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.
431 lines
1.0 MiB
431 lines
1.0 MiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[183,5,7],{"+NIl":function(vt,et,ne){(function(ae){ae(ne("VrN/"))})(function(ae){"use strict";ae.defineMode("stex",function(J,D){"use strict";function Y(u,r){u.cmdState.push(r)}function F(u){return u.cmdState.length>0?u.cmdState[u.cmdState.length-1]:null}function U(u){var r=u.cmdState.pop();r&&r.closeBracket()}function W(u){for(var r=u.cmdState,d=r.length-1;d>=0;d--){var o=r[d];if(o.name=="DEFAULT")continue;return o}return{styleIdentifier:function(){return null}}}function j(u,r,d){return function(){this.name=u,this.bracketNo=0,this.style=r,this.styles=d,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var k={};k.importmodule=j("importmodule","tag",["string","builtin"]),k.documentclass=j("documentclass","tag",["","atom"]),k.usepackage=j("usepackage","tag",["atom"]),k.begin=j("begin","tag",["atom"]),k.end=j("end","tag",["atom"]),k.label=j("label","tag",["atom"]),k.ref=j("ref","tag",["atom"]),k.eqref=j("eqref","tag",["atom"]),k.cite=j("cite","tag",["atom"]),k.bibitem=j("bibitem","tag",["atom"]),k.Bibitem=j("Bibitem","tag",["atom"]),k.RBibitem=j("RBibitem","tag",["atom"]),k.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function I(u,r){u.f=r}function m(u,r){var d;if(u.match(/^\\[a-zA-Z@]+/)){var o=u.current().slice(1);return d=k.hasOwnProperty(o)?k[o]:k.DEFAULT,d=new d,Y(r,d),I(r,f),d.style}if(u.match(/^\\[$&%#{}_]/))return"tag";if(u.match(/^\\[,;!\/\\]/))return"tag";if(u.match("\\["))return I(r,function(l,p){return c(l,p,"\\]")}),"keyword";if(u.match("\\("))return I(r,function(l,p){return c(l,p,"\\)")}),"keyword";if(u.match("$$"))return I(r,function(l,p){return c(l,p,"$$")}),"keyword";if(u.match("$"))return I(r,function(l,p){return c(l,p,"$")}),"keyword";var s=u.next();if(s=="%")return u.skipToEnd(),"comment";if(s=="}"||s=="]"){if(d=F(r),d)d.closeBracket(s),I(r,f);else return"error";return"bracket"}else return s=="{"||s=="["?(d=k.DEFAULT,d=new d,Y(r,d),"bracket"):/\d/.test(s)?(u.eatWhile(/[\w.%]/),"atom"):(u.eatWhile(/[\w\-_]/),d=W(r),d.name=="begin"&&(d.argument=u.current()),d.styleIdentifier())}function c(u,r,d){if(u.eatSpace())return null;if(d&&u.match(d))return I(r,m),"keyword";if(u.match(/^\\[a-zA-Z@]+/))return"tag";if(u.match(/^[a-zA-Z]+/))return"variable-2";if(u.match(/^\\[$&%#{}_]/))return"tag";if(u.match(/^\\[,;!\/]/))return"tag";if(u.match(/^[\^_&]/))return"tag";if(u.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(u.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var o=u.next();return o=="{"||o=="}"||o=="["||o=="]"||o=="("||o==")"?"bracket":o=="%"?(u.skipToEnd(),"comment"):"error"}function f(u,r){var d=u.peek(),o;return d=="{"||d=="["?(o=F(r),o.openBracket(d),u.eat(d),I(r,m),"bracket"):/[ \t\r]/.test(d)?(u.eat(d),null):(I(r,m),U(r),m(u,r))}return{startState:function(){var u=D.inMathMode?function(r,d){return c(r,d)}:m;return{cmdState:[],f:u}},copyState:function(u){return{cmdState:u.cmdState.slice(),f:u.f}},token:function(u,r){return r.f(u,r)},blankLine:function(u){u.f=m,u.cmdState.length=0},lineComment:"%"}}),ae.defineMIME("text/x-stex","stex"),ae.defineMIME("text/x-latex","stex")})},"+ua5":function(vt,et,ne){},"19Vz":function(vt,et,ne){(function(ae){ae(ne("VrN/"))})(function(ae){ae.defineOption("placeholder","",function(j,k,I){var m=I&&I!=ae.Init;if(k&&!m)j.on("blur",F),j.on("change",U),j.on("swapDoc",U),ae.on(j.getInputField(),"compositionupdate",j.state.placeholderCompose=function(){Y(j)}),U(j);else if(!k&&m){j.off("blur",F),j.off("change",U),j.off("swapDoc",U),ae.off(j.getInputField(),"compositionupdate",j.state.placeholderCompose),J(j);var c=j.getWrapperElement();c.className=c.className.replace(" CodeMirror-empty","")}k&&!j.hasFocus()&&F(j)});function J(j){j.state.placeholder&&(j.state.placeholder.parentNode.removeChild(j.state.placeholder),j.state.placeholder=null)}function D(j){J(j);var k=j.state.placeholder=document.createElement("pre");k.style.cssText="height: 0; overflow: visible",k.style.direction=j.getOption("direction"),k.className="CodeMirror-placeholder CodeMirror-line-like";var I=j.getOption("placeholder");typeof I=="string"&&(I=document.createTextNode(I)),k.appendChild(I),j.display.lineSpace.insertBefore(k,j.display.lineSpace.firstChild)}function Y(j){setTimeout(function(){var k=!1,I=j.getInputField();I.nodeName=="TEXTAREA"?k=!I.value:j.lineCount()==1&&(k=!/[^\u200b]/.test(I.querySelector(".CodeMirror-line").textContent)),k?D(j):J(j)},20)}function F(j){W(j)&&D(j)}function U(j){var k=j.getWrapperElement(),I=W(j);k.className=k.className.replace(" CodeMirror-empty","")+(I?" CodeMirror-empty":""),I?D(j):J(j)}function W(j){return j.lineCount()===1&&j.getLine(0)===""}})},"1eCo":function(vt,et,ne){(function(ae){ae(ne("VrN/"))})(function(ae){"use strict";var J={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ae.defineMode("xml",function(Y,F){var U=Y.indentUnit,W={},j=F.htmlMode?J:D;for(var k in j)W[k]=j[k];for(var k in F)W[k]=F[k];var I,m;function c(h,_){function g(P){return _.tokenize=P,P(h,_)}var b=h.next();if(b=="<")return h.eat("!")?h.eat("[")?h.match("CDATA[")?g(r("atom","]]>")):null:h.match("--")?g(r("comment","-->")):h.match("DOCTYPE",!0,!0)?(h.eatWhile(/[\w\._\-]/),g(d(1))):null:h.eat("?")?(h.eatWhile(/[\w\._\-]/),_.tokenize=r("meta","?>"),"meta"):(I=h.eat("/")?"closeTag":"openTag",_.tokenize=f,"tag bracket");if(b=="&"){var M;return h.eat("#")?h.eat("x")?M=h.eatWhile(/[a-fA-F\d]/)&&h.eat(";"):M=h.eatWhile(/[\d]/)&&h.eat(";"):M=h.eatWhile(/[\w\.\-:]/)&&h.eat(";"),M?"atom":"error"}else return h.eatWhile(/[^&<]/),null}c.isInText=!0;function f(h,_){var g=h.next();if(g==">"||g=="/"&&h.eat(">"))return _.tokenize=c,I=g==">"?"endTag":"selfcloseTag","tag bracket";if(g=="=")return I="equals",null;if(g=="<"){_.tokenize=c,_.state=p,_.tagName=_.tagStart=null;var b=_.tokenize(h,_);return b?b+" tag error":"tag error"}else return/[\'\"]/.test(g)?(_.tokenize=u(g),_.stringStartCol=h.column(),_.tokenize(h,_)):(h.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function u(h){var _=function(g,b){for(;!g.eol();)if(g.next()==h){b.tokenize=f;break}return"string"};return _.isInAttribute=!0,_}function r(h,_){return function(g,b){for(;!g.eol();){if(g.match(_)){b.tokenize=c;break}g.next()}return h}}function d(h){return function(_,g){for(var b;(b=_.next())!=null;){if(b=="<")return g.tokenize=d(h+1),g.tokenize(_,g);if(b==">")if(h==1){g.tokenize=c;break}else return g.tokenize=d(h-1),g.tokenize(_,g)}return"meta"}}function o(h,_,g){this.prev=h.context,this.tagName=_,this.indent=h.indented,this.startOfLine=g,(W.doNotIndent.hasOwnProperty(_)||h.context&&h.context.noIndent)&&(this.noIndent=!0)}function s(h){h.context&&(h.context=h.context.prev)}function l(h,_){for(var g;;){if(!h.context)return;if(g=h.context.tagName,!W.contextGrabbers.hasOwnProperty(g)||!W.contextGrabbers[g].hasOwnProperty(_))return;s(h)}}function p(h,_,g){return h=="openTag"?(g.tagStart=_.column(),R):h=="closeTag"?w:p}function R(h,_,g){return h=="word"?(g.tagName=_.current(),m="tag",A):W.allowMissingTagName&&h=="endTag"?(m="tag bracket",A(h,_,g)):(m="error",R)}function w(h,_,g){if(h=="word"){var b=_.current();return g.context&&g.context.tagName!=b&&W.implicitlyClosed.hasOwnProperty(g.context.tagName)&&s(g),g.context&&g.context.tagName==b||W.matchClosing===!1?(m="tag",x):(m="tag error",O)}else return W.allowMissingTagName&&h=="endTag"?(m="tag bracket",x(h,_,g)):(m="error",O)}function x(h,_,g){return h!="endTag"?(m="error",x):(s(g),p)}function O(h,_,g){return m="error",x(h,_,g)}function A(h,_,g){if(h=="word")return m="attribute",T;if(h=="endTag"||h=="selfcloseTag"){var b=g.tagName,M=g.tagStart;return g.tagName=g.tagStart=null,h=="selfcloseTag"||W.autoSelfClosers.hasOwnProperty(b)?l(g,b):(l(g,b),g.context=new o(g,b,M==g.indented)),p}return m="error",A}function T(h,_,g){return h=="equals"?E:(W.allowMissing||(m="error"),A(h,_,g))}function E(h,_,g){return h=="string"?y:h=="word"&&W.allowUnquoted?(m="string",A):(m="error",A(h,_,g))}function y(h,_,g){return h=="string"?y:A(h,_,g)}return{startState:function(h){var _={tokenize:c,state:p,indented:h||0,tagName:null,tagStart:null,context:null};return h!=null&&(_.baseIndent=h),_},token:function(h,_){if(!_.tagName&&h.sol()&&(_.indented=h.indentation()),h.eatSpace())return null;I=null;var g=_.tokenize(h,_);return(g||I)&&g!="comment"&&(m=null,_.state=_.state(I||g,h,_),m&&(g=m=="error"?g+" error":m)),g},indent:function(h,_,g){var b=h.context;if(h.tokenize.isInAttribute)return h.tagStart==h.indented?h.stringStartCol+1:h.indented+U;if(b&&b.noIndent)return ae.Pass;if(h.tokenize!=f&&h.tokenize!=c)return g?g.match(/^(\s*)/)[0].length:0;if(h.tagName)return W.multilineTagIndentPastTag!==!1?h.tagStart+h.tagName.length+2:h.tagStart+U*(W.multilineTagIndentFactor||1);if(W.alignCDATA&&/<!\[CDATA\[/.test(_))return 0;var M=_&&/^<(\/)?([\w_:\.-]*)/.exec(_);if(M&&M[1])for(;b;)if(b.tagName==M[2]){b=b.prev;break}else if(W.implicitlyClosed.hasOwnProperty(b.tagName))b=b.prev;else break;else if(M)for(;b;){var P=W.contextGrabbers[b.tagName];if(P&&P.hasOwnProperty(M[2]))b=b.prev;else break}for(;b&&b.prev&&!b.startOfLine;)b=b.prev;return b?b.indent+U:h.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:W.htmlMode?"html":"xml",helperType:W.htmlMode?"html":"xml",skipAttribute:function(h){h.state==E&&(h.state=A)},xmlCurrentTag:function(h){return h.tagName?{name:h.tagName,close:h.type=="closeTag"}:null},xmlCurrentContext:function(h){for(var _=[],g=h.context;g;g=g.prev)g.tagName&&_.push(g.tagName);return _.reverse()}}}),ae.defineMIME("text/xml","xml"),ae.defineMIME("application/xml","xml"),ae.mimeModes.hasOwnProperty("text/html")||ae.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"30zm":function(vt,et,ne){"use strict";var ae=ne("jCWc"),J=ne("kPKH"),D=ne("k1fw"),Y=ne("tJVT"),F=ne("PpiC"),U=ne("B9cy"),W=ne("Ol7k"),j=ne("lUTK"),k=ne("BvKs"),I=ne("q1tI"),m=ne.n(I),c=ne("Ty5D"),f=ne("55Ip"),u=ne("9kvl"),r=ne("m3rI"),d=ne("kzJb"),o=ne.n(d),s=k.a.SubMenu,l=W.a.Sider,p=W.a.Content,R=function(x){var O=x.messages,A=x.globalSetting,T=x.loading,E=x.user,y=x.dispatch,h=Object(F.a)(x,["messages","globalSetting","loading","user","dispatch"]),_=Object(c.i)(),g=E.userInfo,b=Object(c.h)(),M=O.tidingsList,P=O.privateMessage,K=O.unreadInfo,V=Object(I.useState)({per_page:10,page:1}),B=Object(Y.a)(V,2),C=B[0],$=B[1];Object(I.useEffect)(function(){ee()},[_.userId]);var ee=function(){y({type:"messages/unreadMessageInfo",payload:Object(D.a)(Object(D.a)({},C),_)})};return m.a.createElement(J.a,{flex:"264px"},m.a.createElement("aside",{className:o.a.userInfo},m.a.createElement("img",{className:"mt40",src:r.a.IMG_SERVER+"/images/"+(g==null?void 0:g.image_url)}),m.a.createElement("p",{className:"font24 mt10"},g==null?void 0:g.username),m.a.createElement("p",{className:"mt20"},g==null?void 0:g.user_identity)),m.a.createElement("ul",{className:o.a.navInfo},m.a.createElement(f.a,{to:"/messages/".concat(g==null?void 0:g.login,"/user_tidings")},m.a.createElement("li",{className:b.pathname.indexOf("user_tidings")>-1&&o.a.actived},"\u6D88\u606F",!!(K!=null&&K.unread_tiding_count)&&m.a.createElement("span",{className:o.a.newTip},K==null?void 0:K.unread_tiding_count))),m.a.createElement(f.a,{to:"/messages/".concat(g==null?void 0:g.login,"/private_messages")},m.a.createElement("li",{className:(b.pathname.indexOf("private_messages")>-1||b.pathname.indexOf("message_detail")>-1)&&o.a.actived},"\u79C1\u4FE1",!!(K!=null&&K.unread_message_count)&&m.a.createElement("span",{className:o.a.newTip},K==null?void 0:K.unread_message_count)))))};et.a=Object(u.a)(function(w){var x=w.messages,O=w.loading,A=w.user,T=w.globalSetting;return{messages:x,globalSetting:T,user:A,loading:O.effects}})(R)},"55Ip":function(vt,et,ne){"use strict";ne.d(et,"a",function(){return l});var ae=ne("Ty5D"),J=ne("dI71"),D=ne("q1tI"),Y=ne.n(D),F=ne("YS25"),U=ne("17x9"),W=ne.n(U),j=ne("wx14"),k=ne("zLVn"),I=ne("9R94"),m=function(E){Object(J.a)(y,E);function y(){for(var _,g=arguments.length,b=new Array(g),M=0;M<g;M++)b[M]=arguments[M];return _=E.call.apply(E,[this].concat(b))||this,_.history=Object(F.a)(_.props),_}var h=y.prototype;return h.render=function(){return Y.a.createElement(ae.c,{history:this.history,children:this.props.children})},y}(Y.a.Component),c=function(E){Object(J.a)(y,E);function y(){for(var _,g=arguments.length,b=new Array(g),M=0;M<g;M++)b[M]=arguments[M];return _=E.call.apply(E,[this].concat(b))||this,_.history=Object(F.b)(_.props),_}var h=y.prototype;return h.render=function(){return Y.a.createElement(ae.c,{history:this.history,children:this.props.children})},y}(Y.a.Component),f=function(y,h){return typeof y=="function"?y(h):y},u=function(y,h){return typeof y=="string"?Object(F.c)(y,null,null,h):y},r=function(y){return y},d=Y.a.forwardRef;typeof d=="undefined"&&(d=r);function o(E){return!!(E.metaKey||E.altKey||E.ctrlKey||E.shiftKey)}var s=d(function(E,y){var h=E.innerRef,_=E.navigate,g=E.onClick,b=Object(k.a)(E,["innerRef","navigate","onClick"]),M=b.target,P=Object(j.a)({},b,{onClick:function(V){try{g&&g(V)}catch(B){throw V.preventDefault(),B}!V.defaultPrevented&&V.button===0&&(!M||M==="_self")&&!o(V)&&(V.preventDefault(),_())}});return r!==d?P.ref=y||h:P.ref=h,Y.a.createElement("a",P)}),l=d(function(E,y){var h=E.component,_=h===void 0?s:h,g=E.replace,b=E.to,M=E.innerRef,P=Object(k.a)(E,["component","replace","to","innerRef"]);return Y.a.createElement(ae.e.Consumer,null,function(K){K||Object(I.a)(!1);var V=K.history,B=u(f(b,K.location),K.location),C=B?V.createHref(B):"",$=Object(j.a)({},P,{href:C,navigate:function(){var re=f(b,K.location),ue=g?V.replace:V.push;ue(re)}});return r!==d?$.ref=y||M:$.innerRef=M,Y.a.createElement(_,$)})});if(!1)var p,R;var w=function(y){return y},x=Y.a.forwardRef;typeof x=="undefined"&&(x=w);function O(){for(var E=arguments.length,y=new Array(E),h=0;h<E;h++)y[h]=arguments[h];return y.filter(function(_){return _}).join(" ")}var A=x(function(E,y){var h=E["aria-current"],_=h===void 0?"page":h,g=E.activeClassName,b=g===void 0?"active":g,M=E.activeStyle,P=E.className,K=E.exact,V=E.isActive,B=E.location,C=E.sensitive,$=E.strict,ee=E.style,re=E.to,ue=E.innerRef,Te=Object(k.a)(E,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return Y.a.createElement(ae.e.Consumer,null,function(ye){ye||Object(I.a)(!1);var be=B||ye.location,we=u(f(re,be),be),xe=we.pathname,me=xe&&xe.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),se=me?Object(ae.f)(be.pathname,{path:me,exact:K,sensitive:C,strict:$}):null,Re=!!(V?V(se,be):se),ze=Re?O(P,b):P,He=Re?Object(j.a)({},ee,{},M):ee,rt=Object(j.a)({"aria-current":Re&&_||null,className:ze,style:He,to:we},Te);return w!==x?rt.ref=y||ue:rt.innerRef=ue,Y.a.createElement(l,rt)})});if(!1)var T},"5VLF":function(vt,et,ne){"use strict";var ae,J;function D(Y,F,U){var W=function(j,k){return Y.js_beautify(j,k)};return W.js=Y.js_beautify,W.css=F.css_beautify,W.html=U.html_beautify,W.js_beautify=Y.js_beautify,W.css_beautify=F.css_beautify,W.html_beautify=U.html_beautify,W}!(ae=[ne("6UM0"),ne("TXwP"),ne("psGv")],J=function(Y,F,U){return D(Y,F,U)}.apply(et,ae),J!==void 0&&(vt.exports=J))},"6UM0":function(vt,et,ne){var ae,J;(function(){var D;(function(){"use strict";var F=[function(k,I,m){var c=m(1).Beautifier,f=m(5).Options;function u(r,d){var o=new c(r,d);return o.beautify()}k.exports=u,k.exports.defaultOptions=function(){return new f}},function(k,I,m){var c=m(2).Output,f=m(3).Token,u=m(4),r=m(5).Options,d=m(7).Tokenizer,o=m(7).line_starters,s=m(7).positionable_operators,l=m(7).TOKEN;function p(C,$){return $.indexOf(C)!==-1}function R(C){return C.replace(/^\s+/g,"")}function w(C){for(var $={},ee=0;ee<C.length;ee++)$[C[ee].replace(/-/g,"_")]=C[ee];return $}function x(C,$){return C&&C.type===l.RESERVED&&C.text===$}function O(C,$){return C&&C.type===l.RESERVED&&p(C.text,$)}var A=["case","return","do","if","throw","else","await","break","continue","async"],T=["before-newline","after-newline","preserve-newline"],E=w(T),y=[E.before_newline,E.preserve_newline],h={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function _(C,$){if($.multiline_frame||$.mode===h.ForInitializer||$.mode===h.Conditional)return;C.remove_indent($.start_line_index)}function g(C){C=C.replace(u.allLineBreaks,`
|
|
`);for(var $=[],ee=C.indexOf(`
|
|
`);ee!==-1;)$.push(C.substring(0,ee)),C=C.substring(ee+1),ee=C.indexOf(`
|
|
`);return C.length&&$.push(C),$}function b(C){return C===h.ArrayLiteral}function M(C){return p(C,[h.Expression,h.ForInitializer,h.Conditional])}function P(C,$){for(var ee=0;ee<C.length;ee++){var re=C[ee].trim();if(re.charAt(0)!==$)return!1}return!0}function K(C,$){for(var ee=0,re=C.length,ue;ee<re;ee++)if(ue=C[ee],ue&&ue.indexOf($)!==0)return!1;return!0}function V(C,$){$=$||{},this._source_text=C||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new r($)}V.prototype.create_flags=function(C,$){var ee=0;C&&(ee=C.indentation_level,!this._output.just_added_newline()&&C.line_indent_level>ee&&(ee=C.line_indent_level));var re={mode:$,parent:C,last_token:C?C.last_token:new f(l.START_BLOCK,""),last_word:C?C.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,class_start_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,case_block:!1,indentation_level:ee,alignment:0,line_indent_level:C?C.line_indent_level:ee,start_line_index:this._output.get_line_number(),ternary_depth:0};return re},V.prototype._reset=function(C){var $=C.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new c(this._options,$),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(h.BlockStatement);var ee=new d(C,this._options);return this._tokens=ee.tokenize(),C},V.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var C,$=this._reset(this._source_text),ee=this._options.eol;this._options.eol==="auto"&&(ee=`
|
|
`,$&&u.lineBreak.test($||"")&&(ee=$.match(u.lineBreak)[0]));for(var re=this._tokens.next();re;)this.handle_token(re),this._last_last_text=this._flags.last_token.text,this._flags.last_token=re,re=this._tokens.next();return C=this._output.get_code(ee),C},V.prototype.handle_token=function(C,$){C.type===l.START_EXPR?this.handle_start_expr(C):C.type===l.END_EXPR?this.handle_end_expr(C):C.type===l.START_BLOCK?this.handle_start_block(C):C.type===l.END_BLOCK?this.handle_end_block(C):C.type===l.WORD?this.handle_word(C):C.type===l.RESERVED?this.handle_word(C):C.type===l.SEMICOLON?this.handle_semicolon(C):C.type===l.STRING?this.handle_string(C):C.type===l.EQUALS?this.handle_equals(C):C.type===l.OPERATOR?this.handle_operator(C):C.type===l.COMMA?this.handle_comma(C):C.type===l.BLOCK_COMMENT?this.handle_block_comment(C,$):C.type===l.COMMENT?this.handle_comment(C,$):C.type===l.DOT?this.handle_dot(C):C.type===l.EOF?this.handle_eof(C):C.type===l.UNKNOWN?this.handle_unknown(C,$):this.handle_unknown(C,$)},V.prototype.handle_whitespace_and_comments=function(C,$){var ee=C.newlines,re=this._options.keep_array_indentation&&b(this._flags.mode);if(C.comments_before)for(var ue=C.comments_before.next();ue;)this.handle_whitespace_and_comments(ue,$),this.handle_token(ue,$),ue=C.comments_before.next();if(re)for(var Te=0;Te<ee;Te+=1)this.print_newline(Te>0,$);else if(this._options.max_preserve_newlines&&ee>this._options.max_preserve_newlines&&(ee=this._options.max_preserve_newlines),this._options.preserve_newlines&&ee>1){this.print_newline(!1,$);for(var ye=1;ye<ee;ye+=1)this.print_newline(!0,$)}};var B=["async","break","continue","return","throw","yield"];V.prototype.allow_wrap_or_preserved_newline=function(C,$){if($=$===void 0?!1:$,this._output.just_added_newline())return;var ee=this._options.preserve_newlines&&C.newlines||$,re=p(this._flags.last_token.text,s)||p(C.text,s);if(re){var ue=p(this._flags.last_token.text,s)&&p(this._options.operator_position,y)||p(C.text,s);ee=ee&&ue}if(ee)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(O(this._flags.last_token,B))return;this._output.set_wrap_point()}},V.prototype.print_newline=function(C,$){if(!$&&(this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==l.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")))for(var ee=this._tokens.peek();this._flags.mode===h.Statement&&!(this._flags.if_block&&x(ee,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(C)&&(this._flags.multiline_frame=!0)},V.prototype.print_token_line_indentation=function(C){this._output.just_added_newline()&&(this._options.keep_array_indentation&&C.newlines&&(C.text==="["||b(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(C.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},V.prototype.print_token=function(C){if(this._output.raw){this._output.add_raw_token(C);return}if(this._options.comma_first&&C.previous&&C.previous.type===l.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var $=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push($),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(C),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(C),this._output.non_breaking_space=!0,this._output.add_token(C.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},V.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},V.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},V.prototype.set_mode=function(C){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,C),this._flags=this.create_flags(this._previous_flags,C),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},V.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===h.Statement&&_(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},V.prototype.start_of_object_property=function(){return this._flags.parent.mode===h.ObjectLiteral&&this._flags.mode===h.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||O(this._flags.last_token,["get","set"]))},V.prototype.start_of_statement=function(C){var $=!1;return $=$||O(this._flags.last_token,["var","let","const"])&&C.type===l.WORD,$=$||x(this._flags.last_token,"do"),$=$||!(this._flags.parent.mode===h.ObjectLiteral&&this._flags.mode===h.Statement)&&O(this._flags.last_token,B)&&!C.newlines,$=$||x(this._flags.last_token,"else")&&!(x(C,"if")&&!C.comments_before),$=$||this._flags.last_token.type===l.END_EXPR&&(this._previous_flags.mode===h.ForInitializer||this._previous_flags.mode===h.Conditional),$=$||this._flags.last_token.type===l.WORD&&this._flags.mode===h.BlockStatement&&!this._flags.in_case&&!(C.text==="--"||C.text==="++")&&this._last_last_text!=="function"&&C.type!==l.WORD&&C.type!==l.RESERVED,$=$||this._flags.mode===h.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||O(this._flags.last_token,["get","set"])),$?(this.set_mode(h.Statement),this.indent(),this.handle_whitespace_and_comments(C,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(C,O(C,["do","for","if","while"])),!0):!1},V.prototype.handle_start_expr=function(C){this.start_of_statement(C)||this.handle_whitespace_and_comments(C);var $=h.Expression;if(C.text==="["){if(this._flags.last_token.type===l.WORD||this._flags.last_token.text===")"){O(this._flags.last_token,o)&&(this._output.space_before_token=!0),this.print_token(C),this.set_mode($),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}$=h.ArrayLiteral,b(this._flags.mode)&&((this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}"))&&(this._options.keep_array_indentation||this.print_newline())),p(this._flags.last_token.type,[l.START_EXPR,l.END_EXPR,l.WORD,l.OPERATOR,l.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===l.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,$=h.ForInitializer):p(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,$=h.Conditional):p(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&C.whitespace_before===""?this._output.space_before_token=!1:(p(this._flags.last_token.text,o)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===l.EQUALS||this._flags.last_token.type===l.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(C);else if(this._flags.last_token.type===l.WORD){this._output.space_before_token=!1;var ee=this._tokens.peek(-3);if(this._options.space_after_named_function&&ee){var re=this._tokens.peek(-4);O(ee,["async","function"])||ee.text==="*"&&O(re,["async","function"])?this._output.space_before_token=!0:this._flags.mode===h.ObjectLiteral?(ee.text==="{"||ee.text===","||ee.text==="*"&&(re.text==="{"||re.text===","))&&(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(C);(this._flags.last_token.type===l.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(p(this._last_last_text,["function","yield"])||this._flags.mode===h.ObjectLiteral&&p(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===l.START_BLOCK?this.print_newline():(this._flags.last_token.type===l.END_EXPR||this._flags.last_token.type===l.START_EXPR||this._flags.last_token.type===l.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===l.COMMA)&&this.allow_wrap_or_preserved_newline(C,C.newlines),this.print_token(C),this.set_mode($),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},V.prototype.handle_end_expr=function(C){for(;this._flags.mode===h.Statement;)this.restore_mode();this.handle_whitespace_and_comments(C),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(C,C.text==="]"&&b(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===l.START_EXPR&&!this._options.space_in_empty_paren?(this._output.trim(),this._output.space_before_token=!1):this._output.space_before_token=!0),this.deindent(),this.print_token(C),this.restore_mode(),_(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===h.Conditional&&(this._previous_flags.mode=h.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},V.prototype.handle_start_block=function(C){this.handle_whitespace_and_comments(C);var $=this._tokens.peek(),ee=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===l.END_EXPR?(this.set_mode(h.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(h.BlockStatement):ee&&(p(ee.text,[":",","])&&p($.type,[l.STRING,l.WORD,l.RESERVED])||p($.text,["get","set","..."])&&p(ee.type,[l.WORD,l.RESERVED]))?p(this._last_last_text,["class","interface"])&&!p(ee.text,[":",","])?this.set_mode(h.BlockStatement):this.set_mode(h.ObjectLiteral):this._flags.last_token.type===l.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(h.BlockStatement):p(this._flags.last_token.type,[l.EQUALS,l.START_EXPR,l.COMMA,l.OPERATOR])||O(this._flags.last_token,["return","throw","import","default"])?this.set_mode(h.ObjectLiteral):this.set_mode(h.BlockStatement),this._flags.last_token&&(O(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var re=!$.comments_before&&$.text==="}",ue=re&&this._flags.last_word==="function"&&this._flags.last_token.type===l.END_EXPR;if(this._options.brace_preserve_inline){var Te=0,ye=null;this._flags.inline_frame=!0;do if(Te+=1,ye=this._tokens.peek(Te-1),ye.newlines){this._flags.inline_frame=!1;break}while(ye.type!==l.EOF&&!(ye.type===l.END_BLOCK&&ye.opened===C))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&C.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==l.OPERATOR&&(ue||this._flags.last_token.type===l.EQUALS||O(this._flags.last_token,A)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(b(this._previous_flags.mode)&&(this._flags.last_token.type===l.START_EXPR||this._flags.last_token.type===l.COMMA)&&((this._flags.last_token.type===l.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===l.COMMA||this._flags.last_token.type===l.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(C),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==l.OPERATOR&&this._flags.last_token.type!==l.START_EXPR&&(this._flags.last_token.type===l.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(C),this.indent(),!re&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},V.prototype.handle_end_block=function(C){for(this.handle_whitespace_and_comments(C);this._flags.mode===h.Statement;)this.restore_mode();var $=this._flags.last_token.type===l.START_BLOCK;this._flags.inline_frame&&!$?this._output.space_before_token=!0:this._options.brace_style==="expand"?$||this.print_newline():$||(b(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(C)},V.prototype.handle_word=function(C){if(C.type===l.RESERVED){if(p(C.text,["set","get"])&&this._flags.mode!==h.ObjectLiteral)C.type=l.WORD;else if(C.text==="import"&&p(this._tokens.peek().text,["(","."]))C.type=l.WORD;else if(p(C.text,["as","from"])&&!this._flags.import_block)C.type=l.WORD;else if(this._flags.mode===h.ObjectLiteral){var $=this._tokens.peek();$.text===":"&&(C.type=l.WORD)}}if(this.start_of_statement(C)?O(this._flags.last_token,["var","let","const"])&&C.type===l.WORD&&(this._flags.declaration_statement=!0):C.newlines&&!M(this._flags.mode)&&(this._flags.last_token.type!==l.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==l.EQUALS&&(this._options.preserve_newlines||!O(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(C),this.print_newline()):this.handle_whitespace_and_comments(C),this._flags.do_block&&!this._flags.do_while)if(x(C,"while")){this._output.space_before_token=!0,this.print_token(C),this._output.space_before_token=!0,this._flags.do_while=!0;return}else this.print_newline(),this._flags.do_block=!1;if(this._flags.if_block)if(!this._flags.else_block&&x(C,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===h.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&O(C,["case","default"])){this.print_newline(),!this._flags.case_block&&(this._flags.case_body||this._options.jslint_happy)&&this.deindent(),this._flags.case_body=!1,this.print_token(C),this._flags.in_case=!0;return}if((this._flags.last_token.type===l.COMMA||this._flags.last_token.type===l.START_EXPR||this._flags.last_token.type===l.EQUALS||this._flags.last_token.type===l.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(C)),x(C,"function")){(p(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(p(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===l.OPERATOR))&&(!this._output.just_added_blankline()&&!C.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===l.RESERVED||this._flags.last_token.type===l.WORD?O(this._flags.last_token,["get","set","new","export"])||O(this._flags.last_token,B)?this._output.space_before_token=!0:x(this._flags.last_token,"default")&&this._last_last_text==="export"?this._output.space_before_token=!0:this._flags.last_token.text==="declare"?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===l.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(M(this._flags.mode)||b(this._flags.mode))||this.print_newline(),this.print_token(C),this._flags.last_word=C.text;return}var ee="NONE";if(this._flags.last_token.type===l.END_BLOCK?this._previous_flags.inline_frame?ee="SPACE":O(C,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&C.newlines?ee="NEWLINE":(ee="SPACE",this._output.space_before_token=!0):ee="NEWLINE":this._flags.last_token.type===l.SEMICOLON&&this._flags.mode===h.BlockStatement?ee="NEWLINE":this._flags.last_token.type===l.SEMICOLON&&M(this._flags.mode)?ee="SPACE":this._flags.last_token.type===l.STRING?ee="NEWLINE":this._flags.last_token.type===l.RESERVED||this._flags.last_token.type===l.WORD||this._flags.last_token.text==="*"&&(p(this._last_last_text,["function","yield"])||this._flags.mode===h.ObjectLiteral&&p(this._last_last_text,["{",","]))?ee="SPACE":this._flags.last_token.type===l.START_BLOCK?this._flags.inline_frame?ee="SPACE":ee="NEWLINE":this._flags.last_token.type===l.END_EXPR&&(this._output.space_before_token=!0,ee="NEWLINE"),O(C,o)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?ee="SPACE":ee="NEWLINE"),O(C,["else","catch","finally"]))if((!(this._flags.last_token.type===l.END_BLOCK&&this._previous_flags.mode===h.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&C.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var re=this._output.current_line;re.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else ee==="NEWLINE"?O(this._flags.last_token,A)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&O(C,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==l.END_EXPR?(this._flags.last_token.type!==l.START_EXPR||!O(C,["var","let","const"]))&&this._flags.last_token.text!==":"&&(x(C,"if")&&x(C.previous,"else")?this._output.space_before_token=!0:this.print_newline()):O(C,o)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&b(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():ee==="SPACE"&&(this._output.space_before_token=!0);C.previous&&(C.previous.type===l.WORD||C.previous.type===l.RESERVED)&&(this._output.space_before_token=!0),this.print_token(C),this._flags.last_word=C.text,C.type===l.RESERVED&&(C.text==="do"?this._flags.do_block=!0:C.text==="if"?this._flags.if_block=!0:C.text==="import"?this._flags.import_block=!0:this._flags.import_block&&x(C,"from")&&(this._flags.import_block=!1))},V.prototype.handle_semicolon=function(C){this.start_of_statement(C)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(C);for(var $=this._tokens.peek();this._flags.mode===h.Statement&&!(this._flags.if_block&&x($,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(C)},V.prototype.handle_string=function(C){C.text.startsWith("`")&&C.newlines===0&&C.whitespace_before===""&&(C.previous.text===")"||this._flags.last_token.type===l.WORD)||(this.start_of_statement(C)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(C),this._flags.last_token.type===l.RESERVED||this._flags.last_token.type===l.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===l.COMMA||this._flags.last_token.type===l.START_EXPR||this._flags.last_token.type===l.EQUALS||this._flags.last_token.type===l.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(C):C.text.startsWith("`")&&this._flags.last_token.type===l.END_EXPR&&(C.previous.text==="]"||C.previous.text===")")&&C.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(C)},V.prototype.handle_equals=function(C){this.start_of_statement(C)||this.handle_whitespace_and_comments(C),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(C),this._output.space_before_token=!0},V.prototype.handle_comma=function(C){this.handle_whitespace_and_comments(C,!0),this.print_token(C),this._output.space_before_token=!0,this._flags.declaration_statement?(M(this._flags.parent.mode)&&(this._flags.declaration_assignment=!1),this._flags.declaration_assignment?(this._flags.declaration_assignment=!1,this.print_newline(!1,!0)):this._options.comma_first&&this.allow_wrap_or_preserved_newline(C)):this._flags.mode===h.ObjectLiteral||this._flags.mode===h.Statement&&this._flags.parent.mode===h.ObjectLiteral?(this._flags.mode===h.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(C)},V.prototype.handle_operator=function(C){var $=C.text==="*"&&(O(this._flags.last_token,["function","yield"])||p(this._flags.last_token.type,[l.START_BLOCK,l.COMMA,l.END_BLOCK,l.SEMICOLON])),ee=p(C.text,["-","+"])&&(p(this._flags.last_token.type,[l.START_BLOCK,l.START_EXPR,l.EQUALS,l.OPERATOR])||p(this._flags.last_token.text,o)||this._flags.last_token.text===",");if(!this.start_of_statement(C)){var re=!$;this.handle_whitespace_and_comments(C,re)}if(C.text==="*"&&this._flags.last_token.type===l.DOT){this.print_token(C);return}if(C.text==="::"){this.print_token(C);return}if(this._flags.last_token.type===l.OPERATOR&&p(this._options.operator_position,y)&&this.allow_wrap_or_preserved_newline(C),C.text===":"&&this._flags.in_case){this.print_token(C),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==l.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0);return}var ue=!0,Te=!0,ye=!1;if(C.text===":"?this._flags.ternary_depth===0?ue=!1:(this._flags.ternary_depth-=1,ye=!0):C.text==="?"&&(this._flags.ternary_depth+=1),!ee&&!$&&this._options.preserve_newlines&&p(C.text,s)){var be=C.text===":",we=be&&ye,xe=be&&!ye;switch(this._options.operator_position){case E.before_newline:this._output.space_before_token=!xe,this.print_token(C),(!be||we)&&this.allow_wrap_or_preserved_newline(C),this._output.space_before_token=!0;return;case E.after_newline:this._output.space_before_token=!0,!be||we?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(C):this._output.space_before_token=!1,this.print_token(C),this._output.space_before_token=!0;return;case E.preserve_newline:xe||this.allow_wrap_or_preserved_newline(C),ue=!(this._output.just_added_newline()||xe),this._output.space_before_token=ue,this.print_token(C),this._output.space_before_token=!0;return}}if($){this.allow_wrap_or_preserved_newline(C),ue=!1;var me=this._tokens.peek();Te=me&&p(me.type,[l.WORD,l.RESERVED])}else if(C.text==="...")this.allow_wrap_or_preserved_newline(C),ue=this._flags.last_token.type===l.START_BLOCK,Te=!1;else if(p(C.text,["--","++","!","~"])||ee){if((this._flags.last_token.type===l.COMMA||this._flags.last_token.type===l.START_EXPR)&&this.allow_wrap_or_preserved_newline(C),ue=!1,Te=!1,C.newlines&&(C.text==="--"||C.text==="++"||C.text==="~")){var se=O(this._flags.last_token,A)&&C.newlines;se&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(se,!0)}this._flags.last_token.text===";"&&M(this._flags.mode)&&(ue=!0),this._flags.last_token.type===l.RESERVED?ue=!0:this._flags.last_token.type===l.END_EXPR?ue=!(this._flags.last_token.text==="]"&&(C.text==="--"||C.text==="++")):this._flags.last_token.type===l.OPERATOR&&(ue=p(C.text,["--","-","++","+"])&&p(this._flags.last_token.text,["--","-","++","+"]),p(C.text,["+","-"])&&p(this._flags.last_token.text,["--","++"])&&(Te=!0)),(this._flags.mode===h.BlockStatement&&!this._flags.inline_frame||this._flags.mode===h.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||ue,this.print_token(C),this._output.space_before_token=Te},V.prototype.handle_block_comment=function(C,$){if(this._output.raw){this._output.add_raw_token(C),C.directives&&C.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(C.directives){this.print_newline(!1,$),this.print_token(C),C.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!u.newline.test(C.text)&&!C.newlines){this._output.space_before_token=!0,this.print_token(C),this._output.space_before_token=!0;return}else this.print_block_commment(C,$)},V.prototype.print_block_commment=function(C,$){var ee=g(C.text),re,ue=!1,Te=!1,ye=C.whitespace_before,be=ye.length;if(this.print_newline(!1,$),this.print_token_line_indentation(C),this._output.add_token(ee[0]),this.print_newline(!1,$),ee.length>1){for(ee=ee.slice(1),ue=P(ee,"*"),Te=K(ee,ye),ue&&(this._flags.alignment=1),re=0;re<ee.length;re++)ue?(this.print_token_line_indentation(C),this._output.add_token(R(ee[re]))):Te&&ee[re]?(this.print_token_line_indentation(C),this._output.add_token(ee[re].substring(be))):(this._output.current_line.set_indent(-1),this._output.add_token(ee[re])),this.print_newline(!1,$);this._flags.alignment=0}},V.prototype.handle_comment=function(C,$){C.newlines?this.print_newline(!1,$):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(C),this.print_newline(!1,$)},V.prototype.handle_dot=function(C){this.start_of_statement(C)||this.handle_whitespace_and_comments(C,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),O(this._flags.last_token,A)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(C,this._flags.last_token.text===")"&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(C)},V.prototype.handle_unknown=function(C,$){this.print_token(C),C.text[C.text.length-1]===`
|
|
`&&this.print_newline(!1,$)},V.prototype.handle_eof=function(C){for(;this._flags.mode===h.Statement;)this.restore_mode();this.handle_whitespace_and_comments(C)},k.exports.Beautifier=V},function(k){function I(f){this.__parent=f,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}I.prototype.clone_empty=function(){var f=new I(this.__parent);return f.set_indent(this.__indent_count,this.__alignment_count),f},I.prototype.item=function(f){return f<0?this.__items[this.__items.length+f]:this.__items[f]},I.prototype.has_match=function(f){for(var u=this.__items.length-1;u>=0;u--)if(this.__items[u].match(f))return!0;return!1},I.prototype.set_indent=function(f,u){this.is_empty()&&(this.__indent_count=f||0,this.__alignment_count=u||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},I.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},I.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},I.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var f=this.__parent.current_line;return f.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),f.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),f.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,f.__items[0]===" "&&(f.__items.splice(0,1),f.__character_count-=1),!0}return!1},I.prototype.is_empty=function(){return this.__items.length===0},I.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},I.prototype.push=function(f){this.__items.push(f);var u=f.lastIndexOf(`
|
|
`);u!==-1?this.__character_count=f.length-u:this.__character_count+=f.length},I.prototype.pop=function(){var f=null;return this.is_empty()||(f=this.__items.pop(),this.__character_count-=f.length),f},I.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},I.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},I.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},I.prototype.toString=function(){var f="";return this.is_empty()?this.__parent.indent_empty_lines&&(f=this.__parent.get_indent_string(this.__indent_count)):(f=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),f+=this.__items.join("")),f};function m(f,u){this.__cache=[""],this.__indent_size=f.indent_size,this.__indent_string=f.indent_char,f.indent_with_tabs||(this.__indent_string=new Array(f.indent_size+1).join(f.indent_char)),u=u||"",f.indent_level>0&&(u=new Array(f.indent_level+1).join(this.__indent_string)),this.__base_string=u,this.__base_string_length=u.length}m.prototype.get_indent_size=function(f,u){var r=this.__base_string_length;return u=u||0,f<0&&(r=0),r+=f*this.__indent_size,r+=u,r},m.prototype.get_indent_string=function(f,u){var r=this.__base_string;return u=u||0,f<0&&(f=0,r=""),u+=f*this.__indent_size,this.__ensure_cache(u),r+=this.__cache[u],r},m.prototype.__ensure_cache=function(f){for(;f>=this.__cache.length;)this.__add_column()},m.prototype.__add_column=function(){var f=this.__cache.length,u=0,r="";this.__indent_size&&f>=this.__indent_size&&(u=Math.floor(f/this.__indent_size),f-=u*this.__indent_size,r=new Array(u+1).join(this.__indent_string)),f&&(r+=new Array(f+1).join(" ")),this.__cache.push(r)};function c(f,u){this.__indent_cache=new m(f,u),this.raw=!1,this._end_with_newline=f.end_with_newline,this.indent_size=f.indent_size,this.wrap_line_length=f.wrap_line_length,this.indent_empty_lines=f.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new I(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}c.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},c.prototype.get_line_number=function(){return this.__lines.length},c.prototype.get_indent_string=function(f,u){return this.__indent_cache.get_indent_string(f,u)},c.prototype.get_indent_size=function(f,u){return this.__indent_cache.get_indent_size(f,u)},c.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},c.prototype.add_new_line=function(f){return this.is_empty()||!f&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},c.prototype.get_code=function(f){this.trim(!0);var u=this.current_line.pop();u&&(u[u.length-1]===`
|
|
`&&(u=u.replace(/\n+$/g,"")),this.current_line.push(u)),this._end_with_newline&&this.__add_outputline();var r=this.__lines.join(`
|
|
`);return f!==`
|
|
`&&(r=r.replace(/[\n]/g,f)),r},c.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},c.prototype.set_indent=function(f,u){return f=f||0,u=u||0,this.next_line.set_indent(f,u),this.__lines.length>1?(this.current_line.set_indent(f,u),!0):(this.current_line.set_indent(),!1)},c.prototype.add_raw_token=function(f){for(var u=0;u<f.newlines;u++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(f.whitespace_before),this.current_line.push(f.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},c.prototype.add_token=function(f){this.__add_space_before_token(),this.current_line.push(f),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},c.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},c.prototype.remove_indent=function(f){for(var u=this.__lines.length;f<u;)this.__lines[f]._remove_indent(),f++;this.current_line._remove_wrap_indent()},c.prototype.trim=function(f){for(f=f===void 0?!1:f,this.current_line.trim();f&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},c.prototype.just_added_newline=function(){return this.current_line.is_empty()},c.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},c.prototype.ensure_empty_line_above=function(f,u){for(var r=this.__lines.length-2;r>=0;){var d=this.__lines[r];if(d.is_empty())break;if(d.item(0).indexOf(f)!==0&&d.item(-1)!==u){this.__lines.splice(r+1,0,new I(this)),this.previous_line=this.__lines[this.__lines.length-2];break}r--}},k.exports.Output=c},function(k){function I(m,c,f,u){this.type=m,this.text=c,this.comments_before=null,this.newlines=f||0,this.whitespace_before=u||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}k.exports.Token=I},function(k,I){var m="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",c="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",f="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",u="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",r="(?:\\\\u[0-9a-fA-F]{4}|["+m+f+"])",d="(?:\\\\u[0-9a-fA-F]{4}|["+c+f+u+"])*";I.identifier=new RegExp(r+d,"g"),I.identifierStart=new RegExp(r),I.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+c+f+u+"])+");var o=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;I.newline=/[\n\r\u2028\u2029]/,I.lineBreak=new RegExp(`\r
|
|
|`+I.newline.source),I.allLineBreaks=new RegExp(I.lineBreak.source,"g")},function(k,I,m){var c=m(6).Options,f=["before-newline","after-newline","preserve-newline"];function u(r){c.call(this,r,"js");var d=this.raw_options.brace_style||null;d==="expand-strict"?this.raw_options.brace_style="expand":d==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var o=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var s=0;s<o.length;s++)o[s]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=o[s];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",f),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}u.prototype=new c,k.exports.Options=u},function(k){function I(f,u){this.raw_options=m(f,u),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}I.prototype._get_array=function(f,u){var r=this.raw_options[f],d=u||[];return typeof r=="object"?r!==null&&typeof r.concat=="function"&&(d=r.concat()):typeof r=="string"&&(d=r.split(/[^a-zA-Z0-9_\/\-]+/)),d},I.prototype._get_boolean=function(f,u){var r=this.raw_options[f],d=r===void 0?!!u:!!r;return d},I.prototype._get_characters=function(f,u){var r=this.raw_options[f],d=u||"";return typeof r=="string"&&(d=r.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),d},I.prototype._get_number=function(f,u){var r=this.raw_options[f];u=parseInt(u,10),isNaN(u)&&(u=0);var d=parseInt(r,10);return isNaN(d)&&(d=u),d},I.prototype._get_selection=function(f,u,r){var d=this._get_selection_list(f,u,r);if(d.length!==1)throw new Error("Invalid Option Value: The option '"+f+`' can only be one of the following values:
|
|
`+u+`
|
|
You passed in: '`+this.raw_options[f]+"'");return d[0]},I.prototype._get_selection_list=function(f,u,r){if(!u||u.length===0)throw new Error("Selection list cannot be empty.");if(r=r||[u[0]],!this._is_valid_selection(r,u))throw new Error("Invalid Default Value!");var d=this._get_array(f,r);if(!this._is_valid_selection(d,u))throw new Error("Invalid Option Value: The option '"+f+`' can contain only the following values:
|
|
`+u+`
|
|
You passed in: '`+this.raw_options[f]+"'");return d},I.prototype._is_valid_selection=function(f,u){return f.length&&u.length&&!f.some(function(r){return u.indexOf(r)===-1})};function m(f,u){var r={};f=c(f);var d;for(d in f)d!==u&&(r[d]=f[d]);if(u&&f[u])for(d in f[u])r[d]=f[u][d];return r}function c(f){var u={},r;for(r in f){var d=r.replace(/-/g,"_");u[d]=f[r]}return u}k.exports.Options=I,k.exports.normalizeOpts=c,k.exports.mergeOpts=m},function(k,I,m){var c=m(8).InputScanner,f=m(9).Tokenizer,u=m(9).TOKEN,r=m(13).Directives,d=m(4),o=m(12).Pattern,s=m(14).TemplatablePattern;function l(P,K){return K.indexOf(P)!==-1}var p={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:u.START,RAW:u.RAW,EOF:u.EOF},R=new r(/\/\*/,/\*\//),w=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,x=/[0-9]/,O=/[^\d\.]/,A=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),T=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";T=T.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),T="\\?\\.(?!\\d) "+T,T=T.replace(/ /g,"|");var E=new RegExp(T),y="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),h=y.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),_=new RegExp("^(?:"+h.join("|")+")$"),g,b=function(P,K){f.call(this,P,K),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var V=new o(this._input),B=new s(this._input).read_options(this._options);this.__patterns={template:B,identifier:B.starting_with(d.identifier).matching(d.identifierMatch),number:V.matching(w),punct:V.matching(E),comment:V.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:V.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:V.matching(/<!--/),html_comment_end:V.matching(/-->/),include:V.starting_with(/#include/).until_after(d.lineBreak),shebang:V.starting_with(/#!/).until_after(d.lineBreak),xml:V.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),single_quote:B.until(/['\\\n\r\u2028\u2029]/),double_quote:B.until(/["\\\n\r\u2028\u2029]/),template_text:B.until(/[`\\$]/),template_expression:B.until(/[`}\\]/)}};b.prototype=new f,b.prototype._is_comment=function(P){return P.type===p.COMMENT||P.type===p.BLOCK_COMMENT||P.type===p.UNKNOWN},b.prototype._is_opening=function(P){return P.type===p.START_BLOCK||P.type===p.START_EXPR},b.prototype._is_closing=function(P,K){return(P.type===p.END_BLOCK||P.type===p.END_EXPR)&&K&&(P.text==="]"&&K.text==="["||P.text===")"&&K.text==="("||P.text==="}"&&K.text==="{")},b.prototype._reset=function(){g=!1},b.prototype._get_next_token=function(P,K){var V=null;this._readWhitespace();var B=this._input.peek();return B===null?this._create_token(p.EOF,""):(V=V||this._read_non_javascript(B),V=V||this._read_string(B),V=V||this._read_word(P),V=V||this._read_singles(B),V=V||this._read_comment(B),V=V||this._read_regexp(B,P),V=V||this._read_xml(B,P),V=V||this._read_punctuation(),V=V||this._create_token(p.UNKNOWN,this._input.next()),V)},b.prototype._read_word=function(P){var K;if(K=this.__patterns.identifier.read(),K!=="")return K=K.replace(d.allLineBreaks,`
|
|
`),!(P.type===p.DOT||P.type===p.RESERVED&&(P.text==="set"||P.text==="get"))&&_.test(K)?(K==="in"||K==="of")&&(P.type===p.WORD||P.type===p.STRING)?this._create_token(p.OPERATOR,K):this._create_token(p.RESERVED,K):this._create_token(p.WORD,K);if(K=this.__patterns.number.read(),K!=="")return this._create_token(p.WORD,K)},b.prototype._read_singles=function(P){var K=null;return P==="("||P==="["?K=this._create_token(p.START_EXPR,P):P===")"||P==="]"?K=this._create_token(p.END_EXPR,P):P==="{"?K=this._create_token(p.START_BLOCK,P):P==="}"?K=this._create_token(p.END_BLOCK,P):P===";"?K=this._create_token(p.SEMICOLON,P):P==="."&&O.test(this._input.peek(1))?K=this._create_token(p.DOT,P):P===","&&(K=this._create_token(p.COMMA,P)),K&&this._input.next(),K},b.prototype._read_punctuation=function(){var P=this.__patterns.punct.read();if(P!=="")return P==="="?this._create_token(p.EQUALS,P):P==="?."?this._create_token(p.DOT,P):this._create_token(p.OPERATOR,P)},b.prototype._read_non_javascript=function(P){var K="";if(P==="#"){if(this._is_first_token()&&(K=this.__patterns.shebang.read(),K))return this._create_token(p.UNKNOWN,K.trim()+`
|
|
`);if(K=this.__patterns.include.read(),K)return this._create_token(p.UNKNOWN,K.trim()+`
|
|
`);P=this._input.next();var V="#";if(this._input.hasNext()&&this._input.testChar(x)){do P=this._input.next(),V+=P;while(this._input.hasNext()&&P!=="#"&&P!=="=");return P==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(V+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(V+="{}",this._input.next(),this._input.next())),this._create_token(p.WORD,V)}this._input.back()}else if(P==="<"&&this._is_first_token()){if(K=this.__patterns.html_comment_start.read(),K){for(;this._input.hasNext()&&!this._input.testChar(d.newline);)K+=this._input.next();return g=!0,this._create_token(p.COMMENT,K)}}else if(g&&P==="-"&&(K=this.__patterns.html_comment_end.read(),K))return g=!1,this._create_token(p.COMMENT,K);return null},b.prototype._read_comment=function(P){var K=null;if(P==="/"){var V="";if(this._input.peek(1)==="*"){V=this.__patterns.block_comment.read();var B=R.get_directives(V);B&&B.ignore==="start"&&(V+=R.readIgnored(this._input)),V=V.replace(d.allLineBreaks,`
|
|
`),K=this._create_token(p.BLOCK_COMMENT,V),K.directives=B}else this._input.peek(1)==="/"&&(V=this.__patterns.comment.read(),K=this._create_token(p.COMMENT,V))}return K},b.prototype._read_string=function(P){if(P==="`"||P==="'"||P==='"'){var K=this._input.next();return this.has_char_escapes=!1,P==="`"?K+=this._read_string_recursive("`",!0,"${"):K+=this._read_string_recursive(P),this.has_char_escapes&&this._options.unescape_strings&&(K=M(K)),this._input.peek()===P&&(K+=this._input.next()),K=K.replace(d.allLineBreaks,`
|
|
`),this._create_token(p.STRING,K)}return null},b.prototype._allow_regexp_or_xml=function(P){return P.type===p.RESERVED&&l(P.text,["return","case","throw","else","do","typeof","yield"])||P.type===p.END_EXPR&&P.text===")"&&P.opened.previous.type===p.RESERVED&&l(P.opened.previous.text,["if","while","for"])||l(P.type,[p.COMMENT,p.START_EXPR,p.START_BLOCK,p.START,p.END_BLOCK,p.OPERATOR,p.EQUALS,p.EOF,p.SEMICOLON,p.COMMA])},b.prototype._read_regexp=function(P,K){if(P==="/"&&this._allow_regexp_or_xml(K)){for(var V=this._input.next(),B=!1,C=!1;this._input.hasNext()&&(B||C||this._input.peek()!==P)&&!this._input.testChar(d.newline);)V+=this._input.peek(),B?B=!1:(B=this._input.peek()==="\\",this._input.peek()==="["?C=!0:this._input.peek()==="]"&&(C=!1)),this._input.next();return this._input.peek()===P&&(V+=this._input.next(),V+=this._input.read(d.identifier)),this._create_token(p.STRING,V)}return null},b.prototype._read_xml=function(P,K){if(this._options.e4x&&P==="<"&&this._allow_regexp_or_xml(K)){var V="",B=this.__patterns.xml.read_match();if(B){for(var C=B[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),$=C.indexOf("{")===0,ee=0;B;){var re=!!B[1],ue=B[2],Te=!!B[B.length-1]||ue.slice(0,8)==="![CDATA[";if(!Te&&(ue===C||$&&ue.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(re?--ee:++ee),V+=B[0],ee<=0)break;B=this.__patterns.xml.read_match()}return B||(V+=this._input.match(/[\s\S]*/g)[0]),V=V.replace(d.allLineBreaks,`
|
|
`),this._create_token(p.STRING,V)}}return null};function M(P){for(var K="",V=0,B=new c(P),C=null;B.hasNext();)if(C=B.match(/([\s]|[^\\]|\\\\)+/g),C&&(K+=C[0]),B.peek()==="\\"){if(B.next(),B.peek()==="x")C=B.match(/x([0-9A-Fa-f]{2})/g);else if(B.peek()==="u")C=B.match(/u([0-9A-Fa-f]{4})/g);else{K+="\\",B.hasNext()&&(K+=B.next());continue}if(!C)return P;if(V=parseInt(C[1],16),V>126&&V<=255&&C[0].indexOf("x")===0)return P;if(V>=0&&V<32){K+="\\"+C[0];continue}else V===34||V===39||V===92?K+="\\"+String.fromCharCode(V):K+=String.fromCharCode(V)}return K}b.prototype._read_string_recursive=function(P,K,V){var B,C;P==="'"?C=this.__patterns.single_quote:P==='"'?C=this.__patterns.double_quote:P==="`"?C=this.__patterns.template_text:P==="}"&&(C=this.__patterns.template_expression);for(var $=C.read(),ee="";this._input.hasNext();){if(ee=this._input.next(),ee===P||!K&&d.newline.test(ee)){this._input.back();break}else ee==="\\"&&this._input.hasNext()?(B=this._input.peek(),B==="x"||B==="u"?this.has_char_escapes=!0:B==="\r"&&this._input.peek(1)===`
|
|
`&&this._input.next(),ee+=this._input.next()):V&&(V==="${"&&ee==="$"&&this._input.peek()==="{"&&(ee+=this._input.next()),V===ee&&(P==="`"?ee+=this._read_string_recursive("}",K,"`"):ee+=this._read_string_recursive("`",K,"${"),this._input.hasNext()&&(ee+=this._input.next())));ee+=C.read(),$+=ee}return $},k.exports.Tokenizer=b,k.exports.TOKEN=p,k.exports.positionable_operators=A.slice(),k.exports.line_starters=y.slice()},function(k){var I=RegExp.prototype.hasOwnProperty("sticky");function m(c){this.__input=c||"",this.__input_length=this.__input.length,this.__position=0}m.prototype.restart=function(){this.__position=0},m.prototype.back=function(){this.__position>0&&(this.__position-=1)},m.prototype.hasNext=function(){return this.__position<this.__input_length},m.prototype.next=function(){var c=null;return this.hasNext()&&(c=this.__input.charAt(this.__position),this.__position+=1),c},m.prototype.peek=function(c){var f=null;return c=c||0,c+=this.__position,c>=0&&c<this.__input_length&&(f=this.__input.charAt(c)),f},m.prototype.__match=function(c,f){c.lastIndex=f;var u=c.exec(this.__input);return u&&!(I&&c.sticky)&&(u.index!==f&&(u=null)),u},m.prototype.test=function(c,f){return f=f||0,f+=this.__position,f>=0&&f<this.__input_length?!!this.__match(c,f):!1},m.prototype.testChar=function(c,f){var u=this.peek(f);return c.lastIndex=0,u!==null&&c.test(u)},m.prototype.match=function(c){var f=this.__match(c,this.__position);return f?this.__position+=f[0].length:f=null,f},m.prototype.read=function(c,f,u){var r="",d;return c&&(d=this.match(c),d&&(r+=d[0])),f&&(d||!c)&&(r+=this.readUntil(f,u)),r},m.prototype.readUntil=function(c,f){var u="",r=this.__position;c.lastIndex=this.__position;var d=c.exec(this.__input);return d?(r=d.index,f&&(r+=d[0].length)):r=this.__input_length,u=this.__input.substring(this.__position,r),this.__position=r,u},m.prototype.readUntilAfter=function(c){return this.readUntil(c,!0)},m.prototype.get_regexp=function(c,f){var u=null,r="g";return f&&I&&(r="y"),typeof c=="string"&&c!==""?u=new RegExp(c,r):c&&(u=new RegExp(c.source,r)),u},m.prototype.get_literal_regexp=function(c){return RegExp(c.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},m.prototype.peekUntilAfter=function(c){var f=this.__position,u=this.readUntilAfter(c);return this.__position=f,u},m.prototype.lookBack=function(c){var f=this.__position-1;return f>=c.length&&this.__input.substring(f-c.length,f).toLowerCase()===c},k.exports.InputScanner=m},function(k,I,m){var c=m(8).InputScanner,f=m(3).Token,u=m(10).TokenStream,r=m(11).WhitespacePattern,d={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},o=function(s,l){this._input=new c(s),this._options=l||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new r(this._input)};o.prototype.tokenize=function(){this._input.restart(),this.__tokens=new u,this._reset();for(var s,l=new f(d.START,""),p=null,R=[],w=new u;l.type!==d.EOF;){for(s=this._get_next_token(l,p);this._is_comment(s);)w.add(s),s=this._get_next_token(l,p);w.isEmpty()||(s.comments_before=w,w=new u),s.parent=p,this._is_opening(s)?(R.push(p),p=s):p&&this._is_closing(s,p)&&(s.opened=p,p.closed=s,p=R.pop(),s.parent=p),s.previous=l,l.next=s,this.__tokens.add(s),l=s}return this.__tokens},o.prototype._is_first_token=function(){return this.__tokens.isEmpty()},o.prototype._reset=function(){},o.prototype._get_next_token=function(s,l){this._readWhitespace();var p=this._input.read(/.+/g);return p?this._create_token(d.RAW,p):this._create_token(d.EOF,"")},o.prototype._is_comment=function(s){return!1},o.prototype._is_opening=function(s){return!1},o.prototype._is_closing=function(s,l){return!1},o.prototype._create_token=function(s,l){var p=new f(s,l,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return p},o.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},k.exports.Tokenizer=o,k.exports.TOKEN=d},function(k){function I(m){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=m}I.prototype.restart=function(){this.__position=0},I.prototype.isEmpty=function(){return this.__tokens_length===0},I.prototype.hasNext=function(){return this.__position<this.__tokens_length},I.prototype.next=function(){var m=null;return this.hasNext()&&(m=this.__tokens[this.__position],this.__position+=1),m},I.prototype.peek=function(m){var c=null;return m=m||0,m+=this.__position,m>=0&&m<this.__tokens_length&&(c=this.__tokens[m]),c},I.prototype.add=function(m){this.__parent_token&&(m.parent=this.__parent_token),this.__tokens.push(m),this.__tokens_length+=1},k.exports.TokenStream=I},function(k,I,m){var c=m(12).Pattern;function f(u,r){c.call(this,u,r),r?this._line_regexp=this._input.get_regexp(r._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}f.prototype=new c,f.prototype.__set_whitespace_patterns=function(u,r){u+="\\t ",r+="\\n\\r",this._match_pattern=this._input.get_regexp("["+u+r+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+r+"]")},f.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var u=this._input.read(this._match_pattern);if(u===" ")this.whitespace_before_token=" ";else if(u){var r=this.__split(this._newline_regexp,u);this.newline_count=r.length-1,this.whitespace_before_token=r[this.newline_count]}return u},f.prototype.matching=function(u,r){var d=this._create();return d.__set_whitespace_patterns(u,r),d._update(),d},f.prototype._create=function(){return new f(this._input,this)},f.prototype.__split=function(u,r){u.lastIndex=0;for(var d=0,o=[],s=u.exec(r);s;)o.push(r.substring(d,s.index)),d=s.index+s[0].length,s=u.exec(r);return d<r.length?o.push(r.substring(d,r.length)):o.push(""),o},k.exports.WhitespacePattern=f},function(k){function I(m,c){this._input=m,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,c&&(this._starting_pattern=this._input.get_regexp(c._starting_pattern,!0),this._match_pattern=this._input.get_regexp(c._match_pattern,!0),this._until_pattern=this._input.get_regexp(c._until_pattern),this._until_after=c._until_after)}I.prototype.read=function(){var m=this._input.read(this._starting_pattern);return(!this._starting_pattern||m)&&(m+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),m},I.prototype.read_match=function(){return this._input.match(this._match_pattern)},I.prototype.until_after=function(m){var c=this._create();return c._until_after=!0,c._until_pattern=this._input.get_regexp(m),c._update(),c},I.prototype.until=function(m){var c=this._create();return c._until_after=!1,c._until_pattern=this._input.get_regexp(m),c._update(),c},I.prototype.starting_with=function(m){var c=this._create();return c._starting_pattern=this._input.get_regexp(m,!0),c._update(),c},I.prototype.matching=function(m){var c=this._create();return c._match_pattern=this._input.get_regexp(m,!0),c._update(),c},I.prototype._create=function(){return new I(this._input,this)},I.prototype._update=function(){},k.exports.Pattern=I},function(k){function I(m,c){m=typeof m=="string"?m:m.source,c=typeof c=="string"?c:c.source,this.__directives_block_pattern=new RegExp(m+/ beautify( \w+[:]\w+)+ /.source+c,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(m+/\sbeautify\signore:end\s/.source+c,"g")}I.prototype.get_directives=function(m){if(!m.match(this.__directives_block_pattern))return null;var c={};this.__directive_pattern.lastIndex=0;for(var f=this.__directive_pattern.exec(m);f;)c[f[1]]=f[2],f=this.__directive_pattern.exec(m);return c},I.prototype.readIgnored=function(m){return m.readUntilAfter(this.__directives_end_ignore_pattern)},k.exports.Directives=I},function(k,I,m){var c=m(12).Pattern,f={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function u(r,d){c.call(this,r,d),this.__template_pattern=null,this._disabled=Object.assign({},f),this._excluded=Object.assign({},f),d&&(this.__template_pattern=this._input.get_regexp(d.__template_pattern),this._excluded=Object.assign(this._excluded,d._excluded),this._disabled=Object.assign(this._disabled,d._disabled));var o=new c(r);this.__patterns={handlebars_comment:o.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:o.starting_with(/{{{/).until_after(/}}}/),handlebars:o.starting_with(/{{/).until_after(/}}/),php:o.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:o.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:o.starting_with(/{%/).until_after(/%}/),django_value:o.starting_with(/{{/).until_after(/}}/),django_comment:o.starting_with(/{#/).until_after(/#}/),smarty:o.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:o.starting_with(/{\*/).until_after(/\*}/),smarty_literal:o.starting_with(/{literal}/).until_after(/{\/literal}/)}}u.prototype=new c,u.prototype._create=function(){return new u(this._input,this)},u.prototype._update=function(){this.__set_templated_pattern()},u.prototype.disable=function(r){var d=this._create();return d._disabled[r]=!0,d._update(),d},u.prototype.read_options=function(r){var d=this._create();for(var o in f)d._disabled[o]=r.templating.indexOf(o)===-1;return d._update(),d},u.prototype.exclude=function(r){var d=this._create();return d._excluded[r]=!0,d._update(),d},u.prototype.read=function(){var r="";this._match_pattern?r=this._input.read(this._starting_pattern):r=this._input.read(this._starting_pattern,this.__template_pattern);for(var d=this._read_template();d;)this._match_pattern?d+=this._input.read(this._match_pattern):d+=this._input.readUntil(this.__template_pattern),r+=d,d=this._read_template();return this._until_after&&(r+=this._input.readUntilAfter(this._until_pattern)),r},u.prototype.__set_templated_pattern=function(){var r=[];this._disabled.php||r.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||r.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||r.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(r.push(this.__patterns.django._starting_pattern.source),r.push(this.__patterns.django_value._starting_pattern.source),r.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||r.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&r.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+r.join("|")+")")},u.prototype._read_template=function(){var r="",d=this._input.peek();if(d==="<"){var o=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&o==="?"&&(r=r||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&o==="%"&&(r=r||this.__patterns.erb.read())}else d==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(r=r||this.__patterns.handlebars_comment.read(),r=r||this.__patterns.handlebars_unescaped.read(),r=r||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(r=r||this.__patterns.django_value.read()),this._excluded.django||(r=r||this.__patterns.django_comment.read(),r=r||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(r=r||this.__patterns.smarty_comment.read(),r=r||this.__patterns.smarty_literal.read(),r=r||this.__patterns.smarty.read()));return r},k.exports.TemplatablePattern=u}],U={};function W(k){var I=U[k];if(I!==void 0)return I.exports;var m=U[k]={exports:{}};return F[k](m,m.exports,W),m.exports}var j=W(0);D=j})();var Y=D;!(ae=[],J=function(){return{js_beautify:Y}}.apply(et,ae),J!==void 0&&(vt.exports=J))})()},"7Cbv":function(vt,et,ne){"use strict";var ae=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),J=new Uint8Array(16);function D(){if(!ae)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ae(J)}var Y=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function F(f){return typeof f=="string"&&Y.test(f)}for(var U=F,W=[],j=0;j<256;++j)W.push((j+256).toString(16).substr(1));function k(f){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=(W[f[u+0]]+W[f[u+1]]+W[f[u+2]]+W[f[u+3]]+"-"+W[f[u+4]]+W[f[u+5]]+"-"+W[f[u+6]]+W[f[u+7]]+"-"+W[f[u+8]]+W[f[u+9]]+"-"+W[f[u+10]]+W[f[u+11]]+W[f[u+12]]+W[f[u+13]]+W[f[u+14]]+W[f[u+15]]).toLowerCase();if(!U(r))throw TypeError("Stringified UUID is invalid");return r}var I=k;function m(f,u,r){f=f||{};var d=f.random||(f.rng||D)();if(d[6]=d[6]&15|64,d[8]=d[8]&63|128,u){r=r||0;for(var o=0;o<16;++o)u[r+o]=d[o];return u}return I(d)}var c=et.a=m},"7ahc":function(vt,et,ne){"use strict";ne.d(et,"a",function(){return R});var ae=ne("k1fw"),J=ne("0Owb"),D=ne("+L6B"),Y=ne("2/Rp"),F=ne("y8nQ"),U=ne("Vl3Y"),W=ne("tJVT"),j=ne("OaEy"),k=ne("2fM7"),I=ne("q1tI"),m=ne.n(I),c=ne("VrN/"),f=ne.n(c),u=ne("p77/"),r=ne.n(u),d=ne("c5Ni"),o=ne.n(d),s=k.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},p={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};et.b=function(w){var x=w.callback,O=w.onCancel,A=Object(I.useState)("python"),T=Object(W.a)(A,2),E=T[0],y=T[1];function h(g){y(p[g][1])}function _(g){x(g)}return m.a.createElement(U.a,Object(J.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:_}),m.a.createElement(U.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},m.a.createElement(k.a,{onChange:h},Object.keys(p).map(function(g){return m.a.createElement(s,{key:g,value:g},p[g][0])}))),m.a.createElement(U.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},m.a.createElement(R,{mode:E})),m.a.createElement("div",{className:"flex-container flex-end"},m.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),m.a.createElement(Y.a,{type:"ghost",onClick:O},"\u53D6\u6D88")))};function R(w){var x=w.value,O=w.onChange,A=w.mode,T=w.options,E=T===void 0?{}:T,y=Object(I.useRef)(),h=Object(I.useState)(),_=Object(W.a)(h,2),g=_[0],b=_[1];return Object(I.useEffect)(function(){if(g){function M(P){var K=P.getValue();O&&O(K)}return g.on("change",M),function(){g.off("change",M)}}},[g,O]),Object(I.useEffect)(function(){g&&g.setOption("mode",A)},[g,A]),Object(I.useEffect)(function(){g&&((x!==g.getValue()||x==="")&&setTimeout(function(){g.setValue(x||" ")},300))},[g,x]),Object(I.useEffect)(function(){if(y.current&&!g){var M=f.a.fromTextArea(y.current,Object(ae.a)({mode:A,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},E));b(M)}},[y.current,g]),m.a.createElement("div",{className:"my-codemirror-container"},m.a.createElement("textarea",{ref:y}))}},"8EBN":function(vt,et,ne){(function(ae){ae(ne("VrN/"))})(function(ae){"use strict";ae.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var J=0;J<ae.modeInfo.length;J++){var D=ae.modeInfo[J];D.mimes&&(D.mime=D.mimes[0])}ae.findModeByMIME=function(Y){Y=Y.toLowerCase();for(var F=0;F<ae.modeInfo.length;F++){var U=ae.modeInfo[F];if(U.mime==Y)return U;if(U.mimes){for(var W=0;W<U.mimes.length;W++)if(U.mimes[W]==Y)return U}}if(/\+xml$/.test(Y))return ae.findModeByMIME("application/xml");if(/\+json$/.test(Y))return ae.findModeByMIME("application/json")},ae.findModeByExtension=function(Y){Y=Y.toLowerCase();for(var F=0;F<ae.modeInfo.length;F++){var U=ae.modeInfo[F];if(U.ext){for(var W=0;W<U.ext.length;W++)if(U.ext[W]==Y)return U}}},ae.findModeByFileName=function(Y){for(var F=0;F<ae.modeInfo.length;F++){var U=ae.modeInfo[F];if(U.file&&U.file.test(Y))return U}var W=Y.lastIndexOf("."),j=W>-1&&Y.substring(W+1,Y.length);if(j)return ae.findModeByExtension(j)},ae.findModeByName=function(Y){Y=Y.toLowerCase();for(var F=0;F<ae.modeInfo.length;F++){var U=ae.modeInfo[F];if(U.name.toLowerCase()==Y)return U;if(U.alias){for(var W=0;W<U.alias.length;W++)if(U.alias[W].toLowerCase()==Y)return U}}}})},"8hTe":function(vt,et,ne){vt.exports={button:"button___1wy9m"}},"9Bee":function(vt,et,ne){"use strict";var ae=ne("DYRE"),J=ne("zeV3"),D=ne("+L6B"),Y=ne("2/Rp"),F=ne("k1fw"),U=ne("9og8"),W=ne("tJVT"),j=ne("WmNS"),k=ne.n(j),I=ne("q1tI"),m=ne.n(I),c=ne("vg9a"),f=ne("DlQD"),u=ne.n(f),r=ne("rUJ1");function d(z,v){var S=z.match(/^(\s+)(?:```)/);if(S===null)return v;var N=S[1];return v.split(`
|
|
`).map(function(Z){var G=Z.match(/^\s+/);if(G===null)return Z;var fe=Object(W.a)(G,1),ke=fe[0];return ke.length>=N.length?Z.slice(N.length):Z}).join(`
|
|
`)}var o=[],s=["<ul>"],l=new u.a.Renderer,p=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function R(){o.length=0,s=["<ul>"]}var w={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function x(z,v,S,N){if(v>=z.length||z[v].level<=S)return v;var Z=z[v];N.push("<li><a href='#"+Z.anchor+"'>"+Z.text+"</a>"),v++;var G=[];return v=x(z,v,Z.level,G),G.length>0&&(N.push("<ul>"),G.forEach(function(fe){N.push(fe)}),N.push("</ul>")),N.push("</li>"),v=x(z,v,S,N),v}function O(){return x(o,0,0,s),s.push("</ul>"),s.join("")}var A={heading:function(v){var S=p.exec(v);if(S)return{type:"heading",raw:S[0],depth:S[1].length,text:S[2]}},fences:function(v){var S=this.rules.block.fences.exec(v);if(S){var N=S[0],Z=d(N,S[3]||""),G=S[2]?S[2].trim():S[2];if(["latex","katex","math"].indexOf(G)>=0){var fe=y(),ke=Z;Z=fe,h[fe]={type:"block",expression:ke}}return{type:"code",raw:N,lang:G,text:Z}}}},T=/(?:\${2})([^\n`]+?)(?:\${2})/gi,E=0,y=function(){return"__special_katext_id_".concat(E++,"__")},h={};function _(){return h}function g(){E=0,h={}}function b(z){return z=z.replace(T,function(v,S){var N=y();return h[N]={type:"inline",expression:S},N}),z}var M=l.listitem;l.listitem=function(z){return M(b(z))};var P=l.paragraph;l.paragraph=function(z){return P(b(z))};var K=l.tablecell;l.tablecell=function(z,v){return K(b(z),v)},l.code=function(z,v,S){var N=(v||"").match(/\S*/)[0];return N?["latex","katex","math"].indexOf(N)>=0?"<p class='editormd-tex'>".concat(z,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(v,'">').concat(S?z:Object(r.escape)(z,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(S?z:Object(r.escape)(z,!0))+"</code></pre>"},l.heading=function(z,v,S){var N=this.options.headerPrefix+S.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return o.push({anchor:N,level:v,text:z}),"<h"+v+' id="'+N+'">'+z+"</h"+v+">"},u.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),u.a.use({tokenizer:A,renderer:l});var V=u.a,B=ne("SJMd"),C=ne("ulZh"),$=ne.n(C),ee=ne("m3rI"),re=ne("Oy/b"),ue=ne("p5ED"),Te=ne("ErOA");/*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var ye=function(z,v){return(ye=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(S,N){S.__proto__=N}||function(S,N){for(var Z in N)Object.prototype.hasOwnProperty.call(N,Z)&&(S[Z]=N[Z])})(z,v)};function be(z,v){function S(){this.constructor=z}ye(z,v),z.prototype=v===null?Object.create(v):(S.prototype=v.prototype,new S)}function we(z,v,S,N){return new(S||(S=Promise))(function(Z,G){function fe(gt){try{Ze(N.next(gt))}catch(Fe){G(Fe)}}function ke(gt){try{Ze(N.throw(gt))}catch(Fe){G(Fe)}}function Ze(gt){var Fe;gt.done?Z(gt.value):(Fe=gt.value,Fe instanceof S?Fe:new S(function(Et){Et(Fe)})).then(fe,ke)}Ze((N=N.apply(z,v||[])).next())})}function xe(z,v){var S,N,Z,G,fe={label:0,sent:function(){if(1&Z[0])throw Z[1];return Z[1]},trys:[],ops:[]};return G={next:ke(0),throw:ke(1),return:ke(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function ke(Ze){return function(gt){return function(Fe){if(S)throw new TypeError("Generator is already executing.");for(;fe;)try{if(S=1,N&&(Z=2&Fe[0]?N.return:Fe[0]?N.throw||((Z=N.return)&&Z.call(N),0):N.next)&&!(Z=Z.call(N,Fe[1])).done)return Z;switch(N=0,Z&&(Fe=[2&Fe[0],Z.value]),Fe[0]){case 0:case 1:Z=Fe;break;case 4:return fe.label++,{value:Fe[1],done:!1};case 5:fe.label++,N=Fe[1],Fe=[0];continue;case 7:Fe=fe.ops.pop(),fe.trys.pop();continue;default:if(!(Z=fe.trys,(Z=Z.length>0&&Z[Z.length-1])||Fe[0]!==6&&Fe[0]!==2)){fe=0;continue}if(Fe[0]===3&&(!Z||Fe[1]>Z[0]&&Fe[1]<Z[3])){fe.label=Fe[1];break}if(Fe[0]===6&&fe.label<Z[1]){fe.label=Z[1],Z=Fe;break}if(Z&&fe.label<Z[2]){fe.label=Z[2],fe.ops.push(Fe);break}Z[2]&&fe.ops.pop(),fe.trys.pop();continue}Fe=v.call(z,fe)}catch(Et){Fe=[6,Et],N=0}finally{S=Z=0}if(5&Fe[0])throw Fe[1];return{value:Fe[0]?Fe[1]:void 0,done:!0}}([Ze,gt])}}}function me(){for(var z=0,v=0,S=arguments.length;v<S;v++)z+=arguments[v].length;var N=Array(z),Z=0;for(v=0;v<S;v++)for(var G=arguments[v],fe=0,ke=G.length;fe<ke;fe++,Z++)N[Z]=G[fe];return N}var se=function(){function z(){}return z.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},z.setAttributes=function(v,S){for(var N=0,Z=S;N<Z.length;N++){var G=Z[N],fe=G[0],ke=G[1];v.setAttribute(fe,ke)}},z.createRect=function(v,S,N){var Z=document.createElementNS("http://www.w3.org/2000/svg","rect");return Z.setAttribute("width",v.toString()),Z.setAttribute("height",S.toString()),N&&z.setAttributes(Z,N),Z},z.createLine=function(v,S,N,Z,G){var fe=document.createElementNS("http://www.w3.org/2000/svg","line");return fe.setAttribute("x1",v.toString()),fe.setAttribute("y1",S.toString()),fe.setAttribute("x2",N.toString()),fe.setAttribute("y2",Z.toString()),G&&z.setAttributes(fe,G),fe},z.createPolygon=function(v,S){var N=document.createElementNS("http://www.w3.org/2000/svg","polygon");return N.setAttribute("points",v),S&&z.setAttributes(N,S),N},z.createCircle=function(v,S){var N=document.createElementNS("http://www.w3.org/2000/svg","circle");return N.setAttribute("cx",(v/2).toString()),N.setAttribute("cy",(v/2).toString()),N.setAttribute("r",v.toString()),S&&z.setAttributes(N,S),N},z.createEllipse=function(v,S,N){var Z=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Z.setAttribute("cx",(v/2).toString()),Z.setAttribute("cy",(S/2).toString()),Z.setAttribute("rx",(v/2).toString()),Z.setAttribute("ry",(S/2).toString()),N&&z.setAttributes(Z,N),Z},z.createGroup=function(v){var S=document.createElementNS("http://www.w3.org/2000/svg","g");return v&&z.setAttributes(S,v),S},z.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},z.createMarker=function(v,S,N,Z,G,fe,ke){var Ze=document.createElementNS("http://www.w3.org/2000/svg","marker");return z.setAttributes(Ze,[["id",v],["orient",S],["markerWidth",N.toString()],["markerHeight",Z.toString()],["refX",G.toString()],["refY",fe.toString()]]),Ze.appendChild(ke),Ze},z.createText=function(v){var S=document.createElementNS("http://www.w3.org/2000/svg","text");return S.setAttribute("x","0"),S.setAttribute("y","0"),v&&z.setAttributes(S,v),S},z.createTSpan=function(v,S){var N=document.createElementNS("http://www.w3.org/2000/svg","tspan");return N.textContent=v,S&&z.setAttributes(N,S),N},z.createImage=function(v){var S=document.createElementNS("http://www.w3.org/2000/svg","image");return v&&z.setAttributes(S,v),S},z.createPoint=function(v,S){var N=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return N.x=v,N.y=S,N},z.createPath=function(v,S){var N=document.createElementNS("http://www.w3.org/2000/svg","path");return N.setAttribute("d",v),S&&z.setAttributes(N,S),N},z}(),Re=function(){function z(){}return z.addKey=function(v){z.key=v},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}(),ze=function(){function z(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return z.prototype.rasterize=function(v,S,N){var Z=this;return new Promise(function(G){var fe=N!==void 0?N:document.createElement("canvas");v===null&&(Z.markersOnly=!0,Z.naturalSize=!1);var ke=document.createElementNS("http://www.w3.org/2000/svg","svg");ke.setAttribute("xmlns","http://www.w3.org/2000/svg"),ke.setAttribute("width",S.width.baseVal.valueAsString),ke.setAttribute("height",S.height.baseVal.valueAsString),ke.setAttribute("viewBox","0 0 "+S.viewBox.baseVal.width.toString()+" "+S.viewBox.baseVal.height.toString()),ke.innerHTML=S.innerHTML,Z.naturalSize===!0?(ke.width.baseVal.value=v.naturalWidth,ke.height.baseVal.value=v.naturalHeight):Z.width!==void 0&&Z.height!==void 0&&(ke.width.baseVal.value=Z.width,ke.height.baseVal.value=Z.height),fe.width=ke.width.baseVal.value,fe.height=ke.height.baseVal.value;var Ze=ke.outerHTML,gt=fe.getContext("2d");Z.markersOnly!==!0&>.drawImage(v,0,0,fe.width,fe.height);var Fe=window.URL,Et=new Image(fe.width,fe.height);Et.setAttribute("crossOrigin","anonymous");var Ht=new Blob([Ze],{type:"image/svg+xml"}),Zt=Fe.createObjectURL(Ht);Et.onload=function(){gt.drawImage(Et,0,0),Fe.revokeObjectURL(Zt);var Bi=fe.toDataURL(Z.imageType,Z.imageQuality);G(Bi)},Et.src=Zt})},z}(),He=function(){},rt=function(){function z(v){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+v+"_"}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(v){return this.styleSheet===void 0&&this.addStyleSheet(),v.name=""+this.classNamePrefix+v.localName,this.classes.push(v),this.styleSheet.sheet.insertRule("."+v.name+" {"+v.style+"}",this.styleSheet.sheet.cssRules.length),v},z.prototype.addRule=function(v){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(v),this.styleSheet.sheet.insertRule(v.selector+" {"+v.style+"}",this.styleSheet.sheet.cssRules.length)},z.prototype.addStyleSheet=function(){var v;this.styleSheet=document.createElement("style"),((v=this.styleSheetRoot)!==null&&v!==void 0?v:document.head).appendChild(this.styleSheet),this.addRule(new ot("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new ot("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new ot("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Oe("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Oe("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},z.prototype.removeStyleSheet=function(){var v;this.styleSheet&&(((v=this.styleSheetRoot)!==null&&v!==void 0?v:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},z}(),ot=function(z,v){this.selector=z,this.style=v},Oe=function(z,v){this.localName=z,this.style=v},Le=function(){function z(v,S,N,Z,G){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=v,this.displayMode=S,this.markerItems=N,this.uiStyleSettings=Z,this.styles=G,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(v){var S=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=v,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var N=document.createElement("div");N.className=this.toolbarBlockStyleClass.name,N.style.whiteSpace="nowrap",this.uiContainer.appendChild(N),this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(G){var fe=document.createElement("div");fe.className=""+S.toolbarButtonStyleClass.name,fe.setAttribute("data-type-name",G.typeName),fe.innerHTML=G.icon,fe.addEventListener("click",function(){S.markerToolbarButtonClicked(fe,G)}),S.buttons.push(fe),S.markerButtons.push(fe)}),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 Z=document.createElement("div");Z.className=this.toolbarBlockStyleClass.name,Z.style.whiteSpace="nowrap",Z.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(Z),this.addActionButton(Z,'<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(Z,'<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(v){this.buttonClickListeners.push(v)},z.prototype.removeButtonClickListener=function(v){this.buttonClickListeners.indexOf(v)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(v),1)},z.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},z.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var v=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var S=0;S<this.markerButtons.length;S++)S<v||S===v&&this.markerButtons.length-1===v?this.markerButtonBlock.appendChild(this.markerButtons[S]):(S===v&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[S]))}},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 v=this;this.buttons.forEach(function(S){S.className=S.className.replace(v.uiStyleSettings.toolbarButtonStyleColorsClassName?v.uiStyleSettings.toolbarButtonStyleColorsClassName:v.toolbarButtonStyleColorsClass.name,"").trim(),S.className=S.className.replace(v.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?v.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:v.toolbarActiveButtonStyleColorsClass.name,"").trim(),S.className+=" "+(v.uiStyleSettings.toolbarButtonStyleColorsClassName?v.uiStyleSettings.toolbarButtonStyleColorsClassName:v.toolbarButtonStyleColorsClass.name)})},z.prototype.addActionButton=function(v,S,N){var Z=this,G=document.createElement("div");switch(G.className=""+this.toolbarButtonStyleClass.name,G.innerHTML=S,G.setAttribute("data-action",N),G.addEventListener("click",function(){Z.actionToolbarButtonClicked(G,N)}),N){case"select":G.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":G.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":G.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":G.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":G.style.fill=this.uiStyleSettings.closeButtonColor}v.appendChild(G),this.buttons.push(G)},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Oe("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 Oe("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Oe("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new Oe("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 Oe("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var v=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Oe("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*v)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*v)+`px;
|
|
padding: `+v+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Oe("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Oe("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new ot("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new ot("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},z.prototype.markerToolbarButtonClicked=function(v,S){this.setActiveButton(v),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(N){return N("marker",S)}),this.markerButtonOverflowBlock.style.display="none"},z.prototype.actionToolbarButtonClicked=function(v,S){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(N){return N("action",S)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},z.prototype.setActiveButton=function(v){this.resetButtonStyles(),v.className=v.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),v.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},z.prototype.setActiveMarkerButton=function(v){var S=this.markerButtons.find(function(N){return N.getAttribute("data-type-name")===v});S&&this.setActiveButton(S)},z.prototype.setCurrentMarker=function(v){var S=this;this.currentMarker=v,this.buttons.filter(function(N){return/delete|notes/.test(N.getAttribute("data-action"))}).forEach(function(N){S.currentMarker===void 0?(N.style.fillOpacity="0.4",N.style.pointerEvents="none"):(N.style.fillOpacity="1",N.style.pointerEvents="all")})},z}(),Ue=function(){function z(v,S,N,Z){this.panels=[],this.panelButtons=[],this.markerjsContainer=v,this.displayMode=S,this.uiStyleSettings=N,this.styles=Z,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return z.prototype.addStyles=function(){var v;this.toolboxStyleClass=this.styles.addClass(new Oe("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 Oe("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var S=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Oe("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Oe("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Oe("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 Oe("toolbox-panel-row_colors",`
|
|
background-color: `+((v=this.uiStyleSettings.toolboxBackgroundColor)!==null&&v!==void 0?v:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Oe("toolbox_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.toolboxButtonStyleColorsClass=this.styles.addClass(new Oe("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Oe("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new ot("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new ot("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},z.prototype.show=function(v){var S;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=v,this.uiContainer.className=this.toolboxStyleClass.name+" "+((S=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&S!==void 0?S:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},z.prototype.setPanelButtons=function(v){var S,N,Z=this;this.panels=v,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((S=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&S!==void 0?S:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((N=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&N!==void 0?N:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(G){var fe;G.uiStyleSettings=Z.uiStyleSettings;var ke=document.createElement("div");ke.className=Z.toolboxButtonStyleClass.name+" "+((fe=Z.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&fe!==void 0?fe:Z.toolboxButtonStyleColorsClass.name),ke.innerHTML=G.icon,ke.title=G.title,ke.addEventListener("click",function(){Z.panelButtonClick(G)}),Z.panelButtons.push(ke),Z.buttonRow.appendChild(ke)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},z.prototype.panelButtonClick=function(v){var S=this,N=-1;if(v!==this.activePanel){N=this.panels.indexOf(v),this.panelRow.innerHTML="";var Z=v.getUi();Z.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(Z),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=v}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){S.displayMode==="inline"?S.panelRow.style.display="none":S.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(G,fe){var ke,Ze;G.className=S.toolboxButtonStyleClass.name+" "+(fe===N?""+((ke=S.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&ke!==void 0?ke:S.toolboxActiveButtonStyleColorsClass.name):""+((Ze=S.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Ze!==void 0?Ze:S.toolboxButtonStyleColorsClass.name))})},z}(),Ge=function(z,v){this.title=z,this.icon=v},je=function(z){function v(S,N,Z,G){var fe=z.call(this,S,G||'<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 fe.colors=[],fe.addTransparent=!1,fe.colorBoxes=[],fe.colors=N,fe.currentColor=Z,fe.setCurrentColor=fe.setCurrentColor.bind(fe),fe.getColorBox=fe.getColorBox.bind(fe),fe}return be(v,z),v.prototype.getUi=function(){var S=this,N=document.createElement("div");return N.style.overflow="hidden",N.style.whiteSpace="nowrap",this.colors.forEach(function(Z){var G=S.getColorBox(Z);N.appendChild(G),S.colorBoxes.push(G)}),N},v.prototype.getColorBox=function(S){var N=this,Z=this.uiStyleSettings.toolbarHeight/4,G=this.uiStyleSettings.toolbarHeight-Z,fe=document.createElement("div");fe.style.display="inline-block",fe.style.boxSizing="content-box",fe.style.width=G-2+"px",fe.style.height=G-2+"px",fe.style.padding="1px",fe.style.marginRight="2px",fe.style.marginBottom="2px",fe.style.borderWidth="2px",fe.style.borderStyle="solid",fe.style.borderRadius=(G+2)/2+"px",fe.style.borderColor=S===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",fe.addEventListener("click",function(){N.setCurrentColor(S,fe)});var ke=document.createElement("div");return ke.style.display="inline-block",ke.style.width=G-2+"px",ke.style.height=G-2+"px",ke.style.backgroundColor=S,ke.style.borderRadius=G/2+"px",S==="transparent"&&(ke.style.fill=this.uiStyleSettings.toolboxAccentColor,ke.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>`),fe.appendChild(ke),fe},v.prototype.setCurrentColor=function(S,N){var Z=this;this.currentColor=S,this.colorBoxes.forEach(function(G){G.style.borderColor=G===N?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(S)},v}(Ge),Me=function(){function z(v,S,N){this._state="new",this._isSelected=!1,this._container=v,this._overlayContainer=S,this.globalSettings=N,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(v){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(v,S){},z.prototype.dblClick=function(v,S){},z.prototype.manipulate=function(v){},z.prototype.pointerUp=function(v){this.stateChanged()},z.prototype.dispose=function(){},z.prototype.addMarkerVisualToContainer=function(v){this.container.childNodes.length>0?this.container.insertBefore(v,this.container.childNodes[0]):this.container.appendChild(v)},z.prototype.getState=function(){return{typeName:z.typeName,state:this.state,notes:this.notes}},z.prototype.restoreState=function(v){this._state=v.state,this.notes=v.notes},z.prototype.scale=function(v,S){},z.prototype.colorChanged=function(v){this.onColorChanged&&this.onColorChanged(v),this.stateChanged()},z.prototype.fillColorChanged=function(v){this.onFillColorChanged&&this.onFillColorChanged(v),this.stateChanged()},z.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var v=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),v.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(v)&&this.onStateChanged(this)}},z.typeName="MarkerBase",z}(),Pe=function(){function z(){this.findGripByVisual=this.findGripByVisual.bind(this)}return z.prototype.findGripByVisual=function(v){return this.topLeft.ownsTarget(v)?this.topLeft:this.topCenter.ownsTarget(v)?this.topCenter:this.topRight.ownsTarget(v)?this.topRight:this.centerLeft.ownsTarget(v)?this.centerLeft:this.centerRight.ownsTarget(v)?this.centerRight:this.bottomLeft.ownsTarget(v)?this.bottomLeft:this.bottomCenter.ownsTarget(v)?this.bottomCenter:this.bottomRight.ownsTarget(v)?this.bottomRight:void 0},z}(),ut=function(){function z(){this.GRIP_SIZE=10,this.visual=se.createGroup(),this.visual.appendChild(se.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(se.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return z.prototype.ownsTarget=function(v){return v===this.visual||v===this.visual.childNodes[0]||v===this.visual.childNodes[1]},z}(),tt=function(){function z(){}return z.toITransformMatrix=function(v){return{a:v.a,b:v.b,c:v.c,d:v.d,e:v.e,f:v.f}},z.toSVGMatrix=function(v,S){return v.a=S.a,v.b=S.b,v.c=S.c,v.d=S.d,v.e=S.e,v.f=S.f,v},z}(),qe=function(z){function v(S,N,Z){var G=z.call(this,S,N,Z)||this;return G.left=0,G.top=0,G.width=0,G.height=0,G.defaultSize={x:50,y:20},G.offsetX=0,G.offsetY=0,G.rotationAngle=0,G.CB_DISTANCE=10,G._suppressMarkerCreateEvent=!1,G.container.transform.baseVal.appendItem(se.createTransform()),G.setupControlBox(),G}return be(v,z),Object.defineProperty(v.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"visual",{get:function(){return this._visual},set:function(S){this._visual=S;var N=se.createTransform();this._visual.transform.baseVal.appendItem(N)},enumerable:!1,configurable:!0}),v.prototype.ownsTarget=function(S){return!!z.prototype.ownsTarget.call(this,S)||!!(this.controlGrips.findGripByVisual(S)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(S))},v.prototype.pointerDown=function(S,N){z.prototype.pointerDown.call(this,S,N),this.state==="new"&&(this.left=S.x,this.top=S.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var Z=this.unrotatePoint(S);if(this.manipulationStartX=Z.x,this.manipulationStartY=Z.y,this.offsetX=Z.x-this.left,this.offsetY=Z.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(N),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(N)){this.activeGrip=this.rotatorGrip;var G=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=G.x-this.width/2,this.top=G.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var fe=this.container.transform.baseVal.getItem(0);fe.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(fe,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},v.prototype.pointerUp=function(S){var N=this.state;z.prototype.pointerUp.call(this,S),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(S),this._state="select",N==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},v.prototype.moveVisual=function(S){this.visual.style.transform="translate("+S.x+"px, "+S.y+"px)"},v.prototype.manipulate=function(S){var N=this.unrotatePoint(S);this.state==="creating"?this.resize(S):this.state==="move"?(this.left=this.manipulationStartLeft+(N.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(N.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(N):this.state==="rotate"&&this.rotate(S)},v.prototype.resize=function(S){var N=this.manipulationStartLeft,Z=this.manipulationStartWidth,G=this.manipulationStartTop,fe=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:N=this.manipulationStartLeft+S.x-this.manipulationStartX,Z=this.manipulationStartWidth+this.manipulationStartLeft-N;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:Z=this.manipulationStartWidth+S.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:G=this.manipulationStartTop+S.y-this.manipulationStartY,fe=this.manipulationStartHeight+this.manipulationStartTop-G;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:fe=this.manipulationStartHeight+S.y-this.manipulationStartY}Z>=0?(this.left=N,this.width=Z):(this.left=N+Z,this.width=-Z),fe>=0?(this.top=G,this.height=fe):(this.top=G+fe,this.height=-fe),this.setSize()},v.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},v.prototype.rotate=function(S){if(Math.abs(S.x-this.centerX)>.1){var N=Math.sign(S.x-this.centerX);this.rotationAngle=180*Math.atan((S.y-this.centerY)/(S.x-this.centerX))/Math.PI+90*N,this.applyRotation()}},v.prototype.applyRotation=function(){var S=this.container.transform.baseVal.getItem(0);S.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(S,0)},v.prototype.rotatePoint=function(S){if(this.rotationAngle===0)return S;var N=this.container.getCTM(),Z=se.createPoint(S.x,S.y);return{x:(Z=Z.matrixTransform(N)).x,y:Z.y}},v.prototype.unrotatePoint=function(S){if(this.rotationAngle===0)return S;var N=this.container.getCTM();N=N.inverse();var Z=se.createPoint(S.x,S.y);return{x:(Z=Z.matrixTransform(N)).x,y:Z.y}},v.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},v.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},v.prototype.setupControlBox=function(){this.controlBox=se.createGroup();var S=se.createTransform();S.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(S),this.container.appendChild(this.controlBox),this.controlRect=se.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=se.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Pe,this.addControlGrips(),this.controlBox.style.display="none"},v.prototype.adjustControlBox=function(){var S=this.controlBox.transform.baseVal.getItem(0);S.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(S,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()},v.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()},v.prototype.createGrip=function(){var S=new ut;return S.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(S.visual),S},v.prototype.positionGrips=function(){var S=this.controlGrips.topLeft.GRIP_SIZE,N=-S/2,Z=N,G=(this.width+this.CB_DISTANCE)/2-S/2,fe=(this.height+this.CB_DISTANCE)/2-S/2,ke=this.height+this.CB_DISTANCE-S/2,Ze=this.width+this.CB_DISTANCE-S/2;this.positionGrip(this.controlGrips.topLeft.visual,N,Z),this.positionGrip(this.controlGrips.topCenter.visual,G,Z),this.positionGrip(this.controlGrips.topRight.visual,Ze,Z),this.positionGrip(this.controlGrips.centerLeft.visual,N,fe),this.positionGrip(this.controlGrips.centerRight.visual,Ze,fe),this.positionGrip(this.controlGrips.bottomLeft.visual,N,ke),this.positionGrip(this.controlGrips.bottomCenter.visual,G,ke),this.positionGrip(this.controlGrips.bottomRight.visual,Ze,ke),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,G,Z-3*this.CB_DISTANCE)},v.prototype.positionGrip=function(S,N,Z){var G=S.transform.baseVal.getItem(0);G.setTranslate(N,Z),S.transform.baseVal.replaceItem(G,0)},v.prototype.hideControlBox=function(){this.controlBox.style.display="none"},v.prototype.showControlBox=function(){this.controlBox.style.display=""},v.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:tt.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:tt.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},z.prototype.getState.call(this))},v.prototype.restoreState=function(S){z.prototype.restoreState.call(this,S);var N=S;this.left=N.left,this.top=N.top,this.width=N.width,this.height=N.height,this.rotationAngle=N.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(tt.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,N.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(tt.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,N.containerTransformMatrix))},v.prototype.scale=function(S,N){z.prototype.scale.call(this,S,N);var Z=this.rotatePoint({x:this.left,y:this.top}),G=this.unrotatePoint({x:Z.x*S,y:Z.y*N});this.left=G.x,this.top=G.y,this.width=this.width*S,this.height=this.height*N,this.adjustControlBox()},v}(Me),$e=function(z){function v(S,N,Z){var G=z.call(this,S,N,Z)||this;return G.fillColor="transparent",G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.opacity=1,G.setStrokeColor=G.setStrokeColor.bind(G),G.setFillColor=G.setFillColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.createVisual=G.createVisual.bind(G),G}return be(v,z),v.prototype.ownsTarget=function(S){return!(!z.prototype.ownsTarget.call(this,S)&&S!==this.visual)},v.prototype.createVisual=function(){this.visual=se.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},v.prototype.pointerDown=function(S,N){z.prototype.pointerDown.call(this,S,N),this.state==="new"&&(this.createVisual(),this.moveVisual(S),this._state="creating")},v.prototype.manipulate=function(S){z.prototype.manipulate.call(this,S)},v.prototype.resize=function(S){z.prototype.resize.call(this,S),this.setSize()},v.prototype.setSize=function(){z.prototype.setSize.call(this),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},v.prototype.pointerUp=function(S){z.prototype.pointerUp.call(this,S),this.setSize()},v.prototype.setStrokeColor=function(S){this.strokeColor=S,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(S),this.stateChanged()},v.prototype.setFillColor=function(S){this.fillColor=S,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},v.prototype.setStrokeWidth=function(S){this.strokeWidth=S,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},v.prototype.setStrokeDasharray=function(S){this.strokeDasharray=S,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},v.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))},v.prototype.restoreState=function(S){var N=S;this.fillColor=N.fillColor,this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.opacity=N.opacity,this.createVisual(),z.prototype.restoreState.call(this,S),this.setSize()},v.prototype.scale=function(S,N){z.prototype.scale.call(this,S,N),this.setSize()},v.title="Rectangle marker",v}(qe),ft=function(z){function v(S,N,Z,G){var fe=z.call(this,S,G||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return fe.widths=[],fe.widthBoxes=[],fe.widths=N,fe.currentWidth=Z,fe.setCurrentWidth=fe.setCurrentWidth.bind(fe),fe}return be(v,z),v.prototype.getUi=function(){var S=this,N=document.createElement("div");return N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2",this.widths.forEach(function(Z){var G=document.createElement("div");G.style.display="flex",G.style.flexGrow="2",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.borderColor=Z===S.currentWidth?S.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){S.setCurrentWidth(Z,G)}),N.appendChild(G);var fe=document.createElement("div");fe.innerText=Z.toString(),fe.style.marginRight="5px",G.appendChild(fe);var ke=document.createElement("div");ke.style.minHeight="20px",ke.style.flexGrow="2",ke.style.display="flex",ke.style.alignItems="center";var Ze=document.createElement("hr");Ze.style.minWidth="20px",Ze.style.border="0px",Ze.style.borderTop=Z+"px solid "+S.uiStyleSettings.toolboxColor,Ze.style.flexGrow="2",ke.appendChild(Ze),G.appendChild(ke),S.widthBoxes.push(G)}),N},v.prototype.setCurrentWidth=function(S,N){var Z=this;this.currentWidth=S,this.widthBoxes.forEach(function(G){G.style.borderColor=G===N?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},v}(Ge),nt=function(z){function v(S,N,Z,G){var fe=z.call(this,S,G||'<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 fe.styles=[],fe.styleBoxes=[],fe.styles=N,fe.currentStyle=Z,fe.setCurrentStyle=fe.setCurrentStyle.bind(fe),fe}return be(v,z),v.prototype.getUi=function(){var S=this,N=document.createElement("div");return N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2",this.styles.forEach(function(Z){var G=document.createElement("div");G.style.display="flex",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.overflow="hidden",G.style.maxWidth=100/S.styles.length-5+"%",G.style.borderColor=Z===S.currentStyle?S.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){S.setCurrentStyle(Z,G)}),N.appendChild(G);var fe=document.createElement("div");fe.style.minHeight="20px",fe.style.flexGrow="2",fe.style.overflow="hidden";var ke=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+S.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(Z!==""?'stroke-dasharray="'+Z+'"':"")+` />
|
|
</svg>`;fe.innerHTML=ke,G.appendChild(fe),S.styleBoxes.push(G)}),N},v.prototype.setCurrentStyle=function(S,N){var Z=this;this.currentStyle=S,this.styleBoxes.forEach(function(G){G.style.borderColor=G===N?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},v}(Ge),Ye=function(z){function v(S,N,Z){var G=z.call(this,S,N,Z)||this;return G.strokeColor=Z.defaultColor,G.strokeWidth=Z.defaultStrokeWidth,G.strokeDasharray=Z.defaultStrokeDasharray,G.strokePanel=new je("Line color",Z.defaultColorSet,Z.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new ft("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new nt("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return be(v,z),Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var S=z.prototype.getState.call(this);return S.typeName=v.typeName,S},v.typeName="FrameMarker",v.title="Frame marker",v.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',v}($e),Ae=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},ct=function(z){function v(S,N,Z){var G=z.call(this,S,N,Z)||this;return G.x1=0,G.y1=0,G.x2=0,G.y2=0,G.defaultLength=50,G.manipulationStartX=0,G.manipulationStartY=0,G.manipulationStartX1=0,G.manipulationStartY1=0,G.manipulationStartX2=0,G.manipulationStartY2=0,G.setupControlBox(),G}return be(v,z),v.prototype.ownsTarget=function(S){return!!z.prototype.ownsTarget.call(this,S)||!(!this.grip1.ownsTarget(S)&&!this.grip2.ownsTarget(S))},v.prototype.pointerDown=function(S,N){z.prototype.pointerDown.call(this,S,N),this.manipulationStartX=S.x,this.manipulationStartY=S.y,this.state==="new"&&(this.x1=S.x,this.y1=S.y,this.x2=S.x,this.y2=S.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(N)?this.activeGrip=this.grip1:this.grip2.ownsTarget(N)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},v.prototype.pointerUp=function(S){var N=this.state;z.prototype.pointerUp.call(this,S),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(S),this._state="select",N==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},v.prototype.adjustVisual=function(){},v.prototype.manipulate=function(S){this.state==="creating"?this.resize(S):this.state==="move"?(this.x1=this.manipulationStartX1+S.x-this.manipulationStartX,this.y1=this.manipulationStartY1+S.y-this.manipulationStartY,this.x2=this.manipulationStartX2+S.x-this.manipulationStartX,this.y2=this.manipulationStartY2+S.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(S)},v.prototype.resize=function(S){switch(this.activeGrip){case this.grip1:this.x1=S.x,this.y1=S.y;break;case this.grip2:case void 0:this.x2=S.x,this.y2=S.y}this.adjustVisual(),this.adjustControlBox()},v.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},v.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},v.prototype.setupControlBox=function(){this.controlBox=se.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},v.prototype.adjustControlBox=function(){this.positionGrips()},v.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},v.prototype.createGrip=function(){var S=new ut;return S.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(S.visual),S},v.prototype.positionGrips=function(){var S=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-S/2,this.y1-S/2),this.positionGrip(this.grip2.visual,this.x2-S/2,this.y2-S/2)},v.prototype.positionGrip=function(S,N,Z){var G=S.transform.baseVal.getItem(0);G.setTranslate(N,Z),S.transform.baseVal.replaceItem(G,0)},v.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},z.prototype.getState.call(this))},v.prototype.restoreState=function(S){z.prototype.restoreState.call(this,S);var N=S;this.x1=N.x1,this.y1=N.y1,this.x2=N.x2,this.y2=N.y2},v.prototype.scale=function(S,N){z.prototype.scale.call(this,S,N),this.x1=this.x1*S,this.y1=this.y1*N,this.x2=this.x2*S,this.y2=this.y2*N,this.adjustVisual(),this.adjustControlBox()},v}(Me),Je=function(z){function v(S,N,Z){var G=z.call(this,S,N,Z)||this;return G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.setStrokeColor=G.setStrokeColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.strokeColor=Z.defaultColor,G.strokeWidth=Z.defaultStrokeWidth,G.strokeDasharray=Z.defaultStrokeDasharray,G.strokePanel=new je("Line color",Z.defaultColorSet,Z.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new ft("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new nt("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return be(v,z),v.prototype.ownsTarget=function(S){return!(!z.prototype.ownsTarget.call(this,S)&&S!==this.visual&&S!==this.selectorLine&&S!==this.visibleLine)},v.prototype.createVisual=function(){this.visual=se.createGroup(),this.selectorLine=se.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=se.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},v.prototype.pointerDown=function(S,N){z.prototype.pointerDown.call(this,S,N),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},v.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),se.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},v.prototype.setStrokeColor=function(S){this.strokeColor=S,this.adjustVisual(),this.colorChanged(S)},v.prototype.setStrokeWidth=function(S){this.strokeWidth=S,this.adjustVisual()},v.prototype.setStrokeDasharray=function(S){this.strokeDasharray=S,this.adjustVisual(),this.stateChanged()},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var S=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},z.prototype.getState.call(this));return S.typeName=v.typeName,S},v.prototype.restoreState=function(S){z.prototype.restoreState.call(this,S);var N=S;this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.createVisual(),this.adjustVisual()},v.typeName="LineMarker",v.title="Line marker",v.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',v}(ct),Se=function(z){function v(S,N,Z,G){var fe=z.call(this,S,G||'<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 fe.fonts=[],fe.fontBoxes=[],fe.fonts=N,fe.currentFont=Z,fe.setCurrentFont=fe.setCurrentFont.bind(fe),fe}return be(v,z),v.prototype.getUi=function(){var S=this,N=document.createElement("div");return N.style.overflow="hidden",N.style.flexGrow="2",this.fonts.forEach(function(Z){var G=document.createElement("div");G.style.display="inline-block",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.overflow="hidden",G.style.maxWidth=100/S.fonts.length-5+"%",G.style.borderColor=Z===S.currentFont?S.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){S.setCurrentFont(Z,G)}),N.appendChild(G);var fe=document.createElement("div");fe.style.display="flex",fe.style.minHeight="20px",fe.style.flexGrow="2",fe.style.fontFamily=Z,fe.style.overflow="hidden";var ke=document.createElement("div");ke.style.whiteSpace="nowrap",ke.style.overflow="hidden",ke.style.textOverflow="ellipsis",ke.innerHTML="The quick brown fox jumps over the lazy dog",fe.appendChild(ke),G.appendChild(fe),S.fontBoxes.push(G)}),N},v.prototype.setCurrentFont=function(S,N){var Z=this;this.currentFont=S,this.fontBoxes.forEach(function(G){G.style.borderColor=G===N?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},v}(Ge),Ne=function(z){function v(S,N,Z){var G=z.call(this,S,N,Z)||this;return G.color="transparent",G.padding=5,G.DEFAULT_TEXT="your text here",G.text=G.DEFAULT_TEXT,G.isMoved=!1,G.color=Z.defaultColor,G.fontFamily=Z.defaultFontFamily,G.defaultSize={x:100,y:30},G.setColor=G.setColor.bind(G),G.setFont=G.setFont.bind(G),G.renderText=G.renderText.bind(G),G.sizeText=G.sizeText.bind(G),G.textEditDivClicked=G.textEditDivClicked.bind(G),G.showTextEditor=G.showTextEditor.bind(G),G.setSize=G.setSize.bind(G),G.positionTextEditor=G.positionTextEditor.bind(G),G.colorPanel=new je("Color",Z.defaultColorSet,Z.defaultColor),G.colorPanel.onColorChanged=G.setColor,G.fontFamilyPanel=new Se("Font",Z.defaultFontFamilies,Z.defaultFontFamily),G.fontFamilyPanel.onFontChanged=G.setFont,G}return be(v,z),v.prototype.ownsTarget=function(S){if(z.prototype.ownsTarget.call(this,S)||S===this.visual||S===this.textElement||S===this.bgRectangle)return!0;var N=!1;return this.textElement.childNodes.forEach(function(Z){Z===S&&(N=!0)}),N},v.prototype.createVisual=function(){this.visual=se.createGroup(),this.bgRectangle=se.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=se.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},v.prototype.pointerDown=function(S,N){z.prototype.pointerDown.call(this,S,N),this.isMoved=!1,this.pointerDownPoint=S,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(S),this._state="creating")},v.prototype.renderText=function(){var S=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(N){S.textElement.appendChild(se.createTSpan(N.trim()===""?" ":N.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},v.prototype.getTextScale=function(){var S=this.textElement.getBBox(),N=1;if(S.width>0&&S.height>0){var Z=(1*this.width-this.width*this.padding*2/100)/S.width,G=(1*this.height-this.height*this.padding*2/100)/S.height;N=Math.min(Z,G)}return N},v.prototype.getTextPosition=function(S){var N=this.textElement.getBBox(),Z=0,G=0;return N.width>0&&N.height>0&&(Z=(this.width-N.width*S)/2,G=this.height/2-N.height*S/2),{x:Z,y:G}},v.prototype.sizeText=function(){var S=this.textElement.getBBox(),N=this.getTextScale(),Z=this.getTextPosition(N);Z.y-=S.y*N,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+Z.x+"px, "+Z.y+"px) scale("+N+", "+N+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(Z.x,Z.y),this.textElement.transform.baseVal.getItem(1).setScale(N,N))},v.prototype.manipulate=function(S){z.prototype.manipulate.call(this,S),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(S.x-this.pointerDownPoint.x)>5||Math.abs(S.y-this.pointerDownPoint.y)>5)},v.prototype.resize=function(S){z.prototype.resize.call(this,S),this.isMoved=!0,this.setSize(),this.sizeText()},v.prototype.setSize=function(){z.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},v.prototype.pointerUp=function(S){var N=this.state;N==="creating"&&(this._suppressMarkerCreateEvent=!0),z.prototype.pointerUp.call(this,S),this.setSize(),(N==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},v.prototype.showTextEditor=function(){var S=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(N){N.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var N=Number.parseFloat(S.textEditor.style.fontSize);S.textEditor.clientWidth>=Number.parseInt(S.textEditor.style.maxWidth)&&N>.9;)N-=.1,S.textEditor.style.fontSize=Math.max(N,.9)+"em"}),this.textEditor.addEventListener("keyup",function(N){N.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(N){if(N.clipboardData){var Z=N.clipboardData.getData("text"),G=window.getSelection();if(!G.rangeCount)return!1;G.deleteFromDocument(),G.getRangeAt(0).insertNode(document.createTextNode(Z)),N.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){S.textEditDivClicked(S.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},v.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var S=this.getTextScale(),N=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),Z=this.textElement.getBBox(),G={x:Z.width*S,y:Z.height*S};N.x-=G.x/2,N.y-=G.y/2,this.textEditor.style.top=N.y+"px",this.textEditor.style.left=N.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-N.x+"px",this.textEditor.style.fontSize=Math.max(16*S,12)+"px",this.textElement.style.display="none"}},v.prototype.textEditDivClicked=function(S){this.text=S.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},v.prototype.select=function(){z.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},v.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),z.prototype.deselect.call(this)},v.prototype.dblClick=function(S,N){z.prototype.dblClick.call(this,S,N),this.showTextEditor()},v.prototype.setColor=function(S){this.textElement&&se.setAttributes(this.textElement,[["fill",S]]),this.color=S,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(S)},v.prototype.setFont=function(S){this.textElement&&se.setAttributes(this.textElement,[["font-family",S]]),this.fontFamily=S,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},v.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},v.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var S=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},z.prototype.getState.call(this));return S.typeName=v.typeName,S},v.prototype.restoreState=function(S){var N=S;this.color=N.color,this.fontFamily=N.fontFamily,this.padding=N.padding,this.text=N.text,this.createVisual(),z.prototype.restoreState.call(this,S),this.setSize()},v.prototype.scale=function(S,N){z.prototype.scale.call(this,S,N),this.setSize(),this.sizeText(),this.positionTextEditor()},v.typeName="TextMarker",v.title="Text marker",v.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>',v}(qe),ve=function(z){function v(S,N,Z){var G=z.call(this,S,N,Z)||this;return G.color="transparent",G.lineWidth=3,G.drawing=!1,G.pixelRatio=1,G.color=Z.defaultColor,G.lineWidth=Z.defaultStrokeWidth,G.pixelRatio=Z.freehandPixelRatio,G.setColor=G.setColor.bind(G),G.addCanvas=G.addCanvas.bind(G),G.finishCreation=G.finishCreation.bind(G),G.setLineWidth=G.setLineWidth.bind(G),G.colorPanel=new je("Color",Z.defaultColorSet,Z.defaultColor),G.colorPanel.onColorChanged=G.setColor,G.lineWidthPanel=new ft("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),G.lineWidthPanel.onWidthChanged=G.setLineWidth,G}return be(v,z),v.prototype.ownsTarget=function(S){return!(!z.prototype.ownsTarget.call(this,S)&&S!==this.visual&&S!==this.drawingImage)},v.prototype.createVisual=function(){this.visual=se.createGroup(),this.drawingImage=se.createImage(),this.visual.appendChild(this.drawingImage);var S=se.createTransform();this.visual.transform.baseVal.appendItem(S),this.addMarkerVisualToContainer(this.visual)},v.prototype.pointerDown=function(S,N){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(S.x,S.y),this.drawing=!0):z.prototype.pointerDown.call(this,S,N)},v.prototype.manipulate=function(S){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(S.x,S.y),this.canvasContext.stroke()):z.prototype.manipulate.call(this,S)},v.prototype.resize=function(S){z.prototype.resize.call(this,S),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},v.prototype.pointerUp=function(S){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):z.prototype.pointerUp.call(this,S)},v.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)},v.prototype.select=function(){this.state==="creating"&&this.finishCreation(),z.prototype.select.call(this)},v.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),z.prototype.deselect.call(this)},v.prototype.finishCreation=function(){for(var S=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),N=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],Z=N[0],G=N[1],fe=N[2],ke=N[3],Ze=!1,gt=0;gt<this.canvasElement.height;gt++)for(var Fe=0;Fe<this.canvasElement.width;Fe++)S.data[gt*this.canvasElement.width*4+4*Fe+3]>0&&(Ze=!0,gt<G&&(G=gt),Fe<Z&&(Z=Fe),gt>ke&&(ke=gt),Fe>fe&&(fe=Fe));if(Ze){this.left=Z/this.pixelRatio,this.top=G/this.pixelRatio,this.width=(fe-Z)/this.pixelRatio,this.height=(ke-G)/this.pixelRatio;var Et=document.createElement("canvas");Et.width=fe-Z,Et.height=ke-G,Et.getContext("2d").putImageData(this.canvasContext.getImageData(Z,G,fe-Z,ke-G),0,0),this.drawingImgUrl=Et.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},v.prototype.setDrawingImage=function(){se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},v.prototype.setColor=function(S){this.color=S,this.colorChanged(S)},v.prototype.setLineWidth=function(S){this.lineWidth=S},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var S=Object.assign({drawingImgUrl:this.drawingImgUrl},z.prototype.getState.call(this));return S.typeName=v.typeName,S},v.prototype.restoreState=function(S){this.createVisual(),z.prototype.restoreState.call(this,S),this.drawingImgUrl=S.drawingImgUrl,this.setDrawingImage()},v.prototype.scale=function(S,N){z.prototype.scale.call(this,S,N),this.setDrawingImage()},v.typeName="FreehandMarker",v.title="Freehand marker",v.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>',v}(qe),de=function(z){function v(S,N,Z){var G=z.call(this,S,Z||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return G.typeBoxes=[],G.currentType=N,G.setCurrentType=G.setCurrentType.bind(G),G}return be(v,z),v.prototype.getUi=function(){var S=this,N=document.createElement("div");N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2";for(var Z=function(ke){var Ze="both";switch(ke){case 0:Ze="both";break;case 1:Ze="start";break;case 2:Ze="end";break;case 3:Ze="none"}var gt=document.createElement("div");if(gt.style.display="flex",gt.style.flexGrow="2",gt.style.alignItems="center",gt.style.justifyContent="space-between",gt.style.padding="5px",gt.style.borderWidth="2px",gt.style.borderStyle="solid",gt.style.borderColor=Ze===G.currentType?G.uiStyleSettings.toolboxAccentColor:"transparent",gt.addEventListener("click",function(){S.setCurrentType(Ze,gt)}),N.appendChild(gt),Ze==="both"||Ze==="start"){var Fe=document.createElement("div");Fe.style.display="flex",Fe.style.alignItems="center",Fe.style.minHeight="20px",Fe.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="`+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Fe.style.marginLeft="5px",gt.appendChild(Fe)}var Et=document.createElement("div");Et.style.display="flex",Et.style.alignItems="center",Et.style.minHeight="20px",Et.style.flexGrow="2";var Ht=document.createElement("hr");if(Ht.style.minWidth="20px",Ht.style.border="0px",Ht.style.borderTop="3px solid "+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee"),Ht.style.flexGrow="2",Et.appendChild(Ht),gt.appendChild(Et),Ze==="both"||Ze==="end"){var Zt=document.createElement("div");Zt.style.display="flex",Zt.style.alignItems="center",Zt.style.minHeight="20px",Zt.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="`+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Zt.style.marginRight="5px",gt.appendChild(Zt)}G.typeBoxes.push(gt)},G=this,fe=0;fe<4;fe++)Z(fe);return N},v.prototype.setCurrentType=function(S,N){var Z=this;this.currentType=S,this.typeBoxes.forEach(function(G){G.style.borderColor=G===N?Z.uiStyleSettings!==void 0?Z.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},v}(Ge),pe=function(z){function v(S,N,Z){var G=z.call(this,S,N,Z)||this;return G.arrowType="end",G.arrowBaseHeight=10,G.arrowBaseWidth=10,G.getArrowPoints=G.getArrowPoints.bind(G),G.setArrowType=G.setArrowType.bind(G),G.arrowTypePanel=new de("Arrow type","end"),G.arrowTypePanel.onArrowTypeChanged=G.setArrowType,G}return be(v,z),v.prototype.ownsTarget=function(S){return!(!z.prototype.ownsTarget.call(this,S)&&S!==this.arrow1&&S!==this.arrow2)},v.prototype.getArrowPoints=function(S,N){var Z=this.arrowBaseWidth+2*this.strokeWidth,G=this.arrowBaseHeight+2*this.strokeWidth;return S-Z/2+","+(N+G/2)+" "+S+","+(N-G/2)+" "+(S+Z/2)+","+(N+G/2)},v.prototype.createTips=function(){this.arrow1=se.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=se.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow2)},v.prototype.pointerDown=function(S,N){z.prototype.pointerDown.call(this,S,N),this.state==="creating"&&this.createTips()},v.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",se.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),se.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var S=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),N=this.arrow1.transform.baseVal.getItem(0);N.setRotate(S,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(N,0);var Z=this.arrow2.transform.baseVal.getItem(0);Z.setRotate(S+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(Z,0)}},v.prototype.setArrowType=function(S){this.arrowType=S,this.adjustVisual(),this.stateChanged()},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var S=Object.assign({arrowType:this.arrowType},z.prototype.getState.call(this));return S.typeName=v.typeName,S},v.prototype.restoreState=function(S){z.prototype.restoreState.call(this,S);var N=S;this.arrowType=N.arrowType,this.createTips(),this.adjustVisual()},v.typeName="ArrowMarker",v.title="Arrow marker",v.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',v}(Je),te=function(z){function v(S,N,Z){var G=z.call(this,S,N,Z)||this;return G.fillColor=Z.defaultFillColor,G.strokeWidth=0,G.fillPanel=new je("Color",Z.defaultColorSet,Z.defaultFillColor),G.fillPanel.onColorChanged=G.setFillColor,G}return be(v,z),Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var S=z.prototype.getState.call(this);return S.typeName=v.typeName,S},v.typeName="CoverMarker",v.title="Cover marker",v.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',v}($e),ie=function(z){function v(S,N,Z,G){var fe=z.call(this,S,G||'<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 fe.opacities=[],fe.opacityBoxes=[],fe.opacities=N,fe.currentOpacity=Z,fe.setCurrentOpacity=fe.setCurrentOpacity.bind(fe),fe}return be(v,z),v.prototype.getUi=function(){var S=this,N=document.createElement("div");return N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2",N.style.justifyContent="space-between",this.opacities.forEach(function(Z){var G=document.createElement("div");G.style.display="flex",G.style.alignItems="center",G.style.justifyContent="center",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.borderColor=Z===S.currentOpacity?S.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){S.setCurrentOpacity(Z,G)}),N.appendChild(G);var fe=document.createElement("div");fe.innerText=100*Z+"%",G.appendChild(fe),S.opacityBoxes.push(G)}),N},v.prototype.setCurrentOpacity=function(S,N){var Z=this;this.currentOpacity=S,this.opacityBoxes.forEach(function(G){G.style.borderColor=G===N?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},v}(Ge),oe=function(z){function v(S,N,Z){var G=z.call(this,S,N,Z)||this;return G.setOpacity=G.setOpacity.bind(G),G.fillColor=Z.defaultHighlightColor,G.strokeWidth=0,G.opacity=Z.defaultHighlightOpacity,G.fillPanel=new je("Color",Z.defaultColorSet,G.fillColor),G.fillPanel.onColorChanged=G.setFillColor,G.opacityPanel=new ie("Opacity",Z.defaultOpacitySteps,G.opacity),G.opacityPanel.onOpacityChanged=G.setOpacity,G}return be(v,z),v.prototype.setOpacity=function(S){this.opacity=S,this.visual&&se.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var S=z.prototype.getState.call(this);return S.typeName=v.typeName,S},v.typeName="HighlightMarker",v.title="Highlight marker",v.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>',v}(te),he='<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>',ge=function(z){function v(S,N,Z){var G=z.call(this,S,N,Z)||this;return G.bgColor="transparent",G.tipPosition={x:0,y:0},G.tipBase1Position={x:0,y:0},G.tipBase2Position={x:0,y:0},G.tipMoving=!1,G.color=Z.defaultStrokeColor,G.bgColor=Z.defaultFillColor,G.fontFamily=Z.defaultFontFamily,G.defaultSize={x:100,y:30},G.setBgColor=G.setBgColor.bind(G),G.getTipPoints=G.getTipPoints.bind(G),G.positionTip=G.positionTip.bind(G),G.setTipPoints=G.setTipPoints.bind(G),G.colorPanel=new je("Text color",Z.defaultColorSet,G.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>'),G.colorPanel.onColorChanged=G.setColor,G.bgColorPanel=new je("Fill color",Z.defaultColorSet,G.bgColor,he),G.bgColorPanel.onColorChanged=G.setBgColor,G.fontFamilyPanel=new Se("Font",Z.defaultFontFamilies,Z.defaultFontFamily),G.fontFamilyPanel.onFontChanged=G.setFont,G.tipGrip=new ut,G.tipGrip.visual.transform.baseVal.appendItem(se.createTransform()),G.controlBox.appendChild(G.tipGrip.visual),G}return be(v,z),v.prototype.ownsTarget=function(S){return z.prototype.ownsTarget.call(this,S)||this.tipGrip.ownsTarget(S)||this.tip===S},v.prototype.createTip=function(){se.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=se.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},v.prototype.pointerDown=function(S,N){this.state==="new"&&z.prototype.pointerDown.call(this,S,N),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(N)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):z.prototype.pointerDown.call(this,S,N)},v.prototype.pointerUp=function(S){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,z.prototype.pointerUp.call(this,S);else{var N=this.state==="creating";z.prototype.pointerUp.call(this,S),this.setTipPoints(N),this.positionTip()}},v.prototype.manipulate=function(S){if(this.tipMoving){var N=this.unrotatePoint(S);this.tipPosition={x:N.x-this.manipulationStartLeft,y:N.y-this.manipulationStartTop},this.positionTip()}else z.prototype.manipulate.call(this,S)},v.prototype.setBgColor=function(S){this.bgRectangle&&this.tip&&(se.setAttributes(this.bgRectangle,[["fill",S]]),se.setAttributes(this.tip,[["fill",S]])),this.bgColor=S,this.fillColorChanged(S)},v.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},v.prototype.setTipPoints=function(S){S===void 0&&(S=!1);var N=Math.min(this.height/2,15),Z=this.height/5;S&&(this.tipPosition={x:N+Z/2,y:this.height+20});var G=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?G<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(Z=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:N,y:0},this.tipBase2Position={x:N+Z,y:0}):(this.tipBase1Position={x:0,y:N},this.tipBase2Position={x:0,y:N+Z}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?G<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(Z=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-N-Z,y:0},this.tipBase2Position={x:this.width-N,y:0}):(this.tipBase1Position={x:this.width,y:N},this.tipBase2Position={x:this.width,y:N+Z}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?G<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(Z=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-N-Z,y:this.height},this.tipBase2Position={x:this.width-N,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-N-Z},this.tipBase2Position={x:this.width,y:this.height-N}):G<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(Z=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:N,y:this.height},this.tipBase2Position={x:N+Z,y:this.height}):(this.tipBase1Position={x:0,y:this.height-N},this.tipBase2Position={x:0,y:this.height-N-Z})},v.prototype.resize=function(S){z.prototype.resize.call(this,S),this.positionTip()},v.prototype.positionTip=function(){se.setAttributes(this.tip,[["points",this.getTipPoints()]]);var S=this.tipGrip.visual.transform.baseVal.getItem(0);S.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(S,0)},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),v.prototype.select=function(){this.positionTip(),z.prototype.select.call(this)},v.prototype.getState=function(){var S=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},z.prototype.getState.call(this));return S.typeName=v.typeName,S},v.prototype.restoreState=function(S){var N=S;this.bgColor=N.bgColor,this.tipPosition=N.tipPosition,z.prototype.restoreState.call(this,S),this.createTip(),this.setTipPoints()},v.prototype.scale=function(S,N){z.prototype.scale.call(this,S,N),this.tipPosition={x:this.tipPosition.x*S,y:this.tipPosition.y*N},this.positionTip()},v.typeName="CalloutMarker",v.title="Callout marker",v.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>',v}(Ne),Ce=function(z){function v(S,N,Z){var G=z.call(this,S,N,Z)||this;return G.fillColor="transparent",G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.opacity=1,G.strokeColor=Z.defaultColor,G.strokeWidth=Z.defaultStrokeWidth,G.strokeDasharray=Z.defaultStrokeDasharray,G.fillColor=Z.defaultFillColor,G.setStrokeColor=G.setStrokeColor.bind(G),G.setFillColor=G.setFillColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.setOpacity=G.setOpacity.bind(G),G.createVisual=G.createVisual.bind(G),G.strokePanel=new je("Line color",me(Z.defaultColorSet,["transparent"]),Z.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.fillPanel=new je("Fill color",me(Z.defaultColorSet,["transparent"]),G.fillColor,he),G.fillPanel.onColorChanged=G.setFillColor,G.strokeWidthPanel=new ft("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new nt("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G.opacityPanel=new ie("Opacity",Z.defaultOpacitySteps,G.opacity),G.opacityPanel.onOpacityChanged=G.setOpacity,G}return be(v,z),v.prototype.ownsTarget=function(S){return!(!z.prototype.ownsTarget.call(this,S)&&S!==this.visual)},v.prototype.createVisual=function(){this.visual=se.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},v.prototype.pointerDown=function(S,N){z.prototype.pointerDown.call(this,S,N),this.state==="new"&&(this.createVisual(),this.moveVisual(S),this._state="creating")},v.prototype.manipulate=function(S){z.prototype.manipulate.call(this,S)},v.prototype.resize=function(S){z.prototype.resize.call(this,S),this.setSize()},v.prototype.setSize=function(){z.prototype.setSize.call(this),se.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},v.prototype.pointerUp=function(S){z.prototype.pointerUp.call(this,S),this.setSize()},v.prototype.setStrokeColor=function(S){this.strokeColor=S,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(S),this.stateChanged()},v.prototype.setFillColor=function(S){this.fillColor=S,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(S),this.stateChanged()},v.prototype.setStrokeWidth=function(S){this.strokeWidth=S,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},v.prototype.setStrokeDasharray=function(S){this.strokeDasharray=S,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},v.prototype.setOpacity=function(S){this.opacity=S,this.visual&&se.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var S=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this));return S.typeName=v.typeName,S},v.prototype.restoreState=function(S){var N=S;this.fillColor=N.fillColor,this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.opacity=N.opacity,this.createVisual(),z.prototype.restoreState.call(this,S),this.setSize()},v.prototype.scale=function(S,N){z.prototype.scale.call(this,S,N),this.setSize()},v.typeName="EllipseMarker",v.title="Ellipse marker",v.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>',v}(qe),De=function(z){function v(S,N,Z){return z.call(this,S,N,Z)||this}return be(v,z),Object.defineProperty(v.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),v.prototype.ownsTarget=function(S){return!(!z.prototype.ownsTarget.call(this,S)&&S!==this.tip1&&S!==this.tip2)},v.prototype.createTips=function(){this.tip1=se.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.tip1),this.tip2=se.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.tip2)},v.prototype.pointerDown=function(S,N){z.prototype.pointerDown.call(this,S,N),this.state==="creating"&&this.createTips()},v.prototype.adjustVisual=function(){if(z.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(se.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var S=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),N=this.tip1.transform.baseVal.getItem(0);N.setRotate(S,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(N,0);var Z=this.tip2.transform.baseVal.getItem(0);Z.setRotate(S+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(Z,0)}},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var S=z.prototype.getState.call(this);return S.typeName=v.typeName,S},v.prototype.restoreState=function(S){z.prototype.restoreState.call(this,S),this.createTips(),this.adjustVisual()},v.typeName="MeasurementMarker",v.title="Measurement marker",v.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>',v}(Je),Ke=function(z){function v(S,N,Z){var G=z.call(this,S,N,Z)||this;return G.strokePanel.colors=Z.defaultColorSet,G.fillColor="transparent",G}return be(v,z),Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var S=z.prototype.getState.call(this);return S.typeName=v.typeName,S},v.typeName="EllipseFrameMarker",v.title="Ellipse frame marker",v.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>',v}(Ce),ht=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(v){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(v)||(this.undoStack.push(v),JSON.stringify(this.lastRedoStep)!==JSON.stringify(v)&&this.redoStack.splice(0,this.redoStack.length))},z.prototype.replaceLastUndoStep=function(v){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=v)},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 v=this.undoStack.pop();return v!==void 0&&this.redoStack.push(v),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}(),it=function(z){function v(S,N,Z){var G=z.call(this,S,N,Z)||this;return G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.curveX=0,G.curveY=0,G.manipulationStartCurveX=0,G.manipulationStartCurveY=0,G.setStrokeColor=G.setStrokeColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.positionGrips=G.positionGrips.bind(G),G.addControlGrips=G.addControlGrips.bind(G),G.adjustVisual=G.adjustVisual.bind(G),G.setupControlBox=G.setupControlBox.bind(G),G.resize=G.resize.bind(G),G.strokeColor=Z.defaultColor,G.strokeWidth=Z.defaultStrokeWidth,G.strokeDasharray=Z.defaultStrokeDasharray,G.strokePanel=new je("Line color",Z.defaultColorSet,Z.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new ft("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new nt("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return be(v,z),v.prototype.ownsTarget=function(S){return!(!z.prototype.ownsTarget.call(this,S)&&S!==this.visual&&S!==this.selectorCurve&&S!==this.visibleCurve&&!this.curveGrip.ownsTarget(S))},v.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},v.prototype.createVisual=function(){this.visual=se.createGroup(),this.selectorCurve=se.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=se.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},v.prototype.pointerDown=function(S,N){z.prototype.pointerDown.call(this,S,N),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=S.x,this.curveY=S.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(N)&&(this.activeGrip=this.curveGrip,this._state="resize")},v.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),se.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},v.prototype.setupControlBox=function(){z.prototype.setupControlBox.call(this),this.curveControlLine1=se.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=se.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},v.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,z.prototype.addControlGrips.call(this)},v.prototype.positionGrips=function(){z.prototype.positionGrips.call(this);var S=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-S/2,this.curveY-S/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()))},v.prototype.manipulate=function(S){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+S.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+S.y-this.manipulationStartY),z.prototype.manipulate.call(this,S)},v.prototype.resize=function(S){this.activeGrip===this.curveGrip&&(this.curveX=S.x,this.curveY=S.y),z.prototype.resize.call(this,S),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},v.prototype.setStrokeColor=function(S){this.strokeColor=S,this.adjustVisual(),this.colorChanged(S)},v.prototype.setStrokeWidth=function(S){this.strokeWidth=S,this.adjustVisual()},v.prototype.setStrokeDasharray=function(S){this.strokeDasharray=S,this.adjustVisual()},v.prototype.scale=function(S,N){this.curveX=this.curveX*S,this.curveY=this.curveY*N,z.prototype.scale.call(this,S,N)},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var S=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},z.prototype.getState.call(this));return S.typeName=v.typeName,S},v.prototype.restoreState=function(S){z.prototype.restoreState.call(this,S);var N=S;this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.curveX=N.curveX,this.curveY=N.curveY,this.createVisual(),this.adjustVisual()},v.typeName="CurveMarker",v.title="Curve marker",v.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>',v}(ct),mt=function(){function z(v,S){S===void 0&&(S=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=v,this.cancelable=S}return Object.defineProperty(z.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),z.prototype.preventDefault=function(){this._defaultPrevented=!0},z}(),_t=function(z){function v(S,N,Z){var G=z.call(this,S,!1)||this;return G.dataUrl=N,G.state=Z,G}return be(v,z),v}(mt),Qe=function(z){function v(S,N,Z){Z===void 0&&(Z=!1);var G=z.call(this,S,Z)||this;return G.marker=N,G}return be(v,z),v}(mt),Ft=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(v,S){this[v].push(S)},z.prototype.removeEventListener=function(v,S){var N=this[v].indexOf(S);N>-1&&this[v].splice(N,1)},z}(),Ct=function(){function z(v){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Ae,this._isOpen=!1,this.undoRedoManager=new ht,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new Ft,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=z.instanceCounter++,this.styles=new rt(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=v,this.targetRoot=document.body,this.width=v.clientWidth,this.height=v.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[Ye,ve,pe,Ne,Ke,Ce,oe,ge,De,te,Je,it]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Ye,ve,pe,Ne,Ce,oe,ge]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Ye,ve,pe,Ne,oe]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(v){var S=this;this._availableMarkerTypes.splice(0),v.forEach(function(N){if(typeof N=="string"){var Z=S.ALL_MARKER_TYPES.find(function(G){return G.typeName===N});Z!==void 0&&S._availableMarkerTypes.push(Z)}else S._availableMarkerTypes.push(N)})},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(v){this._zoomLevel=v,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(),Re.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},z.prototype.show=function(){var v=this;this.styles.styleSheetRoot===void 0&&He.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=He.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(S){return S(new mt(v))})},z.prototype.render=function(){return we(this,void 0,void 0,function(){var v;return xe(this,function(S){switch(S.label){case 0:return this.setCurrentMarker(),(v=new ze).naturalSize=this.renderAtNaturalSize,v.imageType=this.renderImageType,v.imageQuality=this.renderImageQuality,v.markersOnly=this.renderMarkersOnly,v.width=this.renderWidth,v.height=this.renderHeight,[4,v.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return S.sent(),[4,v.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,S.sent()]}})})},z.prototype.close=function(v){var S=this;if(v===void 0&&(v=!1),this.isOpen){var N=!1;v||this.eventListeners.beforeclose.forEach(function(Z){var G=new mt(S,!0);Z(G),G.defaultPrevented&&(N=!0)}),N||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(Z){return Z(new mt(S))}),this.detachEvents(),this._isOpen=!1)}},z.prototype.addMarkersToToolbar=function(){for(var v,S=[],N=0;N<arguments.length;N++)S[N]=arguments[N];(v=this._availableMarkerTypes).push.apply(v,S)},z.prototype.addRenderEventListener=function(v){this.addEventListener("render",function(S){v(S.dataUrl,S.state)})},z.prototype.removeRenderEventListener=function(v){},z.prototype.addCloseEventListener=function(v){this.addEventListener("close",function(){v()})},z.prototype.removeCloseEventListener=function(v){},z.prototype.setupResizeObserver=function(){var v=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){v.resize(v.target.clientWidth,v.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return v.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},z.prototype.onPopupTargetResize=function(){var v=1*this.target.clientWidth/this.target.clientHeight,S=this.editorCanvas.clientWidth/v>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*v:this.editorCanvas.clientWidth,N=S<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/v;this.resize(S,N)},z.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},z.prototype.resize=function(v,S){this._isResizing=!0;var N=v/this.imageWidth,Z=S/this.imageHeight;this.imageWidth=Math.round(v),this.imageHeight=Math.round(S),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(N,Z),this._isResizing=!1},z.prototype.scaleMarkers=function(v,S){var N,Z=this;this._currentMarker&&this._currentMarker instanceof Ne?this._currentMarker.scale(v,S):(N=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(G){G!==Z._currentMarker&&G.scale(v,S)}),N!==void 0&&this.setCurrentMarker(N)},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 v=this.editingTarget.getBoundingClientRect(),S=this.editorCanvas.getBoundingClientRect();this.left=v.left-S.left,this.top=v.top-S.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 v,S=[],N=0;N<arguments.length;N++)S[N]=arguments[N];this.defs=se.createDefs(),this.addDefsToImage(),(v=this.defs).append.apply(v,S)},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 v=document.createElement("a");v.href="https://markerjs.com/",v.target="_blank",v.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>',v.title="Powered by marker.js",v.style.display="grid",v.style.alignItems="center",v.style.justifyItems="center",v.style.padding="3px",v.style.width="20px",v.style.height="20px",this.logoUI.appendChild(v),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 v=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=v+"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 Le(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 Ue(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(v){this.markerImage.removeChild(v.container),this.markers.indexOf(v)>-1&&this.markers.splice(this.markers.indexOf(v),1),v.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(v,S){if(v==="marker"&&S!==void 0)this.createNewMarker(S);else if(v==="action")switch(S){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 v=this;if(this._currentMarker!==void 0){var S=!1;if(this.eventListeners.markerbeforedelete.forEach(function(Z){var G=new Qe(v,v._currentMarker,!0);Z(G),G.defaultPrevented&&(S=!0)}),!S){var N=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(Z){return Z(new Qe(v,N))})}}},z.prototype.clear=function(){var v=this,S=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(fe){var ke=new Qe(v,void 0,!0);fe(ke),ke.defaultPrevented&&(S=!0)}),!S)){this.setCurrentMarker();for(var N=function(fe){var ke=Z.markers[fe];Z.setCurrentMarker(Z.markers[fe]),Z._currentMarker.dispose(),Z.markerImage.removeChild(Z._currentMarker.container),Z.markers.splice(Z.markers.indexOf(Z._currentMarker),1),Z.eventListeners.markerdelete.forEach(function(Ze){return Ze(new Qe(v,ke))})},Z=this,G=this.markers.length-1;G>=0;G--)N(G);this.addUndoStep()}},Object.defineProperty(z.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),z.prototype.showNotesEditor=function(){var v;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=(v=this._currentMarker.notes)!==null&&v!==void 0?v:"",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 v=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var S=this.getState(),N=this.undoRedoManager.getLastUndoStep();if(!N||N.width===S.width&&N.height===S.height){var Z=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(S),Z<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(G){return G(new mt(v))})}else this.undoRedoManager.replaceLastUndoStep(S),this.eventListeners.statechange.forEach(function(G){return G(new mt(v))})}},z.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},z.prototype.undoStep=function(){var v=this,S=this.undoRedoManager.undo();S!==void 0&&(this.restoreState(S),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(N){return N(new mt(v))}))},z.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},z.prototype.redoStep=function(){var v=this,S=this.undoRedoManager.redo();S!==void 0&&(this.restoreState(S),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(N){return N(new mt(v))}))},z.prototype.stepZoom=function(){var v=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=v<this.zoomSteps.length-1?this.zoomSteps[v+1]:this.zoomSteps[0]},z.prototype.panTo=function(v){this.contentDiv.scrollBy({left:this.prevPanPoint.x-v.x,top:this.prevPanPoint.y-v.y}),this.prevPanPoint=v},z.prototype.startRenderAndClose=function(){return we(this,void 0,void 0,function(){var v,S,N=this;return xe(this,function(Z){switch(Z.label){case 0:return[4,this.render()];case 1:return v=Z.sent(),S=this.getState(),this.eventListeners.render.forEach(function(G){return G(new _t(N,v,S))}),this.close(!0),[2]}})})},z.prototype.getState=function(v){v===!0&&this.setCurrentMarker();var S={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(N){return S.markers.push(N.getState())}),S},z.prototype.restoreState=function(v){var S=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);v.markers.forEach(function(N){var Z=S._availableMarkerTypes.find(function(fe){return fe.typeName===N.typeName});if(Z!==void 0){var G=S.addNewMarker(Z);G.restoreState(N),S.markers.push(G)}}),v.width&&v.height&&(v.width!==this.imageWidth||v.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/v.width,this.imageHeight/v.height),this.eventListeners.restorestate.forEach(function(N){return N(new mt(S))})},z.prototype.addNewMarker=function(v){var S=se.createGroup();return this.markerImage.appendChild(S),new v(S,this.overlayContainer,this.settings)},z.prototype.createNewMarker=function(v){var S,N=this;(S=typeof v=="string"?this._availableMarkerTypes.find(function(Z){return Z.typeName===v}):v)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(S),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(S.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(Z){return Z(new Qe(N,N._currentMarker))}))},z.prototype.markerCreated=function(v){var S=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(v),this.setCurrentMarker(v),v instanceof ve&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(ve):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(N){return N(new Qe(S,S._currentMarker))})},z.prototype.colorChanged=function(v){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=v,this.settings.defaultStrokeColor=v)},z.prototype.fillColorChanged=function(v){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=v)},z.prototype.markerStateChanged=function(v){var S=this;this.eventListeners.markerchange.forEach(function(N){return N(new Qe(S,v))})},z.prototype.setCurrentMarker=function(v){var S=this;this._currentMarker!==v&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(N){return N(new Qe(S,S._currentMarker))})),this._currentMarker=v,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(N){return N(new Qe(S,S._currentMarker))}))},z.prototype.onPointerDown=function(v){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||v.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var S=this.markers.find(function(N){return N.ownsTarget(v.target)});S!==void 0?(this.setCurrentMarker(S),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(v.clientX,v.clientY),v.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:v.clientX,y:v.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(v.clientX,v.clientY))},z.prototype.onDblClick=function(v){if(this._isFocused||this.focus(),this.mode==="select"){var S=this.markers.find(function(N){return N.ownsTarget(v.target)});S!==void 0&&S!==this._currentMarker&&this.setCurrentMarker(S),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(v.clientX,v.clientY),v.target):this.setCurrentMarker()}},z.prototype.onPointerMove=function(v){this.touchPoints!==1&&v.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||v.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(v.clientX,v.clientY)):this.zoomLevel>1&&this.panTo({x:v.clientX,y:v.clientY}))},z.prototype.onPointerUp=function(v){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(v.clientX,v.clientY)),this.isDragging=!1,this.addUndoStep()},z.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},z.prototype.onKeyUp=function(v){this._currentMarker===void 0||this.notesArea!==void 0||v.key!=="Delete"&&v.key!=="Backspace"||this.deleteSelectedMarker()},z.prototype.clientToLocalCoordinates=function(v,S){var N=this.markerImage.getBoundingClientRect();return{x:(v-N.left)/this.zoomLevel,y:(S-N.top)/this.zoomLevel}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var v=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=v+"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(v){Re.addKey(v)},z.prototype.addEventListener=function(v,S){this.eventListeners.addEventListener(v,S)},z.prototype.removeEventListener=function(v,S){this.eventListeners.removeEventListener(v,S)},z.prototype.renderState=function(v){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(v),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(z.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),z.prototype.focus=function(){var v=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(S){return S(new mt(v))}))},z.prototype.blur=function(){var v=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(S){return S(new mt(v))}))},z.instanceCounter=0,z}();/* **********************************
|
|
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 Yt=function(z,v){return(Yt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(S,N){S.__proto__=N}||function(S,N){for(var Z in N)Object.prototype.hasOwnProperty.call(N,Z)&&(S[Z]=N[Z])})(z,v)};function $t(z,v){if(typeof v!="function"&&v!==null)throw new TypeError("Class extends value "+String(v)+" is not a constructor or null");function S(){this.constructor=z}Yt(z,v),z.prototype=v===null?Object.create(v):(S.prototype=v.prototype,new S)}function Lt(z,v,S,N){return new(S||(S=Promise))(function(Z,G){function fe(gt){try{Ze(N.next(gt))}catch(Fe){G(Fe)}}function ke(gt){try{Ze(N.throw(gt))}catch(Fe){G(Fe)}}function Ze(gt){var Fe;gt.done?Z(gt.value):(Fe=gt.value,Fe instanceof S?Fe:new S(function(Et){Et(Fe)})).then(fe,ke)}Ze((N=N.apply(z,v||[])).next())})}function di(z,v){var S,N,Z,G,fe={label:0,sent:function(){if(1&Z[0])throw Z[1];return Z[1]},trys:[],ops:[]};return G={next:ke(0),throw:ke(1),return:ke(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function ke(Ze){return function(gt){return function(Fe){if(S)throw new TypeError("Generator is already executing.");for(;fe;)try{if(S=1,N&&(Z=2&Fe[0]?N.return:Fe[0]?N.throw||((Z=N.return)&&Z.call(N),0):N.next)&&!(Z=Z.call(N,Fe[1])).done)return Z;switch(N=0,Z&&(Fe=[2&Fe[0],Z.value]),Fe[0]){case 0:case 1:Z=Fe;break;case 4:return fe.label++,{value:Fe[1],done:!1};case 5:fe.label++,N=Fe[1],Fe=[0];continue;case 7:Fe=fe.ops.pop(),fe.trys.pop();continue;default:if(!(Z=fe.trys,(Z=Z.length>0&&Z[Z.length-1])||Fe[0]!==6&&Fe[0]!==2)){fe=0;continue}if(Fe[0]===3&&(!Z||Fe[1]>Z[0]&&Fe[1]<Z[3])){fe.label=Fe[1];break}if(Fe[0]===6&&fe.label<Z[1]){fe.label=Z[1],Z=Fe;break}if(Z&&fe.label<Z[2]){fe.label=Z[2],fe.ops.push(Fe);break}Z[2]&&fe.ops.pop(),fe.trys.pop();continue}Fe=v.call(z,fe)}catch(Et){Fe=[6,Et],N=0}finally{S=Z=0}if(5&Fe[0])throw Fe[1];return{value:Fe[0]?Fe[1]:void 0,done:!0}}([Ze,gt])}}}var Ii=function(){function z(){}return z.addKey=function(v){z.key=v},Object.defineProperty(z,"isLicensed",{get:function(){return!!z.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(z.key)},enumerable:!1,configurable:!0}),z}(),Ve=function(){function z(){}return z.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},z.setAttributes=function(v,S){for(var N=0,Z=S;N<Z.length;N++){var G=Z[N],fe=G[0],ke=G[1];v.setAttribute(fe,ke)}},z.createRect=function(v,S,N){var Z=document.createElementNS("http://www.w3.org/2000/svg","rect");return Z.setAttribute("width",v.toString()),Z.setAttribute("height",S.toString()),N&&z.setAttributes(Z,N),Z},z.createLine=function(v,S,N,Z,G){var fe=document.createElementNS("http://www.w3.org/2000/svg","line");return fe.setAttribute("x1",v.toString()),fe.setAttribute("y1",S.toString()),fe.setAttribute("x2",N.toString()),fe.setAttribute("y2",Z.toString()),G&&z.setAttributes(fe,G),fe},z.createPolygon=function(v,S){var N=document.createElementNS("http://www.w3.org/2000/svg","polygon");return N.setAttribute("points",v),S&&z.setAttributes(N,S),N},z.createCircle=function(v,S){var N=document.createElementNS("http://www.w3.org/2000/svg","circle");return N.setAttribute("cx",(v/2).toString()),N.setAttribute("cy",(v/2).toString()),N.setAttribute("r",v.toString()),S&&z.setAttributes(N,S),N},z.createEllipse=function(v,S,N){var Z=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Z.setAttribute("cx",(v/2).toString()),Z.setAttribute("cy",(S/2).toString()),Z.setAttribute("rx",(v/2).toString()),Z.setAttribute("ry",(S/2).toString()),N&&z.setAttributes(Z,N),Z},z.createGroup=function(v){var S=document.createElementNS("http://www.w3.org/2000/svg","g");return v&&z.setAttributes(S,v),S},z.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},z.createMarker=function(v,S,N,Z,G,fe,ke){var Ze=document.createElementNS("http://www.w3.org/2000/svg","marker");return z.setAttributes(Ze,[["id",v],["orient",S],["markerWidth",N.toString()],["markerHeight",Z.toString()],["refX",G.toString()],["refY",fe.toString()]]),Ze.appendChild(ke),Ze},z.createText=function(v){var S=document.createElementNS("http://www.w3.org/2000/svg","text");return S.setAttribute("x","0"),S.setAttribute("y","0"),v&&z.setAttributes(S,v),S},z.createTSpan=function(v,S){var N=document.createElementNS("http://www.w3.org/2000/svg","tspan");return N.textContent=v,S&&z.setAttributes(N,S),N},z.createImage=function(v){var S=document.createElementNS("http://www.w3.org/2000/svg","image");return v&&z.setAttributes(S,v),S},z.createPoint=function(v,S){var N=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return N.x=v,N.y=S,N},z.createPath=function(v,S){var N=document.createElementNS("http://www.w3.org/2000/svg","path");return N.setAttribute("d",v),S&&z.setAttributes(N,S),N},z.createElement=function(v,S){var N=document.createElementNS("http://www.w3.org/2000/svg",v);return S&&z.setAttributes(N,S),N},z.getHollowRectanglePath=function(v,S,N,Z,G,fe,ke,Ze){return"M"+v+","+S+"V"+(S+Z)+"H"+(v+N)+"V"+S+"H"+G+"V"+fe+"H"+(G+ke)+"V"+(fe+Ze)+"H"+G+"V"+S+"Z"},z}(),St=function(){function z(v){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+v+"_"}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:"#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(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(v){return this.styleSheet===void 0&&this.addStyleSheet(),v.name=""+this.classNamePrefix+v.localName,this.classes.push(v),this.styleSheet.sheet.insertRule("."+v.name+" {"+v.style+"}",this.styleSheet.sheet.cssRules.length),v},z.prototype.addRule=function(v){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(v),this.styleSheet.sheet.insertRule(v.selector+" {"+v.style+"}",this.styleSheet.sheet.cssRules.length)},z.prototype.addStyleSheet=function(){var v;this.styleSheet=document.createElement("style"),((v=this.styleSheetRoot)!==null&&v!==void 0?v:document.head).appendChild(this.styleSheet),this.addRule(new Rt("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Rt("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new Rt("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new It("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new It("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},z.prototype.removeStyleSheet=function(){var v;this.styleSheet&&(((v=this.styleSheetRoot)!==null&&v!==void 0?v:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},z}(),Rt=function(z,v){this.selector=z,this.style=v},It=function(z,v){this.localName=z,this.style=v},qt=function(){function z(){this.blocks=[],this.display=""}return z.prototype.addButtonBlock=function(v){v.className=this.blockClassName,v.buttonClassName=this.buttonClassName,v.buttonColorsClassName=this.buttonColorsClassName,v.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(v)},z.prototype.addElementBlock=function(v){v.className===void 0&&(v.className=this.blockClassName),this.blocks.push(v)},z.prototype.getUI=function(){var v=document.createElement("div");return v.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,v.style.display=this.display,this.blocks.forEach(function(S){return v.appendChild(S.getUI())}),v},z}(),jt=function(){function z(){}return z.prototype.getUI=function(){var v=document.createElement("div");if(v.className=this.className,this.minWidth!==void 0&&(v.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":v.style.justifyContent="flex-start";break;case"center":v.style.justifyContent="center";break;case"end":v.style.justifyContent="flex-end"}return v.style.whiteSpace="nowrap",v},z}(),Kt=function(z){function v(){var S=z!==null&&z.apply(this,arguments)||this;return S.buttons=[],S}return $t(v,z),v.prototype.addButton=function(S){S.className=this.buttonClassName,S.colorsClassName=this.buttonColorsClassName,S.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(S)},v.prototype.getUI=function(){var S=z.prototype.getUI.call(this);return this.buttons.forEach(function(N){return S.appendChild(N.getUI())}),S},v}(jt),Tt=function(){function z(v,S){this._isActive=!1,this._isHidden=!1,this._icon=v,this.title=S,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(z.prototype,"icon",{get:function(){return this._icon},set:function(v){this._icon=v,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isActive",{get:function(){return this._isActive},set:function(v){this._isActive=v,this.adjustClassName()},enumerable:!1,configurable:!0}),z.prototype.getUI=function(){var v=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 v.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},z.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,"")))},z.prototype.hide=function(){this._isHidden=!0},z}(),lt=function(z){function v(){var S=z!==null&&z.apply(this,arguments)||this;return S.elements=[],S}return $t(v,z),v.prototype.addElement=function(S){this.elements.push(S)},v.prototype.getUI=function(){var S=z.prototype.getUI.call(this);return this.elements.forEach(function(N){return S.appendChild(N)}),S},v}(jt),Ai=function(){function z(v,S){this.horizontal=v,this.vertical=S}return Object.defineProperty(z.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),z.prototype.getVerticalLength=function(v){return v/this.ratio},z.prototype.getHorizontalLength=function(v){return v*this.ratio},z}(),Ei=function(){function z(){}return z.getIcon=function(v,S){if(v>0&&S>0){var N=new Ai(v,S),Z=N.ratio>=1?20:N.getHorizontalLength(20),G=N.ratio<1?20:N.getVerticalLength(20),fe=document.createElementNS("http://www.w3.org/2000/svg","svg");fe.setAttribute("xmlns","http://www.w3.org/2000/svg"),fe.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(fe);var ke=Ve.createDefs();fe.appendChild(ke);var Ze=Ve.createElement("clipPath",[["id","text-bg-clip"]]);ke.appendChild(Ze);var gt=Ve.createPath(Ve.getHollowRectanglePath((24-Z)/2,(24-G)/2,Z,G,(24-Z)/2+2,(24-G)/2+2,Z-4,G-4));fe.appendChild(gt);var Fe=Ve.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Fe.appendChild(Ve.createTSpan(v+":"+S)),fe.appendChild(Fe);var Et=Fe.getBBox();Ve.setAttributes(Fe,[["x",((24-Et.width)/2).toString()],["y",((24-Et.height)/2-Et.y).toString()]]);var Ht=Ve.createPath(Ve.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Et.width))/2,(24-Math.ceil(Et.height))/2,Math.ceil(Et.width),Math.ceil(Et.height)));return Ze.appendChild(Ht),Ve.setAttributes(gt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(fe),fe.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>'},z}(),ii=function(z){function v(S,N,Z){var G=z.call(this,S,N)||this;return G.isDropdownOpen=!1,G.onClick=G.dropdownButtonClicked,G.dropdownButtons=Z,G}return $t(v,z),v.prototype.setupDropdown=function(){var S=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(N){N.className=S.className,N.colorsClassName=S.colorsClassName,S.dropdownBlock.appendChild(N.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},v.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},v.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},v.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},v.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},v.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},v}(Tt),Mt=function(){function z(v,S){this.GRIP_SIZE=10,this.color=v,this.fillColor=S,this.visual=Ve.createGroup(),this.visual.appendChild(Ve.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Ve.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return z.prototype.ownsTarget=function(v){return v===this.visual||v===this.visual.childNodes[0]||v===this.visual.childNodes[1]},z.prototype.setCenter=function(v,S){this.visual.childNodes.forEach(function(N){return Ve.setAttributes(N,[["cx",v.toString()],["cy",S.toString()]])})},z}(),Gi=function(){function z(v,S,N,Z){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=v,this.canvasHeight=S,this.margin=N,this.container=Z,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(z.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(v){this._aspectRatio=v,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(v){this._isGridVisible=v,this.gridContainer&&Ve.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(v){this._zoomFactor=v,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),z.prototype.open=function(){var v=this;this.cropShadeElement=Ve.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Ve.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var S=0;S<this.numberOfGridLines;S++)this.horizontalGridLines.push(Ve.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Ve.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(N){return v.gridContainer.appendChild(N)}),this.verticalGridLines.forEach(function(N){return v.gridContainer.appendChild(N)}),this.cropRectElement=Ve.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Mt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Mt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Mt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Mt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},z.prototype.setCropRectangle=function(v){this.cropRect=v;var S=Object.assign({},this.cropRect);this.zoomFactor!==1&&(S.width=this.cropRect.width*this.zoomFactor,S.height=this.cropRect.height*this.zoomFactor,S.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-S.width/2,S.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-S.height/2),Ve.setAttributes(this.cropRectElement,[["x",S.x.toString()],["y",S.y.toString()],["width",S.width.toString()],["height",S.height.toString()]]);var N=S.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(G,fe){var ke=S.y+N*(fe+1);Ve.setAttributes(G,[["x1",""+S.x],["y1",""+ke],["x2",""+(S.x+S.width)],["y2",""+ke]])});var Z=S.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(G,fe){var ke=S.x+Z*(fe+1);Ve.setAttributes(G,[["x1",""+ke],["y1",""+S.y],["x2",""+ke],["y2",""+(S.y+S.height)]])}),Ve.setAttributes(this.cropShadeElement,[["d",Ve.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,S.x,S.y,S.width,S.height)]]),this.topLeftGrip.setCenter(S.x,S.y),this.topRightGrip.setCenter(S.x+S.width,S.y),this.bottomLeftGrip.setCenter(S.x,S.y+S.height),this.bottomRightGrip.setCenter(S.x+S.width,S.y+S.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},z.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)},z.prototype.clientToLocalCoordinates=function(v,S){var N=this.container.getBoundingClientRect();return{x:v-N.left+this.margin,y:S-N.top+this.margin}},z.prototype.onPointerDown=function(v){this.container.setPointerCapture(v.pointerId),this.previousPoint=this.clientToLocalCoordinates(v.clientX,v.clientY),this.cropRectElement===v.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(v.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(v.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(v.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(v.target)&&(this.activeGrip=this.bottomRightGrip)},z.prototype.onPointerMove=function(v){if(this.isMoving)this.move(this.clientToLocalCoordinates(v.clientX,v.clientY));else if(this.activeGrip){var S=this.clientToLocalCoordinates(v.clientX,v.clientY);this.resize(S)}v.preventDefault()},z.prototype.onPointerUp=function(v){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(v.pointerId)},z.prototype.move=function(v){var S=v.x-this.previousPoint.x,N=v.y-this.previousPoint.y;this.zoomFactor!==1&&(S=-S/this.zoomFactor,N=-N/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+S),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+N),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=v},z.prototype.resize=function(v){var S=Object.assign({},this.cropRect),N=v.x-this.previousPoint.x,Z=v.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:S.x+N<this.margin&&(N=this.margin-S.x),S.x+=N,S.width=this.cropRect.x+this.cropRect.width-S.x;break;case this.bottomRightGrip:case this.topRightGrip:S.width+N>this.canvasWidth*this.zoomFactor&&(N=this.canvasWidth*this.zoomFactor-S.width),S.width+=N}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(S.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(N),S.height=this.aspectRatio.getVerticalLength(S.width)):(S.y+=Z,S.height=this.cropRect.y+this.cropRect.height-S.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?S.height=this.aspectRatio.getVerticalLength(S.width):S.height+=Z}S.width<10&&(S.x=this.cropRect.x,S.width=10),S.height<10&&(S.y=this.cropRect.y,S.height=10),this.previousPoint=v,S.x>=this.margin&&S.y>=this.margin&&S.x-this.margin+S.width<=this.canvasWidth&&S.y-this.margin+S.height<=this.canvasHeight&&(this.cropRect=S,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},z.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var v=this.cropRect.x+this.cropRect.width/2,S=this.cropRect.y+this.cropRect.height/2,N=this.aspectRatio.getHorizontalLength(this.cropRect.height),Z=this.aspectRatio.getVerticalLength(this.cropRect.width);N/this.canvasWidth<Z/this.canvasHeight?this.cropRect.width=N:this.cropRect.height=Z,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=v-this.cropRect.width/2,this.cropRect.y=S-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)}},z.prototype.getRescaledRect=function(v,S,N,Z,G,fe){var ke=N/v,Ze=Z/S;return{x:(G.x-fe)*ke+fe,y:(G.y-fe)*Ze+fe,width:G.width*ke,height:G.height*Ze}},z.prototype.scaleCanvas=function(v,S){var N=this.getRescaledRect(this.canvasWidth,this.canvasHeight,v,S,this.cropRect,this.margin);this.canvasWidth=v,this.canvasHeight=S,this.onCropChange&&this.onCropChange(N),this.setCropRectangle(N)},z}(),$i=function(){function z(v){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=v,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(z.prototype,"angle",{get:function(){return this._angle},set:function(v){this._angle=v,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),z.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},z.prototype.onPointerDown=function(v){this.controlContainer.setPointerCapture(v.pointerId),this.isDragging=!0,this.previousPoint={x:v.clientX,y:v.clientY}},z.prototype.onPointerMove=function(v){this.isDragging&&(this.onAngleChange&&this.onAngleChange((v.clientX-this.previousPoint.x)/5),this.previousPoint.x=v.clientX)},z.prototype.onPointerUp=function(v){this.isDragging&&this.onAngleChange&&this.onAngleChange((v.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(v.pointerId)},z.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var v=this.angleLabelText.getBBox();Ve.setAttributes(this.angleLabelElement,[["x",((this.width-v.width)/2).toString()],["y",(this.height/2).toString()]])}},z.prototype.positionScaleShape=function(){if(this.scaleShape){var v=this.scaleShape.transform.baseVal.getItem(0);v.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(v,0)}},z.prototype.getVisual=function(){var v=document.createElementNS("http://www.w3.org/2000/svg","svg");v.setAttribute("xmlns","http://www.w3.org/2000/svg"),v.setAttribute("width",this.width+"px"),v.setAttribute("height",this.height+"px"),v.setAttribute("viewBox","0 0 "+this.width+" "+this.height),v.style.flexShrink="0",document.body.appendChild(v);for(var S="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,N=1;N<=this.width/5+10;N++){var Z=N%5==0?this.height/3:this.height/6;S+="h4v"+-Z+"h1v"+Z}S+="v1H0Z",this.scaleShape=Ve.createPath(S);var G=Ve.createTransform();this.scaleShape.transform.baseVal.appendItem(G),v.appendChild(this.scaleShape),this.angleLabelElement=Ve.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Ve.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var fe=Ve.createTSpan("");return fe.innerHTML="°",this.angleLabelElement.appendChild(fe),v.appendChild(this.angleLabelElement),document.body.removeChild(v),v},z}(),pn=function(){function z(){this.naturalSize=!1,this.imageType="image/png"}return z.prototype.rasterize=function(v,S,N,Z,G,fe,ke){var Ze=this;return new Promise(function(gt){var Fe=document.createElement("canvas");Fe.width=v.width.baseVal.value-2*Z,Fe.height=v.height.baseVal.value-2*Z;var Et=1,Ht=1;Ze.naturalSize===!0?(Et=S.naturalWidth/(v.width.baseVal.value-2*Z)/fe,Ht=S.naturalHeight/(v.height.baseVal.value-2*Z)/ke,Fe.width=S.naturalWidth/fe,Fe.height=S.naturalHeight/ke):Ze.width!==void 0&&Ze.height!==void 0&&(Et=Ze.width/N.width,Ht=Ze.height/N.height,Fe.width*=Et,Fe.height*=Ht);var Zt=Fe.getContext("2d");Zt.translate(Fe.width/2,Fe.height/2),Zt.rotate(G*Math.PI/180),Zt.scale(fe,ke),Zt.translate(-Fe.width/2,-Fe.height/2),Zt.drawImage(S,0,0,Fe.width,Fe.height);var Bi=document.createElement("canvas");Bi.width=N.width*Et,Bi.height=N.height*Ht,Bi.getContext("2d").putImageData(Zt.getImageData((N.x-Z)*Et,(N.y-Z)*Ht,N.width*Et,N.height*Ht),0,0),gt(Bi.toDataURL(Ze.imageType,Ze.imageQuality))})},z}(),We=function(){function z(v){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=z.instanceCounter++,this.styles=new St(this.instanceNo),this.target=v,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(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(v){this._zoomToCropEnabled=v,v?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(v){this._isGridVisible=v,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"gridLines",{get:function(){return this._gridLines},set:function(v){this._gridLines=v,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(v){this._rotationAngle=v,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"aspectRatio",{get:function(){var v;return(v=this._aspectRatio)!==null&&v!==void 0?v:this.aspectRatios[0]},set:function(v){this._aspectRatio=v},enumerable:!1,configurable:!0}),z.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},z.prototype.show=function(){this.showUI(),this.open()},z.prototype.close=function(v){v===void 0&&(v=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),v||this.closeEventListeners.forEach(function(S){return S()}),this._isOpen=!1)},z.prototype.addRenderEventListener=function(v){this.renderEventListeners.push(v)},z.prototype.removeRenderEventListener=function(v){this.renderEventListeners.indexOf(v)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(v),1)},z.prototype.addCloseEventListener=function(v){this.closeEventListeners.push(v)},z.prototype.removeCloseEventListener=function(v){this.closeEventListeners.indexOf(v)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(v),1)},z.prototype.setupResizeObserver=function(){var v=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){v.resize(v.target.clientWidth,v.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))},z.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var v=1*this.target.clientWidth/this.target.clientHeight,S=this.contentDiv.clientWidth/v>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*v:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,N=S+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/v;this.resize(S,N)}},z.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},z.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",Ve.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},z.prototype.resize=function(v,S){this.imageWidth=Math.round(v),this.imageHeight=Math.round(S),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()},z.prototype.setEditingTarget=function(){var v=document.createElement("canvas");v.width=this.target.naturalWidth,v.height=this.target.naturalHeight,v.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var S=v.toDataURL();Ve.setAttributes(this.editingTarget,[["href",S]]),this.setEditingTargetSize()},z.prototype.setTopLeft=function(){var v=this.target.getBoundingClientRect(),S=this.editorCanvas.getBoundingClientRect();this.left=v.left-S.left-this.CANVAS_MARGIN,this.top=v.top-S.top-this.CANVAS_MARGIN},z.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=Ve.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Ve.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Ve.createGroup(),this.editingTargetRotationScaleContainer=Ve.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var v=Ve.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(v);var S=Ve.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(S),this.editingTargetContainer=Ve.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)},z.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},z.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=Ve.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Gi(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()},z.prototype.zoomToCrop=function(){if(this.cropRect){var v=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,S=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=v+"px "+S+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-v+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-S+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},z.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)},z.prototype.cropRectChanged=function(v){this.cropRect=v,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},z.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},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.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 v=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,S=this.target.offsetTop>v+this.CANVAS_MARGIN?this.target.offsetTop-(v+this.CANVAS_MARGIN):0;this.coverDiv.style.top=S+"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},z.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},z.prototype.addTopToolbar=function(){var v=this;this.topToolbar=new qt,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var S=new Kt;S.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(S);var N=[];this.aspectRatios.forEach(function(Ht){var Zt=new Tt(Ei.getIcon(Ht.horizontal,Ht.vertical),Ht.horizontal===0&&Ht.vertical===0?"FREE":Ht.horizontal+":"+Ht.vertical);Zt.onClick=function(){return v.ratioButtonClicked(Ht)},N.push(Zt)}),this.aspectRatioButton=new ii(Ei.getIcon(0,0),"Aspect ratio",N),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,S.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var Z=new Tt('<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");Z.isActive=this.isGridVisible,Z.onClick=function(){v.isGridVisible=!v.isGridVisible,Z.isActive=v.isGridVisible},S.addButton(Z);var G=new Tt('<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(G.isActive=this.zoomToCropEnabled,G.onClick=function(){v.zoomToCropEnabled=!v.zoomToCropEnabled,G.isActive=v.zoomToCropEnabled},S.addButton(G),!Ii.isLicensed){var fe=new lt;this.topToolbar.addElementBlock(fe);var ke=document.createElement("div");ke.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Ze=document.createElement("a");Ze.style.color="currentColor",Ze.href="https://markerjs.com/products/cropro",Ze.target="_blank",Ze.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>',ke.appendChild(Ze),fe.addElement(ke)}var gt=new Kt;gt.minWidth=3*this.toolbarHeight+"px",gt.contentAlign="end",this.topToolbar.addButtonBlock(gt);var Fe=new Tt('<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");Fe.onClick=this.startRenderAndClose,gt.addButton(Fe),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Fe.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Et=new Tt('<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");Et.onClick=this.close,gt.addButton(Et),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Et.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},z.prototype.addBottomToolbar=function(){var v=this;this.bottomToolbar=new qt,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var S=new Kt;S.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(S);var N=new Tt('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");N.onClick=this.rotateLeftButtonClicked,S.addButton(N);var Z=new Tt('<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");Z.onClick=this.rotateRightButtonClicked,S.addButton(Z);var G=new lt;G.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(G),this.straightener=new $i("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(gt){v.rotateBy(gt),v.straightener.angle=v.rotationAngle},G.addElement(this.straightener.getUI());var fe=new Kt;fe.minWidth=2*this.toolbarHeight+"px",fe.contentAlign="end",this.bottomToolbar.addButtonBlock(fe);var ke=new Tt('<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");ke.onClick=this.flipHorizontallyButtonClicked,fe.addButton(ke);var Ze=new Tt('<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");Ze.onClick=this.flipVerticallyButtonClicked,fe.addButton(Ze)},z.prototype.ratioButtonClicked=function(v){this.aspectRatio=v,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},z.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Ei.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},z.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Ai(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},z.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},z.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},z.prototype.restoreState=function(v){if(v){var S=this.cropLayer.getRescaledRect(v.width,v.height,this.imageWidth,this.imageHeight,v.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(S),this.cropRectChanged(S),this.flippedHorizontally=v.flippedHorizontally,this.flippedVertically=v.flippedVertically,this.applyFlip(),this.rotationAngle=v.rotationAngle,this.applyRotation()}},z.prototype.clientToLocalCoordinates=function(v,S){var N=this.cropImage.getBoundingClientRect();return{x:v-N.left,y:S-N.top}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var v=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=v+"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()},z.prototype.rotateLeftButtonClicked=function(){var v=this.rotationAngle-90;this.rotationAngle%90!=0&&(v+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(v)},z.prototype.rotateRightButtonClicked=function(){var v=this.rotationAngle+90;this.rotationAngle%90!=0&&(v-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(v)},z.prototype.rotateTo=function(v){v=(v=v>180?v-360:v)<=-180?v+360:v,this.rotationAngle=v,this.applyRotation()},z.prototype.rotateBy=function(v){this.rotateTo((this.rotationAngle+v)%360)},z.prototype.applyRotation=function(){var v=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var S=this.editingTargetRotationContainer.transform.baseVal.getItem(0);S.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(S,0);var N=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/N.width,this.imageHeight/N.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=v},z.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},z.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},z.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},z.prototype.startRenderAndClose=function(){return Lt(this,void 0,void 0,function(){var v,S;return di(this,function(N){switch(N.label){case 0:return[4,this.render()];case 1:return v=N.sent(),S=this.getState(),this.renderEventListeners.forEach(function(Z){return Z(v,S)}),this.close(!0),[2]}})})},z.prototype.render=function(){return Lt(this,void 0,void 0,function(){var v;return di(this,function(S){switch(S.label){case 0:return(v=new pn).naturalSize=this.renderAtNaturalSize,v.imageType=this.renderImageType,v.imageQuality=this.renderImageQuality,v.width=this.renderWidth,v.height=this.renderHeight,this.unzoomFromCrop(),Ve.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,v.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 S.sent(),[4,v.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,S.sent()]}})})},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new It("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 It("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new It("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var v=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new It("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*v)+`px;
|
|
height: `+(this.toolbarHeight-2*v)+`px;
|
|
padding: `+v+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new It("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new It("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new Rt("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new Rt("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new It("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 It("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new It("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 It("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*v)+`px;
|
|
padding: `+v+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new It("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},z.instanceCounter=0,z}(),At=ne("8hTe"),mn=ne.n(At),gn=/<pre[^>]*>/g;function vn(z){var v=document.createElement("div");return v.innerHTML=z,v.childNodes.length===0?"":v.childNodes[0].nodeValue}var yn=et.a=function(z){var v=z.value,S=v===void 0?"":v,N=z.edit,Z=N===void 0?!1:N,G=z.className,fe=z.showTextOnly,ke=z.showLines,Ze=z.replaces,gt=z.zoomImg,Fe=z.hasMask,Et=z.style,Ht=Et===void 0?{}:Et,Zt=z.stylesPrev,Bi=Zt===void 0?{}:Zt,xi=String(S),Ti=Object(I.useRef)(),Qi=Object(I.useRef)(),Dn=Object(I.useState)(""),ci=Object(W.a)(Dn,2),zi=ci[0],ln=ci[1],un=Object(I.useState)("office"),ji=Object(W.a)(un,2),kn=ji[0],_n=ji[1],Kn=function(){var Wt=new We(Qi.current);Wt.displayMode="popup",Wt.addRenderEventListener(function(){var yi=Object(U.a)(k.a.mark(function Pt(si){var Vt;return k.a.wrap(function(fi){for(;;)switch(fi.prev=fi.next){case 0:return Ti.current.style.display="none",fi.next=3,Object(Te.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:si}});case 3:Vt=fi.sent,Vt!=null&&Vt.id&&Ze(Qi.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Vt==null?void 0:Vt.id,"?type=").concat(Vt.content_type));case 5:case"end":return fi.stop()}},Pt)}));return function(Pt){return yi.apply(this,arguments)}}()),Wt.show()},Vn=function(){var Wt=new Ct(Qi.current);Wt.settings.displayMode="popup",Wt.addEventListener("render",function(){var yi=Object(U.a)(k.a.mark(function Pt(si){var Vt;return k.a.wrap(function(fi){for(;;)switch(fi.prev=fi.next){case 0:if(Ti.current.style.display="none",!Qi.current){fi.next=6;break}return fi.next=4,Object(Te.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:si.dataUrl}});case 4:Vt=fi.sent,Vt!=null&&Vt.id&&Ze(Qi.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Vt==null?void 0:Vt.id,"?type=").concat(Vt.content_type));case 6:case"end":return fi.stop()}},Pt)}));return function(Pt){return yi.apply(this,arguments)}}()),Wt.show(),window.markerArea=Wt},Ji=Object(I.useMemo)(function(){Ti.current&&(Ti.current.style.zIndex=-1);try{var ri=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Wt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,yi=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;xi=xi.replace(ri,"("+ee.a.API_SERVER+"/api/attachments/").replace(Wt,'"'+ee.a.API_SERVER+"/api/attachments/").replace(yi,'"'+ee.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`)}catch(nn){}var Pt=V(xi),si=_();if(xi.match(/\[TOC\]/)&&(Pt=Pt.replace("<p>[TOC]</p>",O()),R()),Pt=Pt.replace(/(__special_katext_id_\d+__)/g,function(nn,fi){var Oi=si[fi],Xn=Oi.type,xn=Oi.expression;return Object(re.renderToString)(vn(xn)||"",{displayMode:Xn==="block",throwOnError:!1,output:"html"})}),Pt=Pt.replace(/▁/g,"\u2581\u2581\u2581"),g(),fe){var Vt=document.createElement("div");return Vt.innerHTML=Pt,Vt.innerText}return setTimeout(function(){return dr()},500),Pt},[xi]),Xi=Object(I.useRef)();w.WebkitLineClamp=ke,ke&&(Ht=Object(F.a)(Object(F.a)({},Ht),w));function bn(ri){var Wt=ri.target;if(Wt.tagName.toUpperCase()==="IMG"){if(gt){var yi=Wt.getAttribute("src");ln(yi),_n("image")}}else if(Wt.tagName.toUpperCase()==="A"){var Pt=Wt.getAttribute("href");if(Pt.indexOf("office")>-1)ri.preventDefault(),ln(Pt),_n("office");else if(Pt.indexOf("application/pdf")>-1)ri.preventDefault(),ln(Pt),_n("pdf");else if(Pt.indexOf("text/html")>-1)ri.preventDefault(),ln(Pt),_n("html");else if(Pt.startsWith("#")){ri.preventDefault();var si=document.getElementById(Pt.replace("#",""));si&&si.scrollIntoView(!0)}}}var dr=function(){var Wt,yi=(Wt=Xi.current)===null||Wt===void 0?void 0:Wt.querySelectorAll("video");yi==null||yi.forEach(function(Pt){if(Pt.oncontextmenu=function(){return!1},Pt.src.indexOf(".m3u8")>-1&&!Pt.canPlayType("application/vnd.apple.mpegurl")){if($.a.isSupported()){var si=new $.a;si.loadSource(Pt.src),si.attachMedia(Pt)}}})};Object(I.useEffect)(function(){if(Xi.current&&Ji&&(Ji.match(gn)&&window.PR.prettyPrint()),Xi.current)return Xi.current.addEventListener("click",bn),function(){Xi.current.removeEventListener("click",bn),g(),R()}},[Ji,Xi.current,bn]);var En=function(Wt){if(!Z)return;Wt.target.nodeName==="IMG"?(Ti.current.style.zIndex=1,Ti.current.style.display="flex",Ti.current.style.width=Wt.target.clientWidth+"px",Ti.current.style.height=Wt.target.clientHeight+"px",Ti.current.style.top=Wt.target.offsetTop+"px",Ti.current.style.left=Wt.target.offsetLeft+"px",Qi.current.src=Wt.target.getAttribute("src")):Ti.current.style.display="none"};return m.a.createElement("div",{style:{position:"relative"}},m.a.createElement("div",{ref:Xi,style:Object(F.a)({},Ht),className:"".concat(G||""," markdown-body ").concat(mn.a.mdBody),onMouseOver:En,dangerouslySetInnerHTML:{__html:Ji}}),m.a.createElement("div",{ref:Ti,className:mn.a.button},m.a.createElement(J.a,null,m.a.createElement(Y.a,{onClick:function(){return Kn()}},"\u88C1\u526A"),m.a.createElement(Y.a,{onClick:function(){return Vn()}},"\u7F16\u8F91"))),m.a.createElement("img",{ref:Qi,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),m.a.createElement(ue.a,{close:!0,data:zi,type:zi!=null&&zi.length?kn:"",style:Object(F.a)({},Bi),onClose:function(){return ln("")}}))}},"9VGf":function(vt,et,ne){"use strict";ne.d(et,"a",function(){return D});var ae=ne("q1tI"),J=ne.n(ae);function D(Y,F){var U=Object(ae.useRef)();Object(ae.useEffect)(function(){U.current=Y}),Object(ae.useEffect)(function(){function W(){U.current()}if(F!==null){var j=setInterval(W,F);return function(){return clearInterval(j)}}},[F])}},BU3w:function(vt,et,ne){"use strict";ne.d(et,"a",function(){return U});var ae=ne("MNnm"),J="rc-util-key";function D(W){if(W.attachTo)return W.attachTo;var j=document.querySelector("head");return j||document.body}function Y(W){var j,k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ae.a)())return null;var I=document.createElement("style");if((j=k.csp)===null||j===void 0?void 0:j.nonce){var m;I.nonce=(m=k.csp)===null||m===void 0?void 0:m.nonce}I.innerHTML=W;var c=D(k),f=c.firstChild;return k.prepend&&c.prepend?c.prepend(I):k.prepend&&f?c.insertBefore(I,f):c.appendChild(I),I}var F=new Map;function U(W,j){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},I=D(k);if(!F.has(I)){var m=Y("",k),c=m.parentNode;F.set(I,c),c.removeChild(m)}var f=Array.from(F.get(I).children).find(function(s){return s.tagName==="STYLE"&&s[J]===j});if(f){var u,r;if(((u=k.csp)===null||u===void 0?void 0:u.nonce)&&f.nonce!==((r=k.csp)===null||r===void 0?void 0:r.nonce)){var d;f.nonce=(d=k.csp)===null||d===void 0?void 0:d.nonce}return f.innerHTML!==W&&(f.innerHTML=W),f}var o=Y(W,k);return o[J]=j,o}},Bd2K:function(vt,et,ne){(function(ae){ae(ne("VrN/"),ne("osHv"))})(function(ae){ae.defineOption("autoCloseTags",!1,function(k,I,m){if(m!=ae.Init&&m&&k.removeKeyMap("autoCloseTags"),!I)return;var c={name:"autoCloseTags"};(typeof I!="object"||I.whenClosing!==!1)&&(c["'/'"]=function(f){return U(f)}),(typeof I!="object"||I.whenOpening!==!1)&&(c["'>'"]=function(f){return Y(f)}),k.addKeyMap(c)});var J=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function Y(k){if(k.getOption("disableInput"))return ae.Pass;for(var I=k.listSelections(),m=[],c=k.getOption("autoCloseTags"),f=0;f<I.length;f++){if(!I[f].empty())return ae.Pass;var u=I[f].head,r=k.getTokenAt(u),d=ae.innerMode(k.getMode(),r.state),o=d.state,s=d.mode.xmlCurrentTag&&d.mode.xmlCurrentTag(o),l=s&&s.name;if(!l)return ae.Pass;var p=d.mode.configuration=="html",R=typeof c=="object"&&c.dontCloseTags||p&&J,w=typeof c=="object"&&c.indentTags||p&&D;r.end>u.ch&&(l=l.slice(0,l.length-r.end+u.ch));var x=l.toLowerCase();if(!l||r.type=="string"&&(r.end!=u.ch||!/[\"\']/.test(r.string.charAt(r.string.length-1))||r.string.length==1)||r.type=="tag"&&s.close||r.string.indexOf("/")==u.ch-r.start-1||R&&W(R,x)>-1||j(k,d.mode.xmlCurrentContext&&d.mode.xmlCurrentContext(o)||[],l,u,!0))return ae.Pass;var O=typeof c=="object"&&c.emptyTags;if(O&&W(O,l)>-1){m[f]={text:"/>",newPos:ae.Pos(u.line,u.ch+2)};continue}var A=w&&W(w,x)>-1;m[f]={indent:A,text:">"+(A?`
|
|
|
|
`:"")+"</"+l+">",newPos:A?ae.Pos(u.line+1,0):ae.Pos(u.line,u.ch+1)}}for(var T=typeof c=="object"&&c.dontIndentOnAutoClose,f=I.length-1;f>=0;f--){var E=m[f];k.replaceRange(E.text,I[f].head,I[f].anchor,"+insert");var y=k.listSelections().slice(0);y[f]={head:E.newPos,anchor:E.newPos},k.setSelections(y),!T&&E.indent&&(k.indentLine(E.newPos.line,null,!0),k.indentLine(E.newPos.line+1,null,!0))}}function F(k,I){for(var m=k.listSelections(),c=[],f=I?"/":"</",u=k.getOption("autoCloseTags"),r=typeof u=="object"&&u.dontIndentOnSlash,d=0;d<m.length;d++){if(!m[d].empty())return ae.Pass;var o=m[d].head,s=k.getTokenAt(o),l=ae.innerMode(k.getMode(),s.state),p=l.state;if(I&&(s.type=="string"||s.string.charAt(0)!="<"||s.start!=o.ch-1))return ae.Pass;var R,w=l.mode.name!="xml"&&k.getMode().name=="htmlmixed";if(w&&l.mode.name=="javascript")R=f+"script";else if(w&&l.mode.name=="css")R=f+"style";else{var x=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(p);if(!x||x.length&&j(k,x,x[x.length-1],o))return ae.Pass;R=f+x[x.length-1]}k.getLine(o.line).charAt(s.end)!=">"&&(R+=">"),c[d]=R}if(k.replaceSelections(c),m=k.listSelections(),!r)for(var d=0;d<m.length;d++)(d==m.length-1||m[d].head.line<m[d+1].head.line)&&k.indentLine(m[d].head.line)}function U(k){return k.getOption("disableInput")?ae.Pass:F(k,!0)}ae.commands.closeTag=function(k){return F(k)};function W(k,I){if(k.indexOf)return k.indexOf(I);for(var m=0,c=k.length;m<c;++m)if(k[m]==I)return m;return-1}function j(k,I,m,c,f){if(!ae.scanForClosingTag)return!1;var u=Math.min(k.lastLine()+1,c.line+500),r=ae.scanForClosingTag(k,c,null,u);if(!r||r.tag!=m)return!1;for(var d=f?1:0,o=I.length-1;o>=0&&I[o]==m;o--)++d;c=r.to;for(var o=1;o<d;o++){var s=ae.scanForClosingTag(k,c,null,u);if(!s||s.tag!=m)return!1;c=s.to}return!0}})},BjJ7:function(vt,et,ne){"use strict";ne.d(et,"d",function(){return J}),ne.d(et,"c",function(){return D}),ne.d(et,"e",function(){return Y}),ne.d(et,"b",function(){return F}),ne.d(et,"a",function(){return W});var ae=ne("m3rI");function J(j){var k=!0;if(j.length>0){for(var I=0;I<j.length;I++)if(j[I].compile_success==0||!j[I].compile_success){k=!1;break}}else k=!1;return k}function D(j){for(var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",I=[],m=0;m<j.length;m++){var c=j[m],f=k?"".concat(k,"/").concat(c.name):"".concat(c.name);I.push({title:c.name,isLeaf:!(c.type==="tree"),key:f})}return I}function Y(j,k,I){for(var m=0;m<j.length;m++){var c=j[m];if(c.key===k){c.children=I;break}c.children&&Y(c.children,k,I)}return j}function F(j,k,I){var m;return function(){var c=this,f=arguments,u=function(){m=null,I||j.apply(c,f)},r=I&&!m;clearTimeout(m),m=setTimeout(u,k),r&&j.apply(c,f)}}var U=!0,W=ae.a.API_SERVER},"C+DQ":function(vt,et,ne){},DlQD:function(vt,et,ne){(function(ae,J){vt.exports=J()})(this,function(){"use strict";function ae(ve,de){for(var pe=0;pe<de.length;pe++){var te=de[pe];te.enumerable=te.enumerable||!1,te.configurable=!0,"value"in te&&(te.writable=!0),Object.defineProperty(ve,te.key,te)}}function J(ve,de,pe){return de&&ae(ve.prototype,de),pe&&ae(ve,pe),ve}function D(ve,de){if(!ve)return;if(typeof ve=="string")return Y(ve,de);var pe=Object.prototype.toString.call(ve).slice(8,-1);if(pe==="Object"&&ve.constructor&&(pe=ve.constructor.name),pe==="Map"||pe==="Set")return Array.from(ve);if(pe==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(pe))return Y(ve,de)}function Y(ve,de){(de==null||de>ve.length)&&(de=ve.length);for(var pe=0,te=new Array(de);pe<de;pe++)te[pe]=ve[pe];return te}function F(ve,de){var pe;if(typeof Symbol=="undefined"||ve[Symbol.iterator]==null){if(Array.isArray(ve)||(pe=D(ve))||de&&ve&&typeof ve.length=="number"){pe&&(ve=pe);var te=0;return function(){return te>=ve.length?{done:!0}:{done:!1,value:ve[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 pe=ve[Symbol.iterator](),pe.next.bind(pe)}function U(ve,de){return de={exports:{}},ve(de,de.exports),de.exports}var W=U(function(ve){function de(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function pe(te){ve.exports.defaults=te}ve.exports={defaults:de(),getDefaults:de,changeDefaults:pe}}),j=W.defaults,k=W.getDefaults,I=W.changeDefaults,m=/[&<>"']/,c=/[&<>"']/g,f=/[<>"']|&(?!#?\w+;)/,u=/[<>"']|&(?!#?\w+;)/g,r={"&":"&","<":"<",">":">",'"':""","'":"'"},d=function(de){return r[de]};function o(ve,de){if(de){if(m.test(ve))return ve.replace(c,d)}else if(f.test(ve))return ve.replace(u,d);return ve}var s=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(ve){return ve.replace(s,function(de,pe){return pe=pe.toLowerCase(),pe==="colon"?":":pe.charAt(0)==="#"?pe.charAt(1)==="x"?String.fromCharCode(parseInt(pe.substring(2),16)):String.fromCharCode(+pe.substring(1)):""})}var p=/(^|[^\[])\^/g;function R(ve,de){ve=ve.source||ve,de=de||"";var pe={replace:function(ie,oe){return oe=oe.source||oe,oe=oe.replace(p,"$1"),ve=ve.replace(ie,oe),pe},getRegex:function(){return new RegExp(ve,de)}};return pe}var w=/[^\w:]/g,x=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(ve,de,pe){if(ve){var te;try{te=decodeURIComponent(l(pe)).replace(w,"").toLowerCase()}catch(ie){return null}if(te.indexOf("javascript:")===0||te.indexOf("vbscript:")===0||te.indexOf("data:")===0)return null}de&&!x.test(pe)&&(pe=h(de,pe));try{pe=encodeURI(pe).replace(/%25/g,"%")}catch(ie){return null}return pe}var A={},T=/^[^:]+:\/*[^/]*$/,E=/^([^:]+:)[\s\S]*$/,y=/^([^:]+:\/*[^/]*)[\s\S]*$/;function h(ve,de){A[" "+ve]||(T.test(ve)?A[" "+ve]=ve+"/":A[" "+ve]=M(ve,"/",!0)),ve=A[" "+ve];var pe=ve.indexOf(":")===-1;return de.substring(0,2)==="//"?pe?de:ve.replace(E,"$1")+de:de.charAt(0)==="/"?pe?de:ve.replace(y,"$1")+de:ve+de}var _={exec:function(){}};function g(ve){for(var de=1,pe,te;de<arguments.length;de++){pe=arguments[de];for(te in pe)Object.prototype.hasOwnProperty.call(pe,te)&&(ve[te]=pe[te])}return ve}function b(ve,de){var pe=ve.replace(/\|/g,function(oe,he,ge){for(var Ce=!1,De=he;--De>=0&&ge[De]==="\\";)Ce=!Ce;return Ce?"|":" |"}),te=pe.split(/ \|/),ie=0;if(te.length>de)te.splice(de);else for(;te.length<de;)te.push("");for(;ie<te.length;ie++)te[ie]=te[ie].trim().replace(/\\\|/g,"|");return te}function M(ve,de,pe){var te=ve.length;if(te===0)return"";for(var ie=0;ie<te;){var oe=ve.charAt(te-ie-1);if(oe===de&&!pe)ie++;else if(oe!==de&&pe)ie++;else break}return ve.substr(0,te-ie)}function P(ve,de){if(ve.indexOf(de[1])===-1)return-1;for(var pe=ve.length,te=0,ie=0;ie<pe;ie++)if(ve[ie]==="\\")ie++;else if(ve[ie]===de[0])te++;else if(ve[ie]===de[1]&&(te--,te<0))return ie;return-1}function K(ve){ve&&ve.sanitize&&!ve.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var V={escape:o,unescape:l,edit:R,cleanUrl:O,resolveUrl:h,noopTest:_,merge:g,splitCells:b,rtrim:M,findClosingBracket:P,checkSanitizeDeprecation:K},B=W.defaults,C=V.rtrim,$=V.splitCells,ee=V.escape,re=V.findClosingBracket;function ue(ve,de,pe){var te=de.href,ie=de.title?ee(de.title):null,oe=ve[1].replace(/\\([\[\]])/g,"$1");return ve[0].charAt(0)!=="!"?{type:"link",raw:pe,href:te,title:ie,text:oe}:{type:"image",raw:pe,href:te,title:ie,text:ee(oe)}}function Te(ve,de){var pe=ve.match(/^(\s+)(?:```)/);if(pe===null)return de;var te=pe[1];return de.split(`
|
|
`).map(function(ie){var oe=ie.match(/^\s+/);if(oe===null)return ie;var he=oe[0];return he.length>=te.length?ie.slice(te.length):ie}).join(`
|
|
`)}var ye=function(){function ve(pe){this.options=pe||B}var de=ve.prototype;return de.space=function(te){var ie=this.rules.block.newline.exec(te);if(ie)return ie[0].length>1?{type:"space",raw:ie[0]}:{raw:`
|
|
`}},de.code=function(te,ie){var oe=this.rules.block.code.exec(te);if(oe){var he=ie[ie.length-1];if(he&&he.type==="paragraph")return{raw:oe[0],text:oe[0].trimRight()};var ge=oe[0].replace(/^ {4}/gm,"");return{type:"code",raw:oe[0],codeBlockStyle:"indented",text:this.options.pedantic?ge:C(ge,`
|
|
`)}}},de.fences=function(te){var ie=this.rules.block.fences.exec(te);if(ie){var oe=ie[0],he=Te(oe,ie[3]||"");return{type:"code",raw:oe,lang:ie[2]?ie[2].trim():ie[2],text:he}}},de.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]}},de.nptable=function(te){var ie=this.rules.block.nptable.exec(te);if(ie){var oe={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(oe.header.length===oe.align.length){var he=oe.align.length,ge;for(ge=0;ge<he;ge++)/^ *-+: *$/.test(oe.align[ge])?oe.align[ge]="right":/^ *:-+: *$/.test(oe.align[ge])?oe.align[ge]="center":/^ *:-+ *$/.test(oe.align[ge])?oe.align[ge]="left":oe.align[ge]=null;for(he=oe.cells.length,ge=0;ge<he;ge++)oe.cells[ge]=$(oe.cells[ge],oe.header.length);return oe}}},de.hr=function(te){var ie=this.rules.block.hr.exec(te);if(ie)return{type:"hr",raw:ie[0]}},de.blockquote=function(te){var ie=this.rules.block.blockquote.exec(te);if(ie){var oe=ie[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ie[0],text:oe}}},de.list=function(te){var ie=this.rules.block.list.exec(te);if(ie){for(var oe=ie[0],he=ie[2],ge=he.length>1,Ce=he[he.length-1]===")",De={type:"list",raw:oe,ordered:ge,start:ge?+he.slice(0,-1):"",loose:!1,items:[]},Ke=ie[0].match(this.rules.block.item),ht=!1,it,mt,_t,Qe,Ft,Ct,Yt,$t=Ke.length,Lt=0;Lt<$t;Lt++)it=Ke[Lt],oe=it,mt=it.length,it=it.replace(/^ *([*+-]|\d+[.)]) */,""),~it.indexOf(`
|
|
`)&&(mt-=it.length,it=this.options.pedantic?it.replace(/^ {1,4}/gm,""):it.replace(new RegExp("^ {1,"+mt+"}","gm"),"")),Lt!==$t-1&&(_t=this.rules.block.bullet.exec(Ke[Lt+1])[0],(ge?_t.length===1||!Ce&&_t[_t.length-1]===")":_t.length>1||this.options.smartLists&&_t!==he)&&(Qe=Ke.slice(Lt+1).join(`
|
|
`),De.raw=De.raw.substring(0,De.raw.length-Qe.length),Lt=$t-1)),Ft=ht||/\n\n(?!\s*$)/.test(it),Lt!==$t-1&&(ht=it.charAt(it.length-1)===`
|
|
`,Ft||(Ft=ht)),Ft&&(De.loose=!0),Ct=/^\[[ xX]\] /.test(it),Yt=void 0,Ct&&(Yt=it[1]!==" ",it=it.replace(/^\[[ xX]\] +/,"")),De.items.push({type:"list_item",raw:oe,task:Ct,checked:Yt,loose:Ft,text:it});return De}},de.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]):ee(ie[0]):ie[0]}},de.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 oe=ie[1].toLowerCase().replace(/\s+/g," ");return{tag:oe,raw:ie[0],href:ie[2],title:ie[3]}}},de.table=function(te){var ie=this.rules.block.table.exec(te);if(ie){var oe={type:"table",header:$(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
|
|
`):[]};if(oe.header.length===oe.align.length){oe.raw=ie[0];var he=oe.align.length,ge;for(ge=0;ge<he;ge++)/^ *-+: *$/.test(oe.align[ge])?oe.align[ge]="right":/^ *:-+: *$/.test(oe.align[ge])?oe.align[ge]="center":/^ *:-+ *$/.test(oe.align[ge])?oe.align[ge]="left":oe.align[ge]=null;for(he=oe.cells.length,ge=0;ge<he;ge++)oe.cells[ge]=$(oe.cells[ge].replace(/^ *\| *| *\| *$/g,""),oe.header.length);return oe}}},de.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]}},de.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]}},de.text=function(te,ie){var oe=this.rules.block.text.exec(te);if(oe){var he=ie[ie.length-1];return he&&he.type==="text"?{raw:oe[0],text:oe[0]}:{type:"text",raw:oe[0],text:oe[0]}}},de.escape=function(te){var ie=this.rules.inline.escape.exec(te);if(ie)return{type:"escape",raw:ie[0],text:ee(ie[1])}},de.tag=function(te,ie,oe){var he=this.rules.inline.tag.exec(te);if(he)return!ie&&/^<a /i.test(he[0])?ie=!0:ie&&/^<\/a>/i.test(he[0])&&(ie=!1),!oe&&/^<(pre|code|kbd|script)(\s|>)/i.test(he[0])?oe=!0:oe&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(he[0])&&(oe=!1),{type:this.options.sanitize?"text":"html",raw:he[0],inLink:ie,inRawBlock:oe,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):ee(he[0]):he[0]}},de.link=function(te){var ie=this.rules.inline.link.exec(te);if(ie){var oe=re(ie[2],"()");if(oe>-1){var he=ie[0].indexOf("!")===0?5:4,ge=he+ie[1].length+oe;ie[2]=ie[2].substring(0,oe),ie[0]=ie[0].substring(0,ge).trim(),ie[3]=""}var Ce=ie[2],De="";if(this.options.pedantic){var Ke=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ce);Ke?(Ce=Ke[1],De=Ke[3]):De=""}else De=ie[3]?ie[3].slice(1,-1):"";Ce=Ce.trim().replace(/^<([\s\S]*)>$/,"$1");var ht=ue(ie,{href:Ce&&Ce.replace(this.rules.inline._escapes,"$1"),title:De&&De.replace(this.rules.inline._escapes,"$1")},ie[0]);return ht}},de.reflink=function(te,ie){var oe;if((oe=this.rules.inline.reflink.exec(te))||(oe=this.rules.inline.nolink.exec(te))){var he=(oe[2]||oe[1]).replace(/\s+/g," ");if(he=ie[he.toLowerCase()],!he||!he.href){var ge=oe[0].charAt(0);return{type:"text",raw:ge,text:ge}}var Ce=ue(oe,he,oe[0]);return Ce}},de.strong=function(te,ie,oe){oe===void 0&&(oe="");var he=this.rules.inline.strong.start.exec(te);if(he&&(!he[1]||he[1]&&(oe===""||this.rules.inline.punctuation.exec(oe)))){ie=ie.slice(-1*te.length);var ge=he[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ge.lastIndex=0;for(var Ce;(he=ge.exec(ie))!=null;)if(Ce=this.rules.inline.strong.middle.exec(ie.slice(0,he.index+3)),Ce)return{type:"strong",raw:te.slice(0,Ce[0].length),text:te.slice(2,Ce[0].length-2)}}},de.em=function(te,ie,oe){oe===void 0&&(oe="");var he=this.rules.inline.em.start.exec(te);if(he&&(!he[1]||he[1]&&(oe===""||this.rules.inline.punctuation.exec(oe)))){ie=ie.slice(-1*te.length);var ge=he[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ge.lastIndex=0;for(var Ce;(he=ge.exec(ie))!=null;)if(Ce=this.rules.inline.em.middle.exec(ie.slice(0,he.index+2)),Ce)return{type:"em",raw:te.slice(0,Ce[0].length),text:te.slice(1,Ce[0].length-1)}}},de.codespan=function(te){var ie=this.rules.inline.code.exec(te);if(ie){var oe=ie[2].replace(/\n/g," "),he=/[^ ]/.test(oe),ge=oe.startsWith(" ")&&oe.endsWith(" ");return he&&ge&&(oe=oe.substring(1,oe.length-1)),oe=ee(oe,!0),{type:"codespan",raw:ie[0],text:oe}}},de.br=function(te){var ie=this.rules.inline.br.exec(te);if(ie)return{type:"br",raw:ie[0]}},de.del=function(te){var ie=this.rules.inline.del.exec(te);if(ie)return{type:"del",raw:ie[0],text:ie[1]}},de.autolink=function(te,ie){var oe=this.rules.inline.autolink.exec(te);if(oe){var he,ge;return oe[2]==="@"?(he=ee(this.options.mangle?ie(oe[1]):oe[1]),ge="mailto:"+he):(he=ee(oe[1]),ge=he),{type:"link",raw:oe[0],text:he,href:ge,tokens:[{type:"text",raw:he,text:he}]}}},de.url=function(te,ie){var oe;if(oe=this.rules.inline.url.exec(te)){var he,ge;if(oe[2]==="@")he=ee(this.options.mangle?ie(oe[0]):oe[0]),ge="mailto:"+he;else{var Ce;do Ce=oe[0],oe[0]=this.rules.inline._backpedal.exec(oe[0])[0];while(Ce!==oe[0]);he=ee(oe[0]),oe[1]==="www."?ge="http://"+he:ge=he}return{type:"link",raw:oe[0],text:he,href:ge,tokens:[{type:"text",raw:he,text:he}]}}},de.inlineText=function(te,ie,oe){var he=this.rules.inline.text.exec(te);if(he){var ge;return ie?ge=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):ee(he[0]):he[0]:ge=ee(this.options.smartypants?oe(he[0]):he[0]),{type:"text",raw:he[0],text:ge}}},ve}(),be=V.noopTest,we=V.edit,xe=V.merge,me={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:be,table:be,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};me._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,me._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,me.def=we(me.def).replace("label",me._label).replace("title",me._title).getRegex(),me.bullet=/(?:[*+-]|\d{1,9}[.)])/,me.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,me.item=we(me.item,"gm").replace(/bull/g,me.bullet).getRegex(),me.list=we(me.list).replace(/bull/g,me.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+me.def.source+")").getRegex(),me._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",me._comment=/<!--(?!-?>)[\s\S]*?-->/,me.html=we(me.html,"i").replace("comment",me._comment).replace("tag",me._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),me.paragraph=we(me._paragraph).replace("hr",me.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",me._tag).getRegex(),me.blockquote=we(me.blockquote).replace("paragraph",me.paragraph).getRegex(),me.normal=xe({},me),me.gfm=xe({},me.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),me.gfm.nptable=we(me.gfm.nptable).replace("hr",me.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",me._tag).getRegex(),me.gfm.table=we(me.gfm.table).replace("hr",me.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",me._tag).getRegex(),me.pedantic=xe({},me.normal,{html:we(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",me._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:be,paragraph:we(me.normal._paragraph).replace("hr",me.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",me.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var se={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:be,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:be,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};se._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",se.punctuation=we(se.punctuation).replace(/punctuation/g,se._punctuation).getRegex(),se._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",se._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",se.em.start=we(se.em.start).replace(/punctuation/g,se._punctuation).getRegex(),se.em.middle=we(se.em.middle).replace(/punctuation/g,se._punctuation).replace(/overlapSkip/g,se._overlapSkip).getRegex(),se.em.endAst=we(se.em.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.em.endUnd=we(se.em.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.start=we(se.strong.start).replace(/punctuation/g,se._punctuation).getRegex(),se.strong.middle=we(se.strong.middle).replace(/punctuation/g,se._punctuation).replace(/blockSkip/g,se._blockSkip).getRegex(),se.strong.endAst=we(se.strong.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.endUnd=we(se.strong.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.blockSkip=we(se._blockSkip,"g").getRegex(),se.overlapSkip=we(se._overlapSkip,"g").getRegex(),se._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,se._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,se._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,se.autolink=we(se.autolink).replace("scheme",se._scheme).replace("email",se._email).getRegex(),se._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,se.tag=we(se.tag).replace("comment",me._comment).replace("attribute",se._attribute).getRegex(),se._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,se._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,se._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,se.link=we(se.link).replace("label",se._label).replace("href",se._href).replace("title",se._title).getRegex(),se.reflink=we(se.reflink).replace("label",se._label).getRegex(),se.reflinkSearch=we(se.reflinkSearch,"g").replace("reflink",se.reflink).replace("nolink",se.nolink).getRegex(),se.normal=xe({},se),se.pedantic=xe({},se.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:we(/^!?\[(label)\]\((.*?)\)/).replace("label",se._label).getRegex(),reflink:we(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",se._label).getRegex()}),se.gfm=xe({},se.normal,{escape:we(se.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),se.gfm.url=we(se.gfm.url,"i").replace("email",se.gfm._extended_email).getRegex(),se.breaks=xe({},se.gfm,{br:we(se.br).replace("{2,}","*").getRegex(),text:we(se.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Re={block:me,inline:se},ze=W.defaults,He=Re.block,rt=Re.inline;function ot(ve){return ve.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(ve){var de="",pe,te,ie=ve.length;for(pe=0;pe<ie;pe++)te=ve.charCodeAt(pe),Math.random()>.5&&(te="x"+te.toString(16)),de+="&#"+te+";";return de}var Le=function(){function ve(pe){this.tokens=[],this.tokens.links=Object.create(null),this.options=pe||ze,this.options.tokenizer=this.options.tokenizer||new ye,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var te={block:He.normal,inline:rt.normal};this.options.pedantic?(te.block=He.pedantic,te.inline=rt.pedantic):this.options.gfm&&(te.block=He.gfm,this.options.breaks?te.inline=rt.breaks:te.inline=rt.gfm),this.tokenizer.rules=te}ve.lex=function(te,ie){var oe=new ve(ie);return oe.lex(te)};var de=ve.prototype;return de.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},de.blockTokens=function(te,ie,oe){ie===void 0&&(ie=[]),oe===void 0&&(oe=!0),te=te.replace(/^ +$/gm,"");for(var he,ge,Ce,De;te;){if(he=this.tokenizer.space(te)){te=te.substring(he.raw.length),he.type&&ie.push(he);continue}if(he=this.tokenizer.code(te,ie)){te=te.substring(he.raw.length),he.type?ie.push(he):(De=ie[ie.length-1],De.raw+=`
|
|
`+he.raw,De.text+=`
|
|
`+he.text);continue}if(he=this.tokenizer.fences(te)){te=te.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.heading(te)){te=te.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.nptable(te)){te=te.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.hr(te)){te=te.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.blockquote(te)){te=te.substring(he.raw.length),he.tokens=this.blockTokens(he.text,[],oe),ie.push(he);continue}if(he=this.tokenizer.list(te)){for(te=te.substring(he.raw.length),Ce=he.items.length,ge=0;ge<Ce;ge++)he.items[ge].tokens=this.blockTokens(he.items[ge].text,[],!1);ie.push(he);continue}if(he=this.tokenizer.html(te)){te=te.substring(he.raw.length),ie.push(he);continue}if(oe&&(he=this.tokenizer.def(te))){te=te.substring(he.raw.length),this.tokens.links[he.tag]||(this.tokens.links[he.tag]={href:he.href,title:he.title});continue}if(he=this.tokenizer.table(te)){te=te.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.lheading(te)){te=te.substring(he.raw.length),ie.push(he);continue}if(oe&&(he=this.tokenizer.paragraph(te))){te=te.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.text(te,ie)){te=te.substring(he.raw.length),he.type?ie.push(he):(De=ie[ie.length-1],De.raw+=`
|
|
`+he.raw,De.text+=`
|
|
`+he.text);continue}if(te){var Ke="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(Ke);break}else throw new Error(Ke)}}return ie},de.inline=function(te){var ie,oe,he,ge,Ce,De,Ke=te.length;for(ie=0;ie<Ke;ie++){De=te[ie];switch(De.type){case"paragraph":case"text":case"heading":{De.tokens=[],this.inlineTokens(De.text,De.tokens);break}case"table":{for(De.tokens={header:[],cells:[]},ge=De.header.length,oe=0;oe<ge;oe++)De.tokens.header[oe]=[],this.inlineTokens(De.header[oe],De.tokens.header[oe]);for(ge=De.cells.length,oe=0;oe<ge;oe++)for(Ce=De.cells[oe],De.tokens.cells[oe]=[],he=0;he<Ce.length;he++)De.tokens.cells[oe][he]=[],this.inlineTokens(Ce[he],De.tokens.cells[oe][he]);break}case"blockquote":{this.inline(De.tokens);break}case"list":{for(ge=De.items.length,oe=0;oe<ge;oe++)this.inline(De.items[oe].tokens);break}}}return te},de.inlineTokens=function(te,ie,oe,he,ge){ie===void 0&&(ie=[]),oe===void 0&&(oe=!1),he===void 0&&(he=!1),ge===void 0&&(ge="");var Ce,De=te,Ke;if(this.tokens.links){var ht=Object.keys(this.tokens.links);if(ht.length>0)for(;(Ke=this.tokenizer.rules.inline.reflinkSearch.exec(De))!=null;)ht.includes(Ke[0].slice(Ke[0].lastIndexOf("[")+1,-1))&&(De=De.slice(0,Ke.index)+"["+"a".repeat(Ke[0].length-2)+"]"+De.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ke=this.tokenizer.rules.inline.blockSkip.exec(De))!=null;)De=De.slice(0,Ke.index)+"["+"a".repeat(Ke[0].length-2)+"]"+De.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;te;){if(Ce=this.tokenizer.escape(te)){te=te.substring(Ce.raw.length),ie.push(Ce);continue}if(Ce=this.tokenizer.tag(te,oe,he)){te=te.substring(Ce.raw.length),oe=Ce.inLink,he=Ce.inRawBlock,ie.push(Ce);continue}if(Ce=this.tokenizer.link(te)){te=te.substring(Ce.raw.length),Ce.type==="link"&&(Ce.tokens=this.inlineTokens(Ce.text,[],!0,he)),ie.push(Ce);continue}if(Ce=this.tokenizer.reflink(te,this.tokens.links)){te=te.substring(Ce.raw.length),Ce.type==="link"&&(Ce.tokens=this.inlineTokens(Ce.text,[],!0,he)),ie.push(Ce);continue}if(Ce=this.tokenizer.strong(te,De,ge)){te=te.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],oe,he),ie.push(Ce);continue}if(Ce=this.tokenizer.em(te,De,ge)){te=te.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],oe,he),ie.push(Ce);continue}if(Ce=this.tokenizer.codespan(te)){te=te.substring(Ce.raw.length),ie.push(Ce);continue}if(Ce=this.tokenizer.br(te)){te=te.substring(Ce.raw.length),ie.push(Ce);continue}if(Ce=this.tokenizer.del(te)){te=te.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],oe,he),ie.push(Ce);continue}if(Ce=this.tokenizer.autolink(te,Oe)){te=te.substring(Ce.raw.length),ie.push(Ce);continue}if(!oe&&(Ce=this.tokenizer.url(te,Oe))){te=te.substring(Ce.raw.length),ie.push(Ce);continue}if(Ce=this.tokenizer.inlineText(te,he,ot)){te=te.substring(Ce.raw.length),ge=Ce.raw.slice(-1),ie.push(Ce);continue}if(te){var it="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(it);break}else throw new Error(it)}}return ie},J(ve,null,[{key:"rules",get:function(){return{block:He,inline:rt}}}]),ve}(),Ue=W.defaults,Ge=V.cleanUrl,je=V.escape,Me=function(){function ve(pe){this.options=pe||Ue}var de=ve.prototype;return de.code=function(te,ie,oe){var he=(ie||"").match(/\S*/)[0];if(this.options.highlight){var ge=this.options.highlight(te,he);ge!=null&&ge!==te&&(oe=!0,te=ge)}return he?'<pre><code class="'+this.options.langPrefix+je(he,!0)+'">'+(oe?te:je(te,!0))+`</code></pre>
|
|
`:"<pre><code>"+(oe?te:je(te,!0))+`</code></pre>
|
|
`},de.blockquote=function(te){return`<blockquote>
|
|
`+te+`</blockquote>
|
|
`},de.html=function(te){return te},de.heading=function(te,ie,oe,he){return this.options.headerIds?"<h"+ie+' id="'+this.options.headerPrefix+he.slug(oe)+'">'+te+"</h"+ie+`>
|
|
`:"<h"+ie+">"+te+"</h"+ie+`>
|
|
`},de.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},de.list=function(te,ie,oe){var he=ie?"ol":"ul",ge=ie&&oe!==1?' start="'+oe+'"':"";return"<"+he+ge+`>
|
|
`+te+"</"+he+`>
|
|
`},de.listitem=function(te){return"<li>"+te+`</li>
|
|
`},de.checkbox=function(te){return"<input "+(te?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},de.paragraph=function(te){return"<p>"+te+`</p>
|
|
`},de.table=function(te,ie){return ie&&(ie="<tbody>"+ie+"</tbody>"),`<table>
|
|
<thead>
|
|
`+te+`</thead>
|
|
`+ie+`</table>
|
|
`},de.tablerow=function(te){return`<tr>
|
|
`+te+`</tr>
|
|
`},de.tablecell=function(te,ie){var oe=ie.header?"th":"td",he=ie.align?"<"+oe+' align="'+ie.align+'">':"<"+oe+">";return he+te+"</"+oe+`>
|
|
`},de.strong=function(te){return"<strong>"+te+"</strong>"},de.em=function(te){return"<em>"+te+"</em>"},de.codespan=function(te){return"<code>"+te+"</code>"},de.br=function(){return this.options.xhtml?"<br/>":"<br>"},de.del=function(te){return"<del>"+te+"</del>"},de.link=function(te,ie,oe){if(te=Ge(this.options.sanitize,this.options.baseUrl,te),te===null)return oe;var he='<a href="'+je(te)+'"';return ie&&(he+=' title="'+ie+'"'),he+=">"+oe+"</a>",he},de.image=function(te,ie,oe){if(te=Ge(this.options.sanitize,this.options.baseUrl,te),te===null)return oe;var he='<img src="'+te+'" alt="'+oe+'"';return ie&&(he+=' title="'+ie+'"'),he+=this.options.xhtml?"/>":">",he},de.text=function(te){return te},ve}(),Pe=function(){function ve(){}var de=ve.prototype;return de.strong=function(te){return te},de.em=function(te){return te},de.codespan=function(te){return te},de.del=function(te){return te},de.html=function(te){return te},de.text=function(te){return te},de.link=function(te,ie,oe){return""+oe},de.image=function(te,ie,oe){return""+oe},de.br=function(){return""},ve}(),ut=function(){function ve(){this.seen={}}var de=ve.prototype;return de.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 oe=ie;do this.seen[oe]++,ie=oe+"-"+this.seen[oe];while(this.seen.hasOwnProperty(ie))}return this.seen[ie]=0,ie},ve}(),tt=W.defaults,qe=V.unescape,$e=function(){function ve(pe){this.options=pe||tt,this.options.renderer=this.options.renderer||new Me,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Pe,this.slugger=new ut}ve.parse=function(te,ie){var oe=new ve(ie);return oe.parse(te)};var de=ve.prototype;return de.parse=function(te,ie){ie===void 0&&(ie=!0);var oe="",he,ge,Ce,De,Ke,ht,it,mt,_t,Qe,Ft,Ct,Yt,$t,Lt,di,Ii,Ve,St=te.length;for(he=0;he<St;he++){Qe=te[he];switch(Qe.type){case"space":continue;case"hr":{oe+=this.renderer.hr();continue}case"heading":{oe+=this.renderer.heading(this.parseInline(Qe.tokens),Qe.depth,qe(this.parseInline(Qe.tokens,this.textRenderer)),this.slugger);continue}case"code":{oe+=this.renderer.code(Qe.text,Qe.lang,Qe.escaped);continue}case"table":{for(mt="",it="",De=Qe.header.length,ge=0;ge<De;ge++)it+=this.renderer.tablecell(this.parseInline(Qe.tokens.header[ge]),{header:!0,align:Qe.align[ge]});for(mt+=this.renderer.tablerow(it),_t="",De=Qe.cells.length,ge=0;ge<De;ge++){for(ht=Qe.tokens.cells[ge],it="",Ke=ht.length,Ce=0;Ce<Ke;Ce++)it+=this.renderer.tablecell(this.parseInline(ht[Ce]),{header:!1,align:Qe.align[Ce]});_t+=this.renderer.tablerow(it)}oe+=this.renderer.table(mt,_t);continue}case"blockquote":{_t=this.parse(Qe.tokens),oe+=this.renderer.blockquote(_t);continue}case"list":{for(Ft=Qe.ordered,Ct=Qe.start,Yt=Qe.loose,De=Qe.items.length,_t="",ge=0;ge<De;ge++)Lt=Qe.items[ge],di=Lt.checked,Ii=Lt.task,$t="",Lt.task&&(Ve=this.renderer.checkbox(di),Yt?Lt.tokens.length>0&&Lt.tokens[0].type==="text"?(Lt.tokens[0].text=Ve+" "+Lt.tokens[0].text,Lt.tokens[0].tokens&&Lt.tokens[0].tokens.length>0&&Lt.tokens[0].tokens[0].type==="text"&&(Lt.tokens[0].tokens[0].text=Ve+" "+Lt.tokens[0].tokens[0].text)):Lt.tokens.unshift({type:"text",text:Ve}):$t+=Ve),$t+=this.parse(Lt.tokens,Yt),_t+=this.renderer.listitem($t,Ii,di);oe+=this.renderer.list(_t,Ft,Ct);continue}case"html":{oe+=this.renderer.html(Qe.text);continue}case"paragraph":{oe+=this.renderer.paragraph(this.parseInline(Qe.tokens));continue}case"text":{for(_t=Qe.tokens?this.parseInline(Qe.tokens):Qe.text;he+1<St&&te[he+1].type==="text";)Qe=te[++he],_t+=`
|
|
`+(Qe.tokens?this.parseInline(Qe.tokens):Qe.text);oe+=ie?this.renderer.paragraph(_t):_t;continue}default:{var Rt='Token with "'+Qe.type+'" type was not found.';if(this.options.silent){console.error(Rt);return}else throw new Error(Rt)}}}return oe},de.parseInline=function(te,ie){ie=ie||this.renderer;var oe="",he,ge,Ce=te.length;for(he=0;he<Ce;he++){ge=te[he];switch(ge.type){case"escape":{oe+=ie.text(ge.text);break}case"html":{oe+=ie.html(ge.text);break}case"link":{oe+=ie.link(ge.href,ge.title,this.parseInline(ge.tokens,ie));break}case"image":{oe+=ie.image(ge.href,ge.title,ge.text);break}case"strong":{oe+=ie.strong(this.parseInline(ge.tokens,ie));break}case"em":{oe+=ie.em(this.parseInline(ge.tokens,ie));break}case"codespan":{oe+=ie.codespan(ge.text);break}case"br":{oe+=ie.br();break}case"del":{oe+=ie.del(this.parseInline(ge.tokens,ie));break}case"text":{oe+=ie.text(ge.text);break}default:{var De='Token with "'+ge.type+'" type was not found.';if(this.options.silent){console.error(De);return}else throw new Error(De)}}}return oe},ve}(),ft=V.merge,nt=V.checkSanitizeDeprecation,Ye=V.escape,Ae=W.getDefaults,ct=W.changeDefaults,Je=W.defaults;function Se(ve,de,pe){if(typeof ve=="undefined"||ve===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ve!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ve)+", string expected");if(typeof de=="function"&&(pe=de,de=null),de=ft({},Se.defaults,de||{}),nt(de),pe){var te=de.highlight,ie;try{ie=Le.lex(ve,de)}catch(Ce){return pe(Ce)}var oe=function(De){var Ke;if(!De)try{Ke=$e.parse(ie,de)}catch(ht){De=ht}return de.highlight=te,De?pe(De):pe(null,Ke)};if(!te||te.length<3)return oe();if(delete de.highlight,!ie.length)return oe();var he=0;Se.walkTokens(ie,function(Ce){Ce.type==="code"&&(he++,setTimeout(function(){te(Ce.text,Ce.lang,function(De,Ke){if(De)return oe(De);Ke!=null&&Ke!==Ce.text&&(Ce.text=Ke,Ce.escaped=!0),he--,he===0&&oe()})},0))}),he===0&&oe();return}try{var ge=Le.lex(ve,de);return de.walkTokens&&Se.walkTokens(ge,de.walkTokens),$e.parse(ge,de)}catch(Ce){if(Ce.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,de.silent)return"<p>An error occurred:</p><pre>"+Ye(Ce.message+"",!0)+"</pre>";throw Ce}}Se.options=Se.setOptions=function(ve){return ft(Se.defaults,ve),ct(Se.defaults),Se},Se.getDefaults=Ae,Se.defaults=Je,Se.use=function(ve){var de=ft({},ve);if(ve.renderer&&function(){var te=Se.defaults.renderer||new Me,ie=function(ge){var Ce=te[ge];te[ge]=function(){for(var De=arguments.length,Ke=new Array(De),ht=0;ht<De;ht++)Ke[ht]=arguments[ht];var it=ve.renderer[ge].apply(te,Ke);return it===!1&&(it=Ce.apply(te,Ke)),it}};for(var oe in ve.renderer)ie(oe);de.renderer=te}(),ve.tokenizer&&function(){var te=Se.defaults.tokenizer||new ye,ie=function(ge){var Ce=te[ge];te[ge]=function(){for(var De=arguments.length,Ke=new Array(De),ht=0;ht<De;ht++)Ke[ht]=arguments[ht];var it=ve.tokenizer[ge].apply(te,Ke);return it===!1&&(it=Ce.apply(te,Ke)),it}};for(var oe in ve.tokenizer)ie(oe);de.tokenizer=te}(),ve.walkTokens){var pe=Se.defaults.walkTokens;de.walkTokens=function(te){ve.walkTokens(te),pe&&pe(te)}}Se.setOptions(de)},Se.walkTokens=function(ve,de){for(var pe=F(ve),te;!(te=pe()).done;){var ie=te.value;de(ie);switch(ie.type){case"table":{for(var oe=F(ie.tokens.header),he;!(he=oe()).done;){var ge=he.value;Se.walkTokens(ge,de)}for(var Ce=F(ie.tokens.cells),De;!(De=Ce()).done;)for(var Ke=De.value,ht=F(Ke),it;!(it=ht()).done;){var mt=it.value;Se.walkTokens(mt,de)}break}case"list":{Se.walkTokens(ie.items,de);break}default:ie.tokens&&Se.walkTokens(ie.tokens,de)}}},Se.Parser=$e,Se.parser=$e.parse,Se.Renderer=Me,Se.TextRenderer=Pe,Se.Lexer=Le,Se.lexer=Le.lex,Se.Tokenizer=ye,Se.Slugger=ut,Se.parse=Se;var Ne=Se;return Ne})},ELLl:function(vt,et,ne){(function(ae){ae(ne("VrN/"))})(function(ae){var J={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=ae.Pos;ae.defineOption("autoCloseBrackets",!1,function(r,d,o){o&&o!=ae.Init&&(r.removeKeyMap(F),r.state.closeBrackets=null),d&&(U(Y(d,"pairs")),r.state.closeBrackets=d,r.addKeyMap(F))});function Y(r,d){return d=="pairs"&&typeof r=="string"?r:typeof r=="object"&&r[d]!=null?r[d]:J[d]}var F={Backspace:k,Enter:I};function U(r){for(var d=0;d<r.length;d++){var o=r.charAt(d),s="'"+o+"'";F[s]||(F[s]=W(o))}}U(J.pairs+"`");function W(r){return function(d){return c(d,r)}}function j(r){var d=r.state.closeBrackets;if(!d||d.override)return d;var o=r.getModeAt(r.getCursor());return o.closeBrackets||d}function k(r){var d=j(r);if(!d||r.getOption("disableInput"))return ae.Pass;for(var o=Y(d,"pairs"),s=r.listSelections(),l=0;l<s.length;l++){if(!s[l].empty())return ae.Pass;var p=f(r,s[l].head);if(!p||o.indexOf(p)%2!=0)return ae.Pass}for(var l=s.length-1;l>=0;l--){var R=s[l].head;r.replaceRange("",D(R.line,R.ch-1),D(R.line,R.ch+1),"+delete")}}function I(r){var d=j(r),o=d&&Y(d,"explode");if(!o||r.getOption("disableInput"))return ae.Pass;for(var s=r.listSelections(),l=0;l<s.length;l++){if(!s[l].empty())return ae.Pass;var p=f(r,s[l].head);if(!p||o.indexOf(p)%2!=0)return ae.Pass}r.operation(function(){var R=r.lineSeparator()||`
|
|
`;r.replaceSelection(R+R,null),r.execCommand("goCharLeft"),s=r.listSelections();for(var w=0;w<s.length;w++){var x=s[w].head.line;r.indentLine(x,null,!0),r.indentLine(x+1,null,!0)}})}function m(r){var d=ae.cmpPos(r.anchor,r.head)>0;return{anchor:new D(r.anchor.line,r.anchor.ch+(d?-1:1)),head:new D(r.head.line,r.head.ch+(d?1:-1))}}function c(r,d){var o=j(r);if(!o||r.getOption("disableInput"))return ae.Pass;var s=Y(o,"pairs"),l=s.indexOf(d);if(l==-1)return ae.Pass;for(var p=Y(o,"closeBefore"),R=Y(o,"triples"),w=s.charAt(l+1)==d,x=r.listSelections(),O=l%2==0,A,T=0;T<x.length;T++){var E=x[T],y=E.head,h,_=r.getRange(y,D(y.line,y.ch+1));if(O&&!E.empty())h="surround";else if((w||!O)&&_==d)w&&u(r,y)?h="both":R.indexOf(d)>=0&&r.getRange(y,D(y.line,y.ch+3))==d+d+d?h="skipThree":h="skip";else if(w&&y.ch>1&&R.indexOf(d)>=0&&r.getRange(D(y.line,y.ch-2),y)==d+d){if(y.ch>2&&/\bstring/.test(r.getTokenTypeAt(D(y.line,y.ch-2))))return ae.Pass;h="addFour"}else if(w){var g=y.ch==0?" ":r.getRange(D(y.line,y.ch-1),y);if(!ae.isWordChar(_)&&g!=d&&!ae.isWordChar(g))h="both";else return ae.Pass}else if(O&&(_.length===0||/\s/.test(_)||p.indexOf(_)>-1))h="both";else return ae.Pass;if(!A)A=h;else if(A!=h)return ae.Pass}var b=l%2?s.charAt(l-1):d,M=l%2?d:s.charAt(l+1);r.operation(function(){if(A=="skip")r.execCommand("goCharRight");else if(A=="skipThree")for(var P=0;P<3;P++)r.execCommand("goCharRight");else if(A=="surround"){for(var K=r.getSelections(),P=0;P<K.length;P++)K[P]=b+K[P]+M;r.replaceSelections(K,"around"),K=r.listSelections().slice();for(var P=0;P<K.length;P++)K[P]=m(K[P]);r.setSelections(K)}else A=="both"?(r.replaceSelection(b+M,null),r.triggerElectric(b+M),r.execCommand("goCharLeft")):A=="addFour"&&(r.replaceSelection(b+b+b+b,"before"),r.execCommand("goCharRight"))})}function f(r,d){var o=r.getRange(D(d.line,d.ch-1),D(d.line,d.ch+1));return o.length==2?o:null}function u(r,d){var o=r.getTokenAt(D(d.line,d.ch+1));return/\bstring/.test(o.type)&&o.start==d.ch&&(d.ch==0||!/\bstring/.test(r.getTokenTypeAt(d)))}})},HmJG:function(vt,et,ne){},LSTS:function(vt,et,ne){"use strict";Object.defineProperty(et,"__esModule",{value:!0});var ae=function(){function c(f,u){for(var r=0;r<u.length;r++){var d=u[r];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(f,d.key,d)}}return function(f,u,r){return u&&c(f.prototype,u),r&&c(f,r),f}}(),J=ne("q1tI"),D=U(J),Y=ne("17x9"),F=U(Y);function U(c){return c&&c.__esModule?c:{default:c}}function W(c,f){var u={};for(var r in c){if(f.indexOf(r)>=0)continue;if(!Object.prototype.hasOwnProperty.call(c,r))continue;u[r]=c[r]}return u}function j(c,f){if(!(c instanceof f))throw new TypeError("Cannot call a class as a function")}function k(c,f){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:c}function I(c,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);c.prototype=Object.create(f&&f.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(c,f):c.__proto__=f)}var m=function(c){I(f,c);function f(u){j(this,f);var r=k(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,u));return r.scrollListener=r.scrollListener.bind(r),r.eventListenerOptions=r.eventListenerOptions.bind(r),r.mousewheelListener=r.mousewheelListener.bind(r),r}return ae(f,[{key:"componentDidMount",value:function(){this.pageLoaded=this.props.pageStart,this.options=this.eventListenerOptions(),this.attachScrollListener()}},{key:"componentDidUpdate",value:function(){if(this.props.isReverse&&this.loadMore){var r=this.getParentElement(this.scrollComponent);r.scrollTop=r.scrollHeight-this.beforeScrollHeight+this.beforeScrollTop,this.loadMore=!1}this.attachScrollListener()}},{key:"componentWillUnmount",value:function(){this.detachScrollListener(),this.detachMousewheelListener()}},{key:"isPassiveSupported",value:function(){var r=!1,d={get passive(){r=!0}};try{document.addEventListener("test",null,d),document.removeEventListener("test",null,d)}catch(o){}return r}},{key:"eventListenerOptions",value:function(){var r=this.props.useCapture;return this.isPassiveSupported()&&(r={useCapture:this.props.useCapture,passive:!0}),r}},{key:"setDefaultLoader",value:function(r){this.defaultLoader=r}},{key:"detachMousewheelListener",value:function(){var r=window;this.props.useWindow===!1&&(r=this.scrollComponent.parentNode),r.removeEventListener("mousewheel",this.mousewheelListener,this.options?this.options:this.props.useCapture)}},{key:"detachScrollListener",value:function(){var r=window;this.props.useWindow===!1&&(r=this.getParentElement(this.scrollComponent)),r.removeEventListener("scroll",this.scrollListener,this.options?this.options:this.props.useCapture),r.removeEventListener("resize",this.scrollListener,this.options?this.options:this.props.useCapture)}},{key:"getParentElement",value:function(r){var d=this.props.getScrollParent&&this.props.getScrollParent();return d!=null?d:r&&r.parentNode}},{key:"filterProps",value:function(r){return r}},{key:"attachScrollListener",value:function(){var r=this.getParentElement(this.scrollComponent);if(!this.props.hasMore||!r)return;var d=window;this.props.useWindow===!1&&(d=r),d.addEventListener("mousewheel",this.mousewheelListener,this.options?this.options:this.props.useCapture),d.addEventListener("scroll",this.scrollListener,this.options?this.options:this.props.useCapture),d.addEventListener("resize",this.scrollListener,this.options?this.options:this.props.useCapture),this.props.initialLoad&&this.scrollListener()}},{key:"mousewheelListener",value:function(r){r.deltaY===1&&!this.isPassiveSupported()&&r.preventDefault()}},{key:"scrollListener",value:function(){var r=this.scrollComponent,d=window,o=this.getParentElement(r),s=void 0;if(this.props.useWindow){var l=document.documentElement||document.body.parentNode||document.body,p=d.pageYOffset!==void 0?d.pageYOffset:l.scrollTop;this.props.isReverse?s=p:s=this.calculateOffset(r,p)}else this.props.isReverse?s=o.scrollTop:s=r.scrollHeight-o.scrollTop-o.clientHeight;s<Number(this.props.threshold)&&r&&r.offsetParent!==null&&(this.detachScrollListener(),this.beforeScrollHeight=o.scrollHeight,this.beforeScrollTop=o.scrollTop,typeof this.props.loadMore=="function"&&(this.props.loadMore(this.pageLoaded+=1),this.loadMore=!0))}},{key:"calculateOffset",value:function(r,d){return r?this.calculateTopPosition(r)+(r.offsetHeight-d-window.innerHeight):0}},{key:"calculateTopPosition",value:function(r){return r?r.offsetTop+this.calculateTopPosition(r.offsetParent):0}},{key:"render",value:function(){var r=this,d=this.filterProps(this.props),o=d.children,s=d.element,l=d.hasMore,p=d.initialLoad,R=d.isReverse,w=d.loader,x=d.loadMore,O=d.pageStart,A=d.ref,T=d.threshold,E=d.useCapture,y=d.useWindow,h=d.getScrollParent,_=W(d,["children","element","hasMore","initialLoad","isReverse","loader","loadMore","pageStart","ref","threshold","useCapture","useWindow","getScrollParent"]);_.ref=function(b){r.scrollComponent=b,A&&A(b)};var g=[o];return l&&(w?R?g.unshift(w):g.push(w):this.defaultLoader&&(R?g.unshift(this.defaultLoader):g.push(this.defaultLoader))),D.default.createElement(s,_,g)}}]),f}(J.Component);m.propTypes={children:F.default.node.isRequired,element:F.default.node,hasMore:F.default.bool,initialLoad:F.default.bool,isReverse:F.default.bool,loader:F.default.node,loadMore:F.default.func.isRequired,pageStart:F.default.number,ref:F.default.func,getScrollParent:F.default.func,threshold:F.default.number,useCapture:F.default.bool,useWindow:F.default.bool},m.defaultProps={element:"div",hasMore:!1,initialLoad:!0,pageStart:0,ref:null,threshold:250,useWindow:!0,isReverse:!1,useCapture:!1,loader:null,getScrollParent:null},et.default=m,vt.exports=et.default},LdHM:function(vt,et,ne){"use strict";ne.d(et,"b",function(){return p}),ne.d(et,"a",function(){return w});var ae=ne("1OyB"),J=ne("vuIU"),D=ne("Ji7U"),Y=ne("LK+K"),F=ne("q1tI"),U=ne("rePB"),W=ne("Ff2n"),j=ne("ODXe"),k=ne("4IlW"),I=ne("bX4T"),m=ne("YrtM"),c=ne("TSYQ"),f=ne.n(c),u=ne("+nKL"),r=ne("8OUc"),d=function($,ee){var re=$.prefixCls,ue=$.id,Te=$.flattenOptions,ye=$.childrenAsData,be=$.values,we=$.searchValue,xe=$.multiple,me=$.defaultActiveFirstOption,se=$.height,Re=$.itemHeight,ze=$.notFoundContent,He=$.open,rt=$.menuItemSelectedIcon,ot=$.virtual,Oe=$.onSelect,Le=$.onToggleOpen,Ue=$.onActiveValue,Ge=$.onScroll,je=$.onMouseEnter,Me="".concat(re,"-item"),Pe=Object(m.a)(function(){return Te},[He,Te],function(Ne,ve){return ve[0]&&Ne[1]!==ve[1]}),ut=F.useRef(null),tt=function(ve){ve.preventDefault()},qe=function(ve){ut.current&&ut.current.scrollTo({index:ve})},$e=function(ve){for(var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,pe=Pe.length,te=0;te<pe;te+=1){var ie=(ve+te*de+pe)%pe,oe=Pe[ie],he=oe.group,ge=oe.data;if(!he&&!ge.disabled)return ie}return-1},ft=F.useState(function(){return $e(0)}),nt=Object(j.a)(ft,2),Ye=nt[0],Ae=nt[1],ct=function(ve){Ae(ve);var de=Pe[ve];if(!de){Ue(null,-1);return}Ue(de.data.value,ve)};F.useEffect(function(){ct(me!==!1?$e(0):-1)},[Pe.length,we]),F.useEffect(function(){var Ne=setTimeout(function(){if(!xe&&He&&be.size===1){var ve=Array.from(be)[0],de=Pe.findIndex(function(pe){var te=pe.data;return te.value===ve});ct(de),qe(de)}});return function(){return clearTimeout(Ne)}},[He]);var Je=function(ve){ve!==void 0&&Oe(ve,{selected:!be.has(ve)}),xe||Le(!1)};if(F.useImperativeHandle(ee,function(){return{onKeyDown:function(ve){var de=ve.which;switch(de){case k.a.UP:case k.a.DOWN:{var pe=0;if(de===k.a.UP?pe=-1:de===k.a.DOWN&&(pe=1),pe!==0){var te=$e(Ye+pe,pe);qe(te),ct(te)}break}case k.a.ENTER:{var ie=Pe[Ye];ie&&!ie.data.disabled?Je(ie.data.value):Je(void 0),He&&ve.preventDefault();break}case k.a.ESC:Le(!1)}},onKeyUp:function(){},scrollTo:function(ve){qe(ve)}}}),Pe.length===0)return F.createElement("div",{role:"listbox",id:"".concat(ue,"_list"),className:"".concat(Me,"-empty"),onMouseDown:tt},ze);function Se(Ne){var ve=Pe[Ne];if(!ve)return null;var de=ve.data||{},pe=de.value,te=de.label,ie=de.children,oe=Object(I.a)(de,!0),he=ye?ie:te;return ve?F.createElement("div",Object.assign({"aria-label":typeof he=="string"?he:null},oe,{key:Ne,role:"option",id:"".concat(ue,"_list_").concat(Ne),"aria-selected":be.has(pe)}),pe):null}return F.createElement(F.Fragment,null,F.createElement("div",{role:"listbox",id:"".concat(ue,"_list"),style:{height:0,width:0,overflow:"hidden"}},Se(Ye-1),Se(Ye),Se(Ye+1)),F.createElement(u.a,{itemKey:"key",ref:ut,data:Pe,height:se,itemHeight:Re,fullHeight:!1,onMouseDown:tt,onScroll:Ge,virtual:ot,onMouseEnter:je},function(Ne,ve){var de,pe=Ne.group,te=Ne.groupOption,ie=Ne.data,oe=ie.label,he=ie.key;if(pe)return F.createElement("div",{className:f()(Me,"".concat(Me,"-group"))},oe!==void 0?oe:he);var ge=ie.disabled,Ce=ie.value,De=ie.title,Ke=ie.children,ht=ie.style,it=ie.className,mt=Object(W.a)(ie,["disabled","value","title","children","style","className"]),_t=be.has(Ce),Qe="".concat(Me,"-option"),Ft=f()(Me,Qe,it,(de={},Object(U.a)(de,"".concat(Qe,"-grouped"),te),Object(U.a)(de,"".concat(Qe,"-active"),Ye===ve&&!ge),Object(U.a)(de,"".concat(Qe,"-disabled"),ge),Object(U.a)(de,"".concat(Qe,"-selected"),_t),de)),Ct=ye?Ke:oe,Yt=!rt||typeof rt=="function"||_t;return F.createElement("div",Object.assign({},mt,{"aria-selected":_t,className:Ft,title:De,onMouseMove:function(){if(Ye===ve||ge)return;ct(ve)},onClick:function(){ge||Je(Ce)},style:ht}),F.createElement("div",{className:"".concat(Qe,"-content")},Ct||Ce),F.isValidElement(rt)||_t,Yt&&F.createElement(r.a,{className:"".concat(Me,"-option-state"),customizeIcon:rt,customizeIconProps:{isSelected:_t}},_t?"\u2713":null))}))},o=F.forwardRef(d);o.displayName="OptionList";var s=o,l=function(){return null};l.isSelectOption=!0;var p=l,R=function(){return null};R.isSelectOptGroup=!0;var w=R,x=ne("VTBJ"),O=ne("Zm9Q");function A(C){var $=C.key,ee=C.props,re=ee.children,ue=ee.value,Te=Object(W.a)(ee,["children","value"]);return Object(x.a)({key:$,value:ue!==void 0?ue:$,children:re},Te)}function T(C){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(O.a)(C).map(function(ee,re){if(!F.isValidElement(ee)||!ee.type)return null;var ue=ee.type.isSelectOptGroup,Te=ee.key,ye=ee.props,be=ye.children,we=Object(W.a)(ye,["children"]);return $||!ue?A(ee):Object(x.a)(Object(x.a)({key:"__RC_SELECT_GRP__".concat(Te===null?re:Te,"__"),label:Te},we),{},{options:T(be)})}).filter(function(ee){return ee})}var E=ne("2Qr1"),y=ne("qNPg"),h=ne("U8pU"),_=ne("Kwbf"),g=ne("WKfj");function b(C){var $=C.mode,ee=C.options,re=C.children,ue=C.backfill,Te=C.allowClear,ye=C.placeholder,be=C.getInputElement,we=C.showSearch,xe=C.onSearch,me=C.defaultOpen,se=C.autoFocus,Re=C.labelInValue,ze=C.value,He=C.inputValue,rt=C.optionLabelProp,ot=$==="multiple"||$==="tags",Oe=we!==void 0?we:ot||$==="combobox",Le=ee||T(re);if(Object(_.a)($!=="tags"||Le.every(function(Me){return!Me.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),$==="tags"||$==="combobox"){var Ue=Le.some(function(Me){return Me.options?Me.options.some(function(Pe){return typeof("value"in Pe?Pe.value:Pe.key)=="number"}):typeof("value"in Me?Me.value:Me.key)=="number"});Object(_.a)(!Ue,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(_.a)($!=="combobox"||!rt,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(_.a)($==="combobox"||!ue,"`backfill` only works with `combobox` mode."),Object(_.a)($==="combobox"||!be,"`getInputElement` only work with `combobox` mode."),Object(_.b)($!=="combobox"||!be||!Te||!ye,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),xe&&!Oe&&$!=="combobox"&&$!=="tags"&&Object(_.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(_.b)(!me||se,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ze!=null){var Ge=Object(g.d)(ze);Object(_.a)(!Re||Ge.every(function(Me){return Object(h.a)(Me)==="object"&&("key"in Me||"value"in Me)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(_.a)(!ot||Array.isArray(ze),"`value` should be array when `mode` is `multiple` or `tags`")}if(re){var je=null;Object(O.a)(re).some(function(Me){if(!F.isValidElement(Me)||!Me.type)return!1;var Pe=Me.type;if(Pe.isSelectOption)return!1;if(Pe.isSelectOptGroup){var ut=Object(O.a)(Me.props.children).every(function(tt){return!F.isValidElement(tt)||!Me.type||tt.type.isSelectOption?!0:(je=tt.type,!1)});return!ut}return je=Pe,!0}),je&&Object(_.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(je.displayName||je.name||je,"`.")),Object(_.a)(He===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var M=b,P=Object(y.a)({prefixCls:"rc-select",components:{optionList:s},convertChildrenToData:T,flattenOptions:E.d,getLabeledValue:E.e,filterOptions:E.b,isValueDisabled:E.g,findValueOption:E.c,warningProps:M,fillOptionsWithMissingValue:E.a}),K=function(C){Object(D.a)(ee,C);var $=Object(Y.a)(ee);function ee(){var re;return Object(ae.a)(this,ee),re=$.apply(this,arguments),re.selectRef=F.createRef(),re.focus=function(){re.selectRef.current.focus()},re.blur=function(){re.selectRef.current.blur()},re}return Object(J.a)(ee,[{key:"render",value:function(){return F.createElement(P,Object.assign({ref:this.selectRef},this.props))}}]),ee}(F.Component);K.Option=p,K.OptGroup=w;var V=K,B=et.c=V},M8RZ:function(vt,et,ne){"use strict";ne.d(et,"a",function(){return k});var ae=ne("fWQN"),J=ne("mtLc"),D=ne("yKVA"),Y=ne("879j"),F=ne("q1tI"),U=ne.n(F),W=ne("i8i4"),j=ne.n(W),k=function(I){Object(D.a)(c,I);var m=Object(Y.a)(c);function c(f){var u;Object(ae.a)(this,c),u=m.call(this,f);var r=window.document;return u.node=r.createElement("div"),r.body.appendChild(u.node),u}return Object(J.a)(c,[{key:"render",value:function(){var u=this.props.children;return Object(W.createPortal)(u,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),c}(U.a.Component)},Ot1p:function(vt,et,ne){"use strict";var ae=ne("2qtc"),J=ne("kLXV"),D=ne("rAM+"),Y=ne("miYZ"),F=ne("tsqr"),U=ne("9og8"),W=ne("tJVT"),j=ne("jrin"),k=ne("WmNS"),I=ne.n(k),m=ne("q1tI"),c=ne.n(m),f=ne("VrN/"),u=ne.n(f),r=ne("bdgK"),d=ne("p77/"),o=ne("Bd2K"),s=ne("ELLl"),l=ne("19Vz"),p=ne("lZu9"),R=ne("+NIl"),w=ne("kSUc"),x=ne("9Bee"),O=function(ge){var Ce=ge.value,De=Ce===void 0?"":Ce,Ke=ge.className,ht=ge.showTextOnly,it=ge.showLines,mt=ge.style,_t=mt===void 0?{}:mt,Qe=Object(m.useMemo)(function(){return""},[De]);return c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{dangerouslySetInnerHTML:{__html:Qe}}))},A=ne("0Owb"),T=ne("dejd"),E=ne("C+DQ"),y=ne("1vsH"),h=ne("m3rI"),_=[{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 g(ge){var Ce=ge.onActionCallback,De=ge.title,Ke=ge.icon,ht=ge.actionName,it=ge.className,mt=it===void 0?"":it,_t=ge.children;function Qe(){Ce(ht)}return c.a.createElement("a",{title:De,className:mt,onClick:Qe},c.a.createElement("i",{className:"md-iconfont ".concat(Ke)}),_t)}var b=function(ge){var Ce=ge.watch,De=ge.showNullButton,Ke=ge.onActionCallback,ht=ge.fullScreen,it=ge.insertTemp,mt=ge.hidetoolBar,_t=ge.uuid,Qe=ge.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(y.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(y.F)("_educoder_session"),"&key=").concat(_t,"&api=").concat(encodeURIComponent(h.a.PROXY_SERVER)));var Ft=[].concat(_,[{title:"".concat(Ce?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ce?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return c.a.createElement("ul",{className:"markdown-toolbar-container"},!mt&&Ft.map(function(Ct,Yt){return c.a.createElement("li",{key:Yt},Ct.actionName?c.a.createElement(g,Object(A.a)({},Ct,{onActionCallback:Ke})):c.a.createElement("span",{className:"v-line"}))}),De?c.a.createElement("li",null,c.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Ke},c.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,it&&c.a.createElement("li",null,c.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(it),onActionCallback:Ke},c.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),c.a.createElement("li",{className:"btn-full-screen"},c.a.createElement(g,{icon:"".concat(ht?"icon-shrink":"icon-enlarge"),title:ht?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Ke})))},M=ne("M8RZ"),P=ne("+L6B"),K=ne("2/Rp"),V=ne("y8nQ"),B=ne("Vl3Y"),C=ne("5NDa"),$=ne("5rEg"),ee={labelCol:{span:4},wrapperCol:{span:20}},re=function(ge){var Ce=ge.callback,De=ge.onCancel;function Ke(ht){Ce(ht)}return c.a.createElement(B.a,Object(A.a)({},ee,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Ke}),c.a.createElement(B.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},c.a.createElement($.a,null)),c.a.createElement(B.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},c.a.createElement($.a,null)),c.a.createElement("div",{className:"flex-container flex-end"},c.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),c.a.createElement(K.a,{type:"ghost",onClick:De},"\u53D6\u6D88")))},ue=ne("7ahc"),Te=ne("HmJG"),ye=ne("BjJ7"),be=B.a.useForm,we={width:280,marginRight:10},xe={labelCol:{span:5},wrapperCol:{span:19}},me=function(ge){var Ce=ge.callback,De=ge.onCancel,Ke=be(),ht=Object(W.a)(Ke,1),it=ht[0];function mt(Ft){Ce(Ft)}function _t(Ft,Ct){if(Ft.status===-1){F.b.error(Ft.message);return}it.setFieldsValue({src:"/api/attachments/".concat(Ft.id),type:Ct.type})}function Qe(Ft){var Ct=Ft.target.files[0];Re(Ct,_t)}return c.a.createElement(B.a,Object(A.a)({form:it},xe,{className:"upload-image-panel",onFinish:mt}),c.a.createElement(B.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},c.a.createElement("div",{className:"flex-container"},c.a.createElement(B.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},c.a.createElement($.a,{style:we})),c.a.createElement(se,{onFileChange:Qe}))),c.a.createElement(B.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},c.a.createElement($.a,{style:{width:264}})),c.a.createElement(B.a.Item,{style:{textAlign:"right"}},c.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),c.a.createElement(K.a,{type:"ghost",onClick:De},"\u53D6\u6D88")))};function se(ge){var Ce=ge.onFileChange;return c.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",c.a.createElement("input",{type:"file",onChange:Ce}))}function Re(ge,Ce){if(!ge)throw new String("\u6CA1\u6709\u6587\u4EF6");var De=new FormData;De.append("editormd-image-file",ge),De.append("file_param_name","editormd-image-file"),De.append("byxhr","true");var Ke=new window.XMLHttpRequest;Ke.withCredentials=!0,Ke.addEventListener("load",function(ht){Ce(JSON.parse(ht.target.responseText),ge)},!1),Ke.addEventListener("error",function(ht){console.error(ht)},!1),Ke.open("POST","".concat(ye.a,"/api/attachments.json")),Ke.send(De)}var ze=ne("giR+"),He=ne("fyUT"),rt=ne("7Kak"),ot=ne("9yH6"),Oe=ot.a.Group,Le={margin:"0 8px"},Ue=function(ge){var Ce=ge.callback,De=ge.onCancel;function Ke(ht){Ce(ht)}return c.a.createElement(B.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Ke},c.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},c.a.createElement("span",{style:Le},"\u5355\u5143\u683C\u6570\uFF1A"),c.a.createElement("span",{style:Le},"\u884C\u6570"),c.a.createElement(B.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},c.a.createElement(He.a,null)),c.a.createElement("span",{style:Le},"\u5217\u6570"),c.a.createElement(B.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},c.a.createElement(He.a,null))),c.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},c.a.createElement("span",{style:Le},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),c.a.createElement(B.a.Item,{name:"align"},c.a.createElement(Oe,null,c.a.createElement(ot.a,{value:"default"},c.a.createElement("i",{className:"fa fa-align-justify"})),c.a.createElement(ot.a,{value:"left"},c.a.createElement("i",{className:"fa fa-align-left"})),c.a.createElement(ot.a,{value:"center"},c.a.createElement("i",{className:"fa fa-align-center"})),c.a.createElement(ot.a,{value:"right"},c.a.createElement("i",{className:"fa fa-align-right"}))))),c.a.createElement("div",{className:"flex-container flex-end"},c.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),c.a.createElement(K.a,{type:"ghost",onClick:De},"\u53D6\u6D88")))},Ge=ne("ErOA"),je=ne("7Cbv"),Me="link",Pe="upload-image",ut="code-block",tt="add-table",qe="------------",$e={default:qe,left:":".concat(qe),center:":".concat(qe,":"),right:"".concat(qe,":")},ft=ne("9VGf"),nt,Ye;function Ae(){}var ct=0,Je=1e4,Se="\u2581",Ne=`
|
|
**\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 ve(ge){return/^\d+$/.test(ge)?"".concat(ge,"px"):ge}var de=navigator.platform.toUpperCase().indexOf("MAC")>=0,pe=de?"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=(nt={},Object(j.a)(nt,pe+"-B","bold"),Object(j.a)(nt,pe+"-I","italic"),nt),oe=(Ye={},Object(j.a)(Ye,Me,"\u6DFB\u52A0\u94FE\u63A5"),Object(j.a)(Ye,ut,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(j.a)(Ye,Pe,"\u6DFB\u52A0\u6587\u4EF6"),Object(j.a)(Ye,tt,"\u6DFB\u52A0\u8868\u683C"),Ye),he=et.a=function(ge){var Ce=ge.defaultValue,De=Ce===void 0?"":Ce,Ke=ge.onChange,ht=ge.width,it=ht===void 0?"100%":ht,mt=ge.height,_t=mt===void 0?400:mt,Qe=ge.miniToolbar,Ft=Qe===void 0?!1:Qe,Ct=ge.isFocus,Yt=Ct===void 0?!1:Ct,$t=ge.watch,Lt=ge.insertTemp,di=ge.mode,Ii=di===void 0?"markdown":di,Ve=ge.id,St=Ve===void 0?"markdown-editor-id":Ve,Rt=ge.showResizeBar,It=Rt===void 0?!1:Rt,qt=ge.noStorage,jt=qt===void 0?!1:qt,Kt=ge.showNullButton,Tt=Kt===void 0?!1:Kt,lt=ge.hidetoolBar,Ai=lt===void 0?!1:lt,Ei=ge.fullScreen,ii=Ei===void 0?!1:Ei,Mt=ge.onBlur,Gi=ge.onCMBeforeChange,$i=ge.onFullScreen,pn=ge.className,We=pn===void 0?"":pn,At=ge.disablePaste,mn=At===void 0?!1:At,gn=ge.placeholder,vn=gn===void 0?"":gn,yn=ge.values,z=yn===void 0?"":yn,v=Object(m.useState)(null),S=Object(W.a)(v,2),N=S[0],Z=S[1],G=Object(m.useState)(De),fe=Object(W.a)(G,2),ke=fe[0],Ze=fe[1],gt=Object(m.useState)($t),Fe=Object(W.a)(gt,2),Et=Fe[0],Ht=Fe[1],Zt=Object(m.useState)(ii),Bi=Object(W.a)(Zt,2),xi=Bi[0],Ti=Bi[1],Qi=Object(m.useState)(""),Dn=Object(W.a)(Qi,2),ci=Dn[0],zi=Dn[1],ln=Object(m.useState)(0),un=Object(W.a)(ln,2),ji=un[0],kn=un[1],_n=Object(m.useState)(_t),Kn=Object(W.a)(_n,2),Vn=Kn[0],Ji=Kn[1],Xi=Object(m.useState)(!1),bn=Object(W.a)(Xi,2),dr=bn[0],En=bn[1],ri=Object(m.useRef)(Object(je.a)()),Wt=Object(m.useRef)(!1),yi=Object(m.useRef)(),Pt=Object(m.useRef)(),si=Object(m.useRef)(),Vt=Object(m.useRef)(),nn=Object(m.useRef)(),fi=function(){var yt=Object(U.a)(I.a.mark(function Ot(){var xt,kt;return I.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:return Qt.next=2,Object(Ge.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:ri.current}});case 2:kt=Qt.sent,kt!=null&&(xt=kt.attachments)!==null&&xt!==void 0&&xt.length&&(console.log("cm:",N,Pt),kt.attachments.map(function(Ut){Ut.content_type.indexOf("image")>-1?N.replaceSelection(".concat(Ut.content_type,")")):Ut.content_type.indexOf("video")>-1?N.replaceSelection('<video width="100%" controls src="'.concat(h.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Ut.content_type.indexOf("pdf")>-1?N.replaceSelection('<a href="'.concat(h.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Ut.content_type,'&disposition=inline" target="_blank">').concat(Ut.name,"</a>")):N.replaceSelection("[".concat(Ut.name,"](").concat(h.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Ut.content_type,")"))}));case 4:case"end":return Qt.stop()}},Ot)}));return function(){return yt.apply(this,arguments)}}();Object(m.useEffect)(function(){Ze(z),N==null||N.setValue(z)},[z]),Object(m.useEffect)(function(){$i==null||$i(xi)},[xi]),Object(m.useEffect)(function(){if(Pt.current){var yt=u.a.fromTextArea(Pt.current,{mode:Ii,lineNumbers:!Ft,lineWrapping:!0,value:De,autoCloseTags:!0,autoCloseBrackets:!0});Yt&&yt.focus();function Ot(xt,kt){if(mn){kt.preventDefault();return}var Bt=kt.clipboardData;if(Bt){var Qt=Bt.types.toString(),Ut=Bt.items;if(Qt==="Files"||Bt.types.indexOf("Files")>-1){if(kt.preventDefault(),Ii=="stex")return;try{var ui,Di=Ut[1];((ui=Ut[0])===null||ui===void 0?void 0:ui.kind)==="file"&&(Di=Ut[0]);var Nt=Di.getAsFile(),hn=Nt.name.split(".").pop();Re(Nt,function(Gt){if(Gt.id){var ki,wi,Yi;(Nt==null||((ki=Nt.type)===null||ki===void 0)?void 0:ki.indexOf("image"))>-1?yt.replaceSelection(".concat(Gt.content_type,")")):(Nt==null||((wi=Nt.type)===null||wi===void 0)?void 0:wi.indexOf("video"))>-1?yt.replaceSelection('<video width="100%" controls src="'.concat(h.a.API_SERVER,"/api/attachments/").concat(Gt.id,'"></video>')):(Nt==null||((Yi=Nt.type)===null||Yi===void 0)?void 0:Yi.indexOf("pdf"))>-1?yt.replaceSelection('<a href="'.concat(h.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Nt.type,'&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):te.includes(hn)?yt.replaceSelection('<a href="'.concat(h.a.API_SERVER,"/api/attachments/").concat(Gt.id,'?type=office&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):yt.replaceSelection("[".concat(Nt.name,"](").concat(h.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Gt.content_type,")"))}else(Gt==null?void 0:Gt.status)===401&&(document.location.href="/user/login")})}catch(Gt){F.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return yt.on("paste",Ot),yt.on("dragleave",function(xt,kt){si.current.classList.remove("mouse-hover-md")}),yt.on("dragover",function(xt,kt){si.current.classList.add("mouse-hover-md")}),yt.on("drop",function(xt,kt){si.current.classList.add("mouse-hover-md");var Bt;if(Bt=kt.dataTransfer.files,Bt.length>0){kt.preventDefault(),kt.stopPropagation();for(var Qt=function(Di){var Nt=Bt[Di],hn=Nt.name.split(".").pop();Re(Nt,function(Gt){if(Gt.id){var ki,wi,Yi;(Nt==null||((ki=Nt.type)===null||ki===void 0)?void 0:ki.indexOf("image"))>-1?yt.replaceSelection(".concat(Gt.content_type,")")):(Nt==null||((wi=Nt.type)===null||wi===void 0)?void 0:wi.indexOf("video"))>-1?yt.replaceSelection('<video width="100%" controls src="'.concat(h.a.API_SERVER,"/api/attachments/").concat(Gt.id,'"></video>')):(Nt==null||((Yi=Nt.type)===null||Yi===void 0)?void 0:Yi.indexOf("pdf"))>-1?yt.replaceSelection('<a href="'.concat(h.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Nt.type,'&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):te.includes(hn)?yt.replaceSelection('<a href="'.concat(h.a.API_SERVER,"/api/attachments/").concat(Gt.id,'?type=office&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):yt.replaceSelection("[".concat(Nt.name,"](").concat(h.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Gt.content_type,")"))}else(Gt==null?void 0:Gt.status)===401&&(document.location.href="/user/login")})},Ut=0;Ut<Bt.length;Ut++)Qt(Ut)}}),Z(yt),function(){yt.off("paste",Ot)}}},[]);var Oi=Object(m.useCallback)(function(){if(si.current)try{}catch(yt){console.log(yt,"---- to set md editor body height")}},[Vn,si,xi]);Object(m.useEffect)(function(){function yt(){var xt=new r.default(function(kt){var Bt=Object(D.a)(kt),Qt;try{for(Bt.s();!(Qt=Bt.n()).done;){var Ut=Qt.value;(Ut.target.offsetHeight>0||Ut.target.offsetWidth>0)&&(Oi(),N.setSize("100%","100%"),N.refresh())}}catch(ui){Bt.e(ui)}finally{Bt.f()}});return xt.observe(Pt.current.parentElement),xt}if(N){var Ot=yt();return function(){Ot.unobserve(Pt.current.parentElement)}}},[N,Oi]),Object(m.useEffect)(function(){if(N){for(var yt=[],Ot=function(){var Ut=kt[xt];Bt=Object(W.a)(Ut,2);var ui=Bt[0],Di=Bt[1],Nt=Object(j.a)({},ui,function(){Xn(Di)});yt.push(Nt),N.addKeyMap(Nt)},xt=0,kt=Object.entries(ie);xt<kt.length;xt++){var Bt;Ot()}return yi.current=setInterval(function(){Wt.current&&fi()},4e3),function(){clearInterval(yi.current);var Qt=Object(D.a)(yt),Ut;try{for(Qt.s();!(Ut=Qt.n()).done;){var ui=Ut.value;N.removeKeyMap(ui)}}catch(Di){Qt.e(Di)}finally{Qt.f()}}}},[N]),Object(m.useEffect)(function(){ii!==xi&&Ti(ii)},[ii]),Object(ft.a)(function(){if(!jt&&ji>0){var yt=new Date().getTime(),Ot=window.sessionStorage.getItem(St);yt>=ji+Je&&(!Ot||Ot!==ke)&&(window.sessionStorage.setItem(St,ke),En(!0))}},Je),Object(m.useEffect)(function(){Ht($t)},[N,$t]),Object(m.useEffect)(function(){N&&(Yt&&N.focus())},[N,Yt]),Object(m.useEffect)(function(){if(Et&&N){var yt=N.getScrollerElement();function Ot(xt){var kt=xt.target;if(nn.current){var Bt=kt.scrollTop/kt.scrollHeight;nn.current.scrollTop=nn.current.scrollHeight*Bt}}return yt.addEventListener("scroll",Ot),function(){yt.removeEventListener("scroll",Ot)}}},[N,Et]),Object(m.useEffect)(function(){if(N&&Gi){function yt(Ot,xt){Gi(Ot,xt)}return N.on("beforeChange",yt),function(){N.off("beforeChange",yt)}}},[N,Gi]),Object(m.useEffect)(function(){if(N&&Mt){function yt(){Mt(N.getValue())}return N.on("blur",yt),function(){N.off("blur",yt)}}},[N,Mt]),Object(m.useEffect)(function(){if(N){function yt(Ot){var xt=Ot.getValue();Ze(xt),kn(new Date().getTime()),Ot.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Ke&&Ke(xt)}return N.on("change",yt),function(){N.off("change",yt)}}},[N,Ke]),Object(m.useEffect)(function(){N&&(De==null?(N.setValue(""),Ze("")):De!==N.getValue()&&(N.setValue(De),Ze(De),N.setCursor(N.lineCount(),0)))},[N,De]);var Xn=Object(m.useCallback)(function(yt){var Ot=N.getCursor(),xt=N.getSelection(),kt=xt.split(`
|
|
`);switch(yt){case"bold":return N.replaceSelection("**"+xt+"**"),xt===""&&N.setCursor(Ot.line,Ot.ch+2),N.focus();case"italic":return N.replaceSelection("*"+xt+"*"),xt===""&&N.setCursor(Ot.line,Ot.ch+1),N.focus();case"code":return N.replaceSelection("`"+xt+"`"),xt===""&&N.setCursor(Ot.line,Ot.ch+1),N.focus();case"inline-latex":return N.replaceSelection("`$$"+xt+"$$`"),xt===""&&N.setCursor(Ot.line,Ot.ch+3),N.focus();case"latex":return N.replaceSelection("```latex\n"+xt+"\n```"),N.setCursor(Ot.line+1,xt.length+1),N.focus();case"line-break":return N.replaceSelection(`<br/>
|
|
`),N.focus();case"list-ul":return xt===""?N.replaceSelection("- "+xt):N.replaceSelection(kt.map(function(Bt){return Bt===""?"":"- ".concat(Bt)}).join(`
|
|
`)),N.focus();case"list-ol":return xt===""?N.replaceSelection("1. "+xt):N.replaceSelection(kt.map(function(Bt,Qt){return Bt===""?"":"".concat(Qt+1,". ").concat(Bt)}).join(`
|
|
`)),N.focus();case"add-null-ch":return xt===""&&N.setCursor(Ot.line,Ot.ch+1),N.replaceSelection(Se),N.focus();case"inster-template-1":return xt===""&&N.setCursor(Ot.line,Ot.ch),N.replaceSelection(Ne),N.focus();case"eraser":return N.setValue(""),N.focus();case"trigger-watch":return Ht(!Et),N.focus();case"trigger-full-screen":return Ti(!xi),N.focus();case Me:zi(Me);return;case ut:zi(ut);return;case Pe:zi(Pe);return;case tt:zi(tt);return;default:throw new Error}},[N,Et,xi]),xn=Object(m.useCallback)(function(yt){zi("");switch(ci){case Me:var Ot=yt.title,xt=yt.link;return N.replaceSelection("[".concat(Ot,"](").concat(xt,")")),N.focus();case ut:var kt=yt.language,Bt=yt.content;return N.replaceSelection(["```"+kt,Bt,"```"].join(`
|
|
`)),N.focus();case Pe:var Qt=yt.src,Ut=yt.alt;return Ut?N.replaceSelection(".concat(Qt,' "').concat(Ut,'" )')):N.replaceSelection("")),N.focus();case tt:for(var ui=yt.row,Di=yt.col,Nt=yt.align,hn=`
|
|
`,Gt=0;Gt<ui;Gt++){for(var ki=[],wi=[],Yi=0;Yi<Di;Yi++)Gt===1&&wi.push($e[Nt]),ki.push(" ");Gt===1&&(hn+="| ".concat(wi.join(" | "),` |
|
|
`)),hn+="| ".concat(ki.join(Di===1?"":" | "),` |
|
|
`)}return N.replaceSelection(hn+`
|
|
`),N.focus();default:throw new Error}},[N,ci]),cr=Object(m.useMemo)(function(){switch(ci){case Me:return c.a.createElement(re,{callback:xn,onCancel:Tn});case ut:return c.a.createElement(ue.b,{callback:xn,onCancel:Tn});case Pe:return c.a.createElement(me,{callback:xn,onCancel:Tn});case tt:return c.a.createElement(Ue,{callback:xn,onCancel:Tn});default:return null}},[ci]);function Tn(){zi("")}Object(m.useEffect)(function(){if(Vt.current){var yt=Vt.current,Ot=!1,xt=0;function kt(Ut){Ot=!0,xt=Ut.pageY}function Bt(){Ot=!1}function Qt(Ut){if(Ot){var ui=Ut.pageY-xt;ui<0&&(ui=0),ui>300&&(ui=300);var Di=_t+ui+"px";Ji(Di)}}return yt.addEventListener("mousedown",kt),document.addEventListener("mousemove",Qt),document.addEventListener("mouseup",Bt),function(){yt.removeEventListener("mousedown",kt),document.removeEventListener("mousemove",Qt),document.removeEventListener("mouseup",Bt)}}},[N,Vt]),Object(m.useEffect)(function(){Ji(_t)},[_t]);var rn=ve(it),fr=ve(Vn),Zi={width:rn,height:fr},pr=Object(m.useMemo)(function(){if(ji){var yt=new Date(ji),Ot=yt.getHours(),xt=yt.getMinutes(),kt=yt.getSeconds();return Ot=Ot<10?"0"+Ot:Ot,xt=xt<10?"0"+xt:xt,kt=kt<10?"0"+kt:kt,"".concat(Ot,":").concat(xt,":").concat(kt)}return 0},[ji]);function jr(){window.sessionStorage.removeItem(St),En(!1),kn(0)}function Mn(){En(!1),kn(0),N.setValue(window.sessionStorage.getItem(St))}function ua(yt,Ot){var xt=N.getValue();xt=xt.replace(yt,Ot),Ze(xt),N==null||N.setValue(xt)}return c.a.createElement(m.Fragment,null,c.a.createElement("div",{className:"markdown-editor-wrapper",ref:si},c.a.createElement("div",{className:"markdown-editor-container ".concat(We," ").concat(Et?"on-preview":""," ").concat(Ft?"mini":""," ").concat(xi?"full-screen":""),style:Zi},c.a.createElement(b,{insertTemp:Lt,watch:Et,fullScreen:xi,showNullButton:Tt,onActionCallback:Xn,hidetoolBar:Ai,uuid:ri.current,setOpenPhones:function(){Wt.current=!0}}),c.a.createElement("div",{className:"markdown-editor-body"},c.a.createElement("div",{className:"codemirror-container"},c.a.createElement("textarea",{ref:Pt,placeholder:vn})),Et?c.a.createElement("div",{ref:nn,className:"preview-container"},Ii==="stex"&&c.a.createElement(O,{value:ke}),Ii!=="stex"&&c.a.createElement(x.a,{edit:!0,value:ke,replaces:ua})):null))),It?c.a.createElement("a",{ref:Vt,className:"editor-resize"}):null,c.a.createElement(M.a,null,oe[ci]?c.a.createElement(J.a,{centered:!0,title:oe[ci],visible:!0,onCancel:Tn,footer:null,className:"markdown-popup-form"},cr):null))}},RotF:function(vt,et,ne){vt.exports=ne("LSTS")},SJMd:function(vt,et){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var ne,ae,J,D=!1,Y,F;window.PR_SHOULD_USE_CONTINUATION=!0;var U,W;(function(){var j=window,k=["break,continue,do,else,for,if,return,while"],I=[k,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],m=[I,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],c=[m,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],f=[m,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],u=[m,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],r="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",d=[m,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],o="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",s=[k,"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=[k,"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"],p=[k,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],R=[c,u,f,d,o,s,l,p],w=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,x="str",O="kwd",A="com",T="typ",E="lit",y="pun",h="pln",_="tag",g="dec",b="src",M="atn",P="atv",K="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function B(Oe){for(var Le=0,Ue=!1,Ge=!1,je=0,Me=Oe.length;je<Me;++je){var Pe=Oe[je];if(Pe.ignoreCase)Ge=!0;else if(/[a-z]/i.test(Pe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ue=!0,Ge=!1;break}}var ut={b:8,t:9,n:10,v:11,f:12,r:13};function tt(Ye){var Ae=Ye.charCodeAt(0);if(Ae!==92)return Ae;var ct=Ye.charAt(1);return Ae=ut[ct],Ae||("0"<=ct&&ct<="7"?parseInt(Ye.substring(1),8):ct==="u"||ct==="x"?parseInt(Ye.substring(2),16):Ye.charCodeAt(1))}function qe(Ye){if(Ye<32)return(Ye<16?"\\x0":"\\x")+Ye.toString(16);var Ae=String.fromCharCode(Ye);return Ae==="\\"||Ae==="-"||Ae==="]"||Ae==="^"?"\\"+Ae:Ae}function $e(Ye){var Ae=Ye.substring(1,Ye.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")),ct=[],Je=Ae[0]==="^",Se=["["];Je&&Se.push("^");for(var Ne=Je?1:0,ve=Ae.length;Ne<ve;++Ne){var de=Ae[Ne];if(/\\[bdsw]/i.test(de))Se.push(de);else{var pe=tt(de),te;Ne+2<ve&&Ae[Ne+1]==="-"?(te=tt(Ae[Ne+2]),Ne+=2):te=pe,ct.push([pe,te]),te<65||pe>122||(te<65||pe>90||ct.push([Math.max(65,pe)|32,Math.min(te,90)|32]),te<97||pe>122||ct.push([Math.max(97,pe)&~32,Math.min(te,122)&~32]))}}ct.sort(function(ge,Ce){return ge[0]-Ce[0]||Ce[1]-ge[1]});for(var ie=[],oe=[],Ne=0;Ne<ct.length;++Ne){var he=ct[Ne];he[0]<=oe[1]+1?oe[1]=Math.max(oe[1],he[1]):ie.push(oe=he)}for(var Ne=0;Ne<ie.length;++Ne){var he=ie[Ne];Se.push(qe(he[0])),he[1]>he[0]&&(he[1]+1>he[0]&&Se.push("-"),Se.push(qe(he[1])))}return Se.push("]"),Se.join("")}function ft(Ye){for(var Ae=Ye.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")),ct=Ae.length,Je=[],Se=0,Ne=0;Se<ct;++Se){var ve=Ae[Se];if(ve==="(")++Ne;else if(ve.charAt(0)==="\\"){var de=+ve.substring(1);de&&(de<=Ne?Je[de]=-1:Ae[Se]=qe(de))}}for(var Se=1;Se<Je.length;++Se)Je[Se]===-1&&(Je[Se]=++Le);for(var Se=0,Ne=0;Se<ct;++Se){var ve=Ae[Se];if(ve==="(")++Ne,Je[Ne]||(Ae[Se]="(?:");else if(ve.charAt(0)==="\\"){var de=+ve.substring(1);de&&de<=Ne&&(Ae[Se]="\\"+Je[de])}}for(var Se=0;Se<ct;++Se)Ae[Se]==="^"&&Ae[Se+1]!=="^"&&(Ae[Se]="");if(Ye.ignoreCase&&Ue)for(var Se=0;Se<ct;++Se){var ve=Ae[Se],pe=ve.charAt(0);ve.length>=2&&pe==="["?Ae[Se]=$e(ve):pe!=="\\"&&(Ae[Se]=ve.replace(/[a-zA-Z]/g,function(oe){var he=oe.charCodeAt(0);return"["+String.fromCharCode(he&~32,he|32)+"]"}))}return Ae.join("")}for(var nt=[],je=0,Me=Oe.length;je<Me;++je){var Pe=Oe[je];if(Pe.global||Pe.multiline)throw new Error(""+Pe);nt.push("(?:"+ft(Pe)+")")}return new RegExp(nt.join("|"),Ge?"gi":"g")}function C(Oe,Le){var Ue=/(?:^|\s)nocode(?:\s|$)/,Ge=[],je=0,Me=[],Pe=0;function ut(tt){var qe=tt.nodeType;if(qe==1){if(Ue.test(tt.className))return;for(var $e=tt.firstChild;$e;$e=$e.nextSibling)ut($e);var ft=tt.nodeName.toLowerCase();(ft==="br"||ft==="li")&&(Ge[Pe]=`
|
|
`,Me[Pe<<1]=je++,Me[Pe++<<1|1]=tt)}else if(qe==3||qe==4){var nt=tt.nodeValue;nt.length&&(Le?nt=nt.replace(/\r\n?/g,`
|
|
`):nt=nt.replace(/[ \t\r\n]+/g," "),Ge[Pe]=nt,Me[Pe<<1]=je,je+=nt.length,Me[Pe++<<1|1]=tt)}}return ut(Oe),{sourceCode:Ge.join("").replace(/\n$/,""),spans:Me}}function $(Oe,Le,Ue,Ge,je){if(!Ue)return;var Me={sourceNode:Oe,pre:1,langExtension:null,numberLines:null,sourceCode:Ue,spans:null,basePos:Le,decorations:null};Ge(Me),je.push.apply(je,Me.decorations)}var ee=/\S/;function re(Oe){for(var Le=void 0,Ue=Oe.firstChild;Ue;Ue=Ue.nextSibling){var Ge=Ue.nodeType;Le=Ge===1?Le?Oe:Ue:Ge===3&&ee.test(Ue.nodeValue)?Oe:Le}return Le===Oe?void 0:Le}function ue(Oe,Le){var Ue={},Ge;(function(){for(var Pe=Oe.concat(Le),ut=[],tt={},qe=0,$e=Pe.length;qe<$e;++qe){var ft=Pe[qe],nt=ft[3];if(nt)for(var Ye=nt.length;--Ye>=0;)Ue[nt.charAt(Ye)]=ft;var Ae=ft[1],ct=""+Ae;tt.hasOwnProperty(ct)||(ut.push(Ae),tt[ct]=null)}ut.push(/[\0-\uffff]/),Ge=B(ut)})();var je=Le.length,Me=function(Pe){for(var ut=Pe.sourceCode,tt=Pe.basePos,qe=Pe.sourceNode,$e=[tt,h],ft=0,nt=ut.match(Ge)||[],Ye={},Ae=0,ct=nt.length;Ae<ct;++Ae){var Je=nt[Ae],Se=Ye[Je],Ne=void 0,ve;if(typeof Se=="string")ve=!1;else{var de=Ue[Je.charAt(0)];if(de)Ne=Je.match(de[1]),Se=de[0];else{for(var pe=0;pe<je;++pe)if(de=Le[pe],Ne=Je.match(de[1]),Ne){Se=de[0];break}Ne||(Se=h)}ve=Se.length>=5&&Se.substring(0,5)==="lang-",ve&&!(Ne&&typeof Ne[1]=="string")&&(ve=!1,Se=b),ve||(Ye[Je]=Se)}var te=ft;if(ft+=Je.length,!ve)$e.push(tt+te,Se);else{var ie=Ne[1],oe=Je.indexOf(ie),he=oe+ie.length;Ne[2]&&(he=Je.length-Ne[2].length,oe=he-ie.length);var ge=Se.substring(5);$(qe,tt+te,Je.substring(0,oe),Me,$e),$(qe,tt+te+oe,ie,se(ge,ie),$e),$(qe,tt+te+he,Je.substring(he),Me,$e)}}Pe.decorations=$e};return Me}function Te(Oe){var Le=[],Ue=[];Oe.tripleQuotedStrings?Le.push([x,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Oe.multiLineStrings?Le.push([x,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Le.push([x,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Oe.verbatimStrings&&Ue.push([x,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ge=Oe.hashComments;Ge&&(Oe.cStyleComments?(Ge>1?Le.push([A,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Le.push([A,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ue.push([x,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Le.push([A,/^#[^\r\n]*/,null,"#"])),Oe.cStyleComments&&(Ue.push([A,/^\/\/[^\r\n]*/,null]),Ue.push([A,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var je=Oe.regexLiterals;if(je){var Me=je>1?"":`
|
|
\r`,Pe=Me?".":"[\\S\\s]",ut="/(?=[^/*"+Me+"])(?:[^/\\x5B\\x5C"+Me+"]|\\x5C"+Pe+"|\\x5B(?:[^\\x5C\\x5D"+Me+"]|\\x5C"+Pe+")*(?:\\x5D|$))+/";Ue.push(["lang-regex",RegExp("^"+V+"("+ut+")")])}var tt=Oe.types;tt&&Ue.push([T,tt]);var qe=(""+Oe.keywords).replace(/^ | $/g,"");qe.length&&Ue.push([O,new RegExp("^(?:"+qe.replace(/[\s,]+/g,"|")+")\\b"),null]),Le.push([h,/^\s+/,null,` \r
|
|
\xA0`]);var $e="^.[^\\s\\w.$@'\"`/\\\\]*";return Oe.regexLiterals&&($e+="(?!s*/)"),Ue.push([E,/^@[a-z_$][a-z_$@0-9]*/i,null],[T,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[h,/^[a-z_$][a-z_$@0-9]*/i,null],[E,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[h,/^\\[\s\S]?/,null],[y,new RegExp($e),null]),ue(Le,Ue)}var ye=Te({keywords:R,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function be(Oe,Le,Ue){for(var Ge=/(?:^|\s)nocode(?:\s|$)/,je=/\r\n?|\n/,Me=Oe.ownerDocument,Pe=Me.createElement("li");Oe.firstChild;)Pe.appendChild(Oe.firstChild);var ut=[Pe];function tt(Ae){var ct=Ae.nodeType;if(ct==1&&!Ge.test(Ae.className))if(Ae.nodeName==="br")qe(Ae),Ae.parentNode&&Ae.parentNode.removeChild(Ae);else for(var Je=Ae.firstChild;Je;Je=Je.nextSibling)tt(Je);else if((ct==3||ct==4)&&Ue){var Se=Ae.nodeValue,Ne=Se.match(je);if(Ne){var ve=Se.substring(0,Ne.index);Ae.nodeValue=ve;var de=Se.substring(Ne.index+Ne[0].length);if(de){var pe=Ae.parentNode;pe.insertBefore(Me.createTextNode(de),Ae.nextSibling)}qe(Ae),ve||Ae.parentNode.removeChild(Ae)}}}function qe(Ae){for(;!Ae.nextSibling;)if(Ae=Ae.parentNode,!Ae)return;function ct(Ne,ve){var de=ve?Ne.cloneNode(!1):Ne,pe=Ne.parentNode;if(pe){var te=ct(pe,1),ie=Ne.nextSibling;te.appendChild(de);for(var oe=ie;oe;oe=ie)ie=oe.nextSibling,te.appendChild(oe)}return de}for(var Je=ct(Ae.nextSibling,0),Se;(Se=Je.parentNode)&&Se.nodeType===1;)Je=Se;ut.push(Je)}for(var $e=0;$e<ut.length;++$e)tt(ut[$e]);Le===(Le|0)&&ut[0].setAttribute("value",Le);var ft=Me.createElement("ol");ft.className="linenums";for(var nt=Math.max(0,Le-1|0)||0,$e=0,Ye=ut.length;$e<Ye;++$e)Pe=ut[$e],Pe.className="L"+($e+nt)%10,Pe.firstChild||Pe.appendChild(Me.createTextNode("\xA0")),ft.appendChild(Pe);Oe.appendChild(ft)}function we(Oe){var Le=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Le=Le&&+Le[1]<=8;var Ue=/\n/g,Ge=Oe.sourceCode,je=Ge.length,Me=0,Pe=Oe.spans,ut=Pe.length,tt=0,qe=Oe.decorations,$e=qe.length,ft=0;qe[$e]=je;var nt,Ye;for(Ye=nt=0;Ye<$e;)qe[Ye]!==qe[Ye+2]?(qe[nt++]=qe[Ye++],qe[nt++]=qe[Ye++]):Ye+=2;for($e=nt,Ye=nt=0;Ye<$e;){for(var Ae=qe[Ye],ct=qe[Ye+1],Je=Ye+2;Je+2<=$e&&qe[Je+1]===ct;)Je+=2;qe[nt++]=Ae,qe[nt++]=ct,Ye=Je}$e=qe.length=nt;var Se=Oe.sourceNode,Ne="";Se&&(Ne=Se.style.display,Se.style.display="none");try{for(var ve=null;tt<ut;){var de=Pe[tt],pe=Pe[tt+2]||je,te=qe[ft+2]||je,Je=Math.min(pe,te),ie=Pe[tt+1],oe;if(ie.nodeType!==1&&(oe=Ge.substring(Me,Je))){Le&&(oe=oe.replace(Ue,"\r")),ie.nodeValue=oe;var he=ie.ownerDocument,ge=he.createElement("span");ge.className=qe[ft+1];var Ce=ie.parentNode;Ce.replaceChild(ge,ie),ge.appendChild(ie),Me<pe&&(Pe[tt+1]=ie=he.createTextNode(Ge.substring(Je,pe)),Ce.insertBefore(ie,ge.nextSibling))}Me=Je,Me>=pe&&(tt+=2),Me>=te&&(ft+=2)}}finally{Se&&(Se.style.display=Ne)}}var xe={};function me(Oe,Le){for(var Ue=Le.length;--Ue>=0;){var Ge=Le[Ue];xe.hasOwnProperty(Ge)?j.console&&console.warn("cannot override language handler %s",Ge):xe[Ge]=Oe}}function se(Oe,Le){return Oe&&xe.hasOwnProperty(Oe)||(Oe=/^\s*</.test(Le)?"default-markup":"default-code"),xe[Oe]}me(ye,["default-code"]),me(ue([],[[h,/^[^<?]+/],[g,/^<!\w[^>]*(?:>|$)/],[A,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[y,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),me(ue([[h,/^[\s]+/,null,` \r
|
|
`],[P,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[_,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[M,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[y,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),me(ue([],[[P,/^[\s\S]+/]]),["uq.val"]),me(Te({keywords:c,hashComments:!0,cStyleComments:!0,types:w}),["c","cc","cpp","cxx","cyc","m"]),me(Te({keywords:"null,true,false"}),["json"]),me(Te({keywords:u,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:w}),["cs"]),me(Te({keywords:f,cStyleComments:!0}),["java"]),me(Te({keywords:p,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),me(Te({keywords:s,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),me(Te({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),me(Te({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),me(Te({keywords:d,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),me(Te({keywords:r,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),me(ue([],[[x,/^[\s\S]+/]]),["regex"]);function Re(Oe){var Le=Oe.langExtension;try{var Ue=C(Oe.sourceNode,Oe.pre),Ge=Ue.sourceCode;Oe.sourceCode=Ge,Oe.spans=Ue.spans,Oe.basePos=0,se(Le,Ge)(Oe),we(Oe)}catch(je){j.console&&console.log(je&&je.stack||je)}}function ze(Oe,Le,Ue){var Ge=Ue||!1,je=Le||null,Me=document.createElement("div");Me.innerHTML="<pre>"+Oe+"</pre>",Me=Me.firstChild,Ge&&be(Me,Ge,!0);var Pe={langExtension:je,numberLines:Ge,sourceNode:Me,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Re(Pe),Me.innerHTML}function He(Oe,Le){var Ue=Le||document.body,Ge=Ue.ownerDocument||document;function je(de){return Ue.getElementsByTagName(de)}for(var Me=[je("pre"),je("code"),je("xmp")],Pe=[],ut=0;ut<Me.length;++ut)for(var tt=0,qe=Me[ut].length;tt<qe;++tt)Pe.push(Me[ut][tt]);Me=null;var $e=Date;$e.now||($e={now:function(){return+new Date}});var ft=0,nt=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ye=/\bprettyprint\b/,Ae=/\bprettyprinted\b/,ct=/pre|xmp/i,Je=/^code$/i,Se=/^(?:pre|code|xmp)$/i,Ne={};function ve(){for(var de=j.PR_SHOULD_USE_CONTINUATION?$e.now()+250:Infinity;ft<Pe.length&&$e.now()<de;ft++){for(var pe=Pe[ft],te=Ne,ie=pe;ie=ie.previousSibling;){var oe=ie.nodeType,he=(oe===7||oe===8)&&ie.nodeValue;if(he?!/^\??prettify\b/.test(he):oe!==3||/\S/.test(ie.nodeValue))break;if(he){te={},he.replace(/\b(\w+)=([\w:.%+-]+)/g,function($t,Lt,di){te[Lt]=di});break}}var ge=pe.className;if((te!==Ne||Ye.test(ge))&&!Ae.test(ge)){for(var Ce=!1,De=pe.parentNode;De;De=De.parentNode){var Ke=De.tagName;if(Se.test(Ke)&&De.className&&Ye.test(De.className)){Ce=!0;break}}if(!Ce){pe.className+=" prettyprinted";var ht=te.lang;if(!ht){ht=ge.match(nt);var it;!ht&&(it=re(pe))&&Je.test(it.tagName)&&(ht=it.className.match(nt)),ht&&(ht=ht[1])}var mt;if(ct.test(pe.tagName))mt=1;else{var _t=pe.currentStyle,Qe=Ge.defaultView,Ft=_t?_t.whiteSpace:Qe&&Qe.getComputedStyle?Qe.getComputedStyle(pe,null).getPropertyValue("white-space"):0;mt=Ft&&Ft.substring(0,3)==="pre"}var Ct=te.linenums;(Ct=Ct==="true"||+Ct)||(Ct=ge.match(/\blinenums\b(?::(\d+))?/),Ct=Ct?Ct[1]&&Ct[1].length?+Ct[1]:!0:!1),Ct&&be(pe,Ct,mt);var Yt={langExtension:ht,sourceNode:pe,numberLines:Ct,pre:mt,sourceCode:null,basePos:null,spans:null,decorations:null};Re(Yt)}}}ft<Pe.length?j.setTimeout(ve,250):typeof Oe=="function"&&Oe()}ve()}var rt=j.PR={createSimpleLexer:ue,registerLangHandler:me,sourceDecorator:Te,PR_ATTRIB_NAME:M,PR_ATTRIB_VALUE:P,PR_COMMENT:A,PR_DECLARATION:g,PR_KEYWORD:O,PR_LITERAL:E,PR_NOCODE:K,PR_PLAIN:h,PR_PUNCTUATION:y,PR_SOURCE:b,PR_STRING:x,PR_TAG:_,PR_TYPE:T,prettyPrintOne:D?j.prettyPrintOne=ze:U=ze,prettyPrint:W=D?j.prettyPrint=He:W=He},ot=j.define;typeof ot=="function"&&ot.amd&&ot("google-code-prettify",[],function(){return rt})})()},SbmS:function(vt,et,ne){vt.exports={flex_box_center:"flex_box_center___HG_ui",flex_space_between:"flex_space_between___i7dgQ",flex_box_vertical_center:"flex_box_vertical_center___25J9O",flex_box_center_end:"flex_box_center_end___Q7-xc",flex_box_column:"flex_box_column___2Q6GJ",userInfo:"userInfo___2ECUY",navInfo:"navInfo___3H3dt",actived:"actived___ilDpa",topBar:"topBar___2O4NK",tabs:"tabs___yp4Rb",active:"active___3Xgtk",list:"list___U4GMG",tags:"tags___2IWIk",searchWrp:"searchWrp___1-W5t",listMessage:"listMessage___1M4jE",deleteMsg:"deleteMsg___1HDtB",listRightMessage:"listRightMessage___1rCRK",content:"content___KsZrb",msg:"msg___35IM3",msgDate:"msgDate___ovoCe"}},TXwP:function(vt,et,ne){var ae,J;(function(){var D;(function(){"use strict";var F=[,,function(k){function I(f){this.__parent=f,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}I.prototype.clone_empty=function(){var f=new I(this.__parent);return f.set_indent(this.__indent_count,this.__alignment_count),f},I.prototype.item=function(f){return f<0?this.__items[this.__items.length+f]:this.__items[f]},I.prototype.has_match=function(f){for(var u=this.__items.length-1;u>=0;u--)if(this.__items[u].match(f))return!0;return!1},I.prototype.set_indent=function(f,u){this.is_empty()&&(this.__indent_count=f||0,this.__alignment_count=u||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},I.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},I.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},I.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var f=this.__parent.current_line;return f.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),f.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),f.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,f.__items[0]===" "&&(f.__items.splice(0,1),f.__character_count-=1),!0}return!1},I.prototype.is_empty=function(){return this.__items.length===0},I.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},I.prototype.push=function(f){this.__items.push(f);var u=f.lastIndexOf(`
|
|
`);u!==-1?this.__character_count=f.length-u:this.__character_count+=f.length},I.prototype.pop=function(){var f=null;return this.is_empty()||(f=this.__items.pop(),this.__character_count-=f.length),f},I.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},I.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},I.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},I.prototype.toString=function(){var f="";return this.is_empty()?this.__parent.indent_empty_lines&&(f=this.__parent.get_indent_string(this.__indent_count)):(f=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),f+=this.__items.join("")),f};function m(f,u){this.__cache=[""],this.__indent_size=f.indent_size,this.__indent_string=f.indent_char,f.indent_with_tabs||(this.__indent_string=new Array(f.indent_size+1).join(f.indent_char)),u=u||"",f.indent_level>0&&(u=new Array(f.indent_level+1).join(this.__indent_string)),this.__base_string=u,this.__base_string_length=u.length}m.prototype.get_indent_size=function(f,u){var r=this.__base_string_length;return u=u||0,f<0&&(r=0),r+=f*this.__indent_size,r+=u,r},m.prototype.get_indent_string=function(f,u){var r=this.__base_string;return u=u||0,f<0&&(f=0,r=""),u+=f*this.__indent_size,this.__ensure_cache(u),r+=this.__cache[u],r},m.prototype.__ensure_cache=function(f){for(;f>=this.__cache.length;)this.__add_column()},m.prototype.__add_column=function(){var f=this.__cache.length,u=0,r="";this.__indent_size&&f>=this.__indent_size&&(u=Math.floor(f/this.__indent_size),f-=u*this.__indent_size,r=new Array(u+1).join(this.__indent_string)),f&&(r+=new Array(f+1).join(" ")),this.__cache.push(r)};function c(f,u){this.__indent_cache=new m(f,u),this.raw=!1,this._end_with_newline=f.end_with_newline,this.indent_size=f.indent_size,this.wrap_line_length=f.wrap_line_length,this.indent_empty_lines=f.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new I(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}c.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},c.prototype.get_line_number=function(){return this.__lines.length},c.prototype.get_indent_string=function(f,u){return this.__indent_cache.get_indent_string(f,u)},c.prototype.get_indent_size=function(f,u){return this.__indent_cache.get_indent_size(f,u)},c.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},c.prototype.add_new_line=function(f){return this.is_empty()||!f&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},c.prototype.get_code=function(f){this.trim(!0);var u=this.current_line.pop();u&&(u[u.length-1]===`
|
|
`&&(u=u.replace(/\n+$/g,"")),this.current_line.push(u)),this._end_with_newline&&this.__add_outputline();var r=this.__lines.join(`
|
|
`);return f!==`
|
|
`&&(r=r.replace(/[\n]/g,f)),r},c.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},c.prototype.set_indent=function(f,u){return f=f||0,u=u||0,this.next_line.set_indent(f,u),this.__lines.length>1?(this.current_line.set_indent(f,u),!0):(this.current_line.set_indent(),!1)},c.prototype.add_raw_token=function(f){for(var u=0;u<f.newlines;u++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(f.whitespace_before),this.current_line.push(f.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},c.prototype.add_token=function(f){this.__add_space_before_token(),this.current_line.push(f),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},c.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},c.prototype.remove_indent=function(f){for(var u=this.__lines.length;f<u;)this.__lines[f]._remove_indent(),f++;this.current_line._remove_wrap_indent()},c.prototype.trim=function(f){for(f=f===void 0?!1:f,this.current_line.trim();f&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},c.prototype.just_added_newline=function(){return this.current_line.is_empty()},c.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},c.prototype.ensure_empty_line_above=function(f,u){for(var r=this.__lines.length-2;r>=0;){var d=this.__lines[r];if(d.is_empty())break;if(d.item(0).indexOf(f)!==0&&d.item(-1)!==u){this.__lines.splice(r+1,0,new I(this)),this.previous_line=this.__lines[this.__lines.length-2];break}r--}},k.exports.Output=c},,,,function(k){function I(f,u){this.raw_options=m(f,u),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}I.prototype._get_array=function(f,u){var r=this.raw_options[f],d=u||[];return typeof r=="object"?r!==null&&typeof r.concat=="function"&&(d=r.concat()):typeof r=="string"&&(d=r.split(/[^a-zA-Z0-9_\/\-]+/)),d},I.prototype._get_boolean=function(f,u){var r=this.raw_options[f],d=r===void 0?!!u:!!r;return d},I.prototype._get_characters=function(f,u){var r=this.raw_options[f],d=u||"";return typeof r=="string"&&(d=r.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),d},I.prototype._get_number=function(f,u){var r=this.raw_options[f];u=parseInt(u,10),isNaN(u)&&(u=0);var d=parseInt(r,10);return isNaN(d)&&(d=u),d},I.prototype._get_selection=function(f,u,r){var d=this._get_selection_list(f,u,r);if(d.length!==1)throw new Error("Invalid Option Value: The option '"+f+`' can only be one of the following values:
|
|
`+u+`
|
|
You passed in: '`+this.raw_options[f]+"'");return d[0]},I.prototype._get_selection_list=function(f,u,r){if(!u||u.length===0)throw new Error("Selection list cannot be empty.");if(r=r||[u[0]],!this._is_valid_selection(r,u))throw new Error("Invalid Default Value!");var d=this._get_array(f,r);if(!this._is_valid_selection(d,u))throw new Error("Invalid Option Value: The option '"+f+`' can contain only the following values:
|
|
`+u+`
|
|
You passed in: '`+this.raw_options[f]+"'");return d},I.prototype._is_valid_selection=function(f,u){return f.length&&u.length&&!f.some(function(r){return u.indexOf(r)===-1})};function m(f,u){var r={};f=c(f);var d;for(d in f)d!==u&&(r[d]=f[d]);if(u&&f[u])for(d in f[u])r[d]=f[u][d];return r}function c(f){var u={},r;for(r in f){var d=r.replace(/-/g,"_");u[d]=f[r]}return u}k.exports.Options=I,k.exports.normalizeOpts=c,k.exports.mergeOpts=m},,function(k){var I=RegExp.prototype.hasOwnProperty("sticky");function m(c){this.__input=c||"",this.__input_length=this.__input.length,this.__position=0}m.prototype.restart=function(){this.__position=0},m.prototype.back=function(){this.__position>0&&(this.__position-=1)},m.prototype.hasNext=function(){return this.__position<this.__input_length},m.prototype.next=function(){var c=null;return this.hasNext()&&(c=this.__input.charAt(this.__position),this.__position+=1),c},m.prototype.peek=function(c){var f=null;return c=c||0,c+=this.__position,c>=0&&c<this.__input_length&&(f=this.__input.charAt(c)),f},m.prototype.__match=function(c,f){c.lastIndex=f;var u=c.exec(this.__input);return u&&!(I&&c.sticky)&&(u.index!==f&&(u=null)),u},m.prototype.test=function(c,f){return f=f||0,f+=this.__position,f>=0&&f<this.__input_length?!!this.__match(c,f):!1},m.prototype.testChar=function(c,f){var u=this.peek(f);return c.lastIndex=0,u!==null&&c.test(u)},m.prototype.match=function(c){var f=this.__match(c,this.__position);return f?this.__position+=f[0].length:f=null,f},m.prototype.read=function(c,f,u){var r="",d;return c&&(d=this.match(c),d&&(r+=d[0])),f&&(d||!c)&&(r+=this.readUntil(f,u)),r},m.prototype.readUntil=function(c,f){var u="",r=this.__position;c.lastIndex=this.__position;var d=c.exec(this.__input);return d?(r=d.index,f&&(r+=d[0].length)):r=this.__input_length,u=this.__input.substring(this.__position,r),this.__position=r,u},m.prototype.readUntilAfter=function(c){return this.readUntil(c,!0)},m.prototype.get_regexp=function(c,f){var u=null,r="g";return f&&I&&(r="y"),typeof c=="string"&&c!==""?u=new RegExp(c,r):c&&(u=new RegExp(c.source,r)),u},m.prototype.get_literal_regexp=function(c){return RegExp(c.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},m.prototype.peekUntilAfter=function(c){var f=this.__position,u=this.readUntilAfter(c);return this.__position=f,u},m.prototype.lookBack=function(c){var f=this.__position-1;return f>=c.length&&this.__input.substring(f-c.length,f).toLowerCase()===c},k.exports.InputScanner=m},,,,,function(k){function I(m,c){m=typeof m=="string"?m:m.source,c=typeof c=="string"?c:c.source,this.__directives_block_pattern=new RegExp(m+/ beautify( \w+[:]\w+)+ /.source+c,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(m+/\sbeautify\signore:end\s/.source+c,"g")}I.prototype.get_directives=function(m){if(!m.match(this.__directives_block_pattern))return null;var c={};this.__directive_pattern.lastIndex=0;for(var f=this.__directive_pattern.exec(m);f;)c[f[1]]=f[2],f=this.__directive_pattern.exec(m);return c},I.prototype.readIgnored=function(m){return m.readUntilAfter(this.__directives_end_ignore_pattern)},k.exports.Directives=I},,function(k,I,m){var c=m(16).Beautifier,f=m(17).Options;function u(r,d){var o=new c(r,d);return o.beautify()}k.exports=u,k.exports.defaultOptions=function(){return new f}},function(k,I,m){var c=m(17).Options,f=m(2).Output,u=m(8).InputScanner,r=m(13).Directives,d=new r(/\/\*/,/\*\//),o=/\r\n|[\r\n]/,s=/\r\n|[\r\n]/g,l=/\s/,p=/(?:\s|\n)+/g,R=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,w=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function x(O,A){this._source_text=O||"",this._options=new c(A),this._ch=null,this._input=null,this.NESTED_AT_RULE={"@page":!0,"@font-face":!0,"@keyframes":!0,"@media":!0,"@supports":!0,"@document":!0},this.CONDITIONAL_GROUP_RULE={"@media":!0,"@supports":!0,"@document":!0},this.NON_SEMICOLON_NEWLINE_PROPERTY=["grid-template-areas","grid-template"]}x.prototype.eatString=function(O){var A="";for(this._ch=this._input.next();this._ch;){if(A+=this._ch,this._ch==="\\")A+=this._input.next();else if(O.indexOf(this._ch)!==-1||this._ch===`
|
|
`)break;this._ch=this._input.next()}return A},x.prototype.eatWhitespace=function(O){for(var A=l.test(this._input.peek()),T=0;l.test(this._input.peek());)this._ch=this._input.next(),O&&this._ch===`
|
|
`&&((T===0||T<this._options.max_preserve_newlines)&&(T++,this._output.add_new_line(!0)));return A},x.prototype.foundNestedPseudoClass=function(){for(var O=0,A=1,T=this._input.peek(A);T;){if(T==="{")return!0;if(T==="(")O+=1;else if(T===")"){if(O===0)return!1;O-=1}else if(T===";"||T==="}")return!1;A++,T=this._input.peek(A)}return!1},x.prototype.print_string=function(O){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(O)},x.prototype.preserveSingleSpace=function(O){O&&(this._output.space_before_token=!0)},x.prototype.indent=function(){this._indentLevel++},x.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},x.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var O=this._source_text,A=this._options.eol;A==="auto"&&(A=`
|
|
`,O&&o.test(O||"")&&(A=O.match(o)[0])),O=O.replace(s,`
|
|
`);var T=O.match(/^[\t ]*/)[0];this._output=new f(this._options,T),this._input=new u(O),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var E=0,y=!1,h=!1,_=!1,g=!1,b=!1,M=!1,P=this._ch,K=!1,V,B,C;V=this._input.read(p),B=V!=="",C=P,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),P=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var $=this._input.read(R),ee=d.get_directives($);ee&&ee.ignore==="start"&&($+=d.readIgnored(this._input)),this.print_string($),this.eatWhitespace(!0),this._output.add_new_line()}else if(this._ch==="/"&&this._input.peek()==="/")this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(w)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(B),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var re=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);re.match(/[ :]$/)&&(re=this.eatString(": ").replace(/\s$/,""),this.print_string(re),this._output.space_before_token=!0),re=re.replace(/\s$/,""),re==="extend"?g=!0:re==="import"&&(b=!0),re in this.NESTED_AT_RULE?(this._nestedLevel+=1,re in this.CONDITIONAL_GROUP_RULE&&(_=!0)):!y&&E===0&&re.indexOf(":")!==-1&&(h=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(B),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")h&&(h=!1,this.outdent()),_?(_=!1,y=this._indentLevel>=this._nestedLevel):y=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&y&&(this._output.previous_line&&this._output.previous_line.item(-1)!=="{"&&this._output.ensure_empty_line_above("/",",")),this._output.space_before_token=!0,this._options.brace_style==="expand"?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(C==="("?this._output.space_before_token=!1:C!==","&&this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line();else if(this._ch==="}")this.outdent(),this._output.add_new_line(),C==="{"&&this._output.trim(!0),b=!1,g=!1,h&&(this.outdent(),h=!1),this.print_string(this._ch),y=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&(this._input.peek()!=="}"&&this._output.add_new_line(!0)),this._input.peek()===")"&&(this._output.trim(!0),this._options.brace_style==="expand"&&this._output.add_new_line(!0));else if(this._ch===":"){for(var ue=0;ue<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;ue++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[ue])){K=!0;break}(y||_)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!g&&E===0?(this.print_string(":"),h||(h=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var Te=C==='"'||C==="'";this.preserveSingleSpace(Te||B),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")K=!1,E===0?(h&&(this.outdent(),h=!1),g=!1,b=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),E++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),E&&(E--,this.outdent()));else{var ye=!1;this._input.lookBack("with")&&(ye=!0),this.preserveSingleSpace(B||ye),this.print_string(this._ch),h&&C==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),M=!0):(this.eatWhitespace(),E++,this.indent())}else if(this._ch===")")E&&(E--,this.outdent()),M&&this._input.peek()===";"&&this._options.selector_separator_newline&&(M=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!h||M)&&E===0&&!b&&!g?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!h&&E===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&l.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(B),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),l.test(this._ch)&&(this._ch="");else if(this._ch==="!"&&!this._input.lookBack("\\"))this._output.space_before_token=!0,this.print_string(this._ch);else{var be=C==='"'||C==="'";this.preserveSingleSpace(be||B),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
`&&K&&this._output.add_new_line()}var we=this._output.get_code(A);return we},k.exports.Beautifier=x},function(k,I,m){var c=m(6).Options;function f(u){c.call(this,u,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var r=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||r;var d=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var o=0;o<d.length;o++)d[o]!=="expand"?this.brace_style="collapse":this.brace_style=d[o]}f.prototype=new c,k.exports.Options=f}],U={};function W(k){var I=U[k];if(I!==void 0)return I.exports;var m=U[k]={exports:{}};return F[k](m,m.exports,W),m.exports}var j=W(15);D=j})();var Y=D;!(ae=[],J=function(){return{css_beautify:Y}}.apply(et,ae),J!==void 0&&(vt.exports=J))})()},UZu5:function(vt,et,ne){},"VrN/":function(vt,et,ne){(function(ae,J){vt.exports=J()})(this,function(){"use strict";var ae=navigator.userAgent,J=navigator.platform,D=/gecko\/\d/i.test(ae),Y=/MSIE \d/.test(ae),F=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ae),U=/Edge\/(\d+)/.exec(ae),W=Y||F||U,j=W&&(Y?document.documentMode||6:+(U||F)[1]),k=!U&&/WebKit\//.test(ae),I=k&&/Qt\/\d+\.\d+/.test(ae),m=!U&&/Chrome\//.test(ae),c=/Opera\//.test(ae),f=/Apple Computer/.test(navigator.vendor),u=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ae),r=/PhantomJS/.test(ae),d=!U&&/AppleWebKit/.test(ae)&&/Mobile\/\w+/.test(ae),o=/Android/.test(ae),s=d||o||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ae),l=d||/Mac/.test(J),p=/\bCrOS\b/.test(ae),R=/win/i.test(J),w=c&&ae.match(/Version\/(\d*\.\d*)/);w&&(w=Number(w[1])),w&&w>=15&&(c=!1,k=!0);var x=l&&(I||c&&(w==null||w<12.11)),O=D||W&&j>=9;function A(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var T=function(e,t){var n=e.className,i=A(t).exec(n);if(i){var a=n.slice(i.index+i[0].length);e.className=n.slice(0,i.index)+(a?i[1]+a:"")}};function E(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function y(e,t){return E(e).appendChild(t)}function h(e,t,n,i){var a=document.createElement(e);if(n&&(a.className=n),i&&(a.style.cssText=i),typeof t=="string")a.appendChild(document.createTextNode(t));else if(t)for(var L=0;L<t.length;++L)a.appendChild(t[L]);return a}function _(e,t,n,i){var a=h(e,t,n,i);return a.setAttribute("role","presentation"),a}var g;document.createRange?g=function(e,t,n,i){var a=document.createRange();return a.setEnd(i||e,n),a.setStart(e,t),a}:g=function(e,t,n){var i=document.body.createTextRange();try{i.moveToElementText(e.parentNode)}catch(a){return i}return i.collapse(!0),i.moveEnd("character",n),i.moveStart("character",t),i};function b(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 M(){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 P(e,t){var n=e.className;A(t).test(n)||(e.className+=(n?" ":"")+t)}function K(e,t){for(var n=e.split(" "),i=0;i<n.length;i++)n[i]&&!A(n[i]).test(t)&&(t+=" "+n[i]);return t}var V=function(e){e.select()};d?V=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:W&&(V=function(e){try{e.select()}catch(t){}});function B(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function C(e,t,n){t||(t={});for(var i in e)e.hasOwnProperty(i)&&(n!==!1||!t.hasOwnProperty(i))&&(t[i]=e[i]);return t}function $(e,t,n,i,a){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var L=i||0,H=a||0;;){var X=e.indexOf(" ",L);if(X<0||X>=t)return H+(t-L);H+=X-L,H+=n-H%n,L=X+1}}var ee=function(){this.id=null,this.f=null,this.time=0,this.handler=B(this.onTimeout,this)};ee.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ee.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function re(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var ue=50,Te={toString:function(){return"CodeMirror.Pass"}},ye={scroll:!1},be={origin:"*mouse"},we={origin:"+move"};function xe(e,t,n){for(var i=0,a=0;;){var L=e.indexOf(" ",i);L==-1&&(L=e.length);var H=L-i;if(L==e.length||a+H>=t)return i+Math.min(H,t-a);if(a+=L-i,a+=n-a%n,i=L+1,a>=t)return i}}var me=[""];function se(e){for(;me.length<=e;)me.push(Re(me)+" ");return me[e]}function Re(e){return e[e.length-1]}function ze(e,t){for(var n=[],i=0;i<e.length;i++)n[i]=t(e[i],i);return n}function He(e,t,n){for(var i=0,a=n(t);i<e.length&&n(e[i])<=a;)i++;e.splice(i,0,t)}function rt(){}function ot(e,t){var n;return Object.create?n=Object.create(e):(rt.prototype=e,n=new rt),t&&C(t,n),n}var Oe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Le(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Oe.test(e))}function Ue(e,t){return t?t.source.indexOf("\\w")>-1&&Le(e)?!0:t.test(e):Le(e)}function Ge(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var je=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Me(e){return e.charCodeAt(0)>=768&&je.test(e)}function Pe(e,t,n){for(;(n<0?t>0:t<e.length)&&Me(e.charAt(t));)t+=n;return t}function ut(e,t,n){for(var i=t>n?-1:1;;){if(t==n)return t;var a=(t+n)/2,L=i<0?Math.ceil(a):Math.floor(a);if(L==t)return e(L)?t:n;e(L)?n=L:t=L+i}}function tt(e,t,n,i){if(!e)return i(t,n,"ltr",0);for(var a=!1,L=0;L<e.length;++L){var H=e[L];(H.from<n&&H.to>t||t==n&&H.to==t)&&(i(Math.max(H.from,t),Math.min(H.to,n),H.level==1?"rtl":"ltr",L),a=!0)}a||i(t,n,"ltr")}var qe=null;function $e(e,t,n){var i;qe=null;for(var a=0;a<e.length;++a){var L=e[a];if(L.from<t&&L.to>t)return a;L.to==t&&(L.from!=L.to&&n=="before"?i=a:qe=a),L.from==t&&(L.from!=L.to&&n!="before"?i=a:qe=a)}return i!=null?i:qe}var ft=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(q){return q<=247?e.charAt(q):1424<=q&&q<=1524?"R":1536<=q&&q<=1785?t.charAt(q-1536):1774<=q&&q<=2220?"r":8192<=q&&q<=8203?"w":q==8204?"b":"L"}var i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,a=/[stwN]/,L=/[LRr]/,H=/[Lb1n]/,X=/[1n]/;function Q(q,le,ce){this.level=q,this.from=le,this.to=ce}return function(q,le){var ce=le=="ltr"?"L":"R";if(q.length==0||le=="ltr"&&!i.test(q))return!1;for(var Ee=q.length,_e=[],Ie=0;Ie<Ee;++Ie)_e.push(n(q.charCodeAt(Ie)));for(var Be=0,Xe=ce;Be<Ee;++Be){var at=_e[Be];at=="m"?_e[Be]=Xe:Xe=at}for(var dt=0,st=ce;dt<Ee;++dt){var pt=_e[dt];pt=="1"&&st=="r"?_e[dt]="n":L.test(pt)&&(st=pt,pt=="r"&&(_e[dt]="R"))}for(var wt=1,bt=_e[0];wt<Ee-1;++wt){var Dt=_e[wt];Dt=="+"&&bt=="1"&&_e[wt+1]=="1"?_e[wt]="1":Dt==","&&bt==_e[wt+1]&&(bt=="1"||bt=="n")&&(_e[wt]=bt),bt=Dt}for(var Jt=0;Jt<Ee;++Jt){var gi=_e[Jt];if(gi==",")_e[Jt]="N";else if(gi=="%"){var ti=void 0;for(ti=Jt+1;ti<Ee&&_e[ti]=="%";++ti);for(var Wi=Jt&&_e[Jt-1]=="!"||ti<Ee&&_e[ti]=="1"?"1":"N",Ni=Jt;Ni<ti;++Ni)_e[Ni]=Wi;Jt=ti-1}}for(var oi=0,Fi=ce;oi<Ee;++oi){var bi=_e[oi];Fi=="L"&&bi=="1"?_e[oi]="L":L.test(bi)&&(Fi=bi)}for(var hi=0;hi<Ee;++hi)if(a.test(_e[hi])){var li=void 0;for(li=hi+1;li<Ee&&a.test(_e[li]);++li);for(var ni=(hi?_e[hi-1]:ce)=="L",Ui=(li<Ee?_e[li]:ce)=="L",ur=ni==Ui?ni?"L":"R":ce,In=hi;In<li;++In)_e[In]=ur;hi=li-1}for(var Ci=[],on,vi=0;vi<Ee;)if(H.test(_e[vi])){var Va=vi;for(++vi;vi<Ee&&H.test(_e[vi]);++vi);Ci.push(new Q(0,Va,vi))}else{var fn=vi,Gn=Ci.length,zn=le=="rtl"?1:0;for(++vi;vi<Ee&&_e[vi]!="L";++vi);for(var Li=fn;Li<vi;)if(X.test(_e[Li])){fn<Li&&(Ci.splice(Gn,0,new Q(1,fn,Li)),Gn+=zn);var hr=Li;for(++Li;Li<vi&&X.test(_e[Li]);++Li);Ci.splice(Gn,0,new Q(2,hr,Li)),Gn+=zn,fn=Li}else++Li;fn<vi&&Ci.splice(Gn,0,new Q(1,fn,vi))}return le=="ltr"&&(Ci[0].level==1&&(on=q.match(/^\s+/))&&(Ci[0].from=on[0].length,Ci.unshift(new Q(0,0,on[0].length))),Re(Ci).level==1&&(on=q.match(/\s+$/))&&(Re(Ci).to-=on[0].length,Ci.push(new Q(0,Ee-on[0].length,Ee)))),le=="rtl"?Ci.reverse():Ci}}();function nt(e,t){var n=e.order;return n==null&&(n=e.order=ft(e.text,t)),n}var Ye=[],Ae=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var i=e._handlers||(e._handlers={});i[t]=(i[t]||Ye).concat(n)}};function ct(e,t){return e._handlers&&e._handlers[t]||Ye}function Je(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var i=e._handlers,a=i&&i[t];if(a){var L=re(a,n);L>-1&&(i[t]=a.slice(0,L).concat(a.slice(L+1)))}}}function Se(e,t){var n=ct(e,t);if(!n.length)return;for(var i=Array.prototype.slice.call(arguments,2),a=0;a<n.length;++a)n[a].apply(null,i)}function Ne(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Se(e,n||t.type,e,t),oe(t)||t.codemirrorIgnore}function ve(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),i=0;i<t.length;++i)re(n,t[i])==-1&&n.push(t[i])}function de(e,t){return ct(e,t).length>0}function pe(e){e.prototype.on=function(t,n){Ae(this,t,n)},e.prototype.off=function(t,n){Je(this,t,n)}}function te(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ie(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function oe(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function he(e){te(e),ie(e)}function ge(e){return e.target||e.srcElement}function Ce(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 De=function(){if(W&&j<9)return!1;var e=h("div");return"draggable"in e||"dragDrop"in e}(),Ke;function ht(e){if(Ke==null){var t=h("span","\u200B");y(e,h("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ke=t.offsetWidth<=1&&t.offsetHeight>2&&!(W&&j<8))}var n=Ke?h("span","\u200B"):h("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var it;function mt(e){if(it!=null)return it;var t=y(e,document.createTextNode("A\u062EA")),n=g(t,0,1).getBoundingClientRect(),i=g(t,1,2).getBoundingClientRect();return E(e),!n||n.left==n.right?!1:it=i.right-n.right<3}var _t=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],i=e.length;t<=i;){var a=e.indexOf(`
|
|
`,t);a==-1&&(a=e.length);var L=e.slice(t,e.charAt(a-1)=="\r"?a-1:a),H=L.indexOf("\r");H!=-1?(n.push(L.slice(0,H)),t+=H+1):(n.push(L),t=a+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Qe=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Ft=function(){var e=h("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Ct=null;function Yt(e){if(Ct!=null)return Ct;var t=y(e,h("span","x")),n=t.getBoundingClientRect(),i=g(t,0,1).getBoundingClientRect();return Ct=Math.abs(n.left-i.left)>1}var $t={},Lt={};function di(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),$t[e]=t}function Ii(e,t){Lt[e]=t}function Ve(e){if(typeof e=="string"&&Lt.hasOwnProperty(e))e=Lt[e];else if(e&&typeof e.name=="string"&&Lt.hasOwnProperty(e.name)){var t=Lt[e.name];typeof t=="string"&&(t={name:t}),e=ot(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ve("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ve("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function St(e,t){t=Ve(t);var n=$t[t.name];if(!n)return St(e,"text/plain");var i=n(e,t);if(Rt.hasOwnProperty(t.name)){var a=Rt[t.name];for(var L in a){if(!a.hasOwnProperty(L))continue;i.hasOwnProperty(L)&&(i["_"+L]=i[L]),i[L]=a[L]}}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var H in t.modeProps)i[H]=t.modeProps[H];return i}var Rt={};function It(e,t){var n=Rt.hasOwnProperty(e)?Rt[e]:Rt[e]={};C(t,n)}function qt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var i in t){var a=t[i];a instanceof Array&&(a=a.concat([])),n[i]=a}return n}function jt(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Kt(e,t,n){return e.startState?e.startState(t,n):!0}var Tt=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Tt.prototype.eol=function(){return this.pos>=this.string.length},Tt.prototype.sol=function(){return this.pos==this.lineStart},Tt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Tt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Tt.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},Tt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Tt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Tt.prototype.skipToEnd=function(){this.pos=this.string.length},Tt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Tt.prototype.backUp=function(e){this.pos-=e},Tt.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)},Tt.prototype.indentation=function(){return $(this.string,null,this.tabSize)-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},Tt.prototype.match=function(e,t,n){if(typeof e=="string"){var i=function(H){return n?H.toLowerCase():H},a=this.string.substr(this.pos,e.length);if(i(a)==i(e))return t!==!1&&(this.pos+=e.length),!0}else{var L=this.string.slice(this.pos).match(e);return L&&L.index>0?null:(L&&t!==!1&&(this.pos+=L[0].length),L)}},Tt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Tt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Tt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Tt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function lt(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 n=e;!n.lines;)for(var i=0;;++i){var a=n.children[i],L=a.chunkSize();if(t<L){n=a;break}t-=L}return n.lines[t]}function Ai(e,t,n){var i=[],a=t.line;return e.iter(t.line,n.line+1,function(L){var H=L.text;a==n.line&&(H=H.slice(0,n.ch)),a==t.line&&(H=H.slice(t.ch)),i.push(H),++a}),i}function Ei(e,t,n){var i=[];return e.iter(t,n,function(a){i.push(a.text)}),i}function ii(e,t){var n=t-e.height;if(n)for(var i=e;i;i=i.parent)i.height+=n}function Mt(e){if(e.parent==null)return null;for(var t=e.parent,n=re(t.lines,e),i=t.parent;i;t=i,i=i.parent)for(var a=0;!(i.children[a]==t);++a)n+=i.children[a].chunkSize();return n+t.first}function Gi(e,t){var n=e.first;e:do{for(var i=0;i<e.children.length;++i){var a=e.children[i],L=a.height;if(t<L){e=a;continue e}t-=L,n+=a.chunkSize()}return n}while(!e.lines);for(var H=0;H<e.lines.length;++H){var X=e.lines[H],Q=X.height;if(t<Q)break;t-=Q}return n+H}function $i(e,t){return t>=e.first&&t<e.first+e.size}function pn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function We(e,t,n){if(n===void 0&&(n=null),!(this instanceof We))return new We(e,t,n);this.line=e,this.ch=t,this.sticky=n}function At(e,t){return e.line-t.line||e.ch-t.ch}function mn(e,t){return e.sticky==t.sticky&&At(e,t)==0}function gn(e){return We(e.line,e.ch)}function vn(e,t){return At(e,t)<0?t:e}function yn(e,t){return At(e,t)<0?e:t}function z(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function v(e,t){if(t.line<e.first)return We(e.first,0);var n=e.first+e.size-1;return t.line>n?We(n,lt(e,n).text.length):S(t,lt(e,t.line).text.length)}function S(e,t){var n=e.ch;return n==null||n>t?We(e.line,t):n<0?We(e.line,0):e}function N(e,t){for(var n=[],i=0;i<t.length;i++)n[i]=v(e,t[i]);return n}var Z=function(e,t){this.state=e,this.lookAhead=t},G=function(e,t,n,i){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};G.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},G.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}},G.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},G.fromSaved=function(e,t,n){return t instanceof Z?new G(e,qt(e.mode,t.state),n,t.lookAhead):new G(e,qt(e.mode,t),n)},G.prototype.save=function(e){var t=e!==!1?qt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Z(t,this.maxLookAhead):t};function fe(e,t,n,i){var a=[e.state.modeGen],L={};xi(e,t.text,e.doc.mode,n,function(q,le){return a.push(q,le)},L,i);for(var H=n.state,X=function(q){n.baseTokens=a;var le=e.state.overlays[q],ce=1,Ee=0;n.state=!0,xi(e,t.text,le.mode,n,function(_e,Ie){for(var Be=ce;Ee<_e;){var Xe=a[ce];Xe>_e&&a.splice(ce,1,_e,a[ce+1],Xe),ce+=2,Ee=Math.min(_e,Xe)}if(!Ie)return;if(le.opaque)a.splice(Be,ce-Be,_e,"overlay "+Ie),ce=Be+2;else for(;Be<ce;Be+=2){var at=a[Be+1];a[Be+1]=(at?at+" ":"")+"overlay "+Ie}},L),n.state=H,n.baseTokens=null,n.baseTokenPos=1},Q=0;Q<e.state.overlays.length;++Q)X(Q);return{styles:a,classes:L.bgClass||L.textClass?L:null}}function ke(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var i=Ze(e,Mt(t)),a=t.text.length>e.options.maxHighlightLength&&qt(e.doc.mode,i.state),L=fe(e,t,i);a&&(i.state=a),t.stateAfter=i.save(!a),t.styles=L.styles,L.classes?t.styleClasses=L.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Ze(e,t,n){var i=e.doc,a=e.display;if(!i.mode.startState)return new G(i,!0,t);var L=Ti(e,t,n),H=L>i.first&<(i,L-1).stateAfter,X=H?G.fromSaved(i,H,L):new G(i,Kt(i.mode),L);return i.iter(L,t,function(Q){gt(e,Q.text,X);var q=X.line;Q.stateAfter=q==t-1||q%5==0||q>=a.viewFrom&&q<a.viewTo?X.save():null,X.nextLine()}),n&&(i.modeFrontier=X.line),X}function gt(e,t,n,i){var a=e.doc.mode,L=new Tt(t,e.options.tabSize,n);for(L.start=L.pos=i||0,t==""&&Fe(a,n.state);!L.eol();)Et(a,L,n.state),L.start=L.pos}function Fe(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=jt(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function Et(e,t,n,i){for(var a=0;a<10;a++){i&&(i[0]=jt(e,n).mode);var L=e.token(t,n);if(t.pos>t.start)return L}throw new Error("Mode "+e.name+" failed to advance stream.")}var Ht=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Zt(e,t,n,i){var a=e.doc,L=a.mode,H;t=v(a,t);var X=lt(a,t.line),Q=Ze(e,t.line,n),q=new Tt(X.text,e.options.tabSize,Q),le;for(i&&(le=[]);(i||q.pos<t.ch)&&!q.eol();)q.start=q.pos,H=Et(L,q,Q.state),i&&le.push(new Ht(q,H,qt(a.mode,Q.state)));return i?le:new Ht(q,H,Q.state)}function Bi(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var i=n[1]?"bgClass":"textClass";t[i]==null?t[i]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[i])||(t[i]+=" "+n[2])}return e}function xi(e,t,n,i,a,L,H){var X=n.flattenSpans;X==null&&(X=e.options.flattenSpans);var Q=0,q=null,le=new Tt(t,e.options.tabSize,i),ce,Ee=e.options.addModeClass&&[null];for(t==""&&Bi(Fe(n,i.state),L);!le.eol();){if(le.pos>e.options.maxHighlightLength?(X=!1,H&>(e,t,i,le.pos),le.pos=t.length,ce=null):ce=Bi(Et(n,le,i.state,Ee),L),Ee){var _e=Ee[0].name;_e&&(ce="m-"+(ce?_e+" "+ce:_e))}if(!X||q!=ce){for(;Q<le.start;)Q=Math.min(le.start,Q+5e3),a(Q,q);q=ce}le.start=le.pos}for(;Q<le.pos;){var Ie=Math.min(le.pos,Q+5e3);a(Ie,q),Q=Ie}}function Ti(e,t,n){for(var i,a,L=e.doc,H=n?-1:t-(e.doc.mode.innerMode?1e3:100),X=t;X>H;--X){if(X<=L.first)return L.first;var Q=lt(L,X-1),q=Q.stateAfter;if(q&&(!n||X+(q instanceof Z?q.lookAhead:0)<=L.modeFrontier))return X;var le=$(Q.text,null,e.options.tabSize);(a==null||i>le)&&(a=X-1,i=le)}return a}function Qi(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,i=t-1;i>n;i--){var a=lt(e,i).stateAfter;if(a&&(!(a instanceof Z)||i+a.lookAhead<t)){n=i+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Dn=!1,ci=!1;function zi(){Dn=!0}function ln(){ci=!0}function un(e,t,n){this.marker=e,this.from=t,this.to=n}function ji(e,t){if(e)for(var n=0;n<e.length;++n){var i=e[n];if(i.marker==t)return i}}function kn(e,t){for(var n,i=0;i<e.length;++i)e[i]!=t&&(n||(n=[])).push(e[i]);return n}function _n(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Kn(e,t,n){var i;if(e)for(var a=0;a<e.length;++a){var L=e[a],H=L.marker,X=L.from==null||(H.inclusiveLeft?L.from<=t:L.from<t);if(X||L.from==t&&H.type=="bookmark"&&(!n||!L.marker.insertLeft)){var Q=L.to==null||(H.inclusiveRight?L.to>=t:L.to>t);(i||(i=[])).push(new un(H,L.from,Q?null:L.to))}}return i}function Vn(e,t,n){var i;if(e)for(var a=0;a<e.length;++a){var L=e[a],H=L.marker,X=L.to==null||(H.inclusiveRight?L.to>=t:L.to>t);if(X||L.from==t&&H.type=="bookmark"&&(!n||L.marker.insertLeft)){var Q=L.from==null||(H.inclusiveLeft?L.from<=t:L.from<t);(i||(i=[])).push(new un(H,Q?null:L.from-t,L.to==null?null:L.to-t))}}return i}function Ji(e,t){if(t.full)return null;var n=$i(e,t.from.line)&<(e,t.from.line).markedSpans,i=$i(e,t.to.line)&<(e,t.to.line).markedSpans;if(!n&&!i)return null;var a=t.from.ch,L=t.to.ch,H=At(t.from,t.to)==0,X=Kn(n,a,H),Q=Vn(i,L,H),q=t.text.length==1,le=Re(t.text).length+(q?a:0);if(X)for(var ce=0;ce<X.length;++ce){var Ee=X[ce];if(Ee.to==null){var _e=ji(Q,Ee.marker);_e?q&&(Ee.to=_e.to==null?null:_e.to+le):Ee.to=a}}if(Q)for(var Ie=0;Ie<Q.length;++Ie){var Be=Q[Ie];if(Be.to!=null&&(Be.to+=le),Be.from==null){var Xe=ji(X,Be.marker);Xe||(Be.from=le,q&&(X||(X=[])).push(Be))}else Be.from+=le,q&&(X||(X=[])).push(Be)}X&&(X=Xi(X)),Q&&Q!=X&&(Q=Xi(Q));var at=[X];if(!q){var dt=t.text.length-2,st;if(dt>0&&X)for(var pt=0;pt<X.length;++pt)X[pt].to==null&&(st||(st=[])).push(new un(X[pt].marker,null,null));for(var wt=0;wt<dt;++wt)at.push(st);at.push(Q)}return at}function Xi(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function bn(e,t,n){var i=null;if(e.iter(t.line,n.line+1,function(_e){if(_e.markedSpans)for(var Ie=0;Ie<_e.markedSpans.length;++Ie){var Be=_e.markedSpans[Ie].marker;Be.readOnly&&(!i||re(i,Be)==-1)&&(i||(i=[])).push(Be)}}),!i)return null;for(var a=[{from:t,to:n}],L=0;L<i.length;++L)for(var H=i[L],X=H.find(0),Q=0;Q<a.length;++Q){var q=a[Q];if(At(q.to,X.from)<0||At(q.from,X.to)>0)continue;var le=[Q,1],ce=At(q.from,X.from),Ee=At(q.to,X.to);(ce<0||!H.inclusiveLeft&&!ce)&&le.push({from:q.from,to:X.from}),(Ee>0||!H.inclusiveRight&&!Ee)&&le.push({from:X.to,to:q.to}),a.splice.apply(a,le),Q+=le.length-3}return a}function dr(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function En(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function ri(e){return e.inclusiveLeft?-1:0}function Wt(e){return e.inclusiveRight?1:0}function yi(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var i=e.find(),a=t.find(),L=At(i.from,a.from)||ri(e)-ri(t);if(L)return-L;var H=At(i.to,a.to)||Wt(e)-Wt(t);return H||t.id-e.id}function Pt(e,t){var n=ci&&e.markedSpans,i;if(n)for(var a=void 0,L=0;L<n.length;++L)a=n[L],a.marker.collapsed&&(t?a.from:a.to)==null&&(!i||yi(i,a.marker)<0)&&(i=a.marker);return i}function si(e){return Pt(e,!0)}function Vt(e){return Pt(e,!1)}function nn(e,t){var n=ci&&e.markedSpans,i;if(n)for(var a=0;a<n.length;++a){var L=n[a];L.marker.collapsed&&(L.from==null||L.from<t)&&(L.to==null||L.to>t)&&(!i||yi(i,L.marker)<0)&&(i=L.marker)}return i}function fi(e,t,n,i,a){var L=lt(e,t),H=ci&&L.markedSpans;if(H)for(var X=0;X<H.length;++X){var Q=H[X];if(!Q.marker.collapsed)continue;var q=Q.marker.find(0),le=At(q.from,n)||ri(Q.marker)-ri(a),ce=At(q.to,i)||Wt(Q.marker)-Wt(a);if(le>=0&&ce<=0||le<=0&&ce>=0)continue;if(le<=0&&(Q.marker.inclusiveRight&&a.inclusiveLeft?At(q.to,n)>=0:At(q.to,n)>0)||le>=0&&(Q.marker.inclusiveRight&&a.inclusiveLeft?At(q.from,i)<=0:At(q.from,i)<0))return!0}}function Oi(e){for(var t;t=si(e);)e=t.find(-1,!0).line;return e}function Xn(e){for(var t;t=Vt(e);)e=t.find(1,!0).line;return e}function xn(e){for(var t,n;t=Vt(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function cr(e,t){var n=lt(e,t),i=Oi(n);return n==i?t:Mt(i)}function Tn(e,t){if(t>e.lastLine())return t;var n=lt(e,t),i;if(!rn(e,n))return t;for(;i=Vt(n);)n=i.find(1,!0).line;return Mt(n)+1}function rn(e,t){var n=ci&&t.markedSpans;if(n)for(var i=void 0,a=0;a<n.length;++a){if(i=n[a],!i.marker.collapsed)continue;if(i.from==null)return!0;if(i.marker.widgetNode)continue;if(i.from==0&&i.marker.inclusiveLeft&&fr(e,t,i))return!0}}function fr(e,t,n){if(n.to==null){var i=n.marker.find(1,!0);return fr(e,i.line,ji(i.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var a=void 0,L=0;L<t.markedSpans.length;++L)if(a=t.markedSpans[L],a.marker.collapsed&&!a.marker.widgetNode&&a.from==n.to&&(a.to==null||a.to!=n.from)&&(a.marker.inclusiveLeft||n.marker.inclusiveRight)&&fr(e,t,a))return!0}function Zi(e){e=Oi(e);for(var t=0,n=e.parent,i=0;i<n.lines.length;++i){var a=n.lines[i];if(a==e)break;t+=a.height}for(var L=n.parent;L;n=L,L=n.parent)for(var H=0;H<L.children.length;++H){var X=L.children[H];if(X==n)break;t+=X.height}return t}function pr(e){if(e.height==0)return 0;for(var t=e.text.length,n,i=e;n=si(i);){var a=n.find(0,!0);i=a.from.line,t+=a.from.ch-a.to.ch}for(i=e;n=Vt(i);){var L=n.find(0,!0);t-=i.text.length-L.from.ch,i=L.to.line,t+=i.text.length-L.to.ch}return t}function jr(e){var t=e.display,n=e.doc;t.maxLine=lt(n,n.first),t.maxLineLength=pr(t.maxLine),t.maxLineChanged=!0,n.iter(function(i){var a=pr(i);a>t.maxLineLength&&(t.maxLineLength=a,t.maxLine=i)})}var Mn=function(e,t,n){this.text=e,En(this,t),this.height=n?n(this):1};Mn.prototype.lineNo=function(){return Mt(this)},pe(Mn);function ua(e,t,n,i){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),dr(e),En(e,n);var a=i?i(e):1;a!=e.height&&ii(e,a)}function yt(e){e.parent=null,dr(e)}var Ot={},xt={};function kt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?xt:Ot;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Bt(e,t){var n=_("span",null,null,k?"padding-right: .1px":null),i={pre:_("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var a=0;a<=(t.rest?t.rest.length:0);a++){var L=a?t.rest[a-1]:t.line,H=void 0;i.pos=0,i.addToken=Ut,mt(e.display.measure)&&(H=nt(L,e.doc.direction))&&(i.addToken=Di(i.addToken,H)),i.map=[];var X=t!=e.display.externalMeasured&&Mt(L);hn(L,i,ke(e,L,X)),L.styleClasses&&(L.styleClasses.bgClass&&(i.bgClass=K(L.styleClasses.bgClass,i.bgClass||"")),L.styleClasses.textClass&&(i.textClass=K(L.styleClasses.textClass,i.textClass||""))),i.map.length==0&&i.map.push(0,0,i.content.appendChild(ht(e.display.measure))),a==0?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(k){var Q=i.content.lastChild;(/\bcm-tab\b/.test(Q.className)||Q.querySelector&&Q.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return Se(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=K(i.pre.className,i.textClass||"")),i}function Qt(e){var t=h("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Ut(e,t,n,i,a,L,H){if(!t)return;var X=e.splitSpaces?ui(t,e.trailingSpace):t,Q=e.cm.state.specialChars,q=!1,le;if(!Q.test(t))e.col+=t.length,le=document.createTextNode(X),e.map.push(e.pos,e.pos+t.length,le),W&&j<9&&(q=!0),e.pos+=t.length;else{le=document.createDocumentFragment();for(var ce=0;;){Q.lastIndex=ce;var Ee=Q.exec(t),_e=Ee?Ee.index-ce:t.length-ce;if(_e){var Ie=document.createTextNode(X.slice(ce,ce+_e));W&&j<9?le.appendChild(h("span",[Ie])):le.appendChild(Ie),e.map.push(e.pos,e.pos+_e,Ie),e.col+=_e,e.pos+=_e}if(!Ee)break;ce+=_e+1;var Be=void 0;if(Ee[0]==" "){var Xe=e.cm.options.tabSize,at=Xe-e.col%Xe;Be=le.appendChild(h("span",se(at),"cm-tab")),Be.setAttribute("role","presentation"),Be.setAttribute("cm-text"," "),e.col+=at}else Ee[0]=="\r"||Ee[0]==`
|
|
`?(Be=le.appendChild(h("span",Ee[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Be.setAttribute("cm-text",Ee[0]),e.col+=1):(Be=e.cm.options.specialCharPlaceholder(Ee[0]),Be.setAttribute("cm-text",Ee[0]),W&&j<9?le.appendChild(h("span",[Be])):le.appendChild(Be),e.col+=1);e.map.push(e.pos,e.pos+1,Be),e.pos++}}if(e.trailingSpace=X.charCodeAt(t.length-1)==32,n||i||a||q||L||H){var dt=n||"";i&&(dt+=i),a&&(dt+=a);var st=h("span",[le],dt,L);if(H)for(var pt in H)H.hasOwnProperty(pt)&&pt!="style"&&pt!="class"&&st.setAttribute(pt,H[pt]);return e.content.appendChild(st)}e.content.appendChild(le)}function ui(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,i="",a=0;a<e.length;a++){var L=e.charAt(a);L==" "&&n&&(a==e.length-1||e.charCodeAt(a+1)==32)&&(L="\xA0"),i+=L,n=L==" "}return i}function Di(e,t){return function(n,i,a,L,H,X,Q){a=a?a+" cm-force-border":"cm-force-border";for(var q=n.pos,le=q+i.length;;){for(var ce=void 0,Ee=0;Ee<t.length&&!(ce=t[Ee],ce.to>q&&ce.from<=q);Ee++);if(ce.to>=le)return e(n,i,a,L,H,X,Q);e(n,i.slice(0,ce.to-q),a,L,null,X,Q),L=null,i=i.slice(ce.to-q),q=ce.to}}}function Nt(e,t,n,i){var a=!i&&n.widgetNode;a&&e.map.push(e.pos,e.pos+t,a),!i&&e.cm.display.input.needsContentAttribute&&(a||(a=e.content.appendChild(document.createElement("span"))),a.setAttribute("cm-marker",n.id)),a&&(e.cm.display.input.setUneditable(a),e.content.appendChild(a)),e.pos+=t,e.trailingSpace=!1}function hn(e,t,n){var i=e.markedSpans,a=e.text,L=0;if(!i){for(var H=1;H<n.length;H+=2)t.addToken(t,a.slice(L,L=n[H]),kt(n[H+1],t.cm.options));return}for(var X=a.length,Q=0,q=1,le="",ce,Ee,_e=0,Ie,Be,Xe,at,dt;;){if(_e==Q){Ie=Be=Xe=Ee="",dt=null,at=null,_e=Infinity;for(var st=[],pt=void 0,wt=0;wt<i.length;++wt){var bt=i[wt],Dt=bt.marker;if(Dt.type=="bookmark"&&bt.from==Q&&Dt.widgetNode)st.push(Dt);else if(bt.from<=Q&&(bt.to==null||bt.to>Q||Dt.collapsed&&bt.to==Q&&bt.from==Q)){if(bt.to!=null&&bt.to!=Q&&_e>bt.to&&(_e=bt.to,Be=""),Dt.className&&(Ie+=" "+Dt.className),Dt.css&&(Ee=(Ee?Ee+";":"")+Dt.css),Dt.startStyle&&bt.from==Q&&(Xe+=" "+Dt.startStyle),Dt.endStyle&&bt.to==_e&&(pt||(pt=[])).push(Dt.endStyle,bt.to),Dt.title&&((dt||(dt={})).title=Dt.title),Dt.attributes)for(var Jt in Dt.attributes)(dt||(dt={}))[Jt]=Dt.attributes[Jt];Dt.collapsed&&(!at||yi(at.marker,Dt)<0)&&(at=bt)}else bt.from>Q&&_e>bt.from&&(_e=bt.from)}if(pt)for(var gi=0;gi<pt.length;gi+=2)pt[gi+1]==_e&&(Be+=" "+pt[gi]);if(!at||at.from==Q)for(var ti=0;ti<st.length;++ti)Nt(t,0,st[ti]);if(at&&(at.from||0)==Q){if(Nt(t,(at.to==null?X+1:at.to)-Q,at.marker,at.from==null),at.to==null)return;at.to==Q&&(at=!1)}}if(Q>=X)break;for(var Wi=Math.min(X,_e);;){if(le){var Ni=Q+le.length;if(!at){var oi=Ni>Wi?le.slice(0,Wi-Q):le;t.addToken(t,oi,ce?ce+Ie:Ie,Xe,Q+oi.length==_e?Be:"",Ee,dt)}if(Ni>=Wi){le=le.slice(Wi-Q),Q=Wi;break}Q=Ni,Xe=""}le=a.slice(L,L=n[q++]),ce=kt(n[q++],t.cm.options)}}}function Gt(e,t,n){this.line=t,this.rest=xn(t),this.size=this.rest?Mt(Re(this.rest))-n+1:1,this.node=this.text=null,this.hidden=rn(e,t)}function ki(e,t,n){for(var i=[],a,L=t;L<n;L=a){var H=new Gt(e.doc,lt(e.doc,L),L);a=L+H.size,i.push(H)}return i}var wi=null;function Yi(e){wi?wi.ops.push(e):e.ownsGroup=wi={ops:[e],delayedCallbacks:[]}}function Lo(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var i=0;i<e.ops.length;i++){var a=e.ops[i];if(a.cursorActivityHandlers)for(;a.cursorActivityCalled<a.cursorActivityHandlers.length;)a.cursorActivityHandlers[a.cursorActivityCalled++].call(null,a.cm)}}while(n<t.length)}function Io(e,t){var n=e.ownsGroup;if(!n)return;try{Lo(n)}finally{wi=null,t(n)}}var mr=null;function _i(e,t){var n=ct(e,t);if(!n.length)return;var i=Array.prototype.slice.call(arguments,2),a;wi?a=wi.delayedCallbacks:mr?a=mr:(a=mr=[],setTimeout(Do,0));for(var L=function(X){a.push(function(){return n[X].apply(null,i)})},H=0;H<n.length;++H)L(H)}function Do(){var e=mr;mr=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,n,i){for(var a=0;a<t.changes.length;a++){var L=t.changes[a];L=="text"?Mo(e,t):L=="gutter"?Qa(e,t,n,i):L=="class"?ha(e,t):L=="widget"&&Po(e,t,i)}t.changes=null}function gr(e){return e.node==e.text&&(e.node=h("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),W&&j<8&&(e.node.style.zIndex=2)),e.node}function ko(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var i=gr(t);t.background=i.insertBefore(h("div",null,n),i.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Bt(e,t)}function Mo(e,t){var n=t.text.className,i=$a(e,t);t.text==t.node&&(t.node=i.pre),t.text.parentNode.replaceChild(i.pre,t.text),t.text=i.pre,i.bgClass!=t.bgClass||i.textClass!=t.textClass?(t.bgClass=i.bgClass,t.textClass=i.textClass,ha(e,t)):n&&(t.text.className=n)}function ha(e,t){ko(e,t),t.line.wrapClass?gr(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Qa(e,t,n,i){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 a=gr(t);t.gutterBackground=h("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),a.insertBefore(t.gutterBackground,t.text)}var L=t.line.gutterMarkers;if(e.options.lineNumbers||L){var H=gr(t),X=t.gutter=h("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(e.display.input.setUneditable(X),H.insertBefore(X,t.text),t.line.gutterClass&&(X.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!L||!L["CodeMirror-linenumbers"])&&(t.lineNumber=X.appendChild(h("div",pn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),L)for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var q=e.display.gutterSpecs[Q].className,le=L.hasOwnProperty(q)&&L[q];le&&X.appendChild(h("div",[le],"CodeMirror-gutter-elt","left: "+i.gutterLeft[q]+"px; width: "+i.gutterWidth[q]+"px"))}}}function Po(e,t,n){t.alignable&&(t.alignable=null);for(var i=A("CodeMirror-linewidget"),a=t.node.firstChild,L=void 0;a;a=L)L=a.nextSibling,i.test(a.className)&&t.node.removeChild(a);Ja(e,t,n)}function No(e,t,n,i){var a=$a(e,t);return t.text=t.node=a.pre,a.bgClass&&(t.bgClass=a.bgClass),a.textClass&&(t.textClass=a.textClass),ha(e,t),Qa(e,t,n,i),Ja(e,t,i),t.node}function Ja(e,t,n){if(Za(e,t.line,t,n,!0),t.rest)for(var i=0;i<t.rest.length;i++)Za(e,t.rest[i],t,n,!1)}function Za(e,t,n,i,a){if(!t.widgets)return;for(var L=gr(n),H=0,X=t.widgets;H<X.length;++H){var Q=X[H],q=h("div",[Q.node],"CodeMirror-linewidget"+(Q.className?" "+Q.className:""));Q.handleMouseEvents||q.setAttribute("cm-ignore-events","true"),Fo(Q,q,n,i),e.display.input.setUneditable(q),a&&Q.above?L.insertBefore(q,n.gutter||n.text):L.appendChild(q),_i(Q,"redraw")}}function Fo(e,t,n,i){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var a=i.wrapperWidth;t.style.left=i.fixedPos+"px",e.coverGutter||(a-=i.gutterTotalWidth,t.style.paddingLeft=i.gutterTotalWidth+"px"),t.style.width=a+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-i.gutterTotalWidth+"px"))}function vr(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!b(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),y(t.display.measure,h("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function dn(e,t){for(var n=ge(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Hr(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=y(e.measure,h("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,i={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(i.left)&&!isNaN(i.right)&&(e.cachedPaddingH=i),i}function an(e){return ue-e.display.nativeBarWidth}function Pn(e){return e.display.scroller.clientWidth-an(e)-e.display.barWidth}function ca(e){return e.display.scroller.clientHeight-an(e)-e.display.barHeight}function Uo(e,t,n){var i=e.options.lineWrapping,a=i&&Pn(e);if(!t.measure.heights||i&&t.measure.width!=a){var L=t.measure.heights=[];if(i){t.measure.width=a;for(var H=t.text.firstChild.getClientRects(),X=0;X<H.length-1;X++){var Q=H[X],q=H[X+1];Math.abs(Q.bottom-q.bottom)>2&&L.push((Q.bottom+q.top)/2-n.top)}}L.push(n.bottom-n.top)}}function es(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var i=0;i<e.rest.length;i++)if(e.rest[i]==t)return{map:e.measure.maps[i],cache:e.measure.caches[i]};for(var a=0;a<e.rest.length;a++)if(Mt(e.rest[a])>n)return{map:e.measure.maps[a],cache:e.measure.caches[a],before:!0}}function Bo(e,t){t=Oi(t);var n=Mt(t),i=e.display.externalMeasured=new Gt(e.doc,t,n);i.lineN=n;var a=i.built=Bt(e,i);return i.text=a.pre,y(e.display.lineMeasure,a.pre),i}function ts(e,t,n,i){return sn(e,Yn(e,t),n,i)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Un(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Yn(e,t){var n=Mt(t),i=fa(e,n);i&&!i.text?i=null:i&&i.changes&&(Ya(e,i,n,_a(e)),e.curOp.forceUpdate=!0),i||(i=Bo(e,t));var a=es(i,t,n);return{line:t,view:i,rect:null,map:a.map,cache:a.cache,before:a.before,hasHeights:!1}}function sn(e,t,n,i,a){t.before&&(n=-1);var L=n+(i||""),H;return t.cache.hasOwnProperty(L)?H=t.cache[L]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Uo(e,t.view,t.rect),t.hasHeights=!0),H=Ho(e,t,n,i),H.bogus||(t.cache[L]=H)),{left:H.left,right:H.right,top:a?H.rtop:H.top,bottom:a?H.rbottom:H.bottom}}var is={left:0,right:0,top:0,bottom:0};function ns(e,t,n){for(var i,a,L,H,X,Q,q=0;q<e.length;q+=3)if(X=e[q],Q=e[q+1],t<X?(a=0,L=1,H="left"):t<Q?(a=t-X,L=a+1):(q==e.length-3||t==Q&&e[q+3]>t)&&(L=Q-X,a=L-1,t>=Q&&(H="right")),a!=null){if(i=e[q+2],X==Q&&n==(i.insertLeft?"left":"right")&&(H=n),n=="left"&&a==0)for(;q&&e[q-2]==e[q-3]&&e[q-1].insertLeft;)i=e[(q-=3)+2],H="left";if(n=="right"&&a==Q-X)for(;q<e.length-3&&e[q+3]==e[q+4]&&!e[q+5].insertLeft;)i=e[(q+=3)+2],H="right";break}return{node:i,start:a,end:L,collapse:H,coverStart:X,coverEnd:Q}}function jo(e,t){var n=is;if(t=="left")for(var i=0;i<e.length&&!((n=e[i]).left!=n.right);i++);else for(var a=e.length-1;a>=0&&!((n=e[a]).left!=n.right);a--);return n}function Ho(e,t,n,i){var a=ns(t.map,n,i),L=a.node,H=a.start,X=a.end,Q=a.collapse,q;if(L.nodeType==3){for(var le=0;le<4;le++){for(;H&&Me(t.line.text.charAt(a.coverStart+H));)--H;for(;a.coverStart+X<a.coverEnd&&Me(t.line.text.charAt(a.coverStart+X));)++X;if(W&&j<9&&H==0&&X==a.coverEnd-a.coverStart?q=L.parentNode.getBoundingClientRect():q=jo(g(L,H,X).getClientRects(),i),q.left||q.right||H==0)break;X=H,H=H-1,Q="right"}W&&j<11&&(q=Wo(e.display.measure,q))}else{H>0&&(Q=i="right");var ce;e.options.lineWrapping&&(ce=L.getClientRects()).length>1?q=ce[i=="right"?ce.length-1:0]:q=L.getBoundingClientRect()}if(W&&j<9&&!H&&(!q||!q.left&&!q.right)){var Ee=L.parentNode.getClientRects()[0];Ee?q={left:Ee.left,right:Ee.left+Qn(e.display),top:Ee.top,bottom:Ee.bottom}:q=is}for(var _e=q.top-t.rect.top,Ie=q.bottom-t.rect.top,Be=(_e+Ie)/2,Xe=t.view.measure.heights,at=0;at<Xe.length-1&&!(Be<Xe[at]);at++);var dt=at?Xe[at-1]:0,st=Xe[at],pt={left:(Q=="right"?q.right:q.left)-t.rect.left,right:(Q=="left"?q.left:q.right)-t.rect.left,top:dt,bottom:st};return!q.left&&!q.right&&(pt.bogus=!0),e.options.singleCursorHeightPerLine||(pt.rtop=_e,pt.rbottom=Ie),pt}function Wo(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Yt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*i,bottom:t.bottom*i}}function rs(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 as(e){e.display.externalMeasure=null,E(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)rs(e.display.view[t])}function yr(e){as(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ss(){return m&&o?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function os(){return m&&o?-(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 n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=vr(e.widgets[n]));return t}function Wr(e,t,n,i,a){if(!a){var L=pa(t);n.top+=L,n.bottom+=L}if(i=="line")return n;i||(i="local");var H=Zi(t);if(i=="local"?H+=Hr(e.display):H-=e.display.viewOffset,i=="page"||i=="window"){var X=e.display.lineSpace.getBoundingClientRect();H+=X.top+(i=="window"?0:os());var Q=X.left+(i=="window"?0:ss());n.left+=Q,n.right+=Q}return n.top+=H,n.bottom+=H,n}function ls(e,t,n){if(n=="div")return t;var i=t.left,a=t.top;if(n=="page")i-=ss(),a-=os();else if(n=="local"||!n){var L=e.display.sizer.getBoundingClientRect();i+=L.left,a+=L.top}var H=e.display.lineSpace.getBoundingClientRect();return{left:i-H.left,top:a-H.top}}function ma(e,t,n,i,a){return i||(i=lt(e.doc,t.line)),Wr(e,i,ts(e,i,t.ch,a),n)}function qi(e,t,n,i,a,L){i=i||lt(e.doc,t.line),a||(a=Yn(e,i));function H(Ie,Be){var Xe=sn(e,a,Ie,Be?"right":"left",L);return Be?Xe.left=Xe.right:Xe.right=Xe.left,Wr(e,i,Xe,n)}var X=nt(i,e.doc.direction),Q=t.ch,q=t.sticky;if(Q>=i.text.length?(Q=i.text.length,q="before"):Q<=0&&(Q=0,q="after"),!X)return H(q=="before"?Q-1:Q,q=="before");function le(Ie,Be,Xe){var at=X[Be],dt=at.level==1;return H(Xe?Ie-1:Ie,dt!=Xe)}var ce=$e(X,Q,q),Ee=qe,_e=le(Q,ce,q=="before");return Ee!=null&&(_e.other=le(Q,Ee,q!="before")),_e}function us(e,t){var n=0;t=v(e.doc,t),e.options.lineWrapping||(n=Qn(e.display)*t.ch);var i=lt(e.doc,t.line),a=Zi(i)+Hr(e.display);return{left:n,right:n,top:a,bottom:a+i.height}}function ga(e,t,n,i,a){var L=We(e,t,n);return L.xRel=a,i&&(L.outside=i),L}function va(e,t,n){var i=e.doc;if(n+=e.display.viewOffset,n<0)return ga(i.first,0,null,-1,-1);var a=Gi(i,n),L=i.first+i.size-1;if(a>L)return ga(i.first+i.size-1,lt(i,L).text.length,null,1,1);t<0&&(t=0);for(var H=lt(i,a);;){var X=Go(e,H,a,t,n),Q=nn(H,X.ch+(X.xRel>0||X.outside>0?1:0));if(!Q)return X;var q=Q.find(1);if(q.line==a)return q;H=lt(i,a=q.line)}}function hs(e,t,n,i){i-=pa(t);var a=t.text.length,L=ut(function(H){return sn(e,n,H-1).bottom<=i},a,0);return a=ut(function(H){return sn(e,n,H).top>i},L,a),{begin:L,end:a}}function ds(e,t,n,i){n||(n=Yn(e,t));var a=Wr(e,t,sn(e,n,i),"line").top;return hs(e,t,n,a)}function ya(e,t,n,i){return e.bottom<=n?!1:e.top>n?!0:(i?e.left:e.right)>t}function Go(e,t,n,i,a){a-=Zi(t);var L=Yn(e,t),H=pa(t),X=0,Q=t.text.length,q=!0,le=nt(t,e.doc.direction);if(le){var ce=(e.options.lineWrapping?Ko:zo)(e,t,n,L,le,i,a);q=ce.level!=1,X=q?ce.from:ce.to-1,Q=q?ce.to:ce.from-1}var Ee=null,_e=null,Ie=ut(function(wt){var bt=sn(e,L,wt);return bt.top+=H,bt.bottom+=H,ya(bt,i,a,!1)?(bt.top<=a&&bt.left<=i&&(Ee=wt,_e=bt),!0):!1},X,Q),Be,Xe,at=!1;if(_e){var dt=i-_e.left<_e.right-i,st=dt==q;Ie=Ee+(st?0:1),Xe=st?"after":"before",Be=dt?_e.left:_e.right}else{!q&&(Ie==Q||Ie==X)&&Ie++,Xe=Ie==0?"after":Ie==t.text.length?"before":sn(e,L,Ie-(q?1:0)).bottom+H<=a==q?"after":"before";var pt=qi(e,We(n,Ie,Xe),"line",t,L);Be=pt.left,at=a<pt.top?-1:a>=pt.bottom?1:0}return Ie=Pe(t.text,Ie,1),ga(n,Ie,Xe,at,i-Be)}function zo(e,t,n,i,a,L,H){var X=ut(function(ce){var Ee=a[ce],_e=Ee.level!=1;return ya(qi(e,We(n,_e?Ee.to:Ee.from,_e?"before":"after"),"line",t,i),L,H,!0)},0,a.length-1),Q=a[X];if(X>0){var q=Q.level!=1,le=qi(e,We(n,q?Q.from:Q.to,q?"after":"before"),"line",t,i);ya(le,L,H,!0)&&le.top>H&&(Q=a[X-1])}return Q}function Ko(e,t,n,i,a,L,H){var X=hs(e,t,i,H),Q=X.begin,q=X.end;/\s/.test(t.text.charAt(q-1))&&q--;for(var le=null,ce=null,Ee=0;Ee<a.length;Ee++){var _e=a[Ee];if(_e.from>=q||_e.to<=Q)continue;var Ie=_e.level!=1,Be=sn(e,i,Ie?Math.min(q,_e.to)-1:Math.max(Q,_e.from)).right,Xe=Be<L?L-Be+1e9:Be-L;(!le||ce>Xe)&&(le=_e,ce=Xe)}return le||(le=a[a.length-1]),le.from<Q&&(le={from:Q,to:le.to,level:le.level}),le.to>q&&(le={from:le.from,to:q,level:le.level}),le}var Nn;function $n(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Nn==null){Nn=h("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Nn.appendChild(document.createTextNode("x")),Nn.appendChild(h("br"));Nn.appendChild(document.createTextNode("x"))}y(e.measure,Nn);var n=Nn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),E(e.measure),n||1}function Qn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=h("span","xxxxxxxxxx"),n=h("pre",[t],"CodeMirror-line-like");y(e.measure,n);var i=t.getBoundingClientRect(),a=(i.right-i.left)/10;return a>2&&(e.cachedCharWidth=a),a||10}function _a(e){for(var t=e.display,n={},i={},a=t.gutters.clientLeft,L=t.gutters.firstChild,H=0;L;L=L.nextSibling,++H){var X=e.display.gutterSpecs[H].className;n[X]=L.offsetLeft+L.clientLeft+a,i[X]=L.clientWidth}return{fixedPos:ba(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function ba(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function cs(e){var t=$n(e.display),n=e.options.lineWrapping,i=n&&Math.max(5,e.display.scroller.clientWidth/Qn(e.display)-3);return function(a){if(rn(e.doc,a))return 0;var L=0;if(a.widgets)for(var H=0;H<a.widgets.length;H++)a.widgets[H].height&&(L+=a.widgets[H].height);return n?L+(Math.ceil(a.text.length/i)||1)*t:L+t}}function Ea(e){var t=e.doc,n=cs(e);t.iter(function(i){var a=n(i);a!=i.height&&ii(i,a)})}function Fn(e,t,n,i){var a=e.display;if(!n&&ge(t).getAttribute("cm-not-content")=="true")return null;var L,H,X=a.lineSpace.getBoundingClientRect();try{L=t.clientX-X.left,H=t.clientY-X.top}catch(ce){return null}var Q=va(e,L,H),q;if(i&&Q.xRel>0&&(q=lt(e.doc,Q.line).text).length==Q.ch){var le=$(q,q.length,e.options.tabSize)-q.length;Q=We(Q.line,Math.max(0,Math.round((L-qa(e.display).left)/Qn(e.display))-le))}return Q}function Un(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,i=0;i<n.length;i++)if(t-=n[i].size,t<0)return i}function Mi(e,t,n,i){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),i||(i=0);var a=e.display;if(i&&n<a.viewTo&&(a.updateLineNumbers==null||a.updateLineNumbers>t)&&(a.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=a.viewTo)ci&&cr(e.doc,t)<a.viewTo&&Sn(e);else if(n<=a.viewFrom)ci&&Tn(e.doc,n+i)>a.viewFrom?Sn(e):(a.viewFrom+=i,a.viewTo+=i);else if(t<=a.viewFrom&&n>=a.viewTo)Sn(e);else if(t<=a.viewFrom){var L=Gr(e,n,n+i,1);L?(a.view=a.view.slice(L.index),a.viewFrom=L.lineN,a.viewTo+=i):Sn(e)}else if(n>=a.viewTo){var H=Gr(e,t,t,-1);H?(a.view=a.view.slice(0,H.index),a.viewTo=H.lineN):Sn(e)}else{var X=Gr(e,t,t,-1),Q=Gr(e,n,n+i,1);X&&Q?(a.view=a.view.slice(0,X.index).concat(ki(e,X.lineN,Q.lineN)).concat(a.view.slice(Q.index)),a.viewTo+=i):Sn(e)}var q=a.externalMeasured;q&&(n<q.lineN?q.lineN+=i:t<q.lineN+q.size&&(a.externalMeasured=null))}function wn(e,t,n){e.curOp.viewChanged=!0;var i=e.display,a=e.display.externalMeasured;if(a&&t>=a.lineN&&t<a.lineN+a.size&&(i.externalMeasured=null),t<i.viewFrom||t>=i.viewTo)return;var L=i.view[Un(e,t)];if(L.node==null)return;var H=L.changes||(L.changes=[]);re(H,n)==-1&&H.push(n)}function Sn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Gr(e,t,n,i){var a=Un(e,t),L,H=e.display.view;if(!ci||n==e.doc.first+e.doc.size)return{index:a,lineN:n};for(var X=e.display.viewFrom,Q=0;Q<a;Q++)X+=H[Q].size;if(X!=t){if(i>0){if(a==H.length-1)return null;L=X+H[a].size-t,a++}else L=X-t;t+=L,n+=L}for(;cr(e.doc,n)!=n;){if(a==(i<0?0:H.length-1))return null;n+=i*H[a-(i<0?1:0)].size,a+=i}return{index:a,lineN:n}}function Vo(e,t,n){var i=e.display,a=i.view;a.length==0||t>=i.viewTo||n<=i.viewFrom?(i.view=ki(e,t,n),i.viewFrom=t):(i.viewFrom>t?i.view=ki(e,t,i.viewFrom).concat(i.view):i.viewFrom<t&&(i.view=i.view.slice(Un(e,t))),i.viewFrom=t,i.viewTo<n?i.view=i.view.concat(ki(e,i.viewTo,n)):i.viewTo>n&&(i.view=i.view.slice(0,Un(e,n)))),i.viewTo=n}function fs(e){for(var t=e.display.view,n=0,i=0;i<t.length;i++){var a=t[i];!a.hidden&&(!a.node||a.changes)&&++n}return n}function _r(e){e.display.input.showSelection(e.display.input.prepareSelection())}function ps(e,t){t===void 0&&(t=!0);for(var n=e.doc,i={},a=i.cursors=document.createDocumentFragment(),L=i.selection=document.createDocumentFragment(),H=0;H<n.sel.ranges.length;H++){if(!t&&H==n.sel.primIndex)continue;var X=n.sel.ranges[H];if(X.from().line>=e.display.viewTo||X.to().line<e.display.viewFrom)continue;var Q=X.empty();(Q||e.options.showCursorWhenSelecting)&&ms(e,X.head,a),Q||Xo(e,X,L)}return i}function ms(e,t,n){var i=qi(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),a=n.appendChild(h("div","\xA0","CodeMirror-cursor"));if(a.style.left=i.left+"px",a.style.top=i.top+"px",a.style.height=Math.max(0,i.bottom-i.top)*e.options.cursorHeight+"px",i.other){var L=n.appendChild(h("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));L.style.display="",L.style.left=i.other.left+"px",L.style.top=i.other.top+"px",L.style.height=(i.other.bottom-i.other.top)*.85+"px"}}function zr(e,t){return e.top-t.top||e.left-t.left}function Xo(e,t,n){var i=e.display,a=e.doc,L=document.createDocumentFragment(),H=qa(e.display),X=H.left,Q=Math.max(i.sizerWidth,Pn(e)-i.sizer.offsetLeft)-H.right,q=a.direction=="ltr";function le(st,pt,wt,bt){pt<0&&(pt=0),pt=Math.round(pt),bt=Math.round(bt),L.appendChild(h("div",null,"CodeMirror-selected","position: absolute; left: "+st+`px;
|
|
top: `+pt+"px; width: "+(wt==null?Q-st:wt)+`px;
|
|
height: `+(bt-pt)+"px"))}function ce(st,pt,wt){var bt=lt(a,st),Dt=bt.text.length,Jt,gi;function ti(oi,Fi){return ma(e,We(st,oi),"div",bt,Fi)}function Wi(oi,Fi,bi){var hi=ds(e,bt,null,oi),li=Fi=="ltr"==(bi=="after")?"left":"right",ni=bi=="after"?hi.begin:hi.end-(/\s/.test(bt.text.charAt(hi.end-1))?2:1);return ti(ni,li)[li]}var Ni=nt(bt,a.direction);return tt(Ni,pt||0,wt==null?Dt:wt,function(oi,Fi,bi,hi){var li=bi=="ltr",ni=ti(oi,li?"left":"right"),Ui=ti(Fi-1,li?"right":"left"),ur=pt==null&&oi==0,In=wt==null&&Fi==Dt,Ci=hi==0,on=!Ni||hi==Ni.length-1;if(Ui.top-ni.top<=3){var vi=(q?ur:In)&&Ci,Va=(q?In:ur)&&on,fn=vi?X:(li?ni:Ui).left,Gn=Va?Q:(li?Ui:ni).right;le(fn,ni.top,Gn-fn,ni.bottom)}else{var zn,Li,hr,Xa;li?(zn=q&&ur&&Ci?X:ni.left,Li=q?Q:Wi(oi,bi,"before"),hr=q?X:Wi(Fi,bi,"after"),Xa=q&&In&&on?Q:Ui.right):(zn=q?Wi(oi,bi,"before"):X,Li=!q&&ur&&Ci?Q:ni.right,hr=!q&&In&&on?X:Ui.left,Xa=q?Wi(Fi,bi,"after"):Q),le(zn,ni.top,Li-zn,ni.bottom),ni.bottom<Ui.top&&le(X,ni.bottom,null,Ui.top),le(hr,Ui.top,Xa-hr,Ui.bottom)}(!Jt||zr(ni,Jt)<0)&&(Jt=ni),zr(Ui,Jt)<0&&(Jt=Ui),(!gi||zr(ni,gi)<0)&&(gi=ni),zr(Ui,gi)<0&&(gi=Ui)}),{start:Jt,end:gi}}var Ee=t.from(),_e=t.to();if(Ee.line==_e.line)ce(Ee.line,Ee.ch,_e.ch);else{var Ie=lt(a,Ee.line),Be=lt(a,_e.line),Xe=Oi(Ie)==Oi(Be),at=ce(Ee.line,Ee.ch,Xe?Ie.text.length+1:null).end,dt=ce(_e.line,Xe?0:null,_e.ch).start;Xe&&(at.top<dt.top-2?(le(at.right,at.top,null,at.bottom),le(X,dt.top,dt.left,dt.bottom)):le(at.right,at.top,dt.left-at.right,at.bottom)),at.bottom<dt.top&&le(X,at.bottom,null,dt.top)}n.appendChild(L)}function xa(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Jn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function gs(e){e.state.focused||(e.display.input.focus(),Ta(e))}function vs(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Jn(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,P(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),k&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),xa(e)}function Jn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Se(e,"blur",e,t),e.state.focused=!1,T(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Kr(e){for(var t=e.display,n=t.lineDiv.offsetTop,i=0;i<t.view.length;i++){var a=t.view[i],L=e.options.lineWrapping,H=void 0,X=0;if(a.hidden)continue;if(W&&j<8){var Q=a.node.offsetTop+a.node.offsetHeight;H=Q-n,n=Q}else{var q=a.node.getBoundingClientRect();H=q.bottom-q.top,!L&&a.text.firstChild&&(X=a.text.firstChild.getBoundingClientRect().right-q.left-1)}var le=a.line.height-H;if((le>.005||le<-.005)&&(ii(a.line,H),ys(a.line),a.rest))for(var ce=0;ce<a.rest.length;ce++)ys(a.rest[ce]);if(X>e.display.sizerWidth){var Ee=Math.ceil(X/Qn(e.display));Ee>e.display.maxLineLength&&(e.display.maxLineLength=Ee,e.display.maxLine=a.line,e.display.maxLineChanged=!0)}}}function ys(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],i=n.node.parentNode;i&&(n.height=i.offsetHeight)}}function Vr(e,t,n){var i=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;i=Math.floor(i-Hr(e));var a=n&&n.bottom!=null?n.bottom:i+e.wrapper.clientHeight,L=Gi(t,i),H=Gi(t,a);if(n&&n.ensure){var X=n.ensure.from.line,Q=n.ensure.to.line;X<L?(L=X,H=Gi(t,Zi(lt(t,X))+e.wrapper.clientHeight)):Math.min(Q,t.lastLine())>=H&&(L=Gi(t,Zi(lt(t,Q))-e.wrapper.clientHeight),H=Q)}return{from:L,to:Math.max(H,L+1)}}function Yo(e,t){if(Ne(e,"scrollCursorIntoView"))return;var n=e.display,i=n.sizer.getBoundingClientRect(),a=null;if(t.top+i.top<0?a=!0:t.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)&&(a=!1),a!=null&&!r){var L=h("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Hr(e.display))+`px;
|
|
height: `+(t.bottom-t.top+an(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(L),L.scrollIntoView(a),e.display.lineSpace.removeChild(L)}}function $o(e,t,n,i){i==null&&(i=0);var a;!e.options.lineWrapping&&t==n&&(t=t.ch?We(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?We(t.line,t.ch+1,"before"):t);for(var L=0;L<5;L++){var H=!1,X=qi(e,t),Q=!n||n==t?X:qi(e,n);a={left:Math.min(X.left,Q.left),top:Math.min(X.top,Q.top)-i,right:Math.max(X.left,Q.left),bottom:Math.max(X.bottom,Q.bottom)+i};var q=wa(e,a),le=e.doc.scrollTop,ce=e.doc.scrollLeft;if(q.scrollTop!=null&&(Er(e,q.scrollTop),Math.abs(e.doc.scrollTop-le)>1&&(H=!0)),q.scrollLeft!=null&&(Bn(e,q.scrollLeft),Math.abs(e.doc.scrollLeft-ce)>1&&(H=!0)),!H)break}return a}function Qo(e,t){var n=wa(e,t);n.scrollTop!=null&&Er(e,n.scrollTop),n.scrollLeft!=null&&Bn(e,n.scrollLeft)}function wa(e,t){var n=e.display,i=$n(e.display);t.top<0&&(t.top=0);var a=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,L=ca(e),H={};t.bottom-t.top>L&&(t.bottom=t.top+L);var X=e.doc.height+da(n),Q=t.top<i,q=t.bottom>X-i;if(t.top<a)H.scrollTop=Q?0:t.top;else if(t.bottom>a+L){var le=Math.min(t.top,(q?X:t.bottom)-L);le!=a&&(H.scrollTop=le)}var ce=e.options.fixedGutter?0:n.gutters.offsetWidth,Ee=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ce,_e=Pn(e)-n.gutters.offsetWidth,Ie=t.right-t.left>_e;return Ie&&(t.right=t.left+_e),t.left<10?H.scrollLeft=0:t.left<Ee?H.scrollLeft=Math.max(0,t.left+ce-(Ie?0:10)):t.right>_e+Ee-3&&(H.scrollLeft=t.right+(Ie?0:10)-_e),H}function Sa(e,t){if(t==null)return;Xr(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Zn(e){Xr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function br(e,t,n){(t!=null||n!=null)&&Xr(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Jo(e,t){Xr(e),e.curOp.scrollToPos=t}function Xr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=us(e,t.from),i=us(e,t.to);_s(e,n,i,t.margin)}}function _s(e,t,n,i){var a=wa(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-i,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+i});br(e,a.scrollLeft,a.scrollTop)}function Er(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||Aa(e,{top:t}),bs(e,t,!0),D&&Aa(e),wr(e,100)}function bs(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Bn(e,t,n,i){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!i)return;e.doc.scrollLeft=t,Ss(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function xr(e){var t=e.display,n=t.gutters.offsetWidth,i=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?n:0,docHeight:i,scrollHeight:i+an(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var jn=function(e,t,n){this.cm=n;var i=this.vert=h("div",[h("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),a=this.horiz=h("div",[h("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=a.tabIndex=-1,e(i),e(a),Ae(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),Ae(a,"scroll",function(){a.clientWidth&&t(a.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,W&&j<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};jn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?i+"px":"0";var a=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+a)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?i+"px":"0",this.horiz.style.left=e.barLeft+"px";var L=e.viewWidth-e.barLeft-(n?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+L)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(i==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?i:0,bottom:t?i:0}},jn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},jn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},jn.prototype.zeroWidthHack=function(){var e=l&&!u?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ee,this.disableVert=new ee},jn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function i(){var a=e.getBoundingClientRect(),L=n=="vert"?document.elementFromPoint(a.right-1,(a.top+a.bottom)/2):document.elementFromPoint((a.right+a.left)/2,a.bottom-1);L!=e?e.style.pointerEvents="none":t.set(1e3,i)}t.set(1e3,i)},jn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Tr=function(){};Tr.prototype.update=function(){return{bottom:0,right:0}},Tr.prototype.setScrollLeft=function(){},Tr.prototype.setScrollTop=function(){},Tr.prototype.clear=function(){};function qn(e,t){t||(t=xr(e));var n=e.display.barWidth,i=e.display.barHeight;Es(e,t);for(var a=0;a<4&&n!=e.display.barWidth||i!=e.display.barHeight;a++)n!=e.display.barWidth&&e.options.lineWrapping&&Kr(e),Es(e,xr(e)),n=e.display.barWidth,i=e.display.barHeight}function Es(e,t){var n=e.display,i=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px",n.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=i.bottom+"px",n.scrollbarFiller.style.width=i.right+"px"):n.scrollbarFiller.style.display="",i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=i.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var xs={native:jn,null:Tr};function Ts(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&T(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new xs[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ae(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?Bn(e,t):Er(e,t)},e),e.display.scrollbars.addClass&&P(e.display.wrapper,e.display.scrollbars.addClass)}var Zo=0;function Hn(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:++Zo},Yi(e.curOp)}function Wn(e){var t=e.curOp;t&&Io(t,function(n){for(var i=0;i<n.ops.length;i++)n.ops[i].cm.curOp=null;qo(n)})}function qo(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var i=0;i<t.length;i++)tl(t[i]);for(var a=0;a<t.length;a++)il(t[a]);for(var L=0;L<t.length;L++)nl(t[L]);for(var H=0;H<t.length;H++)rl(t[H])}function el(e){var t=e.cm,n=t.display;sl(t),e.updateMaxLine&&jr(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Yr(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Ca(e.cm,e.update)}function il(e){var t=e.cm,n=t.display;e.updatedDisplay&&Kr(t),e.barMeasure=xr(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ts(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+an(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Pn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Bn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==M();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&qn(t,e.barMeasure),e.updatedDisplay&&Ra(t,e.barMeasure),e.selectionChanged&&xa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&gs(e.cm)}function rl(e){var t=e.cm,n=t.display,i=t.doc;if(e.updatedDisplay&&ws(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&bs(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Bn(t,e.scrollLeft,!0,!0),e.scrollToPos){var a=$o(t,v(i,e.scrollToPos.from),v(i,e.scrollToPos.to),e.scrollToPos.margin);Yo(t,a)}var L=e.maybeHiddenMarkers,H=e.maybeUnhiddenMarkers;if(L)for(var X=0;X<L.length;++X)L[X].lines.length||Se(L[X],"hide");if(H)for(var Q=0;Q<H.length;++Q)H[Q].lines.length&&Se(H[Q],"unhide");n.wrapper.offsetHeight&&(i.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Se(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Hi(e,t){if(e.curOp)return t();Hn(e);try{return t()}finally{Wn(e)}}function pi(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Hn(e);try{return t.apply(e,arguments)}finally{Wn(e)}}}function Ri(e){return function(){if(this.curOp)return e.apply(this,arguments);Hn(this);try{return e.apply(this,arguments)}finally{Wn(this)}}}function mi(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Hn(t);try{return e.apply(this,arguments)}finally{Wn(t)}}}function wr(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,B(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,i=Ze(e,t.highlightFrontier),a=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),function(L){if(i.line>=e.display.viewFrom){var H=L.styles,X=L.text.length>e.options.maxHighlightLength?qt(t.mode,i.state):null,Q=fe(e,L,i,!0);X&&(i.state=X),L.styles=Q.styles;var q=L.styleClasses,le=Q.classes;le?L.styleClasses=le:q&&(L.styleClasses=null);for(var ce=!H||H.length!=L.styles.length||q!=le&&(!q||!le||q.bgClass!=le.bgClass||q.textClass!=le.textClass),Ee=0;!ce&&Ee<H.length;++Ee)ce=H[Ee]!=L.styles[Ee];ce&&a.push(i.line),L.stateAfter=i.save(),i.nextLine()}else L.text.length<=e.options.maxHighlightLength&>(e,L.text,i),L.stateAfter=i.line%5==0?i.save():null,i.nextLine();if(+new Date>n)return wr(e,e.options.workDelay),!0}),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),a.length&&Hi(e,function(){for(var L=0;L<a.length;L++)wn(e,a[L],"text")})}var Yr=function(e,t,n){var i=e.display;this.viewport=t,this.visible=Vr(i,e.doc,t),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=Pn(e),this.force=n,this.dims=_a(e),this.events=[]};Yr.prototype.signal=function(e,t){de(e,t)&&this.events.push(arguments)},Yr.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Se.apply(null,this.events[e])};function sl(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=an(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=an(e)+"px",t.scrollbarsClipped=!0)}function ol(e){if(e.hasFocus())return null;var t=M();if(!t||!b(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var i=window.getSelection();i.anchorNode&&i.extend&&b(e.display.lineDiv,i.anchorNode)&&(n.anchorNode=i.anchorNode,n.anchorOffset=i.anchorOffset,n.focusNode=i.focusNode,n.focusOffset=i.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==M())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&b(document.body,e.anchorNode)&&b(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function Ca(e,t){var n=e.display,i=e.doc;if(t.editorIsHidden)return Sn(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&fs(e)==0)return!1;Cs(e)&&(Sn(e),t.dims=_a(e));var a=i.first+i.size,L=Math.max(t.visible.from-e.options.viewportMargin,i.first),H=Math.min(a,t.visible.to+e.options.viewportMargin);n.viewFrom<L&&L-n.viewFrom<20&&(L=Math.max(i.first,n.viewFrom)),n.viewTo>H&&n.viewTo-H<20&&(H=Math.min(a,n.viewTo)),ci&&(L=cr(e.doc,L),H=Tn(e.doc,H));var X=L!=n.viewFrom||H!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vo(e,L,H),n.viewOffset=Zi(lt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var Q=fs(e);if(!X&&Q==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var q=ol(e);return Q>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),Q>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(q),E(n.cursorDiv),E(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,X&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,wr(e,400)),n.updateLineNumbers=null,!0}function ws(e,t){for(var n=t.viewport,i=!0;;i=!1){if(!i||!e.options.lineWrapping||t.oldDisplayWidth==Pn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+da(e.display)-ca(e),n.top)}),t.visible=Vr(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else i&&(t.visible=Vr(e.display,e.doc,n));if(!Ca(e,t))break;Kr(e);var a=xr(e);_r(e),qn(e,a),Ra(e,a),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Aa(e,t){var n=new Yr(e,t);if(Ca(e,n)){Kr(e),ws(e,n);var i=xr(e);_r(e),qn(e,i),Ra(e,i),n.finish()}}function ul(e,t,n){var i=e.display,a=e.options.lineNumbers,L=i.lineDiv,H=L.firstChild;function X(Ie){var Be=Ie.nextSibling;return k&&l&&e.display.currentWheelTarget==Ie?Ie.style.display="none":Ie.parentNode.removeChild(Ie),Be}for(var Q=i.view,q=i.viewFrom,le=0;le<Q.length;le++){var ce=Q[le];if(!ce.hidden)if(!ce.node||ce.node.parentNode!=L){var Ee=No(e,ce,q,n);L.insertBefore(Ee,H)}else{for(;H!=ce.node;)H=X(H);var _e=a&&t!=null&&t<=q&&ce.lineNumber;ce.changes&&(re(ce.changes,"gutter")>-1&&(_e=!1),Ya(e,ce,q,n)),_e&&(E(ce.lineNumber),ce.lineNumber.appendChild(document.createTextNode(pn(e.options,q)))),H=ce.node.nextSibling}q+=ce.size}for(;H;)H=X(H)}function Oa(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+an(e)+"px"}function Ss(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var i=ba(t)-t.scroller.scrollLeft+e.doc.scrollLeft,a=t.gutters.offsetWidth,L=i+"px",H=0;H<n.length;H++)if(!n[H].hidden){e.options.fixedGutter&&(n[H].gutter&&(n[H].gutter.style.left=L),n[H].gutterBackground&&(n[H].gutterBackground.style.left=L));var X=n[H].alignable;if(X)for(var Q=0;Q<X.length;Q++)X[Q].style.left=L}e.options.fixedGutter&&(t.gutters.style.left=i+a+"px")}function Cs(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=pn(e.options,t.first+t.size-1),i=e.display;if(n.length!=i.lineNumChars){var a=i.measure.appendChild(h("div",[h("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),L=a.firstChild.offsetWidth,H=a.offsetWidth-L;return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(L,i.lineGutter.offsetWidth-H)+1,i.lineNumWidth=i.lineNumInnerWidth+H,i.lineNumChars=i.lineNumInnerWidth?n.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",Oa(e.display),!0}return!1}function La(e,t){for(var n=[],i=!1,a=0;a<e.length;a++){var L=e[a],H=null;if(typeof L!="string"&&(H=L.style,L=L.className),L=="CodeMirror-linenumbers")if(t)i=!0;else continue;n.push({className:L,style:H})}return t&&!i&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function As(e){var t=e.gutters,n=e.gutterSpecs;E(t),e.lineGutter=null;for(var i=0;i<n.length;++i){var a=n[i],L=a.className,H=a.style,X=t.appendChild(h("div",null,"CodeMirror-gutter "+L));H&&(X.style.cssText=H),L=="CodeMirror-linenumbers"&&(e.lineGutter=X,X.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Oa(e)}function Sr(e){As(e.display),Mi(e),Ss(e)}function hl(e,t,n,i){var a=this;this.input=n,a.scrollbarFiller=h("div",null,"CodeMirror-scrollbar-filler"),a.scrollbarFiller.setAttribute("cm-not-content","true"),a.gutterFiller=h("div",null,"CodeMirror-gutter-filler"),a.gutterFiller.setAttribute("cm-not-content","true"),a.lineDiv=_("div",null,"CodeMirror-code"),a.selectionDiv=h("div",null,null,"position: relative; z-index: 1"),a.cursorDiv=h("div",null,"CodeMirror-cursors"),a.measure=h("div",null,"CodeMirror-measure"),a.lineMeasure=h("div",null,"CodeMirror-measure"),a.lineSpace=_("div",[a.measure,a.lineMeasure,a.selectionDiv,a.cursorDiv,a.lineDiv],null,"position: relative; outline: none");var L=_("div",[a.lineSpace],"CodeMirror-lines");a.mover=h("div",[L],null,"position: relative"),a.sizer=h("div",[a.mover],"CodeMirror-sizer"),a.sizerWidth=null,a.heightForcer=h("div",null,null,"position: absolute; height: "+ue+"px; width: 1px;"),a.gutters=h("div",null,"CodeMirror-gutters"),a.lineGutter=null,a.scroller=h("div",[a.sizer,a.heightForcer,a.gutters],"CodeMirror-scroll"),a.scroller.setAttribute("tabIndex","-1"),a.wrapper=h("div",[a.scrollbarFiller,a.gutterFiller,a.scroller],"CodeMirror"),W&&j<8&&(a.gutters.style.zIndex=-1,a.scroller.style.paddingRight=0),!k&&!(D&&s)&&(a.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(a.wrapper):e(a.wrapper)),a.viewFrom=a.viewTo=t.first,a.reportedViewFrom=a.reportedViewTo=t.first,a.view=[],a.renderedView=null,a.externalMeasured=null,a.viewOffset=0,a.lastWrapHeight=a.lastWrapWidth=0,a.updateLineNumbers=null,a.nativeBarWidth=a.barHeight=a.barWidth=0,a.scrollbarsClipped=!1,a.lineNumWidth=a.lineNumInnerWidth=a.lineNumChars=null,a.alignWidgets=!1,a.cachedCharWidth=a.cachedTextHeight=a.cachedPaddingH=null,a.maxLine=null,a.maxLineLength=0,a.maxLineChanged=!1,a.wheelDX=a.wheelDY=a.wheelStartX=a.wheelStartY=null,a.shift=!1,a.selForContextMenu=null,a.activeTouch=null,a.gutterSpecs=La(i.gutters,i.lineNumbers),As(a),n.init(a)}var $r=0,Ki=null;W?Ki=-.53:D?Ki=15:m?Ki=-.7:f&&(Ki=-1/3);function Os(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function dl(e){var t=Os(e);return t.x*=Ki,t.y*=Ki,t}function Rs(e,t){var n=Os(t),i=n.x,a=n.y,L=e.display,H=L.scroller,X=H.scrollWidth>H.clientWidth,Q=H.scrollHeight>H.clientHeight;if(!(i&&X||a&&Q))return;if(a&&l&&k){e:for(var q=t.target,le=L.view;q!=H;q=q.parentNode)for(var ce=0;ce<le.length;ce++)if(le[ce].node==q){e.display.currentWheelTarget=q;break e}}if(i&&!D&&!c&&Ki!=null){a&&Q&&Er(e,Math.max(0,H.scrollTop+a*Ki)),Bn(e,Math.max(0,H.scrollLeft+i*Ki)),(!a||a&&Q)&&te(t),L.wheelStartX=null;return}if(a&&Ki!=null){var Ee=a*Ki,_e=e.doc.scrollTop,Ie=_e+L.wrapper.clientHeight;Ee<0?_e=Math.max(0,_e+Ee-50):Ie=Math.min(e.doc.height,Ie+Ee+50),Aa(e,{top:_e,bottom:Ie})}$r<20&&(L.wheelStartX==null?(L.wheelStartX=H.scrollLeft,L.wheelStartY=H.scrollTop,L.wheelDX=i,L.wheelDY=a,setTimeout(function(){if(L.wheelStartX==null)return;var Be=H.scrollLeft-L.wheelStartX,Xe=H.scrollTop-L.wheelStartY,at=Xe&&L.wheelDY&&Xe/L.wheelDY||Be&&L.wheelDX&&Be/L.wheelDX;if(L.wheelStartX=L.wheelStartY=null,!at)return;Ki=(Ki*$r+at)/($r+1),++$r},200)):(L.wheelDX+=i,L.wheelDY+=a))}var Vi=function(e,t){this.ranges=e,this.primIndex=t};Vi.prototype.primary=function(){return this.ranges[this.primIndex]},Vi.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 n=this.ranges[t],i=e.ranges[t];if(!mn(n.anchor,i.anchor)||!mn(n.head,i.head))return!1}return!0},Vi.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new zt(gn(this.ranges[t].anchor),gn(this.ranges[t].head));return new Vi(e,this.primIndex)},Vi.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Vi.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var i=this.ranges[n];if(At(t,i.from())>=0&&At(e,i.to())<=0)return n}return-1};var zt=function(e,t){this.anchor=e,this.head=t};zt.prototype.from=function(){return yn(this.anchor,this.head)},zt.prototype.to=function(){return vn(this.anchor,this.head)},zt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function en(e,t,n){var i=e&&e.options.selectionsMayTouch,a=t[n];t.sort(function(Ee,_e){return At(Ee.from(),_e.from())}),n=re(t,a);for(var L=1;L<t.length;L++){var H=t[L],X=t[L-1],Q=At(X.to(),H.from());if(i&&!H.empty()?Q>0:Q>=0){var q=yn(X.from(),H.from()),le=vn(X.to(),H.to()),ce=X.empty()?H.from()==H.head:X.from()==X.head;L<=n&&--n,t.splice(--L,2,new zt(ce?le:q,ce?q:le))}}return new Vi(t,n)}function Cn(e,t){return new Vi([new zt(e,t||e)],0)}function An(e){return e.text?We(e.from.line+e.text.length-1,Re(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ls(e,t){if(At(e,t.from)<0)return e;if(At(e,t.to)<=0)return An(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=An(t).ch-t.to.ch),We(n,i)}function Ia(e,t){for(var n=[],i=0;i<e.sel.ranges.length;i++){var a=e.sel.ranges[i];n.push(new zt(Ls(a.anchor,t),Ls(a.head,t)))}return en(e.cm,n,e.sel.primIndex)}function Is(e,t,n){return e.line==t.line?We(n.line,e.ch-t.ch+n.ch):We(n.line+(e.line-t.line),e.ch)}function cl(e,t,n){for(var i=[],a=We(e.first,0),L=a,H=0;H<t.length;H++){var X=t[H],Q=Is(X.from,a,L),q=Is(An(X),a,L);if(a=X.to,L=q,n=="around"){var le=e.sel.ranges[H],ce=At(le.head,le.anchor)<0;i[H]=new zt(ce?q:Q,ce?Q:q)}else i[H]=new zt(Q,Q)}return new Vi(i,e.sel.primIndex)}function Da(e){e.doc.mode=St(e.options,e.doc.modeOption),Cr(e)}function Cr(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,wr(e,100),e.state.modeGen++,e.curOp&&Mi(e)}function Ds(e,t){return t.from.ch==0&&t.to.ch==0&&Re(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function ka(e,t,n,i){function a(dt){return n?n[dt]:null}function L(dt,st,pt){ua(dt,st,pt,i),_i(dt,"change",dt,t)}function H(dt,st){for(var pt=[],wt=dt;wt<st;++wt)pt.push(new Mn(q[wt],a(wt),i));return pt}var X=t.from,Q=t.to,q=t.text,le=lt(e,X.line),ce=lt(e,Q.line),Ee=Re(q),_e=a(q.length-1),Ie=Q.line-X.line;if(t.full)e.insert(0,H(0,q.length)),e.remove(q.length,e.size-q.length);else if(Ds(e,t)){var Be=H(0,q.length-1);L(ce,ce.text,_e),Ie&&e.remove(X.line,Ie),Be.length&&e.insert(X.line,Be)}else if(le==ce)if(q.length==1)L(le,le.text.slice(0,X.ch)+Ee+le.text.slice(Q.ch),_e);else{var Xe=H(1,q.length-1);Xe.push(new Mn(Ee+le.text.slice(Q.ch),_e,i)),L(le,le.text.slice(0,X.ch)+q[0],a(0)),e.insert(X.line+1,Xe)}else if(q.length==1)L(le,le.text.slice(0,X.ch)+q[0]+ce.text.slice(Q.ch),a(0)),e.remove(X.line+1,Ie);else{L(le,le.text.slice(0,X.ch)+q[0],a(0)),L(ce,Ee+ce.text.slice(Q.ch),_e);var at=H(1,q.length-1);Ie>1&&e.remove(X.line+1,Ie-1),e.insert(X.line+1,at)}_i(e,"change",e,t)}function On(e,t,n){function i(a,L,H){if(a.linked)for(var X=0;X<a.linked.length;++X){var Q=a.linked[X];if(Q.doc==L)continue;var q=H&&Q.sharedHist;if(n&&!q)continue;t(Q.doc,q),i(Q.doc,a,q)}}i(e,null,!0)}function ks(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ea(e),Da(e),Ms(e),e.options.lineWrapping||jr(e),e.options.mode=t.modeOption,Mi(e)}function Ms(e){(e.doc.direction=="rtl"?P:T)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Hi(e,function(){Ms(e),Mi(e)})}function Qr(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 n={from:gn(t.from),to:An(t),text:Ai(e,t.from,t.to)};return Fs(e,n,t.from.line,t.to.line+1),On(e,function(i){return Fs(i,n,t.from.line,t.to.line+1)},!0),n}function Ps(e){for(;e.length;){var t=Re(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Ps(e.done),Re(e.done);if(e.done.length&&!Re(e.done).ranges)return Re(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Re(e.done)}function Ns(e,t,n,i){var a=e.history;a.undone.length=0;var L=+new Date,H,X;if((a.lastOp==i||a.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&a.lastModTime>L-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(H=pl(a,a.lastOp==i)))X=Re(H.changes),At(t.from,t.to)==0&&At(t.from,X.to)==0?X.to=An(t):H.changes.push(Ma(e,t));else{var Q=Re(a.done);for((!Q||!Q.ranges)&&Jr(e.sel,a.done),H={changes:[Ma(e,t)],generation:a.generation},a.done.push(H);a.done.length>a.undoDepth;)a.done.shift(),a.done[0].ranges||a.done.shift()}a.done.push(n),a.generation=++a.maxGeneration,a.lastModTime=a.lastSelTime=L,a.lastOp=a.lastSelOp=i,a.lastOrigin=a.lastSelOrigin=t.origin,X||Se(e,"historyAdded")}function ml(e,t,n,i){var a=t.charAt(0);return a=="*"||a=="+"&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,i){var a=e.history,L=i&&i.origin;n==a.lastSelOp||L&&a.lastSelOrigin==L&&(a.lastModTime==a.lastSelTime&&a.lastOrigin==L||ml(e,L,Re(a.done),t))?a.done[a.done.length-1]=t:Jr(t,a.done),a.lastSelTime=+new Date,a.lastSelOrigin=L,a.lastSelOp=n,i&&i.clearRedo!==!1&&Ps(a.undone)}function Jr(e,t){var n=Re(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Fs(e,t,n,i){var a=t["spans_"+e.id],L=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,i),function(H){H.markedSpans&&((a||(a=t["spans_"+e.id]={}))[L]=H.markedSpans),++L})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var i=[],a=0;a<t.text.length;++a)i.push(vl(n[a]));return i}function Us(e,t){var n=yl(e,t),i=Ji(e,t);if(!n)return i;if(!i)return n;for(var a=0;a<n.length;++a){var L=n[a],H=i[a];if(L&&H){e:for(var X=0;X<H.length;++X){for(var Q=H[X],q=0;q<L.length;++q)if(L[q].marker==Q.marker)continue e;L.push(Q)}}else H&&(n[a]=H)}return n}function er(e,t,n){for(var i=[],a=0;a<e.length;++a){var L=e[a];if(L.ranges){i.push(n?Vi.prototype.deepCopy.call(L):L);continue}var H=L.changes,X=[];i.push({changes:X});for(var Q=0;Q<H.length;++Q){var q=H[Q],le=void 0;if(X.push({from:q.from,to:q.to,text:q.text}),t)for(var ce in q)(le=ce.match(/^spans_(\d+)$/))&&(re(t,Number(le[1]))>-1&&(Re(X)[ce]=q[ce],delete q[ce]))}}return i}function Pa(e,t,n,i){if(i){var a=e.anchor;if(n){var L=At(t,a)<0;L!=At(n,a)<0?(a=t,t=n):L!=At(t,n)<0&&(t=n)}return new zt(a,t)}else return new zt(n||t,t)}function Zr(e,t,n,i,a){a==null&&(a=e.cm&&(e.cm.display.shift||e.extend)),Si(e,new Vi([Pa(e.sel.primary(),t,n,a)],0),i)}function Bs(e,t,n){for(var i=[],a=e.cm&&(e.cm.display.shift||e.extend),L=0;L<e.sel.ranges.length;L++)i[L]=Pa(e.sel.ranges[L],t[L],null,a);var H=en(e.cm,i,e.sel.primIndex);Si(e,H,n)}function Na(e,t,n,i){var a=e.sel.ranges.slice(0);a[t]=n,Si(e,en(e.cm,a,e.sel.primIndex),i)}function js(e,t,n,i){Si(e,Cn(t,n),i)}function _l(e,t,n){var i={ranges:t.ranges,update:function(a){this.ranges=[];for(var L=0;L<a.length;L++)this.ranges[L]=new zt(v(e,a[L].anchor),v(e,a[L].head))},origin:n&&n.origin};return Se(e,"beforeSelectionChange",e,i),e.cm&&Se(e.cm,"beforeSelectionChange",e.cm,i),i.ranges!=t.ranges?en(e.cm,i.ranges,i.ranges.length-1):t}function Hs(e,t,n){var i=e.history.done,a=Re(i);a&&a.ranges?(i[i.length-1]=t,qr(e,t,n)):Si(e,t,n)}function Si(e,t,n){qr(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function qr(e,t,n){(de(e,"beforeSelectionChange")||e.cm&&de(e.cm,"beforeSelectionChange"))&&(t=_l(e,t,n));var i=n&&n.bias||(At(t.primary().head,e.sel.primary().head)<0?-1:1);Ws(e,zs(e,t,i,!0)),!(n&&n.scroll===!1)&&e.cm&&Zn(e.cm)}function Ws(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ve(e.cm)),_i(e,"cursorActivity",e)}function Gs(e){Ws(e,zs(e,e.sel,null,!1))}function zs(e,t,n,i){for(var a,L=0;L<t.ranges.length;L++){var H=t.ranges[L],X=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[L],Q=ea(e,H.anchor,X&&X.anchor,n,i),q=ea(e,H.head,X&&X.head,n,i);(a||Q!=H.anchor||q!=H.head)&&(a||(a=t.ranges.slice(0,L)),a[L]=new zt(Q,q))}return a?en(e.cm,a,t.primIndex):t}function tr(e,t,n,i,a){var L=lt(e,t.line);if(L.markedSpans)for(var H=0;H<L.markedSpans.length;++H){var X=L.markedSpans[H],Q=X.marker,q="selectLeft"in Q?!Q.selectLeft:Q.inclusiveLeft,le="selectRight"in Q?!Q.selectRight:Q.inclusiveRight;if((X.from==null||(q?X.from<=t.ch:X.from<t.ch))&&(X.to==null||(le?X.to>=t.ch:X.to>t.ch))){if(a&&(Se(Q,"beforeCursorEnter"),Q.explicitlyCleared))if(L.markedSpans){--H;continue}else break;if(!Q.atomic)continue;if(n){var ce=Q.find(i<0?1:-1),Ee=void 0;if((i<0?le:q)&&(ce=Ks(e,ce,-i,ce&&ce.line==t.line?L:null)),ce&&ce.line==t.line&&(Ee=At(ce,n))&&(i<0?Ee<0:Ee>0))return tr(e,ce,t,i,a)}var _e=Q.find(i<0?-1:1);return(i<0?q:le)&&(_e=Ks(e,_e,i,_e.line==t.line?L:null)),_e?tr(e,_e,t,i,a):null}}return t}function ea(e,t,n,i,a){var L=i||1,H=tr(e,t,n,L,a)||!a&&tr(e,t,n,L,!0)||tr(e,t,n,-L,a)||!a&&tr(e,t,n,-L,!0);return H||(e.cantEdit=!0,We(e.first,0))}function Ks(e,t,n,i){return n<0&&t.ch==0?t.line>e.first?v(e,We(t.line-1)):null:n>0&&t.ch==(i||lt(e,t.line)).text.length?t.line<e.first+e.size-1?We(t.line+1,0):null:new We(t.line,t.ch+n)}function Vs(e){e.setSelection(We(e.firstLine(),0),We(e.lastLine()),ye)}function Xs(e,t,n){var i={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return i.canceled=!0}};return n&&(i.update=function(a,L,H,X){a&&(i.from=v(e,a)),L&&(i.to=v(e,L)),H&&(i.text=H),X!==void 0&&(i.origin=X)}),Se(e,"beforeChange",e,i),e.cm&&Se(e.cm,"beforeChange",e.cm,i),i.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:i.from,to:i.to,text:i.text,origin:i.origin}}function ir(e,t,n){if(e.cm){if(!e.cm.curOp)return pi(e.cm,ir)(e,t,n);if(e.cm.state.suppressEdits)return}if((de(e,"beforeChange")||e.cm&&de(e.cm,"beforeChange"))&&(t=Xs(e,t,!0),!t))return;var i=Dn&&!n&&bn(e,t.from,t.to);if(i)for(var a=i.length-1;a>=0;--a)Ys(e,{from:i[a].from,to:i[a].to,text:a?[""]:t.text,origin:t.origin});else Ys(e,t)}function Ys(e,t){if(t.text.length==1&&t.text[0]==""&&At(t.from,t.to)==0)return;var n=Ia(e,t);Ns(e,t,n,e.cm?e.cm.curOp.id:NaN),Ar(e,t,n,Ji(e,t));var i=[];On(e,function(a,L){!L&&re(i,a.history)==-1&&(Zs(a.history,t),i.push(a.history)),Ar(a,t,null,Ji(a,t))})}function ta(e,t,n){var i=e.cm&&e.cm.state.suppressEdits;if(i&&!n)return;for(var a=e.history,L,H=e.sel,X=t=="undo"?a.done:a.undone,Q=t=="undo"?a.undone:a.done,q=0;q<X.length&&!(L=X[q],n?L.ranges&&!L.equals(e.sel):!L.ranges);q++);if(q==X.length)return;for(a.lastOrigin=a.lastSelOrigin=null;;)if(L=X.pop(),L.ranges){if(Jr(L,Q),n&&!L.equals(e.sel)){Si(e,L,{clearRedo:!1});return}H=L}else if(i){X.push(L);return}else break;var le=[];Jr(H,Q),Q.push({changes:le,generation:a.generation}),a.generation=L.generation||++a.maxGeneration;for(var ce=de(e,"beforeChange")||e.cm&&de(e.cm,"beforeChange"),Ee=function(Be){var Xe=L.changes[Be];if(Xe.origin=t,ce&&!Xs(e,Xe,!1))return X.length=0,{};le.push(Ma(e,Xe));var at=Be?Ia(e,Xe):Re(X);Ar(e,Xe,at,Us(e,Xe)),!Be&&e.cm&&e.cm.scrollIntoView({from:Xe.from,to:An(Xe)});var dt=[];On(e,function(st,pt){!pt&&re(dt,st.history)==-1&&(Zs(st.history,Xe),dt.push(st.history)),Ar(st,Xe,null,Us(st,Xe))})},_e=L.changes.length-1;_e>=0;--_e){var Ie=Ee(_e);if(Ie)return Ie.v}}function $s(e,t){if(t==0)return;if(e.first+=t,e.sel=new Vi(ze(e.sel.ranges,function(a){return new zt(We(a.anchor.line+t,a.anchor.ch),We(a.head.line+t,a.head.ch))}),e.sel.primIndex),e.cm){Mi(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,i=n.viewFrom;i<n.viewTo;i++)wn(e.cm,i,"gutter")}}function Ar(e,t,n,i){if(e.cm&&!e.cm.curOp)return pi(e.cm,Ar)(e,t,n,i);if(t.to.line<e.first){$s(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 a=t.text.length-1-(e.first-t.from.line);$s(e,a),t={from:We(e.first,0),to:We(t.to.line+a,t.to.ch),text:[Re(t.text)],origin:t.origin}}var L=e.lastLine();t.to.line>L&&(t={from:t.from,to:We(L,lt(e,L).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ai(e,t.from,t.to),n||(n=Ia(e,t)),e.cm?bl(e.cm,t,i):ka(e,t,i),qr(e,n,ye),e.cantEdit&&ea(e,We(e.firstLine(),0))&&(e.cantEdit=!1)}function bl(e,t,n){var i=e.doc,a=e.display,L=t.from,H=t.to,X=!1,Q=L.line;e.options.lineWrapping||(Q=Mt(Oi(lt(i,L.line))),i.iter(Q,H.line+1,function(_e){if(_e==a.maxLine)return X=!0,!0})),i.sel.contains(t.from,t.to)>-1&&ve(e),ka(i,t,n,cs(e)),e.options.lineWrapping||(i.iter(Q,L.line+t.text.length,function(_e){var Ie=pr(_e);Ie>a.maxLineLength&&(a.maxLine=_e,a.maxLineLength=Ie,a.maxLineChanged=!0,X=!1)}),X&&(e.curOp.updateMaxLine=!0)),Qi(i,L.line),wr(e,400);var q=t.text.length-(H.line-L.line)-1;t.full?Mi(e):L.line==H.line&&t.text.length==1&&!Ds(e.doc,t)?wn(e,L.line,"text"):Mi(e,L.line,H.line+1,q);var le=de(e,"changes"),ce=de(e,"change");if(ce||le){var Ee={from:L,to:H,text:t.text,removed:t.removed,origin:t.origin};ce&&_i(e,"change",e,Ee),le&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Ee)}e.display.selForContextMenu=null}function nr(e,t,n,i,a){var L;i||(i=n),At(i,n)<0&&(L=[i,n],n=L[0],i=L[1]),typeof t=="string"&&(t=e.splitLines(t)),ir(e,{from:n,to:i,text:t,origin:a})}function Qs(e,t,n,i){n<e.line?e.line+=i:t<e.line&&(e.line=t,e.ch=0)}function Js(e,t,n,i){for(var a=0;a<e.length;++a){var L=e[a],H=!0;if(L.ranges){L.copied||(L=e[a]=L.deepCopy(),L.copied=!0);for(var X=0;X<L.ranges.length;X++)Qs(L.ranges[X].anchor,t,n,i),Qs(L.ranges[X].head,t,n,i);continue}for(var Q=0;Q<L.changes.length;++Q){var q=L.changes[Q];if(n<q.from.line)q.from=We(q.from.line+i,q.from.ch),q.to=We(q.to.line+i,q.to.ch);else if(t<=q.to.line){H=!1;break}}H||(e.splice(0,a+1),a=0)}}function Zs(e,t){var n=t.from.line,i=t.to.line,a=t.text.length-(i-n)-1;Js(e.done,n,i,a),Js(e.undone,n,i,a)}function Or(e,t,n,i){var a=t,L=t;return typeof t=="number"?L=lt(e,z(e,t)):a=Mt(t),a==null?null:(i(L,a)&&e.cm&&wn(e.cm,a,n),L)}function Rr(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}Rr.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,i=e+t;n<i;++n){var a=this.lines[n];this.height-=a.height,yt(a),_i(a,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var i=0;i<t.length;++i)t[i].parent=this},iterN:function(e,t,n){for(var i=e+t;e<i;++e)if(n(this.lines[e]))return!0}};function Lr(e){this.children=e;for(var t=0,n=0,i=0;i<e.length;++i){var a=e[i];t+=a.chunkSize(),n+=a.height,a.parent=this}this.size=t,this.height=n,this.parent=null}Lr.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var i=this.children[n],a=i.chunkSize();if(e<a){var L=Math.min(t,a-e),H=i.height;if(i.removeInner(e,L),this.height-=H-i.height,a==L&&(this.children.splice(n--,1),i.parent=null),(t-=L)==0)break;e=0}else e-=a}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Rr))){var X=[];this.collapse(X),this.children=[new Rr(X)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var i=0;i<this.children.length;++i){var a=this.children[i],L=a.chunkSize();if(e<=L){if(a.insertInner(e,t,n),a.lines&&a.lines.length>50){for(var H=a.lines.length%25+25,X=H;X<a.lines.length;){var Q=new Rr(a.lines.slice(X,X+=25));a.height-=Q.height,this.children.splice(++i,0,Q),Q.parent=this}a.lines=a.lines.slice(0,H),this.maybeSpill()}break}e-=L}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Lr(t);if(e.parent){e.size-=n.size,e.height-=n.height;var a=re(e.parent.children,e);e.parent.children.splice(a+1,0,n)}else{var i=new Lr(e.children);i.parent=e,e.children=[i,n],e=i}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var i=0;i<this.children.length;++i){var a=this.children[i],L=a.chunkSize();if(e<L){var H=Math.min(t,L-e);if(a.iterN(e,H,n))return!0;if((t-=H)==0)break;e=0}else e-=L}}};var Ir=function(e,t,n){if(n)for(var i in n)n.hasOwnProperty(i)&&(this[i]=n[i]);this.doc=e,this.node=t};Ir.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,i=Mt(n);if(i==null||!t)return;for(var a=0;a<t.length;++a)t[a]==this&&t.splice(a--,1);t.length||(n.widgets=null);var L=vr(this);ii(n,Math.max(0,n.height-L)),e&&(Hi(e,function(){qs(e,n,-L),wn(e,i,"widget")}),_i(e,"lineWidgetCleared",e,this,i))},Ir.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,i=this.line;this.height=null;var a=vr(this)-t;if(!a)return;rn(this.doc,i)||ii(i,i.height+a),n&&Hi(n,function(){n.curOp.forceUpdate=!0,qs(n,i,a),_i(n,"lineWidgetChanged",n,e,Mt(i))})},pe(Ir);function qs(e,t,n){Zi(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Sa(e,n)}function El(e,t,n,i){var a=new Ir(e,n,i),L=e.cm;return L&&a.noHScroll&&(L.display.alignWidgets=!0),Or(e,t,"widget",function(H){var X=H.widgets||(H.widgets=[]);if(a.insertAt==null?X.push(a):X.splice(Math.min(X.length-1,Math.max(0,a.insertAt)),0,a),a.line=H,L&&!rn(e,H)){var Q=Zi(H)<e.scrollTop;ii(H,H.height+vr(a)),Q&&Sa(L,a.height),L.curOp.forceUpdate=!0}return!0}),L&&_i(L,"lineWidgetAdded",L,a,typeof t=="number"?t:Mt(t)),a}var eo=0,Rn=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++eo};Rn.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Hn(e),de(this,"clear")){var n=this.find();n&&_i(this,"clear",n.from,n.to)}for(var i=null,a=null,L=0;L<this.lines.length;++L){var H=this.lines[L],X=ji(H.markedSpans,this);e&&!this.collapsed?wn(e,Mt(H),"text"):e&&(X.to!=null&&(a=Mt(H)),X.from!=null&&(i=Mt(H))),H.markedSpans=kn(H.markedSpans,X),X.from==null&&this.collapsed&&!rn(this.doc,H)&&e&&ii(H,$n(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var Q=0;Q<this.lines.length;++Q){var q=Oi(this.lines[Q]),le=pr(q);le>e.display.maxLineLength&&(e.display.maxLine=q,e.display.maxLineLength=le,e.display.maxLineChanged=!0)}i!=null&&e&&this.collapsed&&Mi(e,i,a+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Gs(e.doc)),e&&_i(e,"markerCleared",e,this,i,a),t&&Wn(e),this.parent&&this.parent.clear()},Rn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,i,a=0;a<this.lines.length;++a){var L=this.lines[a],H=ji(L.markedSpans,this);if(H.from!=null&&(n=We(t?L:Mt(L),H.from),e==-1))return n;if(H.to!=null&&(i=We(t?L:Mt(L),H.to),e==1))return i}return n&&{from:n,to:i}},Rn.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,i=this.doc.cm;if(!t||!i)return;Hi(i,function(){var a=t.line,L=Mt(t.line),H=fa(i,L);if(H&&(rs(H),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!rn(n.doc,a)&&n.height!=null){var X=n.height;n.height=null;var Q=vr(n)-X;Q&&ii(a,a.height+Q)}_i(i,"markerChanged",i,e)})},Rn.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||re(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Rn.prototype.detachLine=function(e){if(this.lines.splice(re(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},pe(Rn);function rr(e,t,n,i,a){if(i&&i.shared)return xl(e,t,n,i,a);if(e.cm&&!e.cm.curOp)return pi(e.cm,rr)(e,t,n,i,a);var L=new Rn(e,a),H=At(t,n);if(i&&C(i,L,!1),H>0||H==0&&L.clearWhenEmpty!==!1)return L;if(L.replacedWith&&(L.collapsed=!0,L.widgetNode=_("span",[L.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||L.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(L.widgetNode.insertLeft=!0)),L.collapsed){if(fi(e,t.line,t,n,L)||t.line!=n.line&&fi(e,n.line,t,n,L))throw new Error("Inserting collapsed marker partially overlapping an existing one");ln()}L.addToHistory&&Ns(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var X=t.line,Q=e.cm,q;if(e.iter(X,n.line+1,function(ce){Q&&L.collapsed&&!Q.options.lineWrapping&&Oi(ce)==Q.display.maxLine&&(q=!0),L.collapsed&&X!=t.line&&ii(ce,0),_n(ce,new un(L,X==t.line?t.ch:null,X==n.line?n.ch:null)),++X}),L.collapsed&&e.iter(t.line,n.line+1,function(ce){rn(e,ce)&&ii(ce,0)}),L.clearOnEnter&&Ae(L,"beforeCursorEnter",function(){return L.clear()}),L.readOnly&&(zi(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),L.collapsed&&(L.id=++eo,L.atomic=!0),Q){if(q&&(Q.curOp.updateMaxLine=!0),L.collapsed)Mi(Q,t.line,n.line+1);else if(L.className||L.startStyle||L.endStyle||L.css||L.attributes||L.title)for(var le=t.line;le<=n.line;le++)wn(Q,le,"text");L.atomic&&Gs(Q.doc),_i(Q,"markerAdded",Q,L)}return L}var Dr=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};Dr.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();_i(this,"clear")},Dr.prototype.find=function(e,t){return this.primary.find(e,t)},pe(Dr);function xl(e,t,n,i,a){i=C(i),i.shared=!1;var L=[rr(e,t,n,i,a)],H=L[0],X=i.widgetNode;return On(e,function(Q){X&&(i.widgetNode=X.cloneNode(!0)),L.push(rr(Q,v(Q,t),v(Q,n),i,a));for(var q=0;q<Q.linked.length;++q)if(Q.linked[q].isParent)return;H=Re(L)}),new Dr(L,H)}function to(e){return e.findMarks(We(e.first,0),e.clipPos(We(e.lastLine())),function(t){return t.parent})}function Tl(e,t){for(var n=0;n<t.length;n++){var i=t[n],a=i.find(),L=e.clipPos(a.from),H=e.clipPos(a.to);if(At(L,H)){var X=rr(e,L,H,i.primary,i.primary.type);i.markers.push(X),X.parent=i}}}function wl(e){for(var t=function(i){var a=e[i],L=[a.primary.doc];On(a.primary.doc,function(Q){return L.push(Q)});for(var H=0;H<a.markers.length;H++){var X=a.markers[H];re(L,X.doc)==-1&&(X.parent=null,a.markers.splice(H--,1))}},n=0;n<e.length;n++)t(n)}var Sl=0,Pi=function(e,t,n,i,a){if(!(this instanceof Pi))return new Pi(e,t,n,i,a);n==null&&(n=0),Lr.call(this,[new Rr([new Mn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var L=We(n,0);this.sel=Cn(L),this.history=new Qr(null),this.id=++Sl,this.modeOption=t,this.lineSep=i,this.direction=a=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),ka(this,{from:L,to:L,text:e}),Si(this,Cn(L),ye)};Pi.prototype=ot(Lr.prototype,{constructor:Pi,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,i=0;i<t.length;++i)n+=t[i].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Ei(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:mi(function(e){var t=We(this.first,0),n=this.first+this.size-1;ir(this,{from:t,to:We(n,lt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&br(this.cm,0,0),Si(this,Cn(t),ye)}),replaceRange:function(e,t,n,i){t=v(this,t),n=n?v(this,n):t,nr(this,e,t,n,i)},getRange:function(e,t,n){var i=Ai(this,v(this,e),v(this,t));return n===!1?i:i.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if($i(this,e))return lt(this,e)},getLineNumber:function(e){return Mt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=lt(this,e)),Oi(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return v(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:mi(function(e,t,n){js(this,v(this,typeof e=="number"?We(e,t||0):e),null,n)}),setSelection:mi(function(e,t,n){js(this,v(this,e),v(this,t||e),n)}),extendSelection:mi(function(e,t,n){Zr(this,v(this,e),t&&v(this,t),n)}),extendSelections:mi(function(e,t){Bs(this,N(this,e),t)}),extendSelectionsBy:mi(function(e,t){var n=ze(this.sel.ranges,e);Bs(this,N(this,n),t)}),setSelections:mi(function(e,t,n){if(!e.length)return;for(var i=[],a=0;a<e.length;a++)i[a]=new zt(v(this,e[a].anchor),v(this,e[a].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Si(this,en(this.cm,i,t),n)}),addSelection:mi(function(e,t,n){var i=this.sel.ranges.slice(0);i.push(new zt(v(this,e),v(this,t||e))),Si(this,en(this.cm,i,i.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,i=0;i<t.length;i++){var a=Ai(this,t[i].from(),t[i].to());n=n?n.concat(a):a}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,i=0;i<n.length;i++){var a=Ai(this,n[i].from(),n[i].to());e!==!1&&(a=a.join(e||this.lineSeparator())),t[i]=a}return t},replaceSelection:function(e,t,n){for(var i=[],a=0;a<this.sel.ranges.length;a++)i[a]=e;this.replaceSelections(i,t,n||"+input")},replaceSelections:mi(function(e,t,n){for(var i=[],a=this.sel,L=0;L<a.ranges.length;L++){var H=a.ranges[L];i[L]={from:H.from(),to:H.to(),text:this.splitLines(e[L]),origin:n}}for(var X=t&&t!="end"&&cl(this,i,t),Q=i.length-1;Q>=0;Q--)ir(this,i[Q]);X?Hs(this,X):this.cm&&Zn(this.cm)}),undo:mi(function(){ta(this,"undo")}),redo:mi(function(){ta(this,"redo")}),undoSelection:mi(function(){ta(this,"undo",!0)}),redoSelection:mi(function(){ta(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,i=0;i<e.done.length;i++)e.done[i].ranges||++t;for(var a=0;a<e.undone.length;a++)e.undone[a].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Qr(this.history.maxGeneration),On(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:er(this.history.done),undone:er(this.history.undone)}},setHistory:function(e){var t=this.history=new Qr(this.history.maxGeneration);t.done=er(e.done.slice(0),null,!0),t.undone=er(e.undone.slice(0),null,!0)},setGutterMarker:mi(function(e,t,n){return Or(this,e,"gutter",function(i){var a=i.gutterMarkers||(i.gutterMarkers={});return a[t]=n,!n&&Ge(a)&&(i.gutterMarkers=null),!0})}),clearGutter:mi(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&Or(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Ge(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!$i(this,e))return null;if(t=e,e=lt(this,e),!e)return null}else if(t=Mt(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:mi(function(e,t,n){return Or(this,e,t=="gutter"?"gutter":"class",function(i){var a=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!i[a])i[a]=n;else{if(A(n).test(i[a]))return!1;i[a]+=" "+n}return!0})}),removeLineClass:mi(function(e,t,n){return Or(this,e,t=="gutter"?"gutter":"class",function(i){var a=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",L=i[a];if(L)if(n==null)i[a]=null;else{var H=L.match(A(n));if(!H)return!1;var X=H.index+H[0].length;i[a]=L.slice(0,H.index)+(!H.index||X==L.length?"":" ")+L.slice(X)||null}else return!1;return!0})}),addLineWidget:mi(function(e,t,n){return El(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return rr(this,v(this,e),v(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=v(this,e),rr(this,e,e,n,"bookmark")},findMarksAt:function(e){e=v(this,e);var t=[],n=lt(this,e.line).markedSpans;if(n)for(var i=0;i<n.length;++i){var a=n[i];(a.from==null||a.from<=e.ch)&&(a.to==null||a.to>=e.ch)&&t.push(a.marker.parent||a.marker)}return t},findMarks:function(e,t,n){e=v(this,e),t=v(this,t);var i=[],a=e.line;return this.iter(e.line,t.line+1,function(L){var H=L.markedSpans;if(H)for(var X=0;X<H.length;X++){var Q=H[X];!(Q.to!=null&&a==e.line&&e.ch>=Q.to||Q.from==null&&a!=e.line||Q.from!=null&&a==t.line&&Q.from>=t.ch)&&(!n||n(Q.marker))&&i.push(Q.marker.parent||Q.marker)}++a}),i},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var i=0;i<n.length;++i)n[i].from!=null&&e.push(n[i].marker)}),e},posFromIndex:function(e){var t,n=this.first,i=this.lineSeparator().length;return this.iter(function(a){var L=a.text.length+i;if(L>e)return t=e,!0;e-=L,++n}),v(this,We(n,t))},indexFromPos:function(e){e=v(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(i){t+=i.text.length+n}),t},copy:function(e){var t=new Pi(Ei(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var i=new Pi(Ei(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(i.history=this.history),(this.linked||(this.linked=[])).push({doc:i,sharedHist:e.sharedHist}),i.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Tl(i,to(this)),i},unlinkDoc:function(e){if(e instanceof ei&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(to(this));break}if(e.history==this.history){var i=[e.id];On(e,function(a){return i.push(a.id)},!0),e.history=new Qr(null),e.history.done=er(this.history.done,i),e.history.undone=er(this.history.undone,i)}},iterLinkedDocs:function(e){On(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):_t(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:mi(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)})}),Pi.prototype.eachLine=Pi.prototype.iter;var io=0;function Cl(e){var t=this;if(no(t),Ne(t,e)||dn(t.display,e))return;te(e),W&&(io=+new Date);var n=Fn(t,e,!0),i=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(i&&i.length&&window.FileReader&&window.File)for(var a=i.length,L=Array(a),H=0,X=function(){++H==a&&pi(t,function(){n=v(t.doc,n);var _e={from:n,to:n,text:t.doc.splitLines(L.filter(function(Ie){return Ie!=null}).join(t.doc.lineSeparator())),origin:"paste"};ir(t.doc,_e),Hs(t.doc,Cn(v(t.doc,n),v(t.doc,An(_e))))})()},Q=function(_e,Ie){if(t.options.allowDropFileTypes&&re(t.options.allowDropFileTypes,_e.type)==-1){X();return}var Be=new FileReader;Be.onerror=function(){return X()},Be.onload=function(){var Xe=Be.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Xe)){X();return}L[Ie]=Xe,X()},Be.readAsText(_e)},q=0;q<i.length;q++)Q(i[q],q);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var le=e.dataTransfer.getData("Text");if(le){var ce;if(t.state.draggingText&&!t.state.draggingText.copy&&(ce=t.listSelections()),qr(t.doc,Cn(n,n)),ce)for(var Ee=0;Ee<ce.length;++Ee)nr(t.doc,"",ce[Ee].anchor,ce[Ee].head,"drag");t.replaceSelection(le,"around","paste"),t.display.input.focus()}}catch(_e){}}}function Al(e,t){if(W&&(!e.state.draggingText||+new Date-io<100)){he(t);return}if(Ne(e,t)||dn(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!f){var n=h("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",c&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),c&&n.parentNode.removeChild(n)}}function Ol(e,t){var n=Fn(e,t);if(!n)return;var i=document.createDocumentFragment();ms(e,n,i),e.display.dragCursor||(e.display.dragCursor=h("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),y(e.display.dragCursor,i)}function no(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ro(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],i=0;i<t.length;i++){var a=t[i].CodeMirror;a&&n.push(a)}n.length&&n[0].operation(function(){for(var L=0;L<n.length;L++)e(n[L])})}var ao=!1;function Rl(){if(ao)return;Ll(),ao=!0}function Ll(){var e;Ae(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ro(Il)},100))}),Ae(window,"blur",function(){return ro(Jn)})}function Il(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Ln={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"},kr=0;kr<10;kr++)Ln[kr+48]=Ln[kr+96]=String(kr);for(var ia=65;ia<=90;ia++)Ln[ia]=String.fromCharCode(ia);for(var Mr=1;Mr<=12;Mr++)Ln[Mr+111]=Ln[Mr+63235]="F"+Mr;var cn={};cn.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"},cn.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"},cn.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"},cn.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"]},cn.default=l?cn.macDefault:cn.pcDefault;function Dl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,i,a,L,H=0;H<t.length-1;H++){var X=t[H];if(/^(cmd|meta|m)$/i.test(X))L=!0;else if(/^a(lt)?$/i.test(X))n=!0;else if(/^(c|ctrl|control)$/i.test(X))i=!0;else if(/^s(hift)?$/i.test(X))a=!0;else throw new Error("Unrecognized modifier name: "+X)}return n&&(e="Alt-"+e),i&&(e="Ctrl-"+e),L&&(e="Cmd-"+e),a&&(e="Shift-"+e),e}function kl(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(i=="..."){delete e[n];continue}for(var a=ze(n.split(" "),Dl),L=0;L<a.length;L++){var H=void 0,X=void 0;L==a.length-1?(X=a.join(" "),H=i):(X=a.slice(0,L+1).join(" "),H="...");var Q=t[X];if(!Q)t[X]=H;else if(Q!=H)throw new Error("Inconsistent bindings for "+X)}delete e[n]}for(var q in t)e[q]=t[q];return e}function ar(e,t,n,i){t=na(t);var a=t.call?t.call(e,i):t[e];if(a===!1)return"nothing";if(a==="...")return"multi";if(a!=null&&n(a))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return ar(e,t.fallthrough,n,i);for(var L=0;L<t.fallthrough.length;L++){var H=ar(e,t.fallthrough[L],n,i);if(H)return H}}}function so(e){var t=typeof e=="string"?e:Ln[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function oo(e,t,n){var i=e;return t.altKey&&i!="Alt"&&(e="Alt-"+e),(x?t.metaKey:t.ctrlKey)&&i!="Ctrl"&&(e="Ctrl-"+e),(x?t.ctrlKey:t.metaKey)&&i!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&i!="Shift"&&(e="Shift-"+e),e}function lo(e,t){if(c&&e.keyCode==34&&e.char)return!1;var n=Ln[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),oo(n,e,t))}function na(e){return typeof e=="string"?cn[e]:e}function sr(e,t){for(var n=e.doc.sel.ranges,i=[],a=0;a<n.length;a++){for(var L=t(n[a]);i.length&&At(L.from,Re(i).to)<=0;){var H=i.pop();if(At(H.from,L.from)<0){L.from=H.from;break}}i.push(L)}Hi(e,function(){for(var X=i.length-1;X>=0;X--)nr(e.doc,"",i[X].from,i[X].to,"+delete");Zn(e)})}function Fa(e,t,n){var i=Pe(e.text,t+n,n);return i<0||i>e.text.length?null:i}function Ua(e,t,n){var i=Fa(e,t.ch,n);return i==null?null:new We(t.line,i,n<0?"after":"before")}function Ba(e,t,n,i,a){if(e){t.doc.direction=="rtl"&&(a=-a);var L=nt(n,t.doc.direction);if(L){var H=a<0?Re(L):L[0],X=a<0==(H.level==1),Q=X?"after":"before",q;if(H.level>0||t.doc.direction=="rtl"){var le=Yn(t,n);q=a<0?n.text.length-1:0;var ce=sn(t,le,q).top;q=ut(function(Ee){return sn(t,le,Ee).top==ce},a<0==(H.level==1)?H.from:H.to-1,q),Q=="before"&&(q=Fa(n,q,1))}else q=a<0?H.to:H.from;return new We(i,q,Q)}}return new We(i,a<0?n.text.length:0,a<0?"before":"after")}function Ml(e,t,n,i){var a=nt(t,e.doc.direction);if(!a)return Ua(t,n,i);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var L=$e(a,n.ch,n.sticky),H=a[L];if(e.doc.direction=="ltr"&&H.level%2==0&&(i>0?H.to>n.ch:H.from<n.ch))return Ua(t,n,i);var X=function(at,dt){return Fa(t,at instanceof We?at.ch:at,dt)},Q,q=function(at){return e.options.lineWrapping?(Q=Q||Yn(e,t),ds(e,t,Q,at)):{begin:0,end:t.text.length}},le=q(n.sticky=="before"?X(n,-1):n.ch);if(e.doc.direction=="rtl"||H.level==1){var ce=H.level==1==i<0,Ee=X(n,ce?1:-1);if(Ee!=null&&(ce?Ee<=H.to&&Ee<=le.end:Ee>=H.from&&Ee>=le.begin)){var _e=ce?"before":"after";return new We(n.line,Ee,_e)}}var Ie=function(at,dt,st){for(var pt=function(Jt,gi){return gi?new We(n.line,X(Jt,1),"before"):new We(n.line,Jt,"after")};at>=0&&at<a.length;at+=dt){var wt=a[at],bt=dt>0==(wt.level!=1),Dt=bt?st.begin:X(st.end,-1);if(wt.from<=Dt&&Dt<wt.to)return pt(Dt,bt);if(Dt=bt?wt.from:X(wt.to,-1),st.begin<=Dt&&Dt<st.end)return pt(Dt,bt)}},Be=Ie(L+i,i,le);if(Be)return Be;var Xe=i>0?le.end:X(le.begin,-1);return Xe!=null&&!(i>0&&Xe==t.text.length)&&(Be=Ie(i>0?0:a.length-1,i,q(Xe)),Be)?Be:null}var Pr={selectAll:Vs,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ye)},killLine:function(e){return sr(e,function(t){if(t.empty()){var n=lt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:We(t.head.line+1,0)}:{from:t.head,to:We(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return sr(e,function(t){return{from:We(t.from().line,0),to:v(e.doc,We(t.to().line+1,0))}})},delLineLeft:function(e){return sr(e,function(t){return{from:We(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return sr(e,function(t){var n=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:n},"div");return{from:i,to:t.from()}})},delWrappedLineRight:function(e){return sr(e,function(t){var n=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:i}})},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(We(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(We(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return uo(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ho(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Pl(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},we)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},we)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:n},"div");return i.ch<e.getLine(i.line).search(/\S/)?ho(e,t.head):i},we)},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=[],n=e.listSelections(),i=e.options.tabSize,a=0;a<n.length;a++){var L=n[a].from(),H=$(e.getLine(L.line),L.ch,i);t.push(se(i-H%i))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Hi(e,function(){for(var t=e.listSelections(),n=[],i=0;i<t.length;i++){if(!t[i].empty())continue;var a=t[i].head,L=lt(e.doc,a.line).text;if(L){if(a.ch==L.length&&(a=new We(a.line,a.ch-1)),a.ch>0)a=new We(a.line,a.ch+1),e.replaceRange(L.charAt(a.ch-1)+L.charAt(a.ch-2),We(a.line,a.ch-2),a,"+transpose");else if(a.line>e.doc.first){var H=lt(e.doc,a.line-1).text;H&&(a=new We(a.line,1),e.replaceRange(L.charAt(0)+e.doc.lineSeparator()+H.charAt(H.length-1),We(a.line-1,H.length-1),a,"+transpose"))}}n.push(new zt(a,a))}e.setSelections(n)})},newlineAndIndent:function(e){return Hi(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var i=0;i<t.length;i++)e.indentLine(t[i].from().line,null,!0);Zn(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function uo(e,t){var n=lt(e.doc,t),i=Oi(n);return i!=n&&(t=Mt(i)),Ba(!0,e,i,t,1)}function Pl(e,t){var n=lt(e.doc,t),i=Xn(n);return i!=n&&(t=Mt(i)),Ba(!0,e,n,t,-1)}function ho(e,t){var n=uo(e,t.line),i=lt(e.doc,n.line),a=nt(i,e.doc.direction);if(!a||a[0].level==0){var L=Math.max(n.ch,i.text.search(/\S/)),H=t.line==n.line&&t.ch<=L&&t.ch;return We(n.line,H?0:L,n.sticky)}return n}function ra(e,t,n){if(typeof t=="string"&&(t=Pr[t],!t))return!1;e.display.input.ensurePolled();var i=e.display.shift,a=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),a=t(e)!=Te}finally{e.display.shift=i,e.state.suppressEdits=!1}return a}function Nl(e,t,n){for(var i=0;i<e.state.keyMaps.length;i++){var a=ar(t,e.state.keyMaps[i],n,e);if(a)return a}return e.options.extraKeys&&ar(t,e.options.extraKeys,n,e)||ar(t,e.options.keyMap,n,e)}var Fl=new ee;function Nr(e,t,n,i){var a=e.state.keySeq;if(a){if(so(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==a&&(e.state.keySeq=null,e.display.input.reset())}),co(e,a+" "+t,n,i))return!0}return co(e,t,n,i)}function co(e,t,n,i){var a=Nl(e,t,i);return a=="multi"&&(e.state.keySeq=t),a=="handled"&&_i(e,"keyHandled",e,t,n),(a=="handled"||a=="multi")&&(te(n),xa(e)),!!a}function fo(e,t){var n=lo(t,!0);return n?t.shiftKey&&!e.state.keySeq?Nr(e,"Shift-"+n,t,function(i){return ra(e,i,!0)})||Nr(e,n,t,function(i){if(typeof i=="string"?/^go[A-Z]/.test(i):i.motion)return ra(e,i)}):Nr(e,n,t,function(i){return ra(e,i)}):!1}function Ul(e,t,n){return Nr(e,"'"+n+"'",t,function(i){return ra(e,i,!0)})}var ja=null;function po(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=M(),Ne(t,e))return;W&&j<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var i=fo(t,e);c&&(ja=i?n:null,!i&&n==88&&!Ft&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),D&&!l&&!i&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;P(t,"CodeMirror-crosshair");function n(i){(i.keyCode==18||!i.altKey)&&(T(t,"CodeMirror-crosshair"),Je(document,"keyup",n),Je(document,"mouseover",n))}Ae(document,"keyup",n),Ae(document,"mouseover",n)}function mo(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ne(this,e)}function go(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(dn(t.display,e)||Ne(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var n=e.keyCode,i=e.charCode;if(c&&n==ja){ja=null,te(e);return}if(c&&(!e.which||e.which<10)&&fo(t,e))return;var a=String.fromCharCode(i==null?n:i);if(a=="\b")return;if(Ul(t,e,a))return;t.display.input.onKeyPress(e)}var jl=400,Ha=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ha.prototype.compare=function(e,t,n){return this.time+jl>e&&At(t,this.pos)==0&&n==this.button};var Fr,Ur;function Hl(e,t){var n=+new Date;return Ur&&Ur.compare(n,e,t)?(Fr=Ur=null,"triple"):Fr&&Fr.compare(n,e,t)?(Ur=new Ha(n,e,t),Fr=null,"double"):(Fr=new Ha(n,e,t),Ur=null,"single")}function vo(e){var t=this,n=t.display;if(Ne(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,dn(n,e)){k||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Wa(t,e))return;var i=Fn(t,e),a=Ce(e),L=i?Hl(i,a):"single";if(window.focus(),a==1&&t.state.selectingText&&t.state.selectingText(e),i&&Wl(t,a,i,L,e))return;a==1?i?zl(t,i,L,e):ge(e)==n.scroller&&te(e):a==2?(i&&Zr(t.doc,i),setTimeout(function(){return n.input.focus()},20)):a==3&&(O?t.display.input.onContextMenu(e):vs(t))}function Wl(e,t,n,i,a){var L="Click";return i=="double"?L="Double"+L:i=="triple"&&(L="Triple"+L),L=(t==1?"Left":t==2?"Middle":"Right")+L,Nr(e,oo(L,a),a,function(H){if(typeof H=="string"&&(H=Pr[H]),!H)return!1;var X=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),X=H(e,n)!=Te}finally{e.state.suppressEdits=!1}return X})}function Gl(e,t,n){var i=e.getOption("configureMouse"),a=i?i(e,t,n):{};if(a.unit==null){var L=p?n.shiftKey&&n.metaKey:n.altKey;a.unit=L?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(a.extend==null||e.doc.extend)&&(a.extend=e.doc.extend||n.shiftKey),a.addNew==null&&(a.addNew=l?n.metaKey:n.ctrlKey),a.moveOnDrag==null&&(a.moveOnDrag=!(l?n.altKey:n.ctrlKey)),a}function zl(e,t,n,i){W?setTimeout(B(gs,e),0):e.curOp.focus=M();var a=Gl(e,n,i),L=e.doc.sel,H;e.options.dragDrop&&De&&!e.isReadOnly()&&n=="single"&&(H=L.contains(t))>-1&&(At((H=L.ranges[H]).from(),t)<0||t.xRel>0)&&(At(H.to(),t)>0||t.xRel<0)?Kl(e,i,t,a):Vl(e,i,t,a)}function Kl(e,t,n,i){var a=e.display,L=!1,H=pi(e,function(q){k&&(a.scroller.draggable=!1),e.state.draggingText=!1,Je(a.wrapper.ownerDocument,"mouseup",H),Je(a.wrapper.ownerDocument,"mousemove",X),Je(a.scroller,"dragstart",Q),Je(a.scroller,"drop",H),L||(te(q),i.addNew||Zr(e.doc,n,null,null,i.extend),k&&!f||W&&j==9?setTimeout(function(){a.wrapper.ownerDocument.body.focus({preventScroll:!0}),a.input.focus()},20):a.input.focus())}),X=function(q){L=L||Math.abs(t.clientX-q.clientX)+Math.abs(t.clientY-q.clientY)>=10},Q=function(){return L=!0};k&&(a.scroller.draggable=!0),e.state.draggingText=H,H.copy=!i.moveOnDrag,a.scroller.dragDrop&&a.scroller.dragDrop(),Ae(a.wrapper.ownerDocument,"mouseup",H),Ae(a.wrapper.ownerDocument,"mousemove",X),Ae(a.scroller,"dragstart",Q),Ae(a.scroller,"drop",H),vs(e),setTimeout(function(){return a.input.focus()},20)}function yo(e,t,n){if(n=="char")return new zt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new zt(We(t.line,0),v(e.doc,We(t.line+1,0)));var i=n(e,t);return new zt(i.from,i.to)}function Vl(e,t,n,i){var a=e.display,L=e.doc;te(t);var H,X,Q=L.sel,q=Q.ranges;if(i.addNew&&!i.extend?(X=L.sel.contains(n),X>-1?H=q[X]:H=new zt(n,n)):(H=L.sel.primary(),X=L.sel.primIndex),i.unit=="rectangle")i.addNew||(H=new zt(n,n)),n=Fn(e,t,!0,!0),X=-1;else{var le=yo(e,n,i.unit);i.extend?H=Pa(H,le.anchor,le.head,i.extend):H=le}i.addNew?X==-1?(X=q.length,Si(L,en(e,q.concat([H]),X),{scroll:!1,origin:"*mouse"})):q.length>1&&q[X].empty()&&i.unit=="char"&&!i.extend?(Si(L,en(e,q.slice(0,X).concat(q.slice(X+1)),0),{scroll:!1,origin:"*mouse"}),Q=L.sel):Na(L,X,H,be):(X=0,Si(L,new Vi([H],0),be),Q=L.sel);var ce=n;function Ee(st){if(At(ce,st)==0)return;if(ce=st,i.unit=="rectangle"){for(var pt=[],wt=e.options.tabSize,bt=$(lt(L,n.line).text,n.ch,wt),Dt=$(lt(L,st.line).text,st.ch,wt),Jt=Math.min(bt,Dt),gi=Math.max(bt,Dt),ti=Math.min(n.line,st.line),Wi=Math.min(e.lastLine(),Math.max(n.line,st.line));ti<=Wi;ti++){var Ni=lt(L,ti).text,oi=xe(Ni,Jt,wt);Jt==gi?pt.push(new zt(We(ti,oi),We(ti,oi))):Ni.length>oi&&pt.push(new zt(We(ti,oi),We(ti,xe(Ni,gi,wt))))}pt.length||pt.push(new zt(n,n)),Si(L,en(e,Q.ranges.slice(0,X).concat(pt),X),{origin:"*mouse",scroll:!1}),e.scrollIntoView(st)}else{var Fi=H,bi=yo(e,st,i.unit),hi=Fi.anchor,li;At(bi.anchor,hi)>0?(li=bi.head,hi=yn(Fi.from(),bi.anchor)):(li=bi.anchor,hi=vn(Fi.to(),bi.head));var ni=Q.ranges.slice(0);ni[X]=Xl(e,new zt(v(L,hi),li)),Si(L,en(e,ni,X),be)}}var _e=a.wrapper.getBoundingClientRect(),Ie=0;function Be(st){var pt=++Ie,wt=Fn(e,st,!0,i.unit=="rectangle");if(!wt)return;if(At(wt,ce)!=0){e.curOp.focus=M(),Ee(wt);var bt=Vr(a,L);(wt.line>=bt.to||wt.line<bt.from)&&setTimeout(pi(e,function(){Ie==pt&&Be(st)}),150)}else{var Dt=st.clientY<_e.top?-20:st.clientY>_e.bottom?20:0;Dt&&setTimeout(pi(e,function(){if(Ie!=pt)return;a.scroller.scrollTop+=Dt,Be(st)}),50)}}function Xe(st){e.state.selectingText=!1,Ie=Infinity,st&&(te(st),a.input.focus()),Je(a.wrapper.ownerDocument,"mousemove",at),Je(a.wrapper.ownerDocument,"mouseup",dt),L.history.lastSelOrigin=null}var at=pi(e,function(st){st.buttons===0||!Ce(st)?Xe(st):Be(st)}),dt=pi(e,Xe);e.state.selectingText=dt,Ae(a.wrapper.ownerDocument,"mousemove",at),Ae(a.wrapper.ownerDocument,"mouseup",dt)}function Xl(e,t){var n=t.anchor,i=t.head,a=lt(e.doc,n.line);if(At(n,i)==0&&n.sticky==i.sticky)return t;var L=nt(a);if(!L)return t;var H=$e(L,n.ch,n.sticky),X=L[H];if(X.from!=n.ch&&X.to!=n.ch)return t;var Q=H+(X.from==n.ch==(X.level!=1)?0:1);if(Q==0||Q==L.length)return t;var q;if(i.line!=n.line)q=(i.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var le=$e(L,i.ch,i.sticky),ce=le-H||(i.ch-n.ch)*(X.level==1?-1:1);le==Q-1||le==Q?q=ce<0:q=ce>0}var Ee=L[Q+(q?-1:0)],_e=q==(Ee.level==1),Ie=_e?Ee.from:Ee.to,Be=_e?"after":"before";return n.ch==Ie&&n.sticky==Be?t:new zt(new We(n.line,Ie,Be),i)}function _o(e,t,n,i){var a,L;if(t.touches)a=t.touches[0].clientX,L=t.touches[0].clientY;else try{a=t.clientX,L=t.clientY}catch(Ee){return!1}if(a>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&te(t);var H=e.display,X=H.lineDiv.getBoundingClientRect();if(L>X.bottom||!de(e,n))return oe(t);L-=X.top-H.viewOffset;for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var q=H.gutters.childNodes[Q];if(q&&q.getBoundingClientRect().right>=a){var le=Gi(e.doc,L),ce=e.display.gutterSpecs[Q];return Se(e,n,e,le,ce.className,t),oe(t)}}}function Wa(e,t){return _o(e,t,"gutterClick",!0)}function bo(e,t){if(dn(e.display,t)||Yl(e,t))return;if(Ne(e,t,"contextmenu"))return;O||e.display.input.onContextMenu(t)}function Yl(e,t){return de(e,"gutterContextMenu")?_o(e,t,"gutterContextMenu",!1):!1}function Eo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),yr(e)}var or={toString:function(){return"CodeMirror.Init"}},xo={},aa={};function $l(e){var t=e.optionHandlers;function n(i,a,L,H){e.defaults[i]=a,L&&(t[i]=H?function(X,Q,q){q!=or&&L(X,Q,q)}:L)}e.defineOption=n,e.Init=or,n("value","",function(i,a){return i.setValue(a)},!0),n("mode",null,function(i,a){i.doc.modeOption=a,Da(i)},!0),n("indentUnit",2,Da,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(i){Cr(i),yr(i),Mi(i)},!0),n("lineSeparator",null,function(i,a){if(i.doc.lineSep=a,!a)return;var L=[],H=i.doc.first;i.doc.iter(function(Q){for(var q=0;;){var le=Q.text.indexOf(a,q);if(le==-1)break;q=le+a.length,L.push(We(H,le))}H++});for(var X=L.length-1;X>=0;X--)nr(i.doc,a,L[X],We(L[X].line,L[X].ch+a.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(i,a,L){i.state.specialChars=new RegExp(a.source+(a.test(" ")?"":"| "),"g"),L!=or&&i.refresh()}),n("specialCharPlaceholder",Qt,function(i){return i.refresh()},!0),n("electricChars",!0),n("inputStyle",s?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(i,a){return i.getInputField().spellcheck=a},!0),n("autocorrect",!1,function(i,a){return i.getInputField().autocorrect=a},!0),n("autocapitalize",!1,function(i,a){return i.getInputField().autocapitalize=a},!0),n("rtlMoveVisually",!R),n("wholeLineUpdateBefore",!0),n("theme","default",function(i){Eo(i),Sr(i)},!0),n("keyMap","default",function(i,a,L){var H=na(a),X=L!=or&&na(L);X&&X.detach&&X.detach(i,H),H.attach&&H.attach(i,X||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(i,a){i.display.gutterSpecs=La(a,i.options.lineNumbers),Sr(i)},!0),n("fixedGutter",!0,function(i,a){i.display.gutters.style.left=a?ba(i.display)+"px":"0",i.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(i){return qn(i)},!0),n("scrollbarStyle","native",function(i){Ts(i),qn(i),i.display.scrollbars.setScrollTop(i.doc.scrollTop),i.display.scrollbars.setScrollLeft(i.doc.scrollLeft)},!0),n("lineNumbers",!1,function(i,a){i.display.gutterSpecs=La(i.options.gutters,a),Sr(i)},!0),n("firstLineNumber",1,Sr,!0),n("lineNumberFormatter",function(i){return i},Sr,!0),n("showCursorWhenSelecting",!1,_r,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(i,a){a=="nocursor"&&(Jn(i),i.display.input.blur()),i.display.input.readOnlyChanged(a)}),n("screenReaderLabel",null,function(i,a){a=a===""?null:a,i.display.input.screenReaderLabelChanged(a)}),n("disableInput",!1,function(i,a){a||i.display.input.reset()},!0),n("dragDrop",!0,Ql),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,_r,!0),n("singleCursorHeightPerLine",!0,_r,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Cr,!0),n("addModeClass",!1,Cr,!0),n("pollInterval",100),n("undoDepth",200,function(i,a){return i.doc.history.undoDepth=a}),n("historyEventDelay",1250),n("viewportMargin",10,function(i){return i.refresh()},!0),n("maxHighlightLength",1e4,Cr,!0),n("moveInputWithCursor",!0,function(i,a){a||i.display.input.resetPosition()}),n("tabindex",null,function(i,a){return i.display.input.getField().tabIndex=a||""}),n("autofocus",null),n("direction","ltr",function(i,a){return i.doc.setDirection(a)},!0),n("phrases",null)}function Ql(e,t,n){var i=n&&n!=or;if(!t!=!i){var a=e.display.dragFunctions,L=t?Ae:Je;L(e.display.scroller,"dragstart",a.start),L(e.display.scroller,"dragenter",a.enter),L(e.display.scroller,"dragover",a.over),L(e.display.scroller,"dragleave",a.leave),L(e.display.scroller,"drop",a.drop)}}function Jl(e){e.options.lineWrapping?(P(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(T(e.display.wrapper,"CodeMirror-wrap"),jr(e)),Ea(e),Mi(e),yr(e),setTimeout(function(){return qn(e)},100)}function ei(e,t){var n=this;if(!(this instanceof ei))return new ei(e,t);this.options=t=t?C(t):{},C(xo,t,!1);var i=t.value;typeof i=="string"?i=new Pi(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var a=new ei.inputStyles[t.inputStyle](this),L=this.display=new hl(e,i,a,t);L.wrapper.CodeMirror=this,Eo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ts(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new ee,keySeq:null,specialChars:null},t.autofocus&&!s&&L.input.focus(),W&&j<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Rl(),Hn(this),this.curOp.forceUpdate=!0,ks(this,i),t.autofocus&&!s||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ta(n)},20):Jn(this);for(var H in aa)aa.hasOwnProperty(H)&&aa[H](this,t[H],or);Cs(this),t.finishInit&&t.finishInit(this);for(var X=0;X<Ga.length;++X)Ga[X](this);Wn(this),k&&t.lineWrapping&&getComputedStyle(L.lineDiv).textRendering=="optimizelegibility"&&(L.lineDiv.style.textRendering="auto")}ei.defaults=xo,ei.optionHandlers=aa;function Zl(e){var t=e.display;Ae(t.scroller,"mousedown",pi(e,vo)),W&&j<11?Ae(t.scroller,"dblclick",pi(e,function(Q){if(Ne(e,Q))return;var q=Fn(e,Q);if(!q||Wa(e,Q)||dn(e.display,Q))return;te(Q);var le=e.findWordAt(q);Zr(e.doc,le.anchor,le.head)})):Ae(t.scroller,"dblclick",function(Q){return Ne(e,Q)||te(Q)}),Ae(t.scroller,"contextmenu",function(Q){return bo(e,Q)}),Ae(t.input.getField(),"contextmenu",function(Q){t.scroller.contains(Q.target)||bo(e,Q)});var n,i={end:0};function a(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),i=t.activeTouch,i.end=+new Date)}function L(Q){if(Q.touches.length!=1)return!1;var q=Q.touches[0];return q.radiusX<=1&&q.radiusY<=1}function H(Q,q){if(q.left==null)return!0;var le=q.left-Q.left,ce=q.top-Q.top;return le*le+ce*ce>20*20}Ae(t.scroller,"touchstart",function(Q){if(!Ne(e,Q)&&!L(Q)&&!Wa(e,Q)){t.input.ensurePolled(),clearTimeout(n);var q=+new Date;t.activeTouch={start:q,moved:!1,prev:q-i.end<=300?i:null},Q.touches.length==1&&(t.activeTouch.left=Q.touches[0].pageX,t.activeTouch.top=Q.touches[0].pageY)}}),Ae(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ae(t.scroller,"touchend",function(Q){var q=t.activeTouch;if(q&&!dn(t,Q)&&q.left!=null&&!q.moved&&new Date-q.start<300){var le=e.coordsChar(t.activeTouch,"page"),ce;!q.prev||H(q,q.prev)?ce=new zt(le,le):!q.prev.prev||H(q,q.prev.prev)?ce=e.findWordAt(le):ce=new zt(We(le.line,0),v(e.doc,We(le.line+1,0))),e.setSelection(ce.anchor,ce.head),e.focus(),te(Q)}a()}),Ae(t.scroller,"touchcancel",a),Ae(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Er(e,t.scroller.scrollTop),Bn(e,t.scroller.scrollLeft,!0),Se(e,"scroll",e))}),Ae(t.scroller,"mousewheel",function(Q){return Rs(e,Q)}),Ae(t.scroller,"DOMMouseScroll",function(Q){return Rs(e,Q)}),Ae(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Q){Ne(e,Q)||he(Q)},over:function(Q){Ne(e,Q)||(Ol(e,Q),he(Q))},start:function(Q){return Al(e,Q)},drop:pi(e,Cl),leave:function(Q){Ne(e,Q)||no(e)}};var X=t.input.getField();Ae(X,"keyup",function(Q){return mo.call(e,Q)}),Ae(X,"keydown",pi(e,po)),Ae(X,"keypress",pi(e,go)),Ae(X,"focus",function(Q){return Ta(e,Q)}),Ae(X,"blur",function(Q){return Jn(e,Q)})}var Ga=[];ei.defineInitHook=function(e){return Ga.push(e)};function Br(e,t,n,i){var a=e.doc,L;n==null&&(n="add"),n=="smart"&&(a.mode.indent?L=Ze(e,t).state:n="prev");var H=e.options.tabSize,X=lt(a,t),Q=$(X.text,null,H);X.stateAfter&&(X.stateAfter=null);var q=X.text.match(/^\s*/)[0],le;if(!i&&!/\S/.test(X.text))le=0,n="not";else if(n=="smart"&&(le=a.mode.indent(L,X.text.slice(q.length),X.text),le==Te||le>150)){if(!i)return;n="prev"}n=="prev"?t>a.first?le=$(lt(a,t-1).text,null,H):le=0:n=="add"?le=Q+e.options.indentUnit:n=="subtract"?le=Q-e.options.indentUnit:typeof n=="number"&&(le=Q+n),le=Math.max(0,le);var ce="",Ee=0;if(e.options.indentWithTabs)for(var _e=Math.floor(le/H);_e;--_e)Ee+=H,ce+=" ";if(Ee<le&&(ce+=se(le-Ee)),ce!=q)return nr(a,ce,We(t,0),We(t,q.length),"+input"),X.stateAfter=null,!0;for(var Ie=0;Ie<a.sel.ranges.length;Ie++){var Be=a.sel.ranges[Ie];if(Be.head.line==t&&Be.head.ch<q.length){var Xe=We(t,q.length);Na(a,Ie,new zt(Xe,Xe));break}}}var tn=null;function sa(e){tn=e}function za(e,t,n,i,a){var L=e.doc;e.display.shift=!1,i||(i=L.sel);var H=+new Date-200,X=a=="paste"||e.state.pasteIncoming>H,Q=_t(t),q=null;if(X&&i.ranges.length>1)if(tn&&tn.text.join(`
|
|
`)==t){if(i.ranges.length%tn.text.length==0){q=[];for(var le=0;le<tn.text.length;le++)q.push(L.splitLines(tn.text[le]))}}else Q.length==i.ranges.length&&e.options.pasteLinesPerSelection&&(q=ze(Q,function(at){return[at]}));for(var ce=e.curOp.updateInput,Ee=i.ranges.length-1;Ee>=0;Ee--){var _e=i.ranges[Ee],Ie=_e.from(),Be=_e.to();_e.empty()&&(n&&n>0?Ie=We(Ie.line,Ie.ch-n):e.state.overwrite&&!X?Be=We(Be.line,Math.min(lt(L,Be.line).text.length,Be.ch+Re(Q).length)):X&&tn&&tn.lineWise&&tn.text.join(`
|
|
`)==Q.join(`
|
|
`)&&(Ie=Be=We(Ie.line,0)));var Xe={from:Ie,to:Be,text:q?q[Ee%q.length]:Q,origin:a||(X?"paste":e.state.cutIncoming>H?"cut":"+input")};ir(e.doc,Xe),_i(e,"inputRead",e,Xe)}t&&!X&&wo(e,t),Zn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ce),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function To(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Hi(t,function(){return za(t,n,0,null,"paste")}),!0}function wo(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,i=n.ranges.length-1;i>=0;i--){var a=n.ranges[i];if(a.head.ch>100||i&&n.ranges[i-1].head.line==a.head.line)continue;var L=e.getModeAt(a.head),H=!1;if(L.electricChars){for(var X=0;X<L.electricChars.length;X++)if(t.indexOf(L.electricChars.charAt(X))>-1){H=Br(e,a.head.line,"smart");break}}else L.electricInput&&(L.electricInput.test(lt(e.doc,a.head.line).text.slice(0,a.head.ch))&&(H=Br(e,a.head.line,"smart")));H&&_i(e,"electricInput",e,a.head.line)}}function So(e){for(var t=[],n=[],i=0;i<e.doc.sel.ranges.length;i++){var a=e.doc.sel.ranges[i].head.line,L={anchor:We(a,0),head:We(a+1,0)};n.push(L),t.push(e.getRange(L.anchor,L.head))}return{text:t,ranges:n}}function Co(e,t,n,i){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",i?"":"off"),e.setAttribute("spellcheck",!!t)}function Ao(){var e=h("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=h("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return k?e.style.width="1000px":e.setAttribute("wrap","off"),d&&(e.style.border="1px solid black"),Co(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(i,a){var L=this.options,H=L[i];if(L[i]==a&&i!="mode")return;L[i]=a,t.hasOwnProperty(i)&&pi(this,t[i])(this,a,H),Se(this,"optionChange",this,i)},getOption:function(i){return this.options[i]},getDoc:function(){return this.doc},addKeyMap:function(i,a){this.state.keyMaps[a?"push":"unshift"](na(i))},removeKeyMap:function(i){for(var a=this.state.keyMaps,L=0;L<a.length;++L)if(a[L]==i||a[L].name==i)return a.splice(L,1),!0},addOverlay:Ri(function(i,a){var L=i.token?i:e.getMode(this.options,i);if(L.startState)throw new Error("Overlays may not be stateful.");He(this.state.overlays,{mode:L,modeSpec:i,opaque:a&&a.opaque,priority:a&&a.priority||0},function(H){return H.priority}),this.state.modeGen++,Mi(this)}),removeOverlay:Ri(function(i){for(var a=this.state.overlays,L=0;L<a.length;++L){var H=a[L].modeSpec;if(H==i||typeof i=="string"&&H.name==i){a.splice(L,1),this.state.modeGen++,Mi(this);return}}}),indentLine:Ri(function(i,a,L){typeof a!="string"&&typeof a!="number"&&(a==null?a=this.options.smartIndent?"smart":"prev":a=a?"add":"subtract"),$i(this.doc,i)&&Br(this,i,a,L)}),indentSelection:Ri(function(i){for(var a=this.doc.sel.ranges,L=-1,H=0;H<a.length;H++){var X=a[H];if(X.empty())X.head.line>L&&(Br(this,X.head.line,i,!0),L=X.head.line,H==this.doc.sel.primIndex&&Zn(this));else{var Q=X.from(),q=X.to(),le=Math.max(L,Q.line);L=Math.min(this.lastLine(),q.line-(q.ch?0:1))+1;for(var ce=le;ce<L;++ce)Br(this,ce,i);var Ee=this.doc.sel.ranges;Q.ch==0&&a.length==Ee.length&&Ee[H].from().ch>0&&Na(this.doc,H,new zt(Q,Ee[H].to()),ye)}}}),getTokenAt:function(i,a){return Zt(this,i,a)},getLineTokens:function(i,a){return Zt(this,We(i),a,!0)},getTokenTypeAt:function(i){i=v(this.doc,i);var a=ke(this,lt(this.doc,i.line)),L=0,H=(a.length-1)/2,X=i.ch,Q;if(X==0)Q=a[2];else for(;;){var q=L+H>>1;if((q?a[q*2-1]:0)>=X)H=q;else if(a[q*2+1]<X)L=q+1;else{Q=a[q*2+2];break}}var le=Q?Q.indexOf("overlay "):-1;return le<0?Q:le==0?null:Q.slice(0,le-1)},getModeAt:function(i){var a=this.doc.mode;return a.innerMode?e.innerMode(a,this.getTokenAt(i).state).mode:a},getHelper:function(i,a){return this.getHelpers(i,a)[0]},getHelpers:function(i,a){var L=[];if(!n.hasOwnProperty(a))return L;var H=n[a],X=this.getModeAt(i);if(typeof X[a]=="string")H[X[a]]&&L.push(H[X[a]]);else if(X[a])for(var Q=0;Q<X[a].length;Q++){var q=H[X[a][Q]];q&&L.push(q)}else X.helperType&&H[X.helperType]?L.push(H[X.helperType]):H[X.name]&&L.push(H[X.name]);for(var le=0;le<H._global.length;le++){var ce=H._global[le];ce.pred(X,this)&&re(L,ce.val)==-1&&L.push(ce.val)}return L},getStateAfter:function(i,a){var L=this.doc;return i=z(L,i==null?L.first+L.size-1:i),Ze(this,i+1,a).state},cursorCoords:function(i,a){var L,H=this.doc.sel.primary();return i==null?L=H.head:typeof i=="object"?L=v(this.doc,i):L=i?H.from():H.to(),qi(this,L,a||"page")},charCoords:function(i,a){return ma(this,v(this.doc,i),a||"page")},coordsChar:function(i,a){return i=ls(this,i,a||"page"),va(this,i.left,i.top)},lineAtHeight:function(i,a){return i=ls(this,{top:i,left:0},a||"page").top,Gi(this.doc,i+this.display.viewOffset)},heightAtLine:function(i,a,L){var H=!1,X;if(typeof i=="number"){var Q=this.doc.first+this.doc.size-1;i<this.doc.first?i=this.doc.first:i>Q&&(i=Q,H=!0),X=lt(this.doc,i)}else X=i;return Wr(this,X,{top:0,left:0},a||"page",L||H).top+(H?this.doc.height-Zi(X):0)},defaultTextHeight:function(){return $n(this.display)},defaultCharWidth:function(){return Qn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(i,a,L,H,X){var Q=this.display;i=qi(this,v(this.doc,i));var q=i.bottom,le=i.left;if(a.style.position="absolute",a.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(a),Q.sizer.appendChild(a),H=="over")q=i.top;else if(H=="above"||H=="near"){var ce=Math.max(Q.wrapper.clientHeight,this.doc.height),Ee=Math.max(Q.sizer.clientWidth,Q.lineSpace.clientWidth);(H=="above"||i.bottom+a.offsetHeight>ce)&&i.top>a.offsetHeight?q=i.top-a.offsetHeight:i.bottom+a.offsetHeight<=ce&&(q=i.bottom),le+a.offsetWidth>Ee&&(le=Ee-a.offsetWidth)}a.style.top=q+"px",a.style.left=a.style.right="",X=="right"?(le=Q.sizer.clientWidth-a.offsetWidth,a.style.right="0px"):(X=="left"?le=0:X=="middle"&&(le=(Q.sizer.clientWidth-a.offsetWidth)/2),a.style.left=le+"px"),L&&Qo(this,{left:le,top:q,right:le+a.offsetWidth,bottom:q+a.offsetHeight})},triggerOnKeyDown:Ri(po),triggerOnKeyPress:Ri(go),triggerOnKeyUp:mo,triggerOnMouseDown:Ri(vo),execCommand:function(i){if(Pr.hasOwnProperty(i))return Pr[i].call(null,this)},triggerElectric:Ri(function(i){wo(this,i)}),findPosH:function(i,a,L,H){var X=1;a<0&&(X=-1,a=-a);for(var Q=v(this.doc,i),q=0;q<a&&!(Q=Ka(this.doc,Q,X,L,H),Q.hitSide);++q);return Q},moveH:Ri(function(i,a){var L=this;this.extendSelectionsBy(function(H){return L.display.shift||L.doc.extend||H.empty()?Ka(L.doc,H.head,i,a,L.options.rtlMoveVisually):i<0?H.from():H.to()},we)}),deleteH:Ri(function(i,a){var L=this.doc.sel,H=this.doc;L.somethingSelected()?H.replaceSelection("",null,"+delete"):sr(this,function(X){var Q=Ka(H,X.head,i,a,!1);return i<0?{from:Q,to:X.head}:{from:X.head,to:Q}})}),findPosV:function(i,a,L,H){var X=1,Q=H;a<0&&(X=-1,a=-a);for(var q=v(this.doc,i),le=0;le<a;++le){var ce=qi(this,q,"div");if(Q==null?Q=ce.left:ce.left=Q,q=Oo(this,ce,X,L),q.hitSide)break}return q},moveV:Ri(function(i,a){var L=this,H=this.doc,X=[],Q=!this.display.shift&&!H.extend&&H.sel.somethingSelected();if(H.extendSelectionsBy(function(le){if(Q)return i<0?le.from():le.to();var ce=qi(L,le.head,"div");le.goalColumn!=null&&(ce.left=le.goalColumn),X.push(ce.left);var Ee=Oo(L,ce,i,a);return a=="page"&&le==H.sel.primary()&&Sa(L,ma(L,Ee,"div").top-ce.top),Ee},we),X.length)for(var q=0;q<H.sel.ranges.length;q++)H.sel.ranges[q].goalColumn=X[q]}),findWordAt:function(i){var a=this.doc,L=lt(a,i.line).text,H=i.ch,X=i.ch;if(L){var Q=this.getHelper(i,"wordChars");(i.sticky=="before"||X==L.length)&&H?--H:++X;for(var q=L.charAt(H),le=Ue(q,Q)?function(ce){return Ue(ce,Q)}:/\s/.test(q)?function(ce){return/\s/.test(ce)}:function(ce){return!/\s/.test(ce)&&!Ue(ce)};H>0&&le(L.charAt(H-1));)--H;for(;X<L.length&&le(L.charAt(X));)++X}return new zt(We(i.line,H),We(i.line,X))},toggleOverwrite:function(i){if(i!=null&&i==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?P(this.display.cursorDiv,"CodeMirror-overwrite"):T(this.display.cursorDiv,"CodeMirror-overwrite"),Se(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==M()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Ri(function(i,a){br(this,i,a)}),getScrollInfo:function(){var i=this.display.scroller;return{left:i.scrollLeft,top:i.scrollTop,height:i.scrollHeight-an(this)-this.display.barHeight,width:i.scrollWidth-an(this)-this.display.barWidth,clientHeight:ca(this),clientWidth:Pn(this)}},scrollIntoView:Ri(function(i,a){i==null?(i={from:this.doc.sel.primary().head,to:null},a==null&&(a=this.options.cursorScrollMargin)):typeof i=="number"?i={from:We(i,0),to:null}:i.from==null&&(i={from:i,to:null}),i.to||(i.to=i.from),i.margin=a||0,i.from.line!=null?Jo(this,i):_s(this,i.from,i.to,i.margin)}),setSize:Ri(function(i,a){var L=this,H=function(Q){return typeof Q=="number"||/^\d+$/.test(String(Q))?Q+"px":Q};i!=null&&(this.display.wrapper.style.width=H(i)),a!=null&&(this.display.wrapper.style.height=H(a)),this.options.lineWrapping&&as(this);var X=this.display.viewFrom;this.doc.iter(X,this.display.viewTo,function(Q){if(Q.widgets){for(var q=0;q<Q.widgets.length;q++)if(Q.widgets[q].noHScroll){wn(L,X,"widget");break}}++X}),this.curOp.forceUpdate=!0,Se(this,"refresh",this)}),operation:function(i){return Hi(this,i)},startOperation:function(){return Hn(this)},endOperation:function(){return Wn(this)},refresh:Ri(function(){var i=this.display.cachedTextHeight;Mi(this),this.curOp.forceUpdate=!0,yr(this),br(this,this.doc.scrollLeft,this.doc.scrollTop),Oa(this.display),(i==null||Math.abs(i-$n(this.display))>.5||this.options.lineWrapping)&&Ea(this),Se(this,"refresh",this)}),swapDoc:Ri(function(i){var a=this.doc;return a.cm=null,this.state.selectingText&&this.state.selectingText(),ks(this,i),yr(this),this.display.input.reset(),br(this,i.scrollLeft,i.scrollTop),this.curOp.forceScroll=!0,_i(this,"swapDoc",this,a),a}),phrase:function(i){var a=this.options.phrases;return a&&Object.prototype.hasOwnProperty.call(a,i)?a[i]:i},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}},pe(e),e.registerHelper=function(i,a,L){n.hasOwnProperty(i)||(n[i]=e[i]={_global:[]}),n[i][a]=L},e.registerGlobalHelper=function(i,a,L,H){e.registerHelper(i,a,H),n[i]._global.push({pred:L,val:H})}}function Ka(e,t,n,i,a){var L=t,H=n,X=lt(e,t.line),Q=a&&e.direction=="rtl"?-n:n;function q(){var dt=t.line+Q;return dt<e.first||dt>=e.first+e.size?!1:(t=new We(dt,t.ch,t.sticky),X=lt(e,dt))}function le(dt){var st;if(i=="codepoint"){var pt=X.text.charCodeAt(t.ch+(i>0?0:-1));isNaN(pt)?st=null:st=new We(t.line,Math.max(0,Math.min(X.text.length,t.ch+n*(pt>=55296&&pt<56320?2:1))),-n)}else a?st=Ml(e.cm,X,t,n):st=Ua(X,t,n);if(st==null)if(!dt&&q())t=Ba(a,e.cm,X,t.line,Q);else return!1;else t=st;return!0}if(i=="char"||i=="codepoint")le();else if(i=="column")le(!0);else if(i=="word"||i=="group")for(var ce=null,Ee=i=="group",_e=e.cm&&e.cm.getHelper(t,"wordChars"),Ie=!0;!(n<0&&!le(!Ie));Ie=!1){var Be=X.text.charAt(t.ch)||`
|
|
`,Xe=Ue(Be,_e)?"w":Ee&&Be==`
|
|
`?"n":!Ee||/\s/.test(Be)?null:"p";if(Ee&&!Ie&&!Xe&&(Xe="s"),ce&&ce!=Xe){n<0&&(n=1,le(),t.sticky="after");break}if(Xe&&(ce=Xe),n>0&&!le(!Ie))break}var at=ea(e,t,L,H,!0);return mn(L,at)&&(at.hitSide=!0),at}function Oo(e,t,n,i){var a=e.doc,L=t.left,H;if(i=="page"){var X=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Q=Math.max(X-.5*$n(e.display),3);H=(n>0?t.bottom:t.top)+n*Q}else i=="line"&&(H=n>0?t.bottom+3:t.top-3);for(var q;!(q=va(e,L,H),!q.outside);){if(n<0?H<=0:H>=a.height){q.hitSide=!0;break}H+=n*5}return q}var Xt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ee,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Xt.prototype.init=function(e){var t=this,n=this,i=n.cm,a=n.div=e.lineDiv;Co(a,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize);function L(X){for(var Q=X.target;Q;Q=Q.parentNode){if(Q==a)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Q.className))break}return!1}Ae(a,"paste",function(X){if(!L(X)||Ne(i,X)||To(X,i))return;j<=11&&setTimeout(pi(i,function(){return t.updateFromDOM()}),20)}),Ae(a,"compositionstart",function(X){t.composing={data:X.data,done:!1}}),Ae(a,"compositionupdate",function(X){t.composing||(t.composing={data:X.data,done:!1})}),Ae(a,"compositionend",function(X){t.composing&&(X.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ae(a,"touchstart",function(){return n.forceCompositionEnd()}),Ae(a,"input",function(){t.composing||t.readFromDOMSoon()});function H(X){if(!L(X)||Ne(i,X))return;if(i.somethingSelected())sa({lineWise:!1,text:i.getSelections()}),X.type=="cut"&&i.replaceSelection("",null,"cut");else if(i.options.lineWiseCopyCut){var Q=So(i);sa({lineWise:!0,text:Q.text}),X.type=="cut"&&i.operation(function(){i.setSelections(Q.ranges,0,ye),i.replaceSelection("",null,"cut")})}else return;if(X.clipboardData){X.clipboardData.clearData();var q=tn.text.join(`
|
|
`);if(X.clipboardData.setData("Text",q),X.clipboardData.getData("Text")==q){X.preventDefault();return}}var le=Ao(),ce=le.firstChild;i.display.lineSpace.insertBefore(le,i.display.lineSpace.firstChild),ce.value=tn.text.join(`
|
|
`);var Ee=document.activeElement;V(ce),setTimeout(function(){i.display.lineSpace.removeChild(le),Ee.focus(),Ee==a&&n.showPrimarySelection()},50)}Ae(a,"copy",H),Ae(a,"cut",H)},Xt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Xt.prototype.prepareSelection=function(){var e=ps(this.cm,!1);return e.focus=document.activeElement==this.div,e},Xt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Xt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Xt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),i=n.from(),a=n.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||a.line<t.display.viewFrom){e.removeAllRanges();return}var L=oa(t,e.anchorNode,e.anchorOffset),H=oa(t,e.focusNode,e.focusOffset);if(L&&!L.bad&&H&&!H.bad&&At(yn(L,H),i)==0&&At(vn(L,H),a)==0)return;var X=t.display.view,Q=i.line>=t.display.viewFrom&&Ro(t,i)||{node:X[0].measure.map[2],offset:0},q=a.line<t.display.viewTo&&Ro(t,a);if(!q){var le=X[X.length-1].measure,ce=le.maps?le.maps[le.maps.length-1]:le.map;q={node:ce[ce.length-1],offset:ce[ce.length-2]-ce[ce.length-3]}}if(!Q||!q){e.removeAllRanges();return}var Ee=e.rangeCount&&e.getRangeAt(0),_e;try{_e=g(Q.node,Q.offset,q.offset,q.node)}catch(Ie){}_e&&(!D&&t.state.focused?(e.collapse(Q.node,Q.offset),_e.collapsed||(e.removeAllRanges(),e.addRange(_e))):(e.removeAllRanges(),e.addRange(_e)),Ee&&e.anchorNode==null?e.addRange(Ee):D&&this.startGracePeriod()),this.rememberSelection()},Xt.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},Xt.prototype.showMultipleSelections=function(e){y(this.cm.display.cursorDiv,e.cursors),y(this.cm.display.selectionDiv,e.selection)},Xt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Xt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return b(this.div,t)},Xt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Xt.prototype.blur=function(){this.div.blur()},Xt.prototype.getField=function(){return this.div},Xt.prototype.supportsTouch=function(){return!0},Xt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Hi(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},Xt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Xt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(o&&m&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=oa(t,e.anchorNode,e.anchorOffset),i=oa(t,e.focusNode,e.focusOffset);n&&i&&Hi(t,function(){Si(t.doc,Cn(n,i),ye),(n.bad||i.bad)&&(t.curOp.selectionChanged=!0)})},Xt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),i=n.from(),a=n.to();if(i.ch==0&&i.line>e.firstLine()&&(i=We(i.line-1,lt(e.doc,i.line-1).length)),a.ch==lt(e.doc,a.line).text.length&&a.line<e.lastLine()&&(a=We(a.line+1,0)),i.line<t.viewFrom||a.line>t.viewTo-1)return!1;var L,H,X;i.line==t.viewFrom||(L=Un(e,i.line))==0?(H=Mt(t.view[0].line),X=t.view[0].node):(H=Mt(t.view[L].line),X=t.view[L-1].node.nextSibling);var Q=Un(e,a.line),q,le;if(Q==t.view.length-1?(q=t.viewTo-1,le=t.lineDiv.lastChild):(q=Mt(t.view[Q+1].line)-1,le=t.view[Q+1].node.previousSibling),!X)return!1;for(var ce=e.doc.splitLines(tu(e,X,le,H,q)),Ee=Ai(e.doc,We(H,0),We(q,lt(e.doc,q).text.length));ce.length>1&&Ee.length>1;)if(Re(ce)==Re(Ee))ce.pop(),Ee.pop(),q--;else if(ce[0]==Ee[0])ce.shift(),Ee.shift(),H++;else break;for(var _e=0,Ie=0,Be=ce[0],Xe=Ee[0],at=Math.min(Be.length,Xe.length);_e<at&&Be.charCodeAt(_e)==Xe.charCodeAt(_e);)++_e;for(var dt=Re(ce),st=Re(Ee),pt=Math.min(dt.length-(ce.length==1?_e:0),st.length-(Ee.length==1?_e:0));Ie<pt&&dt.charCodeAt(dt.length-Ie-1)==st.charCodeAt(st.length-Ie-1);)++Ie;if(ce.length==1&&Ee.length==1&&H==i.line)for(;_e&&_e>i.ch&&dt.charCodeAt(dt.length-Ie-1)==st.charCodeAt(st.length-Ie-1);)_e--,Ie++;ce[ce.length-1]=dt.slice(0,dt.length-Ie).replace(/^\u200b+/,""),ce[0]=ce[0].slice(_e).replace(/\u200b+$/,"");var wt=We(H,_e),bt=We(q,Ee.length?Re(Ee).length-Ie:0);if(ce.length>1||ce[0]||At(wt,bt))return nr(e.doc,ce,wt,bt,"+input"),!0},Xt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Xt.prototype.reset=function(){this.forceCompositionEnd()},Xt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Xt.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},Xt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Hi(this.cm,function(){return Mi(e.cm)})},Xt.prototype.setUneditable=function(e){e.contentEditable="false"},Xt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||pi(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Xt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Xt.prototype.onContextMenu=function(){},Xt.prototype.resetPosition=function(){},Xt.prototype.needsContentAttribute=!0;function Ro(e,t){var n=fa(e,t.line);if(!n||n.hidden)return null;var i=lt(e.doc,t.line),a=es(n,i,t.line),L=nt(i,e.doc.direction),H="left";if(L){var X=$e(L,t.ch);H=X%2?"right":"left"}var Q=ns(a.map,t.ch,H);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 lr(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,i,a){var L="",H=!1,X=e.doc.lineSeparator(),Q=!1;function q(_e){return function(Ie){return Ie.id==_e}}function le(){H&&(L+=X,Q&&(L+=X),H=Q=!1)}function ce(_e){_e&&(le(),L+=_e)}function Ee(_e){if(_e.nodeType==1){var Ie=_e.getAttribute("cm-text");if(Ie){ce(Ie);return}var Be=_e.getAttribute("cm-marker"),Xe;if(Be){var at=e.findMarks(We(i,0),We(a+1,0),q(+Be));at.length&&(Xe=at[0].find(0))&&ce(Ai(e.doc,Xe.from,Xe.to).join(X));return}if(_e.getAttribute("contenteditable")=="false")return;var dt=/^(pre|div|p|li|table|br)$/i.test(_e.nodeName);if(!/^br$/i.test(_e.nodeName)&&_e.textContent.length==0)return;dt&&le();for(var st=0;st<_e.childNodes.length;st++)Ee(_e.childNodes[st]);/^(pre|p)$/i.test(_e.nodeName)&&(Q=!0),dt&&(H=!0)}else _e.nodeType==3&&ce(_e.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Ee(t),t==n);)t=t.nextSibling,Q=!1;return L}function oa(e,t,n){var i;if(t==e.display.lineDiv){if(i=e.display.lineDiv.childNodes[n],!i)return lr(e.clipPos(We(e.display.viewTo-1)),!0);t=null,n=0}else for(i=t;;i=i.parentNode){if(!i||i==e.display.lineDiv)return null;if(i.parentNode&&i.parentNode==e.display.lineDiv)break}for(var a=0;a<e.display.view.length;a++){var L=e.display.view[a];if(L.node==i)return iu(L,t,n)}}function iu(e,t,n){var i=e.text.firstChild,a=!1;if(!t||!b(i,t))return lr(We(Mt(e.line),0),!0);if(t==i&&(a=!0,t=i.childNodes[n],n=0,!t)){var L=e.rest?Re(e.rest):e.line;return lr(We(Mt(L),L.text.length),a)}var H=t.nodeType==3?t:null,X=t;for(!H&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(H=t.firstChild,n&&(n=H.nodeValue.length));X.parentNode!=i;)X=X.parentNode;var Q=e.measure,q=Q.maps;function le(Xe,at,dt){for(var st=-1;st<(q?q.length:0);st++)for(var pt=st<0?Q.map:q[st],wt=0;wt<pt.length;wt+=3){var bt=pt[wt+2];if(bt==Xe||bt==at){var Dt=Mt(st<0?e.line:e.rest[st]),Jt=pt[wt]+dt;return(dt<0||bt!=Xe)&&(Jt=pt[wt+(dt?1:0)]),We(Dt,Jt)}}}var ce=le(H,X,n);if(ce)return lr(ce,a);for(var Ee=X.nextSibling,_e=H?H.nodeValue.length-n:0;Ee;Ee=Ee.nextSibling){if(ce=le(Ee,Ee.firstChild,0),ce)return lr(We(ce.line,ce.ch-_e),a);_e+=Ee.textContent.length}for(var Ie=X.previousSibling,Be=n;Ie;Ie=Ie.previousSibling){if(ce=le(Ie,Ie.firstChild,-1),ce)return lr(We(ce.line,ce.ch+Be),a);Be+=Ie.textContent.length}}var ai=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ee,this.hasSelection=!1,this.composing=null};ai.prototype.init=function(e){var t=this,n=this,i=this.cm;this.createField(e);var a=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),d&&(a.style.width="0px"),Ae(a,"input",function(){W&&j>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Ae(a,"paste",function(H){if(Ne(i,H)||To(H,i))return;i.state.pasteIncoming=+new Date,n.fastPoll()});function L(H){if(Ne(i,H))return;if(i.somethingSelected())sa({lineWise:!1,text:i.getSelections()});else if(i.options.lineWiseCopyCut){var X=So(i);sa({lineWise:!0,text:X.text}),H.type=="cut"?i.setSelections(X.ranges,null,ye):(n.prevInput="",a.value=X.text.join(`
|
|
`),V(a))}else return;H.type=="cut"&&(i.state.cutIncoming=+new Date)}Ae(a,"cut",L),Ae(a,"copy",L),Ae(e.scroller,"paste",function(H){if(dn(e,H)||Ne(i,H))return;if(!a.dispatchEvent){i.state.pasteIncoming=+new Date,n.focus();return}var X=new Event("paste");X.clipboardData=H.clipboardData,a.dispatchEvent(X)}),Ae(e.lineSpace,"selectstart",function(H){dn(e,H)||te(H)}),Ae(a,"compositionstart",function(){var H=i.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:H,range:i.markText(H,i.getCursor("to"),{className:"CodeMirror-composing"})}}),Ae(a,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},ai.prototype.createField=function(e){this.wrapper=Ao(),this.textarea=this.wrapper.firstChild},ai.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},ai.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,i=ps(e);if(e.options.moveInputWithCursor){var a=qi(e,n.sel.primary().head,"div"),L=t.wrapper.getBoundingClientRect(),H=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,a.top+H.top-L.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,a.left+H.left-L.left))}return i},ai.prototype.showSelection=function(e){var t=this.cm,n=t.display;y(n.cursorDiv,e.cursors),y(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},ai.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&V(this.textarea),W&&j>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",W&&j>=9&&(this.hasSelection=null))},ai.prototype.getField=function(){return this.textarea},ai.prototype.supportsTouch=function(){return!1},ai.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!s||M()!=this.textarea))try{this.textarea.focus()}catch(e){}},ai.prototype.blur=function(){this.textarea.blur()},ai.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},ai.prototype.receivedFocus=function(){this.slowPoll()},ai.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()})},ai.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var i=t.poll();!i&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},ai.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||Qe(n)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var a=n.value;if(a==i&&!t.somethingSelected())return!1;if(W&&j>=9&&this.hasSelection===a||l&&/[\uf700-\uf7ff]/.test(a))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var L=a.charCodeAt(0);if(L==8203&&!i&&(i="\u200B"),L==8666)return this.reset(),this.cm.execCommand("undo")}for(var H=0,X=Math.min(i.length,a.length);H<X&&i.charCodeAt(H)==a.charCodeAt(H);)++H;return Hi(t,function(){za(t,a.slice(H),i.length-H,null,e.composing?"*compose":null),a.length>1e3||a.indexOf(`
|
|
`)>-1?n.value=e.prevInput="":e.prevInput=a,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ai.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},ai.prototype.onKeyPress=function(){W&&j>=9&&(this.hasSelection=null),this.fastPoll()},ai.prototype.onContextMenu=function(e){var t=this,n=t.cm,i=n.display,a=t.textarea;t.contextMenuPending&&t.contextMenuPending();var L=Fn(n,e),H=i.scroller.scrollTop;if(!L||c)return;var X=n.options.resetSelectionOnContextMenu;X&&n.doc.sel.contains(L)==-1&&pi(n,Si)(n.doc,Cn(L),ye);var Q=a.style.cssText,q=t.wrapper.style.cssText,le=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",a.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-le.top-5)+"px; left: "+(e.clientX-le.left-5)+`px;
|
|
z-index: 1000; background: `+(W?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ce;k&&(ce=window.scrollY),i.input.focus(),k&&window.scrollTo(null,ce),i.input.reset(),n.somethingSelected()||(a.value=t.prevInput=" "),t.contextMenuPending=_e,i.selForContextMenu=n.doc.sel,clearTimeout(i.detectingSelectAll);function Ee(){if(a.selectionStart!=null){var Be=n.somethingSelected(),Xe="\u200B"+(Be?a.value:"");a.value="\u21DA",a.value=Xe,t.prevInput=Be?"":"\u200B",a.selectionStart=1,a.selectionEnd=Xe.length,i.selForContextMenu=n.doc.sel}}function _e(){if(t.contextMenuPending!=_e)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=q,a.style.cssText=Q,W&&j<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=H),a.selectionStart!=null){(!W||W&&j<9)&&Ee();var Be=0,Xe=function(){i.selForContextMenu==n.doc.sel&&a.selectionStart==0&&a.selectionEnd>0&&t.prevInput=="\u200B"?pi(n,Vs)(n):Be++<10?i.detectingSelectAll=setTimeout(Xe,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(Xe,200)}}if(W&&j>=9&&Ee(),O){he(e);var Ie=function(){Je(window,"mouseup",Ie),setTimeout(_e,20)};Ae(window,"mouseup",Ie)}else setTimeout(_e,50)},ai.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},ai.prototype.setUneditable=function(){},ai.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?C(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 n=M();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function i(){e.value=X.getValue()}var a;if(e.form&&(Ae(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var L=e.form;a=L.submit;try{var H=L.submit=function(){i(),L.submit=a,L.submit(),L.submit=H}}catch(Q){}}t.finishInit=function(Q){Q.save=i,Q.getTextArea=function(){return e},Q.toTextArea=function(){Q.toTextArea=isNaN,i(),e.parentNode.removeChild(Q.getWrapperElement()),e.style.display="",e.form&&(Je(e.form,"submit",i),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=a))}},e.style.display="none";var X=ei(function(Q){return e.parentNode.insertBefore(Q,e.nextSibling)},t);return X}function ru(e){e.off=Je,e.on=Ae,e.wheelEventPixels=dl,e.Doc=Pi,e.splitLines=_t,e.countColumn=$,e.findColumn=xe,e.isWordChar=Le,e.Pass=Te,e.signal=Se,e.Line=Mn,e.changeEnd=An,e.scrollbarModel=xs,e.Pos=We,e.cmpPos=At,e.modes=$t,e.mimeModes=Lt,e.resolveMode=Ve,e.getMode=St,e.modeExtensions=Rt,e.extendMode=It,e.copyState=qt,e.startState=Kt,e.innerMode=jt,e.commands=Pr,e.keyMap=cn,e.keyName=lo,e.isModifierKey=so,e.lookupKey=ar,e.normalizeKeyMap=kl,e.StringStream=Tt,e.SharedTextMarker=Dr,e.TextMarker=Rn,e.LineWidget=Ir,e.e_preventDefault=te,e.e_stopPropagation=ie,e.e_stop=he,e.addClass=P,e.contains=b,e.rmClass=T,e.keyNames=Ln}$l(ei),ql(ei);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in Pi.prototype)Pi.prototype.hasOwnProperty(la)&&re(au,la)<0&&(ei.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(Pi.prototype[la]));return pe(Pi),ei.inputStyles={textarea:ai,contenteditable:Xt},ei.defineMode=function(e){!ei.defaults.mode&&e!="null"&&(ei.defaults.mode=e),di.apply(this,arguments)},ei.defineMIME=Ii,ei.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),ei.defineMIME("text/plain","null"),ei.defineExtension=function(e,t){ei.prototype[e]=t},ei.defineDocExtension=function(e,t){Pi.prototype[e]=t},ei.fromTextArea=nu,ru(ei),ei.version="5.58.2",ei})},Y1PL:function(vt,et,ne){"use strict";ne.r(et),ne.d(et,"ResizableTextArea",function(){return re});var ae=ne("wx14"),J=ne("1OyB"),D=ne("vuIU"),Y=ne("Ji7U"),F=ne("LK+K"),U=ne("q1tI"),W=ne("VTBJ"),j=ne("rePB"),k=ne("Zm9Q"),I=ne("Kwbf"),m=ne("c+Xe"),c=ne("m+aA"),f=ne("bdgK"),u=new Map;function r(ye){ye.forEach(function(be){var we,xe=be.target;(we=u.get(xe))===null||we===void 0||we.forEach(function(me){return me(xe)})})}var d=new f.default(r),o=null,s=null;function l(ye,be){u.has(ye)||(u.set(ye,new Set),d.observe(ye)),u.get(ye).add(be)}function p(ye,be){u.has(ye)&&(u.get(ye).delete(be),u.get(ye).size||(d.unobserve(ye),u.delete(ye)))}var R=function(ye){Object(Y.a)(we,ye);var be=Object(F.a)(we);function we(){return Object(J.a)(this,we),be.apply(this,arguments)}return Object(D.a)(we,[{key:"render",value:function(){return this.props.children}}]),we}(U.Component),w=U.createContext(null);function x(ye){var be=ye.children,we=ye.onBatchResize,xe=U.useRef(0),me=U.useRef([]),se=U.useContext(w),Re=U.useCallback(function(ze,He,rt){xe.current+=1;var ot=xe.current;me.current.push({size:ze,element:He,data:rt}),Promise.resolve().then(function(){ot===xe.current&&(we==null||we(me.current),me.current=[])}),se==null||se(ze,He,rt)},[we,se]);return U.createElement(w.Provider,{value:Re},be)}function O(ye){var be=ye.children,we=ye.disabled,xe=U.useRef(null),me=U.useRef(null),se=U.useContext(w),Re=U.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ze=U.isValidElement(be)&&Object(m.c)(be),He=ze?be.ref:null,rt=U.useMemo(function(){return Object(m.a)(He,xe)},[He,xe]),ot=U.useRef(ye);ot.current=ye;var Oe=U.useCallback(function(Le){var Ue=ot.current,Ge=Ue.onResize,je=Ue.data,Me=Le.getBoundingClientRect(),Pe=Me.width,ut=Me.height,tt=Le.offsetWidth,qe=Le.offsetHeight,$e=Math.floor(Pe),ft=Math.floor(ut);if(Re.current.width!==$e||Re.current.height!==ft||Re.current.offsetWidth!==tt||Re.current.offsetHeight!==qe){var nt={width:$e,height:ft,offsetWidth:tt,offsetHeight:qe};Re.current=nt;var Ye=tt===Math.round(Pe)?Pe:tt,Ae=qe===Math.round(ut)?ut:qe,ct=Object(W.a)(Object(W.a)({},nt),{},{offsetWidth:Ye,offsetHeight:Ae});se==null||se(ct,Le,je),Ge&&Promise.resolve().then(function(){Ge(ct,Le)})}},[]);return U.useEffect(function(){var Le=Object(c.a)(xe.current)||Object(c.a)(me.current);return Le&&!we&&l(Le,Oe),function(){return p(Le,Oe)}},[xe.current,we]),U.createElement(R,{ref:me},ze?U.cloneElement(be,{ref:rt}):be)}var A="rc-observer-key";function T(ye){var be=ye.children,we=Object(k.a)(be);return we.map(function(xe,me){var se=(xe==null?void 0:xe.key)||"".concat(A,"-").concat(me);return U.createElement(O,Object(ae.a)({},ye,{key:se}),xe)})}T.Collection=x;var E=T,y=ne("bT9E"),h=ne("TSYQ"),_=ne.n(h),g=`
|
|
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
|
|
`,b=["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"],M={},P;function K(ye){var be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,we=ye.getAttribute("id")||ye.getAttribute("data-reactid")||ye.getAttribute("name");if(be&&M[we])return M[we];var xe=window.getComputedStyle(ye),me=xe.getPropertyValue("box-sizing")||xe.getPropertyValue("-moz-box-sizing")||xe.getPropertyValue("-webkit-box-sizing"),se=parseFloat(xe.getPropertyValue("padding-bottom"))+parseFloat(xe.getPropertyValue("padding-top")),Re=parseFloat(xe.getPropertyValue("border-bottom-width"))+parseFloat(xe.getPropertyValue("border-top-width")),ze=b.map(function(rt){return"".concat(rt,":").concat(xe.getPropertyValue(rt))}).join(";"),He={sizingStyle:ze,paddingSize:se,borderSize:Re,boxSizing:me};return be&&we&&(M[we]=He),He}function V(ye){var be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,we=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,xe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;P||(P=document.createElement("textarea"),P.setAttribute("tab-index","-1"),P.setAttribute("aria-hidden","true"),document.body.appendChild(P)),ye.getAttribute("wrap")?P.setAttribute("wrap",ye.getAttribute("wrap")):P.removeAttribute("wrap");var me=K(ye,be),se=me.paddingSize,Re=me.borderSize,ze=me.boxSizing,He=me.sizingStyle;P.setAttribute("style","".concat(He,";").concat(g)),P.value=ye.value||ye.placeholder||"";var rt=Number.MIN_SAFE_INTEGER,ot=Number.MAX_SAFE_INTEGER,Oe=P.scrollHeight,Le;if(ze==="border-box"?Oe+=Re:ze==="content-box"&&(Oe-=se),we!==null||xe!==null){P.value=" ";var Ue=P.scrollHeight-se;we!==null&&(rt=Ue*we,ze==="border-box"&&(rt=rt+se+Re),Oe=Math.max(rt,Oe)),xe!==null&&(ot=Ue*xe,ze==="border-box"&&(ot=ot+se+Re),Le=Oe>ot?"":"hidden",Oe=Math.min(ot,Oe))}return{height:Oe,minHeight:rt,maxHeight:ot,overflowY:Le,resize:"none"}}var B=ne("Gytx"),C=ne.n(B),$;(function(ye){ye[ye.NONE=0]="NONE",ye[ye.RESIZING=1]="RESIZING",ye[ye.RESIZED=2]="RESIZED"})($||($={}));var ee=function(ye){Object(Y.a)(we,ye);var be=Object(F.a)(we);function we(xe){var me;return Object(J.a)(this,we),me=be.call(this,xe),me.nextFrameActionId=void 0,me.resizeFrameId=void 0,me.textArea=void 0,me.saveTextArea=function(se){me.textArea=se},me.handleResize=function(se){var Re=me.state.resizeStatus,ze=me.props,He=ze.autoSize,rt=ze.onResize;if(Re!==$.NONE)return;typeof rt=="function"&&rt(se),He&&me.resizeOnNextFrame()},me.resizeOnNextFrame=function(){cancelAnimationFrame(me.nextFrameActionId),me.nextFrameActionId=requestAnimationFrame(me.resizeTextarea)},me.resizeTextarea=function(){var se=me.props.autoSize;if(!se||!me.textArea)return;var Re=se.minRows,ze=se.maxRows,He=V(me.textArea,!1,Re,ze);me.setState({textareaStyles:He,resizeStatus:$.RESIZING},function(){cancelAnimationFrame(me.resizeFrameId),me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:$.RESIZED},function(){me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:$.NONE}),me.fixFirefoxAutoScroll()})})})})},me.renderTextArea=function(){var se=me.props,Re=se.prefixCls,ze=Re===void 0?"rc-textarea":Re,He=se.autoSize,rt=se.onResize,ot=se.className,Oe=se.disabled,Le=me.state,Ue=Le.textareaStyles,Ge=Le.resizeStatus,je=Object(y.a)(me.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Me=_()(ze,ot,Object(j.a)({},"".concat(ze,"-disabled"),Oe));"value"in je&&(je.value=je.value||"");var Pe=Object(W.a)(Object(W.a)(Object(W.a)({},me.props.style),Ue),Ge===$.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return U.createElement(E,{onResize:me.handleResize,disabled:!(He||rt)},U.createElement("textarea",Object(ae.a)({},je,{className:Me,style:Pe,ref:me.saveTextArea})))},me.state={textareaStyles:{},resizeStatus:$.NONE},me}return Object(D.a)(we,[{key:"componentDidUpdate",value:function(me){(me.value!==this.props.value||!C()(me.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var me=this.textArea.selectionStart,se=this.textArea.selectionEnd;this.textArea.setSelectionRange(me,se)}}catch(Re){}}},{key:"render",value:function(){return this.renderTextArea()}}]),we}(U.Component),re=ee,ue=function(ye){Object(Y.a)(we,ye);var be=Object(F.a)(we);function we(xe){var me;Object(J.a)(this,we),me=be.call(this,xe),me.resizableTextArea=void 0,me.focus=function(){me.resizableTextArea.textArea.focus()},me.saveTextArea=function(Re){me.resizableTextArea=Re},me.handleChange=function(Re){var ze=me.props.onChange;me.setValue(Re.target.value,function(){me.resizableTextArea.resizeTextarea()}),ze&&ze(Re)},me.handleKeyDown=function(Re){var ze=me.props,He=ze.onPressEnter,rt=ze.onKeyDown;Re.keyCode===13&&He&&He(Re),rt&&rt(Re)};var se=typeof xe.value=="undefined"||xe.value===null?xe.defaultValue:xe.value;return me.state={value:se},me}return Object(D.a)(we,[{key:"setValue",value:function(me,se){"value"in this.props||this.setState({value:me},se)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return U.createElement(re,Object(ae.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(me){return"value"in me?{value:me.value}:null}}]),we}(U.Component),Te=et.default=ue},ZW9T:function(vt,et,ne){"use strict";ne.d(et,"a",function(){return V});var ae=ne("k1fw"),J=ne("miYZ"),D=ne("tsqr"),Y=ne("rAM+"),F=ne("tJVT"),U=ne("PpiC"),W=ne("q1tI"),j=ne.n(W),k=ne("bdgK"),I=ne("oBTY"),m=ne("9og8"),c=ne("WmNS"),f=ne.n(c),u={keywords:["print","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while"]},r={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
|
|
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
|
|
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},d={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","for","friend","gcnew","generic","goto","if","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`)},{label:"#include",content:'include "$0"'},{label:"printf",content:"printf($0)"},{label:"main",content:["int main () {"," $0","}"].join(`
|
|
`)},{label:"for",content:["for( ; ; ){"," $0","}"].join(`
|
|
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
|
|
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
|
|
`)},{label:"#include <iostream>",content:["#include <iostream>"].join(`
|
|
`)},{label:"#include <vector>",content:["#include <vector>"].join(`
|
|
`)},{label:"#include <sstream>",content:["#include <sstream>"].join(`
|
|
`)},{label:"#include <string>",content:["#include <string>"].join(`
|
|
`)},{label:"#include <cmath>",content:["#include <cmath>"].join(`
|
|
`)}]},o={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
|
|
`)}]},s=ne("5VLF"),l=ne.n(s),p={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},R=function(C,$){return $.map(function(ee){return{label:ee,kind:C.languages.CompletionItemKind.Keyword,insertText:ee}})},w=function(C){return Object.keys(p.tables).map(function($){return{label:$,kind:C.languages.CompletionItemKind.Variable,insertText:$}})},x=function(C,$){var ee=p.tables[C];return ee?ee.map(function(re){return{label:re,kind:$.languages.CompletionItemKind.Field,insertText:re}}):[]};function O(B,C,$,ee,re){var ue=C.getWordUntilPosition($),Te={startLineNumber:$.lineNumber,endLineNumber:$.lineNumber,startColumn:ue.startColumn,endColumn:ue.endColumn},ye=ee.map(function(be){return{label:be,kind:B.languages.CompletionItemKind.Keyword,insertText:be,insertTextRules:B.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Te}});return re.map(function(be){ye.push(Object(ae.a)(Object(ae.a)({},be),{},{range:Te}))}),ye}var A=function(B){p.languages.map(function(re){return B.languages.registerDocumentFormattingEditProvider(re,{provideDocumentFormattingEdits:function(Te,ye,be){return Object(m.a)(f.a.mark(function we(){var xe;return f.a.wrap(function(se){for(;;)switch(se.prev=se.next){case 0:return xe=l()(Te.getValue(),{indent_size:"2",indent_char:" ",max_preserve_newlines:"2",preserve_newlines:!0,keep_array_indentation:!0,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:"0",indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1}),se.abrupt("return",[{range:Te.getFullModelRange(),text:xe}]);case 2:case"end":return se.stop()}},we)}))()}}),re});var C=d.quickKey.map(function(re){return{label:re.label,kind:B.languages.CompletionItemKind.Method,insertText:re.content,insertTextRules:B.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),$=o.quickKey.map(function(re){return{label:re.label,kind:B.languages.CompletionItemKind.Method,insertText:re.content,insertTextRules:B.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),ee=r.quickKey.map(function(re){return{label:re.label,kind:B.languages.CompletionItemKind.Method,insertText:re.content,insertTextRules:B.languages.CompletionItemInsertTextRule.InsertAsSnippet}});B.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(I.a)(d.keywords),Object(I.a)(d.quickKey.map(function(re){return re.label}))),provideCompletionItems:function(ue,Te){var ye=ue.getValueInRange({startLineNumber:Te.lineNumber,startColumn:1,endLineNumber:Te.lineNumber,endColumn:Te.column}),be=ye.match(/cu/gim);console.log("match:",be,Te,ye,ue);var we=[],xe=Te.lineNumber,me=Te.column,se=ue.getValueInRange({startLineNumber:xe,startColumn:0,endLineNumber:xe,endColumn:me}),Re=se.trim().split(/\s+/),ze=Re[Re.length-1];if(ze.endsWith(".")){var He=ze.slice(0,ze.length-1);Object.keys(p.tables).includes(He)&&(we=Object(I.a)(x(He,B)))}else ze==="."?we=[]:we=[].concat(Object(I.a)(w(B)),Object(I.a)(R(B,d.keywords)),Object(I.a)(C));return{suggestions:we}}}),B.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(I.a)(u.keywords)),provideCompletionItems:function(ue,Te){var ye=ue.getValueInRange({startLineNumber:Te.lineNumber,startColumn:1,endLineNumber:Te.lineNumber,endColumn:Te.column}),be=ye.match(/cu/gim);console.log("match:",be,Te,ye,ue);var we=[],xe=Te.lineNumber,me=Te.column,se=ue.getValueInRange({startLineNumber:xe,startColumn:0,endLineNumber:xe,endColumn:me}),Re=se.trim().split(/\s+/),ze=Re[Re.length-1];if(ze.endsWith(".")){var He=ze.slice(0,ze.length-1);Object.keys(p.tables).includes(He)&&(we=Object(I.a)(x(He,B)))}else ze==="."?we=[]:we=[].concat(Object(I.a)(w(B)),Object(I.a)(R(B,u.keywords)));return{suggestions:we}}}),B.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(I.a)(r.keywords)),provideCompletionItems:function(ue,Te){var ye=[],be=Te.lineNumber,we=Te.column,xe=ue.getValueInRange({startLineNumber:be,startColumn:0,endLineNumber:be,endColumn:we}),me=xe.trim().split(/\s+/),se=me[me.length-1];if(se.endsWith(".")){var Re=se.slice(0,se.length-1);Object.keys(p.tables).includes(Re)&&(ye=Object(I.a)(x(Re,B)))}else se==="."?ye=[]:ye=[].concat(Object(I.a)(w(B)),Object(I.a)(R(B,r.keywords)),Object(I.a)(ee));return{suggestions:ye}}}),B.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(I.a)(o.keywords)),provideCompletionItems:function(ue,Te){var ye=[],be=Te.lineNumber,we=Te.column,xe=ue.getValueInRange({startLineNumber:be,startColumn:0,endLineNumber:be,endColumn:we}),me=xe.trim().split(/\s+/),se=me[me.length-1];if(se.endsWith(".")){var Re=se.slice(0,se.length-1);Object.keys(p.tables).includes(Re)&&(ye=Object(I.a)(x(Re,B)))}else se==="."?ye=[]:ye=[].concat(Object(I.a)(w(B)),Object(I.a)(R(B,o.keywords)),Object(I.a)($));return{suggestions:ye}}})},T="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",E=ne("LvDl"),y=ne("+ua5");function h(B){return/^\d+$/.test(B)?"".concat(B,"px"):B}function _(){}var g=!1,b={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function M(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],C=B;if(Array.isArray(B)){for(var $=0;$<B.length;$++){var ee=b[B[$]];if(ee)return ee}return C[0]}return b[C]||C}var P=null,K=et.b=function(B){var C=B.width,$=C===void 0?"100%":C,ee=B.height,re=ee===void 0?"100%":ee,ue=B.value,Te=B.language,ye=Te===void 0?"javascript":Te,be=B.style,we=be===void 0?{}:be,xe=B.options,me=xe===void 0?{}:xe,se=B.overrideServices,Re=se===void 0?{}:se,ze=B.theme,He=ze===void 0?"vs-dark":ze,rt=B.onEditBlur,ot=B.onSave,Oe=B.autoHeight,Le=Oe===void 0?!1:Oe,Ue=B.forbidCopy,Ge=Ue===void 0?!1:Ue,je=B.onChange,Me=je===void 0?_:je,Pe=B.editorDidMount,ut=Pe===void 0?_:Pe,tt=B.onFocus,qe=tt===void 0?_:tt,$e=B.filename,ft=$e===void 0?"educoder.txt":$e,nt=B.errorLine,Ye=B.errorContent,Ae=Ye===void 0?"":Ye,ct=Object(U.a)(B,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),Je=Object(W.useRef)(),Se=Object(W.useRef)({}),Ne=Object(W.useRef)(),ve=Object(W.useRef)(!1),de=Object(W.useRef)(),pe=Object(W.useState)(!1),te=Object(F.a)(pe,2),ie=te[0],oe=te[1];function he(){var Ve;return Je.current&&(Ve=new k.default(function(St){var Rt=Object(Y.a)(St),It;try{for(Rt.s();!(It=Rt.n()).done;){var qt=It.value;(qt.target.offsetHeight>0||qt.target.offsetWidth>0)&&Se.current.instance.layout()}}catch(jt){Rt.e(jt)}finally{Rt.f()}}),Ve.observe(Je.current)),Ve}function ge(){D.b.warn(decodeURIComponent(T))}var Ce=function(){var St=Se.current.instance;if(ue!=null&&St&&ie){var Rt=St.getModel();Rt&&ue!==Rt.getValue()&&(g=!0,Rt.setValue(ue),St.layout(),g=!1)}};Object(W.useEffect)(function(){Ne.current&&clearTimeout(Ne.current),Ne.current=setTimeout(function(){Ce()},500)},[ue,ie,Se.current]),Object(W.useEffect)(function(){if(nt&&Se.current&&Se.current.instance){var Ve=Se.current.instance;Ve.changeViewZones(function(Rt){var It=document.createElement("div");It.style.padding="10px 20px",It.style.width="calc(100% - 20px)",It.className="my-error-line-wrp",It.innerHTML=Ae,Rt.addZone({afterLineNumber:nt||11,heightInLines:3,domNode:It})});var St={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};Ve.addOverlayWidget(St),Ve.revealPositionInCenter({lineNumber:20,column:1})}},[nt,Se.current,ie]);function De(){var Ve=Se.current.instance;if(Ve){var St=Ve.getSelection(),Rt=Se.current.pastePos||{},It=new P.Range(Rt.startLineNumber||St.endLineNumber,Rt.startColumn||St.endColumn,Rt.endLineNumber||St.endLineNumber,Rt.endColumn||St.endColumn);setTimeout(function(){Ve.executeEdits("",[{range:It,text:""}])},300)}}function Ke(Ve){(window.navigator.platform.match("Mac")?Ve.metaKey:Ve.ctrlKey)&&Ve.keyCode==83&&(Ve.preventDefault(),ot())}var ht=function(){if(Le&&Se.current.instance){var St=Se.current.instance.getContentHeight();di(St<re?re:St)}else di(re)};function it(Ve){var St=document.createEvent("MouseEvents");St.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Ve.dispatchEvent(St)}function mt(Ve,St){var Rt=window.URL||window.webkitURL||window,It=new Blob([St]),qt=document.createElementNS("http://www.w3.org/1999/xhtml","a");qt.href=Rt.createObjectURL(It),qt.download=Ve,it(qt)}Object(W.useEffect)(function(){ht()},[ht]),Object(W.useEffect)(function(){Je.current&&!ie&&ne.e(27).then(ne.t.bind(null,"M/lh",7)).then(function(Ve){try{P=Ve,Se.current.instance=P.editor.create(Je.current,{value:ue,language:M(ye),theme:He,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},Re);var St=Se.current.instance;if(ut(St,P),setTimeout(function(){ht(),Se.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){mt(ft||"educoder.txt",St.getValue())}})},500),Se.current.subscription=St.onDidChangeModelContent(function(It){ve.current?clearTimeout(de.current):(ht(),Me(St.getValue(),It)),de.current=setTimeout(function(){ve.current=!1},500)}),window.Monaco||A(P),Ge&&(St.addCommand(P.KeyMod.CtrlCmd|P.KeyMod.Shift|P.KeyCode.KEY_V,function(){return ge(),null}),St.addCommand(P.KeyMod.CtrlCmd|P.KeyCode.KEY_C,function(){return ge(),null})),window.Monaco=P,rt&&St.onDidBlurEditorWidget(function(){rt(St.getValue())}),qe&&St.onDidFocusEditorText(function(){qe(St.getValue())}),Ge){St.addCommand(P.KeyMod.CtrlCmd|P.KeyCode.KEY_V,function(){return ge(),null}),St.onDidPaste(function(It){Se.current.pastePos=It});try{window.addEventListener("paste",De)}catch(It){}}var Rt=he();return oe(!0),function(){var It=Se.current.instance;It.dispose();var qt=It.getModel();qt&&qt.dispose(),Se.current.subscription&&Se.current.subscription.dispose(),Ge&&window.removeEventListener("paste",De),Rt.unobserve(Je.current)}}catch(It){}})},[]),Object(W.useEffect)(function(){var Ve=Se.current.instance;if(Ve&&ie)return document.addEventListener("keydown",Ke,!1),function(){document.removeEventListener("keydown",Ke)}},[ot,ie]),Object(W.useEffect)(function(){var Ve=Se.current.instance;if(Ve&&ie){var St=M(ye);P.editor.setModelLanguage(Ve.getModel(),St),console.log("language:",ye,Ve.getModel(),St)}},[ye,ie]),Object(W.useEffect)(function(){var Ve=Se.current.instance;Ve&&ie&&P.editor.setTheme(He)},[He,ie]),Object(W.useEffect)(function(){var Ve=Se.current.instance;Ve&&ie&&(Ve.updateOptions(Object(ae.a)({},me)),setTimeout(function(){Ve.getModel().updateOptions(Object(ae.a)({},me))},200))},[JSON.stringify(me),ie]),Object(W.useEffect)(function(){var Ve=Se.current.instance;Ve&&ie&&Ve.layout()},[$,re,ie]);var _t=Object(W.useState)(h($)),Qe=Object(F.a)(_t,2),Ft=Qe[0],Ct=Qe[1],Yt=Object(W.useState)(h(re)),$t=Object(F.a)(Yt,2),Lt=$t[0],di=$t[1],Ii=Object(ae.a)(Object(ae.a)({},we),{},{width:Ft,height:Lt});return j.a.createElement("div",{className:"my-monaco-editor",ref:Je,style:Ii})};function V(B){var C=B.width,$=C===void 0?"100%":C,ee=B.height,re=ee===void 0?"100%":ee,ue=B.original,Te=B.modified,ye=B.language,be=B.options,we=be===void 0?{}:be,xe=Object(W.useRef)(),me=Object(W.useState)(null),se=Object(F.a)(me,2),Re=se[0],ze=se[1];function He(Le){var Ue;return xe.current&&(Ue=new k.default(function(Ge){var je=Object(Y.a)(Ge),Me;try{for(je.s();!(Me=je.n()).done;){var Pe=Me.value;(Pe.target.offsetHeight>0||Pe.target.offsetWidth>0)&&Le.layout()}}catch(ut){je.e(ut)}finally{je.f()}}),Ue.observe(xe.current)),Ue}Object(W.useEffect)(function(){xe.current&&ne.e(27).then(ne.t.bind(null,"M/lh",7)).then(function(Le){P=Le;var Ue=P.editor.createDiffEditor(xe.current,Object(ae.a)(Object(ae.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},we),{},{wordWrap:!0}));ze(Ue);var Ge=He(Ue);return function(){Ue.dispose();var je=Ue.getModel();je&&je.dispose(),Ge.unobserve(xe.current)}})},[]),Object(W.useEffect)(function(){Re&&Re.setModel({original:P.editor.createModel(ue,ye),modified:P.editor.createModel(Te,ye)})},[ue,Te,ye,Re]);var rt=h($),ot=h(re),Oe={width:rt,height:ot};return j.a.createElement("div",{className:"my-diff-editor",ref:xe,style:Oe})}},ZpRC:function(vt,et,ne){"use strict";function ae(m){return typeof m=="object"&&m!=null&&m.nodeType===1}function J(m,c){return(!c||m!=="hidden")&&m!=="visible"&&m!=="clip"}function D(m,c){if(m.clientHeight<m.scrollHeight||m.clientWidth<m.scrollWidth){var f=getComputedStyle(m,null);return J(f.overflowY,c)||J(f.overflowX,c)||function(u){var r=function(d){if(!d.ownerDocument||!d.ownerDocument.defaultView)return null;try{return d.ownerDocument.defaultView.frameElement}catch(o){return null}}(u);return!!r&&(r.clientHeight<u.scrollHeight||r.clientWidth<u.scrollWidth)}(m)}return!1}function Y(m,c,f,u,r,d,o,s){return d<m&&o>c||d>m&&o<c?0:d<=m&&s<=f||o>=c&&s>=f?d-m-u:o>c&&s<f||d<m&&s>f?o-c+r:0}var F=function(m,c){var f=window,u=c.scrollMode,r=c.block,d=c.inline,o=c.boundary,s=c.skipOverflowHiddenElements,l=typeof o=="function"?o:function(Ue){return Ue!==o};if(!ae(m))throw new TypeError("Invalid target");for(var p=document.scrollingElement||document.documentElement,R=[],w=m;ae(w)&&l(w);){if((w=w.parentElement)===p){R.push(w);break}w!=null&&w===document.body&&D(w)&&!D(document.documentElement)||w!=null&&D(w,s)&&R.push(w)}for(var x=f.visualViewport?f.visualViewport.width:innerWidth,O=f.visualViewport?f.visualViewport.height:innerHeight,A=window.scrollX||pageXOffset,T=window.scrollY||pageYOffset,E=m.getBoundingClientRect(),y=E.height,h=E.width,_=E.top,g=E.right,b=E.bottom,M=E.left,P=r==="start"||r==="nearest"?_:r==="end"?b:_+y/2,K=d==="center"?M+h/2:d==="end"?g:M,V=[],B=0;B<R.length;B++){var C=R[B],$=C.getBoundingClientRect(),ee=$.height,re=$.width,ue=$.top,Te=$.right,ye=$.bottom,be=$.left;if(u==="if-needed"&&_>=0&&M>=0&&b<=O&&g<=x&&_>=ue&&b<=ye&&M>=be&&g<=Te)return V;var we=getComputedStyle(C),xe=parseInt(we.borderLeftWidth,10),me=parseInt(we.borderTopWidth,10),se=parseInt(we.borderRightWidth,10),Re=parseInt(we.borderBottomWidth,10),ze=0,He=0,rt="offsetWidth"in C?C.offsetWidth-C.clientWidth-xe-se:0,ot="offsetHeight"in C?C.offsetHeight-C.clientHeight-me-Re:0;if(p===C)ze=r==="start"?P:r==="end"?P-O:r==="nearest"?Y(T,T+O,O,me,Re,T+P,T+P+y,y):P-O/2,He=d==="start"?K:d==="center"?K-x/2:d==="end"?K-x:Y(A,A+x,x,xe,se,A+K,A+K+h,h),ze=Math.max(0,ze+T),He=Math.max(0,He+A);else{ze=r==="start"?P-ue-me:r==="end"?P-ye+Re+ot:r==="nearest"?Y(ue,ye,ee,me,Re+ot,P,P+y,y):P-(ue+ee/2)+ot/2,He=d==="start"?K-be-xe:d==="center"?K-(be+re/2)+rt/2:d==="end"?K-Te+se+rt:Y(be,Te,re,xe,se+rt,K,K+h,h);var Oe=C.scrollLeft,Le=C.scrollTop;P+=Le-(ze=Math.max(0,Math.min(Le+ze,C.scrollHeight-ee+ot))),K+=Oe-(He=Math.max(0,Math.min(Oe+He,C.scrollWidth-re+rt)))}V.push({el:C,top:ze,left:He})}return V};function U(m){return m===Object(m)&&Object.keys(m).length!==0}function W(m,c){c===void 0&&(c="auto");var f="scrollBehavior"in document.body.style;m.forEach(function(u){var r=u.el,d=u.top,o=u.left;r.scroll&&f?r.scroll({top:d,left:o,behavior:c}):(r.scrollTop=d,r.scrollLeft=o)})}function j(m){return m===!1?{block:"end",inline:"nearest"}:U(m)?m:{block:"start",inline:"nearest"}}function k(m,c){var f=!m.ownerDocument.documentElement.contains(m);if(U(c)&&typeof c.behavior=="function")return c.behavior(f?[]:F(m,c));if(f)return;var u=j(c);return W(F(m,u),u.behavior)}var I=et.a=k},bT9E:function(vt,et,ne){"use strict";ne.d(et,"a",function(){return J});var ae=ne("VTBJ");function J(D,Y){var F=Object(ae.a)({},D);return Array.isArray(Y)&&Y.forEach(function(U){delete F[U]}),F}},c5Ni:function(vt,et,ne){},dejd:function(vt,et,ne){},dmUQ:function(vt,et,ne){"use strict";var ae=ne("Ff2n"),J=ne("rePB"),D=ne("1OyB"),Y=ne("vuIU"),F=ne("Ji7U"),U=ne("md7G"),W=ne("foSv"),j=ne("q1tI"),k=ne.n(j),I=ne("TSYQ"),m=ne.n(I),c=ne("4IlW");function f(y,h){var _=Object.keys(y);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(y);h&&(g=g.filter(function(b){return Object.getOwnPropertyDescriptor(y,b).enumerable})),_.push.apply(_,g)}return _}function u(y){for(var h=1;h<arguments.length;h++){var _=arguments[h]!=null?arguments[h]:{};h%2?f(Object(_),!0).forEach(function(g){Object(J.a)(y,g,_[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(y,Object.getOwnPropertyDescriptors(_)):f(Object(_)).forEach(function(g){Object.defineProperty(y,g,Object.getOwnPropertyDescriptor(_,g))})}return y}function r(y){var h=d();return function(){var g=Object(W.a)(y),b;if(h){var M=Object(W.a)(this).constructor;b=Reflect.construct(g,arguments,M)}else b=g.apply(this,arguments);return Object(U.a)(this,b)}}function d(){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(y){return!1}}function o(){}function s(y){y.preventDefault()}var l=function(h){return h.replace(/[^\w.-]+/g,"")},p=200,R=600,w=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,x=function(h){return h!=null},O=function(h,_){return _===h||typeof _=="number"&&typeof h=="number"&&isNaN(_)&&isNaN(h)},A=function(y){Object(F.a)(_,y);var h=r(_);function _(g){var b;Object(D.a)(this,_),b=h.call(this,g),b.onKeyDown=function(K){var V=b.props,B=V.onKeyDown,C=V.onPressEnter;if(K.keyCode===c.a.UP){var $=b.getRatio(K);b.up(K,$,null),b.stop()}else if(K.keyCode===c.a.DOWN){var ee=b.getRatio(K);b.down(K,ee,null),b.stop()}else K.keyCode===c.a.ENTER&&C&&C(K);if(b.recordCursorPosition(),b.lastKeyCode=K.keyCode,B){for(var re=arguments.length,ue=new Array(re>1?re-1:0),Te=1;Te<re;Te++)ue[Te-1]=arguments[Te];B.apply(void 0,[K].concat(ue))}},b.onKeyUp=function(K){var V=b.props.onKeyUp;if(b.stop(),b.recordCursorPosition(),V){for(var B=arguments.length,C=new Array(B>1?B-1:0),$=1;$<B;$++)C[$-1]=arguments[$];V.apply(void 0,[K].concat(C))}},b.onChange=function(K){var V=b.props.onChange;b.state.focused&&(b.inputting=!0),b.rawInput=b.props.parser(b.getValueFromEvent(K)),b.setState({inputValue:b.rawInput}),V(b.toNumber(b.rawInput))},b.onMouseUp=function(){var K=b.props.onMouseUp;b.recordCursorPosition(),K&&K.apply(void 0,arguments)},b.onFocus=function(){var K;b.setState({focused:!0}),(K=b.props).onFocus.apply(K,arguments)},b.onBlur=function(){var K=b.props.onBlur;b.inputting=!1,b.setState({focused:!1});var V=b.getCurrentValidValue(b.state.inputValue),B=b.setValue(V,o);if(K){var C=b.input.value,$=b.getInputDisplayValue({focus:!1,value:B});b.input.value=$&&Number($),K.apply(void 0,arguments),b.input.value=C}},b.getRatio=function(K){var V=1;return K.metaKey||K.ctrlKey?V=.1:K.shiftKey&&(V=10),V},b.getFullNum=function(K){return isNaN(K)?K:/e/i.test(String(K))?Number(K).toFixed(18).replace(/\.?0+$/,""):K},b.getPrecision=function(K){if(x(b.props.precision))return b.props.precision;var V=String(K);if(V.indexOf("e-")>=0)return parseInt(V.slice(V.indexOf("e-")+2),10);var B=0;return V.indexOf(".")>=0&&(B=V.length-V.indexOf(".")-1),B},b.getInputDisplayValue=function(K){var V=K||b.state,B=V.focused,C=V.inputValue,$=V.value,ee;B?ee=C:ee=b.toPrecisionAsStep($),ee==null&&(ee="");var re=b.formatWrapper(ee);return x(b.props.decimalSeparator)&&(re=re.toString().replace(".",b.props.decimalSeparator)),re},b.recordCursorPosition=function(){try{b.cursorStart=b.input.selectionStart,b.cursorEnd=b.input.selectionEnd,b.currentValue=b.input.value,b.cursorBefore=b.input.value.substring(0,b.cursorStart),b.cursorAfter=b.input.value.substring(b.cursorEnd)}catch(K){}},b.restoreByAfter=function(K){if(K===void 0)return!1;var V=b.input.value,B=V.lastIndexOf(K);if(B===-1)return!1;var C=b.cursorBefore.length;return b.lastKeyCode===c.a.DELETE&&b.cursorBefore.charAt(C-1)===K[0]?(b.fixCaret(C,C),!0):B+K.length===V.length?(b.fixCaret(B,B),!0):!1},b.partRestoreByAfter=function(K){return K===void 0?!1:Array.prototype.some.call(K,function(V,B){var C=K.substring(B);return b.restoreByAfter(C)})},b.isNotCompleteNumber=function(K){return isNaN(K)||K===""||K===null||K&&K.toString().indexOf(".")===K.toString().length-1},b.stop=function(){b.autoStepTimer&&clearTimeout(b.autoStepTimer)},b.down=function(K,V,B){b.pressingUpOrDown=!0,b.step("down",K,V,B)},b.up=function(K,V,B){b.pressingUpOrDown=!0,b.step("up",K,V,B)},b.saveInput=function(K){b.input=K};var M=g.value;M===void 0&&(M=g.defaultValue),b.state={focused:g.autoFocus};var P=b.getValidValue(b.toNumber(M));return b.state=u(u({},b.state),{},{inputValue:b.toPrecisionAsStep(P),value:P}),b}return Object(Y.a)(_,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(b){var M=this.props,P=M.value,K=M.onChange,V=M.max,B=M.min,C=this.state.focused;if(b){if(!O(b.value,P)||!O(b.max,V)||!O(b.min,B)){var $=C?P:this.getValidValue(P),ee;this.pressingUpOrDown?ee=$:this.inputting?ee=this.rawInput:ee=this.toPrecisionAsStep($),this.setState({value:$,inputValue:ee})}var re="value"in this.props?P:this.state.value;"max"in this.props&&b.max!==V&&typeof re=="number"&&re>V&&K&&K(V),"min"in this.props&&b.min!==B&&typeof re=="number"&&re<B&&K&&K(B)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ue=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===c.a.BACKSPACE?ue=this.cursorStart-1:this.lastKeyCode===c.a.DELETE&&(ue=this.cursorStart):ue=this.input.value.length,this.fixCaret(ue,ue)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case c.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case c.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Te){}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(b){var M=b;return M===""?M="":this.isNotCompleteNumber(parseFloat(M))?M=this.state.value:M=this.getValidValue(M),this.toNumber(M)}},{key:"getValueFromEvent",value:function(b){var M=b.target.value.trim().replace(/。/g,".");return x(this.props.decimalSeparator)&&(M=M.replace(this.props.decimalSeparator,".")),M}},{key:"getValidValue",value:function(b){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,K=parseFloat(b);return isNaN(K)?b:(K<M&&(K=M),K>P&&(K=P),K)}},{key:"setValue",value:function(b,M){var P=this.props.precision,K=this.isNotCompleteNumber(parseFloat(b))?null:parseFloat(b),V=this.state.value,B=V===void 0?null:V,C=this.state.inputValue,$=C===void 0?null:C,ee=typeof K=="number"?K.toFixed(P):"".concat(K),re=K!==B||ee!=="".concat($);return"value"in this.props?($=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:$},M)):this.setState({value:K,inputValue:this.toPrecisionAsStep(b)},M),re&&this.props.onChange(K),K}},{key:"getMaxPrecision",value:function(b){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,P=this.props,K=P.precision,V=P.step;if(x(K))return K;var B=this.getPrecision(M),C=this.getPrecision(V),$=this.getPrecision(b);return b?Math.max($,B+C):B+C}},{key:"getPrecisionFactor",value:function(b){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,P=this.getMaxPrecision(b,M);return Math.pow(10,P)}},{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(b){return this.props.formatter?this.props.formatter(b):b}},{key:"toPrecisionAsStep",value:function(b){if(this.isNotCompleteNumber(b)||b==="")return b;var M=Math.abs(this.getMaxPrecision(b));return isNaN(M)?b.toString():Number(b).toFixed(M)}},{key:"toNumber",value:function(b){var M=this.props.precision,P=this.state.focused,K=b&&b.length>16&&P;return this.isNotCompleteNumber(b)||K?b:x(M)?Math.round(b*Math.pow(10,M))/Math.pow(10,M):Number(b)}},{key:"upStep",value:function(b,M){var P=this.props.step,K=this.getPrecisionFactor(b,M),V=Math.abs(this.getMaxPrecision(b,M)),B=((K*b+K*P*M)/K).toFixed(V);return this.toNumber(B)}},{key:"downStep",value:function(b,M){var P=this.props.step,K=this.getPrecisionFactor(b,M),V=Math.abs(this.getMaxPrecision(b,M)),B=((K*b-K*P*M)/K).toFixed(V);return this.toNumber(B)}},{key:"step",value:function(b,M){var P=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),M&&(M.persist(),M.preventDefault());var B=this.props;if(B.disabled)return;var C=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(C))return;var $=this["".concat(b,"Step")](C,K),ee=$>B.max||$<B.min;if($>B.max?$=B.max:$<B.min&&($=B.min),this.setValue($,null),this.setState({focused:!0},function(){P.pressingUpOrDown=!1}),ee)return;this.autoStepTimer=setTimeout(function(){P[b](M,K,!0)},V?p:R)}},{key:"fixCaret",value:function(b,M){if(b===void 0||M===void 0||!this.input||!this.input.value)return;try{var P=this.input.selectionStart,K=this.input.selectionEnd;(b!==P||M!==K)&&this.input.setSelectionRange(b,M)}catch(V){}}},{key:"render",value:function(){var b,M=this.props,P=M.prefixCls,K=M.disabled,V=M.readOnly,B=M.useTouch,C=M.autoComplete,$=M.upHandler,ee=M.downHandler,re=M.className,ue=M.max,Te=M.min,ye=M.style,be=M.title,we=M.onMouseEnter,xe=M.onMouseLeave,me=M.onMouseOver,se=M.onMouseOut,Re=M.required,ze=M.onClick,He=M.tabIndex,rt=M.type,ot=M.placeholder,Oe=M.id,Le=M.inputMode,Ue=M.pattern,Ge=M.step,je=M.maxLength,Me=M.autoFocus,Pe=M.name,ut=M.onPaste,tt=M.onInput,qe=Object(ae.a)(M,["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"]),$e=this.state,ft=$e.value,nt=$e.focused,Ye=m()(P,(b={},Object(J.a)(b,re,!!re),Object(J.a)(b,"".concat(P,"-disabled"),K),Object(J.a)(b,"".concat(P,"-focused"),nt),b)),Ae={};Object.keys(qe).forEach(function(he){(he.substr(0,5)==="data-"||he.substr(0,5)==="aria-"||he==="role")&&(Ae[he]=qe[he])});var ct=!V&&!K,Je=this.getInputDisplayValue(null),Se=(ft||ft===0)&&(isNaN(ft)||Number(ft)>=ue),Ne=(ft||ft===0)&&(isNaN(ft)||Number(ft)<=Te),ve=Se||K||V,de=Ne||K||V,pe=m()("".concat(P,"-handler"),"".concat(P,"-handler-up"),Object(J.a)({},"".concat(P,"-handler-up-disabled"),ve)),te=m()("".concat(P,"-handler"),"".concat(P,"-handler-down"),Object(J.a)({},"".concat(P,"-handler-down-disabled"),de)),ie=B?{onTouchStart:ve?o:this.up,onTouchEnd:this.stop}:{onMouseDown:ve?o:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},oe=B?{onTouchStart:de?o:this.down,onTouchEnd:this.stop}:{onMouseDown:de?o:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return k.a.createElement("div",{className:Ye,style:ye,title:be,onMouseEnter:we,onMouseLeave:xe,onMouseOver:me,onMouseOut:se,onFocus:function(){return null},onBlur:function(){return null}},k.a.createElement("div",{className:"".concat(P,"-handler-wrap")},k.a.createElement("span",Object.assign({unselectable:"on"},ie,{role:"button","aria-label":"Increase Value","aria-disabled":ve,className:pe}),$||k.a.createElement("span",{unselectable:"on",className:"".concat(P,"-handler-up-inner"),onClick:s})),k.a.createElement("span",Object.assign({unselectable:"on"},oe,{role:"button","aria-label":"Decrease Value","aria-disabled":de,className:te}),ee||k.a.createElement("span",{unselectable:"on",className:"".concat(P,"-handler-down-inner"),onClick:s}))),k.a.createElement("div",{className:"".concat(P,"-input-wrap")},k.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Te,"aria-valuemax":ue,"aria-valuenow":ft,required:Re,type:rt,placeholder:ot,onPaste:ut,onClick:ze,onMouseUp:this.onMouseUp,className:"".concat(P,"-input"),tabIndex:He,autoComplete:C,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:ct?this.onKeyDown:o,onKeyUp:ct?this.onKeyUp:o,autoFocus:Me,maxLength:je,readOnly:V,disabled:K,max:ue,min:Te,step:Ge,name:Pe,title:be,id:Oe,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Je),pattern:Ue,inputMode:Le,onInput:tt},Ae))))}}]),_}(k.a.Component);A.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:w,min:-w,step:1,style:{},onChange:o,onKeyDown:o,onPressEnter:o,onFocus:o,onBlur:o,parser:l,required:!1,autoComplete:"off"};var T=A,E=et.a=T},fB9n:function(vt,et,ne){"use strict";ne.r(et);var ae=ne("14J3"),J=ne("BMrR"),D=ne("jCWc"),Y=ne("kPKH"),F=ne("k1fw"),U=ne("9og8"),W=ne("tJVT"),j=ne("PpiC"),k=ne("WmNS"),I=ne.n(k),m=ne("q1tI"),c=ne.n(m),f=ne("55Ip"),u=ne("9kvl"),r=ne("T2oS"),d=ne("W9HT"),o=ne("oBTY"),s=ne("B9cy"),l=ne("Ol7k"),p=ne("lUTK"),R=ne("BvKs"),w=ne("Ty5D"),x=ne("wd/R"),O=ne.n(x),A=ne("RotF"),T=ne.n(A),E=ne("m3rI"),y=ne("9Bee"),h=ne("SbmS"),_=ne.n(h),g=R.a.SubMenu,b=l.a.Sider,M=l.a.Content,P=function(Le){var Ue=Le.messages,Ge=Le.globalSetting,je=Le.loading,Me=Le.user,Pe=Le.dispatch,ut=Object(j.a)(Le,["messages","globalSetting","loading","user","dispatch"]),tt=Object(w.i)(),qe=Object(w.h)(),$e=Me.userInfo,ft=Object(m.useState)(!1),nt=Object(W.a)(ft,2),Ye=nt[0],Ae=nt[1],ct=Object(m.useState)({per_page:20,page:1}),Je=Object(W.a)(ct,2),Se=Je[0],Ne=Je[1],ve=Object(m.useState)({per_page:20,page:1}),de=Object(W.a)(ve,2),pe=de[0],te=de[1],ie=Object(m.useState)([]),oe=Object(W.a)(ie,2),he=oe[0],ge=oe[1];Object(m.useEffect)(function(){Se.page=1,De()},[tt.userId]);var Ce=function(ht){var it,mt;u.d.push("/messages/".concat(Me==null||((it=Me.userInfo)===null||it===void 0)?void 0:it.login,"/message_detail?target_ids=").concat(ht==null||((mt=ht.target)===null||mt===void 0)?void 0:mt.id))},De=function(){var Ke=Object(U.a)(I.a.mark(function ht(){var it,mt;return I.a.wrap(function(Qe){for(;;)switch(Qe.prev=Qe.next){case 0:return Ae(!1),Qe.next=3,Pe({type:"messages/getPrivateMessages",payload:Object(F.a)(Object(F.a)({},tt),pe)});case 3:it=Qe.sent,it!=null&&it.private_messages&&(ge([].concat(Object(o.a)(he),Object(o.a)(it.private_messages))),((mt=it.private_messages)===null||mt===void 0?void 0:mt.length)===20&&Ae(!0));case 5:case"end":return Qe.stop()}},ht)}));return function(){return Ke.apply(this,arguments)}}();return c.a.createElement("aside",{className:_.a.listRightMessage},c.a.createElement(T.a,{loadMore:function(){pe.page++,De()},hasMore:Ye,useWindow:!1},c.a.createElement(d.a,{spinning:je["messages/getPrivateMessages"]},c.a.createElement("div",{className:"minH500"},he==null?void 0:he.map(function(Ke,ht){var it,mt;return c.a.createElement("aside",{key:ht},c.a.createElement(J.a,{onClick:function(){return Ce(Ke)}},c.a.createElement(Y.a,{flex:"58px"},c.a.createElement("img",{src:E.a.IMG_SERVER+"/images/"+(Ke==null||((it=Ke.target)===null||it===void 0)?void 0:it.image_url),alt:""})),c.a.createElement(Y.a,{flex:"1"},c.a.createElement(J.a,null,c.a.createElement(Y.a,{span:24},c.a.createElement(J.a,null,c.a.createElement(Y.a,{flex:"1"},c.a.createElement("span",{className:_.a.userName},Ke==null||((mt=Ke.target)===null||mt===void 0)?void 0:mt.name)),c.a.createElement(Y.a,null,c.a.createElement("span",{className:"ml15 c-grey-c"},O()(Ke.send_time).fromNow())))),c.a.createElement(Y.a,{span:24},c.a.createElement("div",{className:["mt15",_.a.content].join(" ")},c.a.createElement(y.a,{value:Ke.content||""})))))))})))))},K=Object(u.a)(function(Oe){var Le=Oe.messages,Ue=Oe.loading,Ge=Oe.user,je=Oe.globalSetting;return{messages:Le,globalSetting:je,user:Ge,loading:Ue.effects}})(P),V=ne("+L6B"),B=ne("2/Rp"),C=ne("miYZ"),$=ne("tsqr"),ee=ne("y8nQ"),re=ne("Vl3Y"),ue=ne("kaH+"),Te=ne("1vsH"),ye=ne("5WQS"),be=ne("Ot1p"),we=ne("dhSg"),xe=R.a.SubMenu,me=l.a.Sider,se=l.a.Content,Re=function(Le){var Ue=Le.messages,Ge=Le.globalSetting,je=Le.loading,Me=Le.user,Pe=Le.dispatch,ut=Object(j.a)(Le,["messages","globalSetting","loading","user","dispatch"]),tt=Object(w.i)(),qe=Object(w.h)(),$e=qe.query,ft=Object(m.useState)({per_page:20,page:1}),nt=Object(W.a)(ft,2),Ye=nt[0],Ae=nt[1],ct=Object(m.useState)([]),Je=Object(W.a)(ct,2),Se=Je[0],Ne=Je[1],ve=Object(m.useState)(!1),de=Object(W.a)(ve,2),pe=de[0],te=de[1],ie=Object(m.useState)(!1),oe=Object(W.a)(ie,2),he=oe[0],ge=oe[1],Ce=Object(m.useState)(""),De=Object(W.a)(Ce,2),Ke=De[0],ht=De[1],it=Object(m.useRef)(),mt=re.a.useForm(),_t=Object(W.a)(mt,1),Qe=_t[0],Ft=Object(m.useState)([]),Ct=Object(W.a)(Ft,2),Yt=Ct[0],$t=Ct[1],Lt=Object(m.useState)(!0),di=Object(W.a)(Lt,2),Ii=di[0],Ve=di[1];Object(m.useEffect)(function(){Ye.page=1,St()},[$e.target_ids]);var St=function(){var jt=Object(U.a)(I.a.mark(function Kt(){var Tt,lt;return I.a.wrap(function(Ei){for(;;)switch(Ei.prev=Ei.next){case 0:return te(!1),Ei.next=3,Pe({type:"messages/getPrivateMessageDetails",payload:Object(F.a)(Object(F.a)({},tt),{},{target_id:$e==null?void 0:$e.target_ids},Ye)});case 3:Tt=Ei.sent,Tt!=null&&Tt.messages&&(Yt=Tt==null?void 0:Tt.messages,((lt=Yt)===null||lt===void 0?void 0:lt.length)===20&&setTimeout(function(){te(!0),Ve(!1)},500),Ye.page===1?Ne(Object(o.a)(Tt==null?void 0:Tt.messages.reverse())):Ne([].concat(Object(o.a)(Se),Object(o.a)(Tt==null?void 0:Tt.messages.reverse()))));case 5:case"end":return Ei.stop()}},Kt)}));return function(){return jt.apply(this,arguments)}}();Object(m.useEffect)(function(){console.log("newData.length:",Ye,Yt.length,Yt),Ye.page===1&&Ii&&(it.current.scrollTop=it.current.scrollHeight)},[Se]),Object(m.useEffect)(function(){it.current.onclick=function(jt){jt.target.nodeName==="IMG"&&jt.target.alt!==""&&we.a.publish("preview-image",jt.target.src)}},[]);var Rt=function(){var jt=Object(U.a)(I.a.mark(function Kt(Tt,lt){var Ai;return I.a.wrap(function(ii){for(;;)switch(ii.prev=ii.next){case 0:return ii.next=2,Object(ye.a)(Object(F.a)(Object(F.a)({},tt),{},{id:Tt.id}));case 2:Ai=ii.sent,Ai.status===0&&(Se.splice(lt,1),Ne(Object(o.a)(Se)));case 4:case"end":return ii.stop()}},Kt)}));return function(Tt,lt){return jt.apply(this,arguments)}}(),It=function(){var jt=Object(U.a)(I.a.mark(function Kt(){return I.a.wrap(function(lt){for(;;)switch(lt.prev=lt.next){case 0:if(!(Ke==="")){lt.next=3;break}return $.b.error("\u8BF7\u8F93\u5165\u60A8\u7684\u56DE\u590D"),lt.abrupt("return",!1);case 3:return ht(""),ge(!0),lt.next=7,Object(ye.g)(Object(F.a)(Object(F.a)({},tt),{},{content:Ke,target_id:$e==null?void 0:$e.target_ids}));case 7:ge(!1),Ye.page=1,Qe.resetFields(),St();case 11:case"end":return lt.stop()}},Kt)}));return function(){return jt.apply(this,arguments)}}(),qt=Object(m.useMemo)(function(){var jt=Me||{},Kt=jt.userInfo;return(Kt==null?void 0:Kt.is_teacher)&&(Kt==null?void 0:Kt.professional_certification)},[Me]);return c.a.createElement("section",null,c.a.createElement("aside",{className:_.a.listMessage,ref:it},c.a.createElement(T.a,{isReverse:!0,loadMore:function(){Ye.page++,St()},hasMore:pe,useWindow:!1},!pe&&c.a.createElement("div",{className:"tc mt20 animated fadeIn"},c.a.createElement("span",{className:_.a.msgDate},"\u6CA1\u6709\u4FE1\u606F\u4E86\uFF5E\uFF5E")),c.a.createElement(d.a,{spinning:je["messages/getPrivateMessageDetails"]},c.a.createElement("aside",{className:"minH500"},Se==null?void 0:Se.map(function(jt,Kt){var Tt;return c.a.createElement("aside",{key:Kt},c.a.createElement(J.a,{justify:"center"},c.a.createElement(Y.a,{flex:"1",className:"tc"},c.a.createElement("span",{className:_.a.msgDate},O()(jt.send_time).format("YYYY-MM-DD")))),c.a.createElement(J.a,{onClick:function(){return Object(Te.J)(jt)}},c.a.createElement(Y.a,{flex:"58px"},c.a.createElement("img",{src:E.a.IMG_SERVER+"/images/"+(jt==null||((Tt=jt.sender)===null||Tt===void 0)?void 0:Tt.image_url),alt:""})),c.a.createElement(Y.a,null,c.a.createElement("div",{className:_.a.msg},c.a.createElement(y.a,{value:jt.content||""}),c.a.createElement("span",{onClick:function(){return Rt(jt,Kt)},className:["current",_.a.deleteMsg].join(" ")},"\u5220\u9664"))),c.a.createElement(Y.a,null,c.a.createElement("span",{className:"c-grey-c ml10"},O()(jt.send_time).format("HH:mm")))))}))))),c.a.createElement("aside",{className:"pl30 pr30 mb30 mt30"},qt?c.a.createElement(re.a,{form:Qe},c.a.createElement(re.a.Item,{name:"content"},c.a.createElement(be.a,{placeholder:"\u8BF7\u8F93\u5165\u4F60\u7684\u56DE\u590D",height:150,onChange:function(Kt){return ht(Kt)}})),c.a.createElement(J.a,null,c.a.createElement(Y.a,{flex:"1"},c.a.createElement("span",{className:"c-red font14"},"\u5728\u95EE\u9898\u53CD\u9988\u65F6\uFF0C\u8BF7\u540C\u65F6\u53D1\u9001\u95EE\u9898\u53D1\u751F\u9875\u7684\u7F51\u5740\u94FE\u63A5\uFF0C\u4EE5\u4FBF\u6211\u4EEC\u9AD8\u6548\u7684\u4E3A\u60A8\u670D\u52A1")),c.a.createElement(Y.a,null,c.a.createElement(B.a,{loading:he,type:"primary",onClick:function(){return It()}},"\u56DE\u590D")))):c.a.createElement("p",{className:"c-red font14",style:{textAlign:"center"}},"\u4EC5\u804C\u4E1A\u8BA4\u8BC1\u7684\u6559\u5E08\u53EF\u4EE5\u4F7F\u7528\u79C1\u4FE1\u529F\u80FD")),c.a.createElement(ue.a,null))},ze=Object(u.a)(function(Oe){var Le=Oe.messages,Ue=Oe.loading,Ge=Oe.user,je=Oe.globalSetting;return{messages:Le,globalSetting:je,user:Ge,loading:Ue.effects}})(Re),He=ne("30zm"),rt=function(Le){var Ue,Ge=Le.messages,je=Le.globalSetting,Me=Le.loading,Pe=Le.user,ut=Le.dispatch,tt=Object(j.a)(Le,["messages","globalSetting","loading","user","dispatch"]),qe=tt.match.params,$e=tt.location.query,ft=Pe.userInfo,nt=Ge.tidingsList,Ye=Ge.privateMessageDetails,Ae=Object(m.useState)({per_page:20,page:1}),ct=Object(W.a)(Ae,2),Je=ct[0],Se=ct[1],Ne=Object(m.useState)({per_page:20,page:1}),ve=Object(W.a)(Ne,2),de=ve[0],pe=ve[1],te=Object(m.useState)([]),ie=Object(W.a)(te,2),oe=ie[0],he=ie[1],ge=Object(m.useState)([]),Ce=Object(W.a)(ge,2),De=Ce[0],Ke=Ce[1];Object(m.useEffect)(function(){Je.page=1},[qe.userId]);var ht=function(){var mt=Object(U.a)(I.a.mark(function _t(){var Qe;return I.a.wrap(function(Ct){for(;;)switch(Ct.prev=Ct.next){case 0:return Ct.next=2,ut({type:"messages/getPrivateMessageDetails",payload:Object(F.a)(Object(F.a)({},qe),{},{target_id:$e==null?void 0:$e.target_ids})});case 2:Qe=Ct.sent,Qe!=null&&Qe.messages&&he(Qe.messages);case 4:case"end":return Ct.stop()}},_t)}));return function(){return mt.apply(this,arguments)}}(),it=function(){var mt=Object(U.a)(I.a.mark(function _t(){var Qe;return I.a.wrap(function(Ct){for(;;)switch(Ct.prev=Ct.next){case 0:return Ct.next=2,ut({type:"messages/getPrivateMessages",payload:Object(F.a)(Object(F.a)({},qe),de)});case 2:Qe=Ct.sent,Qe!=null&&Qe.private_messages&&Ke(Qe.private_messages);case 4:case"end":return Ct.stop()}},_t)}));return function(){return mt.apply(this,arguments)}}();return c.a.createElement("section",{className:_.a.bg},c.a.createElement("section",{className:"edu-container mt20"},c.a.createElement(J.a,{gutter:[20,20]},c.a.createElement(He.a,null),c.a.createElement(Y.a,{flex:"1"},c.a.createElement("aside",{className:"bg-white"},c.a.createElement("aside",{className:["font16",_.a.topBar].join(" ")},c.a.createElement(J.a,null,c.a.createElement(Y.a,{flex:"30px",className:"tc"},c.a.createElement(f.a,{to:"/messages/".concat(qe.userId,"/private_messages"),className:"iconfont icon-zuojiantou c-black pl10"})),c.a.createElement(Y.a,{flex:"1",className:"tc"},Ye==null||((Ue=Ye.target)===null||Ue===void 0)?void 0:Ue.name,"\u4E0E\u4F60\u7684\u79C1\u4FE1"),c.a.createElement(Y.a,{flex:"290px",className:"tl"},c.a.createElement("span",{className:"pl30"},"\u79C1\u4FE1\u5217\u8868")))),c.a.createElement(J.a,null,c.a.createElement(Y.a,{flex:"1"},c.a.createElement(ze,null)),c.a.createElement(Y.a,{flex:"290px"},c.a.createElement(K,null))))))))},ot=et.default=Object(u.a)(function(Oe){var Le=Oe.messages,Ue=Oe.loading,Ge=Oe.user,je=Oe.globalSetting;return{messages:Le,globalSetting:je,user:Ge,loading:Ue.effects}})(rt)},kSUc:function(vt,et,ne){},"kaH+":function(vt,et,ne){"use strict";var ae=ne("+L6B"),J=ne("2/Rp"),D=ne("tJVT"),Y=ne("q1tI"),F=ne.n(Y),U=ne("UZu5"),W=ne.n(U),j=ne("dhSg"),k=ne("rLCj"),I=ne("dF/Y"),m=ne("4i/N");et.a=function(){var c=Object(Y.useState)(""),f=Object(D.a)(c,2),u=f[0],r=f[1],d=Object(Y.useState)(0),o=Object(D.a)(d,2),s=o[0],l=o[1],p=Object(Y.useRef)("");Object(Y.useEffect)(function(){var E=j.a.subscribe("preview-image",function(y){r(y),document.body.style.overflow="hidden"});return E},[]),Object(Y.useEffect)(function(){return document.addEventListener("keydown",R),function(){document.removeEventListener("keydown",R)}},[]),Object(Y.useEffect)(function(){p.current=u},[u]);function R(E){E.keyCode==27&&p.current&&w()}function w(){document.body.style.overflow="auto",r("")}function x(){l(s+90)}var O=Object(Y.useRef)(),A=Object(Y.useRef)(),T=function(y){(y.nativeEvent.target===O.current||y.nativeEvent.target===A.current)&&w()};return F.a.createElement(Y.Fragment,null,u?F.a.createElement("div",{className:"image-preview-container",ref:O,onClick:T},F.a.createElement("div",{className:"button-group"},F.a.createElement(J.a,{onClick:x},"\u65CB\u8F6C",F.a.createElement(k.a,null)),F.a.createElement(J.a,{href:u},"\u4E0B\u8F7D",F.a.createElement(I.a,null)),F.a.createElement(J.a,{onClick:w},"\u5173\u95ED",F.a.createElement(m.a,null))),F.a.createElement("div",{className:"preview-wrp-group",ref:A},F.a.createElement("img",{className:"image-preview",src:u,alt:"\u9884\u89C8\u5927\u56FE",style:{transform:"rotate(".concat(s,"deg)")}}))):null)}},kzJb:function(vt,et,ne){vt.exports={flex_box_center:"flex_box_center___2qtoc",flex_space_between:"flex_space_between___NF1Yf",flex_box_vertical_center:"flex_box_vertical_center___2qH_j",flex_box_center_end:"flex_box_center_end___22P0N",flex_box_column:"flex_box_column___1IKP8",userInfo:"userInfo___2Dupy",navInfo:"navInfo___3fEvD",actived:"actived___3F322",newTip:"newTip___1Ta-b"}},lZu9:function(vt,et,ne){(function(ae){ae(ne("VrN/"),ne("1eCo"),ne("8EBN"))})(function(ae){"use strict";ae.defineMode("markdown",function(J,D){var Y=ae.getMode(J,"text/html"),F=Y.name=="null";function U(B){if(ae.findModeByName){var C=ae.findModeByName(B);C&&(B=C.mime||C.mimes[0])}var $=ae.getMode(J,B);return $.name=="null"?null:$}D.highlightFormatting===void 0&&(D.highlightFormatting=!1),D.maxBlockquoteDepth===void 0&&(D.maxBlockquoteDepth=0),D.taskLists===void 0&&(D.taskLists=!1),D.strikethrough===void 0&&(D.strikethrough=!1),D.emoji===void 0&&(D.emoji=!1),D.fencedCodeBlockHighlighting===void 0&&(D.fencedCodeBlockHighlighting=!0),D.fencedCodeBlockDefaultMode===void 0&&(D.fencedCodeBlockDefaultMode="text/plain"),D.xml===void 0&&(D.xml=!0),D.tokenTypeOverrides===void 0&&(D.tokenTypeOverrides={});var W={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 j in W)W.hasOwnProperty(j)&&D.tokenTypeOverrides[j]&&(W[j]=D.tokenTypeOverrides[j]);var k=/^([*\-_])(?:\s*\1){2,}\s*$/,I=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,m=/^\[(x| )\](?=\s)/i,c=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,f=/^ {0,3}(?:\={1,}|-{2,})\s*$/,u=/^[^#!\[\]*_\\<>` "'(~:]+/,r=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,d=/^\s*\[[^\]]+?\]:.*$/,o=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,s=" ";function l(B,C,$){return C.f=C.inline=$,$(B,C)}function p(B,C,$){return C.f=C.block=$,$(B,C)}function R(B){return!B||!/\S/.test(B.string)}function w(B){if(B.linkTitle=!1,B.linkHref=!1,B.linkText=!1,B.em=!1,B.strong=!1,B.strikethrough=!1,B.quote=0,B.indentedCode=!1,B.f==O){var C=F;if(!C){var $=ae.innerMode(Y,B.htmlState);C=$.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText}C&&(B.f=y,B.block=x,B.htmlState=null)}return B.trailingSpace=0,B.trailingSpaceNewLine=!1,B.prevLine=B.thisLine,B.thisLine={stream:null},null}function x(B,C){var $=B.column()===C.indentation,ee=R(C.prevLine.stream),re=C.indentedCode,ue=C.prevLine.hr,Te=C.list!==!1,ye=(C.listStack[C.listStack.length-1]||0)+3;C.indentedCode=!1;var be=C.indentation;if(C.indentationDiff===null&&(C.indentationDiff=C.indentation,Te)){for(C.list=null;be<C.listStack[C.listStack.length-1];)C.listStack.pop(),C.listStack.length?C.indentation=C.listStack[C.listStack.length-1]:C.list=!1;C.list!==!1&&(C.indentationDiff=be-C.listStack[C.listStack.length-1])}var we=!ee&&!ue&&!C.prevLine.header&&(!Te||!re)&&!C.prevLine.fencedCodeEnd,xe=(C.list===!1||ue||ee)&&C.indentation<=ye&&B.match(k),me=null;if(C.indentationDiff>=4&&(re||C.prevLine.fencedCodeEnd||C.prevLine.header||ee))return B.skipToEnd(),C.indentedCode=!0,W.code;if(B.eatSpace())return null;if($&&C.indentation<=ye&&(me=B.match(c))&&me[1].length<=6)return C.quote=0,C.header=me[1].length,C.thisLine.header=!0,D.highlightFormatting&&(C.formatting="header"),C.f=C.inline,T(C);if(C.indentation<=ye&&B.eat(">"))return C.quote=$?1:C.quote+1,D.highlightFormatting&&(C.formatting="quote"),B.eatSpace(),T(C);if(!xe&&!C.setext&&$&&C.indentation<=ye&&(me=B.match(I))){var se=me[1]?"ol":"ul";return C.indentation=be+B.current().length,C.list=!0,C.quote=0,C.listStack.push(C.indentation),C.em=!1,C.strong=!1,C.code=!1,C.strikethrough=!1,D.taskLists&&B.match(m,!1)&&(C.taskList=!0),C.f=C.inline,D.highlightFormatting&&(C.formatting=["list","list-"+se]),T(C)}else{if($&&C.indentation<=ye&&(me=B.match(r,!0)))return C.quote=0,C.fencedEndRE=new RegExp(me[1]+"+ *$"),C.localMode=D.fencedCodeBlockHighlighting&&U(me[2]||D.fencedCodeBlockDefaultMode),C.localMode&&(C.localState=ae.startState(C.localMode)),C.f=C.block=A,D.highlightFormatting&&(C.formatting="code-block"),C.code=-1,T(C);if(C.setext||(!we||!Te)&&!C.quote&&C.list===!1&&!C.code&&!xe&&!d.test(B.string)&&(me=B.lookAhead(1))&&(me=me.match(f)))return C.setext?(C.header=C.setext,C.setext=0,B.skipToEnd(),D.highlightFormatting&&(C.formatting="header")):(C.header=me[0].charAt(0)=="="?1:2,C.setext=C.header),C.thisLine.header=!0,C.f=C.inline,T(C);if(xe)return B.skipToEnd(),C.hr=!0,C.thisLine.hr=!0,W.hr;if(B.peek()==="[")return l(B,C,M)}return l(B,C,C.inline)}function O(B,C){var $=Y.token(B,C.htmlState);if(!F){var ee=ae.innerMode(Y,C.htmlState);(ee.mode.name=="xml"&&ee.state.tagStart===null&&!ee.state.context&&ee.state.tokenize.isInText||C.md_inside&&B.current().indexOf(">")>-1)&&(C.f=y,C.block=x,C.htmlState=null)}return $}function A(B,C){var $=C.listStack[C.listStack.length-1]||0,ee=C.indentation<$,re=$+3;if(C.fencedEndRE&&C.indentation<=re&&(ee||B.match(C.fencedEndRE))){D.highlightFormatting&&(C.formatting="code-block");var ue;return ee||(ue=T(C)),C.localMode=C.localState=null,C.block=x,C.f=y,C.fencedEndRE=null,C.code=0,C.thisLine.fencedCodeEnd=!0,ee?p(B,C,C.block):ue}else return C.localMode?C.localMode.token(B,C.localState):(B.skipToEnd(),W.code)}function T(B){var C=[];if(B.formatting){C.push(W.formatting),typeof B.formatting=="string"&&(B.formatting=[B.formatting]);for(var $=0;$<B.formatting.length;$++)C.push(W.formatting+"-"+B.formatting[$]),B.formatting[$]==="header"&&C.push(W.formatting+"-"+B.formatting[$]+"-"+B.header),B.formatting[$]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=B.quote?C.push(W.formatting+"-"+B.formatting[$]+"-"+B.quote):C.push("error"))}if(B.taskOpen)return C.push("meta"),C.length?C.join(" "):null;if(B.taskClosed)return C.push("property"),C.length?C.join(" "):null;if(B.linkHref?C.push(W.linkHref,"url"):(B.strong&&C.push(W.strong),B.em&&C.push(W.em),B.strikethrough&&C.push(W.strikethrough),B.emoji&&C.push(W.emoji),B.linkText&&C.push(W.linkText),B.code&&C.push(W.code),B.image&&C.push(W.image),B.imageAltText&&C.push(W.imageAltText,"link"),B.imageMarker&&C.push(W.imageMarker)),B.header&&C.push(W.header,W.header+"-"+B.header),B.quote&&(C.push(W.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=B.quote?C.push(W.quote+"-"+B.quote):C.push(W.quote+"-"+D.maxBlockquoteDepth)),B.list!==!1){var ee=(B.listStack.length-1)%3;ee?ee===1?C.push(W.list2):C.push(W.list3):C.push(W.list1)}return B.trailingSpaceNewLine?C.push("trailing-space-new-line"):B.trailingSpace&&C.push("trailing-space-"+(B.trailingSpace%2?"a":"b")),C.length?C.join(" "):null}function E(B,C){return B.match(u,!0)?T(C):void 0}function y(B,C){var $=C.text(B,C);if(typeof $!="undefined")return $;if(C.list)return C.list=null,T(C);if(C.taskList){var ee=B.match(m,!0)[1]===" ";return ee?C.taskOpen=!0:C.taskClosed=!0,D.highlightFormatting&&(C.formatting="task"),C.taskList=!1,T(C)}if(C.taskOpen=!1,C.taskClosed=!1,C.header&&B.match(/^#+$/,!0))return D.highlightFormatting&&(C.formatting="header"),T(C);var re=B.next();if(C.linkTitle){C.linkTitle=!1;var ue=re;re==="("&&(ue=")"),ue=(ue+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Te="^\\s*(?:[^"+ue+"\\\\]+|\\\\\\\\|\\\\.)"+ue;if(B.match(new RegExp(Te),!0))return W.linkHref}if(re==="`"){var ye=C.formatting;D.highlightFormatting&&(C.formatting="code"),B.eatWhile("`");var be=B.current().length;if(C.code==0&&(!C.quote||be==1))return C.code=be,T(C);if(be==C.code){var we=T(C);return C.code=0,we}else return C.formatting=ye,T(C)}else if(C.code)return T(C);if(re==="\\"&&(B.next(),D.highlightFormatting)){var xe=T(C),me=W.formatting+"-escape";return xe?xe+" "+me:me}if(re==="!"&&B.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return C.imageMarker=!0,C.image=!0,D.highlightFormatting&&(C.formatting="image"),T(C);if(re==="["&&C.imageMarker&&B.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return C.imageMarker=!1,C.imageAltText=!0,D.highlightFormatting&&(C.formatting="image"),T(C);if(re==="]"&&C.imageAltText){D.highlightFormatting&&(C.formatting="image");var xe=T(C);return C.imageAltText=!1,C.image=!1,C.inline=C.f=_,xe}if(re==="["&&!C.image)return C.linkText&&B.match(/^.*?\]/)||(C.linkText=!0,D.highlightFormatting&&(C.formatting="link")),T(C);if(re==="]"&&C.linkText){D.highlightFormatting&&(C.formatting="link");var xe=T(C);return C.linkText=!1,C.inline=C.f=B.match(/\(.*?\)| ?\[.*?\]/,!1)?_:y,xe}if(re==="<"&&B.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){C.f=C.inline=h,D.highlightFormatting&&(C.formatting="link");var xe=T(C);return xe?xe+=" ":xe="",xe+W.linkInline}if(re==="<"&&B.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){C.f=C.inline=h,D.highlightFormatting&&(C.formatting="link");var xe=T(C);return xe?xe+=" ":xe="",xe+W.linkEmail}if(D.xml&&re==="<"&&B.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var se=B.string.indexOf(">",B.pos);if(se!=-1){var Re=B.string.substring(B.start,se);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Re)&&(C.md_inside=!0)}return B.backUp(1),C.htmlState=ae.startState(Y),p(B,C,O)}if(D.xml&&re==="<"&&B.match(/^\/\w*?>/))return C.md_inside=!1,"tag";if(re==="*"||re==="_"){for(var ze=1,He=B.pos==1?" ":B.string.charAt(B.pos-2);ze<3&&B.eat(re);)ze++;var rt=B.peek()||" ",ot=!/\s/.test(rt)&&(!o.test(rt)||/\s/.test(He)||o.test(He)),Oe=!/\s/.test(He)&&(!o.test(He)||/\s/.test(rt)||o.test(rt)),Le=null,Ue=null;if(ze%2&&(!C.em&&ot&&(re==="*"||!Oe||o.test(He))?Le=!0:C.em==re&&Oe&&(re==="*"||!ot||o.test(rt))&&(Le=!1)),ze>1&&(!C.strong&&ot&&(re==="*"||!Oe||o.test(He))?Ue=!0:C.strong==re&&Oe&&(re==="*"||!ot||o.test(rt))&&(Ue=!1)),Ue!=null||Le!=null){D.highlightFormatting&&(C.formatting=Le==null?"strong":Ue==null?"em":"strong em"),Le===!0&&(C.em=re),Ue===!0&&(C.strong=re);var we=T(C);return Le===!1&&(C.em=!1),Ue===!1&&(C.strong=!1),we}}else if(re===" "&&(B.eat("*")||B.eat("_"))){if(B.peek()===" ")return T(C);B.backUp(1)}if(D.strikethrough){if(re==="~"&&B.eatWhile(re)){if(C.strikethrough){D.highlightFormatting&&(C.formatting="strikethrough");var we=T(C);return C.strikethrough=!1,we}else if(B.match(/^[^\s]/,!1))return C.strikethrough=!0,D.highlightFormatting&&(C.formatting="strikethrough"),T(C)}else if(re===" "&&B.match(/^~~/,!0)){if(B.peek()===" ")return T(C);B.backUp(2)}}if(D.emoji&&re===":"&&B.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){C.emoji=!0,D.highlightFormatting&&(C.formatting="emoji");var Ge=T(C);return C.emoji=!1,Ge}return re===" "&&(B.match(/^ +$/,!1)?C.trailingSpace++:C.trailingSpace&&(C.trailingSpaceNewLine=!0)),T(C)}function h(B,C){var $=B.next();if($===">"){C.f=C.inline=y,D.highlightFormatting&&(C.formatting="link");var ee=T(C);return ee?ee+=" ":ee="",ee+W.linkInline}return B.match(/^[^>]+/,!0),W.linkInline}function _(B,C){if(B.eatSpace())return null;var $=B.next();return $==="("||$==="["?(C.f=C.inline=b($==="("?")":"]"),D.highlightFormatting&&(C.formatting="link-string"),C.linkHref=!0,T(C)):"error"}var g={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function b(B){return function(C,$){var ee=C.next();if(ee===B){$.f=$.inline=y,D.highlightFormatting&&($.formatting="link-string");var re=T($);return $.linkHref=!1,re}return C.match(g[B]),$.linkHref=!0,T($)}}function M(B,C){return B.match(/^([^\]\\]|\\.)*\]:/,!1)?(C.f=P,B.next(),D.highlightFormatting&&(C.formatting="link"),C.linkText=!0,T(C)):l(B,C,y)}function P(B,C){if(B.match(/^\]:/,!0)){C.f=C.inline=K,D.highlightFormatting&&(C.formatting="link");var $=T(C);return C.linkText=!1,$}return B.match(/^([^\]\\]|\\.)+/,!0),W.linkText}function K(B,C){return B.eatSpace()?null:(B.match(/^[^\s]+/,!0),B.peek()===void 0?C.linkTitle=!0:B.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),C.f=C.inline=y,W.linkHref+" url")}var V={startState:function(){return{f:x,prevLine:{stream:null},thisLine:{stream:null},block:x,htmlState:null,indentation:0,inline:y,text:E,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(B){return{f:B.f,prevLine:B.prevLine,thisLine:B.thisLine,block:B.block,htmlState:B.htmlState&&ae.copyState(Y,B.htmlState),indentation:B.indentation,localMode:B.localMode,localState:B.localMode?ae.copyState(B.localMode,B.localState):null,inline:B.inline,text:B.text,formatting:!1,linkText:B.linkText,linkTitle:B.linkTitle,linkHref:B.linkHref,code:B.code,em:B.em,strong:B.strong,strikethrough:B.strikethrough,emoji:B.emoji,header:B.header,setext:B.setext,hr:B.hr,taskList:B.taskList,list:B.list,listStack:B.listStack.slice(0),quote:B.quote,indentedCode:B.indentedCode,trailingSpace:B.trailingSpace,trailingSpaceNewLine:B.trailingSpaceNewLine,md_inside:B.md_inside,fencedEndRE:B.fencedEndRE}},token:function(B,C){if(C.formatting=!1,B!=C.thisLine.stream){if(C.header=0,C.hr=!1,B.match(/^\s*$/,!0))return w(C),null;if(C.prevLine=C.thisLine,C.thisLine={stream:B},C.taskList=!1,C.trailingSpace=0,C.trailingSpaceNewLine=!1,!C.localState&&(C.f=C.block,C.f!=O)){var $=B.match(/^\s*/,!0)[0].replace(/\t/g,s).length;if(C.indentation=$,C.indentationDiff=null,$>0)return null}}return C.f(B,C)},innerMode:function(B){return B.block==O?{state:B.htmlState,mode:Y}:B.localState?{state:B.localState,mode:B.localMode}:{state:B,mode:V}},indent:function(B,C,$){return B.block==O&&Y.indent?Y.indent(B.htmlState,C,$):B.localState&&B.localMode.indent?B.localMode.indent(B.localState,C,$):ae.Pass},blankLine:w,getType:T,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),ae.defineMIME("text/markdown","markdown"),ae.defineMIME("text/x-markdown","markdown")})},osHv:function(vt,et,ne){(function(ae){ae(ne("VrN/"))})(function(ae){"use strict";var J=ae.Pos;function D(o,s){return o.line-s.line||o.ch-s.ch}var Y="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",F=Y+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",U=new RegExp("<(/?)(["+Y+"]["+F+"]*)","g");function W(o,s,l,p){this.line=s,this.ch=l,this.cm=o,this.text=o.getLine(s),this.min=p?Math.max(p.from,o.firstLine()):o.firstLine(),this.max=p?Math.min(p.to-1,o.lastLine()):o.lastLine()}function j(o,s){var l=o.cm.getTokenTypeAt(J(o.line,s));return l&&/\btag\b/.test(l)}function k(o){return o.line>=o.max?void 0:(o.ch=0,o.text=o.cm.getLine(++o.line),!0)}function I(o){return o.line<=o.min?void 0:(o.text=o.cm.getLine(--o.line),o.ch=o.text.length,!0)}function m(o){for(;;){var s=o.text.indexOf(">",o.ch);if(s==-1){if(k(o))continue;return}if(!j(o,s+1)){o.ch=s+1;continue}var l=o.text.lastIndexOf("/",s),p=l>-1&&!/\S/.test(o.text.slice(l+1,s));return o.ch=s+1,p?"selfClose":"regular"}}function c(o){for(;;){var s=o.ch?o.text.lastIndexOf("<",o.ch-1):-1;if(s==-1){if(I(o))continue;return}if(!j(o,s+1)){o.ch=s;continue}U.lastIndex=s,o.ch=s;var l=U.exec(o.text);if(l&&l.index==s)return l}}function f(o){for(;;){U.lastIndex=o.ch;var s=U.exec(o.text);if(!s){if(k(o))continue;return}if(!j(o,s.index+1)){o.ch=s.index+1;continue}return o.ch=s.index+s[0].length,s}}function u(o){for(;;){var s=o.ch?o.text.lastIndexOf(">",o.ch-1):-1;if(s==-1){if(I(o))continue;return}if(!j(o,s+1)){o.ch=s;continue}var l=o.text.lastIndexOf("/",s),p=l>-1&&!/\S/.test(o.text.slice(l+1,s));return o.ch=s+1,p?"selfClose":"regular"}}function r(o,s){for(var l=[];;){var p=f(o),R,w=o.line,x=o.ch-(p?p[0].length:0);if(!p||!(R=m(o)))return;if(R=="selfClose")continue;if(p[1]){for(var O=l.length-1;O>=0;--O)if(l[O]==p[2]){l.length=O;break}if(O<0&&(!s||s==p[2]))return{tag:p[2],from:J(w,x),to:J(o.line,o.ch)}}else l.push(p[2])}}function d(o,s){for(var l=[];;){var p=u(o);if(!p)return;if(p=="selfClose"){c(o);continue}var R=o.line,w=o.ch,x=c(o);if(!x)return;if(x[1])l.push(x[2]);else{for(var O=l.length-1;O>=0;--O)if(l[O]==x[2]){l.length=O;break}if(O<0&&(!s||s==x[2]))return{tag:x[2],from:J(o.line,o.ch),to:J(R,w)}}}}ae.registerHelper("fold","xml",function(o,s){for(var l=new W(o,s.line,0);;){var p=f(l);if(!p||l.line!=s.line)return;var R=m(l);if(!R)return;if(!p[1]&&R!="selfClose"){var w=J(l.line,l.ch),x=r(l,p[2]);return x&&D(x.from,w)>0?{from:w,to:x.from}:null}}}),ae.findMatchingTag=function(o,s,l){var p=new W(o,s.line,s.ch,l);if(p.text.indexOf(">")==-1&&p.text.indexOf("<")==-1)return;var R=m(p),w=R&&J(p.line,p.ch),x=R&&c(p);if(!R||!x||D(p,s)>0)return;var O={from:J(p.line,p.ch),to:w,tag:x[2]};return R=="selfClose"?{open:O,close:null,at:"open"}:x[1]?{open:d(p,x[2]),close:O,at:"close"}:(p=new W(o,w.line,w.ch,l),{open:O,close:r(p,x[2]),at:"open"})},ae.findEnclosingTag=function(o,s,l,p){for(var R=new W(o,s.line,s.ch,l);;){var w=d(R,p);if(!w)break;var x=new W(o,s.line,s.ch,l),O=r(x,w.tag);if(O)return{open:w,close:O}}},ae.scanForClosingTag=function(o,s,l,p){var R=new W(o,s.line,s.ch,p?{from:0,to:p}:null);return r(R,l)}})},p5ED:function(vt,et,ne){"use strict";var ae=ne("+L6B"),J=ne("2/Rp"),D=ne("5Dmo"),Y=ne("3S7+"),F=ne("k1fw"),U=ne("tJVT"),W=ne("q1tI"),j=ne.n(W),k=ne("vHTk"),I=ne.n(k),m=ne("yEEn"),c=ne("ZW9T"),f=ne("1vsH");et.a=function(u){var r=u.name,d=u.data,o=u.theme,s=u.type,l=u.filename,p=u.monacoEditor,R=u.className,w=u.style,x=u.close,O=u.onClose,A=u.hasMask,T=Object(W.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),E=Object(U.a)(T,2),y=E[0],h=E[1],_=Object(W.useState)(""),g=Object(U.a)(_,2),b=g[0],M=g[1],P,K=1024*1024,V=10*K,B=Object(W.useRef)();s==="office"&&(P=Object(f.T)(d).filesize,P>V&&(s="other")),l&&(p.filename=l),Object(W.useEffect)(function(){var ee,re,ue=(ee=document.cookie)===null||ee===void 0||((re=ee.replace(/\s/g,""))===null||re===void 0)?void 0:re.split(";");ue==null||ue.map(function(Te){var ye=Te.split("=");ye[0]==="_educoder_session"&&M(ye[1])})},[]);var C=function(){if(d.startsWith("http")||d.startsWith("/")){$();return}Object(f.z)(l||"educoder",d,l)},$=function(){Object(f.x)(l||r,d)};return console.log("data:",d,"fileanme:",l," name:",r),j.a.createElement("div",{style:Object(F.a)({},w||{}),className:"".concat(A&&I.a.bgBlack," ").concat(s?I.a.wrp:"hide")},x&&j.a.createElement("div",{className:I.a.close,ref:B},j.a.createElement(Y.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return B.current}},j.a.createElement("span",{onClick:$},j.a.createElement("i",{className:"icon-quxiaozhiding"}))),j.a.createElement(Y.a,{title:"\u5173\u95ED",getPopupContainer:function(){return B.current}},j.a.createElement("span",{className:"",onClick:O},j.a.createElement("i",{className:"icon-guanbi1"})))),j.a.createElement("div",{className:"".concat(I.a[R]," ").concat(R," ").concat(I.a.monaco," ").concat(s==="txt"?"show":"hide")},s==="txt"&&j.a.createElement(c.b,p)),s==="audio"&&j.a.createElement("audio",{src:"".concat(d!=null&&d.startsWith("/")||(d==null?void 0:d.indexOf("https://"))>-1?d:"data:audio/mp3;base64,").concat(d),autoPlay:!0}),s==="video"&&j.a.createElement(j.a.Fragment,null,d!=null&&d.startsWith("/")?j.a.createElement("video",{controls:!0,src:"".concat(d),autoPlay:!0}):j.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(d),autoPlay:!0})),s==="html"&&j.a.createElement("iframe",{src:d+"&disposition=inline"}),s==="pdf"&&j.a.createElement("embed",{className:I.a.embed,src:d}),s==="image"&&j.a.createElement(j.a.Fragment,null,j.a.createElement("img",{src:"".concat(d!=null&&d.startsWith("/")||(d==null?void 0:d.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(d)})),s==="other"&&j.a.createElement("div",null,j.a.createElement(J.a,{type:"primary",size:"large",onClick:C},j.a.createElement(m.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(s==="download"||s==="office")&&j.a.createElement(J.a,{type:"primary",size:"large",onClick:C},j.a.createElement(m.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(vt,et,ne){},psGv:function(vt,et,ne){var ae,J;(function(){var D;(function(){"use strict";var W=[,,function(m){function c(r){this.__parent=r,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}c.prototype.clone_empty=function(){var r=new c(this.__parent);return r.set_indent(this.__indent_count,this.__alignment_count),r},c.prototype.item=function(r){return r<0?this.__items[this.__items.length+r]:this.__items[r]},c.prototype.has_match=function(r){for(var d=this.__items.length-1;d>=0;d--)if(this.__items[d].match(r))return!0;return!1},c.prototype.set_indent=function(r,d){this.is_empty()&&(this.__indent_count=r||0,this.__alignment_count=d||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},c.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},c.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},c.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var r=this.__parent.current_line;return r.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),r.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),r.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,r.__items[0]===" "&&(r.__items.splice(0,1),r.__character_count-=1),!0}return!1},c.prototype.is_empty=function(){return this.__items.length===0},c.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},c.prototype.push=function(r){this.__items.push(r);var d=r.lastIndexOf(`
|
|
`);d!==-1?this.__character_count=r.length-d:this.__character_count+=r.length},c.prototype.pop=function(){var r=null;return this.is_empty()||(r=this.__items.pop(),this.__character_count-=r.length),r},c.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},c.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},c.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},c.prototype.toString=function(){var r="";return this.is_empty()?this.__parent.indent_empty_lines&&(r=this.__parent.get_indent_string(this.__indent_count)):(r=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),r+=this.__items.join("")),r};function f(r,d){this.__cache=[""],this.__indent_size=r.indent_size,this.__indent_string=r.indent_char,r.indent_with_tabs||(this.__indent_string=new Array(r.indent_size+1).join(r.indent_char)),d=d||"",r.indent_level>0&&(d=new Array(r.indent_level+1).join(this.__indent_string)),this.__base_string=d,this.__base_string_length=d.length}f.prototype.get_indent_size=function(r,d){var o=this.__base_string_length;return d=d||0,r<0&&(o=0),o+=r*this.__indent_size,o+=d,o},f.prototype.get_indent_string=function(r,d){var o=this.__base_string;return d=d||0,r<0&&(r=0,o=""),d+=r*this.__indent_size,this.__ensure_cache(d),o+=this.__cache[d],o},f.prototype.__ensure_cache=function(r){for(;r>=this.__cache.length;)this.__add_column()},f.prototype.__add_column=function(){var r=this.__cache.length,d=0,o="";this.__indent_size&&r>=this.__indent_size&&(d=Math.floor(r/this.__indent_size),r-=d*this.__indent_size,o=new Array(d+1).join(this.__indent_string)),r&&(o+=new Array(r+1).join(" ")),this.__cache.push(o)};function u(r,d){this.__indent_cache=new f(r,d),this.raw=!1,this._end_with_newline=r.end_with_newline,this.indent_size=r.indent_size,this.wrap_line_length=r.wrap_line_length,this.indent_empty_lines=r.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new c(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}u.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},u.prototype.get_line_number=function(){return this.__lines.length},u.prototype.get_indent_string=function(r,d){return this.__indent_cache.get_indent_string(r,d)},u.prototype.get_indent_size=function(r,d){return this.__indent_cache.get_indent_size(r,d)},u.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},u.prototype.add_new_line=function(r){return this.is_empty()||!r&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},u.prototype.get_code=function(r){this.trim(!0);var d=this.current_line.pop();d&&(d[d.length-1]===`
|
|
`&&(d=d.replace(/\n+$/g,"")),this.current_line.push(d)),this._end_with_newline&&this.__add_outputline();var o=this.__lines.join(`
|
|
`);return r!==`
|
|
`&&(o=o.replace(/[\n]/g,r)),o},u.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},u.prototype.set_indent=function(r,d){return r=r||0,d=d||0,this.next_line.set_indent(r,d),this.__lines.length>1?(this.current_line.set_indent(r,d),!0):(this.current_line.set_indent(),!1)},u.prototype.add_raw_token=function(r){for(var d=0;d<r.newlines;d++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(r.whitespace_before),this.current_line.push(r.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},u.prototype.add_token=function(r){this.__add_space_before_token(),this.current_line.push(r),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},u.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},u.prototype.remove_indent=function(r){for(var d=this.__lines.length;r<d;)this.__lines[r]._remove_indent(),r++;this.current_line._remove_wrap_indent()},u.prototype.trim=function(r){for(r=r===void 0?!1:r,this.current_line.trim();r&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},u.prototype.just_added_newline=function(){return this.current_line.is_empty()},u.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},u.prototype.ensure_empty_line_above=function(r,d){for(var o=this.__lines.length-2;o>=0;){var s=this.__lines[o];if(s.is_empty())break;if(s.item(0).indexOf(r)!==0&&s.item(-1)!==d){this.__lines.splice(o+1,0,new c(this)),this.previous_line=this.__lines[this.__lines.length-2];break}o--}},m.exports.Output=u},function(m){function c(f,u,r,d){this.type=f,this.text=u,this.comments_before=null,this.newlines=r||0,this.whitespace_before=d||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}m.exports.Token=c},,,function(m){function c(r,d){this.raw_options=f(r,d),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}c.prototype._get_array=function(r,d){var o=this.raw_options[r],s=d||[];return typeof o=="object"?o!==null&&typeof o.concat=="function"&&(s=o.concat()):typeof o=="string"&&(s=o.split(/[^a-zA-Z0-9_\/\-]+/)),s},c.prototype._get_boolean=function(r,d){var o=this.raw_options[r],s=o===void 0?!!d:!!o;return s},c.prototype._get_characters=function(r,d){var o=this.raw_options[r],s=d||"";return typeof o=="string"&&(s=o.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),s},c.prototype._get_number=function(r,d){var o=this.raw_options[r];d=parseInt(d,10),isNaN(d)&&(d=0);var s=parseInt(o,10);return isNaN(s)&&(s=d),s},c.prototype._get_selection=function(r,d,o){var s=this._get_selection_list(r,d,o);if(s.length!==1)throw new Error("Invalid Option Value: The option '"+r+`' can only be one of the following values:
|
|
`+d+`
|
|
You passed in: '`+this.raw_options[r]+"'");return s[0]},c.prototype._get_selection_list=function(r,d,o){if(!d||d.length===0)throw new Error("Selection list cannot be empty.");if(o=o||[d[0]],!this._is_valid_selection(o,d))throw new Error("Invalid Default Value!");var s=this._get_array(r,o);if(!this._is_valid_selection(s,d))throw new Error("Invalid Option Value: The option '"+r+`' can contain only the following values:
|
|
`+d+`
|
|
You passed in: '`+this.raw_options[r]+"'");return s},c.prototype._is_valid_selection=function(r,d){return r.length&&d.length&&!r.some(function(o){return d.indexOf(o)===-1})};function f(r,d){var o={};r=u(r);var s;for(s in r)s!==d&&(o[s]=r[s]);if(d&&r[d])for(s in r[d])o[s]=r[d][s];return o}function u(r){var d={},o;for(o in r){var s=o.replace(/-/g,"_");d[s]=r[o]}return d}m.exports.Options=c,m.exports.normalizeOpts=u,m.exports.mergeOpts=f},,function(m){var c=RegExp.prototype.hasOwnProperty("sticky");function f(u){this.__input=u||"",this.__input_length=this.__input.length,this.__position=0}f.prototype.restart=function(){this.__position=0},f.prototype.back=function(){this.__position>0&&(this.__position-=1)},f.prototype.hasNext=function(){return this.__position<this.__input_length},f.prototype.next=function(){var u=null;return this.hasNext()&&(u=this.__input.charAt(this.__position),this.__position+=1),u},f.prototype.peek=function(u){var r=null;return u=u||0,u+=this.__position,u>=0&&u<this.__input_length&&(r=this.__input.charAt(u)),r},f.prototype.__match=function(u,r){u.lastIndex=r;var d=u.exec(this.__input);return d&&!(c&&u.sticky)&&(d.index!==r&&(d=null)),d},f.prototype.test=function(u,r){return r=r||0,r+=this.__position,r>=0&&r<this.__input_length?!!this.__match(u,r):!1},f.prototype.testChar=function(u,r){var d=this.peek(r);return u.lastIndex=0,d!==null&&u.test(d)},f.prototype.match=function(u){var r=this.__match(u,this.__position);return r?this.__position+=r[0].length:r=null,r},f.prototype.read=function(u,r,d){var o="",s;return u&&(s=this.match(u),s&&(o+=s[0])),r&&(s||!u)&&(o+=this.readUntil(r,d)),o},f.prototype.readUntil=function(u,r){var d="",o=this.__position;u.lastIndex=this.__position;var s=u.exec(this.__input);return s?(o=s.index,r&&(o+=s[0].length)):o=this.__input_length,d=this.__input.substring(this.__position,o),this.__position=o,d},f.prototype.readUntilAfter=function(u){return this.readUntil(u,!0)},f.prototype.get_regexp=function(u,r){var d=null,o="g";return r&&c&&(o="y"),typeof u=="string"&&u!==""?d=new RegExp(u,o):u&&(d=new RegExp(u.source,o)),d},f.prototype.get_literal_regexp=function(u){return RegExp(u.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},f.prototype.peekUntilAfter=function(u){var r=this.__position,d=this.readUntilAfter(u);return this.__position=r,d},f.prototype.lookBack=function(u){var r=this.__position-1;return r>=u.length&&this.__input.substring(r-u.length,r).toLowerCase()===u},m.exports.InputScanner=f},function(m,c,f){var u=f(8).InputScanner,r=f(3).Token,d=f(10).TokenStream,o=f(11).WhitespacePattern,s={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},l=function(p,R){this._input=new u(p),this._options=R||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new o(this._input)};l.prototype.tokenize=function(){this._input.restart(),this.__tokens=new d,this._reset();for(var p,R=new r(s.START,""),w=null,x=[],O=new d;R.type!==s.EOF;){for(p=this._get_next_token(R,w);this._is_comment(p);)O.add(p),p=this._get_next_token(R,w);O.isEmpty()||(p.comments_before=O,O=new d),p.parent=w,this._is_opening(p)?(x.push(w),w=p):w&&this._is_closing(p,w)&&(p.opened=w,w.closed=p,w=x.pop(),p.parent=w),p.previous=R,R.next=p,this.__tokens.add(p),R=p}return this.__tokens},l.prototype._is_first_token=function(){return this.__tokens.isEmpty()},l.prototype._reset=function(){},l.prototype._get_next_token=function(p,R){this._readWhitespace();var w=this._input.read(/.+/g);return w?this._create_token(s.RAW,w):this._create_token(s.EOF,"")},l.prototype._is_comment=function(p){return!1},l.prototype._is_opening=function(p){return!1},l.prototype._is_closing=function(p,R){return!1},l.prototype._create_token=function(p,R){var w=new r(p,R,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return w},l.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},m.exports.Tokenizer=l,m.exports.TOKEN=s},function(m){function c(f){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=f}c.prototype.restart=function(){this.__position=0},c.prototype.isEmpty=function(){return this.__tokens_length===0},c.prototype.hasNext=function(){return this.__position<this.__tokens_length},c.prototype.next=function(){var f=null;return this.hasNext()&&(f=this.__tokens[this.__position],this.__position+=1),f},c.prototype.peek=function(f){var u=null;return f=f||0,f+=this.__position,f>=0&&f<this.__tokens_length&&(u=this.__tokens[f]),u},c.prototype.add=function(f){this.__parent_token&&(f.parent=this.__parent_token),this.__tokens.push(f),this.__tokens_length+=1},m.exports.TokenStream=c},function(m,c,f){var u=f(12).Pattern;function r(d,o){u.call(this,d,o),o?this._line_regexp=this._input.get_regexp(o._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}r.prototype=new u,r.prototype.__set_whitespace_patterns=function(d,o){d+="\\t ",o+="\\n\\r",this._match_pattern=this._input.get_regexp("["+d+o+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+o+"]")},r.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var d=this._input.read(this._match_pattern);if(d===" ")this.whitespace_before_token=" ";else if(d){var o=this.__split(this._newline_regexp,d);this.newline_count=o.length-1,this.whitespace_before_token=o[this.newline_count]}return d},r.prototype.matching=function(d,o){var s=this._create();return s.__set_whitespace_patterns(d,o),s._update(),s},r.prototype._create=function(){return new r(this._input,this)},r.prototype.__split=function(d,o){d.lastIndex=0;for(var s=0,l=[],p=d.exec(o);p;)l.push(o.substring(s,p.index)),s=p.index+p[0].length,p=d.exec(o);return s<o.length?l.push(o.substring(s,o.length)):l.push(""),l},m.exports.WhitespacePattern=r},function(m){function c(f,u){this._input=f,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,u&&(this._starting_pattern=this._input.get_regexp(u._starting_pattern,!0),this._match_pattern=this._input.get_regexp(u._match_pattern,!0),this._until_pattern=this._input.get_regexp(u._until_pattern),this._until_after=u._until_after)}c.prototype.read=function(){var f=this._input.read(this._starting_pattern);return(!this._starting_pattern||f)&&(f+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),f},c.prototype.read_match=function(){return this._input.match(this._match_pattern)},c.prototype.until_after=function(f){var u=this._create();return u._until_after=!0,u._until_pattern=this._input.get_regexp(f),u._update(),u},c.prototype.until=function(f){var u=this._create();return u._until_after=!1,u._until_pattern=this._input.get_regexp(f),u._update(),u},c.prototype.starting_with=function(f){var u=this._create();return u._starting_pattern=this._input.get_regexp(f,!0),u._update(),u},c.prototype.matching=function(f){var u=this._create();return u._match_pattern=this._input.get_regexp(f,!0),u._update(),u},c.prototype._create=function(){return new c(this._input,this)},c.prototype._update=function(){},m.exports.Pattern=c},function(m){function c(f,u){f=typeof f=="string"?f:f.source,u=typeof u=="string"?u:u.source,this.__directives_block_pattern=new RegExp(f+/ beautify( \w+[:]\w+)+ /.source+u,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(f+/\sbeautify\signore:end\s/.source+u,"g")}c.prototype.get_directives=function(f){if(!f.match(this.__directives_block_pattern))return null;var u={};this.__directive_pattern.lastIndex=0;for(var r=this.__directive_pattern.exec(f);r;)u[r[1]]=r[2],r=this.__directive_pattern.exec(f);return u},c.prototype.readIgnored=function(f){return f.readUntilAfter(this.__directives_end_ignore_pattern)},m.exports.Directives=c},function(m,c,f){var u=f(12).Pattern,r={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function d(o,s){u.call(this,o,s),this.__template_pattern=null,this._disabled=Object.assign({},r),this._excluded=Object.assign({},r),s&&(this.__template_pattern=this._input.get_regexp(s.__template_pattern),this._excluded=Object.assign(this._excluded,s._excluded),this._disabled=Object.assign(this._disabled,s._disabled));var l=new u(o);this.__patterns={handlebars_comment:l.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:l.starting_with(/{{{/).until_after(/}}}/),handlebars:l.starting_with(/{{/).until_after(/}}/),php:l.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:l.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:l.starting_with(/{%/).until_after(/%}/),django_value:l.starting_with(/{{/).until_after(/}}/),django_comment:l.starting_with(/{#/).until_after(/#}/),smarty:l.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:l.starting_with(/{\*/).until_after(/\*}/),smarty_literal:l.starting_with(/{literal}/).until_after(/{\/literal}/)}}d.prototype=new u,d.prototype._create=function(){return new d(this._input,this)},d.prototype._update=function(){this.__set_templated_pattern()},d.prototype.disable=function(o){var s=this._create();return s._disabled[o]=!0,s._update(),s},d.prototype.read_options=function(o){var s=this._create();for(var l in r)s._disabled[l]=o.templating.indexOf(l)===-1;return s._update(),s},d.prototype.exclude=function(o){var s=this._create();return s._excluded[o]=!0,s._update(),s},d.prototype.read=function(){var o="";this._match_pattern?o=this._input.read(this._starting_pattern):o=this._input.read(this._starting_pattern,this.__template_pattern);for(var s=this._read_template();s;)this._match_pattern?s+=this._input.read(this._match_pattern):s+=this._input.readUntil(this.__template_pattern),o+=s,s=this._read_template();return this._until_after&&(o+=this._input.readUntilAfter(this._until_pattern)),o},d.prototype.__set_templated_pattern=function(){var o=[];this._disabled.php||o.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||o.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||o.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(o.push(this.__patterns.django._starting_pattern.source),o.push(this.__patterns.django_value._starting_pattern.source),o.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||o.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&o.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+o.join("|")+")")},d.prototype._read_template=function(){var o="",s=this._input.peek();if(s==="<"){var l=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&l==="?"&&(o=o||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&l==="%"&&(o=o||this.__patterns.erb.read())}else s==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(o=o||this.__patterns.handlebars_comment.read(),o=o||this.__patterns.handlebars_unescaped.read(),o=o||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(o=o||this.__patterns.django_value.read()),this._excluded.django||(o=o||this.__patterns.django_comment.read(),o=o||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(o=o||this.__patterns.smarty_comment.read(),o=o||this.__patterns.smarty_literal.read(),o=o||this.__patterns.smarty.read()));return o},m.exports.TemplatablePattern=d},,,,function(m,c,f){var u=f(19).Beautifier,r=f(20).Options;function d(o,s,l,p){var R=new u(o,s,l,p);return R.beautify()}m.exports=d,m.exports.defaultOptions=function(){return new r}},function(m,c,f){var u=f(20).Options,r=f(2).Output,d=f(21).Tokenizer,o=f(21).TOKEN,s=/\r\n|[\r\n]/,l=/\r\n|[\r\n]/g,p=function(_,g){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=_.max_preserve_newlines,this.preserve_newlines=_.preserve_newlines,this._output=new r(_,g)};p.prototype.current_line_has_match=function(_){return this._output.current_line.has_match(_)},p.prototype.set_space_before_token=function(_,g){this._output.space_before_token=_,this._output.non_breaking_space=g},p.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},p.prototype.add_raw_token=function(_){this._output.add_raw_token(_)},p.prototype.print_preserved_newlines=function(_){var g=0;_.type!==o.TEXT&&_.previous.type!==o.TEXT&&(g=_.newlines?1:0),this.preserve_newlines&&(g=_.newlines<this.max_preserve_newlines+1?_.newlines:this.max_preserve_newlines+1);for(var b=0;b<g;b++)this.print_newline(b>0);return g!==0},p.prototype.traverse_whitespace=function(_){return _.whitespace_before||_.newlines?(this.print_preserved_newlines(_)||(this._output.space_before_token=!0),!0):!1},p.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},p.prototype.print_newline=function(_){this._output.add_new_line(_)},p.prototype.print_token=function(_){_.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(_.text))},p.prototype.indent=function(){this.indent_level++},p.prototype.get_full_indent=function(_){return _=this.indent_level+(_||0),_<1?"":this._output.get_indent_string(_)};var R=function(_){for(var g=null,b=_.next;b.type!==o.EOF&&_.closed!==b;){if(b.type===o.ATTRIBUTE&&b.text==="type"){b.next&&b.next.type===o.EQUALS&&b.next.next&&b.next.next.type===o.VALUE&&(g=b.next.next.text);break}b=b.next}return g},w=function(_,g){var b=null,M=null;return g.closed?(_==="script"?b="text/javascript":_==="style"&&(b="text/css"),b=R(g)||b,b.search("text/css")>-1?M="css":b.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?M="javascript":b.search(/(text|application|dojo)\/(x-)?(html)/)>-1?M="html":b.search(/test\/null/)>-1&&(M="null"),M):null};function x(_,g){return g.indexOf(_)!==-1}function O(_,g,b){this.parent=_||null,this.tag=g?g.tag_name:"",this.indent_level=b||0,this.parser_token=g||null}function A(_){this._printer=_,this._current_frame=null}A.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},A.prototype.record_tag=function(_){var g=new O(this._current_frame,_,this._printer.indent_level);this._current_frame=g},A.prototype._try_pop_frame=function(_){var g=null;return _&&(g=_.parser_token,this._printer.indent_level=_.indent_level,this._current_frame=_.parent),g},A.prototype._get_frame=function(_,g){for(var b=this._current_frame;b&&!(_.indexOf(b.tag)!==-1);){if(g&&g.indexOf(b.tag)!==-1){b=null;break}b=b.parent}return b},A.prototype.try_pop=function(_,g){var b=this._get_frame([_],g);return this._try_pop_frame(b)},A.prototype.indent_to_tag=function(_){var g=this._get_frame(_);g&&(this._printer.indent_level=g.indent_level)};function T(_,g,b,M){this._source_text=_||"",g=g||{},this._js_beautify=b,this._css_beautify=M,this._tag_stack=null;var P=new u(g,"html");this._options=P,this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,"force".length)==="force",this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline",this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned",this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple",this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,"preserve".length)==="preserve",this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}T.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var _=this._source_text,g=this._options.eol;this._options.eol==="auto"&&(g=`
|
|
`,_&&s.test(_)&&(g=_.match(s)[0])),_=_.replace(l,`
|
|
`);var b=_.match(/^[\t ]*/)[0],M={text:"",type:""},P=new E,K=new p(this._options,b),V=new d(_,this._options).tokenize();this._tag_stack=new A(K);for(var B=null,C=V.next();C.type!==o.EOF;)C.type===o.TAG_OPEN||C.type===o.COMMENT?(B=this._handle_tag_open(K,C,P,M),P=B):C.type===o.ATTRIBUTE||C.type===o.EQUALS||C.type===o.VALUE||C.type===o.TEXT&&!P.tag_complete?B=this._handle_inside_tag(K,C,P,V):C.type===o.TAG_CLOSE?B=this._handle_tag_close(K,C,P):C.type===o.TEXT?B=this._handle_text(K,C,P):K.add_raw_token(C),M=B,C=V.next();var $=K._output.get_code(g);return $},T.prototype._handle_tag_close=function(_,g,b){var M={text:g.text,type:g.type};return _.alignment_size=0,b.tag_complete=!0,_.set_space_before_token(g.newlines||g.whitespace_before!=="",!0),b.is_unformatted?_.add_raw_token(g):(b.tag_start_char==="<"&&(_.set_space_before_token(g.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&b.has_wrapped_attrs&&_.print_newline(!1)),_.print_token(g)),b.indent_content&&!(b.is_unformatted||b.is_content_unformatted)&&(_.indent(),b.indent_content=!1),!b.is_inline_element&&!(b.is_unformatted||b.is_content_unformatted)&&_.set_wrap_point(),M},T.prototype._handle_inside_tag=function(_,g,b,M){var P=b.has_wrapped_attrs,K={text:g.text,type:g.type};if(_.set_space_before_token(g.newlines||g.whitespace_before!=="",!0),b.is_unformatted)_.add_raw_token(g);else if(b.tag_start_char==="{"&&g.type===o.TEXT)_.print_preserved_newlines(g)?(g.newlines=0,_.add_raw_token(g)):_.print_token(g);else{if(g.type===o.ATTRIBUTE?(_.set_space_before_token(!0),b.attr_count+=1):(g.type===o.EQUALS||g.type===o.VALUE&&g.previous.type===o.EQUALS)&&_.set_space_before_token(!1),g.type===o.ATTRIBUTE&&b.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(_.traverse_whitespace(g),P=P||g.newlines!==0),this._is_wrap_attributes_force)){var V=b.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&b.attr_count===1){var B=!0,C=0,$;do{if($=M.peek(C),$.type===o.ATTRIBUTE){B=!1;break}C+=1}while(C<4&&$.type!==o.EOF&&$.type!==o.TAG_CLOSE);V=!B}V&&(_.print_newline(!1),P=!0)}_.print_token(g),P=P||_.previous_token_wrapped(),b.has_wrapped_attrs=P}return K},T.prototype._handle_text=function(_,g,b){var M={text:g.text,type:"TK_CONTENT"};return b.custom_beautifier_name?this._print_custom_beatifier_text(_,g,b):b.is_unformatted||b.is_content_unformatted?_.add_raw_token(g):(_.traverse_whitespace(g),_.print_token(g)),M},T.prototype._print_custom_beatifier_text=function(_,g,b){var M=this;if(g.text!==""){var P=g.text,K,V=1,B="",C="";b.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?K=this._js_beautify:b.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?K=this._css_beautify:b.custom_beautifier_name==="html"&&(K=function(ye,be){var we=new T(ye,be,M._js_beautify,M._css_beautify);return we.beautify()}),this._options.indent_scripts==="keep"?V=0:this._options.indent_scripts==="separate"&&(V=-_.indent_level);var $=_.get_full_indent(V);if(P=P.replace(/\n[ \t]*$/,""),b.custom_beautifier_name!=="html"&&P[0]==="<"&&P.match(/^(<!--|<!\[CDATA\[)/)){var ee=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(P);if(!ee){_.add_raw_token(g);return}B=$+ee[1]+`
|
|
`,P=ee[4],ee[5]&&(C=$+ee[5]),P=P.replace(/\n[ \t]*$/,""),(ee[2]||ee[3].indexOf(`
|
|
`)!==-1)&&(ee=ee[3].match(/[ \t]+$/),ee&&(g.whitespace_before=ee[0]))}if(P)if(K){var re=function(){this.eol=`
|
|
`};re.prototype=this._options.raw_options;var ue=new re;P=K($+P,ue)}else{var Te=g.whitespace_before;Te&&(P=P.replace(new RegExp(`
|
|
(`+Te+")?","g"),`
|
|
`)),P=$+P.replace(/\n/g,`
|
|
`+$)}B&&(P?P=B+P+`
|
|
`+C:P=B+C),_.print_newline(!1),P&&(g.text=P,g.whitespace_before="",g.newlines=0,_.add_raw_token(g),_.print_newline(!0))}},T.prototype._handle_tag_open=function(_,g,b,M){var P=this._get_tag_open_token(g);return(b.is_unformatted||b.is_content_unformatted)&&!b.is_empty_element&&g.type===o.TAG_OPEN&&g.text.indexOf("</")===0?(_.add_raw_token(g),P.start_tag_token=this._tag_stack.try_pop(P.tag_name)):(_.traverse_whitespace(g),this._set_tag_position(_,g,P,b,M),P.is_inline_element||_.set_wrap_point(),_.print_token(g)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(P.alignment_size=g.text.length+1),!P.tag_complete&&!P.is_unformatted&&(_.alignment_size=P.alignment_size),P};var E=function(_,g){if(this.parent=_||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",!g)this.tag_complete=!0;else{var b;this.tag_start_char=g.text[0],this.text=g.text,this.tag_start_char==="<"?(b=g.text.match(/^<([^\s>]*)/),this.tag_check=b?b[1]:""):(b=g.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=b?b[1]:"",(g.text.startsWith("{{#>")||g.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&g.next!==null?this.tag_check=g.next.text.split(" ")[0]:this.tag_check=g.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),g.type===o.COMMENT&&(this.tag_complete=!0),this.is_start_tag=this.tag_check.charAt(0)!=="/",this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||g.closed&&g.closed.text==="/>";var M=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(M=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(M)))}};T.prototype._get_tag_open_token=function(_){var g=new E(this._tag_stack.get_parser_token(),_);return g.alignment_size=this._options.wrap_attributes_indent_size,g.is_end_tag=g.is_end_tag||x(g.tag_check,this._options.void_elements),g.is_empty_element=g.tag_complete||g.is_start_tag&&g.is_end_tag,g.is_unformatted=!g.tag_complete&&x(g.tag_check,this._options.unformatted),g.is_content_unformatted=!g.is_empty_element&&x(g.tag_check,this._options.content_unformatted),g.is_inline_element=x(g.tag_name,this._options.inline)||g.tag_name.includes("-")||g.tag_start_char==="{",g},T.prototype._set_tag_position=function(_,g,b,M,P){if(b.is_empty_element||(b.is_end_tag?b.start_tag_token=this._tag_stack.try_pop(b.tag_name):(this._do_optional_end_element(b)&&(b.is_inline_element||_.print_newline(!1)),this._tag_stack.record_tag(b),(b.tag_name==="script"||b.tag_name==="style")&&!(b.is_unformatted||b.is_content_unformatted)&&(b.custom_beautifier_name=w(b.tag_check,g)))),x(b.tag_check,this._options.extra_liners)&&(_.print_newline(!1),_._output.just_added_blankline()||_.print_newline(!0)),b.is_empty_element){if(b.tag_start_char==="{"&&b.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),b.indent_content=!0;var K=_.current_line_has_match(/{{#if/);K||_.print_newline(!1)}b.tag_name==="!--"&&P.type===o.TAG_CLOSE&&M.is_end_tag&&b.text.indexOf(`
|
|
`)===-1||(b.is_inline_element||b.is_unformatted||_.print_newline(!1),this._calcluate_parent_multiline(_,b))}else if(b.is_end_tag){var V=!1;V=b.start_tag_token&&b.start_tag_token.multiline_content,V=V||!b.is_inline_element&&!(M.is_inline_element||M.is_unformatted)&&!(P.type===o.TAG_CLOSE&&b.start_tag_token===M)&&P.type!=="TK_CONTENT",(b.is_content_unformatted||b.is_unformatted)&&(V=!1),V&&_.print_newline(!1)}else b.indent_content=!b.custom_beautifier_name,b.tag_start_char==="<"&&(b.tag_name==="html"?b.indent_content=this._options.indent_inner_html:b.tag_name==="head"?b.indent_content=this._options.indent_head_inner_html:b.tag_name==="body"&&(b.indent_content=this._options.indent_body_inner_html)),!(b.is_inline_element||b.is_unformatted)&&(P.type!=="TK_CONTENT"||b.is_content_unformatted)&&_.print_newline(!1),this._calcluate_parent_multiline(_,b)},T.prototype._calcluate_parent_multiline=function(_,g){g.parent&&_._output.just_added_newline()&&!((g.is_inline_element||g.is_unformatted)&&g.parent.is_inline_element)&&(g.parent.multiline_content=!0)};var y=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","nav","ol","p","pre","section","table","ul"],h=["a","audio","del","ins","map","noscript","video"];T.prototype._do_optional_end_element=function(_){var g=null;if(_.is_empty_element||!_.is_start_tag||!_.parent)return;if(_.tag_name==="body")g=g||this._tag_stack.try_pop("head");else if(_.tag_name==="li")g=g||this._tag_stack.try_pop("li",["ol","ul"]);else if(_.tag_name==="dd"||_.tag_name==="dt")g=g||this._tag_stack.try_pop("dt",["dl"]),g=g||this._tag_stack.try_pop("dd",["dl"]);else if(_.parent.tag_name==="p"&&y.indexOf(_.tag_name)!==-1){var b=_.parent.parent;(!b||h.indexOf(b.tag_name)===-1)&&(g=g||this._tag_stack.try_pop("p"))}else _.tag_name==="rp"||_.tag_name==="rt"?(g=g||this._tag_stack.try_pop("rt",["ruby","rtc"]),g=g||this._tag_stack.try_pop("rp",["ruby","rtc"])):_.tag_name==="optgroup"?g=g||this._tag_stack.try_pop("optgroup",["select"]):_.tag_name==="option"?g=g||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):_.tag_name==="colgroup"?g=g||this._tag_stack.try_pop("caption",["table"]):_.tag_name==="thead"?(g=g||this._tag_stack.try_pop("caption",["table"]),g=g||this._tag_stack.try_pop("colgroup",["table"])):_.tag_name==="tbody"||_.tag_name==="tfoot"?(g=g||this._tag_stack.try_pop("caption",["table"]),g=g||this._tag_stack.try_pop("colgroup",["table"]),g=g||this._tag_stack.try_pop("thead",["table"]),g=g||this._tag_stack.try_pop("tbody",["table"])):_.tag_name==="tr"?(g=g||this._tag_stack.try_pop("caption",["table"]),g=g||this._tag_stack.try_pop("colgroup",["table"]),g=g||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(_.tag_name==="th"||_.tag_name==="td")&&(g=g||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),g=g||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return _.parent=this._tag_stack.get_parser_token(),g},m.exports.Beautifier=T},function(m,c,f){var u=f(6).Options;function r(d){u.call(this,d,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}r.prototype=new u,m.exports.Options=r},function(m,c,f){var u=f(9).Tokenizer,r=f(9).TOKEN,d=f(13).Directives,o=f(14).TemplatablePattern,s=f(12).Pattern,l={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:r.START,RAW:r.RAW,EOF:r.EOF},p=new d(/<\!--/,/-->/),R=function(w,x){u.call(this,w,x),this._current_tag_name="";var O=new o(this._input).read_options(this._options),A=new s(this._input);if(this.__patterns={word:O.until(/[\n\r\t <]/),single_quote:O.until_after(/'/),double_quote:O.until_after(/"/),attribute:O.until(/[\n\r\t =>]|\/>/),element_name:O.until(/[\n\r\t >\/]/),handlebars_comment:A.starting_with(/{{!--/).until_after(/--}}/),handlebars:A.starting_with(/{{/).until_after(/}}/),handlebars_open:A.until(/[\n\r\t }]/),handlebars_raw_close:A.until(/}}/),comment:A.starting_with(/<!--/).until_after(/-->/),cdata:A.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:A.starting_with(/<!\[/).until_after(/]>/),processing:A.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var T=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=A.matching(T).until_after(T)}};R.prototype=new u,R.prototype._is_comment=function(w){return!1},R.prototype._is_opening=function(w){return w.type===l.TAG_OPEN},R.prototype._is_closing=function(w,x){return w.type===l.TAG_CLOSE&&x&&((w.text===">"||w.text==="/>")&&x.text[0]==="<"||w.text==="}}"&&x.text[0]==="{"&&x.text[1]==="{")},R.prototype._reset=function(){this._current_tag_name=""},R.prototype._get_next_token=function(w,x){var O=null;this._readWhitespace();var A=this._input.peek();return A===null?this._create_token(l.EOF,""):(O=O||this._read_open_handlebars(A,x),O=O||this._read_attribute(A,w,x),O=O||this._read_close(A,x),O=O||this._read_raw_content(A,w,x),O=O||this._read_content_word(A),O=O||this._read_comment_or_cdata(A),O=O||this._read_processing(A),O=O||this._read_open(A,x),O=O||this._create_token(l.UNKNOWN,this._input.next()),O)},R.prototype._read_comment_or_cdata=function(w){var x=null,O=null,A=null;if(w==="<"){var T=this._input.peek(1);T==="!"&&(O=this.__patterns.comment.read(),O?(A=p.get_directives(O),A&&A.ignore==="start"&&(O+=p.readIgnored(this._input))):O=this.__patterns.cdata.read()),O&&(x=this._create_token(l.COMMENT,O),x.directives=A)}return x},R.prototype._read_processing=function(w){var x=null,O=null,A=null;if(w==="<"){var T=this._input.peek(1);(T==="!"||T==="?")&&(O=this.__patterns.conditional_comment.read(),O=O||this.__patterns.processing.read()),O&&(x=this._create_token(l.COMMENT,O),x.directives=A)}return x},R.prototype._read_open=function(w,x){var O=null,A=null;return x||w==="<"&&(O=this._input.next(),this._input.peek()==="/"&&(O+=this._input.next()),O+=this.__patterns.element_name.read(),A=this._create_token(l.TAG_OPEN,O)),A},R.prototype._read_open_handlebars=function(w,x){var O=null,A=null;return x||this._options.indent_handlebars&&w==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(O=this.__patterns.handlebars_comment.read(),O=O||this.__patterns.handlebars.read(),A=this._create_token(l.COMMENT,O)):(O=this.__patterns.handlebars_open.read(),A=this._create_token(l.TAG_OPEN,O))),A},R.prototype._read_close=function(w,x){var O=null,A=null;return x&&(x.text[0]==="<"&&(w===">"||w==="/"&&this._input.peek(1)===">")?(O=this._input.next(),w==="/"&&(O+=this._input.next()),A=this._create_token(l.TAG_CLOSE,O)):x.text[0]==="{"&&w==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),A=this._create_token(l.TAG_CLOSE,"}}"))),A},R.prototype._read_attribute=function(w,x,O){var A=null,T="";if(O&&O.text[0]==="<")if(w==="=")A=this._create_token(l.EQUALS,this._input.next());else if(w==='"'||w==="'"){var E=this._input.next();w==='"'?E+=this.__patterns.double_quote.read():E+=this.__patterns.single_quote.read(),A=this._create_token(l.VALUE,E)}else T=this.__patterns.attribute.read(),T&&(x.type===l.EQUALS?A=this._create_token(l.VALUE,T):A=this._create_token(l.ATTRIBUTE,T));return A},R.prototype._is_content_unformatted=function(w){return this._options.void_elements.indexOf(w)===-1&&(this._options.content_unformatted.indexOf(w)!==-1||this._options.unformatted.indexOf(w)!==-1)},R.prototype._read_raw_content=function(w,x,O){var A="";if(O&&O.text[0]==="{")A=this.__patterns.handlebars_raw_close.read();else if(x.type===l.TAG_CLOSE&&x.opened.text[0]==="<"&&x.text[0]!=="/"){var T=x.opened.text.substr(1).toLowerCase();if(T==="script"||T==="style"){var E=this._read_comment_or_cdata(w);if(E)return E.type=l.TEXT,E;A=this._input.readUntil(new RegExp("</"+T+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(T)&&(A=this._input.readUntil(new RegExp("</"+T+"[\\n\\r\\t ]*?>","ig")))}return A?this._create_token(l.TEXT,A):null},R.prototype._read_content_word=function(w){var x="";if(this._options.unformatted_content_delimiter&&(w===this._options.unformatted_content_delimiter[0]&&(x=this.__patterns.unformatted_content_delimiter.read())),x||(x=this.__patterns.word.read()),x)return this._create_token(l.TEXT,x)},m.exports.Tokenizer=R,m.exports.TOKEN=l}],j={};function k(m){var c=j[m];if(c!==void 0)return c.exports;var f=j[m]={exports:{}};return W[m](f,f.exports,k),f.exports}var I=k(18);D=I})();var Y=D;if(!0)!(ae=[ne,ne("6UM0"),ne("TXwP")],J=function(W){var j=ne("6UM0"),k=ne("TXwP");return{html_beautify:function(I,m){return Y(I,m,j.js_beautify,k.css_beautify)}}}.apply(et,ae),J!==void 0&&(vt.exports=J));else var F,U})()},"rAM+":function(vt,et,ne){"use strict";ne.d(et,"a",function(){return J});var ae=ne("Qw5x");function J(D,Y){var F;if(typeof Symbol=="undefined"||D[Symbol.iterator]==null){if(Array.isArray(D)||(F=Object(ae.a)(D))||Y&&D&&typeof D.length=="number"){F&&(D=F);var U=0,W=function(){};return{s:W,n:function(){return U>=D.length?{done:!0}:{done:!1,value:D[U++]}},e:function(c){throw c},f:W}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var j=!0,k=!1,I;return{s:function(){F=D[Symbol.iterator]()},n:function(){var c=F.next();return j=c.done,c},e:function(c){k=!0,I=c},f:function(){try{!j&&F.return!=null&&F.return()}finally{if(k)throw I}}}}},rUJ1:function(vt,et){const ne=/[&<>"']/,ae=/[&<>"']/g,J=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,Y={"&":"&","<":"<",">":">",'"':""","'":"'"},F=A=>Y[A];function U(A,T){if(T){if(ne.test(A))return A.replace(ae,F)}else if(J.test(A))return A.replace(D,F);return A}const W=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function j(A){return A.replace(W,(T,E)=>(E=E.toLowerCase(),E==="colon"?":":E.charAt(0)==="#"?E.charAt(1)==="x"?String.fromCharCode(parseInt(E.substring(2),16)):String.fromCharCode(+E.substring(1)):""))}const k=/(^|[^\[])\^/g;function I(A,T){A=A.source||A,T=T||"";const E={replace:(y,h)=>(h=h.source||h,h=h.replace(k,"$1"),A=A.replace(y,h),E),getRegex:()=>new RegExp(A,T)};return E}const m=/[^\w:]/g,c=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function f(A,T,E){if(A){let y;try{y=decodeURIComponent(j(E)).replace(m,"").toLowerCase()}catch(h){return null}if(y.indexOf("javascript:")===0||y.indexOf("vbscript:")===0||y.indexOf("data:")===0)return null}T&&!c.test(E)&&(E=s(T,E));try{E=encodeURI(E).replace(/%25/g,"%")}catch(y){return null}return E}const u={},r=/^[^:]+:\/*[^/]*$/,d=/^([^:]+:)[\s\S]*$/,o=/^([^:]+:\/*[^/]*)[\s\S]*$/;function s(A,T){u[" "+A]||(r.test(A)?u[" "+A]=A+"/":u[" "+A]=w(A,"/",!0)),A=u[" "+A];const E=A.indexOf(":")===-1;return T.substring(0,2)==="//"?E?T:A.replace(d,"$1")+T:T.charAt(0)==="/"?E?T:A.replace(o,"$1")+T:A+T}const l={exec:function(){}};function p(A){let T=1,E,y;for(;T<arguments.length;T++){E=arguments[T];for(y in E)Object.prototype.hasOwnProperty.call(E,y)&&(A[y]=E[y])}return A}function R(A,T){const E=A.replace(/\|/g,(_,g,b)=>{let M=!1,P=g;for(;--P>=0&&b[P]==="\\";)M=!M;return M?"|":" |"}),y=E.split(/ \|/);let h=0;if(y.length>T)y.splice(T);else for(;y.length<T;)y.push("");for(;h<y.length;h++)y[h]=y[h].trim().replace(/\\\|/g,"|");return y}function w(A,T,E){const y=A.length;if(y===0)return"";let h=0;for(;h<y;){const _=A.charAt(y-h-1);if(_===T&&!E)h++;else if(_!==T&&E)h++;else break}return A.substr(0,y-h)}function x(A,T){if(A.indexOf(T[1])===-1)return-1;const E=A.length;let y=0,h=0;for(;h<E;h++)if(A[h]==="\\")h++;else if(A[h]===T[0])y++;else if(A[h]===T[1]&&(y--,y<0))return h;return-1}function O(A){A&&A.sanitize&&!A.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")}vt.exports={escape:U,unescape:j,edit:I,cleanUrl:f,resolveUrl:s,noopTest:l,merge:p,splitCells:R,rtrim:w,findClosingBracket:x,checkSanitizeDeprecation:O}},ulZh:function(vt,et,ne){typeof window!="undefined"&&function(J,D){vt.exports=D()}(this,function(){return function(ae){var J={};function D(Y){if(J[Y])return J[Y].exports;var F=J[Y]={i:Y,l:!1,exports:{}};return ae[Y].call(F.exports,F,F.exports,D),F.l=!0,F.exports}return D.m=ae,D.c=J,D.d=function(Y,F,U){D.o(Y,F)||Object.defineProperty(Y,F,{enumerable:!0,get:U})},D.r=function(Y){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Y,"__esModule",{value:!0})},D.t=function(Y,F){if(F&1&&(Y=D(Y)),F&8)return Y;if(F&4&&typeof Y=="object"&&Y&&Y.__esModule)return Y;var U=Object.create(null);if(D.r(U),Object.defineProperty(U,"default",{enumerable:!0,value:Y}),F&2&&typeof Y!="string")for(var W in Y)D.d(U,W,function(j){return Y[j]}.bind(null,W));return U},D.n=function(Y){var F=Y&&Y.__esModule?function(){return Y.default}:function(){return Y};return D.d(F,"a",F),F},D.o=function(Y,F){return Object.prototype.hasOwnProperty.call(Y,F)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ae,J,D){"use strict";var Y=Object.prototype.hasOwnProperty,F="~";function U(){}Object.create&&(U.prototype=Object.create(null),new U().__proto__||(F=!1));function W(m,c,f){this.fn=m,this.context=c,this.once=f||!1}function j(m,c,f,u,r){if(typeof f!="function")throw new TypeError("The listener must be a function");var d=new W(f,u||m,r),o=F?F+c:c;return m._events[o]?m._events[o].fn?m._events[o]=[m._events[o],d]:m._events[o].push(d):(m._events[o]=d,m._eventsCount++),m}function k(m,c){--m._eventsCount===0?m._events=new U:delete m._events[c]}function I(){this._events=new U,this._eventsCount=0}I.prototype.eventNames=function(){var c=[],f,u;if(this._eventsCount===0)return c;for(u in f=this._events)Y.call(f,u)&&c.push(F?u.slice(1):u);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(f)):c},I.prototype.listeners=function(c){var f=F?F+c:c,u=this._events[f];if(!u)return[];if(u.fn)return[u.fn];for(var r=0,d=u.length,o=new Array(d);r<d;r++)o[r]=u[r].fn;return o},I.prototype.listenerCount=function(c){var f=F?F+c:c,u=this._events[f];return u?u.fn?1:u.length:0},I.prototype.emit=function(c,f,u,r,d,o){var s=F?F+c:c;if(!this._events[s])return!1;var l=this._events[s],p=arguments.length,R,w;if(l.fn){l.once&&this.removeListener(c,l.fn,void 0,!0);switch(p){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,f),!0;case 3:return l.fn.call(l.context,f,u),!0;case 4:return l.fn.call(l.context,f,u,r),!0;case 5:return l.fn.call(l.context,f,u,r,d),!0;case 6:return l.fn.call(l.context,f,u,r,d,o),!0}for(w=1,R=new Array(p-1);w<p;w++)R[w-1]=arguments[w];l.fn.apply(l.context,R)}else{var x=l.length,O;for(w=0;w<x;w++){l[w].once&&this.removeListener(c,l[w].fn,void 0,!0);switch(p){case 1:l[w].fn.call(l[w].context);break;case 2:l[w].fn.call(l[w].context,f);break;case 3:l[w].fn.call(l[w].context,f,u);break;case 4:l[w].fn.call(l[w].context,f,u,r);break;default:if(!R)for(O=1,R=new Array(p-1);O<p;O++)R[O-1]=arguments[O];l[w].fn.apply(l[w].context,R)}}}return!0},I.prototype.on=function(c,f,u){return j(this,c,f,u,!1)},I.prototype.once=function(c,f,u){return j(this,c,f,u,!0)},I.prototype.removeListener=function(c,f,u,r){var d=F?F+c:c;if(!this._events[d])return this;if(!f)return k(this,d),this;var o=this._events[d];if(o.fn)o.fn===f&&(!r||o.once)&&(!u||o.context===u)&&k(this,d);else{for(var s=0,l=[],p=o.length;s<p;s++)(o[s].fn!==f||r&&!o[s].once||u&&o[s].context!==u)&&l.push(o[s]);l.length?this._events[d]=l.length===1?l[0]:l:k(this,d)}return this},I.prototype.removeAllListeners=function(c){var f;return c?(f=F?F+c:c,this._events[f]&&k(this,f)):(this._events=new U,this._eventsCount=0),this},I.prototype.off=I.prototype.removeListener,I.prototype.addListener=I.prototype.on,I.prefixed=F,I.EventEmitter=I,ae.exports=I},"./node_modules/url-toolkit/src/url-toolkit.js":function(ae,J,D){(function(Y){var F=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,U=/^([^\/?#]*)([^]*)$/,W=/(?:\/|^)\.(?=\/)/g,j=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,k={buildAbsoluteURL:function(I,m,c){if(c=c||{},I=I.trim(),m=m.trim(),!m){if(!c.alwaysNormalize)return I;var f=k.parseURL(I);if(!f)throw new Error("Error trying to parse base URL.");return f.path=k.normalizePath(f.path),k.buildURLFromParts(f)}var u=k.parseURL(m);if(!u)throw new Error("Error trying to parse relative URL.");if(u.scheme)return c.alwaysNormalize?(u.path=k.normalizePath(u.path),k.buildURLFromParts(u)):m;var r=k.parseURL(I);if(!r)throw new Error("Error trying to parse base URL.");if(!r.netLoc&&r.path&&r.path[0]!=="/"){var d=U.exec(r.path);r.netLoc=d[1],r.path=d[2]}r.netLoc&&!r.path&&(r.path="/");var o={scheme:r.scheme,netLoc:u.netLoc,path:null,params:u.params,query:u.query,fragment:u.fragment};if(!u.netLoc&&(o.netLoc=r.netLoc,u.path[0]!=="/"))if(!u.path)o.path=r.path,u.params||(o.params=r.params,u.query||(o.query=r.query));else{var s=r.path,l=s.substring(0,s.lastIndexOf("/")+1)+u.path;o.path=k.normalizePath(l)}return o.path===null&&(o.path=c.alwaysNormalize?k.normalizePath(u.path):u.path),k.buildURLFromParts(o)},parseURL:function(I){var m=F.exec(I);return m?{scheme:m[1]||"",netLoc:m[2]||"",path:m[3]||"",params:m[4]||"",query:m[5]||"",fragment:m[6]||""}:null},normalizePath:function(I){for(I=I.split("").reverse().join("").replace(W,"");I.length!==(I=I.replace(j,"")).length;);return I.split("").reverse().join("")},buildURLFromParts:function(I){return I.scheme+I.netLoc+I.path+I.params+I.query+I.fragment}};ae.exports=k})(this)},"./node_modules/webworkify-webpack/index.js":function(ae,J,D){function Y(c){var f={};function u(d){if(f[d])return f[d].exports;var o=f[d]={i:d,l:!1,exports:{}};return c[d].call(o.exports,o,o.exports,u),o.l=!0,o.exports}u.m=c,u.c=f,u.i=function(d){return d},u.d=function(d,o,s){u.o(d,o)||Object.defineProperty(d,o,{configurable:!1,enumerable:!0,get:s})},u.r=function(d){Object.defineProperty(d,"__esModule",{value:!0})},u.n=function(d){var o=d&&d.__esModule?function(){return d.default}:function(){return d};return u.d(o,"a",o),o},u.o=function(d,o){return Object.prototype.hasOwnProperty.call(d,o)},u.p="/",u.oe=function(d){throw console.error(d),d};var r=u(u.s=ENTRY_MODULE);return r.default||r}var F="[\\.|\\-|\\+|\\w|/|@]+",U="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+F+").*?\\)";function W(c){return(c+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function j(c){return!isNaN(1*c)}function k(c,f,u){var r={};r[u]=[];var d=f.toString(),o=d.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!o)return r;for(var s=o[1],l=new RegExp("(\\\\n|\\W)"+W(s)+U,"g"),p;p=l.exec(d);){if(p[3]==="dll-reference")continue;r[u].push(p[3])}for(l=new RegExp("\\("+W(s)+'\\("(dll-reference\\s('+F+'))"\\)\\)'+U,"g");p=l.exec(d);)c[p[2]]||(r[u].push(p[1]),c[p[2]]=D(p[1]).m),r[p[2]]=r[p[2]]||[],r[p[2]].push(p[4]);for(var R=Object.keys(r),w=0;w<R.length;w++)for(var x=0;x<r[R[w]].length;x++)j(r[R[w]][x])&&(r[R[w]][x]=1*r[R[w]][x]);return r}function I(c){var f=Object.keys(c);return f.reduce(function(u,r){return u||c[r].length>0},!1)}function m(c,f){for(var u={main:[f]},r={main:[]},d={main:{}};I(u);)for(var o=Object.keys(u),s=0;s<o.length;s++){var l=o[s],p=u[l],R=p.pop();if(d[l]=d[l]||{},d[l][R]||!c[l][R])continue;d[l][R]=!0,r[l]=r[l]||[],r[l].push(R);for(var w=k(c,c[l][R],l),x=Object.keys(w),O=0;O<x.length;O++)u[x[O]]=u[x[O]]||[],u[x[O]]=u[x[O]].concat(w[x[O]])}return r}ae.exports=function(c,f){f=f||{};var u={main:D.m},r=f.all?{main:Object.keys(u.main)}:m(u,c),d="";Object.keys(r).filter(function(R){return R!=="main"}).forEach(function(R){for(var w=0;r[R][w];)w++;r[R].push(w),u[R][w]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",d=d+"var "+R+" = ("+Y.toString().replace("ENTRY_MODULE",JSON.stringify(w))+")({"+r[R].map(function(x){return""+JSON.stringify(x)+": "+u[R][x].toString()}).join(",")+`});
|
|
`}),d=d+"new (("+Y.toString().replace("ENTRY_MODULE",JSON.stringify(c))+")({"+r.main.map(function(R){return""+JSON.stringify(R)+": "+u.main[R].toString()}).join(",")+"}))(self);";var o=new window.Blob([d],{type:"text/javascript"});if(f.bare)return o;var s=window.URL||window.webkitURL||window.mozURL||window.msURL,l=s.createObjectURL(o),p=new window.Worker(l);return p.objectURL=l,p}},"./src/config.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"hlsDefaultConfig",function(){return O}),D.d(J,"mergeConfig",function(){return T}),D.d(J,"enableStreamingMode",function(){return E});var Y=D("./src/controller/abr-controller.ts"),F=D("./src/controller/audio-stream-controller.ts"),U=D("./src/controller/audio-track-controller.ts"),W=D("./src/controller/subtitle-stream-controller.ts"),j=D("./src/controller/subtitle-track-controller.ts"),k=D("./src/controller/buffer-controller.ts"),I=D("./src/controller/timeline-controller.ts"),m=D("./src/controller/cap-level-controller.ts"),c=D("./src/controller/fps-controller.ts"),f=D("./src/controller/eme-controller.ts"),u=D("./src/controller/cmcd-controller.ts"),r=D("./src/utils/xhr-loader.ts"),d=D("./src/utils/fetch-loader.ts"),o=D("./src/utils/cues.ts"),s=D("./src/utils/mediakeys-helper.ts"),l=D("./src/utils/logger.ts");function p(){return p=Object.assign||function(y){for(var h=1;h<arguments.length;h++){var _=arguments[h];for(var g in _)Object.prototype.hasOwnProperty.call(_,g)&&(y[g]=_[g])}return y},p.apply(this,arguments)}function R(y,h){var _=Object.keys(y);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(y);h&&(g=g.filter(function(b){return Object.getOwnPropertyDescriptor(y,b).enumerable})),_.push.apply(_,g)}return _}function w(y){for(var h=1;h<arguments.length;h++){var _=arguments[h]!=null?arguments[h]:{};h%2?R(Object(_),!0).forEach(function(g){x(y,g,_[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(y,Object.getOwnPropertyDescriptors(_)):R(Object(_)).forEach(function(g){Object.defineProperty(y,g,Object.getOwnPropertyDescriptor(_,g))})}return y}function x(y,h,_){return h in y?Object.defineProperty(y,h,{value:_,enumerable:!0,configurable:!0,writable:!0}):y[h]=_,y}var O=w(w({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:r.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Y.default,bufferController:k.default,capLevelController:m.default,fpsController:c.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:s.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},A()),{},{subtitleStreamController:W.SubtitleStreamController,subtitleTrackController:j.default,timelineController:I.TimelineController,audioStreamController:F.default,audioTrackController:U.default,emeController:f.default,cmcdController:u.default});function A(){return{cueHandler:o.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 T(y,h){if((h.liveSyncDurationCount||h.liveMaxLatencyDurationCount)&&(h.liveSyncDuration||h.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(h.liveMaxLatencyDurationCount!==void 0&&(h.liveSyncDurationCount===void 0||h.liveMaxLatencyDurationCount<=h.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(h.liveMaxLatencyDuration!==void 0&&(h.liveSyncDuration===void 0||h.liveMaxLatencyDuration<=h.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return p({},y,h)}function E(y){var h=y.loader;if(h!==d.default&&h!==r.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),y.progressive=!1;else{var _=Object(d.fetchSupported)();_&&(y.loader=d.default,y.progressive=!0,y.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/polyfills/number.ts"),F=D("./src/utils/ewma-bandwidth-estimator.ts"),U=D("./src/events.ts"),W=D("./src/utils/buffer-helper.ts"),j=D("./src/errors.ts"),k=D("./src/types/loader.ts"),I=D("./src/utils/logger.ts");function m(u,r){for(var d=0;d<r.length;d++){var o=r[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(u,o.key,o)}}function c(u,r,d){return r&&m(u.prototype,r),d&&m(u,d),u}var f=function(){function u(d){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=d;var o=d.config;this.bwEstimator=new F.default(o.abrEwmaSlowVoD,o.abrEwmaFastVoD,o.abrEwmaDefaultEstimate),this.registerListeners()}var r=u.prototype;return r.registerListeners=function(){var o=this.hls;o.on(U.Events.FRAG_LOADING,this.onFragLoading,this),o.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),o.on(U.Events.FRAG_BUFFERED,this.onFragBuffered,this),o.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.on(U.Events.ERROR,this.onError,this)},r.unregisterListeners=function(){var o=this.hls;o.off(U.Events.FRAG_LOADING,this.onFragLoading,this),o.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),o.off(U.Events.FRAG_BUFFERED,this.onFragBuffered,this),o.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.off(U.Events.ERROR,this.onError,this)},r.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},r.onFragLoading=function(o,s){var l=s.frag;if(l.type===k.PlaylistLevelType.MAIN&&!this.timer){var p;this.fragCurrent=l,this.partCurrent=(p=s.part)!=null?p:null,this.timer=self.setInterval(this.onCheck,100)}},r.onLevelLoaded=function(o,s){var l=this.hls.config;s.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},r._abandonRulesCheck=function(){var o=this.fragCurrent,s=this.partCurrent,l=this.hls,p=l.autoLevelEnabled,R=l.config,w=l.media;if(!o||!w)return;var x=s?s.stats:o.stats,O=s?s.duration:o.duration;if(x.aborted){I.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!p||w.paused||!w.playbackRate||!w.readyState)return;var A=performance.now()-x.loading.start,T=Math.abs(w.playbackRate);if(A<=500*O/T)return;var E=l.levels,y=l.minAutoLevel,h=E[o.level],_=x.total||Math.max(x.loaded,Math.round(O*h.maxBitrate/8)),g=Math.max(1,x.bwEstimate?x.bwEstimate/8:x.loaded*1e3/A),b=(_-x.loaded)/g,M=w.currentTime,P=(W.BufferHelper.bufferInfo(w,M,R.maxBufferHole).end-M)/T;if(P>=2*O/T||b<=P)return;var K=Number.POSITIVE_INFINITY,V;for(V=o.level-1;V>y;V--){var B=E[V].maxBitrate;if(K=O*B/(8*.8*g),K<P)break}if(K>=b)return;var C=this.bwEstimator.getEstimate();I.logger.warn("Fragment "+o.sn+(s?" part "+s.index:"")+" of level "+o.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+`
|
|
Current BW estimate: `+(Object(Y.isFiniteNumber)(C)?(C/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+b.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+K.toFixed(3)+` s
|
|
Time to underbuffer: `+P.toFixed(3)+" s"),l.nextLoadLevel=V,this.bwEstimator.sample(A,x.loaded),this.clearTimer(),o.loader&&(this.fragCurrent=this.partCurrent=null,o.loader.abort()),l.trigger(U.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:o,part:s,stats:x})},r.onFragLoaded=function(o,s){var l=s.frag,p=s.part;if(l.type===k.PlaylistLevelType.MAIN&&Object(Y.isFiniteNumber)(l.sn)){var R=p?p.stats:l.stats,w=p?p.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var x=this.hls.levels[l.level],O=(x.loaded?x.loaded.bytes:0)+R.loaded,A=(x.loaded?x.loaded.duration:0)+w;x.loaded={bytes:O,duration:A},x.realBitrate=Math.round(8*O/A)}if(l.bitrateTest){var T={stats:R,frag:l,part:p,id:l.type};this.onFragBuffered(U.Events.FRAG_BUFFERED,T),l.bitrateTest=!1}}},r.onFragBuffered=function(o,s){var l=s.frag,p=s.part,R=p?p.stats:l.stats;if(R.aborted)return;if(l.type!==k.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var w=R.parsing.end-R.loading.start;this.bwEstimator.sample(w,R.loaded),R.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=w/1e3:this.bitrateTestDelay=0},r.onError=function(o,s){switch(s.details){case j.ErrorDetails.FRAG_LOAD_ERROR:case j.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},r.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},r.getNextABRAutoLevel=function(){var o=this.fragCurrent,s=this.partCurrent,l=this.hls,p=l.maxAutoLevel,R=l.config,w=l.minAutoLevel,x=l.media,O=s?s.duration:o?o.duration:0,A=x?x.currentTime:0,T=x&&x.playbackRate!==0?Math.abs(x.playbackRate):1,E=this.bwEstimator?this.bwEstimator.getEstimate():R.abrEwmaDefaultEstimate,y=(W.BufferHelper.bufferInfo(x,A,R.maxBufferHole).end-A)/T,h=this.findBestLevel(E,w,p,y,R.abrBandWidthFactor,R.abrBandWidthUpFactor);if(h>=0)return h;I.logger.trace((y?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var _=O?Math.min(O,R.maxStarvationDelay):R.maxStarvationDelay,g=R.abrBandWidthFactor,b=R.abrBandWidthUpFactor;if(!y){var M=this.bitrateTestDelay;if(M){var P=O?Math.min(O,R.maxLoadingDelay):R.maxLoadingDelay;_=P-M,I.logger.trace("bitrate test took "+Math.round(1e3*M)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*_)+" ms"),g=b=1}}return h=this.findBestLevel(E,w,p,y+_,g,b),Math.max(h,0)},r.findBestLevel=function(o,s,l,p,R,w){for(var x,O=this.fragCurrent,A=this.partCurrent,T=this.lastLoadedFragLevel,E=this.hls.levels,y=E[T],h=!!(y!=null&&(x=y.details)!==null&&x!==void 0&&x.live),_=y==null?void 0:y.codecSet,g=A?A.duration:O?O.duration:0,b=l;b>=s;b--){var M=E[b];if(!M||_&&M.codecSet!==_)continue;var P=M.details,K=(A?P==null?void 0:P.partTarget:P==null?void 0:P.averagetargetduration)||g,V=void 0;b<=T?V=R*o:V=w*o;var B=E[b].maxBitrate,C=B*K/V;if(I.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+b+"/"+Math.round(V)+"/"+B+"/"+K+"/"+p+"/"+C),V>B&&(!C||h&&!this.bitrateTestDelay||C<p))return b}return-1},c(u,[{key:"nextAutoLevel",get:function(){var o=this._nextAutoLevel,s=this.bwEstimator;if(o!==-1&&(!s||!s.canEstimate()))return o;var l=this.getNextABRAutoLevel();return o!==-1&&(l=Math.min(o,l)),l},set:function(o){this._nextAutoLevel=o}}]),u}();J.default=f},"./src/controller/audio-stream-controller.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/polyfills/number.ts"),F=D("./src/controller/base-stream-controller.ts"),U=D("./src/events.ts"),W=D("./src/utils/buffer-helper.ts"),j=D("./src/controller/fragment-tracker.ts"),k=D("./src/types/level.ts"),I=D("./src/types/loader.ts"),m=D("./src/loader/fragment.ts"),c=D("./src/demux/chunk-cache.ts"),f=D("./src/demux/transmuxer-interface.ts"),u=D("./src/types/transmuxer.ts"),r=D("./src/controller/fragment-finders.ts"),d=D("./src/utils/discontinuities.ts"),o=D("./src/errors.ts"),s=D("./src/utils/logger.ts");function l(){return l=Object.assign||function(O){for(var A=1;A<arguments.length;A++){var T=arguments[A];for(var E in T)Object.prototype.hasOwnProperty.call(T,E)&&(O[E]=T[E])}return O},l.apply(this,arguments)}function p(O,A){O.prototype=Object.create(A.prototype),O.prototype.constructor=O,R(O,A)}function R(O,A){return R=Object.setPrototypeOf||function(E,y){return E.__proto__=y,E},R(O,A)}var w=100,x=function(O){p(A,O);function A(E,y){var h;return h=O.call(this,E,y,"[audio-stream-controller]")||this,h.videoBuffer=null,h.videoTrackCC=-1,h.waitingVideoCC=-1,h.audioSwitch=!1,h.trackId=-1,h.waitingData=null,h.mainDetails=null,h.bufferFlushed=!1,h._registerListeners(),h}var T=A.prototype;return T.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},T._registerListeners=function(){var y=this.hls;y.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),y.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),y.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),y.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),y.on(U.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),y.on(U.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),y.on(U.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),y.on(U.Events.ERROR,this.onError,this),y.on(U.Events.BUFFER_RESET,this.onBufferReset,this),y.on(U.Events.BUFFER_CREATED,this.onBufferCreated,this),y.on(U.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),y.on(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),y.on(U.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T._unregisterListeners=function(){var y=this.hls;y.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),y.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),y.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),y.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),y.off(U.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),y.off(U.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),y.off(U.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),y.off(U.Events.ERROR,this.onError,this),y.off(U.Events.BUFFER_RESET,this.onBufferReset,this),y.off(U.Events.BUFFER_CREATED,this.onBufferCreated,this),y.off(U.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),y.off(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),y.off(U.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T.onInitPtsFound=function(y,h){var _=h.frag,g=h.id,b=h.initPTS;if(g==="main"){var M=_.cc;this.initPTS[_.cc]=b,this.log("InitPTS for cc: "+M+" found from main: "+b),this.videoTrackCC=M,this.state===F.State.WAITING_INIT_PTS&&this.tick()}},T.startLoad=function(y){if(!this.levels){this.startPosition=y,this.state=F.State.STOPPED;return}var h=this.lastCurrentTime;this.stopLoad(),this.setInterval(w),this.fragLoadError=0,h>0&&y===-1?(this.log("Override startPosition with lastCurrentTime @"+h.toFixed(3)),this.state=F.State.IDLE):(this.loadedmetadata=!1,this.state=F.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=y,this.tick()},T.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_TRACK:{var y,h=this.levels,_=this.trackId,g=h==null||((y=h[_])===null||y===void 0)?void 0:y.details;if(g){if(this.waitForCdnTuneIn(g))break;this.state=F.State.WAITING_INIT_PTS}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var b,M=performance.now(),P=this.retryDate;(!P||M>=P||(b=this.media)!==null&&b!==void 0&&b.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=F.State.IDLE);break}case F.State.WAITING_INIT_PTS:{var K=this.waitingData;if(K){var V=K.frag,B=K.part,C=K.cache,$=K.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.FRAG_LOADING;var ee=C.flush(),re={frag:V,part:B,payload:ee,networkDetails:null};this._handleFragmentLoadProgress(re),$&&O.prototype._handleFragmentLoadComplete.call(this,re)}else if(this.videoTrackCC!==this.waitingVideoCC)s.logger.log("Waiting fragment cc ("+V.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ue=this.getLoadPosition(),Te=W.BufferHelper.bufferInfo(this.mediaBuffer,ue,this.config.maxBufferHole),ye=Object(r.fragmentWithinToleranceTest)(Te.end,this.config.maxFragLookUpTolerance,V);ye<0&&(s.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+Te.end+" is needed"),this.clearWaitingFragment())}}else this.state=F.State.IDLE}}this.onTickEnd()},T.clearWaitingFragment=function(){var y=this.waitingData;y&&(this.fragmentTracker.removeFragment(y.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.IDLE)},T.onTickEnd=function(){var y=this.media;if(!y||!y.readyState)return;var h=this.mediaBuffer?this.mediaBuffer:y,_=h.buffered;!this.loadedmetadata&&_.length&&(this.loadedmetadata=!0),this.lastCurrentTime=y.currentTime},T.doTickIdle=function(){var y,h,_=this.hls,g=this.levels,b=this.media,M=this.trackId,P=_.config;if(!g||!g[M])return;if(!b&&(this.startFragRequested||!P.startFragPrefetch))return;var K=g[M],V=K.details;if(!V||V.live&&this.levelLastLoaded!==M||this.waitForCdnTuneIn(V)){this.state=F.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,m.ElementaryStreamTypes.AUDIO,I.PlaylistLevelType.AUDIO));var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,I.PlaylistLevelType.AUDIO);if(B===null)return;var C=B.len,$=this.getMaxBufferLength(),ee=this.audioSwitch;if(C>=$&&!ee)return;if(!ee&&this._streamEnded(B,V)){_.trigger(U.Events.BUFFER_EOS,{type:"audio"}),this.state=F.State.ENDED;return}var re=V.fragments,ue=re[0].start,Te=B.end;if(ee){var ye=this.getLoadPosition();Te=ye,V.PTSKnown&&ye<ue&&((B.end>ue||B.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),b.currentTime=ue+.05))}var be=this.getNextFragment(Te,V);if(!be){this.bufferFlushed=!0;return}((y=be.decryptdata)===null||y===void 0?void 0:y.keyFormat)==="identity"&&!((h=be.decryptdata)!==null&&h!==void 0&&h.key)?this.loadKey(be,V):this.loadFragment(be,V,Te)},T.getMaxBufferLength=function(){var y=O.prototype.getMaxBufferLength.call(this),h=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,I.PlaylistLevelType.MAIN);return h===null?y:Math.max(y,h.len)},T.onMediaDetaching=function(){this.videoBuffer=null,O.prototype.onMediaDetaching.call(this)},T.onAudioTracksUpdated=function(y,h){var _=h.audioTracks;this.resetTransmuxer(),this.levels=_.map(function(g){return new k.Level(g)})},T.onAudioTrackSwitching=function(y,h){var _=!!h.url;this.trackId=h.id;var g=this.fragCurrent;g!=null&&g.loader&&g.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),_?this.setInterval(w):this.resetTransmuxer(),_?(this.audioSwitch=!0,this.state=F.State.IDLE):this.state=F.State.STOPPED,this.tick()},T.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},T.onLevelLoaded=function(y,h){this.mainDetails=h.details},T.onAudioTrackLoaded=function(y,h){var _,g=this.levels,b=h.details,M=h.id;if(!g){this.warn("Audio tracks were reset while loading level "+M);return}this.log("Track "+M+" loaded ["+b.startSN+","+b.endSN+"],duration:"+b.totalduration);var P=g[M],K=0;if(b.live||(_=P.details)!==null&&_!==void 0&&_.live){var V=this.mainDetails;if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed||!V)return;!P.details&&b.hasProgramDateTime&&V.hasProgramDateTime?(Object(d.alignMediaPlaylistByPDT)(b,V),K=b.fragments[0].start):K=this.alignPlaylists(b,P.details)}P.details=b,this.levelLastLoaded=M,!this.startFragRequested&&(this.mainDetails||!b.live)&&this.setStartPosition(P.details,K),this.state===F.State.WAITING_TRACK&&!this.waitForCdnTuneIn(b)&&(this.state=F.State.IDLE),this.tick()},T._handleFragmentLoadProgress=function(y){var h,_=y.frag,g=y.part,b=y.payload,M=this.config,P=this.trackId,K=this.levels;if(!K){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+_.sn+" of level "+_.level+" will not be buffered");return}var V=K[P];console.assert(V,"Audio track is defined on fragment load progress");var B=V.details;console.assert(B,"Audio track details are defined on fragment load progress");var C=M.defaultAudioCodec||V.audioCodec||"mp4a.40.2",$=this.transmuxer;$||($=this.transmuxer=new f.default(this.hls,I.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ee=this.initPTS[_.cc],re=(h=_.initSegment)===null||h===void 0?void 0:h.data;if(ee!==void 0){var ue=!1,Te=g?g.index:-1,ye=Te!==-1,be=new u.ChunkMetadata(_.level,_.sn,_.stats.chunkCount,b.byteLength,Te,ye);$.push(b,re,C,"",_,g,B.totalduration,ue,be,ee)}else{s.logger.log("Unknown video PTS for cc "+_.cc+", waiting for video PTS before demuxing audio frag "+_.sn+" of ["+B.startSN+" ,"+B.endSN+"],track "+P);var we=this.waitingData=this.waitingData||{frag:_,part:g,cache:new c.default,complete:!1},xe=we.cache;xe.push(new Uint8Array(b)),this.waitingVideoCC=this.videoTrackCC,this.state=F.State.WAITING_INIT_PTS}},T._handleFragmentLoadComplete=function(y){if(this.waitingData){this.waitingData.complete=!0;return}O.prototype._handleFragmentLoadComplete.call(this,y)},T.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},T.onBufferCreated=function(y,h){var _=h.tracks.audio;_&&(this.mediaBuffer=_.buffer),h.tracks.video&&(this.videoBuffer=h.tracks.video.buffer)},T.onFragBuffered=function(y,h){var _=h.frag,g=h.part;if(_.type!==I.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(_)){this.warn("Fragment "+_.sn+(g?" p: "+g.index:"")+" of level "+_.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}_.sn!=="initSegment"&&(this.fragPrevious=_,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(U.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(_,g)},T.onError=function(y,h){switch(h.details){case o.ErrorDetails.FRAG_LOAD_ERROR:case o.ErrorDetails.FRAG_LOAD_TIMEOUT:case o.ErrorDetails.KEY_LOAD_ERROR:case o.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(I.PlaylistLevelType.AUDIO,h);break;case o.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case o.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==F.State.ERROR&&this.state!==F.State.STOPPED&&(this.state=h.fatal?F.State.ERROR:F.State.IDLE,this.warn(h.details+" while loading frag, switching to "+this.state+" state"));break;case o.ErrorDetails.BUFFER_FULL_ERROR:if(h.parent==="audio"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var _=!0,g=this.getFwdBufferInfo(this.mediaBuffer,I.PlaylistLevelType.AUDIO);g&&g.len>.5&&(_=!this.reduceMaxBufferLength(g.len)),_&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,O.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},T.onBufferFlushed=function(y,h){var _=h.type;_===m.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},T._handleTransmuxComplete=function(y){var h,_="audio",g=this.hls,b=y.remuxResult,M=y.chunkMeta,P=this.getCurrentContext(M);if(!P){this.warn("The loading context changed while buffering fragment "+M.sn+" of level "+M.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(M.level);return}var K=P.frag,V=P.part,B=b.audio,C=b.text,$=b.id3,ee=b.initSegment;if(this.fragContextChanged(K))return;if(this.state=F.State.PARSING,this.audioSwitch&&B&&this.completeAudioSwitch(),ee!=null&&ee.tracks&&(this._bufferInitSegment(ee.tracks,K,M),g.trigger(U.Events.FRAG_PARSING_INIT_SEGMENT,{frag:K,id:_,tracks:ee.tracks})),B){var re=B.startPTS,ue=B.endPTS,Te=B.startDTS,ye=B.endDTS;V&&(V.elementaryStreams[m.ElementaryStreamTypes.AUDIO]={startPTS:re,endPTS:ue,startDTS:Te,endDTS:ye}),K.setElementaryStreamInfo(m.ElementaryStreamTypes.AUDIO,re,ue,Te,ye),this.bufferFragmentData(B,K,V,M)}if($!=null&&(h=$.samples)!==null&&h!==void 0&&h.length){var be=l({frag:K,id:_},$);g.trigger(U.Events.FRAG_PARSING_METADATA,be)}if(C){var we=l({frag:K,id:_},C);g.trigger(U.Events.FRAG_PARSING_USERDATA,we)}},T._bufferInitSegment=function(y,h,_){if(this.state!==F.State.PARSING)return;y.video&&delete y.video;var g=y.audio;if(!g)return;g.levelCodec=g.codec,g.id="audio",this.log("Init audio buffer, container:"+g.container+", codecs[parsed]=["+g.codec+"]"),this.hls.trigger(U.Events.BUFFER_CODECS,y);var b=g.initSegment;if(b!=null&&b.byteLength){var M={type:"audio",frag:h,part:null,chunkMeta:_,parent:h.type,data:b};this.hls.trigger(U.Events.BUFFER_APPENDING,M)}this.tick()},T.loadFragment=function(y,h,_){var g=this.fragmentTracker.getState(y);this.fragCurrent=y,(this.audioSwitch||g===j.FragmentState.NOT_LOADED||g===j.FragmentState.PARTIAL)&&(y.sn==="initSegment"?this._loadInitSegment(y):h.live&&!Object(Y.isFiniteNumber)(this.initPTS[y.cc])?(this.log("Waiting for video PTS in continuity counter "+y.cc+" of live stream before loading audio fragment "+y.sn+" of level "+this.trackId),this.state=F.State.WAITING_INIT_PTS):(this.startFragRequested=!0,O.prototype.loadFragment.call(this,y,h,_)))},T.completeAudioSwitch=function(){var y=this.hls,h=this.media,_=this.trackId;h&&(this.log("Switching audio track : flushing all audio"),O.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,y.trigger(U.Events.AUDIO_TRACK_SWITCHED,{id:_})},A}(F.default);J.default=x},"./src/controller/audio-track-controller.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/events.ts"),F=D("./src/errors.ts"),U=D("./src/controller/base-playlist-controller.ts"),W=D("./src/types/loader.ts");function j(f,u){for(var r=0;r<u.length;r++){var d=u[r];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(f,d.key,d)}}function k(f,u,r){return u&&j(f.prototype,u),r&&j(f,r),f}function I(f,u){f.prototype=Object.create(u.prototype),f.prototype.constructor=f,m(f,u)}function m(f,u){return m=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},m(f,u)}var c=function(f){I(u,f);function u(d){var o;return o=f.call(this,d,"[audio-track-controller]")||this,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.trackName="",o.selectDefaultTrack=!0,o.registerListeners(),o}var r=u.prototype;return r.registerListeners=function(){var o=this.hls;o.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(Y.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.on(Y.Events.ERROR,this.onError,this)},r.unregisterListeners=function(){var o=this.hls;o.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(Y.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.off(Y.Events.ERROR,this.onError,this)},r.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,f.prototype.destroy.call(this)},r.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},r.onManifestParsed=function(o,s){this.tracks=s.audioTracks||[]},r.onAudioTrackLoaded=function(o,s){var l=s.id,p=s.details,R=this.tracksInGroup[l];if(!R){this.warn("Invalid audio track id "+l);return}var w=R.details;R.details=s.details,this.log("audioTrack "+l+" loaded ["+p.startSN+"-"+p.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,s,w))},r.onLevelLoading=function(o,s){this.switchLevel(s.level)},r.onLevelSwitching=function(o,s){this.switchLevel(s.level)},r.switchLevel=function(o){var s=this.hls.levels[o];if(!(s!=null&&s.audioGroupIds))return;var l=s.audioGroupIds[s.urlId];if(this.groupId!==l){this.groupId=l;var p=this.tracks.filter(function(w){return!l||w.groupId===l});this.selectDefaultTrack&&!p.some(function(w){return w.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=p;var R={audioTracks:p};this.log("Updating audio tracks, "+p.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(Y.Events.AUDIO_TRACKS_UPDATED,R),this.selectInitialTrack()}},r.onError=function(o,s){if(f.prototype.onError.call(this,o,s),s.fatal||!s.context)return;s.context.type===W.PlaylistContextType.AUDIO_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},r.setAudioTrack=function(o){var s=this.tracksInGroup;if(o<0||o>=s.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=s[this.trackId];this.log("Now switching to audio-track index "+o);var p=s[o],R=p.id,w=p.groupId,x=w===void 0?"":w,O=p.name,A=p.type,T=p.url;if(this.trackId=o,this.trackName=O,this.selectDefaultTrack=!1,this.hls.trigger(Y.Events.AUDIO_TRACK_SWITCHING,{id:R,groupId:x,name:O,type:A,url:T}),p.details&&!p.details.live)return;var E=this.switchParams(p.url,l==null?void 0:l.details);this.loadPlaylist(E)},r.selectInitialTrack=function(){var o=this.tracksInGroup;console.assert(o.length,"Initial audio track should be selected when tracks are known");var s=this.trackName,l=this.findTrackId(s)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},r.findTrackId=function(o){for(var s=this.tracksInGroup,l=0;l<s.length;l++){var p=s[l];if((!this.selectDefaultTrack||p.default)&&(!o||o===p.name))return p.id}return-1},r.loadPlaylist=function(o){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var l=s.id,p=s.groupId,R=s.url;if(o)try{R=o.addDirectives(R)}catch(w){this.warn("Could not construct new URL with HLS Delivery Directives: "+w)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(Y.Events.AUDIO_TRACK_LOADING,{url:R,id:l,groupId:p,deliveryDirectives:o||null})}},k(u,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1,this.setAudioTrack(o)}}]),u}(U.default);J.default=c},"./src/controller/base-playlist-controller.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return k});var Y=D("./src/polyfills/number.ts"),F=D("./src/types/level.ts"),U=D("./src/controller/level-helper.ts"),W=D("./src/utils/logger.ts"),j=D("./src/errors.ts"),k=function(){function I(c,f){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=W.logger.log.bind(W.logger,f+":"),this.warn=W.logger.warn.bind(W.logger,f+":"),this.hls=c}var m=I.prototype;return m.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},m.onError=function(f,u){u.fatal&&u.type===j.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},m.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},m.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},m.stopLoad=function(){this.canLoad=!1,this.clearTimer()},m.switchParams=function(f,u){var r=u==null?void 0:u.renditionReports;if(r)for(var d=0;d<r.length;d++){var o=r[d],s=""+o.URI;if(s===f.substr(-s.length)){var l=parseInt(o["LAST-MSN"]),p=parseInt(o["LAST-PART"]);if(u&&this.hls.config.lowLatencyMode){var R=Math.min(u.age-u.partTarget,u.targetduration);p!==void 0&&R>u.partTarget&&(p+=1)}if(Object(Y.isFiniteNumber)(l))return new F.HlsUrlParameters(l,Object(Y.isFiniteNumber)(p)?p:void 0,F.HlsSkip.No)}}},m.loadPlaylist=function(f){},m.shouldLoadTrack=function(f){return this.canLoad&&f&&!!f.url&&(!f.details||f.details.live)},m.playlistLoaded=function(f,u,r){var d=this,o=u.details,s=u.stats,l=s.loading.end?Math.max(0,self.performance.now()-s.loading.end):0;if(o.advancedDateTime=Date.now()-l,o.live||r!=null&&r.live){if(o.reloaded(r),r&&this.log("live playlist "+f+" "+(o.advanced?"REFRESHED "+o.lastPartSn+"-"+o.lastPartIndex:"MISSED")),r&&o.fragments.length>0&&Object(U.mergeDetails)(r,o),!this.canLoad||!o.live)return;var p,R=void 0,w=void 0;if(o.canBlockReload&&o.endSN&&o.advanced){var x=this.hls.config.lowLatencyMode,O=o.lastPartSn,A=o.endSN,T=o.lastPartIndex,E=T!==-1,y=O===A,h=x?0:T;E?(R=y?A+1:O,w=y?h:T+1):R=A+1;var _=o.age,g=_+o.ageHeader,b=Math.min(g-o.partTarget,o.targetduration*1.5);if(b>0){if(r&&b>r.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+r.tuneInGoal+" to: "+b+" with playlist age: "+o.age),b=0;else{var M=Math.floor(b/o.targetduration);if(R+=M,w!==void 0){var P=Math.round(b%o.targetduration/o.partTarget);w+=P}this.log("CDN Tune-in age: "+o.ageHeader+"s last advanced "+_.toFixed(2)+"s goal: "+b+" skip sn "+M+" to part "+w)}o.tuneInGoal=b}if(p=this.getDeliveryDirectives(o,u.deliveryDirectives,R,w),x||!y){this.loadPlaylist(p);return}}else p=this.getDeliveryDirectives(o,u.deliveryDirectives,R,w);var K=Object(U.computeReloadInterval)(o,s);R!==void 0&&o.canBlockReload&&(K-=o.partTarget||1),this.log("reload live playlist "+f+" in "+Math.round(K)+" ms"),this.timer=self.setTimeout(function(){return d.loadPlaylist(p)},K)}else this.clearTimer()},m.getDeliveryDirectives=function(f,u,r,d){var o=Object(F.getSkipValue)(f,r);return u!=null&&u.skip&&f.deltaUpdateFailed&&(r=u.msn,d=u.part,o=F.HlsSkip.No),new F.HlsUrlParameters(r,d,o)},m.retryLoadingOrFail=function(f){var u=this,r=this.hls.config,d=this.retryCount<r.levelLoadingMaxRetry;if(d){var o;if(this.retryCount++,f.details.indexOf("LoadTimeOut")>-1&&(o=f.context)!==null&&o!==void 0&&o.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+f.details+'"'),this.loadPlaylist();else{var s=Math.min(Math.pow(2,this.retryCount)*r.levelLoadingRetryDelay,r.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return u.loadPlaylist()},s),this.warn("retry playlist loading #"+this.retryCount+" in "+s+' ms after "'+f.details+'"')}}else this.warn('cannot recover from error "'+f.details+'"'),this.clearTimer(),f.fatal=!0;return d},I}()},"./src/controller/base-stream-controller.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"State",function(){return A}),D.d(J,"default",function(){return T});var Y=D("./src/polyfills/number.ts"),F=D("./src/task-loop.ts"),U=D("./src/controller/fragment-tracker.ts"),W=D("./src/utils/buffer-helper.ts"),j=D("./src/utils/logger.ts"),k=D("./src/events.ts"),I=D("./src/errors.ts"),m=D("./src/types/transmuxer.ts"),c=D("./src/utils/mp4-tools.ts"),f=D("./src/utils/discontinuities.ts"),u=D("./src/controller/fragment-finders.ts"),r=D("./src/controller/level-helper.ts"),d=D("./src/loader/fragment-loader.ts"),o=D("./src/crypt/decrypter.ts"),s=D("./src/utils/time-ranges.ts"),l=D("./src/types/loader.ts");function p(E,y){for(var h=0;h<y.length;h++){var _=y[h];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(E,_.key,_)}}function R(E,y,h){return y&&p(E.prototype,y),h&&p(E,h),E}function w(E){if(E===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return E}function x(E,y){E.prototype=Object.create(y.prototype),E.prototype.constructor=E,O(E,y)}function O(E,y){return O=Object.setPrototypeOf||function(_,g){return _.__proto__=g,_},O(E,y)}var A={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"},T=function(E){x(y,E);function y(_,g,b){var M;return M=E.call(this)||this,M.hls=void 0,M.fragPrevious=null,M.fragCurrent=null,M.fragmentTracker=void 0,M.transmuxer=null,M._state=A.STOPPED,M.media=void 0,M.mediaBuffer=void 0,M.config=void 0,M.bitrateTest=!1,M.lastCurrentTime=0,M.nextLoadPosition=0,M.startPosition=0,M.loadedmetadata=!1,M.fragLoadError=0,M.retryDate=0,M.levels=null,M.fragmentLoader=void 0,M.levelLastLoaded=null,M.startFragRequested=!1,M.decrypter=void 0,M.initPTS=[],M.onvseeking=null,M.onvended=null,M.logPrefix="",M.log=void 0,M.warn=void 0,M.logPrefix=b,M.log=j.logger.log.bind(j.logger,b+":"),M.warn=j.logger.warn.bind(j.logger,b+":"),M.hls=_,M.fragmentLoader=new d.default(_.config),M.fragmentTracker=g,M.config=_.config,M.decrypter=new o.default(_,_.config),_.on(k.Events.KEY_LOADED,M.onKeyLoaded,w(M)),M}var h=y.prototype;return h.doTick=function(){this.onTickEnd()},h.onTickEnd=function(){},h.startLoad=function(g){},h.stopLoad=function(){this.fragmentLoader.abort();var g=this.fragCurrent;g&&this.fragmentTracker.removeFragment(g),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=A.STOPPED},h._streamEnded=function(g,b){var M=this.fragCurrent,P=this.fragmentTracker;if(!b.live&&M&&M.sn===b.endSN&&!g.nextStart){var K=P.getState(M);return K===U.FragmentState.PARTIAL||K===U.FragmentState.OK}return!1},h.onMediaAttached=function(g,b){var M=this.media=this.mediaBuffer=b.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),M.addEventListener("seeking",this.onvseeking),M.addEventListener("ended",this.onvended);var P=this.config;this.levels&&P.autoStartLoad&&this.state===A.STOPPED&&this.startLoad(P.startPosition)},h.onMediaDetaching=function(){var g=this.media;g!=null&&g.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),g&&(g.removeEventListener("seeking",this.onvseeking),g.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},h.onMediaSeeking=function(){var g=this.config,b=this.fragCurrent,M=this.media,P=this.mediaBuffer,K=this.state,V=M?M.currentTime:0,B=W.BufferHelper.bufferInfo(P||M,V,g.maxBufferHole);if(this.log("media seeking to "+(Object(Y.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+K),K===A.ENDED)this.resetLoadingState();else if(b&&!B.len){var C=g.maxFragLookUpTolerance,$=b.start-C,ee=b.start+b.duration+C,re=V>ee;(V<$||re)&&(re&&b.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),b.loader.abort()),this.resetLoadingState())}M&&(this.lastCurrentTime=V),!this.loadedmetadata&&!B.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},h.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},h.onKeyLoaded=function(g,b){if(this.state!==A.KEY_LOADING||b.frag!==this.fragCurrent||!this.levels)return;this.state=A.IDLE;var M=this.levels[b.frag.level].details;M&&this.loadFragment(b.frag,M,b.frag.start)},h.onHandlerDestroying=function(){this.stopLoad(),E.prototype.onHandlerDestroying.call(this)},h.onHandlerDestroyed=function(){this.state=A.STOPPED,this.hls.off(k.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,E.prototype.onHandlerDestroyed.call(this)},h.loadKey=function(g,b){this.log("Loading key for "+g.sn+" of ["+b.startSN+"-"+b.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level),this.state=A.KEY_LOADING,this.fragCurrent=g,this.hls.trigger(k.Events.KEY_LOADING,{frag:g})},h.loadFragment=function(g,b,M){this._loadFragForPlayback(g,b,M)},h._loadFragForPlayback=function(g,b,M){var P=this,K=function(B){if(P.fragContextChanged(g)){P.warn("Fragment "+g.sn+(B.part?" p: "+B.part.index:"")+" of level "+g.level+" was dropped during download."),P.fragmentTracker.removeFragment(g);return}g.stats.chunkCount++,P._handleFragmentLoadProgress(B)};this._doFragLoad(g,b,M,K).then(function(V){if(!V)return;P.fragLoadError=0;var B=P.state;if(P.fragContextChanged(g)){(B===A.FRAG_LOADING||B===A.BACKTRACKING||!P.fragCurrent&&B===A.PARSING)&&(P.fragmentTracker.removeFragment(g),P.state=A.IDLE);return}if("payload"in V&&(P.log("Loaded fragment "+g.sn+" of level "+g.level),P.hls.trigger(k.Events.FRAG_LOADED,V),P.state===A.BACKTRACKING)){P.fragmentTracker.backtrack(g,V),P.resetFragmentLoading(g);return}P._handleFragmentLoadComplete(V)}).catch(function(V){P.warn(V),P.resetFragmentLoading(g)})},h.flushMainBuffer=function(g,b,M){if(M===void 0&&(M=null),!(g-b))return;var P={startOffset:g,endOffset:b,type:M};this.fragLoadError=0,this.hls.trigger(k.Events.BUFFER_FLUSHING,P)},h._loadInitSegment=function(g){var b=this;this._doFragLoad(g).then(function(M){if(!M||b.fragContextChanged(g)||!b.levels)throw new Error("init load aborted");return M}).then(function(M){var P=b.hls,K=M.payload,V=g.decryptdata;if(K&&K.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var B=self.performance.now();return b.decrypter.webCryptoDecrypt(new Uint8Array(K),V.key.buffer,V.iv.buffer).then(function(C){var $=self.performance.now();return P.trigger(k.Events.FRAG_DECRYPTED,{frag:g,payload:C,stats:{tstart:B,tdecrypt:$}}),M.payload=C,M})}return M}).then(function(M){var P=b.fragCurrent,K=b.hls,V=b.levels;if(!V)throw new Error("init load aborted, missing levels");var B=V[g.level].details;console.assert(B,"Level details are defined when init segment is loaded");var C=g.stats;b.state=A.IDLE,b.fragLoadError=0,g.data=new Uint8Array(M.payload),C.parsing.start=C.buffering.start=self.performance.now(),C.parsing.end=C.buffering.end=self.performance.now(),M.frag===P&&K.trigger(k.Events.FRAG_BUFFERED,{stats:C,frag:P,part:null,id:g.type}),b.tick()}).catch(function(M){b.warn(M),b.resetFragmentLoading(g)})},h.fragContextChanged=function(g){var b=this.fragCurrent;return!g||!b||g.level!==b.level||g.sn!==b.sn||g.urlId!==b.urlId},h.fragBufferedComplete=function(g,b){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+g.type+" sn: "+g.sn+(b?" part: "+b.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level+" "+s.default.toString(W.BufferHelper.getBuffered(M))),this.state=A.IDLE,this.tick()},h._handleFragmentLoadComplete=function(g){var b=this.transmuxer;if(!b)return;var M=g.frag,P=g.part,K=g.partsLoaded,V=!K||K.length===0||K.some(function(C){return!C}),B=new m.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,P?P.index:-1,!V);b.flush(B)},h._handleFragmentLoadProgress=function(g){},h._doFragLoad=function(g,b,M,P){var K=this;if(M===void 0&&(M=null),!this.levels)throw new Error("frag load aborted, missing levels");if(M=Math.max(g.start,M||0),this.config.lowLatencyMode&&b){var V=b.partList;if(V&&P){M>g.end&&b.fragmentHint&&(g=b.fragmentHint);var B=this.getNextPart(V,g,M);if(B>-1){var C=V[B];return this.log("Loading part sn: "+g.sn+" p: "+C.index+" cc: "+g.cc+" of playlist ["+b.startSN+"-"+b.endSN+"] parts [0-"+B+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=C.start+C.duration,this.state=A.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:g,part:V[B],targetBufferTime:M}),this.doFragPartsLoad(g,V,B,P).catch(function($){return K.handleFragLoadError($)})}else if(!g.url||this.loadedEndOfParts(V,M))return Promise.resolve(null)}}return this.log("Loading fragment "+g.sn+" cc: "+g.cc+" "+(b?"of ["+b.startSN+"-"+b.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(M.toFixed(3))),Object(Y.isFiniteNumber)(g.sn)&&!this.bitrateTest&&(this.nextLoadPosition=g.start+g.duration),this.state=A.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:g,targetBufferTime:M}),this.fragmentLoader.load(g,P).catch(function($){return K.handleFragLoadError($)})},h.doFragPartsLoad=function(g,b,M,P){var K=this;return new Promise(function(V,B){var C=[],$=function ee(re){var ue=b[re];K.fragmentLoader.loadPart(g,ue,P).then(function(Te){C[ue.index]=Te;var ye=Te.part;K.hls.trigger(k.Events.FRAG_LOADED,Te);var be=b[re+1];if(be&&be.fragment===g)ee(re+1);else return V({frag:g,part:ye,partsLoaded:C})}).catch(B)};$(M)})},h.handleFragLoadError=function(g){var b=g.data;return b&&b.details===I.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(b.frag,b.part):this.hls.trigger(k.Events.ERROR,b),null},h._handleTransmuxerFlush=function(g){var b=this.getCurrentContext(g);if(!b||this.state!==A.PARSING){this.fragCurrent||(this.state=A.IDLE);return}var M=b.frag,P=b.part,K=b.level,V=self.performance.now();M.stats.parsing.end=V,P&&(P.stats.parsing.end=V),this.updateLevelTiming(M,P,K,g.partial)},h.getCurrentContext=function(g){var b=this.levels,M=g.level,P=g.sn,K=g.part;if(!b||!b[M])return this.warn("Levels object was unset while buffering fragment "+P+" of level "+M+". The current chunk will not be buffered."),null;var V=b[M],B=K>-1?Object(r.getPartWith)(V,P,K):null,C=B?B.fragment:Object(r.getFragmentWithSN)(V,P,this.fragCurrent);return C?{frag:C,part:B,level:V}:null},h.bufferFragmentData=function(g,b,M,P){if(!g||this.state!==A.PARSING)return;var K=g.data1,V=g.data2,B=K;if(K&&V&&(B=Object(c.appendUint8Array)(K,V)),!B||!B.length)return;var C={type:g.type,frag:b,part:M,chunkMeta:P,parent:b.type,data:B};this.hls.trigger(k.Events.BUFFER_APPENDING,C),g.dropped&&g.independent&&!M&&this.flushBufferGap(b)},h.flushBufferGap=function(g){var b=this.media;if(!b)return;if(!W.BufferHelper.isBuffered(b,b.currentTime)){this.flushMainBuffer(0,g.start);return}var M=b.currentTime,P=W.BufferHelper.bufferInfo(b,M,0),K=g.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,K*.25),B=Math.max(Math.min(g.start-V,P.end-V),M+V);g.start-B>V&&this.flushMainBuffer(B,g.start)},h.getFwdBufferInfo=function(g,b){var M=this.config,P=this.getLoadPosition();if(!Object(Y.isFiniteNumber)(P))return null;var K=W.BufferHelper.bufferInfo(g,P,M.maxBufferHole);if(K.len===0&&K.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(P,b);if(V&&K.nextStart<V.end)return W.BufferHelper.bufferInfo(g,P,Math.max(K.nextStart,M.maxBufferHole))}return K},h.getMaxBufferLength=function(g){var b=this.config,M;return g?M=Math.max(8*b.maxBufferSize/g,b.maxBufferLength):M=b.maxBufferLength,Math.min(M,b.maxMaxBufferLength)},h.reduceMaxBufferLength=function(g){var b=this.config,M=g||b.maxBufferLength;return b.maxMaxBufferLength>=M?(b.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+b.maxMaxBufferLength+"s"),!0):!1},h.getNextFragment=function(g,b){var M,P,K=b.fragments,V=K.length;if(!V)return null;var B=this.config,C=K[0].start,$;if(b.live){var ee=B.initialLiveManifestSize;if(V<ee)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+ee+")"),null;!b.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&($=this.getInitialLiveFragment(b,K),this.startPosition=$?this.hls.liveSyncPosition||$.start:g)}else g<=C&&($=K[0]);if(!$){var re=B.lowLatencyMode?b.partEnd:b.fragmentEnd;$=this.getFragmentAtPosition(g,re,b)}return(M=$)!==null&&M!==void 0&&M.initSegment&&!((P=$)!==null&&P!==void 0&&P.initSegment.data)&&!this.bitrateTest&&($=$.initSegment),$},h.getNextPart=function(g,b,M){for(var P=-1,K=!1,V=!0,B=0,C=g.length;B<C;B++){var $=g[B];if(V=V&&!$.independent,P>-1&&M<$.start)break;var ee=$.loaded;!ee&&(K||$.independent||V)&&$.fragment===b&&(P=B),K=ee}return P},h.loadedEndOfParts=function(g,b){var M=g[g.length-1];return M&&b>M.start&&M.loaded},h.getInitialLiveFragment=function(g,b){var M=this.fragPrevious,P=null;if(M){if(g.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+M.programDateTime),P=Object(u.findFragmentByPDT)(b,M.endProgramDateTime,this.config.maxFragLookUpTolerance)),!P){var K=M.sn+1;if(K>=g.startSN&&K<=g.endSN){var V=b[K-g.startSN];M.cc===V.cc&&(P=V,this.log("Live playlist, switching playlist, load frag with next SN: "+P.sn))}P||(P=Object(u.findFragWithCC)(b,M.cc),P&&this.log("Live playlist, switching playlist, load frag with same CC: "+P.sn))}}else{var B=this.hls.liveSyncPosition;B!==null&&(P=this.getFragmentAtPosition(B,this.bitrateTest?g.fragmentEnd:g.edge,g))}return P},h.getFragmentAtPosition=function(g,b,M){var P=this.config,K=this.fragPrevious,V=M.fragments,B=M.endSN,C=M.fragmentHint,$=P.maxFragLookUpTolerance,ee=!!(P.lowLatencyMode&&M.partList&&C);ee&&C&&!this.bitrateTest&&(V=V.concat(C),B=C.sn);var re;if(g<b){var ue=g>b-$?0:$;re=Object(u.findFragmentByPTS)(K,V,g,ue)}else re=V[V.length-1];if(re){var Te=re.sn-M.startSN,ye=K&&re.level===K.level,be=V[Te+1],we=this.fragmentTracker.getState(re);if(we===U.FragmentState.BACKTRACKED){re=null;for(var xe=Te;V[xe]&&this.fragmentTracker.getState(V[xe])===U.FragmentState.BACKTRACKED;)K?re=V[xe--]:re=V[--xe];re||(re=be)}else K&&re.sn===K.sn&&!ee&&(ye&&(re.sn<B&&this.fragmentTracker.getState(be)!==U.FragmentState.OK?(this.log("SN "+re.sn+" just loaded, load next one: "+be.sn),re=be):re=null))}return re},h.synchronizeToLiveEdge=function(g){var b=this.config,M=this.media;if(!M)return;var P=this.hls.liveSyncPosition,K=M.currentTime,V=g.fragments[0].start,B=g.edge,C=K>=V-b.maxFragLookUpTolerance&&K<=B;if(P!==null&&M.duration>P&&(K<P||!C)){var $=b.liveMaxLatencyDuration!==void 0?b.liveMaxLatencyDuration:b.liveMaxLatencyDurationCount*g.targetduration;(!C&&M.readyState<4||K<B-$)&&(this.loadedmetadata||(this.nextLoadPosition=P),M.readyState&&(this.warn("Playback: "+K.toFixed(3)+" is located too far from the end of live sliding playlist: "+B+", reset currentTime to : "+P.toFixed(3)),M.currentTime=P))}},h.alignPlaylists=function(g,b){var M=this.levels,P=this.levelLastLoaded,K=this.fragPrevious,V=P!==null?M[P]:null,B=g.fragments.length;if(!B)return this.warn("No fragments in live playlist"),0;var C=g.fragments[0].start,$=!b,ee=g.alignedSliding&&Object(Y.isFiniteNumber)(C);if($||!ee&&!C){Object(f.alignStream)(K,V,g);var re=g.fragments[0].start;return this.log("Live playlist sliding: "+re.toFixed(2)+" start-sn: "+(b?b.startSN:"na")+"->"+g.startSN+" prev-sn: "+(K?K.sn:"na")+" fragments: "+B),re}return C},h.waitForCdnTuneIn=function(g){var b=3;return g.live&&g.canBlockReload&&g.tuneInGoal>Math.max(g.partHoldBack,g.partTarget*b)},h.setStartPosition=function(g,b){var M=this.startPosition;if(M<b&&(M=-1),M===-1||this.lastCurrentTime===-1){var P=g.startTimeOffset;Object(Y.isFiniteNumber)(P)?(M=b+P,P<0&&(M+=g.totalduration),M=Math.min(Math.max(b,M),b+g.totalduration),this.log("Start time offset "+P+" found in playlist, adjust startPosition to "+M),this.startPosition=M):g.live?M=this.hls.liveSyncPosition||b:this.startPosition=M=0,this.lastCurrentTime=M}this.nextLoadPosition=M},h.getLoadPosition=function(){var g=this.media,b=0;return this.loadedmetadata&&g?b=g.currentTime:this.nextLoadPosition&&(b=this.nextLoadPosition),b},h.handleFragLoadAborted=function(g,b){this.transmuxer&&g.sn!=="initSegment"&&g.stats.aborted&&(this.warn("Fragment "+g.sn+(b?" part"+b.index:"")+" of level "+g.level+" was aborted"),this.resetFragmentLoading(g))},h.resetFragmentLoading=function(g){(!this.fragCurrent||!this.fragContextChanged(g))&&(this.state=A.IDLE)},h.onFragmentOrKeyLoadError=function(g,b){if(b.fatal)return;var M=b.frag;if(!M||M.type!==g)return;var P=this.fragCurrent;console.assert(P&&M.sn===P.sn&&M.level===P.level&&M.urlId===P.urlId,"Frag load error must match current frag to retry");var K=this.config;if(this.fragLoadError+1<=K.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(M.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*K.fragLoadingRetryDelay,K.fragLoadingMaxRetryTimeout);this.warn("Fragment "+M.sn+" of "+g+" "+M.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=A.FRAG_LOADING_WAITING_RETRY}else b.levelRetry?(g===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=A.IDLE):(j.logger.error(b.details+" reaches max retry, redispatch as fatal ..."),b.fatal=!0,this.hls.stopLoad(),this.state=A.ERROR)},h.afterBufferFlushed=function(g,b,M){if(!g)return;var P=W.BufferHelper.getBuffered(g);this.fragmentTracker.detectEvictedFragments(b,P,M),this.state===A.ENDED&&this.resetLoadingState()},h.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=A.IDLE},h.resetLiveStartWhenNotLoaded=function(g){if(!this.loadedmetadata){this.startFragRequested=!1;var b=this.levels?this.levels[g].details:null;if(b!=null&&b.live)return this.startPosition=-1,this.setStartPosition(b,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},h.updateLevelTiming=function(g,b,M,P){var K=this,V=M.details;console.assert(!!V,"level.details must be defined");var B=Object.keys(g.elementaryStreams).reduce(function(C,$){var ee=g.elementaryStreams[$];if(ee){var re=ee.endPTS-ee.startPTS;if(re<=0)return K.warn("Could not parse fragment "+g.sn+" "+$+" duration reliably ("+re+") resetting transmuxer to fallback to playlist timing"),K.resetTransmuxer(),C||!1;var ue=P?0:Object(r.updateFragPTSDTS)(V,g,ee.startPTS,ee.endPTS,ee.startDTS,ee.endDTS);return K.hls.trigger(k.Events.LEVEL_PTS_UPDATED,{details:V,level:M,drift:ue,type:$,frag:g,start:ee.startPTS,end:ee.endPTS}),!0}return C},!1);B?(this.state=A.PARSED,this.hls.trigger(k.Events.FRAG_PARSED,{frag:g,part:b})):this.resetLoadingState()},h.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},R(y,[{key:"state",get:function(){return this._state},set:function(g){var b=this._state;b!==g&&(this._state=g,this.log(b+"->"+g))}}]),y}(F.default)},"./src/controller/buffer-controller.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return u});var Y=D("./src/polyfills/number.ts"),F=D("./src/events.ts"),U=D("./src/utils/logger.ts"),W=D("./src/errors.ts"),j=D("./src/utils/buffer-helper.ts"),k=D("./src/utils/mediasource-helper.ts"),I=D("./src/loader/fragment.ts"),m=D("./src/controller/buffer-operation-queue.ts"),c=Object(k.getMediaSource)(),f=/([ha]vc.)(?:\.[^.,]+)+/,u=function(){function r(o){var s=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=s.hls,p=s.media,R=s.mediaSource;U.logger.log("[buffer-controller]: Media source opened"),p&&(s.updateMediaElementDuration(),l.trigger(F.Events.MEDIA_ATTACHED,{media:p})),R&&R.removeEventListener("sourceopen",s._onMediaSourceOpen),s.checkPendingTracks()},this._onMediaSourceClose=function(){U.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){U.logger.log("[buffer-controller]: Media source ended")},this.hls=o,this._initSourceBuffer(),this.registerListeners()}var d=r.prototype;return d.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},d.destroy=function(){this.unregisterListeners(),this.details=null},d.registerListeners=function(){var s=this.hls;s.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(F.Events.BUFFER_RESET,this.onBufferReset,this),s.on(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),s.on(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),s.on(F.Events.BUFFER_EOS,this.onBufferEos,this),s.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),s.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),s.on(F.Events.FRAG_PARSED,this.onFragParsed,this),s.on(F.Events.FRAG_CHANGED,this.onFragChanged,this)},d.unregisterListeners=function(){var s=this.hls;s.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(F.Events.BUFFER_RESET,this.onBufferReset,this),s.off(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),s.off(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),s.off(F.Events.BUFFER_EOS,this.onBufferEos,this),s.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),s.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),s.off(F.Events.FRAG_PARSED,this.onFragParsed,this),s.off(F.Events.FRAG_CHANGED,this.onFragChanged,this)},d._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new m.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},d.onManifestParsed=function(s,l){var p=2;(l.audio&&!l.video||!l.altAudio)&&(p=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=p,this.details=null,U.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},d.onMediaAttaching=function(s,l){var p=this.media=l.media;if(p&&c){var R=this.mediaSource=new c;R.addEventListener("sourceopen",this._onMediaSourceOpen),R.addEventListener("sourceended",this._onMediaSourceEnded),R.addEventListener("sourceclose",this._onMediaSourceClose),p.src=self.URL.createObjectURL(R),this._objectUrl=p.src}},d.onMediaDetaching=function(){var s=this.media,l=this.mediaSource,p=this._objectUrl;if(l){if(U.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(R){U.logger.warn("[buffer-controller]: onMediaDetaching: "+R.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),s&&(p&&self.URL.revokeObjectURL(p),s.src===p?(s.removeAttribute("src"),s.load()):U.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(F.Events.MEDIA_DETACHED,void 0)},d.onBufferReset=function(){var s=this;this.getSourceBufferTypes().forEach(function(l){var p=s.sourceBuffer[l];try{p&&(s.removeBufferListeners(l),s.mediaSource&&s.mediaSource.removeSourceBuffer(p),s.sourceBuffer[l]=void 0)}catch(R){U.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",R)}}),this._initSourceBuffer()},d.onBufferCodecs=function(s,l){var p=this,R=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(w){if(R){var x=p.tracks[w];if(x&&typeof x.buffer.changeType=="function"){var O=l[w],A=O.codec,T=O.levelCodec,E=O.container,y=(x.levelCodec||x.codec).replace(f,"$1"),h=(T||A).replace(f,"$1");if(y!==h){var _=E+";codecs="+(T||A);p.appendChangeType(w,_)}}}else p.pendingTracks[w]=l[w]}),R)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},d.appendChangeType=function(s,l){var p=this,R=this.operationQueue,w={execute:function(){var O=p.sourceBuffer[s];O&&(U.logger.log("[buffer-controller]: changing "+s+" sourceBuffer type to "+l),O.changeType(l)),R.shiftAndExecuteNext(s)},onStart:function(){},onComplete:function(){},onError:function(O){U.logger.warn("[buffer-controller]: Failed to change "+s+" SourceBuffer type",O)}};R.append(w,s)},d.onBufferAppending=function(s,l){var p=this,R=this.hls,w=this.operationQueue,x=this.tracks,O=l.data,A=l.type,T=l.frag,E=l.part,y=l.chunkMeta,h=y.buffering[A],_=self.performance.now();h.start=_;var g=T.stats.buffering,b=E?E.stats.buffering:null;g.start===0&&(g.start=_),b&&b.start===0&&(b.start=_);var M=x.audio,P=A==="audio"&&y.id===1&&(M==null?void 0:M.container)==="audio/mpeg",K={execute:function(){if(h.executeStart=self.performance.now(),P){var B=p.sourceBuffer[A];if(B){var C=T.start-B.timestampOffset;Math.abs(C)>=.1&&(U.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+T.start+" (delta: "+C+") sn: "+T.sn+")"),B.timestampOffset=T.start)}}p.appendExecutor(O,A)},onStart:function(){},onComplete:function(){var B=self.performance.now();h.executeEnd=h.end=B,g.first===0&&(g.first=B),b&&b.first===0&&(b.first=B);var C=p.sourceBuffer,$={};for(var ee in C)$[ee]=j.BufferHelper.getBuffered(C[ee]);p.appendError=0,p.hls.trigger(F.Events.BUFFER_APPENDED,{type:A,frag:T,part:E,chunkMeta:y,parent:T.type,timeRanges:$})},onError:function(B){U.logger.error("[buffer-controller]: Error encountered while trying to append to the "+A+" SourceBuffer",B);var C={type:W.ErrorTypes.MEDIA_ERROR,parent:T.type,details:W.ErrorDetails.BUFFER_APPEND_ERROR,err:B,fatal:!1};B.code===DOMException.QUOTA_EXCEEDED_ERR?C.details=W.ErrorDetails.BUFFER_FULL_ERROR:(p.appendError++,C.details=W.ErrorDetails.BUFFER_APPEND_ERROR,p.appendError>R.config.appendErrorMaxRetry&&(U.logger.error("[buffer-controller]: Failed "+R.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),C.fatal=!0)),R.trigger(F.Events.ERROR,C)}};w.append(K,A)},d.onBufferFlushing=function(s,l){var p=this,R=this.operationQueue,w=function(O){return{execute:p.removeExecutor.bind(p,O,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){p.hls.trigger(F.Events.BUFFER_FLUSHED,{type:O})},onError:function(T){U.logger.warn("[buffer-controller]: Failed to remove from "+O+" SourceBuffer",T)}}};l.type?R.append(w(l.type),l.type):this.getSourceBufferTypes().forEach(function(x){R.append(w(x),x)})},d.onFragParsed=function(s,l){var p=this,R=l.frag,w=l.part,x=[],O=w?w.elementaryStreams:R.elementaryStreams;O[I.ElementaryStreamTypes.AUDIOVIDEO]?x.push("audiovideo"):(O[I.ElementaryStreamTypes.AUDIO]&&x.push("audio"),O[I.ElementaryStreamTypes.VIDEO]&&x.push("video"));var A=function(){var E=self.performance.now();R.stats.buffering.end=E,w&&(w.stats.buffering.end=E);var y=w?w.stats:R.stats;p.hls.trigger(F.Events.FRAG_BUFFERED,{frag:R,part:w,stats:y,id:R.type})};x.length===0&&U.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+R.type+" level: "+R.level+" sn: "+R.sn),this.blockBuffers(A,x)},d.onFragChanged=function(s,l){this.flushBackBuffer()},d.onBufferEos=function(s,l){var p=this,R=this.getSourceBufferTypes().reduce(function(w,x){var O=p.sourceBuffer[x];return(!l.type||l.type===x)&&(O&&!O.ended&&(O.ended=!0,U.logger.log("[buffer-controller]: "+x+" sourceBuffer now EOS"))),w&&!!(!O||O.ended)},!0);R&&this.blockBuffers(function(){var w=p.mediaSource;if(!w||w.readyState!=="open")return;w.endOfStream()})},d.onLevelUpdated=function(s,l){var p=l.details;if(!p.fragments.length)return;this.details=p,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},d.flushBackBuffer=function(){var s=this.hls,l=this.details,p=this.media,R=this.sourceBuffer;if(!p||l===null)return;var w=this.getSourceBufferTypes();if(!w.length)return;var x=l.live&&s.config.liveBackBufferLength!==null?s.config.liveBackBufferLength:s.config.backBufferLength;if(!Object(Y.isFiniteNumber)(x)||x<0)return;var O=p.currentTime,A=l.levelTargetDuration,T=Math.max(x,A),E=Math.floor(O/A)*A-T;w.forEach(function(y){var h=R[y];if(h){var _=j.BufferHelper.getBuffered(h);_.length>0&&E>_.start(0)&&(s.trigger(F.Events.BACK_BUFFER_REACHED,{bufferEnd:E}),l.live&&s.trigger(F.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:E}),s.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:E,type:y}))}})},d.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var s=this.details,l=this.hls,p=this.media,R=this.mediaSource,w=s.fragments[0].start+s.totalduration,x=p.duration,O=Object(Y.isFiniteNumber)(R.duration)?R.duration:0;s.live&&l.config.liveDurationInfinity?(U.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),R.duration=Infinity,this.updateSeekableRange(s)):(w>O&&w>x||!Object(Y.isFiniteNumber)(x))&&(U.logger.log("[buffer-controller]: Updating Media Source duration to "+w.toFixed(3)),R.duration=w)},d.updateSeekableRange=function(s){var l=this.mediaSource,p=s.fragments,R=p.length;if(R&&s.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var w=Math.max(0,p[0].start),x=Math.max(w,w+s.totalduration);l.setLiveSeekableRange(w,x)}},d.checkPendingTracks=function(){var s=this.bufferCodecEventsExpected,l=this.operationQueue,p=this.pendingTracks,R=Object.keys(p).length;if(R&&!s||R===2){this.createSourceBuffers(p),this.pendingTracks={};var w=this.getSourceBufferTypes();if(w.length===0){this.hls.trigger(F.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}w.forEach(function(x){l.executeNext(x)})}},d.createSourceBuffers=function(s){var l=this.sourceBuffer,p=this.mediaSource;if(!p)throw Error("createSourceBuffers called when mediaSource was null");var R=0;for(var w in s)if(!l[w]){var x=s[w];if(!x)throw Error("source buffer exists for track "+w+", however track does not");var O=x.levelCodec||x.codec,A=x.container+";codecs="+O;U.logger.log("[buffer-controller]: creating sourceBuffer("+A+")");try{var T=l[w]=p.addSourceBuffer(A),E=w;this.addBufferListener(E,"updatestart",this._onSBUpdateStart),this.addBufferListener(E,"updateend",this._onSBUpdateEnd),this.addBufferListener(E,"error",this._onSBUpdateError),this.tracks[w]={buffer:T,codec:O,container:x.container,levelCodec:x.levelCodec,id:x.id},R++}catch(y){U.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+y.message),this.hls.trigger(F.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:y,mimeType:A})}}R&&this.hls.trigger(F.Events.BUFFER_CREATED,{tracks:this.tracks})},d._onSBUpdateStart=function(s){var l=this.operationQueue,p=l.current(s);p.onStart()},d._onSBUpdateEnd=function(s){var l=this.operationQueue,p=l.current(s);p.onComplete(),l.shiftAndExecuteNext(s)},d._onSBUpdateError=function(s,l){U.logger.error("[buffer-controller]: "+s+" SourceBuffer error",l),this.hls.trigger(F.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var p=this.operationQueue.current(s);p&&p.onError(l)},d.removeExecutor=function(s,l,p){var R=this.media,w=this.mediaSource,x=this.operationQueue,O=this.sourceBuffer,A=O[s];if(!R||!w||!A){U.logger.warn("[buffer-controller]: Attempting to remove from the "+s+" SourceBuffer, but it does not exist"),x.shiftAndExecuteNext(s);return}var T=Object(Y.isFiniteNumber)(R.duration)?R.duration:Infinity,E=Object(Y.isFiniteNumber)(w.duration)?w.duration:Infinity,y=Math.max(0,l),h=Math.min(p,T,E);h>y?(U.logger.log("[buffer-controller]: Removing ["+y+","+h+"] from the "+s+" SourceBuffer"),console.assert(!A.updating,s+" sourceBuffer must not be updating"),A.remove(y,h)):x.shiftAndExecuteNext(s)},d.appendExecutor=function(s,l){var p=this.operationQueue,R=this.sourceBuffer,w=R[l];if(!w){U.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),p.shiftAndExecuteNext(l);return}w.ended=!1,console.assert(!w.updating,l+" sourceBuffer must not be updating"),w.appendBuffer(s)},d.blockBuffers=function(s,l){var p=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){U.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(s);return}var R=this.operationQueue,w=l.map(function(x){return R.appendBlocker(x)});Promise.all(w).then(function(){s(),l.forEach(function(x){var O=p.sourceBuffer[x];(!O||!O.updating)&&R.shiftAndExecuteNext(x)})})},d.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},d.addBufferListener=function(s,l,p){var R=this.sourceBuffer[s];if(!R)return;var w=p.bind(this,s);this.listeners[s].push({event:l,listener:w}),R.addEventListener(l,w)},d.removeBufferListeners=function(s){var l=this.sourceBuffer[s];if(!l)return;this.listeners[s].forEach(function(p){l.removeEventListener(p.event,p.listener)})},r}()},"./src/controller/buffer-operation-queue.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return F});var Y=D("./src/utils/logger.ts"),F=function(){function U(j){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=j}var W=U.prototype;return W.append=function(k,I){var m=this.queues[I];m.push(k),m.length===1&&this.buffers[I]&&this.executeNext(I)},W.insertAbort=function(k,I){var m=this.queues[I];m.unshift(k),this.executeNext(I)},W.appendBlocker=function(k){var I,m=new Promise(function(f){I=f}),c={execute:I,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(c,k),m},W.executeNext=function(k){var I=this.buffers,m=this.queues,c=I[k],f=m[k];if(f.length){var u=f[0];try{u.execute()}catch(r){Y.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),u.onError(r),(!c||!c.updating)&&(f.shift(),this.executeNext(k))}}},W.shiftAndExecuteNext=function(k){this.queues[k].shift(),this.executeNext(k)},W.current=function(k){return this.queues[k][0]},U}()},"./src/controller/cap-level-controller.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/events.ts");function F(j,k){for(var I=0;I<k.length;I++){var m=k[I];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(j,m.key,m)}}function U(j,k,I){return k&&F(j.prototype,k),I&&F(j,I),j}var W=function(){function j(I){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=I,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var k=j.prototype;return k.setStreamController=function(m){this.streamController=m},k.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},k.registerListeners=function(){var m=this.hls;m.on(Y.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),m.on(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),m.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),m.on(Y.Events.BUFFER_CODECS,this.onBufferCodecs,this),m.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.unregisterListener=function(){var m=this.hls;m.off(Y.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),m.off(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),m.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),m.off(Y.Events.BUFFER_CODECS,this.onBufferCodecs,this),m.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.onFpsDropLevelCapping=function(m,c){j.isLevelAllowed(c.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(c.droppedLevel)},k.onMediaAttaching=function(m,c){this.media=c.media instanceof HTMLVideoElement?c.media:null},k.onManifestParsed=function(m,c){var f=this.hls;this.restrictedLevels=[],this.firstLevel=c.firstLevel,f.config.capLevelToPlayerSize&&c.video&&this.startCapping()},k.onBufferCodecs=function(m,c){var f=this.hls;f.config.capLevelToPlayerSize&&c.video&&this.startCapping()},k.onMediaDetaching=function(){this.stopCapping()},k.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var m=this.hls.levels;if(m.length){var c=this.hls;c.autoLevelCapping=this.getMaxLevel(m.length-1),c.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=c.autoLevelCapping}}},k.getMaxLevel=function(m){var c=this,f=this.hls.levels;if(!f.length)return-1;var u=f.filter(function(r,d){return j.isLevelAllowed(d,c.restrictedLevels)&&d<=m});return this.clientRect=null,j.getMaxLevelByMediaSize(u,this.mediaWidth,this.mediaHeight)},k.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()},k.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},k.getDimensions=function(){if(this.clientRect)return this.clientRect;var m=this.media,c={width:0,height:0};if(m){var f=m.getBoundingClientRect();c.width=f.width,c.height=f.height,!c.width&&!c.height&&(c.width=f.right-f.left||m.width||0,c.height=f.bottom-f.top||m.height||0)}return this.clientRect=c,c},j.isLevelAllowed=function(m,c){return c===void 0&&(c=[]),c.indexOf(m)===-1},j.getMaxLevelByMediaSize=function(m,c,f){if(!m||!m.length)return-1;for(var u=function(l,p){return p?l.width!==p.width||l.height!==p.height:!0},r=m.length-1,d=0;d<m.length;d+=1){var o=m[d];if((o.width>=c||o.height>=f)&&u(o,m[d+1])){r=d;break}}return r},U(j,[{key:"mediaWidth",get:function(){return this.getDimensions().width*j.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*j.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var m=1;try{m=self.devicePixelRatio}catch(c){}return m}}]),j}();J.default=W},"./src/controller/cmcd-controller.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return u});var Y=D("./src/events.ts"),F=D("./src/types/cmcd.ts"),U=D("./src/utils/buffer-helper.ts"),W=D("./src/utils/logger.ts");function j(r,d){for(var o=0;o<d.length;o++){var s=d[o];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(r,s.key,s)}}function k(r,d,o){return d&&j(r.prototype,d),o&&j(r,o),r}function I(r,d){var o=typeof Symbol!="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(o)return(o=o.call(r)).next.bind(o);if(Array.isArray(r)||(o=m(r))||d&&r&&typeof r.length=="number"){o&&(r=o);var s=0;return function(){return s>=r.length?{done:!0}:{done:!1,value:r[s++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function m(r,d){if(!r)return;if(typeof r=="string")return c(r,d);var o=Object.prototype.toString.call(r).slice(8,-1);if(o==="Object"&&r.constructor&&(o=r.constructor.name),o==="Map"||o==="Set")return Array.from(r);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return c(r,d)}function c(r,d){(d==null||d>r.length)&&(d=r.length);for(var o=0,s=new Array(d);o<d;o++)s[o]=r[o];return s}function f(){return f=Object.assign||function(r){for(var d=1;d<arguments.length;d++){var o=arguments[d];for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(r[s]=o[s])}return r},f.apply(this,arguments)}var u=function(){function r(o){var s=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(){s.initialized&&(s.starved=!0),s.buffering=!0},this.onPlaying=function(){s.initialized||(s.initialized=!0),s.buffering=!1},this.applyPlaylistData=function(R){try{s.apply(R,{ot:F.CMCDObjectType.MANIFEST,su:!s.initialized})}catch(w){W.logger.warn("Could not generate manifest CMCD data.",w)}},this.applyFragmentData=function(R){try{var w=R.frag,x=s.hls.levels[w.level],O=s.getObjectType(w),A={d:w.duration*1e3,ot:O};(O===F.CMCDObjectType.VIDEO||O===F.CMCDObjectType.AUDIO||O==F.CMCDObjectType.MUXED)&&(A.br=x.bitrate/1e3,A.tb=s.getTopBandwidth(O),A.bl=s.getBufferLength(O)),s.apply(R,A)}catch(T){W.logger.warn("Could not generate segment CMCD data.",T)}},this.hls=o;var l=this.config=o.config,p=l.cmcd;p!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=p.sessionId||r.uuid(),this.cid=p.contentId,this.useHeaders=p.useHeaders===!0,this.registerListeners())}var d=r.prototype;return d.registerListeners=function(){var s=this.hls;s.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),s.on(Y.Events.BUFFER_CREATED,this.onBufferCreated,this)},d.unregisterListeners=function(){var s=this.hls;s.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),s.off(Y.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},d.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},d.onMediaAttached=function(s,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},d.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},d.onBufferCreated=function(s,l){var p,R;this.audioBuffer=(p=l.tracks.audio)===null||p===void 0?void 0:p.buffer,this.videoBuffer=(R=l.tracks.video)===null||R===void 0?void 0:R.buffer},d.createData=function(){var s;return{v:F.CMCDVersion,sf:F.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(s=this.media)===null||s===void 0?void 0:s.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},d.apply=function(s,l){l===void 0&&(l={}),f(l,this.createData());var p=l.ot===F.CMCDObjectType.INIT||l.ot===F.CMCDObjectType.VIDEO||l.ot===F.CMCDObjectType.MUXED;if(this.starved&&p&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var R=r.toHeaders(l);if(!Object.keys(R).length)return;s.headers||(s.headers={}),f(s.headers,R)}else{var w=r.toQuery(l);if(!w)return;s.url=r.appendQueryToUri(s.url,w)}},d.getObjectType=function(s){var l=s.type;return l==="subtitle"?F.CMCDObjectType.TIMED_TEXT:s.sn==="initSegment"?F.CMCDObjectType.INIT:l==="audio"?F.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?F.CMCDObjectType.VIDEO:F.CMCDObjectType.MUXED:void 0},d.getTopBandwidth=function(s){for(var l=0,p=s===F.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,R=I(p),w;!(w=R()).done;){var x=w.value;x.bitrate>l&&(l=x.bitrate)}return l>0?l:NaN},d.getBufferLength=function(s){var l=this.hls.media,p=s===F.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!p||!l)return NaN;var R=U.BufferHelper.bufferInfo(p,l.currentTime,this.config.maxBufferHole);return R.len*1e3},d.createPlaylistLoader=function(){var s=this.config.pLoader,l=this.applyPlaylistData,p=s||this.config.loader;return function(){function R(x){this.loader=void 0,this.loader=new p(x)}var w=R.prototype;return w.destroy=function(){this.loader.destroy()},w.abort=function(){this.loader.abort()},w.load=function(O,A,T){l(O),this.loader.load(O,A,T)},k(R,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),R}()},d.createFragmentLoader=function(){var s=this.config.fLoader,l=this.applyFragmentData,p=s||this.config.loader;return function(){function R(x){this.loader=void 0,this.loader=new p(x)}var w=R.prototype;return w.destroy=function(){this.loader.destroy()},w.abort=function(){this.loader.abort()},w.load=function(O,A,T){l(O),this.loader.load(O,A,T)},k(R,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),R}()},r.uuid=function(){var s=URL.createObjectURL(new Blob),l=s.toString();return URL.revokeObjectURL(s),l.substr(l.lastIndexOf("/")+1)},r.serialize=function(s){for(var l=[],p=function(P){return!Number.isNaN(P)&&P!=null&&P!==""&&P!==!1},R=function(P){return Math.round(P)},w=function(P){return R(P/100)*100},x=function(P){return encodeURIComponent(P)},O={br:R,d:R,bl:w,dl:w,mtp:w,nor:x,rtp:w,tb:R},A=Object.keys(s||{}).sort(),T=I(A),E;!(E=T()).done;){var y=E.value,h=s[y];if(!p(h))continue;if(y==="v"&&h===1)continue;if(y=="pr"&&h===1)continue;var _=O[y];_&&(h=_(h));var g=typeof h,b=void 0;y==="ot"||y==="sf"||y==="st"?b=y+"="+h:g==="boolean"?b=y:g==="number"?b=y+"="+h:b=y+"="+JSON.stringify(h),l.push(b)}return l.join(",")},r.toHeaders=function(s){for(var l=Object.keys(s),p={},R=["Object","Request","Session","Status"],w=[{},{},{},{}],x={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},O=0,A=l;O<A.length;O++){var T=A[O],E=x[T]!=null?x[T]:1;w[E][T]=s[T]}for(var y=0;y<w.length;y++){var h=r.serialize(w[y]);h&&(p["CMCD-"+R[y]]=h)}return p},r.toQuery=function(s){return"CMCD="+encodeURIComponent(r.serialize(s))},r.appendQueryToUri=function(s,l){if(!l)return s;var p=s.includes("?")?"&":"?";return""+s+p+l},r}()},"./src/controller/eme-controller.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/events.ts"),F=D("./src/errors.ts"),U=D("./src/utils/logger.ts"),W=D("./src/utils/mediakeys-helper.ts");function j(u,r){for(var d=0;d<r.length;d++){var o=r[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(u,o.key,o)}}function k(u,r,d){return r&&j(u.prototype,r),d&&j(u,d),u}var I=3,m=function(r,d,o){var s={audioCapabilities:[],videoCapabilities:[]};return r.forEach(function(l){s.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:o.audioRobustness||""})}),d.forEach(function(l){s.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:o.videoRobustness||""})}),[s]},c=function(r,d,o,s){switch(r){case W.KeySystems.WIDEVINE:return m(d,o,s);default:throw new Error("Unknown key-system: "+r)}},f=function(){function u(d){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=d,this._config=d.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 r=u.prototype;return r.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},r._registerListeners=function(){this.hls.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this)},r._unregisterListeners=function(){this.hls.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this)},r.getLicenseServerUrl=function(o){switch(o){case W.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+o+'"')},r._attemptKeySystemAccess=function(o,s,l){var p=this,R=c(o,s,l,this._drmSystemOptions);U.logger.log("Requesting encrypted media key-system access");var w=this.requestMediaKeySystemAccess(o,R);this.mediaKeysPromise=w.then(function(x){return p._onMediaKeySystemAccessObtained(o,x)}),w.catch(function(x){U.logger.error('Failed to obtain key-system "'+o+'" access:',x)})},r._onMediaKeySystemAccessObtained=function(o,s){var l=this;U.logger.log('Access for key-system "'+o+'" obtained');var p={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:s,mediaKeySystemDomain:o};this._mediaKeysList.push(p);var R=Promise.resolve().then(function(){return s.createMediaKeys()}).then(function(w){return p.mediaKeys=w,U.logger.log('Media-keys created for key-system "'+o+'"'),l._onMediaKeysCreated(),w});return R.catch(function(w){U.logger.error("Failed to create media-keys:",w)}),R},r._onMediaKeysCreated=function(){var o=this;this._mediaKeysList.forEach(function(s){s.mediaKeysSession||(s.mediaKeysSession=s.mediaKeys.createSession(),o._onNewMediaKeySession(s.mediaKeysSession))})},r._onNewMediaKeySession=function(o){var s=this;U.logger.log("New key-system session "+o.sessionId),o.addEventListener("message",function(l){s._onKeySessionMessage(o,l.message)},!1)},r._onKeySessionMessage=function(o,s){U.logger.log("Got EME message event, creating license request"),this._requestLicense(s,function(l){U.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),o.update(l)})},r.onMediaEncrypted=function(o){var s=this;if(U.logger.log('Media is encrypted using "'+o.initDataType+'" init data type'),!this.mediaKeysPromise){U.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(R){if(!s._media)return;s._attemptSetMediaKeys(R),s._generateRequestWithPreferredKeySession(o.initDataType,o.initData)};this.mediaKeysPromise.then(l).catch(l)},r._attemptSetMediaKeys=function(o){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var s=this._mediaKeysList[0];if(!s||!s.mediaKeys){U.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}U.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(s.mediaKeys),this._hasSetMediaKeys=!0}},r._generateRequestWithPreferredKeySession=function(o,s){var l=this,p=this._mediaKeysList[0];if(!p){U.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(p.mediaKeysSessionInitialized){U.logger.warn("Key-Session already initialized but requested again");return}var R=p.mediaKeysSession;if(!R){U.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!s){U.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}U.logger.log('Generating key-session request for "'+o+'" init data type'),p.mediaKeysSessionInitialized=!0,R.generateRequest(o,s).then(function(){U.logger.debug("Key-session generation succeeded")}).catch(function(w){U.logger.error("Error generating key-session request:",w),l.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},r._createLicenseXhr=function(o,s,l){var p=new XMLHttpRequest;p.responseType="arraybuffer",p.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,p,o,s,l);var R=this._licenseXhrSetup;if(R)try{R.call(this.hls,p,o),R=void 0}catch(w){U.logger.error(w)}try{p.readyState||p.open("POST",o,!0),R&&R.call(this.hls,p,o)}catch(w){throw new Error("issue setting up KeySystem license XHR "+w)}return p},r._onLicenseRequestReadyStageChange=function(o,s,l,p){switch(o.readyState){case 4:if(o.status===200){this._requestLicenseFailureCount=0,U.logger.log("License request succeeded");var R=o.response,w=this._licenseResponseCallback;if(w)try{R=w.call(this.hls,o,s)}catch(O){U.logger.error(O)}p(R)}else{if(U.logger.error("License Request XHR failed ("+s+"). Status: "+o.status+" ("+o.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>I){this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var x=I-this._requestLicenseFailureCount+1;U.logger.warn("Retrying license request, "+x+" attempts left"),this._requestLicense(l,p)}break}},r._generateLicenseRequestChallenge=function(o,s){switch(o.mediaKeySystemDomain){case W.KeySystems.WIDEVINE:return s}throw new Error("unsupported key-system: "+o.mediaKeySystemDomain)},r._requestLicense=function(o,s){U.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){U.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var p=this.getLicenseServerUrl(l.mediaKeySystemDomain),R=this._createLicenseXhr(p,o,s);U.logger.log("Sending license request to URL: "+p);var w=this._generateLicenseRequestChallenge(l,o);R.send(w)}catch(x){U.logger.error("Failure requesting DRM license: "+x),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},r.onMediaAttached=function(o,s){if(!this._emeEnabled)return;var l=s.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},r.onMediaDetached=function(){var o=this._media,s=this._mediaKeysList;if(!o)return;o.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(s.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return o.setMediaKeys(null)}).catch(function(){})},r.onManifestParsed=function(o,s){if(!this._emeEnabled)return;var l=s.levels.map(function(R){return R.audioCodec}).filter(function(R){return!!R}),p=s.levels.map(function(R){return R.videoCodec}).filter(function(R){return!!R});this._attemptKeySystemAccess(W.KeySystems.WIDEVINE,l,p)},k(u,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),u}();J.default=f},"./src/controller/fps-controller.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/events.ts"),F=D("./src/utils/logger.ts"),U=function(){function W(k){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=k,this.registerListeners()}var j=W.prototype;return j.setStreamController=function(I){this.streamController=I},j.registerListeners=function(){this.hls.on(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},j.unregisterListeners=function(){this.hls.off(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching)},j.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},j.onMediaAttaching=function(I,m){var c=this.hls.config;if(c.capLevelOnFPSDrop){var f=m.media instanceof self.HTMLVideoElement?m.media:null;this.media=f,f&&typeof f.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),c.fpsDroppedMonitoringPeriod)}},j.checkFPS=function(I,m,c){var f=performance.now();if(m){if(this.lastTime){var u=f-this.lastTime,r=c-this.lastDroppedFrames,d=m-this.lastDecodedFrames,o=1e3*r/u,s=this.hls;if(s.trigger(Y.Events.FPS_DROP,{currentDropped:r,currentDecoded:d,totalDroppedFrames:c}),o>0&&r>s.config.fpsDroppedMonitoringThreshold*d){var l=s.currentLevel;F.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(s.autoLevelCapping===-1||s.autoLevelCapping>=l)&&(l=l-1,s.trigger(Y.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:s.currentLevel}),s.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=f,this.lastDroppedFrames=c,this.lastDecodedFrames=m}},j.checkFPSInterval=function(){var I=this.media;if(I)if(this.isVideoPlaybackQualityAvailable){var m=I.getVideoPlaybackQuality();this.checkFPS(I,m.totalVideoFrames,m.droppedVideoFrames)}else this.checkFPS(I,I.webkitDecodedFrameCount,I.webkitDroppedFrameCount)},W}();J.default=U},"./src/controller/fragment-finders.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"findFragmentByPDT",function(){return U}),D.d(J,"findFragmentByPTS",function(){return W}),D.d(J,"fragmentWithinToleranceTest",function(){return j}),D.d(J,"pdtWithinToleranceTest",function(){return k}),D.d(J,"findFragWithCC",function(){return I});var Y=D("./src/polyfills/number.ts"),F=D("./src/utils/binary-search.ts");function U(m,c,f){if(c===null||!Array.isArray(m)||!m.length||!Object(Y.isFiniteNumber)(c))return null;var u=m[0].programDateTime;if(c<(u||0))return null;var r=m[m.length-1].endProgramDateTime;if(c>=(r||0))return null;f=f||0;for(var d=0;d<m.length;++d){var o=m[d];if(k(c,f,o))return o}return null}function W(m,c,f,u){f===void 0&&(f=0),u===void 0&&(u=0);var r=null;if(m?r=c[m.sn-c[0].sn+1]||null:f===0&&c[0].start===0&&(r=c[0]),r&&j(f,u,r)===0)return r;var d=F.default.search(c,j.bind(null,f,u));return d||r}function j(m,c,f){m===void 0&&(m=0),c===void 0&&(c=0);var u=Math.min(c,f.duration+(f.deltaPTS?f.deltaPTS:0));return f.start+f.duration-u<=m?1:f.start-u>m&&f.start?-1:0}function k(m,c,f){var u=Math.min(c,f.duration+(f.deltaPTS?f.deltaPTS:0))*1e3,r=f.endProgramDateTime||0;return r-u>m}function I(m,c){return F.default.search(m,function(f){return f.cc<c?1:f.cc>c?-1:0})}},"./src/controller/fragment-tracker.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"FragmentState",function(){return U}),D.d(J,"FragmentTracker",function(){return W});var Y=D("./src/events.ts"),F=D("./src/types/loader.ts"),U;(function(I){I.NOT_LOADED="NOT_LOADED",I.BACKTRACKED="BACKTRACKED",I.APPENDING="APPENDING",I.PARTIAL="PARTIAL",I.OK="OK"})(U||(U={}));var W=function(){function I(c){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=c,this._registerListeners()}var m=I.prototype;return m._registerListeners=function(){var f=this.hls;f.on(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),f.on(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.on(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},m._unregisterListeners=function(){var f=this.hls;f.off(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),f.off(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.off(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},m.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},m.getAppendedFrag=function(f,u){if(u===F.PlaylistLevelType.MAIN){var r=this.activeFragment,d=this.activeParts;if(!r)return null;if(d)for(var o=d.length;o--;){var s=d[o],l=s?s.end:r.appendedPTS;if(s.start<=f&&l!==void 0&&f<=l)return o>9&&(this.activeParts=d.slice(o-9)),s}else if(r.start<=f&&r.appendedPTS!==void 0&&f<=r.appendedPTS)return r}return this.getBufferedFrag(f,u)},m.getBufferedFrag=function(f,u){for(var r=this.fragments,d=Object.keys(r),o=d.length;o--;){var s=r[d[o]];if((s==null?void 0:s.body.type)===u&&s.buffered){var l=s.body;if(l.start<=f&&f<=l.end)return l}}return null},m.detectEvictedFragments=function(f,u,r){var d=this;Object.keys(this.fragments).forEach(function(o){var s=d.fragments[o];if(!s)return;if(!s.buffered){s.body.type===r&&d.removeFragment(s.body);return}var l=s.range[f];if(!l)return;l.time.some(function(p){var R=!d.isTimeBuffered(p.startPTS,p.endPTS,u);return R&&d.removeFragment(s.body),R})})},m.detectPartialFragments=function(f){var u=this,r=this.timeRanges,d=f.frag,o=f.part;if(!r||d.sn==="initSegment")return;var s=k(d),l=this.fragments[s];if(!l)return;Object.keys(r).forEach(function(p){var R=d.elementaryStreams[p];if(!R)return;var w=r[p],x=o!==null||R.partial===!0;l.range[p]=u.getBufferedTimes(d,o,x,w)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},m.fragBuffered=function(f){var u=k(f),r=this.fragments[u];r&&(r.backtrack=r.loaded=null,r.buffered=!0)},m.getBufferedTimes=function(f,u,r,d){for(var o={time:[],partial:r},s=u?u.start:f.start,l=u?u.end:f.end,p=f.minEndPTS||l,R=f.maxStartPTS||s,w=0;w<d.length;w++){var x=d.start(w)-this.bufferPadding,O=d.end(w)+this.bufferPadding;if(R>=x&&p<=O){o.time.push({startPTS:Math.max(s,d.start(w)),endPTS:Math.min(l,d.end(w))});break}else if(s<O&&l>x)o.partial=!0,o.time.push({startPTS:Math.max(s,d.start(w)),endPTS:Math.min(l,d.end(w))});else if(l<=x)break}return o},m.getPartialFragment=function(f){var u=null,r,d,o,s=0,l=this.bufferPadding,p=this.fragments;return Object.keys(p).forEach(function(R){var w=p[R];if(!w)return;j(w)&&(d=w.body.start-l,o=w.body.end+l,f>=d&&f<=o&&(r=Math.min(f-d,o-f),s<=r&&(u=w.body,s=r)))}),u},m.getState=function(f){var u=k(f),r=this.fragments[u];return r?r.buffered?j(r)?U.PARTIAL:U.OK:r.backtrack?U.BACKTRACKED:U.APPENDING:U.NOT_LOADED},m.backtrack=function(f,u){var r=k(f),d=this.fragments[r];if(!d||d.backtrack)return null;var o=d.backtrack=u||d.loaded;return d.loaded=null,o},m.getBacktrackData=function(f){var u=k(f),r=this.fragments[u];if(r){var d,o=r.backtrack;if(o!=null&&(d=o.payload)!==null&&d!==void 0&&d.byteLength)return o;this.removeFragment(f)}return null},m.isTimeBuffered=function(f,u,r){for(var d,o,s=0;s<r.length;s++){if(d=r.start(s)-this.bufferPadding,o=r.end(s)+this.bufferPadding,f>=d&&u<=o)return!0;if(u<=d)return!1}return!1},m.onFragLoaded=function(f,u){var r=u.frag,d=u.part;if(r.sn==="initSegment"||r.bitrateTest||d)return;var o=k(r);this.fragments[o]={body:r,loaded:u,backtrack:null,buffered:!1,range:Object.create(null)}},m.onBufferAppended=function(f,u){var r=this,d=u.frag,o=u.part,s=u.timeRanges;if(d.type===F.PlaylistLevelType.MAIN)if(this.activeFragment=d,o){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(o)}else this.activeParts=null;this.timeRanges=s,Object.keys(s).forEach(function(p){var R=s[p];if(r.detectEvictedFragments(p,R),!o)for(var w=0;w<R.length;w++)d.appendedPTS=Math.max(R.end(w),d.appendedPTS||0)})},m.onFragBuffered=function(f,u){this.detectPartialFragments(u)},m.hasFragment=function(f){var u=k(f);return!!this.fragments[u]},m.removeFragmentsInRange=function(f,u,r){var d=this;Object.keys(this.fragments).forEach(function(o){var s=d.fragments[o];if(!s)return;if(s.buffered){var l=s.body;l.type===r&&l.start<u&&l.end>f&&d.removeFragment(l)}})},m.removeFragment=function(f){var u=k(f);f.stats.loaded=0,f.clearElementaryStreamInfo(),delete this.fragments[u]},m.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},I}();function j(I){var m,c;return I.buffered&&(((m=I.range.video)===null||m===void 0?void 0:m.partial)||((c=I.range.audio)===null||c===void 0?void 0:c.partial))}function k(I){return I.type+"_"+I.level+"_"+I.urlId+"_"+I.sn}},"./src/controller/gap-controller.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"STALL_MINIMUM_DURATION_MS",function(){return j}),D.d(J,"MAX_START_GAP_JUMP",function(){return k}),D.d(J,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return I}),D.d(J,"SKIP_BUFFER_RANGE_START",function(){return m}),D.d(J,"default",function(){return c});var Y=D("./src/utils/buffer-helper.ts"),F=D("./src/errors.ts"),U=D("./src/events.ts"),W=D("./src/utils/logger.ts"),j=250,k=2,I=.1,m=.05,c=function(){function f(r,d,o,s){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=r,this.media=d,this.fragmentTracker=o,this.hls=s}var u=f.prototype;return u.destroy=function(){this.hls=this.fragmentTracker=this.media=null},u.poll=function(d){var o=this.config,s=this.media,l=this.stalled,p=s.currentTime,R=s.seeking,w=this.seeking&&!R,x=!this.seeking&&R;if(this.seeking=R,p!==d){if(this.moved=!0,l!==null){if(this.stallReported){var O=self.performance.now()-l;W.logger.warn("playback not stuck anymore @"+p+", after "+Math.round(O)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((x||w)&&(this.stalled=null),s.paused||s.ended||s.playbackRate===0||!Y.BufferHelper.getBuffered(s).length)return;var A=Y.BufferHelper.bufferInfo(s,p,0),T=A.len>0,E=A.nextStart||0;if(!T&&!E)return;if(R){var y=A.len>k,h=!E||E-p>k&&!this.fragmentTracker.getPartialFragment(p);if(y||h)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var _,g=Math.max(E,A.start||0)-p,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,M=b==null||((_=b.details)===null||_===void 0)?void 0:_.live,P=M?b.details.targetduration*2:k;if(g>0&&g<=P){this._trySkipBufferHole(null);return}}var K=self.performance.now();if(l===null){this.stalled=K;return}var V=K-l;!R&&V>=j&&this._reportStall(A.len);var B=Y.BufferHelper.bufferInfo(s,p,o.maxBufferHole);this._tryFixBufferStall(B,V)},u._tryFixBufferStall=function(d,o){var s=this.config,l=this.fragmentTracker,p=this.media,R=p.currentTime,w=l.getPartialFragment(R);if(w){var x=this._trySkipBufferHole(w);if(x)return}d.len>s.maxBufferHole&&o>s.highBufferWatchdogPeriod*1e3&&(W.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},u._reportStall=function(d){var o=this.hls,s=this.media,l=this.stallReported;l||(this.stallReported=!0,W.logger.warn("Playback stalling at @"+s.currentTime+" due to low buffer (buffer="+d+")"),o.trigger(U.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:d}))},u._trySkipBufferHole=function(d){for(var o=this.config,s=this.hls,l=this.media,p=l.currentTime,R=0,w=Y.BufferHelper.getBuffered(l),x=0;x<w.length;x++){var O=w.start(x);if(p+o.maxBufferHole>=R&&p<O){var A=Math.max(O+m,l.currentTime+I);return W.logger.warn("skipping hole, adjusting currentTime from "+p+" to "+A),this.moved=!0,this.stalled=null,l.currentTime=A,d&&s.trigger(U.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+p+" to "+A,frag:d}),A}R=w.end(x)}return 0},u._tryNudgeBuffer=function(){var d=this.config,o=this.hls,s=this.media,l=s.currentTime,p=(this.nudgeRetry||0)+1;if(this.nudgeRetry=p,p<d.nudgeMaxRetry){var R=l+p*d.nudgeOffset;W.logger.warn("Nudging 'currentTime' from "+l+" to "+R),s.currentTime=R,o.trigger(U.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else W.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+d.nudgeMaxRetry+" nudges"),o.trigger(U.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},f}()},"./src/controller/id3-track-controller.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/events.ts"),F=D("./src/utils/texttrack-utils.ts"),U=D("./src/demux/id3.ts"),W=.25,j=function(){function k(m){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=m,this._registerListeners()}var I=k.prototype;return I.destroy=function(){this._unregisterListeners()},I._registerListeners=function(){var c=this.hls;c.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(Y.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),c.on(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},I._unregisterListeners=function(){var c=this.hls;c.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(Y.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),c.off(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},I.onMediaAttached=function(c,f){this.media=f.media},I.onMediaDetaching=function(){if(!this.id3Track)return;Object(F.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},I.getID3Track=function(c){if(!this.media)return;for(var f=0;f<c.length;f++){var u=c[f];if(u.kind==="metadata"&&u.label==="id3")return Object(F.sendAddTrackEvent)(u,this.media),u}return this.media.addTextTrack("metadata","id3")},I.onFragParsingMetadata=function(c,f){if(!this.media)return;var u=f.frag,r=f.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var d=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,o=0;o<r.length;o++){var s=U.getID3Frames(r[o].data);if(s){var l=r[o].pts,p=o<r.length-1?r[o+1].pts:u.end,R=p-l;R<=0&&(p=l+W);for(var w=0;w<s.length;w++){var x=s[w];if(!U.isTimeStampFrame(x)){var O=new d(l,p,"");O.value=x,this.id3Track.addCue(O)}}}}},I.onBufferFlushing=function(c,f){var u=f.startOffset,r=f.endOffset,d=f.type;if(!d||d==="audio"){var o=this.id3Track;o&&Object(F.removeCuesInRange)(o,u,r)}},k}();J.default=j},"./src/controller/latency-controller.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return k});var Y=D("./src/errors.ts"),F=D("./src/events.ts"),U=D("./src/utils/logger.ts");function W(I,m){for(var c=0;c<m.length;c++){var f=m[c];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(I,f.key,f)}}function j(I,m,c){return m&&W(I.prototype,m),c&&W(I,c),I}var k=function(){function I(c){var f=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 f.timeupdate()},this.hls=c,this.config=c.config,this.registerListeners()}var m=I.prototype;return m.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},m.registerListeners=function(){this.hls.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(F.Events.ERROR,this.onError,this)},m.unregisterListeners=function(){this.hls.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(F.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(F.Events.ERROR,this.onError)},m.onMediaAttached=function(f,u){this.media=u.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},m.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},m.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},m.onLevelUpdated=function(f,u){var r=u.details;this.levelDetails=r,r.advanced&&this.timeupdate(),!r.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},m.onError=function(f,u){if(u.details!==Y.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,U.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},m.timeupdate=function(){var f=this.media,u=this.levelDetails;if(!f||!u)return;this.currentTime=f.currentTime;var r=this.computeLatency();if(r===null)return;this._latency=r;var d=this.config,o=d.lowLatencyMode,s=d.maxLiveSyncPlaybackRate;if(!o||s===1)return;var l=this.targetLatency;if(l===null)return;var p=r-l,R=Math.min(this.maxLatency,l+u.targetduration),w=p<R;if(u.live&&w&&p>.05&&this.forwardBufferLength>1){var x=Math.min(2,Math.max(1,s)),O=Math.round(2/(1+Math.exp(-.75*p-this.edgeStalled))*20)/20;f.playbackRate=Math.min(x,Math.max(1,O))}else f.playbackRate!==1&&f.playbackRate!==0&&(f.playbackRate=1)},m.estimateLiveEdge=function(){var f=this.levelDetails;return f===null?null:f.edge+f.age},m.computeLatency=function(){var f=this.estimateLiveEdge();return f===null?null:f-this.currentTime},j(I,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var f=this.config,u=this.levelDetails;return f.liveMaxLatencyDuration!==void 0?f.liveMaxLatencyDuration:u?f.liveMaxLatencyDurationCount*u.targetduration:0}},{key:"targetLatency",get:function(){var f=this.levelDetails;if(f===null)return null;var u=f.holdBack,r=f.partHoldBack,d=f.targetduration,o=this.config,s=o.liveSyncDuration,l=o.liveSyncDurationCount,p=o.lowLatencyMode,R=this.hls.userConfig,w=p&&r||u;(R.liveSyncDuration||R.liveSyncDurationCount||w===0)&&(w=s!==void 0?s:l*d);var x=d,O=1;return w+Math.min(this.stallCount*O,x)}},{key:"liveSyncPosition",get:function(){var f=this.estimateLiveEdge(),u=this.targetLatency,r=this.levelDetails;if(f===null||u===null||r===null)return null;var d=r.edge,o=f-u-this.edgeStalled,s=d-r.totalduration,l=d-(this.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(s,o),l)}},{key:"drift",get:function(){var f=this.levelDetails;return f===null?1:f.drift}},{key:"edgeStalled",get:function(){var f=this.levelDetails;if(f===null)return 0;var u=(this.config.lowLatencyMode&&f.partTarget||f.targetduration)*3;return Math.max(f.age-u,0)}},{key:"forwardBufferLength",get:function(){var f=this.media,u=this.levelDetails;if(!f||!u)return 0;var r=f.buffered.length;return r?f.buffered.end(r-1):u.edge-this.currentTime}}]),I}()},"./src/controller/level-controller.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return o});var Y=D("./src/types/level.ts"),F=D("./src/events.ts"),U=D("./src/errors.ts"),W=D("./src/utils/codecs.ts"),j=D("./src/controller/level-helper.ts"),k=D("./src/controller/base-playlist-controller.ts"),I=D("./src/types/loader.ts");function m(){return m=Object.assign||function(s){for(var l=1;l<arguments.length;l++){var p=arguments[l];for(var R in p)Object.prototype.hasOwnProperty.call(p,R)&&(s[R]=p[R])}return s},m.apply(this,arguments)}function c(s,l){for(var p=0;p<l.length;p++){var R=l[p];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(s,R.key,R)}}function f(s,l,p){return l&&c(s.prototype,l),p&&c(s,p),s}function u(s,l){s.prototype=Object.create(l.prototype),s.prototype.constructor=s,r(s,l)}function r(s,l){return r=Object.setPrototypeOf||function(R,w){return R.__proto__=w,R},r(s,l)}var d=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),o=function(s){u(l,s);function l(R){var w;return w=s.call(this,R,"[level-controller]")||this,w._levels=[],w._firstLevel=-1,w._startLevel=void 0,w.currentLevelIndex=-1,w.manualLevelIndex=-1,w.onParsedComplete=void 0,w._registerListeners(),w}var p=l.prototype;return p._registerListeners=function(){var w=this.hls;w.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),w.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.on(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),w.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),w.on(F.Events.ERROR,this.onError,this)},p._unregisterListeners=function(){var w=this.hls;w.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),w.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.off(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),w.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),w.off(F.Events.ERROR,this.onError,this)},p.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,s.prototype.destroy.call(this)},p.startLoad=function(){var w=this._levels;w.forEach(function(x){x.loadError=0}),s.prototype.startLoad.call(this)},p.onManifestLoaded=function(w,x){var O=[],A=[],T=[],E,y={},h,_=!1,g=!1,b=!1;if(x.levels.forEach(function(V){var B=V.attrs;_=_||!!(V.width&&V.height),g=g||!!V.videoCodec,b=b||!!V.audioCodec,d&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var C=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;h=y[C],h?h.url.push(V.url):(h=new Y.Level(V),y[C]=h,O.push(h)),B&&(B.AUDIO&&Object(j.addGroupId)(h,"audio",B.AUDIO),B.SUBTITLES&&Object(j.addGroupId)(h,"text",B.SUBTITLES))}),(_||g)&&b&&(O=O.filter(function(V){var B=V.videoCodec,C=V.width,$=V.height;return!!B||!!(C&&$)})),O=O.filter(function(V){var B=V.audioCodec,C=V.videoCodec;return(!B||Object(W.isCodecSupportedInMp4)(B,"audio"))&&(!C||Object(W.isCodecSupportedInMp4)(C,"video"))}),x.audioTracks&&(A=x.audioTracks.filter(function(V){return!V.audioCodec||Object(W.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(j.assignTrackIdsByGroup)(A)),x.subtitles&&(T=x.subtitles,Object(j.assignTrackIdsByGroup)(T)),O.length>0){E=O[0].bitrate,O.sort(function(V,B){return V.bitrate-B.bitrate}),this._levels=O;for(var M=0;M<O.length;M++)if(O[M].bitrate===E){this._firstLevel=M,this.log("manifest loaded, "+O.length+" level(s) found, first bitrate: "+E);break}var P=b&&!g,K={levels:O,audioTracks:A,subtitleTracks:T,firstLevel:this._firstLevel,stats:x.stats,audio:b,video:g,altAudio:!P&&A.some(function(V){return!!V.url})};this.hls.trigger(F.Events.MANIFEST_PARSED,K),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(F.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:x.url,reason:"no level with compatible codecs found in manifest"})},p.onError=function(w,x){if(s.prototype.onError.call(this,w,x),x.fatal)return;var O=x.context,A=this._levels[this.currentLevelIndex];if(O&&(O.type===I.PlaylistContextType.AUDIO_TRACK&&A.audioGroupIds&&O.groupId===A.audioGroupIds[A.urlId]||O.type===I.PlaylistContextType.SUBTITLE_TRACK&&A.textGroupIds&&O.groupId===A.textGroupIds[A.urlId])){this.redundantFailover(this.currentLevelIndex);return}var T=!1,E=!0,y;switch(x.details){case U.ErrorDetails.FRAG_LOAD_ERROR:case U.ErrorDetails.FRAG_LOAD_TIMEOUT:case U.ErrorDetails.KEY_LOAD_ERROR:case U.ErrorDetails.KEY_LOAD_TIMEOUT:if(x.frag){var h=this._levels[x.frag.level];h?(h.fragmentError++,h.fragmentError>this.hls.config.fragLoadingMaxRetry&&(y=x.frag.level)):y=x.frag.level}break;case U.ErrorDetails.LEVEL_LOAD_ERROR:case U.ErrorDetails.LEVEL_LOAD_TIMEOUT:O&&(O.deliveryDirectives&&(E=!1),y=O.level),T=!0;break;case U.ErrorDetails.REMUX_ALLOC_ERROR:y=x.level,T=!0;break}y!==void 0&&this.recoverLevel(x,y,T,E)},p.recoverLevel=function(w,x,O,A){var T=w.details,E=this._levels[x];if(E.loadError++,O){var y=this.retryLoadingOrFail(w);if(y)w.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(A){var h=E.url.length;if(h>1&&E.loadError<h)w.levelRetry=!0,this.redundantFailover(x);else if(this.manualLevelIndex===-1){var _=x===0?this._levels.length-1:x-1;this.currentLevelIndex!==_&&this._levels[_].loadError===0&&(this.warn(T+": switch to "+_),w.levelRetry=!0,this.hls.nextAutoLevel=_)}}},p.redundantFailover=function(w){var x=this._levels[w],O=x.url.length;if(O>1){var A=(x.urlId+1)%O;this.warn("Switching to redundant URL-id "+A),this._levels.forEach(function(T){T.urlId=A}),this.level=w}},p.onFragLoaded=function(w,x){var O=x.frag;if(O!==void 0&&O.type===I.PlaylistLevelType.MAIN){var A=this._levels[O.level];A!==void 0&&(A.fragmentError=0,A.loadError=0)}},p.onLevelLoaded=function(w,x){var O,A=x.level,T=x.details,E=this._levels[A];if(!E){var y;this.warn("Invalid level index "+A),(y=x.deliveryDirectives)!==null&&y!==void 0&&y.skip&&(T.deltaUpdateFailed=!0);return}A===this.currentLevelIndex?(E.fragmentError===0&&(E.loadError=0,this.retryCount=0),this.playlistLoaded(A,x,E.details)):(O=x.deliveryDirectives)!==null&&O!==void 0&&O.skip&&(T.deltaUpdateFailed=!0)},p.onAudioTrackSwitched=function(w,x){var O=this.hls.levels[this.currentLevelIndex];if(!O)return;if(O.audioGroupIds){for(var A=-1,T=this.hls.audioTracks[x.id].groupId,E=0;E<O.audioGroupIds.length;E++)if(O.audioGroupIds[E]===T){A=E;break}A!==O.urlId&&(O.urlId=A,this.startLoad())}},p.loadPlaylist=function(w){var x=this.currentLevelIndex,O=this._levels[x];if(this.canLoad&&O&&O.url.length>0){var A=O.urlId,T=O.url[A];if(w)try{T=w.addDirectives(T)}catch(E){this.warn("Could not construct new URL with HLS Delivery Directives: "+E)}this.log("Attempt loading level index "+x+(w?" at sn "+w.msn+" part "+w.part:"")+" with URL-id "+A+" "+T),this.clearTimer(),this.hls.trigger(F.Events.LEVEL_LOADING,{url:T,level:x,id:A,deliveryDirectives:w||null})}},p.removeLevel=function(w,x){var O=function(E,y){return y!==x},A=this._levels.filter(function(T,E){return E!==w?!0:T.url.length>1&&x!==void 0?(T.url=T.url.filter(O),T.audioGroupIds&&(T.audioGroupIds=T.audioGroupIds.filter(O)),T.textGroupIds&&(T.textGroupIds=T.textGroupIds.filter(O)),T.urlId=0,!0):!1}).map(function(T,E){var y=T.details;return y!=null&&y.fragments&&y.fragments.forEach(function(h){h.level=E}),T});this._levels=A,this.hls.trigger(F.Events.LEVELS_UPDATED,{levels:A})},f(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(w){var x,O=this._levels;if(O.length===0)return;if(this.currentLevelIndex===w&&(x=O[w])!==null&&x!==void 0&&x.details)return;if(w<0||w>=O.length){var A=w<0;if(this.hls.trigger(F.Events.ERROR,{type:U.ErrorTypes.OTHER_ERROR,details:U.ErrorDetails.LEVEL_SWITCH_ERROR,level:w,fatal:A,reason:"invalid level idx"}),A)return;w=Math.min(w,O.length-1)}this.clearTimer();var T=this.currentLevelIndex,E=O[T],y=O[w];this.log("switching to level "+w+" from "+T),this.currentLevelIndex=w;var h=m({},y,{level:w,maxBitrate:y.maxBitrate,uri:y.uri,urlId:y.urlId});delete h._urlId,this.hls.trigger(F.Events.LEVEL_SWITCHING,h);var _=y.details;if(!_||_.live){var g=this.switchParams(y.uri,E==null?void 0:E.details);this.loadPlaylist(g)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(w){this.manualLevelIndex=w,this._startLevel===void 0&&(this._startLevel=w),w!==-1&&(this.level=w)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(w){this._firstLevel=w}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var w=this.hls.config.startLevel;return w!==void 0?w:this._firstLevel}else return this._startLevel},set:function(w){this._startLevel=w}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(w){this.level=w,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=w)}}]),l}(k.default)},"./src/controller/level-helper.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"addGroupId",function(){return U}),D.d(J,"assignTrackIdsByGroup",function(){return W}),D.d(J,"updatePTS",function(){return j}),D.d(J,"updateFragPTSDTS",function(){return I}),D.d(J,"mergeDetails",function(){return m}),D.d(J,"mapPartIntersection",function(){return c}),D.d(J,"mapFragmentIntersection",function(){return f}),D.d(J,"adjustSliding",function(){return u}),D.d(J,"addSliding",function(){return r}),D.d(J,"computeReloadInterval",function(){return d}),D.d(J,"getFragmentWithSN",function(){return o}),D.d(J,"getPartWith",function(){return s});var Y=D("./src/polyfills/number.ts"),F=D("./src/utils/logger.ts");function U(l,p,R){switch(p){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(R);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(R);break}}function W(l){var p={};l.forEach(function(R){var w=R.groupId||"";R.id=p[w]=p[w]||0,p[w]++})}function j(l,p,R){var w=l[p],x=l[R];k(w,x)}function k(l,p){var R=p.startPTS;if(Object(Y.isFiniteNumber)(R)){var w=0,x;p.sn>l.sn?(w=R-l.start,x=l):(w=l.start-R,x=p),x.duration!==w&&(x.duration=w)}else if(p.sn>l.sn){var O=l.cc===p.cc;O&&l.minEndPTS?p.start=l.start+(l.minEndPTS-l.start):p.start=l.start+l.duration}else p.start=Math.max(l.start-p.duration,0)}function I(l,p,R,w,x,O){var A=w-R;A<=0&&(F.logger.warn("Fragment should have a positive duration",p),w=R+p.duration,O=x+p.duration);var T=R,E=w,y=p.startPTS,h=p.endPTS;if(Object(Y.isFiniteNumber)(y)){var _=Math.abs(y-R);Object(Y.isFiniteNumber)(p.deltaPTS)?p.deltaPTS=Math.max(_,p.deltaPTS):p.deltaPTS=_,T=Math.max(R,y),R=Math.min(R,y),x=Math.min(x,p.startDTS),E=Math.min(w,h),w=Math.max(w,h),O=Math.max(O,p.endDTS)}p.duration=w-R;var g=R-p.start;p.appendedPTS=w,p.start=p.startPTS=R,p.maxStartPTS=T,p.startDTS=x,p.endPTS=w,p.minEndPTS=E,p.endDTS=O;var b=p.sn;if(!l||b<l.startSN||b>l.endSN)return 0;var M,P=b-l.startSN,K=l.fragments;for(K[P]=p,M=P;M>0;M--)k(K[M],K[M-1]);for(M=P;M<K.length-1;M++)k(K[M],K[M+1]);return l.fragmentHint&&k(K[K.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,g}function m(l,p){for(var R=null,w=l.fragments,x=w.length-1;x>=0;x--){var O=w[x].initSegment;if(O){R=O;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var A=0,T;if(f(l,p,function(M,P){M.relurl&&(A=M.cc-P.cc),Object(Y.isFiniteNumber)(M.startPTS)&&Object(Y.isFiniteNumber)(M.endPTS)&&(P.start=P.startPTS=M.startPTS,P.startDTS=M.startDTS,P.appendedPTS=M.appendedPTS,P.maxStartPTS=M.maxStartPTS,P.endPTS=M.endPTS,P.endDTS=M.endDTS,P.minEndPTS=M.minEndPTS,P.duration=M.endPTS-M.startPTS,P.duration&&(T=P),p.PTSKnown=p.alignedSliding=!0),P.elementaryStreams=M.elementaryStreams,P.loader=M.loader,P.stats=M.stats,P.urlId=M.urlId,M.initSegment&&(P.initSegment=M.initSegment,R=M.initSegment)}),R){var E=p.fragmentHint?p.fragments.concat(p.fragmentHint):p.fragments;E.forEach(function(M){var P;(!M.initSegment||M.initSegment.relurl===((P=R)===null||P===void 0?void 0:P.relurl))&&(M.initSegment=R)})}if(p.skippedSegments&&(p.deltaUpdateFailed=p.fragments.some(function(M){return!M}),p.deltaUpdateFailed)){F.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var y=p.skippedSegments;y--;)p.fragments.shift();p.startSN=p.fragments[0].sn,p.startCC=p.fragments[0].cc}var h=p.fragments;if(A){F.logger.warn("discontinuity sliding from playlist, take drift into account");for(var _=0;_<h.length;_++)h[_].cc+=A}p.skippedSegments&&(p.startCC=p.fragments[0].cc),c(l.partList,p.partList,function(M,P){P.elementaryStreams=M.elementaryStreams,P.stats=M.stats}),T?I(p,T,T.startPTS,T.endPTS,T.startDTS,T.endDTS):u(l,p),h.length&&(p.totalduration=p.edge-h[0].start),p.driftStartTime=l.driftStartTime,p.driftStart=l.driftStart;var g=p.advancedDateTime;if(p.advanced&&g){var b=p.edge;p.driftStart||(p.driftStartTime=g,p.driftStart=b),p.driftEndTime=g,p.driftEnd=b}else p.driftEndTime=l.driftEndTime,p.driftEnd=l.driftEnd,p.advancedDateTime=l.advancedDateTime}function c(l,p,R){if(l&&p)for(var w=0,x=0,O=l.length;x<=O;x++){var A=l[x],T=p[x+w];A&&T&&A.index===T.index&&A.fragment.sn===T.fragment.sn?R(A,T):w--}}function f(l,p,R){for(var w=p.skippedSegments,x=Math.max(l.startSN,p.startSN)-p.startSN,O=(l.fragmentHint?1:0)+(w?p.endSN:Math.min(l.endSN,p.endSN))-p.startSN,A=p.startSN-l.startSN,T=p.fragmentHint?p.fragments.concat(p.fragmentHint):p.fragments,E=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,y=x;y<=O;y++){var h=E[A+y],_=T[y];w&&!_&&y<w&&(_=p.fragments[y]=h),h&&_&&R(h,_)}}function u(l,p){var R=p.startSN+p.skippedSegments-l.startSN,w=l.fragments;if(R<0||R>=w.length)return;r(p,w[R].start)}function r(l,p){if(p){for(var R=l.fragments,w=l.skippedSegments;w<R.length;w++)R[w].start+=p;l.fragmentHint&&(l.fragmentHint.start+=p)}}function d(l,p){var R=1e3*l.levelTargetDuration,w=R/2,x=l.age,O=x>0&&x<R*3,A=p.loading.end-p.loading.start,T,E=l.availabilityDelay;if(l.updated===!1)if(O){var y=333*l.misses;T=Math.max(Math.min(w,A*2),y),l.availabilityDelay=(l.availabilityDelay||0)+T}else T=w;else O?(E=Math.min(E||R/2,x),l.availabilityDelay=E,T=E+R-x):T=R-A;return Math.round(T)}function o(l,p,R){if(!l||!l.details)return null;var w=l.details,x=w.fragments[p-w.startSN];return x||(x=w.fragmentHint,x&&x.sn===p?x:p<w.startSN&&R&&R.sn===p?R:null)}function s(l,p,R){if(!l||!l.details)return null;var w=l.details.partList;if(w)for(var x=w.length;x--;){var O=w[x];if(O.index===R&&O.fragment.sn===p)return O}return null}},"./src/controller/stream-controller.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return w});var Y=D("./src/polyfills/number.ts"),F=D("./src/controller/base-stream-controller.ts"),U=D("./src/is-supported.ts"),W=D("./src/events.ts"),j=D("./src/utils/buffer-helper.ts"),k=D("./src/controller/fragment-tracker.ts"),I=D("./src/types/loader.ts"),m=D("./src/loader/fragment.ts"),c=D("./src/demux/transmuxer-interface.ts"),f=D("./src/types/transmuxer.ts"),u=D("./src/controller/gap-controller.ts"),r=D("./src/errors.ts"),d=D("./src/utils/logger.ts");function o(x,O){for(var A=0;A<O.length;A++){var T=O[A];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(x,T.key,T)}}function s(x,O,A){return O&&o(x.prototype,O),A&&o(x,A),x}function l(x,O){x.prototype=Object.create(O.prototype),x.prototype.constructor=x,p(x,O)}function p(x,O){return p=Object.setPrototypeOf||function(T,E){return T.__proto__=E,T},p(x,O)}var R=100,w=function(x){l(O,x);function O(T,E){var y;return y=x.call(this,T,E,"[stream-controller]")||this,y.audioCodecSwap=!1,y.gapController=null,y.level=-1,y._forceStartLoad=!1,y.altAudio=!1,y.audioOnly=!1,y.fragPlaying=null,y.onvplaying=null,y.onvseeked=null,y.fragLastKbps=0,y.stalled=!1,y.couldBacktrack=!1,y.audioCodecSwitch=!1,y.videoBuffer=null,y._registerListeners(),y}var A=O.prototype;return A._registerListeners=function(){var E=this.hls;E.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),E.on(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.on(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),E.on(W.Events.ERROR,this.onError,this),E.on(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),E.on(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),E.on(W.Events.BUFFER_CREATED,this.onBufferCreated,this),E.on(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),E.on(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),E.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},A._unregisterListeners=function(){var E=this.hls;E.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.off(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.off(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),E.off(W.Events.ERROR,this.onError,this),E.off(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),E.off(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),E.off(W.Events.BUFFER_CREATED,this.onBufferCreated,this),E.off(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),E.off(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),E.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},A.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},A.startLoad=function(E){if(this.levels){var y=this.lastCurrentTime,h=this.hls;if(this.stopLoad(),this.setInterval(R),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var _=h.startLevel;_===-1&&(h.config.testBandwidth?(_=0,this.bitrateTest=!0):_=h.nextAutoLevel),this.level=h.nextLoadLevel=_,this.loadedmetadata=!1}y>0&&E===-1&&(this.log("Override startPosition with lastCurrentTime @"+y.toFixed(3)),E=y),this.state=F.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=E,this.tick()}else this._forceStartLoad=!0,this.state=F.State.STOPPED},A.stopLoad=function(){this._forceStartLoad=!1,x.prototype.stopLoad.call(this)},A.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_LEVEL:{var E,y=this.levels,h=this.level,_=y==null||((E=y[h])===null||E===void 0)?void 0:E.details;if(_&&(!_.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(_))break;this.state=F.State.IDLE;break}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var g,b=self.performance.now(),M=this.retryDate;(!M||b>=M||(g=this.media)!==null&&g!==void 0&&g.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=F.State.IDLE)}break;default:break}this.onTickEnd()},A.onTickEnd=function(){x.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},A.doTickIdle=function(){var E,y,h=this.hls,_=this.levelLastLoaded,g=this.levels,b=this.media,M=h.config,P=h.nextLoadLevel;if(_===null||!b&&(this.startFragRequested||!M.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!g||!g[P])return;var K=g[P];this.level=h.nextLoadLevel=P;var V=K.details;if(!V||this.state===F.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==P){this.state=F.State.WAITING_LEVEL;return}var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:b,I.PlaylistLevelType.MAIN);if(B===null)return;var C=B.len,$=this.getMaxBufferLength(K.maxBitrate);if(C>=$)return;if(this._streamEnded(B,V)){var ee={};this.altAudio&&(ee.type="video"),this.hls.trigger(W.Events.BUFFER_EOS,ee),this.state=F.State.ENDED;return}var re=B.end,ue=this.getNextFragment(re,V);if(this.couldBacktrack&&!this.fragPrevious&&ue&&ue.sn!=="initSegment"){var Te=ue.sn-V.startSN;Te>1&&(ue=V.fragments[Te-1],this.fragmentTracker.removeFragment(ue))}if(ue&&this.fragmentTracker.getState(ue)===k.FragmentState.OK&&this.nextLoadPosition>re){var ye=this.audioOnly&&!this.altAudio?m.ElementaryStreamTypes.AUDIO:m.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(b,ye,I.PlaylistLevelType.MAIN),ue=this.getNextFragment(this.nextLoadPosition,V)}if(!ue)return;ue.initSegment&&!ue.initSegment.data&&!this.bitrateTest&&(ue=ue.initSegment),((E=ue.decryptdata)===null||E===void 0?void 0:E.keyFormat)==="identity"&&!((y=ue.decryptdata)!==null&&y!==void 0&&y.key)?this.loadKey(ue,V):this.loadFragment(ue,V,re)},A.loadFragment=function(E,y,h){var _,g=this.fragmentTracker.getState(E);if(this.fragCurrent=E,g===k.FragmentState.BACKTRACKED){var b=this.fragmentTracker.getBacktrackData(E);if(b){this._handleFragmentLoadProgress(b),this._handleFragmentLoadComplete(b);return}else g=k.FragmentState.NOT_LOADED}g===k.FragmentState.NOT_LOADED||g===k.FragmentState.PARTIAL?E.sn==="initSegment"?this._loadInitSegment(E):this.bitrateTest?(E.bitrateTest=!0,this.log("Fragment "+E.sn+" of level "+E.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(E)):(this.startFragRequested=!0,x.prototype.loadFragment.call(this,E,y,h)):g===k.FragmentState.APPENDING?this.reduceMaxBufferLength(E.duration)&&this.fragmentTracker.removeFragment(E):((_=this.media)===null||_===void 0?void 0:_.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},A.getAppendedFrag=function(E){var y=this.fragmentTracker.getAppendedFrag(E,I.PlaylistLevelType.MAIN);return y&&"fragment"in y?y.fragment:y},A.getBufferedFrag=function(E){return this.fragmentTracker.getBufferedFrag(E,I.PlaylistLevelType.MAIN)},A.followingBufferedFrag=function(E){return E?this.getBufferedFrag(E.end+.5):null},A.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},A.nextLevelSwitch=function(){var E=this.levels,y=this.media;if(y!=null&&y.readyState){var h,_=this.getAppendedFrag(y.currentTime);if(_&&_.start>1&&this.flushMainBuffer(0,_.start-1),!y.paused&&E){var g=this.hls.nextLoadLevel,b=E[g],M=this.fragLastKbps;M&&this.fragCurrent?h=this.fragCurrent.duration*b.maxBitrate/(1e3*M)+1:h=0}else h=0;var P=this.getBufferedFrag(y.currentTime+h);if(P){var K=this.followingBufferedFrag(P);if(K){this.abortCurrentFrag();var V=K.maxStartPTS?K.maxStartPTS:K.start,B=K.duration,C=Math.max(P.end,V+Math.min(Math.max(B-this.config.maxFragLookUpTolerance,B*.5),B*.75));this.flushMainBuffer(C,Number.POSITIVE_INFINITY)}}}},A.abortCurrentFrag=function(){var E=this.fragCurrent;this.fragCurrent=null,E!=null&&E.loader&&E.loader.abort(),this.state===F.State.KEY_LOADING&&(this.state=F.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},A.flushMainBuffer=function(E,y){x.prototype.flushMainBuffer.call(this,E,y,this.altAudio?"video":null)},A.onMediaAttached=function(E,y){x.prototype.onMediaAttached.call(this,E,y);var h=y.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),h.addEventListener("playing",this.onvplaying),h.addEventListener("seeked",this.onvseeked),this.gapController=new u.default(this.config,h,this.fragmentTracker,this.hls)},A.onMediaDetaching=function(){var E=this.media;E&&(E.removeEventListener("playing",this.onvplaying),E.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),x.prototype.onMediaDetaching.call(this)},A.onMediaPlaying=function(){this.tick()},A.onMediaSeeked=function(){var E=this.media,y=E?E.currentTime:null;Object(Y.isFiniteNumber)(y)&&this.log("Media seeked to "+y.toFixed(3)),this.tick()},A.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(W.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},A.onManifestParsed=function(E,y){var h=!1,_=!1,g;y.levels.forEach(function(b){g=b.audioCodec,g&&(g.indexOf("mp4a.40.2")!==-1&&(h=!0),g.indexOf("mp4a.40.5")!==-1&&(_=!0))}),this.audioCodecSwitch=h&&_&&!Object(U.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=y.levels,this.startFragRequested=!1},A.onLevelLoading=function(E,y){var h=this.levels;if(!h||this.state!==F.State.IDLE)return;var _=h[y.level];(!_.details||_.details.live&&this.levelLastLoaded!==y.level||this.waitForCdnTuneIn(_.details))&&(this.state=F.State.WAITING_LEVEL)},A.onLevelLoaded=function(E,y){var h,_=this.levels,g=y.level,b=y.details,M=b.totalduration;if(!_){this.warn("Levels were reset while loading level "+g);return}this.log("Level "+g+" loaded ["+b.startSN+","+b.endSN+"], cc ["+b.startCC+", "+b.endCC+"] duration:"+M);var P=this.fragCurrent;P&&(this.state===F.State.FRAG_LOADING||this.state===F.State.FRAG_LOADING_WAITING_RETRY)&&(P.level!==y.level&&P.loader&&(this.state=F.State.IDLE,P.loader.abort()));var K=_[g],V=0;if(b.live||(h=K.details)!==null&&h!==void 0&&h.live){if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed)return;V=this.alignPlaylists(b,K.details)}if(K.details=b,this.levelLastLoaded=g,this.hls.trigger(W.Events.LEVEL_UPDATED,{details:b,level:g}),this.state===F.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(b))return;this.state=F.State.IDLE}this.startFragRequested?b.live&&this.synchronizeToLiveEdge(b):this.setStartPosition(b,V),this.tick()},A._handleFragmentLoadProgress=function(E){var y,h=E.frag,_=E.part,g=E.payload,b=this.levels;if(!b){this.warn("Levels were reset while fragment load was in progress. Fragment "+h.sn+" of level "+h.level+" will not be buffered");return}var M=b[h.level],P=M.details;if(!P){this.warn("Dropping fragment "+h.sn+" of level "+h.level+" after level details were reset");return}var K=M.videoCodec,V=P.PTSKnown||!P.live,B=(y=h.initSegment)===null||y===void 0?void 0:y.data,C=this._getAudioCodec(M),$=this.transmuxer=this.transmuxer||new c.default(this.hls,I.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ee=_?_.index:-1,re=ee!==-1,ue=new f.ChunkMetadata(h.level,h.sn,h.stats.chunkCount,g.byteLength,ee,re),Te=this.initPTS[h.cc];$.push(g,B,C,K,h,_,P.totalduration,V,ue,Te)},A.onAudioTrackSwitching=function(E,y){var h=this.altAudio,_=!!y.url,g=y.id;if(!_){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var b=this.fragCurrent;b!=null&&b.loader&&(this.log("Switching to main audio track, cancel main fragment load"),b.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var M=this.hls;h&&M.trigger(W.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),M.trigger(W.Events.AUDIO_TRACK_SWITCHED,{id:g})}},A.onAudioTrackSwitched=function(E,y){var h=y.id,_=!!this.hls.audioTracks[h].url;if(_){var g=this.videoBuffer;g&&this.mediaBuffer!==g&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=g)}this.altAudio=_,this.tick()},A.onBufferCreated=function(E,y){var h=y.tracks,_,g,b=!1;for(var M in h){var P=h[M];if(P.id==="main"){if(g=M,_=P,M==="video"){var K=h[M];K&&(this.videoBuffer=K.buffer)}}else b=!0}b&&_?(this.log("Alternate track found, use "+g+".buffered to schedule main fragment loading"),this.mediaBuffer=_.buffer):this.mediaBuffer=this.media},A.onFragBuffered=function(E,y){var h=y.frag,_=y.part;if(h&&h.type!==I.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(h)){this.warn("Fragment "+h.sn+(_?" p: "+_.index:"")+" of level "+h.level+" finished buffering, but was aborted. state: "+this.state),this.state===F.State.PARSED&&(this.state=F.State.IDLE);return}var g=_?_.stats:h.stats;this.fragLastKbps=Math.round(8*g.total/(g.buffering.end-g.loading.first)),h.sn!=="initSegment"&&(this.fragPrevious=h),this.fragBufferedComplete(h,_)},A.onError=function(E,y){switch(y.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:this.onFragmentOrKeyLoadError(I.PlaylistLevelType.MAIN,y);break;case r.ErrorDetails.LEVEL_LOAD_ERROR:case r.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==F.State.ERROR&&(y.fatal?(this.warn(""+y.details),this.state=F.State.ERROR):!y.levelRetry&&this.state===F.State.WAITING_LEVEL&&(this.state=F.State.IDLE));break;case r.ErrorDetails.BUFFER_FULL_ERROR:if(y.parent==="main"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var h=!0,_=this.getFwdBufferInfo(this.media,I.PlaylistLevelType.MAIN);_&&_.len>.5&&(h=!this.reduceMaxBufferLength(_.len)),h&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},A.checkBuffer=function(){var E=this.media,y=this.gapController;if(!E||!y||!E.readyState)return;var h=j.BufferHelper.getBuffered(E);!this.loadedmetadata&&h.length?(this.loadedmetadata=!0,this.seekToStartPos()):y.poll(this.lastCurrentTime),this.lastCurrentTime=E.currentTime},A.onFragLoadEmergencyAborted=function(){this.state=F.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},A.onBufferFlushed=function(E,y){var h=y.type;if(h!==m.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var _=(h===m.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(_,h,I.PlaylistLevelType.MAIN)}},A.onLevelsUpdated=function(E,y){this.levels=y.levels},A.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},A.seekToStartPos=function(){var E=this.media,y=E.currentTime,h=this.startPosition;if(h>=0&&y<h){if(E.seeking){d.logger.log("could not seek to "+h+", already seeking at "+y);return}var _=j.BufferHelper.getBuffered(E),g=_.length?_.start(0):0,b=g-h;b>0&&(b<this.config.maxBufferHole||b<this.config.maxFragLookUpTolerance)&&(d.logger.log("adjusting start position by "+b+" to match buffer start"),h+=b,this.startPosition=h),this.log("seek to target start position "+h+" from current time "+y),E.currentTime=h}},A._getAudioCodec=function(E){var y=this.config.defaultAudioCodec||E.audioCodec;return this.audioCodecSwap&&y&&(this.log("Swapping audio codec"),y.indexOf("mp4a.40.5")!==-1?y="mp4a.40.2":y="mp4a.40.5"),y},A._loadBitrateTestFrag=function(E){var y=this;this._doFragLoad(E).then(function(h){var _=y.hls;if(!h||_.nextLoadLevel||y.fragContextChanged(E))return;y.fragLoadError=0,y.state=F.State.IDLE,y.startFragRequested=!1,y.bitrateTest=!1;var g=E.stats;g.parsing.start=g.parsing.end=g.buffering.start=g.buffering.end=self.performance.now(),_.trigger(W.Events.FRAG_LOADED,h)})},A._handleTransmuxComplete=function(E){var y,h="main",_=this.hls,g=E.remuxResult,b=E.chunkMeta,M=this.getCurrentContext(b);if(!M){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 P=M.frag,K=M.part,V=M.level,B=g.video,C=g.text,$=g.id3,ee=g.initSegment,re=this.altAudio?void 0:g.audio;if(this.fragContextChanged(P))return;if(this.state=F.State.PARSING,ee){ee.tracks&&(this._bufferInitSegment(V,ee.tracks,P,b),_.trigger(W.Events.FRAG_PARSING_INIT_SEGMENT,{frag:P,id:h,tracks:ee.tracks}));var ue=ee.initPTS,Te=ee.timescale;Object(Y.isFiniteNumber)(ue)&&(this.initPTS[P.cc]=ue,_.trigger(W.Events.INIT_PTS_FOUND,{frag:P,id:h,initPTS:ue,timescale:Te}))}if(B&&g.independent!==!1){if(V.details){var ye=B.startPTS,be=B.endPTS,we=B.startDTS,xe=B.endDTS;if(K)K.elementaryStreams[B.type]={startPTS:ye,endPTS:be,startDTS:we,endDTS:xe};else if(B.firstKeyFrame&&B.independent&&(this.couldBacktrack=!0),B.dropped&&B.independent){var me=this.getLoadPosition()+this.config.maxBufferHole;if(me<ye){this.backtrack(P);return}P.setElementaryStreamInfo(B.type,P.start,be,P.start,xe,!0)}P.setElementaryStreamInfo(B.type,ye,be,we,xe),this.bufferFragmentData(B,P,K,b)}}else if(g.independent===!1){this.backtrack(P);return}if(re){var se=re.startPTS,Re=re.endPTS,ze=re.startDTS,He=re.endDTS;K&&(K.elementaryStreams[m.ElementaryStreamTypes.AUDIO]={startPTS:se,endPTS:Re,startDTS:ze,endDTS:He}),P.setElementaryStreamInfo(m.ElementaryStreamTypes.AUDIO,se,Re,ze,He),this.bufferFragmentData(re,P,K,b)}if($!=null&&(y=$.samples)!==null&&y!==void 0&&y.length){var rt={frag:P,id:h,samples:$.samples};_.trigger(W.Events.FRAG_PARSING_METADATA,rt)}if(C){var ot={frag:P,id:h,samples:C.samples};_.trigger(W.Events.FRAG_PARSING_USERDATA,ot)}},A._bufferInitSegment=function(E,y,h,_){var g=this;if(this.state!==F.State.PARSING)return;this.audioOnly=!!y.audio&&!y.video,this.altAudio&&!this.audioOnly&&delete y.audio;var b=y.audio,M=y.video,P=y.audiovideo;if(b){var K=E.audioCodec,V=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(K&&(K.indexOf("mp4a.40.5")!==-1?K="mp4a.40.2":K="mp4a.40.5"),b.metadata.channelCount!==1&&V.indexOf("firefox")===-1&&(K="mp4a.40.5")),V.indexOf("android")!==-1&&b.container!=="audio/mpeg"&&(K="mp4a.40.2",this.log("Android: force audio codec to "+K)),E.audioCodec&&E.audioCodec!==K&&this.log('Swapping manifest audio codec "'+E.audioCodec+'" for "'+K+'"'),b.levelCodec=K,b.id="main",this.log("Init audio buffer, container:"+b.container+", codecs[selected/level/parsed]=["+(K||"")+"/"+(E.audioCodec||"")+"/"+b.codec+"]")}M&&(M.levelCodec=E.videoCodec,M.id="main",this.log("Init video buffer, container:"+M.container+", codecs[level/parsed]=["+(E.videoCodec||"")+"/"+M.codec+"]")),P&&this.log("Init audiovideo buffer, container:"+P.container+", codecs[level/parsed]=["+(E.attrs.CODECS||"")+"/"+P.codec+"]"),this.hls.trigger(W.Events.BUFFER_CODECS,y),Object.keys(y).forEach(function(B){var C=y[B],$=C.initSegment;$!=null&&$.byteLength&&g.hls.trigger(W.Events.BUFFER_APPENDING,{type:B,data:$,frag:h,part:null,chunkMeta:_,parent:h.type})}),this.tick()},A.backtrack=function(E){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(E);var y=this.fragmentTracker.backtrack(E);this.fragPrevious=null,this.nextLoadPosition=E.start,y?this.resetFragmentLoading(E):this.state=F.State.BACKTRACKING},A.checkFragmentChanged=function(){var E=this.media,y=null;if(E&&E.readyState>1&&E.seeking===!1){var h=E.currentTime;if(j.BufferHelper.isBuffered(E,h)?y=this.getAppendedFrag(h):j.BufferHelper.isBuffered(E,h+.1)&&(y=this.getAppendedFrag(h+.1)),y){var _=this.fragPlaying,g=y.level;(!_||y.sn!==_.sn||_.level!==g||y.urlId!==_.urlId)&&(this.hls.trigger(W.Events.FRAG_CHANGED,{frag:y}),(!_||_.level!==g)&&this.hls.trigger(W.Events.LEVEL_SWITCHED,{level:g}),this.fragPlaying=y)}}},s(O,[{key:"nextLevel",get:function(){var E=this.nextBufferedFrag;return E?E.level:-1}},{key:"currentLevel",get:function(){var E=this.media;if(E){var y=this.getAppendedFrag(E.currentTime);if(y)return y.level}return-1}},{key:"nextBufferedFrag",get:function(){var E=this.media;if(E){var y=this.getAppendedFrag(E.currentTime);return this.followingBufferedFrag(y)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),O}(F.default)},"./src/controller/subtitle-stream-controller.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"SubtitleStreamController",function(){return l});var Y=D("./src/events.ts"),F=D("./src/utils/logger.ts"),U=D("./src/utils/buffer-helper.ts"),W=D("./src/controller/fragment-finders.ts"),j=D("./src/utils/discontinuities.ts"),k=D("./src/controller/level-helper.ts"),I=D("./src/controller/fragment-tracker.ts"),m=D("./src/controller/base-stream-controller.ts"),c=D("./src/types/loader.ts"),f=D("./src/types/level.ts");function u(p,R){for(var w=0;w<R.length;w++){var x=R[w];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(p,x.key,x)}}function r(p,R,w){return R&&u(p.prototype,R),w&&u(p,w),p}function d(p,R){p.prototype=Object.create(R.prototype),p.prototype.constructor=p,o(p,R)}function o(p,R){return o=Object.setPrototypeOf||function(x,O){return x.__proto__=O,x},o(p,R)}var s=500,l=function(p){d(R,p);function R(x,O){var A;return A=p.call(this,x,O,"[subtitle-stream-controller]")||this,A.levels=[],A.currentTrackId=-1,A.tracksBuffered=[],A.mainDetails=null,A._registerListeners(),A}var w=R.prototype;return w.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},w._registerListeners=function(){var O=this.hls;O.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),O.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),O.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),O.on(Y.Events.LEVEL_LOADED,this.onLevelLoaded,this),O.on(Y.Events.ERROR,this.onError,this),O.on(Y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),O.on(Y.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),O.on(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),O.on(Y.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),O.on(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w._unregisterListeners=function(){var O=this.hls;O.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),O.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),O.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),O.off(Y.Events.LEVEL_LOADED,this.onLevelLoaded,this),O.off(Y.Events.ERROR,this.onError,this),O.off(Y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),O.off(Y.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),O.off(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),O.off(Y.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),O.off(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w.startLoad=function(){this.stopLoad(),this.state=m.State.IDLE,this.setInterval(s),this.tick()},w.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},w.onLevelLoaded=function(O,A){this.mainDetails=A.details},w.onSubtitleFragProcessed=function(O,A){var T=A.frag,E=A.success;if(this.fragPrevious=T,this.state=m.State.IDLE,!E)return;var y=this.tracksBuffered[this.currentTrackId];if(!y)return;for(var h,_=T.start,g=0;g<y.length;g++)if(_>=y[g].start&&_<=y[g].end){h=y[g];break}var b=T.start+T.duration;h?h.end=b:(h={start:_,end:b},y.push(h)),this.fragmentTracker.fragBuffered(T)},w.onBufferFlushing=function(O,A){var T=A.startOffset,E=A.endOffset;if(T===0&&E!==Number.POSITIVE_INFINITY){var y=this.currentTrackId,h=this.levels;if(!h.length||!h[y]||!h[y].details)return;var _=h[y].details,g=_.targetduration,b=E-g;if(b<=0)return;A.endOffsetSubtitles=Math.max(0,b),this.tracksBuffered.forEach(function(M){for(var P=0;P<M.length;){if(M[P].end<=b){M.shift();continue}else if(M[P].start<b)M[P].start=b;else break;P++}}),this.fragmentTracker.removeFragmentsInRange(T,b,c.PlaylistLevelType.SUBTITLE)}},w.onError=function(O,A){var T,E=A.frag;if(!E||E.type!==c.PlaylistLevelType.SUBTITLE)return;(T=this.fragCurrent)!==null&&T!==void 0&&T.loader&&this.fragCurrent.loader.abort(),this.state=m.State.IDLE},w.onSubtitleTracksUpdated=function(O,A){var T=this,E=A.subtitleTracks;this.tracksBuffered=[],this.levels=E.map(function(y){return new f.Level(y)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(y){T.tracksBuffered[y.id]=[]}),this.mediaBuffer=null},w.onSubtitleTrackSwitch=function(O,A){if(this.currentTrackId=A.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var T=this.levels[this.currentTrackId];T!=null&&T.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,T&&this.setInterval(s)},w.onSubtitleTrackLoaded=function(O,A){var T,E=A.details,y=A.id,h=this.currentTrackId,_=this.levels;if(!_.length)return;var g=_[h];if(y>=_.length||y!==h||!g)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,E.live||(T=g.details)!==null&&T!==void 0&&T.live){var b=this.mainDetails;if(E.deltaUpdateFailed||!b)return;var M=b.fragments[0];if(!g.details)E.hasProgramDateTime&&b.hasProgramDateTime?Object(j.alignMediaPlaylistByPDT)(E,b):M&&Object(k.addSliding)(E,M.start);else{var P=this.alignPlaylists(E,g.details);P===0&&M&&Object(k.addSliding)(E,M.start)}}if(g.details=E,this.levelLastLoaded=y,this.tick(),E.live&&!this.fragCurrent&&this.media&&this.state===m.State.IDLE){var K=Object(W.findFragmentByPTS)(null,E.fragments,this.media.currentTime,0);K||(this.warn("Subtitle playlist not aligned with playback"),g.details=void 0)}},w._handleFragmentLoadComplete=function(O){var A=O.frag,T=O.payload,E=A.decryptdata,y=this.hls;if(this.fragContextChanged(A))return;if(T&&T.byteLength>0&&E&&E.key&&E.iv&&E.method==="AES-128"){var h=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(T),E.key.buffer,E.iv.buffer).then(function(_){var g=performance.now();y.trigger(Y.Events.FRAG_DECRYPTED,{frag:A,payload:_,stats:{tstart:h,tdecrypt:g}})})}},w.doTick=function(){if(!this.media){this.state=m.State.IDLE;return}if(this.state===m.State.IDLE){var O,A=this.currentTrackId,T=this.levels;if(!T.length||!T[A]||!T[A].details)return;var E=T[A].details,y=E.targetduration,h=this.config,_=this.media,g=U.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,_.currentTime-y,h.maxBufferHole),b=g.end,M=g.len,P=this.getMaxBufferLength()+y;if(M>P)return;console.assert(E,"Subtitle track details are defined on idle subtitle stream controller tick");var K=E.fragments,V=K.length,B=E.edge,C,$=this.fragPrevious;if(b<B){var ee=h.maxFragLookUpTolerance;$&&E.hasProgramDateTime&&(C=Object(W.findFragmentByPDT)(K,$.endProgramDateTime,ee)),C||(C=Object(W.findFragmentByPTS)($,K,b,ee),!C&&$&&$.start<K[0].start&&(C=K[0]))}else C=K[V-1];(O=C)!==null&&O!==void 0&&O.encrypted?(F.logger.log("Loading key for "+C.sn),this.state=m.State.KEY_LOADING,this.hls.trigger(Y.Events.KEY_LOADING,{frag:C})):C&&this.fragmentTracker.getState(C)===I.FragmentState.NOT_LOADED&&this.loadFragment(C,E,b)}},w.loadFragment=function(O,A,T){this.fragCurrent=O,p.prototype.loadFragment.call(this,O,A,T)},r(R,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),R}(m.default)},"./src/controller/subtitle-track-controller.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/events.ts"),F=D("./src/utils/texttrack-utils.ts"),U=D("./src/controller/base-playlist-controller.ts"),W=D("./src/types/loader.ts");function j(u,r){for(var d=0;d<r.length;d++){var o=r[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(u,o.key,o)}}function k(u,r,d){return r&&j(u.prototype,r),d&&j(u,d),u}function I(u,r){u.prototype=Object.create(r.prototype),u.prototype.constructor=u,m(u,r)}function m(u,r){return m=Object.setPrototypeOf||function(o,s){return o.__proto__=s,o},m(u,r)}var c=function(u){I(r,u);function r(o){var s;return s=u.call(this,o,"[subtitle-track-controller]")||this,s.media=null,s.tracks=[],s.groupId=null,s.tracksInGroup=[],s.trackId=-1,s.selectDefaultTrack=!0,s.queuedDefaultTrack=-1,s.trackChangeListener=function(){return s.onTextTracksChanged()},s.asyncPollTrackChange=function(){return s.pollTrackChange(0)},s.useTextTrackPolling=!1,s.subtitlePollingInterval=-1,s.subtitleDisplay=!0,s.registerListeners(),s}var d=r.prototype;return d.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,u.prototype.destroy.call(this)},d.registerListeners=function(){var s=this.hls;s.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),s.on(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.on(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),s.on(Y.Events.ERROR,this.onError,this)},d.unregisterListeners=function(){var s=this.hls;s.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),s.off(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.off(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),s.off(Y.Events.ERROR,this.onError,this)},d.onMediaAttached=function(s,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)},d.pollTrackChange=function(s){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,s)},d.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 s=f(this.media.textTracks);s.forEach(function(l){Object(F.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},d.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},d.onManifestParsed=function(s,l){this.tracks=l.subtitleTracks},d.onSubtitleTrackLoaded=function(s,l){var p=l.id,R=l.details,w=this.trackId,x=this.tracksInGroup[w];if(!x){this.warn("Invalid subtitle track id "+p);return}var O=x.details;x.details=l.details,this.log("subtitle track "+p+" loaded ["+R.startSN+"-"+R.endSN+"]"),p===this.trackId&&(this.retryCount=0,this.playlistLoaded(p,l,O))},d.onLevelLoading=function(s,l){this.switchLevel(l.level)},d.onLevelSwitching=function(s,l){this.switchLevel(l.level)},d.switchLevel=function(s){var l=this.hls.levels[s];if(!(l!=null&&l.textGroupIds))return;var p=l.textGroupIds[l.urlId];if(this.groupId!==p){var R=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,w=this.tracks.filter(function(A){return!p||A.groupId===p});this.tracksInGroup=w;var x=this.findTrackId(R==null?void 0:R.name)||this.findTrackId();this.groupId=p;var O={subtitleTracks:w};this.log("Updating subtitle tracks, "+w.length+' track(s) found in "'+p+'" group-id'),this.hls.trigger(Y.Events.SUBTITLE_TRACKS_UPDATED,O),x!==-1&&this.setSubtitleTrack(x,R)}},d.findTrackId=function(s){for(var l=this.tracksInGroup,p=0;p<l.length;p++){var R=l[p];if((!this.selectDefaultTrack||R.default)&&(!s||s===R.name))return R.id}return-1},d.onError=function(s,l){if(u.prototype.onError.call(this,s,l),l.fatal||!l.context)return;l.context.type===W.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},d.loadPlaylist=function(s){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var p=l.id,R=l.groupId,w=l.url;if(s)try{w=s.addDirectives(w)}catch(x){this.warn("Could not construct new URL with HLS Delivery Directives: "+x)}this.log("Loading subtitle playlist for id "+p),this.hls.trigger(Y.Events.SUBTITLE_TRACK_LOADING,{url:w,id:p,groupId:R,deliveryDirectives:s||null})}},d.toggleTrackModes=function(s){var l=this,p=this.media,R=this.subtitleDisplay,w=this.trackId;if(!p)return;var x=f(p.textTracks),O=x.filter(function(E){return E.groupId===l.groupId});if(s===-1)[].slice.call(x).forEach(function(E){E.mode="disabled"});else{var A=O[w];A&&(A.mode="disabled")}var T=O[s];T&&(T.mode=R?"showing":"hidden")},d.setSubtitleTrack=function(s,l){var p,R=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=s;return}if(this.trackId!==s&&this.toggleTrackModes(s),this.trackId===s&&(s===-1||(p=R[s])!==null&&p!==void 0&&p.details)||s<-1||s>=R.length)return;this.clearTimer();var w=R[s];if(this.log("Switching to subtitle track "+s),this.trackId=s,w){var x=w.id,O=w.groupId,A=O===void 0?"":O,T=w.name,E=w.type,y=w.url;this.hls.trigger(Y.Events.SUBTITLE_TRACK_SWITCH,{id:x,groupId:A,name:T,type:E,url:y});var h=this.switchParams(w.url,l==null?void 0:l.details);this.loadPlaylist(h)}else this.hls.trigger(Y.Events.SUBTITLE_TRACK_SWITCH,{id:s})},d.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var s=-1,l=f(this.media.textTracks),p=0;p<l.length;p++)if(l[p].mode==="hidden")s=p;else if(l[p].mode==="showing"){s=p;break}this.subtitleTrack!==s&&(this.subtitleTrack=s)},k(r,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(s){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(s,l)}}]),r}(U.default);function f(u){for(var r=[],d=0;d<u.length;d++){var o=u[d];o.kind==="subtitles"&&o.label&&r.push(u[d])}return r}J.default=c},"./src/controller/timeline-controller.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"TimelineController",function(){return f});var Y=D("./src/polyfills/number.ts"),F=D("./src/events.ts"),U=D("./src/utils/cea-608-parser.ts"),W=D("./src/utils/output-filter.ts"),j=D("./src/utils/webvtt-parser.ts"),k=D("./src/utils/texttrack-utils.ts"),I=D("./src/utils/imsc1-ttml-parser.ts"),m=D("./src/types/loader.ts"),c=D("./src/utils/logger.ts"),f=function(){function o(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=d(),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 p=new W.default(this,"textTrack1"),R=new W.default(this,"textTrack2"),w=new W.default(this,"textTrack3"),x=new W.default(this,"textTrack4");this.cea608Parser1=new U.default(1,p,R),this.cea608Parser2=new U.default(3,w,x)}l.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(F.Events.FRAG_LOADING,this.onFragLoading,this),l.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var s=o.prototype;return s.destroy=function(){var p=this.hls;p.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),p.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.off(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),p.off(F.Events.FRAG_LOADING,this.onFragLoading,this),p.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),p.off(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),p.off(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),p.off(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),p.off(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),p.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},s.addCues=function(p,R,w,x,O){for(var A=!1,T=O.length;T--;){var E=O[T],y=r(E[0],E[1],R,w);if(y>=0&&(E[0]=Math.min(E[0],R),E[1]=Math.max(E[1],w),A=!0,y/(w-R)>.5))return}if(A||O.push([R,w]),this.config.renderTextTracksNatively){var h=this.captionsTracks[p];this.Cues.newCue(h,R,w,x)}else{var _=this.Cues.newCue(null,R,w,x);this.hls.trigger(F.Events.CUES_PARSED,{type:"captions",cues:_,track:p})}},s.onInitPtsFound=function(p,R){var w=this,x=R.frag,O=R.id,A=R.initPTS,T=R.timescale,E=this.unparsedVttFrags;O==="main"&&(this.initPTS[x.cc]=A,this.timescale[x.cc]=T),E.length&&(this.unparsedVttFrags=[],E.forEach(function(y){w.onFragLoaded(F.Events.FRAG_LOADED,y)}))},s.getExistingTrack=function(p){var R=this.media;if(R)for(var w=0;w<R.textTracks.length;w++){var x=R.textTracks[w];if(x[p])return x}return null},s.createCaptionsTrack=function(p){this.config.renderTextTracksNatively?this.createNativeTrack(p):this.createNonNativeTrack(p)},s.createNativeTrack=function(p){if(this.captionsTracks[p])return;var R=this.captionsProperties,w=this.captionsTracks,x=this.media,O=R[p],A=O.label,T=O.languageCode,E=this.getExistingTrack(p);if(E)w[p]=E,Object(k.clearCurrentCues)(w[p]),Object(k.sendAddTrackEvent)(w[p],x);else{var y=this.createTextTrack("captions",A,T);y&&(y[p]=!0,w[p]=y)}},s.createNonNativeTrack=function(p){if(this.nonNativeCaptionsTracks[p])return;var R=this.captionsProperties[p];if(!R)return;var w=R.label,x={_id:p,label:w,kind:"captions",default:R.media?!!R.media.default:!1,closedCaptions:R.media};this.nonNativeCaptionsTracks[p]=x,this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[x]})},s.createTextTrack=function(p,R,w){var x=this.media;return x?x.addTextTrack(p,R,w):void 0},s.onMediaAttaching=function(p,R){this.media=R.media,this._cleanTracks()},s.onMediaDetaching=function(){var p=this.captionsTracks;Object.keys(p).forEach(function(R){Object(k.clearCurrentCues)(p[R]),delete p[R]}),this.nonNativeCaptionsTracks={}},s.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=d(),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())},s._cleanTracks=function(){var p=this.media;if(!p)return;var R=p.textTracks;if(R)for(var w=0;w<R.length;w++)Object(k.clearCurrentCues)(R[w])},s.onSubtitleTracksUpdated=function(p,R){var w=this;this.textTracks=[];var x=R.subtitleTracks||[],O=x.some(function(y){return y.textCodec===I.IMSC1_CODEC});if(this.config.enableWebVTT||O&&this.config.enableIMSC1){var A=this.tracks&&x&&this.tracks.length===x.length;if(this.tracks=x||[],this.config.renderTextTracksNatively){var T=this.media?this.media.textTracks:[];this.tracks.forEach(function(y,h){var _;if(h<T.length){for(var g=null,b=0;b<T.length;b++)if(u(T[b],y)){g=T[b];break}g&&(_=g)}_?Object(k.clearCurrentCues)(_):(_=w.createTextTrack("subtitles",y.name,y.lang),_&&(_.mode="disabled")),_&&(_.groupId=y.groupId,w.textTracks.push(_))})}else if(!A&&this.tracks&&this.tracks.length){var E=this.tracks.map(function(y){return{label:y.name,kind:y.type.toLowerCase(),default:y.default,subtitleTrack:y}});this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:E})}}},s.onManifestLoaded=function(p,R){var w=this;this.config.enableCEA708Captions&&R.captions&&R.captions.forEach(function(x){var O=/(?:CC|SERVICE)([1-4])/.exec(x.instreamId);if(!O)return;var A="textTrack"+O[1],T=w.captionsProperties[A];if(!T)return;T.label=x.name,x.lang&&(T.languageCode=x.lang),T.media=x})},s.onFragLoading=function(p,R){var w=this.cea608Parser1,x=this.cea608Parser2,O=this.lastSn,A=this.lastPartIndex;if(!this.enabled||!(w&&x))return;if(R.frag.type===m.PlaylistLevelType.MAIN){var T,E,y=R.frag.sn,h=(T=R==null||((E=R.part)===null||E===void 0)?void 0:E.index)!=null?T:-1;y===O+1||y===O&&h===A+1||(w.reset(),x.reset()),this.lastSn=y,this.lastPartIndex=h}},s.onFragLoaded=function(p,R){var w=R.frag,x=R.payload,O=this.initPTS,A=this.unparsedVttFrags;if(w.type===m.PlaylistLevelType.SUBTITLE)if(x.byteLength){if(!Object(Y.isFiniteNumber)(O[w.cc])){A.push(R),O.length&&this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:w,error:new Error("Missing initial subtitle PTS")});return}var T=w.decryptdata;if(T==null||T.key==null||T.method!=="AES-128"){var E=this.tracks[w.level],y=this.vttCCs;y[w.cc]||(y[w.cc]={start:w.start,prevCC:this.prevCC,new:!0},this.prevCC=w.cc),E&&E.textCodec===I.IMSC1_CODEC?this._parseIMSC1(w,x):this._parseVTTs(w,x,y)}}else this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:w,error:new Error("Empty subtitle payload")})},s._parseIMSC1=function(p,R){var w=this,x=this.hls;Object(I.parseIMSC1)(R,this.initPTS[p.cc],this.timescale[p.cc],function(O){w._appendCues(O,p.level),x.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:p})},function(O){c.logger.log("Failed to parse IMSC1: "+O),x.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:O})})},s._parseVTTs=function(p,R,w){var x=this,O=this.hls;Object(j.parseWebVTT)(R,this.initPTS[p.cc],this.timescale[p.cc],w,p.cc,p.start,function(A){x._appendCues(A,p.level),O.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:p})},function(A){x._fallbackToIMSC1(p,R),c.logger.log("Failed to parse VTT cue: "+A),O.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:A})})},s._fallbackToIMSC1=function(p,R){var w=this,x=this.tracks[p.level];x.textCodec||Object(I.parseIMSC1)(R,this.initPTS[p.cc],this.timescale[p.cc],function(){x.textCodec=I.IMSC1_CODEC,w._parseIMSC1(p,R)},function(){x.textCodec="wvtt"})},s._appendCues=function(p,R){var w=this.hls;if(this.config.renderTextTracksNatively){var x=this.textTracks[R];if(x.mode==="disabled")return;p.forEach(function(T){return Object(k.addCueToTrack)(x,T)})}else{var O=this.tracks[R],A=O.default?"default":"subtitles"+R;w.trigger(F.Events.CUES_PARSED,{type:"subtitles",cues:p,track:A})}},s.onFragDecrypted=function(p,R){var w=R.frag;if(w.type===m.PlaylistLevelType.SUBTITLE){if(!Object(Y.isFiniteNumber)(this.initPTS[w.cc])){this.unparsedVttFrags.push(R);return}this.onFragLoaded(F.Events.FRAG_LOADED,R)}},s.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},s.onFragParsingUserdata=function(p,R){var w=this.cea608Parser1,x=this.cea608Parser2;if(!this.enabled||!(w&&x))return;for(var O=0;O<R.samples.length;O++){var A=R.samples[O].bytes;if(A){var T=this.extractCea608Data(A);w.addData(R.samples[O].pts,T[0]),x.addData(R.samples[O].pts,T[1])}}},s.onBufferFlushing=function(p,R){var w=R.startOffset,x=R.endOffset,O=R.endOffsetSubtitles,A=R.type,T=this.media;if(!T||T.currentTime<x)return;if(!A||A==="video"){var E=this.captionsTracks;Object.keys(E).forEach(function(h){return Object(k.removeCuesInRange)(E[h],w,x)})}if(this.config.renderTextTracksNatively&&(w===0&&O!==void 0)){var y=this.textTracks;Object.keys(y).forEach(function(h){return Object(k.removeCuesInRange)(y[h],w,O)})}},s.extractCea608Data=function(p){for(var R=p[0]&31,w=2,x=[[],[]],O=0;O<R;O++){var A=p[w++],T=127&p[w++],E=127&p[w++],y=(4&A)!==0,h=3&A;if(T===0&&E===0)continue;y&&((h===0||h===1)&&(x[h].push(T),x[h].push(E)))}return x},o}();function u(o,s){return o&&o.label===s.name&&!(o.textTrack1||o.textTrack2)}function r(o,s,l,p){return Math.min(s,p)-Math.max(o,l)}function d(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return Y});var Y=function(){function F(W,j){this.subtle=void 0,this.aesIV=void 0,this.subtle=W,this.aesIV=j}var U=F.prototype;return U.decrypt=function(j,k){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},k,j)},F}()},"./src/crypt/aes-decryptor.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"removePadding",function(){return F}),D.d(J,"default",function(){return U});var Y=D("./src/utils/typed-array.ts");function F(W){var j=W.byteLength,k=j&&new DataView(W.buffer).getUint8(j-1);return k?Object(Y.sliceUint8)(W,0,j-k):W}var U=function(){function W(){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 j=W.prototype;return j.uint8ArrayToUint32Array_=function(I){for(var m=new DataView(I),c=new Uint32Array(4),f=0;f<4;f++)c[f]=m.getUint32(f*4);return c},j.initTable=function(){var I=this.sBox,m=this.invSBox,c=this.subMix,f=c[0],u=c[1],r=c[2],d=c[3],o=this.invSubMix,s=o[0],l=o[1],p=o[2],R=o[3],w=new Uint32Array(256),x=0,O=0,A=0;for(A=0;A<256;A++)A<128?w[A]=A<<1:w[A]=A<<1^283;for(A=0;A<256;A++){var T=O^O<<1^O<<2^O<<3^O<<4;T=T>>>8^T&255^99,I[x]=T,m[T]=x;var E=w[x],y=w[E],h=w[y],_=w[T]*257^T*16843008;f[x]=_<<24|_>>>8,u[x]=_<<16|_>>>16,r[x]=_<<8|_>>>24,d[x]=_,_=h*16843009^y*65537^E*257^x*16843008,s[T]=_<<24|_>>>8,l[T]=_<<16|_>>>16,p[T]=_<<8|_>>>24,R[T]=_,x?(x=E^w[w[w[h^E]]],O^=w[w[O]]):x=O=1}},j.expandKey=function(I){for(var m=this.uint8ArrayToUint32Array_(I),c=!0,f=0;f<m.length&&c;)c=m[f]===this.key[f],f++;if(c)return;this.key=m;var u=this.keySize=m.length;if(u!==4&&u!==6&&u!==8)throw new Error("Invalid aes key size="+u);var r=this.ksRows=(u+6+1)*4,d,o,s=this.keySchedule=new Uint32Array(r),l=this.invKeySchedule=new Uint32Array(r),p=this.sBox,R=this.rcon,w=this.invSubMix,x=w[0],O=w[1],A=w[2],T=w[3],E,y;for(d=0;d<r;d++){if(d<u){E=s[d]=m[d];continue}y=E,d%u===0?(y=y<<8|y>>>24,y=p[y>>>24]<<24|p[y>>>16&255]<<16|p[y>>>8&255]<<8|p[y&255],y^=R[d/u|0]<<24):u>6&&d%u===4&&(y=p[y>>>24]<<24|p[y>>>16&255]<<16|p[y>>>8&255]<<8|p[y&255]),s[d]=E=(s[d-u]^y)>>>0}for(o=0;o<r;o++)d=r-o,o&3?y=s[d]:y=s[d-4],o<4||d<=4?l[o]=y:l[o]=x[p[y>>>24]]^O[p[y>>>16&255]]^A[p[y>>>8&255]]^T[p[y&255]],l[o]=l[o]>>>0},j.networkToHostOrderSwap=function(I){return I<<24|(I&65280)<<8|(I&16711680)>>8|I>>>24},j.decrypt=function(I,m,c){for(var f=this.keySize+6,u=this.invKeySchedule,r=this.invSBox,d=this.invSubMix,o=d[0],s=d[1],l=d[2],p=d[3],R=this.uint8ArrayToUint32Array_(c),w=R[0],x=R[1],O=R[2],A=R[3],T=new Int32Array(I),E=new Int32Array(T.length),y,h,_,g,b,M,P,K,V,B,C,$,ee,re,ue=this.networkToHostOrderSwap;m<T.length;){for(V=ue(T[m]),B=ue(T[m+1]),C=ue(T[m+2]),$=ue(T[m+3]),b=V^u[0],M=$^u[1],P=C^u[2],K=B^u[3],ee=4,re=1;re<f;re++)y=o[b>>>24]^s[M>>16&255]^l[P>>8&255]^p[K&255]^u[ee],h=o[M>>>24]^s[P>>16&255]^l[K>>8&255]^p[b&255]^u[ee+1],_=o[P>>>24]^s[K>>16&255]^l[b>>8&255]^p[M&255]^u[ee+2],g=o[K>>>24]^s[b>>16&255]^l[M>>8&255]^p[P&255]^u[ee+3],b=y,M=h,P=_,K=g,ee=ee+4;y=r[b>>>24]<<24^r[M>>16&255]<<16^r[P>>8&255]<<8^r[K&255]^u[ee],h=r[M>>>24]<<24^r[P>>16&255]<<16^r[K>>8&255]<<8^r[b&255]^u[ee+1],_=r[P>>>24]<<24^r[K>>16&255]<<16^r[b>>8&255]<<8^r[M&255]^u[ee+2],g=r[K>>>24]<<24^r[b>>16&255]<<16^r[M>>8&255]<<8^r[P&255]^u[ee+3],E[m]=ue(y^w),E[m+1]=ue(g^x),E[m+2]=ue(_^O),E[m+3]=ue(h^A),w=V,x=B,O=C,A=$,m=m+4}return E.buffer},W}()},"./src/crypt/decrypter.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return m});var Y=D("./src/crypt/aes-crypto.ts"),F=D("./src/crypt/fast-aes-key.ts"),U=D("./src/crypt/aes-decryptor.ts"),W=D("./src/utils/logger.ts"),j=D("./src/utils/mp4-tools.ts"),k=D("./src/utils/typed-array.ts"),I=16,m=function(){function c(u,r,d){var o=d===void 0?{}:d,s=o.removePKCS7Padding,l=s===void 0?!0:s;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=u,this.config=r,this.removePKCS7Padding=l,l)try{var p=self.crypto;p&&(this.subtle=p.subtle||p.webkitSubtle)}catch(R){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var f=c.prototype;return f.destroy=function(){this.observer=null},f.isSync=function(){return this.config.enableSoftwareAES},f.flush=function(){var r=this.currentResult;if(!r){this.reset();return}var d=new Uint8Array(r);return this.reset(),this.removePKCS7Padding?Object(U.removePadding)(d):d},f.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},f.decrypt=function(r,d,o,s){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(r),d,o);var l=this.flush();l&&s(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(r),d,o).then(s)},f.softwareDecrypt=function(r,d,o){var s=this.currentIV,l=this.currentResult,p=this.remainderData;this.logOnce("JS AES decrypt"),p&&(r=Object(j.appendUint8Array)(p,r),this.remainderData=null);var R=this.getValidChunk(r);if(!R.length)return null;s&&(o=s);var w=this.softwareDecrypter;w||(w=this.softwareDecrypter=new U.default),w.expandKey(d);var x=l;return this.currentResult=w.decrypt(R.buffer,0,o),this.currentIV=Object(k.sliceUint8)(R,-16).buffer,x||null},f.webCryptoDecrypt=function(r,d,o){var s=this,l=this.subtle;return(this.key!==d||!this.fastAesKey)&&(this.key=d,this.fastAesKey=new F.default(l,d)),this.fastAesKey.expandKey().then(function(p){if(!l)return Promise.reject(new Error("web crypto not initialized"));var R=new Y.default(l,o);return R.decrypt(r.buffer,p)}).catch(function(p){return s.onWebCryptoError(p,r,d,o)})},f.onWebCryptoError=function(r,d,o,s){return W.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",r),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(d,o,s)},f.getValidChunk=function(r){var d=r,o=r.length-r.length%I;return o!==r.length&&(d=Object(k.sliceUint8)(r,0,o),this.remainderData=Object(k.sliceUint8)(r,o)),d},f.logOnce=function(r){if(!this.logEnabled)return;W.logger.log("[decrypter.ts]: "+r),this.logEnabled=!1},c}()},"./src/crypt/fast-aes-key.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return Y});var Y=function(){function F(W,j){this.subtle=void 0,this.key=void 0,this.subtle=W,this.key=j}var U=F.prototype;return U.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},F}()},"./src/demux/aacdemuxer.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/demux/base-audio-demuxer.ts"),F=D("./src/demux/adts.ts"),U=D("./src/utils/logger.ts"),W=D("./src/demux/id3.ts");function j(m,c){m.prototype=Object.create(c.prototype),m.prototype.constructor=m,k(m,c)}function k(m,c){return k=Object.setPrototypeOf||function(u,r){return u.__proto__=r,u},k(m,c)}var I=function(m){j(c,m);function c(u,r){var d;return d=m.call(this)||this,d.observer=void 0,d.config=void 0,d.observer=u,d.config=r,d}var f=c.prototype;return f.resetInitSegment=function(r,d,o){m.prototype.resetInitSegment.call(this,r,d,o),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:r,duration:o,inputTimeScale:9e4,dropped:0}},c.probe=function(r){if(!r)return!1;for(var d=W.getID3Data(r,0)||[],o=d.length,s=r.length;o<s;o++)if(F.probe(r,o))return U.logger.log("ADTS sync word found !"),!0;return!1},f.canParse=function(r,d){return F.canParse(r,d)},f.appendFrame=function(r,d,o){F.initTrackConfig(r,this.observer,d,o,r.manifestCodec);var s=F.appendFrame(r,d,o,this.initPTS,this.frameIndex);if(s&&s.missing===0)return s},c}(Y.default);I.minProbeByteLength=9,J.default=I},"./src/demux/adts.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"getAudioConfig",function(){return W}),D.d(J,"isHeaderPattern",function(){return j}),D.d(J,"getHeaderLength",function(){return k}),D.d(J,"getFullFrameLength",function(){return I}),D.d(J,"canGetFrameLength",function(){return m}),D.d(J,"isHeader",function(){return c}),D.d(J,"canParse",function(){return f}),D.d(J,"probe",function(){return u}),D.d(J,"initTrackConfig",function(){return r}),D.d(J,"getFrameDuration",function(){return d}),D.d(J,"parseFrameHeader",function(){return o}),D.d(J,"appendFrame",function(){return s});var Y=D("./src/utils/logger.ts"),F=D("./src/errors.ts"),U=D("./src/events.ts");function W(l,p,R,w){var x,O,A,T,E=navigator.userAgent.toLowerCase(),y=w,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];x=((p[R+2]&192)>>>6)+1;var _=(p[R+2]&60)>>>2;if(_>h.length-1){l.trigger(U.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+_});return}return A=(p[R+2]&1)<<2,A|=(p[R+3]&192)>>>6,Y.logger.log("manifest codec:"+w+", ADTS type:"+x+", samplingIndex:"+_),/firefox/i.test(E)?_>=6?(x=5,T=new Array(4),O=_-3):(x=2,T=new Array(2),O=_):E.indexOf("android")!==-1?(x=2,T=new Array(2),O=_):(x=5,T=new Array(4),w&&(w.indexOf("mp4a.40.29")!==-1||w.indexOf("mp4a.40.5")!==-1)||!w&&_>=6?O=_-3:((w&&w.indexOf("mp4a.40.2")!==-1&&(_>=6&&A===1||/vivaldi/i.test(E))||!w&&A===1)&&(x=2,T=new Array(2)),O=_)),T[0]=x<<3,T[0]|=(_&14)>>1,T[1]|=(_&1)<<7,T[1]|=A<<3,x===5&&(T[1]|=(O&14)>>1,T[2]=(O&1)<<7,T[2]|=2<<2,T[3]=0),{config:T,samplerate:h[_],channelCount:A,codec:"mp4a.40."+x,manifestCodec:y}}function j(l,p){return l[p]===255&&(l[p+1]&246)===240}function k(l,p){return l[p+1]&1?7:9}function I(l,p){return(l[p+3]&3)<<11|l[p+4]<<3|(l[p+5]&224)>>>5}function m(l,p){return p+5<l.length}function c(l,p){return p+1<l.length&&j(l,p)}function f(l,p){return m(l,p)&&j(l,p)&&I(l,p)<=l.length-p}function u(l,p){if(c(l,p)){var R=k(l,p);if(p+R>=l.length)return!1;var w=I(l,p);if(w<=R)return!1;var x=p+w;return x===l.length||c(l,x)}return!1}function r(l,p,R,w,x){if(!l.samplerate){var O=W(p,R,w,x);if(!O)return;l.config=O.config,l.samplerate=O.samplerate,l.channelCount=O.channelCount,l.codec=O.codec,l.manifestCodec=O.manifestCodec,Y.logger.log("parsed codec:"+l.codec+", rate:"+O.samplerate+", channels:"+O.channelCount)}}function d(l){return 1024*9e4/l}function o(l,p,R,w,x){var O=k(l,p),A=I(l,p);if(A-=O,A>0){var T=R+w*x;return{headerLength:O,frameLength:A,stamp:T}}}function s(l,p,R,w,x){var O=d(l.samplerate),A=o(p,R,w,x,O);if(A){var T=A.frameLength,E=A.headerLength,y=A.stamp,h=E+T,_=Math.max(0,R+h-p.length),g;_?(g=new Uint8Array(h-E),g.set(p.subarray(R+E,p.length),0)):g=p.subarray(R+E,R+h);var b={unit:g,pts:y};return _||l.samples.push(b),{sample:b,length:h,missing:_}}}},"./src/demux/base-audio-demuxer.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"initPTSFn",function(){return I});var Y=D("./src/polyfills/number.ts"),F=D("./src/demux/id3.ts"),U=D("./src/demux/dummy-demuxed-track.ts"),W=D("./src/utils/mp4-tools.ts"),j=D("./src/utils/typed-array.ts"),k=function(){function m(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var c=m.prototype;return c.resetInitSegment=function(u,r,d){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},c.resetTimeStamp=function(){},c.resetContiguity=function(){},c.canParse=function(u,r){return!1},c.appendFrame=function(u,r,d){},c.demux=function(u,r){this.cachedData&&(u=Object(W.appendUint8Array)(this.cachedData,u),this.cachedData=null);var d=F.getID3Data(u,0),o=d?d.length:0,s,l,p=this._audioTrack,R=this._id3Track,w=d?F.getTimeStamp(d):void 0,x=u.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=I(w,r)),d&&d.length>0&&R.samples.push({pts:this.initPTS,dts:this.initPTS,data:d}),l=this.initPTS;o<x;){if(this.canParse(u,o)){var O=this.appendFrame(p,u,o);O?(this.frameIndex++,l=O.sample.pts,o+=O.length,s=o):o=x}else F.canParse(u,o)?(d=F.getID3Data(u,o),R.samples.push({pts:l,dts:l,data:d}),o+=d.length,s=o):o++;if(o===x&&s!==x){var A=Object(j.sliceUint8)(u,s);this.cachedData?this.cachedData=Object(W.appendUint8Array)(this.cachedData,A):this.cachedData=A}}return{audioTrack:p,avcTrack:Object(U.dummyTrack)(),id3Track:R,textTrack:Object(U.dummyTrack)()}},c.demuxSampleAes=function(u,r,d){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},c.flush=function(u){var r=this.cachedData;return r&&(this.cachedData=null,this.demux(r,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(U.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(U.dummyTrack)()}},c.destroy=function(){},m}(),I=function(c,f){return Object(Y.isFiniteNumber)(c)?c*90:f*9e4};J.default=k},"./src/demux/chunk-cache.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return Y});var Y=function(){function U(){this.chunks=[],this.dataLength=0}var W=U.prototype;return W.push=function(k){this.chunks.push(k),this.dataLength+=k.length},W.flush=function(){var k=this.chunks,I=this.dataLength,m;if(k.length)k.length===1?m=k[0]:m=F(k,I);else return new Uint8Array(0);return this.reset(),m},W.reset=function(){this.chunks.length=0,this.dataLength=0},U}();function F(U,W){for(var j=new Uint8Array(W),k=0,I=0;I<U.length;I++){var m=U[I];j.set(m,k),k+=m.length}return j}},"./src/demux/dummy-demuxed-track.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"dummyTrack",function(){return Y});function Y(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/utils/logger.ts"),F=function(){function U(j){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=j,this.bytesAvailable=j.byteLength,this.word=0,this.bitsAvailable=0}var W=U.prototype;return W.loadWord=function(){var k=this.data,I=this.bytesAvailable,m=k.byteLength-I,c=new Uint8Array(4),f=Math.min(4,I);if(f===0)throw new Error("no bytes available");c.set(k.subarray(m,m+f)),this.word=new DataView(c.buffer).getUint32(0),this.bitsAvailable=f*8,this.bytesAvailable-=f},W.skipBits=function(k){var I;this.bitsAvailable>k?(this.word<<=k,this.bitsAvailable-=k):(k-=this.bitsAvailable,I=k>>3,k-=I>>3,this.bytesAvailable-=I,this.loadWord(),this.word<<=k,this.bitsAvailable-=k)},W.readBits=function(k){var I=Math.min(this.bitsAvailable,k),m=this.word>>>32-I;return k>32&&Y.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=I,this.bitsAvailable>0?this.word<<=I:this.bytesAvailable>0&&this.loadWord(),I=k-I,I>0&&this.bitsAvailable?m<<I|this.readBits(I):m},W.skipLZ=function(){var k;for(k=0;k<this.bitsAvailable;++k)if((this.word&2147483648>>>k)!==0)return this.word<<=k,this.bitsAvailable-=k,k;return this.loadWord(),k+this.skipLZ()},W.skipUEG=function(){this.skipBits(1+this.skipLZ())},W.skipEG=function(){this.skipBits(1+this.skipLZ())},W.readUEG=function(){var k=this.skipLZ();return this.readBits(k+1)-1},W.readEG=function(){var k=this.readUEG();return 1&k?1+k>>>1:-1*(k>>>1)},W.readBoolean=function(){return this.readBits(1)===1},W.readUByte=function(){return this.readBits(8)},W.readUShort=function(){return this.readBits(16)},W.readUInt=function(){return this.readBits(32)},W.skipScalingList=function(k){for(var I=8,m=8,c,f=0;f<k;f++)m!==0&&(c=this.readEG(),m=(I+c+256)%256),I=m===0?I:m},W.readSPS=function(){var k=0,I=0,m=0,c=0,f,u,r,d=this.readUByte.bind(this),o=this.readBits.bind(this),s=this.readUEG.bind(this),l=this.readBoolean.bind(this),p=this.skipBits.bind(this),R=this.skipEG.bind(this),w=this.skipUEG.bind(this),x=this.skipScalingList.bind(this);d();var O=d();if(o(5),p(3),d(),w(),O===100||O===110||O===122||O===244||O===44||O===83||O===86||O===118||O===128){var A=s();if(A===3&&p(1),w(),w(),p(1),l())for(u=A!==3?8:12,r=0;r<u;r++)l()&&(r<6?x(16):x(64))}w();var T=s();if(T===0)s();else if(T===1)for(p(1),R(),R(),f=s(),r=0;r<f;r++)R();w(),p(1);var E=s(),y=s(),h=o(1);h===0&&p(1),p(1),l()&&(k=s(),I=s(),m=s(),c=s());var _=[1,1];if(l()&&l()){var g=d();switch(g){case 1:_=[1,1];break;case 2:_=[12,11];break;case 3:_=[10,11];break;case 4:_=[16,11];break;case 5:_=[40,33];break;case 6:_=[24,11];break;case 7:_=[20,11];break;case 8:_=[32,11];break;case 9:_=[80,33];break;case 10:_=[18,11];break;case 11:_=[15,11];break;case 12:_=[64,33];break;case 13:_=[160,99];break;case 14:_=[4,3];break;case 15:_=[3,2];break;case 16:_=[2,1];break;case 255:{_=[d()<<8|d(),d()<<8|d()];break}}}return{width:Math.ceil((E+1)*16-k*2-I*2),height:(2-h)*(y+1)*16-(h?2:4)*(m+c),pixelRatio:_}},W.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},U}();J.default=F},"./src/demux/id3.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"isHeader",function(){return Y}),D.d(J,"isFooter",function(){return F}),D.d(J,"getID3Data",function(){return U}),D.d(J,"canParse",function(){return j}),D.d(J,"getTimeStamp",function(){return k}),D.d(J,"isTimeStampFrame",function(){return I}),D.d(J,"getID3Frames",function(){return c}),D.d(J,"decodeFrame",function(){return f}),D.d(J,"utf8ArrayToStr",function(){return s}),D.d(J,"testables",function(){return l});var Y=function(x,O){return O+10<=x.length&&(x[O]===73&&x[O+1]===68&&x[O+2]===51&&(x[O+3]<255&&x[O+4]<255&&(x[O+6]<128&&x[O+7]<128&&x[O+8]<128&&x[O+9]<128)))},F=function(x,O){return O+10<=x.length&&(x[O]===51&&x[O+1]===68&&x[O+2]===73&&(x[O+3]<255&&x[O+4]<255&&(x[O+6]<128&&x[O+7]<128&&x[O+8]<128&&x[O+9]<128)))},U=function(x,O){for(var A=O,T=0;Y(x,O);){T+=10;var E=W(x,O+6);T+=E,F(x,O+10)&&(T+=10),O+=T}return T>0?x.subarray(A,A+T):void 0},W=function(x,O){var A=0;return A=(x[O]&127)<<21,A|=(x[O+1]&127)<<14,A|=(x[O+2]&127)<<7,A|=x[O+3]&127,A},j=function(x,O){return Y(x,O)&&W(x,O+6)+10<=x.length-O},k=function(x){for(var O=c(x),A=0;A<O.length;A++){var T=O[A];if(I(T))return o(T)}return},I=function(x){return x&&x.key==="PRIV"&&x.info==="com.apple.streaming.transportStreamTimestamp"},m=function(x){var O=String.fromCharCode(x[0],x[1],x[2],x[3]),A=W(x,4),T=10;return{type:O,size:A,data:x.subarray(T,T+A)}},c=function(x){for(var O=0,A=[];Y(x,O);){var T=W(x,O+6);O+=10;for(var E=O+T;O+8<E;){var y=m(x.subarray(O)),h=f(y);h&&A.push(h),O+=y.size+10}F(x,O)&&(O+=10)}return A},f=function(x){return x.type==="PRIV"?u(x):x.type[0]==="W"?d(x):r(x)},u=function(x){if(x.size<2)return;var O=s(x.data,!0),A=new Uint8Array(x.data.subarray(O.length+1));return{key:x.type,info:O,data:A.buffer}},r=function(x){if(x.size<2)return;if(x.type==="TXXX"){var O=1,A=s(x.data.subarray(O),!0);O+=A.length+1;var T=s(x.data.subarray(O));return{key:x.type,info:A,data:T}}var E=s(x.data.subarray(1));return{key:x.type,data:E}},d=function(x){if(x.type==="WXXX"){if(x.size<2)return;var O=1,A=s(x.data.subarray(O),!0);O+=A.length+1;var T=s(x.data.subarray(O));return{key:x.type,info:A,data:T}}var E=s(x.data);return{key:x.type,data:E}},o=function(x){if(x.data.byteLength===8){var O=new Uint8Array(x.data),A=O[3]&1,T=(O[4]<<23)+(O[5]<<15)+(O[6]<<7)+O[7];return T/=45,A&&(T+=4772185884e-2),Math.round(T)}return},s=function(x,O){O===void 0&&(O=!1);var A=R();if(A){var T=A.decode(x);if(O){var E=T.indexOf("\0");return E!==-1?T.substring(0,E):T}return T.replace(/\0/g,"")}for(var y=x.length,h,_,g,b="",M=0;M<y;){if(h=x[M++],h===0&&O)return b;if(h===0||h===3)continue;switch(h>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:b+=String.fromCharCode(h);break;case 12:case 13:_=x[M++],b+=String.fromCharCode((h&31)<<6|_&63);break;case 14:_=x[M++],g=x[M++],b+=String.fromCharCode((h&15)<<12|(_&63)<<6|(g&63)<<0);break;default:}}return b},l={decodeTextFrame:r},p;function R(){return!p&&typeof self.TextDecoder!="undefined"&&(p=new self.TextDecoder("utf-8")),p}},"./src/demux/mp3demuxer.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/demux/base-audio-demuxer.ts"),F=D("./src/demux/id3.ts"),U=D("./src/utils/logger.ts"),W=D("./src/demux/mpegaudio.ts");function j(m,c){m.prototype=Object.create(c.prototype),m.prototype.constructor=m,k(m,c)}function k(m,c){return k=Object.setPrototypeOf||function(u,r){return u.__proto__=r,u},k(m,c)}var I=function(m){j(c,m);function c(){return m.apply(this,arguments)||this}var f=c.prototype;return f.resetInitSegment=function(r,d,o){m.prototype.resetInitSegment.call(this,r,d,o),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:r,duration:o,inputTimeScale:9e4,dropped:0}},c.probe=function(r){if(!r)return!1;for(var d=F.getID3Data(r,0)||[],o=d.length,s=r.length;o<s;o++)if(W.probe(r,o))return U.logger.log("MPEG Audio sync word found !"),!0;return!1},f.canParse=function(r,d){return W.canParse(r,d)},f.appendFrame=function(r,d,o){return this.initPTS===null?void 0:W.appendFrame(r,d,o,this.initPTS,this.frameIndex)},c}(Y.default);I.minProbeByteLength=4,J.default=I},"./src/demux/mp4demuxer.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/utils/mp4-tools.ts"),F=D("./src/demux/dummy-demuxed-track.ts"),U=function(){function W(k,I){this.remainderData=null,this.config=void 0,this.config=I}var j=W.prototype;return j.resetTimeStamp=function(){},j.resetInitSegment=function(){},j.resetContiguity=function(){},W.probe=function(I){return Object(Y.findBox)({data:I,start:0,end:Math.min(I.length,16384)},["moof"]).length>0},j.demux=function(I){var m=I,c=Object(F.dummyTrack)();if(this.config.progressive){this.remainderData&&(m=Object(Y.appendUint8Array)(this.remainderData,I));var f=Object(Y.segmentValidRange)(m);this.remainderData=f.remainder,c.samples=f.valid||new Uint8Array}else c.samples=m;return{audioTrack:Object(F.dummyTrack)(),avcTrack:c,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},j.flush=function(){var I=Object(F.dummyTrack)();return I.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(F.dummyTrack)(),avcTrack:I,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},j.demuxSampleAes=function(I,m,c){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},j.destroy=function(){},W}();U.minProbeByteLength=1024,J.default=U},"./src/demux/mpegaudio.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"appendFrame",function(){return k}),D.d(J,"parseHeader",function(){return I}),D.d(J,"isHeaderPattern",function(){return m}),D.d(J,"isHeader",function(){return c}),D.d(J,"canParse",function(){return f}),D.d(J,"probe",function(){return u});var Y=null,F=[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],U=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],W=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],j=[0,1,1,4];function k(r,d,o,s,l){if(o+24>d.length)return;var p=I(d,o);if(p&&o+p.frameLength<=d.length){var R=p.samplesPerFrame*9e4/p.sampleRate,w=s+l*R,x={unit:d.subarray(o,o+p.frameLength),pts:w,dts:w};return r.config=[],r.channelCount=p.channelCount,r.samplerate=p.sampleRate,r.samples.push(x),{sample:x,length:p.frameLength,missing:0}}}function I(r,d){var o=r[d+1]>>3&3,s=r[d+1]>>1&3,l=r[d+2]>>4&15,p=r[d+2]>>2&3;if(o!==1&&l!==0&&l!==15&&p!==3){var R=r[d+2]>>1&1,w=r[d+3]>>6,x=o===3?3-s:s===3?3:4,O=F[x*14+l-1]*1e3,A=o===3?0:o===2?1:2,T=U[A*3+p],E=w===3?1:2,y=W[o][s],h=j[s],_=y*8*h,g=Math.floor(y*O/T+R)*h;if(Y===null){var b=navigator.userAgent||"",M=b.match(/Chrome\/(\d+)/i);Y=M?parseInt(M[1]):0}var P=!!Y&&Y<=87;return P&&s===2&&O>=224e3&&w===0&&(r[d+3]=r[d+3]|128),{sampleRate:T,channelCount:E,frameLength:g,samplesPerFrame:_}}}function m(r,d){return r[d]===255&&(r[d+1]&224)===224&&(r[d+1]&6)!==0}function c(r,d){return d+1<r.length&&m(r,d)}function f(r,d){var o=4;return m(r,d)&&o<=r.length-d}function u(r,d){if(d+1<r.length&&m(r,d)){var o=4,s=I(r,d),l=o;s!=null&&s.frameLength&&(l=s.frameLength);var p=d+l;return p===r.length||c(r,p)}return!1}},"./src/demux/sample-aes.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/crypt/decrypter.ts"),F=D("./src/demux/tsdemuxer.ts"),U=function(){function W(k,I,m){this.keyData=void 0,this.decrypter=void 0,this.keyData=m,this.decrypter=new Y.default(k,I,{removePKCS7Padding:!1})}var j=W.prototype;return j.decryptBuffer=function(I,m){this.decrypter.decrypt(I,this.keyData.key.buffer,this.keyData.iv.buffer,m)},j.decryptAacSample=function(I,m,c,f){var u=I[m].unit,r=u.subarray(16,u.length-u.length%16),d=r.buffer.slice(r.byteOffset,r.byteOffset+r.length),o=this;this.decryptBuffer(d,function(s){var l=new Uint8Array(s);u.set(l,16),f||o.decryptAacSamples(I,m+1,c)})},j.decryptAacSamples=function(I,m,c){for(;;m++){if(m>=I.length){c();return}if(I[m].unit.length<32)continue;var f=this.decrypter.isSync();if(this.decryptAacSample(I,m,c,f),!f)return}},j.getAvcEncryptedData=function(I){for(var m=Math.floor((I.length-48)/160)*16+16,c=new Int8Array(m),f=0,u=32;u<=I.length-16;u+=160,f+=16)c.set(I.subarray(u,u+16),f);return c},j.getAvcDecryptedUnit=function(I,m){for(var c=new Uint8Array(m),f=0,u=32;u<=I.length-16;u+=160,f+=16)I.set(c.subarray(f,f+16),u);return I},j.decryptAvcSample=function(I,m,c,f,u,r){var d=Object(F.discardEPB)(u.data),o=this.getAvcEncryptedData(d),s=this;this.decryptBuffer(o.buffer,function(l){u.data=s.getAvcDecryptedUnit(d,l),r||s.decryptAvcSamples(I,m,c+1,f)})},j.decryptAvcSamples=function(I,m,c,f){if(I instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;m++,c=0){if(m>=I.length){f();return}for(var u=I[m].units;!(c>=u.length);c++){var r=u[c];if(r.data.length<=48||r.type!==1&&r.type!==5)continue;var d=this.decrypter.isSync();if(this.decryptAvcSample(I,m,c,f,r,d),!d)return}}},W}();J.default=U},"./src/demux/transmuxer-interface.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return u});var Y=D("./node_modules/webworkify-webpack/index.js"),F=D.n(Y),U=D("./src/events.ts"),W=D("./src/demux/transmuxer.ts"),j=D("./src/utils/logger.ts"),k=D("./src/errors.ts"),I=D("./src/utils/mediasource-helper.ts"),m=D("./node_modules/eventemitter3/index.js"),c=D.n(m),f=Object(I.getMediaSource)()||{isTypeSupported:function(){return!1}},u=function(){function r(o,s,l,p){var R=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=o,this.id=s,this.onTransmuxComplete=l,this.onFlush=p;var w=o.config,x=function(y,h){h=h||{},h.frag=R.frag,h.id=R.id,o.trigger(y,h)};this.observer=new m.EventEmitter,this.observer.on(U.Events.FRAG_DECRYPTED,x),this.observer.on(U.Events.ERROR,x);var O={mp4:f.isTypeSupported("video/mp4"),mpeg:f.isTypeSupported("audio/mpeg"),mp3:f.isTypeSupported('audio/mp4; codecs="mp3"')},A=navigator.vendor;if(w.enableWorker&&typeof Worker!="undefined"){j.logger.log("demuxing in webworker");var T;try{T=this.worker=Y("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),T.addEventListener("message",this.onwmsg),T.onerror=function(E){o.trigger(U.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(E.message+" ("+E.filename+":"+E.lineno+")")})},T.postMessage({cmd:"init",typeSupported:O,vendor:A,id:s,config:JSON.stringify(w)})}catch(E){j.logger.warn("Error in worker:",E),j.logger.error("Error while initializing DemuxerWorker, fallback to inline"),T&&self.URL.revokeObjectURL(T.objectURL),this.transmuxer=new W.default(this.observer,O,w,A,s),this.worker=null}}else this.transmuxer=new W.default(this.observer,O,w,A,s)}var d=r.prototype;return d.destroy=function(){var s=this.worker;if(s)s.removeEventListener("message",this.onwmsg),s.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var p=this.observer;p&&p.removeAllListeners(),this.observer=null},d.push=function(s,l,p,R,w,x,O,A,T,E){var y=this;T.transmuxing.start=self.performance.now();var h=this.transmuxer,_=this.worker,g=x?x.start:w.start,b=w.decryptdata,M=this.frag,P=!(M&&w.cc===M.cc),K=!(M&&T.level===M.level),V=M?T.sn-M.sn:-1,B=this.part?T.part-this.part.index:1,C=!K&&(V===1||V===0&&B===1),$=self.performance.now();(K||V||w.stats.parsing.start===0)&&(w.stats.parsing.start=$),x&&(B||!C)&&(x.stats.parsing.start=$);var ee=new W.TransmuxState(P,C,A,K,g);if(!C||P){j.logger.log("[transmuxer-interface, "+w.type+"]: Starting new transmux session for sn: "+T.sn+" p: "+T.part+" level: "+T.level+" id: "+T.id+`
|
|
discontinuity: `+P+`
|
|
trackSwitch: `+K+`
|
|
contiguous: `+C+`
|
|
accurateTimeOffset: `+A+`
|
|
timeOffset: `+g);var re=new W.TransmuxConfig(p,R,l,O,E);this.configureTransmuxer(re)}if(this.frag=w,this.part=x,_)_.postMessage({cmd:"demux",data:s,decryptdata:b,chunkMeta:T,state:ee},s instanceof ArrayBuffer?[s]:[]);else if(h){var ue=h.push(s,b,T,ee);Object(W.isPromise)(ue)?ue.then(function(Te){y.handleTransmuxComplete(Te)}):this.handleTransmuxComplete(ue)}},d.flush=function(s){var l=this;s.transmuxing.start=self.performance.now();var p=this.transmuxer,R=this.worker;if(R)R.postMessage({cmd:"flush",chunkMeta:s});else if(p){var w=p.flush(s);Object(W.isPromise)(w)?w.then(function(x){l.handleFlushResult(x,s)}):this.handleFlushResult(w,s)}},d.handleFlushResult=function(s,l){var p=this;s.forEach(function(R){p.handleTransmuxComplete(R)}),this.onFlush(l)},d.onWorkerMessage=function(s){var l=s.data,p=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,p.trigger(l.event,l.data);break}}},d.configureTransmuxer=function(s){var l=this.worker,p=this.transmuxer;l?l.postMessage({cmd:"configure",config:s}):p&&p.configure(s)},d.handleTransmuxComplete=function(s){s.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(s)},r}()},"./src/demux/transmuxer-worker.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return k});var Y=D("./src/demux/transmuxer.ts"),F=D("./src/events.ts"),U=D("./src/utils/logger.ts"),W=D("./node_modules/eventemitter3/index.js"),j=D.n(W);function k(u){var r=new W.EventEmitter,d=function(s,l){u.postMessage({event:s,data:l})};r.on(F.Events.FRAG_DECRYPTED,d),r.on(F.Events.ERROR,d),u.addEventListener("message",function(o){var s=o.data;switch(s.cmd){case"init":{var l=JSON.parse(s.config);u.transmuxer=new Y.default(r,s.typeSupported,l,s.vendor,s.id),Object(U.enableLogs)(l.debug),d("init",null);break}case"configure":{u.transmuxer.configure(s.config);break}case"demux":{var p=u.transmuxer.push(s.data,s.decryptdata,s.chunkMeta,s.state);Object(Y.isPromise)(p)?p.then(function(x){I(u,x)}):I(u,p);break}case"flush":{var R=s.chunkMeta,w=u.transmuxer.flush(R);Object(Y.isPromise)(w)?w.then(function(x){c(u,x,R)}):c(u,w,R);break}default:break}})}function I(u,r){if(f(r.remuxResult))return;var d=[],o=r.remuxResult,s=o.audio,l=o.video;s&&m(d,s),l&&m(d,l),u.postMessage({event:"transmuxComplete",data:r},d)}function m(u,r){r.data1&&u.push(r.data1.buffer),r.data2&&u.push(r.data2.buffer)}function c(u,r,d){r.forEach(function(o){I(u,o)}),u.postMessage({event:"flush",data:d})}function f(u){return!u.audio&&!u.video&&!u.text&&!u.id3&&!u.initSegment}},"./src/demux/transmuxer.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return l}),D.d(J,"isPromise",function(){return w}),D.d(J,"TransmuxConfig",function(){return x}),D.d(J,"TransmuxState",function(){return O});var Y=D("./src/events.ts"),F=D("./src/errors.ts"),U=D("./src/crypt/decrypter.ts"),W=D("./src/demux/aacdemuxer.ts"),j=D("./src/demux/mp4demuxer.ts"),k=D("./src/demux/tsdemuxer.ts"),I=D("./src/demux/mp3demuxer.ts"),m=D("./src/remux/mp4-remuxer.ts"),c=D("./src/remux/passthrough-remuxer.ts"),f=D("./src/demux/chunk-cache.ts"),u=D("./src/utils/mp4-tools.ts"),r=D("./src/utils/logger.ts"),d;try{d=self.performance.now.bind(self.performance)}catch(A){r.logger.debug("Unable to use Performance API on this environment"),d=self.Date.now}var o=[{demux:k.default,remux:m.default},{demux:j.default,remux:c.default},{demux:W.default,remux:m.default},{demux:I.default,remux:m.default}],s=1024;o.forEach(function(A){var T=A.demux;s=Math.max(s,T.minProbeByteLength)});var l=function(){function A(E,y,h,_,g){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 f.default,this.observer=E,this.typeSupported=y,this.config=h,this.vendor=_,this.id=g}var T=A.prototype;return T.configure=function(y){this.transmuxConfig=y,this.decrypter&&this.decrypter.reset()},T.push=function(y,h,_,g){var b=this,M=_.transmuxing;M.executeStart=d();var P=new Uint8Array(y),K=this.cache,V=this.config,B=this.currentTransmuxState,C=this.transmuxConfig;g&&(this.currentTransmuxState=g);var $=p(P,h);if($&&$.method==="AES-128"){var ee=this.getDecrypter();if(V.enableSoftwareAES){var re=ee.softwareDecrypt(P,$.key.buffer,$.iv.buffer);if(!re)return M.executeEnd=d(),R(_);P=new Uint8Array(re)}else return this.decryptionPromise=ee.webCryptoDecrypt(P,$.key.buffer,$.iv.buffer).then(function(Le){var Ue=b.push(Le,null,_);return b.decryptionPromise=null,Ue}),this.decryptionPromise}var ue=g||B,Te=ue.contiguous,ye=ue.discontinuity,be=ue.trackSwitch,we=ue.accurateTimeOffset,xe=ue.timeOffset,me=C.audioCodec,se=C.videoCodec,Re=C.defaultInitPts,ze=C.duration,He=C.initSegmentData;if((ye||be)&&this.resetInitSegment(He,me,se,ze),ye&&this.resetInitialTimestamp(Re),Te||this.resetContiguity(),this.needsProbing(P,ye,be)){if(K.dataLength){var rt=K.flush();P=Object(u.appendUint8Array)(rt,P)}this.configureTransmuxer(P,C)}var ot=this.transmux(P,$,xe,we,_),Oe=this.currentTransmuxState;return Oe.contiguous=!0,Oe.discontinuity=!1,Oe.trackSwitch=!1,M.executeEnd=d(),ot},T.flush=function(y){var h=this,_=y.transmuxing;_.executeStart=d();var g=this.decrypter,b=this.cache,M=this.currentTransmuxState,P=this.decryptionPromise;if(P)return P.then(function(){return h.flush(y)});var K=[],V=M.timeOffset;if(g){var B=g.flush();B&&K.push(this.push(B,null,y))}var C=b.dataLength;b.reset();var $=this.demuxer,ee=this.remuxer;if(!$||!ee)return C>=s&&this.observer.emit(Y.Events.ERROR,Y.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),_.executeEnd=d(),[R(y)];var re=$.flush(V);return w(re)?re.then(function(ue){return h.flushRemux(K,ue,y),K}):(this.flushRemux(K,re,y),K)},T.flushRemux=function(y,h,_){var g=h.audioTrack,b=h.avcTrack,M=h.id3Track,P=h.textTrack,K=this.currentTransmuxState,V=K.accurateTimeOffset,B=K.timeOffset;r.logger.log("[transmuxer.ts]: Flushed fragment "+_.sn+(_.part>-1?" p: "+_.part:"")+" of level "+_.level);var C=this.remuxer.remux(g,b,M,P,B,V,!0,this.id);y.push({remuxResult:C,chunkMeta:_}),_.transmuxing.executeEnd=d()},T.resetInitialTimestamp=function(y){var h=this.demuxer,_=this.remuxer;if(!h||!_)return;h.resetTimeStamp(y),_.resetTimeStamp(y)},T.resetContiguity=function(){var y=this.demuxer,h=this.remuxer;if(!y||!h)return;y.resetContiguity(),h.resetNextTimestamp()},T.resetInitSegment=function(y,h,_,g){var b=this.demuxer,M=this.remuxer;if(!b||!M)return;b.resetInitSegment(h,_,g),M.resetInitSegment(y,h,_)},T.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},T.transmux=function(y,h,_,g,b){var M;return h&&h.method==="SAMPLE-AES"?M=this.transmuxSampleAes(y,h,_,g,b):M=this.transmuxUnencrypted(y,_,g,b),M},T.transmuxUnencrypted=function(y,h,_,g){var b=this.demuxer.demux(y,h,!1,!this.config.progressive),M=b.audioTrack,P=b.avcTrack,K=b.id3Track,V=b.textTrack,B=this.remuxer.remux(M,P,K,V,h,_,!1,this.id);return{remuxResult:B,chunkMeta:g}},T.transmuxSampleAes=function(y,h,_,g,b){var M=this;return this.demuxer.demuxSampleAes(y,h,_).then(function(P){var K=M.remuxer.remux(P.audioTrack,P.avcTrack,P.id3Track,P.textTrack,_,g,!1,M.id);return{remuxResult:K,chunkMeta:b}})},T.configureTransmuxer=function(y,h){for(var _=this.config,g=this.observer,b=this.typeSupported,M=this.vendor,P=h.audioCodec,K=h.defaultInitPts,V=h.duration,B=h.initSegmentData,C=h.videoCodec,$,ee=0,re=o.length;ee<re;ee++)if(o[ee].demux.probe(y)){$=o[ee];break}$||(r.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),$={demux:j.default,remux:c.default});var ue=this.demuxer,Te=this.remuxer,ye=$.remux,be=$.demux;(!Te||!(Te instanceof ye))&&(this.remuxer=new ye(g,_,b,M)),(!ue||!(ue instanceof be))&&(this.demuxer=new be(g,_,b),this.probe=be.probe),this.resetInitSegment(B,P,C,V),this.resetInitialTimestamp(K)},T.needsProbing=function(y,h,_){return!this.demuxer||!this.remuxer||h||_},T.getDecrypter=function(){var y=this.decrypter;return y||(y=this.decrypter=new U.default(this.observer,this.config)),y},A}();function p(A,T){var E=null;return A.byteLength>0&&T!=null&&T.key!=null&&T.iv!==null&&T.method!=null&&(E=T),E}var R=function(T){return{remuxResult:{},chunkMeta:T}};function w(A){return"then"in A&&A.then instanceof Function}var x=function(T,E,y,h,_){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=T,this.videoCodec=E,this.initSegmentData=y,this.duration=h,this.defaultInitPts=_},O=function(T,E,y,h,_){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=T,this.contiguous=E,this.accurateTimeOffset=y,this.trackSwitch=h,this.timeOffset=_}},"./src/demux/tsdemuxer.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"discardEPB",function(){return R});var Y=D("./src/demux/adts.ts"),F=D("./src/demux/mpegaudio.ts"),U=D("./src/demux/exp-golomb.ts"),W=D("./src/demux/id3.ts"),j=D("./src/demux/sample-aes.ts"),k=D("./src/events.ts"),I=D("./src/utils/mp4-tools.ts"),m=D("./src/utils/logger.ts"),c=D("./src/errors.ts"),f={video:1,audio:2,id3:3,text:4},u=function(){function w(O,A,T){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=O,this.config=A,this.typeSupported=T}w.probe=function(A){var T=w.syncOffset(A);return T<0?!1:(T&&m.logger.warn("MPEG2-TS detected but first sync word found @ offset "+T+", junk ahead ?"),!0)},w.syncOffset=function(A){for(var T=Math.min(1e3,A.length-3*188),E=0;E<T;){if(A[E]===71&&A[E+188]===71&&A[E+2*188]===71)return E;E++}return-1},w.createTrack=function(A,T){return{container:A==="video"||A==="audio"?"video/mp2t":void 0,type:A,id:f[A],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:A==="audio"?T:void 0}};var x=w.prototype;return x.resetInitSegment=function(A,T,E){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=w.createTrack("video",E),this._audioTrack=w.createTrack("audio",E),this._id3Track=w.createTrack("id3",E),this._txtTrack=w.createTrack("text",E),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=A,this.videoCodec=T,this._duration=E},x.resetTimeStamp=function(){},x.resetContiguity=function(){var A=this._audioTrack,T=this._avcTrack,E=this._id3Track;A&&(A.pesData=null),T&&(T.pesData=null),E&&(E.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},x.demux=function(A,T,E,y){E===void 0&&(E=!1),y===void 0&&(y=!1),E||(this.sampleAes=null);var h,_=this._avcTrack,g=this._audioTrack,b=this._id3Track,M=_.pid,P=_.pesData,K=g.pid,V=b.pid,B=g.pesData,C=b.pesData,$=!1,ee=this.pmtParsed,re=this._pmtId,ue=A.length;if(this.remainderData&&(A=Object(I.appendUint8Array)(this.remainderData,A),ue=A.length,this.remainderData=null),ue<188&&!y)return this.remainderData=A,{audioTrack:g,avcTrack:_,id3Track:b,textTrack:this._txtTrack};var Te=Math.max(0,w.syncOffset(A));ue-=(ue+Te)%188,ue<A.byteLength&&!y&&(this.remainderData=new Uint8Array(A.buffer,ue,A.buffer.byteLength-ue));for(var ye=Te;ye<ue;ye+=188)if(A[ye]===71){var be=!!(A[ye+1]&64),we=((A[ye+1]&31)<<8)+A[ye+2],xe=(A[ye+3]&48)>>4,me=void 0;if(xe>1){if(me=ye+5+A[ye+4],me===ye+188)continue}else me=ye+4;switch(we){case M:be&&(P&&(h=s(P))&&this.parseAVCPES(h,!1),P={data:[],size:0}),P&&(P.data.push(A.subarray(me,ye+188)),P.size+=ye+188-me);break;case K:be&&(B&&(h=s(B))&&(g.isAAC?this.parseAACPES(h):this.parseMPEGPES(h)),B={data:[],size:0}),B&&(B.data.push(A.subarray(me,ye+188)),B.size+=ye+188-me);break;case V:be&&(C&&(h=s(C))&&this.parseID3PES(h),C={data:[],size:0}),C&&(C.data.push(A.subarray(me,ye+188)),C.size+=ye+188-me);break;case 0:be&&(me+=A[me]+1),re=this._pmtId=d(A,me);break;case re:{be&&(me+=A[me]+1);var se=o(A,me,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,E);M=se.avc,M>0&&(_.pid=M),K=se.audio,K>0&&(g.pid=K,g.isAAC=se.isAAC),V=se.id3,V>0&&(b.pid=V),$&&!ee&&(m.logger.log("reparse from beginning"),$=!1,ye=Te-188),ee=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=!0;break}}else this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:c.ErrorTypes.MEDIA_ERROR,details:c.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});_.pesData=P,g.pesData=B,b.pesData=C;var Re={audioTrack:g,avcTrack:_,id3Track:b,textTrack:this._txtTrack};return y&&this.extractRemainingSamples(Re),Re},x.flush=function(){var A=this.remainderData;this.remainderData=null;var T;return A?T=this.demux(A,-1,!1,!0):T={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(T),this.sampleAes?this.decrypt(T,this.sampleAes):T},x.extractRemainingSamples=function(A){var T=A.audioTrack,E=A.avcTrack,y=A.id3Track,h=E.pesData,_=T.pesData,g=y.pesData,b;h&&(b=s(h))?(this.parseAVCPES(b,!0),E.pesData=null):E.pesData=h,_&&(b=s(_))?(T.isAAC?this.parseAACPES(b):this.parseMPEGPES(b),T.pesData=null):(_!=null&&_.size&&m.logger.log("last AAC PES packet truncated,might overlap between fragments"),T.pesData=_),g&&(b=s(g))?(this.parseID3PES(b),y.pesData=null):y.pesData=g},x.demuxSampleAes=function(A,T,E){var y=this.demux(A,E,!0,!this.config.progressive),h=this.sampleAes=new j.default(this.observer,this.config,T);return this.decrypt(y,h)},x.decrypt=function(A,T){return new Promise(function(E){var y=A.audioTrack,h=A.avcTrack;y.samples&&y.isAAC?T.decryptAacSamples(y.samples,0,function(){h.samples?T.decryptAvcSamples(h.samples,0,0,function(){E(A)}):E(A)}):h.samples&&T.decryptAvcSamples(h.samples,0,0,function(){E(A)})})},x.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},x.parseAVCPES=function(A,T){var E=this,y=this._avcTrack,h=this.parseAVCNALu(A.data),_=!1,g=this.avcSample,b,M=!1;A.data=null,g&&h.length&&!y.audFound&&(l(g,y),g=this.avcSample=r(!1,A.pts,A.dts,"")),h.forEach(function(P){switch(P.type){case 1:{b=!0,g||(g=E.avcSample=r(!0,A.pts,A.dts,"")),_&&(g.debug+="NDR "),g.frame=!0;var K=P.data;if(M&&K.length>4){var V=new U.default(K).readSliceType();(V===2||V===4||V===7||V===9)&&(g.key=!0)}break}case 5:b=!0,g||(g=E.avcSample=r(!0,A.pts,A.dts,"")),_&&(g.debug+="IDR "),g.key=!0,g.frame=!0;break;case 6:{b=!0,_&&g&&(g.debug+="SEI ");var B=new U.default(R(P.data));B.readUByte();for(var C=0,$=0,ee=!1,re=0;!ee&&B.bytesAvailable>1;){C=0;do re=B.readUByte(),C+=re;while(re===255);$=0;do re=B.readUByte(),$+=re;while(re===255);if(C===4&&B.bytesAvailable!==0){ee=!0;var ue=B.readUByte();if(ue===181){var Te=B.readUShort();if(Te===49){var ye=B.readUInt();if(ye===1195456820){var be=B.readUByte();if(be===3){for(var we=B.readUByte(),xe=B.readUByte(),me=31&we,se=[we,xe],Re=0;Re<me;Re++)se.push(B.readUByte()),se.push(B.readUByte()),se.push(B.readUByte());p(E._txtTrack.samples,{type:3,pts:A.pts,bytes:se})}}}}}else if(C===5&&B.bytesAvailable!==0){if(ee=!0,$>16){for(var ze=[],He=0;He<16;He++)ze.push(B.readUByte().toString(16)),(He===3||He===5||He===7||He===9)&&ze.push("-");for(var rt=$-16,ot=new Uint8Array(rt),Oe=0;Oe<rt;Oe++)ot[Oe]=B.readUByte();p(E._txtTrack.samples,{pts:A.pts,payloadType:C,uuid:ze.join(""),userData:Object(W.utf8ArrayToStr)(ot),userDataBytes:ot})}}else if($<B.bytesAvailable)for(var Le=0;Le<$;Le++)B.readUByte()}break}case 7:if(b=!0,M=!0,_&&g&&(g.debug+="SPS "),!y.sps){var Ue=new U.default(P.data),Ge=Ue.readSPS();y.width=Ge.width,y.height=Ge.height,y.pixelRatio=Ge.pixelRatio,y.sps=[P.data],y.duration=E._duration;for(var je=P.data.subarray(1,4),Me="avc1.",Pe=0;Pe<3;Pe++){var ut=je[Pe].toString(16);ut.length<2&&(ut="0"+ut),Me+=ut}y.codec=Me}break;case 8:b=!0,_&&g&&(g.debug+="PPS "),y.pps||(y.pps=[P.data]);break;case 9:b=!1,y.audFound=!0,g&&l(g,y),g=E.avcSample=r(!1,A.pts,A.dts,_?"AUD ":"");break;case 12:b=!1;break;default:b=!1,g&&(g.debug+="unknown NAL "+P.type+" ");break}if(g&&b){var tt=g.units;tt.push(P)}}),T&&g&&(l(g,y),this.avcSample=null)},x.getLastNalUnit=function(){var A,T=this.avcSample,E;if(!T||T.units.length===0){var y=this._avcTrack.samples;T=y[y.length-1]}if((A=T)!==null&&A!==void 0&&A.units){var h=T.units;E=h[h.length-1]}return E},x.parseAVCNALu=function(A){var T=A.byteLength,E=this._avcTrack,y=E.naluState||0,h=y,_=[],g=0,b,M,P,K=-1,V=0;for(y===-1&&(K=0,V=A[0]&31,y=0,g=1);g<T;){if(b=A[g++],!y){y=b?0:1;continue}if(y===1){y=b?0:2;continue}if(!b)y=3;else if(b===1){if(K>=0){var B={data:A.subarray(K,g-y-1),type:V};_.push(B)}else{var C=this.getLastNalUnit();if(C&&(h&&g<=4-h&&(C.state&&(C.data=C.data.subarray(0,C.data.byteLength-h))),M=g-y-1,M>0)){var $=new Uint8Array(C.data.byteLength+M);$.set(C.data,0),$.set(A.subarray(0,M),C.data.byteLength),C.data=$,C.state=0}}g<T?(P=A[g]&31,K=g,V=P,y=0):y=-1}else y=0}if(K>=0&&y>=0){var ee={data:A.subarray(K,T),type:V,state:y};_.push(ee)}if(_.length===0){var re=this.getLastNalUnit();if(re){var ue=new Uint8Array(re.data.byteLength+A.byteLength);ue.set(re.data,0),ue.set(A,re.data.byteLength),re.data=ue}}return E.naluState=y,_},x.parseAACPES=function(A){var T=0,E=this._audioTrack,y=this.aacOverFlow,h=A.data;if(y){this.aacOverFlow=null;var _=y.sample.unit.byteLength,g=Math.min(y.missing,_),b=_-g;y.sample.unit.set(h.subarray(0,g),b),E.samples.push(y.sample),T=y.missing}var M,P;for(M=T,P=h.length;M<P-1&&!Y.isHeader(h,M);M++);if(M!==T){var K,V;if(M<P-1?(K="AAC PES did not start with ADTS header,offset:"+M,V=!1):(K="no ADTS header found in AAC PES",V=!0),m.logger.warn("parsing error:"+K),this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:c.ErrorTypes.MEDIA_ERROR,details:c.ErrorDetails.FRAG_PARSING_ERROR,fatal:V,reason:K}),V)return}Y.initTrackConfig(E,this.observer,h,M,this.audioCodec);var B;if(A.pts!==void 0)B=A.pts;else if(y){var C=Y.getFrameDuration(E.samplerate);B=y.sample.pts+C}else{m.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var $=0;M<P;)if(Y.isHeader(h,M)){if(M+5<P){var ee=Y.appendFrame(E,h,M,B,$);if(ee)if(ee.missing)this.aacOverFlow=ee;else{M+=ee.length,$++;continue}}break}else M++},x.parseMPEGPES=function(A){var T=A.data,E=T.length,y=0,h=0,_=A.pts;if(_===void 0){m.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;h<E;)if(F.isHeader(T,h)){var g=F.appendFrame(this._audioTrack,T,h,_,y);if(g)h+=g.length,y++;else break}else h++},x.parseID3PES=function(A){if(A.pts===void 0){m.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(A)},w}();u.minProbeByteLength=188;function r(w,x,O,A){return{key:w,frame:!1,pts:x,dts:O,units:[],debug:A,length:0}}function d(w,x){return(w[x+10]&31)<<8|w[x+11]}function o(w,x,O,A){var T={audio:-1,avc:-1,id3:-1,isAAC:!0},E=(w[x+1]&15)<<8|w[x+2],y=x+3+E-4,h=(w[x+10]&15)<<8|w[x+11];for(x+=12+h;x<y;){var _=(w[x+1]&31)<<8|w[x+2];switch(w[x]){case 207:if(!A){m.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:T.audio===-1&&(T.audio=_);break;case 21:T.id3===-1&&(T.id3=_);break;case 219:if(!A){m.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:T.avc===-1&&(T.avc=_);break;case 3:case 4:O?T.audio===-1&&(T.audio=_,T.isAAC=!1):m.logger.log("MPEG audio found, not supported in this browser");break;case 36:m.logger.warn("Unsupported HEVC stream type found");break;default:break}x+=((w[x+3]&15)<<8|w[x+4])+5}return T}function s(w){var x=0,O,A,T,E,y,h=w.data;if(!w||w.size===0)return null;for(;h[0].length<19&&h.length>1;){var _=new Uint8Array(h[0].length+h[1].length);_.set(h[0]),_.set(h[1],h[0].length),h[0]=_,h.splice(1,1)}O=h[0];var g=(O[0]<<16)+(O[1]<<8)+O[2];if(g===1){if(A=(O[4]<<8)+O[5],A&&A>w.size-6)return null;var b=O[7];b&192&&(E=(O[9]&14)*536870912+(O[10]&255)*4194304+(O[11]&254)*16384+(O[12]&255)*128+(O[13]&254)/2,b&64?(y=(O[14]&14)*536870912+(O[15]&255)*4194304+(O[16]&254)*16384+(O[17]&255)*128+(O[18]&254)/2,E-y>60*9e4&&(m.logger.warn(Math.round((E-y)/9e4)+"s delta between PTS and DTS, align them"),E=y)):y=E),T=O[8];var M=T+9;if(w.size<=M)return null;w.size-=M;for(var P=new Uint8Array(w.size),K=0,V=h.length;K<V;K++){O=h[K];var B=O.byteLength;if(M)if(M>B){M-=B;continue}else O=O.subarray(M),B-=M,M=0;P.set(O,x),x+=B}return A&&(A-=T+3),{data:P,pts:E,dts:y,len:A}}return null}function l(w,x){if(w.units.length&&w.frame){if(w.pts===void 0){var O=x.samples,A=O.length;if(A){var T=O[A-1];w.pts=T.pts,w.dts=T.dts}else{x.dropped++;return}}x.samples.push(w)}w.debug.length&&m.logger.log(w.pts+"/"+w.dts+":"+w.debug)}function p(w,x){var O=w.length;if(O>0){if(x.pts>=w[O-1].pts)w.push(x);else for(var A=O-1;A>=0;A--)if(x.pts<w[A].pts){w.splice(A,0,x);break}}else w.push(x)}function R(w){for(var x=w.byteLength,O=[],A=1;A<x-2;)w[A]===0&&w[A+1]===0&&w[A+2]===3?(O.push(A+2),A+=2):A++;if(O.length===0)return w;var T=x-O.length,E=new Uint8Array(T),y=0;for(A=0;A<T;y++,A++)y===O[0]&&(y++,O.shift()),E[A]=w[y];return E}J.default=u},"./src/errors.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"ErrorTypes",function(){return Y}),D.d(J,"ErrorDetails",function(){return F});var Y;(function(U){U.NETWORK_ERROR="networkError",U.MEDIA_ERROR="mediaError",U.KEY_SYSTEM_ERROR="keySystemError",U.MUX_ERROR="muxError",U.OTHER_ERROR="otherError"})(Y||(Y={}));var F;(function(U){U.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",U.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",U.KEY_SYSTEM_NO_SESSION="keySystemNoSession",U.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",U.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",U.MANIFEST_LOAD_ERROR="manifestLoadError",U.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",U.MANIFEST_PARSING_ERROR="manifestParsingError",U.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",U.LEVEL_EMPTY_ERROR="levelEmptyError",U.LEVEL_LOAD_ERROR="levelLoadError",U.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",U.LEVEL_SWITCH_ERROR="levelSwitchError",U.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",U.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",U.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",U.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",U.FRAG_LOAD_ERROR="fragLoadError",U.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",U.FRAG_DECRYPT_ERROR="fragDecryptError",U.FRAG_PARSING_ERROR="fragParsingError",U.REMUX_ALLOC_ERROR="remuxAllocError",U.KEY_LOAD_ERROR="keyLoadError",U.KEY_LOAD_TIMEOUT="keyLoadTimeOut",U.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",U.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",U.BUFFER_APPEND_ERROR="bufferAppendError",U.BUFFER_APPENDING_ERROR="bufferAppendingError",U.BUFFER_STALLED_ERROR="bufferStalledError",U.BUFFER_FULL_ERROR="bufferFullError",U.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",U.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",U.INTERNAL_EXCEPTION="internalException",U.INTERNAL_ABORTED="aborted",U.UNKNOWN="unknown"})(F||(F={}))},"./src/events.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"Events",function(){return Y});var Y;(function(F){F.MEDIA_ATTACHING="hlsMediaAttaching",F.MEDIA_ATTACHED="hlsMediaAttached",F.MEDIA_DETACHING="hlsMediaDetaching",F.MEDIA_DETACHED="hlsMediaDetached",F.BUFFER_RESET="hlsBufferReset",F.BUFFER_CODECS="hlsBufferCodecs",F.BUFFER_CREATED="hlsBufferCreated",F.BUFFER_APPENDING="hlsBufferAppending",F.BUFFER_APPENDED="hlsBufferAppended",F.BUFFER_EOS="hlsBufferEos",F.BUFFER_FLUSHING="hlsBufferFlushing",F.BUFFER_FLUSHED="hlsBufferFlushed",F.MANIFEST_LOADING="hlsManifestLoading",F.MANIFEST_LOADED="hlsManifestLoaded",F.MANIFEST_PARSED="hlsManifestParsed",F.LEVEL_SWITCHING="hlsLevelSwitching",F.LEVEL_SWITCHED="hlsLevelSwitched",F.LEVEL_LOADING="hlsLevelLoading",F.LEVEL_LOADED="hlsLevelLoaded",F.LEVEL_UPDATED="hlsLevelUpdated",F.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",F.LEVELS_UPDATED="hlsLevelsUpdated",F.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",F.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",F.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",F.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",F.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",F.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",F.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",F.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",F.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",F.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",F.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",F.CUES_PARSED="hlsCuesParsed",F.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",F.INIT_PTS_FOUND="hlsInitPtsFound",F.FRAG_LOADING="hlsFragLoading",F.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",F.FRAG_LOADED="hlsFragLoaded",F.FRAG_DECRYPTED="hlsFragDecrypted",F.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",F.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",F.FRAG_PARSING_METADATA="hlsFragParsingMetadata",F.FRAG_PARSED="hlsFragParsed",F.FRAG_BUFFERED="hlsFragBuffered",F.FRAG_CHANGED="hlsFragChanged",F.FPS_DROP="hlsFpsDrop",F.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",F.ERROR="hlsError",F.DESTROYING="hlsDestroying",F.KEY_LOADING="hlsKeyLoading",F.KEY_LOADED="hlsKeyLoaded",F.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",F.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Y||(Y={}))},"./src/hls.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return w});var Y=D("./node_modules/url-toolkit/src/url-toolkit.js"),F=D.n(Y),U=D("./src/loader/playlist-loader.ts"),W=D("./src/loader/key-loader.ts"),j=D("./src/controller/id3-track-controller.ts"),k=D("./src/controller/latency-controller.ts"),I=D("./src/controller/level-controller.ts"),m=D("./src/controller/fragment-tracker.ts"),c=D("./src/controller/stream-controller.ts"),f=D("./src/is-supported.ts"),u=D("./src/utils/logger.ts"),r=D("./src/config.ts"),d=D("./node_modules/eventemitter3/index.js"),o=D.n(d),s=D("./src/events.ts"),l=D("./src/errors.ts");function p(x,O){for(var A=0;A<O.length;A++){var T=O[A];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(x,T.key,T)}}function R(x,O,A){return O&&p(x.prototype,O),A&&p(x,A),x}var w=function(){x.isSupported=function(){return Object(f.isSupported)()};function x(A){A===void 0&&(A={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new d.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 T=this.config=Object(r.mergeConfig)(x.DefaultConfig,A);this.userConfig=A,Object(u.enableLogs)(T.debug),this._autoLevelCapping=-1,T.progressive&&Object(r.enableStreamingMode)(T);var E=T.abrController,y=T.bufferController,h=T.capLevelController,_=T.fpsController,g=this.abrController=new E(this),b=this.bufferController=new y(this),M=this.capLevelController=new h(this),P=new _(this),K=new U.default(this),V=new W.default(this),B=new j.default(this),C=this.levelController=new I.default(this),$=new m.FragmentTracker(this),ee=this.streamController=new c.default(this,$);M.setStreamController(ee),P.setStreamController(ee);var re=[C,ee];this.networkControllers=re;var ue=[K,V,g,b,M,P,B,$];this.audioTrackController=this.createController(T.audioTrackController,null,re),this.createController(T.audioStreamController,$,re),this.subtitleTrackController=this.createController(T.subtitleTrackController,null,re),this.createController(T.subtitleStreamController,$,re),this.createController(T.timelineController,null,ue),this.emeController=this.createController(T.emeController,null,ue),this.cmcdController=this.createController(T.cmcdController,null,ue),this.latencyController=this.createController(k.default,null,ue),this.coreComponents=ue}var O=x.prototype;return O.createController=function(T,E,y){if(T){var h=E?new T(this,E):new T(this);return y&&y.push(h),h}return null},O.on=function(T,E,y){y===void 0&&(y=this),this._emitter.on(T,E,y)},O.once=function(T,E,y){y===void 0&&(y=this),this._emitter.once(T,E,y)},O.removeAllListeners=function(T){this._emitter.removeAllListeners(T)},O.off=function(T,E,y,h){y===void 0&&(y=this),this._emitter.off(T,E,y,h)},O.listeners=function(T){return this._emitter.listeners(T)},O.emit=function(T,E,y){return this._emitter.emit(T,E,y)},O.trigger=function(T,E){if(this.config.debug)return this.emit(T,T,E);try{return this.emit(T,T,E)}catch(y){u.logger.error("An internal error happened while handling event "+T+'. Error message: "'+y.message+'". Here is a stacktrace:',y),this.trigger(s.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:T,error:y})}return!1},O.listenerCount=function(T){return this._emitter.listenerCount(T)},O.destroy=function(){u.logger.log("destroy"),this.trigger(s.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(T){return T.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(T){return T.destroy()}),this.coreComponents.length=0},O.attachMedia=function(T){u.logger.log("attachMedia"),this._media=T,this.trigger(s.Events.MEDIA_ATTACHING,{media:T})},O.detachMedia=function(){u.logger.log("detachMedia"),this.trigger(s.Events.MEDIA_DETACHING,void 0),this._media=null},O.loadSource=function(T){this.stopLoad();var E=this.media,y=this.url,h=this.url=Y.buildAbsoluteURL(self.location.href,T,{alwaysNormalize:!0});u.logger.log("loadSource:"+h),E&&y&&y!==h&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(E)),this.trigger(s.Events.MANIFEST_LOADING,{url:T})},O.startLoad=function(T){T===void 0&&(T=-1),u.logger.log("startLoad("+T+")"),this.networkControllers.forEach(function(E){E.startLoad(T)})},O.stopLoad=function(){u.logger.log("stopLoad"),this.networkControllers.forEach(function(T){T.stopLoad()})},O.swapAudioCodec=function(){u.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},O.recoverMediaError=function(){u.logger.log("recoverMediaError");var T=this._media;this.detachMedia(),T&&this.attachMedia(T)},O.removeLevel=function(T,E){E===void 0&&(E=0),this.levelController.removeLevel(T,E)},R(x,[{key:"levels",get:function(){var T=this.levelController.levels;return T||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(T){u.logger.log("set currentLevel:"+T),this.loadLevel=T,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(T){u.logger.log("set nextLevel:"+T),this.levelController.manualLevel=T,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(T){u.logger.log("set loadLevel:"+T),this.levelController.manualLevel=T}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(T){this.levelController.nextLoadLevel=T}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(T){u.logger.log("set firstLevel:"+T),this.levelController.firstLevel=T}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(T){u.logger.log("set startLevel:"+T),T!==-1&&(T=Math.max(T,this.minAutoLevel)),this.levelController.startLevel=T}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(T){var E=!!T;E!==this.config.capLevelToPlayerSize&&(E?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=E)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(T){this._autoLevelCapping!==T&&(u.logger.log("set autoLevelCapping:"+T),this._autoLevelCapping=T)}},{key:"bandwidthEstimate",get:function(){var T=this.abrController.bwEstimator;return T?T.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var T=this.levels,E=this.config.minAutoBitrate;if(!T)return 0;for(var y=T.length,h=0;h<y;h++)if(T[h].maxBitrate>E)return h;return 0}},{key:"maxAutoLevel",get:function(){var T=this.levels,E=this.autoLevelCapping,y;return E===-1&&T&&T.length?y=T.length-1:y=E,y}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(T){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,T)}},{key:"audioTracks",get:function(){var T=this.audioTrackController;return T?T.audioTracks:[]}},{key:"audioTrack",get:function(){var T=this.audioTrackController;return T?T.audioTrack:-1},set:function(T){var E=this.audioTrackController;E&&(E.audioTrack=T)}},{key:"subtitleTracks",get:function(){var T=this.subtitleTrackController;return T?T.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var T=this.subtitleTrackController;return T?T.subtitleTrack:-1},set:function(T){var E=this.subtitleTrackController;E&&(E.subtitleTrack=T)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var T=this.subtitleTrackController;return T?T.subtitleDisplay:!1},set:function(T){var E=this.subtitleTrackController;E&&(E.subtitleDisplay=T)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(T){this.config.lowLatencyMode=T}},{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 s.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return x.defaultConfig?x.defaultConfig:r.hlsDefaultConfig},set:function(T){x.defaultConfig=T}}]),x}();w.defaultConfig=void 0},"./src/is-supported.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"isSupported",function(){return U}),D.d(J,"changeTypeSupported",function(){return W});var Y=D("./src/utils/mediasource-helper.ts");function F(){return self.SourceBuffer||self.WebKitSourceBuffer}function U(){var j=Object(Y.getMediaSource)();if(!j)return!1;var k=F(),I=j&&typeof j.isTypeSupported=="function"&&j.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),m=!k||k.prototype&&typeof k.prototype.appendBuffer=="function"&&typeof k.prototype.remove=="function";return!!I&&!!m}function W(){var j,k=F();return typeof(k==null||((j=k.prototype)===null||j===void 0)?void 0:j.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return u}),D.d(J,"LoadError",function(){return d});var Y=D("./src/polyfills/number.ts"),F=D("./src/errors.ts");function U(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,m(o,s)}function W(o){var s=typeof Map=="function"?new Map:void 0;return W=function(p){if(p===null||!I(p))return p;if(typeof p!="function")throw new TypeError("Super expression must either be null or a function");if(typeof s!="undefined"){if(s.has(p))return s.get(p);s.set(p,R)}function R(){return j(p,arguments,c(this).constructor)}return R.prototype=Object.create(p.prototype,{constructor:{value:R,enumerable:!1,writable:!0,configurable:!0}}),m(R,p)},W(o)}function j(o,s,l){return k()?j=Reflect.construct:j=function(R,w,x){var O=[null];O.push.apply(O,w);var A=Function.bind.apply(R,O),T=new A;return x&&m(T,x.prototype),T},j.apply(null,arguments)}function k(){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(o){return!1}}function I(o){return Function.toString.call(o).indexOf("[native code]")!==-1}function m(o,s){return m=Object.setPrototypeOf||function(p,R){return p.__proto__=R,p},m(o,s)}function c(o){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},c(o)}var f=Math.pow(2,17),u=function(){function o(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var s=o.prototype;return s.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},s.abort=function(){this.loader&&this.loader.abort()},s.load=function(p,R){var w=this,x=p.url;if(!x)return Promise.reject(new d({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:p,networkDetails:null},"Fragment does not have a "+(x?"part list":"url")));this.abort();var O=this.config,A=O.fLoader,T=O.loader;return new Promise(function(E,y){w.loader&&w.loader.destroy();var h=w.loader=p.loader=A?new A(O):new T(O),_=r(p),g={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:f};p.stats=h.stats,h.load(_,g,{onSuccess:function(M,P,K,V){w.resetLoader(p,h),E({frag:p,part:null,payload:M.data,networkDetails:V})},onError:function(M,P,K){w.resetLoader(p,h),y(new d({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:p,response:M,networkDetails:K}))},onAbort:function(M,P,K){w.resetLoader(p,h),y(new d({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:p,networkDetails:K}))},onTimeout:function(M,P,K){w.resetLoader(p,h),y(new d({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:p,networkDetails:K}))},onProgress:function(M,P,K,V){R&&R({frag:p,part:null,payload:K,networkDetails:V})}})})},s.loadPart=function(p,R,w){var x=this;this.abort();var O=this.config,A=O.fLoader,T=O.loader;return new Promise(function(E,y){x.loader&&x.loader.destroy();var h=x.loader=p.loader=A?new A(O):new T(O),_=r(p,R),g={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:f};R.stats=h.stats,h.load(_,g,{onSuccess:function(M,P,K,V){x.resetLoader(p,h),x.updateStatsFromPart(p,R);var B={frag:p,part:R,payload:M.data,networkDetails:V};w(B),E(B)},onError:function(M,P,K){x.resetLoader(p,h),y(new d({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:p,part:R,response:M,networkDetails:K}))},onAbort:function(M,P,K){p.stats.aborted=R.stats.aborted,x.resetLoader(p,h),y(new d({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:p,part:R,networkDetails:K}))},onTimeout:function(M,P,K){x.resetLoader(p,h),y(new d({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:p,part:R,networkDetails:K}))}})})},s.updateStatsFromPart=function(p,R){var w=p.stats,x=R.stats,O=x.total;if(w.loaded+=x.loaded,O){var A=Math.round(p.duration/R.duration),T=Math.min(Math.round(w.loaded/O),A),E=A-T,y=E*Math.round(w.loaded/T);w.total=w.loaded+y}else w.total=Math.max(w.loaded,w.total);var h=w.loading,_=x.loading;h.start?h.first+=_.first-_.start:(h.start=_.start,h.first=_.first),h.end=_.end},s.resetLoader=function(p,R){p.loader=null,this.loader===R&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),R.destroy()},o}();function r(o,s){s===void 0&&(s=null);var l=s||o,p={frag:o,part:s,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},R=l.byteRangeStartOffset,w=l.byteRangeEndOffset;return Object(Y.isFiniteNumber)(R)&&Object(Y.isFiniteNumber)(w)&&(p.rangeStart=R,p.rangeEnd=w),p}var d=function(o){U(s,o);function s(l){for(var p,R=arguments.length,w=new Array(R>1?R-1:0),x=1;x<R;x++)w[x-1]=arguments[x];return p=o.call.apply(o,[this].concat(w))||this,p.data=void 0,p.data=l,p}return s}(W(Error))},"./src/loader/fragment.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"ElementaryStreamTypes",function(){return u}),D.d(J,"BaseSegment",function(){return r}),D.d(J,"Fragment",function(){return d}),D.d(J,"Part",function(){return o});var Y=D("./src/polyfills/number.ts"),F=D("./node_modules/url-toolkit/src/url-toolkit.js"),U=D.n(F),W=D("./src/utils/logger.ts"),j=D("./src/loader/level-key.ts"),k=D("./src/loader/load-stats.ts");function I(s,l){s.prototype=Object.create(l.prototype),s.prototype.constructor=s,m(s,l)}function m(s,l){return m=Object.setPrototypeOf||function(R,w){return R.__proto__=w,R},m(s,l)}function c(s,l){for(var p=0;p<l.length;p++){var R=l[p];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(s,R.key,R)}}function f(s,l,p){return l&&c(s.prototype,l),p&&c(s,p),s}var u;(function(s){s.AUDIO="audio",s.VIDEO="video",s.AUDIOVIDEO="audiovideo"})(u||(u={}));var r=function(){function s(p){var R;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(R={},R[u.AUDIO]=null,R[u.VIDEO]=null,R[u.AUDIOVIDEO]=null,R),this.baseurl=p}var l=s.prototype;return l.setByteRange=function(R,w){var x=R.split("@",2),O=[];x.length===1?O[0]=w?w.byteRangeEndOffset:0:O[0]=parseInt(x[1]),O[1]=parseInt(x[0])+O[0],this._byteRange=O},f(s,[{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(F.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(R){this._url=R}}]),s}(),d=function(s){I(l,s);function l(R,w){var x;return x=s.call(this,w)||this,x._decryptdata=null,x.rawProgramDateTime=null,x.programDateTime=null,x.tagList=[],x.duration=0,x.sn=0,x.levelkey=void 0,x.type=void 0,x.loader=null,x.level=-1,x.cc=0,x.startPTS=void 0,x.endPTS=void 0,x.appendedPTS=void 0,x.startDTS=void 0,x.endDTS=void 0,x.start=0,x.deltaPTS=void 0,x.maxStartPTS=void 0,x.minEndPTS=void 0,x.stats=new k.LoadStats,x.urlId=0,x.data=void 0,x.bitrateTest=!1,x.title=null,x.initSegment=null,x.type=R,x}var p=l.prototype;return p.createInitializationVector=function(w){for(var x=new Uint8Array(16),O=12;O<16;O++)x[O]=w>>8*(15-O)&255;return x},p.setDecryptDataFromLevelKey=function(w,x){var O=w;return(w==null?void 0:w.method)==="AES-128"&&w.uri&&!w.iv&&(O=j.LevelKey.fromURI(w.uri),O.method=w.method,O.iv=this.createInitializationVector(x),O.keyFormat="identity"),O},p.setElementaryStreamInfo=function(w,x,O,A,T,E){E===void 0&&(E=!1);var y=this.elementaryStreams,h=y[w];if(!h){y[w]={startPTS:x,endPTS:O,startDTS:A,endDTS:T,partial:E};return}h.startPTS=Math.min(h.startPTS,x),h.endPTS=Math.max(h.endPTS,O),h.startDTS=Math.min(h.startDTS,A),h.endDTS=Math.max(h.endDTS,T)},p.clearElementaryStreamInfo=function(){var w=this.elementaryStreams;w[u.AUDIO]=null,w[u.VIDEO]=null,w[u.AUDIOVIDEO]=null},f(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var w=this.sn;typeof w!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&W.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),w=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,w)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(Y.isFiniteNumber)(this.programDateTime))return null;var w=Object(Y.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+w*1e3}},{key:"encrypted",get:function(){var w;return!!((w=this.decryptdata)!==null&&w!==void 0&&w.keyFormat&&this.decryptdata.uri)}}]),l}(r),o=function(s){I(l,s);function l(p,R,w,x,O){var A;A=s.call(this,w)||this,A.fragOffset=0,A.duration=0,A.gap=!1,A.independent=!1,A.relurl=void 0,A.fragment=void 0,A.index=void 0,A.stats=new k.LoadStats,A.duration=p.decimalFloatingPoint("DURATION"),A.gap=p.bool("GAP"),A.independent=p.bool("INDEPENDENT"),A.relurl=p.enumeratedString("URI"),A.fragment=R,A.index=x;var T=p.enumeratedString("BYTERANGE");return T&&A.setByteRange(T,O),O&&(A.fragOffset=O.fragOffset+O.duration),A}return f(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 R=this.elementaryStreams;return!!(R.audio||R.video||R.audiovideo)}}]),l}(r)},"./src/loader/key-loader.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return W});var Y=D("./src/events.ts"),F=D("./src/errors.ts"),U=D("./src/utils/logger.ts"),W=function(){function j(I){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=I,this._registerListeners()}var k=j.prototype;return k._registerListeners=function(){this.hls.on(Y.Events.KEY_LOADING,this.onKeyLoading,this)},k._unregisterListeners=function(){this.hls.off(Y.Events.KEY_LOADING,this.onKeyLoading)},k.destroy=function(){this._unregisterListeners();for(var m in this.loaders){var c=this.loaders[m];c&&c.destroy()}this.loaders={}},k.onKeyLoading=function(m,c){var f=c.frag,u=f.type,r=this.loaders[u];if(!f.decryptdata){U.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var d=f.decryptdata.uri;if(d!==this.decrypturl||this.decryptkey===null){var o=this.hls.config;if(r&&(U.logger.warn("abort previous key loader for type:"+u),r.abort()),!d){U.logger.warn("key uri is falsy");return}var s=o.loader,l=f.loader=this.loaders[u]=new s(o);this.decrypturl=d,this.decryptkey=null;var p={url:d,frag:f,responseType:"arraybuffer"},R={timeout:o.fragLoadingTimeOut,maxRetry:0,retryDelay:o.fragLoadingRetryDelay,maxRetryDelay:o.fragLoadingMaxRetryTimeout,highWaterMark:0},w={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(p,R,w)}else this.decryptkey&&(f.decryptdata.key=this.decryptkey,this.hls.trigger(Y.Events.KEY_LOADED,{frag:f}))},k.loadsuccess=function(m,c,f){var u=f.frag;if(!u.decryptdata){U.logger.error("after key load, decryptdata unset");return}this.decryptkey=u.decryptdata.key=new Uint8Array(m.data),u.loader=null,delete this.loaders[u.type],this.hls.trigger(Y.Events.KEY_LOADED,{frag:u})},k.loaderror=function(m,c){var f=c.frag,u=f.loader;u&&u.abort(),delete this.loaders[f.type],this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:f,response:m})},k.loadtimeout=function(m,c){var f=c.frag,u=f.loader;u&&u.abort(),delete this.loaders[f.type],this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:f})},j}()},"./src/loader/level-details.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"LevelDetails",function(){return j});var Y=D("./src/polyfills/number.ts");function F(k,I){for(var m=0;m<I.length;m++){var c=I[m];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(k,c.key,c)}}function U(k,I,m){return I&&F(k.prototype,I),m&&F(k,m),k}var W=10,j=function(){function k(m){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=m}var I=k.prototype;return I.reloaded=function(c){if(!c){this.advanced=!0,this.updated=!0;return}var f=this.lastPartSn-c.lastPartSn,u=this.lastPartIndex-c.lastPartIndex;this.updated=this.endSN!==c.endSN||!!u||!!f,this.advanced=this.endSN>c.endSN||f>0||f===0&&u>0,this.updated||this.advanced?this.misses=Math.floor(c.misses*.6):this.misses=c.misses+1,this.availabilityDelay=c.availabilityDelay},U(k,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Y.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||W}},{key:"drift",get:function(){var c=this.driftEndTime-this.driftStartTime;if(c>0){var f=this.driftEnd-this.driftStart;return f*1e3/c}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var c;return(c=this.partList)!==null&&c!==void 0&&c.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var c;return(c=this.fragments)!==null&&c!==void 0&&c.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 c;return(c=this.partList)!==null&&c!==void 0&&c.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var c;return(c=this.partList)!==null&&c!==void 0&&c.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),k}()},"./src/loader/level-key.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"LevelKey",function(){return j});var Y=D("./node_modules/url-toolkit/src/url-toolkit.js"),F=D.n(Y);function U(k,I){for(var m=0;m<I.length;m++){var c=I[m];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(k,c.key,c)}}function W(k,I,m){return I&&U(k.prototype,I),m&&U(k,m),k}var j=function(){k.fromURL=function(m,c){return new k(m,c)},k.fromURI=function(m){return new k(m)};function k(I,m){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,m?this._uri=Object(Y.buildAbsoluteURL)(I,m,{alwaysNormalize:!0}):this._uri=I}return W(k,[{key:"uri",get:function(){return this._uri}}]),k}()},"./src/loader/load-stats.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"LoadStats",function(){return Y});var Y=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return l});var Y=D("./src/polyfills/number.ts"),F=D("./node_modules/url-toolkit/src/url-toolkit.js"),U=D.n(F),W=D("./src/loader/fragment.ts"),j=D("./src/loader/level-details.ts"),k=D("./src/loader/level-key.ts"),I=D("./src/utils/attr-list.ts"),m=D("./src/utils/logger.ts"),c=D("./src/utils/codecs.ts"),f=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,u=/#EXT-X-MEDIA:(.*)/g,r=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),d=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("|")),o=/\.(mp4|m4s|m4v|m4a)$/i;function s(O){var A,T;return o.test((A=(T=F.parseURL(O))===null||T===void 0?void 0:T.path)!=null?A:"")}var l=function(){function O(){}return O.findGroup=function(T,E){for(var y=0;y<T.length;y++){var h=T[y];if(h.id===E)return h}},O.convertAVC1ToAVCOTI=function(T){var E=T.split(".");if(E.length>2){var y=E.shift()+".";return y+=parseInt(E.shift()).toString(16),y+=("000"+parseInt(E.shift()).toString(16)).substr(-4),y}return T},O.resolve=function(T,E){return F.buildAbsoluteURL(E,T,{alwaysNormalize:!0})},O.parseMasterPlaylist=function(T,E){var y=[],h={},_=!1;f.lastIndex=0;for(var g;(g=f.exec(T))!=null;)if(g[1]){var b=new I.AttrList(g[1]),M={attrs:b,bitrate:b.decimalInteger("AVERAGE-BANDWIDTH")||b.decimalInteger("BANDWIDTH"),name:b.NAME,url:O.resolve(g[2],E)},P=b.decimalResolution("RESOLUTION");P&&(M.width=P.width,M.height=P.height),p((b.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=O.convertAVC1ToAVCOTI(M.videoCodec)),y.push(M)}else if(g[3]){var K=new I.AttrList(g[3]);K["DATA-ID"]&&(_=!0,h[K["DATA-ID"]]=K)}return{levels:y,sessionData:_?h:null}},O.parseMasterPlaylistMedia=function(T,E,y,h){h===void 0&&(h=[]);var _,g=[],b=0;for(u.lastIndex=0;(_=u.exec(T))!==null;){var M=new I.AttrList(_[1]);if(M.TYPE===y){var P={attrs:M,bitrate:0,id:b++,groupId:M["GROUP-ID"],instreamId:M["INSTREAM-ID"],name:M.NAME||M.LANGUAGE||"",type:y,default:M.bool("DEFAULT"),autoselect:M.bool("AUTOSELECT"),forced:M.bool("FORCED"),lang:M.LANGUAGE,url:M.URI?O.resolve(M.URI,E):""};if(h.length){var K=O.findGroup(h,P.groupId)||h[0];R(P,K,"audioCodec"),R(P,K,"textCodec")}g.push(P)}}return g},O.parseLevelPlaylist=function(T,E,y,h,_){var g=new j.LevelDetails(E),b=g.fragments,M=null,P=0,K=0,V=0,B=0,C=null,$=new W.Fragment(h,E),ee,re,ue,Te=-1,ye=!1;for(r.lastIndex=0,g.m3u8=T;(ee=r.exec(T))!==null;){ye&&(ye=!1,$=new W.Fragment(h,E),$.start=V,$.sn=P,$.cc=B,$.level=y,M&&($.initSegment=M,$.rawProgramDateTime=M.rawProgramDateTime));var be=ee[1];if(be){$.duration=parseFloat(be);var we=(" "+ee[2]).slice(1);$.title=we||null,$.tagList.push(we?["INF",be,we]:["INF",be])}else if(ee[3])Object(Y.isFiniteNumber)($.duration)&&($.start=V,ue&&($.levelkey=ue),$.sn=P,$.level=y,$.cc=B,$.urlId=_,b.push($),$.relurl=(" "+ee[3]).slice(1),x($,C),C=$,V+=$.duration,P++,K=0,ye=!0);else if(ee[4]){var xe=(" "+ee[4]).slice(1);C?$.setByteRange(xe,C):$.setByteRange(xe)}else if(ee[5])$.rawProgramDateTime=(" "+ee[5]).slice(1),$.tagList.push(["PROGRAM-DATE-TIME",$.rawProgramDateTime]),Te===-1&&(Te=b.length);else{if(ee=ee[0].match(d),!ee){m.logger.warn("No matches on slow regex match for level playlist!");continue}for(re=1;re<ee.length&&!(typeof ee[re]!="undefined");re++);var me=(" "+ee[re]).slice(1),se=(" "+ee[re+1]).slice(1),Re=ee[re+2]?(" "+ee[re+2]).slice(1):"";switch(me){case"PLAYLIST-TYPE":g.type=se.toUpperCase();break;case"MEDIA-SEQUENCE":P=g.startSN=parseInt(se);break;case"SKIP":{var ze=new I.AttrList(se),He=ze.decimalInteger("SKIPPED-SEGMENTS");if(Object(Y.isFiniteNumber)(He)){g.skippedSegments=He;for(var rt=He;rt--;)b.unshift(null);P+=He}var ot=ze.enumeratedString("RECENTLY-REMOVED-DATERANGES");ot&&(g.recentlyRemovedDateranges=ot.split(" "));break}case"TARGETDURATION":g.targetduration=parseFloat(se);break;case"VERSION":g.version=parseInt(se);break;case"EXTM3U":break;case"ENDLIST":g.live=!1;break;case"#":(se||Re)&&$.tagList.push(Re?[se,Re]:[se]);break;case"DIS":B++;case"GAP":$.tagList.push([me]);break;case"BITRATE":$.tagList.push([me,se]);break;case"DISCONTINUITY-SEQ":B=parseInt(se);break;case"KEY":{var Oe,Le=new I.AttrList(se),Ue=Le.enumeratedString("METHOD"),Ge=Le.URI,je=Le.hexadecimalInteger("IV"),Me=Le.enumeratedString("KEYFORMATVERSIONS"),Pe=Le.enumeratedString("KEYID"),ut=(Oe=Le.enumeratedString("KEYFORMAT"))!=null?Oe:"identity",tt=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(tt.indexOf(ut)>-1){m.logger.warn("Keyformat "+ut+" is not supported from the manifest");continue}else if(ut!=="identity")continue;Ue&&(ue=k.LevelKey.fromURL(E,Ge),Ge&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ue)>=0&&(ue.method=Ue,ue.keyFormat=ut,Pe&&(ue.keyID=Pe),Me&&(ue.keyFormatVersions=Me),ue.iv=je));break}case"START":{var qe=new I.AttrList(se),$e=qe.decimalFloatingPoint("TIME-OFFSET");Object(Y.isFiniteNumber)($e)&&(g.startTimeOffset=$e);break}case"MAP":{var ft=new I.AttrList(se);$.relurl=ft.URI,ft.BYTERANGE&&$.setByteRange(ft.BYTERANGE),$.level=y,$.sn="initSegment",ue&&($.levelkey=ue),$.initSegment=null,M=$,ye=!0;break}case"SERVER-CONTROL":{var nt=new I.AttrList(se);g.canBlockReload=nt.bool("CAN-BLOCK-RELOAD"),g.canSkipUntil=nt.optionalFloat("CAN-SKIP-UNTIL",0),g.canSkipDateRanges=g.canSkipUntil>0&&nt.bool("CAN-SKIP-DATERANGES"),g.partHoldBack=nt.optionalFloat("PART-HOLD-BACK",0),g.holdBack=nt.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ye=new I.AttrList(se);g.partTarget=Ye.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ae=g.partList;Ae||(Ae=g.partList=[]);var ct=K>0?Ae[Ae.length-1]:void 0,Je=K++,Se=new W.Part(new I.AttrList(se),$,E,Je,ct);Ae.push(Se),$.duration+=Se.duration;break}case"PRELOAD-HINT":{var Ne=new I.AttrList(se);g.preloadHint=Ne;break}case"RENDITION-REPORT":{var ve=new I.AttrList(se);g.renditionReports=g.renditionReports||[],g.renditionReports.push(ve);break}default:m.logger.warn("line parsed but not handled: "+ee);break}}}C&&!C.relurl?(b.pop(),V-=C.duration,g.partList&&(g.fragmentHint=C)):g.partList&&(x($,C),$.cc=B,g.fragmentHint=$);var de=b.length,pe=b[0],te=b[de-1];if(V+=g.skippedSegments*g.targetduration,V>0&&de&&te){g.averagetargetduration=V/de;var ie=te.sn;g.endSN=ie!=="initSegment"?ie:0,pe&&(g.startCC=pe.cc,pe.initSegment||g.fragments.every(function(oe){return oe.relurl&&s(oe.relurl)})&&(m.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),$=new W.Fragment(h,E),$.relurl=te.relurl,$.level=y,$.sn="initSegment",pe.initSegment=$,g.needSidxRanges=!0))}else g.endSN=0,g.startCC=0;return g.fragmentHint&&(V+=g.fragmentHint.duration),g.totalduration=V,g.endCC=B,Te>0&&w(b,Te),g},O}();function p(O,A){["video","audio","text"].forEach(function(T){var E=O.filter(function(h){return Object(c.isCodecType)(h,T)});if(E.length){var y=E.filter(function(h){return h.lastIndexOf("avc1",0)===0||h.lastIndexOf("mp4a",0)===0});A[T+"Codec"]=y.length>0?y[0]:E[0],O=O.filter(function(h){return E.indexOf(h)===-1})}}),A.unknownCodecs=O}function R(O,A,T){var E=A[T];E&&(O[T]=E)}function w(O,A){for(var T=O[A],E=A;E--;){var y=O[E];if(!y)return;y.programDateTime=T.programDateTime-y.duration*1e3,T=y}}function x(O,A){O.rawProgramDateTime?O.programDateTime=Date.parse(O.rawProgramDateTime):A!=null&&A.programDateTime&&(O.programDateTime=A.endProgramDateTime),Object(Y.isFiniteNumber)(O.programDateTime)||(O.programDateTime=null,O.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/polyfills/number.ts"),F=D("./src/events.ts"),U=D("./src/errors.ts"),W=D("./src/utils/logger.ts"),j=D("./src/utils/mp4-tools.ts"),k=D("./src/loader/m3u8-parser.ts"),I=D("./src/types/loader.ts"),m=D("./src/utils/attr-list.ts");function c(r){var d=r.type;switch(d){case I.PlaylistContextType.AUDIO_TRACK:return I.PlaylistLevelType.AUDIO;case I.PlaylistContextType.SUBTITLE_TRACK:return I.PlaylistLevelType.SUBTITLE;default:return I.PlaylistLevelType.MAIN}}function f(r,d){var o=r.url;return(o===void 0||o.indexOf("data:")===0)&&(o=d.url),o}var u=function(){function r(o){this.hls=void 0,this.loaders=Object.create(null),this.hls=o,this.registerListeners()}var d=r.prototype;return d.registerListeners=function(){var s=this.hls;s.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(F.Events.LEVEL_LOADING,this.onLevelLoading,this),s.on(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),s.on(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},d.unregisterListeners=function(){var s=this.hls;s.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(F.Events.LEVEL_LOADING,this.onLevelLoading,this),s.off(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),s.off(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},d.createInternalLoader=function(s){var l=this.hls.config,p=l.pLoader,R=l.loader,w=p||R,x=new w(l);return s.loader=x,this.loaders[s.type]=x,x},d.getInternalLoader=function(s){return this.loaders[s.type]},d.resetInternalLoader=function(s){this.loaders[s]&&delete this.loaders[s]},d.destroyInternalLoaders=function(){for(var s in this.loaders){var l=this.loaders[s];l&&l.destroy(),this.resetInternalLoader(s)}},d.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},d.onManifestLoading=function(s,l){var p=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:I.PlaylistContextType.MANIFEST,url:p,deliveryDirectives:null})},d.onLevelLoading=function(s,l){var p=l.id,R=l.level,w=l.url,x=l.deliveryDirectives;this.load({id:p,groupId:null,level:R,responseType:"text",type:I.PlaylistContextType.LEVEL,url:w,deliveryDirectives:x})},d.onAudioTrackLoading=function(s,l){var p=l.id,R=l.groupId,w=l.url,x=l.deliveryDirectives;this.load({id:p,groupId:R,level:null,responseType:"text",type:I.PlaylistContextType.AUDIO_TRACK,url:w,deliveryDirectives:x})},d.onSubtitleTrackLoading=function(s,l){var p=l.id,R=l.groupId,w=l.url,x=l.deliveryDirectives;this.load({id:p,groupId:R,level:null,responseType:"text",type:I.PlaylistContextType.SUBTITLE_TRACK,url:w,deliveryDirectives:x})},d.load=function(s){var l,p=this.hls.config,R=this.getInternalLoader(s);if(R){var w=R.context;if(w&&w.url===s.url){W.logger.trace("[playlist-loader]: playlist request ongoing");return}W.logger.log("[playlist-loader]: aborting previous loader for type: "+s.type),R.abort()}var x,O,A,T;switch(s.type){case I.PlaylistContextType.MANIFEST:x=p.manifestLoadingMaxRetry,O=p.manifestLoadingTimeOut,A=p.manifestLoadingRetryDelay,T=p.manifestLoadingMaxRetryTimeout;break;case I.PlaylistContextType.LEVEL:case I.PlaylistContextType.AUDIO_TRACK:case I.PlaylistContextType.SUBTITLE_TRACK:x=0,O=p.levelLoadingTimeOut;break;default:x=p.levelLoadingMaxRetry,O=p.levelLoadingTimeOut,A=p.levelLoadingRetryDelay,T=p.levelLoadingMaxRetryTimeout;break}if(R=this.createInternalLoader(s),(l=s.deliveryDirectives)!==null&&l!==void 0&&l.part){var E;if(s.type===I.PlaylistContextType.LEVEL&&s.level!==null?E=this.hls.levels[s.level].details:s.type===I.PlaylistContextType.AUDIO_TRACK&&s.id!==null?E=this.hls.audioTracks[s.id].details:s.type===I.PlaylistContextType.SUBTITLE_TRACK&&s.id!==null&&(E=this.hls.subtitleTracks[s.id].details),E){var y=E.partTarget,h=E.targetduration;y&&h&&(O=Math.min(Math.max(y*3,h*.8)*1e3,O))}}var _={timeout:O,maxRetry:x,retryDelay:A,maxRetryDelay:T,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};R.load(s,_,g)},d.loadsuccess=function(s,l,p,R){if(R===void 0&&(R=null),p.isSidxRequest){this.handleSidxRequest(s,p),this.handlePlaylistLoaded(s,l,p,R);return}this.resetInternalLoader(p.type);var w=s.data;if(w.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(s,p,"no EXTM3U delimiter",R);return}l.parsing.start=performance.now(),w.indexOf("#EXTINF:")>0||w.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(s,l,p,R):this.handleMasterPlaylist(s,l,p,R)},d.loaderror=function(s,l,p){p===void 0&&(p=null),this.handleNetworkError(l,p,!1,s)},d.loadtimeout=function(s,l,p){p===void 0&&(p=null),this.handleNetworkError(l,p,!0)},d.handleMasterPlaylist=function(s,l,p,R){var w=this.hls,x=s.data,O=f(s,p),A=k.default.parseMasterPlaylist(x,O),T=A.levels,E=A.sessionData;if(!T.length){this.handleManifestParsingError(s,p,"no level found in manifest",R);return}var y=T.map(function(P){return{id:P.attrs.AUDIO,audioCodec:P.audioCodec}}),h=T.map(function(P){return{id:P.attrs.SUBTITLES,textCodec:P.textCodec}}),_=k.default.parseMasterPlaylistMedia(x,O,"AUDIO",y),g=k.default.parseMasterPlaylistMedia(x,O,"SUBTITLES",h),b=k.default.parseMasterPlaylistMedia(x,O,"CLOSED-CAPTIONS");if(_.length){var M=_.some(function(P){return!P.url});!M&&T[0].audioCodec&&!T[0].attrs.AUDIO&&(W.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),_.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new m.AttrList({}),bitrate:0,url:""}))}w.trigger(F.Events.MANIFEST_LOADED,{levels:T,audioTracks:_,subtitles:g,captions:b,url:O,stats:l,networkDetails:R,sessionData:E})},d.handleTrackOrLevelPlaylist=function(s,l,p,R){var w=this.hls,x=p.id,O=p.level,A=p.type,T=f(s,p),E=Object(Y.isFiniteNumber)(x)?x:0,y=Object(Y.isFiniteNumber)(O)?O:E,h=c(p),_=k.default.parseLevelPlaylist(s.data,T,y,h,E);if(!_.fragments.length){w.trigger(F.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:T,reason:"no fragments found in level",level:typeof p.level=="number"?p.level:void 0});return}if(A===I.PlaylistContextType.MANIFEST){var g={attrs:new m.AttrList({}),bitrate:0,details:_,name:"",url:T};w.trigger(F.Events.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:T,stats:l,networkDetails:R,sessionData:null})}if(l.parsing.end=performance.now(),_.needSidxRanges){var b,M=(b=_.fragments[0].initSegment)===null||b===void 0?void 0:b.url;this.load({url:M,isSidxRequest:!0,type:A,level:O,levelDetails:_,id:x,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}p.levelDetails=_,this.handlePlaylistLoaded(s,l,p,R)},d.handleSidxRequest=function(s,l){var p=Object(j.parseSegmentIndex)(new Uint8Array(s.data));if(!p)return;var R=p.references,w=l.levelDetails;R.forEach(function(x,O){var A=x.info,T=w.fragments[O];T.byteRange.length===0&&T.setByteRange(String(1+A.end-A.start)+"@"+String(A.start)),T.initSegment&&T.initSegment.setByteRange(String(p.moovEndOffset)+"@0")})},d.handleManifestParsingError=function(s,l,p,R){this.hls.trigger(F.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===I.PlaylistContextType.MANIFEST,url:s.url,reason:p,response:s,context:l,networkDetails:R})},d.handleNetworkError=function(s,l,p,R){p===void 0&&(p=!1),W.logger.warn("[playlist-loader]: A network "+(p?"timeout":"error")+" occurred while loading "+s.type+" level: "+s.level+" id: "+s.id+' group-id: "'+s.groupId+'"');var w=U.ErrorDetails.UNKNOWN,x=!1,O=this.getInternalLoader(s);switch(s.type){case I.PlaylistContextType.MANIFEST:w=p?U.ErrorDetails.MANIFEST_LOAD_TIMEOUT:U.ErrorDetails.MANIFEST_LOAD_ERROR,x=!0;break;case I.PlaylistContextType.LEVEL:w=p?U.ErrorDetails.LEVEL_LOAD_TIMEOUT:U.ErrorDetails.LEVEL_LOAD_ERROR,x=!1;break;case I.PlaylistContextType.AUDIO_TRACK:w=p?U.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,x=!1;break;case I.PlaylistContextType.SUBTITLE_TRACK:w=p?U.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:U.ErrorDetails.SUBTITLE_LOAD_ERROR,x=!1;break}O&&this.resetInternalLoader(s.type);var A={type:U.ErrorTypes.NETWORK_ERROR,details:w,fatal:x,url:s.url,loader:O,context:s,networkDetails:l};R&&(A.response=R),this.hls.trigger(F.Events.ERROR,A)},d.handlePlaylistLoaded=function(s,l,p,R){var w=p.type,x=p.level,O=p.id,A=p.groupId,T=p.loader,E=p.levelDetails,y=p.deliveryDirectives;if(!(E!=null&&E.targetduration)){this.handleManifestParsingError(s,p,"invalid target duration",R);return}if(!T)return;E.live&&(T.getCacheAge&&(E.ageHeader=T.getCacheAge()||0),(!T.getCacheAge||isNaN(E.ageHeader))&&(E.ageHeader=0));switch(w){case I.PlaylistContextType.MANIFEST:case I.PlaylistContextType.LEVEL:this.hls.trigger(F.Events.LEVEL_LOADED,{details:E,level:x||0,id:O||0,stats:l,networkDetails:R,deliveryDirectives:y});break;case I.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(F.Events.AUDIO_TRACK_LOADED,{details:E,id:O||0,groupId:A||"",stats:l,networkDetails:R,deliveryDirectives:y});break;case I.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(F.Events.SUBTITLE_TRACK_LOADED,{details:E,id:O||0,groupId:A||"",stats:l,networkDetails:R,deliveryDirectives:y});break}},r}();J.default=u},"./src/polyfills/number.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"isFiniteNumber",function(){return Y}),D.d(J,"MAX_SAFE_INTEGER",function(){return F});var Y=Number.isFinite||function(U){return typeof U=="number"&&isFinite(U)},F=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ae,J,D){"use strict";D.r(J);var Y=function(){function F(){}return F.getSilentFrame=function(W,j){switch(W){case"mp4a.40.2":if(j===1)return new Uint8Array([0,200,0,128,35,128]);if(j===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(j===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(j===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(j===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(j===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(j===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(j===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(j===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},F}();J.default=Y},"./src/remux/mp4-generator.ts":function(ae,J,D){"use strict";D.r(J);var Y=Math.pow(2,32)-1,F=function(){function U(){}return U.init=function(){U.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 j;for(j in U.types)U.types.hasOwnProperty(j)&&(U.types[j]=[j.charCodeAt(0),j.charCodeAt(1),j.charCodeAt(2),j.charCodeAt(3)]);var k=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]),I=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]);U.HDLR_TYPES={video:k,audio:I};var m=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),c=new Uint8Array([0,0,0,0,0,0,0,0]);U.STTS=U.STSC=U.STCO=c,U.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),U.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),U.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),U.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var f=new Uint8Array([105,115,111,109]),u=new Uint8Array([97,118,99,49]),r=new Uint8Array([0,0,0,1]);U.FTYP=U.box(U.types.ftyp,f,r,f,u),U.DINF=U.box(U.types.dinf,U.box(U.types.dref,m))},U.box=function(j){for(var k=8,I=arguments.length,m=new Array(I>1?I-1:0),c=1;c<I;c++)m[c-1]=arguments[c];for(var f=m.length,u=f;f--;)k+=m[f].byteLength;var r=new Uint8Array(k);for(r[0]=k>>24&255,r[1]=k>>16&255,r[2]=k>>8&255,r[3]=k&255,r.set(j,4),f=0,k=8;f<u;f++)r.set(m[f],k),k+=m[f].byteLength;return r},U.hdlr=function(j){return U.box(U.types.hdlr,U.HDLR_TYPES[j])},U.mdat=function(j){return U.box(U.types.mdat,j)},U.mdhd=function(j,k){k*=j;var I=Math.floor(k/(Y+1)),m=Math.floor(k%(Y+1));return U.box(U.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,j>>24&255,j>>16&255,j>>8&255,j&255,I>>24,I>>16&255,I>>8&255,I&255,m>>24,m>>16&255,m>>8&255,m&255,85,196,0,0]))},U.mdia=function(j){return U.box(U.types.mdia,U.mdhd(j.timescale,j.duration),U.hdlr(j.type),U.minf(j))},U.mfhd=function(j){return U.box(U.types.mfhd,new Uint8Array([0,0,0,0,j>>24,j>>16&255,j>>8&255,j&255]))},U.minf=function(j){return j.type==="audio"?U.box(U.types.minf,U.box(U.types.smhd,U.SMHD),U.DINF,U.stbl(j)):U.box(U.types.minf,U.box(U.types.vmhd,U.VMHD),U.DINF,U.stbl(j))},U.moof=function(j,k,I){return U.box(U.types.moof,U.mfhd(j),U.traf(I,k))},U.moov=function(j){for(var k=j.length,I=[];k--;)I[k]=U.trak(j[k]);return U.box.apply(null,[U.types.moov,U.mvhd(j[0].timescale,j[0].duration)].concat(I).concat(U.mvex(j)))},U.mvex=function(j){for(var k=j.length,I=[];k--;)I[k]=U.trex(j[k]);return U.box.apply(null,[U.types.mvex].concat(I))},U.mvhd=function(j,k){k*=j;var I=Math.floor(k/(Y+1)),m=Math.floor(k%(Y+1)),c=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,j>>24&255,j>>16&255,j>>8&255,j&255,I>>24,I>>16&255,I>>8&255,I&255,m>>24,m>>16&255,m>>8&255,m&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return U.box(U.types.mvhd,c)},U.sdtp=function(j){var k=j.samples||[],I=new Uint8Array(4+k.length),m,c;for(m=0;m<k.length;m++)c=k[m].flags,I[m+4]=c.dependsOn<<4|c.isDependedOn<<2|c.hasRedundancy;return U.box(U.types.sdtp,I)},U.stbl=function(j){return U.box(U.types.stbl,U.stsd(j),U.box(U.types.stts,U.STTS),U.box(U.types.stsc,U.STSC),U.box(U.types.stsz,U.STSZ),U.box(U.types.stco,U.STCO))},U.avc1=function(j){var k=[],I=[],m,c,f;for(m=0;m<j.sps.length;m++)c=j.sps[m],f=c.byteLength,k.push(f>>>8&255),k.push(f&255),k=k.concat(Array.prototype.slice.call(c));for(m=0;m<j.pps.length;m++)c=j.pps[m],f=c.byteLength,I.push(f>>>8&255),I.push(f&255),I=I.concat(Array.prototype.slice.call(c));var u=U.box(U.types.avcC,new Uint8Array([1,k[3],k[4],k[5],252|3,224|j.sps.length].concat(k).concat([j.pps.length]).concat(I))),r=j.width,d=j.height,o=j.pixelRatio[0],s=j.pixelRatio[1];return U.box(U.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,r>>8&255,r&255,d>>8&255,d&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]),u,U.box(U.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),U.box(U.types.pasp,new Uint8Array([o>>24,o>>16&255,o>>8&255,o&255,s>>24,s>>16&255,s>>8&255,s&255])))},U.esds=function(j){var k=j.config.length;return new Uint8Array([0,0,0,0,3,23+k,0,1,0,4,15+k,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([k]).concat(j.config).concat([6,1,2]))},U.mp4a=function(j){var k=j.samplerate;return U.box(U.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,j.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]),U.box(U.types.esds,U.esds(j)))},U.mp3=function(j){var k=j.samplerate;return U.box(U.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,j.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]))},U.stsd=function(j){return j.type==="audio"?!j.isAAC&&j.codec==="mp3"?U.box(U.types.stsd,U.STSD,U.mp3(j)):U.box(U.types.stsd,U.STSD,U.mp4a(j)):U.box(U.types.stsd,U.STSD,U.avc1(j))},U.tkhd=function(j){var k=j.id,I=j.duration*j.timescale,m=j.width,c=j.height,f=Math.floor(I/(Y+1)),u=Math.floor(I%(Y+1));return U.box(U.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,0,0,0,0,f>>24,f>>16&255,f>>8&255,f&255,u>>24,u>>16&255,u>>8&255,u&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,m>>8&255,m&255,0,0,c>>8&255,c&255,0,0]))},U.traf=function(j,k){var I=U.sdtp(j),m=j.id,c=Math.floor(k/(Y+1)),f=Math.floor(k%(Y+1));return U.box(U.types.traf,U.box(U.types.tfhd,new Uint8Array([0,0,0,0,m>>24,m>>16&255,m>>8&255,m&255])),U.box(U.types.tfdt,new Uint8Array([1,0,0,0,c>>24,c>>16&255,c>>8&255,c&255,f>>24,f>>16&255,f>>8&255,f&255])),U.trun(j,I.length+16+20+8+16+8+8),I)},U.trak=function(j){return j.duration=j.duration||4294967295,U.box(U.types.trak,U.tkhd(j),U.mdia(j))},U.trex=function(j){var k=j.id;return U.box(U.types.trex,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},U.trun=function(j,k){var I=j.samples||[],m=I.length,c=12+16*m,f=new Uint8Array(c),u,r,d,o,s,l;for(k+=8+c,f.set([0,0,15,1,m>>>24&255,m>>>16&255,m>>>8&255,m&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255],0),u=0;u<m;u++)r=I[u],d=r.duration,o=r.size,s=r.flags,l=r.cts,f.set([d>>>24&255,d>>>16&255,d>>>8&255,d&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,s.degradPrio&240<<8,s.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*u);return U.box(U.types.trun,f)},U.initSegment=function(j){U.types||U.init();var k=U.moov(j),I=new Uint8Array(U.FTYP.byteLength+k.byteLength);return I.set(U.FTYP),I.set(k,U.FTYP.byteLength),I},U}();F.types=void 0,F.HDLR_TYPES=void 0,F.STTS=void 0,F.STSC=void 0,F.STCO=void 0,F.STSZ=void 0,F.VMHD=void 0,F.SMHD=void 0,F.STSD=void 0,F.FTYP=void 0,F.DINF=void 0,J.default=F},"./src/remux/mp4-remuxer.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return l}),D.d(J,"normalizePts",function(){return p});var Y=D("./src/polyfills/number.ts"),F=D("./src/remux/aac-helper.ts"),U=D("./src/remux/mp4-generator.ts"),W=D("./src/events.ts"),j=D("./src/errors.ts"),k=D("./src/utils/logger.ts"),I=D("./src/types/loader.ts"),m=D("./src/utils/timescale-conversion.ts");function c(){return c=Object.assign||function(O){for(var A=1;A<arguments.length;A++){var T=arguments[A];for(var E in T)Object.prototype.hasOwnProperty.call(T,E)&&(O[E]=T[E])}return O},c.apply(this,arguments)}var f=10*1e3,u=1024,r=1152,d=null,o=null,s=!1,l=function(){function O(T,E,y,h){if(h===void 0&&(h=""),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=T,this.config=E,this.typeSupported=y,this.ISGenerated=!1,d===null){var _=navigator.userAgent||"",g=_.match(/Chrome\/(\d+)/i);d=g?parseInt(g[1]):0}if(o===null){var b=navigator.userAgent.match(/Safari\/(\d+)/i);o=b?parseInt(b[1]):0}s=!!d&&d<75||!!o&&o<600}var A=O.prototype;return A.destroy=function(){},A.resetTimeStamp=function(E){k.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=E},A.resetNextTimestamp=function(){k.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},A.resetInitSegment=function(){k.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},A.getVideoStartPts=function(E){var y=!1,h=E.reduce(function(_,g){var b=g.pts-_;return b<-4294967296?(y=!0,p(_,g.pts)):b>0?_:g.pts},E[0].pts);return y&&k.logger.debug("PTS rollover detected"),h},A.remux=function(E,y,h,_,g,b,M,P){var K,V,B,C,$,ee,re=g,ue=g,Te=E.pid>-1,ye=y.pid>-1,be=y.samples.length,we=E.samples.length>0,xe=be>1,me=(!Te||we)&&(!ye||xe)||this.ISGenerated||M;if(me){this.ISGenerated||(B=this.generateIS(E,y,g));var se=this.isVideoContiguous,Re=-1;if(xe&&(Re=R(y.samples),!se&&this.config.forceKeyFrameOnDiscontinuity))if(ee=!0,Re>0){k.logger.warn("[mp4-remuxer]: Dropped "+Re+" out of "+be+" video samples due to a missing keyframe");var ze=this.getVideoStartPts(y.samples);y.samples=y.samples.slice(Re),y.dropped+=Re,ue+=(y.samples[0].pts-ze)/(y.timescale||9e4)}else Re===-1&&(k.logger.warn("[mp4-remuxer]: No keyframe found out of "+be+" video samples"),ee=!1);if(this.ISGenerated){if(we&&xe){var He=this.getVideoStartPts(y.samples),rt=p(E.samples[0].pts,He)-He,ot=rt/y.inputTimeScale;re+=Math.max(0,ot),ue+=Math.max(0,-ot)}if(we){if(E.samplerate||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),B=this.generateIS(E,y,g)),V=this.remuxAudio(E,re,this.isAudioContiguous,b,ye||xe||P===I.PlaylistLevelType.AUDIO?ue:void 0),xe){var Oe=V?V.endPTS-V.startPTS:0;y.inputTimeScale||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),B=this.generateIS(E,y,g)),K=this.remuxVideo(y,ue,se,Oe)}}else xe&&(K=this.remuxVideo(y,ue,se,0));K&&(K.firstKeyFrame=Re,K.independent=Re!==-1)}}return this.ISGenerated&&(h.samples.length&&($=this.remuxID3(h,g)),_.samples.length&&(C=this.remuxText(_,g))),{audio:V,video:K,initSegment:B,independent:ee,text:C,id3:$}},A.generateIS=function(E,y,h){var _=E.samples,g=y.samples,b=this.typeSupported,M={},P=!Object(Y.isFiniteNumber)(this._initPTS),K="audio/mp4",V,B,C;if(P&&(V=B=Infinity),E.config&&_.length&&(E.timescale=E.samplerate,E.isAAC||(b.mpeg?(K="audio/mpeg",E.codec=""):b.mp3&&(E.codec="mp3")),M.audio={id:"audio",container:K,codec:E.codec,initSegment:!E.isAAC&&b.mpeg?new Uint8Array(0):U.default.initSegment([E]),metadata:{channelCount:E.channelCount}},P&&(C=E.inputTimeScale,V=B=_[0].pts-Math.round(C*h))),y.sps&&y.pps&&g.length&&(y.timescale=y.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:y.codec,initSegment:U.default.initSegment([y]),metadata:{width:y.width,height:y.height}},P)){C=y.inputTimeScale;var $=this.getVideoStartPts(g),ee=Math.round(C*h);B=Math.min(B,p(g[0].dts,$)-ee),V=Math.min(V,$-ee)}if(Object.keys(M).length)return this.ISGenerated=!0,P&&(this._initPTS=V,this._initDTS=B),{tracks:M,initPTS:V,timescale:C}},A.remuxVideo=function(E,y,h,_){var g=E.inputTimeScale,b=E.samples,M=[],P=b.length,K=this._initPTS,V=this.nextAvcDts,B=8,C,$,ee,re=Number.POSITIVE_INFINITY,ue=Number.NEGATIVE_INFINITY,Te=0,ye=!1;if(!h||V===null){var be=y*g,we=b[0].pts-p(b[0].dts,b[0].pts);V=be-we}for(var xe=0;xe<P;xe++){var me=b[xe];if(me.pts=p(me.pts-K,V),me.dts=p(me.dts-K,V),me.dts>me.pts){var se=9e4*.2;Te=Math.max(Math.min(Te,me.pts-me.dts),-1*se)}me.dts<b[xe>0?xe-1:xe].dts&&(ye=!0)}ye&&b.sort(function(mt,_t){var Qe=mt.dts-_t.dts,Ft=mt.pts-_t.pts;return Qe||Ft}),$=b[0].dts,ee=b[b.length-1].dts;var Re=Math.round((ee-$)/(P-1));if(Te<0){if(Te<Re*-2){k.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(m.toMsFromMpegTsClock)(-Re,!0)+" ms");for(var ze=Te,He=0;He<P;He++)b[He].dts=ze=Math.max(ze,b[He].pts-Re),b[He].pts=Math.max(ze,b[He].pts)}else{k.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(m.toMsFromMpegTsClock)(Te,!0)+" ms to overcome this issue");for(var rt=0;rt<P;rt++)b[rt].dts=b[rt].dts+Te}$=b[0].dts}if(h){var ot=$-V,Oe=ot>Re,Le=ot<-1;if(Oe||Le){Oe?k.logger.warn("AVC: "+Object(m.toMsFromMpegTsClock)(ot,!0)+" ms ("+ot+"dts) hole between fragments detected, filling it"):k.logger.warn("AVC: "+Object(m.toMsFromMpegTsClock)(-ot,!0)+" ms ("+ot+"dts) overlapping between fragments detected"),$=V;var Ue=b[0].pts-ot;b[0].dts=$,b[0].pts=Ue,k.logger.log("Video: First PTS/DTS adjusted: "+Object(m.toMsFromMpegTsClock)(Ue,!0)+"/"+Object(m.toMsFromMpegTsClock)($,!0)+", delta: "+Object(m.toMsFromMpegTsClock)(ot,!0)+" ms")}}s&&($=Math.max(0,$));for(var Ge=0,je=0,Me=0;Me<P;Me++){for(var Pe=b[Me],ut=Pe.units,tt=ut.length,qe=0,$e=0;$e<tt;$e++)qe+=ut[$e].data.length;je+=qe,Ge+=tt,Pe.length=qe,Pe.dts=Math.max(Pe.dts,$),Pe.pts=Math.max(Pe.pts,Pe.dts,0),re=Math.min(Pe.pts,re),ue=Math.max(Pe.pts,ue)}ee=b[P-1].dts;var ft=je+4*Ge+8,nt;try{nt=new Uint8Array(ft)}catch(mt){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:j.ErrorTypes.MUX_ERROR,details:j.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ft,reason:"fail allocating video mdat "+ft});return}var Ye=new DataView(nt.buffer);Ye.setUint32(0,ft),nt.set(U.default.types.mdat,4);for(var Ae=0;Ae<P;Ae++){for(var ct=b[Ae],Je=ct.units,Se=0,Ne=0,ve=Je.length;Ne<ve;Ne++){var de=Je[Ne],pe=de.data,te=de.data.byteLength;Ye.setUint32(B,te),B+=4,nt.set(pe,B),B+=te,Se+=4+te}if(Ae<P-1)C=b[Ae+1].dts-ct.dts;else{var ie=this.config,oe=ct.dts-b[Ae>0?Ae-1:Ae].dts;if(ie.stretchShortVideoTrack&&this.nextAudioPts!==null){var he=Math.floor(ie.maxBufferHole*g),ge=(_?re+_*g:this.nextAudioPts)-ct.pts;ge>he?(C=ge-oe,C<0&&(C=oe),k.logger.log("[mp4-remuxer]: It is approximately "+ge/90+" ms to the next segment; using duration "+C/90+" ms for the last video frame.")):C=oe}else C=oe}var Ce=Math.round(ct.pts-ct.dts);M.push(new w(ct.key,C,Se,Ce))}if(M.length&&d&&d<70){var De=M[0].flags;De.dependsOn=2,De.isNonSync=0}console.assert(C!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=ee+C,this.isVideoContiguous=!0;var Ke=U.default.moof(E.sequenceNumber++,$,c({},E,{samples:M})),ht="video",it={data1:Ke,data2:nt,startPTS:re/g,endPTS:(ue+C)/g,startDTS:$/g,endDTS:V/g,type:ht,hasAudio:!1,hasVideo:!0,nb:M.length,dropped:E.dropped};return E.samples=[],E.dropped=0,console.assert(nt.length,"MDAT length must not be zero"),it},A.remuxAudio=function(E,y,h,_,g){var b=E.inputTimeScale,M=E.samplerate?E.samplerate:b,P=b/M,K=E.isAAC?u:r,V=K*P,B=this._initPTS,C=!E.isAAC&&this.typeSupported.mpeg,$=[],ee=E.samples,re=C?0:8,ue=this.nextAudioPts||-1,Te=y*b;if(this.isAudioContiguous=h=h||ee.length&&ue>0&&(_&&Math.abs(Te-ue)<9e3||Math.abs(p(ee[0].pts-B,Te)-ue)<20*V),ee.forEach(function(pe){pe.pts=p(pe.pts-B,Te)}),!h||ue<0){if(ee=ee.filter(function(pe){return pe.pts>=0}),!ee.length)return;g===0?ue=0:_?ue=Math.max(0,Te):ue=ee[0].pts}if(E.isAAC)for(var ye=g!==void 0,be=this.config.maxAudioFramesDrift,we=0,xe=ue;we<ee.length;we++){var me=ee[we],se=me.pts,Re=se-xe,ze=Math.abs(1e3*Re/b);if(Re<=-be*V&&ye)we===0&&(k.logger.warn("Audio frame @ "+(se/b).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Re/b)+" ms."),this.nextAudioPts=ue=xe=se);else if(Re>=be*V&&ze<f&&ye){var He=Math.round(Re/V);xe=se-He*V,xe<0&&(He--,xe+=V),we===0&&(this.nextAudioPts=ue=xe),k.logger.warn("[mp4-remuxer]: Injecting "+He+" audio frame @ "+(xe/b).toFixed(3)+"s due to "+Math.round(1e3*Re/b)+" ms gap.");for(var rt=0;rt<He;rt++){var ot=Math.max(xe,0),Oe=F.default.getSilentFrame(E.manifestCodec||E.codec,E.channelCount);Oe||(k.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Oe=me.unit.subarray()),ee.splice(we,0,{unit:Oe,pts:ot}),xe+=V,we++}}me.pts=xe,xe+=V}for(var Le=null,Ue=null,Ge,je=0,Me=ee.length;Me--;)je+=ee[Me].unit.byteLength;for(var Pe=0,ut=ee.length;Pe<ut;Pe++){var tt=ee[Pe],qe=tt.unit,$e=tt.pts;if(Ue!==null){var ft=$[Pe-1];ft.duration=Math.round(($e-Ue)/P)}else if(h&&E.isAAC&&($e=ue),Le=$e,je>0){je+=re;try{Ge=new Uint8Array(je)}catch(pe){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:j.ErrorTypes.MUX_ERROR,details:j.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:je,reason:"fail allocating audio mdat "+je});return}if(!C){var nt=new DataView(Ge.buffer);nt.setUint32(0,je),Ge.set(U.default.types.mdat,4)}}else return;Ge.set(qe,re);var Ye=qe.byteLength;re+=Ye,$.push(new w(!0,K,Ye,0)),Ue=$e}var Ae=$.length;if(!Ae)return;var ct=$[$.length-1];this.nextAudioPts=ue=Ue+P*ct.duration;var Je=C?new Uint8Array(0):U.default.moof(E.sequenceNumber++,Le/P,c({},E,{samples:$}));E.samples=[];var Se=Le/b,Ne=ue/b,ve="audio",de={data1:Je,data2:Ge,startPTS:Se,endPTS:Ne,startDTS:Se,endDTS:Ne,type:ve,hasAudio:!0,hasVideo:!1,nb:Ae};return this.isAudioContiguous=!0,console.assert(Ge.length,"MDAT length must not be zero"),de},A.remuxEmptyAudio=function(E,y,h,_){var g=E.inputTimeScale,b=E.samplerate?E.samplerate:g,M=g/b,P=this.nextAudioPts,K=(P!==null?P:_.startDTS*g)+this._initDTS,V=_.endDTS*g+this._initDTS,B=M*u,C=Math.ceil((V-K)/B),$=F.default.getSilentFrame(E.manifestCodec||E.codec,E.channelCount);if(k.logger.warn("[mp4-remuxer]: remux empty Audio"),!$){k.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ee=[],re=0;re<C;re++){var ue=K+re*B;ee.push({unit:$,pts:ue,dts:ue})}return E.samples=ee,this.remuxAudio(E,y,h,!1)},A.remuxID3=function(E,y){var h=E.samples.length;if(!h)return;for(var _=E.inputTimeScale,g=this._initPTS,b=this._initDTS,M=0;M<h;M++){var P=E.samples[M];P.pts=p(P.pts-g,y*_)/_,P.dts=p(P.dts-b,y*_)/_}var K=E.samples;return E.samples=[],{samples:K}},A.remuxText=function(E,y){var h=E.samples.length;if(!h)return;for(var _=E.inputTimeScale,g=this._initPTS,b=0;b<h;b++){var M=E.samples[b];M.pts=p(M.pts-g,y*_)/_}E.samples.sort(function(K,V){return K.pts-V.pts});var P=E.samples;return E.samples=[],{samples:P}},O}();function p(O,A){var T;if(A===null)return O;for(A<O?T=-8589934592:T=8589934592;Math.abs(O-A)>4294967296;)O+=T;return O}function R(O){for(var A=0;A<O.length;A++)if(O[A].key)return A;return-1}var w=function(A,T,E,y){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=T,this.size=E,this.cts=y,this.flags=new x(A)},x=function(A){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=A?2:1,this.isNonSync=A?0:1}},"./src/remux/passthrough-remuxer.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/polyfills/number.ts"),F=D("./src/utils/mp4-tools.ts"),U=D("./src/loader/fragment.ts"),W=D("./src/utils/logger.ts"),j=function(){function m(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var c=m.prototype;return c.destroy=function(){},c.resetTimeStamp=function(u){this.initPTS=u,this.lastEndDTS=null},c.resetNextTimestamp=function(){this.lastEndDTS=null},c.resetInitSegment=function(u,r,d){this.audioCodec=r,this.videoCodec=d,this.generateInitSegment(u),this.emitInitSegment=!0},c.generateInitSegment=function(u){var r=this.audioCodec,d=this.videoCodec;if(!u||!u.byteLength){this.initTracks=void 0,this.initData=void 0;return}var o=this.initData=Object(F.parseInitSegment)(u);r||(r=I(o.audio,U.ElementaryStreamTypes.AUDIO)),d||(d=I(o.video,U.ElementaryStreamTypes.VIDEO));var s={};o.audio&&o.video?s.audiovideo={container:"video/mp4",codec:r+","+d,initSegment:u,id:"main"}:o.audio?s.audio={container:"audio/mp4",codec:r,initSegment:u,id:"audio"}:o.video?s.video={container:"video/mp4",codec:d,initSegment:u,id:"main"}:W.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=s},c.remux=function(u,r,d,o,s){var l=this.initPTS,p=this.lastEndDTS,R={audio:void 0,video:void 0,text:o,id3:d,initSegment:void 0};Object(Y.isFiniteNumber)(p)||(p=this.lastEndDTS=s||0);var w=r.samples;if(!w||!w.length)return R;var x={initPTS:void 0,timescale:1},O=this.initData;if((!O||!O.length)&&(this.generateInitSegment(w),O=this.initData),!O||!O.length)return W.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),R;this.emitInitSegment&&(x.tracks=this.initTracks,this.emitInitSegment=!1),Object(Y.isFiniteNumber)(l)||(this.initPTS=x.initPTS=l=k(O,w,p));var A=Object(F.getDuration)(w,O),T=p,E=A+T;Object(F.offsetStartDTS)(O,w,l),A>0?this.lastEndDTS=E:(W.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var y=!!O.audio,h=!!O.video,_="";y&&(_+="audio"),h&&(_+="video");var g={data1:w,startPTS:T,startDTS:T,endPTS:E,endDTS:E,type:_,hasAudio:y,hasVideo:h,nb:1,dropped:0};return R.audio=g.type==="audio"?g:void 0,R.video=g.type!=="audio"?g:void 0,R.text=o,R.id3=d,R.initSegment=x,R},m}(),k=function(c,f,u){return Object(F.getStartDTS)(c,f)-u};function I(m,c){var f=m==null?void 0:m.codec;return f&&f.length>4?f:f==="hvc1"?"hvc1.1.c.L120.90":f==="av01"?"av01.0.04M.08":f==="avc1"||c===U.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}J.default=j},"./src/task-loop.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return Y});var Y=function(){function F(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var U=F.prototype;return U.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},U.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},U.onHandlerDestroyed=function(){},U.hasInterval=function(){return!!this._tickInterval},U.hasNextTick=function(){return!!this._tickTimer},U.setInterval=function(j){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,j),!0)},U.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},U.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},U.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},U.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},U.doTick=function(){},F}()},"./src/types/cmcd.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"CMCDVersion",function(){return Y}),D.d(J,"CMCDObjectType",function(){return F}),D.d(J,"CMCDStreamingFormat",function(){return U}),D.d(J,"CMCDStreamType",function(){return W});var Y=1,F;(function(j){j.MANIFEST="m",j.AUDIO="a",j.VIDEO="v",j.MUXED="av",j.INIT="i",j.CAPTION="c",j.TIMED_TEXT="tt",j.KEY="k",j.OTHER="o"})(F||(F={}));var U;(function(j){j.DASH="d",j.HLS="h",j.SMOOTH="s",j.OTHER="o"})(U||(U={}));var W;(function(j){j.VOD="v",j.LIVE="l"})(W||(W={}))},"./src/types/level.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"HlsSkip",function(){return U}),D.d(J,"getSkipValue",function(){return W}),D.d(J,"HlsUrlParameters",function(){return j}),D.d(J,"Level",function(){return k});function Y(I,m){for(var c=0;c<m.length;c++){var f=m[c];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(I,f.key,f)}}function F(I,m,c){return m&&Y(I.prototype,m),c&&Y(I,c),I}var U;(function(I){I.No="",I.Yes="YES",I.v2="v2"})(U||(U={}));function W(I,m){var c=I.canSkipUntil,f=I.canSkipDateRanges,u=I.endSN,r=m!==void 0?m-u:0;return c&&r<c?f?U.v2:U.Yes:U.No}var j=function(){function I(c,f,u){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=c,this.part=f,this.skip=u}var m=I.prototype;return m.addDirectives=function(f){var u=new self.URL(f);return this.msn!==void 0&&u.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&u.searchParams.set("_HLS_part",this.part.toString()),this.skip&&u.searchParams.set("_HLS_skip",this.skip),u.toString()},I}(),k=function(){function I(m){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[m.url],this.attrs=m.attrs,this.bitrate=m.bitrate,m.details&&(this.details=m.details),this.id=m.id||0,this.name=m.name,this.width=m.width||0,this.height=m.height||0,this.audioCodec=m.audioCodec,this.videoCodec=m.videoCodec,this.unknownCodecs=m.unknownCodecs,this.codecSet=[m.videoCodec,m.audioCodec].filter(function(c){return c}).join(",").replace(/\.[^.,]+/g,"")}return F(I,[{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(c){var f=c%this.url.length;this._urlId!==f&&(this.details=void 0,this._urlId=f)}}]),I}()},"./src/types/loader.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"PlaylistContextType",function(){return Y}),D.d(J,"PlaylistLevelType",function(){return F});var Y;(function(U){U.MANIFEST="manifest",U.LEVEL="level",U.AUDIO_TRACK="audioTrack",U.SUBTITLE_TRACK="subtitleTrack"})(Y||(Y={}));var F;(function(U){U.MAIN="main",U.AUDIO="audio",U.SUBTITLE="subtitle"})(F||(F={}))},"./src/types/transmuxer.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"ChunkMetadata",function(){return Y});var Y=function(W,j,k,I,m,c){I===void 0&&(I=0),m===void 0&&(m=-1),c===void 0&&(c=!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=F(),this.buffering={audio:F(),video:F(),audiovideo:F()},this.level=W,this.sn=j,this.id=k,this.size=I,this.part=m,this.partial=c};function F(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"AttrList",function(){return U});var Y=/^(\d+)x(\d+)$/,F=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,U=function(){function W(k){typeof k=="string"&&(k=W.parseAttrList(k));for(var I in k)k.hasOwnProperty(I)&&(this[I]=k[I])}var j=W.prototype;return j.decimalInteger=function(I){var m=parseInt(this[I],10);return m>Number.MAX_SAFE_INTEGER?Infinity:m},j.hexadecimalInteger=function(I){if(this[I]){var m=(this[I]||"0x").slice(2);m=(m.length&1?"0":"")+m;for(var c=new Uint8Array(m.length/2),f=0;f<m.length/2;f++)c[f]=parseInt(m.slice(f*2,f*2+2),16);return c}else return null},j.hexadecimalIntegerAsNumber=function(I){var m=parseInt(this[I],16);return m>Number.MAX_SAFE_INTEGER?Infinity:m},j.decimalFloatingPoint=function(I){return parseFloat(this[I])},j.optionalFloat=function(I,m){var c=this[I];return c?parseFloat(c):m},j.enumeratedString=function(I){return this[I]},j.bool=function(I){return this[I]==="YES"},j.decimalResolution=function(I){var m=Y.exec(this[I]);return m===null?void 0:{width:parseInt(m[1],10),height:parseInt(m[2],10)}},W.parseAttrList=function(I){var m,c={},f='"';for(F.lastIndex=0;(m=F.exec(I))!==null;){var u=m[2];u.indexOf(f)===0&&u.lastIndexOf(f)===u.length-1&&(u=u.slice(1,-1)),c[m[1]]=u}return c},W}()},"./src/utils/binary-search.ts":function(ae,J,D){"use strict";D.r(J);var Y={search:function(U,W){for(var j=0,k=U.length-1,I=null,m=null;j<=k;){I=(j+k)/2|0,m=U[I];var c=W(m);if(c>0)j=I+1;else if(c<0)k=I-1;else return m}return null}};J.default=Y},"./src/utils/buffer-helper.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"BufferHelper",function(){return U});var Y=D("./src/utils/logger.ts"),F={length:0,start:function(){return 0},end:function(){return 0}},U=function(){function W(){}return W.isBuffered=function(k,I){try{if(k){for(var m=W.getBuffered(k),c=0;c<m.length;c++)if(I>=m.start(c)&&I<=m.end(c))return!0}}catch(f){}return!1},W.bufferInfo=function(k,I,m){try{if(k){var c=W.getBuffered(k),f=[],u;for(u=0;u<c.length;u++)f.push({start:c.start(u),end:c.end(u)});return this.bufferedInfo(f,I,m)}}catch(r){}return{len:0,start:I,end:I,nextStart:void 0}},W.bufferedInfo=function(k,I,m){I=Math.max(0,I),k.sort(function(x,O){var A=x.start-O.start;return A||O.end-x.end});var c=[];if(m)for(var f=0;f<k.length;f++){var u=c.length;if(u){var r=c[u-1].end;k[f].start-r<m?k[f].end>r&&(c[u-1].end=k[f].end):c.push(k[f])}else c.push(k[f])}else c=k;for(var d=0,o,s=I,l=I,p=0;p<c.length;p++){var R=c[p].start,w=c[p].end;if(I+m>=R&&I<w)s=R,l=w,d=l-I;else if(I+m<R){o=R;break}}return{len:d,start:s||0,end:l||0,nextStart:o}},W.getBuffered=function(k){try{return k.buffered}catch(I){return Y.logger.log("failed to get media.buffered",I),F}},W}()},"./src/utils/cea-608-parser.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"Row",function(){return l}),D.d(J,"CaptionScreen",function(){return p});var Y=D("./src/utils/logger.ts"),F={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},U=function(E){var y=E;return F.hasOwnProperty(E)&&(y=F[E]),String.fromCharCode(y)},W=15,j=100,k={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},I={17:2,18:4,21:6,22:8,23:10,19:13,20:15},m={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},c={25:2,26:4,29:6,30:8,31:10,27:13,28:15},f=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],u;(function(T){T[T.ERROR=0]="ERROR",T[T.TEXT=1]="TEXT",T[T.WARNING=2]="WARNING",T[T.INFO=2]="INFO",T[T.DEBUG=3]="DEBUG",T[T.DATA=3]="DATA"})(u||(u={}));var r=function(){function T(){this.time=null,this.verboseLevel=u.ERROR}var E=T.prototype;return E.log=function(h,_){this.verboseLevel>=h&&Y.logger.log(this.time+" ["+h+"] "+_)},T}(),d=function(E){for(var y=[],h=0;h<E.length;h++)y.push(E[h].toString(16));return y},o=function(){function T(y,h,_,g,b){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=y||"white",this.underline=h||!1,this.italics=_||!1,this.background=g||"black",this.flash=b||!1}var E=T.prototype;return E.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},E.setStyles=function(h){for(var _=["foreground","underline","italics","background","flash"],g=0;g<_.length;g++){var b=_[g];h.hasOwnProperty(b)&&(this[b]=h[b])}},E.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},E.equals=function(h){return this.foreground===h.foreground&&this.underline===h.underline&&this.italics===h.italics&&this.background===h.background&&this.flash===h.flash},E.copy=function(h){this.foreground=h.foreground,this.underline=h.underline,this.italics=h.italics,this.background=h.background,this.flash=h.flash},E.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},T}(),s=function(){function T(y,h,_,g,b,M){this.uchar=void 0,this.penState=void 0,this.uchar=y||" ",this.penState=new o(h,_,g,b,M)}var E=T.prototype;return E.reset=function(){this.uchar=" ",this.penState.reset()},E.setChar=function(h,_){this.uchar=h,this.penState.copy(_)},E.setPenState=function(h){this.penState.copy(h)},E.equals=function(h){return this.uchar===h.uchar&&this.penState.equals(h.penState)},E.copy=function(h){this.uchar=h.uchar,this.penState.copy(h.penState)},E.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},T}(),l=function(){function T(y){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var h=0;h<j;h++)this.chars.push(new s);this.logger=y,this.pos=0,this.currPenState=new o}var E=T.prototype;return E.equals=function(h){for(var _=!0,g=0;g<j;g++)if(!this.chars[g].equals(h.chars[g])){_=!1;break}return _},E.copy=function(h){for(var _=0;_<j;_++)this.chars[_].copy(h.chars[_])},E.isEmpty=function(){for(var h=!0,_=0;_<j;_++)if(!this.chars[_].isEmpty()){h=!1;break}return h},E.setCursor=function(h){this.pos!==h&&(this.pos=h),this.pos<0?(this.logger.log(u.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>j&&(this.logger.log(u.DEBUG,"Too large cursor position "+this.pos),this.pos=j)},E.moveCursor=function(h){var _=this.pos+h;if(h>1)for(var g=this.pos+1;g<_+1;g++)this.chars[g].setPenState(this.currPenState);this.setCursor(_)},E.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},E.insertChar=function(h){h>=144&&this.backSpace();var _=U(h);if(this.pos>=j){this.logger.log(u.ERROR,"Cannot insert "+h.toString(16)+" ("+_+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(_,this.currPenState),this.moveCursor(1)},E.clearFromPos=function(h){var _;for(_=h;_<j;_++)this.chars[_].reset()},E.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},E.clearToEndOfRow=function(){this.clearFromPos(this.pos)},E.getTextString=function(){for(var h=[],_=!0,g=0;g<j;g++){var b=this.chars[g].uchar;b!==" "&&(_=!1),h.push(b)}return _?"":h.join("")},E.setPenStyles=function(h){this.currPenState.setStyles(h);var _=this.chars[this.pos];_.setPenState(this.currPenState)},T}(),p=function(){function T(y){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var h=0;h<W;h++)this.rows.push(new l(y));this.logger=y,this.currRow=W-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var E=T.prototype;return E.reset=function(){for(var h=0;h<W;h++)this.rows[h].clear();this.currRow=W-1},E.equals=function(h){for(var _=!0,g=0;g<W;g++)if(!this.rows[g].equals(h.rows[g])){_=!1;break}return _},E.copy=function(h){for(var _=0;_<W;_++)this.rows[_].copy(h.rows[_])},E.isEmpty=function(){for(var h=!0,_=0;_<W;_++)if(!this.rows[_].isEmpty()){h=!1;break}return h},E.backSpace=function(){var h=this.rows[this.currRow];h.backSpace()},E.clearToEndOfRow=function(){var h=this.rows[this.currRow];h.clearToEndOfRow()},E.insertChar=function(h){var _=this.rows[this.currRow];_.insertChar(h)},E.setPen=function(h){var _=this.rows[this.currRow];_.setPenStyles(h)},E.moveCursor=function(h){var _=this.rows[this.currRow];_.moveCursor(h)},E.setCursor=function(h){this.logger.log(u.INFO,"setCursor: "+h);var _=this.rows[this.currRow];_.setCursor(h)},E.setPAC=function(h){this.logger.log(u.INFO,"pacData = "+JSON.stringify(h));var _=h.row-1;if(this.nrRollUpRows&&_<this.nrRollUpRows-1&&(_=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==_){for(var g=0;g<W;g++)this.rows[g].clear();var b=this.currRow+1-this.nrRollUpRows,M=this.lastOutputScreen;if(M){var P=M.rows[b].cueStartTime,K=this.logger.time;if(P&&K!==null&&P<K)for(var V=0;V<this.nrRollUpRows;V++)this.rows[_-this.nrRollUpRows+V+1].copy(M.rows[b+V])}}this.currRow=_;var B=this.rows[this.currRow];if(h.indent!==null){var C=h.indent,$=Math.max(C-1,0);B.setCursor(h.indent),h.color=B.chars[$].penState.foreground}var ee={foreground:h.color,underline:h.underline,italics:h.italics,background:"black",flash:!1};this.setPen(ee)},E.setBkgData=function(h){this.logger.log(u.INFO,"bkgData = "+JSON.stringify(h)),this.backSpace(),this.setPen(h),this.insertChar(32)},E.setRollUpRows=function(h){this.nrRollUpRows=h},E.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(u.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(u.TEXT,this.getDisplayText());var h=this.currRow+1-this.nrRollUpRows,_=this.rows.splice(h,1)[0];_.clear(),this.rows.splice(this.currRow,0,_),this.logger.log(u.INFO,"Rolling up")},E.getDisplayText=function(h){h=h||!1;for(var _=[],g="",b=-1,M=0;M<W;M++){var P=this.rows[M].getTextString();P&&(b=M+1,h?_.push("Row "+b+": '"+P+"'"):_.push(P.trim()))}return _.length>0&&(h?g="["+_.join(" | ")+"]":g=_.join(`
|
|
`)),g},E.getTextAndFormat=function(){return this.rows},T}(),R=function(){function T(y,h,_){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=y,this.outputFilter=h,this.mode=null,this.verbose=0,this.displayedMemory=new p(_),this.nonDisplayedMemory=new p(_),this.lastOutputScreen=new p(_),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=_}var E=T.prototype;return E.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},E.getHandler=function(){return this.outputFilter},E.setHandler=function(h){this.outputFilter=h},E.setPAC=function(h){this.writeScreen.setPAC(h)},E.setBkgData=function(h){this.writeScreen.setBkgData(h)},E.setMode=function(h){if(h===this.mode)return;this.mode=h,this.logger.log(u.INFO,"MODE="+h),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=h},E.insertChars=function(h){for(var _=0;_<h.length;_++)this.writeScreen.insertChar(h[_]);var g=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(u.INFO,g+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(u.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},E.ccRCL=function(){this.logger.log(u.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},E.ccBS=function(){if(this.logger.log(u.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},E.ccAOF=function(){},E.ccAON=function(){},E.ccDER=function(){this.logger.log(u.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},E.ccRU=function(h){this.logger.log(u.INFO,"RU("+h+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(h)},E.ccFON=function(){this.logger.log(u.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},E.ccRDC=function(){this.logger.log(u.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},E.ccTR=function(){this.logger.log(u.INFO,"TR"),this.setMode("MODE_TEXT")},E.ccRTD=function(){this.logger.log(u.INFO,"RTD"),this.setMode("MODE_TEXT")},E.ccEDM=function(){this.logger.log(u.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},E.ccCR=function(){this.logger.log(u.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},E.ccENM=function(){this.logger.log(u.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},E.ccEOC=function(){if(this.logger.log(u.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var h=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=h,this.writeScreen=this.nonDisplayedMemory,this.logger.log(u.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},E.ccTO=function(h){this.logger.log(u.INFO,"TO("+h+") - Tab Offset"),this.writeScreen.moveCursor(h)},E.ccMIDROW=function(h){var _={flash:!1};if(_.underline=h%2===1,_.italics=h>=46,_.italics)_.foreground="white";else{var g=Math.floor(h/2)-16,b=["white","green","blue","cyan","red","yellow","magenta"];_.foreground=b[g]}this.logger.log(u.INFO,"MIDROW: "+JSON.stringify(_)),this.writeScreen.setPen(_)},E.outputDataUpdate=function(h){h===void 0&&(h=!1);var _=this.logger.time;if(_===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=_:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,_,this.lastOutputScreen),h&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:_),this.lastOutputScreen.copy(this.displayedMemory))},E.cueSplitAtTime=function(h){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,h,this.displayedMemory),this.cueStartTime=h))},T}(),w=function(){function T(y,h,_){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var g=new r;this.channels=[null,new R(y,h,g),new R(y+1,_,g)],this.cmdHistory=A(),this.logger=g}var E=T.prototype;return E.getHandler=function(h){return this.channels[h].getHandler()},E.setHandler=function(h,_){this.channels[h].setHandler(_)},E.addData=function(h,_){var g,b,M,P=!1;this.logger.time=h;for(var K=0;K<_.length;K+=2){if(b=_[K]&127,M=_[K+1]&127,b===0&&M===0)continue;if(this.logger.log(u.DATA,"["+d([_[K],_[K+1]])+"] -> ("+d([b,M])+")"),g=this.parseCmd(b,M),g||(g=this.parseMidrow(b,M)),g||(g=this.parsePAC(b,M)),g||(g=this.parseBackgroundAttributes(b,M)),!g&&(P=this.parseChars(b,M),P)){var V=this.currentChannel;if(V&&V>0){var B=this.channels[V];B.insertChars(P)}else this.logger.log(u.WARNING,"No channel found yet. TEXT-MODE?")}!g&&!P&&this.logger.log(u.WARNING,"Couldn't parse cleaned data "+d([b,M])+" orig: "+d([_[K],_[K+1]]))}},E.parseCmd=function(h,_){var g=this.cmdHistory,b=(h===20||h===28||h===21||h===29)&&_>=32&&_<=47,M=(h===23||h===31)&&_>=33&&_<=35;if(!(b||M))return!1;if(O(h,_,g))return x(null,null,g),this.logger.log(u.DEBUG,"Repeated command ("+d([h,_])+") is dropped"),!0;var P=h===20||h===21||h===23?1:2,K=this.channels[P];return h===20||h===21||h===28||h===29?_===32?K.ccRCL():_===33?K.ccBS():_===34?K.ccAOF():_===35?K.ccAON():_===36?K.ccDER():_===37?K.ccRU(2):_===38?K.ccRU(3):_===39?K.ccRU(4):_===40?K.ccFON():_===41?K.ccRDC():_===42?K.ccTR():_===43?K.ccRTD():_===44?K.ccEDM():_===45?K.ccCR():_===46?K.ccENM():_===47&&K.ccEOC():K.ccTO(_-32),x(h,_,g),this.currentChannel=P,!0},E.parseMidrow=function(h,_){var g=0;if((h===17||h===25)&&_>=32&&_<=47){if(h===17?g=1:g=2,g!==this.currentChannel)return this.logger.log(u.ERROR,"Mismatch channel in midrow parsing"),!1;var b=this.channels[g];return b?(b.ccMIDROW(_),this.logger.log(u.DEBUG,"MIDROW ("+d([h,_])+")"),!0):!1}return!1},E.parsePAC=function(h,_){var g,b=this.cmdHistory,M=(h>=17&&h<=23||h>=25&&h<=31)&&_>=64&&_<=127,P=(h===16||h===24)&&_>=64&&_<=95;if(!(M||P))return!1;if(O(h,_,b))return x(null,null,b),!0;var K=h<=23?1:2;_>=64&&_<=95?g=K===1?k[h]:m[h]:g=K===1?I[h]:c[h];var V=this.channels[K];return V?(V.setPAC(this.interpretPAC(g,_)),x(h,_,b),this.currentChannel=K,!0):!1},E.interpretPAC=function(h,_){var g,b={color:null,italics:!1,indent:null,underline:!1,row:h};return _>95?g=_-96:g=_-64,b.underline=(g&1)===1,g<=13?b.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(g/2)]:g<=15?(b.italics=!0,b.color="white"):b.indent=Math.floor((g-16)/2)*4,b},E.parseChars=function(h,_){var g,b=null,M=null;if(h>=25?(g=2,M=h-8):(g=1,M=h),M>=17&&M<=19){var P;M===17?P=_+80:M===18?P=_+112:P=_+144,this.logger.log(u.INFO,"Special char '"+U(P)+"' in channel "+g),b=[P]}else h>=32&&h<=127&&(b=_===0?[h]:[h,_]);if(b){var K=d(b);this.logger.log(u.DEBUG,"Char codes = "+K.join(",")),x(h,_,this.cmdHistory)}return b},E.parseBackgroundAttributes=function(h,_){var g=(h===16||h===24)&&_>=32&&_<=47,b=(h===23||h===31)&&_>=45&&_<=47;if(!(g||b))return!1;var M,P={};h===16||h===24?(M=Math.floor((_-32)/2),P.background=f[M],_%2===1&&(P.background=P.background+"_semi")):_===45?P.background="transparent":(P.foreground="black",_===47&&(P.underline=!0));var K=h<=23?1:2,V=this.channels[K];return V.setBkgData(P),x(h,_,this.cmdHistory),!0},E.reset=function(){for(var h=0;h<Object.keys(this.channels).length;h++){var _=this.channels[h];_&&_.reset()}this.cmdHistory=A()},E.cueSplitAtTime=function(h){for(var _=0;_<this.channels.length;_++){var g=this.channels[_];g&&g.cueSplitAtTime(h)}},T}();function x(T,E,y){y.a=T,y.b=E}function O(T,E,y){return y.a===T&&y.b===E}function A(){return{a:null,b:null}}J.default=w},"./src/utils/codecs.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"isCodecType",function(){return F}),D.d(J,"isCodecSupportedInMp4",function(){return U});var Y={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function F(W,j){var k=Y[j];return!!k&&k[W.slice(0,4)]===!0}function U(W,j){return MediaSource.isTypeSupported((j||"video")+'/mp4;codecs="'+W+'"')}},"./src/utils/cues.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/utils/vttparser.ts"),F=D("./src/utils/webvtt-parser.ts"),U=D("./src/utils/texttrack-utils.ts"),W=/\s/,j={newCue:function(I,m,c,f){for(var u=[],r,d,o,s,l,p=self.VTTCue||self.TextTrackCue,R=0;R<f.rows.length;R++)if(r=f.rows[R],o=!0,s=0,l="",!r.isEmpty()){for(var w=0;w<r.chars.length;w++)W.test(r.chars[w].uchar)&&o?s++:(l+=r.chars[w].uchar,o=!1);r.cueStartTime=m,m===c&&(c+=1e-4),s>=16?s--:s++;var x=Object(Y.fixLineBreaks)(l.trim()),O=Object(F.generateCueId)(m,c,x);(!I||!I.cues||!I.cues.getCueById(O))&&(d=new p(m,c,x),d.id=O,d.line=R+1,d.align="left",d.position=10+Math.min(80,Math.floor(s*8/32)*10),u.push(d))}return I&&u.length&&(u.sort(function(A,T){return A.line==="auto"||T.line==="auto"?0:A.line>8&&T.line>8?T.line-A.line:A.line-T.line}),u.forEach(function(A){return Object(U.addCueToTrack)(I,A)})),u}};J.default=j},"./src/utils/discontinuities.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"findFirstFragWithCC",function(){return W}),D.d(J,"shouldAlignOnDiscontinuities",function(){return j}),D.d(J,"findDiscontinuousReferenceFrag",function(){return k}),D.d(J,"adjustSlidingStart",function(){return m}),D.d(J,"alignStream",function(){return c}),D.d(J,"alignPDT",function(){return u}),D.d(J,"alignFragmentByPDTDelta",function(){return r}),D.d(J,"alignMediaPlaylistByPDT",function(){return d});var Y=D("./src/polyfills/number.ts"),F=D("./src/utils/logger.ts"),U=D("./src/controller/level-helper.ts");function W(o,s){for(var l=null,p=0,R=o.length;p<R;p++){var w=o[p];if(w&&w.cc===s){l=w;break}}return l}function j(o,s,l){return!!(s.details&&(l.endCC>l.startCC||o&&o.cc<l.startCC))}function k(o,s){var l=o.fragments,p=s.fragments;if(!p.length||!l.length){F.logger.log("No fragments to align");return}var R=W(l,p[0].cc);if(!R||R&&!R.startPTS){F.logger.log("No frag in previous level to align on");return}return R}function I(o,s){if(o){var l=o.start+s;o.start=o.startPTS=l,o.endPTS=l+o.duration}}function m(o,s){for(var l=s.fragments,p=0,R=l.length;p<R;p++)I(l[p],o);s.fragmentHint&&I(s.fragmentHint,o),s.alignedSliding=!0}function c(o,s,l){if(!s)return;f(o,l,s),!l.alignedSliding&&s.details&&u(l,s.details),!l.alignedSliding&&s.details&&!l.skippedSegments&&Object(U.adjustSliding)(s.details,l)}function f(o,s,l){if(j(o,l,s)){var p=k(l.details,s);p&&Object(Y.isFiniteNumber)(p.start)&&(F.logger.log("Adjusting PTS using last level due to CC increase within current level "+s.url),m(p.start,s))}}function u(o,s){if(!s.fragments.length||!o.hasProgramDateTime||!s.hasProgramDateTime)return;var l=s.fragments[0].programDateTime,p=o.fragments[0].programDateTime,R=(p-l)/1e3+s.fragments[0].start;R&&Object(Y.isFiniteNumber)(R)&&(F.logger.log("Adjusting PTS using programDateTime delta "+(p-l)+"ms, sliding:"+R.toFixed(3)+" "+o.url+" "),m(R,o))}function r(o,s){var l=o.programDateTime;if(!l)return;var p=(l-s)/1e3;o.start=o.startPTS=p,o.endPTS=p+o.duration}function d(o,s){if(!s.fragments.length||!o.hasProgramDateTime||!s.hasProgramDateTime)return;var l=s.fragments[0].programDateTime,p=s.fragments[0].start,R=l-p*1e3;o.fragments.forEach(function(w){r(w,R)}),o.fragmentHint&&r(o.fragmentHint,R),o.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/utils/ewma.ts"),F=function(){function U(j,k,I){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=I,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Y.default(j),this.fast_=new Y.default(k)}var W=U.prototype;return W.update=function(k,I){var m=this.slow_,c=this.fast_;this.slow_.halfLife!==k&&(this.slow_=new Y.default(k,m.getEstimate(),m.getTotalWeight())),this.fast_.halfLife!==I&&(this.fast_=new Y.default(I,c.getEstimate(),c.getTotalWeight()))},W.sample=function(k,I){k=Math.max(k,this.minDelayMs_);var m=8*I,c=k/1e3,f=m/c;this.fast_.sample(c,f),this.slow_.sample(c,f)},W.canEstimate=function(){var k=this.fast_;return k&&k.getTotalWeight()>=this.minWeight_},W.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},W.destroy=function(){},U}();J.default=F},"./src/utils/ewma.ts":function(ae,J,D){"use strict";D.r(J);var Y=function(){function F(W,j,k){j===void 0&&(j=0),k===void 0&&(k=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=W,this.alpha_=W?Math.exp(Math.log(.5)/W):0,this.estimate_=j,this.totalWeight_=k}var U=F.prototype;return U.sample=function(j,k){var I=Math.pow(this.alpha_,j);this.estimate_=k*(1-I)+I*this.estimate_,this.totalWeight_+=j},U.getTotalWeight=function(){return this.totalWeight_},U.getEstimate=function(){if(this.alpha_){var j=1-Math.pow(this.alpha_,this.totalWeight_);if(j)return this.estimate_/j}return this.estimate_},F}();J.default=Y},"./src/utils/fetch-loader.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"fetchSupported",function(){return r});var Y=D("./src/polyfills/number.ts"),F=D("./src/loader/load-stats.ts"),U=D("./src/demux/chunk-cache.ts");function W(p,R){p.prototype=Object.create(R.prototype),p.prototype.constructor=p,c(p,R)}function j(p){var R=typeof Map=="function"?new Map:void 0;return j=function(x){if(x===null||!m(x))return x;if(typeof x!="function")throw new TypeError("Super expression must either be null or a function");if(typeof R!="undefined"){if(R.has(x))return R.get(x);R.set(x,O)}function O(){return k(x,arguments,f(this).constructor)}return O.prototype=Object.create(x.prototype,{constructor:{value:O,enumerable:!1,writable:!0,configurable:!0}}),c(O,x)},j(p)}function k(p,R,w){return I()?k=Reflect.construct:k=function(O,A,T){var E=[null];E.push.apply(E,A);var y=Function.bind.apply(O,E),h=new y;return T&&c(h,T.prototype),h},k.apply(null,arguments)}function I(){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(p){return!1}}function m(p){return Function.toString.call(p).indexOf("[native code]")!==-1}function c(p,R){return c=Object.setPrototypeOf||function(x,O){return x.__proto__=O,x},c(p,R)}function f(p){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(w){return w.__proto__||Object.getPrototypeOf(w)},f(p)}function u(){return u=Object.assign||function(p){for(var R=1;R<arguments.length;R++){var w=arguments[R];for(var x in w)Object.prototype.hasOwnProperty.call(w,x)&&(p[x]=w[x])}return p},u.apply(this,arguments)}function r(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(p){}return!1}var d=function(){function p(w){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=w.fetchSetup||s,this.controller=new self.AbortController,this.stats=new F.LoadStats}var R=p.prototype;return R.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},R.abortInternal=function(){var x=this.response;(!x||!x.ok)&&(this.stats.aborted=!0,this.controller.abort())},R.abort=function(){var x;this.abortInternal(),(x=this.callbacks)!==null&&x!==void 0&&x.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},R.load=function(x,O,A){var T=this,E=this.stats;if(E.loading.start)throw new Error("Loader can only be used once.");E.loading.start=self.performance.now();var y=o(x,this.controller.signal),h=A.onProgress,_=x.responseType==="arraybuffer",g=_?"byteLength":"length";this.context=x,this.config=O,this.callbacks=A,this.request=this.fetchSetup(x,y),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){T.abortInternal(),A.onTimeout(E,x,T.response)},O.timeout),self.fetch(this.request).then(function(b){if(T.response=T.loader=b,!b.ok){var M=b.status,P=b.statusText;throw new l(P||"fetch, bad network response",M,b)}return E.loading.first=Math.max(self.performance.now(),E.loading.start),E.total=parseInt(b.headers.get("Content-Length")||"0"),h&&Object(Y.isFiniteNumber)(O.highWaterMark)?T.loadProgressively(b,E,x,O.highWaterMark,h):_?b.arrayBuffer():b.text()}).then(function(b){var M=T.response;self.clearTimeout(T.requestTimeout),E.loading.end=Math.max(self.performance.now(),E.loading.first),E.loaded=E.total=b[g];var P={url:M.url,data:b};h&&!Object(Y.isFiniteNumber)(O.highWaterMark)&&h(E,x,b,M),A.onSuccess(P,E,x,M)}).catch(function(b){if(self.clearTimeout(T.requestTimeout),E.aborted)return;var M=b.code||0;A.onError({code:M,text:b.message},x,b.details)})},R.getCacheAge=function(){var x=null;if(this.response){var O=this.response.headers.get("age");x=O?parseFloat(O):null}return x},R.loadProgressively=function(x,O,A,T,E){T===void 0&&(T=0);var y=new U.default,h=x.body.getReader(),_=function g(){return h.read().then(function(b){if(b.done)return y.dataLength&&E(O,A,y.flush(),x),Promise.resolve(new ArrayBuffer(0));var M=b.value,P=M.length;return O.loaded+=P,P<T||y.dataLength?(y.push(M),y.dataLength>=T&&E(O,A,y.flush(),x)):E(O,A,M,x),g()}).catch(function(){return Promise.reject()})};return _()},p}();function o(p,R){var w={method:"GET",mode:"cors",credentials:"same-origin",signal:R,headers:new self.Headers(u({},p.headers))};return p.rangeEnd&&w.headers.set("Range","bytes="+p.rangeStart+"-"+String(p.rangeEnd-1)),w}function s(p,R){return new self.Request(p.url,R)}var l=function(p){W(R,p);function R(w,x,O){var A;return A=p.call(this,w)||this,A.code=void 0,A.details=void 0,A.code=x,A.details=O,A}return R}(j(Error));J.default=d},"./src/utils/imsc1-ttml-parser.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"IMSC1_CODEC",function(){return m}),D.d(J,"parseIMSC1",function(){return r});var Y=D("./src/utils/mp4-tools.ts"),F=D("./src/utils/vttparser.ts"),U=D("./src/utils/vttcue.ts"),W=D("./src/demux/id3.ts"),j=D("./src/utils/timescale-conversion.ts"),k=D("./src/utils/webvtt-parser.ts");function I(){return I=Object.assign||function(T){for(var E=1;E<arguments.length;E++){var y=arguments[E];for(var h in y)Object.prototype.hasOwnProperty.call(y,h)&&(T[h]=y[h])}return T},I.apply(this,arguments)}var m="stpp.ttml.im1t",c=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,f=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,u={left:"start",center:"center",right:"end",start:"start",end:"end"};function r(T,E,y,h,_){var g=Object(Y.findBox)(new Uint8Array(T),["mdat"]);if(g.length===0){_(new Error("Could not parse IMSC1 mdat"));return}var b=g[0],M=Object(W.utf8ArrayToStr)(new Uint8Array(T,b.start,b.end-b.start)),P=Object(j.toTimescaleFromScale)(E,1,y);try{h(d(M,P))}catch(K){_(K)}}function d(T,E){var y=new DOMParser,h=y.parseFromString(T,"text/xml"),_=h.getElementsByTagName("tt")[0];if(!_)throw new Error("Invalid ttml");var g={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},b=Object.keys(g).reduce(function(B,C){return B[C]=_.getAttribute("ttp:"+C)||g[C],B},{}),M=_.getAttribute("xml:space")!=="preserve",P=s(o(_,"styling","style")),K=s(o(_,"layout","region")),V=o(_,"body","[begin]");return[].map.call(V,function(B){var C=l(B,M);if(!C||!B.hasAttribute("begin"))return null;var $=x(B.getAttribute("begin"),b),ee=x(B.getAttribute("dur"),b),re=x(B.getAttribute("end"),b);if($===null)throw w(B);if(re===null){if(ee===null)throw w(B);re=$+ee}var ue=new U.default($-E,re-E,C);ue.id=Object(k.generateCueId)(ue.startTime,ue.endTime,ue.text);var Te=K[B.getAttribute("region")],ye=P[B.getAttribute("style")];ue.position=10,ue.size=80;var be=p(Te,ye),we=be.textAlign;if(we){var xe=u[we];xe&&(ue.lineAlign=xe),ue.align=we}return I(ue,be),ue}).filter(function(B){return B!==null})}function o(T,E,y){var h=T.getElementsByTagName(E)[0];return h?[].slice.call(h.querySelectorAll(y)):[]}function s(T){return T.reduce(function(E,y){var h=y.getAttribute("xml:id");return h&&(E[h]=y),E},{})}function l(T,E){return[].slice.call(T.childNodes).reduce(function(y,h,_){var g;return h.nodeName==="br"&&_?y+`
|
|
`:(g=h.childNodes)!==null&&g!==void 0&&g.length?l(h,E):E?y+h.textContent.trim().replace(/\s+/g," "):y+h.textContent},"")}function p(T,E){var y="http://www.w3.org/ns/ttml#styling",h=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return h.reduce(function(_,g){var b=R(E,y,g)||R(T,y,g);return b&&(_[g]=b),_},{})}function R(T,E,y){return T.hasAttributeNS(E,y)?T.getAttributeNS(E,y):null}function w(T){return new Error("Could not parse ttml timestamp "+T)}function x(T,E){if(!T)return null;var y=Object(F.parseTimeStamp)(T);return y===null&&(c.test(T)?y=O(T,E):f.test(T)&&(y=A(T,E))),y}function O(T,E){var y=c.exec(T),h=(y[4]|0)+(y[5]|0)/E.subFrameRate;return(y[1]|0)*3600+(y[2]|0)*60+(y[3]|0)+h/E.frameRate}function A(T,E){var y=f.exec(T),h=Number(y[1]),_=y[2];switch(_){case"h":return h*3600;case"m":return h*60;case"ms":return h*1e3;case"f":return h/E.frameRate;case"t":return h/E.tickRate}return h}},"./src/utils/logger.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"enableLogs",function(){return k}),D.d(J,"logger",function(){return I});var Y=function(){},F={trace:Y,debug:Y,log:Y,warn:Y,info:Y,error:Y},U=F;function W(m){var c=self.console[m];return c?c.bind(self.console,"["+m+"] >"):Y}function j(m){for(var c=arguments.length,f=new Array(c>1?c-1:0),u=1;u<c;u++)f[u-1]=arguments[u];f.forEach(function(r){U[r]=m[r]?m[r].bind(m):W(r)})}function k(m){if(self.console&&m===!0||typeof m=="object"){j(m,"debug","log","info","warn","error");try{U.log()}catch(c){U=F}}else U=F}var I=U},"./src/utils/mediakeys-helper.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"KeySystems",function(){return Y}),D.d(J,"requestMediaKeySystemAccess",function(){return F});var Y;(function(U){U.WIDEVINE="com.widevine.alpha",U.PLAYREADY="com.microsoft.playready"})(Y||(Y={}));var F=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"getMediaSource",function(){return Y});function Y(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"bin2str",function(){return j}),D.d(J,"readUint16",function(){return k}),D.d(J,"readUint32",function(){return I}),D.d(J,"writeUint32",function(){return m}),D.d(J,"findBox",function(){return c}),D.d(J,"parseSegmentIndex",function(){return f}),D.d(J,"parseInitSegment",function(){return u}),D.d(J,"getStartDTS",function(){return r}),D.d(J,"getDuration",function(){return d}),D.d(J,"computeRawDurationFromSamples",function(){return o}),D.d(J,"offsetStartDTS",function(){return s}),D.d(J,"segmentValidRange",function(){return l}),D.d(J,"appendUint8Array",function(){return p});var Y=D("./src/utils/typed-array.ts"),F=D("./src/loader/fragment.ts"),U=Math.pow(2,32)-1,W=[].push;function j(R){return String.fromCharCode.apply(null,R)}function k(R,w){"data"in R&&(w+=R.start,R=R.data);var x=R[w]<<8|R[w+1];return x<0?65536+x:x}function I(R,w){"data"in R&&(w+=R.start,R=R.data);var x=R[w]<<24|R[w+1]<<16|R[w+2]<<8|R[w+3];return x<0?4294967296+x:x}function m(R,w,x){"data"in R&&(w+=R.start,R=R.data),R[w]=x>>24,R[w+1]=x>>16&255,R[w+2]=x>>8&255,R[w+3]=x&255}function c(R,w){var x=[];if(!w.length)return x;var O,A,T;"data"in R?(O=R.data,A=R.start,T=R.end):(O=R,A=0,T=O.byteLength);for(var E=A;E<T;){var y=I(O,E),h=j(O.subarray(E+4,E+8)),_=y>1?E+y:T;if(h===w[0])if(w.length===1)x.push({data:O,start:E+8,end:_});else{var g=c({data:O,start:E+8,end:_},w.slice(1));g.length&&W.apply(x,g)}E=_}return x}function f(R){var w=c(R,["moov"]),x=w[0],O=x?x.end:null,A=c(R,["sidx"]);if(!A||!A[0])return null;var T=[],E=A[0],y=E.data[0],h=y===0?8:16,_=I(E,h);h+=4;var g=0,b=0;y===0?h+=8:h+=16,h+=2;var M=E.end+b,P=k(E,h);h+=2;for(var K=0;K<P;K++){var V=h,B=I(E,V);V+=4;var C=B&2147483647,$=(B&2147483648)>>>31;if($===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ee=I(E,V);V+=4,T.push({referenceSize:C,subsegmentDuration:ee,info:{duration:ee/_,start:M,end:M+C-1}}),M+=C,V+=4,h=V}return{earliestPresentationTime:g,timescale:_,version:y,referencesCount:P,references:T,moovEndOffset:O}}function u(R){for(var w=[],x=c(R,["moov","trak"]),O=0;O<x.length;O++){var A=x[O],T=c(A,["tkhd"])[0];if(T){var E=T.data[T.start],y=E===0?12:20,h=I(T,y),_=c(A,["mdia","mdhd"])[0];if(_){E=_.data[_.start],y=E===0?12:20;var g=I(_,y),b=c(A,["mdia","hdlr"])[0];if(b){var M=j(b.data.subarray(b.start+8,b.start+12)),P={soun:F.ElementaryStreamTypes.AUDIO,vide:F.ElementaryStreamTypes.VIDEO}[M];if(P){var K=c(A,["mdia","minf","stbl","stsd"])[0],V=void 0;K&&(V=j(K.data.subarray(K.start+12,K.start+16))),w[h]={timescale:g,type:P},w[P]={timescale:g,id:h,codec:V}}}}}}var B=c(R,["moov","mvex","trex"]);return B.forEach(function(C){var $=I(C,4),ee=w[$];ee&&(ee.default={duration:I(C,12),flags:I(C,20)})}),w}function r(R,w){return c(w,["moof","traf"]).reduce(function(x,O){var A=c(O,["tfdt"])[0],T=A.data[A.start],E=c(O,["tfhd"]).reduce(function(y,h){var _=I(h,4),g=R[_];if(g){var b=I(A,4);T===1&&(b*=Math.pow(2,32),b+=I(A,8));var M=g.timescale||9e4,P=b/M;if(isFinite(P)&&(y===null||P<y))return P}return y},null);return E!==null&&isFinite(E)&&(x===null||E<x)?E:x},null)||0}function d(R,w){for(var x=0,O=0,A=0,T=c(R,["moof","traf"]),E=0;E<T.length;E++){var y=T[E],h=c(y,["tfhd"])[0],_=I(h,4),g=w[_];if(!g)continue;var b=g.default,M=I(h,0)|(b==null?void 0:b.flags),P=b==null?void 0:b.duration;M&8&&(M&2?P=I(h,12):P=I(h,8));for(var K=g.timescale||9e4,V=c(y,["trun"]),B=0;B<V.length;B++){if(P){var C=I(V[B],4);x=P*C}else x=o(V[B]);g.type===F.ElementaryStreamTypes.VIDEO?O+=x/K:g.type===F.ElementaryStreamTypes.AUDIO&&(A+=x/K)}}if(O===0&&A===0){var $=f(R);if($!=null&&$.references)return $.references.reduce(function(ee,re){return ee+re.info.duration||0},0)}return O||A}function o(R){var w=I(R,0),x=8;w&1&&(x+=4),w&4&&(x+=4);for(var O=0,A=I(R,4),T=0;T<A;T++){if(w&256){var E=I(R,x);O+=E,x+=4}w&512&&(x+=4),w&1024&&(x+=4),w&2048&&(x+=4)}return O}function s(R,w,x){c(w,["moof","traf"]).forEach(function(O){c(O,["tfhd"]).forEach(function(A){var T=I(A,4),E=R[T];if(!E)return;var y=E.timescale||9e4;c(O,["tfdt"]).forEach(function(h){var _=h.data[h.start],g=I(h,4);if(_===0)m(h,4,g-x*y);else{g*=Math.pow(2,32),g+=I(h,8),g-=x*y,g=Math.max(g,0);var b=Math.floor(g/(U+1)),M=Math.floor(g%(U+1));m(h,4,b),m(h,8,M)}})})})}function l(R){var w={valid:null,remainder:null},x=c(R,["moof"]);if(x){if(x.length<2)return w.remainder=R,w}else return w;var O=x[x.length-1];return w.valid=Object(Y.sliceUint8)(R,0,O.start-8),w.remainder=Object(Y.sliceUint8)(R,O.start-8),w}function p(R,w){var x=new Uint8Array(R.length+w.length);return x.set(R),x.set(w,R.length),x}},"./src/utils/output-filter.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return Y});var Y=function(){function F(W,j){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=W,this.trackName=j}var U=F.prototype;return U.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},U.newCue=function(j,k,I){(this.startTime===null||this.startTime>j)&&(this.startTime=j),this.endTime=k,this.screen=I,this.timelineController.createCaptionsTrack(this.trackName)},U.reset=function(){this.cueRanges=[]},F}()},"./src/utils/texttrack-utils.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"sendAddTrackEvent",function(){return F}),D.d(J,"addCueToTrack",function(){return U}),D.d(J,"clearCurrentCues",function(){return W}),D.d(J,"removeCuesInRange",function(){return j}),D.d(J,"getCuesInRange",function(){return I});var Y=D("./src/utils/logger.ts");function F(m,c){var f;try{f=new Event("addtrack")}catch(u){f=document.createEvent("Event"),f.initEvent("addtrack",!1,!1)}f.track=m,c.dispatchEvent(f)}function U(m,c){var f=m.mode;if(f==="disabled"&&(m.mode="hidden"),m.cues&&!m.cues.getCueById(c.id))try{if(m.addCue(c),!m.cues.getCueById(c.id))throw new Error("addCue is failed for: "+c)}catch(r){Y.logger.debug("[texttrack-utils]: "+r);var u=new self.TextTrackCue(c.startTime,c.endTime,c.text);u.id=c.id,m.addCue(u)}f==="disabled"&&(m.mode=f)}function W(m){var c=m.mode;if(c==="disabled"&&(m.mode="hidden"),m.cues)for(var f=m.cues.length;f--;)m.removeCue(m.cues[f]);c==="disabled"&&(m.mode=c)}function j(m,c,f){var u=m.mode;if(u==="disabled"&&(m.mode="hidden"),m.cues&&m.cues.length>0)for(var r=I(m.cues,c,f),d=0;d<r.length;d++)m.removeCue(r[d]);u==="disabled"&&(m.mode=u)}function k(m,c){if(c<m[0].startTime)return 0;var f=m.length-1;if(c>m[f].endTime)return-1;for(var u=0,r=f;u<=r;){var d=Math.floor((r+u)/2);if(c<m[d].startTime)r=d-1;else if(c>m[d].startTime&&u<f)u=d+1;else return d}return m[u].startTime-c<c-m[r].startTime?u:r}function I(m,c,f){var u=[],r=k(m,c);if(r>-1)for(var d=r,o=m.length;d<o;d++){var s=m[d];if(s.startTime>=c&&s.endTime<=f)u.push(s);else if(s.startTime>f)return u}return u}},"./src/utils/time-ranges.ts":function(ae,J,D){"use strict";D.r(J);var Y={toString:function(U){for(var W="",j=U.length,k=0;k<j;k++)W+="["+U.start(k).toFixed(3)+","+U.end(k).toFixed(3)+"]";return W}};J.default=Y},"./src/utils/timescale-conversion.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"toTimescaleFromBase",function(){return F}),D.d(J,"toTimescaleFromScale",function(){return U}),D.d(J,"toMsFromMpegTsClock",function(){return W}),D.d(J,"toMpegTsClockFromTimescale",function(){return j});var Y=9e4;function F(k,I,m,c){m===void 0&&(m=1),c===void 0&&(c=!1);var f=k*I*m;return c?Math.round(f):f}function U(k,I,m,c){return m===void 0&&(m=1),c===void 0&&(c=!1),F(k,I,1/m,c)}function W(k,I){return I===void 0&&(I=!1),F(k,1e3,1/Y,I)}function j(k,I){return I===void 0&&(I=1),F(k,Y,1/I)}},"./src/utils/typed-array.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"sliceUint8",function(){return Y});function Y(F,U,W){return Uint8Array.prototype.slice?F.slice(U,W):new Uint8Array(Array.prototype.slice.call(F,U,W))}},"./src/utils/vttcue.ts":function(ae,J,D){"use strict";D.r(J),J.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Y=["","lr","rl"],F=["start","middle","end","left","right"];function U(m,c){if(typeof c!="string")return!1;if(!Array.isArray(m))return!1;var f=c.toLowerCase();return~m.indexOf(f)?f:!1}function W(m){return U(Y,m)}function j(m){return U(F,m)}function k(m){for(var c=arguments.length,f=new Array(c>1?c-1:0),u=1;u<c;u++)f[u-1]=arguments[u];for(var r=1;r<arguments.length;r++){var d=arguments[r];for(var o in d)m[o]=d[o]}return m}function I(m,c,f){var u=this,r={enumerable:!0};u.hasBeenReset=!1;var d="",o=!1,s=m,l=c,p=f,R=null,w="",x=!0,O="auto",A="start",T=50,E="middle",y=50,h="middle";Object.defineProperty(u,"id",k({},r,{get:function(){return d},set:function(g){d=""+g}})),Object.defineProperty(u,"pauseOnExit",k({},r,{get:function(){return o},set:function(g){o=!!g}})),Object.defineProperty(u,"startTime",k({},r,{get:function(){return s},set:function(g){if(typeof g!="number")throw new TypeError("Start time must be set to a number.");s=g,this.hasBeenReset=!0}})),Object.defineProperty(u,"endTime",k({},r,{get:function(){return l},set:function(g){if(typeof g!="number")throw new TypeError("End time must be set to a number.");l=g,this.hasBeenReset=!0}})),Object.defineProperty(u,"text",k({},r,{get:function(){return p},set:function(g){p=""+g,this.hasBeenReset=!0}})),Object.defineProperty(u,"region",k({},r,{get:function(){return R},set:function(g){R=g,this.hasBeenReset=!0}})),Object.defineProperty(u,"vertical",k({},r,{get:function(){return w},set:function(g){var b=W(g);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");w=b,this.hasBeenReset=!0}})),Object.defineProperty(u,"snapToLines",k({},r,{get:function(){return x},set:function(g){x=!!g,this.hasBeenReset=!0}})),Object.defineProperty(u,"line",k({},r,{get:function(){return O},set:function(g){if(typeof g!="number"&&g!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");O=g,this.hasBeenReset=!0}})),Object.defineProperty(u,"lineAlign",k({},r,{get:function(){return A},set:function(g){var b=j(g);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");A=b,this.hasBeenReset=!0}})),Object.defineProperty(u,"position",k({},r,{get:function(){return T},set:function(g){if(g<0||g>100)throw new Error("Position must be between 0 and 100.");T=g,this.hasBeenReset=!0}})),Object.defineProperty(u,"positionAlign",k({},r,{get:function(){return E},set:function(g){var b=j(g);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");E=b,this.hasBeenReset=!0}})),Object.defineProperty(u,"size",k({},r,{get:function(){return y},set:function(g){if(g<0||g>100)throw new Error("Size must be between 0 and 100.");y=g,this.hasBeenReset=!0}})),Object.defineProperty(u,"align",k({},r,{get:function(){return h},set:function(g){var b=j(g);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");h=b,this.hasBeenReset=!0}})),u.displayState=void 0}return I.prototype.getCueAsHTML=function(){var m=self.WebVTT;return m.convertCueToDOMTree(self,this.text)},I}()},"./src/utils/vttparser.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"parseTimeStamp",function(){return U}),D.d(J,"fixLineBreaks",function(){return c}),D.d(J,"VTTParser",function(){return f});var Y=D("./src/utils/vttcue.ts"),F=function(){function u(){}var r=u.prototype;return r.decode=function(o,s){if(!o)return"";if(typeof o!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(o))},u}();function U(u){function r(o,s,l,p){return(o|0)*3600+(s|0)*60+(l|0)+parseFloat(p||0)}var d=u.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return d?parseFloat(d[2])>59?r(d[2],d[3],0,d[4]):r(d[1],d[2],d[3],d[4]):null}var W=function(){function u(){this.values=Object.create(null)}var r=u.prototype;return r.set=function(o,s){!this.get(o)&&s!==""&&(this.values[o]=s)},r.get=function(o,s,l){return l?this.has(o)?this.values[o]:s[l]:this.has(o)?this.values[o]:s},r.has=function(o){return o in this.values},r.alt=function(o,s,l){for(var p=0;p<l.length;++p)if(s===l[p]){this.set(o,s);break}},r.integer=function(o,s){/^-?\d+$/.test(s)&&this.set(o,parseInt(s,10))},r.percent=function(o,s){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(s)){var l=parseFloat(s);if(l>=0&&l<=100)return this.set(o,l),!0}return!1},u}();function j(u,r,d,o){var s=o?u.split(o):[u];for(var l in s){if(typeof s[l]!="string")continue;var p=s[l].split(d);if(p.length!==2)continue;var R=p[0],w=p[1];r(R,w)}}var k=new Y.default(0,0,""),I=k.align==="middle"?"middle":"center";function m(u,r,d){var o=u;function s(){var R=U(u);if(R===null)throw new Error("Malformed timestamp: "+o);return u=u.replace(/^[^\sa-zA-Z-]+/,""),R}function l(R,w){var x=new W;j(R,function(T,E){var y;switch(T){case"region":for(var h=d.length-1;h>=0;h--)if(d[h].id===E){x.set(T,d[h].region);break}break;case"vertical":x.alt(T,E,["rl","lr"]);break;case"line":y=E.split(","),x.integer(T,y[0]),x.percent(T,y[0])&&x.set("snapToLines",!1),x.alt(T,y[0],["auto"]),y.length===2&&x.alt("lineAlign",y[1],["start",I,"end"]);break;case"position":y=E.split(","),x.percent(T,y[0]),y.length===2&&x.alt("positionAlign",y[1],["start",I,"end","line-left","line-right","auto"]);break;case"size":x.percent(T,E);break;case"align":x.alt(T,E,["start",I,"end","left","right"]);break}},/:/,/\s/),w.region=x.get("region",null),w.vertical=x.get("vertical","");var O=x.get("line","auto");O==="auto"&&k.line===-1&&(O=-1),w.line=O,w.lineAlign=x.get("lineAlign","start"),w.snapToLines=x.get("snapToLines",!0),w.size=x.get("size",100),w.align=x.get("align",I);var A=x.get("position","auto");A==="auto"&&k.position===50&&(A=w.align==="start"||w.align==="left"?0:w.align==="end"||w.align==="right"?100:50),w.position=A}function p(){u=u.replace(/^\s+/,"")}if(p(),r.startTime=s(),p(),u.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+o);u=u.substr(3),p(),r.endTime=s(),p(),l(u,r)}function c(u){return u.replace(/<br(?: \/)?>/gi,`
|
|
`)}var f=function(){function u(){this.state="INITIAL",this.buffer="",this.decoder=new F,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var r=u.prototype;return r.parse=function(o){var s=this;o&&(s.buffer+=s.decoder.decode(o,{stream:!0}));function l(){var A=s.buffer,T=0;for(A=c(A);T<A.length&&A[T]!=="\r"&&A[T]!==`
|
|
`;)++T;var E=A.substr(0,T);return A[T]==="\r"&&++T,A[T]===`
|
|
`&&++T,s.buffer=A.substr(T),E}function p(A){j(A,function(T,E){},/:/)}try{var R="";if(s.state==="INITIAL"){if(!/\r\n|\n/.test(s.buffer))return this;R=l();var w=R.match(/^()?WEBVTT([ \t].*)?$/);if(!w||!w[0])throw new Error("Malformed WebVTT signature.");s.state="HEADER"}for(var x=!1;s.buffer;){if(!/\r\n|\n/.test(s.buffer))return this;x?x=!1:R=l();switch(s.state){case"HEADER":/:/.test(R)?p(R):R||(s.state="ID");continue;case"NOTE":R||(s.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(R)){s.state="NOTE";break}if(!R)continue;if(s.cue=new Y.default(0,0,""),s.state="CUE",R.indexOf("-->")===-1){s.cue.id=R;continue}case"CUE":if(!s.cue){s.state="BADCUE";continue}try{m(R,s.cue,s.regionList)}catch(A){s.cue=null,s.state="BADCUE";continue}s.state="CUETEXT";continue;case"CUETEXT":{var O=R.indexOf("-->")!==-1;if(!R||O&&(x=!0)){s.oncue&&s.cue&&s.oncue(s.cue),s.cue=null,s.state="ID";continue}if(s.cue===null)continue;s.cue.text&&(s.cue.text+=`
|
|
`),s.cue.text+=R}continue;case"BADCUE":R||(s.state="ID")}}}catch(A){s.state==="CUETEXT"&&s.cue&&s.oncue&&s.oncue(s.cue),s.cue=null,s.state=s.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},r.flush=function(){var o=this;try{if((o.cue||o.state==="HEADER")&&(o.buffer+=`
|
|
|
|
`,o.parse()),o.state==="INITIAL"||o.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(s){o.onparsingerror&&o.onparsingerror(s)}return o.onflush&&o.onflush(),this},u}()},"./src/utils/webvtt-parser.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"generateCueId",function(){return f}),D.d(J,"parseWebVTT",function(){return r});var Y=D("./src/polyfills/number.ts"),F=D("./src/utils/vttparser.ts"),U=D("./src/demux/id3.ts"),W=D("./src/utils/timescale-conversion.ts"),j=D("./src/remux/mp4-remuxer.ts"),k=/\r\n|\n\r|\n|\r/g,I=function(o,s,l){return l===void 0&&(l=0),o.substr(l,s.length)===s},m=function(o){var s=parseInt(o.substr(-3)),l=parseInt(o.substr(-6,2)),p=parseInt(o.substr(-9,2)),R=o.length>9?parseInt(o.substr(0,o.indexOf(":"))):0;if(!Object(Y.isFiniteNumber)(s)||!Object(Y.isFiniteNumber)(l)||!Object(Y.isFiniteNumber)(p)||!Object(Y.isFiniteNumber)(R))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+o);return s+=1e3*l,s+=60*1e3*p,s+=60*60*1e3*R,s},c=function(o){for(var s=5381,l=o.length;l;)s=s*33^o.charCodeAt(--l);return(s>>>0).toString()};function f(d,o,s){return c(d.toString())+c(o.toString())+c(s)}var u=function(o,s,l){var p=o[s],R=o[p.prevCC];if(!R||!R.new&&p.new){o.ccOffset=o.presentationOffset=p.start,p.new=!1;return}for(;(w=R)!==null&&w!==void 0&&w.new;){var w;o.ccOffset+=p.start-R.start,p.new=!1,p=R,R=o[p.prevCC]}o.presentationOffset=l};function r(d,o,s,l,p,R,w,x){var O=new F.VTTParser,A=Object(U.utf8ArrayToStr)(new Uint8Array(d)).trim().replace(k,`
|
|
`).split(`
|
|
`),T=[],E=Object(W.toMpegTsClockFromTimescale)(o,s),y="00:00.000",h=0,_=0,g,b=!0,M=!1;O.oncue=function(P){var K=l[p],V=l.ccOffset,B=(h-E)/9e4;if(K!=null&&K.new&&(_!==void 0?V=l.ccOffset=K.start:u(l,p,B)),B&&(V=B-l.presentationOffset),M){var C=P.endTime-P.startTime,$=Object(j.normalizePts)((P.startTime+V-_)*9e4,R*9e4)/9e4;P.startTime=$,P.endTime=$+C}var ee=P.text.trim();P.text=decodeURIComponent(encodeURIComponent(ee)),P.id||(P.id=f(P.startTime,P.endTime,ee)),P.endTime>0&&T.push(P)},O.onparsingerror=function(P){g=P},O.onflush=function(){if(g){x(g);return}w(T)},A.forEach(function(P){if(b)if(I(P,"X-TIMESTAMP-MAP=")){b=!1,M=!0,P.substr(16).split(",").forEach(function(K){I(K,"LOCAL:")?y=K.substr(6):I(K,"MPEGTS:")&&(h=parseInt(K.substr(7)))});try{_=m(y)/1e3}catch(K){M=!1,g=K}return}else P===""&&(b=!1);O.parse(P+`
|
|
`)}),O.flush()}},"./src/utils/xhr-loader.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/utils/logger.ts"),F=D("./src/loader/load-stats.ts"),U=/^age:\s*[\d.]+\s*$/m,W=function(){function j(I){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=I?I.xhrSetup:null,this.stats=new F.LoadStats,this.retryDelay=0}var k=j.prototype;return k.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},k.abortInternal=function(){var m=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),m&&(m.onreadystatechange=null,m.onprogress=null,m.readyState!==4&&(this.stats.aborted=!0,m.abort()))},k.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},k.load=function(m,c,f){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=m,this.config=c,this.callbacks=f,this.retryDelay=c.retryDelay,this.loadInternal()},k.loadInternal=function(){var m=this.config,c=this.context;if(!m)return;var f=this.loader=new self.XMLHttpRequest,u=this.stats;u.loading.first=0,u.loaded=0;var r=this.xhrSetup;try{if(r)try{r(f,c.url)}catch(s){f.open("GET",c.url,!0),r(f,c.url)}f.readyState||f.open("GET",c.url,!0);var d=this.context.headers;if(d)for(var o in d)f.setRequestHeader(o,d[o])}catch(s){this.callbacks.onError({code:f.status,text:s.message},c,f);return}c.rangeEnd&&f.setRequestHeader("Range","bytes="+c.rangeStart+"-"+(c.rangeEnd-1)),f.onreadystatechange=this.readystatechange.bind(this),f.onprogress=this.loadprogress.bind(this),f.responseType=c.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),m.timeout),f.send()},k.readystatechange=function(){var m=this.context,c=this.loader,f=this.stats;if(!m||!c)return;var u=c.readyState,r=this.config;if(f.aborted)return;if(u>=2)if(self.clearTimeout(this.requestTimeout),f.loading.first===0&&(f.loading.first=Math.max(self.performance.now(),f.loading.start)),u===4){c.onreadystatechange=null,c.onprogress=null;var d=c.status;if(d>=200&&d<300){f.loading.end=Math.max(self.performance.now(),f.loading.first);var o,s;if(m.responseType==="arraybuffer"?(o=c.response,s=o.byteLength):(o=c.responseText,s=o.length),f.loaded=f.total=s,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(f,m,o,c),!this.callbacks)return;var p={url:c.responseURL,data:o};this.callbacks.onSuccess(p,f,m,c)}else f.retry>=r.maxRetry||d>=400&&d<499?(Y.logger.error(d+" while loading "+m.url),this.callbacks.onError({code:d,text:c.statusText},m,c)):(Y.logger.warn(d+" while loading "+m.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,r.maxRetryDelay),f.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout)},k.loadtimeout=function(){Y.logger.warn("timeout while loading "+this.context.url);var m=this.callbacks;m&&(this.abortInternal(),m.onTimeout(this.stats,this.context,this.loader))},k.loadprogress=function(m){var c=this.stats;c.loaded=m.loaded,m.lengthComputable&&(c.total=m.total)},k.getCacheAge=function(){var m=null;if(this.loader&&U.test(this.loader.getAllResponseHeaders())){var c=this.loader.getResponseHeader("age");m=c?parseFloat(c):null}return m},j}();J.default=W}}).default})},vHTk:function(vt,et,ne){vt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|