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.
436 lines
1.1 MiB
436 lines
1.1 MiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[163,5,6,7],{"+NIl":function(gt,Ye,ne){(function(ue){ue(ne("VrN/"))})(function(ue){"use strict";ue.defineMode("stex",function(Z,P){"use strict";function Q(d,s){d.cmdState.push(s)}function B(d){return d.cmdState.length>0?d.cmdState[d.cmdState.length-1]:null}function F(d){var s=d.cmdState.pop();s&&s.closeBracket()}function K(d){for(var s=d.cmdState,c=s.length-1;c>=0;c--){var l=s[c];if(l.name=="DEFAULT")continue;return l}return{styleIdentifier:function(){return null}}}function G(d,s,c){return function(){this.name=d,this.bracketNo=0,this.style=s,this.styles=c,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var M={};M.importmodule=G("importmodule","tag",["string","builtin"]),M.documentclass=G("documentclass","tag",["","atom"]),M.usepackage=G("usepackage","tag",["atom"]),M.begin=G("begin","tag",["atom"]),M.end=G("end","tag",["atom"]),M.label=G("label","tag",["atom"]),M.ref=G("ref","tag",["atom"]),M.eqref=G("eqref","tag",["atom"]),M.cite=G("cite","tag",["atom"]),M.bibitem=G("bibitem","tag",["atom"]),M.Bibitem=G("Bibitem","tag",["atom"]),M.RBibitem=G("RBibitem","tag",["atom"]),M.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function R(d,s){d.f=s}function g(d,s){var c;if(d.match(/^\\[a-zA-Z@]+/)){var l=d.current().slice(1);return c=M.hasOwnProperty(l)?M[l]:M.DEFAULT,c=new c,Q(s,c),R(s,f),c.style}if(d.match(/^\\[$&%#{}_]/))return"tag";if(d.match(/^\\[,;!\/\\]/))return"tag";if(d.match("\\["))return R(s,function(o,h){return p(o,h,"\\]")}),"keyword";if(d.match("\\("))return R(s,function(o,h){return p(o,h,"\\)")}),"keyword";if(d.match("$$"))return R(s,function(o,h){return p(o,h,"$$")}),"keyword";if(d.match("$"))return R(s,function(o,h){return p(o,h,"$")}),"keyword";var n=d.next();if(n=="%")return d.skipToEnd(),"comment";if(n=="}"||n=="]"){if(c=B(s),c)c.closeBracket(n),R(s,f);else return"error";return"bracket"}else return n=="{"||n=="["?(c=M.DEFAULT,c=new c,Q(s,c),"bracket"):/\d/.test(n)?(d.eatWhile(/[\w.%]/),"atom"):(d.eatWhile(/[\w\-_]/),c=K(s),c.name=="begin"&&(c.argument=d.current()),c.styleIdentifier())}function p(d,s,c){if(d.eatSpace())return null;if(c&&d.match(c))return R(s,g),"keyword";if(d.match(/^\\[a-zA-Z@]+/))return"tag";if(d.match(/^[a-zA-Z]+/))return"variable-2";if(d.match(/^\\[$&%#{}_]/))return"tag";if(d.match(/^\\[,;!\/]/))return"tag";if(d.match(/^[\^_&]/))return"tag";if(d.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(d.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var l=d.next();return l=="{"||l=="}"||l=="["||l=="]"||l=="("||l==")"?"bracket":l=="%"?(d.skipToEnd(),"comment"):"error"}function f(d,s){var c=d.peek(),l;return c=="{"||c=="["?(l=B(s),l.openBracket(c),d.eat(c),R(s,g),"bracket"):/[ \t\r]/.test(c)?(d.eat(c),null):(R(s,g),F(s),g(d,s))}return{startState:function(){var d=P.inMathMode?function(s,c){return p(s,c)}:g;return{cmdState:[],f:d}},copyState:function(d){return{cmdState:d.cmdState.slice(),f:d.f}},token:function(d,s){return s.f(d,s)},blankLine:function(d){d.f=g,d.cmdState.length=0},lineComment:"%"}}),ue.defineMIME("text/x-stex","stex"),ue.defineMIME("text/x-latex","stex")})},"+ua5":function(gt,Ye,ne){},"19Vz":function(gt,Ye,ne){(function(ue){ue(ne("VrN/"))})(function(ue){ue.defineOption("placeholder","",function(G,M,R){var g=R&&R!=ue.Init;if(M&&!g)G.on("blur",B),G.on("change",F),G.on("swapDoc",F),ue.on(G.getInputField(),"compositionupdate",G.state.placeholderCompose=function(){Q(G)}),F(G);else if(!M&&g){G.off("blur",B),G.off("change",F),G.off("swapDoc",F),ue.off(G.getInputField(),"compositionupdate",G.state.placeholderCompose),Z(G);var p=G.getWrapperElement();p.className=p.className.replace(" CodeMirror-empty","")}M&&!G.hasFocus()&&B(G)});function Z(G){G.state.placeholder&&(G.state.placeholder.parentNode.removeChild(G.state.placeholder),G.state.placeholder=null)}function P(G){Z(G);var M=G.state.placeholder=document.createElement("pre");M.style.cssText="height: 0; overflow: visible",M.style.direction=G.getOption("direction"),M.className="CodeMirror-placeholder CodeMirror-line-like";var R=G.getOption("placeholder");typeof R=="string"&&(R=document.createTextNode(R)),M.appendChild(R),G.display.lineSpace.insertBefore(M,G.display.lineSpace.firstChild)}function Q(G){setTimeout(function(){var M=!1,R=G.getInputField();R.nodeName=="TEXTAREA"?M=!R.value:G.lineCount()==1&&(M=!/[^\u200b]/.test(R.querySelector(".CodeMirror-line").textContent)),M?P(G):Z(G)},20)}function B(G){K(G)&&P(G)}function F(G){var M=G.getWrapperElement(),R=K(G);M.className=M.className.replace(" CodeMirror-empty","")+(R?" CodeMirror-empty":""),R?P(G):Z(G)}function K(G){return G.lineCount()===1&&G.getLine(0)===""}})},"1eCo":function(gt,Ye,ne){(function(ue){ue(ne("VrN/"))})(function(ue){"use strict";var Z={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},P={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ue.defineMode("xml",function(Q,B){var F=Q.indentUnit,K={},G=B.htmlMode?Z:P;for(var M in G)K[M]=G[M];for(var M in B)K[M]=B[M];var R,g;function p(u,E){function m(D){return E.tokenize=D,D(u,E)}var b=u.next();if(b=="<")return u.eat("!")?u.eat("[")?u.match("CDATA[")?m(s("atom","]]>")):null:u.match("--")?m(s("comment","-->")):u.match("DOCTYPE",!0,!0)?(u.eatWhile(/[\w\._\-]/),m(c(1))):null:u.eat("?")?(u.eatWhile(/[\w\._\-]/),E.tokenize=s("meta","?>"),"meta"):(R=u.eat("/")?"closeTag":"openTag",E.tokenize=f,"tag bracket");if(b=="&"){var N;return u.eat("#")?u.eat("x")?N=u.eatWhile(/[a-fA-F\d]/)&&u.eat(";"):N=u.eatWhile(/[\d]/)&&u.eat(";"):N=u.eatWhile(/[\w\.\-:]/)&&u.eat(";"),N?"atom":"error"}else return u.eatWhile(/[^&<]/),null}p.isInText=!0;function f(u,E){var m=u.next();if(m==">"||m=="/"&&u.eat(">"))return E.tokenize=p,R=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return R="equals",null;if(m=="<"){E.tokenize=p,E.state=h,E.tagName=E.tagStart=null;var b=E.tokenize(u,E);return b?b+" tag error":"tag error"}else return/[\'\"]/.test(m)?(E.tokenize=d(m),E.stringStartCol=u.column(),E.tokenize(u,E)):(u.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function d(u){var E=function(m,b){for(;!m.eol();)if(m.next()==u){b.tokenize=f;break}return"string"};return E.isInAttribute=!0,E}function s(u,E){return function(m,b){for(;!m.eol();){if(m.match(E)){b.tokenize=p;break}m.next()}return u}}function c(u){return function(E,m){for(var b;(b=E.next())!=null;){if(b=="<")return m.tokenize=c(u+1),m.tokenize(E,m);if(b==">")if(u==1){m.tokenize=p;break}else return m.tokenize=c(u-1),m.tokenize(E,m)}return"meta"}}function l(u,E,m){this.prev=u.context,this.tagName=E,this.indent=u.indented,this.startOfLine=m,(K.doNotIndent.hasOwnProperty(E)||u.context&&u.context.noIndent)&&(this.noIndent=!0)}function n(u){u.context&&(u.context=u.context.prev)}function o(u,E){for(var m;;){if(!u.context)return;if(m=u.context.tagName,!K.contextGrabbers.hasOwnProperty(m)||!K.contextGrabbers[m].hasOwnProperty(E))return;n(u)}}function h(u,E,m){return u=="openTag"?(m.tagStart=E.column(),L):u=="closeTag"?S:h}function L(u,E,m){return u=="word"?(m.tagName=E.current(),g="tag",C):K.allowMissingTagName&&u=="endTag"?(g="tag bracket",C(u,E,m)):(g="error",L)}function S(u,E,m){if(u=="word"){var b=E.current();return m.context&&m.context.tagName!=b&&K.implicitlyClosed.hasOwnProperty(m.context.tagName)&&n(m),m.context&&m.context.tagName==b||K.matchClosing===!1?(g="tag",x):(g="tag error",O)}else return K.allowMissingTagName&&u=="endTag"?(g="tag bracket",x(u,E,m)):(g="error",O)}function x(u,E,m){return u!="endTag"?(g="error",x):(n(m),h)}function O(u,E,m){return g="error",x(u,E,m)}function C(u,E,m){if(u=="word")return g="attribute",w;if(u=="endTag"||u=="selfcloseTag"){var b=m.tagName,N=m.tagStart;return m.tagName=m.tagStart=null,u=="selfcloseTag"||K.autoSelfClosers.hasOwnProperty(b)?o(m,b):(o(m,b),m.context=new l(m,b,N==m.indented)),h}return g="error",C}function w(u,E,m){return u=="equals"?T:(K.allowMissing||(g="error"),C(u,E,m))}function T(u,E,m){return u=="string"?_:u=="word"&&K.allowUnquoted?(g="string",C):(g="error",C(u,E,m))}function _(u,E,m){return u=="string"?_:C(u,E,m)}return{startState:function(u){var E={tokenize:p,state:h,indented:u||0,tagName:null,tagStart:null,context:null};return u!=null&&(E.baseIndent=u),E},token:function(u,E){if(!E.tagName&&u.sol()&&(E.indented=u.indentation()),u.eatSpace())return null;R=null;var m=E.tokenize(u,E);return(m||R)&&m!="comment"&&(g=null,E.state=E.state(R||m,u,E),g&&(m=g=="error"?m+" error":g)),m},indent:function(u,E,m){var b=u.context;if(u.tokenize.isInAttribute)return u.tagStart==u.indented?u.stringStartCol+1:u.indented+F;if(b&&b.noIndent)return ue.Pass;if(u.tokenize!=f&&u.tokenize!=p)return m?m.match(/^(\s*)/)[0].length:0;if(u.tagName)return K.multilineTagIndentPastTag!==!1?u.tagStart+u.tagName.length+2:u.tagStart+F*(K.multilineTagIndentFactor||1);if(K.alignCDATA&&/<!\[CDATA\[/.test(E))return 0;var N=E&&/^<(\/)?([\w_:\.-]*)/.exec(E);if(N&&N[1])for(;b;)if(b.tagName==N[2]){b=b.prev;break}else if(K.implicitlyClosed.hasOwnProperty(b.tagName))b=b.prev;else break;else if(N)for(;b;){var D=K.contextGrabbers[b.tagName];if(D&&D.hasOwnProperty(N[2]))b=b.prev;else break}for(;b&&b.prev&&!b.startOfLine;)b=b.prev;return b?b.indent+F:u.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:K.htmlMode?"html":"xml",helperType:K.htmlMode?"html":"xml",skipAttribute:function(u){u.state==T&&(u.state=C)},xmlCurrentTag:function(u){return u.tagName?{name:u.tagName,close:u.type=="closeTag"}:null},xmlCurrentContext:function(u){for(var E=[],m=u.context;m;m=m.prev)m.tagName&&E.push(m.tagName);return E.reverse()}}}),ue.defineMIME("text/xml","xml"),ue.defineMIME("application/xml","xml"),ue.mimeModes.hasOwnProperty("text/html")||ue.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"500L":function(gt,Ye,ne){"use strict";ne.d(Ye,"a",function(){return S});var ue=ne("+L6B"),Z=ne("2/Rp"),P=ne("2qtc"),Q=ne("kLXV"),B=ne("9og8"),F=ne("k1fw"),K=ne("miYZ"),G=ne("tsqr"),M=ne("oBTY"),R=ne("tJVT"),g=ne("DZo9"),p=ne("8z0m"),f=ne("WmNS"),d=ne.n(f),s=ne("q1tI"),c=ne.n(s),l=ne("m3rI"),n=ne("wzkS"),o=ne("y5JW"),h=ne("LtfV"),L=p.a.Dragger;function S(x){var O=[];return x&&x.length>0&&(O=x.map(function(C){return{uid:C.id,id:C.id,name:C.title+o.c+C.filesize,url:C.url,filesize:C.filesize,status:"done",response:{id:C.id}}})),O}Ye.b=function(x){var O=x.value,C=x.onChange,w=x.action,T=x.className,_=x.maxSize,u=_===void 0?150:_,E=x.title,m=E===void 0?"\u4E0A\u4F20\u9644\u4EF6":E,b=x.showRemoveModal,N=b===void 0?!1:b,D=x.accept,H=D===void 0?"":D,j=x.additionalText,I=x.isDragger,y=x.number,W=y===void 0?1e3:y,Y=x.aloneClear,ie=Y===void 0?!1:Y,oe=Object(s.useState)(!1),we=Object(R.a)(oe,2),me=we[0],Se=we[1],Ce=Object(s.useState)(O||[]),xe=Object(R.a)(Ce,2),pe=xe[0],le=xe[1];Object(s.useEffect)(function(){O&&(le(Object(M.a)(O)),W===(O==null?void 0:O.length)&&Se(!0))},[O]);var te=function(){setTimeout(function(){pe.pop(),le(Object(M.a)(pe))},500)},de={multiple:!0,disabled:me,accept:H,withCredentials:!0,fileList:pe,beforeUpload:function(ke,Te){var Le=ke.size/1024/1024;return pe.concat(Te).length>W?(pe.pop(),le(Object(M.a)(pe)),G.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(W,"\u4E2A\u6587\u4EF6")),ie?Promise.reject():(te(),!1)):!0},action:w||"".concat(l.a.API_SERVER,"/api/attachments.json"),onChange:function(ke){var Te,Le,Me=Object(M.a)(ke.fileList);if(ke.file.status==="done"&&((Te=ke.file)===null||Te===void 0||((Le=Te.response)===null||Le===void 0)?void 0:Le.status)===-1){var je,Fe;G.b.error((je=ke.file)===null||je===void 0||((Fe=je.response)===null||Fe===void 0)?void 0:Fe.message);return}Me.length>=W?Se(!0):Se(!1),le(Object(M.a)(Me)),Me=Me.map(function(Ne){var Ue;if(Ne!=null&&(Ue=Ne.response)!==null&&Ue!==void 0&&Ue.id){var Je;Ne.url="/api/attachments/".concat(Ne==null||((Je=Ne.response)===null||Je===void 0)?void 0:Je.id)}return Ne.name.indexOf(o.c)===-1&&(Ne.name="".concat(Ne.name).concat(o.c).concat(Object(o.a)(Ne.size))),Object(F.a)({},Ne)}),console.log("info:",ke),C(Me)},onRemove:function(){var Oe=Object(B.a)(d.a.mark(function Te(Le){var Me;return d.a.wrap(function(Fe){for(;;)switch(Fe.prev=Fe.next){case 0:if(Me=function(){var Ne=Object(B.a)(d.a.mark(function Ue(){var Je,tt;return d.a.wrap(function(Ze){for(;;)switch(Ze.prev=Ze.next){case 0:if(Je=Le.response?Le.response.id:Le.id,!Je){Ze.next=8;break}return Ze.next=4,Object(n.d)(Le.response?Le.response.id:Le.uid);case 4:return tt=Ze.sent,Ze.abrupt("return",tt);case 8:return Ze.abrupt("return",!0);case 9:case"end":return Ze.stop()}},Ue)}));return function(){return Ne.apply(this,arguments)}}(),!N){Fe.next=5;break}return Fe.abrupt("return",new Promise(function(Ne,Ue){Q.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:c.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var Je=Object(B.a)(d.a.mark(function et(){var Ze;return d.a.wrap(function(it){for(;;)switch(it.prev=it.next){case 0:return it.next=2,Me();case 2:Ze=it.sent,G.b.success("\u5220\u9664\u6210\u529F"),Ne(!0);case 5:case"end":return it.stop()}},et)}));function tt(){return Je.apply(this,arguments)}return tt}(),onCancel:function(){return Ne(!1)}})}));case 5:return Fe.next=7,Me();case 7:return Fe.abrupt("return",Fe.sent);case 8:case"end":return Fe.stop()}},Te)}));function ke(Te){return Oe.apply(this,arguments)}return ke}()};function se(Oe){Oe.preventDefault(),Oe.stopPropagation()}return c.a.createElement("div",{className:"multi-upload ".concat(T||"")},I&&c.a.createElement(L,de,c.a.createElement("p",{className:"ant-upload-drag-icon"},c.a.createElement(h.a,null)),c.a.createElement("p",{className:"ant-upload-text"},"\u70B9\u51FB\u4E0A\u4F20\u56FE\u6807\uFF0C\u9009\u62E9\u8981\u4E0A\u4F20\u7684\u6587\u4EF6\u6216\u5C06\u6587\u4EF6\u62D6\u62FD\u5230\u6B64",c.a.createElement("br",null),"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",u,"MB)"," "),j),!I&&c.a.createElement(p.a,de,c.a.createElement(Z.a,{disabled:me},m),c.a.createElement("span",{onClick:se,style:{marginLeft:10,color:"#FA6400"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",u,"MB)"," ")))}},"55Ip":function(gt,Ye,ne){"use strict";ne.d(Ye,"a",function(){return o});var ue=ne("Ty5D"),Z=ne("dI71"),P=ne("q1tI"),Q=ne.n(P),B=ne("YS25"),F=ne("17x9"),K=ne.n(F),G=ne("wx14"),M=ne("zLVn"),R=ne("9R94"),g=function(T){Object(Z.a)(_,T);function _(){for(var E,m=arguments.length,b=new Array(m),N=0;N<m;N++)b[N]=arguments[N];return E=T.call.apply(T,[this].concat(b))||this,E.history=Object(B.a)(E.props),E}var u=_.prototype;return u.render=function(){return Q.a.createElement(ue.c,{history:this.history,children:this.props.children})},_}(Q.a.Component),p=function(T){Object(Z.a)(_,T);function _(){for(var E,m=arguments.length,b=new Array(m),N=0;N<m;N++)b[N]=arguments[N];return E=T.call.apply(T,[this].concat(b))||this,E.history=Object(B.b)(E.props),E}var u=_.prototype;return u.render=function(){return Q.a.createElement(ue.c,{history:this.history,children:this.props.children})},_}(Q.a.Component),f=function(_,u){return typeof _=="function"?_(u):_},d=function(_,u){return typeof _=="string"?Object(B.c)(_,null,null,u):_},s=function(_){return _},c=Q.a.forwardRef;typeof c=="undefined"&&(c=s);function l(T){return!!(T.metaKey||T.altKey||T.ctrlKey||T.shiftKey)}var n=c(function(T,_){var u=T.innerRef,E=T.navigate,m=T.onClick,b=Object(M.a)(T,["innerRef","navigate","onClick"]),N=b.target,D=Object(G.a)({},b,{onClick:function(j){try{m&&m(j)}catch(I){throw j.preventDefault(),I}!j.defaultPrevented&&j.button===0&&(!N||N==="_self")&&!l(j)&&(j.preventDefault(),E())}});return s!==c?D.ref=_||u:D.ref=u,Q.a.createElement("a",D)}),o=c(function(T,_){var u=T.component,E=u===void 0?n:u,m=T.replace,b=T.to,N=T.innerRef,D=Object(M.a)(T,["component","replace","to","innerRef"]);return Q.a.createElement(ue.e.Consumer,null,function(H){H||Object(R.a)(!1);var j=H.history,I=d(f(b,H.location),H.location),y=I?j.createHref(I):"",W=Object(G.a)({},D,{href:y,navigate:function(){var ie=f(b,H.location),oe=m?j.replace:j.push;oe(ie)}});return s!==c?W.ref=_||N:W.innerRef=N,Q.a.createElement(E,W)})});if(!1)var h,L;var S=function(_){return _},x=Q.a.forwardRef;typeof x=="undefined"&&(x=S);function O(){for(var T=arguments.length,_=new Array(T),u=0;u<T;u++)_[u]=arguments[u];return _.filter(function(E){return E}).join(" ")}var C=x(function(T,_){var u=T["aria-current"],E=u===void 0?"page":u,m=T.activeClassName,b=m===void 0?"active":m,N=T.activeStyle,D=T.className,H=T.exact,j=T.isActive,I=T.location,y=T.sensitive,W=T.strict,Y=T.style,ie=T.to,oe=T.innerRef,we=Object(M.a)(T,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return Q.a.createElement(ue.e.Consumer,null,function(me){me||Object(R.a)(!1);var Se=I||me.location,Ce=d(f(ie,Se),Se),xe=Ce.pathname,pe=xe&&xe.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),le=pe?Object(ue.f)(Se.pathname,{path:pe,exact:H,sensitive:y,strict:W}):null,te=!!(j?j(le,Se):le),de=te?O(D,b):D,se=te?Object(G.a)({},Y,{},N):Y,Oe=Object(G.a)({"aria-current":te&&E||null,className:de,style:se,to:Ce},we);return S!==x?Oe.ref=_||oe:Oe.innerRef=oe,Q.a.createElement(o,Oe)})});if(!1)var w},"5VLF":function(gt,Ye,ne){"use strict";var ue,Z;function P(Q,B,F){var K=function(G,M){return Q.js_beautify(G,M)};return K.js=Q.js_beautify,K.css=B.css_beautify,K.html=F.html_beautify,K.js_beautify=Q.js_beautify,K.css_beautify=B.css_beautify,K.html_beautify=F.html_beautify,K}!(ue=[ne("6UM0"),ne("TXwP"),ne("psGv")],Z=function(Q,B,F){return P(Q,B,F)}.apply(Ye,ue),Z!==void 0&&(gt.exports=Z))},"6UM0":function(gt,Ye,ne){var ue,Z;(function(){var P;(function(){"use strict";var B=[function(M,R,g){var p=g(1).Beautifier,f=g(5).Options;function d(s,c){var l=new p(s,c);return l.beautify()}M.exports=d,M.exports.defaultOptions=function(){return new f}},function(M,R,g){var p=g(2).Output,f=g(3).Token,d=g(4),s=g(5).Options,c=g(7).Tokenizer,l=g(7).line_starters,n=g(7).positionable_operators,o=g(7).TOKEN;function h(y,W){return W.indexOf(y)!==-1}function L(y){return y.replace(/^\s+/g,"")}function S(y){for(var W={},Y=0;Y<y.length;Y++)W[y[Y].replace(/-/g,"_")]=y[Y];return W}function x(y,W){return y&&y.type===o.RESERVED&&y.text===W}function O(y,W){return y&&y.type===o.RESERVED&&h(y.text,W)}var C=["case","return","do","if","throw","else","await","break","continue","async"],w=["before-newline","after-newline","preserve-newline"],T=S(w),_=[T.before_newline,T.preserve_newline],u={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function E(y,W){if(W.multiline_frame||W.mode===u.ForInitializer||W.mode===u.Conditional)return;y.remove_indent(W.start_line_index)}function m(y){y=y.replace(d.allLineBreaks,`
|
|
`);for(var W=[],Y=y.indexOf(`
|
|
`);Y!==-1;)W.push(y.substring(0,Y)),y=y.substring(Y+1),Y=y.indexOf(`
|
|
`);return y.length&&W.push(y),W}function b(y){return y===u.ArrayLiteral}function N(y){return h(y,[u.Expression,u.ForInitializer,u.Conditional])}function D(y,W){for(var Y=0;Y<y.length;Y++){var ie=y[Y].trim();if(ie.charAt(0)!==W)return!1}return!0}function H(y,W){for(var Y=0,ie=y.length,oe;Y<ie;Y++)if(oe=y[Y],oe&&oe.indexOf(W)!==0)return!1;return!0}function j(y,W){W=W||{},this._source_text=y||"",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 s(W)}j.prototype.create_flags=function(y,W){var Y=0;y&&(Y=y.indentation_level,!this._output.just_added_newline()&&y.line_indent_level>Y&&(Y=y.line_indent_level));var ie={mode:W,parent:y,last_token:y?y.last_token:new f(o.START_BLOCK,""),last_word:y?y.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:Y,alignment:0,line_indent_level:y?y.line_indent_level:Y,start_line_index:this._output.get_line_number(),ternary_depth:0};return ie},j.prototype._reset=function(y){var W=y.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new p(this._options,W),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(u.BlockStatement);var Y=new c(y,this._options);return this._tokens=Y.tokenize(),y},j.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var y,W=this._reset(this._source_text),Y=this._options.eol;this._options.eol==="auto"&&(Y=`
|
|
`,W&&d.lineBreak.test(W||"")&&(Y=W.match(d.lineBreak)[0]));for(var ie=this._tokens.next();ie;)this.handle_token(ie),this._last_last_text=this._flags.last_token.text,this._flags.last_token=ie,ie=this._tokens.next();return y=this._output.get_code(Y),y},j.prototype.handle_token=function(y,W){y.type===o.START_EXPR?this.handle_start_expr(y):y.type===o.END_EXPR?this.handle_end_expr(y):y.type===o.START_BLOCK?this.handle_start_block(y):y.type===o.END_BLOCK?this.handle_end_block(y):y.type===o.WORD?this.handle_word(y):y.type===o.RESERVED?this.handle_word(y):y.type===o.SEMICOLON?this.handle_semicolon(y):y.type===o.STRING?this.handle_string(y):y.type===o.EQUALS?this.handle_equals(y):y.type===o.OPERATOR?this.handle_operator(y):y.type===o.COMMA?this.handle_comma(y):y.type===o.BLOCK_COMMENT?this.handle_block_comment(y,W):y.type===o.COMMENT?this.handle_comment(y,W):y.type===o.DOT?this.handle_dot(y):y.type===o.EOF?this.handle_eof(y):y.type===o.UNKNOWN?this.handle_unknown(y,W):this.handle_unknown(y,W)},j.prototype.handle_whitespace_and_comments=function(y,W){var Y=y.newlines,ie=this._options.keep_array_indentation&&b(this._flags.mode);if(y.comments_before)for(var oe=y.comments_before.next();oe;)this.handle_whitespace_and_comments(oe,W),this.handle_token(oe,W),oe=y.comments_before.next();if(ie)for(var we=0;we<Y;we+=1)this.print_newline(we>0,W);else if(this._options.max_preserve_newlines&&Y>this._options.max_preserve_newlines&&(Y=this._options.max_preserve_newlines),this._options.preserve_newlines&&Y>1){this.print_newline(!1,W);for(var me=1;me<Y;me+=1)this.print_newline(!0,W)}};var I=["async","break","continue","return","throw","yield"];j.prototype.allow_wrap_or_preserved_newline=function(y,W){if(W=W===void 0?!1:W,this._output.just_added_newline())return;var Y=this._options.preserve_newlines&&y.newlines||W,ie=h(this._flags.last_token.text,n)||h(y.text,n);if(ie){var oe=h(this._flags.last_token.text,n)&&h(this._options.operator_position,_)||h(y.text,n);Y=Y&&oe}if(Y)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(O(this._flags.last_token,I))return;this._output.set_wrap_point()}},j.prototype.print_newline=function(y,W){if(!W&&(this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==o.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")))for(var Y=this._tokens.peek();this._flags.mode===u.Statement&&!(this._flags.if_block&&x(Y,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(y)&&(this._flags.multiline_frame=!0)},j.prototype.print_token_line_indentation=function(y){this._output.just_added_newline()&&(this._options.keep_array_indentation&&y.newlines&&(y.text==="["||b(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(y.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))},j.prototype.print_token=function(y){if(this._output.raw){this._output.add_raw_token(y);return}if(this._options.comma_first&&y.previous&&y.previous.type===o.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var W=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(W),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(y),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(y),this._output.non_breaking_space=!0,this._output.add_token(y.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},j.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},j.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))},j.prototype.set_mode=function(y){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,y),this._flags=this.create_flags(this._previous_flags,y),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},j.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===u.Statement&&E(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},j.prototype.start_of_object_property=function(){return this._flags.parent.mode===u.ObjectLiteral&&this._flags.mode===u.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||O(this._flags.last_token,["get","set"]))},j.prototype.start_of_statement=function(y){var W=!1;return W=W||O(this._flags.last_token,["var","let","const"])&&y.type===o.WORD,W=W||x(this._flags.last_token,"do"),W=W||!(this._flags.parent.mode===u.ObjectLiteral&&this._flags.mode===u.Statement)&&O(this._flags.last_token,I)&&!y.newlines,W=W||x(this._flags.last_token,"else")&&!(x(y,"if")&&!y.comments_before),W=W||this._flags.last_token.type===o.END_EXPR&&(this._previous_flags.mode===u.ForInitializer||this._previous_flags.mode===u.Conditional),W=W||this._flags.last_token.type===o.WORD&&this._flags.mode===u.BlockStatement&&!this._flags.in_case&&!(y.text==="--"||y.text==="++")&&this._last_last_text!=="function"&&y.type!==o.WORD&&y.type!==o.RESERVED,W=W||this._flags.mode===u.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||O(this._flags.last_token,["get","set"])),W?(this.set_mode(u.Statement),this.indent(),this.handle_whitespace_and_comments(y,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(y,O(y,["do","for","if","while"])),!0):!1},j.prototype.handle_start_expr=function(y){this.start_of_statement(y)||this.handle_whitespace_and_comments(y);var W=u.Expression;if(y.text==="["){if(this._flags.last_token.type===o.WORD||this._flags.last_token.text===")"){O(this._flags.last_token,l)&&(this._output.space_before_token=!0),this.print_token(y),this.set_mode(W),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}W=u.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())),h(this._flags.last_token.type,[o.START_EXPR,o.END_EXPR,o.WORD,o.OPERATOR,o.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===o.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,W=u.ForInitializer):h(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,W=u.Conditional):h(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&y.whitespace_before===""?this._output.space_before_token=!1:(h(this._flags.last_token.text,l)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===o.EQUALS||this._flags.last_token.type===o.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(y);else if(this._flags.last_token.type===o.WORD){this._output.space_before_token=!1;var Y=this._tokens.peek(-3);if(this._options.space_after_named_function&&Y){var ie=this._tokens.peek(-4);O(Y,["async","function"])||Y.text==="*"&&O(ie,["async","function"])?this._output.space_before_token=!0:this._flags.mode===u.ObjectLiteral?(Y.text==="{"||Y.text===","||Y.text==="*"&&(ie.text==="{"||ie.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(y);(this._flags.last_token.type===o.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(h(this._last_last_text,["function","yield"])||this._flags.mode===u.ObjectLiteral&&h(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===o.START_BLOCK?this.print_newline():(this._flags.last_token.type===o.END_EXPR||this._flags.last_token.type===o.START_EXPR||this._flags.last_token.type===o.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===o.COMMA)&&this.allow_wrap_or_preserved_newline(y,y.newlines),this.print_token(y),this.set_mode(W),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},j.prototype.handle_end_expr=function(y){for(;this._flags.mode===u.Statement;)this.restore_mode();this.handle_whitespace_and_comments(y),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(y,y.text==="]"&&b(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===o.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(y),this.restore_mode(),E(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===u.Conditional&&(this._previous_flags.mode=u.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},j.prototype.handle_start_block=function(y){this.handle_whitespace_and_comments(y);var W=this._tokens.peek(),Y=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===o.END_EXPR?(this.set_mode(u.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(u.BlockStatement):Y&&(h(Y.text,[":",","])&&h(W.type,[o.STRING,o.WORD,o.RESERVED])||h(W.text,["get","set","..."])&&h(Y.type,[o.WORD,o.RESERVED]))?h(this._last_last_text,["class","interface"])&&!h(Y.text,[":",","])?this.set_mode(u.BlockStatement):this.set_mode(u.ObjectLiteral):this._flags.last_token.type===o.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(u.BlockStatement):h(this._flags.last_token.type,[o.EQUALS,o.START_EXPR,o.COMMA,o.OPERATOR])||O(this._flags.last_token,["return","throw","import","default"])?this.set_mode(u.ObjectLiteral):this.set_mode(u.BlockStatement),this._flags.last_token&&(O(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var ie=!W.comments_before&&W.text==="}",oe=ie&&this._flags.last_word==="function"&&this._flags.last_token.type===o.END_EXPR;if(this._options.brace_preserve_inline){var we=0,me=null;this._flags.inline_frame=!0;do if(we+=1,me=this._tokens.peek(we-1),me.newlines){this._flags.inline_frame=!1;break}while(me.type!==o.EOF&&!(me.type===o.END_BLOCK&&me.opened===y))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&y.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==o.OPERATOR&&(oe||this._flags.last_token.type===o.EQUALS||O(this._flags.last_token,C)&&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===o.START_EXPR||this._flags.last_token.type===o.COMMA)&&((this._flags.last_token.type===o.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===o.COMMA||this._flags.last_token.type===o.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(y),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==o.OPERATOR&&this._flags.last_token.type!==o.START_EXPR&&(this._flags.last_token.type===o.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(y),this.indent(),!ie&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},j.prototype.handle_end_block=function(y){for(this.handle_whitespace_and_comments(y);this._flags.mode===u.Statement;)this.restore_mode();var W=this._flags.last_token.type===o.START_BLOCK;this._flags.inline_frame&&!W?this._output.space_before_token=!0:this._options.brace_style==="expand"?W||this.print_newline():W||(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(y)},j.prototype.handle_word=function(y){if(y.type===o.RESERVED){if(h(y.text,["set","get"])&&this._flags.mode!==u.ObjectLiteral)y.type=o.WORD;else if(y.text==="import"&&h(this._tokens.peek().text,["(","."]))y.type=o.WORD;else if(h(y.text,["as","from"])&&!this._flags.import_block)y.type=o.WORD;else if(this._flags.mode===u.ObjectLiteral){var W=this._tokens.peek();W.text===":"&&(y.type=o.WORD)}}if(this.start_of_statement(y)?O(this._flags.last_token,["var","let","const"])&&y.type===o.WORD&&(this._flags.declaration_statement=!0):y.newlines&&!N(this._flags.mode)&&(this._flags.last_token.type!==o.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==o.EQUALS&&(this._options.preserve_newlines||!O(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(y),this.print_newline()):this.handle_whitespace_and_comments(y),this._flags.do_block&&!this._flags.do_while)if(x(y,"while")){this._output.space_before_token=!0,this.print_token(y),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(y,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===u.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&O(y,["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(y),this._flags.in_case=!0;return}if((this._flags.last_token.type===o.COMMA||this._flags.last_token.type===o.START_EXPR||this._flags.last_token.type===o.EQUALS||this._flags.last_token.type===o.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(y)),x(y,"function")){(h(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(h(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===o.OPERATOR))&&(!this._output.just_added_blankline()&&!y.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===o.RESERVED||this._flags.last_token.type===o.WORD?O(this._flags.last_token,["get","set","new","export"])||O(this._flags.last_token,I)?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===o.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(N(this._flags.mode)||b(this._flags.mode))||this.print_newline(),this.print_token(y),this._flags.last_word=y.text;return}var Y="NONE";if(this._flags.last_token.type===o.END_BLOCK?this._previous_flags.inline_frame?Y="SPACE":O(y,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&y.newlines?Y="NEWLINE":(Y="SPACE",this._output.space_before_token=!0):Y="NEWLINE":this._flags.last_token.type===o.SEMICOLON&&this._flags.mode===u.BlockStatement?Y="NEWLINE":this._flags.last_token.type===o.SEMICOLON&&N(this._flags.mode)?Y="SPACE":this._flags.last_token.type===o.STRING?Y="NEWLINE":this._flags.last_token.type===o.RESERVED||this._flags.last_token.type===o.WORD||this._flags.last_token.text==="*"&&(h(this._last_last_text,["function","yield"])||this._flags.mode===u.ObjectLiteral&&h(this._last_last_text,["{",","]))?Y="SPACE":this._flags.last_token.type===o.START_BLOCK?this._flags.inline_frame?Y="SPACE":Y="NEWLINE":this._flags.last_token.type===o.END_EXPR&&(this._output.space_before_token=!0,Y="NEWLINE"),O(y,l)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?Y="SPACE":Y="NEWLINE"),O(y,["else","catch","finally"]))if((!(this._flags.last_token.type===o.END_BLOCK&&this._previous_flags.mode===u.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&y.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var ie=this._output.current_line;ie.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else Y==="NEWLINE"?O(this._flags.last_token,C)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&O(y,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==o.END_EXPR?(this._flags.last_token.type!==o.START_EXPR||!O(y,["var","let","const"]))&&this._flags.last_token.text!==":"&&(x(y,"if")&&x(y.previous,"else")?this._output.space_before_token=!0:this.print_newline()):O(y,l)&&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():Y==="SPACE"&&(this._output.space_before_token=!0);y.previous&&(y.previous.type===o.WORD||y.previous.type===o.RESERVED)&&(this._output.space_before_token=!0),this.print_token(y),this._flags.last_word=y.text,y.type===o.RESERVED&&(y.text==="do"?this._flags.do_block=!0:y.text==="if"?this._flags.if_block=!0:y.text==="import"?this._flags.import_block=!0:this._flags.import_block&&x(y,"from")&&(this._flags.import_block=!1))},j.prototype.handle_semicolon=function(y){this.start_of_statement(y)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(y);for(var W=this._tokens.peek();this._flags.mode===u.Statement&&!(this._flags.if_block&&x(W,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(y)},j.prototype.handle_string=function(y){y.text.startsWith("`")&&y.newlines===0&&y.whitespace_before===""&&(y.previous.text===")"||this._flags.last_token.type===o.WORD)||(this.start_of_statement(y)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(y),this._flags.last_token.type===o.RESERVED||this._flags.last_token.type===o.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===o.COMMA||this._flags.last_token.type===o.START_EXPR||this._flags.last_token.type===o.EQUALS||this._flags.last_token.type===o.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(y):y.text.startsWith("`")&&this._flags.last_token.type===o.END_EXPR&&(y.previous.text==="]"||y.previous.text===")")&&y.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(y)},j.prototype.handle_equals=function(y){this.start_of_statement(y)||this.handle_whitespace_and_comments(y),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(y),this._output.space_before_token=!0},j.prototype.handle_comma=function(y){this.handle_whitespace_and_comments(y,!0),this.print_token(y),this._output.space_before_token=!0,this._flags.declaration_statement?(N(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(y)):this._flags.mode===u.ObjectLiteral||this._flags.mode===u.Statement&&this._flags.parent.mode===u.ObjectLiteral?(this._flags.mode===u.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(y)},j.prototype.handle_operator=function(y){var W=y.text==="*"&&(O(this._flags.last_token,["function","yield"])||h(this._flags.last_token.type,[o.START_BLOCK,o.COMMA,o.END_BLOCK,o.SEMICOLON])),Y=h(y.text,["-","+"])&&(h(this._flags.last_token.type,[o.START_BLOCK,o.START_EXPR,o.EQUALS,o.OPERATOR])||h(this._flags.last_token.text,l)||this._flags.last_token.text===",");if(!this.start_of_statement(y)){var ie=!W;this.handle_whitespace_and_comments(y,ie)}if(y.text==="*"&&this._flags.last_token.type===o.DOT){this.print_token(y);return}if(y.text==="::"){this.print_token(y);return}if(this._flags.last_token.type===o.OPERATOR&&h(this._options.operator_position,_)&&this.allow_wrap_or_preserved_newline(y),y.text===":"&&this._flags.in_case){this.print_token(y),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==o.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 oe=!0,we=!0,me=!1;if(y.text===":"?this._flags.ternary_depth===0?oe=!1:(this._flags.ternary_depth-=1,me=!0):y.text==="?"&&(this._flags.ternary_depth+=1),!Y&&!W&&this._options.preserve_newlines&&h(y.text,n)){var Se=y.text===":",Ce=Se&&me,xe=Se&&!me;switch(this._options.operator_position){case T.before_newline:this._output.space_before_token=!xe,this.print_token(y),(!Se||Ce)&&this.allow_wrap_or_preserved_newline(y),this._output.space_before_token=!0;return;case T.after_newline:this._output.space_before_token=!0,!Se||Ce?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(y):this._output.space_before_token=!1,this.print_token(y),this._output.space_before_token=!0;return;case T.preserve_newline:xe||this.allow_wrap_or_preserved_newline(y),oe=!(this._output.just_added_newline()||xe),this._output.space_before_token=oe,this.print_token(y),this._output.space_before_token=!0;return}}if(W){this.allow_wrap_or_preserved_newline(y),oe=!1;var pe=this._tokens.peek();we=pe&&h(pe.type,[o.WORD,o.RESERVED])}else if(y.text==="...")this.allow_wrap_or_preserved_newline(y),oe=this._flags.last_token.type===o.START_BLOCK,we=!1;else if(h(y.text,["--","++","!","~"])||Y){if((this._flags.last_token.type===o.COMMA||this._flags.last_token.type===o.START_EXPR)&&this.allow_wrap_or_preserved_newline(y),oe=!1,we=!1,y.newlines&&(y.text==="--"||y.text==="++"||y.text==="~")){var le=O(this._flags.last_token,C)&&y.newlines;le&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(le,!0)}this._flags.last_token.text===";"&&N(this._flags.mode)&&(oe=!0),this._flags.last_token.type===o.RESERVED?oe=!0:this._flags.last_token.type===o.END_EXPR?oe=!(this._flags.last_token.text==="]"&&(y.text==="--"||y.text==="++")):this._flags.last_token.type===o.OPERATOR&&(oe=h(y.text,["--","-","++","+"])&&h(this._flags.last_token.text,["--","-","++","+"]),h(y.text,["+","-"])&&h(this._flags.last_token.text,["--","++"])&&(we=!0)),(this._flags.mode===u.BlockStatement&&!this._flags.inline_frame||this._flags.mode===u.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||oe,this.print_token(y),this._output.space_before_token=we},j.prototype.handle_block_comment=function(y,W){if(this._output.raw){this._output.add_raw_token(y),y.directives&&y.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(y.directives){this.print_newline(!1,W),this.print_token(y),y.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!d.newline.test(y.text)&&!y.newlines){this._output.space_before_token=!0,this.print_token(y),this._output.space_before_token=!0;return}else this.print_block_commment(y,W)},j.prototype.print_block_commment=function(y,W){var Y=m(y.text),ie,oe=!1,we=!1,me=y.whitespace_before,Se=me.length;if(this.print_newline(!1,W),this.print_token_line_indentation(y),this._output.add_token(Y[0]),this.print_newline(!1,W),Y.length>1){for(Y=Y.slice(1),oe=D(Y,"*"),we=H(Y,me),oe&&(this._flags.alignment=1),ie=0;ie<Y.length;ie++)oe?(this.print_token_line_indentation(y),this._output.add_token(L(Y[ie]))):we&&Y[ie]?(this.print_token_line_indentation(y),this._output.add_token(Y[ie].substring(Se))):(this._output.current_line.set_indent(-1),this._output.add_token(Y[ie])),this.print_newline(!1,W);this._flags.alignment=0}},j.prototype.handle_comment=function(y,W){y.newlines?this.print_newline(!1,W):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(y),this.print_newline(!1,W)},j.prototype.handle_dot=function(y){this.start_of_statement(y)||this.handle_whitespace_and_comments(y,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),O(this._flags.last_token,C)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(y,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(y)},j.prototype.handle_unknown=function(y,W){this.print_token(y),y.text[y.text.length-1]===`
|
|
`&&this.print_newline(!1,W)},j.prototype.handle_eof=function(y){for(;this._flags.mode===u.Statement;)this.restore_mode();this.handle_whitespace_and_comments(y)},M.exports.Beautifier=j},function(M){function R(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=[]}R.prototype.clone_empty=function(){var f=new R(this.__parent);return f.set_indent(this.__indent_count,this.__alignment_count),f},R.prototype.item=function(f){return f<0?this.__items[this.__items.length+f]:this.__items[f]},R.prototype.has_match=function(f){for(var d=this.__items.length-1;d>=0;d--)if(this.__items[d].match(f))return!0;return!1},R.prototype.set_indent=function(f,d){this.is_empty()&&(this.__indent_count=f||0,this.__alignment_count=d||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},R.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)},R.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},R.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},R.prototype.is_empty=function(){return this.__items.length===0},R.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},R.prototype.push=function(f){this.__items.push(f);var d=f.lastIndexOf(`
|
|
`);d!==-1?this.__character_count=f.length-d:this.__character_count+=f.length},R.prototype.pop=function(){var f=null;return this.is_empty()||(f=this.__items.pop(),this.__character_count-=f.length),f},R.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},R.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},R.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},R.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 g(f,d){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)),d=d||"",f.indent_level>0&&(d=new Array(f.indent_level+1).join(this.__indent_string)),this.__base_string=d,this.__base_string_length=d.length}g.prototype.get_indent_size=function(f,d){var s=this.__base_string_length;return d=d||0,f<0&&(s=0),s+=f*this.__indent_size,s+=d,s},g.prototype.get_indent_string=function(f,d){var s=this.__base_string;return d=d||0,f<0&&(f=0,s=""),d+=f*this.__indent_size,this.__ensure_cache(d),s+=this.__cache[d],s},g.prototype.__ensure_cache=function(f){for(;f>=this.__cache.length;)this.__add_column()},g.prototype.__add_column=function(){var f=this.__cache.length,d=0,s="";this.__indent_size&&f>=this.__indent_size&&(d=Math.floor(f/this.__indent_size),f-=d*this.__indent_size,s=new Array(d+1).join(this.__indent_string)),f&&(s+=new Array(f+1).join(" ")),this.__cache.push(s)};function p(f,d){this.__indent_cache=new g(f,d),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 R(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}p.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},p.prototype.get_line_number=function(){return this.__lines.length},p.prototype.get_indent_string=function(f,d){return this.__indent_cache.get_indent_string(f,d)},p.prototype.get_indent_size=function(f,d){return this.__indent_cache.get_indent_size(f,d)},p.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},p.prototype.add_new_line=function(f){return this.is_empty()||!f&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},p.prototype.get_code=function(f){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 s=this.__lines.join(`
|
|
`);return f!==`
|
|
`&&(s=s.replace(/[\n]/g,f)),s},p.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},p.prototype.set_indent=function(f,d){return f=f||0,d=d||0,this.next_line.set_indent(f,d),this.__lines.length>1?(this.current_line.set_indent(f,d),!0):(this.current_line.set_indent(),!1)},p.prototype.add_raw_token=function(f){for(var d=0;d<f.newlines;d++)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},p.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()},p.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(" "))},p.prototype.remove_indent=function(f){for(var d=this.__lines.length;f<d;)this.__lines[f]._remove_indent(),f++;this.current_line._remove_wrap_indent()},p.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},p.prototype.just_added_newline=function(){return this.current_line.is_empty()},p.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},p.prototype.ensure_empty_line_above=function(f,d){for(var s=this.__lines.length-2;s>=0;){var c=this.__lines[s];if(c.is_empty())break;if(c.item(0).indexOf(f)!==0&&c.item(-1)!==d){this.__lines.splice(s+1,0,new R(this)),this.previous_line=this.__lines[this.__lines.length-2];break}s--}},M.exports.Output=p},function(M){function R(g,p,f,d){this.type=g,this.text=p,this.comments_before=null,this.newlines=f||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=R},function(M,R){var g="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",p="\\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",d="\\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",s="(?:\\\\u[0-9a-fA-F]{4}|["+g+f+"])",c="(?:\\\\u[0-9a-fA-F]{4}|["+p+f+d+"])*";R.identifier=new RegExp(s+c,"g"),R.identifierStart=new RegExp(s),R.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+p+f+d+"])+");var l=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;R.newline=/[\n\r\u2028\u2029]/,R.lineBreak=new RegExp(`\r
|
|
|`+R.newline.source),R.allLineBreaks=new RegExp(R.lineBreak.source,"g")},function(M,R,g){var p=g(6).Options,f=["before-newline","after-newline","preserve-newline"];function d(s){p.call(this,s,"js");var c=this.raw_options.brace_style||null;c==="expand-strict"?this.raw_options.brace_style="expand":c==="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 l=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var n=0;n<l.length;n++)l[n]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=l[n];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)}d.prototype=new p,M.exports.Options=d},function(M){function R(f,d){this.raw_options=g(f,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"])}R.prototype._get_array=function(f,d){var s=this.raw_options[f],c=d||[];return typeof s=="object"?s!==null&&typeof s.concat=="function"&&(c=s.concat()):typeof s=="string"&&(c=s.split(/[^a-zA-Z0-9_\/\-]+/)),c},R.prototype._get_boolean=function(f,d){var s=this.raw_options[f],c=s===void 0?!!d:!!s;return c},R.prototype._get_characters=function(f,d){var s=this.raw_options[f],c=d||"";return typeof s=="string"&&(c=s.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),c},R.prototype._get_number=function(f,d){var s=this.raw_options[f];d=parseInt(d,10),isNaN(d)&&(d=0);var c=parseInt(s,10);return isNaN(c)&&(c=d),c},R.prototype._get_selection=function(f,d,s){var c=this._get_selection_list(f,d,s);if(c.length!==1)throw new Error("Invalid Option Value: The option '"+f+`' can only be one of the following values:
|
|
`+d+`
|
|
You passed in: '`+this.raw_options[f]+"'");return c[0]},R.prototype._get_selection_list=function(f,d,s){if(!d||d.length===0)throw new Error("Selection list cannot be empty.");if(s=s||[d[0]],!this._is_valid_selection(s,d))throw new Error("Invalid Default Value!");var c=this._get_array(f,s);if(!this._is_valid_selection(c,d))throw new Error("Invalid Option Value: The option '"+f+`' can contain only the following values:
|
|
`+d+`
|
|
You passed in: '`+this.raw_options[f]+"'");return c},R.prototype._is_valid_selection=function(f,d){return f.length&&d.length&&!f.some(function(s){return d.indexOf(s)===-1})};function g(f,d){var s={};f=p(f);var c;for(c in f)c!==d&&(s[c]=f[c]);if(d&&f[d])for(c in f[d])s[c]=f[d][c];return s}function p(f){var d={},s;for(s in f){var c=s.replace(/-/g,"_");d[c]=f[s]}return d}M.exports.Options=R,M.exports.normalizeOpts=p,M.exports.mergeOpts=g},function(M,R,g){var p=g(8).InputScanner,f=g(9).Tokenizer,d=g(9).TOKEN,s=g(13).Directives,c=g(4),l=g(12).Pattern,n=g(14).TemplatablePattern;function o(D,H){return H.indexOf(D)!==-1}var h={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:d.START,RAW:d.RAW,EOF:d.EOF},L=new s(/\/\*/,/\*\//),S=/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\.]/,C=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),w=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";w=w.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),w="\\?\\.(?!\\d) "+w,w=w.replace(/ /g,"|");var T=new RegExp(w),_="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),u=_.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),E=new RegExp("^(?:"+u.join("|")+")$"),m,b=function(D,H){f.call(this,D,H),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var j=new l(this._input),I=new n(this._input).read_options(this._options);this.__patterns={template:I,identifier:I.starting_with(c.identifier).matching(c.identifierMatch),number:j.matching(S),punct:j.matching(T),comment:j.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:j.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:j.matching(/<!--/),html_comment_end:j.matching(/-->/),include:j.starting_with(/#include/).until_after(c.lineBreak),shebang:j.starting_with(/#!/).until_after(c.lineBreak),xml:j.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:I.until(/['\\\n\r\u2028\u2029]/),double_quote:I.until(/["\\\n\r\u2028\u2029]/),template_text:I.until(/[`\\$]/),template_expression:I.until(/[`}\\]/)}};b.prototype=new f,b.prototype._is_comment=function(D){return D.type===h.COMMENT||D.type===h.BLOCK_COMMENT||D.type===h.UNKNOWN},b.prototype._is_opening=function(D){return D.type===h.START_BLOCK||D.type===h.START_EXPR},b.prototype._is_closing=function(D,H){return(D.type===h.END_BLOCK||D.type===h.END_EXPR)&&H&&(D.text==="]"&&H.text==="["||D.text===")"&&H.text==="("||D.text==="}"&&H.text==="{")},b.prototype._reset=function(){m=!1},b.prototype._get_next_token=function(D,H){var j=null;this._readWhitespace();var I=this._input.peek();return I===null?this._create_token(h.EOF,""):(j=j||this._read_non_javascript(I),j=j||this._read_string(I),j=j||this._read_word(D),j=j||this._read_singles(I),j=j||this._read_comment(I),j=j||this._read_regexp(I,D),j=j||this._read_xml(I,D),j=j||this._read_punctuation(),j=j||this._create_token(h.UNKNOWN,this._input.next()),j)},b.prototype._read_word=function(D){var H;if(H=this.__patterns.identifier.read(),H!=="")return H=H.replace(c.allLineBreaks,`
|
|
`),!(D.type===h.DOT||D.type===h.RESERVED&&(D.text==="set"||D.text==="get"))&&E.test(H)?(H==="in"||H==="of")&&(D.type===h.WORD||D.type===h.STRING)?this._create_token(h.OPERATOR,H):this._create_token(h.RESERVED,H):this._create_token(h.WORD,H);if(H=this.__patterns.number.read(),H!=="")return this._create_token(h.WORD,H)},b.prototype._read_singles=function(D){var H=null;return D==="("||D==="["?H=this._create_token(h.START_EXPR,D):D===")"||D==="]"?H=this._create_token(h.END_EXPR,D):D==="{"?H=this._create_token(h.START_BLOCK,D):D==="}"?H=this._create_token(h.END_BLOCK,D):D===";"?H=this._create_token(h.SEMICOLON,D):D==="."&&O.test(this._input.peek(1))?H=this._create_token(h.DOT,D):D===","&&(H=this._create_token(h.COMMA,D)),H&&this._input.next(),H},b.prototype._read_punctuation=function(){var D=this.__patterns.punct.read();if(D!=="")return D==="="?this._create_token(h.EQUALS,D):D==="?."?this._create_token(h.DOT,D):this._create_token(h.OPERATOR,D)},b.prototype._read_non_javascript=function(D){var H="";if(D==="#"){if(this._is_first_token()&&(H=this.__patterns.shebang.read(),H))return this._create_token(h.UNKNOWN,H.trim()+`
|
|
`);if(H=this.__patterns.include.read(),H)return this._create_token(h.UNKNOWN,H.trim()+`
|
|
`);D=this._input.next();var j="#";if(this._input.hasNext()&&this._input.testChar(x)){do D=this._input.next(),j+=D;while(this._input.hasNext()&&D!=="#"&&D!=="=");return D==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(j+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(j+="{}",this._input.next(),this._input.next())),this._create_token(h.WORD,j)}this._input.back()}else if(D==="<"&&this._is_first_token()){if(H=this.__patterns.html_comment_start.read(),H){for(;this._input.hasNext()&&!this._input.testChar(c.newline);)H+=this._input.next();return m=!0,this._create_token(h.COMMENT,H)}}else if(m&&D==="-"&&(H=this.__patterns.html_comment_end.read(),H))return m=!1,this._create_token(h.COMMENT,H);return null},b.prototype._read_comment=function(D){var H=null;if(D==="/"){var j="";if(this._input.peek(1)==="*"){j=this.__patterns.block_comment.read();var I=L.get_directives(j);I&&I.ignore==="start"&&(j+=L.readIgnored(this._input)),j=j.replace(c.allLineBreaks,`
|
|
`),H=this._create_token(h.BLOCK_COMMENT,j),H.directives=I}else this._input.peek(1)==="/"&&(j=this.__patterns.comment.read(),H=this._create_token(h.COMMENT,j))}return H},b.prototype._read_string=function(D){if(D==="`"||D==="'"||D==='"'){var H=this._input.next();return this.has_char_escapes=!1,D==="`"?H+=this._read_string_recursive("`",!0,"${"):H+=this._read_string_recursive(D),this.has_char_escapes&&this._options.unescape_strings&&(H=N(H)),this._input.peek()===D&&(H+=this._input.next()),H=H.replace(c.allLineBreaks,`
|
|
`),this._create_token(h.STRING,H)}return null},b.prototype._allow_regexp_or_xml=function(D){return D.type===h.RESERVED&&o(D.text,["return","case","throw","else","do","typeof","yield"])||D.type===h.END_EXPR&&D.text===")"&&D.opened.previous.type===h.RESERVED&&o(D.opened.previous.text,["if","while","for"])||o(D.type,[h.COMMENT,h.START_EXPR,h.START_BLOCK,h.START,h.END_BLOCK,h.OPERATOR,h.EQUALS,h.EOF,h.SEMICOLON,h.COMMA])},b.prototype._read_regexp=function(D,H){if(D==="/"&&this._allow_regexp_or_xml(H)){for(var j=this._input.next(),I=!1,y=!1;this._input.hasNext()&&(I||y||this._input.peek()!==D)&&!this._input.testChar(c.newline);)j+=this._input.peek(),I?I=!1:(I=this._input.peek()==="\\",this._input.peek()==="["?y=!0:this._input.peek()==="]"&&(y=!1)),this._input.next();return this._input.peek()===D&&(j+=this._input.next(),j+=this._input.read(c.identifier)),this._create_token(h.STRING,j)}return null},b.prototype._read_xml=function(D,H){if(this._options.e4x&&D==="<"&&this._allow_regexp_or_xml(H)){var j="",I=this.__patterns.xml.read_match();if(I){for(var y=I[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),W=y.indexOf("{")===0,Y=0;I;){var ie=!!I[1],oe=I[2],we=!!I[I.length-1]||oe.slice(0,8)==="![CDATA[";if(!we&&(oe===y||W&&oe.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(ie?--Y:++Y),j+=I[0],Y<=0)break;I=this.__patterns.xml.read_match()}return I||(j+=this._input.match(/[\s\S]*/g)[0]),j=j.replace(c.allLineBreaks,`
|
|
`),this._create_token(h.STRING,j)}}return null};function N(D){for(var H="",j=0,I=new p(D),y=null;I.hasNext();)if(y=I.match(/([\s]|[^\\]|\\\\)+/g),y&&(H+=y[0]),I.peek()==="\\"){if(I.next(),I.peek()==="x")y=I.match(/x([0-9A-Fa-f]{2})/g);else if(I.peek()==="u")y=I.match(/u([0-9A-Fa-f]{4})/g);else{H+="\\",I.hasNext()&&(H+=I.next());continue}if(!y)return D;if(j=parseInt(y[1],16),j>126&&j<=255&&y[0].indexOf("x")===0)return D;if(j>=0&&j<32){H+="\\"+y[0];continue}else j===34||j===39||j===92?H+="\\"+String.fromCharCode(j):H+=String.fromCharCode(j)}return H}b.prototype._read_string_recursive=function(D,H,j){var I,y;D==="'"?y=this.__patterns.single_quote:D==='"'?y=this.__patterns.double_quote:D==="`"?y=this.__patterns.template_text:D==="}"&&(y=this.__patterns.template_expression);for(var W=y.read(),Y="";this._input.hasNext();){if(Y=this._input.next(),Y===D||!H&&c.newline.test(Y)){this._input.back();break}else Y==="\\"&&this._input.hasNext()?(I=this._input.peek(),I==="x"||I==="u"?this.has_char_escapes=!0:I==="\r"&&this._input.peek(1)===`
|
|
`&&this._input.next(),Y+=this._input.next()):j&&(j==="${"&&Y==="$"&&this._input.peek()==="{"&&(Y+=this._input.next()),j===Y&&(D==="`"?Y+=this._read_string_recursive("}",H,"`"):Y+=this._read_string_recursive("`",H,"${"),this._input.hasNext()&&(Y+=this._input.next())));Y+=y.read(),W+=Y}return W},M.exports.Tokenizer=b,M.exports.TOKEN=h,M.exports.positionable_operators=C.slice(),M.exports.line_starters=_.slice()},function(M){var R=RegExp.prototype.hasOwnProperty("sticky");function g(p){this.__input=p||"",this.__input_length=this.__input.length,this.__position=0}g.prototype.restart=function(){this.__position=0},g.prototype.back=function(){this.__position>0&&(this.__position-=1)},g.prototype.hasNext=function(){return this.__position<this.__input_length},g.prototype.next=function(){var p=null;return this.hasNext()&&(p=this.__input.charAt(this.__position),this.__position+=1),p},g.prototype.peek=function(p){var f=null;return p=p||0,p+=this.__position,p>=0&&p<this.__input_length&&(f=this.__input.charAt(p)),f},g.prototype.__match=function(p,f){p.lastIndex=f;var d=p.exec(this.__input);return d&&!(R&&p.sticky)&&(d.index!==f&&(d=null)),d},g.prototype.test=function(p,f){return f=f||0,f+=this.__position,f>=0&&f<this.__input_length?!!this.__match(p,f):!1},g.prototype.testChar=function(p,f){var d=this.peek(f);return p.lastIndex=0,d!==null&&p.test(d)},g.prototype.match=function(p){var f=this.__match(p,this.__position);return f?this.__position+=f[0].length:f=null,f},g.prototype.read=function(p,f,d){var s="",c;return p&&(c=this.match(p),c&&(s+=c[0])),f&&(c||!p)&&(s+=this.readUntil(f,d)),s},g.prototype.readUntil=function(p,f){var d="",s=this.__position;p.lastIndex=this.__position;var c=p.exec(this.__input);return c?(s=c.index,f&&(s+=c[0].length)):s=this.__input_length,d=this.__input.substring(this.__position,s),this.__position=s,d},g.prototype.readUntilAfter=function(p){return this.readUntil(p,!0)},g.prototype.get_regexp=function(p,f){var d=null,s="g";return f&&R&&(s="y"),typeof p=="string"&&p!==""?d=new RegExp(p,s):p&&(d=new RegExp(p.source,s)),d},g.prototype.get_literal_regexp=function(p){return RegExp(p.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},g.prototype.peekUntilAfter=function(p){var f=this.__position,d=this.readUntilAfter(p);return this.__position=f,d},g.prototype.lookBack=function(p){var f=this.__position-1;return f>=p.length&&this.__input.substring(f-p.length,f).toLowerCase()===p},M.exports.InputScanner=g},function(M,R,g){var p=g(8).InputScanner,f=g(3).Token,d=g(10).TokenStream,s=g(11).WhitespacePattern,c={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},l=function(n,o){this._input=new p(n),this._options=o||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new s(this._input)};l.prototype.tokenize=function(){this._input.restart(),this.__tokens=new d,this._reset();for(var n,o=new f(c.START,""),h=null,L=[],S=new d;o.type!==c.EOF;){for(n=this._get_next_token(o,h);this._is_comment(n);)S.add(n),n=this._get_next_token(o,h);S.isEmpty()||(n.comments_before=S,S=new d),n.parent=h,this._is_opening(n)?(L.push(h),h=n):h&&this._is_closing(n,h)&&(n.opened=h,h.closed=n,h=L.pop(),n.parent=h),n.previous=o,o.next=n,this.__tokens.add(n),o=n}return this.__tokens},l.prototype._is_first_token=function(){return this.__tokens.isEmpty()},l.prototype._reset=function(){},l.prototype._get_next_token=function(n,o){this._readWhitespace();var h=this._input.read(/.+/g);return h?this._create_token(c.RAW,h):this._create_token(c.EOF,"")},l.prototype._is_comment=function(n){return!1},l.prototype._is_opening=function(n){return!1},l.prototype._is_closing=function(n,o){return!1},l.prototype._create_token=function(n,o){var h=new f(n,o,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return h},l.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},M.exports.Tokenizer=l,M.exports.TOKEN=c},function(M){function R(g){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=g}R.prototype.restart=function(){this.__position=0},R.prototype.isEmpty=function(){return this.__tokens_length===0},R.prototype.hasNext=function(){return this.__position<this.__tokens_length},R.prototype.next=function(){var g=null;return this.hasNext()&&(g=this.__tokens[this.__position],this.__position+=1),g},R.prototype.peek=function(g){var p=null;return g=g||0,g+=this.__position,g>=0&&g<this.__tokens_length&&(p=this.__tokens[g]),p},R.prototype.add=function(g){this.__parent_token&&(g.parent=this.__parent_token),this.__tokens.push(g),this.__tokens_length+=1},M.exports.TokenStream=R},function(M,R,g){var p=g(12).Pattern;function f(d,s){p.call(this,d,s),s?this._line_regexp=this._input.get_regexp(s._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}f.prototype=new p,f.prototype.__set_whitespace_patterns=function(d,s){d+="\\t ",s+="\\n\\r",this._match_pattern=this._input.get_regexp("["+d+s+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+s+"]")},f.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 s=this.__split(this._newline_regexp,d);this.newline_count=s.length-1,this.whitespace_before_token=s[this.newline_count]}return d},f.prototype.matching=function(d,s){var c=this._create();return c.__set_whitespace_patterns(d,s),c._update(),c},f.prototype._create=function(){return new f(this._input,this)},f.prototype.__split=function(d,s){d.lastIndex=0;for(var c=0,l=[],n=d.exec(s);n;)l.push(s.substring(c,n.index)),c=n.index+n[0].length,n=d.exec(s);return c<s.length?l.push(s.substring(c,s.length)):l.push(""),l},M.exports.WhitespacePattern=f},function(M){function R(g,p){this._input=g,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,p&&(this._starting_pattern=this._input.get_regexp(p._starting_pattern,!0),this._match_pattern=this._input.get_regexp(p._match_pattern,!0),this._until_pattern=this._input.get_regexp(p._until_pattern),this._until_after=p._until_after)}R.prototype.read=function(){var g=this._input.read(this._starting_pattern);return(!this._starting_pattern||g)&&(g+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),g},R.prototype.read_match=function(){return this._input.match(this._match_pattern)},R.prototype.until_after=function(g){var p=this._create();return p._until_after=!0,p._until_pattern=this._input.get_regexp(g),p._update(),p},R.prototype.until=function(g){var p=this._create();return p._until_after=!1,p._until_pattern=this._input.get_regexp(g),p._update(),p},R.prototype.starting_with=function(g){var p=this._create();return p._starting_pattern=this._input.get_regexp(g,!0),p._update(),p},R.prototype.matching=function(g){var p=this._create();return p._match_pattern=this._input.get_regexp(g,!0),p._update(),p},R.prototype._create=function(){return new R(this._input,this)},R.prototype._update=function(){},M.exports.Pattern=R},function(M){function R(g,p){g=typeof g=="string"?g:g.source,p=typeof p=="string"?p:p.source,this.__directives_block_pattern=new RegExp(g+/ beautify( \w+[:]\w+)+ /.source+p,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(g+/\sbeautify\signore:end\s/.source+p,"g")}R.prototype.get_directives=function(g){if(!g.match(this.__directives_block_pattern))return null;var p={};this.__directive_pattern.lastIndex=0;for(var f=this.__directive_pattern.exec(g);f;)p[f[1]]=f[2],f=this.__directive_pattern.exec(g);return p},R.prototype.readIgnored=function(g){return g.readUntilAfter(this.__directives_end_ignore_pattern)},M.exports.Directives=R},function(M,R,g){var p=g(12).Pattern,f={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function d(s,c){p.call(this,s,c),this.__template_pattern=null,this._disabled=Object.assign({},f),this._excluded=Object.assign({},f),c&&(this.__template_pattern=this._input.get_regexp(c.__template_pattern),this._excluded=Object.assign(this._excluded,c._excluded),this._disabled=Object.assign(this._disabled,c._disabled));var l=new p(s);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 p,d.prototype._create=function(){return new d(this._input,this)},d.prototype._update=function(){this.__set_templated_pattern()},d.prototype.disable=function(s){var c=this._create();return c._disabled[s]=!0,c._update(),c},d.prototype.read_options=function(s){var c=this._create();for(var l in f)c._disabled[l]=s.templating.indexOf(l)===-1;return c._update(),c},d.prototype.exclude=function(s){var c=this._create();return c._excluded[s]=!0,c._update(),c},d.prototype.read=function(){var s="";this._match_pattern?s=this._input.read(this._starting_pattern):s=this._input.read(this._starting_pattern,this.__template_pattern);for(var c=this._read_template();c;)this._match_pattern?c+=this._input.read(this._match_pattern):c+=this._input.readUntil(this.__template_pattern),s+=c,c=this._read_template();return this._until_after&&(s+=this._input.readUntilAfter(this._until_pattern)),s},d.prototype.__set_templated_pattern=function(){var s=[];this._disabled.php||s.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||s.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||s.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(s.push(this.__patterns.django._starting_pattern.source),s.push(this.__patterns.django_value._starting_pattern.source),s.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||s.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&s.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+s.join("|")+")")},d.prototype._read_template=function(){var s="",c=this._input.peek();if(c==="<"){var l=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&l==="?"&&(s=s||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&l==="%"&&(s=s||this.__patterns.erb.read())}else c==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(s=s||this.__patterns.handlebars_comment.read(),s=s||this.__patterns.handlebars_unescaped.read(),s=s||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(s=s||this.__patterns.django_value.read()),this._excluded.django||(s=s||this.__patterns.django_comment.read(),s=s||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(s=s||this.__patterns.smarty_comment.read(),s=s||this.__patterns.smarty_literal.read(),s=s||this.__patterns.smarty.read()));return s},M.exports.TemplatablePattern=d}],F={};function K(M){var R=F[M];if(R!==void 0)return R.exports;var g=F[M]={exports:{}};return B[M](g,g.exports,K),g.exports}var G=K(0);P=G})();var Q=P;!(ue=[],Z=function(){return{js_beautify:Q}}.apply(Ye,ue),Z!==void 0&&(gt.exports=Z))})()},"7/Dv":function(gt,Ye,ne){gt.exports={bg:"bg___2rJyo",flexRow:"flexRow___2xuIa",flexJustifyCenter:"flexJustifyCenter___Z3bJt",flexAlignEnd:"flexAlignEnd___v7Ww-",flexAlignCenter:"flexAlignCenter___223DA",flexColumn:"flexColumn___3CNqR",formWrap:"formWrap___2b6uL",titleWrap:"titleWrap___1CMQA",fieldWrap:"fieldWrap___2BRrD",mdWrap:"mdWrap___3UYzt",backgroundFa:"backgroundFa___32wpj",button:"button___MHDAn"}},"7Cbv":function(gt,Ye,ne){"use strict";var ue=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Z=new Uint8Array(16);function P(){if(!ue)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ue(Z)}var Q=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function B(f){return typeof f=="string"&&Q.test(f)}for(var F=B,K=[],G=0;G<256;++G)K.push((G+256).toString(16).substr(1));function M(f){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=(K[f[d+0]]+K[f[d+1]]+K[f[d+2]]+K[f[d+3]]+"-"+K[f[d+4]]+K[f[d+5]]+"-"+K[f[d+6]]+K[f[d+7]]+"-"+K[f[d+8]]+K[f[d+9]]+"-"+K[f[d+10]]+K[f[d+11]]+K[f[d+12]]+K[f[d+13]]+K[f[d+14]]+K[f[d+15]]).toLowerCase();if(!F(s))throw TypeError("Stringified UUID is invalid");return s}var R=M;function g(f,d,s){f=f||{};var c=f.random||(f.rng||P)();if(c[6]=c[6]&15|64,c[8]=c[8]&63|128,d){s=s||0;for(var l=0;l<16;++l)d[s+l]=c[l];return d}return R(c)}var p=Ye.a=g},"7ahc":function(gt,Ye,ne){"use strict";ne.d(Ye,"a",function(){return L});var ue=ne("k1fw"),Z=ne("0Owb"),P=ne("+L6B"),Q=ne("2/Rp"),B=ne("y8nQ"),F=ne("Vl3Y"),K=ne("tJVT"),G=ne("OaEy"),M=ne("2fM7"),R=ne("q1tI"),g=ne.n(R),p=ne("VrN/"),f=ne.n(p),d=ne("p77/"),s=ne.n(d),c=ne("c5Ni"),l=ne.n(c),n=M.a.Option,o={labelCol:{span:4},wrapperCol:{span:20}},h={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};Ye.b=function(S){var x=S.callback,O=S.onCancel,C=Object(R.useState)("python"),w=Object(K.a)(C,2),T=w[0],_=w[1];function u(m){_(h[m][1])}function E(m){x(m)}return g.a.createElement(F.a,Object(Z.a)({},o,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:E}),g.a.createElement(F.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},g.a.createElement(M.a,{onChange:u},Object.keys(h).map(function(m){return g.a.createElement(n,{key:m,value:m},h[m][0])}))),g.a.createElement(F.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},g.a.createElement(L,{mode:T})),g.a.createElement("div",{className:"flex-container flex-end"},g.a.createElement(Q.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),g.a.createElement(Q.a,{type:"ghost",onClick:O},"\u53D6\u6D88")))};function L(S){var x=S.value,O=S.onChange,C=S.mode,w=S.options,T=w===void 0?{}:w,_=Object(R.useRef)(),u=Object(R.useState)(),E=Object(K.a)(u,2),m=E[0],b=E[1];return Object(R.useEffect)(function(){if(m){function N(D){var H=D.getValue();O&&O(H)}return m.on("change",N),function(){m.off("change",N)}}},[m,O]),Object(R.useEffect)(function(){m&&m.setOption("mode",C)},[m,C]),Object(R.useEffect)(function(){m&&((x!==m.getValue()||x==="")&&setTimeout(function(){m.setValue(x||" ")},300))},[m,x]),Object(R.useEffect)(function(){if(_.current&&!m){var N=f.a.fromTextArea(_.current,Object(ue.a)({mode:C,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},T));b(N)}},[_.current,m]),g.a.createElement("div",{className:"my-codemirror-container"},g.a.createElement("textarea",{ref:_}))}},"8EBN":function(gt,Ye,ne){(function(ue){ue(ne("VrN/"))})(function(ue){"use strict";ue.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var Z=0;Z<ue.modeInfo.length;Z++){var P=ue.modeInfo[Z];P.mimes&&(P.mime=P.mimes[0])}ue.findModeByMIME=function(Q){Q=Q.toLowerCase();for(var B=0;B<ue.modeInfo.length;B++){var F=ue.modeInfo[B];if(F.mime==Q)return F;if(F.mimes){for(var K=0;K<F.mimes.length;K++)if(F.mimes[K]==Q)return F}}if(/\+xml$/.test(Q))return ue.findModeByMIME("application/xml");if(/\+json$/.test(Q))return ue.findModeByMIME("application/json")},ue.findModeByExtension=function(Q){Q=Q.toLowerCase();for(var B=0;B<ue.modeInfo.length;B++){var F=ue.modeInfo[B];if(F.ext){for(var K=0;K<F.ext.length;K++)if(F.ext[K]==Q)return F}}},ue.findModeByFileName=function(Q){for(var B=0;B<ue.modeInfo.length;B++){var F=ue.modeInfo[B];if(F.file&&F.file.test(Q))return F}var K=Q.lastIndexOf("."),G=K>-1&&Q.substring(K+1,Q.length);if(G)return ue.findModeByExtension(G)},ue.findModeByName=function(Q){Q=Q.toLowerCase();for(var B=0;B<ue.modeInfo.length;B++){var F=ue.modeInfo[B];if(F.name.toLowerCase()==Q)return F;if(F.alias){for(var K=0;K<F.alias.length;K++)if(F.alias[K].toLowerCase()==Q)return F}}}})},"8hTe":function(gt,Ye,ne){gt.exports={button:"button___1wy9m"}},"9Bee":function(gt,Ye,ne){"use strict";var ue=ne("DYRE"),Z=ne("zeV3"),P=ne("+L6B"),Q=ne("2/Rp"),B=ne("k1fw"),F=ne("9og8"),K=ne("tJVT"),G=ne("WmNS"),M=ne.n(G),R=ne("q1tI"),g=ne.n(R),p=ne("vg9a"),f=ne("DlQD"),d=ne.n(f),s=ne("rUJ1");function c(X,v){var A=X.match(/^(\s+)(?:```)/);if(A===null)return v;var U=A[1];return v.split(`
|
|
`).map(function(q){var V=q.match(/^\s+/);if(V===null)return q;var ye=Object(K.a)(V,1),We=ye[0];return We.length>=U.length?q.slice(U.length):q}).join(`
|
|
`)}var l=[],n=["<ul>"],o=new d.a.Renderer,h=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function L(){l.length=0,n=["<ul>"]}var S={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function x(X,v,A,U){if(v>=X.length||X[v].level<=A)return v;var q=X[v];U.push("<li><a href='#"+q.anchor+"'>"+q.text+"</a>"),v++;var V=[];return v=x(X,v,q.level,V),V.length>0&&(U.push("<ul>"),V.forEach(function(ye){U.push(ye)}),U.push("</ul>")),U.push("</li>"),v=x(X,v,A,U),v}function O(){return x(l,0,0,n),n.push("</ul>"),n.join("")}var C={heading:function(v){var A=h.exec(v);if(A)return{type:"heading",raw:A[0],depth:A[1].length,text:A[2]}},fences:function(v){var A=this.rules.block.fences.exec(v);if(A){var U=A[0],q=c(U,A[3]||""),V=A[2]?A[2].trim():A[2];if(["latex","katex","math"].indexOf(V)>=0){var ye=_(),We=q;q=ye,u[ye]={type:"block",expression:We}}return{type:"code",raw:U,lang:V,text:q}}}},w=/(?:\${2})([^\n`]+?)(?:\${2})/gi,T=0,_=function(){return"__special_katext_id_".concat(T++,"__")},u={};function E(){return u}function m(){T=0,u={}}function b(X){return X=X.replace(w,function(v,A){var U=_();return u[U]={type:"inline",expression:A},U}),X}var N=o.listitem;o.listitem=function(X){return N(b(X))};var D=o.paragraph;o.paragraph=function(X){return D(b(X))};var H=o.tablecell;o.tablecell=function(X,v){return H(b(X),v)},o.code=function(X,v,A){var U=(v||"").match(/\S*/)[0];return U?["latex","katex","math"].indexOf(U)>=0?"<p class='editormd-tex'>".concat(X,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(v,'">').concat(A?X:Object(s.escape)(X,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(A?X:Object(s.escape)(X,!0))+"</code></pre>"},o.heading=function(X,v,A){var U=this.options.headerPrefix+A.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return l.push({anchor:U,level:v,text:X}),"<h"+v+' id="'+U+'">'+X+"</h"+v+">"},d.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),d.a.use({tokenizer:C,renderer:o});var j=d.a,I=ne("SJMd"),y=ne("ulZh"),W=ne.n(y),Y=ne("m3rI"),ie=ne("Oy/b"),oe=ne("p5ED"),we=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 me=function(X,v){return(me=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,U){A.__proto__=U}||function(A,U){for(var q in U)Object.prototype.hasOwnProperty.call(U,q)&&(A[q]=U[q])})(X,v)};function Se(X,v){function A(){this.constructor=X}me(X,v),X.prototype=v===null?Object.create(v):(A.prototype=v.prototype,new A)}function Ce(X,v,A,U){return new(A||(A=Promise))(function(q,V){function ye(mt){try{qe(U.next(mt))}catch(ze){V(ze)}}function We(mt){try{qe(U.throw(mt))}catch(ze){V(ze)}}function qe(mt){var ze;mt.done?q(mt.value):(ze=mt.value,ze instanceof A?ze:new A(function(_t){_t(ze)})).then(ye,We)}qe((U=U.apply(X,v||[])).next())})}function xe(X,v){var A,U,q,V,ye={label:0,sent:function(){if(1&q[0])throw q[1];return q[1]},trys:[],ops:[]};return V={next:We(0),throw:We(1),return:We(2)},typeof Symbol=="function"&&(V[Symbol.iterator]=function(){return this}),V;function We(qe){return function(mt){return function(ze){if(A)throw new TypeError("Generator is already executing.");for(;ye;)try{if(A=1,U&&(q=2&ze[0]?U.return:ze[0]?U.throw||((q=U.return)&&q.call(U),0):U.next)&&!(q=q.call(U,ze[1])).done)return q;switch(U=0,q&&(ze=[2&ze[0],q.value]),ze[0]){case 0:case 1:q=ze;break;case 4:return ye.label++,{value:ze[1],done:!1};case 5:ye.label++,U=ze[1],ze=[0];continue;case 7:ze=ye.ops.pop(),ye.trys.pop();continue;default:if(!(q=ye.trys,(q=q.length>0&&q[q.length-1])||ze[0]!==6&&ze[0]!==2)){ye=0;continue}if(ze[0]===3&&(!q||ze[1]>q[0]&&ze[1]<q[3])){ye.label=ze[1];break}if(ze[0]===6&&ye.label<q[1]){ye.label=q[1],q=ze;break}if(q&&ye.label<q[2]){ye.label=q[2],ye.ops.push(ze);break}q[2]&&ye.ops.pop(),ye.trys.pop();continue}ze=v.call(X,ye)}catch(_t){ze=[6,_t],U=0}finally{A=q=0}if(5&ze[0])throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}([qe,mt])}}}function pe(){for(var X=0,v=0,A=arguments.length;v<A;v++)X+=arguments[v].length;var U=Array(X),q=0;for(v=0;v<A;v++)for(var V=arguments[v],ye=0,We=V.length;ye<We;ye++,q++)U[q]=V[ye];return U}var le=function(){function X(){}return X.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},X.setAttributes=function(v,A){for(var U=0,q=A;U<q.length;U++){var V=q[U],ye=V[0],We=V[1];v.setAttribute(ye,We)}},X.createRect=function(v,A,U){var q=document.createElementNS("http://www.w3.org/2000/svg","rect");return q.setAttribute("width",v.toString()),q.setAttribute("height",A.toString()),U&&X.setAttributes(q,U),q},X.createLine=function(v,A,U,q,V){var ye=document.createElementNS("http://www.w3.org/2000/svg","line");return ye.setAttribute("x1",v.toString()),ye.setAttribute("y1",A.toString()),ye.setAttribute("x2",U.toString()),ye.setAttribute("y2",q.toString()),V&&X.setAttributes(ye,V),ye},X.createPolygon=function(v,A){var U=document.createElementNS("http://www.w3.org/2000/svg","polygon");return U.setAttribute("points",v),A&&X.setAttributes(U,A),U},X.createCircle=function(v,A){var U=document.createElementNS("http://www.w3.org/2000/svg","circle");return U.setAttribute("cx",(v/2).toString()),U.setAttribute("cy",(v/2).toString()),U.setAttribute("r",v.toString()),A&&X.setAttributes(U,A),U},X.createEllipse=function(v,A,U){var q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return q.setAttribute("cx",(v/2).toString()),q.setAttribute("cy",(A/2).toString()),q.setAttribute("rx",(v/2).toString()),q.setAttribute("ry",(A/2).toString()),U&&X.setAttributes(q,U),q},X.createGroup=function(v){var A=document.createElementNS("http://www.w3.org/2000/svg","g");return v&&X.setAttributes(A,v),A},X.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},X.createMarker=function(v,A,U,q,V,ye,We){var qe=document.createElementNS("http://www.w3.org/2000/svg","marker");return X.setAttributes(qe,[["id",v],["orient",A],["markerWidth",U.toString()],["markerHeight",q.toString()],["refX",V.toString()],["refY",ye.toString()]]),qe.appendChild(We),qe},X.createText=function(v){var A=document.createElementNS("http://www.w3.org/2000/svg","text");return A.setAttribute("x","0"),A.setAttribute("y","0"),v&&X.setAttributes(A,v),A},X.createTSpan=function(v,A){var U=document.createElementNS("http://www.w3.org/2000/svg","tspan");return U.textContent=v,A&&X.setAttributes(U,A),U},X.createImage=function(v){var A=document.createElementNS("http://www.w3.org/2000/svg","image");return v&&X.setAttributes(A,v),A},X.createPoint=function(v,A){var U=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return U.x=v,U.y=A,U},X.createPath=function(v,A){var U=document.createElementNS("http://www.w3.org/2000/svg","path");return U.setAttribute("d",v),A&&X.setAttributes(U,A),U},X}(),te=function(){function X(){}return X.addKey=function(v){X.key=v},Object.defineProperty(X,"isLicensed",{get:function(){return!!X.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(X.key)},enumerable:!1,configurable:!0}),X}(),de=function(){function X(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return X.prototype.rasterize=function(v,A,U){var q=this;return new Promise(function(V){var ye=U!==void 0?U:document.createElement("canvas");v===null&&(q.markersOnly=!0,q.naturalSize=!1);var We=document.createElementNS("http://www.w3.org/2000/svg","svg");We.setAttribute("xmlns","http://www.w3.org/2000/svg"),We.setAttribute("width",A.width.baseVal.valueAsString),We.setAttribute("height",A.height.baseVal.valueAsString),We.setAttribute("viewBox","0 0 "+A.viewBox.baseVal.width.toString()+" "+A.viewBox.baseVal.height.toString()),We.innerHTML=A.innerHTML,q.naturalSize===!0?(We.width.baseVal.value=v.naturalWidth,We.height.baseVal.value=v.naturalHeight):q.width!==void 0&&q.height!==void 0&&(We.width.baseVal.value=q.width,We.height.baseVal.value=q.height),ye.width=We.width.baseVal.value,ye.height=We.height.baseVal.value;var qe=We.outerHTML,mt=ye.getContext("2d");q.markersOnly!==!0&&mt.drawImage(v,0,0,ye.width,ye.height);var ze=window.URL,_t=new Image(ye.width,ye.height);_t.setAttribute("crossOrigin","anonymous");var jt=new Blob([qe],{type:"image/svg+xml"}),$t=ze.createObjectURL(jt);_t.onload=function(){mt.drawImage(_t,0,0),ze.revokeObjectURL($t);var Pi=ye.toDataURL(q.imageType,q.imageQuality);V(Pi)},_t.src=$t})},X}(),se=function(){},Oe=function(){function X(v){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+v+"_"}return Object.defineProperty(X.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(X.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(X.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),X.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},X.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)},X.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 ke("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new ke("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new ke("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Te("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Te("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},X.prototype.removeStyleSheet=function(){var v;this.styleSheet&&(((v=this.styleSheetRoot)!==null&&v!==void 0?v:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},X}(),ke=function(X,v){this.selector=X,this.style=v},Te=function(X,v){this.localName=X,this.style=v},Le=function(){function X(v,A,U,q,V){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=v,this.displayMode=A,this.markerItems=U,this.uiStyleSettings=q,this.styles=V,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return X.prototype.show=function(v){var A=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 U=document.createElement("div");U.className=this.toolbarBlockStyleClass.name,U.style.whiteSpace="nowrap",this.uiContainer.appendChild(U),this.addActionButton(U,'<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(U,'<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(U,'<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(U,'<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(U,'<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(U,'<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(U,'<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(U,'<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(V){var ye=document.createElement("div");ye.className=""+A.toolbarButtonStyleClass.name,ye.setAttribute("data-type-name",V.typeName),ye.innerHTML=V.icon,ye.addEventListener("click",function(){A.markerToolbarButtonClicked(ye,V)}),A.buttons.push(ye),A.markerButtons.push(ye)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var q=document.createElement("div");q.className=this.toolbarBlockStyleClass.name,q.style.whiteSpace="nowrap",q.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(q),this.addActionButton(q,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(q,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},X.prototype.addButtonClickListener=function(v){this.buttonClickListeners.push(v)},X.prototype.removeButtonClickListener=function(v){this.buttonClickListeners.indexOf(v)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(v),1)},X.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},X.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 A=0;A<this.markerButtons.length;A++)A<v||A===v&&this.markerButtons.length-1===v?this.markerButtonBlock.appendChild(this.markerButtons[A]):(A===v&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[A]))}},X.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")},X.prototype.resetButtonStyles=function(){var v=this;this.buttons.forEach(function(A){A.className=A.className.replace(v.uiStyleSettings.toolbarButtonStyleColorsClassName?v.uiStyleSettings.toolbarButtonStyleColorsClassName:v.toolbarButtonStyleColorsClass.name,"").trim(),A.className=A.className.replace(v.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?v.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:v.toolbarActiveButtonStyleColorsClass.name,"").trim(),A.className+=" "+(v.uiStyleSettings.toolbarButtonStyleColorsClassName?v.uiStyleSettings.toolbarButtonStyleColorsClassName:v.toolbarButtonStyleColorsClass.name)})},X.prototype.addActionButton=function(v,A,U){var q=this,V=document.createElement("div");switch(V.className=""+this.toolbarButtonStyleClass.name,V.innerHTML=A,V.setAttribute("data-action",U),V.addEventListener("click",function(){q.actionToolbarButtonClicked(V,U)}),U){case"select":V.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":V.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":V.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":V.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":V.style.fill=this.uiStyleSettings.closeButtonColor}v.appendChild(V),this.buttons.push(V)},X.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Te("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 Te("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Te("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new Te("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 Te("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var v=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Te("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 Te("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Te("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new ke("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new ke("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},X.prototype.markerToolbarButtonClicked=function(v,A){this.setActiveButton(v),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(U){return U("marker",A)}),this.markerButtonOverflowBlock.style.display="none"},X.prototype.actionToolbarButtonClicked=function(v,A){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(U){return U("action",A)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},X.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)},X.prototype.setActiveMarkerButton=function(v){var A=this.markerButtons.find(function(U){return U.getAttribute("data-type-name")===v});A&&this.setActiveButton(A)},X.prototype.setCurrentMarker=function(v){var A=this;this.currentMarker=v,this.buttons.filter(function(U){return/delete|notes/.test(U.getAttribute("data-action"))}).forEach(function(U){A.currentMarker===void 0?(U.style.fillOpacity="0.4",U.style.pointerEvents="none"):(U.style.fillOpacity="1",U.style.pointerEvents="all")})},X}(),Me=function(){function X(v,A,U,q){this.panels=[],this.panelButtons=[],this.markerjsContainer=v,this.displayMode=A,this.uiStyleSettings=U,this.styles=q,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return X.prototype.addStyles=function(){var v;this.toolboxStyleClass=this.styles.addClass(new Te("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 Te("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var A=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Te("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Te("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Te("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 Te("toolbox-panel-row_colors",`
|
|
background-color: `+((v=this.uiStyleSettings.toolboxBackgroundColor)!==null&&v!==void 0?v:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Te("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*A)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*A)+`px;
|
|
padding: `+A+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Te("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Te("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new ke("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new ke("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},X.prototype.show=function(v){var A;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=v,this.uiContainer.className=this.toolboxStyleClass.name+" "+((A=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&A!==void 0?A:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},X.prototype.setPanelButtons=function(v){var A,U,q=this;this.panels=v,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((A=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&A!==void 0?A:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((U=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&U!==void 0?U:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(V){var ye;V.uiStyleSettings=q.uiStyleSettings;var We=document.createElement("div");We.className=q.toolboxButtonStyleClass.name+" "+((ye=q.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ye!==void 0?ye:q.toolboxButtonStyleColorsClass.name),We.innerHTML=V.icon,We.title=V.title,We.addEventListener("click",function(){q.panelButtonClick(V)}),q.panelButtons.push(We),q.buttonRow.appendChild(We)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},X.prototype.panelButtonClick=function(v){var A=this,U=-1;if(v!==this.activePanel){U=this.panels.indexOf(v),this.panelRow.innerHTML="";var q=v.getUi();q.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(q),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=v}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){A.displayMode==="inline"?A.panelRow.style.display="none":A.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(V,ye){var We,qe;V.className=A.toolboxButtonStyleClass.name+" "+(ye===U?""+((We=A.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&We!==void 0?We:A.toolboxActiveButtonStyleColorsClass.name):""+((qe=A.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&qe!==void 0?qe:A.toolboxButtonStyleColorsClass.name))})},X}(),je=function(X,v){this.title=X,this.icon=v},Fe=function(X){function v(A,U,q,V){var ye=X.call(this,A,V||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return ye.colors=[],ye.addTransparent=!1,ye.colorBoxes=[],ye.colors=U,ye.currentColor=q,ye.setCurrentColor=ye.setCurrentColor.bind(ye),ye.getColorBox=ye.getColorBox.bind(ye),ye}return Se(v,X),v.prototype.getUi=function(){var A=this,U=document.createElement("div");return U.style.overflow="hidden",U.style.whiteSpace="nowrap",this.colors.forEach(function(q){var V=A.getColorBox(q);U.appendChild(V),A.colorBoxes.push(V)}),U},v.prototype.getColorBox=function(A){var U=this,q=this.uiStyleSettings.toolbarHeight/4,V=this.uiStyleSettings.toolbarHeight-q,ye=document.createElement("div");ye.style.display="inline-block",ye.style.boxSizing="content-box",ye.style.width=V-2+"px",ye.style.height=V-2+"px",ye.style.padding="1px",ye.style.marginRight="2px",ye.style.marginBottom="2px",ye.style.borderWidth="2px",ye.style.borderStyle="solid",ye.style.borderRadius=(V+2)/2+"px",ye.style.borderColor=A===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ye.addEventListener("click",function(){U.setCurrentColor(A,ye)});var We=document.createElement("div");return We.style.display="inline-block",We.style.width=V-2+"px",We.style.height=V-2+"px",We.style.backgroundColor=A,We.style.borderRadius=V/2+"px",A==="transparent"&&(We.style.fill=this.uiStyleSettings.toolboxAccentColor,We.innerHTML=`<svg viewBox="0 0 24 24">
|
|
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
|
|
</svg>`),ye.appendChild(We),ye},v.prototype.setCurrentColor=function(A,U){var q=this;this.currentColor=A,this.colorBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(A)},v}(je),Ne=function(){function X(v,A,U){this._state="new",this._isSelected=!1,this._container=v,this._overlayContainer=A,this.globalSettings=U,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(X.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),X.prototype.ownsTarget=function(v){return!1},Object.defineProperty(X.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),X.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},X.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},X.prototype.pointerDown=function(v,A){},X.prototype.dblClick=function(v,A){},X.prototype.manipulate=function(v){},X.prototype.pointerUp=function(v){this.stateChanged()},X.prototype.dispose=function(){},X.prototype.addMarkerVisualToContainer=function(v){this.container.childNodes.length>0?this.container.insertBefore(v,this.container.childNodes[0]):this.container.appendChild(v)},X.prototype.getState=function(){return{typeName:X.typeName,state:this.state,notes:this.notes}},X.prototype.restoreState=function(v){this._state=v.state,this.notes=v.notes},X.prototype.scale=function(v,A){},X.prototype.colorChanged=function(v){this.onColorChanged&&this.onColorChanged(v),this.stateChanged()},X.prototype.fillColorChanged=function(v){this.onFillColorChanged&&this.onFillColorChanged(v),this.stateChanged()},X.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)}},X.typeName="MarkerBase",X}(),Ue=function(){function X(){this.findGripByVisual=this.findGripByVisual.bind(this)}return X.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},X}(),Je=function(){function X(){this.GRIP_SIZE=10,this.visual=le.createGroup(),this.visual.appendChild(le.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(le.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return X.prototype.ownsTarget=function(v){return v===this.visual||v===this.visual.childNodes[0]||v===this.visual.childNodes[1]},X}(),tt=function(){function X(){}return X.toITransformMatrix=function(v){return{a:v.a,b:v.b,c:v.c,d:v.d,e:v.e,f:v.f}},X.toSVGMatrix=function(v,A){return v.a=A.a,v.b=A.b,v.c=A.c,v.d=A.d,v.e=A.e,v.f=A.f,v},X}(),et=function(X){function v(A,U,q){var V=X.call(this,A,U,q)||this;return V.left=0,V.top=0,V.width=0,V.height=0,V.defaultSize={x:50,y:20},V.offsetX=0,V.offsetY=0,V.rotationAngle=0,V.CB_DISTANCE=10,V._suppressMarkerCreateEvent=!1,V.container.transform.baseVal.appendItem(le.createTransform()),V.setupControlBox(),V}return Se(v,X),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(A){this._visual=A;var U=le.createTransform();this._visual.transform.baseVal.appendItem(U)},enumerable:!1,configurable:!0}),v.prototype.ownsTarget=function(A){return!!X.prototype.ownsTarget.call(this,A)||!!(this.controlGrips.findGripByVisual(A)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(A))},v.prototype.pointerDown=function(A,U){X.prototype.pointerDown.call(this,A,U),this.state==="new"&&(this.left=A.x,this.top=A.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var q=this.unrotatePoint(A);if(this.manipulationStartX=q.x,this.manipulationStartY=q.y,this.offsetX=q.x-this.left,this.offsetY=q.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(U),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(U)){this.activeGrip=this.rotatorGrip;var V=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=V.x-this.width/2,this.top=V.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ye=this.container.transform.baseVal.getItem(0);ye.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ye,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},v.prototype.pointerUp=function(A){var U=this.state;X.prototype.pointerUp.call(this,A),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(A),this._state="select",U==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},v.prototype.moveVisual=function(A){this.visual.style.transform="translate("+A.x+"px, "+A.y+"px)"},v.prototype.manipulate=function(A){var U=this.unrotatePoint(A);this.state==="creating"?this.resize(A):this.state==="move"?(this.left=this.manipulationStartLeft+(U.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(U.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(U):this.state==="rotate"&&this.rotate(A)},v.prototype.resize=function(A){var U=this.manipulationStartLeft,q=this.manipulationStartWidth,V=this.manipulationStartTop,ye=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:U=this.manipulationStartLeft+A.x-this.manipulationStartX,q=this.manipulationStartWidth+this.manipulationStartLeft-U;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:q=this.manipulationStartWidth+A.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:V=this.manipulationStartTop+A.y-this.manipulationStartY,ye=this.manipulationStartHeight+this.manipulationStartTop-V;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ye=this.manipulationStartHeight+A.y-this.manipulationStartY}q>=0?(this.left=U,this.width=q):(this.left=U+q,this.width=-q),ye>=0?(this.top=V,this.height=ye):(this.top=V+ye,this.height=-ye),this.setSize()},v.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},v.prototype.rotate=function(A){if(Math.abs(A.x-this.centerX)>.1){var U=Math.sign(A.x-this.centerX);this.rotationAngle=180*Math.atan((A.y-this.centerY)/(A.x-this.centerX))/Math.PI+90*U,this.applyRotation()}},v.prototype.applyRotation=function(){var A=this.container.transform.baseVal.getItem(0);A.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(A,0)},v.prototype.rotatePoint=function(A){if(this.rotationAngle===0)return A;var U=this.container.getCTM(),q=le.createPoint(A.x,A.y);return{x:(q=q.matrixTransform(U)).x,y:q.y}},v.prototype.unrotatePoint=function(A){if(this.rotationAngle===0)return A;var U=this.container.getCTM();U=U.inverse();var q=le.createPoint(A.x,A.y);return{x:(q=q.matrixTransform(U)).x,y:q.y}},v.prototype.select=function(){X.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},v.prototype.deselect=function(){X.prototype.deselect.call(this),this.controlBox.style.display="none"},v.prototype.setupControlBox=function(){this.controlBox=le.createGroup();var A=le.createTransform();A.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(A),this.container.appendChild(this.controlBox),this.controlRect=le.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=le.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 Ue,this.addControlGrips(),this.controlBox.style.display="none"},v.prototype.adjustControlBox=function(){var A=this.controlBox.transform.baseVal.getItem(0);A.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(A,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 A=new Je;return A.visual.transform.baseVal.appendItem(le.createTransform()),this.controlBox.appendChild(A.visual),A},v.prototype.positionGrips=function(){var A=this.controlGrips.topLeft.GRIP_SIZE,U=-A/2,q=U,V=(this.width+this.CB_DISTANCE)/2-A/2,ye=(this.height+this.CB_DISTANCE)/2-A/2,We=this.height+this.CB_DISTANCE-A/2,qe=this.width+this.CB_DISTANCE-A/2;this.positionGrip(this.controlGrips.topLeft.visual,U,q),this.positionGrip(this.controlGrips.topCenter.visual,V,q),this.positionGrip(this.controlGrips.topRight.visual,qe,q),this.positionGrip(this.controlGrips.centerLeft.visual,U,ye),this.positionGrip(this.controlGrips.centerRight.visual,qe,ye),this.positionGrip(this.controlGrips.bottomLeft.visual,U,We),this.positionGrip(this.controlGrips.bottomCenter.visual,V,We),this.positionGrip(this.controlGrips.bottomRight.visual,qe,We),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,V,q-3*this.CB_DISTANCE)},v.prototype.positionGrip=function(A,U,q){var V=A.transform.baseVal.getItem(0);V.setTranslate(U,q),A.transform.baseVal.replaceItem(V,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)},X.prototype.getState.call(this))},v.prototype.restoreState=function(A){X.prototype.restoreState.call(this,A);var U=A;this.left=U.left,this.top=U.top,this.width=U.width,this.height=U.height,this.rotationAngle=U.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(tt.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,U.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(tt.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,U.containerTransformMatrix))},v.prototype.scale=function(A,U){X.prototype.scale.call(this,A,U);var q=this.rotatePoint({x:this.left,y:this.top}),V=this.unrotatePoint({x:q.x*A,y:q.y*U});this.left=V.x,this.top=V.y,this.width=this.width*A,this.height=this.height*U,this.adjustControlBox()},v}(Ne),Ze=function(X){function v(A,U,q){var V=X.call(this,A,U,q)||this;return V.fillColor="transparent",V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.opacity=1,V.setStrokeColor=V.setStrokeColor.bind(V),V.setFillColor=V.setFillColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.createVisual=V.createVisual.bind(V),V}return Se(v,X),v.prototype.ownsTarget=function(A){return!(!X.prototype.ownsTarget.call(this,A)&&A!==this.visual)},v.prototype.createVisual=function(){this.visual=le.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(A,U){X.prototype.pointerDown.call(this,A,U),this.state==="new"&&(this.createVisual(),this.moveVisual(A),this._state="creating")},v.prototype.manipulate=function(A){X.prototype.manipulate.call(this,A)},v.prototype.resize=function(A){X.prototype.resize.call(this,A),this.setSize()},v.prototype.setSize=function(){X.prototype.setSize.call(this),le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},v.prototype.pointerUp=function(A){X.prototype.pointerUp.call(this,A),this.setSize()},v.prototype.setStrokeColor=function(A){this.strokeColor=A,this.visual&&le.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(A),this.stateChanged()},v.prototype.setFillColor=function(A){this.fillColor=A,this.visual&&le.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},v.prototype.setStrokeWidth=function(A){this.strokeWidth=A,this.visual&&le.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},v.prototype.setStrokeDasharray=function(A){this.strokeDasharray=A,this.visual&&le.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},X.prototype.getState.call(this))},v.prototype.restoreState=function(A){var U=A;this.fillColor=U.fillColor,this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.opacity=U.opacity,this.createVisual(),X.prototype.restoreState.call(this,A),this.setSize()},v.prototype.scale=function(A,U){X.prototype.scale.call(this,A,U),this.setSize()},v.title="Rectangle marker",v}(et),dt=function(X){function v(A,U,q,V){var ye=X.call(this,A,V||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ye.widths=[],ye.widthBoxes=[],ye.widths=U,ye.currentWidth=q,ye.setCurrentWidth=ye.setCurrentWidth.bind(ye),ye}return Se(v,X),v.prototype.getUi=function(){var A=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",this.widths.forEach(function(q){var V=document.createElement("div");V.style.display="flex",V.style.flexGrow="2",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.borderColor=q===A.currentWidth?A.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){A.setCurrentWidth(q,V)}),U.appendChild(V);var ye=document.createElement("div");ye.innerText=q.toString(),ye.style.marginRight="5px",V.appendChild(ye);var We=document.createElement("div");We.style.minHeight="20px",We.style.flexGrow="2",We.style.display="flex",We.style.alignItems="center";var qe=document.createElement("hr");qe.style.minWidth="20px",qe.style.border="0px",qe.style.borderTop=q+"px solid "+A.uiStyleSettings.toolboxColor,qe.style.flexGrow="2",We.appendChild(qe),V.appendChild(We),A.widthBoxes.push(V)}),U},v.prototype.setCurrentWidth=function(A,U){var q=this;this.currentWidth=A,this.widthBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},v}(je),it=function(X){function v(A,U,q,V){var ye=X.call(this,A,V||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return ye.styles=[],ye.styleBoxes=[],ye.styles=U,ye.currentStyle=q,ye.setCurrentStyle=ye.setCurrentStyle.bind(ye),ye}return Se(v,X),v.prototype.getUi=function(){var A=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",this.styles.forEach(function(q){var V=document.createElement("div");V.style.display="flex",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.overflow="hidden",V.style.maxWidth=100/A.styles.length-5+"%",V.style.borderColor=q===A.currentStyle?A.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){A.setCurrentStyle(q,V)}),U.appendChild(V);var ye=document.createElement("div");ye.style.minHeight="20px",ye.style.flexGrow="2",ye.style.overflow="hidden";var We=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+A.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(q!==""?'stroke-dasharray="'+q+'"':"")+` />
|
|
</svg>`;ye.innerHTML=We,V.appendChild(ye),A.styleBoxes.push(V)}),U},v.prototype.setCurrentStyle=function(A,U){var q=this;this.currentStyle=A,this.styleBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},v}(je),at=function(X){function v(A,U,q){var V=X.call(this,A,U,q)||this;return V.strokeColor=q.defaultColor,V.strokeWidth=q.defaultStrokeWidth,V.strokeDasharray=q.defaultStrokeDasharray,V.strokePanel=new Fe("Line color",q.defaultColorSet,q.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new dt("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new it("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return Se(v,X),Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var A=X.prototype.getState.call(this);return A.typeName=v.typeName,A},v.typeName="FrameMarker",v.title="Frame marker",v.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',v}(Ze),Ie=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},st=function(X){function v(A,U,q){var V=X.call(this,A,U,q)||this;return V.x1=0,V.y1=0,V.x2=0,V.y2=0,V.defaultLength=50,V.manipulationStartX=0,V.manipulationStartY=0,V.manipulationStartX1=0,V.manipulationStartY1=0,V.manipulationStartX2=0,V.manipulationStartY2=0,V.setupControlBox(),V}return Se(v,X),v.prototype.ownsTarget=function(A){return!!X.prototype.ownsTarget.call(this,A)||!(!this.grip1.ownsTarget(A)&&!this.grip2.ownsTarget(A))},v.prototype.pointerDown=function(A,U){X.prototype.pointerDown.call(this,A,U),this.manipulationStartX=A.x,this.manipulationStartY=A.y,this.state==="new"&&(this.x1=A.x,this.y1=A.y,this.x2=A.x,this.y2=A.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(U)?this.activeGrip=this.grip1:this.grip2.ownsTarget(U)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},v.prototype.pointerUp=function(A){var U=this.state;X.prototype.pointerUp.call(this,A),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(A),this._state="select",U==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},v.prototype.adjustVisual=function(){},v.prototype.manipulate=function(A){this.state==="creating"?this.resize(A):this.state==="move"?(this.x1=this.manipulationStartX1+A.x-this.manipulationStartX,this.y1=this.manipulationStartY1+A.y-this.manipulationStartY,this.x2=this.manipulationStartX2+A.x-this.manipulationStartX,this.y2=this.manipulationStartY2+A.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(A)},v.prototype.resize=function(A){switch(this.activeGrip){case this.grip1:this.x1=A.x,this.y1=A.y;break;case this.grip2:case void 0:this.x2=A.x,this.y2=A.y}this.adjustVisual(),this.adjustControlBox()},v.prototype.select=function(){X.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},v.prototype.deselect=function(){X.prototype.deselect.call(this),this.controlBox.style.display="none"},v.prototype.setupControlBox=function(){this.controlBox=le.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 A=new Je;return A.visual.transform.baseVal.appendItem(le.createTransform()),this.controlBox.appendChild(A.visual),A},v.prototype.positionGrips=function(){var A=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-A/2,this.y1-A/2),this.positionGrip(this.grip2.visual,this.x2-A/2,this.y2-A/2)},v.prototype.positionGrip=function(A,U,q){var V=A.transform.baseVal.getItem(0);V.setTranslate(U,q),A.transform.baseVal.replaceItem(V,0)},v.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},X.prototype.getState.call(this))},v.prototype.restoreState=function(A){X.prototype.restoreState.call(this,A);var U=A;this.x1=U.x1,this.y1=U.y1,this.x2=U.x2,this.y2=U.y2},v.prototype.scale=function(A,U){X.prototype.scale.call(this,A,U),this.x1=this.x1*A,this.y1=this.y1*U,this.x2=this.x2*A,this.y2=this.y2*U,this.adjustVisual(),this.adjustControlBox()},v}(Ne),$e=function(X){function v(A,U,q){var V=X.call(this,A,U,q)||this;return V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.setStrokeColor=V.setStrokeColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.strokeColor=q.defaultColor,V.strokeWidth=q.defaultStrokeWidth,V.strokeDasharray=q.defaultStrokeDasharray,V.strokePanel=new Fe("Line color",q.defaultColorSet,q.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new dt("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new it("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return Se(v,X),v.prototype.ownsTarget=function(A){return!(!X.prototype.ownsTarget.call(this,A)&&A!==this.visual&&A!==this.selectorLine&&A!==this.visibleLine)},v.prototype.createVisual=function(){this.visual=le.createGroup(),this.selectorLine=le.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=le.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(A,U){X.prototype.pointerDown.call(this,A,U),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()),le.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),le.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),le.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},v.prototype.setStrokeColor=function(A){this.strokeColor=A,this.adjustVisual(),this.colorChanged(A)},v.prototype.setStrokeWidth=function(A){this.strokeWidth=A,this.adjustVisual()},v.prototype.setStrokeDasharray=function(A){this.strokeDasharray=A,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 A=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},X.prototype.getState.call(this));return A.typeName=v.typeName,A},v.prototype.restoreState=function(A){X.prototype.restoreState.call(this,A);var U=A;this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.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}(st),De=function(X){function v(A,U,q,V){var ye=X.call(this,A,V||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return ye.fonts=[],ye.fontBoxes=[],ye.fonts=U,ye.currentFont=q,ye.setCurrentFont=ye.setCurrentFont.bind(ye),ye}return Se(v,X),v.prototype.getUi=function(){var A=this,U=document.createElement("div");return U.style.overflow="hidden",U.style.flexGrow="2",this.fonts.forEach(function(q){var V=document.createElement("div");V.style.display="inline-block",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.overflow="hidden",V.style.maxWidth=100/A.fonts.length-5+"%",V.style.borderColor=q===A.currentFont?A.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){A.setCurrentFont(q,V)}),U.appendChild(V);var ye=document.createElement("div");ye.style.display="flex",ye.style.minHeight="20px",ye.style.flexGrow="2",ye.style.fontFamily=q,ye.style.overflow="hidden";var We=document.createElement("div");We.style.whiteSpace="nowrap",We.style.overflow="hidden",We.style.textOverflow="ellipsis",We.innerHTML="The quick brown fox jumps over the lazy dog",ye.appendChild(We),V.appendChild(ye),A.fontBoxes.push(V)}),U},v.prototype.setCurrentFont=function(A,U){var q=this;this.currentFont=A,this.fontBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},v}(je),He=function(X){function v(A,U,q){var V=X.call(this,A,U,q)||this;return V.color="transparent",V.padding=5,V.DEFAULT_TEXT="your text here",V.text=V.DEFAULT_TEXT,V.isMoved=!1,V.color=q.defaultColor,V.fontFamily=q.defaultFontFamily,V.defaultSize={x:100,y:30},V.setColor=V.setColor.bind(V),V.setFont=V.setFont.bind(V),V.renderText=V.renderText.bind(V),V.sizeText=V.sizeText.bind(V),V.textEditDivClicked=V.textEditDivClicked.bind(V),V.showTextEditor=V.showTextEditor.bind(V),V.setSize=V.setSize.bind(V),V.positionTextEditor=V.positionTextEditor.bind(V),V.colorPanel=new Fe("Color",q.defaultColorSet,q.defaultColor),V.colorPanel.onColorChanged=V.setColor,V.fontFamilyPanel=new De("Font",q.defaultFontFamilies,q.defaultFontFamily),V.fontFamilyPanel.onFontChanged=V.setFont,V}return Se(v,X),v.prototype.ownsTarget=function(A){if(X.prototype.ownsTarget.call(this,A)||A===this.visual||A===this.textElement||A===this.bgRectangle)return!0;var U=!1;return this.textElement.childNodes.forEach(function(q){q===A&&(U=!0)}),U},v.prototype.createVisual=function(){this.visual=le.createGroup(),this.bgRectangle=le.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=le.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(le.createTransform()),this.textElement.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},v.prototype.pointerDown=function(A,U){X.prototype.pointerDown.call(this,A,U),this.isMoved=!1,this.pointerDownPoint=A,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(A),this._state="creating")},v.prototype.renderText=function(){var A=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(U){A.textElement.appendChild(le.createTSpan(U.trim()===""?" ":U.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},v.prototype.getTextScale=function(){var A=this.textElement.getBBox(),U=1;if(A.width>0&&A.height>0){var q=(1*this.width-this.width*this.padding*2/100)/A.width,V=(1*this.height-this.height*this.padding*2/100)/A.height;U=Math.min(q,V)}return U},v.prototype.getTextPosition=function(A){var U=this.textElement.getBBox(),q=0,V=0;return U.width>0&&U.height>0&&(q=(this.width-U.width*A)/2,V=this.height/2-U.height*A/2),{x:q,y:V}},v.prototype.sizeText=function(){var A=this.textElement.getBBox(),U=this.getTextScale(),q=this.getTextPosition(U);q.y-=A.y*U,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+q.x+"px, "+q.y+"px) scale("+U+", "+U+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(q.x,q.y),this.textElement.transform.baseVal.getItem(1).setScale(U,U))},v.prototype.manipulate=function(A){X.prototype.manipulate.call(this,A),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(A.x-this.pointerDownPoint.x)>5||Math.abs(A.y-this.pointerDownPoint.y)>5)},v.prototype.resize=function(A){X.prototype.resize.call(this,A),this.isMoved=!0,this.setSize(),this.sizeText()},v.prototype.setSize=function(){X.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},v.prototype.pointerUp=function(A){var U=this.state;U==="creating"&&(this._suppressMarkerCreateEvent=!0),X.prototype.pointerUp.call(this,A),this.setSize(),(U==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},v.prototype.showTextEditor=function(){var A=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(U){U.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var U=Number.parseFloat(A.textEditor.style.fontSize);A.textEditor.clientWidth>=Number.parseInt(A.textEditor.style.maxWidth)&&U>.9;)U-=.1,A.textEditor.style.fontSize=Math.max(U,.9)+"em"}),this.textEditor.addEventListener("keyup",function(U){U.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(U){if(U.clipboardData){var q=U.clipboardData.getData("text"),V=window.getSelection();if(!V.rangeCount)return!1;V.deleteFromDocument(),V.getRangeAt(0).insertNode(document.createTextNode(q)),U.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){A.textEditDivClicked(A.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 A=this.getTextScale(),U=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),q=this.textElement.getBBox(),V={x:q.width*A,y:q.height*A};U.x-=V.x/2,U.y-=V.y/2,this.textEditor.style.top=U.y+"px",this.textEditor.style.left=U.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-U.x+"px",this.textEditor.style.fontSize=Math.max(16*A,12)+"px",this.textElement.style.display="none"}},v.prototype.textEditDivClicked=function(A){this.text=A.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},v.prototype.select=function(){X.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},v.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),X.prototype.deselect.call(this)},v.prototype.dblClick=function(A,U){X.prototype.dblClick.call(this,A,U),this.showTextEditor()},v.prototype.setColor=function(A){this.textElement&&le.setAttributes(this.textElement,[["fill",A]]),this.color=A,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(A)},v.prototype.setFont=function(A){this.textElement&&le.setAttributes(this.textElement,[["font-family",A]]),this.fontFamily=A,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 A=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},X.prototype.getState.call(this));return A.typeName=v.typeName,A},v.prototype.restoreState=function(A){var U=A;this.color=U.color,this.fontFamily=U.fontFamily,this.padding=U.padding,this.text=U.text,this.createVisual(),X.prototype.restoreState.call(this,A),this.setSize()},v.prototype.scale=function(A,U){X.prototype.scale.call(this,A,U),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}(et),Ee=function(X){function v(A,U,q){var V=X.call(this,A,U,q)||this;return V.color="transparent",V.lineWidth=3,V.drawing=!1,V.pixelRatio=1,V.color=q.defaultColor,V.lineWidth=q.defaultStrokeWidth,V.pixelRatio=q.freehandPixelRatio,V.setColor=V.setColor.bind(V),V.addCanvas=V.addCanvas.bind(V),V.finishCreation=V.finishCreation.bind(V),V.setLineWidth=V.setLineWidth.bind(V),V.colorPanel=new Fe("Color",q.defaultColorSet,q.defaultColor),V.colorPanel.onColorChanged=V.setColor,V.lineWidthPanel=new dt("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.lineWidthPanel.onWidthChanged=V.setLineWidth,V}return Se(v,X),v.prototype.ownsTarget=function(A){return!(!X.prototype.ownsTarget.call(this,A)&&A!==this.visual&&A!==this.drawingImage)},v.prototype.createVisual=function(){this.visual=le.createGroup(),this.drawingImage=le.createImage(),this.visual.appendChild(this.drawingImage);var A=le.createTransform();this.visual.transform.baseVal.appendItem(A),this.addMarkerVisualToContainer(this.visual)},v.prototype.pointerDown=function(A,U){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(A.x,A.y),this.drawing=!0):X.prototype.pointerDown.call(this,A,U)},v.prototype.manipulate=function(A){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(A.x,A.y),this.canvasContext.stroke()):X.prototype.manipulate.call(this,A)},v.prototype.resize=function(A){X.prototype.resize.call(this,A),le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},v.prototype.pointerUp=function(A){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):X.prototype.pointerUp.call(this,A)},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(),X.prototype.select.call(this)},v.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),X.prototype.deselect.call(this)},v.prototype.finishCreation=function(){for(var A=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),U=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],q=U[0],V=U[1],ye=U[2],We=U[3],qe=!1,mt=0;mt<this.canvasElement.height;mt++)for(var ze=0;ze<this.canvasElement.width;ze++)A.data[mt*this.canvasElement.width*4+4*ze+3]>0&&(qe=!0,mt<V&&(V=mt),ze<q&&(q=ze),mt>We&&(We=mt),ze>ye&&(ye=ze));if(qe){this.left=q/this.pixelRatio,this.top=V/this.pixelRatio,this.width=(ye-q)/this.pixelRatio,this.height=(We-V)/this.pixelRatio;var _t=document.createElement("canvas");_t.width=ye-q,_t.height=We-V,_t.getContext("2d").putImageData(this.canvasContext.getImageData(q,V,ye-q,We-V),0,0),this.drawingImgUrl=_t.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},v.prototype.setDrawingImage=function(){le.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},v.prototype.setColor=function(A){this.color=A,this.colorChanged(A)},v.prototype.setLineWidth=function(A){this.lineWidth=A},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 A=Object.assign({drawingImgUrl:this.drawingImgUrl},X.prototype.getState.call(this));return A.typeName=v.typeName,A},v.prototype.restoreState=function(A){this.createVisual(),X.prototype.restoreState.call(this,A),this.drawingImgUrl=A.drawingImgUrl,this.setDrawingImage()},v.prototype.scale=function(A,U){X.prototype.scale.call(this,A,U),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}(et),fe=function(X){function v(A,U,q){var V=X.call(this,A,q||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return V.typeBoxes=[],V.currentType=U,V.setCurrentType=V.setCurrentType.bind(V),V}return Se(v,X),v.prototype.getUi=function(){var A=this,U=document.createElement("div");U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2";for(var q=function(We){var qe="both";switch(We){case 0:qe="both";break;case 1:qe="start";break;case 2:qe="end";break;case 3:qe="none"}var mt=document.createElement("div");if(mt.style.display="flex",mt.style.flexGrow="2",mt.style.alignItems="center",mt.style.justifyContent="space-between",mt.style.padding="5px",mt.style.borderWidth="2px",mt.style.borderStyle="solid",mt.style.borderColor=qe===V.currentType?V.uiStyleSettings.toolboxAccentColor:"transparent",mt.addEventListener("click",function(){A.setCurrentType(qe,mt)}),U.appendChild(mt),qe==="both"||qe==="start"){var ze=document.createElement("div");ze.style.display="flex",ze.style.alignItems="center",ze.style.minHeight="20px",ze.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="`+(V.uiStyleSettings!==void 0?V.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,ze.style.marginLeft="5px",mt.appendChild(ze)}var _t=document.createElement("div");_t.style.display="flex",_t.style.alignItems="center",_t.style.minHeight="20px",_t.style.flexGrow="2";var jt=document.createElement("hr");if(jt.style.minWidth="20px",jt.style.border="0px",jt.style.borderTop="3px solid "+(V.uiStyleSettings!==void 0?V.uiStyleSettings.toolboxColor:"#eeeeee"),jt.style.flexGrow="2",_t.appendChild(jt),mt.appendChild(_t),qe==="both"||qe==="end"){var $t=document.createElement("div");$t.style.display="flex",$t.style.alignItems="center",$t.style.minHeight="20px",$t.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="`+(V.uiStyleSettings!==void 0?V.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,$t.style.marginRight="5px",mt.appendChild($t)}V.typeBoxes.push(mt)},V=this,ye=0;ye<4;ye++)q(ye);return U},v.prototype.setCurrentType=function(A,U){var q=this;this.currentType=A,this.typeBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings!==void 0?q.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},v}(je),_e=function(X){function v(A,U,q){var V=X.call(this,A,U,q)||this;return V.arrowType="end",V.arrowBaseHeight=10,V.arrowBaseWidth=10,V.getArrowPoints=V.getArrowPoints.bind(V),V.setArrowType=V.setArrowType.bind(V),V.arrowTypePanel=new fe("Arrow type","end"),V.arrowTypePanel.onArrowTypeChanged=V.setArrowType,V}return Se(v,X),v.prototype.ownsTarget=function(A){return!(!X.prototype.ownsTarget.call(this,A)&&A!==this.arrow1&&A!==this.arrow2)},v.prototype.getArrowPoints=function(A,U){var q=this.arrowBaseWidth+2*this.strokeWidth,V=this.arrowBaseHeight+2*this.strokeWidth;return A-q/2+","+(U+V/2)+" "+A+","+(U-V/2)+" "+(A+q/2)+","+(U+V/2)},v.prototype.createTips=function(){this.arrow1=le.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=le.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.arrow2)},v.prototype.pointerDown=function(A,U){X.prototype.pointerDown.call(this,A,U),this.state==="creating"&&this.createTips()},v.prototype.adjustVisual=function(){if(X.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",le.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),le.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var A=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),U=this.arrow1.transform.baseVal.getItem(0);U.setRotate(A,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(U,0);var q=this.arrow2.transform.baseVal.getItem(0);q.setRotate(A+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(q,0)}},v.prototype.setArrowType=function(A){this.arrowType=A,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 A=Object.assign({arrowType:this.arrowType},X.prototype.getState.call(this));return A.typeName=v.typeName,A},v.prototype.restoreState=function(A){X.prototype.restoreState.call(this,A);var U=A;this.arrowType=U.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}($e),re=function(X){function v(A,U,q){var V=X.call(this,A,U,q)||this;return V.fillColor=q.defaultFillColor,V.strokeWidth=0,V.fillPanel=new Fe("Color",q.defaultColorSet,q.defaultFillColor),V.fillPanel.onColorChanged=V.setFillColor,V}return Se(v,X),Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var A=X.prototype.getState.call(this);return A.typeName=v.typeName,A},v.typeName="CoverMarker",v.title="Cover marker",v.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',v}(Ze),ae=function(X){function v(A,U,q,V){var ye=X.call(this,A,V||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return ye.opacities=[],ye.opacityBoxes=[],ye.opacities=U,ye.currentOpacity=q,ye.setCurrentOpacity=ye.setCurrentOpacity.bind(ye),ye}return Se(v,X),v.prototype.getUi=function(){var A=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",U.style.justifyContent="space-between",this.opacities.forEach(function(q){var V=document.createElement("div");V.style.display="flex",V.style.alignItems="center",V.style.justifyContent="center",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.borderColor=q===A.currentOpacity?A.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){A.setCurrentOpacity(q,V)}),U.appendChild(V);var ye=document.createElement("div");ye.innerText=100*q+"%",V.appendChild(ye),A.opacityBoxes.push(V)}),U},v.prototype.setCurrentOpacity=function(A,U){var q=this;this.currentOpacity=A,this.opacityBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},v}(je),he=function(X){function v(A,U,q){var V=X.call(this,A,U,q)||this;return V.setOpacity=V.setOpacity.bind(V),V.fillColor=q.defaultHighlightColor,V.strokeWidth=0,V.opacity=q.defaultHighlightOpacity,V.fillPanel=new Fe("Color",q.defaultColorSet,V.fillColor),V.fillPanel.onColorChanged=V.setFillColor,V.opacityPanel=new ae("Opacity",q.defaultOpacitySteps,V.opacity),V.opacityPanel.onOpacityChanged=V.setOpacity,V}return Se(v,X),v.prototype.setOpacity=function(A){this.opacity=A,this.visual&&le.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 A=X.prototype.getState.call(this);return A.typeName=v.typeName,A},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}(re),ve='<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>',be=function(X){function v(A,U,q){var V=X.call(this,A,U,q)||this;return V.bgColor="transparent",V.tipPosition={x:0,y:0},V.tipBase1Position={x:0,y:0},V.tipBase2Position={x:0,y:0},V.tipMoving=!1,V.color=q.defaultStrokeColor,V.bgColor=q.defaultFillColor,V.fontFamily=q.defaultFontFamily,V.defaultSize={x:100,y:30},V.setBgColor=V.setBgColor.bind(V),V.getTipPoints=V.getTipPoints.bind(V),V.positionTip=V.positionTip.bind(V),V.setTipPoints=V.setTipPoints.bind(V),V.colorPanel=new Fe("Text color",q.defaultColorSet,V.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>'),V.colorPanel.onColorChanged=V.setColor,V.bgColorPanel=new Fe("Fill color",q.defaultColorSet,V.bgColor,ve),V.bgColorPanel.onColorChanged=V.setBgColor,V.fontFamilyPanel=new De("Font",q.defaultFontFamilies,q.defaultFontFamily),V.fontFamilyPanel.onFontChanged=V.setFont,V.tipGrip=new Je,V.tipGrip.visual.transform.baseVal.appendItem(le.createTransform()),V.controlBox.appendChild(V.tipGrip.visual),V}return Se(v,X),v.prototype.ownsTarget=function(A){return X.prototype.ownsTarget.call(this,A)||this.tipGrip.ownsTarget(A)||this.tip===A},v.prototype.createTip=function(){le.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=le.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},v.prototype.pointerDown=function(A,U){this.state==="new"&&X.prototype.pointerDown.call(this,A,U),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(U)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):X.prototype.pointerDown.call(this,A,U)},v.prototype.pointerUp=function(A){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,X.prototype.pointerUp.call(this,A);else{var U=this.state==="creating";X.prototype.pointerUp.call(this,A),this.setTipPoints(U),this.positionTip()}},v.prototype.manipulate=function(A){if(this.tipMoving){var U=this.unrotatePoint(A);this.tipPosition={x:U.x-this.manipulationStartLeft,y:U.y-this.manipulationStartTop},this.positionTip()}else X.prototype.manipulate.call(this,A)},v.prototype.setBgColor=function(A){this.bgRectangle&&this.tip&&(le.setAttributes(this.bgRectangle,[["fill",A]]),le.setAttributes(this.tip,[["fill",A]])),this.bgColor=A,this.fillColorChanged(A)},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(A){A===void 0&&(A=!1);var U=Math.min(this.height/2,15),q=this.height/5;A&&(this.tipPosition={x:U+q/2,y:this.height+20});var V=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?V<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(q=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:U,y:0},this.tipBase2Position={x:U+q,y:0}):(this.tipBase1Position={x:0,y:U},this.tipBase2Position={x:0,y:U+q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?V<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(q=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-U-q,y:0},this.tipBase2Position={x:this.width-U,y:0}):(this.tipBase1Position={x:this.width,y:U},this.tipBase2Position={x:this.width,y:U+q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?V<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(q=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-U-q,y:this.height},this.tipBase2Position={x:this.width-U,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-U-q},this.tipBase2Position={x:this.width,y:this.height-U}):V<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(q=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:U,y:this.height},this.tipBase2Position={x:U+q,y:this.height}):(this.tipBase1Position={x:0,y:this.height-U},this.tipBase2Position={x:0,y:this.height-U-q})},v.prototype.resize=function(A){X.prototype.resize.call(this,A),this.positionTip()},v.prototype.positionTip=function(){le.setAttributes(this.tip,[["points",this.getTipPoints()]]);var A=this.tipGrip.visual.transform.baseVal.getItem(0);A.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(A,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(),X.prototype.select.call(this)},v.prototype.getState=function(){var A=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},X.prototype.getState.call(this));return A.typeName=v.typeName,A},v.prototype.restoreState=function(A){var U=A;this.bgColor=U.bgColor,this.tipPosition=U.tipPosition,X.prototype.restoreState.call(this,A),this.createTip(),this.setTipPoints()},v.prototype.scale=function(A,U){X.prototype.scale.call(this,A,U),this.tipPosition={x:this.tipPosition.x*A,y:this.tipPosition.y*U},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}(He),Pe=function(X){function v(A,U,q){var V=X.call(this,A,U,q)||this;return V.fillColor="transparent",V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.opacity=1,V.strokeColor=q.defaultColor,V.strokeWidth=q.defaultStrokeWidth,V.strokeDasharray=q.defaultStrokeDasharray,V.fillColor=q.defaultFillColor,V.setStrokeColor=V.setStrokeColor.bind(V),V.setFillColor=V.setFillColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.setOpacity=V.setOpacity.bind(V),V.createVisual=V.createVisual.bind(V),V.strokePanel=new Fe("Line color",pe(q.defaultColorSet,["transparent"]),q.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.fillPanel=new Fe("Fill color",pe(q.defaultColorSet,["transparent"]),V.fillColor,ve),V.fillPanel.onColorChanged=V.setFillColor,V.strokeWidthPanel=new dt("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new it("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V.opacityPanel=new ae("Opacity",q.defaultOpacitySteps,V.opacity),V.opacityPanel.onOpacityChanged=V.setOpacity,V}return Se(v,X),v.prototype.ownsTarget=function(A){return!(!X.prototype.ownsTarget.call(this,A)&&A!==this.visual)},v.prototype.createVisual=function(){this.visual=le.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(A,U){X.prototype.pointerDown.call(this,A,U),this.state==="new"&&(this.createVisual(),this.moveVisual(A),this._state="creating")},v.prototype.manipulate=function(A){X.prototype.manipulate.call(this,A)},v.prototype.resize=function(A){X.prototype.resize.call(this,A),this.setSize()},v.prototype.setSize=function(){X.prototype.setSize.call(this),le.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(A){X.prototype.pointerUp.call(this,A),this.setSize()},v.prototype.setStrokeColor=function(A){this.strokeColor=A,this.visual&&le.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(A),this.stateChanged()},v.prototype.setFillColor=function(A){this.fillColor=A,this.visual&&le.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(A),this.stateChanged()},v.prototype.setStrokeWidth=function(A){this.strokeWidth=A,this.visual&&le.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},v.prototype.setStrokeDasharray=function(A){this.strokeDasharray=A,this.visual&&le.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},v.prototype.setOpacity=function(A){this.opacity=A,this.visual&&le.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 A=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},X.prototype.getState.call(this));return A.typeName=v.typeName,A},v.prototype.restoreState=function(A){var U=A;this.fillColor=U.fillColor,this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.opacity=U.opacity,this.createVisual(),X.prototype.restoreState.call(this,A),this.setSize()},v.prototype.scale=function(A,U){X.prototype.scale.call(this,A,U),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}(et),Ge=function(X){function v(A,U,q){return X.call(this,A,U,q)||this}return Se(v,X),Object.defineProperty(v.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),v.prototype.ownsTarget=function(A){return!(!X.prototype.ownsTarget.call(this,A)&&A!==this.tip1&&A!==this.tip2)},v.prototype.createTips=function(){this.tip1=le.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(le.createTransform()),this.visual.appendChild(this.tip1),this.tip2=le.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(le.createTransform()),this.visual.appendChild(this.tip2)},v.prototype.pointerDown=function(A,U){X.prototype.pointerDown.call(this,A,U),this.state==="creating"&&this.createTips()},v.prototype.adjustVisual=function(){if(X.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(le.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()]]),le.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 A=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),U=this.tip1.transform.baseVal.getItem(0);U.setRotate(A,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(U,0);var q=this.tip2.transform.baseVal.getItem(0);q.setRotate(A+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(q,0)}},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var A=X.prototype.getState.call(this);return A.typeName=v.typeName,A},v.prototype.restoreState=function(A){X.prototype.restoreState.call(this,A),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}($e),ot=function(X){function v(A,U,q){var V=X.call(this,A,U,q)||this;return V.strokePanel.colors=q.defaultColorSet,V.fillColor="transparent",V}return Se(v,X),Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var A=X.prototype.getState.call(this);return A.typeName=v.typeName,A},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}(Pe),ct=function(){function X(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(X.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),X.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))},X.prototype.replaceLastUndoStep=function(v){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=v)},X.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},X.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}},X.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},X}(),ft=function(X){function v(A,U,q){var V=X.call(this,A,U,q)||this;return V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.curveX=0,V.curveY=0,V.manipulationStartCurveX=0,V.manipulationStartCurveY=0,V.setStrokeColor=V.setStrokeColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.positionGrips=V.positionGrips.bind(V),V.addControlGrips=V.addControlGrips.bind(V),V.adjustVisual=V.adjustVisual.bind(V),V.setupControlBox=V.setupControlBox.bind(V),V.resize=V.resize.bind(V),V.strokeColor=q.defaultColor,V.strokeWidth=q.defaultStrokeWidth,V.strokeDasharray=q.defaultStrokeDasharray,V.strokePanel=new Fe("Line color",q.defaultColorSet,q.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new dt("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new it("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return Se(v,X),v.prototype.ownsTarget=function(A){return!(!X.prototype.ownsTarget.call(this,A)&&A!==this.visual&&A!==this.selectorCurve&&A!==this.visibleCurve&&!this.curveGrip.ownsTarget(A))},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=le.createGroup(),this.selectorCurve=le.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=le.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(A,U){X.prototype.pointerDown.call(this,A,U),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=A.x,this.curveY=A.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(U)&&(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()),le.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),le.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),le.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},v.prototype.setupControlBox=function(){X.prototype.setupControlBox.call(this),this.curveControlLine1=le.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=le.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,X.prototype.addControlGrips.call(this)},v.prototype.positionGrips=function(){X.prototype.positionGrips.call(this);var A=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-A/2,this.curveY-A/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(A){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+A.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+A.y-this.manipulationStartY),X.prototype.manipulate.call(this,A)},v.prototype.resize=function(A){this.activeGrip===this.curveGrip&&(this.curveX=A.x,this.curveY=A.y),X.prototype.resize.call(this,A),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(A){this.strokeColor=A,this.adjustVisual(),this.colorChanged(A)},v.prototype.setStrokeWidth=function(A){this.strokeWidth=A,this.adjustVisual()},v.prototype.setStrokeDasharray=function(A){this.strokeDasharray=A,this.adjustVisual()},v.prototype.scale=function(A,U){this.curveX=this.curveX*A,this.curveY=this.curveY*U,X.prototype.scale.call(this,A,U)},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var A=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},X.prototype.getState.call(this));return A.typeName=v.typeName,A},v.prototype.restoreState=function(A){X.prototype.restoreState.call(this,A);var U=A;this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.curveX=U.curveX,this.curveY=U.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}(st),Ct=function(){function X(v,A){A===void 0&&(A=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=v,this.cancelable=A}return Object.defineProperty(X.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),X.prototype.preventDefault=function(){this._defaultPrevented=!0},X}(),xt=function(X){function v(A,U,q){var V=X.call(this,A,!1)||this;return V.dataUrl=U,V.state=q,V}return Se(v,X),v}(Ct),ut=function(X){function v(A,U,q){q===void 0&&(q=!1);var V=X.call(this,A,q)||this;return V.marker=U,V}return Se(v,X),v}(Ct),Ut=function(){function X(){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 X.prototype.addEventListener=function(v,A){this[v].push(A)},X.prototype.removeEventListener=function(v,A){var U=this[v].indexOf(A);U>-1&&this[v].splice(U,1)},X}(),Mt=function(){function X(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 Ie,this._isOpen=!1,this.undoRedoManager=new ct,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 Ut,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=X.instanceCounter++,this.styles=new Oe(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(X.prototype,"ALL_MARKER_TYPES",{get:function(){return[at,Ee,_e,He,ot,Pe,he,be,Ge,re,$e,ft]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[at,Ee,_e,He,Pe,he,be]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"BASIC_MARKER_TYPES",{get:function(){return[at,Ee,_e,He,he]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(v){var A=this;this._availableMarkerTypes.splice(0),v.forEach(function(U){if(typeof U=="string"){var q=A.ALL_MARKER_TYPES.find(function(V){return V.typeName===U});q!==void 0&&A._availableMarkerTypes.push(q)}else A._availableMarkerTypes.push(U)})},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(X.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(X.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),X.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),te.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},X.prototype.show=function(){var v=this;this.styles.styleSheetRoot===void 0&&se.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=se.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(A){return A(new Ct(v))})},X.prototype.render=function(){return Ce(this,void 0,void 0,function(){var v;return xe(this,function(A){switch(A.label){case 0:return this.setCurrentMarker(),(v=new de).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 A.sent(),[4,v.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,A.sent()]}})})},X.prototype.close=function(v){var A=this;if(v===void 0&&(v=!1),this.isOpen){var U=!1;v||this.eventListeners.beforeclose.forEach(function(q){var V=new Ct(A,!0);q(V),V.defaultPrevented&&(U=!0)}),U||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(q){return q(new Ct(A))}),this.detachEvents(),this._isOpen=!1)}},X.prototype.addMarkersToToolbar=function(){for(var v,A=[],U=0;U<arguments.length;U++)A[U]=arguments[U];(v=this._availableMarkerTypes).push.apply(v,A)},X.prototype.addRenderEventListener=function(v){this.addEventListener("render",function(A){v(A.dataUrl,A.state)})},X.prototype.removeRenderEventListener=function(v){},X.prototype.addCloseEventListener=function(v){this.addEventListener("close",function(){v()})},X.prototype.removeCloseEventListener=function(v){},X.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))},X.prototype.onPopupTargetResize=function(){var v=1*this.target.clientWidth/this.target.clientHeight,A=this.editorCanvas.clientWidth/v>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*v:this.editorCanvas.clientWidth,U=A<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/v;this.resize(A,U)},X.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},X.prototype.resize=function(v,A){this._isResizing=!0;var U=v/this.imageWidth,q=A/this.imageHeight;this.imageWidth=Math.round(v),this.imageHeight=Math.round(A),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(U,q),this._isResizing=!1},X.prototype.scaleMarkers=function(v,A){var U,q=this;this._currentMarker&&this._currentMarker instanceof He?this._currentMarker.scale(v,A):(U=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(V){V!==q._currentMarker&&V.scale(v,A)}),U!==void 0&&this.setCurrentMarker(U)},X.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"},X.prototype.setTopLeft=function(){var v=this.editingTarget.getBoundingClientRect(),A=this.editorCanvas.getBoundingClientRect();this.left=v.left-A.left,this.top=v.top-A.top},X.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)},X.prototype.addDefs=function(){for(var v,A=[],U=0;U<arguments.length;U++)A[U]=arguments[U];this.defs=le.createDefs(),this.addDefsToImage(),(v=this.defs).append.apply(v,A)},X.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},X.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)},X.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},X.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},X.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)},X.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},X.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)},X.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()},X.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")},X.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"},X.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},X.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 Me(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},X.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},X.prototype.removeMarker=function(v){this.markerImage.removeChild(v.container),this.markers.indexOf(v)>-1&&this.markers.splice(this.markers.indexOf(v),1),v.dispose()},X.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())},X.prototype.toolbarButtonClicked=function(v,A){if(v==="marker"&&A!==void 0)this.createNewMarker(A);else if(v==="action")switch(A){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()}},X.prototype.deleteSelectedMarker=function(){var v=this;if(this._currentMarker!==void 0){var A=!1;if(this.eventListeners.markerbeforedelete.forEach(function(q){var V=new ut(v,v._currentMarker,!0);q(V),V.defaultPrevented&&(A=!0)}),!A){var U=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(q){return q(new ut(v,U))})}}},X.prototype.clear=function(){var v=this,A=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ye){var We=new ut(v,void 0,!0);ye(We),We.defaultPrevented&&(A=!0)}),!A)){this.setCurrentMarker();for(var U=function(ye){var We=q.markers[ye];q.setCurrentMarker(q.markers[ye]),q._currentMarker.dispose(),q.markerImage.removeChild(q._currentMarker.container),q.markers.splice(q.markers.indexOf(q._currentMarker),1),q.eventListeners.markerdelete.forEach(function(qe){return qe(new ut(v,We))})},q=this,V=this.markers.length-1;V>=0;V--)U(V);this.addUndoStep()}},Object.defineProperty(X.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),X.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))},X.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)},X.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},X.prototype.addUndoStep=function(){var v=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var A=this.getState(),U=this.undoRedoManager.getLastUndoStep();if(!U||U.width===A.width&&U.height===A.height){var q=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(A),q<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(V){return V(new Ct(v))})}else this.undoRedoManager.replaceLastUndoStep(A),this.eventListeners.statechange.forEach(function(V){return V(new Ct(v))})}},X.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},X.prototype.undoStep=function(){var v=this,A=this.undoRedoManager.undo();A!==void 0&&(this.restoreState(A),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(U){return U(new Ct(v))}))},X.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},X.prototype.redoStep=function(){var v=this,A=this.undoRedoManager.redo();A!==void 0&&(this.restoreState(A),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(U){return U(new Ct(v))}))},X.prototype.stepZoom=function(){var v=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=v<this.zoomSteps.length-1?this.zoomSteps[v+1]:this.zoomSteps[0]},X.prototype.panTo=function(v){this.contentDiv.scrollBy({left:this.prevPanPoint.x-v.x,top:this.prevPanPoint.y-v.y}),this.prevPanPoint=v},X.prototype.startRenderAndClose=function(){return Ce(this,void 0,void 0,function(){var v,A,U=this;return xe(this,function(q){switch(q.label){case 0:return[4,this.render()];case 1:return v=q.sent(),A=this.getState(),this.eventListeners.render.forEach(function(V){return V(new xt(U,v,A))}),this.close(!0),[2]}})})},X.prototype.getState=function(v){v===!0&&this.setCurrentMarker();var A={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(U){return A.markers.push(U.getState())}),A},X.prototype.restoreState=function(v){var A=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);v.markers.forEach(function(U){var q=A._availableMarkerTypes.find(function(ye){return ye.typeName===U.typeName});if(q!==void 0){var V=A.addNewMarker(q);V.restoreState(U),A.markers.push(V)}}),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(U){return U(new Ct(A))})},X.prototype.addNewMarker=function(v){var A=le.createGroup();return this.markerImage.appendChild(A),new v(A,this.overlayContainer,this.settings)},X.prototype.createNewMarker=function(v){var A,U=this;(A=typeof v=="string"?this._availableMarkerTypes.find(function(q){return q.typeName===v}):v)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(A),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(A.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(q){return q(new ut(U,U._currentMarker))}))},X.prototype.markerCreated=function(v){var A=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(v),this.setCurrentMarker(v),v instanceof Ee&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Ee):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(U){return U(new ut(A,A._currentMarker))})},X.prototype.colorChanged=function(v){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=v,this.settings.defaultStrokeColor=v)},X.prototype.fillColorChanged=function(v){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=v)},X.prototype.markerStateChanged=function(v){var A=this;this.eventListeners.markerchange.forEach(function(U){return U(new ut(A,v))})},X.prototype.setCurrentMarker=function(v){var A=this;this._currentMarker!==v&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(U){return U(new ut(A,A._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(U){return U(new ut(A,A._currentMarker))}))},X.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 A=this.markers.find(function(U){return U.ownsTarget(v.target)});A!==void 0?(this.setCurrentMarker(A),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))},X.prototype.onDblClick=function(v){if(this._isFocused||this.focus(),this.mode==="select"){var A=this.markers.find(function(U){return U.ownsTarget(v.target)});A!==void 0&&A!==this._currentMarker&&this.setCurrentMarker(A),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(v.clientX,v.clientY),v.target):this.setCurrentMarker()}},X.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}))},X.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()},X.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},X.prototype.onKeyUp=function(v){this._currentMarker===void 0||this.notesArea!==void 0||v.key!=="Delete"&&v.key!=="Backspace"||this.deleteSelectedMarker()},X.prototype.clientToLocalCoordinates=function(v,A){var U=this.markerImage.getBoundingClientRect();return{x:(v-U.left)/this.zoomLevel,y:(A-U.top)/this.zoomLevel}},X.prototype.onWindowResize=function(){this.positionUI()},X.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()},X.prototype.addLicenseKey=function(v){te.addKey(v)},X.prototype.addEventListener=function(v,A){this.eventListeners.addEventListener(v,A)},X.prototype.removeEventListener=function(v,A){this.eventListeners.removeEventListener(v,A)},X.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(X.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),X.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(A){return A(new Ct(v))}))},X.prototype.blur=function(){var v=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(A){return A(new Ct(v))}))},X.instanceCounter=0,X}();/* **********************************
|
|
cropro version 1.2.0
|
|
@license SEE LICENSE IN LICENSE
|
|
|
|
copyright Alan Mendelevich
|
|
see README and LICENSE for details
|
|
********************************** *//*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var Zt=function(X,v){return(Zt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,U){A.__proto__=U}||function(A,U){for(var q in U)Object.prototype.hasOwnProperty.call(U,q)&&(A[q]=U[q])})(X,v)};function Yt(X,v){if(typeof v!="function"&&v!==null)throw new TypeError("Class extends value "+String(v)+" is not a constructor or null");function A(){this.constructor=X}Zt(X,v),X.prototype=v===null?Object.create(v):(A.prototype=v.prototype,new A)}function Rt(X,v,A,U){return new(A||(A=Promise))(function(q,V){function ye(mt){try{qe(U.next(mt))}catch(ze){V(ze)}}function We(mt){try{qe(U.throw(mt))}catch(ze){V(ze)}}function qe(mt){var ze;mt.done?q(mt.value):(ze=mt.value,ze instanceof A?ze:new A(function(_t){_t(ze)})).then(ye,We)}qe((U=U.apply(X,v||[])).next())})}function Ti(X,v){var A,U,q,V,ye={label:0,sent:function(){if(1&q[0])throw q[1];return q[1]},trys:[],ops:[]};return V={next:We(0),throw:We(1),return:We(2)},typeof Symbol=="function"&&(V[Symbol.iterator]=function(){return this}),V;function We(qe){return function(mt){return function(ze){if(A)throw new TypeError("Generator is already executing.");for(;ye;)try{if(A=1,U&&(q=2&ze[0]?U.return:ze[0]?U.throw||((q=U.return)&&q.call(U),0):U.next)&&!(q=q.call(U,ze[1])).done)return q;switch(U=0,q&&(ze=[2&ze[0],q.value]),ze[0]){case 0:case 1:q=ze;break;case 4:return ye.label++,{value:ze[1],done:!1};case 5:ye.label++,U=ze[1],ze=[0];continue;case 7:ze=ye.ops.pop(),ye.trys.pop();continue;default:if(!(q=ye.trys,(q=q.length>0&&q[q.length-1])||ze[0]!==6&&ze[0]!==2)){ye=0;continue}if(ze[0]===3&&(!q||ze[1]>q[0]&&ze[1]<q[3])){ye.label=ze[1];break}if(ze[0]===6&&ye.label<q[1]){ye.label=q[1],q=ze;break}if(q&&ye.label<q[2]){ye.label=q[2],ye.ops.push(ze);break}q[2]&&ye.ops.pop(),ye.trys.pop();continue}ze=v.call(X,ye)}catch(_t){ze=[6,_t],U=0}finally{A=q=0}if(5&ze[0])throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}([qe,mt])}}}var Ui=function(){function X(){}return X.addKey=function(v){X.key=v},Object.defineProperty(X,"isLicensed",{get:function(){return!!X.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(X.key)},enumerable:!1,configurable:!0}),X}(),Qe=function(){function X(){}return X.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},X.setAttributes=function(v,A){for(var U=0,q=A;U<q.length;U++){var V=q[U],ye=V[0],We=V[1];v.setAttribute(ye,We)}},X.createRect=function(v,A,U){var q=document.createElementNS("http://www.w3.org/2000/svg","rect");return q.setAttribute("width",v.toString()),q.setAttribute("height",A.toString()),U&&X.setAttributes(q,U),q},X.createLine=function(v,A,U,q,V){var ye=document.createElementNS("http://www.w3.org/2000/svg","line");return ye.setAttribute("x1",v.toString()),ye.setAttribute("y1",A.toString()),ye.setAttribute("x2",U.toString()),ye.setAttribute("y2",q.toString()),V&&X.setAttributes(ye,V),ye},X.createPolygon=function(v,A){var U=document.createElementNS("http://www.w3.org/2000/svg","polygon");return U.setAttribute("points",v),A&&X.setAttributes(U,A),U},X.createCircle=function(v,A){var U=document.createElementNS("http://www.w3.org/2000/svg","circle");return U.setAttribute("cx",(v/2).toString()),U.setAttribute("cy",(v/2).toString()),U.setAttribute("r",v.toString()),A&&X.setAttributes(U,A),U},X.createEllipse=function(v,A,U){var q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return q.setAttribute("cx",(v/2).toString()),q.setAttribute("cy",(A/2).toString()),q.setAttribute("rx",(v/2).toString()),q.setAttribute("ry",(A/2).toString()),U&&X.setAttributes(q,U),q},X.createGroup=function(v){var A=document.createElementNS("http://www.w3.org/2000/svg","g");return v&&X.setAttributes(A,v),A},X.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},X.createMarker=function(v,A,U,q,V,ye,We){var qe=document.createElementNS("http://www.w3.org/2000/svg","marker");return X.setAttributes(qe,[["id",v],["orient",A],["markerWidth",U.toString()],["markerHeight",q.toString()],["refX",V.toString()],["refY",ye.toString()]]),qe.appendChild(We),qe},X.createText=function(v){var A=document.createElementNS("http://www.w3.org/2000/svg","text");return A.setAttribute("x","0"),A.setAttribute("y","0"),v&&X.setAttributes(A,v),A},X.createTSpan=function(v,A){var U=document.createElementNS("http://www.w3.org/2000/svg","tspan");return U.textContent=v,A&&X.setAttributes(U,A),U},X.createImage=function(v){var A=document.createElementNS("http://www.w3.org/2000/svg","image");return v&&X.setAttributes(A,v),A},X.createPoint=function(v,A){var U=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return U.x=v,U.y=A,U},X.createPath=function(v,A){var U=document.createElementNS("http://www.w3.org/2000/svg","path");return U.setAttribute("d",v),A&&X.setAttributes(U,A),U},X.createElement=function(v,A){var U=document.createElementNS("http://www.w3.org/2000/svg",v);return A&&X.setAttributes(U,A),U},X.getHollowRectanglePath=function(v,A,U,q,V,ye,We,qe){return"M"+v+","+A+"V"+(A+q)+"H"+(v+U)+"V"+A+"H"+V+"V"+ye+"H"+(V+We)+"V"+(ye+qe)+"H"+V+"V"+A+"Z"},X}(),wt=function(){function X(v){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+v+"_"}return Object.defineProperty(X.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(X.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(X.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),X.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},X.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)},X.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 Lt("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Lt("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},X.prototype.removeStyleSheet=function(){var v;this.styleSheet&&(((v=this.styleSheetRoot)!==null&&v!==void 0?v:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},X}(),Ot=function(X,v){this.selector=X,this.style=v},Lt=function(X,v){this.localName=X,this.style=v},qt=function(){function X(){this.blocks=[],this.display=""}return X.prototype.addButtonBlock=function(v){v.className=this.blockClassName,v.buttonClassName=this.buttonClassName,v.buttonColorsClassName=this.buttonColorsClassName,v.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(v)},X.prototype.addElementBlock=function(v){v.className===void 0&&(v.className=this.blockClassName),this.blocks.push(v)},X.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(A){return v.appendChild(A.getUI())}),v},X}(),qi=function(){function X(){}return X.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},X}(),er=function(X){function v(){var A=X!==null&&X.apply(this,arguments)||this;return A.buttons=[],A}return Yt(v,X),v.prototype.addButton=function(A){A.className=this.buttonClassName,A.colorsClassName=this.buttonColorsClassName,A.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(A)},v.prototype.getUI=function(){var A=X.prototype.getUI.call(this);return this.buttons.forEach(function(U){return A.appendChild(U.getUI())}),A},v}(qi),Bt=function(){function X(v,A){this._isActive=!1,this._isHidden=!1,this._icon=v,this.title=A,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(X.prototype,"icon",{get:function(){return this._icon},set:function(v){this._icon=v,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isActive",{get:function(){return this._isActive},set:function(v){this._isActive=v,this.adjustClassName()},enumerable:!1,configurable:!0}),X.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},X.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,"")))},X.prototype.hide=function(){this._isHidden=!0},X}(),pt=function(X){function v(){var A=X!==null&&X.apply(this,arguments)||this;return A.elements=[],A}return Yt(v,X),v.prototype.addElement=function(A){this.elements.push(A)},v.prototype.getUI=function(){var A=X.prototype.getUI.call(this);return this.elements.forEach(function(U){return A.appendChild(U)}),A},v}(qi),Gi=function(){function X(v,A){this.horizontal=v,this.vertical=A}return Object.defineProperty(X.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),X.prototype.getVerticalLength=function(v){return v/this.ratio},X.prototype.getHorizontalLength=function(v){return v*this.ratio},X}(),tr=function(){function X(){}return X.getIcon=function(v,A){if(v>0&&A>0){var U=new Gi(v,A),q=U.ratio>=1?20:U.getHorizontalLength(20),V=U.ratio<1?20:U.getVerticalLength(20),ye=document.createElementNS("http://www.w3.org/2000/svg","svg");ye.setAttribute("xmlns","http://www.w3.org/2000/svg"),ye.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ye);var We=Qe.createDefs();ye.appendChild(We);var qe=Qe.createElement("clipPath",[["id","text-bg-clip"]]);We.appendChild(qe);var mt=Qe.createPath(Qe.getHollowRectanglePath((24-q)/2,(24-V)/2,q,V,(24-q)/2+2,(24-V)/2+2,q-4,V-4));ye.appendChild(mt);var ze=Qe.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);ze.appendChild(Qe.createTSpan(v+":"+A)),ye.appendChild(ze);var _t=ze.getBBox();Qe.setAttributes(ze,[["x",((24-_t.width)/2).toString()],["y",((24-_t.height)/2-_t.y).toString()]]);var jt=Qe.createPath(Qe.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(_t.width))/2,(24-Math.ceil(_t.height))/2,Math.ceil(_t.width),Math.ceil(_t.height)));return qe.appendChild(jt),Qe.setAttributes(mt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ye),ye.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},X}(),vi=function(X){function v(A,U,q){var V=X.call(this,A,U)||this;return V.isDropdownOpen=!1,V.onClick=V.dropdownButtonClicked,V.dropdownButtons=q,V}return Yt(v,X),v.prototype.setupDropdown=function(){var A=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(U){U.className=A.className,U.colorsClassName=A.colorsClassName,A.dropdownBlock.appendChild(U.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}(Bt),kt=function(){function X(v,A){this.GRIP_SIZE=10,this.color=v,this.fillColor=A,this.visual=Qe.createGroup(),this.visual.appendChild(Qe.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Qe.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return X.prototype.ownsTarget=function(v){return v===this.visual||v===this.visual.childNodes[0]||v===this.visual.childNodes[1]},X.prototype.setCenter=function(v,A){this.visual.childNodes.forEach(function(U){return Qe.setAttributes(U,[["cx",v.toString()],["cy",A.toString()]])})},X}(),Bi=function(){function X(v,A,U,q){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=v,this.canvasHeight=A,this.margin=U,this.container=q,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(X.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(X.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(v){this._isGridVisible=v,this.gridContainer&&Qe.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(v){this._zoomFactor=v,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),X.prototype.open=function(){var v=this;this.cropShadeElement=Qe.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Qe.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var A=0;A<this.numberOfGridLines;A++)this.horizontalGridLines.push(Qe.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Qe.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(U){return v.gridContainer.appendChild(U)}),this.verticalGridLines.forEach(function(U){return v.gridContainer.appendChild(U)}),this.cropRectElement=Qe.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},X.prototype.setCropRectangle=function(v){this.cropRect=v;var A=Object.assign({},this.cropRect);this.zoomFactor!==1&&(A.width=this.cropRect.width*this.zoomFactor,A.height=this.cropRect.height*this.zoomFactor,A.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-A.width/2,A.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-A.height/2),Qe.setAttributes(this.cropRectElement,[["x",A.x.toString()],["y",A.y.toString()],["width",A.width.toString()],["height",A.height.toString()]]);var U=A.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(V,ye){var We=A.y+U*(ye+1);Qe.setAttributes(V,[["x1",""+A.x],["y1",""+We],["x2",""+(A.x+A.width)],["y2",""+We]])});var q=A.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(V,ye){var We=A.x+q*(ye+1);Qe.setAttributes(V,[["x1",""+We],["y1",""+A.y],["x2",""+We],["y2",""+(A.y+A.height)]])}),Qe.setAttributes(this.cropShadeElement,[["d",Qe.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,A.x,A.y,A.width,A.height)]]),this.topLeftGrip.setCenter(A.x,A.y),this.topRightGrip.setCenter(A.x+A.width,A.y),this.bottomLeftGrip.setCenter(A.x,A.y+A.height),this.bottomRightGrip.setCenter(A.x+A.width,A.y+A.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},X.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)},X.prototype.clientToLocalCoordinates=function(v,A){var U=this.container.getBoundingClientRect();return{x:v-U.left+this.margin,y:A-U.top+this.margin}},X.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)},X.prototype.onPointerMove=function(v){if(this.isMoving)this.move(this.clientToLocalCoordinates(v.clientX,v.clientY));else if(this.activeGrip){var A=this.clientToLocalCoordinates(v.clientX,v.clientY);this.resize(A)}v.preventDefault()},X.prototype.onPointerUp=function(v){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(v.pointerId)},X.prototype.move=function(v){var A=v.x-this.previousPoint.x,U=v.y-this.previousPoint.y;this.zoomFactor!==1&&(A=-A/this.zoomFactor,U=-U/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+A),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+U),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=v},X.prototype.resize=function(v){var A=Object.assign({},this.cropRect),U=v.x-this.previousPoint.x,q=v.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:A.x+U<this.margin&&(U=this.margin-A.x),A.x+=U,A.width=this.cropRect.x+this.cropRect.width-A.x;break;case this.bottomRightGrip:case this.topRightGrip:A.width+U>this.canvasWidth*this.zoomFactor&&(U=this.canvasWidth*this.zoomFactor-A.width),A.width+=U}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(A.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(U),A.height=this.aspectRatio.getVerticalLength(A.width)):(A.y+=q,A.height=this.cropRect.y+this.cropRect.height-A.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?A.height=this.aspectRatio.getVerticalLength(A.width):A.height+=q}A.width<10&&(A.x=this.cropRect.x,A.width=10),A.height<10&&(A.y=this.cropRect.y,A.height=10),this.previousPoint=v,A.x>=this.margin&&A.y>=this.margin&&A.x-this.margin+A.width<=this.canvasWidth&&A.y-this.margin+A.height<=this.canvasHeight&&(this.cropRect=A,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},X.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,A=this.cropRect.y+this.cropRect.height/2,U=this.aspectRatio.getHorizontalLength(this.cropRect.height),q=this.aspectRatio.getVerticalLength(this.cropRect.width);U/this.canvasWidth<q/this.canvasHeight?this.cropRect.width=U:this.cropRect.height=q,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=v-this.cropRect.width/2,this.cropRect.y=A-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)}},X.prototype.getRescaledRect=function(v,A,U,q,V,ye){var We=U/v,qe=q/A;return{x:(V.x-ye)*We+ye,y:(V.y-ye)*qe+ye,width:V.width*We,height:V.height*qe}},X.prototype.scaleCanvas=function(v,A){var U=this.getRescaledRect(this.canvasWidth,this.canvasHeight,v,A,this.cropRect,this.margin);this.canvasWidth=v,this.canvasHeight=A,this.onCropChange&&this.onCropChange(U),this.setCropRectangle(U)},X}(),Vi=function(){function X(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(X.prototype,"angle",{get:function(){return this._angle},set:function(v){this._angle=v,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),X.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},X.prototype.onPointerDown=function(v){this.controlContainer.setPointerCapture(v.pointerId),this.isDragging=!0,this.previousPoint={x:v.clientX,y:v.clientY}},X.prototype.onPointerMove=function(v){this.isDragging&&(this.onAngleChange&&this.onAngleChange((v.clientX-this.previousPoint.x)/5),this.previousPoint.x=v.clientX)},X.prototype.onPointerUp=function(v){this.isDragging&&this.onAngleChange&&this.onAngleChange((v.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(v.pointerId)},X.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var v=this.angleLabelText.getBBox();Qe.setAttributes(this.angleLabelElement,[["x",((this.width-v.width)/2).toString()],["y",(this.height/2).toString()]])}},X.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)}},X.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 A="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,U=1;U<=this.width/5+10;U++){var q=U%5==0?this.height/3:this.height/6;A+="h4v"+-q+"h1v"+q}A+="v1H0Z",this.scaleShape=Qe.createPath(A);var V=Qe.createTransform();this.scaleShape.transform.baseVal.appendItem(V),v.appendChild(this.scaleShape),this.angleLabelElement=Qe.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Qe.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ye=Qe.createTSpan("");return ye.innerHTML="°",this.angleLabelElement.appendChild(ye),v.appendChild(this.angleLabelElement),document.body.removeChild(v),v},X}(),fr=function(){function X(){this.naturalSize=!1,this.imageType="image/png"}return X.prototype.rasterize=function(v,A,U,q,V,ye,We){var qe=this;return new Promise(function(mt){var ze=document.createElement("canvas");ze.width=v.width.baseVal.value-2*q,ze.height=v.height.baseVal.value-2*q;var _t=1,jt=1;qe.naturalSize===!0?(_t=A.naturalWidth/(v.width.baseVal.value-2*q)/ye,jt=A.naturalHeight/(v.height.baseVal.value-2*q)/We,ze.width=A.naturalWidth/ye,ze.height=A.naturalHeight/We):qe.width!==void 0&&qe.height!==void 0&&(_t=qe.width/U.width,jt=qe.height/U.height,ze.width*=_t,ze.height*=jt);var $t=ze.getContext("2d");$t.translate(ze.width/2,ze.height/2),$t.rotate(V*Math.PI/180),$t.scale(ye,We),$t.translate(-ze.width/2,-ze.height/2),$t.drawImage(A,0,0,ze.width,ze.height);var Pi=document.createElement("canvas");Pi.width=U.width*_t,Pi.height=U.height*jt,Pi.getContext("2d").putImageData($t.getImageData((U.x-q)*_t,(U.y-q)*jt,U.width*_t,U.height*jt),0,0),mt(Pi.toDataURL(qe.imageType,qe.imageQuality))})},X}(),Ve=function(){function X(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=X.instanceCounter++,this.styles=new wt(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(X.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(v){this._zoomToCropEnabled=v,v?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(X.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(X.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(X.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(X.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(X.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}),X.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},X.prototype.show=function(){this.showUI(),this.open()},X.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(A){return A()}),this._isOpen=!1)},X.prototype.addRenderEventListener=function(v){this.renderEventListeners.push(v)},X.prototype.removeRenderEventListener=function(v){this.renderEventListeners.indexOf(v)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(v),1)},X.prototype.addCloseEventListener=function(v){this.closeEventListeners.push(v)},X.prototype.removeCloseEventListener=function(v){this.closeEventListeners.indexOf(v)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(v),1)},X.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))},X.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var v=1*this.target.clientWidth/this.target.clientHeight,A=this.contentDiv.clientWidth/v>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*v:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,U=A+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/v;this.resize(A,U)}},X.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},X.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",Qe.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},X.prototype.resize=function(v,A){this.imageWidth=Math.round(v),this.imageHeight=Math.round(A),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()},X.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 A=v.toDataURL();Qe.setAttributes(this.editingTarget,[["href",A]]),this.setEditingTargetSize()},X.prototype.setTopLeft=function(){var v=this.target.getBoundingClientRect(),A=this.editorCanvas.getBoundingClientRect();this.left=v.left-A.left-this.CANVAS_MARGIN,this.top=v.top-A.top-this.CANVAS_MARGIN},X.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=Qe.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Qe.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Qe.createGroup(),this.editingTargetRotationScaleContainer=Qe.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var v=Qe.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(v);var A=Qe.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(A),this.editingTargetContainer=Qe.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)},X.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},X.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=Qe.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Bi(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()},X.prototype.zoomToCrop=function(){if(this.cropRect){var v=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,A=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 "+A+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-v+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-A+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},X.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)},X.prototype.cropRectChanged=function(v){this.cropRect=v,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},X.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},X.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"},X.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},X.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,A=this.target.offsetTop>v+this.CANVAS_MARGIN?this.target.offsetTop-(v+this.CANVAS_MARGIN):0;this.coverDiv.style.top=A+"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},X.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},X.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 A=new er;A.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(A);var U=[];this.aspectRatios.forEach(function(jt){var $t=new Bt(tr.getIcon(jt.horizontal,jt.vertical),jt.horizontal===0&&jt.vertical===0?"FREE":jt.horizontal+":"+jt.vertical);$t.onClick=function(){return v.ratioButtonClicked(jt)},U.push($t)}),this.aspectRatioButton=new vi(tr.getIcon(0,0),"Aspect ratio",U),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,A.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var q=new Bt('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");q.isActive=this.isGridVisible,q.onClick=function(){v.isGridVisible=!v.isGridVisible,q.isActive=v.isGridVisible},A.addButton(q);var V=new Bt('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(V.isActive=this.zoomToCropEnabled,V.onClick=function(){v.zoomToCropEnabled=!v.zoomToCropEnabled,V.isActive=v.zoomToCropEnabled},A.addButton(V),!Ui.isLicensed){var ye=new pt;this.topToolbar.addElementBlock(ye);var We=document.createElement("div");We.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var qe=document.createElement("a");qe.style.color="currentColor",qe.href="https://markerjs.com/products/cropro",qe.target="_blank",qe.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>',We.appendChild(qe),ye.addElement(We)}var mt=new er;mt.minWidth=3*this.toolbarHeight+"px",mt.contentAlign="end",this.topToolbar.addButtonBlock(mt);var ze=new Bt('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");ze.onClick=this.startRenderAndClose,mt.addButton(ze),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(ze.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var _t=new Bt('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");_t.onClick=this.close,mt.addButton(_t),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(_t.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},X.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 A=new er;A.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(A);var U=new Bt('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");U.onClick=this.rotateLeftButtonClicked,A.addButton(U);var q=new Bt('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");q.onClick=this.rotateRightButtonClicked,A.addButton(q);var V=new pt;V.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(V),this.straightener=new Vi("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(mt){v.rotateBy(mt),v.straightener.angle=v.rotationAngle},V.addElement(this.straightener.getUI());var ye=new er;ye.minWidth=2*this.toolbarHeight+"px",ye.contentAlign="end",this.bottomToolbar.addButtonBlock(ye);var We=new Bt('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");We.onClick=this.flipHorizontallyButtonClicked,ye.addButton(We);var qe=new Bt('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");qe.onClick=this.flipVerticallyButtonClicked,ye.addButton(qe)},X.prototype.ratioButtonClicked=function(v){this.aspectRatio=v,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},X.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=tr.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},X.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Gi(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},X.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},X.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},X.prototype.restoreState=function(v){if(v){var A=this.cropLayer.getRescaledRect(v.width,v.height,this.imageWidth,this.imageHeight,v.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(A),this.cropRectChanged(A),this.flippedHorizontally=v.flippedHorizontally,this.flippedVertically=v.flippedVertically,this.applyFlip(),this.rotationAngle=v.rotationAngle,this.applyRotation()}},X.prototype.clientToLocalCoordinates=function(v,A){var U=this.cropImage.getBoundingClientRect();return{x:v-U.left,y:A-U.top}},X.prototype.onWindowResize=function(){this.positionUI()},X.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()},X.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)},X.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)},X.prototype.rotateTo=function(v){v=(v=v>180?v-360:v)<=-180?v+360:v,this.rotationAngle=v,this.applyRotation()},X.prototype.rotateBy=function(v){this.rotateTo((this.rotationAngle+v)%360)},X.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 A=this.editingTargetRotationContainer.transform.baseVal.getItem(0);A.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(A,0);var U=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/U.width,this.imageHeight/U.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=v},X.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},X.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},X.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},X.prototype.startRenderAndClose=function(){return Rt(this,void 0,void 0,function(){var v,A;return Ti(this,function(U){switch(U.label){case 0:return[4,this.render()];case 1:return v=U.sent(),A=this.getState(),this.renderEventListeners.forEach(function(q){return q(v,A)}),this.close(!0),[2]}})})},X.prototype.render=function(){return Rt(this,void 0,void 0,function(){var v;return Ti(this,function(A){switch(A.label){case 0:return(v=new fr).naturalSize=this.renderAtNaturalSize,v.imageType=this.renderImageType,v.imageQuality=this.renderImageQuality,v.width=this.renderWidth,v.height=this.renderHeight,this.unzoomFromCrop(),Qe.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 A.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,A.sent()]}})})},X.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Lt("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 Lt("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Lt("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var v=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Lt("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 Lt("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Lt("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new Ot("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new Ot("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Lt("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 Lt("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Lt("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 Lt("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 Lt("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},X.instanceCounter=0,X}(),Tt=ne("8hTe"),pr=ne.n(Tt),mr=/<pre[^>]*>/g;function gr(X){var v=document.createElement("div");return v.innerHTML=X,v.childNodes.length===0?"":v.childNodes[0].nodeValue}var vr=Ye.a=function(X){var v=X.value,A=v===void 0?"":v,U=X.edit,q=U===void 0?!1:U,V=X.className,ye=X.showTextOnly,We=X.showLines,qe=X.replaces,mt=X.zoomImg,ze=X.hasMask,_t=X.style,jt=_t===void 0?{}:_t,$t=X.stylesPrev,Pi=$t===void 0?{}:$t,yi=String(A),_i=Object(R.useRef)(),Xi=Object(R.useRef)(),Ir=Object(R.useState)(""),li=Object(K.a)(Ir,2),ji=li[0],or=li[1],lr=Object(R.useState)("office"),Mi=Object(K.a)(lr,2),kr=Mi[0],yr=Mi[1],zr=function(){var Ht=new Ve(Xi.current);Ht.displayMode="popup",Ht.addRenderEventListener(function(){var pi=Object(F.a)(M.a.mark(function Dt(ri){var zt;return M.a.wrap(function(ui){for(;;)switch(ui.prev=ui.next){case 0:return _i.current.style.display="none",ui.next=3,Object(we.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:ri}});case 3:zt=ui.sent,zt!=null&&zt.id&&qe(Xi.current.getAttribute("src").replace(Y.a.API_SERVER,""),"/api/attachments/".concat(zt==null?void 0:zt.id,"?type=").concat(zt.content_type));case 5:case"end":return ui.stop()}},Dt)}));return function(Dt){return pi.apply(this,arguments)}}()),Ht.show()},Kr=function(){var Ht=new Mt(Xi.current);Ht.settings.displayMode="popup",Ht.addEventListener("render",function(){var pi=Object(F.a)(M.a.mark(function Dt(ri){var zt;return M.a.wrap(function(ui){for(;;)switch(ui.prev=ui.next){case 0:if(_i.current.style.display="none",!Xi.current){ui.next=6;break}return ui.next=4,Object(we.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:ri.dataUrl}});case 4:zt=ui.sent,zt!=null&&zt.id&&qe(Xi.current.getAttribute("src").replace(Y.a.API_SERVER,""),"/api/attachments/".concat(zt==null?void 0:zt.id,"?type=").concat(zt.content_type));case 6:case"end":return ui.stop()}},Dt)}));return function(Dt){return pi.apply(this,arguments)}}()),Ht.show(),window.markerArea=Ht},Yi=Object(R.useMemo)(function(){_i.current&&(_i.current.style.zIndex=-1);try{var ti=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Ht=/\"\/api\/attachments\/|\"\/attachments\/download\//g,pi=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;yi=yi.replace(ti,"("+Y.a.API_SERVER+"/api/attachments/").replace(Ht,'"'+Y.a.API_SERVER+"/api/attachments/").replace(pi,'"'+Y.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(ir){}var Dt=j(yi),ri=E();if(yi.match(/\[TOC\]/)&&(Dt=Dt.replace("<p>[TOC]</p>",O()),L()),Dt=Dt.replace(/(__special_katext_id_\d+__)/g,function(ir,ui){var wi=ri[ui],Vr=wi.type,Er=wi.expression;return Object(ie.renderToString)(gr(Er)||"",{displayMode:Vr==="block",throwOnError:!1,output:"html"})}),Dt=Dt.replace(/▁/g,"\u2581\u2581\u2581"),m(),ye){var zt=document.createElement("div");return zt.innerHTML=Dt,zt.innerText}return setTimeout(function(){return dn()},500),Dt},[yi]),zi=Object(R.useRef)();S.WebkitLineClamp=We,We&&(jt=Object(B.a)(Object(B.a)({},jt),S));function _r(ti){var Ht=ti.target;if(Ht.tagName.toUpperCase()==="IMG"){if(mt){var pi=Ht.getAttribute("src");or(pi),yr("image")}}else if(Ht.tagName.toUpperCase()==="A"){var Dt=Ht.getAttribute("href");if(Dt.indexOf("office")>-1)ti.preventDefault(),or(Dt),yr("office");else if(Dt.indexOf("application/pdf")>-1)ti.preventDefault(),or(Dt),yr("pdf");else if(Dt.indexOf("text/html")>-1)ti.preventDefault(),or(Dt),yr("html");else if(Dt.startsWith("#")){ti.preventDefault();var ri=document.getElementById(Dt.replace("#",""));ri&&ri.scrollIntoView(!0)}}}var dn=function(){var Ht,pi=(Ht=zi.current)===null||Ht===void 0?void 0:Ht.querySelectorAll("video");pi==null||pi.forEach(function(Dt){if(Dt.oncontextmenu=function(){return!1},Dt.src.indexOf(".m3u8")>-1&&!Dt.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var ri=new W.a;ri.loadSource(Dt.src),ri.attachMedia(Dt)}}})};Object(R.useEffect)(function(){if(zi.current&&Yi&&(Yi.match(mr)&&window.PR.prettyPrint()),zi.current)return zi.current.addEventListener("click",_r),function(){zi.current.removeEventListener("click",_r),m(),L()}},[Yi,zi.current,_r]);var br=function(Ht){if(!q)return;Ht.target.nodeName==="IMG"?(_i.current.style.zIndex=1,_i.current.style.display="flex",_i.current.style.width=Ht.target.clientWidth+"px",_i.current.style.height=Ht.target.clientHeight+"px",_i.current.style.top=Ht.target.offsetTop+"px",_i.current.style.left=Ht.target.offsetLeft+"px",Xi.current.src=Ht.target.getAttribute("src")):_i.current.style.display="none"};return g.a.createElement("div",{style:{position:"relative"}},g.a.createElement("div",{ref:zi,style:Object(B.a)({},jt),className:"".concat(V||""," markdown-body ").concat(pr.a.mdBody),onMouseOver:br,dangerouslySetInnerHTML:{__html:Yi}}),g.a.createElement("div",{ref:_i,className:pr.a.button},g.a.createElement(Z.a,null,g.a.createElement(Q.a,{onClick:function(){return zr()}},"\u88C1\u526A"),g.a.createElement(Q.a,{onClick:function(){return Kr()}},"\u7F16\u8F91"))),g.a.createElement("img",{ref:Xi,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),g.a.createElement(oe.a,{close:!0,data:ji,type:ji!=null&&ji.length?kr:"",style:Object(B.a)({},Pi),onClose:function(){return or("")}}))}},"9VGf":function(gt,Ye,ne){"use strict";ne.d(Ye,"a",function(){return P});var ue=ne("q1tI"),Z=ne.n(ue);function P(Q,B){var F=Object(ue.useRef)();Object(ue.useEffect)(function(){F.current=Q}),Object(ue.useEffect)(function(){function K(){F.current()}if(B!==null){var G=setInterval(K,B);return function(){return clearInterval(G)}}},[B])}},BU3w:function(gt,Ye,ne){"use strict";ne.d(Ye,"a",function(){return F});var ue=ne("MNnm"),Z="rc-util-key";function P(K){if(K.attachTo)return K.attachTo;var G=document.querySelector("head");return G||document.body}function Q(K){var G,M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ue.a)())return null;var R=document.createElement("style");if((G=M.csp)===null||G===void 0?void 0:G.nonce){var g;R.nonce=(g=M.csp)===null||g===void 0?void 0:g.nonce}R.innerHTML=K;var p=P(M),f=p.firstChild;return M.prepend&&p.prepend?p.prepend(R):M.prepend&&f?p.insertBefore(R,f):p.appendChild(R),R}var B=new Map;function F(K,G){var M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},R=P(M);if(!B.has(R)){var g=Q("",M),p=g.parentNode;B.set(R,p),p.removeChild(g)}var f=Array.from(B.get(R).children).find(function(n){return n.tagName==="STYLE"&&n[Z]===G});if(f){var d,s;if(((d=M.csp)===null||d===void 0?void 0:d.nonce)&&f.nonce!==((s=M.csp)===null||s===void 0?void 0:s.nonce)){var c;f.nonce=(c=M.csp)===null||c===void 0?void 0:c.nonce}return f.innerHTML!==K&&(f.innerHTML=K),f}var l=Q(K,M);return l[Z]=G,l}},Bd2K:function(gt,Ye,ne){(function(ue){ue(ne("VrN/"),ne("osHv"))})(function(ue){ue.defineOption("autoCloseTags",!1,function(M,R,g){if(g!=ue.Init&&g&&M.removeKeyMap("autoCloseTags"),!R)return;var p={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(p["'/'"]=function(f){return F(f)}),(typeof R!="object"||R.whenOpening!==!1)&&(p["'>'"]=function(f){return Q(f)}),M.addKeyMap(p)});var Z=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],P=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function Q(M){if(M.getOption("disableInput"))return ue.Pass;for(var R=M.listSelections(),g=[],p=M.getOption("autoCloseTags"),f=0;f<R.length;f++){if(!R[f].empty())return ue.Pass;var d=R[f].head,s=M.getTokenAt(d),c=ue.innerMode(M.getMode(),s.state),l=c.state,n=c.mode.xmlCurrentTag&&c.mode.xmlCurrentTag(l),o=n&&n.name;if(!o)return ue.Pass;var h=c.mode.configuration=="html",L=typeof p=="object"&&p.dontCloseTags||h&&Z,S=typeof p=="object"&&p.indentTags||h&&P;s.end>d.ch&&(o=o.slice(0,o.length-s.end+d.ch));var x=o.toLowerCase();if(!o||s.type=="string"&&(s.end!=d.ch||!/[\"\']/.test(s.string.charAt(s.string.length-1))||s.string.length==1)||s.type=="tag"&&n.close||s.string.indexOf("/")==d.ch-s.start-1||L&&K(L,x)>-1||G(M,c.mode.xmlCurrentContext&&c.mode.xmlCurrentContext(l)||[],o,d,!0))return ue.Pass;var O=typeof p=="object"&&p.emptyTags;if(O&&K(O,o)>-1){g[f]={text:"/>",newPos:ue.Pos(d.line,d.ch+2)};continue}var C=S&&K(S,x)>-1;g[f]={indent:C,text:">"+(C?`
|
|
|
|
`:"")+"</"+o+">",newPos:C?ue.Pos(d.line+1,0):ue.Pos(d.line,d.ch+1)}}for(var w=typeof p=="object"&&p.dontIndentOnAutoClose,f=R.length-1;f>=0;f--){var T=g[f];M.replaceRange(T.text,R[f].head,R[f].anchor,"+insert");var _=M.listSelections().slice(0);_[f]={head:T.newPos,anchor:T.newPos},M.setSelections(_),!w&&T.indent&&(M.indentLine(T.newPos.line,null,!0),M.indentLine(T.newPos.line+1,null,!0))}}function B(M,R){for(var g=M.listSelections(),p=[],f=R?"/":"</",d=M.getOption("autoCloseTags"),s=typeof d=="object"&&d.dontIndentOnSlash,c=0;c<g.length;c++){if(!g[c].empty())return ue.Pass;var l=g[c].head,n=M.getTokenAt(l),o=ue.innerMode(M.getMode(),n.state),h=o.state;if(R&&(n.type=="string"||n.string.charAt(0)!="<"||n.start!=l.ch-1))return ue.Pass;var L,S=o.mode.name!="xml"&&M.getMode().name=="htmlmixed";if(S&&o.mode.name=="javascript")L=f+"script";else if(S&&o.mode.name=="css")L=f+"style";else{var x=o.mode.xmlCurrentContext&&o.mode.xmlCurrentContext(h);if(!x||x.length&&G(M,x,x[x.length-1],l))return ue.Pass;L=f+x[x.length-1]}M.getLine(l.line).charAt(n.end)!=">"&&(L+=">"),p[c]=L}if(M.replaceSelections(p),g=M.listSelections(),!s)for(var c=0;c<g.length;c++)(c==g.length-1||g[c].head.line<g[c+1].head.line)&&M.indentLine(g[c].head.line)}function F(M){return M.getOption("disableInput")?ue.Pass:B(M,!0)}ue.commands.closeTag=function(M){return B(M)};function K(M,R){if(M.indexOf)return M.indexOf(R);for(var g=0,p=M.length;g<p;++g)if(M[g]==R)return g;return-1}function G(M,R,g,p,f){if(!ue.scanForClosingTag)return!1;var d=Math.min(M.lastLine()+1,p.line+500),s=ue.scanForClosingTag(M,p,null,d);if(!s||s.tag!=g)return!1;for(var c=f?1:0,l=R.length-1;l>=0&&R[l]==g;l--)++c;p=s.to;for(var l=1;l<c;l++){var n=ue.scanForClosingTag(M,p,null,d);if(!n||n.tag!=g)return!1;p=n.to}return!0}})},BjJ7:function(gt,Ye,ne){"use strict";ne.d(Ye,"d",function(){return Z}),ne.d(Ye,"c",function(){return P}),ne.d(Ye,"e",function(){return Q}),ne.d(Ye,"b",function(){return B}),ne.d(Ye,"a",function(){return K});var ue=ne("m3rI");function Z(G){var M=!0;if(G.length>0){for(var R=0;R<G.length;R++)if(G[R].compile_success==0||!G[R].compile_success){M=!1;break}}else M=!1;return M}function P(G){for(var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",R=[],g=0;g<G.length;g++){var p=G[g],f=M?"".concat(M,"/").concat(p.name):"".concat(p.name);R.push({title:p.name,isLeaf:!(p.type==="tree"),key:f})}return R}function Q(G,M,R){for(var g=0;g<G.length;g++){var p=G[g];if(p.key===M){p.children=R;break}p.children&&Q(p.children,M,R)}return G}function B(G,M,R){var g;return function(){var p=this,f=arguments,d=function(){g=null,R||G.apply(p,f)},s=R&&!g;clearTimeout(g),g=setTimeout(d,M),s&&G.apply(p,f)}}var F=!0,K=ue.a.API_SERVER},"C+DQ":function(gt,Ye,ne){},CKgm:function(gt,Ye,ne){"use strict";ne.r(Ye);var ue=ne("+L6B"),Z=ne("2/Rp"),P=ne("5NDa"),Q=ne("5rEg"),B=ne("sPJy"),F=ne("bE4q"),K=ne("miYZ"),G=ne("tsqr"),M=ne("9og8"),R=ne("k1fw"),g=ne("y8nQ"),p=ne("Vl3Y"),f=ne("tJVT"),d=ne("PpiC"),s=ne("OaEy"),c=ne("2fM7"),l=ne("WmNS"),n=ne.n(l),o=ne("q1tI"),h=ne.n(o),L=ne("Ty5D"),S=ne("9kvl"),x=ne("55Ip"),O=ne("Ot1p"),C=ne("500L"),w=ne("h+Ho"),T=ne("7/Dv"),_=ne.n(T),u=c.a.Option,E=function(b){var N,D,H,j=b.forumsDetail,I=b.globalSetting,y=b.loading,W=b.dispatch,Y=Object(d.a)(b,["forumsDetail","globalSetting","loading","dispatch"]),ie=Object(L.i)(),oe=p.a.useForm(),we=Object(f.a)(oe,1),me=we[0],Se=Object(o.useState)({}),Ce=Object(f.a)(Se,2),xe=Ce[0],pe=Ce[1],le=Object(o.useState)(0),te=Object(f.a)(le,2),de=te[0],se=te[1],Oe=Object(o.useState)(!1),ke=Object(f.a)(Oe,2),Te=ke[0],Le=ke[1],Me=Object(o.useState)({}),je=Object(f.a)(Me,2),Fe=je[0],Ne=je[1],Ue=Object(o.useState)(1),Je=Object(f.a)(Ue,2),tt=Je[0],et=Je[1];Object(o.useEffect)(function(){if(Ze(),ie.memoId)Le(!0),dt();else{Le(!1);var Ie={forum_id:5};pe(Object(R.a)({},Ie)),me.setFieldsValue(Object(R.a)({},Ie))}},[ie.memoId]);var Ze=function(){var Ie=Object(M.a)(n.a.mark(function st(){var $e;return n.a.wrap(function(He){for(;;)switch(He.prev=He.next){case 0:return He.next=2,Object(w.f)({});case 2:$e=He.sent,Ne($e||{});case 4:case"end":return He.stop()}},st)}));return function(){return Ie.apply(this,arguments)}}(),dt=function(){var Ie=Object(M.a)(n.a.mark(function st(){var $e,De,He;return n.a.wrap(function(fe){for(;;)switch(fe.prev=fe.next){case 0:return fe.next=2,Object(w.e)({id:ie.memoId});case 2:if(fe.t0=fe.sent,fe.t0){fe.next=5;break}fe.t0={};case 5:De=fe.t0,He={subject:De.subject,content:De.content,attachments:Object(C.a)(De.attachments),forum_id:De.forum_id,memo_tags:($e=De.memo_tags)===null||$e===void 0?void 0:$e.map(function(_e){return _e.id})},pe(Object(R.a)({},He)),me.setFieldsValue(Object(R.a)({},He));case 9:case"end":return fe.stop()}},st)}));return function(){return Ie.apply(this,arguments)}}(),it=function(){var Ie=Object(M.a)(n.a.mark(function st($e){var De,He,Ee,fe;return n.a.wrap(function(re){for(;;)switch(re.prev=re.next){case 0:if(Ee=Object(R.a)(Object(R.a)({id:Te?ie.memoId:null},xe),{},{attachment_ids:(De=xe.attachments)===null||De===void 0||((He=De.filter(function(ae){var he;return(he=ae.response)===null||he===void 0?void 0:he.id}))===null||He===void 0)?void 0:He.map(function(ae){var he;return(he=ae.response)===null||he===void 0?void 0:he.id}),tags:xe.memo_tags}),!Te){re.next=7;break}return re.next=4,Object(w.n)(Ee);case 4:re.t0=re.sent,re.next=10;break;case 7:return re.next=9,Object(w.j)(Ee);case 9:re.t0=re.sent;case 10:fe=re.t0,se(0),(fe==null?void 0:fe.status)===0&&(G.b.success(fe==null?void 0:fe.message),tt===1?S.d.push("/forums/".concat(Te?ie==null?void 0:ie.memoId:fe==null?void 0:fe.memo_id)):S.d.push("/forums/".concat(Te?ie==null?void 0:ie.memoId:fe==null?void 0:fe.memo_id,"/edit")));case 13:case"end":return re.stop()}},st)}));return function($e){return Ie.apply(this,arguments)}}(),at=function(){document.body.scrollIntoView(),window.location.href.includes("new")?S.d.goBack():S.d.push("/forums/".concat(ie.memoId))};return h.a.createElement("section",{className:_.a.bg},h.a.createElement("section",{className:"animated fadeIn mb10"},h.a.createElement("aside",{className:"mt10"},h.a.createElement(F.a,{separator:"/"},h.a.createElement(F.a.Item,null,h.a.createElement(x.a,{to:"/forums"},"\u4EA4\u6D41\u95EE\u7B54")),h.a.createElement(F.a.Item,null,"\u8BE6\u60C5")))),h.a.createElement("aside",{className:"bg-white font16 pt20 pb20 pl20"},Te?"\u7F16\u8F91\u8BDD\u9898":"\u53D1\u5E03\u8BDD\u9898"),h.a.createElement(p.a,{form:me,className:_.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(st,$e){console.log($e,"values"),pe(Object(R.a)(Object(R.a)({},xe),st))},onFinish:it,onFinishFailed:function(){se(0)}},h.a.createElement("div",{className:_.a.fieldWrap},h.a.createElement(p.a.Item,{name:"subject",label:h.a.createElement("span",{className:"font16"},"\u8BDD\u9898\u540D\u79F0: "),rules:[{required:!0,message:"\u8BF7\u5148\u8F93\u5165\u8BDD\u9898\u540D\u79F0"}]},h.a.createElement(Q.a,{maxLength:50,suffix:"".concat(((N=xe.subject)===null||N===void 0?void 0:N.length)||0,"/50")}))),h.a.createElement("div",{className:_.a.mdWrap},h.a.createElement(p.a.Item,{name:"content",label:h.a.createElement("span",{className:"font16"},"\u5185\u5BB9: "),rules:[{required:!0,message:"\u8BF7\u5148\u8F93\u5165\u8BDD\u9898\u5185\u5BB9"}]},h.a.createElement(O.a,{height:600,id:"forums-new-content",watch:!0,defaultValue:xe.content})),h.a.createElement("div",null,h.a.createElement(p.a.Item,{name:"attachments",style:{width:350}},h.a.createElement(C.b,{showRemoveModal:!0})))),h.a.createElement("div",{className:_.a.mdWrap},h.a.createElement(p.a.Item,{name:"forum_id",label:h.a.createElement("span",{className:"font16"},"\u8BDD\u9898\u7C7B\u578B: "),rules:[{required:!0,message:"\u8BF7\u5148\u9009\u62E9\u8BDD\u9898\u7C7B\u578B"}]},h.a.createElement(c.a,{style:{width:300}},Fe==null||((D=Fe.forums)===null||D===void 0)?void 0:D.map(function(Ie){return h.a.createElement(u,{key:Ie.id,value:Ie.id},Ie.name)})))),xe.forum_id===5&&h.a.createElement("div",{className:_.a.mdWrap},h.a.createElement(p.a.Item,{name:"memo_tags",label:h.a.createElement("span",{className:"font16"},"\u6280\u672F\u6807\u7B7E: "),rules:[{required:!0,message:"\u8BF7\u5148\u9009\u62E9\u6280\u672F\u6807\u7B7E"}]},h.a.createElement(c.a,{style:{width:300},placeholder:"\u8BF7\u9009\u62E9\u6280\u672F\u6807\u7B7E",mode:"multiple",tokenSeparators:[";"],filterOption:function(st,$e){return $e.props.children.toLocaleLowerCase().indexOf(st.toLocaleLowerCase())!=-1}},Fe==null||((H=Fe.tag_list)===null||H===void 0)?void 0:H.map(function(Ie){return h.a.createElement(u,{key:Ie.id,value:Ie.id},Ie.name)})))),h.a.createElement("div",{className:_.a.backgroundFa},h.a.createElement("div",{className:"pt40 mb30"},h.a.createElement(p.a.Item,null,h.a.createElement(Z.a,{size:"large",type:"primary",className:"".concat(_.a.button," mr20"),htmlType:"submit",loading:de===1,onClick:function(){et(1),se(1)}},"\u63D0\u4EA4"),h.a.createElement(Z.a,{size:"large",type:"primary",className:"".concat(_.a.button," mr20"),htmlType:"submit",loading:de===2,onClick:function(){et(2),se(2)}},"\u4FDD\u5B58"),h.a.createElement(Z.a,{size:"large",type:"primary",ghost:!0,className:"".concat(_.a.button," mr20"),onClick:at},"\u53D6\u6D88"))))))};Ye.default=Object(S.a)(function(m){var b=m.forumsDetail,N=m.loading,D=m.globalSetting;return{forumsDetail:b,globalSetting:D,loading:N.models.forumsDetail}})(E)},DlQD:function(gt,Ye,ne){(function(ue,Z){gt.exports=Z()})(this,function(){"use strict";function ue(Ee,fe){for(var _e=0;_e<fe.length;_e++){var re=fe[_e];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(Ee,re.key,re)}}function Z(Ee,fe,_e){return fe&&ue(Ee.prototype,fe),_e&&ue(Ee,_e),Ee}function P(Ee,fe){if(!Ee)return;if(typeof Ee=="string")return Q(Ee,fe);var _e=Object.prototype.toString.call(Ee).slice(8,-1);if(_e==="Object"&&Ee.constructor&&(_e=Ee.constructor.name),_e==="Map"||_e==="Set")return Array.from(Ee);if(_e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(_e))return Q(Ee,fe)}function Q(Ee,fe){(fe==null||fe>Ee.length)&&(fe=Ee.length);for(var _e=0,re=new Array(fe);_e<fe;_e++)re[_e]=Ee[_e];return re}function B(Ee,fe){var _e;if(typeof Symbol=="undefined"||Ee[Symbol.iterator]==null){if(Array.isArray(Ee)||(_e=P(Ee))||fe&&Ee&&typeof Ee.length=="number"){_e&&(Ee=_e);var re=0;return function(){return re>=Ee.length?{done:!0}:{done:!1,value:Ee[re++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return _e=Ee[Symbol.iterator](),_e.next.bind(_e)}function F(Ee,fe){return fe={exports:{}},Ee(fe,fe.exports),fe.exports}var K=F(function(Ee){function fe(){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 _e(re){Ee.exports.defaults=re}Ee.exports={defaults:fe(),getDefaults:fe,changeDefaults:_e}}),G=K.defaults,M=K.getDefaults,R=K.changeDefaults,g=/[&<>"']/,p=/[&<>"']/g,f=/[<>"']|&(?!#?\w+;)/,d=/[<>"']|&(?!#?\w+;)/g,s={"&":"&","<":"<",">":">",'"':""","'":"'"},c=function(fe){return s[fe]};function l(Ee,fe){if(fe){if(g.test(Ee))return Ee.replace(p,c)}else if(f.test(Ee))return Ee.replace(d,c);return Ee}var n=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function o(Ee){return Ee.replace(n,function(fe,_e){return _e=_e.toLowerCase(),_e==="colon"?":":_e.charAt(0)==="#"?_e.charAt(1)==="x"?String.fromCharCode(parseInt(_e.substring(2),16)):String.fromCharCode(+_e.substring(1)):""})}var h=/(^|[^\[])\^/g;function L(Ee,fe){Ee=Ee.source||Ee,fe=fe||"";var _e={replace:function(ae,he){return he=he.source||he,he=he.replace(h,"$1"),Ee=Ee.replace(ae,he),_e},getRegex:function(){return new RegExp(Ee,fe)}};return _e}var S=/[^\w:]/g,x=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(Ee,fe,_e){if(Ee){var re;try{re=decodeURIComponent(o(_e)).replace(S,"").toLowerCase()}catch(ae){return null}if(re.indexOf("javascript:")===0||re.indexOf("vbscript:")===0||re.indexOf("data:")===0)return null}fe&&!x.test(_e)&&(_e=u(fe,_e));try{_e=encodeURI(_e).replace(/%25/g,"%")}catch(ae){return null}return _e}var C={},w=/^[^:]+:\/*[^/]*$/,T=/^([^:]+:)[\s\S]*$/,_=/^([^:]+:\/*[^/]*)[\s\S]*$/;function u(Ee,fe){C[" "+Ee]||(w.test(Ee)?C[" "+Ee]=Ee+"/":C[" "+Ee]=N(Ee,"/",!0)),Ee=C[" "+Ee];var _e=Ee.indexOf(":")===-1;return fe.substring(0,2)==="//"?_e?fe:Ee.replace(T,"$1")+fe:fe.charAt(0)==="/"?_e?fe:Ee.replace(_,"$1")+fe:Ee+fe}var E={exec:function(){}};function m(Ee){for(var fe=1,_e,re;fe<arguments.length;fe++){_e=arguments[fe];for(re in _e)Object.prototype.hasOwnProperty.call(_e,re)&&(Ee[re]=_e[re])}return Ee}function b(Ee,fe){var _e=Ee.replace(/\|/g,function(he,ve,be){for(var Pe=!1,Ge=ve;--Ge>=0&&be[Ge]==="\\";)Pe=!Pe;return Pe?"|":" |"}),re=_e.split(/ \|/),ae=0;if(re.length>fe)re.splice(fe);else for(;re.length<fe;)re.push("");for(;ae<re.length;ae++)re[ae]=re[ae].trim().replace(/\\\|/g,"|");return re}function N(Ee,fe,_e){var re=Ee.length;if(re===0)return"";for(var ae=0;ae<re;){var he=Ee.charAt(re-ae-1);if(he===fe&&!_e)ae++;else if(he!==fe&&_e)ae++;else break}return Ee.substr(0,re-ae)}function D(Ee,fe){if(Ee.indexOf(fe[1])===-1)return-1;for(var _e=Ee.length,re=0,ae=0;ae<_e;ae++)if(Ee[ae]==="\\")ae++;else if(Ee[ae]===fe[0])re++;else if(Ee[ae]===fe[1]&&(re--,re<0))return ae;return-1}function H(Ee){Ee&&Ee.sanitize&&!Ee.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var j={escape:l,unescape:o,edit:L,cleanUrl:O,resolveUrl:u,noopTest:E,merge:m,splitCells:b,rtrim:N,findClosingBracket:D,checkSanitizeDeprecation:H},I=K.defaults,y=j.rtrim,W=j.splitCells,Y=j.escape,ie=j.findClosingBracket;function oe(Ee,fe,_e){var re=fe.href,ae=fe.title?Y(fe.title):null,he=Ee[1].replace(/\\([\[\]])/g,"$1");return Ee[0].charAt(0)!=="!"?{type:"link",raw:_e,href:re,title:ae,text:he}:{type:"image",raw:_e,href:re,title:ae,text:Y(he)}}function we(Ee,fe){var _e=Ee.match(/^(\s+)(?:```)/);if(_e===null)return fe;var re=_e[1];return fe.split(`
|
|
`).map(function(ae){var he=ae.match(/^\s+/);if(he===null)return ae;var ve=he[0];return ve.length>=re.length?ae.slice(re.length):ae}).join(`
|
|
`)}var me=function(){function Ee(_e){this.options=_e||I}var fe=Ee.prototype;return fe.space=function(re){var ae=this.rules.block.newline.exec(re);if(ae)return ae[0].length>1?{type:"space",raw:ae[0]}:{raw:`
|
|
`}},fe.code=function(re,ae){var he=this.rules.block.code.exec(re);if(he){var ve=ae[ae.length-1];if(ve&&ve.type==="paragraph")return{raw:he[0],text:he[0].trimRight()};var be=he[0].replace(/^ {4}/gm,"");return{type:"code",raw:he[0],codeBlockStyle:"indented",text:this.options.pedantic?be:y(be,`
|
|
`)}}},fe.fences=function(re){var ae=this.rules.block.fences.exec(re);if(ae){var he=ae[0],ve=we(he,ae[3]||"");return{type:"code",raw:he,lang:ae[2]?ae[2].trim():ae[2],text:ve}}},fe.heading=function(re){var ae=this.rules.block.heading.exec(re);if(ae)return{type:"heading",raw:ae[0],depth:ae[1].length,text:ae[2]}},fe.nptable=function(re){var ae=this.rules.block.nptable.exec(re);if(ae){var he={type:"table",header:W(ae[1].replace(/^ *| *\| *$/g,"")),align:ae[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ae[3]?ae[3].replace(/\n$/,"").split(`
|
|
`):[],raw:ae[0]};if(he.header.length===he.align.length){var ve=he.align.length,be;for(be=0;be<ve;be++)/^ *-+: *$/.test(he.align[be])?he.align[be]="right":/^ *:-+: *$/.test(he.align[be])?he.align[be]="center":/^ *:-+ *$/.test(he.align[be])?he.align[be]="left":he.align[be]=null;for(ve=he.cells.length,be=0;be<ve;be++)he.cells[be]=W(he.cells[be],he.header.length);return he}}},fe.hr=function(re){var ae=this.rules.block.hr.exec(re);if(ae)return{type:"hr",raw:ae[0]}},fe.blockquote=function(re){var ae=this.rules.block.blockquote.exec(re);if(ae){var he=ae[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ae[0],text:he}}},fe.list=function(re){var ae=this.rules.block.list.exec(re);if(ae){for(var he=ae[0],ve=ae[2],be=ve.length>1,Pe=ve[ve.length-1]===")",Ge={type:"list",raw:he,ordered:be,start:be?+ve.slice(0,-1):"",loose:!1,items:[]},ot=ae[0].match(this.rules.block.item),ct=!1,ft,Ct,xt,ut,Ut,Mt,Zt,Yt=ot.length,Rt=0;Rt<Yt;Rt++)ft=ot[Rt],he=ft,Ct=ft.length,ft=ft.replace(/^ *([*+-]|\d+[.)]) */,""),~ft.indexOf(`
|
|
`)&&(Ct-=ft.length,ft=this.options.pedantic?ft.replace(/^ {1,4}/gm,""):ft.replace(new RegExp("^ {1,"+Ct+"}","gm"),"")),Rt!==Yt-1&&(xt=this.rules.block.bullet.exec(ot[Rt+1])[0],(be?xt.length===1||!Pe&&xt[xt.length-1]===")":xt.length>1||this.options.smartLists&&xt!==ve)&&(ut=ot.slice(Rt+1).join(`
|
|
`),Ge.raw=Ge.raw.substring(0,Ge.raw.length-ut.length),Rt=Yt-1)),Ut=ct||/\n\n(?!\s*$)/.test(ft),Rt!==Yt-1&&(ct=ft.charAt(ft.length-1)===`
|
|
`,Ut||(Ut=ct)),Ut&&(Ge.loose=!0),Mt=/^\[[ xX]\] /.test(ft),Zt=void 0,Mt&&(Zt=ft[1]!==" ",ft=ft.replace(/^\[[ xX]\] +/,"")),Ge.items.push({type:"list_item",raw:he,task:Mt,checked:Zt,loose:Ut,text:ft});return Ge}},fe.html=function(re){var ae=this.rules.block.html.exec(re);if(ae)return{type:this.options.sanitize?"paragraph":"html",raw:ae[0],pre:!this.options.sanitizer&&(ae[1]==="pre"||ae[1]==="script"||ae[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ae[0]):Y(ae[0]):ae[0]}},fe.def=function(re){var ae=this.rules.block.def.exec(re);if(ae){ae[3]&&(ae[3]=ae[3].substring(1,ae[3].length-1));var he=ae[1].toLowerCase().replace(/\s+/g," ");return{tag:he,raw:ae[0],href:ae[2],title:ae[3]}}},fe.table=function(re){var ae=this.rules.block.table.exec(re);if(ae){var he={type:"table",header:W(ae[1].replace(/^ *| *\| *$/g,"")),align:ae[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ae[3]?ae[3].replace(/\n$/,"").split(`
|
|
`):[]};if(he.header.length===he.align.length){he.raw=ae[0];var ve=he.align.length,be;for(be=0;be<ve;be++)/^ *-+: *$/.test(he.align[be])?he.align[be]="right":/^ *:-+: *$/.test(he.align[be])?he.align[be]="center":/^ *:-+ *$/.test(he.align[be])?he.align[be]="left":he.align[be]=null;for(ve=he.cells.length,be=0;be<ve;be++)he.cells[be]=W(he.cells[be].replace(/^ *\| *| *\| *$/g,""),he.header.length);return he}}},fe.lheading=function(re){var ae=this.rules.block.lheading.exec(re);if(ae)return{type:"heading",raw:ae[0],depth:ae[2].charAt(0)==="="?1:2,text:ae[1]}},fe.paragraph=function(re){var ae=this.rules.block.paragraph.exec(re);if(ae)return{type:"paragraph",raw:ae[0],text:ae[1].charAt(ae[1].length-1)===`
|
|
`?ae[1].slice(0,-1):ae[1]}},fe.text=function(re,ae){var he=this.rules.block.text.exec(re);if(he){var ve=ae[ae.length-1];return ve&&ve.type==="text"?{raw:he[0],text:he[0]}:{type:"text",raw:he[0],text:he[0]}}},fe.escape=function(re){var ae=this.rules.inline.escape.exec(re);if(ae)return{type:"escape",raw:ae[0],text:Y(ae[1])}},fe.tag=function(re,ae,he){var ve=this.rules.inline.tag.exec(re);if(ve)return!ae&&/^<a /i.test(ve[0])?ae=!0:ae&&/^<\/a>/i.test(ve[0])&&(ae=!1),!he&&/^<(pre|code|kbd|script)(\s|>)/i.test(ve[0])?he=!0:he&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ve[0])&&(he=!1),{type:this.options.sanitize?"text":"html",raw:ve[0],inLink:ae,inRawBlock:he,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ve[0]):Y(ve[0]):ve[0]}},fe.link=function(re){var ae=this.rules.inline.link.exec(re);if(ae){var he=ie(ae[2],"()");if(he>-1){var ve=ae[0].indexOf("!")===0?5:4,be=ve+ae[1].length+he;ae[2]=ae[2].substring(0,he),ae[0]=ae[0].substring(0,be).trim(),ae[3]=""}var Pe=ae[2],Ge="";if(this.options.pedantic){var ot=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Pe);ot?(Pe=ot[1],Ge=ot[3]):Ge=""}else Ge=ae[3]?ae[3].slice(1,-1):"";Pe=Pe.trim().replace(/^<([\s\S]*)>$/,"$1");var ct=oe(ae,{href:Pe&&Pe.replace(this.rules.inline._escapes,"$1"),title:Ge&&Ge.replace(this.rules.inline._escapes,"$1")},ae[0]);return ct}},fe.reflink=function(re,ae){var he;if((he=this.rules.inline.reflink.exec(re))||(he=this.rules.inline.nolink.exec(re))){var ve=(he[2]||he[1]).replace(/\s+/g," ");if(ve=ae[ve.toLowerCase()],!ve||!ve.href){var be=he[0].charAt(0);return{type:"text",raw:be,text:be}}var Pe=oe(he,ve,he[0]);return Pe}},fe.strong=function(re,ae,he){he===void 0&&(he="");var ve=this.rules.inline.strong.start.exec(re);if(ve&&(!ve[1]||ve[1]&&(he===""||this.rules.inline.punctuation.exec(he)))){ae=ae.slice(-1*re.length);var be=ve[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;be.lastIndex=0;for(var Pe;(ve=be.exec(ae))!=null;)if(Pe=this.rules.inline.strong.middle.exec(ae.slice(0,ve.index+3)),Pe)return{type:"strong",raw:re.slice(0,Pe[0].length),text:re.slice(2,Pe[0].length-2)}}},fe.em=function(re,ae,he){he===void 0&&(he="");var ve=this.rules.inline.em.start.exec(re);if(ve&&(!ve[1]||ve[1]&&(he===""||this.rules.inline.punctuation.exec(he)))){ae=ae.slice(-1*re.length);var be=ve[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;be.lastIndex=0;for(var Pe;(ve=be.exec(ae))!=null;)if(Pe=this.rules.inline.em.middle.exec(ae.slice(0,ve.index+2)),Pe)return{type:"em",raw:re.slice(0,Pe[0].length),text:re.slice(1,Pe[0].length-1)}}},fe.codespan=function(re){var ae=this.rules.inline.code.exec(re);if(ae){var he=ae[2].replace(/\n/g," "),ve=/[^ ]/.test(he),be=he.startsWith(" ")&&he.endsWith(" ");return ve&&be&&(he=he.substring(1,he.length-1)),he=Y(he,!0),{type:"codespan",raw:ae[0],text:he}}},fe.br=function(re){var ae=this.rules.inline.br.exec(re);if(ae)return{type:"br",raw:ae[0]}},fe.del=function(re){var ae=this.rules.inline.del.exec(re);if(ae)return{type:"del",raw:ae[0],text:ae[1]}},fe.autolink=function(re,ae){var he=this.rules.inline.autolink.exec(re);if(he){var ve,be;return he[2]==="@"?(ve=Y(this.options.mangle?ae(he[1]):he[1]),be="mailto:"+ve):(ve=Y(he[1]),be=ve),{type:"link",raw:he[0],text:ve,href:be,tokens:[{type:"text",raw:ve,text:ve}]}}},fe.url=function(re,ae){var he;if(he=this.rules.inline.url.exec(re)){var ve,be;if(he[2]==="@")ve=Y(this.options.mangle?ae(he[0]):he[0]),be="mailto:"+ve;else{var Pe;do Pe=he[0],he[0]=this.rules.inline._backpedal.exec(he[0])[0];while(Pe!==he[0]);ve=Y(he[0]),he[1]==="www."?be="http://"+ve:be=ve}return{type:"link",raw:he[0],text:ve,href:be,tokens:[{type:"text",raw:ve,text:ve}]}}},fe.inlineText=function(re,ae,he){var ve=this.rules.inline.text.exec(re);if(ve){var be;return ae?be=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ve[0]):Y(ve[0]):ve[0]:be=Y(this.options.smartypants?he(ve[0]):ve[0]),{type:"text",raw:ve[0],text:be}}},Ee}(),Se=j.noopTest,Ce=j.edit,xe=j.merge,pe={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:Se,table:Se,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};pe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,pe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,pe.def=Ce(pe.def).replace("label",pe._label).replace("title",pe._title).getRegex(),pe.bullet=/(?:[*+-]|\d{1,9}[.)])/,pe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,pe.item=Ce(pe.item,"gm").replace(/bull/g,pe.bullet).getRegex(),pe.list=Ce(pe.list).replace(/bull/g,pe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+pe.def.source+")").getRegex(),pe._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",pe._comment=/<!--(?!-?>)[\s\S]*?-->/,pe.html=Ce(pe.html,"i").replace("comment",pe._comment).replace("tag",pe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),pe.paragraph=Ce(pe._paragraph).replace("hr",pe.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",pe._tag).getRegex(),pe.blockquote=Ce(pe.blockquote).replace("paragraph",pe.paragraph).getRegex(),pe.normal=xe({},pe),pe.gfm=xe({},pe.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),pe.gfm.nptable=Ce(pe.gfm.nptable).replace("hr",pe.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",pe._tag).getRegex(),pe.gfm.table=Ce(pe.gfm.table).replace("hr",pe.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",pe._tag).getRegex(),pe.pedantic=xe({},pe.normal,{html:Ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",pe._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:Se,paragraph:Ce(pe.normal._paragraph).replace("hr",pe.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",pe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var le={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Se,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:Se,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};le._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",le.punctuation=Ce(le.punctuation).replace(/punctuation/g,le._punctuation).getRegex(),le._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",le._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",le.em.start=Ce(le.em.start).replace(/punctuation/g,le._punctuation).getRegex(),le.em.middle=Ce(le.em.middle).replace(/punctuation/g,le._punctuation).replace(/overlapSkip/g,le._overlapSkip).getRegex(),le.em.endAst=Ce(le.em.endAst,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.em.endUnd=Ce(le.em.endUnd,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.strong.start=Ce(le.strong.start).replace(/punctuation/g,le._punctuation).getRegex(),le.strong.middle=Ce(le.strong.middle).replace(/punctuation/g,le._punctuation).replace(/blockSkip/g,le._blockSkip).getRegex(),le.strong.endAst=Ce(le.strong.endAst,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.strong.endUnd=Ce(le.strong.endUnd,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.blockSkip=Ce(le._blockSkip,"g").getRegex(),le.overlapSkip=Ce(le._overlapSkip,"g").getRegex(),le._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,le._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,le._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])?)+(?![-_])/,le.autolink=Ce(le.autolink).replace("scheme",le._scheme).replace("email",le._email).getRegex(),le._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,le.tag=Ce(le.tag).replace("comment",pe._comment).replace("attribute",le._attribute).getRegex(),le._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,le._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,le._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,le.link=Ce(le.link).replace("label",le._label).replace("href",le._href).replace("title",le._title).getRegex(),le.reflink=Ce(le.reflink).replace("label",le._label).getRegex(),le.reflinkSearch=Ce(le.reflinkSearch,"g").replace("reflink",le.reflink).replace("nolink",le.nolink).getRegex(),le.normal=xe({},le),le.pedantic=xe({},le.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Ce(/^!?\[(label)\]\((.*?)\)/).replace("label",le._label).getRegex(),reflink:Ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",le._label).getRegex()}),le.gfm=xe({},le.normal,{escape:Ce(le.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),le.gfm.url=Ce(le.gfm.url,"i").replace("email",le.gfm._extended_email).getRegex(),le.breaks=xe({},le.gfm,{br:Ce(le.br).replace("{2,}","*").getRegex(),text:Ce(le.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var te={block:pe,inline:le},de=K.defaults,se=te.block,Oe=te.inline;function ke(Ee){return Ee.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function Te(Ee){var fe="",_e,re,ae=Ee.length;for(_e=0;_e<ae;_e++)re=Ee.charCodeAt(_e),Math.random()>.5&&(re="x"+re.toString(16)),fe+="&#"+re+";";return fe}var Le=function(){function Ee(_e){this.tokens=[],this.tokens.links=Object.create(null),this.options=_e||de,this.options.tokenizer=this.options.tokenizer||new me,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var re={block:se.normal,inline:Oe.normal};this.options.pedantic?(re.block=se.pedantic,re.inline=Oe.pedantic):this.options.gfm&&(re.block=se.gfm,this.options.breaks?re.inline=Oe.breaks:re.inline=Oe.gfm),this.tokenizer.rules=re}Ee.lex=function(re,ae){var he=new Ee(ae);return he.lex(re)};var fe=Ee.prototype;return fe.lex=function(re){return re=re.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(re,this.tokens,!0),this.inline(this.tokens),this.tokens},fe.blockTokens=function(re,ae,he){ae===void 0&&(ae=[]),he===void 0&&(he=!0),re=re.replace(/^ +$/gm,"");for(var ve,be,Pe,Ge;re;){if(ve=this.tokenizer.space(re)){re=re.substring(ve.raw.length),ve.type&&ae.push(ve);continue}if(ve=this.tokenizer.code(re,ae)){re=re.substring(ve.raw.length),ve.type?ae.push(ve):(Ge=ae[ae.length-1],Ge.raw+=`
|
|
`+ve.raw,Ge.text+=`
|
|
`+ve.text);continue}if(ve=this.tokenizer.fences(re)){re=re.substring(ve.raw.length),ae.push(ve);continue}if(ve=this.tokenizer.heading(re)){re=re.substring(ve.raw.length),ae.push(ve);continue}if(ve=this.tokenizer.nptable(re)){re=re.substring(ve.raw.length),ae.push(ve);continue}if(ve=this.tokenizer.hr(re)){re=re.substring(ve.raw.length),ae.push(ve);continue}if(ve=this.tokenizer.blockquote(re)){re=re.substring(ve.raw.length),ve.tokens=this.blockTokens(ve.text,[],he),ae.push(ve);continue}if(ve=this.tokenizer.list(re)){for(re=re.substring(ve.raw.length),Pe=ve.items.length,be=0;be<Pe;be++)ve.items[be].tokens=this.blockTokens(ve.items[be].text,[],!1);ae.push(ve);continue}if(ve=this.tokenizer.html(re)){re=re.substring(ve.raw.length),ae.push(ve);continue}if(he&&(ve=this.tokenizer.def(re))){re=re.substring(ve.raw.length),this.tokens.links[ve.tag]||(this.tokens.links[ve.tag]={href:ve.href,title:ve.title});continue}if(ve=this.tokenizer.table(re)){re=re.substring(ve.raw.length),ae.push(ve);continue}if(ve=this.tokenizer.lheading(re)){re=re.substring(ve.raw.length),ae.push(ve);continue}if(he&&(ve=this.tokenizer.paragraph(re))){re=re.substring(ve.raw.length),ae.push(ve);continue}if(ve=this.tokenizer.text(re,ae)){re=re.substring(ve.raw.length),ve.type?ae.push(ve):(Ge=ae[ae.length-1],Ge.raw+=`
|
|
`+ve.raw,Ge.text+=`
|
|
`+ve.text);continue}if(re){var ot="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(ot);break}else throw new Error(ot)}}return ae},fe.inline=function(re){var ae,he,ve,be,Pe,Ge,ot=re.length;for(ae=0;ae<ot;ae++){Ge=re[ae];switch(Ge.type){case"paragraph":case"text":case"heading":{Ge.tokens=[],this.inlineTokens(Ge.text,Ge.tokens);break}case"table":{for(Ge.tokens={header:[],cells:[]},be=Ge.header.length,he=0;he<be;he++)Ge.tokens.header[he]=[],this.inlineTokens(Ge.header[he],Ge.tokens.header[he]);for(be=Ge.cells.length,he=0;he<be;he++)for(Pe=Ge.cells[he],Ge.tokens.cells[he]=[],ve=0;ve<Pe.length;ve++)Ge.tokens.cells[he][ve]=[],this.inlineTokens(Pe[ve],Ge.tokens.cells[he][ve]);break}case"blockquote":{this.inline(Ge.tokens);break}case"list":{for(be=Ge.items.length,he=0;he<be;he++)this.inline(Ge.items[he].tokens);break}}}return re},fe.inlineTokens=function(re,ae,he,ve,be){ae===void 0&&(ae=[]),he===void 0&&(he=!1),ve===void 0&&(ve=!1),be===void 0&&(be="");var Pe,Ge=re,ot;if(this.tokens.links){var ct=Object.keys(this.tokens.links);if(ct.length>0)for(;(ot=this.tokenizer.rules.inline.reflinkSearch.exec(Ge))!=null;)ct.includes(ot[0].slice(ot[0].lastIndexOf("[")+1,-1))&&(Ge=Ge.slice(0,ot.index)+"["+"a".repeat(ot[0].length-2)+"]"+Ge.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(ot=this.tokenizer.rules.inline.blockSkip.exec(Ge))!=null;)Ge=Ge.slice(0,ot.index)+"["+"a".repeat(ot[0].length-2)+"]"+Ge.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;re;){if(Pe=this.tokenizer.escape(re)){re=re.substring(Pe.raw.length),ae.push(Pe);continue}if(Pe=this.tokenizer.tag(re,he,ve)){re=re.substring(Pe.raw.length),he=Pe.inLink,ve=Pe.inRawBlock,ae.push(Pe);continue}if(Pe=this.tokenizer.link(re)){re=re.substring(Pe.raw.length),Pe.type==="link"&&(Pe.tokens=this.inlineTokens(Pe.text,[],!0,ve)),ae.push(Pe);continue}if(Pe=this.tokenizer.reflink(re,this.tokens.links)){re=re.substring(Pe.raw.length),Pe.type==="link"&&(Pe.tokens=this.inlineTokens(Pe.text,[],!0,ve)),ae.push(Pe);continue}if(Pe=this.tokenizer.strong(re,Ge,be)){re=re.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],he,ve),ae.push(Pe);continue}if(Pe=this.tokenizer.em(re,Ge,be)){re=re.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],he,ve),ae.push(Pe);continue}if(Pe=this.tokenizer.codespan(re)){re=re.substring(Pe.raw.length),ae.push(Pe);continue}if(Pe=this.tokenizer.br(re)){re=re.substring(Pe.raw.length),ae.push(Pe);continue}if(Pe=this.tokenizer.del(re)){re=re.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],he,ve),ae.push(Pe);continue}if(Pe=this.tokenizer.autolink(re,Te)){re=re.substring(Pe.raw.length),ae.push(Pe);continue}if(!he&&(Pe=this.tokenizer.url(re,Te))){re=re.substring(Pe.raw.length),ae.push(Pe);continue}if(Pe=this.tokenizer.inlineText(re,ve,ke)){re=re.substring(Pe.raw.length),be=Pe.raw.slice(-1),ae.push(Pe);continue}if(re){var ft="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(ft);break}else throw new Error(ft)}}return ae},Z(Ee,null,[{key:"rules",get:function(){return{block:se,inline:Oe}}}]),Ee}(),Me=K.defaults,je=j.cleanUrl,Fe=j.escape,Ne=function(){function Ee(_e){this.options=_e||Me}var fe=Ee.prototype;return fe.code=function(re,ae,he){var ve=(ae||"").match(/\S*/)[0];if(this.options.highlight){var be=this.options.highlight(re,ve);be!=null&&be!==re&&(he=!0,re=be)}return ve?'<pre><code class="'+this.options.langPrefix+Fe(ve,!0)+'">'+(he?re:Fe(re,!0))+`</code></pre>
|
|
`:"<pre><code>"+(he?re:Fe(re,!0))+`</code></pre>
|
|
`},fe.blockquote=function(re){return`<blockquote>
|
|
`+re+`</blockquote>
|
|
`},fe.html=function(re){return re},fe.heading=function(re,ae,he,ve){return this.options.headerIds?"<h"+ae+' id="'+this.options.headerPrefix+ve.slug(he)+'">'+re+"</h"+ae+`>
|
|
`:"<h"+ae+">"+re+"</h"+ae+`>
|
|
`},fe.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},fe.list=function(re,ae,he){var ve=ae?"ol":"ul",be=ae&&he!==1?' start="'+he+'"':"";return"<"+ve+be+`>
|
|
`+re+"</"+ve+`>
|
|
`},fe.listitem=function(re){return"<li>"+re+`</li>
|
|
`},fe.checkbox=function(re){return"<input "+(re?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},fe.paragraph=function(re){return"<p>"+re+`</p>
|
|
`},fe.table=function(re,ae){return ae&&(ae="<tbody>"+ae+"</tbody>"),`<table>
|
|
<thead>
|
|
`+re+`</thead>
|
|
`+ae+`</table>
|
|
`},fe.tablerow=function(re){return`<tr>
|
|
`+re+`</tr>
|
|
`},fe.tablecell=function(re,ae){var he=ae.header?"th":"td",ve=ae.align?"<"+he+' align="'+ae.align+'">':"<"+he+">";return ve+re+"</"+he+`>
|
|
`},fe.strong=function(re){return"<strong>"+re+"</strong>"},fe.em=function(re){return"<em>"+re+"</em>"},fe.codespan=function(re){return"<code>"+re+"</code>"},fe.br=function(){return this.options.xhtml?"<br/>":"<br>"},fe.del=function(re){return"<del>"+re+"</del>"},fe.link=function(re,ae,he){if(re=je(this.options.sanitize,this.options.baseUrl,re),re===null)return he;var ve='<a href="'+Fe(re)+'"';return ae&&(ve+=' title="'+ae+'"'),ve+=">"+he+"</a>",ve},fe.image=function(re,ae,he){if(re=je(this.options.sanitize,this.options.baseUrl,re),re===null)return he;var ve='<img src="'+re+'" alt="'+he+'"';return ae&&(ve+=' title="'+ae+'"'),ve+=this.options.xhtml?"/>":">",ve},fe.text=function(re){return re},Ee}(),Ue=function(){function Ee(){}var fe=Ee.prototype;return fe.strong=function(re){return re},fe.em=function(re){return re},fe.codespan=function(re){return re},fe.del=function(re){return re},fe.html=function(re){return re},fe.text=function(re){return re},fe.link=function(re,ae,he){return""+he},fe.image=function(re,ae,he){return""+he},fe.br=function(){return""},Ee}(),Je=function(){function Ee(){this.seen={}}var fe=Ee.prototype;return fe.slug=function(re){var ae=re.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ae)){var he=ae;do this.seen[he]++,ae=he+"-"+this.seen[he];while(this.seen.hasOwnProperty(ae))}return this.seen[ae]=0,ae},Ee}(),tt=K.defaults,et=j.unescape,Ze=function(){function Ee(_e){this.options=_e||tt,this.options.renderer=this.options.renderer||new Ne,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ue,this.slugger=new Je}Ee.parse=function(re,ae){var he=new Ee(ae);return he.parse(re)};var fe=Ee.prototype;return fe.parse=function(re,ae){ae===void 0&&(ae=!0);var he="",ve,be,Pe,Ge,ot,ct,ft,Ct,xt,ut,Ut,Mt,Zt,Yt,Rt,Ti,Ui,Qe,wt=re.length;for(ve=0;ve<wt;ve++){ut=re[ve];switch(ut.type){case"space":continue;case"hr":{he+=this.renderer.hr();continue}case"heading":{he+=this.renderer.heading(this.parseInline(ut.tokens),ut.depth,et(this.parseInline(ut.tokens,this.textRenderer)),this.slugger);continue}case"code":{he+=this.renderer.code(ut.text,ut.lang,ut.escaped);continue}case"table":{for(Ct="",ft="",Ge=ut.header.length,be=0;be<Ge;be++)ft+=this.renderer.tablecell(this.parseInline(ut.tokens.header[be]),{header:!0,align:ut.align[be]});for(Ct+=this.renderer.tablerow(ft),xt="",Ge=ut.cells.length,be=0;be<Ge;be++){for(ct=ut.tokens.cells[be],ft="",ot=ct.length,Pe=0;Pe<ot;Pe++)ft+=this.renderer.tablecell(this.parseInline(ct[Pe]),{header:!1,align:ut.align[Pe]});xt+=this.renderer.tablerow(ft)}he+=this.renderer.table(Ct,xt);continue}case"blockquote":{xt=this.parse(ut.tokens),he+=this.renderer.blockquote(xt);continue}case"list":{for(Ut=ut.ordered,Mt=ut.start,Zt=ut.loose,Ge=ut.items.length,xt="",be=0;be<Ge;be++)Rt=ut.items[be],Ti=Rt.checked,Ui=Rt.task,Yt="",Rt.task&&(Qe=this.renderer.checkbox(Ti),Zt?Rt.tokens.length>0&&Rt.tokens[0].type==="text"?(Rt.tokens[0].text=Qe+" "+Rt.tokens[0].text,Rt.tokens[0].tokens&&Rt.tokens[0].tokens.length>0&&Rt.tokens[0].tokens[0].type==="text"&&(Rt.tokens[0].tokens[0].text=Qe+" "+Rt.tokens[0].tokens[0].text)):Rt.tokens.unshift({type:"text",text:Qe}):Yt+=Qe),Yt+=this.parse(Rt.tokens,Zt),xt+=this.renderer.listitem(Yt,Ui,Ti);he+=this.renderer.list(xt,Ut,Mt);continue}case"html":{he+=this.renderer.html(ut.text);continue}case"paragraph":{he+=this.renderer.paragraph(this.parseInline(ut.tokens));continue}case"text":{for(xt=ut.tokens?this.parseInline(ut.tokens):ut.text;ve+1<wt&&re[ve+1].type==="text";)ut=re[++ve],xt+=`
|
|
`+(ut.tokens?this.parseInline(ut.tokens):ut.text);he+=ae?this.renderer.paragraph(xt):xt;continue}default:{var Ot='Token with "'+ut.type+'" type was not found.';if(this.options.silent){console.error(Ot);return}else throw new Error(Ot)}}}return he},fe.parseInline=function(re,ae){ae=ae||this.renderer;var he="",ve,be,Pe=re.length;for(ve=0;ve<Pe;ve++){be=re[ve];switch(be.type){case"escape":{he+=ae.text(be.text);break}case"html":{he+=ae.html(be.text);break}case"link":{he+=ae.link(be.href,be.title,this.parseInline(be.tokens,ae));break}case"image":{he+=ae.image(be.href,be.title,be.text);break}case"strong":{he+=ae.strong(this.parseInline(be.tokens,ae));break}case"em":{he+=ae.em(this.parseInline(be.tokens,ae));break}case"codespan":{he+=ae.codespan(be.text);break}case"br":{he+=ae.br();break}case"del":{he+=ae.del(this.parseInline(be.tokens,ae));break}case"text":{he+=ae.text(be.text);break}default:{var Ge='Token with "'+be.type+'" type was not found.';if(this.options.silent){console.error(Ge);return}else throw new Error(Ge)}}}return he},Ee}(),dt=j.merge,it=j.checkSanitizeDeprecation,at=j.escape,Ie=K.getDefaults,st=K.changeDefaults,$e=K.defaults;function De(Ee,fe,_e){if(typeof Ee=="undefined"||Ee===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Ee!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Ee)+", string expected");if(typeof fe=="function"&&(_e=fe,fe=null),fe=dt({},De.defaults,fe||{}),it(fe),_e){var re=fe.highlight,ae;try{ae=Le.lex(Ee,fe)}catch(Pe){return _e(Pe)}var he=function(Ge){var ot;if(!Ge)try{ot=Ze.parse(ae,fe)}catch(ct){Ge=ct}return fe.highlight=re,Ge?_e(Ge):_e(null,ot)};if(!re||re.length<3)return he();if(delete fe.highlight,!ae.length)return he();var ve=0;De.walkTokens(ae,function(Pe){Pe.type==="code"&&(ve++,setTimeout(function(){re(Pe.text,Pe.lang,function(Ge,ot){if(Ge)return he(Ge);ot!=null&&ot!==Pe.text&&(Pe.text=ot,Pe.escaped=!0),ve--,ve===0&&he()})},0))}),ve===0&&he();return}try{var be=Le.lex(Ee,fe);return fe.walkTokens&&De.walkTokens(be,fe.walkTokens),Ze.parse(be,fe)}catch(Pe){if(Pe.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,fe.silent)return"<p>An error occurred:</p><pre>"+at(Pe.message+"",!0)+"</pre>";throw Pe}}De.options=De.setOptions=function(Ee){return dt(De.defaults,Ee),st(De.defaults),De},De.getDefaults=Ie,De.defaults=$e,De.use=function(Ee){var fe=dt({},Ee);if(Ee.renderer&&function(){var re=De.defaults.renderer||new Ne,ae=function(be){var Pe=re[be];re[be]=function(){for(var Ge=arguments.length,ot=new Array(Ge),ct=0;ct<Ge;ct++)ot[ct]=arguments[ct];var ft=Ee.renderer[be].apply(re,ot);return ft===!1&&(ft=Pe.apply(re,ot)),ft}};for(var he in Ee.renderer)ae(he);fe.renderer=re}(),Ee.tokenizer&&function(){var re=De.defaults.tokenizer||new me,ae=function(be){var Pe=re[be];re[be]=function(){for(var Ge=arguments.length,ot=new Array(Ge),ct=0;ct<Ge;ct++)ot[ct]=arguments[ct];var ft=Ee.tokenizer[be].apply(re,ot);return ft===!1&&(ft=Pe.apply(re,ot)),ft}};for(var he in Ee.tokenizer)ae(he);fe.tokenizer=re}(),Ee.walkTokens){var _e=De.defaults.walkTokens;fe.walkTokens=function(re){Ee.walkTokens(re),_e&&_e(re)}}De.setOptions(fe)},De.walkTokens=function(Ee,fe){for(var _e=B(Ee),re;!(re=_e()).done;){var ae=re.value;fe(ae);switch(ae.type){case"table":{for(var he=B(ae.tokens.header),ve;!(ve=he()).done;){var be=ve.value;De.walkTokens(be,fe)}for(var Pe=B(ae.tokens.cells),Ge;!(Ge=Pe()).done;)for(var ot=Ge.value,ct=B(ot),ft;!(ft=ct()).done;){var Ct=ft.value;De.walkTokens(Ct,fe)}break}case"list":{De.walkTokens(ae.items,fe);break}default:ae.tokens&&De.walkTokens(ae.tokens,fe)}}},De.Parser=Ze,De.parser=Ze.parse,De.Renderer=Ne,De.TextRenderer=Ue,De.Lexer=Le,De.lexer=Le.lex,De.Tokenizer=me,De.Slugger=Je,De.parse=De;var He=De;return He})},ELLl:function(gt,Ye,ne){(function(ue){ue(ne("VrN/"))})(function(ue){var Z={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},P=ue.Pos;ue.defineOption("autoCloseBrackets",!1,function(s,c,l){l&&l!=ue.Init&&(s.removeKeyMap(B),s.state.closeBrackets=null),c&&(F(Q(c,"pairs")),s.state.closeBrackets=c,s.addKeyMap(B))});function Q(s,c){return c=="pairs"&&typeof s=="string"?s:typeof s=="object"&&s[c]!=null?s[c]:Z[c]}var B={Backspace:M,Enter:R};function F(s){for(var c=0;c<s.length;c++){var l=s.charAt(c),n="'"+l+"'";B[n]||(B[n]=K(l))}}F(Z.pairs+"`");function K(s){return function(c){return p(c,s)}}function G(s){var c=s.state.closeBrackets;if(!c||c.override)return c;var l=s.getModeAt(s.getCursor());return l.closeBrackets||c}function M(s){var c=G(s);if(!c||s.getOption("disableInput"))return ue.Pass;for(var l=Q(c,"pairs"),n=s.listSelections(),o=0;o<n.length;o++){if(!n[o].empty())return ue.Pass;var h=f(s,n[o].head);if(!h||l.indexOf(h)%2!=0)return ue.Pass}for(var o=n.length-1;o>=0;o--){var L=n[o].head;s.replaceRange("",P(L.line,L.ch-1),P(L.line,L.ch+1),"+delete")}}function R(s){var c=G(s),l=c&&Q(c,"explode");if(!l||s.getOption("disableInput"))return ue.Pass;for(var n=s.listSelections(),o=0;o<n.length;o++){if(!n[o].empty())return ue.Pass;var h=f(s,n[o].head);if(!h||l.indexOf(h)%2!=0)return ue.Pass}s.operation(function(){var L=s.lineSeparator()||`
|
|
`;s.replaceSelection(L+L,null),s.execCommand("goCharLeft"),n=s.listSelections();for(var S=0;S<n.length;S++){var x=n[S].head.line;s.indentLine(x,null,!0),s.indentLine(x+1,null,!0)}})}function g(s){var c=ue.cmpPos(s.anchor,s.head)>0;return{anchor:new P(s.anchor.line,s.anchor.ch+(c?-1:1)),head:new P(s.head.line,s.head.ch+(c?1:-1))}}function p(s,c){var l=G(s);if(!l||s.getOption("disableInput"))return ue.Pass;var n=Q(l,"pairs"),o=n.indexOf(c);if(o==-1)return ue.Pass;for(var h=Q(l,"closeBefore"),L=Q(l,"triples"),S=n.charAt(o+1)==c,x=s.listSelections(),O=o%2==0,C,w=0;w<x.length;w++){var T=x[w],_=T.head,u,E=s.getRange(_,P(_.line,_.ch+1));if(O&&!T.empty())u="surround";else if((S||!O)&&E==c)S&&d(s,_)?u="both":L.indexOf(c)>=0&&s.getRange(_,P(_.line,_.ch+3))==c+c+c?u="skipThree":u="skip";else if(S&&_.ch>1&&L.indexOf(c)>=0&&s.getRange(P(_.line,_.ch-2),_)==c+c){if(_.ch>2&&/\bstring/.test(s.getTokenTypeAt(P(_.line,_.ch-2))))return ue.Pass;u="addFour"}else if(S){var m=_.ch==0?" ":s.getRange(P(_.line,_.ch-1),_);if(!ue.isWordChar(E)&&m!=c&&!ue.isWordChar(m))u="both";else return ue.Pass}else if(O&&(E.length===0||/\s/.test(E)||h.indexOf(E)>-1))u="both";else return ue.Pass;if(!C)C=u;else if(C!=u)return ue.Pass}var b=o%2?n.charAt(o-1):c,N=o%2?c:n.charAt(o+1);s.operation(function(){if(C=="skip")s.execCommand("goCharRight");else if(C=="skipThree")for(var D=0;D<3;D++)s.execCommand("goCharRight");else if(C=="surround"){for(var H=s.getSelections(),D=0;D<H.length;D++)H[D]=b+H[D]+N;s.replaceSelections(H,"around"),H=s.listSelections().slice();for(var D=0;D<H.length;D++)H[D]=g(H[D]);s.setSelections(H)}else C=="both"?(s.replaceSelection(b+N,null),s.triggerElectric(b+N),s.execCommand("goCharLeft")):C=="addFour"&&(s.replaceSelection(b+b+b+b,"before"),s.execCommand("goCharRight"))})}function f(s,c){var l=s.getRange(P(c.line,c.ch-1),P(c.line,c.ch+1));return l.length==2?l:null}function d(s,c){var l=s.getTokenAt(P(c.line,c.ch+1));return/\bstring/.test(l.type)&&l.start==c.ch&&(c.ch==0||!/\bstring/.test(s.getTokenTypeAt(c)))}})},GfqC:function(gt,Ye,ne){"use strict";var ue=ne("q1tI"),Z=ne.n(ue),P=ne("TSYQ"),Q=ne.n(P);function B(j,I){var y="cannot "+j.method+" "+j.action+" "+I.status+"'",W=new Error(y);return W.status=I.status,W.method=j.method,W.url=j.action,W}function F(j){var I=j.responseText||j.response;if(!I)return I;try{return JSON.parse(I)}catch(y){return I}}function K(j){var I=new XMLHttpRequest;j.onProgress&&I.upload&&(I.upload.onprogress=function(ie){ie.total>0&&(ie.percent=ie.loaded/ie.total*100),j.onProgress(ie)});var y=new FormData;j.data&&Object.keys(j.data).forEach(function(Y){var ie=j.data[Y];if(Array.isArray(ie)){ie.forEach(function(oe){y.append(Y+"[]",oe)});return}y.append(Y,j.data[Y])}),j.file instanceof Blob?y.append(j.filename,j.file,j.file.name):y.append(j.filename,j.file),I.onerror=function(ie){j.onError(ie)},I.onload=function(){return I.status<200||I.status>=300?j.onError(B(j,I),F(I)):j.onSuccess(F(I),I)},I.open(j.method,j.action,!0),j.withCredentials&&"withCredentials"in I&&(I.withCredentials=!0);var W=j.headers||{};return W["X-Requested-With"]!==null&&I.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(W).forEach(function(Y){W[Y]!==null&&I.setRequestHeader(Y,W[Y])}),I.send(y),{abort:function(){I.abort()}}}var G=+new Date,M=0;function R(){return"rc-upload-"+G+"-"+ ++M}function g(j,I){return j.indexOf(I,j.length-I.length)!==-1}var p=function(j,I){if(j&&I){var y=Array.isArray(I)?I:I.split(","),W=j.name||"",Y=j.type||"",ie=Y.replace(/\/.*$/,"");return y.some(function(oe){var we=oe.trim();return we.charAt(0)==="."?g(W.toLowerCase(),we.toLowerCase()):/\/\*$/.test(we)?ie===we.replace(/\/.*$/,""):Y===we})}return!0};function f(j,I){var y=j.createReader(),W=[];function Y(){y.readEntries(function(ie){var oe=Array.prototype.slice.apply(ie);W=W.concat(oe);var we=!oe.length;we?I(W):Y()})}Y()}var d=function(I,y,W){var Y=function ie(oe,we){we=we||"",oe.isFile?oe.file(function(me){W(me)&&(oe.fullPath&&!me.webkitRelativePath&&(Object.defineProperties(me,{webkitRelativePath:{writable:!0}}),me.webkitRelativePath=oe.fullPath.replace(/^\//,""),Object.defineProperties(me,{webkitRelativePath:{writable:!1}})),y([me]))}):oe.isDirectory&&f(oe,function(me){me.forEach(function(Se){ie(Se,""+we+oe.name+"/")})})};I.forEach(function(ie){Y(ie.webkitGetAsEntry())})},s=d,c=Object.assign||function(j){for(var I=1;I<arguments.length;I++){var y=arguments[I];for(var W in y)Object.prototype.hasOwnProperty.call(y,W)&&(j[W]=y[W])}return j},l=function(){function j(I,y){var W=[],Y=!0,ie=!1,oe=void 0;try{for(var we=I[Symbol.iterator](),me;!(Y=(me=we.next()).done)&&!(W.push(me.value),y&&W.length===y);Y=!0);}catch(Se){ie=!0,oe=Se}finally{try{!Y&&we.return&&we.return()}finally{if(ie)throw oe}}return W}return function(I,y){if(Array.isArray(I))return I;if(Symbol.iterator in Object(I))return j(I,y);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),n=function(){function j(I,y){for(var W=0;W<y.length;W++){var Y=y[W];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(I,Y.key,Y)}}return function(I,y,W){return y&&j(I.prototype,y),W&&j(I,W),I}}();function o(j,I,y){return I in j?Object.defineProperty(j,I,{value:y,enumerable:!0,configurable:!0,writable:!0}):j[I]=y,j}function h(j,I){var y={};for(var W in j){if(I.indexOf(W)>=0)continue;if(!Object.prototype.hasOwnProperty.call(j,W))continue;y[W]=j[W]}return y}function L(j,I){if(!(j instanceof I))throw new TypeError("Cannot call a class as a function")}function S(j,I){if(!j)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:j}function x(j,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);j.prototype=Object.create(I&&I.prototype,{constructor:{value:j,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(j,I):j.__proto__=I)}var O=function(I){return Object.keys(I).reduce(function(y,W){return(W.substr(0,5)==="data-"||W.substr(0,5)==="aria-"||W==="role")&&(y[W]=I[W]),y},{})},C=function(j){x(I,j);function I(){var y,W,Y,ie;L(this,I);for(var oe=arguments.length,we=Array(oe),me=0;me<oe;me++)we[me]=arguments[me];return ie=(W=(Y=S(this,(y=I.__proto__||Object.getPrototypeOf(I)).call.apply(y,[this].concat(we))),Y),Y.state={uid:R()},Y.reqs={},Y.onChange=function(Se){var Ce=Se.target.files;Y.uploadFiles(Ce),Y.reset()},Y.onClick=function(Se){var Ce=Y.fileInput;if(!Ce)return;var xe=Y.props,pe=xe.children,le=xe.onClick;pe&&pe.type==="button"&&(Ce.parentNode.focus(),Ce.parentNode.querySelector("button").blur()),Ce.click(),le&&le(Se)},Y.onKeyDown=function(Se){Se.key==="Enter"&&Y.onClick()},Y.onFileDrop=function(Se){var Ce=Y.props.multiple;if(Se.preventDefault(),Se.type==="dragover")return;if(Y.props.directory)s(Array.prototype.slice.call(Se.dataTransfer.items),Y.uploadFiles,function(pe){return p(pe,Y.props.accept)});else{var xe=Array.prototype.slice.call(Se.dataTransfer.files).filter(function(pe){return p(pe,Y.props.accept)});Ce===!1&&(xe=xe.slice(0,1)),Y.uploadFiles(xe)}},Y.uploadFiles=function(Se){var Ce=Array.prototype.slice.call(Se);Ce.map(function(xe){return xe.uid=R(),xe}).forEach(function(xe){Y.upload(xe,Ce)})},Y.saveFileInput=function(Se){Y.fileInput=Se},W),S(Y,ie)}return n(I,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(W,Y){var ie=this,oe=this.props;if(!oe.beforeUpload)return setTimeout(function(){return ie.post(W)},0);var we=oe.beforeUpload(W,Y);we&&we.then?we.then(function(me){var Se=Object.prototype.toString.call(me);return Se==="[object File]"||Se==="[object Blob]"?ie.post(me):ie.post(W)}).catch(function(me){console.log(me)}):we!==!1&&setTimeout(function(){return ie.post(W)},0);return}},{key:"post",value:function(W){var Y=this;if(!this._isMounted)return;var ie=this.props,oe=ie.onStart,we=ie.onProgress,me=ie.transformFile,Se=me===void 0?function(Ce){return Ce}:me;new Promise(function(Ce){var xe=ie.action;return typeof xe=="function"&&(xe=xe(W)),Ce(xe)}).then(function(Ce){var xe=W.uid,pe=ie.customRequest||K,le=Promise.resolve(Se(W)).then(function(te){var de=ie.data;return typeof de=="function"&&(de=de(te)),Promise.all([te,de])}).catch(function(te){console.error(te)});le.then(function(te){var de=l(te,2),se=de[0],Oe=de[1],ke={action:Ce,filename:ie.name,data:Oe,file:se,headers:ie.headers,withCredentials:ie.withCredentials,method:ie.method||"post",onProgress:we?function(Te){we(Te,W)}:null,onSuccess:function(Le,Me){delete Y.reqs[xe],ie.onSuccess(Le,W,Me)},onError:function(Le,Me){delete Y.reqs[xe],ie.onError(Le,Me,W)}};oe(W),Y.reqs[xe]=pe(ke)})})}},{key:"reset",value:function(){this.setState({uid:R()})}},{key:"abort",value:function(W){var Y=this.reqs;if(W){var ie=W;W&&W.uid&&(ie=W.uid),Y[ie]&&Y[ie].abort&&Y[ie].abort(),delete Y[ie]}else Object.keys(Y).forEach(function(oe){Y[oe]&&Y[oe].abort&&Y[oe].abort(),delete Y[oe]})}},{key:"render",value:function(){var W,Y=this.props,ie=Y.component,oe=Y.prefixCls,we=Y.className,me=Y.disabled,Se=Y.id,Ce=Y.style,xe=Y.multiple,pe=Y.accept,le=Y.children,te=Y.directory,de=Y.openFileDialogOnClick,se=Y.onMouseEnter,Oe=Y.onMouseLeave,ke=h(Y,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),Te=Q()((W={},o(W,oe,!0),o(W,oe+"-disabled",me),o(W,we,we),W)),Le=me?{}:{onClick:de?this.onClick:function(){},onKeyDown:de?this.onKeyDown:function(){},onMouseEnter:se,onMouseLeave:Oe,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return Z.a.createElement(ie,c({},Le,{className:Te,role:"button",style:Ce}),Z.a.createElement("input",c({},O(ke),{id:Se,type:"file",ref:this.saveFileInput,onClick:function(je){return je.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:pe,directory:te?"directory":null,webkitdirectory:te?"webkitdirectory":null,multiple:xe,onChange:this.onChange})),le)}}]),I}(ue.Component),w=C,T=Object.assign||function(j){for(var I=1;I<arguments.length;I++){var y=arguments[I];for(var W in y)Object.prototype.hasOwnProperty.call(y,W)&&(j[W]=y[W])}return j},_=function(){function j(I,y){for(var W=0;W<y.length;W++){var Y=y[W];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(I,Y.key,Y)}}return function(I,y,W){return y&&j(I.prototype,y),W&&j(I,W),I}}();function u(j,I){if(!(j instanceof I))throw new TypeError("Cannot call a class as a function")}function E(j,I){if(!j)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:j}function m(j,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);j.prototype=Object.create(I&&I.prototype,{constructor:{value:j,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(j,I):j.__proto__=I)}function b(){}var N=function(j){m(I,j);function I(){var y,W,Y,ie;u(this,I);for(var oe=arguments.length,we=Array(oe),me=0;me<oe;me++)we[me]=arguments[me];return ie=(W=(Y=E(this,(y=I.__proto__||Object.getPrototypeOf(I)).call.apply(y,[this].concat(we))),Y),Y.saveUploader=function(Se){Y.uploader=Se},W),E(Y,ie)}return _(I,[{key:"abort",value:function(W){this.uploader.abort(W)}},{key:"render",value:function(){return Z.a.createElement(w,T({},this.props,{ref:this.saveUploader}))}}]),I}(ue.Component);N.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:b,onError:b,onSuccess:b,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var D=N,H=Ye.a=D},HmJG:function(gt,Ye,ne){},LdHM:function(gt,Ye,ne){"use strict";ne.d(Ye,"b",function(){return h}),ne.d(Ye,"a",function(){return S});var ue=ne("1OyB"),Z=ne("vuIU"),P=ne("Ji7U"),Q=ne("LK+K"),B=ne("q1tI"),F=ne("rePB"),K=ne("Ff2n"),G=ne("ODXe"),M=ne("4IlW"),R=ne("bX4T"),g=ne("YrtM"),p=ne("TSYQ"),f=ne.n(p),d=ne("+nKL"),s=ne("8OUc"),c=function(W,Y){var ie=W.prefixCls,oe=W.id,we=W.flattenOptions,me=W.childrenAsData,Se=W.values,Ce=W.searchValue,xe=W.multiple,pe=W.defaultActiveFirstOption,le=W.height,te=W.itemHeight,de=W.notFoundContent,se=W.open,Oe=W.menuItemSelectedIcon,ke=W.virtual,Te=W.onSelect,Le=W.onToggleOpen,Me=W.onActiveValue,je=W.onScroll,Fe=W.onMouseEnter,Ne="".concat(ie,"-item"),Ue=Object(g.a)(function(){return we},[se,we],function(He,Ee){return Ee[0]&&He[1]!==Ee[1]}),Je=B.useRef(null),tt=function(Ee){Ee.preventDefault()},et=function(Ee){Je.current&&Je.current.scrollTo({index:Ee})},Ze=function(Ee){for(var fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,_e=Ue.length,re=0;re<_e;re+=1){var ae=(Ee+re*fe+_e)%_e,he=Ue[ae],ve=he.group,be=he.data;if(!ve&&!be.disabled)return ae}return-1},dt=B.useState(function(){return Ze(0)}),it=Object(G.a)(dt,2),at=it[0],Ie=it[1],st=function(Ee){Ie(Ee);var fe=Ue[Ee];if(!fe){Me(null,-1);return}Me(fe.data.value,Ee)};B.useEffect(function(){st(pe!==!1?Ze(0):-1)},[Ue.length,Ce]),B.useEffect(function(){var He=setTimeout(function(){if(!xe&&se&&Se.size===1){var Ee=Array.from(Se)[0],fe=Ue.findIndex(function(_e){var re=_e.data;return re.value===Ee});st(fe),et(fe)}});return function(){return clearTimeout(He)}},[se]);var $e=function(Ee){Ee!==void 0&&Te(Ee,{selected:!Se.has(Ee)}),xe||Le(!1)};if(B.useImperativeHandle(Y,function(){return{onKeyDown:function(Ee){var fe=Ee.which;switch(fe){case M.a.UP:case M.a.DOWN:{var _e=0;if(fe===M.a.UP?_e=-1:fe===M.a.DOWN&&(_e=1),_e!==0){var re=Ze(at+_e,_e);et(re),st(re)}break}case M.a.ENTER:{var ae=Ue[at];ae&&!ae.data.disabled?$e(ae.data.value):$e(void 0),se&&Ee.preventDefault();break}case M.a.ESC:Le(!1)}},onKeyUp:function(){},scrollTo:function(Ee){et(Ee)}}}),Ue.length===0)return B.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),className:"".concat(Ne,"-empty"),onMouseDown:tt},de);function De(He){var Ee=Ue[He];if(!Ee)return null;var fe=Ee.data||{},_e=fe.value,re=fe.label,ae=fe.children,he=Object(R.a)(fe,!0),ve=me?ae:re;return Ee?B.createElement("div",Object.assign({"aria-label":typeof ve=="string"?ve:null},he,{key:He,role:"option",id:"".concat(oe,"_list_").concat(He),"aria-selected":Se.has(_e)}),_e):null}return B.createElement(B.Fragment,null,B.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),style:{height:0,width:0,overflow:"hidden"}},De(at-1),De(at),De(at+1)),B.createElement(d.a,{itemKey:"key",ref:Je,data:Ue,height:le,itemHeight:te,fullHeight:!1,onMouseDown:tt,onScroll:je,virtual:ke,onMouseEnter:Fe},function(He,Ee){var fe,_e=He.group,re=He.groupOption,ae=He.data,he=ae.label,ve=ae.key;if(_e)return B.createElement("div",{className:f()(Ne,"".concat(Ne,"-group"))},he!==void 0?he:ve);var be=ae.disabled,Pe=ae.value,Ge=ae.title,ot=ae.children,ct=ae.style,ft=ae.className,Ct=Object(K.a)(ae,["disabled","value","title","children","style","className"]),xt=Se.has(Pe),ut="".concat(Ne,"-option"),Ut=f()(Ne,ut,ft,(fe={},Object(F.a)(fe,"".concat(ut,"-grouped"),re),Object(F.a)(fe,"".concat(ut,"-active"),at===Ee&&!be),Object(F.a)(fe,"".concat(ut,"-disabled"),be),Object(F.a)(fe,"".concat(ut,"-selected"),xt),fe)),Mt=me?ot:he,Zt=!Oe||typeof Oe=="function"||xt;return B.createElement("div",Object.assign({},Ct,{"aria-selected":xt,className:Ut,title:Ge,onMouseMove:function(){if(at===Ee||be)return;st(Ee)},onClick:function(){be||$e(Pe)},style:ct}),B.createElement("div",{className:"".concat(ut,"-content")},Mt||Pe),B.isValidElement(Oe)||xt,Zt&&B.createElement(s.a,{className:"".concat(Ne,"-option-state"),customizeIcon:Oe,customizeIconProps:{isSelected:xt}},xt?"\u2713":null))}))},l=B.forwardRef(c);l.displayName="OptionList";var n=l,o=function(){return null};o.isSelectOption=!0;var h=o,L=function(){return null};L.isSelectOptGroup=!0;var S=L,x=ne("VTBJ"),O=ne("Zm9Q");function C(y){var W=y.key,Y=y.props,ie=Y.children,oe=Y.value,we=Object(K.a)(Y,["children","value"]);return Object(x.a)({key:W,value:oe!==void 0?oe:W,children:ie},we)}function w(y){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(O.a)(y).map(function(Y,ie){if(!B.isValidElement(Y)||!Y.type)return null;var oe=Y.type.isSelectOptGroup,we=Y.key,me=Y.props,Se=me.children,Ce=Object(K.a)(me,["children"]);return W||!oe?C(Y):Object(x.a)(Object(x.a)({key:"__RC_SELECT_GRP__".concat(we===null?ie:we,"__"),label:we},Ce),{},{options:w(Se)})}).filter(function(Y){return Y})}var T=ne("2Qr1"),_=ne("qNPg"),u=ne("U8pU"),E=ne("Kwbf"),m=ne("WKfj");function b(y){var W=y.mode,Y=y.options,ie=y.children,oe=y.backfill,we=y.allowClear,me=y.placeholder,Se=y.getInputElement,Ce=y.showSearch,xe=y.onSearch,pe=y.defaultOpen,le=y.autoFocus,te=y.labelInValue,de=y.value,se=y.inputValue,Oe=y.optionLabelProp,ke=W==="multiple"||W==="tags",Te=Ce!==void 0?Ce:ke||W==="combobox",Le=Y||w(ie);if(Object(E.a)(W!=="tags"||Le.every(function(Ne){return!Ne.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),W==="tags"||W==="combobox"){var Me=Le.some(function(Ne){return Ne.options?Ne.options.some(function(Ue){return typeof("value"in Ue?Ue.value:Ue.key)=="number"}):typeof("value"in Ne?Ne.value:Ne.key)=="number"});Object(E.a)(!Me,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(E.a)(W!=="combobox"||!Oe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(E.a)(W==="combobox"||!oe,"`backfill` only works with `combobox` mode."),Object(E.a)(W==="combobox"||!Se,"`getInputElement` only work with `combobox` mode."),Object(E.b)(W!=="combobox"||!Se||!we||!me,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),xe&&!Te&&W!=="combobox"&&W!=="tags"&&Object(E.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(E.b)(!pe||le,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),de!=null){var je=Object(m.d)(de);Object(E.a)(!te||je.every(function(Ne){return Object(u.a)(Ne)==="object"&&("key"in Ne||"value"in Ne)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(E.a)(!ke||Array.isArray(de),"`value` should be array when `mode` is `multiple` or `tags`")}if(ie){var Fe=null;Object(O.a)(ie).some(function(Ne){if(!B.isValidElement(Ne)||!Ne.type)return!1;var Ue=Ne.type;if(Ue.isSelectOption)return!1;if(Ue.isSelectOptGroup){var Je=Object(O.a)(Ne.props.children).every(function(tt){return!B.isValidElement(tt)||!Ne.type||tt.type.isSelectOption?!0:(Fe=tt.type,!1)});return!Je}return Fe=Ue,!0}),Fe&&Object(E.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Fe.displayName||Fe.name||Fe,"`.")),Object(E.a)(se===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var N=b,D=Object(_.a)({prefixCls:"rc-select",components:{optionList:n},convertChildrenToData:w,flattenOptions:T.d,getLabeledValue:T.e,filterOptions:T.b,isValueDisabled:T.g,findValueOption:T.c,warningProps:N,fillOptionsWithMissingValue:T.a}),H=function(y){Object(P.a)(Y,y);var W=Object(Q.a)(Y);function Y(){var ie;return Object(ue.a)(this,Y),ie=W.apply(this,arguments),ie.selectRef=B.createRef(),ie.focus=function(){ie.selectRef.current.focus()},ie.blur=function(){ie.selectRef.current.blur()},ie}return Object(Z.a)(Y,[{key:"render",value:function(){return B.createElement(D,Object.assign({ref:this.selectRef},this.props))}}]),Y}(B.Component);H.Option=h,H.OptGroup=S;var j=H,I=Ye.c=j},M8RZ:function(gt,Ye,ne){"use strict";ne.d(Ye,"a",function(){return M});var ue=ne("fWQN"),Z=ne("mtLc"),P=ne("yKVA"),Q=ne("879j"),B=ne("q1tI"),F=ne.n(B),K=ne("i8i4"),G=ne.n(K),M=function(R){Object(P.a)(p,R);var g=Object(Q.a)(p);function p(f){var d;Object(ue.a)(this,p),d=g.call(this,f);var s=window.document;return d.node=s.createElement("div"),s.body.appendChild(d.node),d}return Object(Z.a)(p,[{key:"render",value:function(){var d=this.props.children;return Object(K.createPortal)(d,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),p}(F.a.Component)},Ot1p:function(gt,Ye,ne){"use strict";var ue=ne("2qtc"),Z=ne("kLXV"),P=ne("rAM+"),Q=ne("miYZ"),B=ne("tsqr"),F=ne("9og8"),K=ne("tJVT"),G=ne("jrin"),M=ne("WmNS"),R=ne.n(M),g=ne("q1tI"),p=ne.n(g),f=ne("VrN/"),d=ne.n(f),s=ne("bdgK"),c=ne("p77/"),l=ne("Bd2K"),n=ne("ELLl"),o=ne("19Vz"),h=ne("lZu9"),L=ne("+NIl"),S=ne("kSUc"),x=ne("9Bee"),O=function(be){var Pe=be.value,Ge=Pe===void 0?"":Pe,ot=be.className,ct=be.showTextOnly,ft=be.showLines,Ct=be.style,xt=Ct===void 0?{}:Ct,ut=Object(g.useMemo)(function(){return""},[Ge]);return p.a.createElement(p.a.Fragment,null,p.a.createElement("div",{dangerouslySetInnerHTML:{__html:ut}}))},C=ne("0Owb"),w=ne("dejd"),T=ne("C+DQ"),_=ne("1vsH"),u=ne("m3rI"),E=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function m(be){var Pe=be.onActionCallback,Ge=be.title,ot=be.icon,ct=be.actionName,ft=be.className,Ct=ft===void 0?"":ft,xt=be.children;function ut(){Pe(ct)}return p.a.createElement("a",{title:Ge,className:Ct,onClick:ut},p.a.createElement("i",{className:"md-iconfont ".concat(ot)}),xt)}var b=function(be){var Pe=be.watch,Ge=be.showNullButton,ot=be.onActionCallback,ct=be.fullScreen,ft=be.insertTemp,Ct=be.hidetoolBar,xt=be.uuid,ut=be.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(_.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(_.F)("_educoder_session"),"&key=").concat(xt,"&api=").concat(encodeURIComponent(u.a.PROXY_SERVER)));var Ut=[].concat(E,[{title:"".concat(Pe?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Pe?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return p.a.createElement("ul",{className:"markdown-toolbar-container"},!Ct&&Ut.map(function(Mt,Zt){return p.a.createElement("li",{key:Zt},Mt.actionName?p.a.createElement(m,Object(C.a)({},Mt,{onActionCallback:ot})):p.a.createElement("span",{className:"v-line"}))}),Ge?p.a.createElement("li",null,p.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:ot},p.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,ft&&p.a.createElement("li",null,p.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(ft),onActionCallback:ot},p.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),p.a.createElement("li",{className:"btn-full-screen"},p.a.createElement(m,{icon:"".concat(ct?"icon-shrink":"icon-enlarge"),title:ct?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:ot})))},N=ne("M8RZ"),D=ne("+L6B"),H=ne("2/Rp"),j=ne("y8nQ"),I=ne("Vl3Y"),y=ne("5NDa"),W=ne("5rEg"),Y={labelCol:{span:4},wrapperCol:{span:20}},ie=function(be){var Pe=be.callback,Ge=be.onCancel;function ot(ct){Pe(ct)}return p.a.createElement(I.a,Object(C.a)({},Y,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:ot}),p.a.createElement(I.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},p.a.createElement(W.a,null)),p.a.createElement(I.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},p.a.createElement(W.a,null)),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(H.a,{type:"ghost",onClick:Ge},"\u53D6\u6D88")))},oe=ne("7ahc"),we=ne("HmJG"),me=ne("BjJ7"),Se=I.a.useForm,Ce={width:280,marginRight:10},xe={labelCol:{span:5},wrapperCol:{span:19}},pe=function(be){var Pe=be.callback,Ge=be.onCancel,ot=Se(),ct=Object(K.a)(ot,1),ft=ct[0];function Ct(Ut){Pe(Ut)}function xt(Ut,Mt){if(Ut.status===-1){B.b.error(Ut.message);return}ft.setFieldsValue({src:"/api/attachments/".concat(Ut.id),type:Mt.type})}function ut(Ut){var Mt=Ut.target.files[0];te(Mt,xt)}return p.a.createElement(I.a,Object(C.a)({form:ft},xe,{className:"upload-image-panel",onFinish:Ct}),p.a.createElement(I.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},p.a.createElement("div",{className:"flex-container"},p.a.createElement(I.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},p.a.createElement(W.a,{style:Ce})),p.a.createElement(le,{onFileChange:ut}))),p.a.createElement(I.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},p.a.createElement(W.a,{style:{width:264}})),p.a.createElement(I.a.Item,{style:{textAlign:"right"}},p.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(H.a,{type:"ghost",onClick:Ge},"\u53D6\u6D88")))};function le(be){var Pe=be.onFileChange;return p.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",p.a.createElement("input",{type:"file",onChange:Pe}))}function te(be,Pe){if(!be)throw new String("\u6CA1\u6709\u6587\u4EF6");var Ge=new FormData;Ge.append("editormd-image-file",be),Ge.append("file_param_name","editormd-image-file"),Ge.append("byxhr","true");var ot=new window.XMLHttpRequest;ot.withCredentials=!0,ot.addEventListener("load",function(ct){Pe(JSON.parse(ct.target.responseText),be)},!1),ot.addEventListener("error",function(ct){console.error(ct)},!1),ot.open("POST","".concat(me.a,"/api/attachments.json")),ot.send(Ge)}var de=ne("giR+"),se=ne("fyUT"),Oe=ne("7Kak"),ke=ne("9yH6"),Te=ke.a.Group,Le={margin:"0 8px"},Me=function(be){var Pe=be.callback,Ge=be.onCancel;function ot(ct){Pe(ct)}return p.a.createElement(I.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:ot},p.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},p.a.createElement("span",{style:Le},"\u5355\u5143\u683C\u6570\uFF1A"),p.a.createElement("span",{style:Le},"\u884C\u6570"),p.a.createElement(I.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},p.a.createElement(se.a,null)),p.a.createElement("span",{style:Le},"\u5217\u6570"),p.a.createElement(I.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},p.a.createElement(se.a,null))),p.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},p.a.createElement("span",{style:Le},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),p.a.createElement(I.a.Item,{name:"align"},p.a.createElement(Te,null,p.a.createElement(ke.a,{value:"default"},p.a.createElement("i",{className:"fa fa-align-justify"})),p.a.createElement(ke.a,{value:"left"},p.a.createElement("i",{className:"fa fa-align-left"})),p.a.createElement(ke.a,{value:"center"},p.a.createElement("i",{className:"fa fa-align-center"})),p.a.createElement(ke.a,{value:"right"},p.a.createElement("i",{className:"fa fa-align-right"}))))),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(H.a,{type:"ghost",onClick:Ge},"\u53D6\u6D88")))},je=ne("ErOA"),Fe=ne("7Cbv"),Ne="link",Ue="upload-image",Je="code-block",tt="add-table",et="------------",Ze={default:et,left:":".concat(et),center:":".concat(et,":"),right:"".concat(et,":")},dt=ne("9VGf"),it,at;function Ie(){}var st=0,$e=1e4,De="\u2581",He=`
|
|
**\u6A21\u677F\u6807\u9898**
|
|
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function Ee(be){return/^\d+$/.test(be)?"".concat(be,"px"):be}var fe=navigator.platform.toUpperCase().indexOf("MAC")>=0,_e=fe?"Cmd":"Ctrl",re=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],ae=(it={},Object(G.a)(it,_e+"-B","bold"),Object(G.a)(it,_e+"-I","italic"),it),he=(at={},Object(G.a)(at,Ne,"\u6DFB\u52A0\u94FE\u63A5"),Object(G.a)(at,Je,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(G.a)(at,Ue,"\u6DFB\u52A0\u6587\u4EF6"),Object(G.a)(at,tt,"\u6DFB\u52A0\u8868\u683C"),at),ve=Ye.a=function(be){var Pe=be.defaultValue,Ge=Pe===void 0?"":Pe,ot=be.onChange,ct=be.width,ft=ct===void 0?"100%":ct,Ct=be.height,xt=Ct===void 0?400:Ct,ut=be.miniToolbar,Ut=ut===void 0?!1:ut,Mt=be.isFocus,Zt=Mt===void 0?!1:Mt,Yt=be.watch,Rt=be.insertTemp,Ti=be.mode,Ui=Ti===void 0?"markdown":Ti,Qe=be.id,wt=Qe===void 0?"markdown-editor-id":Qe,Ot=be.showResizeBar,Lt=Ot===void 0?!1:Ot,qt=be.noStorage,qi=qt===void 0?!1:qt,er=be.showNullButton,Bt=er===void 0?!1:er,pt=be.hidetoolBar,Gi=pt===void 0?!1:pt,tr=be.fullScreen,vi=tr===void 0?!1:tr,kt=be.onBlur,Bi=be.onCMBeforeChange,Vi=be.onFullScreen,fr=be.className,Ve=fr===void 0?"":fr,Tt=be.disablePaste,pr=Tt===void 0?!1:Tt,mr=be.placeholder,gr=mr===void 0?"":mr,vr=be.values,X=vr===void 0?"":vr,v=Object(g.useState)(null),A=Object(K.a)(v,2),U=A[0],q=A[1],V=Object(g.useState)(Ge),ye=Object(K.a)(V,2),We=ye[0],qe=ye[1],mt=Object(g.useState)(Yt),ze=Object(K.a)(mt,2),_t=ze[0],jt=ze[1],$t=Object(g.useState)(vi),Pi=Object(K.a)($t,2),yi=Pi[0],_i=Pi[1],Xi=Object(g.useState)(""),Ir=Object(K.a)(Xi,2),li=Ir[0],ji=Ir[1],or=Object(g.useState)(0),lr=Object(K.a)(or,2),Mi=lr[0],kr=lr[1],yr=Object(g.useState)(xt),zr=Object(K.a)(yr,2),Kr=zr[0],Yi=zr[1],zi=Object(g.useState)(!1),_r=Object(K.a)(zi,2),dn=_r[0],br=_r[1],ti=Object(g.useRef)(Object(Fe.a)()),Ht=Object(g.useRef)(!1),pi=Object(g.useRef)(),Dt=Object(g.useRef)(),ri=Object(g.useRef)(),zt=Object(g.useRef)(),ir=Object(g.useRef)(),ui=function(){var vt=Object(F.a)(R.a.mark(function St(){var bt,It;return R.a.wrap(function(Vt){for(;;)switch(Vt.prev=Vt.next){case 0:return Vt.next=2,Object(je.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:ti.current}});case 2:It=Vt.sent,It!=null&&(bt=It.attachments)!==null&&bt!==void 0&&bt.length&&(console.log("cm:",U,Dt),It.attachments.map(function(Nt){Nt.content_type.indexOf("image")>-1?U.replaceSelection(".concat(Nt.content_type,")")):Nt.content_type.indexOf("video")>-1?U.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Nt.content_type.indexOf("pdf")>-1?U.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Nt.id,"?type=").concat(Nt.content_type,'&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):U.replaceSelection("[".concat(Nt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Nt.id,"?type=").concat(Nt.content_type,")"))}));case 4:case"end":return Vt.stop()}},St)}));return function(){return vt.apply(this,arguments)}}();Object(g.useEffect)(function(){qe(X),U==null||U.setValue(X)},[X]),Object(g.useEffect)(function(){Vi==null||Vi(yi)},[yi]),Object(g.useEffect)(function(){if(Dt.current){var vt=d.a.fromTextArea(Dt.current,{mode:Ui,lineNumbers:!Ut,lineWrapping:!0,value:Ge,autoCloseTags:!0,autoCloseBrackets:!0});Zt&&vt.focus();function St(bt,It){if(pr){It.preventDefault();return}var Ft=It.clipboardData;if(Ft){var Vt=Ft.types.toString(),Nt=Ft.items;if(Vt==="Files"||Ft.types.indexOf("Files")>-1){if(It.preventDefault(),Ui=="stex")return;try{var si,Ai=Nt[1];((si=Nt[0])===null||si===void 0?void 0:si.kind)==="file"&&(Ai=Nt[0]);var Pt=Ai.getAsFile(),ur=Pt.name.split(".").pop();te(Pt,function(Wt){if(Wt.id){var Oi,bi,Ki;(Pt==null||((Oi=Pt.type)===null||Oi===void 0)?void 0:Oi.indexOf("image"))>-1?vt.replaceSelection(".concat(Wt.content_type,")")):(Pt==null||((bi=Pt.type)===null||bi===void 0)?void 0:bi.indexOf("video"))>-1?vt.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Wt.id,'"></video>')):(Pt==null||((Ki=Pt.type)===null||Ki===void 0)?void 0:Ki.indexOf("pdf"))>-1?vt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Pt.type,'&disposition=inline" target="_blank">').concat(Pt.name,"</a>")):re.includes(ur)?vt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Wt.id,'?type=office&disposition=inline" target="_blank">').concat(Pt.name,"</a>")):vt.replaceSelection("[".concat(Pt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Wt.content_type,")"))}else(Wt==null?void 0:Wt.status)===401&&(document.location.href="/user/login")})}catch(Wt){B.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return vt.on("paste",St),vt.on("dragleave",function(bt,It){ri.current.classList.remove("mouse-hover-md")}),vt.on("dragover",function(bt,It){ri.current.classList.add("mouse-hover-md")}),vt.on("drop",function(bt,It){ri.current.classList.add("mouse-hover-md");var Ft;if(Ft=It.dataTransfer.files,Ft.length>0){It.preventDefault(),It.stopPropagation();for(var Vt=function(Ai){var Pt=Ft[Ai],ur=Pt.name.split(".").pop();te(Pt,function(Wt){if(Wt.id){var Oi,bi,Ki;(Pt==null||((Oi=Pt.type)===null||Oi===void 0)?void 0:Oi.indexOf("image"))>-1?vt.replaceSelection(".concat(Wt.content_type,")")):(Pt==null||((bi=Pt.type)===null||bi===void 0)?void 0:bi.indexOf("video"))>-1?vt.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Wt.id,'"></video>')):(Pt==null||((Ki=Pt.type)===null||Ki===void 0)?void 0:Ki.indexOf("pdf"))>-1?vt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Pt.type,'&disposition=inline" target="_blank">').concat(Pt.name,"</a>")):re.includes(ur)?vt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Wt.id,'?type=office&disposition=inline" target="_blank">').concat(Pt.name,"</a>")):vt.replaceSelection("[".concat(Pt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Wt.content_type,")"))}else(Wt==null?void 0:Wt.status)===401&&(document.location.href="/user/login")})},Nt=0;Nt<Ft.length;Nt++)Vt(Nt)}}),q(vt),function(){vt.off("paste",St)}}},[]);var wi=Object(g.useCallback)(function(){if(ri.current)try{}catch(vt){console.log(vt,"---- to set md editor body height")}},[Kr,ri,yi]);Object(g.useEffect)(function(){function vt(){var bt=new s.default(function(It){var Ft=Object(P.a)(It),Vt;try{for(Ft.s();!(Vt=Ft.n()).done;){var Nt=Vt.value;(Nt.target.offsetHeight>0||Nt.target.offsetWidth>0)&&(wi(),U.setSize("100%","100%"),U.refresh())}}catch(si){Ft.e(si)}finally{Ft.f()}});return bt.observe(Dt.current.parentElement),bt}if(U){var St=vt();return function(){St.unobserve(Dt.current.parentElement)}}},[U,wi]),Object(g.useEffect)(function(){if(U){for(var vt=[],St=function(){var Nt=It[bt];Ft=Object(K.a)(Nt,2);var si=Ft[0],Ai=Ft[1],Pt=Object(G.a)({},si,function(){Vr(Ai)});vt.push(Pt),U.addKeyMap(Pt)},bt=0,It=Object.entries(ae);bt<It.length;bt++){var Ft;St()}return pi.current=setInterval(function(){Ht.current&&ui()},4e3),function(){clearInterval(pi.current);var Vt=Object(P.a)(vt),Nt;try{for(Vt.s();!(Nt=Vt.n()).done;){var si=Nt.value;U.removeKeyMap(si)}}catch(Ai){Vt.e(Ai)}finally{Vt.f()}}}},[U]),Object(g.useEffect)(function(){vi!==yi&&_i(vi)},[vi]),Object(dt.a)(function(){if(!qi&&Mi>0){var vt=new Date().getTime(),St=window.sessionStorage.getItem(wt);vt>=Mi+$e&&(!St||St!==We)&&(window.sessionStorage.setItem(wt,We),br(!0))}},$e),Object(g.useEffect)(function(){jt(Yt)},[U,Yt]),Object(g.useEffect)(function(){U&&(Zt&&U.focus())},[U,Zt]),Object(g.useEffect)(function(){if(_t&&U){var vt=U.getScrollerElement();function St(bt){var It=bt.target;if(ir.current){var Ft=It.scrollTop/It.scrollHeight;ir.current.scrollTop=ir.current.scrollHeight*Ft}}return vt.addEventListener("scroll",St),function(){vt.removeEventListener("scroll",St)}}},[U,_t]),Object(g.useEffect)(function(){if(U&&Bi){function vt(St,bt){Bi(St,bt)}return U.on("beforeChange",vt),function(){U.off("beforeChange",vt)}}},[U,Bi]),Object(g.useEffect)(function(){if(U&&kt){function vt(){kt(U.getValue())}return U.on("blur",vt),function(){U.off("blur",vt)}}},[U,kt]),Object(g.useEffect)(function(){if(U){function vt(St){var bt=St.getValue();qe(bt),kr(new Date().getTime()),St.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),ot&&ot(bt)}return U.on("change",vt),function(){U.off("change",vt)}}},[U,ot]),Object(g.useEffect)(function(){U&&(Ge==null?(U.setValue(""),qe("")):Ge!==U.getValue()&&(U.setValue(Ge),qe(Ge),U.setCursor(U.lineCount(),0)))},[U,Ge]);var Vr=Object(g.useCallback)(function(vt){var St=U.getCursor(),bt=U.getSelection(),It=bt.split(`
|
|
`);switch(vt){case"bold":return U.replaceSelection("**"+bt+"**"),bt===""&&U.setCursor(St.line,St.ch+2),U.focus();case"italic":return U.replaceSelection("*"+bt+"*"),bt===""&&U.setCursor(St.line,St.ch+1),U.focus();case"code":return U.replaceSelection("`"+bt+"`"),bt===""&&U.setCursor(St.line,St.ch+1),U.focus();case"inline-latex":return U.replaceSelection("`$$"+bt+"$$`"),bt===""&&U.setCursor(St.line,St.ch+3),U.focus();case"latex":return U.replaceSelection("```latex\n"+bt+"\n```"),U.setCursor(St.line+1,bt.length+1),U.focus();case"line-break":return U.replaceSelection(`<br/>
|
|
`),U.focus();case"list-ul":return bt===""?U.replaceSelection("- "+bt):U.replaceSelection(It.map(function(Ft){return Ft===""?"":"- ".concat(Ft)}).join(`
|
|
`)),U.focus();case"list-ol":return bt===""?U.replaceSelection("1. "+bt):U.replaceSelection(It.map(function(Ft,Vt){return Ft===""?"":"".concat(Vt+1,". ").concat(Ft)}).join(`
|
|
`)),U.focus();case"add-null-ch":return bt===""&&U.setCursor(St.line,St.ch+1),U.replaceSelection(De),U.focus();case"inster-template-1":return bt===""&&U.setCursor(St.line,St.ch),U.replaceSelection(He),U.focus();case"eraser":return U.setValue(""),U.focus();case"trigger-watch":return jt(!_t),U.focus();case"trigger-full-screen":return _i(!yi),U.focus();case Ne:ji(Ne);return;case Je:ji(Je);return;case Ue:ji(Ue);return;case tt:ji(tt);return;default:throw new Error}},[U,_t,yi]),Er=Object(g.useCallback)(function(vt){ji("");switch(li){case Ne:var St=vt.title,bt=vt.link;return U.replaceSelection("[".concat(St,"](").concat(bt,")")),U.focus();case Je:var It=vt.language,Ft=vt.content;return U.replaceSelection(["```"+It,Ft,"```"].join(`
|
|
`)),U.focus();case Ue:var Vt=vt.src,Nt=vt.alt;return Nt?U.replaceSelection(".concat(Vt,' "').concat(Nt,'" )')):U.replaceSelection("")),U.focus();case tt:for(var si=vt.row,Ai=vt.col,Pt=vt.align,ur=`
|
|
`,Wt=0;Wt<si;Wt++){for(var Oi=[],bi=[],Ki=0;Ki<Ai;Ki++)Wt===1&&bi.push(Ze[Pt]),Oi.push(" ");Wt===1&&(ur+="| ".concat(bi.join(" | "),` |
|
|
`)),ur+="| ".concat(Oi.join(Ai===1?"":" | "),` |
|
|
`)}return U.replaceSelection(ur+`
|
|
`),U.focus();default:throw new Error}},[U,li]),cn=Object(g.useMemo)(function(){switch(li){case Ne:return p.a.createElement(ie,{callback:Er,onCancel:xr});case Je:return p.a.createElement(oe.b,{callback:Er,onCancel:xr});case Ue:return p.a.createElement(pe,{callback:Er,onCancel:xr});case tt:return p.a.createElement(Me,{callback:Er,onCancel:xr});default:return null}},[li]);function xr(){ji("")}Object(g.useEffect)(function(){if(zt.current){var vt=zt.current,St=!1,bt=0;function It(Nt){St=!0,bt=Nt.pageY}function Ft(){St=!1}function Vt(Nt){if(St){var si=Nt.pageY-bt;si<0&&(si=0),si>300&&(si=300);var Ai=xt+si+"px";Yi(Ai)}}return vt.addEventListener("mousedown",It),document.addEventListener("mousemove",Vt),document.addEventListener("mouseup",Ft),function(){vt.removeEventListener("mousedown",It),document.removeEventListener("mousemove",Vt),document.removeEventListener("mouseup",Ft)}}},[U,zt]),Object(g.useEffect)(function(){Yi(xt)},[xt]);var rr=Ee(ft),fn=Ee(Kr),$i={width:rr,height:fn},pn=Object(g.useMemo)(function(){if(Mi){var vt=new Date(Mi),St=vt.getHours(),bt=vt.getMinutes(),It=vt.getSeconds();return St=St<10?"0"+St:St,bt=bt<10?"0"+bt:bt,It=It<10?"0"+It:It,"".concat(St,":").concat(bt,":").concat(It)}return 0},[Mi]);function jn(){window.sessionStorage.removeItem(wt),br(!1),kr(0)}function Dr(){br(!1),kr(0),U.setValue(window.sessionStorage.getItem(wt))}function ua(vt,St){var bt=U.getValue();bt=bt.replace(vt,St),qe(bt),U==null||U.setValue(bt)}return p.a.createElement(g.Fragment,null,p.a.createElement("div",{className:"markdown-editor-wrapper",ref:ri},p.a.createElement("div",{className:"markdown-editor-container ".concat(Ve," ").concat(_t?"on-preview":""," ").concat(Ut?"mini":""," ").concat(yi?"full-screen":""),style:$i},p.a.createElement(b,{insertTemp:Rt,watch:_t,fullScreen:yi,showNullButton:Bt,onActionCallback:Vr,hidetoolBar:Gi,uuid:ti.current,setOpenPhones:function(){Ht.current=!0}}),p.a.createElement("div",{className:"markdown-editor-body"},p.a.createElement("div",{className:"codemirror-container"},p.a.createElement("textarea",{ref:Dt,placeholder:gr})),_t?p.a.createElement("div",{ref:ir,className:"preview-container"},Ui==="stex"&&p.a.createElement(O,{value:We}),Ui!=="stex"&&p.a.createElement(x.a,{edit:!0,value:We,replaces:ua})):null))),Lt?p.a.createElement("a",{ref:zt,className:"editor-resize"}):null,p.a.createElement(N.a,null,he[li]?p.a.createElement(Z.a,{centered:!0,title:he[li],visible:!0,onCancel:xr,footer:null,className:"markdown-popup-form"},cn):null))}},SJMd:function(gt,Ye){/**
|
|
* @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,ue,Z,P=!1,Q,B;window.PR_SHOULD_USE_CONTINUATION=!0;var F,K;(function(){var G=window,M=["break,continue,do,else,for,if,return,while"],R=[M,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],g=[R,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],p=[g,"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=[g,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],d=[g,"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"],s="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",c=[g,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],l="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",n=[M,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],o=[M,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],h=[M,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],L=[p,d,f,c,l,n,o,h],S=/^(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",C="com",w="typ",T="lit",_="pun",u="pln",E="tag",m="dec",b="src",N="atn",D="atv",H="nocode",j="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function I(Te){for(var Le=0,Me=!1,je=!1,Fe=0,Ne=Te.length;Fe<Ne;++Fe){var Ue=Te[Fe];if(Ue.ignoreCase)je=!0;else if(/[a-z]/i.test(Ue.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Me=!0,je=!1;break}}var Je={b:8,t:9,n:10,v:11,f:12,r:13};function tt(at){var Ie=at.charCodeAt(0);if(Ie!==92)return Ie;var st=at.charAt(1);return Ie=Je[st],Ie||("0"<=st&&st<="7"?parseInt(at.substring(1),8):st==="u"||st==="x"?parseInt(at.substring(2),16):at.charCodeAt(1))}function et(at){if(at<32)return(at<16?"\\x0":"\\x")+at.toString(16);var Ie=String.fromCharCode(at);return Ie==="\\"||Ie==="-"||Ie==="]"||Ie==="^"?"\\"+Ie:Ie}function Ze(at){var Ie=at.substring(1,at.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")),st=[],$e=Ie[0]==="^",De=["["];$e&&De.push("^");for(var He=$e?1:0,Ee=Ie.length;He<Ee;++He){var fe=Ie[He];if(/\\[bdsw]/i.test(fe))De.push(fe);else{var _e=tt(fe),re;He+2<Ee&&Ie[He+1]==="-"?(re=tt(Ie[He+2]),He+=2):re=_e,st.push([_e,re]),re<65||_e>122||(re<65||_e>90||st.push([Math.max(65,_e)|32,Math.min(re,90)|32]),re<97||_e>122||st.push([Math.max(97,_e)&~32,Math.min(re,122)&~32]))}}st.sort(function(be,Pe){return be[0]-Pe[0]||Pe[1]-be[1]});for(var ae=[],he=[],He=0;He<st.length;++He){var ve=st[He];ve[0]<=he[1]+1?he[1]=Math.max(he[1],ve[1]):ae.push(he=ve)}for(var He=0;He<ae.length;++He){var ve=ae[He];De.push(et(ve[0])),ve[1]>ve[0]&&(ve[1]+1>ve[0]&&De.push("-"),De.push(et(ve[1])))}return De.push("]"),De.join("")}function dt(at){for(var Ie=at.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")),st=Ie.length,$e=[],De=0,He=0;De<st;++De){var Ee=Ie[De];if(Ee==="(")++He;else if(Ee.charAt(0)==="\\"){var fe=+Ee.substring(1);fe&&(fe<=He?$e[fe]=-1:Ie[De]=et(fe))}}for(var De=1;De<$e.length;++De)$e[De]===-1&&($e[De]=++Le);for(var De=0,He=0;De<st;++De){var Ee=Ie[De];if(Ee==="(")++He,$e[He]||(Ie[De]="(?:");else if(Ee.charAt(0)==="\\"){var fe=+Ee.substring(1);fe&&fe<=He&&(Ie[De]="\\"+$e[fe])}}for(var De=0;De<st;++De)Ie[De]==="^"&&Ie[De+1]!=="^"&&(Ie[De]="");if(at.ignoreCase&&Me)for(var De=0;De<st;++De){var Ee=Ie[De],_e=Ee.charAt(0);Ee.length>=2&&_e==="["?Ie[De]=Ze(Ee):_e!=="\\"&&(Ie[De]=Ee.replace(/[a-zA-Z]/g,function(he){var ve=he.charCodeAt(0);return"["+String.fromCharCode(ve&~32,ve|32)+"]"}))}return Ie.join("")}for(var it=[],Fe=0,Ne=Te.length;Fe<Ne;++Fe){var Ue=Te[Fe];if(Ue.global||Ue.multiline)throw new Error(""+Ue);it.push("(?:"+dt(Ue)+")")}return new RegExp(it.join("|"),je?"gi":"g")}function y(Te,Le){var Me=/(?:^|\s)nocode(?:\s|$)/,je=[],Fe=0,Ne=[],Ue=0;function Je(tt){var et=tt.nodeType;if(et==1){if(Me.test(tt.className))return;for(var Ze=tt.firstChild;Ze;Ze=Ze.nextSibling)Je(Ze);var dt=tt.nodeName.toLowerCase();(dt==="br"||dt==="li")&&(je[Ue]=`
|
|
`,Ne[Ue<<1]=Fe++,Ne[Ue++<<1|1]=tt)}else if(et==3||et==4){var it=tt.nodeValue;it.length&&(Le?it=it.replace(/\r\n?/g,`
|
|
`):it=it.replace(/[ \t\r\n]+/g," "),je[Ue]=it,Ne[Ue<<1]=Fe,Fe+=it.length,Ne[Ue++<<1|1]=tt)}}return Je(Te),{sourceCode:je.join("").replace(/\n$/,""),spans:Ne}}function W(Te,Le,Me,je,Fe){if(!Me)return;var Ne={sourceNode:Te,pre:1,langExtension:null,numberLines:null,sourceCode:Me,spans:null,basePos:Le,decorations:null};je(Ne),Fe.push.apply(Fe,Ne.decorations)}var Y=/\S/;function ie(Te){for(var Le=void 0,Me=Te.firstChild;Me;Me=Me.nextSibling){var je=Me.nodeType;Le=je===1?Le?Te:Me:je===3&&Y.test(Me.nodeValue)?Te:Le}return Le===Te?void 0:Le}function oe(Te,Le){var Me={},je;(function(){for(var Ue=Te.concat(Le),Je=[],tt={},et=0,Ze=Ue.length;et<Ze;++et){var dt=Ue[et],it=dt[3];if(it)for(var at=it.length;--at>=0;)Me[it.charAt(at)]=dt;var Ie=dt[1],st=""+Ie;tt.hasOwnProperty(st)||(Je.push(Ie),tt[st]=null)}Je.push(/[\0-\uffff]/),je=I(Je)})();var Fe=Le.length,Ne=function(Ue){for(var Je=Ue.sourceCode,tt=Ue.basePos,et=Ue.sourceNode,Ze=[tt,u],dt=0,it=Je.match(je)||[],at={},Ie=0,st=it.length;Ie<st;++Ie){var $e=it[Ie],De=at[$e],He=void 0,Ee;if(typeof De=="string")Ee=!1;else{var fe=Me[$e.charAt(0)];if(fe)He=$e.match(fe[1]),De=fe[0];else{for(var _e=0;_e<Fe;++_e)if(fe=Le[_e],He=$e.match(fe[1]),He){De=fe[0];break}He||(De=u)}Ee=De.length>=5&&De.substring(0,5)==="lang-",Ee&&!(He&&typeof He[1]=="string")&&(Ee=!1,De=b),Ee||(at[$e]=De)}var re=dt;if(dt+=$e.length,!Ee)Ze.push(tt+re,De);else{var ae=He[1],he=$e.indexOf(ae),ve=he+ae.length;He[2]&&(ve=$e.length-He[2].length,he=ve-ae.length);var be=De.substring(5);W(et,tt+re,$e.substring(0,he),Ne,Ze),W(et,tt+re+he,ae,le(be,ae),Ze),W(et,tt+re+ve,$e.substring(ve),Ne,Ze)}}Ue.decorations=Ze};return Ne}function we(Te){var Le=[],Me=[];Te.tripleQuotedStrings?Le.push([x,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Te.multiLineStrings?Le.push([x,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Le.push([x,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Te.verbatimStrings&&Me.push([x,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var je=Te.hashComments;je&&(Te.cStyleComments?(je>1?Le.push([C,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Le.push([C,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Me.push([x,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Le.push([C,/^#[^\r\n]*/,null,"#"])),Te.cStyleComments&&(Me.push([C,/^\/\/[^\r\n]*/,null]),Me.push([C,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Fe=Te.regexLiterals;if(Fe){var Ne=Fe>1?"":`
|
|
\r`,Ue=Ne?".":"[\\S\\s]",Je="/(?=[^/*"+Ne+"])(?:[^/\\x5B\\x5C"+Ne+"]|\\x5C"+Ue+"|\\x5B(?:[^\\x5C\\x5D"+Ne+"]|\\x5C"+Ue+")*(?:\\x5D|$))+/";Me.push(["lang-regex",RegExp("^"+j+"("+Je+")")])}var tt=Te.types;tt&&Me.push([w,tt]);var et=(""+Te.keywords).replace(/^ | $/g,"");et.length&&Me.push([O,new RegExp("^(?:"+et.replace(/[\s,]+/g,"|")+")\\b"),null]),Le.push([u,/^\s+/,null,` \r
|
|
\xA0`]);var Ze="^.[^\\s\\w.$@'\"`/\\\\]*";return Te.regexLiterals&&(Ze+="(?!s*/)"),Me.push([T,/^@[a-z_$][a-z_$@0-9]*/i,null],[w,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[u,/^[a-z_$][a-z_$@0-9]*/i,null],[T,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[u,/^\\[\s\S]?/,null],[_,new RegExp(Ze),null]),oe(Le,Me)}var me=we({keywords:L,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Se(Te,Le,Me){for(var je=/(?:^|\s)nocode(?:\s|$)/,Fe=/\r\n?|\n/,Ne=Te.ownerDocument,Ue=Ne.createElement("li");Te.firstChild;)Ue.appendChild(Te.firstChild);var Je=[Ue];function tt(Ie){var st=Ie.nodeType;if(st==1&&!je.test(Ie.className))if(Ie.nodeName==="br")et(Ie),Ie.parentNode&&Ie.parentNode.removeChild(Ie);else for(var $e=Ie.firstChild;$e;$e=$e.nextSibling)tt($e);else if((st==3||st==4)&&Me){var De=Ie.nodeValue,He=De.match(Fe);if(He){var Ee=De.substring(0,He.index);Ie.nodeValue=Ee;var fe=De.substring(He.index+He[0].length);if(fe){var _e=Ie.parentNode;_e.insertBefore(Ne.createTextNode(fe),Ie.nextSibling)}et(Ie),Ee||Ie.parentNode.removeChild(Ie)}}}function et(Ie){for(;!Ie.nextSibling;)if(Ie=Ie.parentNode,!Ie)return;function st(He,Ee){var fe=Ee?He.cloneNode(!1):He,_e=He.parentNode;if(_e){var re=st(_e,1),ae=He.nextSibling;re.appendChild(fe);for(var he=ae;he;he=ae)ae=he.nextSibling,re.appendChild(he)}return fe}for(var $e=st(Ie.nextSibling,0),De;(De=$e.parentNode)&&De.nodeType===1;)$e=De;Je.push($e)}for(var Ze=0;Ze<Je.length;++Ze)tt(Je[Ze]);Le===(Le|0)&&Je[0].setAttribute("value",Le);var dt=Ne.createElement("ol");dt.className="linenums";for(var it=Math.max(0,Le-1|0)||0,Ze=0,at=Je.length;Ze<at;++Ze)Ue=Je[Ze],Ue.className="L"+(Ze+it)%10,Ue.firstChild||Ue.appendChild(Ne.createTextNode("\xA0")),dt.appendChild(Ue);Te.appendChild(dt)}function Ce(Te){var Le=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Le=Le&&+Le[1]<=8;var Me=/\n/g,je=Te.sourceCode,Fe=je.length,Ne=0,Ue=Te.spans,Je=Ue.length,tt=0,et=Te.decorations,Ze=et.length,dt=0;et[Ze]=Fe;var it,at;for(at=it=0;at<Ze;)et[at]!==et[at+2]?(et[it++]=et[at++],et[it++]=et[at++]):at+=2;for(Ze=it,at=it=0;at<Ze;){for(var Ie=et[at],st=et[at+1],$e=at+2;$e+2<=Ze&&et[$e+1]===st;)$e+=2;et[it++]=Ie,et[it++]=st,at=$e}Ze=et.length=it;var De=Te.sourceNode,He="";De&&(He=De.style.display,De.style.display="none");try{for(var Ee=null;tt<Je;){var fe=Ue[tt],_e=Ue[tt+2]||Fe,re=et[dt+2]||Fe,$e=Math.min(_e,re),ae=Ue[tt+1],he;if(ae.nodeType!==1&&(he=je.substring(Ne,$e))){Le&&(he=he.replace(Me,"\r")),ae.nodeValue=he;var ve=ae.ownerDocument,be=ve.createElement("span");be.className=et[dt+1];var Pe=ae.parentNode;Pe.replaceChild(be,ae),be.appendChild(ae),Ne<_e&&(Ue[tt+1]=ae=ve.createTextNode(je.substring($e,_e)),Pe.insertBefore(ae,be.nextSibling))}Ne=$e,Ne>=_e&&(tt+=2),Ne>=re&&(dt+=2)}}finally{De&&(De.style.display=He)}}var xe={};function pe(Te,Le){for(var Me=Le.length;--Me>=0;){var je=Le[Me];xe.hasOwnProperty(je)?G.console&&console.warn("cannot override language handler %s",je):xe[je]=Te}}function le(Te,Le){return Te&&xe.hasOwnProperty(Te)||(Te=/^\s*</.test(Le)?"default-markup":"default-code"),xe[Te]}pe(me,["default-code"]),pe(oe([],[[u,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[C,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[_,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),pe(oe([[u,/^[\s]+/,null,` \r
|
|
`],[D,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[E,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[N,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[_,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),pe(oe([],[[D,/^[\s\S]+/]]),["uq.val"]),pe(we({keywords:p,hashComments:!0,cStyleComments:!0,types:S}),["c","cc","cpp","cxx","cyc","m"]),pe(we({keywords:"null,true,false"}),["json"]),pe(we({keywords:d,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:S}),["cs"]),pe(we({keywords:f,cStyleComments:!0}),["java"]),pe(we({keywords:h,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),pe(we({keywords:n,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),pe(we({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),pe(we({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),pe(we({keywords:c,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),pe(we({keywords:s,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),pe(oe([],[[x,/^[\s\S]+/]]),["regex"]);function te(Te){var Le=Te.langExtension;try{var Me=y(Te.sourceNode,Te.pre),je=Me.sourceCode;Te.sourceCode=je,Te.spans=Me.spans,Te.basePos=0,le(Le,je)(Te),Ce(Te)}catch(Fe){G.console&&console.log(Fe&&Fe.stack||Fe)}}function de(Te,Le,Me){var je=Me||!1,Fe=Le||null,Ne=document.createElement("div");Ne.innerHTML="<pre>"+Te+"</pre>",Ne=Ne.firstChild,je&&Se(Ne,je,!0);var Ue={langExtension:Fe,numberLines:je,sourceNode:Ne,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return te(Ue),Ne.innerHTML}function se(Te,Le){var Me=Le||document.body,je=Me.ownerDocument||document;function Fe(fe){return Me.getElementsByTagName(fe)}for(var Ne=[Fe("pre"),Fe("code"),Fe("xmp")],Ue=[],Je=0;Je<Ne.length;++Je)for(var tt=0,et=Ne[Je].length;tt<et;++tt)Ue.push(Ne[Je][tt]);Ne=null;var Ze=Date;Ze.now||(Ze={now:function(){return+new Date}});var dt=0,it=/\blang(?:uage)?-([\w.]+)(?!\S)/,at=/\bprettyprint\b/,Ie=/\bprettyprinted\b/,st=/pre|xmp/i,$e=/^code$/i,De=/^(?:pre|code|xmp)$/i,He={};function Ee(){for(var fe=G.PR_SHOULD_USE_CONTINUATION?Ze.now()+250:Infinity;dt<Ue.length&&Ze.now()<fe;dt++){for(var _e=Ue[dt],re=He,ae=_e;ae=ae.previousSibling;){var he=ae.nodeType,ve=(he===7||he===8)&&ae.nodeValue;if(ve?!/^\??prettify\b/.test(ve):he!==3||/\S/.test(ae.nodeValue))break;if(ve){re={},ve.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Yt,Rt,Ti){re[Rt]=Ti});break}}var be=_e.className;if((re!==He||at.test(be))&&!Ie.test(be)){for(var Pe=!1,Ge=_e.parentNode;Ge;Ge=Ge.parentNode){var ot=Ge.tagName;if(De.test(ot)&&Ge.className&&at.test(Ge.className)){Pe=!0;break}}if(!Pe){_e.className+=" prettyprinted";var ct=re.lang;if(!ct){ct=be.match(it);var ft;!ct&&(ft=ie(_e))&&$e.test(ft.tagName)&&(ct=ft.className.match(it)),ct&&(ct=ct[1])}var Ct;if(st.test(_e.tagName))Ct=1;else{var xt=_e.currentStyle,ut=je.defaultView,Ut=xt?xt.whiteSpace:ut&&ut.getComputedStyle?ut.getComputedStyle(_e,null).getPropertyValue("white-space"):0;Ct=Ut&&Ut.substring(0,3)==="pre"}var Mt=re.linenums;(Mt=Mt==="true"||+Mt)||(Mt=be.match(/\blinenums\b(?::(\d+))?/),Mt=Mt?Mt[1]&&Mt[1].length?+Mt[1]:!0:!1),Mt&&Se(_e,Mt,Ct);var Zt={langExtension:ct,sourceNode:_e,numberLines:Mt,pre:Ct,sourceCode:null,basePos:null,spans:null,decorations:null};te(Zt)}}}dt<Ue.length?G.setTimeout(Ee,250):typeof Te=="function"&&Te()}Ee()}var Oe=G.PR={createSimpleLexer:oe,registerLangHandler:pe,sourceDecorator:we,PR_ATTRIB_NAME:N,PR_ATTRIB_VALUE:D,PR_COMMENT:C,PR_DECLARATION:m,PR_KEYWORD:O,PR_LITERAL:T,PR_NOCODE:H,PR_PLAIN:u,PR_PUNCTUATION:_,PR_SOURCE:b,PR_STRING:x,PR_TAG:E,PR_TYPE:w,prettyPrintOne:P?G.prettyPrintOne=de:F=de,prettyPrint:K=P?G.prettyPrint=se:K=se},ke=G.define;typeof ke=="function"&&ke.amd&&ke("google-code-prettify",[],function(){return Oe})})()},TXwP:function(gt,Ye,ne){var ue,Z;(function(){var P;(function(){"use strict";var B=[,,function(M){function R(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=[]}R.prototype.clone_empty=function(){var f=new R(this.__parent);return f.set_indent(this.__indent_count,this.__alignment_count),f},R.prototype.item=function(f){return f<0?this.__items[this.__items.length+f]:this.__items[f]},R.prototype.has_match=function(f){for(var d=this.__items.length-1;d>=0;d--)if(this.__items[d].match(f))return!0;return!1},R.prototype.set_indent=function(f,d){this.is_empty()&&(this.__indent_count=f||0,this.__alignment_count=d||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},R.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)},R.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},R.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},R.prototype.is_empty=function(){return this.__items.length===0},R.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},R.prototype.push=function(f){this.__items.push(f);var d=f.lastIndexOf(`
|
|
`);d!==-1?this.__character_count=f.length-d:this.__character_count+=f.length},R.prototype.pop=function(){var f=null;return this.is_empty()||(f=this.__items.pop(),this.__character_count-=f.length),f},R.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},R.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},R.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},R.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 g(f,d){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)),d=d||"",f.indent_level>0&&(d=new Array(f.indent_level+1).join(this.__indent_string)),this.__base_string=d,this.__base_string_length=d.length}g.prototype.get_indent_size=function(f,d){var s=this.__base_string_length;return d=d||0,f<0&&(s=0),s+=f*this.__indent_size,s+=d,s},g.prototype.get_indent_string=function(f,d){var s=this.__base_string;return d=d||0,f<0&&(f=0,s=""),d+=f*this.__indent_size,this.__ensure_cache(d),s+=this.__cache[d],s},g.prototype.__ensure_cache=function(f){for(;f>=this.__cache.length;)this.__add_column()},g.prototype.__add_column=function(){var f=this.__cache.length,d=0,s="";this.__indent_size&&f>=this.__indent_size&&(d=Math.floor(f/this.__indent_size),f-=d*this.__indent_size,s=new Array(d+1).join(this.__indent_string)),f&&(s+=new Array(f+1).join(" ")),this.__cache.push(s)};function p(f,d){this.__indent_cache=new g(f,d),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 R(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}p.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},p.prototype.get_line_number=function(){return this.__lines.length},p.prototype.get_indent_string=function(f,d){return this.__indent_cache.get_indent_string(f,d)},p.prototype.get_indent_size=function(f,d){return this.__indent_cache.get_indent_size(f,d)},p.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},p.prototype.add_new_line=function(f){return this.is_empty()||!f&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},p.prototype.get_code=function(f){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 s=this.__lines.join(`
|
|
`);return f!==`
|
|
`&&(s=s.replace(/[\n]/g,f)),s},p.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},p.prototype.set_indent=function(f,d){return f=f||0,d=d||0,this.next_line.set_indent(f,d),this.__lines.length>1?(this.current_line.set_indent(f,d),!0):(this.current_line.set_indent(),!1)},p.prototype.add_raw_token=function(f){for(var d=0;d<f.newlines;d++)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},p.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()},p.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(" "))},p.prototype.remove_indent=function(f){for(var d=this.__lines.length;f<d;)this.__lines[f]._remove_indent(),f++;this.current_line._remove_wrap_indent()},p.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},p.prototype.just_added_newline=function(){return this.current_line.is_empty()},p.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},p.prototype.ensure_empty_line_above=function(f,d){for(var s=this.__lines.length-2;s>=0;){var c=this.__lines[s];if(c.is_empty())break;if(c.item(0).indexOf(f)!==0&&c.item(-1)!==d){this.__lines.splice(s+1,0,new R(this)),this.previous_line=this.__lines[this.__lines.length-2];break}s--}},M.exports.Output=p},,,,function(M){function R(f,d){this.raw_options=g(f,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"])}R.prototype._get_array=function(f,d){var s=this.raw_options[f],c=d||[];return typeof s=="object"?s!==null&&typeof s.concat=="function"&&(c=s.concat()):typeof s=="string"&&(c=s.split(/[^a-zA-Z0-9_\/\-]+/)),c},R.prototype._get_boolean=function(f,d){var s=this.raw_options[f],c=s===void 0?!!d:!!s;return c},R.prototype._get_characters=function(f,d){var s=this.raw_options[f],c=d||"";return typeof s=="string"&&(c=s.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),c},R.prototype._get_number=function(f,d){var s=this.raw_options[f];d=parseInt(d,10),isNaN(d)&&(d=0);var c=parseInt(s,10);return isNaN(c)&&(c=d),c},R.prototype._get_selection=function(f,d,s){var c=this._get_selection_list(f,d,s);if(c.length!==1)throw new Error("Invalid Option Value: The option '"+f+`' can only be one of the following values:
|
|
`+d+`
|
|
You passed in: '`+this.raw_options[f]+"'");return c[0]},R.prototype._get_selection_list=function(f,d,s){if(!d||d.length===0)throw new Error("Selection list cannot be empty.");if(s=s||[d[0]],!this._is_valid_selection(s,d))throw new Error("Invalid Default Value!");var c=this._get_array(f,s);if(!this._is_valid_selection(c,d))throw new Error("Invalid Option Value: The option '"+f+`' can contain only the following values:
|
|
`+d+`
|
|
You passed in: '`+this.raw_options[f]+"'");return c},R.prototype._is_valid_selection=function(f,d){return f.length&&d.length&&!f.some(function(s){return d.indexOf(s)===-1})};function g(f,d){var s={};f=p(f);var c;for(c in f)c!==d&&(s[c]=f[c]);if(d&&f[d])for(c in f[d])s[c]=f[d][c];return s}function p(f){var d={},s;for(s in f){var c=s.replace(/-/g,"_");d[c]=f[s]}return d}M.exports.Options=R,M.exports.normalizeOpts=p,M.exports.mergeOpts=g},,function(M){var R=RegExp.prototype.hasOwnProperty("sticky");function g(p){this.__input=p||"",this.__input_length=this.__input.length,this.__position=0}g.prototype.restart=function(){this.__position=0},g.prototype.back=function(){this.__position>0&&(this.__position-=1)},g.prototype.hasNext=function(){return this.__position<this.__input_length},g.prototype.next=function(){var p=null;return this.hasNext()&&(p=this.__input.charAt(this.__position),this.__position+=1),p},g.prototype.peek=function(p){var f=null;return p=p||0,p+=this.__position,p>=0&&p<this.__input_length&&(f=this.__input.charAt(p)),f},g.prototype.__match=function(p,f){p.lastIndex=f;var d=p.exec(this.__input);return d&&!(R&&p.sticky)&&(d.index!==f&&(d=null)),d},g.prototype.test=function(p,f){return f=f||0,f+=this.__position,f>=0&&f<this.__input_length?!!this.__match(p,f):!1},g.prototype.testChar=function(p,f){var d=this.peek(f);return p.lastIndex=0,d!==null&&p.test(d)},g.prototype.match=function(p){var f=this.__match(p,this.__position);return f?this.__position+=f[0].length:f=null,f},g.prototype.read=function(p,f,d){var s="",c;return p&&(c=this.match(p),c&&(s+=c[0])),f&&(c||!p)&&(s+=this.readUntil(f,d)),s},g.prototype.readUntil=function(p,f){var d="",s=this.__position;p.lastIndex=this.__position;var c=p.exec(this.__input);return c?(s=c.index,f&&(s+=c[0].length)):s=this.__input_length,d=this.__input.substring(this.__position,s),this.__position=s,d},g.prototype.readUntilAfter=function(p){return this.readUntil(p,!0)},g.prototype.get_regexp=function(p,f){var d=null,s="g";return f&&R&&(s="y"),typeof p=="string"&&p!==""?d=new RegExp(p,s):p&&(d=new RegExp(p.source,s)),d},g.prototype.get_literal_regexp=function(p){return RegExp(p.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},g.prototype.peekUntilAfter=function(p){var f=this.__position,d=this.readUntilAfter(p);return this.__position=f,d},g.prototype.lookBack=function(p){var f=this.__position-1;return f>=p.length&&this.__input.substring(f-p.length,f).toLowerCase()===p},M.exports.InputScanner=g},,,,,function(M){function R(g,p){g=typeof g=="string"?g:g.source,p=typeof p=="string"?p:p.source,this.__directives_block_pattern=new RegExp(g+/ beautify( \w+[:]\w+)+ /.source+p,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(g+/\sbeautify\signore:end\s/.source+p,"g")}R.prototype.get_directives=function(g){if(!g.match(this.__directives_block_pattern))return null;var p={};this.__directive_pattern.lastIndex=0;for(var f=this.__directive_pattern.exec(g);f;)p[f[1]]=f[2],f=this.__directive_pattern.exec(g);return p},R.prototype.readIgnored=function(g){return g.readUntilAfter(this.__directives_end_ignore_pattern)},M.exports.Directives=R},,function(M,R,g){var p=g(16).Beautifier,f=g(17).Options;function d(s,c){var l=new p(s,c);return l.beautify()}M.exports=d,M.exports.defaultOptions=function(){return new f}},function(M,R,g){var p=g(17).Options,f=g(2).Output,d=g(8).InputScanner,s=g(13).Directives,c=new s(/\/\*/,/\*\//),l=/\r\n|[\r\n]/,n=/\r\n|[\r\n]/g,o=/\s/,h=/(?:\s|\n)+/g,L=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,S=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function x(O,C){this._source_text=O||"",this._options=new p(C),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 C="";for(this._ch=this._input.next();this._ch;){if(C+=this._ch,this._ch==="\\")C+=this._input.next();else if(O.indexOf(this._ch)!==-1||this._ch===`
|
|
`)break;this._ch=this._input.next()}return C},x.prototype.eatWhitespace=function(O){for(var C=o.test(this._input.peek()),w=0;o.test(this._input.peek());)this._ch=this._input.next(),O&&this._ch===`
|
|
`&&((w===0||w<this._options.max_preserve_newlines)&&(w++,this._output.add_new_line(!0)));return C},x.prototype.foundNestedPseudoClass=function(){for(var O=0,C=1,w=this._input.peek(C);w;){if(w==="{")return!0;if(w==="(")O+=1;else if(w===")"){if(O===0)return!1;O-=1}else if(w===";"||w==="}")return!1;C++,w=this._input.peek(C)}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,C=this._options.eol;C==="auto"&&(C=`
|
|
`,O&&l.test(O||"")&&(C=O.match(l)[0])),O=O.replace(n,`
|
|
`);var w=O.match(/^[\t ]*/)[0];this._output=new f(this._options,w),this._input=new d(O),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var T=0,_=!1,u=!1,E=!1,m=!1,b=!1,N=!1,D=this._ch,H=!1,j,I,y;j=this._input.read(h),I=j!=="",y=D,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),D=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var W=this._input.read(L),Y=c.get_directives(W);Y&&Y.ignore==="start"&&(W+=c.readIgnored(this._input)),this.print_string(W),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(S)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(I),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var ie=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);ie.match(/[ :]$/)&&(ie=this.eatString(": ").replace(/\s$/,""),this.print_string(ie),this._output.space_before_token=!0),ie=ie.replace(/\s$/,""),ie==="extend"?m=!0:ie==="import"&&(b=!0),ie in this.NESTED_AT_RULE?(this._nestedLevel+=1,ie in this.CONDITIONAL_GROUP_RULE&&(E=!0)):!_&&T===0&&ie.indexOf(":")!==-1&&(u=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(I),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")u&&(u=!1,this.outdent()),E?(E=!1,_=this._indentLevel>=this._nestedLevel):_=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&_&&(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)):(y==="("?this._output.space_before_token=!1:y!==","&&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(),y==="{"&&this._output.trim(!0),b=!1,m=!1,u&&(this.outdent(),u=!1),this.print_string(this._ch),_=!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 oe=0;oe<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;oe++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[oe])){H=!0;break}(_||E)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!m&&T===0?(this.print_string(":"),u||(u=!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 we=y==='"'||y==="'";this.preserveSingleSpace(we||I),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")H=!1,T===0?(u&&(this.outdent(),u=!1),m=!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(),T++,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(")")),T&&(T--,this.outdent()));else{var me=!1;this._input.lookBack("with")&&(me=!0),this.preserveSingleSpace(I||me),this.print_string(this._ch),u&&y==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),N=!0):(this.eatWhitespace(),T++,this.indent())}else if(this._ch===")")T&&(T--,this.outdent()),N&&this._input.peek()===";"&&this._options.selector_separator_newline&&(N=!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&&(!u||N)&&T===0&&!b&&!m?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!u&&T===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&&o.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(I),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),o.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 Se=y==='"'||y==="'";this.preserveSingleSpace(Se||I),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
`&&H&&this._output.add_new_line()}var Ce=this._output.get_code(C);return Ce},M.exports.Beautifier=x},function(M,R,g){var p=g(6).Options;function f(d){p.call(this,d,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var s=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||s;var c=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var l=0;l<c.length;l++)c[l]!=="expand"?this.brace_style="collapse":this.brace_style=c[l]}f.prototype=new p,M.exports.Options=f}],F={};function K(M){var R=F[M];if(R!==void 0)return R.exports;var g=F[M]={exports:{}};return B[M](g,g.exports,K),g.exports}var G=K(15);P=G})();var Q=P;!(ue=[],Z=function(){return{css_beautify:Q}}.apply(Ye,ue),Z!==void 0&&(gt.exports=Z))})()},"VrN/":function(gt,Ye,ne){(function(ue,Z){gt.exports=Z()})(this,function(){"use strict";var ue=navigator.userAgent,Z=navigator.platform,P=/gecko\/\d/i.test(ue),Q=/MSIE \d/.test(ue),B=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ue),F=/Edge\/(\d+)/.exec(ue),K=Q||B||F,G=K&&(Q?document.documentMode||6:+(F||B)[1]),M=!F&&/WebKit\//.test(ue),R=M&&/Qt\/\d+\.\d+/.test(ue),g=!F&&/Chrome\//.test(ue),p=/Opera\//.test(ue),f=/Apple Computer/.test(navigator.vendor),d=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ue),s=/PhantomJS/.test(ue),c=!F&&/AppleWebKit/.test(ue)&&/Mobile\/\w+/.test(ue),l=/Android/.test(ue),n=c||l||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ue),o=c||/Mac/.test(Z),h=/\bCrOS\b/.test(ue),L=/win/i.test(Z),S=p&&ue.match(/Version\/(\d*\.\d*)/);S&&(S=Number(S[1])),S&&S>=15&&(p=!1,M=!0);var x=o&&(R||p&&(S==null||S<12.11)),O=P||K&&G>=9;function C(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var w=function(e,t){var r=e.className,i=C(t).exec(r);if(i){var a=r.slice(i.index+i[0].length);e.className=r.slice(0,i.index)+(a?i[1]+a:"")}};function T(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function _(e,t){return T(e).appendChild(t)}function u(e,t,r,i){var a=document.createElement(e);if(r&&(a.className=r),i&&(a.style.cssText=i),typeof t=="string")a.appendChild(document.createTextNode(t));else if(t)for(var k=0;k<t.length;++k)a.appendChild(t[k]);return a}function E(e,t,r,i){var a=u(e,t,r,i);return a.setAttribute("role","presentation"),a}var m;document.createRange?m=function(e,t,r,i){var a=document.createRange();return a.setEnd(i||e,r),a.setStart(e,t),a}:m=function(e,t,r){var i=document.body.createTextRange();try{i.moveToElementText(e.parentNode)}catch(a){return i}return i.collapse(!0),i.moveEnd("character",r),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 N(){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 D(e,t){var r=e.className;C(t).test(r)||(e.className+=(r?" ":"")+t)}function H(e,t){for(var r=e.split(" "),i=0;i<r.length;i++)r[i]&&!C(r[i]).test(t)&&(t+=" "+r[i]);return t}var j=function(e){e.select()};c?j=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:K&&(j=function(e){try{e.select()}catch(t){}});function I(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function y(e,t,r){t||(t={});for(var i in e)e.hasOwnProperty(i)&&(r!==!1||!t.hasOwnProperty(i))&&(t[i]=e[i]);return t}function W(e,t,r,i,a){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var k=i||0,z=a||0;;){var $=e.indexOf(" ",k);if($<0||$>=t)return z+(t-k);z+=$-k,z+=r-z%r,k=$+1}}var Y=function(){this.id=null,this.f=null,this.time=0,this.handler=I(this.onTimeout,this)};Y.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Y.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=r)};function ie(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}var oe=50,we={toString:function(){return"CodeMirror.Pass"}},me={scroll:!1},Se={origin:"*mouse"},Ce={origin:"+move"};function xe(e,t,r){for(var i=0,a=0;;){var k=e.indexOf(" ",i);k==-1&&(k=e.length);var z=k-i;if(k==e.length||a+z>=t)return i+Math.min(z,t-a);if(a+=k-i,a+=r-a%r,i=k+1,a>=t)return i}}var pe=[""];function le(e){for(;pe.length<=e;)pe.push(te(pe)+" ");return pe[e]}function te(e){return e[e.length-1]}function de(e,t){for(var r=[],i=0;i<e.length;i++)r[i]=t(e[i],i);return r}function se(e,t,r){for(var i=0,a=r(t);i<e.length&&r(e[i])<=a;)i++;e.splice(i,0,t)}function Oe(){}function ke(e,t){var r;return Object.create?r=Object.create(e):(Oe.prototype=e,r=new Oe),t&&y(t,r),r}var Te=/[\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()||Te.test(e))}function Me(e,t){return t?t.source.indexOf("\\w")>-1&&Le(e)?!0:t.test(e):Le(e)}function je(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Fe=/[\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 Ne(e){return e.charCodeAt(0)>=768&&Fe.test(e)}function Ue(e,t,r){for(;(r<0?t>0:t<e.length)&&Ne(e.charAt(t));)t+=r;return t}function Je(e,t,r){for(var i=t>r?-1:1;;){if(t==r)return t;var a=(t+r)/2,k=i<0?Math.ceil(a):Math.floor(a);if(k==t)return e(k)?t:r;e(k)?r=k:t=k+i}}function tt(e,t,r,i){if(!e)return i(t,r,"ltr",0);for(var a=!1,k=0;k<e.length;++k){var z=e[k];(z.from<r&&z.to>t||t==r&&z.to==t)&&(i(Math.max(z.from,t),Math.min(z.to,r),z.level==1?"rtl":"ltr",k),a=!0)}a||i(t,r,"ltr")}var et=null;function Ze(e,t,r){var i;et=null;for(var a=0;a<e.length;++a){var k=e[a];if(k.from<t&&k.to>t)return a;k.to==t&&(k.from!=k.to&&r=="before"?i=a:et=a),k.from==t&&(k.from!=k.to&&r!="before"?i=a:et=a)}return i!=null?i:et}var dt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(ee){return ee<=247?e.charAt(ee):1424<=ee&&ee<=1524?"R":1536<=ee&&ee<=1785?t.charAt(ee-1536):1774<=ee&&ee<=2220?"r":8192<=ee&&ee<=8203?"w":ee==8204?"b":"L"}var i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,a=/[stwN]/,k=/[LRr]/,z=/[Lb1n]/,$=/[1n]/;function J(ee,ce,ge){this.level=ee,this.from=ce,this.to=ge}return function(ee,ce){var ge=ce=="ltr"?"L":"R";if(ee.length==0||ce=="ltr"&&!i.test(ee))return!1;for(var Re=ee.length,Ae=[],Be=0;Be<Re;++Be)Ae.push(r(ee.charCodeAt(Be)));for(var Ke=0,Xe=ge;Ke<Re;++Ke){var rt=Ae[Ke];rt=="m"?Ae[Ke]=Xe:Xe=rt}for(var lt=0,nt=ge;lt<Re;++lt){var ht=Ae[lt];ht=="1"&&nt=="r"?Ae[lt]="n":k.test(ht)&&(nt=ht,ht=="r"&&(Ae[lt]="R"))}for(var Et=1,yt=Ae[0];Et<Re-1;++Et){var At=Ae[Et];At=="+"&&yt=="1"&&Ae[Et+1]=="1"?Ae[Et]="1":At==","&&yt==Ae[Et+1]&&(yt=="1"||yt=="n")&&(Ae[Et]=yt),yt=At}for(var Xt=0;Xt<Re;++Xt){var ci=Ae[Xt];if(ci==",")Ae[Xt]="N";else if(ci=="%"){var Jt=void 0;for(Jt=Xt+1;Jt<Re&&Ae[Jt]=="%";++Jt);for(var Fi=Xt&&Ae[Xt-1]=="!"||Jt<Re&&Ae[Jt]=="1"?"1":"N",Ii=Xt;Ii<Jt;++Ii)Ae[Ii]=Fi;Xt=Jt-1}}for(var ni=0,ki=ge;ni<Re;++ni){var gi=Ae[ni];ki=="L"&&gi=="1"?Ae[ni]="L":k.test(gi)&&(ki=gi)}for(var oi=0;oi<Re;++oi)if(a.test(Ae[oi])){var ai=void 0;for(ai=oi+1;ai<Re&&a.test(Ae[ai]);++ai);for(var ei=(oi?Ae[oi-1]:ge)=="L",Di=(ai<Re?Ae[ai]:ge)=="L",un=ei==Di?ei?"L":"R":ge,Lr=oi;Lr<ai;++Lr)Ae[Lr]=un;oi=ai-1}for(var xi=[],sr,fi=0;fi<Re;)if(z.test(Ae[fi])){var Va=fi;for(++fi;fi<Re&&z.test(Ae[fi]);++fi);xi.push(new J(0,Va,fi))}else{var cr=fi,Wr=xi.length,Gr=ce=="rtl"?1:0;for(++fi;fi<Re&&Ae[fi]!="L";++fi);for(var Ci=cr;Ci<fi;)if($.test(Ae[Ci])){cr<Ci&&(xi.splice(Wr,0,new J(1,cr,Ci)),Wr+=Gr);var hn=Ci;for(++Ci;Ci<fi&&$.test(Ae[Ci]);++Ci);xi.splice(Wr,0,new J(2,hn,Ci)),Wr+=Gr,cr=Ci}else++Ci;cr<fi&&xi.splice(Wr,0,new J(1,cr,fi))}return ce=="ltr"&&(xi[0].level==1&&(sr=ee.match(/^\s+/))&&(xi[0].from=sr[0].length,xi.unshift(new J(0,0,sr[0].length))),te(xi).level==1&&(sr=ee.match(/\s+$/))&&(te(xi).to-=sr[0].length,xi.push(new J(0,Re-sr[0].length,Re)))),ce=="rtl"?xi.reverse():xi}}();function it(e,t){var r=e.order;return r==null&&(r=e.order=dt(e.text,t)),r}var at=[],Ie=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var i=e._handlers||(e._handlers={});i[t]=(i[t]||at).concat(r)}};function st(e,t){return e._handlers&&e._handlers[t]||at}function $e(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var i=e._handlers,a=i&&i[t];if(a){var k=ie(a,r);k>-1&&(i[t]=a.slice(0,k).concat(a.slice(k+1)))}}}function De(e,t){var r=st(e,t);if(!r.length)return;for(var i=Array.prototype.slice.call(arguments,2),a=0;a<r.length;++a)r[a].apply(null,i)}function He(e,t,r){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),De(e,r||t.type,e,t),he(t)||t.codemirrorIgnore}function Ee(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),i=0;i<t.length;++i)ie(r,t[i])==-1&&r.push(t[i])}function fe(e,t){return st(e,t).length>0}function _e(e){e.prototype.on=function(t,r){Ie(this,t,r)},e.prototype.off=function(t,r){$e(this,t,r)}}function re(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ae(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function he(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ve(e){re(e),ae(e)}function be(e){return e.target||e.srcElement}function Pe(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),o&&e.ctrlKey&&t==1&&(t=3),t}var Ge=function(){if(K&&G<9)return!1;var e=u("div");return"draggable"in e||"dragDrop"in e}(),ot;function ct(e){if(ot==null){var t=u("span","\u200B");_(e,u("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ot=t.offsetWidth<=1&&t.offsetHeight>2&&!(K&&G<8))}var r=ot?u("span","\u200B"):u("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var ft;function Ct(e){if(ft!=null)return ft;var t=_(e,document.createTextNode("A\u062EA")),r=m(t,0,1).getBoundingClientRect(),i=m(t,1,2).getBoundingClientRect();return T(e),!r||r.left==r.right?!1:ft=i.right-r.right<3}var xt=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,r=[],i=e.length;t<=i;){var a=e.indexOf(`
|
|
`,t);a==-1&&(a=e.length);var k=e.slice(t,e.charAt(a-1)=="\r"?a-1:a),z=k.indexOf("\r");z!=-1?(r.push(k.slice(0,z)),t+=z+1):(r.push(k),t=a+1)}return r}:function(e){return e.split(/\r\n?|\n/)},ut=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(r){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Ut=function(){var e=u("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Mt=null;function Zt(e){if(Mt!=null)return Mt;var t=_(e,u("span","x")),r=t.getBoundingClientRect(),i=m(t,0,1).getBoundingClientRect();return Mt=Math.abs(r.left-i.left)>1}var Yt={},Rt={};function Ti(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Yt[e]=t}function Ui(e,t){Rt[e]=t}function Qe(e){if(typeof e=="string"&&Rt.hasOwnProperty(e))e=Rt[e];else if(e&&typeof e.name=="string"&&Rt.hasOwnProperty(e.name)){var t=Rt[e.name];typeof t=="string"&&(t={name:t}),e=ke(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Qe("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Qe("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function wt(e,t){t=Qe(t);var r=Yt[t.name];if(!r)return wt(e,"text/plain");var i=r(e,t);if(Ot.hasOwnProperty(t.name)){var a=Ot[t.name];for(var k in a){if(!a.hasOwnProperty(k))continue;i.hasOwnProperty(k)&&(i["_"+k]=i[k]),i[k]=a[k]}}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var z in t.modeProps)i[z]=t.modeProps[z];return i}var Ot={};function Lt(e,t){var r=Ot.hasOwnProperty(e)?Ot[e]:Ot[e]={};y(t,r)}function qt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var i in t){var a=t[i];a instanceof Array&&(a=a.concat([])),r[i]=a}return r}function qi(e,t){for(var r;e.innerMode&&!(r=e.innerMode(t),!r||r.mode==e);)t=r.state,e=r.mode;return r||{mode:e,state:t}}function er(e,t,r){return e.startState?e.startState(t,r):!0}var Bt=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};Bt.prototype.eol=function(){return this.pos>=this.string.length},Bt.prototype.sol=function(){return this.pos==this.lineStart},Bt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Bt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Bt.prototype.eat=function(e){var t=this.string.charAt(this.pos),r;if(typeof e=="string"?r=t==e:r=t&&(e.test?e.test(t):e(t)),r)return++this.pos,t},Bt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Bt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Bt.prototype.skipToEnd=function(){this.pos=this.string.length},Bt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Bt.prototype.backUp=function(e){this.pos-=e},Bt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=W(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?W(this.string,this.lineStart,this.tabSize):0)},Bt.prototype.indentation=function(){return W(this.string,null,this.tabSize)-(this.lineStart?W(this.string,this.lineStart,this.tabSize):0)},Bt.prototype.match=function(e,t,r){if(typeof e=="string"){var i=function(z){return r?z.toLowerCase():z},a=this.string.substr(this.pos,e.length);if(i(a)==i(e))return t!==!1&&(this.pos+=e.length),!0}else{var k=this.string.slice(this.pos).match(e);return k&&k.index>0?null:(k&&t!==!1&&(this.pos+=k[0].length),k)}},Bt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Bt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Bt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Bt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function pt(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 r=e;!r.lines;)for(var i=0;;++i){var a=r.children[i],k=a.chunkSize();if(t<k){r=a;break}t-=k}return r.lines[t]}function Gi(e,t,r){var i=[],a=t.line;return e.iter(t.line,r.line+1,function(k){var z=k.text;a==r.line&&(z=z.slice(0,r.ch)),a==t.line&&(z=z.slice(t.ch)),i.push(z),++a}),i}function tr(e,t,r){var i=[];return e.iter(t,r,function(a){i.push(a.text)}),i}function vi(e,t){var r=t-e.height;if(r)for(var i=e;i;i=i.parent)i.height+=r}function kt(e){if(e.parent==null)return null;for(var t=e.parent,r=ie(t.lines,e),i=t.parent;i;t=i,i=i.parent)for(var a=0;!(i.children[a]==t);++a)r+=i.children[a].chunkSize();return r+t.first}function Bi(e,t){var r=e.first;e:do{for(var i=0;i<e.children.length;++i){var a=e.children[i],k=a.height;if(t<k){e=a;continue e}t-=k,r+=a.chunkSize()}return r}while(!e.lines);for(var z=0;z<e.lines.length;++z){var $=e.lines[z],J=$.height;if(t<J)break;t-=J}return r+z}function Vi(e,t){return t>=e.first&&t<e.first+e.size}function fr(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ve(e,t,r){if(r===void 0&&(r=null),!(this instanceof Ve))return new Ve(e,t,r);this.line=e,this.ch=t,this.sticky=r}function Tt(e,t){return e.line-t.line||e.ch-t.ch}function pr(e,t){return e.sticky==t.sticky&&Tt(e,t)==0}function mr(e){return Ve(e.line,e.ch)}function gr(e,t){return Tt(e,t)<0?t:e}function vr(e,t){return Tt(e,t)<0?e:t}function X(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 Ve(e.first,0);var r=e.first+e.size-1;return t.line>r?Ve(r,pt(e,r).text.length):A(t,pt(e,t.line).text.length)}function A(e,t){var r=e.ch;return r==null||r>t?Ve(e.line,t):r<0?Ve(e.line,0):e}function U(e,t){for(var r=[],i=0;i<t.length;i++)r[i]=v(e,t[i]);return r}var q=function(e,t){this.state=e,this.lookAhead=t},V=function(e,t,r,i){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};V.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},V.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}},V.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},V.fromSaved=function(e,t,r){return t instanceof q?new V(e,qt(e.mode,t.state),r,t.lookAhead):new V(e,qt(e.mode,t),r)},V.prototype.save=function(e){var t=e!==!1?qt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new q(t,this.maxLookAhead):t};function ye(e,t,r,i){var a=[e.state.modeGen],k={};yi(e,t.text,e.doc.mode,r,function(ee,ce){return a.push(ee,ce)},k,i);for(var z=r.state,$=function(ee){r.baseTokens=a;var ce=e.state.overlays[ee],ge=1,Re=0;r.state=!0,yi(e,t.text,ce.mode,r,function(Ae,Be){for(var Ke=ge;Re<Ae;){var Xe=a[ge];Xe>Ae&&a.splice(ge,1,Ae,a[ge+1],Xe),ge+=2,Re=Math.min(Ae,Xe)}if(!Be)return;if(ce.opaque)a.splice(Ke,ge-Ke,Ae,"overlay "+Be),ge=Ke+2;else for(;Ke<ge;Ke+=2){var rt=a[Ke+1];a[Ke+1]=(rt?rt+" ":"")+"overlay "+Be}},k),r.state=z,r.baseTokens=null,r.baseTokenPos=1},J=0;J<e.state.overlays.length;++J)$(J);return{styles:a,classes:k.bgClass||k.textClass?k:null}}function We(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var i=qe(e,kt(t)),a=t.text.length>e.options.maxHighlightLength&&qt(e.doc.mode,i.state),k=ye(e,t,i);a&&(i.state=a),t.stateAfter=i.save(!a),t.styles=k.styles,k.classes?t.styleClasses=k.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function qe(e,t,r){var i=e.doc,a=e.display;if(!i.mode.startState)return new V(i,!0,t);var k=_i(e,t,r),z=k>i.first&&pt(i,k-1).stateAfter,$=z?V.fromSaved(i,z,k):new V(i,er(i.mode),k);return i.iter(k,t,function(J){mt(e,J.text,$);var ee=$.line;J.stateAfter=ee==t-1||ee%5==0||ee>=a.viewFrom&&ee<a.viewTo?$.save():null,$.nextLine()}),r&&(i.modeFrontier=$.line),$}function mt(e,t,r,i){var a=e.doc.mode,k=new Bt(t,e.options.tabSize,r);for(k.start=k.pos=i||0,t==""&&ze(a,r.state);!k.eol();)_t(a,k,r.state),k.start=k.pos}function ze(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var r=qi(e,t);if(r.mode.blankLine)return r.mode.blankLine(r.state)}function _t(e,t,r,i){for(var a=0;a<10;a++){i&&(i[0]=qi(e,r).mode);var k=e.token(t,r);if(t.pos>t.start)return k}throw new Error("Mode "+e.name+" failed to advance stream.")}var jt=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function $t(e,t,r,i){var a=e.doc,k=a.mode,z;t=v(a,t);var $=pt(a,t.line),J=qe(e,t.line,r),ee=new Bt($.text,e.options.tabSize,J),ce;for(i&&(ce=[]);(i||ee.pos<t.ch)&&!ee.eol();)ee.start=ee.pos,z=_t(k,ee,J.state),i&&ce.push(new jt(ee,z,qt(a.mode,J.state)));return i?ce:new jt(ee,z,J.state)}function Pi(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var i=r[1]?"bgClass":"textClass";t[i]==null?t[i]=r[2]:new RegExp("(?:^|\\s)"+r[2]+"(?:$|\\s)").test(t[i])||(t[i]+=" "+r[2])}return e}function yi(e,t,r,i,a,k,z){var $=r.flattenSpans;$==null&&($=e.options.flattenSpans);var J=0,ee=null,ce=new Bt(t,e.options.tabSize,i),ge,Re=e.options.addModeClass&&[null];for(t==""&&Pi(ze(r,i.state),k);!ce.eol();){if(ce.pos>e.options.maxHighlightLength?($=!1,z&&mt(e,t,i,ce.pos),ce.pos=t.length,ge=null):ge=Pi(_t(r,ce,i.state,Re),k),Re){var Ae=Re[0].name;Ae&&(ge="m-"+(ge?Ae+" "+ge:Ae))}if(!$||ee!=ge){for(;J<ce.start;)J=Math.min(ce.start,J+5e3),a(J,ee);ee=ge}ce.start=ce.pos}for(;J<ce.pos;){var Be=Math.min(ce.pos,J+5e3);a(Be,ee),J=Be}}function _i(e,t,r){for(var i,a,k=e.doc,z=r?-1:t-(e.doc.mode.innerMode?1e3:100),$=t;$>z;--$){if($<=k.first)return k.first;var J=pt(k,$-1),ee=J.stateAfter;if(ee&&(!r||$+(ee instanceof q?ee.lookAhead:0)<=k.modeFrontier))return $;var ce=W(J.text,null,e.options.tabSize);(a==null||i>ce)&&(a=$-1,i=ce)}return a}function Xi(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var r=e.first,i=t-1;i>r;i--){var a=pt(e,i).stateAfter;if(a&&(!(a instanceof q)||i+a.lookAhead<t)){r=i+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}var Ir=!1,li=!1;function ji(){Ir=!0}function or(){li=!0}function lr(e,t,r){this.marker=e,this.from=t,this.to=r}function Mi(e,t){if(e)for(var r=0;r<e.length;++r){var i=e[r];if(i.marker==t)return i}}function kr(e,t){for(var r,i=0;i<e.length;++i)e[i]!=t&&(r||(r=[])).push(e[i]);return r}function yr(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function zr(e,t,r){var i;if(e)for(var a=0;a<e.length;++a){var k=e[a],z=k.marker,$=k.from==null||(z.inclusiveLeft?k.from<=t:k.from<t);if($||k.from==t&&z.type=="bookmark"&&(!r||!k.marker.insertLeft)){var J=k.to==null||(z.inclusiveRight?k.to>=t:k.to>t);(i||(i=[])).push(new lr(z,k.from,J?null:k.to))}}return i}function Kr(e,t,r){var i;if(e)for(var a=0;a<e.length;++a){var k=e[a],z=k.marker,$=k.to==null||(z.inclusiveRight?k.to>=t:k.to>t);if($||k.from==t&&z.type=="bookmark"&&(!r||k.marker.insertLeft)){var J=k.from==null||(z.inclusiveLeft?k.from<=t:k.from<t);(i||(i=[])).push(new lr(z,J?null:k.from-t,k.to==null?null:k.to-t))}}return i}function Yi(e,t){if(t.full)return null;var r=Vi(e,t.from.line)&&pt(e,t.from.line).markedSpans,i=Vi(e,t.to.line)&&pt(e,t.to.line).markedSpans;if(!r&&!i)return null;var a=t.from.ch,k=t.to.ch,z=Tt(t.from,t.to)==0,$=zr(r,a,z),J=Kr(i,k,z),ee=t.text.length==1,ce=te(t.text).length+(ee?a:0);if($)for(var ge=0;ge<$.length;++ge){var Re=$[ge];if(Re.to==null){var Ae=Mi(J,Re.marker);Ae?ee&&(Re.to=Ae.to==null?null:Ae.to+ce):Re.to=a}}if(J)for(var Be=0;Be<J.length;++Be){var Ke=J[Be];if(Ke.to!=null&&(Ke.to+=ce),Ke.from==null){var Xe=Mi($,Ke.marker);Xe||(Ke.from=ce,ee&&($||($=[])).push(Ke))}else Ke.from+=ce,ee&&($||($=[])).push(Ke)}$&&($=zi($)),J&&J!=$&&(J=zi(J));var rt=[$];if(!ee){var lt=t.text.length-2,nt;if(lt>0&&$)for(var ht=0;ht<$.length;++ht)$[ht].to==null&&(nt||(nt=[])).push(new lr($[ht].marker,null,null));for(var Et=0;Et<lt;++Et)rt.push(nt);rt.push(J)}return rt}function zi(e){for(var t=0;t<e.length;++t){var r=e[t];r.from!=null&&r.from==r.to&&r.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function _r(e,t,r){var i=null;if(e.iter(t.line,r.line+1,function(Ae){if(Ae.markedSpans)for(var Be=0;Be<Ae.markedSpans.length;++Be){var Ke=Ae.markedSpans[Be].marker;Ke.readOnly&&(!i||ie(i,Ke)==-1)&&(i||(i=[])).push(Ke)}}),!i)return null;for(var a=[{from:t,to:r}],k=0;k<i.length;++k)for(var z=i[k],$=z.find(0),J=0;J<a.length;++J){var ee=a[J];if(Tt(ee.to,$.from)<0||Tt(ee.from,$.to)>0)continue;var ce=[J,1],ge=Tt(ee.from,$.from),Re=Tt(ee.to,$.to);(ge<0||!z.inclusiveLeft&&!ge)&&ce.push({from:ee.from,to:$.from}),(Re>0||!z.inclusiveRight&&!Re)&&ce.push({from:$.to,to:ee.to}),a.splice.apply(a,ce),J+=ce.length-3}return a}function dn(e){var t=e.markedSpans;if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}function br(e,t){if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}function ti(e){return e.inclusiveLeft?-1:0}function Ht(e){return e.inclusiveRight?1:0}function pi(e,t){var r=e.lines.length-t.lines.length;if(r!=0)return r;var i=e.find(),a=t.find(),k=Tt(i.from,a.from)||ti(e)-ti(t);if(k)return-k;var z=Tt(i.to,a.to)||Ht(e)-Ht(t);return z||t.id-e.id}function Dt(e,t){var r=li&&e.markedSpans,i;if(r)for(var a=void 0,k=0;k<r.length;++k)a=r[k],a.marker.collapsed&&(t?a.from:a.to)==null&&(!i||pi(i,a.marker)<0)&&(i=a.marker);return i}function ri(e){return Dt(e,!0)}function zt(e){return Dt(e,!1)}function ir(e,t){var r=li&&e.markedSpans,i;if(r)for(var a=0;a<r.length;++a){var k=r[a];k.marker.collapsed&&(k.from==null||k.from<t)&&(k.to==null||k.to>t)&&(!i||pi(i,k.marker)<0)&&(i=k.marker)}return i}function ui(e,t,r,i,a){var k=pt(e,t),z=li&&k.markedSpans;if(z)for(var $=0;$<z.length;++$){var J=z[$];if(!J.marker.collapsed)continue;var ee=J.marker.find(0),ce=Tt(ee.from,r)||ti(J.marker)-ti(a),ge=Tt(ee.to,i)||Ht(J.marker)-Ht(a);if(ce>=0&&ge<=0||ce<=0&&ge>=0)continue;if(ce<=0&&(J.marker.inclusiveRight&&a.inclusiveLeft?Tt(ee.to,r)>=0:Tt(ee.to,r)>0)||ce>=0&&(J.marker.inclusiveRight&&a.inclusiveLeft?Tt(ee.from,i)<=0:Tt(ee.from,i)<0))return!0}}function wi(e){for(var t;t=ri(e);)e=t.find(-1,!0).line;return e}function Vr(e){for(var t;t=zt(e);)e=t.find(1,!0).line;return e}function Er(e){for(var t,r;t=zt(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function cn(e,t){var r=pt(e,t),i=wi(r);return r==i?t:kt(i)}function xr(e,t){if(t>e.lastLine())return t;var r=pt(e,t),i;if(!rr(e,r))return t;for(;i=zt(r);)r=i.find(1,!0).line;return kt(r)+1}function rr(e,t){var r=li&&t.markedSpans;if(r)for(var i=void 0,a=0;a<r.length;++a){if(i=r[a],!i.marker.collapsed)continue;if(i.from==null)return!0;if(i.marker.widgetNode)continue;if(i.from==0&&i.marker.inclusiveLeft&&fn(e,t,i))return!0}}function fn(e,t,r){if(r.to==null){var i=r.marker.find(1,!0);return fn(e,i.line,Mi(i.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var a=void 0,k=0;k<t.markedSpans.length;++k)if(a=t.markedSpans[k],a.marker.collapsed&&!a.marker.widgetNode&&a.from==r.to&&(a.to==null||a.to!=r.from)&&(a.marker.inclusiveLeft||r.marker.inclusiveRight)&&fn(e,t,a))return!0}function $i(e){e=wi(e);for(var t=0,r=e.parent,i=0;i<r.lines.length;++i){var a=r.lines[i];if(a==e)break;t+=a.height}for(var k=r.parent;k;r=k,k=r.parent)for(var z=0;z<k.children.length;++z){var $=k.children[z];if($==r)break;t+=$.height}return t}function pn(e){if(e.height==0)return 0;for(var t=e.text.length,r,i=e;r=ri(i);){var a=r.find(0,!0);i=a.from.line,t+=a.from.ch-a.to.ch}for(i=e;r=zt(i);){var k=r.find(0,!0);t-=i.text.length-k.from.ch,i=k.to.line,t+=i.text.length-k.to.ch}return t}function jn(e){var t=e.display,r=e.doc;t.maxLine=pt(r,r.first),t.maxLineLength=pn(t.maxLine),t.maxLineChanged=!0,r.iter(function(i){var a=pn(i);a>t.maxLineLength&&(t.maxLineLength=a,t.maxLine=i)})}var Dr=function(e,t,r){this.text=e,br(this,t),this.height=r?r(this):1};Dr.prototype.lineNo=function(){return kt(this)},_e(Dr);function ua(e,t,r,i){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),dn(e),br(e,r);var a=i?i(e):1;a!=e.height&&vi(e,a)}function vt(e){e.parent=null,dn(e)}var St={},bt={};function It(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?bt:St;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Ft(e,t){var r=E("span",null,null,M?"padding-right: .1px":null),i={pre:E("pre",[r],"CodeMirror-line"),content:r,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 k=a?t.rest[a-1]:t.line,z=void 0;i.pos=0,i.addToken=Nt,Ct(e.display.measure)&&(z=it(k,e.doc.direction))&&(i.addToken=Ai(i.addToken,z)),i.map=[];var $=t!=e.display.externalMeasured&&kt(k);ur(k,i,We(e,k,$)),k.styleClasses&&(k.styleClasses.bgClass&&(i.bgClass=H(k.styleClasses.bgClass,i.bgClass||"")),k.styleClasses.textClass&&(i.textClass=H(k.styleClasses.textClass,i.textClass||""))),i.map.length==0&&i.map.push(0,0,i.content.appendChild(ct(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(M){var J=i.content.lastChild;(/\bcm-tab\b/.test(J.className)||J.querySelector&&J.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return De(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=H(i.pre.className,i.textClass||"")),i}function Vt(e){var t=u("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Nt(e,t,r,i,a,k,z){if(!t)return;var $=e.splitSpaces?si(t,e.trailingSpace):t,J=e.cm.state.specialChars,ee=!1,ce;if(!J.test(t))e.col+=t.length,ce=document.createTextNode($),e.map.push(e.pos,e.pos+t.length,ce),K&&G<9&&(ee=!0),e.pos+=t.length;else{ce=document.createDocumentFragment();for(var ge=0;;){J.lastIndex=ge;var Re=J.exec(t),Ae=Re?Re.index-ge:t.length-ge;if(Ae){var Be=document.createTextNode($.slice(ge,ge+Ae));K&&G<9?ce.appendChild(u("span",[Be])):ce.appendChild(Be),e.map.push(e.pos,e.pos+Ae,Be),e.col+=Ae,e.pos+=Ae}if(!Re)break;ge+=Ae+1;var Ke=void 0;if(Re[0]==" "){var Xe=e.cm.options.tabSize,rt=Xe-e.col%Xe;Ke=ce.appendChild(u("span",le(rt),"cm-tab")),Ke.setAttribute("role","presentation"),Ke.setAttribute("cm-text"," "),e.col+=rt}else Re[0]=="\r"||Re[0]==`
|
|
`?(Ke=ce.appendChild(u("span",Re[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ke.setAttribute("cm-text",Re[0]),e.col+=1):(Ke=e.cm.options.specialCharPlaceholder(Re[0]),Ke.setAttribute("cm-text",Re[0]),K&&G<9?ce.appendChild(u("span",[Ke])):ce.appendChild(Ke),e.col+=1);e.map.push(e.pos,e.pos+1,Ke),e.pos++}}if(e.trailingSpace=$.charCodeAt(t.length-1)==32,r||i||a||ee||k||z){var lt=r||"";i&&(lt+=i),a&&(lt+=a);var nt=u("span",[ce],lt,k);if(z)for(var ht in z)z.hasOwnProperty(ht)&&ht!="style"&&ht!="class"&&nt.setAttribute(ht,z[ht]);return e.content.appendChild(nt)}e.content.appendChild(ce)}function si(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,i="",a=0;a<e.length;a++){var k=e.charAt(a);k==" "&&r&&(a==e.length-1||e.charCodeAt(a+1)==32)&&(k="\xA0"),i+=k,r=k==" "}return i}function Ai(e,t){return function(r,i,a,k,z,$,J){a=a?a+" cm-force-border":"cm-force-border";for(var ee=r.pos,ce=ee+i.length;;){for(var ge=void 0,Re=0;Re<t.length&&!(ge=t[Re],ge.to>ee&&ge.from<=ee);Re++);if(ge.to>=ce)return e(r,i,a,k,z,$,J);e(r,i.slice(0,ge.to-ee),a,k,null,$,J),k=null,i=i.slice(ge.to-ee),ee=ge.to}}}function Pt(e,t,r,i){var a=!i&&r.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",r.id)),a&&(e.cm.display.input.setUneditable(a),e.content.appendChild(a)),e.pos+=t,e.trailingSpace=!1}function ur(e,t,r){var i=e.markedSpans,a=e.text,k=0;if(!i){for(var z=1;z<r.length;z+=2)t.addToken(t,a.slice(k,k=r[z]),It(r[z+1],t.cm.options));return}for(var $=a.length,J=0,ee=1,ce="",ge,Re,Ae=0,Be,Ke,Xe,rt,lt;;){if(Ae==J){Be=Ke=Xe=Re="",lt=null,rt=null,Ae=Infinity;for(var nt=[],ht=void 0,Et=0;Et<i.length;++Et){var yt=i[Et],At=yt.marker;if(At.type=="bookmark"&&yt.from==J&&At.widgetNode)nt.push(At);else if(yt.from<=J&&(yt.to==null||yt.to>J||At.collapsed&&yt.to==J&&yt.from==J)){if(yt.to!=null&&yt.to!=J&&Ae>yt.to&&(Ae=yt.to,Ke=""),At.className&&(Be+=" "+At.className),At.css&&(Re=(Re?Re+";":"")+At.css),At.startStyle&&yt.from==J&&(Xe+=" "+At.startStyle),At.endStyle&&yt.to==Ae&&(ht||(ht=[])).push(At.endStyle,yt.to),At.title&&((lt||(lt={})).title=At.title),At.attributes)for(var Xt in At.attributes)(lt||(lt={}))[Xt]=At.attributes[Xt];At.collapsed&&(!rt||pi(rt.marker,At)<0)&&(rt=yt)}else yt.from>J&&Ae>yt.from&&(Ae=yt.from)}if(ht)for(var ci=0;ci<ht.length;ci+=2)ht[ci+1]==Ae&&(Ke+=" "+ht[ci]);if(!rt||rt.from==J)for(var Jt=0;Jt<nt.length;++Jt)Pt(t,0,nt[Jt]);if(rt&&(rt.from||0)==J){if(Pt(t,(rt.to==null?$+1:rt.to)-J,rt.marker,rt.from==null),rt.to==null)return;rt.to==J&&(rt=!1)}}if(J>=$)break;for(var Fi=Math.min($,Ae);;){if(ce){var Ii=J+ce.length;if(!rt){var ni=Ii>Fi?ce.slice(0,Fi-J):ce;t.addToken(t,ni,ge?ge+Be:Be,Xe,J+ni.length==Ae?Ke:"",Re,lt)}if(Ii>=Fi){ce=ce.slice(Fi-J),J=Fi;break}J=Ii,Xe=""}ce=a.slice(k,k=r[ee++]),ge=It(r[ee++],t.cm.options)}}}function Wt(e,t,r){this.line=t,this.rest=Er(t),this.size=this.rest?kt(te(this.rest))-r+1:1,this.node=this.text=null,this.hidden=rr(e,t)}function Oi(e,t,r){for(var i=[],a,k=t;k<r;k=a){var z=new Wt(e.doc,pt(e.doc,k),k);a=k+z.size,i.push(z)}return i}var bi=null;function Ki(e){bi?bi.ops.push(e):e.ownsGroup=bi={ops:[e],delayedCallbacks:[]}}function Lo(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].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(r<t.length)}function Io(e,t){var r=e.ownsGroup;if(!r)return;try{Lo(r)}finally{bi=null,t(r)}}var mn=null;function mi(e,t){var r=st(e,t);if(!r.length)return;var i=Array.prototype.slice.call(arguments,2),a;bi?a=bi.delayedCallbacks:mn?a=mn:(a=mn=[],setTimeout(ko,0));for(var k=function($){a.push(function(){return r[$].apply(null,i)})},z=0;z<r.length;++z)k(z)}function ko(){var e=mn;mn=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,r,i){for(var a=0;a<t.changes.length;a++){var k=t.changes[a];k=="text"?Po(e,t):k=="gutter"?Qa(e,t,r,i):k=="class"?ha(e,t):k=="widget"&&Mo(e,t,i)}t.changes=null}function gn(e){return e.node==e.text&&(e.node=u("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),K&&G<8&&(e.node.style.zIndex=2)),e.node}function Do(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var i=gn(t);t.background=i.insertBefore(u("div",null,r),i.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Ft(e,t)}function Po(e,t){var r=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)):r&&(t.text.className=r)}function ha(e,t){Do(e,t),t.line.wrapClass?gn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function Qa(e,t,r,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=gn(t);t.gutterBackground=u("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 k=t.line.gutterMarkers;if(e.options.lineNumbers||k){var z=gn(t),$=t.gutter=u("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(e.display.input.setUneditable($),z.insertBefore($,t.text),t.line.gutterClass&&($.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!k||!k["CodeMirror-linenumbers"])&&(t.lineNumber=$.appendChild(u("div",fr(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),k)for(var J=0;J<e.display.gutterSpecs.length;++J){var ee=e.display.gutterSpecs[J].className,ce=k.hasOwnProperty(ee)&&k[ee];ce&&$.appendChild(u("div",[ce],"CodeMirror-gutter-elt","left: "+i.gutterLeft[ee]+"px; width: "+i.gutterWidth[ee]+"px"))}}}function Mo(e,t,r){t.alignable&&(t.alignable=null);for(var i=C("CodeMirror-linewidget"),a=t.node.firstChild,k=void 0;a;a=k)k=a.nextSibling,i.test(a.className)&&t.node.removeChild(a);Za(e,t,r)}function No(e,t,r,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,r,i),Za(e,t,i),t.node}function Za(e,t,r){if(Ja(e,t.line,t,r,!0),t.rest)for(var i=0;i<t.rest.length;i++)Ja(e,t.rest[i],t,r,!1)}function Ja(e,t,r,i,a){if(!t.widgets)return;for(var k=gn(r),z=0,$=t.widgets;z<$.length;++z){var J=$[z],ee=u("div",[J.node],"CodeMirror-linewidget"+(J.className?" "+J.className:""));J.handleMouseEvents||ee.setAttribute("cm-ignore-events","true"),Fo(J,ee,r,i),e.display.input.setUneditable(ee),a&&J.above?k.insertBefore(ee,r.gutter||r.text):k.appendChild(ee),mi(J,"redraw")}}function Fo(e,t,r,i){if(e.noHScroll){(r.alignable||(r.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 vn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!b(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),_(t.display.measure,u("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function hr(e,t){for(var r=be(t);r!=e.wrapper;r=r.parentNode)if(!r||r.nodeType==1&&r.getAttribute("cm-ignore-events")=="true"||r.parentNode==e.sizer&&r!=e.mover)return!0}function Hn(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=_(e.measure,u("pre","x","CodeMirror-line-like")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,i={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return!isNaN(i.left)&&!isNaN(i.right)&&(e.cachedPaddingH=i),i}function nr(e){return oe-e.display.nativeBarWidth}function Pr(e){return e.display.scroller.clientWidth-nr(e)-e.display.barWidth}function ca(e){return e.display.scroller.clientHeight-nr(e)-e.display.barHeight}function Uo(e,t,r){var i=e.options.lineWrapping,a=i&&Pr(e);if(!t.measure.heights||i&&t.measure.width!=a){var k=t.measure.heights=[];if(i){t.measure.width=a;for(var z=t.text.firstChild.getClientRects(),$=0;$<z.length-1;$++){var J=z[$],ee=z[$+1];Math.abs(J.bottom-ee.bottom)>2&&k.push((J.bottom+ee.top)/2-r.top)}}k.push(r.bottom-r.top)}}function es(e,t,r){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(kt(e.rest[a])>r)return{map:e.measure.maps[a],cache:e.measure.caches[a],before:!0}}function Bo(e,t){t=wi(t);var r=kt(t),i=e.display.externalMeasured=new Wt(e.doc,t,r);i.lineN=r;var a=i.built=Ft(e,i);return i.text=a.pre,_(e.display.lineMeasure,a.pre),i}function ts(e,t,r,i){return ar(e,Xr(e,t),r,i)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Fr(e,t)];var r=e.display.externalMeasured;if(r&&t>=r.lineN&&t<r.lineN+r.size)return r}function Xr(e,t){var r=kt(t),i=fa(e,r);i&&!i.text?i=null:i&&i.changes&&(Ya(e,i,r,_a(e)),e.curOp.forceUpdate=!0),i||(i=Bo(e,t));var a=es(i,t,r);return{line:t,view:i,rect:null,map:a.map,cache:a.cache,before:a.before,hasHeights:!1}}function ar(e,t,r,i,a){t.before&&(r=-1);var k=r+(i||""),z;return t.cache.hasOwnProperty(k)?z=t.cache[k]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Uo(e,t.view,t.rect),t.hasHeights=!0),z=Ho(e,t,r,i),z.bogus||(t.cache[k]=z)),{left:z.left,right:z.right,top:a?z.rtop:z.top,bottom:a?z.rbottom:z.bottom}}var is={left:0,right:0,top:0,bottom:0};function rs(e,t,r){for(var i,a,k,z,$,J,ee=0;ee<e.length;ee+=3)if($=e[ee],J=e[ee+1],t<$?(a=0,k=1,z="left"):t<J?(a=t-$,k=a+1):(ee==e.length-3||t==J&&e[ee+3]>t)&&(k=J-$,a=k-1,t>=J&&(z="right")),a!=null){if(i=e[ee+2],$==J&&r==(i.insertLeft?"left":"right")&&(z=r),r=="left"&&a==0)for(;ee&&e[ee-2]==e[ee-3]&&e[ee-1].insertLeft;)i=e[(ee-=3)+2],z="left";if(r=="right"&&a==J-$)for(;ee<e.length-3&&e[ee+3]==e[ee+4]&&!e[ee+5].insertLeft;)i=e[(ee+=3)+2],z="right";break}return{node:i,start:a,end:k,collapse:z,coverStart:$,coverEnd:J}}function jo(e,t){var r=is;if(t=="left")for(var i=0;i<e.length&&!((r=e[i]).left!=r.right);i++);else for(var a=e.length-1;a>=0&&!((r=e[a]).left!=r.right);a--);return r}function Ho(e,t,r,i){var a=rs(t.map,r,i),k=a.node,z=a.start,$=a.end,J=a.collapse,ee;if(k.nodeType==3){for(var ce=0;ce<4;ce++){for(;z&&Ne(t.line.text.charAt(a.coverStart+z));)--z;for(;a.coverStart+$<a.coverEnd&&Ne(t.line.text.charAt(a.coverStart+$));)++$;if(K&&G<9&&z==0&&$==a.coverEnd-a.coverStart?ee=k.parentNode.getBoundingClientRect():ee=jo(m(k,z,$).getClientRects(),i),ee.left||ee.right||z==0)break;$=z,z=z-1,J="right"}K&&G<11&&(ee=Wo(e.display.measure,ee))}else{z>0&&(J=i="right");var ge;e.options.lineWrapping&&(ge=k.getClientRects()).length>1?ee=ge[i=="right"?ge.length-1:0]:ee=k.getBoundingClientRect()}if(K&&G<9&&!z&&(!ee||!ee.left&&!ee.right)){var Re=k.parentNode.getClientRects()[0];Re?ee={left:Re.left,right:Re.left+$r(e.display),top:Re.top,bottom:Re.bottom}:ee=is}for(var Ae=ee.top-t.rect.top,Be=ee.bottom-t.rect.top,Ke=(Ae+Be)/2,Xe=t.view.measure.heights,rt=0;rt<Xe.length-1&&!(Ke<Xe[rt]);rt++);var lt=rt?Xe[rt-1]:0,nt=Xe[rt],ht={left:(J=="right"?ee.right:ee.left)-t.rect.left,right:(J=="left"?ee.left:ee.right)-t.rect.left,top:lt,bottom:nt};return!ee.left&&!ee.right&&(ht.bogus=!0),e.options.singleCursorHeightPerLine||(ht.rtop=Ae,ht.rbottom=Be),ht}function Wo(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Zt(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*i,bottom:t.bottom*i}}function ns(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,T(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)ns(e.display.view[t])}function yn(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 g&&l?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function os(){return g&&l?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=vn(e.widgets[r]));return t}function Wn(e,t,r,i,a){if(!a){var k=pa(t);r.top+=k,r.bottom+=k}if(i=="line")return r;i||(i="local");var z=$i(t);if(i=="local"?z+=Hn(e.display):z-=e.display.viewOffset,i=="page"||i=="window"){var $=e.display.lineSpace.getBoundingClientRect();z+=$.top+(i=="window"?0:os());var J=$.left+(i=="window"?0:ss());r.left+=J,r.right+=J}return r.top+=z,r.bottom+=z,r}function ls(e,t,r){if(r=="div")return t;var i=t.left,a=t.top;if(r=="page")i-=ss(),a-=os();else if(r=="local"||!r){var k=e.display.sizer.getBoundingClientRect();i+=k.left,a+=k.top}var z=e.display.lineSpace.getBoundingClientRect();return{left:i-z.left,top:a-z.top}}function ma(e,t,r,i,a){return i||(i=pt(e.doc,t.line)),Wn(e,i,ts(e,i,t.ch,a),r)}function Qi(e,t,r,i,a,k){i=i||pt(e.doc,t.line),a||(a=Xr(e,i));function z(Be,Ke){var Xe=ar(e,a,Be,Ke?"right":"left",k);return Ke?Xe.left=Xe.right:Xe.right=Xe.left,Wn(e,i,Xe,r)}var $=it(i,e.doc.direction),J=t.ch,ee=t.sticky;if(J>=i.text.length?(J=i.text.length,ee="before"):J<=0&&(J=0,ee="after"),!$)return z(ee=="before"?J-1:J,ee=="before");function ce(Be,Ke,Xe){var rt=$[Ke],lt=rt.level==1;return z(Xe?Be-1:Be,lt!=Xe)}var ge=Ze($,J,ee),Re=et,Ae=ce(J,ge,ee=="before");return Re!=null&&(Ae.other=ce(J,Re,ee!="before")),Ae}function us(e,t){var r=0;t=v(e.doc,t),e.options.lineWrapping||(r=$r(e.display)*t.ch);var i=pt(e.doc,t.line),a=$i(i)+Hn(e.display);return{left:r,right:r,top:a,bottom:a+i.height}}function ga(e,t,r,i,a){var k=Ve(e,t,r);return k.xRel=a,i&&(k.outside=i),k}function va(e,t,r){var i=e.doc;if(r+=e.display.viewOffset,r<0)return ga(i.first,0,null,-1,-1);var a=Bi(i,r),k=i.first+i.size-1;if(a>k)return ga(i.first+i.size-1,pt(i,k).text.length,null,1,1);t<0&&(t=0);for(var z=pt(i,a);;){var $=Go(e,z,a,t,r),J=ir(z,$.ch+($.xRel>0||$.outside>0?1:0));if(!J)return $;var ee=J.find(1);if(ee.line==a)return ee;z=pt(i,a=ee.line)}}function hs(e,t,r,i){i-=pa(t);var a=t.text.length,k=Je(function(z){return ar(e,r,z-1).bottom<=i},a,0);return a=Je(function(z){return ar(e,r,z).top>i},k,a),{begin:k,end:a}}function ds(e,t,r,i){r||(r=Xr(e,t));var a=Wn(e,t,ar(e,r,i),"line").top;return hs(e,t,r,a)}function ya(e,t,r,i){return e.bottom<=r?!1:e.top>r?!0:(i?e.left:e.right)>t}function Go(e,t,r,i,a){a-=$i(t);var k=Xr(e,t),z=pa(t),$=0,J=t.text.length,ee=!0,ce=it(t,e.doc.direction);if(ce){var ge=(e.options.lineWrapping?Ko:zo)(e,t,r,k,ce,i,a);ee=ge.level!=1,$=ee?ge.from:ge.to-1,J=ee?ge.to:ge.from-1}var Re=null,Ae=null,Be=Je(function(Et){var yt=ar(e,k,Et);return yt.top+=z,yt.bottom+=z,ya(yt,i,a,!1)?(yt.top<=a&&yt.left<=i&&(Re=Et,Ae=yt),!0):!1},$,J),Ke,Xe,rt=!1;if(Ae){var lt=i-Ae.left<Ae.right-i,nt=lt==ee;Be=Re+(nt?0:1),Xe=nt?"after":"before",Ke=lt?Ae.left:Ae.right}else{!ee&&(Be==J||Be==$)&&Be++,Xe=Be==0?"after":Be==t.text.length?"before":ar(e,k,Be-(ee?1:0)).bottom+z<=a==ee?"after":"before";var ht=Qi(e,Ve(r,Be,Xe),"line",t,k);Ke=ht.left,rt=a<ht.top?-1:a>=ht.bottom?1:0}return Be=Ue(t.text,Be,1),ga(r,Be,Xe,rt,i-Ke)}function zo(e,t,r,i,a,k,z){var $=Je(function(ge){var Re=a[ge],Ae=Re.level!=1;return ya(Qi(e,Ve(r,Ae?Re.to:Re.from,Ae?"before":"after"),"line",t,i),k,z,!0)},0,a.length-1),J=a[$];if($>0){var ee=J.level!=1,ce=Qi(e,Ve(r,ee?J.from:J.to,ee?"after":"before"),"line",t,i);ya(ce,k,z,!0)&&ce.top>z&&(J=a[$-1])}return J}function Ko(e,t,r,i,a,k,z){var $=hs(e,t,i,z),J=$.begin,ee=$.end;/\s/.test(t.text.charAt(ee-1))&&ee--;for(var ce=null,ge=null,Re=0;Re<a.length;Re++){var Ae=a[Re];if(Ae.from>=ee||Ae.to<=J)continue;var Be=Ae.level!=1,Ke=ar(e,i,Be?Math.min(ee,Ae.to)-1:Math.max(J,Ae.from)).right,Xe=Ke<k?k-Ke+1e9:Ke-k;(!ce||ge>Xe)&&(ce=Ae,ge=Xe)}return ce||(ce=a[a.length-1]),ce.from<J&&(ce={from:J,to:ce.to,level:ce.level}),ce.to>ee&&(ce={from:ce.from,to:ee,level:ce.level}),ce}var Mr;function Yr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Mr==null){Mr=u("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Mr.appendChild(document.createTextNode("x")),Mr.appendChild(u("br"));Mr.appendChild(document.createTextNode("x"))}_(e.measure,Mr);var r=Mr.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),T(e.measure),r||1}function $r(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=u("span","xxxxxxxxxx"),r=u("pre",[t],"CodeMirror-line-like");_(e.measure,r);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,r={},i={},a=t.gutters.clientLeft,k=t.gutters.firstChild,z=0;k;k=k.nextSibling,++z){var $=e.display.gutterSpecs[z].className;r[$]=k.offsetLeft+k.clientLeft+a,i[$]=k.clientWidth}return{fixedPos:ba(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function ba(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function cs(e){var t=Yr(e.display),r=e.options.lineWrapping,i=r&&Math.max(5,e.display.scroller.clientWidth/$r(e.display)-3);return function(a){if(rr(e.doc,a))return 0;var k=0;if(a.widgets)for(var z=0;z<a.widgets.length;z++)a.widgets[z].height&&(k+=a.widgets[z].height);return r?k+(Math.ceil(a.text.length/i)||1)*t:k+t}}function Ea(e){var t=e.doc,r=cs(e);t.iter(function(i){var a=r(i);a!=i.height&&vi(i,a)})}function Nr(e,t,r,i){var a=e.display;if(!r&&be(t).getAttribute("cm-not-content")=="true")return null;var k,z,$=a.lineSpace.getBoundingClientRect();try{k=t.clientX-$.left,z=t.clientY-$.top}catch(ge){return null}var J=va(e,k,z),ee;if(i&&J.xRel>0&&(ee=pt(e.doc,J.line).text).length==J.ch){var ce=W(ee,ee.length,e.options.tabSize)-ee.length;J=Ve(J.line,Math.max(0,Math.round((k-qa(e.display).left)/$r(e.display))-ce))}return J}function Fr(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var r=e.display.view,i=0;i<r.length;i++)if(t-=r[i].size,t<0)return i}function Ri(e,t,r,i){t==null&&(t=e.doc.first),r==null&&(r=e.doc.first+e.doc.size),i||(i=0);var a=e.display;if(i&&r<a.viewTo&&(a.updateLineNumbers==null||a.updateLineNumbers>t)&&(a.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=a.viewTo)li&&cn(e.doc,t)<a.viewTo&&wr(e);else if(r<=a.viewFrom)li&&xr(e.doc,r+i)>a.viewFrom?wr(e):(a.viewFrom+=i,a.viewTo+=i);else if(t<=a.viewFrom&&r>=a.viewTo)wr(e);else if(t<=a.viewFrom){var k=Gn(e,r,r+i,1);k?(a.view=a.view.slice(k.index),a.viewFrom=k.lineN,a.viewTo+=i):wr(e)}else if(r>=a.viewTo){var z=Gn(e,t,t,-1);z?(a.view=a.view.slice(0,z.index),a.viewTo=z.lineN):wr(e)}else{var $=Gn(e,t,t,-1),J=Gn(e,r,r+i,1);$&&J?(a.view=a.view.slice(0,$.index).concat(Oi(e,$.lineN,J.lineN)).concat(a.view.slice(J.index)),a.viewTo+=i):wr(e)}var ee=a.externalMeasured;ee&&(r<ee.lineN?ee.lineN+=i:t<ee.lineN+ee.size&&(a.externalMeasured=null))}function Tr(e,t,r){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 k=i.view[Fr(e,t)];if(k.node==null)return;var z=k.changes||(k.changes=[]);ie(z,r)==-1&&z.push(r)}function wr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Gn(e,t,r,i){var a=Fr(e,t),k,z=e.display.view;if(!li||r==e.doc.first+e.doc.size)return{index:a,lineN:r};for(var $=e.display.viewFrom,J=0;J<a;J++)$+=z[J].size;if($!=t){if(i>0){if(a==z.length-1)return null;k=$+z[a].size-t,a++}else k=$-t;t+=k,r+=k}for(;cn(e.doc,r)!=r;){if(a==(i<0?0:z.length-1))return null;r+=i*z[a-(i<0?1:0)].size,a+=i}return{index:a,lineN:r}}function Vo(e,t,r){var i=e.display,a=i.view;a.length==0||t>=i.viewTo||r<=i.viewFrom?(i.view=Oi(e,t,r),i.viewFrom=t):(i.viewFrom>t?i.view=Oi(e,t,i.viewFrom).concat(i.view):i.viewFrom<t&&(i.view=i.view.slice(Fr(e,t))),i.viewFrom=t,i.viewTo<r?i.view=i.view.concat(Oi(e,i.viewTo,r)):i.viewTo>r&&(i.view=i.view.slice(0,Fr(e,r)))),i.viewTo=r}function fs(e){for(var t=e.display.view,r=0,i=0;i<t.length;i++){var a=t[i];!a.hidden&&(!a.node||a.changes)&&++r}return r}function _n(e){e.display.input.showSelection(e.display.input.prepareSelection())}function ps(e,t){t===void 0&&(t=!0);for(var r=e.doc,i={},a=i.cursors=document.createDocumentFragment(),k=i.selection=document.createDocumentFragment(),z=0;z<r.sel.ranges.length;z++){if(!t&&z==r.sel.primIndex)continue;var $=r.sel.ranges[z];if($.from().line>=e.display.viewTo||$.to().line<e.display.viewFrom)continue;var J=$.empty();(J||e.options.showCursorWhenSelecting)&&ms(e,$.head,a),J||Xo(e,$,k)}return i}function ms(e,t,r){var i=Qi(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),a=r.appendChild(u("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 k=r.appendChild(u("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));k.style.display="",k.style.left=i.other.left+"px",k.style.top=i.other.top+"px",k.style.height=(i.other.bottom-i.other.top)*.85+"px"}}function zn(e,t){return e.top-t.top||e.left-t.left}function Xo(e,t,r){var i=e.display,a=e.doc,k=document.createDocumentFragment(),z=qa(e.display),$=z.left,J=Math.max(i.sizerWidth,Pr(e)-i.sizer.offsetLeft)-z.right,ee=a.direction=="ltr";function ce(nt,ht,Et,yt){ht<0&&(ht=0),ht=Math.round(ht),yt=Math.round(yt),k.appendChild(u("div",null,"CodeMirror-selected","position: absolute; left: "+nt+`px;
|
|
top: `+ht+"px; width: "+(Et==null?J-nt:Et)+`px;
|
|
height: `+(yt-ht)+"px"))}function ge(nt,ht,Et){var yt=pt(a,nt),At=yt.text.length,Xt,ci;function Jt(ni,ki){return ma(e,Ve(nt,ni),"div",yt,ki)}function Fi(ni,ki,gi){var oi=ds(e,yt,null,ni),ai=ki=="ltr"==(gi=="after")?"left":"right",ei=gi=="after"?oi.begin:oi.end-(/\s/.test(yt.text.charAt(oi.end-1))?2:1);return Jt(ei,ai)[ai]}var Ii=it(yt,a.direction);return tt(Ii,ht||0,Et==null?At:Et,function(ni,ki,gi,oi){var ai=gi=="ltr",ei=Jt(ni,ai?"left":"right"),Di=Jt(ki-1,ai?"right":"left"),un=ht==null&&ni==0,Lr=Et==null&&ki==At,xi=oi==0,sr=!Ii||oi==Ii.length-1;if(Di.top-ei.top<=3){var fi=(ee?un:Lr)&&xi,Va=(ee?Lr:un)&&sr,cr=fi?$:(ai?ei:Di).left,Wr=Va?J:(ai?Di:ei).right;ce(cr,ei.top,Wr-cr,ei.bottom)}else{var Gr,Ci,hn,Xa;ai?(Gr=ee&&un&&xi?$:ei.left,Ci=ee?J:Fi(ni,gi,"before"),hn=ee?$:Fi(ki,gi,"after"),Xa=ee&&Lr&&sr?J:Di.right):(Gr=ee?Fi(ni,gi,"before"):$,Ci=!ee&&un&&xi?J:ei.right,hn=!ee&&Lr&&sr?$:Di.left,Xa=ee?Fi(ki,gi,"after"):J),ce(Gr,ei.top,Ci-Gr,ei.bottom),ei.bottom<Di.top&&ce($,ei.bottom,null,Di.top),ce(hn,Di.top,Xa-hn,Di.bottom)}(!Xt||zn(ei,Xt)<0)&&(Xt=ei),zn(Di,Xt)<0&&(Xt=Di),(!ci||zn(ei,ci)<0)&&(ci=ei),zn(Di,ci)<0&&(ci=Di)}),{start:Xt,end:ci}}var Re=t.from(),Ae=t.to();if(Re.line==Ae.line)ge(Re.line,Re.ch,Ae.ch);else{var Be=pt(a,Re.line),Ke=pt(a,Ae.line),Xe=wi(Be)==wi(Ke),rt=ge(Re.line,Re.ch,Xe?Be.text.length+1:null).end,lt=ge(Ae.line,Xe?0:null,Ae.ch).start;Xe&&(rt.top<lt.top-2?(ce(rt.right,rt.top,null,rt.bottom),ce($,lt.top,lt.left,lt.bottom)):ce(rt.right,rt.top,lt.left-rt.right,rt.bottom)),rt.bottom<lt.top&&ce($,rt.bottom,null,lt.top)}r.appendChild(k)}function xa(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Qr(e),t.cursorDiv.style.visibility=(r=!r)?"":"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,Qr(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(De(e,"focus",e,t),e.state.focused=!0,D(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),M&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),xa(e)}function Qr(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(De(e,"blur",e,t),e.state.focused=!1,w(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Kn(e){for(var t=e.display,r=t.lineDiv.offsetTop,i=0;i<t.view.length;i++){var a=t.view[i],k=e.options.lineWrapping,z=void 0,$=0;if(a.hidden)continue;if(K&&G<8){var J=a.node.offsetTop+a.node.offsetHeight;z=J-r,r=J}else{var ee=a.node.getBoundingClientRect();z=ee.bottom-ee.top,!k&&a.text.firstChild&&($=a.text.firstChild.getBoundingClientRect().right-ee.left-1)}var ce=a.line.height-z;if((ce>.005||ce<-.005)&&(vi(a.line,z),ys(a.line),a.rest))for(var ge=0;ge<a.rest.length;ge++)ys(a.rest[ge]);if($>e.display.sizerWidth){var Re=Math.ceil($/$r(e.display));Re>e.display.maxLineLength&&(e.display.maxLineLength=Re,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 r=e.widgets[t],i=r.node.parentNode;i&&(r.height=i.offsetHeight)}}function Vn(e,t,r){var i=r&&r.top!=null?Math.max(0,r.top):e.scroller.scrollTop;i=Math.floor(i-Hn(e));var a=r&&r.bottom!=null?r.bottom:i+e.wrapper.clientHeight,k=Bi(t,i),z=Bi(t,a);if(r&&r.ensure){var $=r.ensure.from.line,J=r.ensure.to.line;$<k?(k=$,z=Bi(t,$i(pt(t,$))+e.wrapper.clientHeight)):Math.min(J,t.lastLine())>=z&&(k=Bi(t,$i(pt(t,J))-e.wrapper.clientHeight),z=J)}return{from:k,to:Math.max(z,k+1)}}function Yo(e,t){if(He(e,"scrollCursorIntoView"))return;var r=e.display,i=r.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&&!s){var k=u("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-r.viewOffset-Hn(e.display))+`px;
|
|
height: `+(t.bottom-t.top+nr(e)+r.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(k),k.scrollIntoView(a),e.display.lineSpace.removeChild(k)}}function $o(e,t,r,i){i==null&&(i=0);var a;!e.options.lineWrapping&&t==r&&(t=t.ch?Ve(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,r=t.sticky=="before"?Ve(t.line,t.ch+1,"before"):t);for(var k=0;k<5;k++){var z=!1,$=Qi(e,t),J=!r||r==t?$:Qi(e,r);a={left:Math.min($.left,J.left),top:Math.min($.top,J.top)-i,right:Math.max($.left,J.left),bottom:Math.max($.bottom,J.bottom)+i};var ee=wa(e,a),ce=e.doc.scrollTop,ge=e.doc.scrollLeft;if(ee.scrollTop!=null&&(En(e,ee.scrollTop),Math.abs(e.doc.scrollTop-ce)>1&&(z=!0)),ee.scrollLeft!=null&&(Ur(e,ee.scrollLeft),Math.abs(e.doc.scrollLeft-ge)>1&&(z=!0)),!z)break}return a}function Qo(e,t){var r=wa(e,t);r.scrollTop!=null&&En(e,r.scrollTop),r.scrollLeft!=null&&Ur(e,r.scrollLeft)}function wa(e,t){var r=e.display,i=Yr(e.display);t.top<0&&(t.top=0);var a=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,k=ca(e),z={};t.bottom-t.top>k&&(t.bottom=t.top+k);var $=e.doc.height+da(r),J=t.top<i,ee=t.bottom>$-i;if(t.top<a)z.scrollTop=J?0:t.top;else if(t.bottom>a+k){var ce=Math.min(t.top,(ee?$:t.bottom)-k);ce!=a&&(z.scrollTop=ce)}var ge=e.options.fixedGutter?0:r.gutters.offsetWidth,Re=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-ge,Ae=Pr(e)-r.gutters.offsetWidth,Be=t.right-t.left>Ae;return Be&&(t.right=t.left+Ae),t.left<10?z.scrollLeft=0:t.left<Re?z.scrollLeft=Math.max(0,t.left+ge-(Be?0:10)):t.right>Ae+Re-3&&(z.scrollLeft=t.right+(Be?0:10)-Ae),z}function Sa(e,t){if(t==null)return;Xn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Zr(e){Xn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function bn(e,t,r){(t!=null||r!=null)&&Xn(e),t!=null&&(e.curOp.scrollLeft=t),r!=null&&(e.curOp.scrollTop=r)}function Zo(e,t){Xn(e),e.curOp.scrollToPos=t}function Xn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=us(e,t.from),i=us(e,t.to);_s(e,r,i,t.margin)}}function _s(e,t,r,i){var a=wa(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-i,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+i});bn(e,a.scrollLeft,a.scrollTop)}function En(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;P||Aa(e,{top:t}),bs(e,t,!0),P&&Aa(e),wn(e,100)}function bs(e,t,r){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!r)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Ur(e,t,r,i){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(r?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 xn(e){var t=e.display,r=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?r:0,docHeight:i,scrollHeight:i+nr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var Br=function(e,t,r){this.cm=r;var i=this.vert=u("div",[u("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),a=this.horiz=u("div",[u("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=a.tabIndex=-1,e(i),e(a),Ie(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),Ie(a,"scroll",function(){a.clientWidth&&t(a.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,K&&G<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Br.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;if(r){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=r?i+"px":"0",this.horiz.style.left=e.barLeft+"px";var k=e.viewWidth-e.barLeft-(r?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+k)+"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:r?i:0,bottom:t?i:0}},Br.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Br.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Br.prototype.zeroWidthHack=function(){var e=o&&!d?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Y,this.disableVert=new Y},Br.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function i(){var a=e.getBoundingClientRect(),k=r=="vert"?document.elementFromPoint(a.right-1,(a.top+a.bottom)/2):document.elementFromPoint((a.right+a.left)/2,a.bottom-1);k!=e?e.style.pointerEvents="none":t.set(1e3,i)}t.set(1e3,i)},Br.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Tn=function(){};Tn.prototype.update=function(){return{bottom:0,right:0}},Tn.prototype.setScrollLeft=function(){},Tn.prototype.setScrollTop=function(){},Tn.prototype.clear=function(){};function Jr(e,t){t||(t=xn(e));var r=e.display.barWidth,i=e.display.barHeight;Es(e,t);for(var a=0;a<4&&r!=e.display.barWidth||i!=e.display.barHeight;a++)r!=e.display.barWidth&&e.options.lineWrapping&&Kn(e),Es(e,xn(e)),r=e.display.barWidth,i=e.display.barHeight}function Es(e,t){var r=e.display,i=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=i.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=i.bottom)+"px",r.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=i.bottom+"px",r.scrollbarFiller.style.width=i.right+"px"):r.scrollbarFiller.style.display="",i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=i.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}var xs={native:Br,null:Tn};function Ts(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&w(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),Ie(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,r){r=="horizontal"?Ur(e,t):En(e,t)},e),e.display.scrollbars.addClass&&D(e.display.wrapper,e.display.scrollbars.addClass)}var Jo=0;function jr(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:++Jo},Ki(e.curOp)}function Hr(e){var t=e.curOp;t&&Io(t,function(r){for(var i=0;i<r.ops.length;i++)r.ops[i].cm.curOp=null;qo(r)})}function qo(e){for(var t=e.ops,r=0;r<t.length;r++)el(t[r]);for(var i=0;i<t.length;i++)tl(t[i]);for(var a=0;a<t.length;a++)il(t[a]);for(var k=0;k<t.length;k++)rl(t[k]);for(var z=0;z<t.length;z++)nl(t[z])}function el(e){var t=e.cm,r=t.display;sl(t),e.updateMaxLine&&jn(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Yn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Ca(e.cm,e.update)}function il(e){var t=e.cm,r=t.display;e.updatedDisplay&&Kn(t),e.barMeasure=xn(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ts(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+nr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Pr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function rl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Ur(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==N();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Jr(t,e.barMeasure),e.updatedDisplay&&Ra(t,e.barMeasure),e.selectionChanged&&xa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&gs(e.cm)}function nl(e){var t=e.cm,r=t.display,i=t.doc;if(e.updatedDisplay&&ws(t,e.update),r.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(r.wheelStartX=r.wheelStartY=null),e.scrollTop!=null&&bs(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Ur(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 k=e.maybeHiddenMarkers,z=e.maybeUnhiddenMarkers;if(k)for(var $=0;$<k.length;++$)k[$].lines.length||De(k[$],"hide");if(z)for(var J=0;J<z.length;++J)z[J].lines.length&&De(z[J],"unhide");r.wrapper.offsetHeight&&(i.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&De(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Ni(e,t){if(e.curOp)return t();jr(e);try{return t()}finally{Hr(e)}}function hi(e,t){return function(){if(e.curOp)return t.apply(e,arguments);jr(e);try{return t.apply(e,arguments)}finally{Hr(e)}}}function Si(e){return function(){if(this.curOp)return e.apply(this,arguments);jr(this);try{return e.apply(this,arguments)}finally{Hr(this)}}}function di(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);jr(t);try{return e.apply(this,arguments)}finally{Hr(t)}}}function wn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,I(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var r=+new Date+e.options.workTime,i=qe(e,t.highlightFrontier),a=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),function(k){if(i.line>=e.display.viewFrom){var z=k.styles,$=k.text.length>e.options.maxHighlightLength?qt(t.mode,i.state):null,J=ye(e,k,i,!0);$&&(i.state=$),k.styles=J.styles;var ee=k.styleClasses,ce=J.classes;ce?k.styleClasses=ce:ee&&(k.styleClasses=null);for(var ge=!z||z.length!=k.styles.length||ee!=ce&&(!ee||!ce||ee.bgClass!=ce.bgClass||ee.textClass!=ce.textClass),Re=0;!ge&&Re<z.length;++Re)ge=z[Re]!=k.styles[Re];ge&&a.push(i.line),k.stateAfter=i.save(),i.nextLine()}else k.text.length<=e.options.maxHighlightLength&&mt(e,k.text,i),k.stateAfter=i.line%5==0?i.save():null,i.nextLine();if(+new Date>r)return wn(e,e.options.workDelay),!0}),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),a.length&&Ni(e,function(){for(var k=0;k<a.length;k++)Tr(e,a[k],"text")})}var Yn=function(e,t,r){var i=e.display;this.viewport=t,this.visible=Vn(i,e.doc,t),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=Pr(e),this.force=r,this.dims=_a(e),this.events=[]};Yn.prototype.signal=function(e,t){fe(e,t)&&this.events.push(arguments)},Yn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)De.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=nr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=nr(e)+"px",t.scrollbarsClipped=!0)}function ol(e){if(e.hasFocus())return null;var t=N();if(!t||!b(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var i=window.getSelection();i.anchorNode&&i.extend&&b(e.display.lineDiv,i.anchorNode)&&(r.anchorNode=i.anchorNode,r.anchorOffset=i.anchorOffset,r.focusNode=i.focusNode,r.focusOffset=i.focusOffset)}return r}function ll(e){if(!e||!e.activeElt||e.activeElt==N())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(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}function Ca(e,t){var r=e.display,i=e.doc;if(t.editorIsHidden)return wr(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&fs(e)==0)return!1;Cs(e)&&(wr(e),t.dims=_a(e));var a=i.first+i.size,k=Math.max(t.visible.from-e.options.viewportMargin,i.first),z=Math.min(a,t.visible.to+e.options.viewportMargin);r.viewFrom<k&&k-r.viewFrom<20&&(k=Math.max(i.first,r.viewFrom)),r.viewTo>z&&r.viewTo-z<20&&(z=Math.min(a,r.viewTo)),li&&(k=cn(e.doc,k),z=xr(e.doc,z));var $=k!=r.viewFrom||z!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Vo(e,k,z),r.viewOffset=$i(pt(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var J=fs(e);if(!$&&J==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var ee=ol(e);return J>4&&(r.lineDiv.style.display="none"),ul(e,r.updateLineNumbers,t.dims),J>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,ll(ee),T(r.cursorDiv),T(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,$&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,wn(e,400)),r.updateLineNumbers=null,!0}function ws(e,t){for(var r=t.viewport,i=!0;;i=!1){if(!i||!e.options.lineWrapping||t.oldDisplayWidth==Pr(e)){if(r&&r.top!=null&&(r={top:Math.min(e.doc.height+da(e.display)-ca(e),r.top)}),t.visible=Vn(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else i&&(t.visible=Vn(e.display,e.doc,r));if(!Ca(e,t))break;Kn(e);var a=xn(e);_n(e),Jr(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 r=new Yn(e,t);if(Ca(e,r)){Kn(e),ws(e,r);var i=xn(e);_n(e),Jr(e,i),Ra(e,i),r.finish()}}function ul(e,t,r){var i=e.display,a=e.options.lineNumbers,k=i.lineDiv,z=k.firstChild;function $(Be){var Ke=Be.nextSibling;return M&&o&&e.display.currentWheelTarget==Be?Be.style.display="none":Be.parentNode.removeChild(Be),Ke}for(var J=i.view,ee=i.viewFrom,ce=0;ce<J.length;ce++){var ge=J[ce];if(!ge.hidden)if(!ge.node||ge.node.parentNode!=k){var Re=No(e,ge,ee,r);k.insertBefore(Re,z)}else{for(;z!=ge.node;)z=$(z);var Ae=a&&t!=null&&t<=ee&&ge.lineNumber;ge.changes&&(ie(ge.changes,"gutter")>-1&&(Ae=!1),Ya(e,ge,ee,r)),Ae&&(T(ge.lineNumber),ge.lineNumber.appendChild(document.createTextNode(fr(e.options,ee)))),z=ge.node.nextSibling}ee+=ge.size}for(;z;)z=$(z)}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+nr(e)+"px"}function Ss(e){var t=e.display,r=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,k=i+"px",z=0;z<r.length;z++)if(!r[z].hidden){e.options.fixedGutter&&(r[z].gutter&&(r[z].gutter.style.left=k),r[z].gutterBackground&&(r[z].gutterBackground.style.left=k));var $=r[z].alignable;if($)for(var J=0;J<$.length;J++)$[J].style.left=k}e.options.fixedGutter&&(t.gutters.style.left=i+a+"px")}function Cs(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=fr(e.options,t.first+t.size-1),i=e.display;if(r.length!=i.lineNumChars){var a=i.measure.appendChild(u("div",[u("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),k=a.firstChild.offsetWidth,z=a.offsetWidth-k;return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(k,i.lineGutter.offsetWidth-z)+1,i.lineNumWidth=i.lineNumInnerWidth+z,i.lineNumChars=i.lineNumInnerWidth?r.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",Oa(e.display),!0}return!1}function La(e,t){for(var r=[],i=!1,a=0;a<e.length;a++){var k=e[a],z=null;if(typeof k!="string"&&(z=k.style,k=k.className),k=="CodeMirror-linenumbers")if(t)i=!0;else continue;r.push({className:k,style:z})}return t&&!i&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function As(e){var t=e.gutters,r=e.gutterSpecs;T(t),e.lineGutter=null;for(var i=0;i<r.length;++i){var a=r[i],k=a.className,z=a.style,$=t.appendChild(u("div",null,"CodeMirror-gutter "+k));z&&($.style.cssText=z),k=="CodeMirror-linenumbers"&&(e.lineGutter=$,$.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",Oa(e)}function Sn(e){As(e.display),Ri(e),Ss(e)}function hl(e,t,r,i){var a=this;this.input=r,a.scrollbarFiller=u("div",null,"CodeMirror-scrollbar-filler"),a.scrollbarFiller.setAttribute("cm-not-content","true"),a.gutterFiller=u("div",null,"CodeMirror-gutter-filler"),a.gutterFiller.setAttribute("cm-not-content","true"),a.lineDiv=E("div",null,"CodeMirror-code"),a.selectionDiv=u("div",null,null,"position: relative; z-index: 1"),a.cursorDiv=u("div",null,"CodeMirror-cursors"),a.measure=u("div",null,"CodeMirror-measure"),a.lineMeasure=u("div",null,"CodeMirror-measure"),a.lineSpace=E("div",[a.measure,a.lineMeasure,a.selectionDiv,a.cursorDiv,a.lineDiv],null,"position: relative; outline: none");var k=E("div",[a.lineSpace],"CodeMirror-lines");a.mover=u("div",[k],null,"position: relative"),a.sizer=u("div",[a.mover],"CodeMirror-sizer"),a.sizerWidth=null,a.heightForcer=u("div",null,null,"position: absolute; height: "+oe+"px; width: 1px;"),a.gutters=u("div",null,"CodeMirror-gutters"),a.lineGutter=null,a.scroller=u("div",[a.sizer,a.heightForcer,a.gutters],"CodeMirror-scroll"),a.scroller.setAttribute("tabIndex","-1"),a.wrapper=u("div",[a.scrollbarFiller,a.gutterFiller,a.scroller],"CodeMirror"),K&&G<8&&(a.gutters.style.zIndex=-1,a.scroller.style.paddingRight=0),!M&&!(P&&n)&&(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),r.init(a)}var $n=0,Hi=null;K?Hi=-.53:P?Hi=15:g?Hi=-.7:f&&(Hi=-1/3);function Os(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),r==null&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:r==null&&(r=e.wheelDelta),{x:t,y:r}}function dl(e){var t=Os(e);return t.x*=Hi,t.y*=Hi,t}function Rs(e,t){var r=Os(t),i=r.x,a=r.y,k=e.display,z=k.scroller,$=z.scrollWidth>z.clientWidth,J=z.scrollHeight>z.clientHeight;if(!(i&&$||a&&J))return;if(a&&o&&M){e:for(var ee=t.target,ce=k.view;ee!=z;ee=ee.parentNode)for(var ge=0;ge<ce.length;ge++)if(ce[ge].node==ee){e.display.currentWheelTarget=ee;break e}}if(i&&!P&&!p&&Hi!=null){a&&J&&En(e,Math.max(0,z.scrollTop+a*Hi)),Ur(e,Math.max(0,z.scrollLeft+i*Hi)),(!a||a&&J)&&re(t),k.wheelStartX=null;return}if(a&&Hi!=null){var Re=a*Hi,Ae=e.doc.scrollTop,Be=Ae+k.wrapper.clientHeight;Re<0?Ae=Math.max(0,Ae+Re-50):Be=Math.min(e.doc.height,Be+Re+50),Aa(e,{top:Ae,bottom:Be})}$n<20&&(k.wheelStartX==null?(k.wheelStartX=z.scrollLeft,k.wheelStartY=z.scrollTop,k.wheelDX=i,k.wheelDY=a,setTimeout(function(){if(k.wheelStartX==null)return;var Ke=z.scrollLeft-k.wheelStartX,Xe=z.scrollTop-k.wheelStartY,rt=Xe&&k.wheelDY&&Xe/k.wheelDY||Ke&&k.wheelDX&&Ke/k.wheelDX;if(k.wheelStartX=k.wheelStartY=null,!rt)return;Hi=(Hi*$n+rt)/($n+1),++$n},200)):(k.wheelDX+=i,k.wheelDY+=a))}var Wi=function(e,t){this.ranges=e,this.primIndex=t};Wi.prototype.primary=function(){return this.ranges[this.primIndex]},Wi.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 r=this.ranges[t],i=e.ranges[t];if(!pr(r.anchor,i.anchor)||!pr(r.head,i.head))return!1}return!0},Wi.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Gt(mr(this.ranges[t].anchor),mr(this.ranges[t].head));return new Wi(e,this.primIndex)},Wi.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Wi.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var i=this.ranges[r];if(Tt(t,i.from())>=0&&Tt(e,i.to())<=0)return r}return-1};var Gt=function(e,t){this.anchor=e,this.head=t};Gt.prototype.from=function(){return vr(this.anchor,this.head)},Gt.prototype.to=function(){return gr(this.anchor,this.head)},Gt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Zi(e,t,r){var i=e&&e.options.selectionsMayTouch,a=t[r];t.sort(function(Re,Ae){return Tt(Re.from(),Ae.from())}),r=ie(t,a);for(var k=1;k<t.length;k++){var z=t[k],$=t[k-1],J=Tt($.to(),z.from());if(i&&!z.empty()?J>0:J>=0){var ee=vr($.from(),z.from()),ce=gr($.to(),z.to()),ge=$.empty()?z.from()==z.head:$.from()==$.head;k<=r&&--r,t.splice(--k,2,new Gt(ge?ce:ee,ge?ee:ce))}}return new Wi(t,r)}function Sr(e,t){return new Wi([new Gt(e,t||e)],0)}function Cr(e){return e.text?Ve(e.from.line+e.text.length-1,te(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ls(e,t){if(Tt(e,t.from)<0)return e;if(Tt(e,t.to)<=0)return Cr(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=Cr(t).ch-t.to.ch),Ve(r,i)}function Ia(e,t){for(var r=[],i=0;i<e.sel.ranges.length;i++){var a=e.sel.ranges[i];r.push(new Gt(Ls(a.anchor,t),Ls(a.head,t)))}return Zi(e.cm,r,e.sel.primIndex)}function Is(e,t,r){return e.line==t.line?Ve(r.line,e.ch-t.ch+r.ch):Ve(r.line+(e.line-t.line),e.ch)}function cl(e,t,r){for(var i=[],a=Ve(e.first,0),k=a,z=0;z<t.length;z++){var $=t[z],J=Is($.from,a,k),ee=Is(Cr($),a,k);if(a=$.to,k=ee,r=="around"){var ce=e.sel.ranges[z],ge=Tt(ce.head,ce.anchor)<0;i[z]=new Gt(ge?ee:J,ge?J:ee)}else i[z]=new Gt(J,J)}return new Wi(i,e.sel.primIndex)}function ka(e){e.doc.mode=wt(e.options,e.doc.modeOption),Cn(e)}function Cn(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,wn(e,100),e.state.modeGen++,e.curOp&&Ri(e)}function ks(e,t){return t.from.ch==0&&t.to.ch==0&&te(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Da(e,t,r,i){function a(lt){return r?r[lt]:null}function k(lt,nt,ht){ua(lt,nt,ht,i),mi(lt,"change",lt,t)}function z(lt,nt){for(var ht=[],Et=lt;Et<nt;++Et)ht.push(new Dr(ee[Et],a(Et),i));return ht}var $=t.from,J=t.to,ee=t.text,ce=pt(e,$.line),ge=pt(e,J.line),Re=te(ee),Ae=a(ee.length-1),Be=J.line-$.line;if(t.full)e.insert(0,z(0,ee.length)),e.remove(ee.length,e.size-ee.length);else if(ks(e,t)){var Ke=z(0,ee.length-1);k(ge,ge.text,Ae),Be&&e.remove($.line,Be),Ke.length&&e.insert($.line,Ke)}else if(ce==ge)if(ee.length==1)k(ce,ce.text.slice(0,$.ch)+Re+ce.text.slice(J.ch),Ae);else{var Xe=z(1,ee.length-1);Xe.push(new Dr(Re+ce.text.slice(J.ch),Ae,i)),k(ce,ce.text.slice(0,$.ch)+ee[0],a(0)),e.insert($.line+1,Xe)}else if(ee.length==1)k(ce,ce.text.slice(0,$.ch)+ee[0]+ge.text.slice(J.ch),a(0)),e.remove($.line+1,Be);else{k(ce,ce.text.slice(0,$.ch)+ee[0],a(0)),k(ge,Re+ge.text.slice(J.ch),Ae);var rt=z(1,ee.length-1);Be>1&&e.remove($.line+1,Be-1),e.insert($.line+1,rt)}mi(e,"change",e,t)}function Ar(e,t,r){function i(a,k,z){if(a.linked)for(var $=0;$<a.linked.length;++$){var J=a.linked[$];if(J.doc==k)continue;var ee=z&&J.sharedHist;if(r&&!ee)continue;t(J.doc,ee),i(J.doc,a,ee)}}i(e,null,!0)}function Ds(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ea(e),ka(e),Ps(e),e.options.lineWrapping||jn(e),e.options.mode=t.modeOption,Ri(e)}function Ps(e){(e.doc.direction=="rtl"?D:w)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Ni(e,function(){Ps(e),Ri(e)})}function Qn(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Pa(e,t){var r={from:mr(t.from),to:Cr(t),text:Gi(e,t.from,t.to)};return Fs(e,r,t.from.line,t.to.line+1),Ar(e,function(i){return Fs(i,r,t.from.line,t.to.line+1)},!0),r}function Ms(e){for(;e.length;){var t=te(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Ms(e.done),te(e.done);if(e.done.length&&!te(e.done).ranges)return te(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),te(e.done)}function Ns(e,t,r,i){var a=e.history;a.undone.length=0;var k=+new Date,z,$;if((a.lastOp==i||a.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&a.lastModTime>k-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(z=pl(a,a.lastOp==i)))$=te(z.changes),Tt(t.from,t.to)==0&&Tt(t.from,$.to)==0?$.to=Cr(t):z.changes.push(Pa(e,t));else{var J=te(a.done);for((!J||!J.ranges)&&Zn(e.sel,a.done),z={changes:[Pa(e,t)],generation:a.generation},a.done.push(z);a.done.length>a.undoDepth;)a.done.shift(),a.done[0].ranges||a.done.shift()}a.done.push(r),a.generation=++a.maxGeneration,a.lastModTime=a.lastSelTime=k,a.lastOp=a.lastSelOp=i,a.lastOrigin=a.lastSelOrigin=t.origin,$||De(e,"historyAdded")}function ml(e,t,r,i){var a=t.charAt(0);return a=="*"||a=="+"&&r.ranges.length==i.ranges.length&&r.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,r,i){var a=e.history,k=i&&i.origin;r==a.lastSelOp||k&&a.lastSelOrigin==k&&(a.lastModTime==a.lastSelTime&&a.lastOrigin==k||ml(e,k,te(a.done),t))?a.done[a.done.length-1]=t:Zn(t,a.done),a.lastSelTime=+new Date,a.lastSelOrigin=k,a.lastSelOp=r,i&&i.clearRedo!==!1&&Ms(a.undone)}function Zn(e,t){var r=te(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Fs(e,t,r,i){var a=t["spans_"+e.id],k=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,i),function(z){z.markedSpans&&((a||(a=t["spans_"+e.id]={}))[k]=z.markedSpans),++k})}function vl(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function yl(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var i=[],a=0;a<t.text.length;++a)i.push(vl(r[a]));return i}function Us(e,t){var r=yl(e,t),i=Yi(e,t);if(!r)return i;if(!i)return r;for(var a=0;a<r.length;++a){var k=r[a],z=i[a];if(k&&z){e:for(var $=0;$<z.length;++$){for(var J=z[$],ee=0;ee<k.length;++ee)if(k[ee].marker==J.marker)continue e;k.push(J)}}else z&&(r[a]=z)}return r}function qr(e,t,r){for(var i=[],a=0;a<e.length;++a){var k=e[a];if(k.ranges){i.push(r?Wi.prototype.deepCopy.call(k):k);continue}var z=k.changes,$=[];i.push({changes:$});for(var J=0;J<z.length;++J){var ee=z[J],ce=void 0;if($.push({from:ee.from,to:ee.to,text:ee.text}),t)for(var ge in ee)(ce=ge.match(/^spans_(\d+)$/))&&(ie(t,Number(ce[1]))>-1&&(te($)[ge]=ee[ge],delete ee[ge]))}}return i}function Ma(e,t,r,i){if(i){var a=e.anchor;if(r){var k=Tt(t,a)<0;k!=Tt(r,a)<0?(a=t,t=r):k!=Tt(t,r)<0&&(t=r)}return new Gt(a,t)}else return new Gt(r||t,t)}function Jn(e,t,r,i,a){a==null&&(a=e.cm&&(e.cm.display.shift||e.extend)),Ei(e,new Wi([Ma(e.sel.primary(),t,r,a)],0),i)}function Bs(e,t,r){for(var i=[],a=e.cm&&(e.cm.display.shift||e.extend),k=0;k<e.sel.ranges.length;k++)i[k]=Ma(e.sel.ranges[k],t[k],null,a);var z=Zi(e.cm,i,e.sel.primIndex);Ei(e,z,r)}function Na(e,t,r,i){var a=e.sel.ranges.slice(0);a[t]=r,Ei(e,Zi(e.cm,a,e.sel.primIndex),i)}function js(e,t,r,i){Ei(e,Sr(t,r),i)}function _l(e,t,r){var i={ranges:t.ranges,update:function(a){this.ranges=[];for(var k=0;k<a.length;k++)this.ranges[k]=new Gt(v(e,a[k].anchor),v(e,a[k].head))},origin:r&&r.origin};return De(e,"beforeSelectionChange",e,i),e.cm&&De(e.cm,"beforeSelectionChange",e.cm,i),i.ranges!=t.ranges?Zi(e.cm,i.ranges,i.ranges.length-1):t}function Hs(e,t,r){var i=e.history.done,a=te(i);a&&a.ranges?(i[i.length-1]=t,qn(e,t,r)):Ei(e,t,r)}function Ei(e,t,r){qn(e,t,r),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function qn(e,t,r){(fe(e,"beforeSelectionChange")||e.cm&&fe(e.cm,"beforeSelectionChange"))&&(t=_l(e,t,r));var i=r&&r.bias||(Tt(t.primary().head,e.sel.primary().head)<0?-1:1);Ws(e,zs(e,t,i,!0)),!(r&&r.scroll===!1)&&e.cm&&Zr(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,Ee(e.cm)),mi(e,"cursorActivity",e)}function Gs(e){Ws(e,zs(e,e.sel,null,!1))}function zs(e,t,r,i){for(var a,k=0;k<t.ranges.length;k++){var z=t.ranges[k],$=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[k],J=ea(e,z.anchor,$&&$.anchor,r,i),ee=ea(e,z.head,$&&$.head,r,i);(a||J!=z.anchor||ee!=z.head)&&(a||(a=t.ranges.slice(0,k)),a[k]=new Gt(J,ee))}return a?Zi(e.cm,a,t.primIndex):t}function en(e,t,r,i,a){var k=pt(e,t.line);if(k.markedSpans)for(var z=0;z<k.markedSpans.length;++z){var $=k.markedSpans[z],J=$.marker,ee="selectLeft"in J?!J.selectLeft:J.inclusiveLeft,ce="selectRight"in J?!J.selectRight:J.inclusiveRight;if(($.from==null||(ee?$.from<=t.ch:$.from<t.ch))&&($.to==null||(ce?$.to>=t.ch:$.to>t.ch))){if(a&&(De(J,"beforeCursorEnter"),J.explicitlyCleared))if(k.markedSpans){--z;continue}else break;if(!J.atomic)continue;if(r){var ge=J.find(i<0?1:-1),Re=void 0;if((i<0?ce:ee)&&(ge=Ks(e,ge,-i,ge&&ge.line==t.line?k:null)),ge&&ge.line==t.line&&(Re=Tt(ge,r))&&(i<0?Re<0:Re>0))return en(e,ge,t,i,a)}var Ae=J.find(i<0?-1:1);return(i<0?ee:ce)&&(Ae=Ks(e,Ae,i,Ae.line==t.line?k:null)),Ae?en(e,Ae,t,i,a):null}}return t}function ea(e,t,r,i,a){var k=i||1,z=en(e,t,r,k,a)||!a&&en(e,t,r,k,!0)||en(e,t,r,-k,a)||!a&&en(e,t,r,-k,!0);return z||(e.cantEdit=!0,Ve(e.first,0))}function Ks(e,t,r,i){return r<0&&t.ch==0?t.line>e.first?v(e,Ve(t.line-1)):null:r>0&&t.ch==(i||pt(e,t.line)).text.length?t.line<e.first+e.size-1?Ve(t.line+1,0):null:new Ve(t.line,t.ch+r)}function Vs(e){e.setSelection(Ve(e.firstLine(),0),Ve(e.lastLine()),me)}function Xs(e,t,r){var i={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return i.canceled=!0}};return r&&(i.update=function(a,k,z,$){a&&(i.from=v(e,a)),k&&(i.to=v(e,k)),z&&(i.text=z),$!==void 0&&(i.origin=$)}),De(e,"beforeChange",e,i),e.cm&&De(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 tn(e,t,r){if(e.cm){if(!e.cm.curOp)return hi(e.cm,tn)(e,t,r);if(e.cm.state.suppressEdits)return}if((fe(e,"beforeChange")||e.cm&&fe(e.cm,"beforeChange"))&&(t=Xs(e,t,!0),!t))return;var i=Ir&&!r&&_r(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]==""&&Tt(t.from,t.to)==0)return;var r=Ia(e,t);Ns(e,t,r,e.cm?e.cm.curOp.id:NaN),An(e,t,r,Yi(e,t));var i=[];Ar(e,function(a,k){!k&&ie(i,a.history)==-1&&(Js(a.history,t),i.push(a.history)),An(a,t,null,Yi(a,t))})}function ta(e,t,r){var i=e.cm&&e.cm.state.suppressEdits;if(i&&!r)return;for(var a=e.history,k,z=e.sel,$=t=="undo"?a.done:a.undone,J=t=="undo"?a.undone:a.done,ee=0;ee<$.length&&!(k=$[ee],r?k.ranges&&!k.equals(e.sel):!k.ranges);ee++);if(ee==$.length)return;for(a.lastOrigin=a.lastSelOrigin=null;;)if(k=$.pop(),k.ranges){if(Zn(k,J),r&&!k.equals(e.sel)){Ei(e,k,{clearRedo:!1});return}z=k}else if(i){$.push(k);return}else break;var ce=[];Zn(z,J),J.push({changes:ce,generation:a.generation}),a.generation=k.generation||++a.maxGeneration;for(var ge=fe(e,"beforeChange")||e.cm&&fe(e.cm,"beforeChange"),Re=function(Ke){var Xe=k.changes[Ke];if(Xe.origin=t,ge&&!Xs(e,Xe,!1))return $.length=0,{};ce.push(Pa(e,Xe));var rt=Ke?Ia(e,Xe):te($);An(e,Xe,rt,Us(e,Xe)),!Ke&&e.cm&&e.cm.scrollIntoView({from:Xe.from,to:Cr(Xe)});var lt=[];Ar(e,function(nt,ht){!ht&&ie(lt,nt.history)==-1&&(Js(nt.history,Xe),lt.push(nt.history)),An(nt,Xe,null,Us(nt,Xe))})},Ae=k.changes.length-1;Ae>=0;--Ae){var Be=Re(Ae);if(Be)return Be.v}}function $s(e,t){if(t==0)return;if(e.first+=t,e.sel=new Wi(de(e.sel.ranges,function(a){return new Gt(Ve(a.anchor.line+t,a.anchor.ch),Ve(a.head.line+t,a.head.ch))}),e.sel.primIndex),e.cm){Ri(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,i=r.viewFrom;i<r.viewTo;i++)Tr(e.cm,i,"gutter")}}function An(e,t,r,i){if(e.cm&&!e.cm.curOp)return hi(e.cm,An)(e,t,r,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:Ve(e.first,0),to:Ve(t.to.line+a,t.to.ch),text:[te(t.text)],origin:t.origin}}var k=e.lastLine();t.to.line>k&&(t={from:t.from,to:Ve(k,pt(e,k).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Gi(e,t.from,t.to),r||(r=Ia(e,t)),e.cm?bl(e.cm,t,i):Da(e,t,i),qn(e,r,me),e.cantEdit&&ea(e,Ve(e.firstLine(),0))&&(e.cantEdit=!1)}function bl(e,t,r){var i=e.doc,a=e.display,k=t.from,z=t.to,$=!1,J=k.line;e.options.lineWrapping||(J=kt(wi(pt(i,k.line))),i.iter(J,z.line+1,function(Ae){if(Ae==a.maxLine)return $=!0,!0})),i.sel.contains(t.from,t.to)>-1&&Ee(e),Da(i,t,r,cs(e)),e.options.lineWrapping||(i.iter(J,k.line+t.text.length,function(Ae){var Be=pn(Ae);Be>a.maxLineLength&&(a.maxLine=Ae,a.maxLineLength=Be,a.maxLineChanged=!0,$=!1)}),$&&(e.curOp.updateMaxLine=!0)),Xi(i,k.line),wn(e,400);var ee=t.text.length-(z.line-k.line)-1;t.full?Ri(e):k.line==z.line&&t.text.length==1&&!ks(e.doc,t)?Tr(e,k.line,"text"):Ri(e,k.line,z.line+1,ee);var ce=fe(e,"changes"),ge=fe(e,"change");if(ge||ce){var Re={from:k,to:z,text:t.text,removed:t.removed,origin:t.origin};ge&&mi(e,"change",e,Re),ce&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Re)}e.display.selForContextMenu=null}function rn(e,t,r,i,a){var k;i||(i=r),Tt(i,r)<0&&(k=[i,r],r=k[0],i=k[1]),typeof t=="string"&&(t=e.splitLines(t)),tn(e,{from:r,to:i,text:t,origin:a})}function Qs(e,t,r,i){r<e.line?e.line+=i:t<e.line&&(e.line=t,e.ch=0)}function Zs(e,t,r,i){for(var a=0;a<e.length;++a){var k=e[a],z=!0;if(k.ranges){k.copied||(k=e[a]=k.deepCopy(),k.copied=!0);for(var $=0;$<k.ranges.length;$++)Qs(k.ranges[$].anchor,t,r,i),Qs(k.ranges[$].head,t,r,i);continue}for(var J=0;J<k.changes.length;++J){var ee=k.changes[J];if(r<ee.from.line)ee.from=Ve(ee.from.line+i,ee.from.ch),ee.to=Ve(ee.to.line+i,ee.to.ch);else if(t<=ee.to.line){z=!1;break}}z||(e.splice(0,a+1),a=0)}}function Js(e,t){var r=t.from.line,i=t.to.line,a=t.text.length-(i-r)-1;Zs(e.done,r,i,a),Zs(e.undone,r,i,a)}function On(e,t,r,i){var a=t,k=t;return typeof t=="number"?k=pt(e,X(e,t)):a=kt(t),a==null?null:(i(k,a)&&e.cm&&Tr(e.cm,a,r),k)}function Rn(e){this.lines=e,this.parent=null;for(var t=0,r=0;r<e.length;++r)e[r].parent=this,t+=e[r].height;this.height=t}Rn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,i=e+t;r<i;++r){var a=this.lines[r];this.height-=a.height,vt(a),mi(a,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,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,r){for(var i=e+t;e<i;++e)if(r(this.lines[e]))return!0}};function Ln(e){this.children=e;for(var t=0,r=0,i=0;i<e.length;++i){var a=e[i];t+=a.chunkSize(),r+=a.height,a.parent=this}this.size=t,this.height=r,this.parent=null}Ln.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var i=this.children[r],a=i.chunkSize();if(e<a){var k=Math.min(t,a-e),z=i.height;if(i.removeInner(e,k),this.height-=z-i.height,a==k&&(this.children.splice(r--,1),i.parent=null),(t-=k)==0)break;e=0}else e-=a}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Rn))){var $=[];this.collapse($),this.children=[new Rn($)],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,r){this.size+=t.length,this.height+=r;for(var i=0;i<this.children.length;++i){var a=this.children[i],k=a.chunkSize();if(e<=k){if(a.insertInner(e,t,r),a.lines&&a.lines.length>50){for(var z=a.lines.length%25+25,$=z;$<a.lines.length;){var J=new Rn(a.lines.slice($,$+=25));a.height-=J.height,this.children.splice(++i,0,J),J.parent=this}a.lines=a.lines.slice(0,z),this.maybeSpill()}break}e-=k}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new Ln(t);if(e.parent){e.size-=r.size,e.height-=r.height;var a=ie(e.parent.children,e);e.parent.children.splice(a+1,0,r)}else{var i=new Ln(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,r){for(var i=0;i<this.children.length;++i){var a=this.children[i],k=a.chunkSize();if(e<k){var z=Math.min(t,k-e);if(a.iterN(e,z,r))return!0;if((t-=z)==0)break;e=0}else e-=k}}};var In=function(e,t,r){if(r)for(var i in r)r.hasOwnProperty(i)&&(this[i]=r[i]);this.doc=e,this.node=t};In.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,i=kt(r);if(i==null||!t)return;for(var a=0;a<t.length;++a)t[a]==this&&t.splice(a--,1);t.length||(r.widgets=null);var k=vn(this);vi(r,Math.max(0,r.height-k)),e&&(Ni(e,function(){qs(e,r,-k),Tr(e,i,"widget")}),mi(e,"lineWidgetCleared",e,this,i))},In.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,i=this.line;this.height=null;var a=vn(this)-t;if(!a)return;rr(this.doc,i)||vi(i,i.height+a),r&&Ni(r,function(){r.curOp.forceUpdate=!0,qs(r,i,a),mi(r,"lineWidgetChanged",r,e,kt(i))})},_e(In);function qs(e,t,r){$i(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Sa(e,r)}function El(e,t,r,i){var a=new In(e,r,i),k=e.cm;return k&&a.noHScroll&&(k.display.alignWidgets=!0),On(e,t,"widget",function(z){var $=z.widgets||(z.widgets=[]);if(a.insertAt==null?$.push(a):$.splice(Math.min($.length-1,Math.max(0,a.insertAt)),0,a),a.line=z,k&&!rr(e,z)){var J=$i(z)<e.scrollTop;vi(z,z.height+vn(a)),J&&Sa(k,a.height),k.curOp.forceUpdate=!0}return!0}),k&&mi(k,"lineWidgetAdded",k,a,typeof t=="number"?t:kt(t)),a}var eo=0,Or=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++eo};Or.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&jr(e),fe(this,"clear")){var r=this.find();r&&mi(this,"clear",r.from,r.to)}for(var i=null,a=null,k=0;k<this.lines.length;++k){var z=this.lines[k],$=Mi(z.markedSpans,this);e&&!this.collapsed?Tr(e,kt(z),"text"):e&&($.to!=null&&(a=kt(z)),$.from!=null&&(i=kt(z))),z.markedSpans=kr(z.markedSpans,$),$.from==null&&this.collapsed&&!rr(this.doc,z)&&e&&vi(z,Yr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var J=0;J<this.lines.length;++J){var ee=wi(this.lines[J]),ce=pn(ee);ce>e.display.maxLineLength&&(e.display.maxLine=ee,e.display.maxLineLength=ce,e.display.maxLineChanged=!0)}i!=null&&e&&this.collapsed&&Ri(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&&mi(e,"markerCleared",e,this,i,a),t&&Hr(e),this.parent&&this.parent.clear()},Or.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var r,i,a=0;a<this.lines.length;++a){var k=this.lines[a],z=Mi(k.markedSpans,this);if(z.from!=null&&(r=Ve(t?k:kt(k),z.from),e==-1))return r;if(z.to!=null&&(i=Ve(t?k:kt(k),z.to),e==1))return i}return r&&{from:r,to:i}},Or.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,i=this.doc.cm;if(!t||!i)return;Ni(i,function(){var a=t.line,k=kt(t.line),z=fa(i,k);if(z&&(ns(z),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!rr(r.doc,a)&&r.height!=null){var $=r.height;r.height=null;var J=vn(r)-$;J&&vi(a,a.height+J)}mi(i,"markerChanged",i,e)})},Or.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ie(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Or.prototype.detachLine=function(e){if(this.lines.splice(ie(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},_e(Or);function nn(e,t,r,i,a){if(i&&i.shared)return xl(e,t,r,i,a);if(e.cm&&!e.cm.curOp)return hi(e.cm,nn)(e,t,r,i,a);var k=new Or(e,a),z=Tt(t,r);if(i&&y(i,k,!1),z>0||z==0&&k.clearWhenEmpty!==!1)return k;if(k.replacedWith&&(k.collapsed=!0,k.widgetNode=E("span",[k.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||k.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(k.widgetNode.insertLeft=!0)),k.collapsed){if(ui(e,t.line,t,r,k)||t.line!=r.line&&ui(e,r.line,t,r,k))throw new Error("Inserting collapsed marker partially overlapping an existing one");or()}k.addToHistory&&Ns(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var $=t.line,J=e.cm,ee;if(e.iter($,r.line+1,function(ge){J&&k.collapsed&&!J.options.lineWrapping&&wi(ge)==J.display.maxLine&&(ee=!0),k.collapsed&&$!=t.line&&vi(ge,0),yr(ge,new lr(k,$==t.line?t.ch:null,$==r.line?r.ch:null)),++$}),k.collapsed&&e.iter(t.line,r.line+1,function(ge){rr(e,ge)&&vi(ge,0)}),k.clearOnEnter&&Ie(k,"beforeCursorEnter",function(){return k.clear()}),k.readOnly&&(ji(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),k.collapsed&&(k.id=++eo,k.atomic=!0),J){if(ee&&(J.curOp.updateMaxLine=!0),k.collapsed)Ri(J,t.line,r.line+1);else if(k.className||k.startStyle||k.endStyle||k.css||k.attributes||k.title)for(var ce=t.line;ce<=r.line;ce++)Tr(J,ce,"text");k.atomic&&Gs(J.doc),mi(J,"markerAdded",J,k)}return k}var kn=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};kn.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();mi(this,"clear")},kn.prototype.find=function(e,t){return this.primary.find(e,t)},_e(kn);function xl(e,t,r,i,a){i=y(i),i.shared=!1;var k=[nn(e,t,r,i,a)],z=k[0],$=i.widgetNode;return Ar(e,function(J){$&&(i.widgetNode=$.cloneNode(!0)),k.push(nn(J,v(J,t),v(J,r),i,a));for(var ee=0;ee<J.linked.length;++ee)if(J.linked[ee].isParent)return;z=te(k)}),new kn(k,z)}function to(e){return e.findMarks(Ve(e.first,0),e.clipPos(Ve(e.lastLine())),function(t){return t.parent})}function Tl(e,t){for(var r=0;r<t.length;r++){var i=t[r],a=i.find(),k=e.clipPos(a.from),z=e.clipPos(a.to);if(Tt(k,z)){var $=nn(e,k,z,i.primary,i.primary.type);i.markers.push($),$.parent=i}}}function wl(e){for(var t=function(i){var a=e[i],k=[a.primary.doc];Ar(a.primary.doc,function(J){return k.push(J)});for(var z=0;z<a.markers.length;z++){var $=a.markers[z];ie(k,$.doc)==-1&&($.parent=null,a.markers.splice(z--,1))}},r=0;r<e.length;r++)t(r)}var Sl=0,Li=function(e,t,r,i,a){if(!(this instanceof Li))return new Li(e,t,r,i,a);r==null&&(r=0),Ln.call(this,[new Rn([new Dr("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var k=Ve(r,0);this.sel=Sr(k),this.history=new Qn(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)),Da(this,{from:k,to:k,text:e}),Ei(this,Sr(k),me)};Li.prototype=ke(Ln.prototype,{constructor:Li,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,i=0;i<t.length;++i)r+=t[i].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=tr(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:di(function(e){var t=Ve(this.first,0),r=this.first+this.size-1;tn(this,{from:t,to:Ve(r,pt(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&bn(this.cm,0,0),Ei(this,Sr(t),me)}),replaceRange:function(e,t,r,i){t=v(this,t),r=r?v(this,r):t,rn(this,e,t,r,i)},getRange:function(e,t,r){var i=Gi(this,v(this,e),v(this,t));return r===!1?i:i.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Vi(this,e))return pt(this,e)},getLineNumber:function(e){return kt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=pt(this,e)),wi(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(),r;return e==null||e=="head"?r=t.head:e=="anchor"?r=t.anchor:e=="end"||e=="to"||e===!1?r=t.to():r=t.from(),r},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:di(function(e,t,r){js(this,v(this,typeof e=="number"?Ve(e,t||0):e),null,r)}),setSelection:di(function(e,t,r){js(this,v(this,e),v(this,t||e),r)}),extendSelection:di(function(e,t,r){Jn(this,v(this,e),t&&v(this,t),r)}),extendSelections:di(function(e,t){Bs(this,U(this,e),t)}),extendSelectionsBy:di(function(e,t){var r=de(this.sel.ranges,e);Bs(this,U(this,r),t)}),setSelections:di(function(e,t,r){if(!e.length)return;for(var i=[],a=0;a<e.length;a++)i[a]=new Gt(v(this,e[a].anchor),v(this,e[a].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Ei(this,Zi(this.cm,i,t),r)}),addSelection:di(function(e,t,r){var i=this.sel.ranges.slice(0);i.push(new Gt(v(this,e),v(this,t||e))),Ei(this,Zi(this.cm,i,i.length-1),r)}),getSelection:function(e){for(var t=this.sel.ranges,r,i=0;i<t.length;i++){var a=Gi(this,t[i].from(),t[i].to());r=r?r.concat(a):a}return e===!1?r:r.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,i=0;i<r.length;i++){var a=Gi(this,r[i].from(),r[i].to());e!==!1&&(a=a.join(e||this.lineSeparator())),t[i]=a}return t},replaceSelection:function(e,t,r){for(var i=[],a=0;a<this.sel.ranges.length;a++)i[a]=e;this.replaceSelections(i,t,r||"+input")},replaceSelections:di(function(e,t,r){for(var i=[],a=this.sel,k=0;k<a.ranges.length;k++){var z=a.ranges[k];i[k]={from:z.from(),to:z.to(),text:this.splitLines(e[k]),origin:r}}for(var $=t&&t!="end"&&cl(this,i,t),J=i.length-1;J>=0;J--)tn(this,i[J]);$?Hs(this,$):this.cm&&Zr(this.cm)}),undo:di(function(){ta(this,"undo")}),redo:di(function(){ta(this,"redo")}),undoSelection:di(function(){ta(this,"undo",!0)}),redoSelection:di(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,r=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||++r;return{undo:t,redo:r}},clearHistory:function(){var e=this;this.history=new Qn(this.history.maxGeneration),Ar(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:qr(this.history.done),undone:qr(this.history.undone)}},setHistory:function(e){var t=this.history=new Qn(this.history.maxGeneration);t.done=qr(e.done.slice(0),null,!0),t.undone=qr(e.undone.slice(0),null,!0)},setGutterMarker:di(function(e,t,r){return On(this,e,"gutter",function(i){var a=i.gutterMarkers||(i.gutterMarkers={});return a[t]=r,!r&&je(a)&&(i.gutterMarkers=null),!0})}),clearGutter:di(function(e){var t=this;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&On(t,r,"gutter",function(){return r.gutterMarkers[e]=null,je(r.gutterMarkers)&&(r.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Vi(this,e))return null;if(t=e,e=pt(this,e),!e)return null}else if(t=kt(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:di(function(e,t,r){return On(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]=r;else{if(C(r).test(i[a]))return!1;i[a]+=" "+r}return!0})}),removeLineClass:di(function(e,t,r){return On(this,e,t=="gutter"?"gutter":"class",function(i){var a=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",k=i[a];if(k)if(r==null)i[a]=null;else{var z=k.match(C(r));if(!z)return!1;var $=z.index+z[0].length;i[a]=k.slice(0,z.index)+(!z.index||$==k.length?"":" ")+k.slice($)||null}else return!1;return!0})}),addLineWidget:di(function(e,t,r){return El(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return nn(this,v(this,e),v(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={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),nn(this,e,e,r,"bookmark")},findMarksAt:function(e){e=v(this,e);var t=[],r=pt(this,e.line).markedSpans;if(r)for(var i=0;i<r.length;++i){var a=r[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,r){e=v(this,e),t=v(this,t);var i=[],a=e.line;return this.iter(e.line,t.line+1,function(k){var z=k.markedSpans;if(z)for(var $=0;$<z.length;$++){var J=z[$];!(J.to!=null&&a==e.line&&e.ch>=J.to||J.from==null&&a!=e.line||J.from!=null&&a==t.line&&J.from>=t.ch)&&(!r||r(J.marker))&&i.push(J.marker.parent||J.marker)}++a}),i},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var i=0;i<r.length;++i)r[i].from!=null&&e.push(r[i].marker)}),e},posFromIndex:function(e){var t,r=this.first,i=this.lineSeparator().length;return this.iter(function(a){var k=a.text.length+i;if(k>e)return t=e,!0;e-=k,++r}),v(this,Ve(r,t))},indexFromPos:function(e){e=v(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,function(i){t+=i.text.length+r}),t},copy:function(e){var t=new Li(tr(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,r=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<r&&(r=e.to);var i=new Li(tr(this,t,r),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 Qt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var r=this.linked[t];if(r.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(to(this));break}if(e.history==this.history){var i=[e.id];Ar(e,function(a){return i.push(a.id)},!0),e.history=new Qn(null),e.history.done=qr(this.history.done,i),e.history.undone=qr(this.history.undone,i)}},iterLinkedDocs:function(e){Ar(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):xt(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:di(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)})}),Li.prototype.eachLine=Li.prototype.iter;var io=0;function Cl(e){var t=this;if(ro(t),He(t,e)||hr(t.display,e))return;re(e),K&&(io=+new Date);var r=Nr(t,e,!0),i=e.dataTransfer.files;if(!r||t.isReadOnly())return;if(i&&i.length&&window.FileReader&&window.File)for(var a=i.length,k=Array(a),z=0,$=function(){++z==a&&hi(t,function(){r=v(t.doc,r);var Ae={from:r,to:r,text:t.doc.splitLines(k.filter(function(Be){return Be!=null}).join(t.doc.lineSeparator())),origin:"paste"};tn(t.doc,Ae),Hs(t.doc,Sr(v(t.doc,r),v(t.doc,Cr(Ae))))})()},J=function(Ae,Be){if(t.options.allowDropFileTypes&&ie(t.options.allowDropFileTypes,Ae.type)==-1){$();return}var Ke=new FileReader;Ke.onerror=function(){return $()},Ke.onload=function(){var Xe=Ke.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Xe)){$();return}k[Be]=Xe,$()},Ke.readAsText(Ae)},ee=0;ee<i.length;ee++)J(i[ee],ee);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ce=e.dataTransfer.getData("Text");if(ce){var ge;if(t.state.draggingText&&!t.state.draggingText.copy&&(ge=t.listSelections()),qn(t.doc,Sr(r,r)),ge)for(var Re=0;Re<ge.length;++Re)rn(t.doc,"",ge[Re].anchor,ge[Re].head,"drag");t.replaceSelection(ce,"around","paste"),t.display.input.focus()}}catch(Ae){}}}function Al(e,t){if(K&&(!e.state.draggingText||+new Date-io<100)){ve(t);return}if(He(e,t)||hr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!f){var r=u("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",p&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),p&&r.parentNode.removeChild(r)}}function Ol(e,t){var r=Nr(e,t);if(!r)return;var i=document.createDocumentFragment();ms(e,r,i),e.display.dragCursor||(e.display.dragCursor=u("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),_(e.display.dragCursor,i)}function ro(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function no(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),r=[],i=0;i<t.length;i++){var a=t[i].CodeMirror;a&&r.push(a)}r.length&&r[0].operation(function(){for(var k=0;k<r.length;k++)e(r[k])})}var ao=!1;function Rl(){if(ao)return;Ll(),ao=!0}function Ll(){var e;Ie(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,no(Il)},100))}),Ie(window,"blur",function(){return no(Qr)})}function Il(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Rr={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"},Dn=0;Dn<10;Dn++)Rr[Dn+48]=Rr[Dn+96]=String(Dn);for(var ia=65;ia<=90;ia++)Rr[ia]=String.fromCharCode(ia);for(var Pn=1;Pn<=12;Pn++)Rr[Pn+111]=Rr[Pn+63235]="F"+Pn;var dr={};dr.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"},dr.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"},dr.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"},dr.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"]},dr.default=o?dr.macDefault:dr.pcDefault;function kl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var r,i,a,k,z=0;z<t.length-1;z++){var $=t[z];if(/^(cmd|meta|m)$/i.test($))k=!0;else if(/^a(lt)?$/i.test($))r=!0;else if(/^(c|ctrl|control)$/i.test($))i=!0;else if(/^s(hift)?$/i.test($))a=!0;else throw new Error("Unrecognized modifier name: "+$)}return r&&(e="Alt-"+e),i&&(e="Ctrl-"+e),k&&(e="Cmd-"+e),a&&(e="Shift-"+e),e}function Dl(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if(i=="..."){delete e[r];continue}for(var a=de(r.split(" "),kl),k=0;k<a.length;k++){var z=void 0,$=void 0;k==a.length-1?($=a.join(" "),z=i):($=a.slice(0,k+1).join(" "),z="...");var J=t[$];if(!J)t[$]=z;else if(J!=z)throw new Error("Inconsistent bindings for "+$)}delete e[r]}for(var ee in t)e[ee]=t[ee];return e}function an(e,t,r,i){t=ra(t);var a=t.call?t.call(e,i):t[e];if(a===!1)return"nothing";if(a==="...")return"multi";if(a!=null&&r(a))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return an(e,t.fallthrough,r,i);for(var k=0;k<t.fallthrough.length;k++){var z=an(e,t.fallthrough[k],r,i);if(z)return z}}}function so(e){var t=typeof e=="string"?e:Rr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function oo(e,t,r){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),!r&&t.shiftKey&&i!="Shift"&&(e="Shift-"+e),e}function lo(e,t){if(p&&e.keyCode==34&&e.char)return!1;var r=Rr[e.keyCode];return r==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(r=e.code),oo(r,e,t))}function ra(e){return typeof e=="string"?dr[e]:e}function sn(e,t){for(var r=e.doc.sel.ranges,i=[],a=0;a<r.length;a++){for(var k=t(r[a]);i.length&&Tt(k.from,te(i).to)<=0;){var z=i.pop();if(Tt(z.from,k.from)<0){k.from=z.from;break}}i.push(k)}Ni(e,function(){for(var $=i.length-1;$>=0;$--)rn(e.doc,"",i[$].from,i[$].to,"+delete");Zr(e)})}function Fa(e,t,r){var i=Ue(e.text,t+r,r);return i<0||i>e.text.length?null:i}function Ua(e,t,r){var i=Fa(e,t.ch,r);return i==null?null:new Ve(t.line,i,r<0?"after":"before")}function Ba(e,t,r,i,a){if(e){t.doc.direction=="rtl"&&(a=-a);var k=it(r,t.doc.direction);if(k){var z=a<0?te(k):k[0],$=a<0==(z.level==1),J=$?"after":"before",ee;if(z.level>0||t.doc.direction=="rtl"){var ce=Xr(t,r);ee=a<0?r.text.length-1:0;var ge=ar(t,ce,ee).top;ee=Je(function(Re){return ar(t,ce,Re).top==ge},a<0==(z.level==1)?z.from:z.to-1,ee),J=="before"&&(ee=Fa(r,ee,1))}else ee=a<0?z.to:z.from;return new Ve(i,ee,J)}}return new Ve(i,a<0?r.text.length:0,a<0?"before":"after")}function Pl(e,t,r,i){var a=it(t,e.doc.direction);if(!a)return Ua(t,r,i);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var k=Ze(a,r.ch,r.sticky),z=a[k];if(e.doc.direction=="ltr"&&z.level%2==0&&(i>0?z.to>r.ch:z.from<r.ch))return Ua(t,r,i);var $=function(rt,lt){return Fa(t,rt instanceof Ve?rt.ch:rt,lt)},J,ee=function(rt){return e.options.lineWrapping?(J=J||Xr(e,t),ds(e,t,J,rt)):{begin:0,end:t.text.length}},ce=ee(r.sticky=="before"?$(r,-1):r.ch);if(e.doc.direction=="rtl"||z.level==1){var ge=z.level==1==i<0,Re=$(r,ge?1:-1);if(Re!=null&&(ge?Re<=z.to&&Re<=ce.end:Re>=z.from&&Re>=ce.begin)){var Ae=ge?"before":"after";return new Ve(r.line,Re,Ae)}}var Be=function(rt,lt,nt){for(var ht=function(Xt,ci){return ci?new Ve(r.line,$(Xt,1),"before"):new Ve(r.line,Xt,"after")};rt>=0&&rt<a.length;rt+=lt){var Et=a[rt],yt=lt>0==(Et.level!=1),At=yt?nt.begin:$(nt.end,-1);if(Et.from<=At&&At<Et.to)return ht(At,yt);if(At=yt?Et.from:$(Et.to,-1),nt.begin<=At&&At<nt.end)return ht(At,yt)}},Ke=Be(k+i,i,ce);if(Ke)return Ke;var Xe=i>0?ce.end:$(ce.begin,-1);return Xe!=null&&!(i>0&&Xe==t.text.length)&&(Ke=Be(i>0?0:a.length-1,i,ee(Xe)),Ke)?Ke:null}var Mn={selectAll:Vs,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),me)},killLine:function(e){return sn(e,function(t){if(t.empty()){var r=pt(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:Ve(t.head.line+1,0)}:{from:t.head,to:Ve(t.head.line,r)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return sn(e,function(t){return{from:Ve(t.from().line,0),to:v(e.doc,Ve(t.to().line+1,0))}})},delLineLeft:function(e){return sn(e,function(t){return{from:Ve(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return sn(e,function(t){var r=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:r},"div");return{from:i,to:t.from()}})},delWrappedLineRight:function(e){return sn(e,function(t){var r=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"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(Ve(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ve(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 Ml(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},Ce)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},Ce)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:r},"div");return i.ch<e.getLine(i.line).search(/\S/)?ho(e,t.head):i},Ce)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),i=e.options.tabSize,a=0;a<r.length;a++){var k=r[a].from(),z=W(e.getLine(k.line),k.ch,i);t.push(le(i-z%i))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Ni(e,function(){for(var t=e.listSelections(),r=[],i=0;i<t.length;i++){if(!t[i].empty())continue;var a=t[i].head,k=pt(e.doc,a.line).text;if(k){if(a.ch==k.length&&(a=new Ve(a.line,a.ch-1)),a.ch>0)a=new Ve(a.line,a.ch+1),e.replaceRange(k.charAt(a.ch-1)+k.charAt(a.ch-2),Ve(a.line,a.ch-2),a,"+transpose");else if(a.line>e.doc.first){var z=pt(e.doc,a.line-1).text;z&&(a=new Ve(a.line,1),e.replaceRange(k.charAt(0)+e.doc.lineSeparator()+z.charAt(z.length-1),Ve(a.line-1,z.length-1),a,"+transpose"))}}r.push(new Gt(a,a))}e.setSelections(r)})},newlineAndIndent:function(e){return Ni(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var i=0;i<t.length;i++)e.indentLine(t[i].from().line,null,!0);Zr(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function uo(e,t){var r=pt(e.doc,t),i=wi(r);return i!=r&&(t=kt(i)),Ba(!0,e,i,t,1)}function Ml(e,t){var r=pt(e.doc,t),i=Vr(r);return i!=r&&(t=kt(i)),Ba(!0,e,r,t,-1)}function ho(e,t){var r=uo(e,t.line),i=pt(e.doc,r.line),a=it(i,e.doc.direction);if(!a||a[0].level==0){var k=Math.max(r.ch,i.text.search(/\S/)),z=t.line==r.line&&t.ch<=k&&t.ch;return Ve(r.line,z?0:k,r.sticky)}return r}function na(e,t,r){if(typeof t=="string"&&(t=Mn[t],!t))return!1;e.display.input.ensurePolled();var i=e.display.shift,a=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),a=t(e)!=we}finally{e.display.shift=i,e.state.suppressEdits=!1}return a}function Nl(e,t,r){for(var i=0;i<e.state.keyMaps.length;i++){var a=an(t,e.state.keyMaps[i],r,e);if(a)return a}return e.options.extraKeys&&an(t,e.options.extraKeys,r,e)||an(t,e.options.keyMap,r,e)}var Fl=new Y;function Nn(e,t,r,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,r,i))return!0}return co(e,t,r,i)}function co(e,t,r,i){var a=Nl(e,t,i);return a=="multi"&&(e.state.keySeq=t),a=="handled"&&mi(e,"keyHandled",e,t,r),(a=="handled"||a=="multi")&&(re(r),xa(e)),!!a}function fo(e,t){var r=lo(t,!0);return r?t.shiftKey&&!e.state.keySeq?Nn(e,"Shift-"+r,t,function(i){return na(e,i,!0)})||Nn(e,r,t,function(i){if(typeof i=="string"?/^go[A-Z]/.test(i):i.motion)return na(e,i)}):Nn(e,r,t,function(i){return na(e,i)}):!1}function Ul(e,t,r){return Nn(e,"'"+r+"'",t,function(i){return na(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=N(),He(t,e))return;K&&G<11&&e.keyCode==27&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=r==16||e.shiftKey;var i=fo(t,e);p&&(ja=i?r:null,!i&&r==88&&!Ut&&(o?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),P&&!o&&!i&&r==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),r==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;D(t,"CodeMirror-crosshair");function r(i){(i.keyCode==18||!i.altKey)&&(w(t,"CodeMirror-crosshair"),$e(document,"keyup",r),$e(document,"mouseover",r))}Ie(document,"keyup",r),Ie(document,"mouseover",r)}function mo(e){e.keyCode==16&&(this.doc.sel.shift=!1),He(this,e)}function go(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(hr(t.display,e)||He(t,e)||e.ctrlKey&&!e.altKey||o&&e.metaKey)return;var r=e.keyCode,i=e.charCode;if(p&&r==ja){ja=null,re(e);return}if(p&&(!e.which||e.which<10)&&fo(t,e))return;var a=String.fromCharCode(i==null?r:i);if(a=="\b")return;if(Ul(t,e,a))return;t.display.input.onKeyPress(e)}var jl=400,Ha=function(e,t,r){this.time=e,this.pos=t,this.button=r};Ha.prototype.compare=function(e,t,r){return this.time+jl>e&&Tt(t,this.pos)==0&&r==this.button};var Fn,Un;function Hl(e,t){var r=+new Date;return Un&&Un.compare(r,e,t)?(Fn=Un=null,"triple"):Fn&&Fn.compare(r,e,t)?(Un=new Ha(r,e,t),Fn=null,"double"):(Fn=new Ha(r,e,t),Un=null,"single")}function vo(e){var t=this,r=t.display;if(He(t,e)||r.activeTouch&&r.input.supportsTouch())return;if(r.input.ensurePolled(),r.shift=e.shiftKey,hr(r,e)){M||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));return}if(Wa(t,e))return;var i=Nr(t,e),a=Pe(e),k=i?Hl(i,a):"single";if(window.focus(),a==1&&t.state.selectingText&&t.state.selectingText(e),i&&Wl(t,a,i,k,e))return;a==1?i?zl(t,i,k,e):be(e)==r.scroller&&re(e):a==2?(i&&Jn(t.doc,i),setTimeout(function(){return r.input.focus()},20)):a==3&&(O?t.display.input.onContextMenu(e):vs(t))}function Wl(e,t,r,i,a){var k="Click";return i=="double"?k="Double"+k:i=="triple"&&(k="Triple"+k),k=(t==1?"Left":t==2?"Middle":"Right")+k,Nn(e,oo(k,a),a,function(z){if(typeof z=="string"&&(z=Mn[z]),!z)return!1;var $=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),$=z(e,r)!=we}finally{e.state.suppressEdits=!1}return $})}function Gl(e,t,r){var i=e.getOption("configureMouse"),a=i?i(e,t,r):{};if(a.unit==null){var k=h?r.shiftKey&&r.metaKey:r.altKey;a.unit=k?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(a.extend==null||e.doc.extend)&&(a.extend=e.doc.extend||r.shiftKey),a.addNew==null&&(a.addNew=o?r.metaKey:r.ctrlKey),a.moveOnDrag==null&&(a.moveOnDrag=!(o?r.altKey:r.ctrlKey)),a}function zl(e,t,r,i){K?setTimeout(I(gs,e),0):e.curOp.focus=N();var a=Gl(e,r,i),k=e.doc.sel,z;e.options.dragDrop&&Ge&&!e.isReadOnly()&&r=="single"&&(z=k.contains(t))>-1&&(Tt((z=k.ranges[z]).from(),t)<0||t.xRel>0)&&(Tt(z.to(),t)>0||t.xRel<0)?Kl(e,i,t,a):Vl(e,i,t,a)}function Kl(e,t,r,i){var a=e.display,k=!1,z=hi(e,function(ee){M&&(a.scroller.draggable=!1),e.state.draggingText=!1,$e(a.wrapper.ownerDocument,"mouseup",z),$e(a.wrapper.ownerDocument,"mousemove",$),$e(a.scroller,"dragstart",J),$e(a.scroller,"drop",z),k||(re(ee),i.addNew||Jn(e.doc,r,null,null,i.extend),M&&!f||K&&G==9?setTimeout(function(){a.wrapper.ownerDocument.body.focus({preventScroll:!0}),a.input.focus()},20):a.input.focus())}),$=function(ee){k=k||Math.abs(t.clientX-ee.clientX)+Math.abs(t.clientY-ee.clientY)>=10},J=function(){return k=!0};M&&(a.scroller.draggable=!0),e.state.draggingText=z,z.copy=!i.moveOnDrag,a.scroller.dragDrop&&a.scroller.dragDrop(),Ie(a.wrapper.ownerDocument,"mouseup",z),Ie(a.wrapper.ownerDocument,"mousemove",$),Ie(a.scroller,"dragstart",J),Ie(a.scroller,"drop",z),vs(e),setTimeout(function(){return a.input.focus()},20)}function yo(e,t,r){if(r=="char")return new Gt(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new Gt(Ve(t.line,0),v(e.doc,Ve(t.line+1,0)));var i=r(e,t);return new Gt(i.from,i.to)}function Vl(e,t,r,i){var a=e.display,k=e.doc;re(t);var z,$,J=k.sel,ee=J.ranges;if(i.addNew&&!i.extend?($=k.sel.contains(r),$>-1?z=ee[$]:z=new Gt(r,r)):(z=k.sel.primary(),$=k.sel.primIndex),i.unit=="rectangle")i.addNew||(z=new Gt(r,r)),r=Nr(e,t,!0,!0),$=-1;else{var ce=yo(e,r,i.unit);i.extend?z=Ma(z,ce.anchor,ce.head,i.extend):z=ce}i.addNew?$==-1?($=ee.length,Ei(k,Zi(e,ee.concat([z]),$),{scroll:!1,origin:"*mouse"})):ee.length>1&&ee[$].empty()&&i.unit=="char"&&!i.extend?(Ei(k,Zi(e,ee.slice(0,$).concat(ee.slice($+1)),0),{scroll:!1,origin:"*mouse"}),J=k.sel):Na(k,$,z,Se):($=0,Ei(k,new Wi([z],0),Se),J=k.sel);var ge=r;function Re(nt){if(Tt(ge,nt)==0)return;if(ge=nt,i.unit=="rectangle"){for(var ht=[],Et=e.options.tabSize,yt=W(pt(k,r.line).text,r.ch,Et),At=W(pt(k,nt.line).text,nt.ch,Et),Xt=Math.min(yt,At),ci=Math.max(yt,At),Jt=Math.min(r.line,nt.line),Fi=Math.min(e.lastLine(),Math.max(r.line,nt.line));Jt<=Fi;Jt++){var Ii=pt(k,Jt).text,ni=xe(Ii,Xt,Et);Xt==ci?ht.push(new Gt(Ve(Jt,ni),Ve(Jt,ni))):Ii.length>ni&&ht.push(new Gt(Ve(Jt,ni),Ve(Jt,xe(Ii,ci,Et))))}ht.length||ht.push(new Gt(r,r)),Ei(k,Zi(e,J.ranges.slice(0,$).concat(ht),$),{origin:"*mouse",scroll:!1}),e.scrollIntoView(nt)}else{var ki=z,gi=yo(e,nt,i.unit),oi=ki.anchor,ai;Tt(gi.anchor,oi)>0?(ai=gi.head,oi=vr(ki.from(),gi.anchor)):(ai=gi.anchor,oi=gr(ki.to(),gi.head));var ei=J.ranges.slice(0);ei[$]=Xl(e,new Gt(v(k,oi),ai)),Ei(k,Zi(e,ei,$),Se)}}var Ae=a.wrapper.getBoundingClientRect(),Be=0;function Ke(nt){var ht=++Be,Et=Nr(e,nt,!0,i.unit=="rectangle");if(!Et)return;if(Tt(Et,ge)!=0){e.curOp.focus=N(),Re(Et);var yt=Vn(a,k);(Et.line>=yt.to||Et.line<yt.from)&&setTimeout(hi(e,function(){Be==ht&&Ke(nt)}),150)}else{var At=nt.clientY<Ae.top?-20:nt.clientY>Ae.bottom?20:0;At&&setTimeout(hi(e,function(){if(Be!=ht)return;a.scroller.scrollTop+=At,Ke(nt)}),50)}}function Xe(nt){e.state.selectingText=!1,Be=Infinity,nt&&(re(nt),a.input.focus()),$e(a.wrapper.ownerDocument,"mousemove",rt),$e(a.wrapper.ownerDocument,"mouseup",lt),k.history.lastSelOrigin=null}var rt=hi(e,function(nt){nt.buttons===0||!Pe(nt)?Xe(nt):Ke(nt)}),lt=hi(e,Xe);e.state.selectingText=lt,Ie(a.wrapper.ownerDocument,"mousemove",rt),Ie(a.wrapper.ownerDocument,"mouseup",lt)}function Xl(e,t){var r=t.anchor,i=t.head,a=pt(e.doc,r.line);if(Tt(r,i)==0&&r.sticky==i.sticky)return t;var k=it(a);if(!k)return t;var z=Ze(k,r.ch,r.sticky),$=k[z];if($.from!=r.ch&&$.to!=r.ch)return t;var J=z+($.from==r.ch==($.level!=1)?0:1);if(J==0||J==k.length)return t;var ee;if(i.line!=r.line)ee=(i.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ce=Ze(k,i.ch,i.sticky),ge=ce-z||(i.ch-r.ch)*($.level==1?-1:1);ce==J-1||ce==J?ee=ge<0:ee=ge>0}var Re=k[J+(ee?-1:0)],Ae=ee==(Re.level==1),Be=Ae?Re.from:Re.to,Ke=Ae?"after":"before";return r.ch==Be&&r.sticky==Ke?t:new Gt(new Ve(r.line,Be,Ke),i)}function _o(e,t,r,i){var a,k;if(t.touches)a=t.touches[0].clientX,k=t.touches[0].clientY;else try{a=t.clientX,k=t.clientY}catch(Re){return!1}if(a>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&re(t);var z=e.display,$=z.lineDiv.getBoundingClientRect();if(k>$.bottom||!fe(e,r))return he(t);k-=$.top-z.viewOffset;for(var J=0;J<e.display.gutterSpecs.length;++J){var ee=z.gutters.childNodes[J];if(ee&&ee.getBoundingClientRect().right>=a){var ce=Bi(e.doc,k),ge=e.display.gutterSpecs[J];return De(e,r,e,ce,ge.className,t),he(t)}}}function Wa(e,t){return _o(e,t,"gutterClick",!0)}function bo(e,t){if(hr(e.display,t)||Yl(e,t))return;if(He(e,t,"contextmenu"))return;O||e.display.input.onContextMenu(t)}function Yl(e,t){return fe(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-"),yn(e)}var on={toString:function(){return"CodeMirror.Init"}},xo={},aa={};function $l(e){var t=e.optionHandlers;function r(i,a,k,z){e.defaults[i]=a,k&&(t[i]=z?function($,J,ee){ee!=on&&k($,J,ee)}:k)}e.defineOption=r,e.Init=on,r("value","",function(i,a){return i.setValue(a)},!0),r("mode",null,function(i,a){i.doc.modeOption=a,ka(i)},!0),r("indentUnit",2,ka,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(i){Cn(i),yn(i),Ri(i)},!0),r("lineSeparator",null,function(i,a){if(i.doc.lineSep=a,!a)return;var k=[],z=i.doc.first;i.doc.iter(function(J){for(var ee=0;;){var ce=J.text.indexOf(a,ee);if(ce==-1)break;ee=ce+a.length,k.push(Ve(z,ce))}z++});for(var $=k.length-1;$>=0;$--)rn(i.doc,a,k[$],Ve(k[$].line,k[$].ch+a.length))}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(i,a,k){i.state.specialChars=new RegExp(a.source+(a.test(" ")?"":"| "),"g"),k!=on&&i.refresh()}),r("specialCharPlaceholder",Vt,function(i){return i.refresh()},!0),r("electricChars",!0),r("inputStyle",n?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),r("spellcheck",!1,function(i,a){return i.getInputField().spellcheck=a},!0),r("autocorrect",!1,function(i,a){return i.getInputField().autocorrect=a},!0),r("autocapitalize",!1,function(i,a){return i.getInputField().autocapitalize=a},!0),r("rtlMoveVisually",!L),r("wholeLineUpdateBefore",!0),r("theme","default",function(i){Eo(i),Sn(i)},!0),r("keyMap","default",function(i,a,k){var z=ra(a),$=k!=on&&ra(k);$&&$.detach&&$.detach(i,z),z.attach&&z.attach(i,$||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Zl,!0),r("gutters",[],function(i,a){i.display.gutterSpecs=La(a,i.options.lineNumbers),Sn(i)},!0),r("fixedGutter",!0,function(i,a){i.display.gutters.style.left=a?ba(i.display)+"px":"0",i.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(i){return Jr(i)},!0),r("scrollbarStyle","native",function(i){Ts(i),Jr(i),i.display.scrollbars.setScrollTop(i.doc.scrollTop),i.display.scrollbars.setScrollLeft(i.doc.scrollLeft)},!0),r("lineNumbers",!1,function(i,a){i.display.gutterSpecs=La(i.options.gutters,a),Sn(i)},!0),r("firstLineNumber",1,Sn,!0),r("lineNumberFormatter",function(i){return i},Sn,!0),r("showCursorWhenSelecting",!1,_n,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(i,a){a=="nocursor"&&(Qr(i),i.display.input.blur()),i.display.input.readOnlyChanged(a)}),r("screenReaderLabel",null,function(i,a){a=a===""?null:a,i.display.input.screenReaderLabelChanged(a)}),r("disableInput",!1,function(i,a){a||i.display.input.reset()},!0),r("dragDrop",!0,Ql),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,_n,!0),r("singleCursorHeightPerLine",!0,_n,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Cn,!0),r("addModeClass",!1,Cn,!0),r("pollInterval",100),r("undoDepth",200,function(i,a){return i.doc.history.undoDepth=a}),r("historyEventDelay",1250),r("viewportMargin",10,function(i){return i.refresh()},!0),r("maxHighlightLength",1e4,Cn,!0),r("moveInputWithCursor",!0,function(i,a){a||i.display.input.resetPosition()}),r("tabindex",null,function(i,a){return i.display.input.getField().tabIndex=a||""}),r("autofocus",null),r("direction","ltr",function(i,a){return i.doc.setDirection(a)},!0),r("phrases",null)}function Ql(e,t,r){var i=r&&r!=on;if(!t!=!i){var a=e.display.dragFunctions,k=t?Ie:$e;k(e.display.scroller,"dragstart",a.start),k(e.display.scroller,"dragenter",a.enter),k(e.display.scroller,"dragover",a.over),k(e.display.scroller,"dragleave",a.leave),k(e.display.scroller,"drop",a.drop)}}function Zl(e){e.options.lineWrapping?(D(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(w(e.display.wrapper,"CodeMirror-wrap"),jn(e)),Ea(e),Ri(e),yn(e),setTimeout(function(){return Jr(e)},100)}function Qt(e,t){var r=this;if(!(this instanceof Qt))return new Qt(e,t);this.options=t=t?y(t):{},y(xo,t,!1);var i=t.value;typeof i=="string"?i=new Li(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var a=new Qt.inputStyles[t.inputStyle](this),k=this.display=new hl(e,i,a,t);k.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 Y,keySeq:null,specialChars:null},t.autofocus&&!n&&k.input.focus(),K&&G<11&&setTimeout(function(){return r.display.input.reset(!0)},20),Jl(this),Rl(),jr(this),this.curOp.forceUpdate=!0,Ds(this,i),t.autofocus&&!n||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&Ta(r)},20):Qr(this);for(var z in aa)aa.hasOwnProperty(z)&&aa[z](this,t[z],on);Cs(this),t.finishInit&&t.finishInit(this);for(var $=0;$<Ga.length;++$)Ga[$](this);Hr(this),M&&t.lineWrapping&&getComputedStyle(k.lineDiv).textRendering=="optimizelegibility"&&(k.lineDiv.style.textRendering="auto")}Qt.defaults=xo,Qt.optionHandlers=aa;function Jl(e){var t=e.display;Ie(t.scroller,"mousedown",hi(e,vo)),K&&G<11?Ie(t.scroller,"dblclick",hi(e,function(J){if(He(e,J))return;var ee=Nr(e,J);if(!ee||Wa(e,J)||hr(e.display,J))return;re(J);var ce=e.findWordAt(ee);Jn(e.doc,ce.anchor,ce.head)})):Ie(t.scroller,"dblclick",function(J){return He(e,J)||re(J)}),Ie(t.scroller,"contextmenu",function(J){return bo(e,J)}),Ie(t.input.getField(),"contextmenu",function(J){t.scroller.contains(J.target)||bo(e,J)});var r,i={end:0};function a(){t.activeTouch&&(r=setTimeout(function(){return t.activeTouch=null},1e3),i=t.activeTouch,i.end=+new Date)}function k(J){if(J.touches.length!=1)return!1;var ee=J.touches[0];return ee.radiusX<=1&&ee.radiusY<=1}function z(J,ee){if(ee.left==null)return!0;var ce=ee.left-J.left,ge=ee.top-J.top;return ce*ce+ge*ge>20*20}Ie(t.scroller,"touchstart",function(J){if(!He(e,J)&&!k(J)&&!Wa(e,J)){t.input.ensurePolled(),clearTimeout(r);var ee=+new Date;t.activeTouch={start:ee,moved:!1,prev:ee-i.end<=300?i:null},J.touches.length==1&&(t.activeTouch.left=J.touches[0].pageX,t.activeTouch.top=J.touches[0].pageY)}}),Ie(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ie(t.scroller,"touchend",function(J){var ee=t.activeTouch;if(ee&&!hr(t,J)&&ee.left!=null&&!ee.moved&&new Date-ee.start<300){var ce=e.coordsChar(t.activeTouch,"page"),ge;!ee.prev||z(ee,ee.prev)?ge=new Gt(ce,ce):!ee.prev.prev||z(ee,ee.prev.prev)?ge=e.findWordAt(ce):ge=new Gt(Ve(ce.line,0),v(e.doc,Ve(ce.line+1,0))),e.setSelection(ge.anchor,ge.head),e.focus(),re(J)}a()}),Ie(t.scroller,"touchcancel",a),Ie(t.scroller,"scroll",function(){t.scroller.clientHeight&&(En(e,t.scroller.scrollTop),Ur(e,t.scroller.scrollLeft,!0),De(e,"scroll",e))}),Ie(t.scroller,"mousewheel",function(J){return Rs(e,J)}),Ie(t.scroller,"DOMMouseScroll",function(J){return Rs(e,J)}),Ie(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(J){He(e,J)||ve(J)},over:function(J){He(e,J)||(Ol(e,J),ve(J))},start:function(J){return Al(e,J)},drop:hi(e,Cl),leave:function(J){He(e,J)||ro(e)}};var $=t.input.getField();Ie($,"keyup",function(J){return mo.call(e,J)}),Ie($,"keydown",hi(e,po)),Ie($,"keypress",hi(e,go)),Ie($,"focus",function(J){return Ta(e,J)}),Ie($,"blur",function(J){return Qr(e,J)})}var Ga=[];Qt.defineInitHook=function(e){return Ga.push(e)};function Bn(e,t,r,i){var a=e.doc,k;r==null&&(r="add"),r=="smart"&&(a.mode.indent?k=qe(e,t).state:r="prev");var z=e.options.tabSize,$=pt(a,t),J=W($.text,null,z);$.stateAfter&&($.stateAfter=null);var ee=$.text.match(/^\s*/)[0],ce;if(!i&&!/\S/.test($.text))ce=0,r="not";else if(r=="smart"&&(ce=a.mode.indent(k,$.text.slice(ee.length),$.text),ce==we||ce>150)){if(!i)return;r="prev"}r=="prev"?t>a.first?ce=W(pt(a,t-1).text,null,z):ce=0:r=="add"?ce=J+e.options.indentUnit:r=="subtract"?ce=J-e.options.indentUnit:typeof r=="number"&&(ce=J+r),ce=Math.max(0,ce);var ge="",Re=0;if(e.options.indentWithTabs)for(var Ae=Math.floor(ce/z);Ae;--Ae)Re+=z,ge+=" ";if(Re<ce&&(ge+=le(ce-Re)),ge!=ee)return rn(a,ge,Ve(t,0),Ve(t,ee.length),"+input"),$.stateAfter=null,!0;for(var Be=0;Be<a.sel.ranges.length;Be++){var Ke=a.sel.ranges[Be];if(Ke.head.line==t&&Ke.head.ch<ee.length){var Xe=Ve(t,ee.length);Na(a,Be,new Gt(Xe,Xe));break}}}var Ji=null;function sa(e){Ji=e}function za(e,t,r,i,a){var k=e.doc;e.display.shift=!1,i||(i=k.sel);var z=+new Date-200,$=a=="paste"||e.state.pasteIncoming>z,J=xt(t),ee=null;if($&&i.ranges.length>1)if(Ji&&Ji.text.join(`
|
|
`)==t){if(i.ranges.length%Ji.text.length==0){ee=[];for(var ce=0;ce<Ji.text.length;ce++)ee.push(k.splitLines(Ji.text[ce]))}}else J.length==i.ranges.length&&e.options.pasteLinesPerSelection&&(ee=de(J,function(rt){return[rt]}));for(var ge=e.curOp.updateInput,Re=i.ranges.length-1;Re>=0;Re--){var Ae=i.ranges[Re],Be=Ae.from(),Ke=Ae.to();Ae.empty()&&(r&&r>0?Be=Ve(Be.line,Be.ch-r):e.state.overwrite&&!$?Ke=Ve(Ke.line,Math.min(pt(k,Ke.line).text.length,Ke.ch+te(J).length)):$&&Ji&&Ji.lineWise&&Ji.text.join(`
|
|
`)==J.join(`
|
|
`)&&(Be=Ke=Ve(Be.line,0)));var Xe={from:Be,to:Ke,text:ee?ee[Re%ee.length]:J,origin:a||($?"paste":e.state.cutIncoming>z?"cut":"+input")};tn(e.doc,Xe),mi(e,"inputRead",e,Xe)}t&&!$&&wo(e,t),Zr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ge),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function To(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Ni(t,function(){return za(t,r,0,null,"paste")}),!0}function wo(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var r=e.doc.sel,i=r.ranges.length-1;i>=0;i--){var a=r.ranges[i];if(a.head.ch>100||i&&r.ranges[i-1].head.line==a.head.line)continue;var k=e.getModeAt(a.head),z=!1;if(k.electricChars){for(var $=0;$<k.electricChars.length;$++)if(t.indexOf(k.electricChars.charAt($))>-1){z=Bn(e,a.head.line,"smart");break}}else k.electricInput&&(k.electricInput.test(pt(e.doc,a.head.line).text.slice(0,a.head.ch))&&(z=Bn(e,a.head.line,"smart")));z&&mi(e,"electricInput",e,a.head.line)}}function So(e){for(var t=[],r=[],i=0;i<e.doc.sel.ranges.length;i++){var a=e.doc.sel.ranges[i].head.line,k={anchor:Ve(a,0),head:Ve(a+1,0)};r.push(k),t.push(e.getRange(k.anchor,k.head))}return{text:t,ranges:r}}function Co(e,t,r,i){e.setAttribute("autocorrect",r?"":"off"),e.setAttribute("autocapitalize",i?"":"off"),e.setAttribute("spellcheck",!!t)}function Ao(){var e=u("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=u("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return M?e.style.width="1000px":e.setAttribute("wrap","off"),c&&(e.style.border="1px solid black"),Co(e),t}function ql(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(i,a){var k=this.options,z=k[i];if(k[i]==a&&i!="mode")return;k[i]=a,t.hasOwnProperty(i)&&hi(this,t[i])(this,a,z),De(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"](ra(i))},removeKeyMap:function(i){for(var a=this.state.keyMaps,k=0;k<a.length;++k)if(a[k]==i||a[k].name==i)return a.splice(k,1),!0},addOverlay:Si(function(i,a){var k=i.token?i:e.getMode(this.options,i);if(k.startState)throw new Error("Overlays may not be stateful.");se(this.state.overlays,{mode:k,modeSpec:i,opaque:a&&a.opaque,priority:a&&a.priority||0},function(z){return z.priority}),this.state.modeGen++,Ri(this)}),removeOverlay:Si(function(i){for(var a=this.state.overlays,k=0;k<a.length;++k){var z=a[k].modeSpec;if(z==i||typeof i=="string"&&z.name==i){a.splice(k,1),this.state.modeGen++,Ri(this);return}}}),indentLine:Si(function(i,a,k){typeof a!="string"&&typeof a!="number"&&(a==null?a=this.options.smartIndent?"smart":"prev":a=a?"add":"subtract"),Vi(this.doc,i)&&Bn(this,i,a,k)}),indentSelection:Si(function(i){for(var a=this.doc.sel.ranges,k=-1,z=0;z<a.length;z++){var $=a[z];if($.empty())$.head.line>k&&(Bn(this,$.head.line,i,!0),k=$.head.line,z==this.doc.sel.primIndex&&Zr(this));else{var J=$.from(),ee=$.to(),ce=Math.max(k,J.line);k=Math.min(this.lastLine(),ee.line-(ee.ch?0:1))+1;for(var ge=ce;ge<k;++ge)Bn(this,ge,i);var Re=this.doc.sel.ranges;J.ch==0&&a.length==Re.length&&Re[z].from().ch>0&&Na(this.doc,z,new Gt(J,Re[z].to()),me)}}}),getTokenAt:function(i,a){return $t(this,i,a)},getLineTokens:function(i,a){return $t(this,Ve(i),a,!0)},getTokenTypeAt:function(i){i=v(this.doc,i);var a=We(this,pt(this.doc,i.line)),k=0,z=(a.length-1)/2,$=i.ch,J;if($==0)J=a[2];else for(;;){var ee=k+z>>1;if((ee?a[ee*2-1]:0)>=$)z=ee;else if(a[ee*2+1]<$)k=ee+1;else{J=a[ee*2+2];break}}var ce=J?J.indexOf("overlay "):-1;return ce<0?J:ce==0?null:J.slice(0,ce-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 k=[];if(!r.hasOwnProperty(a))return k;var z=r[a],$=this.getModeAt(i);if(typeof $[a]=="string")z[$[a]]&&k.push(z[$[a]]);else if($[a])for(var J=0;J<$[a].length;J++){var ee=z[$[a][J]];ee&&k.push(ee)}else $.helperType&&z[$.helperType]?k.push(z[$.helperType]):z[$.name]&&k.push(z[$.name]);for(var ce=0;ce<z._global.length;ce++){var ge=z._global[ce];ge.pred($,this)&&ie(k,ge.val)==-1&&k.push(ge.val)}return k},getStateAfter:function(i,a){var k=this.doc;return i=X(k,i==null?k.first+k.size-1:i),qe(this,i+1,a).state},cursorCoords:function(i,a){var k,z=this.doc.sel.primary();return i==null?k=z.head:typeof i=="object"?k=v(this.doc,i):k=i?z.from():z.to(),Qi(this,k,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,Bi(this.doc,i+this.display.viewOffset)},heightAtLine:function(i,a,k){var z=!1,$;if(typeof i=="number"){var J=this.doc.first+this.doc.size-1;i<this.doc.first?i=this.doc.first:i>J&&(i=J,z=!0),$=pt(this.doc,i)}else $=i;return Wn(this,$,{top:0,left:0},a||"page",k||z).top+(z?this.doc.height-$i($):0)},defaultTextHeight:function(){return Yr(this.display)},defaultCharWidth:function(){return $r(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(i,a,k,z,$){var J=this.display;i=Qi(this,v(this.doc,i));var ee=i.bottom,ce=i.left;if(a.style.position="absolute",a.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(a),J.sizer.appendChild(a),z=="over")ee=i.top;else if(z=="above"||z=="near"){var ge=Math.max(J.wrapper.clientHeight,this.doc.height),Re=Math.max(J.sizer.clientWidth,J.lineSpace.clientWidth);(z=="above"||i.bottom+a.offsetHeight>ge)&&i.top>a.offsetHeight?ee=i.top-a.offsetHeight:i.bottom+a.offsetHeight<=ge&&(ee=i.bottom),ce+a.offsetWidth>Re&&(ce=Re-a.offsetWidth)}a.style.top=ee+"px",a.style.left=a.style.right="",$=="right"?(ce=J.sizer.clientWidth-a.offsetWidth,a.style.right="0px"):($=="left"?ce=0:$=="middle"&&(ce=(J.sizer.clientWidth-a.offsetWidth)/2),a.style.left=ce+"px"),k&&Qo(this,{left:ce,top:ee,right:ce+a.offsetWidth,bottom:ee+a.offsetHeight})},triggerOnKeyDown:Si(po),triggerOnKeyPress:Si(go),triggerOnKeyUp:mo,triggerOnMouseDown:Si(vo),execCommand:function(i){if(Mn.hasOwnProperty(i))return Mn[i].call(null,this)},triggerElectric:Si(function(i){wo(this,i)}),findPosH:function(i,a,k,z){var $=1;a<0&&($=-1,a=-a);for(var J=v(this.doc,i),ee=0;ee<a&&!(J=Ka(this.doc,J,$,k,z),J.hitSide);++ee);return J},moveH:Si(function(i,a){var k=this;this.extendSelectionsBy(function(z){return k.display.shift||k.doc.extend||z.empty()?Ka(k.doc,z.head,i,a,k.options.rtlMoveVisually):i<0?z.from():z.to()},Ce)}),deleteH:Si(function(i,a){var k=this.doc.sel,z=this.doc;k.somethingSelected()?z.replaceSelection("",null,"+delete"):sn(this,function($){var J=Ka(z,$.head,i,a,!1);return i<0?{from:J,to:$.head}:{from:$.head,to:J}})}),findPosV:function(i,a,k,z){var $=1,J=z;a<0&&($=-1,a=-a);for(var ee=v(this.doc,i),ce=0;ce<a;++ce){var ge=Qi(this,ee,"div");if(J==null?J=ge.left:ge.left=J,ee=Oo(this,ge,$,k),ee.hitSide)break}return ee},moveV:Si(function(i,a){var k=this,z=this.doc,$=[],J=!this.display.shift&&!z.extend&&z.sel.somethingSelected();if(z.extendSelectionsBy(function(ce){if(J)return i<0?ce.from():ce.to();var ge=Qi(k,ce.head,"div");ce.goalColumn!=null&&(ge.left=ce.goalColumn),$.push(ge.left);var Re=Oo(k,ge,i,a);return a=="page"&&ce==z.sel.primary()&&Sa(k,ma(k,Re,"div").top-ge.top),Re},Ce),$.length)for(var ee=0;ee<z.sel.ranges.length;ee++)z.sel.ranges[ee].goalColumn=$[ee]}),findWordAt:function(i){var a=this.doc,k=pt(a,i.line).text,z=i.ch,$=i.ch;if(k){var J=this.getHelper(i,"wordChars");(i.sticky=="before"||$==k.length)&&z?--z:++$;for(var ee=k.charAt(z),ce=Me(ee,J)?function(ge){return Me(ge,J)}:/\s/.test(ee)?function(ge){return/\s/.test(ge)}:function(ge){return!/\s/.test(ge)&&!Me(ge)};z>0&&ce(k.charAt(z-1));)--z;for(;$<k.length&&ce(k.charAt($));)++$}return new Gt(Ve(i.line,z),Ve(i.line,$))},toggleOverwrite:function(i){if(i!=null&&i==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?D(this.display.cursorDiv,"CodeMirror-overwrite"):w(this.display.cursorDiv,"CodeMirror-overwrite"),De(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==N()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Si(function(i,a){bn(this,i,a)}),getScrollInfo:function(){var i=this.display.scroller;return{left:i.scrollLeft,top:i.scrollTop,height:i.scrollHeight-nr(this)-this.display.barHeight,width:i.scrollWidth-nr(this)-this.display.barWidth,clientHeight:ca(this),clientWidth:Pr(this)}},scrollIntoView:Si(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:Ve(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?Zo(this,i):_s(this,i.from,i.to,i.margin)}),setSize:Si(function(i,a){var k=this,z=function(J){return typeof J=="number"||/^\d+$/.test(String(J))?J+"px":J};i!=null&&(this.display.wrapper.style.width=z(i)),a!=null&&(this.display.wrapper.style.height=z(a)),this.options.lineWrapping&&as(this);var $=this.display.viewFrom;this.doc.iter($,this.display.viewTo,function(J){if(J.widgets){for(var ee=0;ee<J.widgets.length;ee++)if(J.widgets[ee].noHScroll){Tr(k,$,"widget");break}}++$}),this.curOp.forceUpdate=!0,De(this,"refresh",this)}),operation:function(i){return Ni(this,i)},startOperation:function(){return jr(this)},endOperation:function(){return Hr(this)},refresh:Si(function(){var i=this.display.cachedTextHeight;Ri(this),this.curOp.forceUpdate=!0,yn(this),bn(this,this.doc.scrollLeft,this.doc.scrollTop),Oa(this.display),(i==null||Math.abs(i-Yr(this.display))>.5||this.options.lineWrapping)&&Ea(this),De(this,"refresh",this)}),swapDoc:Si(function(i){var a=this.doc;return a.cm=null,this.state.selectingText&&this.state.selectingText(),Ds(this,i),yn(this),this.display.input.reset(),bn(this,i.scrollLeft,i.scrollTop),this.curOp.forceScroll=!0,mi(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}},_e(e),e.registerHelper=function(i,a,k){r.hasOwnProperty(i)||(r[i]=e[i]={_global:[]}),r[i][a]=k},e.registerGlobalHelper=function(i,a,k,z){e.registerHelper(i,a,z),r[i]._global.push({pred:k,val:z})}}function Ka(e,t,r,i,a){var k=t,z=r,$=pt(e,t.line),J=a&&e.direction=="rtl"?-r:r;function ee(){var lt=t.line+J;return lt<e.first||lt>=e.first+e.size?!1:(t=new Ve(lt,t.ch,t.sticky),$=pt(e,lt))}function ce(lt){var nt;if(i=="codepoint"){var ht=$.text.charCodeAt(t.ch+(i>0?0:-1));isNaN(ht)?nt=null:nt=new Ve(t.line,Math.max(0,Math.min($.text.length,t.ch+r*(ht>=55296&&ht<56320?2:1))),-r)}else a?nt=Pl(e.cm,$,t,r):nt=Ua($,t,r);if(nt==null)if(!lt&&ee())t=Ba(a,e.cm,$,t.line,J);else return!1;else t=nt;return!0}if(i=="char"||i=="codepoint")ce();else if(i=="column")ce(!0);else if(i=="word"||i=="group")for(var ge=null,Re=i=="group",Ae=e.cm&&e.cm.getHelper(t,"wordChars"),Be=!0;!(r<0&&!ce(!Be));Be=!1){var Ke=$.text.charAt(t.ch)||`
|
|
`,Xe=Me(Ke,Ae)?"w":Re&&Ke==`
|
|
`?"n":!Re||/\s/.test(Ke)?null:"p";if(Re&&!Be&&!Xe&&(Xe="s"),ge&&ge!=Xe){r<0&&(r=1,ce(),t.sticky="after");break}if(Xe&&(ge=Xe),r>0&&!ce(!Be))break}var rt=ea(e,t,k,z,!0);return pr(k,rt)&&(rt.hitSide=!0),rt}function Oo(e,t,r,i){var a=e.doc,k=t.left,z;if(i=="page"){var $=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),J=Math.max($-.5*Yr(e.display),3);z=(r>0?t.bottom:t.top)+r*J}else i=="line"&&(z=r>0?t.bottom+3:t.top-3);for(var ee;!(ee=va(e,k,z),!ee.outside);){if(r<0?z<=0:z>=a.height){ee.hitSide=!0;break}z+=r*5}return ee}var Kt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Y,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Kt.prototype.init=function(e){var t=this,r=this,i=r.cm,a=r.div=e.lineDiv;Co(a,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize);function k($){for(var J=$.target;J;J=J.parentNode){if(J==a)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(J.className))break}return!1}Ie(a,"paste",function($){if(!k($)||He(i,$)||To($,i))return;G<=11&&setTimeout(hi(i,function(){return t.updateFromDOM()}),20)}),Ie(a,"compositionstart",function($){t.composing={data:$.data,done:!1}}),Ie(a,"compositionupdate",function($){t.composing||(t.composing={data:$.data,done:!1})}),Ie(a,"compositionend",function($){t.composing&&($.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ie(a,"touchstart",function(){return r.forceCompositionEnd()}),Ie(a,"input",function(){t.composing||t.readFromDOMSoon()});function z($){if(!k($)||He(i,$))return;if(i.somethingSelected())sa({lineWise:!1,text:i.getSelections()}),$.type=="cut"&&i.replaceSelection("",null,"cut");else if(i.options.lineWiseCopyCut){var J=So(i);sa({lineWise:!0,text:J.text}),$.type=="cut"&&i.operation(function(){i.setSelections(J.ranges,0,me),i.replaceSelection("",null,"cut")})}else return;if($.clipboardData){$.clipboardData.clearData();var ee=Ji.text.join(`
|
|
`);if($.clipboardData.setData("Text",ee),$.clipboardData.getData("Text")==ee){$.preventDefault();return}}var ce=Ao(),ge=ce.firstChild;i.display.lineSpace.insertBefore(ce,i.display.lineSpace.firstChild),ge.value=Ji.text.join(`
|
|
`);var Re=document.activeElement;j(ge),setTimeout(function(){i.display.lineSpace.removeChild(ce),Re.focus(),Re==a&&r.showPrimarySelection()},50)}Ie(a,"copy",z),Ie(a,"cut",z)},Kt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Kt.prototype.prepareSelection=function(){var e=ps(this.cm,!1);return e.focus=document.activeElement==this.div,e},Kt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Kt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Kt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),i=r.from(),a=r.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||a.line<t.display.viewFrom){e.removeAllRanges();return}var k=oa(t,e.anchorNode,e.anchorOffset),z=oa(t,e.focusNode,e.focusOffset);if(k&&!k.bad&&z&&!z.bad&&Tt(vr(k,z),i)==0&&Tt(gr(k,z),a)==0)return;var $=t.display.view,J=i.line>=t.display.viewFrom&&Ro(t,i)||{node:$[0].measure.map[2],offset:0},ee=a.line<t.display.viewTo&&Ro(t,a);if(!ee){var ce=$[$.length-1].measure,ge=ce.maps?ce.maps[ce.maps.length-1]:ce.map;ee={node:ge[ge.length-1],offset:ge[ge.length-2]-ge[ge.length-3]}}if(!J||!ee){e.removeAllRanges();return}var Re=e.rangeCount&&e.getRangeAt(0),Ae;try{Ae=m(J.node,J.offset,ee.offset,ee.node)}catch(Be){}Ae&&(!P&&t.state.focused?(e.collapse(J.node,J.offset),Ae.collapsed||(e.removeAllRanges(),e.addRange(Ae))):(e.removeAllRanges(),e.addRange(Ae)),Re&&e.anchorNode==null?e.addRange(Re):P&&this.startGracePeriod()),this.rememberSelection()},Kt.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)},Kt.prototype.showMultipleSelections=function(e){_(this.cm.display.cursorDiv,e.cursors),_(this.cm.display.selectionDiv,e.selection)},Kt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Kt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return b(this.div,t)},Kt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Kt.prototype.blur=function(){this.div.blur()},Kt.prototype.getField=function(){return this.div},Kt.prototype.supportsTouch=function(){return!0},Kt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Ni(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)},Kt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Kt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(l&&g&&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 r=oa(t,e.anchorNode,e.anchorOffset),i=oa(t,e.focusNode,e.focusOffset);r&&i&&Ni(t,function(){Ei(t.doc,Sr(r,i),me),(r.bad||i.bad)&&(t.curOp.selectionChanged=!0)})},Kt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,r=e.doc.sel.primary(),i=r.from(),a=r.to();if(i.ch==0&&i.line>e.firstLine()&&(i=Ve(i.line-1,pt(e.doc,i.line-1).length)),a.ch==pt(e.doc,a.line).text.length&&a.line<e.lastLine()&&(a=Ve(a.line+1,0)),i.line<t.viewFrom||a.line>t.viewTo-1)return!1;var k,z,$;i.line==t.viewFrom||(k=Fr(e,i.line))==0?(z=kt(t.view[0].line),$=t.view[0].node):(z=kt(t.view[k].line),$=t.view[k-1].node.nextSibling);var J=Fr(e,a.line),ee,ce;if(J==t.view.length-1?(ee=t.viewTo-1,ce=t.lineDiv.lastChild):(ee=kt(t.view[J+1].line)-1,ce=t.view[J+1].node.previousSibling),!$)return!1;for(var ge=e.doc.splitLines(tu(e,$,ce,z,ee)),Re=Gi(e.doc,Ve(z,0),Ve(ee,pt(e.doc,ee).text.length));ge.length>1&&Re.length>1;)if(te(ge)==te(Re))ge.pop(),Re.pop(),ee--;else if(ge[0]==Re[0])ge.shift(),Re.shift(),z++;else break;for(var Ae=0,Be=0,Ke=ge[0],Xe=Re[0],rt=Math.min(Ke.length,Xe.length);Ae<rt&&Ke.charCodeAt(Ae)==Xe.charCodeAt(Ae);)++Ae;for(var lt=te(ge),nt=te(Re),ht=Math.min(lt.length-(ge.length==1?Ae:0),nt.length-(Re.length==1?Ae:0));Be<ht&<.charCodeAt(lt.length-Be-1)==nt.charCodeAt(nt.length-Be-1);)++Be;if(ge.length==1&&Re.length==1&&z==i.line)for(;Ae&&Ae>i.ch&<.charCodeAt(lt.length-Be-1)==nt.charCodeAt(nt.length-Be-1);)Ae--,Be++;ge[ge.length-1]=lt.slice(0,lt.length-Be).replace(/^\u200b+/,""),ge[0]=ge[0].slice(Ae).replace(/\u200b+$/,"");var Et=Ve(z,Ae),yt=Ve(ee,Re.length?te(Re).length-Be:0);if(ge.length>1||ge[0]||Tt(Et,yt))return rn(e.doc,ge,Et,yt,"+input"),!0},Kt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Kt.prototype.reset=function(){this.forceCompositionEnd()},Kt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Kt.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)},Kt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Ni(this.cm,function(){return Ri(e.cm)})},Kt.prototype.setUneditable=function(e){e.contentEditable="false"},Kt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||hi(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Kt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Kt.prototype.onContextMenu=function(){},Kt.prototype.resetPosition=function(){},Kt.prototype.needsContentAttribute=!0;function Ro(e,t){var r=fa(e,t.line);if(!r||r.hidden)return null;var i=pt(e.doc,t.line),a=es(r,i,t.line),k=it(i,e.doc.direction),z="left";if(k){var $=Ze(k,t.ch);z=$%2?"right":"left"}var J=rs(a.map,t.ch,z);return J.offset=J.collapse=="right"?J.end:J.start,J}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function ln(e,t){return t&&(e.bad=!0),e}function tu(e,t,r,i,a){var k="",z=!1,$=e.doc.lineSeparator(),J=!1;function ee(Ae){return function(Be){return Be.id==Ae}}function ce(){z&&(k+=$,J&&(k+=$),z=J=!1)}function ge(Ae){Ae&&(ce(),k+=Ae)}function Re(Ae){if(Ae.nodeType==1){var Be=Ae.getAttribute("cm-text");if(Be){ge(Be);return}var Ke=Ae.getAttribute("cm-marker"),Xe;if(Ke){var rt=e.findMarks(Ve(i,0),Ve(a+1,0),ee(+Ke));rt.length&&(Xe=rt[0].find(0))&&ge(Gi(e.doc,Xe.from,Xe.to).join($));return}if(Ae.getAttribute("contenteditable")=="false")return;var lt=/^(pre|div|p|li|table|br)$/i.test(Ae.nodeName);if(!/^br$/i.test(Ae.nodeName)&&Ae.textContent.length==0)return;lt&&ce();for(var nt=0;nt<Ae.childNodes.length;nt++)Re(Ae.childNodes[nt]);/^(pre|p)$/i.test(Ae.nodeName)&&(J=!0),lt&&(z=!0)}else Ae.nodeType==3&&ge(Ae.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Re(t),t==r);)t=t.nextSibling,J=!1;return k}function oa(e,t,r){var i;if(t==e.display.lineDiv){if(i=e.display.lineDiv.childNodes[r],!i)return ln(e.clipPos(Ve(e.display.viewTo-1)),!0);t=null,r=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 k=e.display.view[a];if(k.node==i)return iu(k,t,r)}}function iu(e,t,r){var i=e.text.firstChild,a=!1;if(!t||!b(i,t))return ln(Ve(kt(e.line),0),!0);if(t==i&&(a=!0,t=i.childNodes[r],r=0,!t)){var k=e.rest?te(e.rest):e.line;return ln(Ve(kt(k),k.text.length),a)}var z=t.nodeType==3?t:null,$=t;for(!z&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(z=t.firstChild,r&&(r=z.nodeValue.length));$.parentNode!=i;)$=$.parentNode;var J=e.measure,ee=J.maps;function ce(Xe,rt,lt){for(var nt=-1;nt<(ee?ee.length:0);nt++)for(var ht=nt<0?J.map:ee[nt],Et=0;Et<ht.length;Et+=3){var yt=ht[Et+2];if(yt==Xe||yt==rt){var At=kt(nt<0?e.line:e.rest[nt]),Xt=ht[Et]+lt;return(lt<0||yt!=Xe)&&(Xt=ht[Et+(lt?1:0)]),Ve(At,Xt)}}}var ge=ce(z,$,r);if(ge)return ln(ge,a);for(var Re=$.nextSibling,Ae=z?z.nodeValue.length-r:0;Re;Re=Re.nextSibling){if(ge=ce(Re,Re.firstChild,0),ge)return ln(Ve(ge.line,ge.ch-Ae),a);Ae+=Re.textContent.length}for(var Be=$.previousSibling,Ke=r;Be;Be=Be.previousSibling){if(ge=ce(Be,Be.firstChild,-1),ge)return ln(Ve(ge.line,ge.ch+Ke),a);Ke+=Be.textContent.length}}var ii=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Y,this.hasSelection=!1,this.composing=null};ii.prototype.init=function(e){var t=this,r=this,i=this.cm;this.createField(e);var a=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),c&&(a.style.width="0px"),Ie(a,"input",function(){K&&G>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),Ie(a,"paste",function(z){if(He(i,z)||To(z,i))return;i.state.pasteIncoming=+new Date,r.fastPoll()});function k(z){if(He(i,z))return;if(i.somethingSelected())sa({lineWise:!1,text:i.getSelections()});else if(i.options.lineWiseCopyCut){var $=So(i);sa({lineWise:!0,text:$.text}),z.type=="cut"?i.setSelections($.ranges,null,me):(r.prevInput="",a.value=$.text.join(`
|
|
`),j(a))}else return;z.type=="cut"&&(i.state.cutIncoming=+new Date)}Ie(a,"cut",k),Ie(a,"copy",k),Ie(e.scroller,"paste",function(z){if(hr(e,z)||He(i,z))return;if(!a.dispatchEvent){i.state.pasteIncoming=+new Date,r.focus();return}var $=new Event("paste");$.clipboardData=z.clipboardData,a.dispatchEvent($)}),Ie(e.lineSpace,"selectstart",function(z){hr(e,z)||re(z)}),Ie(a,"compositionstart",function(){var z=i.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:z,range:i.markText(z,i.getCursor("to"),{className:"CodeMirror-composing"})}}),Ie(a,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},ii.prototype.createField=function(e){this.wrapper=Ao(),this.textarea=this.wrapper.firstChild},ii.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},ii.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,i=ps(e);if(e.options.moveInputWithCursor){var a=Qi(e,r.sel.primary().head,"div"),k=t.wrapper.getBoundingClientRect(),z=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,a.top+z.top-k.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,a.left+z.left-k.left))}return i},ii.prototype.showSelection=function(e){var t=this.cm,r=t.display;_(r.cursorDiv,e.cursors),_(r.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},ii.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&j(this.textarea),K&&G>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",K&&G>=9&&(this.hasSelection=null))},ii.prototype.getField=function(){return this.textarea},ii.prototype.supportsTouch=function(){return!1},ii.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!n||N()!=this.textarea))try{this.textarea.focus()}catch(e){}},ii.prototype.blur=function(){this.textarea.blur()},ii.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},ii.prototype.receivedFocus=function(){this.slowPoll()},ii.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()})},ii.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function r(){var i=t.poll();!i&&!e?(e=!0,t.polling.set(60,r)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,r)},ii.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||ut(r)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var a=r.value;if(a==i&&!t.somethingSelected())return!1;if(K&&G>=9&&this.hasSelection===a||o&&/[\uf700-\uf7ff]/.test(a))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var k=a.charCodeAt(0);if(k==8203&&!i&&(i="\u200B"),k==8666)return this.reset(),this.cm.execCommand("undo")}for(var z=0,$=Math.min(i.length,a.length);z<$&&i.charCodeAt(z)==a.charCodeAt(z);)++z;return Ni(t,function(){za(t,a.slice(z),i.length-z,null,e.composing?"*compose":null),a.length>1e3||a.indexOf(`
|
|
`)>-1?r.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},ii.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},ii.prototype.onKeyPress=function(){K&&G>=9&&(this.hasSelection=null),this.fastPoll()},ii.prototype.onContextMenu=function(e){var t=this,r=t.cm,i=r.display,a=t.textarea;t.contextMenuPending&&t.contextMenuPending();var k=Nr(r,e),z=i.scroller.scrollTop;if(!k||p)return;var $=r.options.resetSelectionOnContextMenu;$&&r.doc.sel.contains(k)==-1&&hi(r,Ei)(r.doc,Sr(k),me);var J=a.style.cssText,ee=t.wrapper.style.cssText,ce=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",a.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-ce.top-5)+"px; left: "+(e.clientX-ce.left-5)+`px;
|
|
z-index: 1000; background: `+(K?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ge;M&&(ge=window.scrollY),i.input.focus(),M&&window.scrollTo(null,ge),i.input.reset(),r.somethingSelected()||(a.value=t.prevInput=" "),t.contextMenuPending=Ae,i.selForContextMenu=r.doc.sel,clearTimeout(i.detectingSelectAll);function Re(){if(a.selectionStart!=null){var Ke=r.somethingSelected(),Xe="\u200B"+(Ke?a.value:"");a.value="\u21DA",a.value=Xe,t.prevInput=Ke?"":"\u200B",a.selectionStart=1,a.selectionEnd=Xe.length,i.selForContextMenu=r.doc.sel}}function Ae(){if(t.contextMenuPending!=Ae)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=ee,a.style.cssText=J,K&&G<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=z),a.selectionStart!=null){(!K||K&&G<9)&&Re();var Ke=0,Xe=function(){i.selForContextMenu==r.doc.sel&&a.selectionStart==0&&a.selectionEnd>0&&t.prevInput=="\u200B"?hi(r,Vs)(r):Ke++<10?i.detectingSelectAll=setTimeout(Xe,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(Xe,200)}}if(K&&G>=9&&Re(),O){ve(e);var Be=function(){$e(window,"mouseup",Be),setTimeout(Ae,20)};Ie(window,"mouseup",Be)}else setTimeout(Ae,50)},ii.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},ii.prototype.setUneditable=function(){},ii.prototype.needsContentAttribute=!1;function ru(e,t){if(t=t?y(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 r=N();t.autofocus=r==e||e.getAttribute("autofocus")!=null&&r==document.body}function i(){e.value=$.getValue()}var a;if(e.form&&(Ie(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var k=e.form;a=k.submit;try{var z=k.submit=function(){i(),k.submit=a,k.submit(),k.submit=z}}catch(J){}}t.finishInit=function(J){J.save=i,J.getTextArea=function(){return e},J.toTextArea=function(){J.toTextArea=isNaN,i(),e.parentNode.removeChild(J.getWrapperElement()),e.style.display="",e.form&&($e(e.form,"submit",i),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=a))}},e.style.display="none";var $=Qt(function(J){return e.parentNode.insertBefore(J,e.nextSibling)},t);return $}function nu(e){e.off=$e,e.on=Ie,e.wheelEventPixels=dl,e.Doc=Li,e.splitLines=xt,e.countColumn=W,e.findColumn=xe,e.isWordChar=Le,e.Pass=we,e.signal=De,e.Line=Dr,e.changeEnd=Cr,e.scrollbarModel=xs,e.Pos=Ve,e.cmpPos=Tt,e.modes=Yt,e.mimeModes=Rt,e.resolveMode=Qe,e.getMode=wt,e.modeExtensions=Ot,e.extendMode=Lt,e.copyState=qt,e.startState=er,e.innerMode=qi,e.commands=Mn,e.keyMap=dr,e.keyName=lo,e.isModifierKey=so,e.lookupKey=an,e.normalizeKeyMap=Dl,e.StringStream=Bt,e.SharedTextMarker=kn,e.TextMarker=Or,e.LineWidget=In,e.e_preventDefault=re,e.e_stopPropagation=ae,e.e_stop=ve,e.addClass=D,e.contains=b,e.rmClass=w,e.keyNames=Rr}$l(Qt),ql(Qt);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in Li.prototype)Li.prototype.hasOwnProperty(la)&&ie(au,la)<0&&(Qt.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(Li.prototype[la]));return _e(Li),Qt.inputStyles={textarea:ii,contenteditable:Kt},Qt.defineMode=function(e){!Qt.defaults.mode&&e!="null"&&(Qt.defaults.mode=e),Ti.apply(this,arguments)},Qt.defineMIME=Ui,Qt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Qt.defineMIME("text/plain","null"),Qt.defineExtension=function(e,t){Qt.prototype[e]=t},Qt.defineDocExtension=function(e,t){Li.prototype[e]=t},Qt.fromTextArea=ru,nu(Qt),Qt.version="5.58.2",Qt})},Y1PL:function(gt,Ye,ne){"use strict";ne.r(Ye),ne.d(Ye,"ResizableTextArea",function(){return ie});var ue=ne("wx14"),Z=ne("1OyB"),P=ne("vuIU"),Q=ne("Ji7U"),B=ne("LK+K"),F=ne("q1tI"),K=ne("VTBJ"),G=ne("rePB"),M=ne("Zm9Q"),R=ne("Kwbf"),g=ne("c+Xe"),p=ne("m+aA"),f=ne("bdgK"),d=new Map;function s(me){me.forEach(function(Se){var Ce,xe=Se.target;(Ce=d.get(xe))===null||Ce===void 0||Ce.forEach(function(pe){return pe(xe)})})}var c=new f.default(s),l=null,n=null;function o(me,Se){d.has(me)||(d.set(me,new Set),c.observe(me)),d.get(me).add(Se)}function h(me,Se){d.has(me)&&(d.get(me).delete(Se),d.get(me).size||(c.unobserve(me),d.delete(me)))}var L=function(me){Object(Q.a)(Ce,me);var Se=Object(B.a)(Ce);function Ce(){return Object(Z.a)(this,Ce),Se.apply(this,arguments)}return Object(P.a)(Ce,[{key:"render",value:function(){return this.props.children}}]),Ce}(F.Component),S=F.createContext(null);function x(me){var Se=me.children,Ce=me.onBatchResize,xe=F.useRef(0),pe=F.useRef([]),le=F.useContext(S),te=F.useCallback(function(de,se,Oe){xe.current+=1;var ke=xe.current;pe.current.push({size:de,element:se,data:Oe}),Promise.resolve().then(function(){ke===xe.current&&(Ce==null||Ce(pe.current),pe.current=[])}),le==null||le(de,se,Oe)},[Ce,le]);return F.createElement(S.Provider,{value:te},Se)}function O(me){var Se=me.children,Ce=me.disabled,xe=F.useRef(null),pe=F.useRef(null),le=F.useContext(S),te=F.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),de=F.isValidElement(Se)&&Object(g.c)(Se),se=de?Se.ref:null,Oe=F.useMemo(function(){return Object(g.a)(se,xe)},[se,xe]),ke=F.useRef(me);ke.current=me;var Te=F.useCallback(function(Le){var Me=ke.current,je=Me.onResize,Fe=Me.data,Ne=Le.getBoundingClientRect(),Ue=Ne.width,Je=Ne.height,tt=Le.offsetWidth,et=Le.offsetHeight,Ze=Math.floor(Ue),dt=Math.floor(Je);if(te.current.width!==Ze||te.current.height!==dt||te.current.offsetWidth!==tt||te.current.offsetHeight!==et){var it={width:Ze,height:dt,offsetWidth:tt,offsetHeight:et};te.current=it;var at=tt===Math.round(Ue)?Ue:tt,Ie=et===Math.round(Je)?Je:et,st=Object(K.a)(Object(K.a)({},it),{},{offsetWidth:at,offsetHeight:Ie});le==null||le(st,Le,Fe),je&&Promise.resolve().then(function(){je(st,Le)})}},[]);return F.useEffect(function(){var Le=Object(p.a)(xe.current)||Object(p.a)(pe.current);return Le&&!Ce&&o(Le,Te),function(){return h(Le,Te)}},[xe.current,Ce]),F.createElement(L,{ref:pe},de?F.cloneElement(Se,{ref:Oe}):Se)}var C="rc-observer-key";function w(me){var Se=me.children,Ce=Object(M.a)(Se);return Ce.map(function(xe,pe){var le=(xe==null?void 0:xe.key)||"".concat(C,"-").concat(pe);return F.createElement(O,Object(ue.a)({},me,{key:le}),xe)})}w.Collection=x;var T=w,_=ne("bT9E"),u=ne("TSYQ"),E=ne.n(u),m=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,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"],N={},D;function H(me){var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ce=me.getAttribute("id")||me.getAttribute("data-reactid")||me.getAttribute("name");if(Se&&N[Ce])return N[Ce];var xe=window.getComputedStyle(me),pe=xe.getPropertyValue("box-sizing")||xe.getPropertyValue("-moz-box-sizing")||xe.getPropertyValue("-webkit-box-sizing"),le=parseFloat(xe.getPropertyValue("padding-bottom"))+parseFloat(xe.getPropertyValue("padding-top")),te=parseFloat(xe.getPropertyValue("border-bottom-width"))+parseFloat(xe.getPropertyValue("border-top-width")),de=b.map(function(Oe){return"".concat(Oe,":").concat(xe.getPropertyValue(Oe))}).join(";"),se={sizingStyle:de,paddingSize:le,borderSize:te,boxSizing:pe};return Se&&Ce&&(N[Ce]=se),se}function j(me){var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ce=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,xe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;D||(D=document.createElement("textarea"),D.setAttribute("tab-index","-1"),D.setAttribute("aria-hidden","true"),document.body.appendChild(D)),me.getAttribute("wrap")?D.setAttribute("wrap",me.getAttribute("wrap")):D.removeAttribute("wrap");var pe=H(me,Se),le=pe.paddingSize,te=pe.borderSize,de=pe.boxSizing,se=pe.sizingStyle;D.setAttribute("style","".concat(se,";").concat(m)),D.value=me.value||me.placeholder||"";var Oe=Number.MIN_SAFE_INTEGER,ke=Number.MAX_SAFE_INTEGER,Te=D.scrollHeight,Le;if(de==="border-box"?Te+=te:de==="content-box"&&(Te-=le),Ce!==null||xe!==null){D.value=" ";var Me=D.scrollHeight-le;Ce!==null&&(Oe=Me*Ce,de==="border-box"&&(Oe=Oe+le+te),Te=Math.max(Oe,Te)),xe!==null&&(ke=Me*xe,de==="border-box"&&(ke=ke+le+te),Le=Te>ke?"":"hidden",Te=Math.min(ke,Te))}return{height:Te,minHeight:Oe,maxHeight:ke,overflowY:Le,resize:"none"}}var I=ne("Gytx"),y=ne.n(I),W;(function(me){me[me.NONE=0]="NONE",me[me.RESIZING=1]="RESIZING",me[me.RESIZED=2]="RESIZED"})(W||(W={}));var Y=function(me){Object(Q.a)(Ce,me);var Se=Object(B.a)(Ce);function Ce(xe){var pe;return Object(Z.a)(this,Ce),pe=Se.call(this,xe),pe.nextFrameActionId=void 0,pe.resizeFrameId=void 0,pe.textArea=void 0,pe.saveTextArea=function(le){pe.textArea=le},pe.handleResize=function(le){var te=pe.state.resizeStatus,de=pe.props,se=de.autoSize,Oe=de.onResize;if(te!==W.NONE)return;typeof Oe=="function"&&Oe(le),se&&pe.resizeOnNextFrame()},pe.resizeOnNextFrame=function(){cancelAnimationFrame(pe.nextFrameActionId),pe.nextFrameActionId=requestAnimationFrame(pe.resizeTextarea)},pe.resizeTextarea=function(){var le=pe.props.autoSize;if(!le||!pe.textArea)return;var te=le.minRows,de=le.maxRows,se=j(pe.textArea,!1,te,de);pe.setState({textareaStyles:se,resizeStatus:W.RESIZING},function(){cancelAnimationFrame(pe.resizeFrameId),pe.resizeFrameId=requestAnimationFrame(function(){pe.setState({resizeStatus:W.RESIZED},function(){pe.resizeFrameId=requestAnimationFrame(function(){pe.setState({resizeStatus:W.NONE}),pe.fixFirefoxAutoScroll()})})})})},pe.renderTextArea=function(){var le=pe.props,te=le.prefixCls,de=te===void 0?"rc-textarea":te,se=le.autoSize,Oe=le.onResize,ke=le.className,Te=le.disabled,Le=pe.state,Me=Le.textareaStyles,je=Le.resizeStatus,Fe=Object(_.a)(pe.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ne=E()(de,ke,Object(G.a)({},"".concat(de,"-disabled"),Te));"value"in Fe&&(Fe.value=Fe.value||"");var Ue=Object(K.a)(Object(K.a)(Object(K.a)({},pe.props.style),Me),je===W.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return F.createElement(T,{onResize:pe.handleResize,disabled:!(se||Oe)},F.createElement("textarea",Object(ue.a)({},Fe,{className:Ne,style:Ue,ref:pe.saveTextArea})))},pe.state={textareaStyles:{},resizeStatus:W.NONE},pe}return Object(P.a)(Ce,[{key:"componentDidUpdate",value:function(pe){(pe.value!==this.props.value||!y()(pe.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var pe=this.textArea.selectionStart,le=this.textArea.selectionEnd;this.textArea.setSelectionRange(pe,le)}}catch(te){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Ce}(F.Component),ie=Y,oe=function(me){Object(Q.a)(Ce,me);var Se=Object(B.a)(Ce);function Ce(xe){var pe;Object(Z.a)(this,Ce),pe=Se.call(this,xe),pe.resizableTextArea=void 0,pe.focus=function(){pe.resizableTextArea.textArea.focus()},pe.saveTextArea=function(te){pe.resizableTextArea=te},pe.handleChange=function(te){var de=pe.props.onChange;pe.setValue(te.target.value,function(){pe.resizableTextArea.resizeTextarea()}),de&&de(te)},pe.handleKeyDown=function(te){var de=pe.props,se=de.onPressEnter,Oe=de.onKeyDown;te.keyCode===13&&se&&se(te),Oe&&Oe(te)};var le=typeof xe.value=="undefined"||xe.value===null?xe.defaultValue:xe.value;return pe.state={value:le},pe}return Object(P.a)(Ce,[{key:"setValue",value:function(pe,le){"value"in this.props||this.setState({value:pe},le)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return F.createElement(ie,Object(ue.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(pe){return"value"in pe?{value:pe.value}:null}}]),Ce}(F.Component),we=Ye.default=oe},ZW9T:function(gt,Ye,ne){"use strict";ne.d(Ye,"a",function(){return j});var ue=ne("k1fw"),Z=ne("miYZ"),P=ne("tsqr"),Q=ne("rAM+"),B=ne("tJVT"),F=ne("PpiC"),K=ne("q1tI"),G=ne.n(K),M=ne("bdgK"),R=ne("oBTY"),g=ne("9og8"),p=ne("WmNS"),f=ne.n(p),d={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"]},s={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"]},c={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(`
|
|
`)}]},l={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(`
|
|
`)}]},n=ne("5VLF"),o=ne.n(n),h={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"]}},L=function(y,W){return W.map(function(Y){return{label:Y,kind:y.languages.CompletionItemKind.Keyword,insertText:Y}})},S=function(y){return Object.keys(h.tables).map(function(W){return{label:W,kind:y.languages.CompletionItemKind.Variable,insertText:W}})},x=function(y,W){var Y=h.tables[y];return Y?Y.map(function(ie){return{label:ie,kind:W.languages.CompletionItemKind.Field,insertText:ie}}):[]};function O(I,y,W,Y,ie){var oe=y.getWordUntilPosition(W),we={startLineNumber:W.lineNumber,endLineNumber:W.lineNumber,startColumn:oe.startColumn,endColumn:oe.endColumn},me=Y.map(function(Se){return{label:Se,kind:I.languages.CompletionItemKind.Keyword,insertText:Se,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:we}});return ie.map(function(Se){me.push(Object(ue.a)(Object(ue.a)({},Se),{},{range:we}))}),me}var C=function(I){h.languages.map(function(ie){return I.languages.registerDocumentFormattingEditProvider(ie,{provideDocumentFormattingEdits:function(we,me,Se){return Object(g.a)(f.a.mark(function Ce(){var xe;return f.a.wrap(function(le){for(;;)switch(le.prev=le.next){case 0:return xe=o()(we.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}),le.abrupt("return",[{range:we.getFullModelRange(),text:xe}]);case 2:case"end":return le.stop()}},Ce)}))()}}),ie});var y=c.quickKey.map(function(ie){return{label:ie.label,kind:I.languages.CompletionItemKind.Method,insertText:ie.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),W=l.quickKey.map(function(ie){return{label:ie.label,kind:I.languages.CompletionItemKind.Method,insertText:ie.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),Y=s.quickKey.map(function(ie){return{label:ie.label,kind:I.languages.CompletionItemKind.Method,insertText:ie.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}});I.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(R.a)(c.keywords),Object(R.a)(c.quickKey.map(function(ie){return ie.label}))),provideCompletionItems:function(oe,we){var me=oe.getValueInRange({startLineNumber:we.lineNumber,startColumn:1,endLineNumber:we.lineNumber,endColumn:we.column}),Se=me.match(/cu/gim);console.log("match:",Se,we,me,oe);var Ce=[],xe=we.lineNumber,pe=we.column,le=oe.getValueInRange({startLineNumber:xe,startColumn:0,endLineNumber:xe,endColumn:pe}),te=le.trim().split(/\s+/),de=te[te.length-1];if(de.endsWith(".")){var se=de.slice(0,de.length-1);Object.keys(h.tables).includes(se)&&(Ce=Object(R.a)(x(se,I)))}else de==="."?Ce=[]:Ce=[].concat(Object(R.a)(S(I)),Object(R.a)(L(I,c.keywords)),Object(R.a)(y));return{suggestions:Ce}}}),I.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(R.a)(d.keywords)),provideCompletionItems:function(oe,we){var me=oe.getValueInRange({startLineNumber:we.lineNumber,startColumn:1,endLineNumber:we.lineNumber,endColumn:we.column}),Se=me.match(/cu/gim);console.log("match:",Se,we,me,oe);var Ce=[],xe=we.lineNumber,pe=we.column,le=oe.getValueInRange({startLineNumber:xe,startColumn:0,endLineNumber:xe,endColumn:pe}),te=le.trim().split(/\s+/),de=te[te.length-1];if(de.endsWith(".")){var se=de.slice(0,de.length-1);Object.keys(h.tables).includes(se)&&(Ce=Object(R.a)(x(se,I)))}else de==="."?Ce=[]:Ce=[].concat(Object(R.a)(S(I)),Object(R.a)(L(I,d.keywords)));return{suggestions:Ce}}}),I.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(R.a)(s.keywords)),provideCompletionItems:function(oe,we){var me=[],Se=we.lineNumber,Ce=we.column,xe=oe.getValueInRange({startLineNumber:Se,startColumn:0,endLineNumber:Se,endColumn:Ce}),pe=xe.trim().split(/\s+/),le=pe[pe.length-1];if(le.endsWith(".")){var te=le.slice(0,le.length-1);Object.keys(h.tables).includes(te)&&(me=Object(R.a)(x(te,I)))}else le==="."?me=[]:me=[].concat(Object(R.a)(S(I)),Object(R.a)(L(I,s.keywords)),Object(R.a)(Y));return{suggestions:me}}}),I.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(R.a)(l.keywords)),provideCompletionItems:function(oe,we){var me=[],Se=we.lineNumber,Ce=we.column,xe=oe.getValueInRange({startLineNumber:Se,startColumn:0,endLineNumber:Se,endColumn:Ce}),pe=xe.trim().split(/\s+/),le=pe[pe.length-1];if(le.endsWith(".")){var te=le.slice(0,le.length-1);Object.keys(h.tables).includes(te)&&(me=Object(R.a)(x(te,I)))}else le==="."?me=[]:me=[].concat(Object(R.a)(S(I)),Object(R.a)(L(I,l.keywords)),Object(R.a)(W));return{suggestions:me}}})},w="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",T=ne("LvDl"),_=ne("+ua5");function u(I){return/^\d+$/.test(I)?"".concat(I,"px"):I}function E(){}var m=!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 N(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],y=I;if(Array.isArray(I)){for(var W=0;W<I.length;W++){var Y=b[I[W]];if(Y)return Y}return y[0]}return b[y]||y}var D=null,H=Ye.b=function(I){var y=I.width,W=y===void 0?"100%":y,Y=I.height,ie=Y===void 0?"100%":Y,oe=I.value,we=I.language,me=we===void 0?"javascript":we,Se=I.style,Ce=Se===void 0?{}:Se,xe=I.options,pe=xe===void 0?{}:xe,le=I.overrideServices,te=le===void 0?{}:le,de=I.theme,se=de===void 0?"vs-dark":de,Oe=I.onEditBlur,ke=I.onSave,Te=I.autoHeight,Le=Te===void 0?!1:Te,Me=I.forbidCopy,je=Me===void 0?!1:Me,Fe=I.onChange,Ne=Fe===void 0?E:Fe,Ue=I.editorDidMount,Je=Ue===void 0?E:Ue,tt=I.onFocus,et=tt===void 0?E:tt,Ze=I.filename,dt=Ze===void 0?"educoder.txt":Ze,it=I.errorLine,at=I.errorContent,Ie=at===void 0?"":at,st=Object(F.a)(I,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),$e=Object(K.useRef)(),De=Object(K.useRef)({}),He=Object(K.useRef)(),Ee=Object(K.useRef)(!1),fe=Object(K.useRef)(),_e=Object(K.useState)(!1),re=Object(B.a)(_e,2),ae=re[0],he=re[1];function ve(){var Qe;return $e.current&&(Qe=new M.default(function(wt){var Ot=Object(Q.a)(wt),Lt;try{for(Ot.s();!(Lt=Ot.n()).done;){var qt=Lt.value;(qt.target.offsetHeight>0||qt.target.offsetWidth>0)&&De.current.instance.layout()}}catch(qi){Ot.e(qi)}finally{Ot.f()}}),Qe.observe($e.current)),Qe}function be(){P.b.warn(decodeURIComponent(w))}var Pe=function(){var wt=De.current.instance;if(oe!=null&&wt&&ae){var Ot=wt.getModel();Ot&&oe!==Ot.getValue()&&(m=!0,Ot.setValue(oe),wt.layout(),m=!1)}};Object(K.useEffect)(function(){He.current&&clearTimeout(He.current),He.current=setTimeout(function(){Pe()},500)},[oe,ae,De.current]),Object(K.useEffect)(function(){if(it&&De.current&&De.current.instance){var Qe=De.current.instance;Qe.changeViewZones(function(Ot){var Lt=document.createElement("div");Lt.style.padding="10px 20px",Lt.style.width="calc(100% - 20px)",Lt.className="my-error-line-wrp",Lt.innerHTML=Ie,Ot.addZone({afterLineNumber:it||11,heightInLines:3,domNode:Lt})});var wt={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}};Qe.addOverlayWidget(wt),Qe.revealPositionInCenter({lineNumber:20,column:1})}},[it,De.current,ae]);function Ge(){var Qe=De.current.instance;if(Qe){var wt=Qe.getSelection(),Ot=De.current.pastePos||{},Lt=new D.Range(Ot.startLineNumber||wt.endLineNumber,Ot.startColumn||wt.endColumn,Ot.endLineNumber||wt.endLineNumber,Ot.endColumn||wt.endColumn);setTimeout(function(){Qe.executeEdits("",[{range:Lt,text:""}])},300)}}function ot(Qe){(window.navigator.platform.match("Mac")?Qe.metaKey:Qe.ctrlKey)&&Qe.keyCode==83&&(Qe.preventDefault(),ke())}var ct=function(){if(Le&&De.current.instance){var wt=De.current.instance.getContentHeight();Ti(wt<ie?ie:wt)}else Ti(ie)};function ft(Qe){var wt=document.createEvent("MouseEvents");wt.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Qe.dispatchEvent(wt)}function Ct(Qe,wt){var Ot=window.URL||window.webkitURL||window,Lt=new Blob([wt]),qt=document.createElementNS("http://www.w3.org/1999/xhtml","a");qt.href=Ot.createObjectURL(Lt),qt.download=Qe,ft(qt)}Object(K.useEffect)(function(){ct()},[ct]),Object(K.useEffect)(function(){$e.current&&!ae&&ne.e(27).then(ne.t.bind(null,"M/lh",7)).then(function(Qe){try{D=Qe,De.current.instance=D.editor.create($e.current,{value:oe,language:N(me),theme:se,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},te);var wt=De.current.instance;if(Je(wt,D),setTimeout(function(){ct(),De.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Ct(dt||"educoder.txt",wt.getValue())}})},500),De.current.subscription=wt.onDidChangeModelContent(function(Lt){Ee.current?clearTimeout(fe.current):(ct(),Ne(wt.getValue(),Lt)),fe.current=setTimeout(function(){Ee.current=!1},500)}),window.Monaco||C(D),je&&(wt.addCommand(D.KeyMod.CtrlCmd|D.KeyMod.Shift|D.KeyCode.KEY_V,function(){return be(),null}),wt.addCommand(D.KeyMod.CtrlCmd|D.KeyCode.KEY_C,function(){return be(),null})),window.Monaco=D,Oe&&wt.onDidBlurEditorWidget(function(){Oe(wt.getValue())}),et&&wt.onDidFocusEditorText(function(){et(wt.getValue())}),je){wt.addCommand(D.KeyMod.CtrlCmd|D.KeyCode.KEY_V,function(){return be(),null}),wt.onDidPaste(function(Lt){De.current.pastePos=Lt});try{window.addEventListener("paste",Ge)}catch(Lt){}}var Ot=ve();return he(!0),function(){var Lt=De.current.instance;Lt.dispose();var qt=Lt.getModel();qt&&qt.dispose(),De.current.subscription&&De.current.subscription.dispose(),je&&window.removeEventListener("paste",Ge),Ot.unobserve($e.current)}}catch(Lt){}})},[]),Object(K.useEffect)(function(){var Qe=De.current.instance;if(Qe&&ae)return document.addEventListener("keydown",ot,!1),function(){document.removeEventListener("keydown",ot)}},[ke,ae]),Object(K.useEffect)(function(){var Qe=De.current.instance;if(Qe&&ae){var wt=N(me);D.editor.setModelLanguage(Qe.getModel(),wt),console.log("language:",me,Qe.getModel(),wt)}},[me,ae]),Object(K.useEffect)(function(){var Qe=De.current.instance;Qe&&ae&&D.editor.setTheme(se)},[se,ae]),Object(K.useEffect)(function(){var Qe=De.current.instance;Qe&&ae&&(Qe.updateOptions(Object(ue.a)({},pe)),setTimeout(function(){Qe.getModel().updateOptions(Object(ue.a)({},pe))},200))},[JSON.stringify(pe),ae]),Object(K.useEffect)(function(){var Qe=De.current.instance;Qe&&ae&&Qe.layout()},[W,ie,ae]);var xt=Object(K.useState)(u(W)),ut=Object(B.a)(xt,2),Ut=ut[0],Mt=ut[1],Zt=Object(K.useState)(u(ie)),Yt=Object(B.a)(Zt,2),Rt=Yt[0],Ti=Yt[1],Ui=Object(ue.a)(Object(ue.a)({},Ce),{},{width:Ut,height:Rt});return G.a.createElement("div",{className:"my-monaco-editor",ref:$e,style:Ui})};function j(I){var y=I.width,W=y===void 0?"100%":y,Y=I.height,ie=Y===void 0?"100%":Y,oe=I.original,we=I.modified,me=I.language,Se=I.options,Ce=Se===void 0?{}:Se,xe=Object(K.useRef)(),pe=Object(K.useState)(null),le=Object(B.a)(pe,2),te=le[0],de=le[1];function se(Le){var Me;return xe.current&&(Me=new M.default(function(je){var Fe=Object(Q.a)(je),Ne;try{for(Fe.s();!(Ne=Fe.n()).done;){var Ue=Ne.value;(Ue.target.offsetHeight>0||Ue.target.offsetWidth>0)&&Le.layout()}}catch(Je){Fe.e(Je)}finally{Fe.f()}}),Me.observe(xe.current)),Me}Object(K.useEffect)(function(){xe.current&&ne.e(27).then(ne.t.bind(null,"M/lh",7)).then(function(Le){D=Le;var Me=D.editor.createDiffEditor(xe.current,Object(ue.a)(Object(ue.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},Ce),{},{wordWrap:!0}));de(Me);var je=se(Me);return function(){Me.dispose();var Fe=Me.getModel();Fe&&Fe.dispose(),je.unobserve(xe.current)}})},[]),Object(K.useEffect)(function(){te&&te.setModel({original:D.editor.createModel(oe,me),modified:D.editor.createModel(we,me)})},[oe,we,me,te]);var Oe=u(W),ke=u(ie),Te={width:Oe,height:ke};return G.a.createElement("div",{className:"my-diff-editor",ref:xe,style:Te})}},ZpRC:function(gt,Ye,ne){"use strict";function ue(g){return typeof g=="object"&&g!=null&&g.nodeType===1}function Z(g,p){return(!p||g!=="hidden")&&g!=="visible"&&g!=="clip"}function P(g,p){if(g.clientHeight<g.scrollHeight||g.clientWidth<g.scrollWidth){var f=getComputedStyle(g,null);return Z(f.overflowY,p)||Z(f.overflowX,p)||function(d){var s=function(c){if(!c.ownerDocument||!c.ownerDocument.defaultView)return null;try{return c.ownerDocument.defaultView.frameElement}catch(l){return null}}(d);return!!s&&(s.clientHeight<d.scrollHeight||s.clientWidth<d.scrollWidth)}(g)}return!1}function Q(g,p,f,d,s,c,l,n){return c<g&&l>p||c>g&&l<p?0:c<=g&&n<=f||l>=p&&n>=f?c-g-d:l>p&&n<f||c<g&&n>f?l-p+s:0}var B=function(g,p){var f=window,d=p.scrollMode,s=p.block,c=p.inline,l=p.boundary,n=p.skipOverflowHiddenElements,o=typeof l=="function"?l:function(Me){return Me!==l};if(!ue(g))throw new TypeError("Invalid target");for(var h=document.scrollingElement||document.documentElement,L=[],S=g;ue(S)&&o(S);){if((S=S.parentElement)===h){L.push(S);break}S!=null&&S===document.body&&P(S)&&!P(document.documentElement)||S!=null&&P(S,n)&&L.push(S)}for(var x=f.visualViewport?f.visualViewport.width:innerWidth,O=f.visualViewport?f.visualViewport.height:innerHeight,C=window.scrollX||pageXOffset,w=window.scrollY||pageYOffset,T=g.getBoundingClientRect(),_=T.height,u=T.width,E=T.top,m=T.right,b=T.bottom,N=T.left,D=s==="start"||s==="nearest"?E:s==="end"?b:E+_/2,H=c==="center"?N+u/2:c==="end"?m:N,j=[],I=0;I<L.length;I++){var y=L[I],W=y.getBoundingClientRect(),Y=W.height,ie=W.width,oe=W.top,we=W.right,me=W.bottom,Se=W.left;if(d==="if-needed"&&E>=0&&N>=0&&b<=O&&m<=x&&E>=oe&&b<=me&&N>=Se&&m<=we)return j;var Ce=getComputedStyle(y),xe=parseInt(Ce.borderLeftWidth,10),pe=parseInt(Ce.borderTopWidth,10),le=parseInt(Ce.borderRightWidth,10),te=parseInt(Ce.borderBottomWidth,10),de=0,se=0,Oe="offsetWidth"in y?y.offsetWidth-y.clientWidth-xe-le:0,ke="offsetHeight"in y?y.offsetHeight-y.clientHeight-pe-te:0;if(h===y)de=s==="start"?D:s==="end"?D-O:s==="nearest"?Q(w,w+O,O,pe,te,w+D,w+D+_,_):D-O/2,se=c==="start"?H:c==="center"?H-x/2:c==="end"?H-x:Q(C,C+x,x,xe,le,C+H,C+H+u,u),de=Math.max(0,de+w),se=Math.max(0,se+C);else{de=s==="start"?D-oe-pe:s==="end"?D-me+te+ke:s==="nearest"?Q(oe,me,Y,pe,te+ke,D,D+_,_):D-(oe+Y/2)+ke/2,se=c==="start"?H-Se-xe:c==="center"?H-(Se+ie/2)+Oe/2:c==="end"?H-we+le+Oe:Q(Se,we,ie,xe,le+Oe,H,H+u,u);var Te=y.scrollLeft,Le=y.scrollTop;D+=Le-(de=Math.max(0,Math.min(Le+de,y.scrollHeight-Y+ke))),H+=Te-(se=Math.max(0,Math.min(Te+se,y.scrollWidth-ie+Oe)))}j.push({el:y,top:de,left:se})}return j};function F(g){return g===Object(g)&&Object.keys(g).length!==0}function K(g,p){p===void 0&&(p="auto");var f="scrollBehavior"in document.body.style;g.forEach(function(d){var s=d.el,c=d.top,l=d.left;s.scroll&&f?s.scroll({top:c,left:l,behavior:p}):(s.scrollTop=c,s.scrollLeft=l)})}function G(g){return g===!1?{block:"end",inline:"nearest"}:F(g)?g:{block:"start",inline:"nearest"}}function M(g,p){var f=!g.ownerDocument.documentElement.contains(g);if(F(p)&&typeof p.behavior=="function")return p.behavior(f?[]:B(g,p));if(f)return;var d=G(p);return K(B(g,d),d.behavior)}var R=Ye.a=M},Zss7:function(gt,Ye,ne){var ue;(function(Z){var P=/^\s+/,Q=/\s+$/,B=0,F=Z.round,K=Z.min,G=Z.max,M=Z.random;function R(te,de){if(te=te||"",de=de||{},te instanceof R)return te;if(!(this instanceof R))return new R(te,de);var se=g(te);this._originalInput=te,this._r=se.r,this._g=se.g,this._b=se.b,this._a=se.a,this._roundA=F(100*this._a)/100,this._format=de.format||se.format,this._gradientType=de.gradientType,this._r<1&&(this._r=F(this._r)),this._g<1&&(this._g=F(this._g)),this._b<1&&(this._b=F(this._b)),this._ok=se.ok,this._tc_id=B++}R.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var te=this.toRgb();return(te.r*299+te.g*587+te.b*114)/1e3},getLuminance:function(){var te=this.toRgb(),de,se,Oe,ke,Te,Le;return de=te.r/255,se=te.g/255,Oe=te.b/255,de<=.03928?ke=de/12.92:ke=Z.pow((de+.055)/1.055,2.4),se<=.03928?Te=se/12.92:Te=Z.pow((se+.055)/1.055,2.4),Oe<=.03928?Le=Oe/12.92:Le=Z.pow((Oe+.055)/1.055,2.4),.2126*ke+.7152*Te+.0722*Le},setAlpha:function(te){return this._a=j(te),this._roundA=F(100*this._a)/100,this},toHsv:function(){var te=s(this._r,this._g,this._b);return{h:te.h*360,s:te.s,v:te.v,a:this._a}},toHsvString:function(){var te=s(this._r,this._g,this._b),de=F(te.h*360),se=F(te.s*100),Oe=F(te.v*100);return this._a==1?"hsv("+de+", "+se+"%, "+Oe+"%)":"hsva("+de+", "+se+"%, "+Oe+"%, "+this._roundA+")"},toHsl:function(){var te=f(this._r,this._g,this._b);return{h:te.h*360,s:te.s,l:te.l,a:this._a}},toHslString:function(){var te=f(this._r,this._g,this._b),de=F(te.h*360),se=F(te.s*100),Oe=F(te.l*100);return this._a==1?"hsl("+de+", "+se+"%, "+Oe+"%)":"hsla("+de+", "+se+"%, "+Oe+"%, "+this._roundA+")"},toHex:function(te){return l(this._r,this._g,this._b,te)},toHexString:function(te){return"#"+this.toHex(te)},toHex8:function(te){return n(this._r,this._g,this._b,this._a,te)},toHex8String:function(te){return"#"+this.toHex8(te)},toRgb:function(){return{r:F(this._r),g:F(this._g),b:F(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+F(this._r)+", "+F(this._g)+", "+F(this._b)+")":"rgba("+F(this._r)+", "+F(this._g)+", "+F(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:F(I(this._r,255)*100)+"%",g:F(I(this._g,255)*100)+"%",b:F(I(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+F(I(this._r,255)*100)+"%, "+F(I(this._g,255)*100)+"%, "+F(I(this._b,255)*100)+"%)":"rgba("+F(I(this._r,255)*100)+"%, "+F(I(this._g,255)*100)+"%, "+F(I(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:D[l(this._r,this._g,this._b,!0)]||!1},toFilter:function(te){var de="#"+o(this._r,this._g,this._b,this._a),se=de,Oe=this._gradientType?"GradientType = 1, ":"";if(te){var ke=R(te);se="#"+o(ke._r,ke._g,ke._b,ke._a)}return"progid:DXImageTransform.Microsoft.gradient("+Oe+"startColorstr="+de+",endColorstr="+se+")"},toString:function(te){var de=!!te;te=te||this._format;var se=!1,Oe=this._a<1&&this._a>=0,ke=!de&&Oe&&(te==="hex"||te==="hex6"||te==="hex3"||te==="hex4"||te==="hex8"||te==="name");return ke?te==="name"&&this._a===0?this.toName():this.toRgbString():(te==="rgb"&&(se=this.toRgbString()),te==="prgb"&&(se=this.toPercentageRgbString()),(te==="hex"||te==="hex6")&&(se=this.toHexString()),te==="hex3"&&(se=this.toHexString(!0)),te==="hex4"&&(se=this.toHex8String(!0)),te==="hex8"&&(se=this.toHex8String()),te==="name"&&(se=this.toName()),te==="hsl"&&(se=this.toHslString()),te==="hsv"&&(se=this.toHsvString()),se||this.toHexString())},clone:function(){return R(this.toString())},_applyModification:function(te,de){var se=te.apply(null,[this].concat([].slice.call(de)));return this._r=se._r,this._g=se._g,this._b=se._b,this.setAlpha(se._a),this},lighten:function(){return this._applyModification(x,arguments)},brighten:function(){return this._applyModification(O,arguments)},darken:function(){return this._applyModification(C,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(L,arguments)},greyscale:function(){return this._applyModification(S,arguments)},spin:function(){return this._applyModification(w,arguments)},_applyCombination:function(te,de){return te.apply(null,[this].concat([].slice.call(de)))},analogous:function(){return this._applyCombination(m,arguments)},complement:function(){return this._applyCombination(T,arguments)},monochromatic:function(){return this._applyCombination(b,arguments)},splitcomplement:function(){return this._applyCombination(E,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(u,arguments)}},R.fromRatio=function(te,de){if(typeof te=="object"){var se={};for(var Oe in te)te.hasOwnProperty(Oe)&&(Oe==="a"?se[Oe]=te[Oe]:se[Oe]=we(te[Oe]));te=se}return R(te,de)};function g(te){var de={r:0,g:0,b:0},se=1,Oe=null,ke=null,Te=null,Le=!1,Me=!1;return typeof te=="string"&&(te=pe(te)),typeof te=="object"&&(xe(te.r)&&xe(te.g)&&xe(te.b)?(de=p(te.r,te.g,te.b),Le=!0,Me=String(te.r).substr(-1)==="%"?"prgb":"rgb"):xe(te.h)&&xe(te.s)&&xe(te.v)?(Oe=we(te.s),ke=we(te.v),de=c(te.h,Oe,ke),Le=!0,Me="hsv"):xe(te.h)&&xe(te.s)&&xe(te.l)&&(Oe=we(te.s),Te=we(te.l),de=d(te.h,Oe,Te),Le=!0,Me="hsl"),te.hasOwnProperty("a")&&(se=te.a)),se=j(se),{ok:Le,format:te.format||Me,r:K(255,G(de.r,0)),g:K(255,G(de.g,0)),b:K(255,G(de.b,0)),a:se}}function p(te,de,se){return{r:I(te,255)*255,g:I(de,255)*255,b:I(se,255)*255}}function f(te,de,se){te=I(te,255),de=I(de,255),se=I(se,255);var Oe=G(te,de,se),ke=K(te,de,se),Te,Le,Me=(Oe+ke)/2;if(Oe==ke)Te=Le=0;else{var je=Oe-ke;Le=Me>.5?je/(2-Oe-ke):je/(Oe+ke);switch(Oe){case te:Te=(de-se)/je+(de<se?6:0);break;case de:Te=(se-te)/je+2;break;case se:Te=(te-de)/je+4;break}Te/=6}return{h:Te,s:Le,l:Me}}function d(te,de,se){var Oe,ke,Te;te=I(te,360),de=I(de,100),se=I(se,100);function Le(Fe,Ne,Ue){return Ue<0&&(Ue+=1),Ue>1&&(Ue-=1),Ue<1/6?Fe+(Ne-Fe)*6*Ue:Ue<1/2?Ne:Ue<2/3?Fe+(Ne-Fe)*(2/3-Ue)*6:Fe}if(de===0)Oe=ke=Te=se;else{var Me=se<.5?se*(1+de):se+de-se*de,je=2*se-Me;Oe=Le(je,Me,te+1/3),ke=Le(je,Me,te),Te=Le(je,Me,te-1/3)}return{r:Oe*255,g:ke*255,b:Te*255}}function s(te,de,se){te=I(te,255),de=I(de,255),se=I(se,255);var Oe=G(te,de,se),ke=K(te,de,se),Te,Le,Me=Oe,je=Oe-ke;if(Le=Oe===0?0:je/Oe,Oe==ke)Te=0;else{switch(Oe){case te:Te=(de-se)/je+(de<se?6:0);break;case de:Te=(se-te)/je+2;break;case se:Te=(te-de)/je+4;break}Te/=6}return{h:Te,s:Le,v:Me}}function c(te,de,se){te=I(te,360)*6,de=I(de,100),se=I(se,100);var Oe=Z.floor(te),ke=te-Oe,Te=se*(1-de),Le=se*(1-ke*de),Me=se*(1-(1-ke)*de),je=Oe%6,Fe=[se,Le,Te,Te,Me,se][je],Ne=[Me,se,se,Le,Te,Te][je],Ue=[Te,Te,Me,se,se,Le][je];return{r:Fe*255,g:Ne*255,b:Ue*255}}function l(te,de,se,Oe){var ke=[oe(F(te).toString(16)),oe(F(de).toString(16)),oe(F(se).toString(16))];return Oe&&ke[0].charAt(0)==ke[0].charAt(1)&&ke[1].charAt(0)==ke[1].charAt(1)&&ke[2].charAt(0)==ke[2].charAt(1)?ke[0].charAt(0)+ke[1].charAt(0)+ke[2].charAt(0):ke.join("")}function n(te,de,se,Oe,ke){var Te=[oe(F(te).toString(16)),oe(F(de).toString(16)),oe(F(se).toString(16)),oe(me(Oe))];return ke&&Te[0].charAt(0)==Te[0].charAt(1)&&Te[1].charAt(0)==Te[1].charAt(1)&&Te[2].charAt(0)==Te[2].charAt(1)&&Te[3].charAt(0)==Te[3].charAt(1)?Te[0].charAt(0)+Te[1].charAt(0)+Te[2].charAt(0)+Te[3].charAt(0):Te.join("")}function o(te,de,se,Oe){var ke=[oe(me(Oe)),oe(F(te).toString(16)),oe(F(de).toString(16)),oe(F(se).toString(16))];return ke.join("")}R.equals=function(te,de){return!te||!de?!1:R(te).toRgbString()==R(de).toRgbString()},R.random=function(){return R.fromRatio({r:M(),g:M(),b:M()})};function h(te,de){de=de===0?0:de||10;var se=R(te).toHsl();return se.s-=de/100,se.s=y(se.s),R(se)}function L(te,de){de=de===0?0:de||10;var se=R(te).toHsl();return se.s+=de/100,se.s=y(se.s),R(se)}function S(te){return R(te).desaturate(100)}function x(te,de){de=de===0?0:de||10;var se=R(te).toHsl();return se.l+=de/100,se.l=y(se.l),R(se)}function O(te,de){de=de===0?0:de||10;var se=R(te).toRgb();return se.r=G(0,K(255,se.r-F(255*-(de/100)))),se.g=G(0,K(255,se.g-F(255*-(de/100)))),se.b=G(0,K(255,se.b-F(255*-(de/100)))),R(se)}function C(te,de){de=de===0?0:de||10;var se=R(te).toHsl();return se.l-=de/100,se.l=y(se.l),R(se)}function w(te,de){var se=R(te).toHsl(),Oe=(se.h+de)%360;return se.h=Oe<0?360+Oe:Oe,R(se)}function T(te){var de=R(te).toHsl();return de.h=(de.h+180)%360,R(de)}function _(te){var de=R(te).toHsl(),se=de.h;return[R(te),R({h:(se+120)%360,s:de.s,l:de.l}),R({h:(se+240)%360,s:de.s,l:de.l})]}function u(te){var de=R(te).toHsl(),se=de.h;return[R(te),R({h:(se+90)%360,s:de.s,l:de.l}),R({h:(se+180)%360,s:de.s,l:de.l}),R({h:(se+270)%360,s:de.s,l:de.l})]}function E(te){var de=R(te).toHsl(),se=de.h;return[R(te),R({h:(se+72)%360,s:de.s,l:de.l}),R({h:(se+216)%360,s:de.s,l:de.l})]}function m(te,de,se){de=de||6,se=se||30;var Oe=R(te).toHsl(),ke=360/se,Te=[R(te)];for(Oe.h=(Oe.h-(ke*de>>1)+720)%360;--de;)Oe.h=(Oe.h+ke)%360,Te.push(R(Oe));return Te}function b(te,de){de=de||6;for(var se=R(te).toHsv(),Oe=se.h,ke=se.s,Te=se.v,Le=[],Me=1/de;de--;)Le.push(R({h:Oe,s:ke,v:Te})),Te=(Te+Me)%1;return Le}R.mix=function(te,de,se){se=se===0?0:se||50;var Oe=R(te).toRgb(),ke=R(de).toRgb(),Te=se/100,Le={r:(ke.r-Oe.r)*Te+Oe.r,g:(ke.g-Oe.g)*Te+Oe.g,b:(ke.b-Oe.b)*Te+Oe.b,a:(ke.a-Oe.a)*Te+Oe.a};return R(Le)},R.readability=function(te,de){var se=R(te),Oe=R(de);return(Z.max(se.getLuminance(),Oe.getLuminance())+.05)/(Z.min(se.getLuminance(),Oe.getLuminance())+.05)},R.isReadable=function(te,de,se){var Oe=R.readability(te,de),ke,Te;Te=!1,ke=le(se);switch(ke.level+ke.size){case"AAsmall":case"AAAlarge":Te=Oe>=4.5;break;case"AAlarge":Te=Oe>=3;break;case"AAAsmall":Te=Oe>=7;break}return Te},R.mostReadable=function(te,de,se){var Oe=null,ke=0,Te,Le,Me,je;se=se||{},Le=se.includeFallbackColors,Me=se.level,je=se.size;for(var Fe=0;Fe<de.length;Fe++)Te=R.readability(te,de[Fe]),Te>ke&&(ke=Te,Oe=R(de[Fe]));return R.isReadable(te,Oe,{level:Me,size:je})||!Le?Oe:(se.includeFallbackColors=!1,R.mostReadable(te,["#fff","#000"],se))};var N=R.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},D=R.hexNames=H(N);function H(te){var de={};for(var se in te)te.hasOwnProperty(se)&&(de[te[se]]=se);return de}function j(te){return te=parseFloat(te),(isNaN(te)||te<0||te>1)&&(te=1),te}function I(te,de){Y(te)&&(te="100%");var se=ie(te);return te=K(de,G(0,parseFloat(te))),se&&(te=parseInt(te*de,10)/100),Z.abs(te-de)<1e-6?1:te%de/parseFloat(de)}function y(te){return K(1,G(0,te))}function W(te){return parseInt(te,16)}function Y(te){return typeof te=="string"&&te.indexOf(".")!=-1&&parseFloat(te)===1}function ie(te){return typeof te=="string"&&te.indexOf("%")!=-1}function oe(te){return te.length==1?"0"+te:""+te}function we(te){return te<=1&&(te=te*100+"%"),te}function me(te){return Z.round(parseFloat(te)*255).toString(16)}function Se(te){return W(te)/255}var Ce=function(){var te="[-\\+]?\\d+%?",de="[-\\+]?\\d*\\.\\d+%?",se="(?:"+de+")|(?:"+te+")",Oe="[\\s|\\(]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")\\s*\\)?",ke="[\\s|\\(]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")\\s*\\)?";return{CSS_UNIT:new RegExp(se),rgb:new RegExp("rgb"+Oe),rgba:new RegExp("rgba"+ke),hsl:new RegExp("hsl"+Oe),hsla:new RegExp("hsla"+ke),hsv:new RegExp("hsv"+Oe),hsva:new RegExp("hsva"+ke),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function xe(te){return!!Ce.CSS_UNIT.exec(te)}function pe(te){te=te.replace(P,"").replace(Q,"").toLowerCase();var de=!1;if(N[te])te=N[te],de=!0;else if(te=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var se;return(se=Ce.rgb.exec(te))?{r:se[1],g:se[2],b:se[3]}:(se=Ce.rgba.exec(te))?{r:se[1],g:se[2],b:se[3],a:se[4]}:(se=Ce.hsl.exec(te))?{h:se[1],s:se[2],l:se[3]}:(se=Ce.hsla.exec(te))?{h:se[1],s:se[2],l:se[3],a:se[4]}:(se=Ce.hsv.exec(te))?{h:se[1],s:se[2],v:se[3]}:(se=Ce.hsva.exec(te))?{h:se[1],s:se[2],v:se[3],a:se[4]}:(se=Ce.hex8.exec(te))?{r:W(se[1]),g:W(se[2]),b:W(se[3]),a:Se(se[4]),format:de?"name":"hex8"}:(se=Ce.hex6.exec(te))?{r:W(se[1]),g:W(se[2]),b:W(se[3]),format:de?"name":"hex"}:(se=Ce.hex4.exec(te))?{r:W(se[1]+""+se[1]),g:W(se[2]+""+se[2]),b:W(se[3]+""+se[3]),a:Se(se[4]+""+se[4]),format:de?"name":"hex8"}:(se=Ce.hex3.exec(te))?{r:W(se[1]+""+se[1]),g:W(se[2]+""+se[2]),b:W(se[3]+""+se[3]),format:de?"name":"hex"}:!1}function le(te){var de,se;return te=te||{level:"AA",size:"small"},de=(te.level||"AA").toUpperCase(),se=(te.size||"small").toLowerCase(),de!=="AA"&&de!=="AAA"&&(de="AA"),se!=="small"&&se!=="large"&&(se="small"),{level:de,size:se}}gt.exports?gt.exports=R:!(ue=function(){return R}.call(Ye,ne,Ye,gt),ue!==void 0&&(gt.exports=ue))})(Math)},bT9E:function(gt,Ye,ne){"use strict";ne.d(Ye,"a",function(){return Z});var ue=ne("VTBJ");function Z(P,Q){var B=Object(ue.a)({},P);return Array.isArray(Q)&&Q.forEach(function(F){delete B[F]}),B}},c5Ni:function(gt,Ye,ne){},dejd:function(gt,Ye,ne){},dmUQ:function(gt,Ye,ne){"use strict";var ue=ne("Ff2n"),Z=ne("rePB"),P=ne("1OyB"),Q=ne("vuIU"),B=ne("Ji7U"),F=ne("md7G"),K=ne("foSv"),G=ne("q1tI"),M=ne.n(G),R=ne("TSYQ"),g=ne.n(R),p=ne("4IlW");function f(_,u){var E=Object.keys(_);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(_);u&&(m=m.filter(function(b){return Object.getOwnPropertyDescriptor(_,b).enumerable})),E.push.apply(E,m)}return E}function d(_){for(var u=1;u<arguments.length;u++){var E=arguments[u]!=null?arguments[u]:{};u%2?f(Object(E),!0).forEach(function(m){Object(Z.a)(_,m,E[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(_,Object.getOwnPropertyDescriptors(E)):f(Object(E)).forEach(function(m){Object.defineProperty(_,m,Object.getOwnPropertyDescriptor(E,m))})}return _}function s(_){var u=c();return function(){var m=Object(K.a)(_),b;if(u){var N=Object(K.a)(this).constructor;b=Reflect.construct(m,arguments,N)}else b=m.apply(this,arguments);return Object(F.a)(this,b)}}function c(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(_){return!1}}function l(){}function n(_){_.preventDefault()}var o=function(u){return u.replace(/[^\w.-]+/g,"")},h=200,L=600,S=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,x=function(u){return u!=null},O=function(u,E){return E===u||typeof E=="number"&&typeof u=="number"&&isNaN(E)&&isNaN(u)},C=function(_){Object(B.a)(E,_);var u=s(E);function E(m){var b;Object(P.a)(this,E),b=u.call(this,m),b.onKeyDown=function(H){var j=b.props,I=j.onKeyDown,y=j.onPressEnter;if(H.keyCode===p.a.UP){var W=b.getRatio(H);b.up(H,W,null),b.stop()}else if(H.keyCode===p.a.DOWN){var Y=b.getRatio(H);b.down(H,Y,null),b.stop()}else H.keyCode===p.a.ENTER&&y&&y(H);if(b.recordCursorPosition(),b.lastKeyCode=H.keyCode,I){for(var ie=arguments.length,oe=new Array(ie>1?ie-1:0),we=1;we<ie;we++)oe[we-1]=arguments[we];I.apply(void 0,[H].concat(oe))}},b.onKeyUp=function(H){var j=b.props.onKeyUp;if(b.stop(),b.recordCursorPosition(),j){for(var I=arguments.length,y=new Array(I>1?I-1:0),W=1;W<I;W++)y[W-1]=arguments[W];j.apply(void 0,[H].concat(y))}},b.onChange=function(H){var j=b.props.onChange;b.state.focused&&(b.inputting=!0),b.rawInput=b.props.parser(b.getValueFromEvent(H)),b.setState({inputValue:b.rawInput}),j(b.toNumber(b.rawInput))},b.onMouseUp=function(){var H=b.props.onMouseUp;b.recordCursorPosition(),H&&H.apply(void 0,arguments)},b.onFocus=function(){var H;b.setState({focused:!0}),(H=b.props).onFocus.apply(H,arguments)},b.onBlur=function(){var H=b.props.onBlur;b.inputting=!1,b.setState({focused:!1});var j=b.getCurrentValidValue(b.state.inputValue),I=b.setValue(j,l);if(H){var y=b.input.value,W=b.getInputDisplayValue({focus:!1,value:I});b.input.value=W&&Number(W),H.apply(void 0,arguments),b.input.value=y}},b.getRatio=function(H){var j=1;return H.metaKey||H.ctrlKey?j=.1:H.shiftKey&&(j=10),j},b.getFullNum=function(H){return isNaN(H)?H:/e/i.test(String(H))?Number(H).toFixed(18).replace(/\.?0+$/,""):H},b.getPrecision=function(H){if(x(b.props.precision))return b.props.precision;var j=String(H);if(j.indexOf("e-")>=0)return parseInt(j.slice(j.indexOf("e-")+2),10);var I=0;return j.indexOf(".")>=0&&(I=j.length-j.indexOf(".")-1),I},b.getInputDisplayValue=function(H){var j=H||b.state,I=j.focused,y=j.inputValue,W=j.value,Y;I?Y=y:Y=b.toPrecisionAsStep(W),Y==null&&(Y="");var ie=b.formatWrapper(Y);return x(b.props.decimalSeparator)&&(ie=ie.toString().replace(".",b.props.decimalSeparator)),ie},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(H){}},b.restoreByAfter=function(H){if(H===void 0)return!1;var j=b.input.value,I=j.lastIndexOf(H);if(I===-1)return!1;var y=b.cursorBefore.length;return b.lastKeyCode===p.a.DELETE&&b.cursorBefore.charAt(y-1)===H[0]?(b.fixCaret(y,y),!0):I+H.length===j.length?(b.fixCaret(I,I),!0):!1},b.partRestoreByAfter=function(H){return H===void 0?!1:Array.prototype.some.call(H,function(j,I){var y=H.substring(I);return b.restoreByAfter(y)})},b.isNotCompleteNumber=function(H){return isNaN(H)||H===""||H===null||H&&H.toString().indexOf(".")===H.toString().length-1},b.stop=function(){b.autoStepTimer&&clearTimeout(b.autoStepTimer)},b.down=function(H,j,I){b.pressingUpOrDown=!0,b.step("down",H,j,I)},b.up=function(H,j,I){b.pressingUpOrDown=!0,b.step("up",H,j,I)},b.saveInput=function(H){b.input=H};var N=m.value;N===void 0&&(N=m.defaultValue),b.state={focused:m.autoFocus};var D=b.getValidValue(b.toNumber(N));return b.state=d(d({},b.state),{},{inputValue:b.toPrecisionAsStep(D),value:D}),b}return Object(Q.a)(E,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(b){var N=this.props,D=N.value,H=N.onChange,j=N.max,I=N.min,y=this.state.focused;if(b){if(!O(b.value,D)||!O(b.max,j)||!O(b.min,I)){var W=y?D:this.getValidValue(D),Y;this.pressingUpOrDown?Y=W:this.inputting?Y=this.rawInput:Y=this.toPrecisionAsStep(W),this.setState({value:W,inputValue:Y})}var ie="value"in this.props?D:this.state.value;"max"in this.props&&b.max!==j&&typeof ie=="number"&&ie>j&&H&&H(j),"min"in this.props&&b.min!==I&&typeof ie=="number"&&ie<I&&H&&H(I)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var oe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===p.a.BACKSPACE?oe=this.cursorStart-1:this.lastKeyCode===p.a.DELETE&&(oe=this.cursorStart):oe=this.input.value.length,this.fixCaret(oe,oe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case p.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case p.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(we){}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 N=b;return N===""?N="":this.isNotCompleteNumber(parseFloat(N))?N=this.state.value:N=this.getValidValue(N),this.toNumber(N)}},{key:"getValueFromEvent",value:function(b){var N=b.target.value.trim().replace(/。/g,".");return x(this.props.decimalSeparator)&&(N=N.replace(this.props.decimalSeparator,".")),N}},{key:"getValidValue",value:function(b){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,H=parseFloat(b);return isNaN(H)?b:(H<N&&(H=N),H>D&&(H=D),H)}},{key:"setValue",value:function(b,N){var D=this.props.precision,H=this.isNotCompleteNumber(parseFloat(b))?null:parseFloat(b),j=this.state.value,I=j===void 0?null:j,y=this.state.inputValue,W=y===void 0?null:y,Y=typeof H=="number"?H.toFixed(D):"".concat(H),ie=H!==I||Y!=="".concat(W);return"value"in this.props?(W=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:W},N)):this.setState({value:H,inputValue:this.toPrecisionAsStep(b)},N),ie&&this.props.onChange(H),H}},{key:"getMaxPrecision",value:function(b){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,D=this.props,H=D.precision,j=D.step;if(x(H))return H;var I=this.getPrecision(N),y=this.getPrecision(j),W=this.getPrecision(b);return b?Math.max(W,I+y):I+y}},{key:"getPrecisionFactor",value:function(b){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,D=this.getMaxPrecision(b,N);return Math.pow(10,D)}},{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 N=Math.abs(this.getMaxPrecision(b));return isNaN(N)?b.toString():Number(b).toFixed(N)}},{key:"toNumber",value:function(b){var N=this.props.precision,D=this.state.focused,H=b&&b.length>16&&D;return this.isNotCompleteNumber(b)||H?b:x(N)?Math.round(b*Math.pow(10,N))/Math.pow(10,N):Number(b)}},{key:"upStep",value:function(b,N){var D=this.props.step,H=this.getPrecisionFactor(b,N),j=Math.abs(this.getMaxPrecision(b,N)),I=((H*b+H*D*N)/H).toFixed(j);return this.toNumber(I)}},{key:"downStep",value:function(b,N){var D=this.props.step,H=this.getPrecisionFactor(b,N),j=Math.abs(this.getMaxPrecision(b,N)),I=((H*b-H*D*N)/H).toFixed(j);return this.toNumber(I)}},{key:"step",value:function(b,N){var D=this,H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,j=arguments.length>3?arguments[3]:void 0;this.stop(),N&&(N.persist(),N.preventDefault());var I=this.props;if(I.disabled)return;var y=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(y))return;var W=this["".concat(b,"Step")](y,H),Y=W>I.max||W<I.min;if(W>I.max?W=I.max:W<I.min&&(W=I.min),this.setValue(W,null),this.setState({focused:!0},function(){D.pressingUpOrDown=!1}),Y)return;this.autoStepTimer=setTimeout(function(){D[b](N,H,!0)},j?h:L)}},{key:"fixCaret",value:function(b,N){if(b===void 0||N===void 0||!this.input||!this.input.value)return;try{var D=this.input.selectionStart,H=this.input.selectionEnd;(b!==D||N!==H)&&this.input.setSelectionRange(b,N)}catch(j){}}},{key:"render",value:function(){var b,N=this.props,D=N.prefixCls,H=N.disabled,j=N.readOnly,I=N.useTouch,y=N.autoComplete,W=N.upHandler,Y=N.downHandler,ie=N.className,oe=N.max,we=N.min,me=N.style,Se=N.title,Ce=N.onMouseEnter,xe=N.onMouseLeave,pe=N.onMouseOver,le=N.onMouseOut,te=N.required,de=N.onClick,se=N.tabIndex,Oe=N.type,ke=N.placeholder,Te=N.id,Le=N.inputMode,Me=N.pattern,je=N.step,Fe=N.maxLength,Ne=N.autoFocus,Ue=N.name,Je=N.onPaste,tt=N.onInput,et=Object(ue.a)(N,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Ze=this.state,dt=Ze.value,it=Ze.focused,at=g()(D,(b={},Object(Z.a)(b,ie,!!ie),Object(Z.a)(b,"".concat(D,"-disabled"),H),Object(Z.a)(b,"".concat(D,"-focused"),it),b)),Ie={};Object.keys(et).forEach(function(ve){(ve.substr(0,5)==="data-"||ve.substr(0,5)==="aria-"||ve==="role")&&(Ie[ve]=et[ve])});var st=!j&&!H,$e=this.getInputDisplayValue(null),De=(dt||dt===0)&&(isNaN(dt)||Number(dt)>=oe),He=(dt||dt===0)&&(isNaN(dt)||Number(dt)<=we),Ee=De||H||j,fe=He||H||j,_e=g()("".concat(D,"-handler"),"".concat(D,"-handler-up"),Object(Z.a)({},"".concat(D,"-handler-up-disabled"),Ee)),re=g()("".concat(D,"-handler"),"".concat(D,"-handler-down"),Object(Z.a)({},"".concat(D,"-handler-down-disabled"),fe)),ae=I?{onTouchStart:Ee?l:this.up,onTouchEnd:this.stop}:{onMouseDown:Ee?l:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},he=I?{onTouchStart:fe?l:this.down,onTouchEnd:this.stop}:{onMouseDown:fe?l:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return M.a.createElement("div",{className:at,style:me,title:Se,onMouseEnter:Ce,onMouseLeave:xe,onMouseOver:pe,onMouseOut:le,onFocus:function(){return null},onBlur:function(){return null}},M.a.createElement("div",{className:"".concat(D,"-handler-wrap")},M.a.createElement("span",Object.assign({unselectable:"on"},ae,{role:"button","aria-label":"Increase Value","aria-disabled":Ee,className:_e}),W||M.a.createElement("span",{unselectable:"on",className:"".concat(D,"-handler-up-inner"),onClick:n})),M.a.createElement("span",Object.assign({unselectable:"on"},he,{role:"button","aria-label":"Decrease Value","aria-disabled":fe,className:re}),Y||M.a.createElement("span",{unselectable:"on",className:"".concat(D,"-handler-down-inner"),onClick:n}))),M.a.createElement("div",{className:"".concat(D,"-input-wrap")},M.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":we,"aria-valuemax":oe,"aria-valuenow":dt,required:te,type:Oe,placeholder:ke,onPaste:Je,onClick:de,onMouseUp:this.onMouseUp,className:"".concat(D,"-input"),tabIndex:se,autoComplete:y,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:st?this.onKeyDown:l,onKeyUp:st?this.onKeyUp:l,autoFocus:Ne,maxLength:Fe,readOnly:j,disabled:H,max:oe,min:we,step:je,name:Ue,title:Se,id:Te,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum($e),pattern:Me,inputMode:Le,onInput:tt},Ie))))}}]),E}(M.a.Component);C.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:S,min:-S,step:1,style:{},onChange:l,onKeyDown:l,onPressEnter:l,onFocus:l,onBlur:l,parser:o,required:!1,autoComplete:"off"};var w=C,T=Ye.a=w},h78n:function(gt,Ye,ne){"use strict";ne.d(Ye,"a",function(){return b});var ue=ne("q1tI"),Z=ne.n(ue),P=ne("TSYQ"),Q=ne.n(P),B={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},F=function(H){var j=H.map(function(){return Object(ue.useRef)()}),I=Object(ue.useRef)();return Object(ue.useEffect)(function(){var y=Date.now(),W=!1;Object.keys(j).forEach(function(Y){var ie=j[Y].current;if(!ie)return;W=!0;var oe=ie.style;oe.transitionDuration=".3s, .3s, .3s, .06s",I.current&&y-I.current<100&&(oe.transitionDuration="0s, 0s")}),W&&(I.current=Date.now())}),[j]};function K(){return K=Object.assign||function(D){for(var H=1;H<arguments.length;H++){var j=arguments[H];for(var I in j)Object.prototype.hasOwnProperty.call(j,I)&&(D[I]=j[I])}return D},K.apply(this,arguments)}function G(D,H){return f(D)||p(D,H)||R(D,H)||M()}function M(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function R(D,H){if(!D)return;if(typeof D=="string")return g(D,H);var j=Object.prototype.toString.call(D).slice(8,-1);if(j==="Object"&&D.constructor&&(j=D.constructor.name),j==="Map"||j==="Set")return Array.from(D);if(j==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(j))return g(D,H)}function g(D,H){(H==null||H>D.length)&&(H=D.length);for(var j=0,I=new Array(H);j<H;j++)I[j]=D[j];return I}function p(D,H){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(D)))return;var j=[],I=!0,y=!1,W=void 0;try{for(var Y=D[Symbol.iterator](),ie;!(I=(ie=Y.next()).done)&&!(j.push(ie.value),H&&j.length===H);I=!0);}catch(oe){y=!0,W=oe}finally{try{!I&&Y.return!=null&&Y.return()}finally{if(y)throw W}}return j}function f(D){if(Array.isArray(D))return D}function d(D,H){if(D==null)return{};var j=s(D,H),I,y;if(Object.getOwnPropertySymbols){var W=Object.getOwnPropertySymbols(D);for(y=0;y<W.length;y++){if(I=W[y],H.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(D,I))continue;j[I]=D[I]}}return j}function s(D,H){if(D==null)return{};var j={},I=Object.keys(D),y,W;for(W=0;W<I.length;W++){if(y=I[W],H.indexOf(y)>=0)continue;j[y]=D[y]}return j}var c=function(H){var j=H.className,I=H.percent,y=H.prefixCls,W=H.strokeColor,Y=H.strokeLinecap,ie=H.strokeWidth,oe=H.style,we=H.trailColor,me=H.trailWidth,Se=H.transition,Ce=d(H,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Ce.gapPosition;var xe=Array.isArray(I)?I:[I],pe=Array.isArray(W)?W:[W],le=F(xe),te=G(le,1),de=te[0],se=ie/2,Oe=100-ie/2,ke="M ".concat(Y==="round"?se:0,",").concat(se,`
|
|
L `).concat(Y==="round"?Oe:100,",").concat(se),Te="0 0 100 ".concat(ie),Le=0;return Z.a.createElement("svg",K({className:Q()("".concat(y,"-line"),j),viewBox:Te,preserveAspectRatio:"none",style:oe},Ce),Z.a.createElement("path",{className:"".concat(y,"-line-trail"),d:ke,strokeLinecap:Y,stroke:we,strokeWidth:me||ie,fillOpacity:"0"}),xe.map(function(Me,je){var Fe={strokeDasharray:"".concat(Me,"px, 100px"),strokeDashoffset:"-".concat(Le,"px"),transition:Se||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Ne=pe[je]||pe[pe.length-1];return Le+=Me,Z.a.createElement("path",{key:je,className:"".concat(y,"-line-path"),d:ke,strokeLinecap:Y,stroke:Ne,strokeWidth:ie,fillOpacity:"0",ref:de[je],style:Fe})}))};c.defaultProps=B;var l=c;function n(){return n=Object.assign||function(D){for(var H=1;H<arguments.length;H++){var j=arguments[H];for(var I in j)Object.prototype.hasOwnProperty.call(j,I)&&(D[I]=j[I])}return D},n.apply(this,arguments)}function o(D,H){return O(D)||x(D,H)||L(D,H)||h()}function h(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function L(D,H){if(!D)return;if(typeof D=="string")return S(D,H);var j=Object.prototype.toString.call(D).slice(8,-1);if(j==="Object"&&D.constructor&&(j=D.constructor.name),j==="Map"||j==="Set")return Array.from(D);if(j==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(j))return S(D,H)}function S(D,H){(H==null||H>D.length)&&(H=D.length);for(var j=0,I=new Array(H);j<H;j++)I[j]=D[j];return I}function x(D,H){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(D)))return;var j=[],I=!0,y=!1,W=void 0;try{for(var Y=D[Symbol.iterator](),ie;!(I=(ie=Y.next()).done)&&!(j.push(ie.value),H&&j.length===H);I=!0);}catch(oe){y=!0,W=oe}finally{try{!I&&Y.return!=null&&Y.return()}finally{if(y)throw W}}return j}function O(D){if(Array.isArray(D))return D}function C(D,H){if(D==null)return{};var j=w(D,H),I,y;if(Object.getOwnPropertySymbols){var W=Object.getOwnPropertySymbols(D);for(y=0;y<W.length;y++){if(I=W[y],H.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(D,I))continue;j[I]=D[I]}}return j}function w(D,H){if(D==null)return{};var j={},I=Object.keys(D),y,W;for(W=0;W<I.length;W++){if(y=I[W],H.indexOf(y)>=0)continue;j[y]=D[y]}return j}var T=0;function _(D){return+D.replace("%","")}function u(D){return Array.isArray(D)?D:[D]}function E(D,H,j,I){var y=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,W=arguments.length>5?arguments[5]:void 0,Y=50-I/2,ie=0,oe=-Y,we=0,me=-2*Y;switch(W){case"left":ie=-Y,oe=0,we=2*Y,me=0;break;case"right":ie=Y,oe=0,we=-2*Y,me=0;break;case"bottom":oe=Y,me=2*Y;break;default:}var Se="M 50,50 m ".concat(ie,",").concat(oe,`
|
|
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(we,",").concat(-me,`
|
|
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(-we,",").concat(me),Ce=Math.PI*2*Y,xe={stroke:j,strokeDasharray:"".concat(H/100*(Ce-y),"px ").concat(Ce,"px"),strokeDashoffset:"-".concat(y/2+D/100*(Ce-y),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Se,pathStyle:xe}}var m=function(H){var j=H.prefixCls,I=H.strokeWidth,y=H.trailWidth,W=H.gapDegree,Y=H.gapPosition,ie=H.trailColor,oe=H.strokeLinecap,we=H.style,me=H.className,Se=H.strokeColor,Ce=H.percent,xe=C(H,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),pe=Object(ue.useMemo)(function(){return T+=1,T},[]),le=E(0,100,ie,I,W,Y),te=le.pathString,de=le.pathStyle,se=u(Ce),Oe=u(Se),ke=Oe.find(function(Fe){return Object.prototype.toString.call(Fe)==="[object Object]"}),Te=F(se),Le=o(Te,1),Me=Le[0],je=function(){var Ne=0;return se.map(function(Ue,Je){var tt=Oe[Je]||Oe[Oe.length-1],et=Object.prototype.toString.call(tt)==="[object Object]"?"url(#".concat(j,"-gradient-").concat(pe,")"):"",Ze=E(Ne,Ue,tt,I,W,Y);return Ne+=Ue,Z.a.createElement("path",{key:Je,className:"".concat(j,"-circle-path"),d:Ze.pathString,stroke:et,strokeLinecap:oe,strokeWidth:I,opacity:Ue===0?0:1,fillOpacity:"0",style:Ze.pathStyle,ref:Me[Je]})})};return Z.a.createElement("svg",n({className:Q()("".concat(j,"-circle"),me),viewBox:"0 0 100 100",style:we},xe),ke&&Z.a.createElement("defs",null,Z.a.createElement("linearGradient",{id:"".concat(j,"-gradient-").concat(pe),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(ke).sort(function(Fe,Ne){return _(Fe)-_(Ne)}).map(function(Fe,Ne){return Z.a.createElement("stop",{key:Ne,offset:Fe,stopColor:ke[Fe]})}))),Z.a.createElement("path",{className:"".concat(j,"-circle-trail"),d:te,stroke:ie,strokeLinecap:oe,strokeWidth:y||I,fillOpacity:"0",style:de}),je().reverse())};m.defaultProps=B;var b=m,N={Line:l,Circle:b}},kSUc:function(gt,Ye,ne){},lZu9:function(gt,Ye,ne){(function(ue){ue(ne("VrN/"),ne("1eCo"),ne("8EBN"))})(function(ue){"use strict";ue.defineMode("markdown",function(Z,P){var Q=ue.getMode(Z,"text/html"),B=Q.name=="null";function F(I){if(ue.findModeByName){var y=ue.findModeByName(I);y&&(I=y.mime||y.mimes[0])}var W=ue.getMode(Z,I);return W.name=="null"?null:W}P.highlightFormatting===void 0&&(P.highlightFormatting=!1),P.maxBlockquoteDepth===void 0&&(P.maxBlockquoteDepth=0),P.taskLists===void 0&&(P.taskLists=!1),P.strikethrough===void 0&&(P.strikethrough=!1),P.emoji===void 0&&(P.emoji=!1),P.fencedCodeBlockHighlighting===void 0&&(P.fencedCodeBlockHighlighting=!0),P.fencedCodeBlockDefaultMode===void 0&&(P.fencedCodeBlockDefaultMode="text/plain"),P.xml===void 0&&(P.xml=!0),P.tokenTypeOverrides===void 0&&(P.tokenTypeOverrides={});var K={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 G in K)K.hasOwnProperty(G)&&P.tokenTypeOverrides[G]&&(K[G]=P.tokenTypeOverrides[G]);var M=/^([*\-_])(?:\s*\1){2,}\s*$/,R=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,g=/^\[(x| )\](?=\s)/i,p=P.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,f=/^ {0,3}(?:\={1,}|-{2,})\s*$/,d=/^[^#!\[\]*_\\<>` "'(~:]+/,s=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,c=/^\s*\[[^\]]+?\]:.*$/,l=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,n=" ";function o(I,y,W){return y.f=y.inline=W,W(I,y)}function h(I,y,W){return y.f=y.block=W,W(I,y)}function L(I){return!I||!/\S/.test(I.string)}function S(I){if(I.linkTitle=!1,I.linkHref=!1,I.linkText=!1,I.em=!1,I.strong=!1,I.strikethrough=!1,I.quote=0,I.indentedCode=!1,I.f==O){var y=B;if(!y){var W=ue.innerMode(Q,I.htmlState);y=W.mode.name=="xml"&&W.state.tagStart===null&&!W.state.context&&W.state.tokenize.isInText}y&&(I.f=_,I.block=x,I.htmlState=null)}return I.trailingSpace=0,I.trailingSpaceNewLine=!1,I.prevLine=I.thisLine,I.thisLine={stream:null},null}function x(I,y){var W=I.column()===y.indentation,Y=L(y.prevLine.stream),ie=y.indentedCode,oe=y.prevLine.hr,we=y.list!==!1,me=(y.listStack[y.listStack.length-1]||0)+3;y.indentedCode=!1;var Se=y.indentation;if(y.indentationDiff===null&&(y.indentationDiff=y.indentation,we)){for(y.list=null;Se<y.listStack[y.listStack.length-1];)y.listStack.pop(),y.listStack.length?y.indentation=y.listStack[y.listStack.length-1]:y.list=!1;y.list!==!1&&(y.indentationDiff=Se-y.listStack[y.listStack.length-1])}var Ce=!Y&&!oe&&!y.prevLine.header&&(!we||!ie)&&!y.prevLine.fencedCodeEnd,xe=(y.list===!1||oe||Y)&&y.indentation<=me&&I.match(M),pe=null;if(y.indentationDiff>=4&&(ie||y.prevLine.fencedCodeEnd||y.prevLine.header||Y))return I.skipToEnd(),y.indentedCode=!0,K.code;if(I.eatSpace())return null;if(W&&y.indentation<=me&&(pe=I.match(p))&&pe[1].length<=6)return y.quote=0,y.header=pe[1].length,y.thisLine.header=!0,P.highlightFormatting&&(y.formatting="header"),y.f=y.inline,w(y);if(y.indentation<=me&&I.eat(">"))return y.quote=W?1:y.quote+1,P.highlightFormatting&&(y.formatting="quote"),I.eatSpace(),w(y);if(!xe&&!y.setext&&W&&y.indentation<=me&&(pe=I.match(R))){var le=pe[1]?"ol":"ul";return y.indentation=Se+I.current().length,y.list=!0,y.quote=0,y.listStack.push(y.indentation),y.em=!1,y.strong=!1,y.code=!1,y.strikethrough=!1,P.taskLists&&I.match(g,!1)&&(y.taskList=!0),y.f=y.inline,P.highlightFormatting&&(y.formatting=["list","list-"+le]),w(y)}else{if(W&&y.indentation<=me&&(pe=I.match(s,!0)))return y.quote=0,y.fencedEndRE=new RegExp(pe[1]+"+ *$"),y.localMode=P.fencedCodeBlockHighlighting&&F(pe[2]||P.fencedCodeBlockDefaultMode),y.localMode&&(y.localState=ue.startState(y.localMode)),y.f=y.block=C,P.highlightFormatting&&(y.formatting="code-block"),y.code=-1,w(y);if(y.setext||(!Ce||!we)&&!y.quote&&y.list===!1&&!y.code&&!xe&&!c.test(I.string)&&(pe=I.lookAhead(1))&&(pe=pe.match(f)))return y.setext?(y.header=y.setext,y.setext=0,I.skipToEnd(),P.highlightFormatting&&(y.formatting="header")):(y.header=pe[0].charAt(0)=="="?1:2,y.setext=y.header),y.thisLine.header=!0,y.f=y.inline,w(y);if(xe)return I.skipToEnd(),y.hr=!0,y.thisLine.hr=!0,K.hr;if(I.peek()==="[")return o(I,y,N)}return o(I,y,y.inline)}function O(I,y){var W=Q.token(I,y.htmlState);if(!B){var Y=ue.innerMode(Q,y.htmlState);(Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText||y.md_inside&&I.current().indexOf(">")>-1)&&(y.f=_,y.block=x,y.htmlState=null)}return W}function C(I,y){var W=y.listStack[y.listStack.length-1]||0,Y=y.indentation<W,ie=W+3;if(y.fencedEndRE&&y.indentation<=ie&&(Y||I.match(y.fencedEndRE))){P.highlightFormatting&&(y.formatting="code-block");var oe;return Y||(oe=w(y)),y.localMode=y.localState=null,y.block=x,y.f=_,y.fencedEndRE=null,y.code=0,y.thisLine.fencedCodeEnd=!0,Y?h(I,y,y.block):oe}else return y.localMode?y.localMode.token(I,y.localState):(I.skipToEnd(),K.code)}function w(I){var y=[];if(I.formatting){y.push(K.formatting),typeof I.formatting=="string"&&(I.formatting=[I.formatting]);for(var W=0;W<I.formatting.length;W++)y.push(K.formatting+"-"+I.formatting[W]),I.formatting[W]==="header"&&y.push(K.formatting+"-"+I.formatting[W]+"-"+I.header),I.formatting[W]==="quote"&&(!P.maxBlockquoteDepth||P.maxBlockquoteDepth>=I.quote?y.push(K.formatting+"-"+I.formatting[W]+"-"+I.quote):y.push("error"))}if(I.taskOpen)return y.push("meta"),y.length?y.join(" "):null;if(I.taskClosed)return y.push("property"),y.length?y.join(" "):null;if(I.linkHref?y.push(K.linkHref,"url"):(I.strong&&y.push(K.strong),I.em&&y.push(K.em),I.strikethrough&&y.push(K.strikethrough),I.emoji&&y.push(K.emoji),I.linkText&&y.push(K.linkText),I.code&&y.push(K.code),I.image&&y.push(K.image),I.imageAltText&&y.push(K.imageAltText,"link"),I.imageMarker&&y.push(K.imageMarker)),I.header&&y.push(K.header,K.header+"-"+I.header),I.quote&&(y.push(K.quote),!P.maxBlockquoteDepth||P.maxBlockquoteDepth>=I.quote?y.push(K.quote+"-"+I.quote):y.push(K.quote+"-"+P.maxBlockquoteDepth)),I.list!==!1){var Y=(I.listStack.length-1)%3;Y?Y===1?y.push(K.list2):y.push(K.list3):y.push(K.list1)}return I.trailingSpaceNewLine?y.push("trailing-space-new-line"):I.trailingSpace&&y.push("trailing-space-"+(I.trailingSpace%2?"a":"b")),y.length?y.join(" "):null}function T(I,y){return I.match(d,!0)?w(y):void 0}function _(I,y){var W=y.text(I,y);if(typeof W!="undefined")return W;if(y.list)return y.list=null,w(y);if(y.taskList){var Y=I.match(g,!0)[1]===" ";return Y?y.taskOpen=!0:y.taskClosed=!0,P.highlightFormatting&&(y.formatting="task"),y.taskList=!1,w(y)}if(y.taskOpen=!1,y.taskClosed=!1,y.header&&I.match(/^#+$/,!0))return P.highlightFormatting&&(y.formatting="header"),w(y);var ie=I.next();if(y.linkTitle){y.linkTitle=!1;var oe=ie;ie==="("&&(oe=")"),oe=(oe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var we="^\\s*(?:[^"+oe+"\\\\]+|\\\\\\\\|\\\\.)"+oe;if(I.match(new RegExp(we),!0))return K.linkHref}if(ie==="`"){var me=y.formatting;P.highlightFormatting&&(y.formatting="code"),I.eatWhile("`");var Se=I.current().length;if(y.code==0&&(!y.quote||Se==1))return y.code=Se,w(y);if(Se==y.code){var Ce=w(y);return y.code=0,Ce}else return y.formatting=me,w(y)}else if(y.code)return w(y);if(ie==="\\"&&(I.next(),P.highlightFormatting)){var xe=w(y),pe=K.formatting+"-escape";return xe?xe+" "+pe:pe}if(ie==="!"&&I.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return y.imageMarker=!0,y.image=!0,P.highlightFormatting&&(y.formatting="image"),w(y);if(ie==="["&&y.imageMarker&&I.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return y.imageMarker=!1,y.imageAltText=!0,P.highlightFormatting&&(y.formatting="image"),w(y);if(ie==="]"&&y.imageAltText){P.highlightFormatting&&(y.formatting="image");var xe=w(y);return y.imageAltText=!1,y.image=!1,y.inline=y.f=E,xe}if(ie==="["&&!y.image)return y.linkText&&I.match(/^.*?\]/)||(y.linkText=!0,P.highlightFormatting&&(y.formatting="link")),w(y);if(ie==="]"&&y.linkText){P.highlightFormatting&&(y.formatting="link");var xe=w(y);return y.linkText=!1,y.inline=y.f=I.match(/\(.*?\)| ?\[.*?\]/,!1)?E:_,xe}if(ie==="<"&&I.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){y.f=y.inline=u,P.highlightFormatting&&(y.formatting="link");var xe=w(y);return xe?xe+=" ":xe="",xe+K.linkInline}if(ie==="<"&&I.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){y.f=y.inline=u,P.highlightFormatting&&(y.formatting="link");var xe=w(y);return xe?xe+=" ":xe="",xe+K.linkEmail}if(P.xml&&ie==="<"&&I.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var le=I.string.indexOf(">",I.pos);if(le!=-1){var te=I.string.substring(I.start,le);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(te)&&(y.md_inside=!0)}return I.backUp(1),y.htmlState=ue.startState(Q),h(I,y,O)}if(P.xml&&ie==="<"&&I.match(/^\/\w*?>/))return y.md_inside=!1,"tag";if(ie==="*"||ie==="_"){for(var de=1,se=I.pos==1?" ":I.string.charAt(I.pos-2);de<3&&I.eat(ie);)de++;var Oe=I.peek()||" ",ke=!/\s/.test(Oe)&&(!l.test(Oe)||/\s/.test(se)||l.test(se)),Te=!/\s/.test(se)&&(!l.test(se)||/\s/.test(Oe)||l.test(Oe)),Le=null,Me=null;if(de%2&&(!y.em&&ke&&(ie==="*"||!Te||l.test(se))?Le=!0:y.em==ie&&Te&&(ie==="*"||!ke||l.test(Oe))&&(Le=!1)),de>1&&(!y.strong&&ke&&(ie==="*"||!Te||l.test(se))?Me=!0:y.strong==ie&&Te&&(ie==="*"||!ke||l.test(Oe))&&(Me=!1)),Me!=null||Le!=null){P.highlightFormatting&&(y.formatting=Le==null?"strong":Me==null?"em":"strong em"),Le===!0&&(y.em=ie),Me===!0&&(y.strong=ie);var Ce=w(y);return Le===!1&&(y.em=!1),Me===!1&&(y.strong=!1),Ce}}else if(ie===" "&&(I.eat("*")||I.eat("_"))){if(I.peek()===" ")return w(y);I.backUp(1)}if(P.strikethrough){if(ie==="~"&&I.eatWhile(ie)){if(y.strikethrough){P.highlightFormatting&&(y.formatting="strikethrough");var Ce=w(y);return y.strikethrough=!1,Ce}else if(I.match(/^[^\s]/,!1))return y.strikethrough=!0,P.highlightFormatting&&(y.formatting="strikethrough"),w(y)}else if(ie===" "&&I.match(/^~~/,!0)){if(I.peek()===" ")return w(y);I.backUp(2)}}if(P.emoji&&ie===":"&&I.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){y.emoji=!0,P.highlightFormatting&&(y.formatting="emoji");var je=w(y);return y.emoji=!1,je}return ie===" "&&(I.match(/^ +$/,!1)?y.trailingSpace++:y.trailingSpace&&(y.trailingSpaceNewLine=!0)),w(y)}function u(I,y){var W=I.next();if(W===">"){y.f=y.inline=_,P.highlightFormatting&&(y.formatting="link");var Y=w(y);return Y?Y+=" ":Y="",Y+K.linkInline}return I.match(/^[^>]+/,!0),K.linkInline}function E(I,y){if(I.eatSpace())return null;var W=I.next();return W==="("||W==="["?(y.f=y.inline=b(W==="("?")":"]"),P.highlightFormatting&&(y.formatting="link-string"),y.linkHref=!0,w(y)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function b(I){return function(y,W){var Y=y.next();if(Y===I){W.f=W.inline=_,P.highlightFormatting&&(W.formatting="link-string");var ie=w(W);return W.linkHref=!1,ie}return y.match(m[I]),W.linkHref=!0,w(W)}}function N(I,y){return I.match(/^([^\]\\]|\\.)*\]:/,!1)?(y.f=D,I.next(),P.highlightFormatting&&(y.formatting="link"),y.linkText=!0,w(y)):o(I,y,_)}function D(I,y){if(I.match(/^\]:/,!0)){y.f=y.inline=H,P.highlightFormatting&&(y.formatting="link");var W=w(y);return y.linkText=!1,W}return I.match(/^([^\]\\]|\\.)+/,!0),K.linkText}function H(I,y){return I.eatSpace()?null:(I.match(/^[^\s]+/,!0),I.peek()===void 0?y.linkTitle=!0:I.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),y.f=y.inline=_,K.linkHref+" url")}var j={startState:function(){return{f:x,prevLine:{stream:null},thisLine:{stream:null},block:x,htmlState:null,indentation:0,inline:_,text:T,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(I){return{f:I.f,prevLine:I.prevLine,thisLine:I.thisLine,block:I.block,htmlState:I.htmlState&&ue.copyState(Q,I.htmlState),indentation:I.indentation,localMode:I.localMode,localState:I.localMode?ue.copyState(I.localMode,I.localState):null,inline:I.inline,text:I.text,formatting:!1,linkText:I.linkText,linkTitle:I.linkTitle,linkHref:I.linkHref,code:I.code,em:I.em,strong:I.strong,strikethrough:I.strikethrough,emoji:I.emoji,header:I.header,setext:I.setext,hr:I.hr,taskList:I.taskList,list:I.list,listStack:I.listStack.slice(0),quote:I.quote,indentedCode:I.indentedCode,trailingSpace:I.trailingSpace,trailingSpaceNewLine:I.trailingSpaceNewLine,md_inside:I.md_inside,fencedEndRE:I.fencedEndRE}},token:function(I,y){if(y.formatting=!1,I!=y.thisLine.stream){if(y.header=0,y.hr=!1,I.match(/^\s*$/,!0))return S(y),null;if(y.prevLine=y.thisLine,y.thisLine={stream:I},y.taskList=!1,y.trailingSpace=0,y.trailingSpaceNewLine=!1,!y.localState&&(y.f=y.block,y.f!=O)){var W=I.match(/^\s*/,!0)[0].replace(/\t/g,n).length;if(y.indentation=W,y.indentationDiff=null,W>0)return null}}return y.f(I,y)},innerMode:function(I){return I.block==O?{state:I.htmlState,mode:Q}:I.localState?{state:I.localState,mode:I.localMode}:{state:I,mode:j}},indent:function(I,y,W){return I.block==O&&Q.indent?Q.indent(I.htmlState,y,W):I.localState&&I.localMode.indent?I.localMode.indent(I.localState,y,W):ue.Pass},blankLine:S,getType:w,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return j},"xml"),ue.defineMIME("text/markdown","markdown"),ue.defineMIME("text/x-markdown","markdown")})},osHv:function(gt,Ye,ne){(function(ue){ue(ne("VrN/"))})(function(ue){"use strict";var Z=ue.Pos;function P(l,n){return l.line-n.line||l.ch-n.ch}var Q="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",B=Q+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",F=new RegExp("<(/?)(["+Q+"]["+B+"]*)","g");function K(l,n,o,h){this.line=n,this.ch=o,this.cm=l,this.text=l.getLine(n),this.min=h?Math.max(h.from,l.firstLine()):l.firstLine(),this.max=h?Math.min(h.to-1,l.lastLine()):l.lastLine()}function G(l,n){var o=l.cm.getTokenTypeAt(Z(l.line,n));return o&&/\btag\b/.test(o)}function M(l){return l.line>=l.max?void 0:(l.ch=0,l.text=l.cm.getLine(++l.line),!0)}function R(l){return l.line<=l.min?void 0:(l.text=l.cm.getLine(--l.line),l.ch=l.text.length,!0)}function g(l){for(;;){var n=l.text.indexOf(">",l.ch);if(n==-1){if(M(l))continue;return}if(!G(l,n+1)){l.ch=n+1;continue}var o=l.text.lastIndexOf("/",n),h=o>-1&&!/\S/.test(l.text.slice(o+1,n));return l.ch=n+1,h?"selfClose":"regular"}}function p(l){for(;;){var n=l.ch?l.text.lastIndexOf("<",l.ch-1):-1;if(n==-1){if(R(l))continue;return}if(!G(l,n+1)){l.ch=n;continue}F.lastIndex=n,l.ch=n;var o=F.exec(l.text);if(o&&o.index==n)return o}}function f(l){for(;;){F.lastIndex=l.ch;var n=F.exec(l.text);if(!n){if(M(l))continue;return}if(!G(l,n.index+1)){l.ch=n.index+1;continue}return l.ch=n.index+n[0].length,n}}function d(l){for(;;){var n=l.ch?l.text.lastIndexOf(">",l.ch-1):-1;if(n==-1){if(R(l))continue;return}if(!G(l,n+1)){l.ch=n;continue}var o=l.text.lastIndexOf("/",n),h=o>-1&&!/\S/.test(l.text.slice(o+1,n));return l.ch=n+1,h?"selfClose":"regular"}}function s(l,n){for(var o=[];;){var h=f(l),L,S=l.line,x=l.ch-(h?h[0].length:0);if(!h||!(L=g(l)))return;if(L=="selfClose")continue;if(h[1]){for(var O=o.length-1;O>=0;--O)if(o[O]==h[2]){o.length=O;break}if(O<0&&(!n||n==h[2]))return{tag:h[2],from:Z(S,x),to:Z(l.line,l.ch)}}else o.push(h[2])}}function c(l,n){for(var o=[];;){var h=d(l);if(!h)return;if(h=="selfClose"){p(l);continue}var L=l.line,S=l.ch,x=p(l);if(!x)return;if(x[1])o.push(x[2]);else{for(var O=o.length-1;O>=0;--O)if(o[O]==x[2]){o.length=O;break}if(O<0&&(!n||n==x[2]))return{tag:x[2],from:Z(l.line,l.ch),to:Z(L,S)}}}}ue.registerHelper("fold","xml",function(l,n){for(var o=new K(l,n.line,0);;){var h=f(o);if(!h||o.line!=n.line)return;var L=g(o);if(!L)return;if(!h[1]&&L!="selfClose"){var S=Z(o.line,o.ch),x=s(o,h[2]);return x&&P(x.from,S)>0?{from:S,to:x.from}:null}}}),ue.findMatchingTag=function(l,n,o){var h=new K(l,n.line,n.ch,o);if(h.text.indexOf(">")==-1&&h.text.indexOf("<")==-1)return;var L=g(h),S=L&&Z(h.line,h.ch),x=L&&p(h);if(!L||!x||P(h,n)>0)return;var O={from:Z(h.line,h.ch),to:S,tag:x[2]};return L=="selfClose"?{open:O,close:null,at:"open"}:x[1]?{open:c(h,x[2]),close:O,at:"close"}:(h=new K(l,S.line,S.ch,o),{open:O,close:s(h,x[2]),at:"open"})},ue.findEnclosingTag=function(l,n,o,h){for(var L=new K(l,n.line,n.ch,o);;){var S=c(L,h);if(!S)break;var x=new K(l,n.line,n.ch,o),O=s(x,S.tag);if(O)return{open:S,close:O}}},ue.scanForClosingTag=function(l,n,o,h){var L=new K(l,n.line,n.ch,h?{from:0,to:h}:null);return s(L,o)}})},p5ED:function(gt,Ye,ne){"use strict";var ue=ne("+L6B"),Z=ne("2/Rp"),P=ne("5Dmo"),Q=ne("3S7+"),B=ne("k1fw"),F=ne("tJVT"),K=ne("q1tI"),G=ne.n(K),M=ne("vHTk"),R=ne.n(M),g=ne("yEEn"),p=ne("ZW9T"),f=ne("1vsH");Ye.a=function(d){var s=d.name,c=d.data,l=d.theme,n=d.type,o=d.filename,h=d.monacoEditor,L=d.className,S=d.style,x=d.close,O=d.onClose,C=d.hasMask,w=Object(K.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),T=Object(F.a)(w,2),_=T[0],u=T[1],E=Object(K.useState)(""),m=Object(F.a)(E,2),b=m[0],N=m[1],D,H=1024*1024,j=10*H,I=Object(K.useRef)();n==="office"&&(D=Object(f.T)(c).filesize,D>j&&(n="other")),o&&(h.filename=o),Object(K.useEffect)(function(){var Y,ie,oe=(Y=document.cookie)===null||Y===void 0||((ie=Y.replace(/\s/g,""))===null||ie===void 0)?void 0:ie.split(";");oe==null||oe.map(function(we){var me=we.split("=");me[0]==="_educoder_session"&&N(me[1])})},[]);var y=function(){if(c.startsWith("http")||c.startsWith("/")){W();return}Object(f.z)(o||"educoder",c,o)},W=function(){Object(f.x)(o||s,c)};return console.log("data:",c,"fileanme:",o," name:",s),G.a.createElement("div",{style:Object(B.a)({},S||{}),className:"".concat(C&&R.a.bgBlack," ").concat(n?R.a.wrp:"hide")},x&&G.a.createElement("div",{className:R.a.close,ref:I},G.a.createElement(Q.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return I.current}},G.a.createElement("span",{onClick:W},G.a.createElement("i",{className:"icon-quxiaozhiding"}))),G.a.createElement(Q.a,{title:"\u5173\u95ED",getPopupContainer:function(){return I.current}},G.a.createElement("span",{className:"",onClick:O},G.a.createElement("i",{className:"icon-guanbi1"})))),G.a.createElement("div",{className:"".concat(R.a[L]," ").concat(L," ").concat(R.a.monaco," ").concat(n==="txt"?"show":"hide")},n==="txt"&&G.a.createElement(p.b,h)),n==="audio"&&G.a.createElement("audio",{src:"".concat(c!=null&&c.startsWith("/")||(c==null?void 0:c.indexOf("https://"))>-1?c:"data:audio/mp3;base64,").concat(c),autoPlay:!0}),n==="video"&&G.a.createElement(G.a.Fragment,null,c!=null&&c.startsWith("/")?G.a.createElement("video",{controls:!0,src:"".concat(c),autoPlay:!0}):G.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(c),autoPlay:!0})),n==="html"&&G.a.createElement("iframe",{src:c+"&disposition=inline"}),n==="pdf"&&G.a.createElement("embed",{className:R.a.embed,src:c}),n==="image"&&G.a.createElement(G.a.Fragment,null,G.a.createElement("img",{src:"".concat(c!=null&&c.startsWith("/")||(c==null?void 0:c.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(c)})),n==="other"&&G.a.createElement("div",null,G.a.createElement(Z.a,{type:"primary",size:"large",onClick:y},G.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(n==="download"||n==="office")&&G.a.createElement(Z.a,{type:"primary",size:"large",onClick:y},G.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(gt,Ye,ne){},psGv:function(gt,Ye,ne){var ue,Z;(function(){var P;(function(){"use strict";var K=[,,function(g){function p(s){this.__parent=s,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=[]}p.prototype.clone_empty=function(){var s=new p(this.__parent);return s.set_indent(this.__indent_count,this.__alignment_count),s},p.prototype.item=function(s){return s<0?this.__items[this.__items.length+s]:this.__items[s]},p.prototype.has_match=function(s){for(var c=this.__items.length-1;c>=0;c--)if(this.__items[c].match(s))return!0;return!1},p.prototype.set_indent=function(s,c){this.is_empty()&&(this.__indent_count=s||0,this.__alignment_count=c||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},p.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)},p.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},p.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var s=this.__parent.current_line;return s.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),s.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),s.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,s.__items[0]===" "&&(s.__items.splice(0,1),s.__character_count-=1),!0}return!1},p.prototype.is_empty=function(){return this.__items.length===0},p.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},p.prototype.push=function(s){this.__items.push(s);var c=s.lastIndexOf(`
|
|
`);c!==-1?this.__character_count=s.length-c:this.__character_count+=s.length},p.prototype.pop=function(){var s=null;return this.is_empty()||(s=this.__items.pop(),this.__character_count-=s.length),s},p.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},p.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},p.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},p.prototype.toString=function(){var s="";return this.is_empty()?this.__parent.indent_empty_lines&&(s=this.__parent.get_indent_string(this.__indent_count)):(s=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),s+=this.__items.join("")),s};function f(s,c){this.__cache=[""],this.__indent_size=s.indent_size,this.__indent_string=s.indent_char,s.indent_with_tabs||(this.__indent_string=new Array(s.indent_size+1).join(s.indent_char)),c=c||"",s.indent_level>0&&(c=new Array(s.indent_level+1).join(this.__indent_string)),this.__base_string=c,this.__base_string_length=c.length}f.prototype.get_indent_size=function(s,c){var l=this.__base_string_length;return c=c||0,s<0&&(l=0),l+=s*this.__indent_size,l+=c,l},f.prototype.get_indent_string=function(s,c){var l=this.__base_string;return c=c||0,s<0&&(s=0,l=""),c+=s*this.__indent_size,this.__ensure_cache(c),l+=this.__cache[c],l},f.prototype.__ensure_cache=function(s){for(;s>=this.__cache.length;)this.__add_column()},f.prototype.__add_column=function(){var s=this.__cache.length,c=0,l="";this.__indent_size&&s>=this.__indent_size&&(c=Math.floor(s/this.__indent_size),s-=c*this.__indent_size,l=new Array(c+1).join(this.__indent_string)),s&&(l+=new Array(s+1).join(" ")),this.__cache.push(l)};function d(s,c){this.__indent_cache=new f(s,c),this.raw=!1,this._end_with_newline=s.end_with_newline,this.indent_size=s.indent_size,this.wrap_line_length=s.wrap_line_length,this.indent_empty_lines=s.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new p(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}d.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},d.prototype.get_line_number=function(){return this.__lines.length},d.prototype.get_indent_string=function(s,c){return this.__indent_cache.get_indent_string(s,c)},d.prototype.get_indent_size=function(s,c){return this.__indent_cache.get_indent_size(s,c)},d.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},d.prototype.add_new_line=function(s){return this.is_empty()||!s&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},d.prototype.get_code=function(s){this.trim(!0);var c=this.current_line.pop();c&&(c[c.length-1]===`
|
|
`&&(c=c.replace(/\n+$/g,"")),this.current_line.push(c)),this._end_with_newline&&this.__add_outputline();var l=this.__lines.join(`
|
|
`);return s!==`
|
|
`&&(l=l.replace(/[\n]/g,s)),l},d.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},d.prototype.set_indent=function(s,c){return s=s||0,c=c||0,this.next_line.set_indent(s,c),this.__lines.length>1?(this.current_line.set_indent(s,c),!0):(this.current_line.set_indent(),!1)},d.prototype.add_raw_token=function(s){for(var c=0;c<s.newlines;c++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(s.whitespace_before),this.current_line.push(s.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},d.prototype.add_token=function(s){this.__add_space_before_token(),this.current_line.push(s),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},d.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(" "))},d.prototype.remove_indent=function(s){for(var c=this.__lines.length;s<c;)this.__lines[s]._remove_indent(),s++;this.current_line._remove_wrap_indent()},d.prototype.trim=function(s){for(s=s===void 0?!1:s,this.current_line.trim();s&&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},d.prototype.just_added_newline=function(){return this.current_line.is_empty()},d.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},d.prototype.ensure_empty_line_above=function(s,c){for(var l=this.__lines.length-2;l>=0;){var n=this.__lines[l];if(n.is_empty())break;if(n.item(0).indexOf(s)!==0&&n.item(-1)!==c){this.__lines.splice(l+1,0,new p(this)),this.previous_line=this.__lines[this.__lines.length-2];break}l--}},g.exports.Output=d},function(g){function p(f,d,s,c){this.type=f,this.text=d,this.comments_before=null,this.newlines=s||0,this.whitespace_before=c||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}g.exports.Token=p},,,function(g){function p(s,c){this.raw_options=f(s,c),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"])}p.prototype._get_array=function(s,c){var l=this.raw_options[s],n=c||[];return typeof l=="object"?l!==null&&typeof l.concat=="function"&&(n=l.concat()):typeof l=="string"&&(n=l.split(/[^a-zA-Z0-9_\/\-]+/)),n},p.prototype._get_boolean=function(s,c){var l=this.raw_options[s],n=l===void 0?!!c:!!l;return n},p.prototype._get_characters=function(s,c){var l=this.raw_options[s],n=c||"";return typeof l=="string"&&(n=l.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),n},p.prototype._get_number=function(s,c){var l=this.raw_options[s];c=parseInt(c,10),isNaN(c)&&(c=0);var n=parseInt(l,10);return isNaN(n)&&(n=c),n},p.prototype._get_selection=function(s,c,l){var n=this._get_selection_list(s,c,l);if(n.length!==1)throw new Error("Invalid Option Value: The option '"+s+`' can only be one of the following values:
|
|
`+c+`
|
|
You passed in: '`+this.raw_options[s]+"'");return n[0]},p.prototype._get_selection_list=function(s,c,l){if(!c||c.length===0)throw new Error("Selection list cannot be empty.");if(l=l||[c[0]],!this._is_valid_selection(l,c))throw new Error("Invalid Default Value!");var n=this._get_array(s,l);if(!this._is_valid_selection(n,c))throw new Error("Invalid Option Value: The option '"+s+`' can contain only the following values:
|
|
`+c+`
|
|
You passed in: '`+this.raw_options[s]+"'");return n},p.prototype._is_valid_selection=function(s,c){return s.length&&c.length&&!s.some(function(l){return c.indexOf(l)===-1})};function f(s,c){var l={};s=d(s);var n;for(n in s)n!==c&&(l[n]=s[n]);if(c&&s[c])for(n in s[c])l[n]=s[c][n];return l}function d(s){var c={},l;for(l in s){var n=l.replace(/-/g,"_");c[n]=s[l]}return c}g.exports.Options=p,g.exports.normalizeOpts=d,g.exports.mergeOpts=f},,function(g){var p=RegExp.prototype.hasOwnProperty("sticky");function f(d){this.__input=d||"",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 d=null;return this.hasNext()&&(d=this.__input.charAt(this.__position),this.__position+=1),d},f.prototype.peek=function(d){var s=null;return d=d||0,d+=this.__position,d>=0&&d<this.__input_length&&(s=this.__input.charAt(d)),s},f.prototype.__match=function(d,s){d.lastIndex=s;var c=d.exec(this.__input);return c&&!(p&&d.sticky)&&(c.index!==s&&(c=null)),c},f.prototype.test=function(d,s){return s=s||0,s+=this.__position,s>=0&&s<this.__input_length?!!this.__match(d,s):!1},f.prototype.testChar=function(d,s){var c=this.peek(s);return d.lastIndex=0,c!==null&&d.test(c)},f.prototype.match=function(d){var s=this.__match(d,this.__position);return s?this.__position+=s[0].length:s=null,s},f.prototype.read=function(d,s,c){var l="",n;return d&&(n=this.match(d),n&&(l+=n[0])),s&&(n||!d)&&(l+=this.readUntil(s,c)),l},f.prototype.readUntil=function(d,s){var c="",l=this.__position;d.lastIndex=this.__position;var n=d.exec(this.__input);return n?(l=n.index,s&&(l+=n[0].length)):l=this.__input_length,c=this.__input.substring(this.__position,l),this.__position=l,c},f.prototype.readUntilAfter=function(d){return this.readUntil(d,!0)},f.prototype.get_regexp=function(d,s){var c=null,l="g";return s&&p&&(l="y"),typeof d=="string"&&d!==""?c=new RegExp(d,l):d&&(c=new RegExp(d.source,l)),c},f.prototype.get_literal_regexp=function(d){return RegExp(d.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},f.prototype.peekUntilAfter=function(d){var s=this.__position,c=this.readUntilAfter(d);return this.__position=s,c},f.prototype.lookBack=function(d){var s=this.__position-1;return s>=d.length&&this.__input.substring(s-d.length,s).toLowerCase()===d},g.exports.InputScanner=f},function(g,p,f){var d=f(8).InputScanner,s=f(3).Token,c=f(10).TokenStream,l=f(11).WhitespacePattern,n={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},o=function(h,L){this._input=new d(h),this._options=L||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new l(this._input)};o.prototype.tokenize=function(){this._input.restart(),this.__tokens=new c,this._reset();for(var h,L=new s(n.START,""),S=null,x=[],O=new c;L.type!==n.EOF;){for(h=this._get_next_token(L,S);this._is_comment(h);)O.add(h),h=this._get_next_token(L,S);O.isEmpty()||(h.comments_before=O,O=new c),h.parent=S,this._is_opening(h)?(x.push(S),S=h):S&&this._is_closing(h,S)&&(h.opened=S,S.closed=h,S=x.pop(),h.parent=S),h.previous=L,L.next=h,this.__tokens.add(h),L=h}return this.__tokens},o.prototype._is_first_token=function(){return this.__tokens.isEmpty()},o.prototype._reset=function(){},o.prototype._get_next_token=function(h,L){this._readWhitespace();var S=this._input.read(/.+/g);return S?this._create_token(n.RAW,S):this._create_token(n.EOF,"")},o.prototype._is_comment=function(h){return!1},o.prototype._is_opening=function(h){return!1},o.prototype._is_closing=function(h,L){return!1},o.prototype._create_token=function(h,L){var S=new s(h,L,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return S},o.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},g.exports.Tokenizer=o,g.exports.TOKEN=n},function(g){function p(f){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=f}p.prototype.restart=function(){this.__position=0},p.prototype.isEmpty=function(){return this.__tokens_length===0},p.prototype.hasNext=function(){return this.__position<this.__tokens_length},p.prototype.next=function(){var f=null;return this.hasNext()&&(f=this.__tokens[this.__position],this.__position+=1),f},p.prototype.peek=function(f){var d=null;return f=f||0,f+=this.__position,f>=0&&f<this.__tokens_length&&(d=this.__tokens[f]),d},p.prototype.add=function(f){this.__parent_token&&(f.parent=this.__parent_token),this.__tokens.push(f),this.__tokens_length+=1},g.exports.TokenStream=p},function(g,p,f){var d=f(12).Pattern;function s(c,l){d.call(this,c,l),l?this._line_regexp=this._input.get_regexp(l._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}s.prototype=new d,s.prototype.__set_whitespace_patterns=function(c,l){c+="\\t ",l+="\\n\\r",this._match_pattern=this._input.get_regexp("["+c+l+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+l+"]")},s.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var c=this._input.read(this._match_pattern);if(c===" ")this.whitespace_before_token=" ";else if(c){var l=this.__split(this._newline_regexp,c);this.newline_count=l.length-1,this.whitespace_before_token=l[this.newline_count]}return c},s.prototype.matching=function(c,l){var n=this._create();return n.__set_whitespace_patterns(c,l),n._update(),n},s.prototype._create=function(){return new s(this._input,this)},s.prototype.__split=function(c,l){c.lastIndex=0;for(var n=0,o=[],h=c.exec(l);h;)o.push(l.substring(n,h.index)),n=h.index+h[0].length,h=c.exec(l);return n<l.length?o.push(l.substring(n,l.length)):o.push(""),o},g.exports.WhitespacePattern=s},function(g){function p(f,d){this._input=f,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,d&&(this._starting_pattern=this._input.get_regexp(d._starting_pattern,!0),this._match_pattern=this._input.get_regexp(d._match_pattern,!0),this._until_pattern=this._input.get_regexp(d._until_pattern),this._until_after=d._until_after)}p.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},p.prototype.read_match=function(){return this._input.match(this._match_pattern)},p.prototype.until_after=function(f){var d=this._create();return d._until_after=!0,d._until_pattern=this._input.get_regexp(f),d._update(),d},p.prototype.until=function(f){var d=this._create();return d._until_after=!1,d._until_pattern=this._input.get_regexp(f),d._update(),d},p.prototype.starting_with=function(f){var d=this._create();return d._starting_pattern=this._input.get_regexp(f,!0),d._update(),d},p.prototype.matching=function(f){var d=this._create();return d._match_pattern=this._input.get_regexp(f,!0),d._update(),d},p.prototype._create=function(){return new p(this._input,this)},p.prototype._update=function(){},g.exports.Pattern=p},function(g){function p(f,d){f=typeof f=="string"?f:f.source,d=typeof d=="string"?d:d.source,this.__directives_block_pattern=new RegExp(f+/ beautify( \w+[:]\w+)+ /.source+d,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(f+/\sbeautify\signore:end\s/.source+d,"g")}p.prototype.get_directives=function(f){if(!f.match(this.__directives_block_pattern))return null;var d={};this.__directive_pattern.lastIndex=0;for(var s=this.__directive_pattern.exec(f);s;)d[s[1]]=s[2],s=this.__directive_pattern.exec(f);return d},p.prototype.readIgnored=function(f){return f.readUntilAfter(this.__directives_end_ignore_pattern)},g.exports.Directives=p},function(g,p,f){var d=f(12).Pattern,s={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function c(l,n){d.call(this,l,n),this.__template_pattern=null,this._disabled=Object.assign({},s),this._excluded=Object.assign({},s),n&&(this.__template_pattern=this._input.get_regexp(n.__template_pattern),this._excluded=Object.assign(this._excluded,n._excluded),this._disabled=Object.assign(this._disabled,n._disabled));var o=new d(l);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}/)}}c.prototype=new d,c.prototype._create=function(){return new c(this._input,this)},c.prototype._update=function(){this.__set_templated_pattern()},c.prototype.disable=function(l){var n=this._create();return n._disabled[l]=!0,n._update(),n},c.prototype.read_options=function(l){var n=this._create();for(var o in s)n._disabled[o]=l.templating.indexOf(o)===-1;return n._update(),n},c.prototype.exclude=function(l){var n=this._create();return n._excluded[l]=!0,n._update(),n},c.prototype.read=function(){var l="";this._match_pattern?l=this._input.read(this._starting_pattern):l=this._input.read(this._starting_pattern,this.__template_pattern);for(var n=this._read_template();n;)this._match_pattern?n+=this._input.read(this._match_pattern):n+=this._input.readUntil(this.__template_pattern),l+=n,n=this._read_template();return this._until_after&&(l+=this._input.readUntilAfter(this._until_pattern)),l},c.prototype.__set_templated_pattern=function(){var l=[];this._disabled.php||l.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||l.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||l.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(l.push(this.__patterns.django._starting_pattern.source),l.push(this.__patterns.django_value._starting_pattern.source),l.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||l.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&l.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+l.join("|")+")")},c.prototype._read_template=function(){var l="",n=this._input.peek();if(n==="<"){var o=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&o==="?"&&(l=l||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&o==="%"&&(l=l||this.__patterns.erb.read())}else n==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(l=l||this.__patterns.handlebars_comment.read(),l=l||this.__patterns.handlebars_unescaped.read(),l=l||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(l=l||this.__patterns.django_value.read()),this._excluded.django||(l=l||this.__patterns.django_comment.read(),l=l||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(l=l||this.__patterns.smarty_comment.read(),l=l||this.__patterns.smarty_literal.read(),l=l||this.__patterns.smarty.read()));return l},g.exports.TemplatablePattern=c},,,,function(g,p,f){var d=f(19).Beautifier,s=f(20).Options;function c(l,n,o,h){var L=new d(l,n,o,h);return L.beautify()}g.exports=c,g.exports.defaultOptions=function(){return new s}},function(g,p,f){var d=f(20).Options,s=f(2).Output,c=f(21).Tokenizer,l=f(21).TOKEN,n=/\r\n|[\r\n]/,o=/\r\n|[\r\n]/g,h=function(E,m){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=E.max_preserve_newlines,this.preserve_newlines=E.preserve_newlines,this._output=new s(E,m)};h.prototype.current_line_has_match=function(E){return this._output.current_line.has_match(E)},h.prototype.set_space_before_token=function(E,m){this._output.space_before_token=E,this._output.non_breaking_space=m},h.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},h.prototype.add_raw_token=function(E){this._output.add_raw_token(E)},h.prototype.print_preserved_newlines=function(E){var m=0;E.type!==l.TEXT&&E.previous.type!==l.TEXT&&(m=E.newlines?1:0),this.preserve_newlines&&(m=E.newlines<this.max_preserve_newlines+1?E.newlines:this.max_preserve_newlines+1);for(var b=0;b<m;b++)this.print_newline(b>0);return m!==0},h.prototype.traverse_whitespace=function(E){return E.whitespace_before||E.newlines?(this.print_preserved_newlines(E)||(this._output.space_before_token=!0),!0):!1},h.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},h.prototype.print_newline=function(E){this._output.add_new_line(E)},h.prototype.print_token=function(E){E.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(E.text))},h.prototype.indent=function(){this.indent_level++},h.prototype.get_full_indent=function(E){return E=this.indent_level+(E||0),E<1?"":this._output.get_indent_string(E)};var L=function(E){for(var m=null,b=E.next;b.type!==l.EOF&&E.closed!==b;){if(b.type===l.ATTRIBUTE&&b.text==="type"){b.next&&b.next.type===l.EQUALS&&b.next.next&&b.next.next.type===l.VALUE&&(m=b.next.next.text);break}b=b.next}return m},S=function(E,m){var b=null,N=null;return m.closed?(E==="script"?b="text/javascript":E==="style"&&(b="text/css"),b=L(m)||b,b.search("text/css")>-1?N="css":b.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?N="javascript":b.search(/(text|application|dojo)\/(x-)?(html)/)>-1?N="html":b.search(/test\/null/)>-1&&(N="null"),N):null};function x(E,m){return m.indexOf(E)!==-1}function O(E,m,b){this.parent=E||null,this.tag=m?m.tag_name:"",this.indent_level=b||0,this.parser_token=m||null}function C(E){this._printer=E,this._current_frame=null}C.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},C.prototype.record_tag=function(E){var m=new O(this._current_frame,E,this._printer.indent_level);this._current_frame=m},C.prototype._try_pop_frame=function(E){var m=null;return E&&(m=E.parser_token,this._printer.indent_level=E.indent_level,this._current_frame=E.parent),m},C.prototype._get_frame=function(E,m){for(var b=this._current_frame;b&&!(E.indexOf(b.tag)!==-1);){if(m&&m.indexOf(b.tag)!==-1){b=null;break}b=b.parent}return b},C.prototype.try_pop=function(E,m){var b=this._get_frame([E],m);return this._try_pop_frame(b)},C.prototype.indent_to_tag=function(E){var m=this._get_frame(E);m&&(this._printer.indent_level=m.indent_level)};function w(E,m,b,N){this._source_text=E||"",m=m||{},this._js_beautify=b,this._css_beautify=N,this._tag_stack=null;var D=new d(m,"html");this._options=D,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"}w.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var E=this._source_text,m=this._options.eol;this._options.eol==="auto"&&(m=`
|
|
`,E&&n.test(E)&&(m=E.match(n)[0])),E=E.replace(o,`
|
|
`);var b=E.match(/^[\t ]*/)[0],N={text:"",type:""},D=new T,H=new h(this._options,b),j=new c(E,this._options).tokenize();this._tag_stack=new C(H);for(var I=null,y=j.next();y.type!==l.EOF;)y.type===l.TAG_OPEN||y.type===l.COMMENT?(I=this._handle_tag_open(H,y,D,N),D=I):y.type===l.ATTRIBUTE||y.type===l.EQUALS||y.type===l.VALUE||y.type===l.TEXT&&!D.tag_complete?I=this._handle_inside_tag(H,y,D,j):y.type===l.TAG_CLOSE?I=this._handle_tag_close(H,y,D):y.type===l.TEXT?I=this._handle_text(H,y,D):H.add_raw_token(y),N=I,y=j.next();var W=H._output.get_code(m);return W},w.prototype._handle_tag_close=function(E,m,b){var N={text:m.text,type:m.type};return E.alignment_size=0,b.tag_complete=!0,E.set_space_before_token(m.newlines||m.whitespace_before!=="",!0),b.is_unformatted?E.add_raw_token(m):(b.tag_start_char==="<"&&(E.set_space_before_token(m.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&b.has_wrapped_attrs&&E.print_newline(!1)),E.print_token(m)),b.indent_content&&!(b.is_unformatted||b.is_content_unformatted)&&(E.indent(),b.indent_content=!1),!b.is_inline_element&&!(b.is_unformatted||b.is_content_unformatted)&&E.set_wrap_point(),N},w.prototype._handle_inside_tag=function(E,m,b,N){var D=b.has_wrapped_attrs,H={text:m.text,type:m.type};if(E.set_space_before_token(m.newlines||m.whitespace_before!=="",!0),b.is_unformatted)E.add_raw_token(m);else if(b.tag_start_char==="{"&&m.type===l.TEXT)E.print_preserved_newlines(m)?(m.newlines=0,E.add_raw_token(m)):E.print_token(m);else{if(m.type===l.ATTRIBUTE?(E.set_space_before_token(!0),b.attr_count+=1):(m.type===l.EQUALS||m.type===l.VALUE&&m.previous.type===l.EQUALS)&&E.set_space_before_token(!1),m.type===l.ATTRIBUTE&&b.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(E.traverse_whitespace(m),D=D||m.newlines!==0),this._is_wrap_attributes_force)){var j=b.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&b.attr_count===1){var I=!0,y=0,W;do{if(W=N.peek(y),W.type===l.ATTRIBUTE){I=!1;break}y+=1}while(y<4&&W.type!==l.EOF&&W.type!==l.TAG_CLOSE);j=!I}j&&(E.print_newline(!1),D=!0)}E.print_token(m),D=D||E.previous_token_wrapped(),b.has_wrapped_attrs=D}return H},w.prototype._handle_text=function(E,m,b){var N={text:m.text,type:"TK_CONTENT"};return b.custom_beautifier_name?this._print_custom_beatifier_text(E,m,b):b.is_unformatted||b.is_content_unformatted?E.add_raw_token(m):(E.traverse_whitespace(m),E.print_token(m)),N},w.prototype._print_custom_beatifier_text=function(E,m,b){var N=this;if(m.text!==""){var D=m.text,H,j=1,I="",y="";b.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?H=this._js_beautify:b.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?H=this._css_beautify:b.custom_beautifier_name==="html"&&(H=function(me,Se){var Ce=new w(me,Se,N._js_beautify,N._css_beautify);return Ce.beautify()}),this._options.indent_scripts==="keep"?j=0:this._options.indent_scripts==="separate"&&(j=-E.indent_level);var W=E.get_full_indent(j);if(D=D.replace(/\n[ \t]*$/,""),b.custom_beautifier_name!=="html"&&D[0]==="<"&&D.match(/^(<!--|<!\[CDATA\[)/)){var Y=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(D);if(!Y){E.add_raw_token(m);return}I=W+Y[1]+`
|
|
`,D=Y[4],Y[5]&&(y=W+Y[5]),D=D.replace(/\n[ \t]*$/,""),(Y[2]||Y[3].indexOf(`
|
|
`)!==-1)&&(Y=Y[3].match(/[ \t]+$/),Y&&(m.whitespace_before=Y[0]))}if(D)if(H){var ie=function(){this.eol=`
|
|
`};ie.prototype=this._options.raw_options;var oe=new ie;D=H(W+D,oe)}else{var we=m.whitespace_before;we&&(D=D.replace(new RegExp(`
|
|
(`+we+")?","g"),`
|
|
`)),D=W+D.replace(/\n/g,`
|
|
`+W)}I&&(D?D=I+D+`
|
|
`+y:D=I+y),E.print_newline(!1),D&&(m.text=D,m.whitespace_before="",m.newlines=0,E.add_raw_token(m),E.print_newline(!0))}},w.prototype._handle_tag_open=function(E,m,b,N){var D=this._get_tag_open_token(m);return(b.is_unformatted||b.is_content_unformatted)&&!b.is_empty_element&&m.type===l.TAG_OPEN&&m.text.indexOf("</")===0?(E.add_raw_token(m),D.start_tag_token=this._tag_stack.try_pop(D.tag_name)):(E.traverse_whitespace(m),this._set_tag_position(E,m,D,b,N),D.is_inline_element||E.set_wrap_point(),E.print_token(m)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(D.alignment_size=m.text.length+1),!D.tag_complete&&!D.is_unformatted&&(E.alignment_size=D.alignment_size),D};var T=function(E,m){if(this.parent=E||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="",!m)this.tag_complete=!0;else{var b;this.tag_start_char=m.text[0],this.text=m.text,this.tag_start_char==="<"?(b=m.text.match(/^<([^\s>]*)/),this.tag_check=b?b[1]:""):(b=m.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=b?b[1]:"",(m.text.startsWith("{{#>")||m.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&m.next!==null?this.tag_check=m.next.text.split(" ")[0]:this.tag_check=m.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),m.type===l.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||m.closed&&m.closed.text==="/>";var N=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(N=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(N)))}};w.prototype._get_tag_open_token=function(E){var m=new T(this._tag_stack.get_parser_token(),E);return m.alignment_size=this._options.wrap_attributes_indent_size,m.is_end_tag=m.is_end_tag||x(m.tag_check,this._options.void_elements),m.is_empty_element=m.tag_complete||m.is_start_tag&&m.is_end_tag,m.is_unformatted=!m.tag_complete&&x(m.tag_check,this._options.unformatted),m.is_content_unformatted=!m.is_empty_element&&x(m.tag_check,this._options.content_unformatted),m.is_inline_element=x(m.tag_name,this._options.inline)||m.tag_name.includes("-")||m.tag_start_char==="{",m},w.prototype._set_tag_position=function(E,m,b,N,D){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||E.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=S(b.tag_check,m)))),x(b.tag_check,this._options.extra_liners)&&(E.print_newline(!1),E._output.just_added_blankline()||E.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 H=E.current_line_has_match(/{{#if/);H||E.print_newline(!1)}b.tag_name==="!--"&&D.type===l.TAG_CLOSE&&N.is_end_tag&&b.text.indexOf(`
|
|
`)===-1||(b.is_inline_element||b.is_unformatted||E.print_newline(!1),this._calcluate_parent_multiline(E,b))}else if(b.is_end_tag){var j=!1;j=b.start_tag_token&&b.start_tag_token.multiline_content,j=j||!b.is_inline_element&&!(N.is_inline_element||N.is_unformatted)&&!(D.type===l.TAG_CLOSE&&b.start_tag_token===N)&&D.type!=="TK_CONTENT",(b.is_content_unformatted||b.is_unformatted)&&(j=!1),j&&E.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)&&(D.type!=="TK_CONTENT"||b.is_content_unformatted)&&E.print_newline(!1),this._calcluate_parent_multiline(E,b)},w.prototype._calcluate_parent_multiline=function(E,m){m.parent&&E._output.just_added_newline()&&!((m.is_inline_element||m.is_unformatted)&&m.parent.is_inline_element)&&(m.parent.multiline_content=!0)};var _=["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"],u=["a","audio","del","ins","map","noscript","video"];w.prototype._do_optional_end_element=function(E){var m=null;if(E.is_empty_element||!E.is_start_tag||!E.parent)return;if(E.tag_name==="body")m=m||this._tag_stack.try_pop("head");else if(E.tag_name==="li")m=m||this._tag_stack.try_pop("li",["ol","ul"]);else if(E.tag_name==="dd"||E.tag_name==="dt")m=m||this._tag_stack.try_pop("dt",["dl"]),m=m||this._tag_stack.try_pop("dd",["dl"]);else if(E.parent.tag_name==="p"&&_.indexOf(E.tag_name)!==-1){var b=E.parent.parent;(!b||u.indexOf(b.tag_name)===-1)&&(m=m||this._tag_stack.try_pop("p"))}else E.tag_name==="rp"||E.tag_name==="rt"?(m=m||this._tag_stack.try_pop("rt",["ruby","rtc"]),m=m||this._tag_stack.try_pop("rp",["ruby","rtc"])):E.tag_name==="optgroup"?m=m||this._tag_stack.try_pop("optgroup",["select"]):E.tag_name==="option"?m=m||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):E.tag_name==="colgroup"?m=m||this._tag_stack.try_pop("caption",["table"]):E.tag_name==="thead"?(m=m||this._tag_stack.try_pop("caption",["table"]),m=m||this._tag_stack.try_pop("colgroup",["table"])):E.tag_name==="tbody"||E.tag_name==="tfoot"?(m=m||this._tag_stack.try_pop("caption",["table"]),m=m||this._tag_stack.try_pop("colgroup",["table"]),m=m||this._tag_stack.try_pop("thead",["table"]),m=m||this._tag_stack.try_pop("tbody",["table"])):E.tag_name==="tr"?(m=m||this._tag_stack.try_pop("caption",["table"]),m=m||this._tag_stack.try_pop("colgroup",["table"]),m=m||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(E.tag_name==="th"||E.tag_name==="td")&&(m=m||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),m=m||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return E.parent=this._tag_stack.get_parser_token(),m},g.exports.Beautifier=w},function(g,p,f){var d=f(6).Options;function s(c){d.call(this,c,"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"])}s.prototype=new d,g.exports.Options=s},function(g,p,f){var d=f(9).Tokenizer,s=f(9).TOKEN,c=f(13).Directives,l=f(14).TemplatablePattern,n=f(12).Pattern,o={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:s.START,RAW:s.RAW,EOF:s.EOF},h=new c(/<\!--/,/-->/),L=function(S,x){d.call(this,S,x),this._current_tag_name="";var O=new l(this._input).read_options(this._options),C=new n(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:C.starting_with(/{{!--/).until_after(/--}}/),handlebars:C.starting_with(/{{/).until_after(/}}/),handlebars_open:C.until(/[\n\r\t }]/),handlebars_raw_close:C.until(/}}/),comment:C.starting_with(/<!--/).until_after(/-->/),cdata:C.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:C.starting_with(/<!\[/).until_after(/]>/),processing:C.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 w=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=C.matching(w).until_after(w)}};L.prototype=new d,L.prototype._is_comment=function(S){return!1},L.prototype._is_opening=function(S){return S.type===o.TAG_OPEN},L.prototype._is_closing=function(S,x){return S.type===o.TAG_CLOSE&&x&&((S.text===">"||S.text==="/>")&&x.text[0]==="<"||S.text==="}}"&&x.text[0]==="{"&&x.text[1]==="{")},L.prototype._reset=function(){this._current_tag_name=""},L.prototype._get_next_token=function(S,x){var O=null;this._readWhitespace();var C=this._input.peek();return C===null?this._create_token(o.EOF,""):(O=O||this._read_open_handlebars(C,x),O=O||this._read_attribute(C,S,x),O=O||this._read_close(C,x),O=O||this._read_raw_content(C,S,x),O=O||this._read_content_word(C),O=O||this._read_comment_or_cdata(C),O=O||this._read_processing(C),O=O||this._read_open(C,x),O=O||this._create_token(o.UNKNOWN,this._input.next()),O)},L.prototype._read_comment_or_cdata=function(S){var x=null,O=null,C=null;if(S==="<"){var w=this._input.peek(1);w==="!"&&(O=this.__patterns.comment.read(),O?(C=h.get_directives(O),C&&C.ignore==="start"&&(O+=h.readIgnored(this._input))):O=this.__patterns.cdata.read()),O&&(x=this._create_token(o.COMMENT,O),x.directives=C)}return x},L.prototype._read_processing=function(S){var x=null,O=null,C=null;if(S==="<"){var w=this._input.peek(1);(w==="!"||w==="?")&&(O=this.__patterns.conditional_comment.read(),O=O||this.__patterns.processing.read()),O&&(x=this._create_token(o.COMMENT,O),x.directives=C)}return x},L.prototype._read_open=function(S,x){var O=null,C=null;return x||S==="<"&&(O=this._input.next(),this._input.peek()==="/"&&(O+=this._input.next()),O+=this.__patterns.element_name.read(),C=this._create_token(o.TAG_OPEN,O)),C},L.prototype._read_open_handlebars=function(S,x){var O=null,C=null;return x||this._options.indent_handlebars&&S==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(O=this.__patterns.handlebars_comment.read(),O=O||this.__patterns.handlebars.read(),C=this._create_token(o.COMMENT,O)):(O=this.__patterns.handlebars_open.read(),C=this._create_token(o.TAG_OPEN,O))),C},L.prototype._read_close=function(S,x){var O=null,C=null;return x&&(x.text[0]==="<"&&(S===">"||S==="/"&&this._input.peek(1)===">")?(O=this._input.next(),S==="/"&&(O+=this._input.next()),C=this._create_token(o.TAG_CLOSE,O)):x.text[0]==="{"&&S==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),C=this._create_token(o.TAG_CLOSE,"}}"))),C},L.prototype._read_attribute=function(S,x,O){var C=null,w="";if(O&&O.text[0]==="<")if(S==="=")C=this._create_token(o.EQUALS,this._input.next());else if(S==='"'||S==="'"){var T=this._input.next();S==='"'?T+=this.__patterns.double_quote.read():T+=this.__patterns.single_quote.read(),C=this._create_token(o.VALUE,T)}else w=this.__patterns.attribute.read(),w&&(x.type===o.EQUALS?C=this._create_token(o.VALUE,w):C=this._create_token(o.ATTRIBUTE,w));return C},L.prototype._is_content_unformatted=function(S){return this._options.void_elements.indexOf(S)===-1&&(this._options.content_unformatted.indexOf(S)!==-1||this._options.unformatted.indexOf(S)!==-1)},L.prototype._read_raw_content=function(S,x,O){var C="";if(O&&O.text[0]==="{")C=this.__patterns.handlebars_raw_close.read();else if(x.type===o.TAG_CLOSE&&x.opened.text[0]==="<"&&x.text[0]!=="/"){var w=x.opened.text.substr(1).toLowerCase();if(w==="script"||w==="style"){var T=this._read_comment_or_cdata(S);if(T)return T.type=o.TEXT,T;C=this._input.readUntil(new RegExp("</"+w+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(w)&&(C=this._input.readUntil(new RegExp("</"+w+"[\\n\\r\\t ]*?>","ig")))}return C?this._create_token(o.TEXT,C):null},L.prototype._read_content_word=function(S){var x="";if(this._options.unformatted_content_delimiter&&(S===this._options.unformatted_content_delimiter[0]&&(x=this.__patterns.unformatted_content_delimiter.read())),x||(x=this.__patterns.word.read()),x)return this._create_token(o.TEXT,x)},g.exports.Tokenizer=L,g.exports.TOKEN=o}],G={};function M(g){var p=G[g];if(p!==void 0)return p.exports;var f=G[g]={exports:{}};return K[g](f,f.exports,M),f.exports}var R=M(18);P=R})();var Q=P;if(!0)!(ue=[ne,ne("6UM0"),ne("TXwP")],Z=function(K){var G=ne("6UM0"),M=ne("TXwP");return{html_beautify:function(R,g){return Q(R,g,G.js_beautify,M.css_beautify)}}}.apply(Ye,ue),Z!==void 0&&(gt.exports=Z));else var B,F})()},"rAM+":function(gt,Ye,ne){"use strict";ne.d(Ye,"a",function(){return Z});var ue=ne("Qw5x");function Z(P,Q){var B;if(typeof Symbol=="undefined"||P[Symbol.iterator]==null){if(Array.isArray(P)||(B=Object(ue.a)(P))||Q&&P&&typeof P.length=="number"){B&&(P=B);var F=0,K=function(){};return{s:K,n:function(){return F>=P.length?{done:!0}:{done:!1,value:P[F++]}},e:function(p){throw p},f:K}}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 G=!0,M=!1,R;return{s:function(){B=P[Symbol.iterator]()},n:function(){var p=B.next();return G=p.done,p},e:function(p){M=!0,R=p},f:function(){try{!G&&B.return!=null&&B.return()}finally{if(M)throw R}}}}},rUJ1:function(gt,Ye){const ne=/[&<>"']/,ue=/[&<>"']/g,Z=/[<>"']|&(?!#?\w+;)/,P=/[<>"']|&(?!#?\w+;)/g,Q={"&":"&","<":"<",">":">",'"':""","'":"'"},B=C=>Q[C];function F(C,w){if(w){if(ne.test(C))return C.replace(ue,B)}else if(Z.test(C))return C.replace(P,B);return C}const K=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function G(C){return C.replace(K,(w,T)=>(T=T.toLowerCase(),T==="colon"?":":T.charAt(0)==="#"?T.charAt(1)==="x"?String.fromCharCode(parseInt(T.substring(2),16)):String.fromCharCode(+T.substring(1)):""))}const M=/(^|[^\[])\^/g;function R(C,w){C=C.source||C,w=w||"";const T={replace:(_,u)=>(u=u.source||u,u=u.replace(M,"$1"),C=C.replace(_,u),T),getRegex:()=>new RegExp(C,w)};return T}const g=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function f(C,w,T){if(C){let _;try{_=decodeURIComponent(G(T)).replace(g,"").toLowerCase()}catch(u){return null}if(_.indexOf("javascript:")===0||_.indexOf("vbscript:")===0||_.indexOf("data:")===0)return null}w&&!p.test(T)&&(T=n(w,T));try{T=encodeURI(T).replace(/%25/g,"%")}catch(_){return null}return T}const d={},s=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function n(C,w){d[" "+C]||(s.test(C)?d[" "+C]=C+"/":d[" "+C]=S(C,"/",!0)),C=d[" "+C];const T=C.indexOf(":")===-1;return w.substring(0,2)==="//"?T?w:C.replace(c,"$1")+w:w.charAt(0)==="/"?T?w:C.replace(l,"$1")+w:C+w}const o={exec:function(){}};function h(C){let w=1,T,_;for(;w<arguments.length;w++){T=arguments[w];for(_ in T)Object.prototype.hasOwnProperty.call(T,_)&&(C[_]=T[_])}return C}function L(C,w){const T=C.replace(/\|/g,(E,m,b)=>{let N=!1,D=m;for(;--D>=0&&b[D]==="\\";)N=!N;return N?"|":" |"}),_=T.split(/ \|/);let u=0;if(_.length>w)_.splice(w);else for(;_.length<w;)_.push("");for(;u<_.length;u++)_[u]=_[u].trim().replace(/\\\|/g,"|");return _}function S(C,w,T){const _=C.length;if(_===0)return"";let u=0;for(;u<_;){const E=C.charAt(_-u-1);if(E===w&&!T)u++;else if(E!==w&&T)u++;else break}return C.substr(0,_-u)}function x(C,w){if(C.indexOf(w[1])===-1)return-1;const T=C.length;let _=0,u=0;for(;u<T;u++)if(C[u]==="\\")u++;else if(C[u]===w[0])_++;else if(C[u]===w[1]&&(_--,_<0))return u;return-1}function O(C){C&&C.sanitize&&!C.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")}gt.exports={escape:F,unescape:G,edit:R,cleanUrl:f,resolveUrl:n,noopTest:o,merge:h,splitCells:L,rtrim:S,findClosingBracket:x,checkSanitizeDeprecation:O}},ulZh:function(gt,Ye,ne){typeof window!="undefined"&&function(Z,P){gt.exports=P()}(this,function(){return function(ue){var Z={};function P(Q){if(Z[Q])return Z[Q].exports;var B=Z[Q]={i:Q,l:!1,exports:{}};return ue[Q].call(B.exports,B,B.exports,P),B.l=!0,B.exports}return P.m=ue,P.c=Z,P.d=function(Q,B,F){P.o(Q,B)||Object.defineProperty(Q,B,{enumerable:!0,get:F})},P.r=function(Q){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Q,"__esModule",{value:!0})},P.t=function(Q,B){if(B&1&&(Q=P(Q)),B&8)return Q;if(B&4&&typeof Q=="object"&&Q&&Q.__esModule)return Q;var F=Object.create(null);if(P.r(F),Object.defineProperty(F,"default",{enumerable:!0,value:Q}),B&2&&typeof Q!="string")for(var K in Q)P.d(F,K,function(G){return Q[G]}.bind(null,K));return F},P.n=function(Q){var B=Q&&Q.__esModule?function(){return Q.default}:function(){return Q};return P.d(B,"a",B),B},P.o=function(Q,B){return Object.prototype.hasOwnProperty.call(Q,B)},P.p="/dist/",P(P.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ue,Z,P){"use strict";var Q=Object.prototype.hasOwnProperty,B="~";function F(){}Object.create&&(F.prototype=Object.create(null),new F().__proto__||(B=!1));function K(g,p,f){this.fn=g,this.context=p,this.once=f||!1}function G(g,p,f,d,s){if(typeof f!="function")throw new TypeError("The listener must be a function");var c=new K(f,d||g,s),l=B?B+p:p;return g._events[l]?g._events[l].fn?g._events[l]=[g._events[l],c]:g._events[l].push(c):(g._events[l]=c,g._eventsCount++),g}function M(g,p){--g._eventsCount===0?g._events=new F:delete g._events[p]}function R(){this._events=new F,this._eventsCount=0}R.prototype.eventNames=function(){var p=[],f,d;if(this._eventsCount===0)return p;for(d in f=this._events)Q.call(f,d)&&p.push(B?d.slice(1):d);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(f)):p},R.prototype.listeners=function(p){var f=B?B+p:p,d=this._events[f];if(!d)return[];if(d.fn)return[d.fn];for(var s=0,c=d.length,l=new Array(c);s<c;s++)l[s]=d[s].fn;return l},R.prototype.listenerCount=function(p){var f=B?B+p:p,d=this._events[f];return d?d.fn?1:d.length:0},R.prototype.emit=function(p,f,d,s,c,l){var n=B?B+p:p;if(!this._events[n])return!1;var o=this._events[n],h=arguments.length,L,S;if(o.fn){o.once&&this.removeListener(p,o.fn,void 0,!0);switch(h){case 1:return o.fn.call(o.context),!0;case 2:return o.fn.call(o.context,f),!0;case 3:return o.fn.call(o.context,f,d),!0;case 4:return o.fn.call(o.context,f,d,s),!0;case 5:return o.fn.call(o.context,f,d,s,c),!0;case 6:return o.fn.call(o.context,f,d,s,c,l),!0}for(S=1,L=new Array(h-1);S<h;S++)L[S-1]=arguments[S];o.fn.apply(o.context,L)}else{var x=o.length,O;for(S=0;S<x;S++){o[S].once&&this.removeListener(p,o[S].fn,void 0,!0);switch(h){case 1:o[S].fn.call(o[S].context);break;case 2:o[S].fn.call(o[S].context,f);break;case 3:o[S].fn.call(o[S].context,f,d);break;case 4:o[S].fn.call(o[S].context,f,d,s);break;default:if(!L)for(O=1,L=new Array(h-1);O<h;O++)L[O-1]=arguments[O];o[S].fn.apply(o[S].context,L)}}}return!0},R.prototype.on=function(p,f,d){return G(this,p,f,d,!1)},R.prototype.once=function(p,f,d){return G(this,p,f,d,!0)},R.prototype.removeListener=function(p,f,d,s){var c=B?B+p:p;if(!this._events[c])return this;if(!f)return M(this,c),this;var l=this._events[c];if(l.fn)l.fn===f&&(!s||l.once)&&(!d||l.context===d)&&M(this,c);else{for(var n=0,o=[],h=l.length;n<h;n++)(l[n].fn!==f||s&&!l[n].once||d&&l[n].context!==d)&&o.push(l[n]);o.length?this._events[c]=o.length===1?o[0]:o:M(this,c)}return this},R.prototype.removeAllListeners=function(p){var f;return p?(f=B?B+p:p,this._events[f]&&M(this,f)):(this._events=new F,this._eventsCount=0),this},R.prototype.off=R.prototype.removeListener,R.prototype.addListener=R.prototype.on,R.prefixed=B,R.EventEmitter=R,ue.exports=R},"./node_modules/url-toolkit/src/url-toolkit.js":function(ue,Z,P){(function(Q){var B=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,F=/^([^\/?#]*)([^]*)$/,K=/(?:\/|^)\.(?=\/)/g,G=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,M={buildAbsoluteURL:function(R,g,p){if(p=p||{},R=R.trim(),g=g.trim(),!g){if(!p.alwaysNormalize)return R;var f=M.parseURL(R);if(!f)throw new Error("Error trying to parse base URL.");return f.path=M.normalizePath(f.path),M.buildURLFromParts(f)}var d=M.parseURL(g);if(!d)throw new Error("Error trying to parse relative URL.");if(d.scheme)return p.alwaysNormalize?(d.path=M.normalizePath(d.path),M.buildURLFromParts(d)):g;var s=M.parseURL(R);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&s.path[0]!=="/"){var c=F.exec(s.path);s.netLoc=c[1],s.path=c[2]}s.netLoc&&!s.path&&(s.path="/");var l={scheme:s.scheme,netLoc:d.netLoc,path:null,params:d.params,query:d.query,fragment:d.fragment};if(!d.netLoc&&(l.netLoc=s.netLoc,d.path[0]!=="/"))if(!d.path)l.path=s.path,d.params||(l.params=s.params,d.query||(l.query=s.query));else{var n=s.path,o=n.substring(0,n.lastIndexOf("/")+1)+d.path;l.path=M.normalizePath(o)}return l.path===null&&(l.path=p.alwaysNormalize?M.normalizePath(d.path):d.path),M.buildURLFromParts(l)},parseURL:function(R){var g=B.exec(R);return g?{scheme:g[1]||"",netLoc:g[2]||"",path:g[3]||"",params:g[4]||"",query:g[5]||"",fragment:g[6]||""}:null},normalizePath:function(R){for(R=R.split("").reverse().join("").replace(K,"");R.length!==(R=R.replace(G,"")).length;);return R.split("").reverse().join("")},buildURLFromParts:function(R){return R.scheme+R.netLoc+R.path+R.params+R.query+R.fragment}};ue.exports=M})(this)},"./node_modules/webworkify-webpack/index.js":function(ue,Z,P){function Q(p){var f={};function d(c){if(f[c])return f[c].exports;var l=f[c]={i:c,l:!1,exports:{}};return p[c].call(l.exports,l,l.exports,d),l.l=!0,l.exports}d.m=p,d.c=f,d.i=function(c){return c},d.d=function(c,l,n){d.o(c,l)||Object.defineProperty(c,l,{configurable:!1,enumerable:!0,get:n})},d.r=function(c){Object.defineProperty(c,"__esModule",{value:!0})},d.n=function(c){var l=c&&c.__esModule?function(){return c.default}:function(){return c};return d.d(l,"a",l),l},d.o=function(c,l){return Object.prototype.hasOwnProperty.call(c,l)},d.p="/",d.oe=function(c){throw console.error(c),c};var s=d(d.s=ENTRY_MODULE);return s.default||s}var B="[\\.|\\-|\\+|\\w|/|@]+",F="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+B+").*?\\)";function K(p){return(p+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function G(p){return!isNaN(1*p)}function M(p,f,d){var s={};s[d]=[];var c=f.toString(),l=c.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!l)return s;for(var n=l[1],o=new RegExp("(\\\\n|\\W)"+K(n)+F,"g"),h;h=o.exec(c);){if(h[3]==="dll-reference")continue;s[d].push(h[3])}for(o=new RegExp("\\("+K(n)+'\\("(dll-reference\\s('+B+'))"\\)\\)'+F,"g");h=o.exec(c);)p[h[2]]||(s[d].push(h[1]),p[h[2]]=P(h[1]).m),s[h[2]]=s[h[2]]||[],s[h[2]].push(h[4]);for(var L=Object.keys(s),S=0;S<L.length;S++)for(var x=0;x<s[L[S]].length;x++)G(s[L[S]][x])&&(s[L[S]][x]=1*s[L[S]][x]);return s}function R(p){var f=Object.keys(p);return f.reduce(function(d,s){return d||p[s].length>0},!1)}function g(p,f){for(var d={main:[f]},s={main:[]},c={main:{}};R(d);)for(var l=Object.keys(d),n=0;n<l.length;n++){var o=l[n],h=d[o],L=h.pop();if(c[o]=c[o]||{},c[o][L]||!p[o][L])continue;c[o][L]=!0,s[o]=s[o]||[],s[o].push(L);for(var S=M(p,p[o][L],o),x=Object.keys(S),O=0;O<x.length;O++)d[x[O]]=d[x[O]]||[],d[x[O]]=d[x[O]].concat(S[x[O]])}return s}ue.exports=function(p,f){f=f||{};var d={main:P.m},s=f.all?{main:Object.keys(d.main)}:g(d,p),c="";Object.keys(s).filter(function(L){return L!=="main"}).forEach(function(L){for(var S=0;s[L][S];)S++;s[L].push(S),d[L][S]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",c=c+"var "+L+" = ("+Q.toString().replace("ENTRY_MODULE",JSON.stringify(S))+")({"+s[L].map(function(x){return""+JSON.stringify(x)+": "+d[L][x].toString()}).join(",")+`});
|
|
`}),c=c+"new (("+Q.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+s.main.map(function(L){return""+JSON.stringify(L)+": "+d.main[L].toString()}).join(",")+"}))(self);";var l=new window.Blob([c],{type:"text/javascript"});if(f.bare)return l;var n=window.URL||window.webkitURL||window.mozURL||window.msURL,o=n.createObjectURL(l),h=new window.Worker(o);return h.objectURL=o,h}},"./src/config.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"hlsDefaultConfig",function(){return O}),P.d(Z,"mergeConfig",function(){return w}),P.d(Z,"enableStreamingMode",function(){return T});var Q=P("./src/controller/abr-controller.ts"),B=P("./src/controller/audio-stream-controller.ts"),F=P("./src/controller/audio-track-controller.ts"),K=P("./src/controller/subtitle-stream-controller.ts"),G=P("./src/controller/subtitle-track-controller.ts"),M=P("./src/controller/buffer-controller.ts"),R=P("./src/controller/timeline-controller.ts"),g=P("./src/controller/cap-level-controller.ts"),p=P("./src/controller/fps-controller.ts"),f=P("./src/controller/eme-controller.ts"),d=P("./src/controller/cmcd-controller.ts"),s=P("./src/utils/xhr-loader.ts"),c=P("./src/utils/fetch-loader.ts"),l=P("./src/utils/cues.ts"),n=P("./src/utils/mediakeys-helper.ts"),o=P("./src/utils/logger.ts");function h(){return h=Object.assign||function(_){for(var u=1;u<arguments.length;u++){var E=arguments[u];for(var m in E)Object.prototype.hasOwnProperty.call(E,m)&&(_[m]=E[m])}return _},h.apply(this,arguments)}function L(_,u){var E=Object.keys(_);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(_);u&&(m=m.filter(function(b){return Object.getOwnPropertyDescriptor(_,b).enumerable})),E.push.apply(E,m)}return E}function S(_){for(var u=1;u<arguments.length;u++){var E=arguments[u]!=null?arguments[u]:{};u%2?L(Object(E),!0).forEach(function(m){x(_,m,E[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(_,Object.getOwnPropertyDescriptors(E)):L(Object(E)).forEach(function(m){Object.defineProperty(_,m,Object.getOwnPropertyDescriptor(E,m))})}return _}function x(_,u,E){return u in _?Object.defineProperty(_,u,{value:E,enumerable:!0,configurable:!0,writable:!0}):_[u]=E,_}var O=S(S({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:s.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Q.default,bufferController:M.default,capLevelController:g.default,fpsController:p.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:n.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},C()),{},{subtitleStreamController:K.SubtitleStreamController,subtitleTrackController:G.default,timelineController:R.TimelineController,audioStreamController:B.default,audioTrackController:F.default,emeController:f.default,cmcdController:d.default});function C(){return{cueHandler:l.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function w(_,u){if((u.liveSyncDurationCount||u.liveMaxLatencyDurationCount)&&(u.liveSyncDuration||u.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(u.liveMaxLatencyDurationCount!==void 0&&(u.liveSyncDurationCount===void 0||u.liveMaxLatencyDurationCount<=u.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(u.liveMaxLatencyDuration!==void 0&&(u.liveSyncDuration===void 0||u.liveMaxLatencyDuration<=u.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return h({},_,u)}function T(_){var u=_.loader;if(u!==c.default&&u!==s.default)o.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),_.progressive=!1;else{var E=Object(c.fetchSupported)();E&&(_.loader=c.default,_.progressive=!0,_.enableSoftwareAES=!0,o.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/polyfills/number.ts"),B=P("./src/utils/ewma-bandwidth-estimator.ts"),F=P("./src/events.ts"),K=P("./src/utils/buffer-helper.ts"),G=P("./src/errors.ts"),M=P("./src/types/loader.ts"),R=P("./src/utils/logger.ts");function g(d,s){for(var c=0;c<s.length;c++){var l=s[c];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(d,l.key,l)}}function p(d,s,c){return s&&g(d.prototype,s),c&&g(d,c),d}var f=function(){function d(c){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=c;var l=c.config;this.bwEstimator=new B.default(l.abrEwmaSlowVoD,l.abrEwmaFastVoD,l.abrEwmaDefaultEstimate),this.registerListeners()}var s=d.prototype;return s.registerListeners=function(){var l=this.hls;l.on(F.Events.FRAG_LOADING,this.onFragLoading,this),l.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(F.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(F.Events.ERROR,this.onError,this)},s.unregisterListeners=function(){var l=this.hls;l.off(F.Events.FRAG_LOADING,this.onFragLoading,this),l.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(F.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(F.Events.ERROR,this.onError,this)},s.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},s.onFragLoading=function(l,n){var o=n.frag;if(o.type===M.PlaylistLevelType.MAIN&&!this.timer){var h;this.fragCurrent=o,this.partCurrent=(h=n.part)!=null?h:null,this.timer=self.setInterval(this.onCheck,100)}},s.onLevelLoaded=function(l,n){var o=this.hls.config;n.details.live?this.bwEstimator.update(o.abrEwmaSlowLive,o.abrEwmaFastLive):this.bwEstimator.update(o.abrEwmaSlowVoD,o.abrEwmaFastVoD)},s._abandonRulesCheck=function(){var l=this.fragCurrent,n=this.partCurrent,o=this.hls,h=o.autoLevelEnabled,L=o.config,S=o.media;if(!l||!S)return;var x=n?n.stats:l.stats,O=n?n.duration:l.duration;if(x.aborted){R.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!h||S.paused||!S.playbackRate||!S.readyState)return;var C=performance.now()-x.loading.start,w=Math.abs(S.playbackRate);if(C<=500*O/w)return;var T=o.levels,_=o.minAutoLevel,u=T[l.level],E=x.total||Math.max(x.loaded,Math.round(O*u.maxBitrate/8)),m=Math.max(1,x.bwEstimate?x.bwEstimate/8:x.loaded*1e3/C),b=(E-x.loaded)/m,N=S.currentTime,D=(K.BufferHelper.bufferInfo(S,N,L.maxBufferHole).end-N)/w;if(D>=2*O/w||b<=D)return;var H=Number.POSITIVE_INFINITY,j;for(j=l.level-1;j>_;j--){var I=T[j].maxBitrate;if(H=O*I/(8*.8*m),H<D)break}if(H>=b)return;var y=this.bwEstimator.getEstimate();R.logger.warn("Fragment "+l.sn+(n?" part "+n.index:"")+" of level "+l.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+j+`
|
|
Current BW estimate: `+(Object(Q.isFiniteNumber)(y)?(y/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+b.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+H.toFixed(3)+` s
|
|
Time to underbuffer: `+D.toFixed(3)+" s"),o.nextLoadLevel=j,this.bwEstimator.sample(C,x.loaded),this.clearTimer(),l.loader&&(this.fragCurrent=this.partCurrent=null,l.loader.abort()),o.trigger(F.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:l,part:n,stats:x})},s.onFragLoaded=function(l,n){var o=n.frag,h=n.part;if(o.type===M.PlaylistLevelType.MAIN&&Object(Q.isFiniteNumber)(o.sn)){var L=h?h.stats:o.stats,S=h?h.duration:o.duration;if(this.clearTimer(),this.lastLoadedFragLevel=o.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var x=this.hls.levels[o.level],O=(x.loaded?x.loaded.bytes:0)+L.loaded,C=(x.loaded?x.loaded.duration:0)+S;x.loaded={bytes:O,duration:C},x.realBitrate=Math.round(8*O/C)}if(o.bitrateTest){var w={stats:L,frag:o,part:h,id:o.type};this.onFragBuffered(F.Events.FRAG_BUFFERED,w),o.bitrateTest=!1}}},s.onFragBuffered=function(l,n){var o=n.frag,h=n.part,L=h?h.stats:o.stats;if(L.aborted)return;if(o.type!==M.PlaylistLevelType.MAIN||o.sn==="initSegment")return;var S=L.parsing.end-L.loading.start;this.bwEstimator.sample(S,L.loaded),L.bwEstimate=this.bwEstimator.getEstimate(),o.bitrateTest?this.bitrateTestDelay=S/1e3:this.bitrateTestDelay=0},s.onError=function(l,n){switch(n.details){case G.ErrorDetails.FRAG_LOAD_ERROR:case G.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},s.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},s.getNextABRAutoLevel=function(){var l=this.fragCurrent,n=this.partCurrent,o=this.hls,h=o.maxAutoLevel,L=o.config,S=o.minAutoLevel,x=o.media,O=n?n.duration:l?l.duration:0,C=x?x.currentTime:0,w=x&&x.playbackRate!==0?Math.abs(x.playbackRate):1,T=this.bwEstimator?this.bwEstimator.getEstimate():L.abrEwmaDefaultEstimate,_=(K.BufferHelper.bufferInfo(x,C,L.maxBufferHole).end-C)/w,u=this.findBestLevel(T,S,h,_,L.abrBandWidthFactor,L.abrBandWidthUpFactor);if(u>=0)return u;R.logger.trace((_?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var E=O?Math.min(O,L.maxStarvationDelay):L.maxStarvationDelay,m=L.abrBandWidthFactor,b=L.abrBandWidthUpFactor;if(!_){var N=this.bitrateTestDelay;if(N){var D=O?Math.min(O,L.maxLoadingDelay):L.maxLoadingDelay;E=D-N,R.logger.trace("bitrate test took "+Math.round(1e3*N)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*E)+" ms"),m=b=1}}return u=this.findBestLevel(T,S,h,_+E,m,b),Math.max(u,0)},s.findBestLevel=function(l,n,o,h,L,S){for(var x,O=this.fragCurrent,C=this.partCurrent,w=this.lastLoadedFragLevel,T=this.hls.levels,_=T[w],u=!!(_!=null&&(x=_.details)!==null&&x!==void 0&&x.live),E=_==null?void 0:_.codecSet,m=C?C.duration:O?O.duration:0,b=o;b>=n;b--){var N=T[b];if(!N||E&&N.codecSet!==E)continue;var D=N.details,H=(C?D==null?void 0:D.partTarget:D==null?void 0:D.averagetargetduration)||m,j=void 0;b<=w?j=L*l:j=S*l;var I=T[b].maxBitrate,y=I*H/j;if(R.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+b+"/"+Math.round(j)+"/"+I+"/"+H+"/"+h+"/"+y),j>I&&(!y||u&&!this.bitrateTestDelay||y<h))return b}return-1},p(d,[{key:"nextAutoLevel",get:function(){var l=this._nextAutoLevel,n=this.bwEstimator;if(l!==-1&&(!n||!n.canEstimate()))return l;var o=this.getNextABRAutoLevel();return l!==-1&&(o=Math.min(l,o)),o},set:function(l){this._nextAutoLevel=l}}]),d}();Z.default=f},"./src/controller/audio-stream-controller.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/polyfills/number.ts"),B=P("./src/controller/base-stream-controller.ts"),F=P("./src/events.ts"),K=P("./src/utils/buffer-helper.ts"),G=P("./src/controller/fragment-tracker.ts"),M=P("./src/types/level.ts"),R=P("./src/types/loader.ts"),g=P("./src/loader/fragment.ts"),p=P("./src/demux/chunk-cache.ts"),f=P("./src/demux/transmuxer-interface.ts"),d=P("./src/types/transmuxer.ts"),s=P("./src/controller/fragment-finders.ts"),c=P("./src/utils/discontinuities.ts"),l=P("./src/errors.ts"),n=P("./src/utils/logger.ts");function o(){return o=Object.assign||function(O){for(var C=1;C<arguments.length;C++){var w=arguments[C];for(var T in w)Object.prototype.hasOwnProperty.call(w,T)&&(O[T]=w[T])}return O},o.apply(this,arguments)}function h(O,C){O.prototype=Object.create(C.prototype),O.prototype.constructor=O,L(O,C)}function L(O,C){return L=Object.setPrototypeOf||function(T,_){return T.__proto__=_,T},L(O,C)}var S=100,x=function(O){h(C,O);function C(T,_){var u;return u=O.call(this,T,_,"[audio-stream-controller]")||this,u.videoBuffer=null,u.videoTrackCC=-1,u.waitingVideoCC=-1,u.audioSwitch=!1,u.trackId=-1,u.waitingData=null,u.mainDetails=null,u.bufferFlushed=!1,u._registerListeners(),u}var w=C.prototype;return w.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},w._registerListeners=function(){var _=this.hls;_.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),_.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.on(F.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),_.on(F.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),_.on(F.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),_.on(F.Events.ERROR,this.onError,this),_.on(F.Events.BUFFER_RESET,this.onBufferReset,this),_.on(F.Events.BUFFER_CREATED,this.onBufferCreated,this),_.on(F.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),_.on(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),_.on(F.Events.FRAG_BUFFERED,this.onFragBuffered,this)},w._unregisterListeners=function(){var _=this.hls;_.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),_.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.off(F.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),_.off(F.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),_.off(F.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),_.off(F.Events.ERROR,this.onError,this),_.off(F.Events.BUFFER_RESET,this.onBufferReset,this),_.off(F.Events.BUFFER_CREATED,this.onBufferCreated,this),_.off(F.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),_.off(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),_.off(F.Events.FRAG_BUFFERED,this.onFragBuffered,this)},w.onInitPtsFound=function(_,u){var E=u.frag,m=u.id,b=u.initPTS;if(m==="main"){var N=E.cc;this.initPTS[E.cc]=b,this.log("InitPTS for cc: "+N+" found from main: "+b),this.videoTrackCC=N,this.state===B.State.WAITING_INIT_PTS&&this.tick()}},w.startLoad=function(_){if(!this.levels){this.startPosition=_,this.state=B.State.STOPPED;return}var u=this.lastCurrentTime;this.stopLoad(),this.setInterval(S),this.fragLoadError=0,u>0&&_===-1?(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),this.state=B.State.IDLE):(this.loadedmetadata=!1,this.state=B.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=_,this.tick()},w.doTick=function(){switch(this.state){case B.State.IDLE:this.doTickIdle();break;case B.State.WAITING_TRACK:{var _,u=this.levels,E=this.trackId,m=u==null||((_=u[E])===null||_===void 0)?void 0:_.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=B.State.WAITING_INIT_PTS}break}case B.State.FRAG_LOADING_WAITING_RETRY:{var b,N=performance.now(),D=this.retryDate;(!D||N>=D||(b=this.media)!==null&&b!==void 0&&b.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=B.State.IDLE);break}case B.State.WAITING_INIT_PTS:{var H=this.waitingData;if(H){var j=H.frag,I=H.part,y=H.cache,W=H.complete;if(this.initPTS[j.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=B.State.FRAG_LOADING;var Y=y.flush(),ie={frag:j,part:I,payload:Y,networkDetails:null};this._handleFragmentLoadProgress(ie),W&&O.prototype._handleFragmentLoadComplete.call(this,ie)}else if(this.videoTrackCC!==this.waitingVideoCC)n.logger.log("Waiting fragment cc ("+j.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var oe=this.getLoadPosition(),we=K.BufferHelper.bufferInfo(this.mediaBuffer,oe,this.config.maxBufferHole),me=Object(s.fragmentWithinToleranceTest)(we.end,this.config.maxFragLookUpTolerance,j);me<0&&(n.logger.log("Waiting fragment cc ("+j.cc+") @ "+j.start+" cancelled because another fragment at "+we.end+" is needed"),this.clearWaitingFragment())}}else this.state=B.State.IDLE}}this.onTickEnd()},w.clearWaitingFragment=function(){var _=this.waitingData;_&&(this.fragmentTracker.removeFragment(_.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=B.State.IDLE)},w.onTickEnd=function(){var _=this.media;if(!_||!_.readyState)return;var u=this.mediaBuffer?this.mediaBuffer:_,E=u.buffered;!this.loadedmetadata&&E.length&&(this.loadedmetadata=!0),this.lastCurrentTime=_.currentTime},w.doTickIdle=function(){var _,u,E=this.hls,m=this.levels,b=this.media,N=this.trackId,D=E.config;if(!m||!m[N])return;if(!b&&(this.startFragRequested||!D.startFragPrefetch))return;var H=m[N],j=H.details;if(!j||j.live&&this.levelLastLoaded!==N||this.waitForCdnTuneIn(j)){this.state=B.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,g.ElementaryStreamTypes.AUDIO,R.PlaylistLevelType.AUDIO));var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,R.PlaylistLevelType.AUDIO);if(I===null)return;var y=I.len,W=this.getMaxBufferLength(),Y=this.audioSwitch;if(y>=W&&!Y)return;if(!Y&&this._streamEnded(I,j)){E.trigger(F.Events.BUFFER_EOS,{type:"audio"}),this.state=B.State.ENDED;return}var ie=j.fragments,oe=ie[0].start,we=I.end;if(Y){var me=this.getLoadPosition();we=me,j.PTSKnown&&me<oe&&((I.end>oe||I.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),b.currentTime=oe+.05))}var Se=this.getNextFragment(we,j);if(!Se){this.bufferFlushed=!0;return}((_=Se.decryptdata)===null||_===void 0?void 0:_.keyFormat)==="identity"&&!((u=Se.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(Se,j):this.loadFragment(Se,j,we)},w.getMaxBufferLength=function(){var _=O.prototype.getMaxBufferLength.call(this),u=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,R.PlaylistLevelType.MAIN);return u===null?_:Math.max(_,u.len)},w.onMediaDetaching=function(){this.videoBuffer=null,O.prototype.onMediaDetaching.call(this)},w.onAudioTracksUpdated=function(_,u){var E=u.audioTracks;this.resetTransmuxer(),this.levels=E.map(function(m){return new M.Level(m)})},w.onAudioTrackSwitching=function(_,u){var E=!!u.url;this.trackId=u.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),E?this.setInterval(S):this.resetTransmuxer(),E?(this.audioSwitch=!0,this.state=B.State.IDLE):this.state=B.State.STOPPED,this.tick()},w.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},w.onLevelLoaded=function(_,u){this.mainDetails=u.details},w.onAudioTrackLoaded=function(_,u){var E,m=this.levels,b=u.details,N=u.id;if(!m){this.warn("Audio tracks were reset while loading level "+N);return}this.log("Track "+N+" loaded ["+b.startSN+","+b.endSN+"],duration:"+b.totalduration);var D=m[N],H=0;if(b.live||(E=D.details)!==null&&E!==void 0&&E.live){var j=this.mainDetails;if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed||!j)return;!D.details&&b.hasProgramDateTime&&j.hasProgramDateTime?(Object(c.alignMediaPlaylistByPDT)(b,j),H=b.fragments[0].start):H=this.alignPlaylists(b,D.details)}D.details=b,this.levelLastLoaded=N,!this.startFragRequested&&(this.mainDetails||!b.live)&&this.setStartPosition(D.details,H),this.state===B.State.WAITING_TRACK&&!this.waitForCdnTuneIn(b)&&(this.state=B.State.IDLE),this.tick()},w._handleFragmentLoadProgress=function(_){var u,E=_.frag,m=_.part,b=_.payload,N=this.config,D=this.trackId,H=this.levels;if(!H){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+E.sn+" of level "+E.level+" will not be buffered");return}var j=H[D];console.assert(j,"Audio track is defined on fragment load progress");var I=j.details;console.assert(I,"Audio track details are defined on fragment load progress");var y=N.defaultAudioCodec||j.audioCodec||"mp4a.40.2",W=this.transmuxer;W||(W=this.transmuxer=new f.default(this.hls,R.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Y=this.initPTS[E.cc],ie=(u=E.initSegment)===null||u===void 0?void 0:u.data;if(Y!==void 0){var oe=!1,we=m?m.index:-1,me=we!==-1,Se=new d.ChunkMetadata(E.level,E.sn,E.stats.chunkCount,b.byteLength,we,me);W.push(b,ie,y,"",E,m,I.totalduration,oe,Se,Y)}else{n.logger.log("Unknown video PTS for cc "+E.cc+", waiting for video PTS before demuxing audio frag "+E.sn+" of ["+I.startSN+" ,"+I.endSN+"],track "+D);var Ce=this.waitingData=this.waitingData||{frag:E,part:m,cache:new p.default,complete:!1},xe=Ce.cache;xe.push(new Uint8Array(b)),this.waitingVideoCC=this.videoTrackCC,this.state=B.State.WAITING_INIT_PTS}},w._handleFragmentLoadComplete=function(_){if(this.waitingData){this.waitingData.complete=!0;return}O.prototype._handleFragmentLoadComplete.call(this,_)},w.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},w.onBufferCreated=function(_,u){var E=u.tracks.audio;E&&(this.mediaBuffer=E.buffer),u.tracks.video&&(this.videoBuffer=u.tracks.video.buffer)},w.onFragBuffered=function(_,u){var E=u.frag,m=u.part;if(E.type!==R.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(E)){this.warn("Fragment "+E.sn+(m?" p: "+m.index:"")+" of level "+E.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}E.sn!=="initSegment"&&(this.fragPrevious=E,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(F.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(E,m)},w.onError=function(_,u){switch(u.details){case l.ErrorDetails.FRAG_LOAD_ERROR:case l.ErrorDetails.FRAG_LOAD_TIMEOUT:case l.ErrorDetails.KEY_LOAD_ERROR:case l.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.AUDIO,u);break;case l.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case l.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==B.State.ERROR&&this.state!==B.State.STOPPED&&(this.state=u.fatal?B.State.ERROR:B.State.IDLE,this.warn(u.details+" while loading frag, switching to "+this.state+" state"));break;case l.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="audio"&&(this.state===B.State.PARSING||this.state===B.State.PARSED)){var E=!0,m=this.getFwdBufferInfo(this.mediaBuffer,R.PlaylistLevelType.AUDIO);m&&m.len>.5&&(E=!this.reduceMaxBufferLength(m.len)),E&&(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}},w.onBufferFlushed=function(_,u){var E=u.type;E===g.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},w._handleTransmuxComplete=function(_){var u,E="audio",m=this.hls,b=_.remuxResult,N=_.chunkMeta,D=this.getCurrentContext(N);if(!D){this.warn("The loading context changed while buffering fragment "+N.sn+" of level "+N.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(N.level);return}var H=D.frag,j=D.part,I=b.audio,y=b.text,W=b.id3,Y=b.initSegment;if(this.fragContextChanged(H))return;if(this.state=B.State.PARSING,this.audioSwitch&&I&&this.completeAudioSwitch(),Y!=null&&Y.tracks&&(this._bufferInitSegment(Y.tracks,H,N),m.trigger(F.Events.FRAG_PARSING_INIT_SEGMENT,{frag:H,id:E,tracks:Y.tracks})),I){var ie=I.startPTS,oe=I.endPTS,we=I.startDTS,me=I.endDTS;j&&(j.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:ie,endPTS:oe,startDTS:we,endDTS:me}),H.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,ie,oe,we,me),this.bufferFragmentData(I,H,j,N)}if(W!=null&&(u=W.samples)!==null&&u!==void 0&&u.length){var Se=o({frag:H,id:E},W);m.trigger(F.Events.FRAG_PARSING_METADATA,Se)}if(y){var Ce=o({frag:H,id:E},y);m.trigger(F.Events.FRAG_PARSING_USERDATA,Ce)}},w._bufferInitSegment=function(_,u,E){if(this.state!==B.State.PARSING)return;_.video&&delete _.video;var m=_.audio;if(!m)return;m.levelCodec=m.codec,m.id="audio",this.log("Init audio buffer, container:"+m.container+", codecs[parsed]=["+m.codec+"]"),this.hls.trigger(F.Events.BUFFER_CODECS,_);var b=m.initSegment;if(b!=null&&b.byteLength){var N={type:"audio",frag:u,part:null,chunkMeta:E,parent:u.type,data:b};this.hls.trigger(F.Events.BUFFER_APPENDING,N)}this.tick()},w.loadFragment=function(_,u,E){var m=this.fragmentTracker.getState(_);this.fragCurrent=_,(this.audioSwitch||m===G.FragmentState.NOT_LOADED||m===G.FragmentState.PARTIAL)&&(_.sn==="initSegment"?this._loadInitSegment(_):u.live&&!Object(Q.isFiniteNumber)(this.initPTS[_.cc])?(this.log("Waiting for video PTS in continuity counter "+_.cc+" of live stream before loading audio fragment "+_.sn+" of level "+this.trackId),this.state=B.State.WAITING_INIT_PTS):(this.startFragRequested=!0,O.prototype.loadFragment.call(this,_,u,E)))},w.completeAudioSwitch=function(){var _=this.hls,u=this.media,E=this.trackId;u&&(this.log("Switching audio track : flushing all audio"),O.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,_.trigger(F.Events.AUDIO_TRACK_SWITCHED,{id:E})},C}(B.default);Z.default=x},"./src/controller/audio-track-controller.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/events.ts"),B=P("./src/errors.ts"),F=P("./src/controller/base-playlist-controller.ts"),K=P("./src/types/loader.ts");function G(f,d){for(var s=0;s<d.length;s++){var c=d[s];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(f,c.key,c)}}function M(f,d,s){return d&&G(f.prototype,d),s&&G(f,s),f}function R(f,d){f.prototype=Object.create(d.prototype),f.prototype.constructor=f,g(f,d)}function g(f,d){return g=Object.setPrototypeOf||function(c,l){return c.__proto__=l,c},g(f,d)}var p=function(f){R(d,f);function d(c){var l;return l=f.call(this,c,"[audio-track-controller]")||this,l.tracks=[],l.groupId=null,l.tracksInGroup=[],l.trackId=-1,l.trackName="",l.selectDefaultTrack=!0,l.registerListeners(),l}var s=d.prototype;return s.registerListeners=function(){var l=this.hls;l.on(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.on(Q.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(Q.Events.ERROR,this.onError,this)},s.unregisterListeners=function(){var l=this.hls;l.off(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.off(Q.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(Q.Events.ERROR,this.onError,this)},s.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,f.prototype.destroy.call(this)},s.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},s.onManifestParsed=function(l,n){this.tracks=n.audioTracks||[]},s.onAudioTrackLoaded=function(l,n){var o=n.id,h=n.details,L=this.tracksInGroup[o];if(!L){this.warn("Invalid audio track id "+o);return}var S=L.details;L.details=n.details,this.log("audioTrack "+o+" loaded ["+h.startSN+"-"+h.endSN+"]"),o===this.trackId&&(this.retryCount=0,this.playlistLoaded(o,n,S))},s.onLevelLoading=function(l,n){this.switchLevel(n.level)},s.onLevelSwitching=function(l,n){this.switchLevel(n.level)},s.switchLevel=function(l){var n=this.hls.levels[l];if(!(n!=null&&n.audioGroupIds))return;var o=n.audioGroupIds[n.urlId];if(this.groupId!==o){this.groupId=o;var h=this.tracks.filter(function(S){return!o||S.groupId===o});this.selectDefaultTrack&&!h.some(function(S){return S.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=h;var L={audioTracks:h};this.log("Updating audio tracks, "+h.length+' track(s) found in "'+o+'" group-id'),this.hls.trigger(Q.Events.AUDIO_TRACKS_UPDATED,L),this.selectInitialTrack()}},s.onError=function(l,n){if(f.prototype.onError.call(this,l,n),n.fatal||!n.context)return;n.context.type===K.PlaylistContextType.AUDIO_TRACK&&n.context.id===this.trackId&&n.context.groupId===this.groupId&&this.retryLoadingOrFail(n)},s.setAudioTrack=function(l){var n=this.tracksInGroup;if(l<0||l>=n.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var o=n[this.trackId];this.log("Now switching to audio-track index "+l);var h=n[l],L=h.id,S=h.groupId,x=S===void 0?"":S,O=h.name,C=h.type,w=h.url;if(this.trackId=l,this.trackName=O,this.selectDefaultTrack=!1,this.hls.trigger(Q.Events.AUDIO_TRACK_SWITCHING,{id:L,groupId:x,name:O,type:C,url:w}),h.details&&!h.details.live)return;var T=this.switchParams(h.url,o==null?void 0:o.details);this.loadPlaylist(T)},s.selectInitialTrack=function(){var l=this.tracksInGroup;console.assert(l.length,"Initial audio track should be selected when tracks are known");var n=this.trackName,o=this.findTrackId(n)||this.findTrackId();o!==-1?this.setAudioTrack(o):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},s.findTrackId=function(l){for(var n=this.tracksInGroup,o=0;o<n.length;o++){var h=n[o];if((!this.selectDefaultTrack||h.default)&&(!l||l===h.name))return h.id}return-1},s.loadPlaylist=function(l){var n=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(n)){var o=n.id,h=n.groupId,L=n.url;if(l)try{L=l.addDirectives(L)}catch(S){this.warn("Could not construct new URL with HLS Delivery Directives: "+S)}this.log("loading audio-track playlist for id: "+o),this.clearTimer(),this.hls.trigger(Q.Events.AUDIO_TRACK_LOADING,{url:L,id:o,groupId:h,deliveryDirectives:l||null})}},M(d,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(l){this.selectDefaultTrack=!1,this.setAudioTrack(l)}}]),d}(F.default);Z.default=p},"./src/controller/base-playlist-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return M});var Q=P("./src/polyfills/number.ts"),B=P("./src/types/level.ts"),F=P("./src/controller/level-helper.ts"),K=P("./src/utils/logger.ts"),G=P("./src/errors.ts"),M=function(){function R(p,f){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=K.logger.log.bind(K.logger,f+":"),this.warn=K.logger.warn.bind(K.logger,f+":"),this.hls=p}var g=R.prototype;return g.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},g.onError=function(f,d){d.fatal&&d.type===G.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},g.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},g.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},g.stopLoad=function(){this.canLoad=!1,this.clearTimer()},g.switchParams=function(f,d){var s=d==null?void 0:d.renditionReports;if(s)for(var c=0;c<s.length;c++){var l=s[c],n=""+l.URI;if(n===f.substr(-n.length)){var o=parseInt(l["LAST-MSN"]),h=parseInt(l["LAST-PART"]);if(d&&this.hls.config.lowLatencyMode){var L=Math.min(d.age-d.partTarget,d.targetduration);h!==void 0&&L>d.partTarget&&(h+=1)}if(Object(Q.isFiniteNumber)(o))return new B.HlsUrlParameters(o,Object(Q.isFiniteNumber)(h)?h:void 0,B.HlsSkip.No)}}},g.loadPlaylist=function(f){},g.shouldLoadTrack=function(f){return this.canLoad&&f&&!!f.url&&(!f.details||f.details.live)},g.playlistLoaded=function(f,d,s){var c=this,l=d.details,n=d.stats,o=n.loading.end?Math.max(0,self.performance.now()-n.loading.end):0;if(l.advancedDateTime=Date.now()-o,l.live||s!=null&&s.live){if(l.reloaded(s),s&&this.log("live playlist "+f+" "+(l.advanced?"REFRESHED "+l.lastPartSn+"-"+l.lastPartIndex:"MISSED")),s&&l.fragments.length>0&&Object(F.mergeDetails)(s,l),!this.canLoad||!l.live)return;var h,L=void 0,S=void 0;if(l.canBlockReload&&l.endSN&&l.advanced){var x=this.hls.config.lowLatencyMode,O=l.lastPartSn,C=l.endSN,w=l.lastPartIndex,T=w!==-1,_=O===C,u=x?0:w;T?(L=_?C+1:O,S=_?u:w+1):L=C+1;var E=l.age,m=E+l.ageHeader,b=Math.min(m-l.partTarget,l.targetduration*1.5);if(b>0){if(s&&b>s.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+s.tuneInGoal+" to: "+b+" with playlist age: "+l.age),b=0;else{var N=Math.floor(b/l.targetduration);if(L+=N,S!==void 0){var D=Math.round(b%l.targetduration/l.partTarget);S+=D}this.log("CDN Tune-in age: "+l.ageHeader+"s last advanced "+E.toFixed(2)+"s goal: "+b+" skip sn "+N+" to part "+S)}l.tuneInGoal=b}if(h=this.getDeliveryDirectives(l,d.deliveryDirectives,L,S),x||!_){this.loadPlaylist(h);return}}else h=this.getDeliveryDirectives(l,d.deliveryDirectives,L,S);var H=Object(F.computeReloadInterval)(l,n);L!==void 0&&l.canBlockReload&&(H-=l.partTarget||1),this.log("reload live playlist "+f+" in "+Math.round(H)+" ms"),this.timer=self.setTimeout(function(){return c.loadPlaylist(h)},H)}else this.clearTimer()},g.getDeliveryDirectives=function(f,d,s,c){var l=Object(B.getSkipValue)(f,s);return d!=null&&d.skip&&f.deltaUpdateFailed&&(s=d.msn,c=d.part,l=B.HlsSkip.No),new B.HlsUrlParameters(s,c,l)},g.retryLoadingOrFail=function(f){var d=this,s=this.hls.config,c=this.retryCount<s.levelLoadingMaxRetry;if(c){var l;if(this.retryCount++,f.details.indexOf("LoadTimeOut")>-1&&(l=f.context)!==null&&l!==void 0&&l.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+f.details+'"'),this.loadPlaylist();else{var n=Math.min(Math.pow(2,this.retryCount)*s.levelLoadingRetryDelay,s.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return d.loadPlaylist()},n),this.warn("retry playlist loading #"+this.retryCount+" in "+n+' ms after "'+f.details+'"')}}else this.warn('cannot recover from error "'+f.details+'"'),this.clearTimer(),f.fatal=!0;return c},R}()},"./src/controller/base-stream-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"State",function(){return C}),P.d(Z,"default",function(){return w});var Q=P("./src/polyfills/number.ts"),B=P("./src/task-loop.ts"),F=P("./src/controller/fragment-tracker.ts"),K=P("./src/utils/buffer-helper.ts"),G=P("./src/utils/logger.ts"),M=P("./src/events.ts"),R=P("./src/errors.ts"),g=P("./src/types/transmuxer.ts"),p=P("./src/utils/mp4-tools.ts"),f=P("./src/utils/discontinuities.ts"),d=P("./src/controller/fragment-finders.ts"),s=P("./src/controller/level-helper.ts"),c=P("./src/loader/fragment-loader.ts"),l=P("./src/crypt/decrypter.ts"),n=P("./src/utils/time-ranges.ts"),o=P("./src/types/loader.ts");function h(T,_){for(var u=0;u<_.length;u++){var E=_[u];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(T,E.key,E)}}function L(T,_,u){return _&&h(T.prototype,_),u&&h(T,u),T}function S(T){if(T===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return T}function x(T,_){T.prototype=Object.create(_.prototype),T.prototype.constructor=T,O(T,_)}function O(T,_){return O=Object.setPrototypeOf||function(E,m){return E.__proto__=m,E},O(T,_)}var C={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"},w=function(T){x(_,T);function _(E,m,b){var N;return N=T.call(this)||this,N.hls=void 0,N.fragPrevious=null,N.fragCurrent=null,N.fragmentTracker=void 0,N.transmuxer=null,N._state=C.STOPPED,N.media=void 0,N.mediaBuffer=void 0,N.config=void 0,N.bitrateTest=!1,N.lastCurrentTime=0,N.nextLoadPosition=0,N.startPosition=0,N.loadedmetadata=!1,N.fragLoadError=0,N.retryDate=0,N.levels=null,N.fragmentLoader=void 0,N.levelLastLoaded=null,N.startFragRequested=!1,N.decrypter=void 0,N.initPTS=[],N.onvseeking=null,N.onvended=null,N.logPrefix="",N.log=void 0,N.warn=void 0,N.logPrefix=b,N.log=G.logger.log.bind(G.logger,b+":"),N.warn=G.logger.warn.bind(G.logger,b+":"),N.hls=E,N.fragmentLoader=new c.default(E.config),N.fragmentTracker=m,N.config=E.config,N.decrypter=new l.default(E,E.config),E.on(M.Events.KEY_LOADED,N.onKeyLoaded,S(N)),N}var u=_.prototype;return u.doTick=function(){this.onTickEnd()},u.onTickEnd=function(){},u.startLoad=function(m){},u.stopLoad=function(){this.fragmentLoader.abort();var m=this.fragCurrent;m&&this.fragmentTracker.removeFragment(m),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=C.STOPPED},u._streamEnded=function(m,b){var N=this.fragCurrent,D=this.fragmentTracker;if(!b.live&&N&&N.sn===b.endSN&&!m.nextStart){var H=D.getState(N);return H===F.FragmentState.PARTIAL||H===F.FragmentState.OK}return!1},u.onMediaAttached=function(m,b){var N=this.media=this.mediaBuffer=b.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),N.addEventListener("seeking",this.onvseeking),N.addEventListener("ended",this.onvended);var D=this.config;this.levels&&D.autoStartLoad&&this.state===C.STOPPED&&this.startLoad(D.startPosition)},u.onMediaDetaching=function(){var m=this.media;m!=null&&m.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),m&&(m.removeEventListener("seeking",this.onvseeking),m.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},u.onMediaSeeking=function(){var m=this.config,b=this.fragCurrent,N=this.media,D=this.mediaBuffer,H=this.state,j=N?N.currentTime:0,I=K.BufferHelper.bufferInfo(D||N,j,m.maxBufferHole);if(this.log("media seeking to "+(Object(Q.isFiniteNumber)(j)?j.toFixed(3):j)+", state: "+H),H===C.ENDED)this.resetLoadingState();else if(b&&!I.len){var y=m.maxFragLookUpTolerance,W=b.start-y,Y=b.start+b.duration+y,ie=j>Y;(j<W||ie)&&(ie&&b.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),b.loader.abort()),this.resetLoadingState())}N&&(this.lastCurrentTime=j),!this.loadedmetadata&&!I.len&&(this.nextLoadPosition=this.startPosition=j),this.tickImmediate()},u.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},u.onKeyLoaded=function(m,b){if(this.state!==C.KEY_LOADING||b.frag!==this.fragCurrent||!this.levels)return;this.state=C.IDLE;var N=this.levels[b.frag.level].details;N&&this.loadFragment(b.frag,N,b.frag.start)},u.onHandlerDestroying=function(){this.stopLoad(),T.prototype.onHandlerDestroying.call(this)},u.onHandlerDestroyed=function(){this.state=C.STOPPED,this.hls.off(M.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,T.prototype.onHandlerDestroyed.call(this)},u.loadKey=function(m,b){this.log("Loading key for "+m.sn+" of ["+b.startSN+"-"+b.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=C.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(M.Events.KEY_LOADING,{frag:m})},u.loadFragment=function(m,b,N){this._loadFragForPlayback(m,b,N)},u._loadFragForPlayback=function(m,b,N){var D=this,H=function(I){if(D.fragContextChanged(m)){D.warn("Fragment "+m.sn+(I.part?" p: "+I.part.index:"")+" of level "+m.level+" was dropped during download."),D.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,D._handleFragmentLoadProgress(I)};this._doFragLoad(m,b,N,H).then(function(j){if(!j)return;D.fragLoadError=0;var I=D.state;if(D.fragContextChanged(m)){(I===C.FRAG_LOADING||I===C.BACKTRACKING||!D.fragCurrent&&I===C.PARSING)&&(D.fragmentTracker.removeFragment(m),D.state=C.IDLE);return}if("payload"in j&&(D.log("Loaded fragment "+m.sn+" of level "+m.level),D.hls.trigger(M.Events.FRAG_LOADED,j),D.state===C.BACKTRACKING)){D.fragmentTracker.backtrack(m,j),D.resetFragmentLoading(m);return}D._handleFragmentLoadComplete(j)}).catch(function(j){D.warn(j),D.resetFragmentLoading(m)})},u.flushMainBuffer=function(m,b,N){if(N===void 0&&(N=null),!(m-b))return;var D={startOffset:m,endOffset:b,type:N};this.fragLoadError=0,this.hls.trigger(M.Events.BUFFER_FLUSHING,D)},u._loadInitSegment=function(m){var b=this;this._doFragLoad(m).then(function(N){if(!N||b.fragContextChanged(m)||!b.levels)throw new Error("init load aborted");return N}).then(function(N){var D=b.hls,H=N.payload,j=m.decryptdata;if(H&&H.byteLength>0&&j&&j.key&&j.iv&&j.method==="AES-128"){var I=self.performance.now();return b.decrypter.webCryptoDecrypt(new Uint8Array(H),j.key.buffer,j.iv.buffer).then(function(y){var W=self.performance.now();return D.trigger(M.Events.FRAG_DECRYPTED,{frag:m,payload:y,stats:{tstart:I,tdecrypt:W}}),N.payload=y,N})}return N}).then(function(N){var D=b.fragCurrent,H=b.hls,j=b.levels;if(!j)throw new Error("init load aborted, missing levels");var I=j[m.level].details;console.assert(I,"Level details are defined when init segment is loaded");var y=m.stats;b.state=C.IDLE,b.fragLoadError=0,m.data=new Uint8Array(N.payload),y.parsing.start=y.buffering.start=self.performance.now(),y.parsing.end=y.buffering.end=self.performance.now(),N.frag===D&&H.trigger(M.Events.FRAG_BUFFERED,{stats:y,frag:D,part:null,id:m.type}),b.tick()}).catch(function(N){b.warn(N),b.resetFragmentLoading(m)})},u.fragContextChanged=function(m){var b=this.fragCurrent;return!m||!b||m.level!==b.level||m.sn!==b.sn||m.urlId!==b.urlId},u.fragBufferedComplete=function(m,b){var N=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(b?" part: "+b.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+n.default.toString(K.BufferHelper.getBuffered(N))),this.state=C.IDLE,this.tick()},u._handleFragmentLoadComplete=function(m){var b=this.transmuxer;if(!b)return;var N=m.frag,D=m.part,H=m.partsLoaded,j=!H||H.length===0||H.some(function(y){return!y}),I=new g.ChunkMetadata(N.level,N.sn,N.stats.chunkCount+1,0,D?D.index:-1,!j);b.flush(I)},u._handleFragmentLoadProgress=function(m){},u._doFragLoad=function(m,b,N,D){var H=this;if(N===void 0&&(N=null),!this.levels)throw new Error("frag load aborted, missing levels");if(N=Math.max(m.start,N||0),this.config.lowLatencyMode&&b){var j=b.partList;if(j&&D){N>m.end&&b.fragmentHint&&(m=b.fragmentHint);var I=this.getNextPart(j,m,N);if(I>-1){var y=j[I];return this.log("Loading part sn: "+m.sn+" p: "+y.index+" cc: "+m.cc+" of playlist ["+b.startSN+"-"+b.endSN+"] parts [0-"+I+"-"+(j.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(N.toFixed(3))),this.nextLoadPosition=y.start+y.duration,this.state=C.FRAG_LOADING,this.hls.trigger(M.Events.FRAG_LOADING,{frag:m,part:j[I],targetBufferTime:N}),this.doFragPartsLoad(m,j,I,D).catch(function(W){return H.handleFragLoadError(W)})}else if(!m.url||this.loadedEndOfParts(j,N))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(b?"of ["+b.startSN+"-"+b.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(N.toFixed(3))),Object(Q.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=C.FRAG_LOADING,this.hls.trigger(M.Events.FRAG_LOADING,{frag:m,targetBufferTime:N}),this.fragmentLoader.load(m,D).catch(function(W){return H.handleFragLoadError(W)})},u.doFragPartsLoad=function(m,b,N,D){var H=this;return new Promise(function(j,I){var y=[],W=function Y(ie){var oe=b[ie];H.fragmentLoader.loadPart(m,oe,D).then(function(we){y[oe.index]=we;var me=we.part;H.hls.trigger(M.Events.FRAG_LOADED,we);var Se=b[ie+1];if(Se&&Se.fragment===m)Y(ie+1);else return j({frag:m,part:me,partsLoaded:y})}).catch(I)};W(N)})},u.handleFragLoadError=function(m){var b=m.data;return b&&b.details===R.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(b.frag,b.part):this.hls.trigger(M.Events.ERROR,b),null},u._handleTransmuxerFlush=function(m){var b=this.getCurrentContext(m);if(!b||this.state!==C.PARSING){this.fragCurrent||(this.state=C.IDLE);return}var N=b.frag,D=b.part,H=b.level,j=self.performance.now();N.stats.parsing.end=j,D&&(D.stats.parsing.end=j),this.updateLevelTiming(N,D,H,m.partial)},u.getCurrentContext=function(m){var b=this.levels,N=m.level,D=m.sn,H=m.part;if(!b||!b[N])return this.warn("Levels object was unset while buffering fragment "+D+" of level "+N+". The current chunk will not be buffered."),null;var j=b[N],I=H>-1?Object(s.getPartWith)(j,D,H):null,y=I?I.fragment:Object(s.getFragmentWithSN)(j,D,this.fragCurrent);return y?{frag:y,part:I,level:j}:null},u.bufferFragmentData=function(m,b,N,D){if(!m||this.state!==C.PARSING)return;var H=m.data1,j=m.data2,I=H;if(H&&j&&(I=Object(p.appendUint8Array)(H,j)),!I||!I.length)return;var y={type:m.type,frag:b,part:N,chunkMeta:D,parent:b.type,data:I};this.hls.trigger(M.Events.BUFFER_APPENDING,y),m.dropped&&m.independent&&!N&&this.flushBufferGap(b)},u.flushBufferGap=function(m){var b=this.media;if(!b)return;if(!K.BufferHelper.isBuffered(b,b.currentTime)){this.flushMainBuffer(0,m.start);return}var N=b.currentTime,D=K.BufferHelper.bufferInfo(b,N,0),H=m.duration,j=Math.min(this.config.maxFragLookUpTolerance*2,H*.25),I=Math.max(Math.min(m.start-j,D.end-j),N+j);m.start-I>j&&this.flushMainBuffer(I,m.start)},u.getFwdBufferInfo=function(m,b){var N=this.config,D=this.getLoadPosition();if(!Object(Q.isFiniteNumber)(D))return null;var H=K.BufferHelper.bufferInfo(m,D,N.maxBufferHole);if(H.len===0&&H.nextStart!==void 0){var j=this.fragmentTracker.getBufferedFrag(D,b);if(j&&H.nextStart<j.end)return K.BufferHelper.bufferInfo(m,D,Math.max(H.nextStart,N.maxBufferHole))}return H},u.getMaxBufferLength=function(m){var b=this.config,N;return m?N=Math.max(8*b.maxBufferSize/m,b.maxBufferLength):N=b.maxBufferLength,Math.min(N,b.maxMaxBufferLength)},u.reduceMaxBufferLength=function(m){var b=this.config,N=m||b.maxBufferLength;return b.maxMaxBufferLength>=N?(b.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+b.maxMaxBufferLength+"s"),!0):!1},u.getNextFragment=function(m,b){var N,D,H=b.fragments,j=H.length;if(!j)return null;var I=this.config,y=H[0].start,W;if(b.live){var Y=I.initialLiveManifestSize;if(j<Y)return this.warn("Not enough fragments to start playback (have: "+j+", need: "+Y+")"),null;!b.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(W=this.getInitialLiveFragment(b,H),this.startPosition=W?this.hls.liveSyncPosition||W.start:m)}else m<=y&&(W=H[0]);if(!W){var ie=I.lowLatencyMode?b.partEnd:b.fragmentEnd;W=this.getFragmentAtPosition(m,ie,b)}return(N=W)!==null&&N!==void 0&&N.initSegment&&!((D=W)!==null&&D!==void 0&&D.initSegment.data)&&!this.bitrateTest&&(W=W.initSegment),W},u.getNextPart=function(m,b,N){for(var D=-1,H=!1,j=!0,I=0,y=m.length;I<y;I++){var W=m[I];if(j=j&&!W.independent,D>-1&&N<W.start)break;var Y=W.loaded;!Y&&(H||W.independent||j)&&W.fragment===b&&(D=I),H=Y}return D},u.loadedEndOfParts=function(m,b){var N=m[m.length-1];return N&&b>N.start&&N.loaded},u.getInitialLiveFragment=function(m,b){var N=this.fragPrevious,D=null;if(N){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+N.programDateTime),D=Object(d.findFragmentByPDT)(b,N.endProgramDateTime,this.config.maxFragLookUpTolerance)),!D){var H=N.sn+1;if(H>=m.startSN&&H<=m.endSN){var j=b[H-m.startSN];N.cc===j.cc&&(D=j,this.log("Live playlist, switching playlist, load frag with next SN: "+D.sn))}D||(D=Object(d.findFragWithCC)(b,N.cc),D&&this.log("Live playlist, switching playlist, load frag with same CC: "+D.sn))}}else{var I=this.hls.liveSyncPosition;I!==null&&(D=this.getFragmentAtPosition(I,this.bitrateTest?m.fragmentEnd:m.edge,m))}return D},u.getFragmentAtPosition=function(m,b,N){var D=this.config,H=this.fragPrevious,j=N.fragments,I=N.endSN,y=N.fragmentHint,W=D.maxFragLookUpTolerance,Y=!!(D.lowLatencyMode&&N.partList&&y);Y&&y&&!this.bitrateTest&&(j=j.concat(y),I=y.sn);var ie;if(m<b){var oe=m>b-W?0:W;ie=Object(d.findFragmentByPTS)(H,j,m,oe)}else ie=j[j.length-1];if(ie){var we=ie.sn-N.startSN,me=H&&ie.level===H.level,Se=j[we+1],Ce=this.fragmentTracker.getState(ie);if(Ce===F.FragmentState.BACKTRACKED){ie=null;for(var xe=we;j[xe]&&this.fragmentTracker.getState(j[xe])===F.FragmentState.BACKTRACKED;)H?ie=j[xe--]:ie=j[--xe];ie||(ie=Se)}else H&&ie.sn===H.sn&&!Y&&(me&&(ie.sn<I&&this.fragmentTracker.getState(Se)!==F.FragmentState.OK?(this.log("SN "+ie.sn+" just loaded, load next one: "+Se.sn),ie=Se):ie=null))}return ie},u.synchronizeToLiveEdge=function(m){var b=this.config,N=this.media;if(!N)return;var D=this.hls.liveSyncPosition,H=N.currentTime,j=m.fragments[0].start,I=m.edge,y=H>=j-b.maxFragLookUpTolerance&&H<=I;if(D!==null&&N.duration>D&&(H<D||!y)){var W=b.liveMaxLatencyDuration!==void 0?b.liveMaxLatencyDuration:b.liveMaxLatencyDurationCount*m.targetduration;(!y&&N.readyState<4||H<I-W)&&(this.loadedmetadata||(this.nextLoadPosition=D),N.readyState&&(this.warn("Playback: "+H.toFixed(3)+" is located too far from the end of live sliding playlist: "+I+", reset currentTime to : "+D.toFixed(3)),N.currentTime=D))}},u.alignPlaylists=function(m,b){var N=this.levels,D=this.levelLastLoaded,H=this.fragPrevious,j=D!==null?N[D]:null,I=m.fragments.length;if(!I)return this.warn("No fragments in live playlist"),0;var y=m.fragments[0].start,W=!b,Y=m.alignedSliding&&Object(Q.isFiniteNumber)(y);if(W||!Y&&!y){Object(f.alignStream)(H,j,m);var ie=m.fragments[0].start;return this.log("Live playlist sliding: "+ie.toFixed(2)+" start-sn: "+(b?b.startSN:"na")+"->"+m.startSN+" prev-sn: "+(H?H.sn:"na")+" fragments: "+I),ie}return y},u.waitForCdnTuneIn=function(m){var b=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*b)},u.setStartPosition=function(m,b){var N=this.startPosition;if(N<b&&(N=-1),N===-1||this.lastCurrentTime===-1){var D=m.startTimeOffset;Object(Q.isFiniteNumber)(D)?(N=b+D,D<0&&(N+=m.totalduration),N=Math.min(Math.max(b,N),b+m.totalduration),this.log("Start time offset "+D+" found in playlist, adjust startPosition to "+N),this.startPosition=N):m.live?N=this.hls.liveSyncPosition||b:this.startPosition=N=0,this.lastCurrentTime=N}this.nextLoadPosition=N},u.getLoadPosition=function(){var m=this.media,b=0;return this.loadedmetadata&&m?b=m.currentTime:this.nextLoadPosition&&(b=this.nextLoadPosition),b},u.handleFragLoadAborted=function(m,b){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(b?" part"+b.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},u.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=C.IDLE)},u.onFragmentOrKeyLoadError=function(m,b){if(b.fatal)return;var N=b.frag;if(!N||N.type!==m)return;var D=this.fragCurrent;console.assert(D&&N.sn===D.sn&&N.level===D.level&&N.urlId===D.urlId,"Frag load error must match current frag to retry");var H=this.config;if(this.fragLoadError+1<=H.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(N.level))return;var j=Math.min(Math.pow(2,this.fragLoadError)*H.fragLoadingRetryDelay,H.fragLoadingMaxRetryTimeout);this.warn("Fragment "+N.sn+" of "+m+" "+N.level+" failed to load, retrying in "+j+"ms"),this.retryDate=self.performance.now()+j,this.fragLoadError++,this.state=C.FRAG_LOADING_WAITING_RETRY}else b.levelRetry?(m===o.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=C.IDLE):(G.logger.error(b.details+" reaches max retry, redispatch as fatal ..."),b.fatal=!0,this.hls.stopLoad(),this.state=C.ERROR)},u.afterBufferFlushed=function(m,b,N){if(!m)return;var D=K.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(b,D,N),this.state===C.ENDED&&this.resetLoadingState()},u.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=C.IDLE},u.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var b=this.levels?this.levels[m].details:null;if(b!=null&&b.live)return this.startPosition=-1,this.setStartPosition(b,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},u.updateLevelTiming=function(m,b,N,D){var H=this,j=N.details;console.assert(!!j,"level.details must be defined");var I=Object.keys(m.elementaryStreams).reduce(function(y,W){var Y=m.elementaryStreams[W];if(Y){var ie=Y.endPTS-Y.startPTS;if(ie<=0)return H.warn("Could not parse fragment "+m.sn+" "+W+" duration reliably ("+ie+") resetting transmuxer to fallback to playlist timing"),H.resetTransmuxer(),y||!1;var oe=D?0:Object(s.updateFragPTSDTS)(j,m,Y.startPTS,Y.endPTS,Y.startDTS,Y.endDTS);return H.hls.trigger(M.Events.LEVEL_PTS_UPDATED,{details:j,level:N,drift:oe,type:W,frag:m,start:Y.startPTS,end:Y.endPTS}),!0}return y},!1);I?(this.state=C.PARSED,this.hls.trigger(M.Events.FRAG_PARSED,{frag:m,part:b})):this.resetLoadingState()},u.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},L(_,[{key:"state",get:function(){return this._state},set:function(m){var b=this._state;b!==m&&(this._state=m,this.log(b+"->"+m))}}]),_}(B.default)},"./src/controller/buffer-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return d});var Q=P("./src/polyfills/number.ts"),B=P("./src/events.ts"),F=P("./src/utils/logger.ts"),K=P("./src/errors.ts"),G=P("./src/utils/buffer-helper.ts"),M=P("./src/utils/mediasource-helper.ts"),R=P("./src/loader/fragment.ts"),g=P("./src/controller/buffer-operation-queue.ts"),p=Object(M.getMediaSource)(),f=/([ha]vc.)(?:\.[^.,]+)+/,d=function(){function s(l){var n=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 o=n.hls,h=n.media,L=n.mediaSource;F.logger.log("[buffer-controller]: Media source opened"),h&&(n.updateMediaElementDuration(),o.trigger(B.Events.MEDIA_ATTACHED,{media:h})),L&&L.removeEventListener("sourceopen",n._onMediaSourceOpen),n.checkPendingTracks()},this._onMediaSourceClose=function(){F.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){F.logger.log("[buffer-controller]: Media source ended")},this.hls=l,this._initSourceBuffer(),this.registerListeners()}var c=s.prototype;return c.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},c.destroy=function(){this.unregisterListeners(),this.details=null},c.registerListeners=function(){var n=this.hls;n.on(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),n.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.on(B.Events.BUFFER_RESET,this.onBufferReset,this),n.on(B.Events.BUFFER_APPENDING,this.onBufferAppending,this),n.on(B.Events.BUFFER_CODECS,this.onBufferCodecs,this),n.on(B.Events.BUFFER_EOS,this.onBufferEos,this),n.on(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),n.on(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),n.on(B.Events.FRAG_PARSED,this.onFragParsed,this),n.on(B.Events.FRAG_CHANGED,this.onFragChanged,this)},c.unregisterListeners=function(){var n=this.hls;n.off(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),n.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.off(B.Events.BUFFER_RESET,this.onBufferReset,this),n.off(B.Events.BUFFER_APPENDING,this.onBufferAppending,this),n.off(B.Events.BUFFER_CODECS,this.onBufferCodecs,this),n.off(B.Events.BUFFER_EOS,this.onBufferEos,this),n.off(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),n.off(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),n.off(B.Events.FRAG_PARSED,this.onFragParsed,this),n.off(B.Events.FRAG_CHANGED,this.onFragChanged,this)},c._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new g.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},c.onManifestParsed=function(n,o){var h=2;(o.audio&&!o.video||!o.altAudio)&&(h=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=h,this.details=null,F.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},c.onMediaAttaching=function(n,o){var h=this.media=o.media;if(h&&p){var L=this.mediaSource=new p;L.addEventListener("sourceopen",this._onMediaSourceOpen),L.addEventListener("sourceended",this._onMediaSourceEnded),L.addEventListener("sourceclose",this._onMediaSourceClose),h.src=self.URL.createObjectURL(L),this._objectUrl=h.src}},c.onMediaDetaching=function(){var n=this.media,o=this.mediaSource,h=this._objectUrl;if(o){if(F.logger.log("[buffer-controller]: media source detaching"),o.readyState==="open")try{o.endOfStream()}catch(L){F.logger.warn("[buffer-controller]: onMediaDetaching: "+L.message+" while calling endOfStream")}this.onBufferReset(),o.removeEventListener("sourceopen",this._onMediaSourceOpen),o.removeEventListener("sourceended",this._onMediaSourceEnded),o.removeEventListener("sourceclose",this._onMediaSourceClose),n&&(h&&self.URL.revokeObjectURL(h),n.src===h?(n.removeAttribute("src"),n.load()):F.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(B.Events.MEDIA_DETACHED,void 0)},c.onBufferReset=function(){var n=this;this.getSourceBufferTypes().forEach(function(o){var h=n.sourceBuffer[o];try{h&&(n.removeBufferListeners(o),n.mediaSource&&n.mediaSource.removeSourceBuffer(h),n.sourceBuffer[o]=void 0)}catch(L){F.logger.warn("[buffer-controller]: Failed to reset the "+o+" buffer",L)}}),this._initSourceBuffer()},c.onBufferCodecs=function(n,o){var h=this,L=this.getSourceBufferTypes().length;if(Object.keys(o).forEach(function(S){if(L){var x=h.tracks[S];if(x&&typeof x.buffer.changeType=="function"){var O=o[S],C=O.codec,w=O.levelCodec,T=O.container,_=(x.levelCodec||x.codec).replace(f,"$1"),u=(w||C).replace(f,"$1");if(_!==u){var E=T+";codecs="+(w||C);h.appendChangeType(S,E)}}}else h.pendingTracks[S]=o[S]}),L)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},c.appendChangeType=function(n,o){var h=this,L=this.operationQueue,S={execute:function(){var O=h.sourceBuffer[n];O&&(F.logger.log("[buffer-controller]: changing "+n+" sourceBuffer type to "+o),O.changeType(o)),L.shiftAndExecuteNext(n)},onStart:function(){},onComplete:function(){},onError:function(O){F.logger.warn("[buffer-controller]: Failed to change "+n+" SourceBuffer type",O)}};L.append(S,n)},c.onBufferAppending=function(n,o){var h=this,L=this.hls,S=this.operationQueue,x=this.tracks,O=o.data,C=o.type,w=o.frag,T=o.part,_=o.chunkMeta,u=_.buffering[C],E=self.performance.now();u.start=E;var m=w.stats.buffering,b=T?T.stats.buffering:null;m.start===0&&(m.start=E),b&&b.start===0&&(b.start=E);var N=x.audio,D=C==="audio"&&_.id===1&&(N==null?void 0:N.container)==="audio/mpeg",H={execute:function(){if(u.executeStart=self.performance.now(),D){var I=h.sourceBuffer[C];if(I){var y=w.start-I.timestampOffset;Math.abs(y)>=.1&&(F.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+w.start+" (delta: "+y+") sn: "+w.sn+")"),I.timestampOffset=w.start)}}h.appendExecutor(O,C)},onStart:function(){},onComplete:function(){var I=self.performance.now();u.executeEnd=u.end=I,m.first===0&&(m.first=I),b&&b.first===0&&(b.first=I);var y=h.sourceBuffer,W={};for(var Y in y)W[Y]=G.BufferHelper.getBuffered(y[Y]);h.appendError=0,h.hls.trigger(B.Events.BUFFER_APPENDED,{type:C,frag:w,part:T,chunkMeta:_,parent:w.type,timeRanges:W})},onError:function(I){F.logger.error("[buffer-controller]: Error encountered while trying to append to the "+C+" SourceBuffer",I);var y={type:K.ErrorTypes.MEDIA_ERROR,parent:w.type,details:K.ErrorDetails.BUFFER_APPEND_ERROR,err:I,fatal:!1};I.code===DOMException.QUOTA_EXCEEDED_ERR?y.details=K.ErrorDetails.BUFFER_FULL_ERROR:(h.appendError++,y.details=K.ErrorDetails.BUFFER_APPEND_ERROR,h.appendError>L.config.appendErrorMaxRetry&&(F.logger.error("[buffer-controller]: Failed "+L.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),y.fatal=!0)),L.trigger(B.Events.ERROR,y)}};S.append(H,C)},c.onBufferFlushing=function(n,o){var h=this,L=this.operationQueue,S=function(O){return{execute:h.removeExecutor.bind(h,O,o.startOffset,o.endOffset),onStart:function(){},onComplete:function(){h.hls.trigger(B.Events.BUFFER_FLUSHED,{type:O})},onError:function(w){F.logger.warn("[buffer-controller]: Failed to remove from "+O+" SourceBuffer",w)}}};o.type?L.append(S(o.type),o.type):this.getSourceBufferTypes().forEach(function(x){L.append(S(x),x)})},c.onFragParsed=function(n,o){var h=this,L=o.frag,S=o.part,x=[],O=S?S.elementaryStreams:L.elementaryStreams;O[R.ElementaryStreamTypes.AUDIOVIDEO]?x.push("audiovideo"):(O[R.ElementaryStreamTypes.AUDIO]&&x.push("audio"),O[R.ElementaryStreamTypes.VIDEO]&&x.push("video"));var C=function(){var T=self.performance.now();L.stats.buffering.end=T,S&&(S.stats.buffering.end=T);var _=S?S.stats:L.stats;h.hls.trigger(B.Events.FRAG_BUFFERED,{frag:L,part:S,stats:_,id:L.type})};x.length===0&&F.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+L.type+" level: "+L.level+" sn: "+L.sn),this.blockBuffers(C,x)},c.onFragChanged=function(n,o){this.flushBackBuffer()},c.onBufferEos=function(n,o){var h=this,L=this.getSourceBufferTypes().reduce(function(S,x){var O=h.sourceBuffer[x];return(!o.type||o.type===x)&&(O&&!O.ended&&(O.ended=!0,F.logger.log("[buffer-controller]: "+x+" sourceBuffer now EOS"))),S&&!!(!O||O.ended)},!0);L&&this.blockBuffers(function(){var S=h.mediaSource;if(!S||S.readyState!=="open")return;S.endOfStream()})},c.onLevelUpdated=function(n,o){var h=o.details;if(!h.fragments.length)return;this.details=h,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},c.flushBackBuffer=function(){var n=this.hls,o=this.details,h=this.media,L=this.sourceBuffer;if(!h||o===null)return;var S=this.getSourceBufferTypes();if(!S.length)return;var x=o.live&&n.config.liveBackBufferLength!==null?n.config.liveBackBufferLength:n.config.backBufferLength;if(!Object(Q.isFiniteNumber)(x)||x<0)return;var O=h.currentTime,C=o.levelTargetDuration,w=Math.max(x,C),T=Math.floor(O/C)*C-w;S.forEach(function(_){var u=L[_];if(u){var E=G.BufferHelper.getBuffered(u);E.length>0&&T>E.start(0)&&(n.trigger(B.Events.BACK_BUFFER_REACHED,{bufferEnd:T}),o.live&&n.trigger(B.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:T}),n.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:T,type:_}))}})},c.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var n=this.details,o=this.hls,h=this.media,L=this.mediaSource,S=n.fragments[0].start+n.totalduration,x=h.duration,O=Object(Q.isFiniteNumber)(L.duration)?L.duration:0;n.live&&o.config.liveDurationInfinity?(F.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),L.duration=Infinity,this.updateSeekableRange(n)):(S>O&&S>x||!Object(Q.isFiniteNumber)(x))&&(F.logger.log("[buffer-controller]: Updating Media Source duration to "+S.toFixed(3)),L.duration=S)},c.updateSeekableRange=function(n){var o=this.mediaSource,h=n.fragments,L=h.length;if(L&&n.live&&o!==null&&o!==void 0&&o.setLiveSeekableRange){var S=Math.max(0,h[0].start),x=Math.max(S,S+n.totalduration);o.setLiveSeekableRange(S,x)}},c.checkPendingTracks=function(){var n=this.bufferCodecEventsExpected,o=this.operationQueue,h=this.pendingTracks,L=Object.keys(h).length;if(L&&!n||L===2){this.createSourceBuffers(h),this.pendingTracks={};var S=this.getSourceBufferTypes();if(S.length===0){this.hls.trigger(B.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}S.forEach(function(x){o.executeNext(x)})}},c.createSourceBuffers=function(n){var o=this.sourceBuffer,h=this.mediaSource;if(!h)throw Error("createSourceBuffers called when mediaSource was null");var L=0;for(var S in n)if(!o[S]){var x=n[S];if(!x)throw Error("source buffer exists for track "+S+", however track does not");var O=x.levelCodec||x.codec,C=x.container+";codecs="+O;F.logger.log("[buffer-controller]: creating sourceBuffer("+C+")");try{var w=o[S]=h.addSourceBuffer(C),T=S;this.addBufferListener(T,"updatestart",this._onSBUpdateStart),this.addBufferListener(T,"updateend",this._onSBUpdateEnd),this.addBufferListener(T,"error",this._onSBUpdateError),this.tracks[S]={buffer:w,codec:O,container:x.container,levelCodec:x.levelCodec,id:x.id},L++}catch(_){F.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+_.message),this.hls.trigger(B.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:_,mimeType:C})}}L&&this.hls.trigger(B.Events.BUFFER_CREATED,{tracks:this.tracks})},c._onSBUpdateStart=function(n){var o=this.operationQueue,h=o.current(n);h.onStart()},c._onSBUpdateEnd=function(n){var o=this.operationQueue,h=o.current(n);h.onComplete(),o.shiftAndExecuteNext(n)},c._onSBUpdateError=function(n,o){F.logger.error("[buffer-controller]: "+n+" SourceBuffer error",o),this.hls.trigger(B.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var h=this.operationQueue.current(n);h&&h.onError(o)},c.removeExecutor=function(n,o,h){var L=this.media,S=this.mediaSource,x=this.operationQueue,O=this.sourceBuffer,C=O[n];if(!L||!S||!C){F.logger.warn("[buffer-controller]: Attempting to remove from the "+n+" SourceBuffer, but it does not exist"),x.shiftAndExecuteNext(n);return}var w=Object(Q.isFiniteNumber)(L.duration)?L.duration:Infinity,T=Object(Q.isFiniteNumber)(S.duration)?S.duration:Infinity,_=Math.max(0,o),u=Math.min(h,w,T);u>_?(F.logger.log("[buffer-controller]: Removing ["+_+","+u+"] from the "+n+" SourceBuffer"),console.assert(!C.updating,n+" sourceBuffer must not be updating"),C.remove(_,u)):x.shiftAndExecuteNext(n)},c.appendExecutor=function(n,o){var h=this.operationQueue,L=this.sourceBuffer,S=L[o];if(!S){F.logger.warn("[buffer-controller]: Attempting to append to the "+o+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(o);return}S.ended=!1,console.assert(!S.updating,o+" sourceBuffer must not be updating"),S.appendBuffer(n)},c.blockBuffers=function(n,o){var h=this;if(o===void 0&&(o=this.getSourceBufferTypes()),!o.length){F.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(n);return}var L=this.operationQueue,S=o.map(function(x){return L.appendBlocker(x)});Promise.all(S).then(function(){n(),o.forEach(function(x){var O=h.sourceBuffer[x];(!O||!O.updating)&&L.shiftAndExecuteNext(x)})})},c.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},c.addBufferListener=function(n,o,h){var L=this.sourceBuffer[n];if(!L)return;var S=h.bind(this,n);this.listeners[n].push({event:o,listener:S}),L.addEventListener(o,S)},c.removeBufferListeners=function(n){var o=this.sourceBuffer[n];if(!o)return;this.listeners[n].forEach(function(h){o.removeEventListener(h.event,h.listener)})},s}()},"./src/controller/buffer-operation-queue.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return B});var Q=P("./src/utils/logger.ts"),B=function(){function F(G){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=G}var K=F.prototype;return K.append=function(M,R){var g=this.queues[R];g.push(M),g.length===1&&this.buffers[R]&&this.executeNext(R)},K.insertAbort=function(M,R){var g=this.queues[R];g.unshift(M),this.executeNext(R)},K.appendBlocker=function(M){var R,g=new Promise(function(f){R=f}),p={execute:R,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(p,M),g},K.executeNext=function(M){var R=this.buffers,g=this.queues,p=R[M],f=g[M];if(f.length){var d=f[0];try{d.execute()}catch(s){Q.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),d.onError(s),(!p||!p.updating)&&(f.shift(),this.executeNext(M))}}},K.shiftAndExecuteNext=function(M){this.queues[M].shift(),this.executeNext(M)},K.current=function(M){return this.queues[M][0]},F}()},"./src/controller/cap-level-controller.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/events.ts");function B(G,M){for(var R=0;R<M.length;R++){var g=M[R];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(G,g.key,g)}}function F(G,M,R){return M&&B(G.prototype,M),R&&B(G,R),G}var K=function(){function G(R){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=R,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var M=G.prototype;return M.setStreamController=function(g){this.streamController=g},M.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},M.registerListeners=function(){var g=this.hls;g.on(Q.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.on(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.on(Q.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},M.unregisterListener=function(){var g=this.hls;g.off(Q.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.off(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.off(Q.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},M.onFpsDropLevelCapping=function(g,p){G.isLevelAllowed(p.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(p.droppedLevel)},M.onMediaAttaching=function(g,p){this.media=p.media instanceof HTMLVideoElement?p.media:null},M.onManifestParsed=function(g,p){var f=this.hls;this.restrictedLevels=[],this.firstLevel=p.firstLevel,f.config.capLevelToPlayerSize&&p.video&&this.startCapping()},M.onBufferCodecs=function(g,p){var f=this.hls;f.config.capLevelToPlayerSize&&p.video&&this.startCapping()},M.onMediaDetaching=function(){this.stopCapping()},M.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var g=this.hls.levels;if(g.length){var p=this.hls;p.autoLevelCapping=this.getMaxLevel(g.length-1),p.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=p.autoLevelCapping}}},M.getMaxLevel=function(g){var p=this,f=this.hls.levels;if(!f.length)return-1;var d=f.filter(function(s,c){return G.isLevelAllowed(c,p.restrictedLevels)&&c<=g});return this.clientRect=null,G.getMaxLevelByMediaSize(d,this.mediaWidth,this.mediaHeight)},M.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},M.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},M.getDimensions=function(){if(this.clientRect)return this.clientRect;var g=this.media,p={width:0,height:0};if(g){var f=g.getBoundingClientRect();p.width=f.width,p.height=f.height,!p.width&&!p.height&&(p.width=f.right-f.left||g.width||0,p.height=f.bottom-f.top||g.height||0)}return this.clientRect=p,p},G.isLevelAllowed=function(g,p){return p===void 0&&(p=[]),p.indexOf(g)===-1},G.getMaxLevelByMediaSize=function(g,p,f){if(!g||!g.length)return-1;for(var d=function(o,h){return h?o.width!==h.width||o.height!==h.height:!0},s=g.length-1,c=0;c<g.length;c+=1){var l=g[c];if((l.width>=p||l.height>=f)&&d(l,g[c+1])){s=c;break}}return s},F(G,[{key:"mediaWidth",get:function(){return this.getDimensions().width*G.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*G.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var g=1;try{g=self.devicePixelRatio}catch(p){}return g}}]),G}();Z.default=K},"./src/controller/cmcd-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return d});var Q=P("./src/events.ts"),B=P("./src/types/cmcd.ts"),F=P("./src/utils/buffer-helper.ts"),K=P("./src/utils/logger.ts");function G(s,c){for(var l=0;l<c.length;l++){var n=c[l];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(s,n.key,n)}}function M(s,c,l){return c&&G(s.prototype,c),l&&G(s,l),s}function R(s,c){var l=typeof Symbol!="undefined"&&s[Symbol.iterator]||s["@@iterator"];if(l)return(l=l.call(s)).next.bind(l);if(Array.isArray(s)||(l=g(s))||c&&s&&typeof s.length=="number"){l&&(s=l);var n=0;return function(){return n>=s.length?{done:!0}:{done:!1,value:s[n++]}}}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 g(s,c){if(!s)return;if(typeof s=="string")return p(s,c);var l=Object.prototype.toString.call(s).slice(8,-1);if(l==="Object"&&s.constructor&&(l=s.constructor.name),l==="Map"||l==="Set")return Array.from(s);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return p(s,c)}function p(s,c){(c==null||c>s.length)&&(c=s.length);for(var l=0,n=new Array(c);l<c;l++)n[l]=s[l];return n}function f(){return f=Object.assign||function(s){for(var c=1;c<arguments.length;c++){var l=arguments[c];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(s[n]=l[n])}return s},f.apply(this,arguments)}var d=function(){function s(l){var n=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(){n.initialized&&(n.starved=!0),n.buffering=!0},this.onPlaying=function(){n.initialized||(n.initialized=!0),n.buffering=!1},this.applyPlaylistData=function(L){try{n.apply(L,{ot:B.CMCDObjectType.MANIFEST,su:!n.initialized})}catch(S){K.logger.warn("Could not generate manifest CMCD data.",S)}},this.applyFragmentData=function(L){try{var S=L.frag,x=n.hls.levels[S.level],O=n.getObjectType(S),C={d:S.duration*1e3,ot:O};(O===B.CMCDObjectType.VIDEO||O===B.CMCDObjectType.AUDIO||O==B.CMCDObjectType.MUXED)&&(C.br=x.bitrate/1e3,C.tb=n.getTopBandwidth(O),C.bl=n.getBufferLength(O)),n.apply(L,C)}catch(w){K.logger.warn("Could not generate segment CMCD data.",w)}},this.hls=l;var o=this.config=l.config,h=o.cmcd;h!=null&&(o.pLoader=this.createPlaylistLoader(),o.fLoader=this.createFragmentLoader(),this.sid=h.sessionId||s.uuid(),this.cid=h.contentId,this.useHeaders=h.useHeaders===!0,this.registerListeners())}var c=s.prototype;return c.registerListeners=function(){var n=this.hls;n.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),n.on(Q.Events.BUFFER_CREATED,this.onBufferCreated,this)},c.unregisterListeners=function(){var n=this.hls;n.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),n.off(Q.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},c.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},c.onMediaAttached=function(n,o){this.media=o.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},c.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},c.onBufferCreated=function(n,o){var h,L;this.audioBuffer=(h=o.tracks.audio)===null||h===void 0?void 0:h.buffer,this.videoBuffer=(L=o.tracks.video)===null||L===void 0?void 0:L.buffer},c.createData=function(){var n;return{v:B.CMCDVersion,sf:B.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(n=this.media)===null||n===void 0?void 0:n.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},c.apply=function(n,o){o===void 0&&(o={}),f(o,this.createData());var h=o.ot===B.CMCDObjectType.INIT||o.ot===B.CMCDObjectType.VIDEO||o.ot===B.CMCDObjectType.MUXED;if(this.starved&&h&&(o.bs=!0,o.su=!0,this.starved=!1),o.su==null&&(o.su=this.buffering),this.useHeaders){var L=s.toHeaders(o);if(!Object.keys(L).length)return;n.headers||(n.headers={}),f(n.headers,L)}else{var S=s.toQuery(o);if(!S)return;n.url=s.appendQueryToUri(n.url,S)}},c.getObjectType=function(n){var o=n.type;return o==="subtitle"?B.CMCDObjectType.TIMED_TEXT:n.sn==="initSegment"?B.CMCDObjectType.INIT:o==="audio"?B.CMCDObjectType.AUDIO:o==="main"?this.hls.audioTracks.length?B.CMCDObjectType.VIDEO:B.CMCDObjectType.MUXED:void 0},c.getTopBandwidth=function(n){for(var o=0,h=n===B.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,L=R(h),S;!(S=L()).done;){var x=S.value;x.bitrate>o&&(o=x.bitrate)}return o>0?o:NaN},c.getBufferLength=function(n){var o=this.hls.media,h=n===B.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!h||!o)return NaN;var L=F.BufferHelper.bufferInfo(h,o.currentTime,this.config.maxBufferHole);return L.len*1e3},c.createPlaylistLoader=function(){var n=this.config.pLoader,o=this.applyPlaylistData,h=n||this.config.loader;return function(){function L(x){this.loader=void 0,this.loader=new h(x)}var S=L.prototype;return S.destroy=function(){this.loader.destroy()},S.abort=function(){this.loader.abort()},S.load=function(O,C,w){o(O),this.loader.load(O,C,w)},M(L,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),L}()},c.createFragmentLoader=function(){var n=this.config.fLoader,o=this.applyFragmentData,h=n||this.config.loader;return function(){function L(x){this.loader=void 0,this.loader=new h(x)}var S=L.prototype;return S.destroy=function(){this.loader.destroy()},S.abort=function(){this.loader.abort()},S.load=function(O,C,w){o(O),this.loader.load(O,C,w)},M(L,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),L}()},s.uuid=function(){var n=URL.createObjectURL(new Blob),o=n.toString();return URL.revokeObjectURL(n),o.substr(o.lastIndexOf("/")+1)},s.serialize=function(n){for(var o=[],h=function(D){return!Number.isNaN(D)&&D!=null&&D!==""&&D!==!1},L=function(D){return Math.round(D)},S=function(D){return L(D/100)*100},x=function(D){return encodeURIComponent(D)},O={br:L,d:L,bl:S,dl:S,mtp:S,nor:x,rtp:S,tb:L},C=Object.keys(n||{}).sort(),w=R(C),T;!(T=w()).done;){var _=T.value,u=n[_];if(!h(u))continue;if(_==="v"&&u===1)continue;if(_=="pr"&&u===1)continue;var E=O[_];E&&(u=E(u));var m=typeof u,b=void 0;_==="ot"||_==="sf"||_==="st"?b=_+"="+u:m==="boolean"?b=_:m==="number"?b=_+"="+u:b=_+"="+JSON.stringify(u),o.push(b)}return o.join(",")},s.toHeaders=function(n){for(var o=Object.keys(n),h={},L=["Object","Request","Session","Status"],S=[{},{},{},{}],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,C=o;O<C.length;O++){var w=C[O],T=x[w]!=null?x[w]:1;S[T][w]=n[w]}for(var _=0;_<S.length;_++){var u=s.serialize(S[_]);u&&(h["CMCD-"+L[_]]=u)}return h},s.toQuery=function(n){return"CMCD="+encodeURIComponent(s.serialize(n))},s.appendQueryToUri=function(n,o){if(!o)return n;var h=n.includes("?")?"&":"?";return""+n+h+o},s}()},"./src/controller/eme-controller.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/events.ts"),B=P("./src/errors.ts"),F=P("./src/utils/logger.ts"),K=P("./src/utils/mediakeys-helper.ts");function G(d,s){for(var c=0;c<s.length;c++){var l=s[c];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(d,l.key,l)}}function M(d,s,c){return s&&G(d.prototype,s),c&&G(d,c),d}var R=3,g=function(s,c,l){var n={audioCapabilities:[],videoCapabilities:[]};return s.forEach(function(o){n.audioCapabilities.push({contentType:'audio/mp4; codecs="'+o+'"',robustness:l.audioRobustness||""})}),c.forEach(function(o){n.videoCapabilities.push({contentType:'video/mp4; codecs="'+o+'"',robustness:l.videoRobustness||""})}),[n]},p=function(s,c,l,n){switch(s){case K.KeySystems.WIDEVINE:return g(c,l,n);default:throw new Error("Unknown key-system: "+s)}},f=function(){function d(c){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=c,this._config=c.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var s=d.prototype;return s.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},s._registerListeners=function(){this.hls.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this)},s._unregisterListeners=function(){this.hls.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this)},s.getLicenseServerUrl=function(l){switch(l){case K.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+l+'"')},s._attemptKeySystemAccess=function(l,n,o){var h=this,L=p(l,n,o,this._drmSystemOptions);F.logger.log("Requesting encrypted media key-system access");var S=this.requestMediaKeySystemAccess(l,L);this.mediaKeysPromise=S.then(function(x){return h._onMediaKeySystemAccessObtained(l,x)}),S.catch(function(x){F.logger.error('Failed to obtain key-system "'+l+'" access:',x)})},s._onMediaKeySystemAccessObtained=function(l,n){var o=this;F.logger.log('Access for key-system "'+l+'" obtained');var h={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:n,mediaKeySystemDomain:l};this._mediaKeysList.push(h);var L=Promise.resolve().then(function(){return n.createMediaKeys()}).then(function(S){return h.mediaKeys=S,F.logger.log('Media-keys created for key-system "'+l+'"'),o._onMediaKeysCreated(),S});return L.catch(function(S){F.logger.error("Failed to create media-keys:",S)}),L},s._onMediaKeysCreated=function(){var l=this;this._mediaKeysList.forEach(function(n){n.mediaKeysSession||(n.mediaKeysSession=n.mediaKeys.createSession(),l._onNewMediaKeySession(n.mediaKeysSession))})},s._onNewMediaKeySession=function(l){var n=this;F.logger.log("New key-system session "+l.sessionId),l.addEventListener("message",function(o){n._onKeySessionMessage(l,o.message)},!1)},s._onKeySessionMessage=function(l,n){F.logger.log("Got EME message event, creating license request"),this._requestLicense(n,function(o){F.logger.log("Received license data (length: "+(o&&o.byteLength)+"), updating key-session"),l.update(o)})},s.onMediaEncrypted=function(l){var n=this;if(F.logger.log('Media is encrypted using "'+l.initDataType+'" init data type'),!this.mediaKeysPromise){F.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var o=function(L){if(!n._media)return;n._attemptSetMediaKeys(L),n._generateRequestWithPreferredKeySession(l.initDataType,l.initData)};this.mediaKeysPromise.then(o).catch(o)},s._attemptSetMediaKeys=function(l){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var n=this._mediaKeysList[0];if(!n||!n.mediaKeys){F.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}F.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(n.mediaKeys),this._hasSetMediaKeys=!0}},s._generateRequestWithPreferredKeySession=function(l,n){var o=this,h=this._mediaKeysList[0];if(!h){F.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(h.mediaKeysSessionInitialized){F.logger.warn("Key-Session already initialized but requested again");return}var L=h.mediaKeysSession;if(!L){F.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!n){F.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}F.logger.log('Generating key-session request for "'+l+'" init data type'),h.mediaKeysSessionInitialized=!0,L.generateRequest(l,n).then(function(){F.logger.debug("Key-session generation succeeded")}).catch(function(S){F.logger.error("Error generating key-session request:",S),o.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},s._createLicenseXhr=function(l,n,o){var h=new XMLHttpRequest;h.responseType="arraybuffer",h.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,h,l,n,o);var L=this._licenseXhrSetup;if(L)try{L.call(this.hls,h,l),L=void 0}catch(S){F.logger.error(S)}try{h.readyState||h.open("POST",l,!0),L&&L.call(this.hls,h,l)}catch(S){throw new Error("issue setting up KeySystem license XHR "+S)}return h},s._onLicenseRequestReadyStageChange=function(l,n,o,h){switch(l.readyState){case 4:if(l.status===200){this._requestLicenseFailureCount=0,F.logger.log("License request succeeded");var L=l.response,S=this._licenseResponseCallback;if(S)try{L=S.call(this.hls,l,n)}catch(O){F.logger.error(O)}h(L)}else{if(F.logger.error("License Request XHR failed ("+n+"). Status: "+l.status+" ("+l.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>R){this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var x=R-this._requestLicenseFailureCount+1;F.logger.warn("Retrying license request, "+x+" attempts left"),this._requestLicense(o,h)}break}},s._generateLicenseRequestChallenge=function(l,n){switch(l.mediaKeySystemDomain){case K.KeySystems.WIDEVINE:return n}throw new Error("unsupported key-system: "+l.mediaKeySystemDomain)},s._requestLicense=function(l,n){F.logger.log("Requesting content license for key-system");var o=this._mediaKeysList[0];if(!o){F.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var h=this.getLicenseServerUrl(o.mediaKeySystemDomain),L=this._createLicenseXhr(h,l,n);F.logger.log("Sending license request to URL: "+h);var S=this._generateLicenseRequestChallenge(o,l);L.send(S)}catch(x){F.logger.error("Failure requesting DRM license: "+x),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},s.onMediaAttached=function(l,n){if(!this._emeEnabled)return;var o=n.media;this._media=o,o.addEventListener("encrypted",this._onMediaEncrypted)},s.onMediaDetached=function(){var l=this._media,n=this._mediaKeysList;if(!l)return;l.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(n.map(function(o){if(o.mediaKeysSession)return o.mediaKeysSession.close().catch(function(){})})).then(function(){return l.setMediaKeys(null)}).catch(function(){})},s.onManifestParsed=function(l,n){if(!this._emeEnabled)return;var o=n.levels.map(function(L){return L.audioCodec}).filter(function(L){return!!L}),h=n.levels.map(function(L){return L.videoCodec}).filter(function(L){return!!L});this._attemptKeySystemAccess(K.KeySystems.WIDEVINE,o,h)},M(d,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),d}();Z.default=f},"./src/controller/fps-controller.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/events.ts"),B=P("./src/utils/logger.ts"),F=function(){function K(M){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=M,this.registerListeners()}var G=K.prototype;return G.setStreamController=function(R){this.streamController=R},G.registerListeners=function(){this.hls.on(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},G.unregisterListeners=function(){this.hls.off(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching)},G.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},G.onMediaAttaching=function(R,g){var p=this.hls.config;if(p.capLevelOnFPSDrop){var f=g.media instanceof self.HTMLVideoElement?g.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),p.fpsDroppedMonitoringPeriod)}},G.checkFPS=function(R,g,p){var f=performance.now();if(g){if(this.lastTime){var d=f-this.lastTime,s=p-this.lastDroppedFrames,c=g-this.lastDecodedFrames,l=1e3*s/d,n=this.hls;if(n.trigger(Q.Events.FPS_DROP,{currentDropped:s,currentDecoded:c,totalDroppedFrames:p}),l>0&&s>n.config.fpsDroppedMonitoringThreshold*c){var o=n.currentLevel;B.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+o),o>0&&(n.autoLevelCapping===-1||n.autoLevelCapping>=o)&&(o=o-1,n.trigger(Q.Events.FPS_DROP_LEVEL_CAPPING,{level:o,droppedLevel:n.currentLevel}),n.autoLevelCapping=o,this.streamController.nextLevelSwitch())}}this.lastTime=f,this.lastDroppedFrames=p,this.lastDecodedFrames=g}},G.checkFPSInterval=function(){var R=this.media;if(R)if(this.isVideoPlaybackQualityAvailable){var g=R.getVideoPlaybackQuality();this.checkFPS(R,g.totalVideoFrames,g.droppedVideoFrames)}else this.checkFPS(R,R.webkitDecodedFrameCount,R.webkitDroppedFrameCount)},K}();Z.default=F},"./src/controller/fragment-finders.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"findFragmentByPDT",function(){return F}),P.d(Z,"findFragmentByPTS",function(){return K}),P.d(Z,"fragmentWithinToleranceTest",function(){return G}),P.d(Z,"pdtWithinToleranceTest",function(){return M}),P.d(Z,"findFragWithCC",function(){return R});var Q=P("./src/polyfills/number.ts"),B=P("./src/utils/binary-search.ts");function F(g,p,f){if(p===null||!Array.isArray(g)||!g.length||!Object(Q.isFiniteNumber)(p))return null;var d=g[0].programDateTime;if(p<(d||0))return null;var s=g[g.length-1].endProgramDateTime;if(p>=(s||0))return null;f=f||0;for(var c=0;c<g.length;++c){var l=g[c];if(M(p,f,l))return l}return null}function K(g,p,f,d){f===void 0&&(f=0),d===void 0&&(d=0);var s=null;if(g?s=p[g.sn-p[0].sn+1]||null:f===0&&p[0].start===0&&(s=p[0]),s&&G(f,d,s)===0)return s;var c=B.default.search(p,G.bind(null,f,d));return c||s}function G(g,p,f){g===void 0&&(g=0),p===void 0&&(p=0);var d=Math.min(p,f.duration+(f.deltaPTS?f.deltaPTS:0));return f.start+f.duration-d<=g?1:f.start-d>g&&f.start?-1:0}function M(g,p,f){var d=Math.min(p,f.duration+(f.deltaPTS?f.deltaPTS:0))*1e3,s=f.endProgramDateTime||0;return s-d>g}function R(g,p){return B.default.search(g,function(f){return f.cc<p?1:f.cc>p?-1:0})}},"./src/controller/fragment-tracker.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"FragmentState",function(){return F}),P.d(Z,"FragmentTracker",function(){return K});var Q=P("./src/events.ts"),B=P("./src/types/loader.ts"),F;(function(R){R.NOT_LOADED="NOT_LOADED",R.BACKTRACKED="BACKTRACKED",R.APPENDING="APPENDING",R.PARTIAL="PARTIAL",R.OK="OK"})(F||(F={}));var K=function(){function R(p){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=p,this._registerListeners()}var g=R.prototype;return g._registerListeners=function(){var f=this.hls;f.on(Q.Events.BUFFER_APPENDED,this.onBufferAppended,this),f.on(Q.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.on(Q.Events.FRAG_LOADED,this.onFragLoaded,this)},g._unregisterListeners=function(){var f=this.hls;f.off(Q.Events.BUFFER_APPENDED,this.onBufferAppended,this),f.off(Q.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.off(Q.Events.FRAG_LOADED,this.onFragLoaded,this)},g.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},g.getAppendedFrag=function(f,d){if(d===B.PlaylistLevelType.MAIN){var s=this.activeFragment,c=this.activeParts;if(!s)return null;if(c)for(var l=c.length;l--;){var n=c[l],o=n?n.end:s.appendedPTS;if(n.start<=f&&o!==void 0&&f<=o)return l>9&&(this.activeParts=c.slice(l-9)),n}else if(s.start<=f&&s.appendedPTS!==void 0&&f<=s.appendedPTS)return s}return this.getBufferedFrag(f,d)},g.getBufferedFrag=function(f,d){for(var s=this.fragments,c=Object.keys(s),l=c.length;l--;){var n=s[c[l]];if((n==null?void 0:n.body.type)===d&&n.buffered){var o=n.body;if(o.start<=f&&f<=o.end)return o}}return null},g.detectEvictedFragments=function(f,d,s){var c=this;Object.keys(this.fragments).forEach(function(l){var n=c.fragments[l];if(!n)return;if(!n.buffered){n.body.type===s&&c.removeFragment(n.body);return}var o=n.range[f];if(!o)return;o.time.some(function(h){var L=!c.isTimeBuffered(h.startPTS,h.endPTS,d);return L&&c.removeFragment(n.body),L})})},g.detectPartialFragments=function(f){var d=this,s=this.timeRanges,c=f.frag,l=f.part;if(!s||c.sn==="initSegment")return;var n=M(c),o=this.fragments[n];if(!o)return;Object.keys(s).forEach(function(h){var L=c.elementaryStreams[h];if(!L)return;var S=s[h],x=l!==null||L.partial===!0;o.range[h]=d.getBufferedTimes(c,l,x,S)}),o.backtrack=o.loaded=null,Object.keys(o.range).length?o.buffered=!0:this.removeFragment(o.body)},g.fragBuffered=function(f){var d=M(f),s=this.fragments[d];s&&(s.backtrack=s.loaded=null,s.buffered=!0)},g.getBufferedTimes=function(f,d,s,c){for(var l={time:[],partial:s},n=d?d.start:f.start,o=d?d.end:f.end,h=f.minEndPTS||o,L=f.maxStartPTS||n,S=0;S<c.length;S++){var x=c.start(S)-this.bufferPadding,O=c.end(S)+this.bufferPadding;if(L>=x&&h<=O){l.time.push({startPTS:Math.max(n,c.start(S)),endPTS:Math.min(o,c.end(S))});break}else if(n<O&&o>x)l.partial=!0,l.time.push({startPTS:Math.max(n,c.start(S)),endPTS:Math.min(o,c.end(S))});else if(o<=x)break}return l},g.getPartialFragment=function(f){var d=null,s,c,l,n=0,o=this.bufferPadding,h=this.fragments;return Object.keys(h).forEach(function(L){var S=h[L];if(!S)return;G(S)&&(c=S.body.start-o,l=S.body.end+o,f>=c&&f<=l&&(s=Math.min(f-c,l-f),n<=s&&(d=S.body,n=s)))}),d},g.getState=function(f){var d=M(f),s=this.fragments[d];return s?s.buffered?G(s)?F.PARTIAL:F.OK:s.backtrack?F.BACKTRACKED:F.APPENDING:F.NOT_LOADED},g.backtrack=function(f,d){var s=M(f),c=this.fragments[s];if(!c||c.backtrack)return null;var l=c.backtrack=d||c.loaded;return c.loaded=null,l},g.getBacktrackData=function(f){var d=M(f),s=this.fragments[d];if(s){var c,l=s.backtrack;if(l!=null&&(c=l.payload)!==null&&c!==void 0&&c.byteLength)return l;this.removeFragment(f)}return null},g.isTimeBuffered=function(f,d,s){for(var c,l,n=0;n<s.length;n++){if(c=s.start(n)-this.bufferPadding,l=s.end(n)+this.bufferPadding,f>=c&&d<=l)return!0;if(d<=c)return!1}return!1},g.onFragLoaded=function(f,d){var s=d.frag,c=d.part;if(s.sn==="initSegment"||s.bitrateTest||c)return;var l=M(s);this.fragments[l]={body:s,loaded:d,backtrack:null,buffered:!1,range:Object.create(null)}},g.onBufferAppended=function(f,d){var s=this,c=d.frag,l=d.part,n=d.timeRanges;if(c.type===B.PlaylistLevelType.MAIN)if(this.activeFragment=c,l){var o=this.activeParts;o||(this.activeParts=o=[]),o.push(l)}else this.activeParts=null;this.timeRanges=n,Object.keys(n).forEach(function(h){var L=n[h];if(s.detectEvictedFragments(h,L),!l)for(var S=0;S<L.length;S++)c.appendedPTS=Math.max(L.end(S),c.appendedPTS||0)})},g.onFragBuffered=function(f,d){this.detectPartialFragments(d)},g.hasFragment=function(f){var d=M(f);return!!this.fragments[d]},g.removeFragmentsInRange=function(f,d,s){var c=this;Object.keys(this.fragments).forEach(function(l){var n=c.fragments[l];if(!n)return;if(n.buffered){var o=n.body;o.type===s&&o.start<d&&o.end>f&&c.removeFragment(o)}})},g.removeFragment=function(f){var d=M(f);f.stats.loaded=0,f.clearElementaryStreamInfo(),delete this.fragments[d]},g.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},R}();function G(R){var g,p;return R.buffered&&(((g=R.range.video)===null||g===void 0?void 0:g.partial)||((p=R.range.audio)===null||p===void 0?void 0:p.partial))}function M(R){return R.type+"_"+R.level+"_"+R.urlId+"_"+R.sn}},"./src/controller/gap-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"STALL_MINIMUM_DURATION_MS",function(){return G}),P.d(Z,"MAX_START_GAP_JUMP",function(){return M}),P.d(Z,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return R}),P.d(Z,"SKIP_BUFFER_RANGE_START",function(){return g}),P.d(Z,"default",function(){return p});var Q=P("./src/utils/buffer-helper.ts"),B=P("./src/errors.ts"),F=P("./src/events.ts"),K=P("./src/utils/logger.ts"),G=250,M=2,R=.1,g=.05,p=function(){function f(s,c,l,n){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=s,this.media=c,this.fragmentTracker=l,this.hls=n}var d=f.prototype;return d.destroy=function(){this.hls=this.fragmentTracker=this.media=null},d.poll=function(c){var l=this.config,n=this.media,o=this.stalled,h=n.currentTime,L=n.seeking,S=this.seeking&&!L,x=!this.seeking&&L;if(this.seeking=L,h!==c){if(this.moved=!0,o!==null){if(this.stallReported){var O=self.performance.now()-o;K.logger.warn("playback not stuck anymore @"+h+", after "+Math.round(O)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((x||S)&&(this.stalled=null),n.paused||n.ended||n.playbackRate===0||!Q.BufferHelper.getBuffered(n).length)return;var C=Q.BufferHelper.bufferInfo(n,h,0),w=C.len>0,T=C.nextStart||0;if(!w&&!T)return;if(L){var _=C.len>M,u=!T||T-h>M&&!this.fragmentTracker.getPartialFragment(h);if(_||u)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var E,m=Math.max(T,C.start||0)-h,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,N=b==null||((E=b.details)===null||E===void 0)?void 0:E.live,D=N?b.details.targetduration*2:M;if(m>0&&m<=D){this._trySkipBufferHole(null);return}}var H=self.performance.now();if(o===null){this.stalled=H;return}var j=H-o;!L&&j>=G&&this._reportStall(C.len);var I=Q.BufferHelper.bufferInfo(n,h,l.maxBufferHole);this._tryFixBufferStall(I,j)},d._tryFixBufferStall=function(c,l){var n=this.config,o=this.fragmentTracker,h=this.media,L=h.currentTime,S=o.getPartialFragment(L);if(S){var x=this._trySkipBufferHole(S);if(x)return}c.len>n.maxBufferHole&&l>n.highBufferWatchdogPeriod*1e3&&(K.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},d._reportStall=function(c){var l=this.hls,n=this.media,o=this.stallReported;o||(this.stallReported=!0,K.logger.warn("Playback stalling at @"+n.currentTime+" due to low buffer (buffer="+c+")"),l.trigger(F.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:c}))},d._trySkipBufferHole=function(c){for(var l=this.config,n=this.hls,o=this.media,h=o.currentTime,L=0,S=Q.BufferHelper.getBuffered(o),x=0;x<S.length;x++){var O=S.start(x);if(h+l.maxBufferHole>=L&&h<O){var C=Math.max(O+g,o.currentTime+R);return K.logger.warn("skipping hole, adjusting currentTime from "+h+" to "+C),this.moved=!0,this.stalled=null,o.currentTime=C,c&&n.trigger(F.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+h+" to "+C,frag:c}),C}L=S.end(x)}return 0},d._tryNudgeBuffer=function(){var c=this.config,l=this.hls,n=this.media,o=n.currentTime,h=(this.nudgeRetry||0)+1;if(this.nudgeRetry=h,h<c.nudgeMaxRetry){var L=o+h*c.nudgeOffset;K.logger.warn("Nudging 'currentTime' from "+o+" to "+L),n.currentTime=L,l.trigger(F.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else K.logger.error("Playhead still not moving while enough data buffered @"+o+" after "+c.nudgeMaxRetry+" nudges"),l.trigger(F.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},f}()},"./src/controller/id3-track-controller.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/events.ts"),B=P("./src/utils/texttrack-utils.ts"),F=P("./src/demux/id3.ts"),K=.25,G=function(){function M(g){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=g,this._registerListeners()}var R=M.prototype;return R.destroy=function(){this._unregisterListeners()},R._registerListeners=function(){var p=this.hls;p.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(Q.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.on(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R._unregisterListeners=function(){var p=this.hls;p.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(Q.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.off(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R.onMediaAttached=function(p,f){this.media=f.media},R.onMediaDetaching=function(){if(!this.id3Track)return;Object(B.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},R.getID3Track=function(p){if(!this.media)return;for(var f=0;f<p.length;f++){var d=p[f];if(d.kind==="metadata"&&d.label==="id3")return Object(B.sendAddTrackEvent)(d,this.media),d}return this.media.addTextTrack("metadata","id3")},R.onFragParsingMetadata=function(p,f){if(!this.media)return;var d=f.frag,s=f.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var c=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,l=0;l<s.length;l++){var n=F.getID3Frames(s[l].data);if(n){var o=s[l].pts,h=l<s.length-1?s[l+1].pts:d.end,L=h-o;L<=0&&(h=o+K);for(var S=0;S<n.length;S++){var x=n[S];if(!F.isTimeStampFrame(x)){var O=new c(o,h,"");O.value=x,this.id3Track.addCue(O)}}}}},R.onBufferFlushing=function(p,f){var d=f.startOffset,s=f.endOffset,c=f.type;if(!c||c==="audio"){var l=this.id3Track;l&&Object(B.removeCuesInRange)(l,d,s)}},M}();Z.default=G},"./src/controller/latency-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return M});var Q=P("./src/errors.ts"),B=P("./src/events.ts"),F=P("./src/utils/logger.ts");function K(R,g){for(var p=0;p<g.length;p++){var f=g[p];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(R,f.key,f)}}function G(R,g,p){return g&&K(R.prototype,g),p&&K(R,p),R}var M=function(){function R(p){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=p,this.config=p.config,this.registerListeners()}var g=R.prototype;return g.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},g.registerListeners=function(){this.hls.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(B.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){this.hls.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(B.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(B.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(B.Events.ERROR,this.onError)},g.onMediaAttached=function(f,d){this.media=d.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},g.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},g.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},g.onLevelUpdated=function(f,d){var s=d.details;this.levelDetails=s,s.advanced&&this.timeupdate(),!s.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},g.onError=function(f,d){if(d.details!==Q.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,F.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},g.timeupdate=function(){var f=this.media,d=this.levelDetails;if(!f||!d)return;this.currentTime=f.currentTime;var s=this.computeLatency();if(s===null)return;this._latency=s;var c=this.config,l=c.lowLatencyMode,n=c.maxLiveSyncPlaybackRate;if(!l||n===1)return;var o=this.targetLatency;if(o===null)return;var h=s-o,L=Math.min(this.maxLatency,o+d.targetduration),S=h<L;if(d.live&&S&&h>.05&&this.forwardBufferLength>1){var x=Math.min(2,Math.max(1,n)),O=Math.round(2/(1+Math.exp(-.75*h-this.edgeStalled))*20)/20;f.playbackRate=Math.min(x,Math.max(1,O))}else f.playbackRate!==1&&f.playbackRate!==0&&(f.playbackRate=1)},g.estimateLiveEdge=function(){var f=this.levelDetails;return f===null?null:f.edge+f.age},g.computeLatency=function(){var f=this.estimateLiveEdge();return f===null?null:f-this.currentTime},G(R,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var f=this.config,d=this.levelDetails;return f.liveMaxLatencyDuration!==void 0?f.liveMaxLatencyDuration:d?f.liveMaxLatencyDurationCount*d.targetduration:0}},{key:"targetLatency",get:function(){var f=this.levelDetails;if(f===null)return null;var d=f.holdBack,s=f.partHoldBack,c=f.targetduration,l=this.config,n=l.liveSyncDuration,o=l.liveSyncDurationCount,h=l.lowLatencyMode,L=this.hls.userConfig,S=h&&s||d;(L.liveSyncDuration||L.liveSyncDurationCount||S===0)&&(S=n!==void 0?n:o*c);var x=c,O=1;return S+Math.min(this.stallCount*O,x)}},{key:"liveSyncPosition",get:function(){var f=this.estimateLiveEdge(),d=this.targetLatency,s=this.levelDetails;if(f===null||d===null||s===null)return null;var c=s.edge,l=f-d-this.edgeStalled,n=c-s.totalduration,o=c-(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(n,l),o)}},{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 d=(this.config.lowLatencyMode&&f.partTarget||f.targetduration)*3;return Math.max(f.age-d,0)}},{key:"forwardBufferLength",get:function(){var f=this.media,d=this.levelDetails;if(!f||!d)return 0;var s=f.buffered.length;return s?f.buffered.end(s-1):d.edge-this.currentTime}}]),R}()},"./src/controller/level-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return l});var Q=P("./src/types/level.ts"),B=P("./src/events.ts"),F=P("./src/errors.ts"),K=P("./src/utils/codecs.ts"),G=P("./src/controller/level-helper.ts"),M=P("./src/controller/base-playlist-controller.ts"),R=P("./src/types/loader.ts");function g(){return g=Object.assign||function(n){for(var o=1;o<arguments.length;o++){var h=arguments[o];for(var L in h)Object.prototype.hasOwnProperty.call(h,L)&&(n[L]=h[L])}return n},g.apply(this,arguments)}function p(n,o){for(var h=0;h<o.length;h++){var L=o[h];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(n,L.key,L)}}function f(n,o,h){return o&&p(n.prototype,o),h&&p(n,h),n}function d(n,o){n.prototype=Object.create(o.prototype),n.prototype.constructor=n,s(n,o)}function s(n,o){return s=Object.setPrototypeOf||function(L,S){return L.__proto__=S,L},s(n,o)}var c=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),l=function(n){d(o,n);function o(L){var S;return S=n.call(this,L,"[level-controller]")||this,S._levels=[],S._firstLevel=-1,S._startLevel=void 0,S.currentLevelIndex=-1,S.manualLevelIndex=-1,S.onParsedComplete=void 0,S._registerListeners(),S}var h=o.prototype;return h._registerListeners=function(){var S=this.hls;S.on(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),S.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),S.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),S.on(B.Events.FRAG_LOADED,this.onFragLoaded,this),S.on(B.Events.ERROR,this.onError,this)},h._unregisterListeners=function(){var S=this.hls;S.off(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),S.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),S.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),S.off(B.Events.FRAG_LOADED,this.onFragLoaded,this),S.off(B.Events.ERROR,this.onError,this)},h.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,n.prototype.destroy.call(this)},h.startLoad=function(){var S=this._levels;S.forEach(function(x){x.loadError=0}),n.prototype.startLoad.call(this)},h.onManifestLoaded=function(S,x){var O=[],C=[],w=[],T,_={},u,E=!1,m=!1,b=!1;if(x.levels.forEach(function(j){var I=j.attrs;E=E||!!(j.width&&j.height),m=m||!!j.videoCodec,b=b||!!j.audioCodec,c&&j.audioCodec&&j.audioCodec.indexOf("mp4a.40.34")!==-1&&(j.audioCodec=void 0);var y=j.bitrate+"-"+j.attrs.RESOLUTION+"-"+j.attrs.CODECS;u=_[y],u?u.url.push(j.url):(u=new Q.Level(j),_[y]=u,O.push(u)),I&&(I.AUDIO&&Object(G.addGroupId)(u,"audio",I.AUDIO),I.SUBTITLES&&Object(G.addGroupId)(u,"text",I.SUBTITLES))}),(E||m)&&b&&(O=O.filter(function(j){var I=j.videoCodec,y=j.width,W=j.height;return!!I||!!(y&&W)})),O=O.filter(function(j){var I=j.audioCodec,y=j.videoCodec;return(!I||Object(K.isCodecSupportedInMp4)(I,"audio"))&&(!y||Object(K.isCodecSupportedInMp4)(y,"video"))}),x.audioTracks&&(C=x.audioTracks.filter(function(j){return!j.audioCodec||Object(K.isCodecSupportedInMp4)(j.audioCodec,"audio")}),Object(G.assignTrackIdsByGroup)(C)),x.subtitles&&(w=x.subtitles,Object(G.assignTrackIdsByGroup)(w)),O.length>0){T=O[0].bitrate,O.sort(function(j,I){return j.bitrate-I.bitrate}),this._levels=O;for(var N=0;N<O.length;N++)if(O[N].bitrate===T){this._firstLevel=N,this.log("manifest loaded, "+O.length+" level(s) found, first bitrate: "+T);break}var D=b&&!m,H={levels:O,audioTracks:C,subtitleTracks:w,firstLevel:this._firstLevel,stats:x.stats,audio:b,video:m,altAudio:!D&&C.some(function(j){return!!j.url})};this.hls.trigger(B.Events.MANIFEST_PARSED,H),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(B.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:x.url,reason:"no level with compatible codecs found in manifest"})},h.onError=function(S,x){if(n.prototype.onError.call(this,S,x),x.fatal)return;var O=x.context,C=this._levels[this.currentLevelIndex];if(O&&(O.type===R.PlaylistContextType.AUDIO_TRACK&&C.audioGroupIds&&O.groupId===C.audioGroupIds[C.urlId]||O.type===R.PlaylistContextType.SUBTITLE_TRACK&&C.textGroupIds&&O.groupId===C.textGroupIds[C.urlId])){this.redundantFailover(this.currentLevelIndex);return}var w=!1,T=!0,_;switch(x.details){case F.ErrorDetails.FRAG_LOAD_ERROR:case F.ErrorDetails.FRAG_LOAD_TIMEOUT:case F.ErrorDetails.KEY_LOAD_ERROR:case F.ErrorDetails.KEY_LOAD_TIMEOUT:if(x.frag){var u=this._levels[x.frag.level];u?(u.fragmentError++,u.fragmentError>this.hls.config.fragLoadingMaxRetry&&(_=x.frag.level)):_=x.frag.level}break;case F.ErrorDetails.LEVEL_LOAD_ERROR:case F.ErrorDetails.LEVEL_LOAD_TIMEOUT:O&&(O.deliveryDirectives&&(T=!1),_=O.level),w=!0;break;case F.ErrorDetails.REMUX_ALLOC_ERROR:_=x.level,w=!0;break}_!==void 0&&this.recoverLevel(x,_,w,T)},h.recoverLevel=function(S,x,O,C){var w=S.details,T=this._levels[x];if(T.loadError++,O){var _=this.retryLoadingOrFail(S);if(_)S.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(C){var u=T.url.length;if(u>1&&T.loadError<u)S.levelRetry=!0,this.redundantFailover(x);else if(this.manualLevelIndex===-1){var E=x===0?this._levels.length-1:x-1;this.currentLevelIndex!==E&&this._levels[E].loadError===0&&(this.warn(w+": switch to "+E),S.levelRetry=!0,this.hls.nextAutoLevel=E)}}},h.redundantFailover=function(S){var x=this._levels[S],O=x.url.length;if(O>1){var C=(x.urlId+1)%O;this.warn("Switching to redundant URL-id "+C),this._levels.forEach(function(w){w.urlId=C}),this.level=S}},h.onFragLoaded=function(S,x){var O=x.frag;if(O!==void 0&&O.type===R.PlaylistLevelType.MAIN){var C=this._levels[O.level];C!==void 0&&(C.fragmentError=0,C.loadError=0)}},h.onLevelLoaded=function(S,x){var O,C=x.level,w=x.details,T=this._levels[C];if(!T){var _;this.warn("Invalid level index "+C),(_=x.deliveryDirectives)!==null&&_!==void 0&&_.skip&&(w.deltaUpdateFailed=!0);return}C===this.currentLevelIndex?(T.fragmentError===0&&(T.loadError=0,this.retryCount=0),this.playlistLoaded(C,x,T.details)):(O=x.deliveryDirectives)!==null&&O!==void 0&&O.skip&&(w.deltaUpdateFailed=!0)},h.onAudioTrackSwitched=function(S,x){var O=this.hls.levels[this.currentLevelIndex];if(!O)return;if(O.audioGroupIds){for(var C=-1,w=this.hls.audioTracks[x.id].groupId,T=0;T<O.audioGroupIds.length;T++)if(O.audioGroupIds[T]===w){C=T;break}C!==O.urlId&&(O.urlId=C,this.startLoad())}},h.loadPlaylist=function(S){var x=this.currentLevelIndex,O=this._levels[x];if(this.canLoad&&O&&O.url.length>0){var C=O.urlId,w=O.url[C];if(S)try{w=S.addDirectives(w)}catch(T){this.warn("Could not construct new URL with HLS Delivery Directives: "+T)}this.log("Attempt loading level index "+x+(S?" at sn "+S.msn+" part "+S.part:"")+" with URL-id "+C+" "+w),this.clearTimer(),this.hls.trigger(B.Events.LEVEL_LOADING,{url:w,level:x,id:C,deliveryDirectives:S||null})}},h.removeLevel=function(S,x){var O=function(T,_){return _!==x},C=this._levels.filter(function(w,T){return T!==S?!0:w.url.length>1&&x!==void 0?(w.url=w.url.filter(O),w.audioGroupIds&&(w.audioGroupIds=w.audioGroupIds.filter(O)),w.textGroupIds&&(w.textGroupIds=w.textGroupIds.filter(O)),w.urlId=0,!0):!1}).map(function(w,T){var _=w.details;return _!=null&&_.fragments&&_.fragments.forEach(function(u){u.level=T}),w});this._levels=C,this.hls.trigger(B.Events.LEVELS_UPDATED,{levels:C})},f(o,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(S){var x,O=this._levels;if(O.length===0)return;if(this.currentLevelIndex===S&&(x=O[S])!==null&&x!==void 0&&x.details)return;if(S<0||S>=O.length){var C=S<0;if(this.hls.trigger(B.Events.ERROR,{type:F.ErrorTypes.OTHER_ERROR,details:F.ErrorDetails.LEVEL_SWITCH_ERROR,level:S,fatal:C,reason:"invalid level idx"}),C)return;S=Math.min(S,O.length-1)}this.clearTimer();var w=this.currentLevelIndex,T=O[w],_=O[S];this.log("switching to level "+S+" from "+w),this.currentLevelIndex=S;var u=g({},_,{level:S,maxBitrate:_.maxBitrate,uri:_.uri,urlId:_.urlId});delete u._urlId,this.hls.trigger(B.Events.LEVEL_SWITCHING,u);var E=_.details;if(!E||E.live){var m=this.switchParams(_.uri,T==null?void 0:T.details);this.loadPlaylist(m)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(S){this.manualLevelIndex=S,this._startLevel===void 0&&(this._startLevel=S),S!==-1&&(this.level=S)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(S){this._firstLevel=S}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var S=this.hls.config.startLevel;return S!==void 0?S:this._firstLevel}else return this._startLevel},set:function(S){this._startLevel=S}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(S){this.level=S,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=S)}}]),o}(M.default)},"./src/controller/level-helper.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"addGroupId",function(){return F}),P.d(Z,"assignTrackIdsByGroup",function(){return K}),P.d(Z,"updatePTS",function(){return G}),P.d(Z,"updateFragPTSDTS",function(){return R}),P.d(Z,"mergeDetails",function(){return g}),P.d(Z,"mapPartIntersection",function(){return p}),P.d(Z,"mapFragmentIntersection",function(){return f}),P.d(Z,"adjustSliding",function(){return d}),P.d(Z,"addSliding",function(){return s}),P.d(Z,"computeReloadInterval",function(){return c}),P.d(Z,"getFragmentWithSN",function(){return l}),P.d(Z,"getPartWith",function(){return n});var Q=P("./src/polyfills/number.ts"),B=P("./src/utils/logger.ts");function F(o,h,L){switch(h){case"audio":o.audioGroupIds||(o.audioGroupIds=[]),o.audioGroupIds.push(L);break;case"text":o.textGroupIds||(o.textGroupIds=[]),o.textGroupIds.push(L);break}}function K(o){var h={};o.forEach(function(L){var S=L.groupId||"";L.id=h[S]=h[S]||0,h[S]++})}function G(o,h,L){var S=o[h],x=o[L];M(S,x)}function M(o,h){var L=h.startPTS;if(Object(Q.isFiniteNumber)(L)){var S=0,x;h.sn>o.sn?(S=L-o.start,x=o):(S=o.start-L,x=h),x.duration!==S&&(x.duration=S)}else if(h.sn>o.sn){var O=o.cc===h.cc;O&&o.minEndPTS?h.start=o.start+(o.minEndPTS-o.start):h.start=o.start+o.duration}else h.start=Math.max(o.start-h.duration,0)}function R(o,h,L,S,x,O){var C=S-L;C<=0&&(B.logger.warn("Fragment should have a positive duration",h),S=L+h.duration,O=x+h.duration);var w=L,T=S,_=h.startPTS,u=h.endPTS;if(Object(Q.isFiniteNumber)(_)){var E=Math.abs(_-L);Object(Q.isFiniteNumber)(h.deltaPTS)?h.deltaPTS=Math.max(E,h.deltaPTS):h.deltaPTS=E,w=Math.max(L,_),L=Math.min(L,_),x=Math.min(x,h.startDTS),T=Math.min(S,u),S=Math.max(S,u),O=Math.max(O,h.endDTS)}h.duration=S-L;var m=L-h.start;h.appendedPTS=S,h.start=h.startPTS=L,h.maxStartPTS=w,h.startDTS=x,h.endPTS=S,h.minEndPTS=T,h.endDTS=O;var b=h.sn;if(!o||b<o.startSN||b>o.endSN)return 0;var N,D=b-o.startSN,H=o.fragments;for(H[D]=h,N=D;N>0;N--)M(H[N],H[N-1]);for(N=D;N<H.length-1;N++)M(H[N],H[N+1]);return o.fragmentHint&&M(H[H.length-1],o.fragmentHint),o.PTSKnown=o.alignedSliding=!0,m}function g(o,h){for(var L=null,S=o.fragments,x=S.length-1;x>=0;x--){var O=S[x].initSegment;if(O){L=O;break}}o.fragmentHint&&delete o.fragmentHint.endPTS;var C=0,w;if(f(o,h,function(N,D){N.relurl&&(C=N.cc-D.cc),Object(Q.isFiniteNumber)(N.startPTS)&&Object(Q.isFiniteNumber)(N.endPTS)&&(D.start=D.startPTS=N.startPTS,D.startDTS=N.startDTS,D.appendedPTS=N.appendedPTS,D.maxStartPTS=N.maxStartPTS,D.endPTS=N.endPTS,D.endDTS=N.endDTS,D.minEndPTS=N.minEndPTS,D.duration=N.endPTS-N.startPTS,D.duration&&(w=D),h.PTSKnown=h.alignedSliding=!0),D.elementaryStreams=N.elementaryStreams,D.loader=N.loader,D.stats=N.stats,D.urlId=N.urlId,N.initSegment&&(D.initSegment=N.initSegment,L=N.initSegment)}),L){var T=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments;T.forEach(function(N){var D;(!N.initSegment||N.initSegment.relurl===((D=L)===null||D===void 0?void 0:D.relurl))&&(N.initSegment=L)})}if(h.skippedSegments&&(h.deltaUpdateFailed=h.fragments.some(function(N){return!N}),h.deltaUpdateFailed)){B.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var _=h.skippedSegments;_--;)h.fragments.shift();h.startSN=h.fragments[0].sn,h.startCC=h.fragments[0].cc}var u=h.fragments;if(C){B.logger.warn("discontinuity sliding from playlist, take drift into account");for(var E=0;E<u.length;E++)u[E].cc+=C}h.skippedSegments&&(h.startCC=h.fragments[0].cc),p(o.partList,h.partList,function(N,D){D.elementaryStreams=N.elementaryStreams,D.stats=N.stats}),w?R(h,w,w.startPTS,w.endPTS,w.startDTS,w.endDTS):d(o,h),u.length&&(h.totalduration=h.edge-u[0].start),h.driftStartTime=o.driftStartTime,h.driftStart=o.driftStart;var m=h.advancedDateTime;if(h.advanced&&m){var b=h.edge;h.driftStart||(h.driftStartTime=m,h.driftStart=b),h.driftEndTime=m,h.driftEnd=b}else h.driftEndTime=o.driftEndTime,h.driftEnd=o.driftEnd,h.advancedDateTime=o.advancedDateTime}function p(o,h,L){if(o&&h)for(var S=0,x=0,O=o.length;x<=O;x++){var C=o[x],w=h[x+S];C&&w&&C.index===w.index&&C.fragment.sn===w.fragment.sn?L(C,w):S--}}function f(o,h,L){for(var S=h.skippedSegments,x=Math.max(o.startSN,h.startSN)-h.startSN,O=(o.fragmentHint?1:0)+(S?h.endSN:Math.min(o.endSN,h.endSN))-h.startSN,C=h.startSN-o.startSN,w=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments,T=o.fragmentHint?o.fragments.concat(o.fragmentHint):o.fragments,_=x;_<=O;_++){var u=T[C+_],E=w[_];S&&!E&&_<S&&(E=h.fragments[_]=u),u&&E&&L(u,E)}}function d(o,h){var L=h.startSN+h.skippedSegments-o.startSN,S=o.fragments;if(L<0||L>=S.length)return;s(h,S[L].start)}function s(o,h){if(h){for(var L=o.fragments,S=o.skippedSegments;S<L.length;S++)L[S].start+=h;o.fragmentHint&&(o.fragmentHint.start+=h)}}function c(o,h){var L=1e3*o.levelTargetDuration,S=L/2,x=o.age,O=x>0&&x<L*3,C=h.loading.end-h.loading.start,w,T=o.availabilityDelay;if(o.updated===!1)if(O){var _=333*o.misses;w=Math.max(Math.min(S,C*2),_),o.availabilityDelay=(o.availabilityDelay||0)+w}else w=S;else O?(T=Math.min(T||L/2,x),o.availabilityDelay=T,w=T+L-x):w=L-C;return Math.round(w)}function l(o,h,L){if(!o||!o.details)return null;var S=o.details,x=S.fragments[h-S.startSN];return x||(x=S.fragmentHint,x&&x.sn===h?x:h<S.startSN&&L&&L.sn===h?L:null)}function n(o,h,L){if(!o||!o.details)return null;var S=o.details.partList;if(S)for(var x=S.length;x--;){var O=S[x];if(O.index===L&&O.fragment.sn===h)return O}return null}},"./src/controller/stream-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return S});var Q=P("./src/polyfills/number.ts"),B=P("./src/controller/base-stream-controller.ts"),F=P("./src/is-supported.ts"),K=P("./src/events.ts"),G=P("./src/utils/buffer-helper.ts"),M=P("./src/controller/fragment-tracker.ts"),R=P("./src/types/loader.ts"),g=P("./src/loader/fragment.ts"),p=P("./src/demux/transmuxer-interface.ts"),f=P("./src/types/transmuxer.ts"),d=P("./src/controller/gap-controller.ts"),s=P("./src/errors.ts"),c=P("./src/utils/logger.ts");function l(x,O){for(var C=0;C<O.length;C++){var w=O[C];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(x,w.key,w)}}function n(x,O,C){return O&&l(x.prototype,O),C&&l(x,C),x}function o(x,O){x.prototype=Object.create(O.prototype),x.prototype.constructor=x,h(x,O)}function h(x,O){return h=Object.setPrototypeOf||function(w,T){return w.__proto__=T,w},h(x,O)}var L=100,S=function(x){o(O,x);function O(w,T){var _;return _=x.call(this,w,T,"[stream-controller]")||this,_.audioCodecSwap=!1,_.gapController=null,_.level=-1,_._forceStartLoad=!1,_.altAudio=!1,_.audioOnly=!1,_.fragPlaying=null,_.onvplaying=null,_.onvseeked=null,_.fragLastKbps=0,_.stalled=!1,_.couldBacktrack=!1,_.audioCodecSwitch=!1,_.videoBuffer=null,_._registerListeners(),_}var C=O.prototype;return C._registerListeners=function(){var T=this.hls;T.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),T.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),T.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),T.on(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),T.on(K.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),T.on(K.Events.ERROR,this.onError,this),T.on(K.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),T.on(K.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),T.on(K.Events.BUFFER_CREATED,this.onBufferCreated,this),T.on(K.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),T.on(K.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),T.on(K.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C._unregisterListeners=function(){var T=this.hls;T.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),T.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),T.off(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),T.off(K.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),T.off(K.Events.ERROR,this.onError,this),T.off(K.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),T.off(K.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),T.off(K.Events.BUFFER_CREATED,this.onBufferCreated,this),T.off(K.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),T.off(K.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),T.off(K.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},C.startLoad=function(T){if(this.levels){var _=this.lastCurrentTime,u=this.hls;if(this.stopLoad(),this.setInterval(L),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var E=u.startLevel;E===-1&&(u.config.testBandwidth?(E=0,this.bitrateTest=!0):E=u.nextAutoLevel),this.level=u.nextLoadLevel=E,this.loadedmetadata=!1}_>0&&T===-1&&(this.log("Override startPosition with lastCurrentTime @"+_.toFixed(3)),T=_),this.state=B.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=T,this.tick()}else this._forceStartLoad=!0,this.state=B.State.STOPPED},C.stopLoad=function(){this._forceStartLoad=!1,x.prototype.stopLoad.call(this)},C.doTick=function(){switch(this.state){case B.State.IDLE:this.doTickIdle();break;case B.State.WAITING_LEVEL:{var T,_=this.levels,u=this.level,E=_==null||((T=_[u])===null||T===void 0)?void 0:T.details;if(E&&(!E.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(E))break;this.state=B.State.IDLE;break}break}case B.State.FRAG_LOADING_WAITING_RETRY:{var m,b=self.performance.now(),N=this.retryDate;(!N||b>=N||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=B.State.IDLE)}break;default:break}this.onTickEnd()},C.onTickEnd=function(){x.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},C.doTickIdle=function(){var T,_,u=this.hls,E=this.levelLastLoaded,m=this.levels,b=this.media,N=u.config,D=u.nextLoadLevel;if(E===null||!b&&(this.startFragRequested||!N.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[D])return;var H=m[D];this.level=u.nextLoadLevel=D;var j=H.details;if(!j||this.state===B.State.WAITING_LEVEL||j.live&&this.levelLastLoaded!==D){this.state=B.State.WAITING_LEVEL;return}var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:b,R.PlaylistLevelType.MAIN);if(I===null)return;var y=I.len,W=this.getMaxBufferLength(H.maxBitrate);if(y>=W)return;if(this._streamEnded(I,j)){var Y={};this.altAudio&&(Y.type="video"),this.hls.trigger(K.Events.BUFFER_EOS,Y),this.state=B.State.ENDED;return}var ie=I.end,oe=this.getNextFragment(ie,j);if(this.couldBacktrack&&!this.fragPrevious&&oe&&oe.sn!=="initSegment"){var we=oe.sn-j.startSN;we>1&&(oe=j.fragments[we-1],this.fragmentTracker.removeFragment(oe))}if(oe&&this.fragmentTracker.getState(oe)===M.FragmentState.OK&&this.nextLoadPosition>ie){var me=this.audioOnly&&!this.altAudio?g.ElementaryStreamTypes.AUDIO:g.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(b,me,R.PlaylistLevelType.MAIN),oe=this.getNextFragment(this.nextLoadPosition,j)}if(!oe)return;oe.initSegment&&!oe.initSegment.data&&!this.bitrateTest&&(oe=oe.initSegment),((T=oe.decryptdata)===null||T===void 0?void 0:T.keyFormat)==="identity"&&!((_=oe.decryptdata)!==null&&_!==void 0&&_.key)?this.loadKey(oe,j):this.loadFragment(oe,j,ie)},C.loadFragment=function(T,_,u){var E,m=this.fragmentTracker.getState(T);if(this.fragCurrent=T,m===M.FragmentState.BACKTRACKED){var b=this.fragmentTracker.getBacktrackData(T);if(b){this._handleFragmentLoadProgress(b),this._handleFragmentLoadComplete(b);return}else m=M.FragmentState.NOT_LOADED}m===M.FragmentState.NOT_LOADED||m===M.FragmentState.PARTIAL?T.sn==="initSegment"?this._loadInitSegment(T):this.bitrateTest?(T.bitrateTest=!0,this.log("Fragment "+T.sn+" of level "+T.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(T)):(this.startFragRequested=!0,x.prototype.loadFragment.call(this,T,_,u)):m===M.FragmentState.APPENDING?this.reduceMaxBufferLength(T.duration)&&this.fragmentTracker.removeFragment(T):((E=this.media)===null||E===void 0?void 0:E.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},C.getAppendedFrag=function(T){var _=this.fragmentTracker.getAppendedFrag(T,R.PlaylistLevelType.MAIN);return _&&"fragment"in _?_.fragment:_},C.getBufferedFrag=function(T){return this.fragmentTracker.getBufferedFrag(T,R.PlaylistLevelType.MAIN)},C.followingBufferedFrag=function(T){return T?this.getBufferedFrag(T.end+.5):null},C.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},C.nextLevelSwitch=function(){var T=this.levels,_=this.media;if(_!=null&&_.readyState){var u,E=this.getAppendedFrag(_.currentTime);if(E&&E.start>1&&this.flushMainBuffer(0,E.start-1),!_.paused&&T){var m=this.hls.nextLoadLevel,b=T[m],N=this.fragLastKbps;N&&this.fragCurrent?u=this.fragCurrent.duration*b.maxBitrate/(1e3*N)+1:u=0}else u=0;var D=this.getBufferedFrag(_.currentTime+u);if(D){var H=this.followingBufferedFrag(D);if(H){this.abortCurrentFrag();var j=H.maxStartPTS?H.maxStartPTS:H.start,I=H.duration,y=Math.max(D.end,j+Math.min(Math.max(I-this.config.maxFragLookUpTolerance,I*.5),I*.75));this.flushMainBuffer(y,Number.POSITIVE_INFINITY)}}}},C.abortCurrentFrag=function(){var T=this.fragCurrent;this.fragCurrent=null,T!=null&&T.loader&&T.loader.abort(),this.state===B.State.KEY_LOADING&&(this.state=B.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},C.flushMainBuffer=function(T,_){x.prototype.flushMainBuffer.call(this,T,_,this.altAudio?"video":null)},C.onMediaAttached=function(T,_){x.prototype.onMediaAttached.call(this,T,_);var u=_.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),u.addEventListener("playing",this.onvplaying),u.addEventListener("seeked",this.onvseeked),this.gapController=new d.default(this.config,u,this.fragmentTracker,this.hls)},C.onMediaDetaching=function(){var T=this.media;T&&(T.removeEventListener("playing",this.onvplaying),T.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)},C.onMediaPlaying=function(){this.tick()},C.onMediaSeeked=function(){var T=this.media,_=T?T.currentTime:null;Object(Q.isFiniteNumber)(_)&&this.log("Media seeked to "+_.toFixed(3)),this.tick()},C.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(K.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},C.onManifestParsed=function(T,_){var u=!1,E=!1,m;_.levels.forEach(function(b){m=b.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(u=!0),m.indexOf("mp4a.40.5")!==-1&&(E=!0))}),this.audioCodecSwitch=u&&E&&!Object(F.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=_.levels,this.startFragRequested=!1},C.onLevelLoading=function(T,_){var u=this.levels;if(!u||this.state!==B.State.IDLE)return;var E=u[_.level];(!E.details||E.details.live&&this.levelLastLoaded!==_.level||this.waitForCdnTuneIn(E.details))&&(this.state=B.State.WAITING_LEVEL)},C.onLevelLoaded=function(T,_){var u,E=this.levels,m=_.level,b=_.details,N=b.totalduration;if(!E){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+b.startSN+","+b.endSN+"], cc ["+b.startCC+", "+b.endCC+"] duration:"+N);var D=this.fragCurrent;D&&(this.state===B.State.FRAG_LOADING||this.state===B.State.FRAG_LOADING_WAITING_RETRY)&&(D.level!==_.level&&D.loader&&(this.state=B.State.IDLE,D.loader.abort()));var H=E[m],j=0;if(b.live||(u=H.details)!==null&&u!==void 0&&u.live){if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed)return;j=this.alignPlaylists(b,H.details)}if(H.details=b,this.levelLastLoaded=m,this.hls.trigger(K.Events.LEVEL_UPDATED,{details:b,level:m}),this.state===B.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(b))return;this.state=B.State.IDLE}this.startFragRequested?b.live&&this.synchronizeToLiveEdge(b):this.setStartPosition(b,j),this.tick()},C._handleFragmentLoadProgress=function(T){var _,u=T.frag,E=T.part,m=T.payload,b=this.levels;if(!b){this.warn("Levels were reset while fragment load was in progress. Fragment "+u.sn+" of level "+u.level+" will not be buffered");return}var N=b[u.level],D=N.details;if(!D){this.warn("Dropping fragment "+u.sn+" of level "+u.level+" after level details were reset");return}var H=N.videoCodec,j=D.PTSKnown||!D.live,I=(_=u.initSegment)===null||_===void 0?void 0:_.data,y=this._getAudioCodec(N),W=this.transmuxer=this.transmuxer||new p.default(this.hls,R.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Y=E?E.index:-1,ie=Y!==-1,oe=new f.ChunkMetadata(u.level,u.sn,u.stats.chunkCount,m.byteLength,Y,ie),we=this.initPTS[u.cc];W.push(m,I,y,H,u,E,D.totalduration,j,oe,we)},C.onAudioTrackSwitching=function(T,_){var u=this.altAudio,E=!!_.url,m=_.id;if(!E){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var 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 N=this.hls;u&&N.trigger(K.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),N.trigger(K.Events.AUDIO_TRACK_SWITCHED,{id:m})}},C.onAudioTrackSwitched=function(T,_){var u=_.id,E=!!this.hls.audioTracks[u].url;if(E){var m=this.videoBuffer;m&&this.mediaBuffer!==m&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=m)}this.altAudio=E,this.tick()},C.onBufferCreated=function(T,_){var u=_.tracks,E,m,b=!1;for(var N in u){var D=u[N];if(D.id==="main"){if(m=N,E=D,N==="video"){var H=u[N];H&&(this.videoBuffer=H.buffer)}}else b=!0}b&&E?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=E.buffer):this.mediaBuffer=this.media},C.onFragBuffered=function(T,_){var u=_.frag,E=_.part;if(u&&u.type!==R.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(u)){this.warn("Fragment "+u.sn+(E?" p: "+E.index:"")+" of level "+u.level+" finished buffering, but was aborted. state: "+this.state),this.state===B.State.PARSED&&(this.state=B.State.IDLE);return}var m=E?E.stats:u.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),u.sn!=="initSegment"&&(this.fragPrevious=u),this.fragBufferedComplete(u,E)},C.onError=function(T,_){switch(_.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:case s.ErrorDetails.KEY_LOAD_ERROR:case s.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.MAIN,_);break;case s.ErrorDetails.LEVEL_LOAD_ERROR:case s.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==B.State.ERROR&&(_.fatal?(this.warn(""+_.details),this.state=B.State.ERROR):!_.levelRetry&&this.state===B.State.WAITING_LEVEL&&(this.state=B.State.IDLE));break;case s.ErrorDetails.BUFFER_FULL_ERROR:if(_.parent==="main"&&(this.state===B.State.PARSING||this.state===B.State.PARSED)){var u=!0,E=this.getFwdBufferInfo(this.media,R.PlaylistLevelType.MAIN);E&&E.len>.5&&(u=!this.reduceMaxBufferLength(E.len)),u&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},C.checkBuffer=function(){var T=this.media,_=this.gapController;if(!T||!_||!T.readyState)return;var u=G.BufferHelper.getBuffered(T);!this.loadedmetadata&&u.length?(this.loadedmetadata=!0,this.seekToStartPos()):_.poll(this.lastCurrentTime),this.lastCurrentTime=T.currentTime},C.onFragLoadEmergencyAborted=function(){this.state=B.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},C.onBufferFlushed=function(T,_){var u=_.type;if(u!==g.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var E=(u===g.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(E,u,R.PlaylistLevelType.MAIN)}},C.onLevelsUpdated=function(T,_){this.levels=_.levels},C.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},C.seekToStartPos=function(){var T=this.media,_=T.currentTime,u=this.startPosition;if(u>=0&&_<u){if(T.seeking){c.logger.log("could not seek to "+u+", already seeking at "+_);return}var E=G.BufferHelper.getBuffered(T),m=E.length?E.start(0):0,b=m-u;b>0&&(b<this.config.maxBufferHole||b<this.config.maxFragLookUpTolerance)&&(c.logger.log("adjusting start position by "+b+" to match buffer start"),u+=b,this.startPosition=u),this.log("seek to target start position "+u+" from current time "+_),T.currentTime=u}},C._getAudioCodec=function(T){var _=this.config.defaultAudioCodec||T.audioCodec;return this.audioCodecSwap&&_&&(this.log("Swapping audio codec"),_.indexOf("mp4a.40.5")!==-1?_="mp4a.40.2":_="mp4a.40.5"),_},C._loadBitrateTestFrag=function(T){var _=this;this._doFragLoad(T).then(function(u){var E=_.hls;if(!u||E.nextLoadLevel||_.fragContextChanged(T))return;_.fragLoadError=0,_.state=B.State.IDLE,_.startFragRequested=!1,_.bitrateTest=!1;var m=T.stats;m.parsing.start=m.parsing.end=m.buffering.start=m.buffering.end=self.performance.now(),E.trigger(K.Events.FRAG_LOADED,u)})},C._handleTransmuxComplete=function(T){var _,u="main",E=this.hls,m=T.remuxResult,b=T.chunkMeta,N=this.getCurrentContext(b);if(!N){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 D=N.frag,H=N.part,j=N.level,I=m.video,y=m.text,W=m.id3,Y=m.initSegment,ie=this.altAudio?void 0:m.audio;if(this.fragContextChanged(D))return;if(this.state=B.State.PARSING,Y){Y.tracks&&(this._bufferInitSegment(j,Y.tracks,D,b),E.trigger(K.Events.FRAG_PARSING_INIT_SEGMENT,{frag:D,id:u,tracks:Y.tracks}));var oe=Y.initPTS,we=Y.timescale;Object(Q.isFiniteNumber)(oe)&&(this.initPTS[D.cc]=oe,E.trigger(K.Events.INIT_PTS_FOUND,{frag:D,id:u,initPTS:oe,timescale:we}))}if(I&&m.independent!==!1){if(j.details){var me=I.startPTS,Se=I.endPTS,Ce=I.startDTS,xe=I.endDTS;if(H)H.elementaryStreams[I.type]={startPTS:me,endPTS:Se,startDTS:Ce,endDTS:xe};else if(I.firstKeyFrame&&I.independent&&(this.couldBacktrack=!0),I.dropped&&I.independent){var pe=this.getLoadPosition()+this.config.maxBufferHole;if(pe<me){this.backtrack(D);return}D.setElementaryStreamInfo(I.type,D.start,Se,D.start,xe,!0)}D.setElementaryStreamInfo(I.type,me,Se,Ce,xe),this.bufferFragmentData(I,D,H,b)}}else if(m.independent===!1){this.backtrack(D);return}if(ie){var le=ie.startPTS,te=ie.endPTS,de=ie.startDTS,se=ie.endDTS;H&&(H.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:le,endPTS:te,startDTS:de,endDTS:se}),D.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,le,te,de,se),this.bufferFragmentData(ie,D,H,b)}if(W!=null&&(_=W.samples)!==null&&_!==void 0&&_.length){var Oe={frag:D,id:u,samples:W.samples};E.trigger(K.Events.FRAG_PARSING_METADATA,Oe)}if(y){var ke={frag:D,id:u,samples:y.samples};E.trigger(K.Events.FRAG_PARSING_USERDATA,ke)}},C._bufferInitSegment=function(T,_,u,E){var m=this;if(this.state!==B.State.PARSING)return;this.audioOnly=!!_.audio&&!_.video,this.altAudio&&!this.audioOnly&&delete _.audio;var b=_.audio,N=_.video,D=_.audiovideo;if(b){var H=T.audioCodec,j=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(H&&(H.indexOf("mp4a.40.5")!==-1?H="mp4a.40.2":H="mp4a.40.5"),b.metadata.channelCount!==1&&j.indexOf("firefox")===-1&&(H="mp4a.40.5")),j.indexOf("android")!==-1&&b.container!=="audio/mpeg"&&(H="mp4a.40.2",this.log("Android: force audio codec to "+H)),T.audioCodec&&T.audioCodec!==H&&this.log('Swapping manifest audio codec "'+T.audioCodec+'" for "'+H+'"'),b.levelCodec=H,b.id="main",this.log("Init audio buffer, container:"+b.container+", codecs[selected/level/parsed]=["+(H||"")+"/"+(T.audioCodec||"")+"/"+b.codec+"]")}N&&(N.levelCodec=T.videoCodec,N.id="main",this.log("Init video buffer, container:"+N.container+", codecs[level/parsed]=["+(T.videoCodec||"")+"/"+N.codec+"]")),D&&this.log("Init audiovideo buffer, container:"+D.container+", codecs[level/parsed]=["+(T.attrs.CODECS||"")+"/"+D.codec+"]"),this.hls.trigger(K.Events.BUFFER_CODECS,_),Object.keys(_).forEach(function(I){var y=_[I],W=y.initSegment;W!=null&&W.byteLength&&m.hls.trigger(K.Events.BUFFER_APPENDING,{type:I,data:W,frag:u,part:null,chunkMeta:E,parent:u.type})}),this.tick()},C.backtrack=function(T){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(T);var _=this.fragmentTracker.backtrack(T);this.fragPrevious=null,this.nextLoadPosition=T.start,_?this.resetFragmentLoading(T):this.state=B.State.BACKTRACKING},C.checkFragmentChanged=function(){var T=this.media,_=null;if(T&&T.readyState>1&&T.seeking===!1){var u=T.currentTime;if(G.BufferHelper.isBuffered(T,u)?_=this.getAppendedFrag(u):G.BufferHelper.isBuffered(T,u+.1)&&(_=this.getAppendedFrag(u+.1)),_){var E=this.fragPlaying,m=_.level;(!E||_.sn!==E.sn||E.level!==m||_.urlId!==E.urlId)&&(this.hls.trigger(K.Events.FRAG_CHANGED,{frag:_}),(!E||E.level!==m)&&this.hls.trigger(K.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=_)}}},n(O,[{key:"nextLevel",get:function(){var T=this.nextBufferedFrag;return T?T.level:-1}},{key:"currentLevel",get:function(){var T=this.media;if(T){var _=this.getAppendedFrag(T.currentTime);if(_)return _.level}return-1}},{key:"nextBufferedFrag",get:function(){var T=this.media;if(T){var _=this.getAppendedFrag(T.currentTime);return this.followingBufferedFrag(_)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),O}(B.default)},"./src/controller/subtitle-stream-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"SubtitleStreamController",function(){return o});var Q=P("./src/events.ts"),B=P("./src/utils/logger.ts"),F=P("./src/utils/buffer-helper.ts"),K=P("./src/controller/fragment-finders.ts"),G=P("./src/utils/discontinuities.ts"),M=P("./src/controller/level-helper.ts"),R=P("./src/controller/fragment-tracker.ts"),g=P("./src/controller/base-stream-controller.ts"),p=P("./src/types/loader.ts"),f=P("./src/types/level.ts");function d(h,L){for(var S=0;S<L.length;S++){var x=L[S];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(h,x.key,x)}}function s(h,L,S){return L&&d(h.prototype,L),S&&d(h,S),h}function c(h,L){h.prototype=Object.create(L.prototype),h.prototype.constructor=h,l(h,L)}function l(h,L){return l=Object.setPrototypeOf||function(x,O){return x.__proto__=O,x},l(h,L)}var n=500,o=function(h){c(L,h);function L(x,O){var C;return C=h.call(this,x,O,"[subtitle-stream-controller]")||this,C.levels=[],C.currentTrackId=-1,C.tracksBuffered=[],C.mainDetails=null,C._registerListeners(),C}var S=L.prototype;return S.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},S._registerListeners=function(){var O=this.hls;O.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),O.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),O.on(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),O.on(Q.Events.LEVEL_LOADED,this.onLevelLoaded,this),O.on(Q.Events.ERROR,this.onError,this),O.on(Q.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),O.on(Q.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),O.on(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),O.on(Q.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),O.on(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S._unregisterListeners=function(){var O=this.hls;O.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),O.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),O.off(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),O.off(Q.Events.LEVEL_LOADED,this.onLevelLoaded,this),O.off(Q.Events.ERROR,this.onError,this),O.off(Q.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),O.off(Q.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),O.off(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),O.off(Q.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),O.off(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S.startLoad=function(){this.stopLoad(),this.state=g.State.IDLE,this.setInterval(n),this.tick()},S.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},S.onLevelLoaded=function(O,C){this.mainDetails=C.details},S.onSubtitleFragProcessed=function(O,C){var w=C.frag,T=C.success;if(this.fragPrevious=w,this.state=g.State.IDLE,!T)return;var _=this.tracksBuffered[this.currentTrackId];if(!_)return;for(var u,E=w.start,m=0;m<_.length;m++)if(E>=_[m].start&&E<=_[m].end){u=_[m];break}var b=w.start+w.duration;u?u.end=b:(u={start:E,end:b},_.push(u)),this.fragmentTracker.fragBuffered(w)},S.onBufferFlushing=function(O,C){var w=C.startOffset,T=C.endOffset;if(w===0&&T!==Number.POSITIVE_INFINITY){var _=this.currentTrackId,u=this.levels;if(!u.length||!u[_]||!u[_].details)return;var E=u[_].details,m=E.targetduration,b=T-m;if(b<=0)return;C.endOffsetSubtitles=Math.max(0,b),this.tracksBuffered.forEach(function(N){for(var D=0;D<N.length;){if(N[D].end<=b){N.shift();continue}else if(N[D].start<b)N[D].start=b;else break;D++}}),this.fragmentTracker.removeFragmentsInRange(w,b,p.PlaylistLevelType.SUBTITLE)}},S.onError=function(O,C){var w,T=C.frag;if(!T||T.type!==p.PlaylistLevelType.SUBTITLE)return;(w=this.fragCurrent)!==null&&w!==void 0&&w.loader&&this.fragCurrent.loader.abort(),this.state=g.State.IDLE},S.onSubtitleTracksUpdated=function(O,C){var w=this,T=C.subtitleTracks;this.tracksBuffered=[],this.levels=T.map(function(_){return new f.Level(_)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(_){w.tracksBuffered[_.id]=[]}),this.mediaBuffer=null},S.onSubtitleTrackSwitch=function(O,C){if(this.currentTrackId=C.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var w=this.levels[this.currentTrackId];w!=null&&w.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,w&&this.setInterval(n)},S.onSubtitleTrackLoaded=function(O,C){var w,T=C.details,_=C.id,u=this.currentTrackId,E=this.levels;if(!E.length)return;var m=E[u];if(_>=E.length||_!==u||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,T.live||(w=m.details)!==null&&w!==void 0&&w.live){var b=this.mainDetails;if(T.deltaUpdateFailed||!b)return;var N=b.fragments[0];if(!m.details)T.hasProgramDateTime&&b.hasProgramDateTime?Object(G.alignMediaPlaylistByPDT)(T,b):N&&Object(M.addSliding)(T,N.start);else{var D=this.alignPlaylists(T,m.details);D===0&&N&&Object(M.addSliding)(T,N.start)}}if(m.details=T,this.levelLastLoaded=_,this.tick(),T.live&&!this.fragCurrent&&this.media&&this.state===g.State.IDLE){var H=Object(K.findFragmentByPTS)(null,T.fragments,this.media.currentTime,0);H||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},S._handleFragmentLoadComplete=function(O){var C=O.frag,w=O.payload,T=C.decryptdata,_=this.hls;if(this.fragContextChanged(C))return;if(w&&w.byteLength>0&&T&&T.key&&T.iv&&T.method==="AES-128"){var u=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(w),T.key.buffer,T.iv.buffer).then(function(E){var m=performance.now();_.trigger(Q.Events.FRAG_DECRYPTED,{frag:C,payload:E,stats:{tstart:u,tdecrypt:m}})})}},S.doTick=function(){if(!this.media){this.state=g.State.IDLE;return}if(this.state===g.State.IDLE){var O,C=this.currentTrackId,w=this.levels;if(!w.length||!w[C]||!w[C].details)return;var T=w[C].details,_=T.targetduration,u=this.config,E=this.media,m=F.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,E.currentTime-_,u.maxBufferHole),b=m.end,N=m.len,D=this.getMaxBufferLength()+_;if(N>D)return;console.assert(T,"Subtitle track details are defined on idle subtitle stream controller tick");var H=T.fragments,j=H.length,I=T.edge,y,W=this.fragPrevious;if(b<I){var Y=u.maxFragLookUpTolerance;W&&T.hasProgramDateTime&&(y=Object(K.findFragmentByPDT)(H,W.endProgramDateTime,Y)),y||(y=Object(K.findFragmentByPTS)(W,H,b,Y),!y&&W&&W.start<H[0].start&&(y=H[0]))}else y=H[j-1];(O=y)!==null&&O!==void 0&&O.encrypted?(B.logger.log("Loading key for "+y.sn),this.state=g.State.KEY_LOADING,this.hls.trigger(Q.Events.KEY_LOADING,{frag:y})):y&&this.fragmentTracker.getState(y)===R.FragmentState.NOT_LOADED&&this.loadFragment(y,T,b)}},S.loadFragment=function(O,C,w){this.fragCurrent=O,h.prototype.loadFragment.call(this,O,C,w)},s(L,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),L}(g.default)},"./src/controller/subtitle-track-controller.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/events.ts"),B=P("./src/utils/texttrack-utils.ts"),F=P("./src/controller/base-playlist-controller.ts"),K=P("./src/types/loader.ts");function G(d,s){for(var c=0;c<s.length;c++){var l=s[c];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(d,l.key,l)}}function M(d,s,c){return s&&G(d.prototype,s),c&&G(d,c),d}function R(d,s){d.prototype=Object.create(s.prototype),d.prototype.constructor=d,g(d,s)}function g(d,s){return g=Object.setPrototypeOf||function(l,n){return l.__proto__=n,l},g(d,s)}var p=function(d){R(s,d);function s(l){var n;return n=d.call(this,l,"[subtitle-track-controller]")||this,n.media=null,n.tracks=[],n.groupId=null,n.tracksInGroup=[],n.trackId=-1,n.selectDefaultTrack=!0,n.queuedDefaultTrack=-1,n.trackChangeListener=function(){return n.onTextTracksChanged()},n.asyncPollTrackChange=function(){return n.pollTrackChange(0)},n.useTextTrackPolling=!1,n.subtitlePollingInterval=-1,n.subtitleDisplay=!0,n.registerListeners(),n}var c=s.prototype;return c.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,d.prototype.destroy.call(this)},c.registerListeners=function(){var n=this.hls;n.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.on(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),n.on(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),n.on(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),n.on(Q.Events.ERROR,this.onError,this)},c.unregisterListeners=function(){var n=this.hls;n.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.off(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),n.off(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),n.off(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),n.off(Q.Events.ERROR,this.onError,this)},c.onMediaAttached=function(n,o){if(this.media=o.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},c.pollTrackChange=function(n){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,n)},c.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var n=f(this.media.textTracks);n.forEach(function(o){Object(B.clearCurrentCues)(o)}),this.subtitleTrack=-1,this.media=null},c.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},c.onManifestParsed=function(n,o){this.tracks=o.subtitleTracks},c.onSubtitleTrackLoaded=function(n,o){var h=o.id,L=o.details,S=this.trackId,x=this.tracksInGroup[S];if(!x){this.warn("Invalid subtitle track id "+h);return}var O=x.details;x.details=o.details,this.log("subtitle track "+h+" loaded ["+L.startSN+"-"+L.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,o,O))},c.onLevelLoading=function(n,o){this.switchLevel(o.level)},c.onLevelSwitching=function(n,o){this.switchLevel(o.level)},c.switchLevel=function(n){var o=this.hls.levels[n];if(!(o!=null&&o.textGroupIds))return;var h=o.textGroupIds[o.urlId];if(this.groupId!==h){var L=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,S=this.tracks.filter(function(C){return!h||C.groupId===h});this.tracksInGroup=S;var x=this.findTrackId(L==null?void 0:L.name)||this.findTrackId();this.groupId=h;var O={subtitleTracks:S};this.log("Updating subtitle tracks, "+S.length+' track(s) found in "'+h+'" group-id'),this.hls.trigger(Q.Events.SUBTITLE_TRACKS_UPDATED,O),x!==-1&&this.setSubtitleTrack(x,L)}},c.findTrackId=function(n){for(var o=this.tracksInGroup,h=0;h<o.length;h++){var L=o[h];if((!this.selectDefaultTrack||L.default)&&(!n||n===L.name))return L.id}return-1},c.onError=function(n,o){if(d.prototype.onError.call(this,n,o),o.fatal||!o.context)return;o.context.type===K.PlaylistContextType.SUBTITLE_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},c.loadPlaylist=function(n){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var h=o.id,L=o.groupId,S=o.url;if(n)try{S=n.addDirectives(S)}catch(x){this.warn("Could not construct new URL with HLS Delivery Directives: "+x)}this.log("Loading subtitle playlist for id "+h),this.hls.trigger(Q.Events.SUBTITLE_TRACK_LOADING,{url:S,id:h,groupId:L,deliveryDirectives:n||null})}},c.toggleTrackModes=function(n){var o=this,h=this.media,L=this.subtitleDisplay,S=this.trackId;if(!h)return;var x=f(h.textTracks),O=x.filter(function(T){return T.groupId===o.groupId});if(n===-1)[].slice.call(x).forEach(function(T){T.mode="disabled"});else{var C=O[S];C&&(C.mode="disabled")}var w=O[n];w&&(w.mode=L?"showing":"hidden")},c.setSubtitleTrack=function(n,o){var h,L=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=n;return}if(this.trackId!==n&&this.toggleTrackModes(n),this.trackId===n&&(n===-1||(h=L[n])!==null&&h!==void 0&&h.details)||n<-1||n>=L.length)return;this.clearTimer();var S=L[n];if(this.log("Switching to subtitle track "+n),this.trackId=n,S){var x=S.id,O=S.groupId,C=O===void 0?"":O,w=S.name,T=S.type,_=S.url;this.hls.trigger(Q.Events.SUBTITLE_TRACK_SWITCH,{id:x,groupId:C,name:w,type:T,url:_});var u=this.switchParams(S.url,o==null?void 0:o.details);this.loadPlaylist(u)}else this.hls.trigger(Q.Events.SUBTITLE_TRACK_SWITCH,{id:n})},c.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var n=-1,o=f(this.media.textTracks),h=0;h<o.length;h++)if(o[h].mode==="hidden")n=h;else if(o[h].mode==="showing"){n=h;break}this.subtitleTrack!==n&&(this.subtitleTrack=n)},M(s,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(n){this.selectDefaultTrack=!1;var o=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(n,o)}}]),s}(F.default);function f(d){for(var s=[],c=0;c<d.length;c++){var l=d[c];l.kind==="subtitles"&&l.label&&s.push(d[c])}return s}Z.default=p},"./src/controller/timeline-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"TimelineController",function(){return f});var Q=P("./src/polyfills/number.ts"),B=P("./src/events.ts"),F=P("./src/utils/cea-608-parser.ts"),K=P("./src/utils/output-filter.ts"),G=P("./src/utils/webvtt-parser.ts"),M=P("./src/utils/texttrack-utils.ts"),R=P("./src/utils/imsc1-ttml-parser.ts"),g=P("./src/types/loader.ts"),p=P("./src/utils/logger.ts"),f=function(){function l(o){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=c(),this.captionsProperties=void 0,this.hls=o,this.config=o.config,this.Cues=o.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var h=new K.default(this,"textTrack1"),L=new K.default(this,"textTrack2"),S=new K.default(this,"textTrack3"),x=new K.default(this,"textTrack4");this.cea608Parser1=new F.default(1,h,L),this.cea608Parser2=new F.default(3,S,x)}o.on(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),o.on(B.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),o.on(B.Events.FRAG_LOADING,this.onFragLoading,this),o.on(B.Events.FRAG_LOADED,this.onFragLoaded,this),o.on(B.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),o.on(B.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),o.on(B.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.on(B.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),o.on(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var n=l.prototype;return n.destroy=function(){var h=this.hls;h.off(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),h.off(B.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),h.off(B.Events.FRAG_LOADING,this.onFragLoading,this),h.off(B.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(B.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),h.off(B.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),h.off(B.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(B.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),h.off(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},n.addCues=function(h,L,S,x,O){for(var C=!1,w=O.length;w--;){var T=O[w],_=s(T[0],T[1],L,S);if(_>=0&&(T[0]=Math.min(T[0],L),T[1]=Math.max(T[1],S),C=!0,_/(S-L)>.5))return}if(C||O.push([L,S]),this.config.renderTextTracksNatively){var u=this.captionsTracks[h];this.Cues.newCue(u,L,S,x)}else{var E=this.Cues.newCue(null,L,S,x);this.hls.trigger(B.Events.CUES_PARSED,{type:"captions",cues:E,track:h})}},n.onInitPtsFound=function(h,L){var S=this,x=L.frag,O=L.id,C=L.initPTS,w=L.timescale,T=this.unparsedVttFrags;O==="main"&&(this.initPTS[x.cc]=C,this.timescale[x.cc]=w),T.length&&(this.unparsedVttFrags=[],T.forEach(function(_){S.onFragLoaded(B.Events.FRAG_LOADED,_)}))},n.getExistingTrack=function(h){var L=this.media;if(L)for(var S=0;S<L.textTracks.length;S++){var x=L.textTracks[S];if(x[h])return x}return null},n.createCaptionsTrack=function(h){this.config.renderTextTracksNatively?this.createNativeTrack(h):this.createNonNativeTrack(h)},n.createNativeTrack=function(h){if(this.captionsTracks[h])return;var L=this.captionsProperties,S=this.captionsTracks,x=this.media,O=L[h],C=O.label,w=O.languageCode,T=this.getExistingTrack(h);if(T)S[h]=T,Object(M.clearCurrentCues)(S[h]),Object(M.sendAddTrackEvent)(S[h],x);else{var _=this.createTextTrack("captions",C,w);_&&(_[h]=!0,S[h]=_)}},n.createNonNativeTrack=function(h){if(this.nonNativeCaptionsTracks[h])return;var L=this.captionsProperties[h];if(!L)return;var S=L.label,x={_id:h,label:S,kind:"captions",default:L.media?!!L.media.default:!1,closedCaptions:L.media};this.nonNativeCaptionsTracks[h]=x,this.hls.trigger(B.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[x]})},n.createTextTrack=function(h,L,S){var x=this.media;return x?x.addTextTrack(h,L,S):void 0},n.onMediaAttaching=function(h,L){this.media=L.media,this._cleanTracks()},n.onMediaDetaching=function(){var h=this.captionsTracks;Object.keys(h).forEach(function(L){Object(M.clearCurrentCues)(h[L]),delete h[L]}),this.nonNativeCaptionsTracks={}},n.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=c(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},n._cleanTracks=function(){var h=this.media;if(!h)return;var L=h.textTracks;if(L)for(var S=0;S<L.length;S++)Object(M.clearCurrentCues)(L[S])},n.onSubtitleTracksUpdated=function(h,L){var S=this;this.textTracks=[];var x=L.subtitleTracks||[],O=x.some(function(_){return _.textCodec===R.IMSC1_CODEC});if(this.config.enableWebVTT||O&&this.config.enableIMSC1){var C=this.tracks&&x&&this.tracks.length===x.length;if(this.tracks=x||[],this.config.renderTextTracksNatively){var w=this.media?this.media.textTracks:[];this.tracks.forEach(function(_,u){var E;if(u<w.length){for(var m=null,b=0;b<w.length;b++)if(d(w[b],_)){m=w[b];break}m&&(E=m)}E?Object(M.clearCurrentCues)(E):(E=S.createTextTrack("subtitles",_.name,_.lang),E&&(E.mode="disabled")),E&&(E.groupId=_.groupId,S.textTracks.push(E))})}else if(!C&&this.tracks&&this.tracks.length){var T=this.tracks.map(function(_){return{label:_.name,kind:_.type.toLowerCase(),default:_.default,subtitleTrack:_}});this.hls.trigger(B.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:T})}}},n.onManifestLoaded=function(h,L){var S=this;this.config.enableCEA708Captions&&L.captions&&L.captions.forEach(function(x){var O=/(?:CC|SERVICE)([1-4])/.exec(x.instreamId);if(!O)return;var C="textTrack"+O[1],w=S.captionsProperties[C];if(!w)return;w.label=x.name,x.lang&&(w.languageCode=x.lang),w.media=x})},n.onFragLoading=function(h,L){var S=this.cea608Parser1,x=this.cea608Parser2,O=this.lastSn,C=this.lastPartIndex;if(!this.enabled||!(S&&x))return;if(L.frag.type===g.PlaylistLevelType.MAIN){var w,T,_=L.frag.sn,u=(w=L==null||((T=L.part)===null||T===void 0)?void 0:T.index)!=null?w:-1;_===O+1||_===O&&u===C+1||(S.reset(),x.reset()),this.lastSn=_,this.lastPartIndex=u}},n.onFragLoaded=function(h,L){var S=L.frag,x=L.payload,O=this.initPTS,C=this.unparsedVttFrags;if(S.type===g.PlaylistLevelType.SUBTITLE)if(x.byteLength){if(!Object(Q.isFiniteNumber)(O[S.cc])){C.push(L),O.length&&this.hls.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:S,error:new Error("Missing initial subtitle PTS")});return}var w=S.decryptdata;if(w==null||w.key==null||w.method!=="AES-128"){var T=this.tracks[S.level],_=this.vttCCs;_[S.cc]||(_[S.cc]={start:S.start,prevCC:this.prevCC,new:!0},this.prevCC=S.cc),T&&T.textCodec===R.IMSC1_CODEC?this._parseIMSC1(S,x):this._parseVTTs(S,x,_)}}else this.hls.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:S,error:new Error("Empty subtitle payload")})},n._parseIMSC1=function(h,L){var S=this,x=this.hls;Object(R.parseIMSC1)(L,this.initPTS[h.cc],this.timescale[h.cc],function(O){S._appendCues(O,h.level),x.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(O){p.logger.log("Failed to parse IMSC1: "+O),x.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:O})})},n._parseVTTs=function(h,L,S){var x=this,O=this.hls;Object(G.parseWebVTT)(L,this.initPTS[h.cc],this.timescale[h.cc],S,h.cc,h.start,function(C){x._appendCues(C,h.level),O.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(C){x._fallbackToIMSC1(h,L),p.logger.log("Failed to parse VTT cue: "+C),O.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:C})})},n._fallbackToIMSC1=function(h,L){var S=this,x=this.tracks[h.level];x.textCodec||Object(R.parseIMSC1)(L,this.initPTS[h.cc],this.timescale[h.cc],function(){x.textCodec=R.IMSC1_CODEC,S._parseIMSC1(h,L)},function(){x.textCodec="wvtt"})},n._appendCues=function(h,L){var S=this.hls;if(this.config.renderTextTracksNatively){var x=this.textTracks[L];if(x.mode==="disabled")return;h.forEach(function(w){return Object(M.addCueToTrack)(x,w)})}else{var O=this.tracks[L],C=O.default?"default":"subtitles"+L;S.trigger(B.Events.CUES_PARSED,{type:"subtitles",cues:h,track:C})}},n.onFragDecrypted=function(h,L){var S=L.frag;if(S.type===g.PlaylistLevelType.SUBTITLE){if(!Object(Q.isFiniteNumber)(this.initPTS[S.cc])){this.unparsedVttFrags.push(L);return}this.onFragLoaded(B.Events.FRAG_LOADED,L)}},n.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},n.onFragParsingUserdata=function(h,L){var S=this.cea608Parser1,x=this.cea608Parser2;if(!this.enabled||!(S&&x))return;for(var O=0;O<L.samples.length;O++){var C=L.samples[O].bytes;if(C){var w=this.extractCea608Data(C);S.addData(L.samples[O].pts,w[0]),x.addData(L.samples[O].pts,w[1])}}},n.onBufferFlushing=function(h,L){var S=L.startOffset,x=L.endOffset,O=L.endOffsetSubtitles,C=L.type,w=this.media;if(!w||w.currentTime<x)return;if(!C||C==="video"){var T=this.captionsTracks;Object.keys(T).forEach(function(u){return Object(M.removeCuesInRange)(T[u],S,x)})}if(this.config.renderTextTracksNatively&&(S===0&&O!==void 0)){var _=this.textTracks;Object.keys(_).forEach(function(u){return Object(M.removeCuesInRange)(_[u],S,O)})}},n.extractCea608Data=function(h){for(var L=h[0]&31,S=2,x=[[],[]],O=0;O<L;O++){var C=h[S++],w=127&h[S++],T=127&h[S++],_=(4&C)!==0,u=3&C;if(w===0&&T===0)continue;_&&((u===0||u===1)&&(x[u].push(w),x[u].push(T)))}return x},l}();function d(l,n){return l&&l.label===n.name&&!(l.textTrack1||l.textTrack2)}function s(l,n,o,h){return Math.min(n,h)-Math.max(l,o)}function c(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return Q});var Q=function(){function B(K,G){this.subtle=void 0,this.aesIV=void 0,this.subtle=K,this.aesIV=G}var F=B.prototype;return F.decrypt=function(G,M){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},M,G)},B}()},"./src/crypt/aes-decryptor.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"removePadding",function(){return B}),P.d(Z,"default",function(){return F});var Q=P("./src/utils/typed-array.ts");function B(K){var G=K.byteLength,M=G&&new DataView(K.buffer).getUint8(G-1);return M?Object(Q.sliceUint8)(K,0,G-M):K}var F=function(){function K(){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 G=K.prototype;return G.uint8ArrayToUint32Array_=function(R){for(var g=new DataView(R),p=new Uint32Array(4),f=0;f<4;f++)p[f]=g.getUint32(f*4);return p},G.initTable=function(){var R=this.sBox,g=this.invSBox,p=this.subMix,f=p[0],d=p[1],s=p[2],c=p[3],l=this.invSubMix,n=l[0],o=l[1],h=l[2],L=l[3],S=new Uint32Array(256),x=0,O=0,C=0;for(C=0;C<256;C++)C<128?S[C]=C<<1:S[C]=C<<1^283;for(C=0;C<256;C++){var w=O^O<<1^O<<2^O<<3^O<<4;w=w>>>8^w&255^99,R[x]=w,g[w]=x;var T=S[x],_=S[T],u=S[_],E=S[w]*257^w*16843008;f[x]=E<<24|E>>>8,d[x]=E<<16|E>>>16,s[x]=E<<8|E>>>24,c[x]=E,E=u*16843009^_*65537^T*257^x*16843008,n[w]=E<<24|E>>>8,o[w]=E<<16|E>>>16,h[w]=E<<8|E>>>24,L[w]=E,x?(x=T^S[S[S[u^T]]],O^=S[S[O]]):x=O=1}},G.expandKey=function(R){for(var g=this.uint8ArrayToUint32Array_(R),p=!0,f=0;f<g.length&&p;)p=g[f]===this.key[f],f++;if(p)return;this.key=g;var d=this.keySize=g.length;if(d!==4&&d!==6&&d!==8)throw new Error("Invalid aes key size="+d);var s=this.ksRows=(d+6+1)*4,c,l,n=this.keySchedule=new Uint32Array(s),o=this.invKeySchedule=new Uint32Array(s),h=this.sBox,L=this.rcon,S=this.invSubMix,x=S[0],O=S[1],C=S[2],w=S[3],T,_;for(c=0;c<s;c++){if(c<d){T=n[c]=g[c];continue}_=T,c%d===0?(_=_<<8|_>>>24,_=h[_>>>24]<<24|h[_>>>16&255]<<16|h[_>>>8&255]<<8|h[_&255],_^=L[c/d|0]<<24):d>6&&c%d===4&&(_=h[_>>>24]<<24|h[_>>>16&255]<<16|h[_>>>8&255]<<8|h[_&255]),n[c]=T=(n[c-d]^_)>>>0}for(l=0;l<s;l++)c=s-l,l&3?_=n[c]:_=n[c-4],l<4||c<=4?o[l]=_:o[l]=x[h[_>>>24]]^O[h[_>>>16&255]]^C[h[_>>>8&255]]^w[h[_&255]],o[l]=o[l]>>>0},G.networkToHostOrderSwap=function(R){return R<<24|(R&65280)<<8|(R&16711680)>>8|R>>>24},G.decrypt=function(R,g,p){for(var f=this.keySize+6,d=this.invKeySchedule,s=this.invSBox,c=this.invSubMix,l=c[0],n=c[1],o=c[2],h=c[3],L=this.uint8ArrayToUint32Array_(p),S=L[0],x=L[1],O=L[2],C=L[3],w=new Int32Array(R),T=new Int32Array(w.length),_,u,E,m,b,N,D,H,j,I,y,W,Y,ie,oe=this.networkToHostOrderSwap;g<w.length;){for(j=oe(w[g]),I=oe(w[g+1]),y=oe(w[g+2]),W=oe(w[g+3]),b=j^d[0],N=W^d[1],D=y^d[2],H=I^d[3],Y=4,ie=1;ie<f;ie++)_=l[b>>>24]^n[N>>16&255]^o[D>>8&255]^h[H&255]^d[Y],u=l[N>>>24]^n[D>>16&255]^o[H>>8&255]^h[b&255]^d[Y+1],E=l[D>>>24]^n[H>>16&255]^o[b>>8&255]^h[N&255]^d[Y+2],m=l[H>>>24]^n[b>>16&255]^o[N>>8&255]^h[D&255]^d[Y+3],b=_,N=u,D=E,H=m,Y=Y+4;_=s[b>>>24]<<24^s[N>>16&255]<<16^s[D>>8&255]<<8^s[H&255]^d[Y],u=s[N>>>24]<<24^s[D>>16&255]<<16^s[H>>8&255]<<8^s[b&255]^d[Y+1],E=s[D>>>24]<<24^s[H>>16&255]<<16^s[b>>8&255]<<8^s[N&255]^d[Y+2],m=s[H>>>24]<<24^s[b>>16&255]<<16^s[N>>8&255]<<8^s[D&255]^d[Y+3],T[g]=oe(_^S),T[g+1]=oe(m^x),T[g+2]=oe(E^O),T[g+3]=oe(u^C),S=j,x=I,O=y,C=W,g=g+4}return T.buffer},K}()},"./src/crypt/decrypter.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return g});var Q=P("./src/crypt/aes-crypto.ts"),B=P("./src/crypt/fast-aes-key.ts"),F=P("./src/crypt/aes-decryptor.ts"),K=P("./src/utils/logger.ts"),G=P("./src/utils/mp4-tools.ts"),M=P("./src/utils/typed-array.ts"),R=16,g=function(){function p(d,s,c){var l=c===void 0?{}:c,n=l.removePKCS7Padding,o=n===void 0?!0:n;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=d,this.config=s,this.removePKCS7Padding=o,o)try{var h=self.crypto;h&&(this.subtle=h.subtle||h.webkitSubtle)}catch(L){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var f=p.prototype;return f.destroy=function(){this.observer=null},f.isSync=function(){return this.config.enableSoftwareAES},f.flush=function(){var s=this.currentResult;if(!s){this.reset();return}var c=new Uint8Array(s);return this.reset(),this.removePKCS7Padding?Object(F.removePadding)(c):c},f.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},f.decrypt=function(s,c,l,n){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(s),c,l);var o=this.flush();o&&n(o.buffer)}else this.webCryptoDecrypt(new Uint8Array(s),c,l).then(n)},f.softwareDecrypt=function(s,c,l){var n=this.currentIV,o=this.currentResult,h=this.remainderData;this.logOnce("JS AES decrypt"),h&&(s=Object(G.appendUint8Array)(h,s),this.remainderData=null);var L=this.getValidChunk(s);if(!L.length)return null;n&&(l=n);var S=this.softwareDecrypter;S||(S=this.softwareDecrypter=new F.default),S.expandKey(c);var x=o;return this.currentResult=S.decrypt(L.buffer,0,l),this.currentIV=Object(M.sliceUint8)(L,-16).buffer,x||null},f.webCryptoDecrypt=function(s,c,l){var n=this,o=this.subtle;return(this.key!==c||!this.fastAesKey)&&(this.key=c,this.fastAesKey=new B.default(o,c)),this.fastAesKey.expandKey().then(function(h){if(!o)return Promise.reject(new Error("web crypto not initialized"));var L=new Q.default(o,l);return L.decrypt(s.buffer,h)}).catch(function(h){return n.onWebCryptoError(h,s,c,l)})},f.onWebCryptoError=function(s,c,l,n){return K.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",s),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(c,l,n)},f.getValidChunk=function(s){var c=s,l=s.length-s.length%R;return l!==s.length&&(c=Object(M.sliceUint8)(s,0,l),this.remainderData=Object(M.sliceUint8)(s,l)),c},f.logOnce=function(s){if(!this.logEnabled)return;K.logger.log("[decrypter.ts]: "+s),this.logEnabled=!1},p}()},"./src/crypt/fast-aes-key.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return Q});var Q=function(){function B(K,G){this.subtle=void 0,this.key=void 0,this.subtle=K,this.key=G}var F=B.prototype;return F.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},B}()},"./src/demux/aacdemuxer.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/demux/base-audio-demuxer.ts"),B=P("./src/demux/adts.ts"),F=P("./src/utils/logger.ts"),K=P("./src/demux/id3.ts");function G(g,p){g.prototype=Object.create(p.prototype),g.prototype.constructor=g,M(g,p)}function M(g,p){return M=Object.setPrototypeOf||function(d,s){return d.__proto__=s,d},M(g,p)}var R=function(g){G(p,g);function p(d,s){var c;return c=g.call(this)||this,c.observer=void 0,c.config=void 0,c.observer=d,c.config=s,c}var f=p.prototype;return f.resetInitSegment=function(s,c,l){g.prototype.resetInitSegment.call(this,s,c,l),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:s,duration:l,inputTimeScale:9e4,dropped:0}},p.probe=function(s){if(!s)return!1;for(var c=K.getID3Data(s,0)||[],l=c.length,n=s.length;l<n;l++)if(B.probe(s,l))return F.logger.log("ADTS sync word found !"),!0;return!1},f.canParse=function(s,c){return B.canParse(s,c)},f.appendFrame=function(s,c,l){B.initTrackConfig(s,this.observer,c,l,s.manifestCodec);var n=B.appendFrame(s,c,l,this.initPTS,this.frameIndex);if(n&&n.missing===0)return n},p}(Q.default);R.minProbeByteLength=9,Z.default=R},"./src/demux/adts.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"getAudioConfig",function(){return K}),P.d(Z,"isHeaderPattern",function(){return G}),P.d(Z,"getHeaderLength",function(){return M}),P.d(Z,"getFullFrameLength",function(){return R}),P.d(Z,"canGetFrameLength",function(){return g}),P.d(Z,"isHeader",function(){return p}),P.d(Z,"canParse",function(){return f}),P.d(Z,"probe",function(){return d}),P.d(Z,"initTrackConfig",function(){return s}),P.d(Z,"getFrameDuration",function(){return c}),P.d(Z,"parseFrameHeader",function(){return l}),P.d(Z,"appendFrame",function(){return n});var Q=P("./src/utils/logger.ts"),B=P("./src/errors.ts"),F=P("./src/events.ts");function K(o,h,L,S){var x,O,C,w,T=navigator.userAgent.toLowerCase(),_=S,u=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];x=((h[L+2]&192)>>>6)+1;var E=(h[L+2]&60)>>>2;if(E>u.length-1){o.trigger(F.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+E});return}return C=(h[L+2]&1)<<2,C|=(h[L+3]&192)>>>6,Q.logger.log("manifest codec:"+S+", ADTS type:"+x+", samplingIndex:"+E),/firefox/i.test(T)?E>=6?(x=5,w=new Array(4),O=E-3):(x=2,w=new Array(2),O=E):T.indexOf("android")!==-1?(x=2,w=new Array(2),O=E):(x=5,w=new Array(4),S&&(S.indexOf("mp4a.40.29")!==-1||S.indexOf("mp4a.40.5")!==-1)||!S&&E>=6?O=E-3:((S&&S.indexOf("mp4a.40.2")!==-1&&(E>=6&&C===1||/vivaldi/i.test(T))||!S&&C===1)&&(x=2,w=new Array(2)),O=E)),w[0]=x<<3,w[0]|=(E&14)>>1,w[1]|=(E&1)<<7,w[1]|=C<<3,x===5&&(w[1]|=(O&14)>>1,w[2]=(O&1)<<7,w[2]|=2<<2,w[3]=0),{config:w,samplerate:u[E],channelCount:C,codec:"mp4a.40."+x,manifestCodec:_}}function G(o,h){return o[h]===255&&(o[h+1]&246)===240}function M(o,h){return o[h+1]&1?7:9}function R(o,h){return(o[h+3]&3)<<11|o[h+4]<<3|(o[h+5]&224)>>>5}function g(o,h){return h+5<o.length}function p(o,h){return h+1<o.length&&G(o,h)}function f(o,h){return g(o,h)&&G(o,h)&&R(o,h)<=o.length-h}function d(o,h){if(p(o,h)){var L=M(o,h);if(h+L>=o.length)return!1;var S=R(o,h);if(S<=L)return!1;var x=h+S;return x===o.length||p(o,x)}return!1}function s(o,h,L,S,x){if(!o.samplerate){var O=K(h,L,S,x);if(!O)return;o.config=O.config,o.samplerate=O.samplerate,o.channelCount=O.channelCount,o.codec=O.codec,o.manifestCodec=O.manifestCodec,Q.logger.log("parsed codec:"+o.codec+", rate:"+O.samplerate+", channels:"+O.channelCount)}}function c(o){return 1024*9e4/o}function l(o,h,L,S,x){var O=M(o,h),C=R(o,h);if(C-=O,C>0){var w=L+S*x;return{headerLength:O,frameLength:C,stamp:w}}}function n(o,h,L,S,x){var O=c(o.samplerate),C=l(h,L,S,x,O);if(C){var w=C.frameLength,T=C.headerLength,_=C.stamp,u=T+w,E=Math.max(0,L+u-h.length),m;E?(m=new Uint8Array(u-T),m.set(h.subarray(L+T,h.length),0)):m=h.subarray(L+T,L+u);var b={unit:m,pts:_};return E||o.samples.push(b),{sample:b,length:u,missing:E}}}},"./src/demux/base-audio-demuxer.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"initPTSFn",function(){return R});var Q=P("./src/polyfills/number.ts"),B=P("./src/demux/id3.ts"),F=P("./src/demux/dummy-demuxed-track.ts"),K=P("./src/utils/mp4-tools.ts"),G=P("./src/utils/typed-array.ts"),M=function(){function g(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var p=g.prototype;return p.resetInitSegment=function(d,s,c){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},p.resetTimeStamp=function(){},p.resetContiguity=function(){},p.canParse=function(d,s){return!1},p.appendFrame=function(d,s,c){},p.demux=function(d,s){this.cachedData&&(d=Object(K.appendUint8Array)(this.cachedData,d),this.cachedData=null);var c=B.getID3Data(d,0),l=c?c.length:0,n,o,h=this._audioTrack,L=this._id3Track,S=c?B.getTimeStamp(c):void 0,x=d.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=R(S,s)),c&&c.length>0&&L.samples.push({pts:this.initPTS,dts:this.initPTS,data:c}),o=this.initPTS;l<x;){if(this.canParse(d,l)){var O=this.appendFrame(h,d,l);O?(this.frameIndex++,o=O.sample.pts,l+=O.length,n=l):l=x}else B.canParse(d,l)?(c=B.getID3Data(d,l),L.samples.push({pts:o,dts:o,data:c}),l+=c.length,n=l):l++;if(l===x&&n!==x){var C=Object(G.sliceUint8)(d,n);this.cachedData?this.cachedData=Object(K.appendUint8Array)(this.cachedData,C):this.cachedData=C}}return{audioTrack:h,avcTrack:Object(F.dummyTrack)(),id3Track:L,textTrack:Object(F.dummyTrack)()}},p.demuxSampleAes=function(d,s,c){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},p.flush=function(d){var s=this.cachedData;return s&&(this.cachedData=null,this.demux(s,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(F.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(F.dummyTrack)()}},p.destroy=function(){},g}(),R=function(p,f){return Object(Q.isFiniteNumber)(p)?p*90:f*9e4};Z.default=M},"./src/demux/chunk-cache.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return Q});var Q=function(){function F(){this.chunks=[],this.dataLength=0}var K=F.prototype;return K.push=function(M){this.chunks.push(M),this.dataLength+=M.length},K.flush=function(){var M=this.chunks,R=this.dataLength,g;if(M.length)M.length===1?g=M[0]:g=B(M,R);else return new Uint8Array(0);return this.reset(),g},K.reset=function(){this.chunks.length=0,this.dataLength=0},F}();function B(F,K){for(var G=new Uint8Array(K),M=0,R=0;R<F.length;R++){var g=F[R];G.set(g,M),M+=g.length}return G}},"./src/demux/dummy-demuxed-track.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"dummyTrack",function(){return Q});function Q(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/utils/logger.ts"),B=function(){function F(G){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=G,this.bytesAvailable=G.byteLength,this.word=0,this.bitsAvailable=0}var K=F.prototype;return K.loadWord=function(){var M=this.data,R=this.bytesAvailable,g=M.byteLength-R,p=new Uint8Array(4),f=Math.min(4,R);if(f===0)throw new Error("no bytes available");p.set(M.subarray(g,g+f)),this.word=new DataView(p.buffer).getUint32(0),this.bitsAvailable=f*8,this.bytesAvailable-=f},K.skipBits=function(M){var R;this.bitsAvailable>M?(this.word<<=M,this.bitsAvailable-=M):(M-=this.bitsAvailable,R=M>>3,M-=R>>3,this.bytesAvailable-=R,this.loadWord(),this.word<<=M,this.bitsAvailable-=M)},K.readBits=function(M){var R=Math.min(this.bitsAvailable,M),g=this.word>>>32-R;return M>32&&Q.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=R,this.bitsAvailable>0?this.word<<=R:this.bytesAvailable>0&&this.loadWord(),R=M-R,R>0&&this.bitsAvailable?g<<R|this.readBits(R):g},K.skipLZ=function(){var M;for(M=0;M<this.bitsAvailable;++M)if((this.word&2147483648>>>M)!==0)return this.word<<=M,this.bitsAvailable-=M,M;return this.loadWord(),M+this.skipLZ()},K.skipUEG=function(){this.skipBits(1+this.skipLZ())},K.skipEG=function(){this.skipBits(1+this.skipLZ())},K.readUEG=function(){var M=this.skipLZ();return this.readBits(M+1)-1},K.readEG=function(){var M=this.readUEG();return 1&M?1+M>>>1:-1*(M>>>1)},K.readBoolean=function(){return this.readBits(1)===1},K.readUByte=function(){return this.readBits(8)},K.readUShort=function(){return this.readBits(16)},K.readUInt=function(){return this.readBits(32)},K.skipScalingList=function(M){for(var R=8,g=8,p,f=0;f<M;f++)g!==0&&(p=this.readEG(),g=(R+p+256)%256),R=g===0?R:g},K.readSPS=function(){var M=0,R=0,g=0,p=0,f,d,s,c=this.readUByte.bind(this),l=this.readBits.bind(this),n=this.readUEG.bind(this),o=this.readBoolean.bind(this),h=this.skipBits.bind(this),L=this.skipEG.bind(this),S=this.skipUEG.bind(this),x=this.skipScalingList.bind(this);c();var O=c();if(l(5),h(3),c(),S(),O===100||O===110||O===122||O===244||O===44||O===83||O===86||O===118||O===128){var C=n();if(C===3&&h(1),S(),S(),h(1),o())for(d=C!==3?8:12,s=0;s<d;s++)o()&&(s<6?x(16):x(64))}S();var w=n();if(w===0)n();else if(w===1)for(h(1),L(),L(),f=n(),s=0;s<f;s++)L();S(),h(1);var T=n(),_=n(),u=l(1);u===0&&h(1),h(1),o()&&(M=n(),R=n(),g=n(),p=n());var E=[1,1];if(o()&&o()){var m=c();switch(m){case 1:E=[1,1];break;case 2:E=[12,11];break;case 3:E=[10,11];break;case 4:E=[16,11];break;case 5:E=[40,33];break;case 6:E=[24,11];break;case 7:E=[20,11];break;case 8:E=[32,11];break;case 9:E=[80,33];break;case 10:E=[18,11];break;case 11:E=[15,11];break;case 12:E=[64,33];break;case 13:E=[160,99];break;case 14:E=[4,3];break;case 15:E=[3,2];break;case 16:E=[2,1];break;case 255:{E=[c()<<8|c(),c()<<8|c()];break}}}return{width:Math.ceil((T+1)*16-M*2-R*2),height:(2-u)*(_+1)*16-(u?2:4)*(g+p),pixelRatio:E}},K.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},F}();Z.default=B},"./src/demux/id3.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"isHeader",function(){return Q}),P.d(Z,"isFooter",function(){return B}),P.d(Z,"getID3Data",function(){return F}),P.d(Z,"canParse",function(){return G}),P.d(Z,"getTimeStamp",function(){return M}),P.d(Z,"isTimeStampFrame",function(){return R}),P.d(Z,"getID3Frames",function(){return p}),P.d(Z,"decodeFrame",function(){return f}),P.d(Z,"utf8ArrayToStr",function(){return n}),P.d(Z,"testables",function(){return o});var Q=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)))},B=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)))},F=function(x,O){for(var C=O,w=0;Q(x,O);){w+=10;var T=K(x,O+6);w+=T,B(x,O+10)&&(w+=10),O+=w}return w>0?x.subarray(C,C+w):void 0},K=function(x,O){var C=0;return C=(x[O]&127)<<21,C|=(x[O+1]&127)<<14,C|=(x[O+2]&127)<<7,C|=x[O+3]&127,C},G=function(x,O){return Q(x,O)&&K(x,O+6)+10<=x.length-O},M=function(x){for(var O=p(x),C=0;C<O.length;C++){var w=O[C];if(R(w))return l(w)}return},R=function(x){return x&&x.key==="PRIV"&&x.info==="com.apple.streaming.transportStreamTimestamp"},g=function(x){var O=String.fromCharCode(x[0],x[1],x[2],x[3]),C=K(x,4),w=10;return{type:O,size:C,data:x.subarray(w,w+C)}},p=function(x){for(var O=0,C=[];Q(x,O);){var w=K(x,O+6);O+=10;for(var T=O+w;O+8<T;){var _=g(x.subarray(O)),u=f(_);u&&C.push(u),O+=_.size+10}B(x,O)&&(O+=10)}return C},f=function(x){return x.type==="PRIV"?d(x):x.type[0]==="W"?c(x):s(x)},d=function(x){if(x.size<2)return;var O=n(x.data,!0),C=new Uint8Array(x.data.subarray(O.length+1));return{key:x.type,info:O,data:C.buffer}},s=function(x){if(x.size<2)return;if(x.type==="TXXX"){var O=1,C=n(x.data.subarray(O),!0);O+=C.length+1;var w=n(x.data.subarray(O));return{key:x.type,info:C,data:w}}var T=n(x.data.subarray(1));return{key:x.type,data:T}},c=function(x){if(x.type==="WXXX"){if(x.size<2)return;var O=1,C=n(x.data.subarray(O),!0);O+=C.length+1;var w=n(x.data.subarray(O));return{key:x.type,info:C,data:w}}var T=n(x.data);return{key:x.type,data:T}},l=function(x){if(x.data.byteLength===8){var O=new Uint8Array(x.data),C=O[3]&1,w=(O[4]<<23)+(O[5]<<15)+(O[6]<<7)+O[7];return w/=45,C&&(w+=4772185884e-2),Math.round(w)}return},n=function(x,O){O===void 0&&(O=!1);var C=L();if(C){var w=C.decode(x);if(O){var T=w.indexOf("\0");return T!==-1?w.substring(0,T):w}return w.replace(/\0/g,"")}for(var _=x.length,u,E,m,b="",N=0;N<_;){if(u=x[N++],u===0&&O)return b;if(u===0||u===3)continue;switch(u>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:b+=String.fromCharCode(u);break;case 12:case 13:E=x[N++],b+=String.fromCharCode((u&31)<<6|E&63);break;case 14:E=x[N++],m=x[N++],b+=String.fromCharCode((u&15)<<12|(E&63)<<6|(m&63)<<0);break;default:}}return b},o={decodeTextFrame:s},h;function L(){return!h&&typeof self.TextDecoder!="undefined"&&(h=new self.TextDecoder("utf-8")),h}},"./src/demux/mp3demuxer.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/demux/base-audio-demuxer.ts"),B=P("./src/demux/id3.ts"),F=P("./src/utils/logger.ts"),K=P("./src/demux/mpegaudio.ts");function G(g,p){g.prototype=Object.create(p.prototype),g.prototype.constructor=g,M(g,p)}function M(g,p){return M=Object.setPrototypeOf||function(d,s){return d.__proto__=s,d},M(g,p)}var R=function(g){G(p,g);function p(){return g.apply(this,arguments)||this}var f=p.prototype;return f.resetInitSegment=function(s,c,l){g.prototype.resetInitSegment.call(this,s,c,l),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:s,duration:l,inputTimeScale:9e4,dropped:0}},p.probe=function(s){if(!s)return!1;for(var c=B.getID3Data(s,0)||[],l=c.length,n=s.length;l<n;l++)if(K.probe(s,l))return F.logger.log("MPEG Audio sync word found !"),!0;return!1},f.canParse=function(s,c){return K.canParse(s,c)},f.appendFrame=function(s,c,l){return this.initPTS===null?void 0:K.appendFrame(s,c,l,this.initPTS,this.frameIndex)},p}(Q.default);R.minProbeByteLength=4,Z.default=R},"./src/demux/mp4demuxer.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/utils/mp4-tools.ts"),B=P("./src/demux/dummy-demuxed-track.ts"),F=function(){function K(M,R){this.remainderData=null,this.config=void 0,this.config=R}var G=K.prototype;return G.resetTimeStamp=function(){},G.resetInitSegment=function(){},G.resetContiguity=function(){},K.probe=function(R){return Object(Q.findBox)({data:R,start:0,end:Math.min(R.length,16384)},["moof"]).length>0},G.demux=function(R){var g=R,p=Object(B.dummyTrack)();if(this.config.progressive){this.remainderData&&(g=Object(Q.appendUint8Array)(this.remainderData,R));var f=Object(Q.segmentValidRange)(g);this.remainderData=f.remainder,p.samples=f.valid||new Uint8Array}else p.samples=g;return{audioTrack:Object(B.dummyTrack)(),avcTrack:p,id3Track:Object(B.dummyTrack)(),textTrack:Object(B.dummyTrack)()}},G.flush=function(){var R=Object(B.dummyTrack)();return R.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(B.dummyTrack)(),avcTrack:R,id3Track:Object(B.dummyTrack)(),textTrack:Object(B.dummyTrack)()}},G.demuxSampleAes=function(R,g,p){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},G.destroy=function(){},K}();F.minProbeByteLength=1024,Z.default=F},"./src/demux/mpegaudio.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"appendFrame",function(){return M}),P.d(Z,"parseHeader",function(){return R}),P.d(Z,"isHeaderPattern",function(){return g}),P.d(Z,"isHeader",function(){return p}),P.d(Z,"canParse",function(){return f}),P.d(Z,"probe",function(){return d});var Q=null,B=[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],F=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],K=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],G=[0,1,1,4];function M(s,c,l,n,o){if(l+24>c.length)return;var h=R(c,l);if(h&&l+h.frameLength<=c.length){var L=h.samplesPerFrame*9e4/h.sampleRate,S=n+o*L,x={unit:c.subarray(l,l+h.frameLength),pts:S,dts:S};return s.config=[],s.channelCount=h.channelCount,s.samplerate=h.sampleRate,s.samples.push(x),{sample:x,length:h.frameLength,missing:0}}}function R(s,c){var l=s[c+1]>>3&3,n=s[c+1]>>1&3,o=s[c+2]>>4&15,h=s[c+2]>>2&3;if(l!==1&&o!==0&&o!==15&&h!==3){var L=s[c+2]>>1&1,S=s[c+3]>>6,x=l===3?3-n:n===3?3:4,O=B[x*14+o-1]*1e3,C=l===3?0:l===2?1:2,w=F[C*3+h],T=S===3?1:2,_=K[l][n],u=G[n],E=_*8*u,m=Math.floor(_*O/w+L)*u;if(Q===null){var b=navigator.userAgent||"",N=b.match(/Chrome\/(\d+)/i);Q=N?parseInt(N[1]):0}var D=!!Q&&Q<=87;return D&&n===2&&O>=224e3&&S===0&&(s[c+3]=s[c+3]|128),{sampleRate:w,channelCount:T,frameLength:m,samplesPerFrame:E}}}function g(s,c){return s[c]===255&&(s[c+1]&224)===224&&(s[c+1]&6)!==0}function p(s,c){return c+1<s.length&&g(s,c)}function f(s,c){var l=4;return g(s,c)&&l<=s.length-c}function d(s,c){if(c+1<s.length&&g(s,c)){var l=4,n=R(s,c),o=l;n!=null&&n.frameLength&&(o=n.frameLength);var h=c+o;return h===s.length||p(s,h)}return!1}},"./src/demux/sample-aes.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/crypt/decrypter.ts"),B=P("./src/demux/tsdemuxer.ts"),F=function(){function K(M,R,g){this.keyData=void 0,this.decrypter=void 0,this.keyData=g,this.decrypter=new Q.default(M,R,{removePKCS7Padding:!1})}var G=K.prototype;return G.decryptBuffer=function(R,g){this.decrypter.decrypt(R,this.keyData.key.buffer,this.keyData.iv.buffer,g)},G.decryptAacSample=function(R,g,p,f){var d=R[g].unit,s=d.subarray(16,d.length-d.length%16),c=s.buffer.slice(s.byteOffset,s.byteOffset+s.length),l=this;this.decryptBuffer(c,function(n){var o=new Uint8Array(n);d.set(o,16),f||l.decryptAacSamples(R,g+1,p)})},G.decryptAacSamples=function(R,g,p){for(;;g++){if(g>=R.length){p();return}if(R[g].unit.length<32)continue;var f=this.decrypter.isSync();if(this.decryptAacSample(R,g,p,f),!f)return}},G.getAvcEncryptedData=function(R){for(var g=Math.floor((R.length-48)/160)*16+16,p=new Int8Array(g),f=0,d=32;d<=R.length-16;d+=160,f+=16)p.set(R.subarray(d,d+16),f);return p},G.getAvcDecryptedUnit=function(R,g){for(var p=new Uint8Array(g),f=0,d=32;d<=R.length-16;d+=160,f+=16)R.set(p.subarray(f,f+16),d);return R},G.decryptAvcSample=function(R,g,p,f,d,s){var c=Object(B.discardEPB)(d.data),l=this.getAvcEncryptedData(c),n=this;this.decryptBuffer(l.buffer,function(o){d.data=n.getAvcDecryptedUnit(c,o),s||n.decryptAvcSamples(R,g,p+1,f)})},G.decryptAvcSamples=function(R,g,p,f){if(R instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;g++,p=0){if(g>=R.length){f();return}for(var d=R[g].units;!(p>=d.length);p++){var s=d[p];if(s.data.length<=48||s.type!==1&&s.type!==5)continue;var c=this.decrypter.isSync();if(this.decryptAvcSample(R,g,p,f,s,c),!c)return}}},K}();Z.default=F},"./src/demux/transmuxer-interface.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return d});var Q=P("./node_modules/webworkify-webpack/index.js"),B=P.n(Q),F=P("./src/events.ts"),K=P("./src/demux/transmuxer.ts"),G=P("./src/utils/logger.ts"),M=P("./src/errors.ts"),R=P("./src/utils/mediasource-helper.ts"),g=P("./node_modules/eventemitter3/index.js"),p=P.n(g),f=Object(R.getMediaSource)()||{isTypeSupported:function(){return!1}},d=function(){function s(l,n,o,h){var L=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=l,this.id=n,this.onTransmuxComplete=o,this.onFlush=h;var S=l.config,x=function(_,u){u=u||{},u.frag=L.frag,u.id=L.id,l.trigger(_,u)};this.observer=new g.EventEmitter,this.observer.on(F.Events.FRAG_DECRYPTED,x),this.observer.on(F.Events.ERROR,x);var O={mp4:f.isTypeSupported("video/mp4"),mpeg:f.isTypeSupported("audio/mpeg"),mp3:f.isTypeSupported('audio/mp4; codecs="mp3"')},C=navigator.vendor;if(S.enableWorker&&typeof Worker!="undefined"){G.logger.log("demuxing in webworker");var w;try{w=this.worker=Q("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),w.addEventListener("message",this.onwmsg),w.onerror=function(T){l.trigger(F.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(T.message+" ("+T.filename+":"+T.lineno+")")})},w.postMessage({cmd:"init",typeSupported:O,vendor:C,id:n,config:JSON.stringify(S)})}catch(T){G.logger.warn("Error in worker:",T),G.logger.error("Error while initializing DemuxerWorker, fallback to inline"),w&&self.URL.revokeObjectURL(w.objectURL),this.transmuxer=new K.default(this.observer,O,S,C,n),this.worker=null}}else this.transmuxer=new K.default(this.observer,O,S,C,n)}var c=s.prototype;return c.destroy=function(){var n=this.worker;if(n)n.removeEventListener("message",this.onwmsg),n.terminate(),this.worker=null;else{var o=this.transmuxer;o&&(o.destroy(),this.transmuxer=null)}var h=this.observer;h&&h.removeAllListeners(),this.observer=null},c.push=function(n,o,h,L,S,x,O,C,w,T){var _=this;w.transmuxing.start=self.performance.now();var u=this.transmuxer,E=this.worker,m=x?x.start:S.start,b=S.decryptdata,N=this.frag,D=!(N&&S.cc===N.cc),H=!(N&&w.level===N.level),j=N?w.sn-N.sn:-1,I=this.part?w.part-this.part.index:1,y=!H&&(j===1||j===0&&I===1),W=self.performance.now();(H||j||S.stats.parsing.start===0)&&(S.stats.parsing.start=W),x&&(I||!y)&&(x.stats.parsing.start=W);var Y=new K.TransmuxState(D,y,C,H,m);if(!y||D){G.logger.log("[transmuxer-interface, "+S.type+"]: Starting new transmux session for sn: "+w.sn+" p: "+w.part+" level: "+w.level+" id: "+w.id+`
|
|
discontinuity: `+D+`
|
|
trackSwitch: `+H+`
|
|
contiguous: `+y+`
|
|
accurateTimeOffset: `+C+`
|
|
timeOffset: `+m);var ie=new K.TransmuxConfig(h,L,o,O,T);this.configureTransmuxer(ie)}if(this.frag=S,this.part=x,E)E.postMessage({cmd:"demux",data:n,decryptdata:b,chunkMeta:w,state:Y},n instanceof ArrayBuffer?[n]:[]);else if(u){var oe=u.push(n,b,w,Y);Object(K.isPromise)(oe)?oe.then(function(we){_.handleTransmuxComplete(we)}):this.handleTransmuxComplete(oe)}},c.flush=function(n){var o=this;n.transmuxing.start=self.performance.now();var h=this.transmuxer,L=this.worker;if(L)L.postMessage({cmd:"flush",chunkMeta:n});else if(h){var S=h.flush(n);Object(K.isPromise)(S)?S.then(function(x){o.handleFlushResult(x,n)}):this.handleFlushResult(S,n)}},c.handleFlushResult=function(n,o){var h=this;n.forEach(function(L){h.handleTransmuxComplete(L)}),this.onFlush(o)},c.onWorkerMessage=function(n){var o=n.data,h=this.hls;switch(o.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(o.data);break}case"flush":{this.onFlush(o.data);break}default:{o.data=o.data||{},o.data.frag=this.frag,o.data.id=this.id,h.trigger(o.event,o.data);break}}},c.configureTransmuxer=function(n){var o=this.worker,h=this.transmuxer;o?o.postMessage({cmd:"configure",config:n}):h&&h.configure(n)},c.handleTransmuxComplete=function(n){n.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(n)},s}()},"./src/demux/transmuxer-worker.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return M});var Q=P("./src/demux/transmuxer.ts"),B=P("./src/events.ts"),F=P("./src/utils/logger.ts"),K=P("./node_modules/eventemitter3/index.js"),G=P.n(K);function M(d){var s=new K.EventEmitter,c=function(n,o){d.postMessage({event:n,data:o})};s.on(B.Events.FRAG_DECRYPTED,c),s.on(B.Events.ERROR,c),d.addEventListener("message",function(l){var n=l.data;switch(n.cmd){case"init":{var o=JSON.parse(n.config);d.transmuxer=new Q.default(s,n.typeSupported,o,n.vendor,n.id),Object(F.enableLogs)(o.debug),c("init",null);break}case"configure":{d.transmuxer.configure(n.config);break}case"demux":{var h=d.transmuxer.push(n.data,n.decryptdata,n.chunkMeta,n.state);Object(Q.isPromise)(h)?h.then(function(x){R(d,x)}):R(d,h);break}case"flush":{var L=n.chunkMeta,S=d.transmuxer.flush(L);Object(Q.isPromise)(S)?S.then(function(x){p(d,x,L)}):p(d,S,L);break}default:break}})}function R(d,s){if(f(s.remuxResult))return;var c=[],l=s.remuxResult,n=l.audio,o=l.video;n&&g(c,n),o&&g(c,o),d.postMessage({event:"transmuxComplete",data:s},c)}function g(d,s){s.data1&&d.push(s.data1.buffer),s.data2&&d.push(s.data2.buffer)}function p(d,s,c){s.forEach(function(l){R(d,l)}),d.postMessage({event:"flush",data:c})}function f(d){return!d.audio&&!d.video&&!d.text&&!d.id3&&!d.initSegment}},"./src/demux/transmuxer.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return o}),P.d(Z,"isPromise",function(){return S}),P.d(Z,"TransmuxConfig",function(){return x}),P.d(Z,"TransmuxState",function(){return O});var Q=P("./src/events.ts"),B=P("./src/errors.ts"),F=P("./src/crypt/decrypter.ts"),K=P("./src/demux/aacdemuxer.ts"),G=P("./src/demux/mp4demuxer.ts"),M=P("./src/demux/tsdemuxer.ts"),R=P("./src/demux/mp3demuxer.ts"),g=P("./src/remux/mp4-remuxer.ts"),p=P("./src/remux/passthrough-remuxer.ts"),f=P("./src/demux/chunk-cache.ts"),d=P("./src/utils/mp4-tools.ts"),s=P("./src/utils/logger.ts"),c;try{c=self.performance.now.bind(self.performance)}catch(C){s.logger.debug("Unable to use Performance API on this environment"),c=self.Date.now}var l=[{demux:M.default,remux:g.default},{demux:G.default,remux:p.default},{demux:K.default,remux:g.default},{demux:R.default,remux:g.default}],n=1024;l.forEach(function(C){var w=C.demux;n=Math.max(n,w.minProbeByteLength)});var o=function(){function C(T,_,u,E,m){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new f.default,this.observer=T,this.typeSupported=_,this.config=u,this.vendor=E,this.id=m}var w=C.prototype;return w.configure=function(_){this.transmuxConfig=_,this.decrypter&&this.decrypter.reset()},w.push=function(_,u,E,m){var b=this,N=E.transmuxing;N.executeStart=c();var D=new Uint8Array(_),H=this.cache,j=this.config,I=this.currentTransmuxState,y=this.transmuxConfig;m&&(this.currentTransmuxState=m);var W=h(D,u);if(W&&W.method==="AES-128"){var Y=this.getDecrypter();if(j.enableSoftwareAES){var ie=Y.softwareDecrypt(D,W.key.buffer,W.iv.buffer);if(!ie)return N.executeEnd=c(),L(E);D=new Uint8Array(ie)}else return this.decryptionPromise=Y.webCryptoDecrypt(D,W.key.buffer,W.iv.buffer).then(function(Le){var Me=b.push(Le,null,E);return b.decryptionPromise=null,Me}),this.decryptionPromise}var oe=m||I,we=oe.contiguous,me=oe.discontinuity,Se=oe.trackSwitch,Ce=oe.accurateTimeOffset,xe=oe.timeOffset,pe=y.audioCodec,le=y.videoCodec,te=y.defaultInitPts,de=y.duration,se=y.initSegmentData;if((me||Se)&&this.resetInitSegment(se,pe,le,de),me&&this.resetInitialTimestamp(te),we||this.resetContiguity(),this.needsProbing(D,me,Se)){if(H.dataLength){var Oe=H.flush();D=Object(d.appendUint8Array)(Oe,D)}this.configureTransmuxer(D,y)}var ke=this.transmux(D,W,xe,Ce,E),Te=this.currentTransmuxState;return Te.contiguous=!0,Te.discontinuity=!1,Te.trackSwitch=!1,N.executeEnd=c(),ke},w.flush=function(_){var u=this,E=_.transmuxing;E.executeStart=c();var m=this.decrypter,b=this.cache,N=this.currentTransmuxState,D=this.decryptionPromise;if(D)return D.then(function(){return u.flush(_)});var H=[],j=N.timeOffset;if(m){var I=m.flush();I&&H.push(this.push(I,null,_))}var y=b.dataLength;b.reset();var W=this.demuxer,Y=this.remuxer;if(!W||!Y)return y>=n&&this.observer.emit(Q.Events.ERROR,Q.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),E.executeEnd=c(),[L(_)];var ie=W.flush(j);return S(ie)?ie.then(function(oe){return u.flushRemux(H,oe,_),H}):(this.flushRemux(H,ie,_),H)},w.flushRemux=function(_,u,E){var m=u.audioTrack,b=u.avcTrack,N=u.id3Track,D=u.textTrack,H=this.currentTransmuxState,j=H.accurateTimeOffset,I=H.timeOffset;s.logger.log("[transmuxer.ts]: Flushed fragment "+E.sn+(E.part>-1?" p: "+E.part:"")+" of level "+E.level);var y=this.remuxer.remux(m,b,N,D,I,j,!0,this.id);_.push({remuxResult:y,chunkMeta:E}),E.transmuxing.executeEnd=c()},w.resetInitialTimestamp=function(_){var u=this.demuxer,E=this.remuxer;if(!u||!E)return;u.resetTimeStamp(_),E.resetTimeStamp(_)},w.resetContiguity=function(){var _=this.demuxer,u=this.remuxer;if(!_||!u)return;_.resetContiguity(),u.resetNextTimestamp()},w.resetInitSegment=function(_,u,E,m){var b=this.demuxer,N=this.remuxer;if(!b||!N)return;b.resetInitSegment(u,E,m),N.resetInitSegment(_,u,E)},w.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},w.transmux=function(_,u,E,m,b){var N;return u&&u.method==="SAMPLE-AES"?N=this.transmuxSampleAes(_,u,E,m,b):N=this.transmuxUnencrypted(_,E,m,b),N},w.transmuxUnencrypted=function(_,u,E,m){var b=this.demuxer.demux(_,u,!1,!this.config.progressive),N=b.audioTrack,D=b.avcTrack,H=b.id3Track,j=b.textTrack,I=this.remuxer.remux(N,D,H,j,u,E,!1,this.id);return{remuxResult:I,chunkMeta:m}},w.transmuxSampleAes=function(_,u,E,m,b){var N=this;return this.demuxer.demuxSampleAes(_,u,E).then(function(D){var H=N.remuxer.remux(D.audioTrack,D.avcTrack,D.id3Track,D.textTrack,E,m,!1,N.id);return{remuxResult:H,chunkMeta:b}})},w.configureTransmuxer=function(_,u){for(var E=this.config,m=this.observer,b=this.typeSupported,N=this.vendor,D=u.audioCodec,H=u.defaultInitPts,j=u.duration,I=u.initSegmentData,y=u.videoCodec,W,Y=0,ie=l.length;Y<ie;Y++)if(l[Y].demux.probe(_)){W=l[Y];break}W||(s.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),W={demux:G.default,remux:p.default});var oe=this.demuxer,we=this.remuxer,me=W.remux,Se=W.demux;(!we||!(we instanceof me))&&(this.remuxer=new me(m,E,b,N)),(!oe||!(oe instanceof Se))&&(this.demuxer=new Se(m,E,b),this.probe=Se.probe),this.resetInitSegment(I,D,y,j),this.resetInitialTimestamp(H)},w.needsProbing=function(_,u,E){return!this.demuxer||!this.remuxer||u||E},w.getDecrypter=function(){var _=this.decrypter;return _||(_=this.decrypter=new F.default(this.observer,this.config)),_},C}();function h(C,w){var T=null;return C.byteLength>0&&w!=null&&w.key!=null&&w.iv!==null&&w.method!=null&&(T=w),T}var L=function(w){return{remuxResult:{},chunkMeta:w}};function S(C){return"then"in C&&C.then instanceof Function}var x=function(w,T,_,u,E){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=w,this.videoCodec=T,this.initSegmentData=_,this.duration=u,this.defaultInitPts=E},O=function(w,T,_,u,E){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=w,this.contiguous=T,this.accurateTimeOffset=_,this.trackSwitch=u,this.timeOffset=E}},"./src/demux/tsdemuxer.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"discardEPB",function(){return L});var Q=P("./src/demux/adts.ts"),B=P("./src/demux/mpegaudio.ts"),F=P("./src/demux/exp-golomb.ts"),K=P("./src/demux/id3.ts"),G=P("./src/demux/sample-aes.ts"),M=P("./src/events.ts"),R=P("./src/utils/mp4-tools.ts"),g=P("./src/utils/logger.ts"),p=P("./src/errors.ts"),f={video:1,audio:2,id3:3,text:4},d=function(){function S(O,C,w){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=C,this.typeSupported=w}S.probe=function(C){var w=S.syncOffset(C);return w<0?!1:(w&&g.logger.warn("MPEG2-TS detected but first sync word found @ offset "+w+", junk ahead ?"),!0)},S.syncOffset=function(C){for(var w=Math.min(1e3,C.length-3*188),T=0;T<w;){if(C[T]===71&&C[T+188]===71&&C[T+2*188]===71)return T;T++}return-1},S.createTrack=function(C,w){return{container:C==="video"||C==="audio"?"video/mp2t":void 0,type:C,id:f[C],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:C==="audio"?w:void 0}};var x=S.prototype;return x.resetInitSegment=function(C,w,T){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=S.createTrack("video",T),this._audioTrack=S.createTrack("audio",T),this._id3Track=S.createTrack("id3",T),this._txtTrack=S.createTrack("text",T),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=C,this.videoCodec=w,this._duration=T},x.resetTimeStamp=function(){},x.resetContiguity=function(){var C=this._audioTrack,w=this._avcTrack,T=this._id3Track;C&&(C.pesData=null),w&&(w.pesData=null),T&&(T.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},x.demux=function(C,w,T,_){T===void 0&&(T=!1),_===void 0&&(_=!1),T||(this.sampleAes=null);var u,E=this._avcTrack,m=this._audioTrack,b=this._id3Track,N=E.pid,D=E.pesData,H=m.pid,j=b.pid,I=m.pesData,y=b.pesData,W=!1,Y=this.pmtParsed,ie=this._pmtId,oe=C.length;if(this.remainderData&&(C=Object(R.appendUint8Array)(this.remainderData,C),oe=C.length,this.remainderData=null),oe<188&&!_)return this.remainderData=C,{audioTrack:m,avcTrack:E,id3Track:b,textTrack:this._txtTrack};var we=Math.max(0,S.syncOffset(C));oe-=(oe+we)%188,oe<C.byteLength&&!_&&(this.remainderData=new Uint8Array(C.buffer,oe,C.buffer.byteLength-oe));for(var me=we;me<oe;me+=188)if(C[me]===71){var Se=!!(C[me+1]&64),Ce=((C[me+1]&31)<<8)+C[me+2],xe=(C[me+3]&48)>>4,pe=void 0;if(xe>1){if(pe=me+5+C[me+4],pe===me+188)continue}else pe=me+4;switch(Ce){case N:Se&&(D&&(u=n(D))&&this.parseAVCPES(u,!1),D={data:[],size:0}),D&&(D.data.push(C.subarray(pe,me+188)),D.size+=me+188-pe);break;case H:Se&&(I&&(u=n(I))&&(m.isAAC?this.parseAACPES(u):this.parseMPEGPES(u)),I={data:[],size:0}),I&&(I.data.push(C.subarray(pe,me+188)),I.size+=me+188-pe);break;case j:Se&&(y&&(u=n(y))&&this.parseID3PES(u),y={data:[],size:0}),y&&(y.data.push(C.subarray(pe,me+188)),y.size+=me+188-pe);break;case 0:Se&&(pe+=C[pe]+1),ie=this._pmtId=c(C,pe);break;case ie:{Se&&(pe+=C[pe]+1);var le=l(C,pe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,T);N=le.avc,N>0&&(E.pid=N),H=le.audio,H>0&&(m.pid=H,m.isAAC=le.isAAC),j=le.id3,j>0&&(b.pid=j),W&&!Y&&(g.logger.log("reparse from beginning"),W=!1,me=we-188),Y=this.pmtParsed=!0;break}case 17:case 8191:break;default:W=!0;break}}else this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});E.pesData=D,m.pesData=I,b.pesData=y;var te={audioTrack:m,avcTrack:E,id3Track:b,textTrack:this._txtTrack};return _&&this.extractRemainingSamples(te),te},x.flush=function(){var C=this.remainderData;this.remainderData=null;var w;return C?w=this.demux(C,-1,!1,!0):w={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(w),this.sampleAes?this.decrypt(w,this.sampleAes):w},x.extractRemainingSamples=function(C){var w=C.audioTrack,T=C.avcTrack,_=C.id3Track,u=T.pesData,E=w.pesData,m=_.pesData,b;u&&(b=n(u))?(this.parseAVCPES(b,!0),T.pesData=null):T.pesData=u,E&&(b=n(E))?(w.isAAC?this.parseAACPES(b):this.parseMPEGPES(b),w.pesData=null):(E!=null&&E.size&&g.logger.log("last AAC PES packet truncated,might overlap between fragments"),w.pesData=E),m&&(b=n(m))?(this.parseID3PES(b),_.pesData=null):_.pesData=m},x.demuxSampleAes=function(C,w,T){var _=this.demux(C,T,!0,!this.config.progressive),u=this.sampleAes=new G.default(this.observer,this.config,w);return this.decrypt(_,u)},x.decrypt=function(C,w){return new Promise(function(T){var _=C.audioTrack,u=C.avcTrack;_.samples&&_.isAAC?w.decryptAacSamples(_.samples,0,function(){u.samples?w.decryptAvcSamples(u.samples,0,0,function(){T(C)}):T(C)}):u.samples&&w.decryptAvcSamples(u.samples,0,0,function(){T(C)})})},x.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},x.parseAVCPES=function(C,w){var T=this,_=this._avcTrack,u=this.parseAVCNALu(C.data),E=!1,m=this.avcSample,b,N=!1;C.data=null,m&&u.length&&!_.audFound&&(o(m,_),m=this.avcSample=s(!1,C.pts,C.dts,"")),u.forEach(function(D){switch(D.type){case 1:{b=!0,m||(m=T.avcSample=s(!0,C.pts,C.dts,"")),E&&(m.debug+="NDR "),m.frame=!0;var H=D.data;if(N&&H.length>4){var j=new F.default(H).readSliceType();(j===2||j===4||j===7||j===9)&&(m.key=!0)}break}case 5:b=!0,m||(m=T.avcSample=s(!0,C.pts,C.dts,"")),E&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{b=!0,E&&m&&(m.debug+="SEI ");var I=new F.default(L(D.data));I.readUByte();for(var y=0,W=0,Y=!1,ie=0;!Y&&I.bytesAvailable>1;){y=0;do ie=I.readUByte(),y+=ie;while(ie===255);W=0;do ie=I.readUByte(),W+=ie;while(ie===255);if(y===4&&I.bytesAvailable!==0){Y=!0;var oe=I.readUByte();if(oe===181){var we=I.readUShort();if(we===49){var me=I.readUInt();if(me===1195456820){var Se=I.readUByte();if(Se===3){for(var Ce=I.readUByte(),xe=I.readUByte(),pe=31&Ce,le=[Ce,xe],te=0;te<pe;te++)le.push(I.readUByte()),le.push(I.readUByte()),le.push(I.readUByte());h(T._txtTrack.samples,{type:3,pts:C.pts,bytes:le})}}}}}else if(y===5&&I.bytesAvailable!==0){if(Y=!0,W>16){for(var de=[],se=0;se<16;se++)de.push(I.readUByte().toString(16)),(se===3||se===5||se===7||se===9)&&de.push("-");for(var Oe=W-16,ke=new Uint8Array(Oe),Te=0;Te<Oe;Te++)ke[Te]=I.readUByte();h(T._txtTrack.samples,{pts:C.pts,payloadType:y,uuid:de.join(""),userData:Object(K.utf8ArrayToStr)(ke),userDataBytes:ke})}}else if(W<I.bytesAvailable)for(var Le=0;Le<W;Le++)I.readUByte()}break}case 7:if(b=!0,N=!0,E&&m&&(m.debug+="SPS "),!_.sps){var Me=new F.default(D.data),je=Me.readSPS();_.width=je.width,_.height=je.height,_.pixelRatio=je.pixelRatio,_.sps=[D.data],_.duration=T._duration;for(var Fe=D.data.subarray(1,4),Ne="avc1.",Ue=0;Ue<3;Ue++){var Je=Fe[Ue].toString(16);Je.length<2&&(Je="0"+Je),Ne+=Je}_.codec=Ne}break;case 8:b=!0,E&&m&&(m.debug+="PPS "),_.pps||(_.pps=[D.data]);break;case 9:b=!1,_.audFound=!0,m&&o(m,_),m=T.avcSample=s(!1,C.pts,C.dts,E?"AUD ":"");break;case 12:b=!1;break;default:b=!1,m&&(m.debug+="unknown NAL "+D.type+" ");break}if(m&&b){var tt=m.units;tt.push(D)}}),w&&m&&(o(m,_),this.avcSample=null)},x.getLastNalUnit=function(){var C,w=this.avcSample,T;if(!w||w.units.length===0){var _=this._avcTrack.samples;w=_[_.length-1]}if((C=w)!==null&&C!==void 0&&C.units){var u=w.units;T=u[u.length-1]}return T},x.parseAVCNALu=function(C){var w=C.byteLength,T=this._avcTrack,_=T.naluState||0,u=_,E=[],m=0,b,N,D,H=-1,j=0;for(_===-1&&(H=0,j=C[0]&31,_=0,m=1);m<w;){if(b=C[m++],!_){_=b?0:1;continue}if(_===1){_=b?0:2;continue}if(!b)_=3;else if(b===1){if(H>=0){var I={data:C.subarray(H,m-_-1),type:j};E.push(I)}else{var y=this.getLastNalUnit();if(y&&(u&&m<=4-u&&(y.state&&(y.data=y.data.subarray(0,y.data.byteLength-u))),N=m-_-1,N>0)){var W=new Uint8Array(y.data.byteLength+N);W.set(y.data,0),W.set(C.subarray(0,N),y.data.byteLength),y.data=W,y.state=0}}m<w?(D=C[m]&31,H=m,j=D,_=0):_=-1}else _=0}if(H>=0&&_>=0){var Y={data:C.subarray(H,w),type:j,state:_};E.push(Y)}if(E.length===0){var ie=this.getLastNalUnit();if(ie){var oe=new Uint8Array(ie.data.byteLength+C.byteLength);oe.set(ie.data,0),oe.set(C,ie.data.byteLength),ie.data=oe}}return T.naluState=_,E},x.parseAACPES=function(C){var w=0,T=this._audioTrack,_=this.aacOverFlow,u=C.data;if(_){this.aacOverFlow=null;var E=_.sample.unit.byteLength,m=Math.min(_.missing,E),b=E-m;_.sample.unit.set(u.subarray(0,m),b),T.samples.push(_.sample),w=_.missing}var N,D;for(N=w,D=u.length;N<D-1&&!Q.isHeader(u,N);N++);if(N!==w){var H,j;if(N<D-1?(H="AAC PES did not start with ADTS header,offset:"+N,j=!1):(H="no ADTS header found in AAC PES",j=!0),g.logger.warn("parsing error:"+H),this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:j,reason:H}),j)return}Q.initTrackConfig(T,this.observer,u,N,this.audioCodec);var I;if(C.pts!==void 0)I=C.pts;else if(_){var y=Q.getFrameDuration(T.samplerate);I=_.sample.pts+y}else{g.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var W=0;N<D;)if(Q.isHeader(u,N)){if(N+5<D){var Y=Q.appendFrame(T,u,N,I,W);if(Y)if(Y.missing)this.aacOverFlow=Y;else{N+=Y.length,W++;continue}}break}else N++},x.parseMPEGPES=function(C){var w=C.data,T=w.length,_=0,u=0,E=C.pts;if(E===void 0){g.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;u<T;)if(B.isHeader(w,u)){var m=B.appendFrame(this._audioTrack,w,u,E,_);if(m)u+=m.length,_++;else break}else u++},x.parseID3PES=function(C){if(C.pts===void 0){g.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(C)},S}();d.minProbeByteLength=188;function s(S,x,O,C){return{key:S,frame:!1,pts:x,dts:O,units:[],debug:C,length:0}}function c(S,x){return(S[x+10]&31)<<8|S[x+11]}function l(S,x,O,C){var w={audio:-1,avc:-1,id3:-1,isAAC:!0},T=(S[x+1]&15)<<8|S[x+2],_=x+3+T-4,u=(S[x+10]&15)<<8|S[x+11];for(x+=12+u;x<_;){var E=(S[x+1]&31)<<8|S[x+2];switch(S[x]){case 207:if(!C){g.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:w.audio===-1&&(w.audio=E);break;case 21:w.id3===-1&&(w.id3=E);break;case 219:if(!C){g.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:w.avc===-1&&(w.avc=E);break;case 3:case 4:O?w.audio===-1&&(w.audio=E,w.isAAC=!1):g.logger.log("MPEG audio found, not supported in this browser");break;case 36:g.logger.warn("Unsupported HEVC stream type found");break;default:break}x+=((S[x+3]&15)<<8|S[x+4])+5}return w}function n(S){var x=0,O,C,w,T,_,u=S.data;if(!S||S.size===0)return null;for(;u[0].length<19&&u.length>1;){var E=new Uint8Array(u[0].length+u[1].length);E.set(u[0]),E.set(u[1],u[0].length),u[0]=E,u.splice(1,1)}O=u[0];var m=(O[0]<<16)+(O[1]<<8)+O[2];if(m===1){if(C=(O[4]<<8)+O[5],C&&C>S.size-6)return null;var b=O[7];b&192&&(T=(O[9]&14)*536870912+(O[10]&255)*4194304+(O[11]&254)*16384+(O[12]&255)*128+(O[13]&254)/2,b&64?(_=(O[14]&14)*536870912+(O[15]&255)*4194304+(O[16]&254)*16384+(O[17]&255)*128+(O[18]&254)/2,T-_>60*9e4&&(g.logger.warn(Math.round((T-_)/9e4)+"s delta between PTS and DTS, align them"),T=_)):_=T),w=O[8];var N=w+9;if(S.size<=N)return null;S.size-=N;for(var D=new Uint8Array(S.size),H=0,j=u.length;H<j;H++){O=u[H];var I=O.byteLength;if(N)if(N>I){N-=I;continue}else O=O.subarray(N),I-=N,N=0;D.set(O,x),x+=I}return C&&(C-=w+3),{data:D,pts:T,dts:_,len:C}}return null}function o(S,x){if(S.units.length&&S.frame){if(S.pts===void 0){var O=x.samples,C=O.length;if(C){var w=O[C-1];S.pts=w.pts,S.dts=w.dts}else{x.dropped++;return}}x.samples.push(S)}S.debug.length&&g.logger.log(S.pts+"/"+S.dts+":"+S.debug)}function h(S,x){var O=S.length;if(O>0){if(x.pts>=S[O-1].pts)S.push(x);else for(var C=O-1;C>=0;C--)if(x.pts<S[C].pts){S.splice(C,0,x);break}}else S.push(x)}function L(S){for(var x=S.byteLength,O=[],C=1;C<x-2;)S[C]===0&&S[C+1]===0&&S[C+2]===3?(O.push(C+2),C+=2):C++;if(O.length===0)return S;var w=x-O.length,T=new Uint8Array(w),_=0;for(C=0;C<w;_++,C++)_===O[0]&&(_++,O.shift()),T[C]=S[_];return T}Z.default=d},"./src/errors.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"ErrorTypes",function(){return Q}),P.d(Z,"ErrorDetails",function(){return B});var Q;(function(F){F.NETWORK_ERROR="networkError",F.MEDIA_ERROR="mediaError",F.KEY_SYSTEM_ERROR="keySystemError",F.MUX_ERROR="muxError",F.OTHER_ERROR="otherError"})(Q||(Q={}));var B;(function(F){F.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",F.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",F.KEY_SYSTEM_NO_SESSION="keySystemNoSession",F.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",F.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",F.MANIFEST_LOAD_ERROR="manifestLoadError",F.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",F.MANIFEST_PARSING_ERROR="manifestParsingError",F.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",F.LEVEL_EMPTY_ERROR="levelEmptyError",F.LEVEL_LOAD_ERROR="levelLoadError",F.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",F.LEVEL_SWITCH_ERROR="levelSwitchError",F.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",F.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",F.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",F.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",F.FRAG_LOAD_ERROR="fragLoadError",F.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",F.FRAG_DECRYPT_ERROR="fragDecryptError",F.FRAG_PARSING_ERROR="fragParsingError",F.REMUX_ALLOC_ERROR="remuxAllocError",F.KEY_LOAD_ERROR="keyLoadError",F.KEY_LOAD_TIMEOUT="keyLoadTimeOut",F.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",F.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",F.BUFFER_APPEND_ERROR="bufferAppendError",F.BUFFER_APPENDING_ERROR="bufferAppendingError",F.BUFFER_STALLED_ERROR="bufferStalledError",F.BUFFER_FULL_ERROR="bufferFullError",F.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",F.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",F.INTERNAL_EXCEPTION="internalException",F.INTERNAL_ABORTED="aborted",F.UNKNOWN="unknown"})(B||(B={}))},"./src/events.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"Events",function(){return Q});var Q;(function(B){B.MEDIA_ATTACHING="hlsMediaAttaching",B.MEDIA_ATTACHED="hlsMediaAttached",B.MEDIA_DETACHING="hlsMediaDetaching",B.MEDIA_DETACHED="hlsMediaDetached",B.BUFFER_RESET="hlsBufferReset",B.BUFFER_CODECS="hlsBufferCodecs",B.BUFFER_CREATED="hlsBufferCreated",B.BUFFER_APPENDING="hlsBufferAppending",B.BUFFER_APPENDED="hlsBufferAppended",B.BUFFER_EOS="hlsBufferEos",B.BUFFER_FLUSHING="hlsBufferFlushing",B.BUFFER_FLUSHED="hlsBufferFlushed",B.MANIFEST_LOADING="hlsManifestLoading",B.MANIFEST_LOADED="hlsManifestLoaded",B.MANIFEST_PARSED="hlsManifestParsed",B.LEVEL_SWITCHING="hlsLevelSwitching",B.LEVEL_SWITCHED="hlsLevelSwitched",B.LEVEL_LOADING="hlsLevelLoading",B.LEVEL_LOADED="hlsLevelLoaded",B.LEVEL_UPDATED="hlsLevelUpdated",B.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",B.LEVELS_UPDATED="hlsLevelsUpdated",B.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",B.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",B.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",B.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",B.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",B.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",B.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",B.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",B.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",B.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",B.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",B.CUES_PARSED="hlsCuesParsed",B.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",B.INIT_PTS_FOUND="hlsInitPtsFound",B.FRAG_LOADING="hlsFragLoading",B.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",B.FRAG_LOADED="hlsFragLoaded",B.FRAG_DECRYPTED="hlsFragDecrypted",B.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",B.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",B.FRAG_PARSING_METADATA="hlsFragParsingMetadata",B.FRAG_PARSED="hlsFragParsed",B.FRAG_BUFFERED="hlsFragBuffered",B.FRAG_CHANGED="hlsFragChanged",B.FPS_DROP="hlsFpsDrop",B.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",B.ERROR="hlsError",B.DESTROYING="hlsDestroying",B.KEY_LOADING="hlsKeyLoading",B.KEY_LOADED="hlsKeyLoaded",B.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",B.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Q||(Q={}))},"./src/hls.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return S});var Q=P("./node_modules/url-toolkit/src/url-toolkit.js"),B=P.n(Q),F=P("./src/loader/playlist-loader.ts"),K=P("./src/loader/key-loader.ts"),G=P("./src/controller/id3-track-controller.ts"),M=P("./src/controller/latency-controller.ts"),R=P("./src/controller/level-controller.ts"),g=P("./src/controller/fragment-tracker.ts"),p=P("./src/controller/stream-controller.ts"),f=P("./src/is-supported.ts"),d=P("./src/utils/logger.ts"),s=P("./src/config.ts"),c=P("./node_modules/eventemitter3/index.js"),l=P.n(c),n=P("./src/events.ts"),o=P("./src/errors.ts");function h(x,O){for(var C=0;C<O.length;C++){var w=O[C];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(x,w.key,w)}}function L(x,O,C){return O&&h(x.prototype,O),C&&h(x,C),x}var S=function(){x.isSupported=function(){return Object(f.isSupported)()};function x(C){C===void 0&&(C={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new c.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var w=this.config=Object(s.mergeConfig)(x.DefaultConfig,C);this.userConfig=C,Object(d.enableLogs)(w.debug),this._autoLevelCapping=-1,w.progressive&&Object(s.enableStreamingMode)(w);var T=w.abrController,_=w.bufferController,u=w.capLevelController,E=w.fpsController,m=this.abrController=new T(this),b=this.bufferController=new _(this),N=this.capLevelController=new u(this),D=new E(this),H=new F.default(this),j=new K.default(this),I=new G.default(this),y=this.levelController=new R.default(this),W=new g.FragmentTracker(this),Y=this.streamController=new p.default(this,W);N.setStreamController(Y),D.setStreamController(Y);var ie=[y,Y];this.networkControllers=ie;var oe=[H,j,m,b,N,D,I,W];this.audioTrackController=this.createController(w.audioTrackController,null,ie),this.createController(w.audioStreamController,W,ie),this.subtitleTrackController=this.createController(w.subtitleTrackController,null,ie),this.createController(w.subtitleStreamController,W,ie),this.createController(w.timelineController,null,oe),this.emeController=this.createController(w.emeController,null,oe),this.cmcdController=this.createController(w.cmcdController,null,oe),this.latencyController=this.createController(M.default,null,oe),this.coreComponents=oe}var O=x.prototype;return O.createController=function(w,T,_){if(w){var u=T?new w(this,T):new w(this);return _&&_.push(u),u}return null},O.on=function(w,T,_){_===void 0&&(_=this),this._emitter.on(w,T,_)},O.once=function(w,T,_){_===void 0&&(_=this),this._emitter.once(w,T,_)},O.removeAllListeners=function(w){this._emitter.removeAllListeners(w)},O.off=function(w,T,_,u){_===void 0&&(_=this),this._emitter.off(w,T,_,u)},O.listeners=function(w){return this._emitter.listeners(w)},O.emit=function(w,T,_){return this._emitter.emit(w,T,_)},O.trigger=function(w,T){if(this.config.debug)return this.emit(w,w,T);try{return this.emit(w,w,T)}catch(_){d.logger.error("An internal error happened while handling event "+w+'. Error message: "'+_.message+'". Here is a stacktrace:',_),this.trigger(n.Events.ERROR,{type:o.ErrorTypes.OTHER_ERROR,details:o.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:w,error:_})}return!1},O.listenerCount=function(w){return this._emitter.listenerCount(w)},O.destroy=function(){d.logger.log("destroy"),this.trigger(n.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(w){return w.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(w){return w.destroy()}),this.coreComponents.length=0},O.attachMedia=function(w){d.logger.log("attachMedia"),this._media=w,this.trigger(n.Events.MEDIA_ATTACHING,{media:w})},O.detachMedia=function(){d.logger.log("detachMedia"),this.trigger(n.Events.MEDIA_DETACHING,void 0),this._media=null},O.loadSource=function(w){this.stopLoad();var T=this.media,_=this.url,u=this.url=Q.buildAbsoluteURL(self.location.href,w,{alwaysNormalize:!0});d.logger.log("loadSource:"+u),T&&_&&_!==u&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(T)),this.trigger(n.Events.MANIFEST_LOADING,{url:w})},O.startLoad=function(w){w===void 0&&(w=-1),d.logger.log("startLoad("+w+")"),this.networkControllers.forEach(function(T){T.startLoad(w)})},O.stopLoad=function(){d.logger.log("stopLoad"),this.networkControllers.forEach(function(w){w.stopLoad()})},O.swapAudioCodec=function(){d.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},O.recoverMediaError=function(){d.logger.log("recoverMediaError");var w=this._media;this.detachMedia(),w&&this.attachMedia(w)},O.removeLevel=function(w,T){T===void 0&&(T=0),this.levelController.removeLevel(w,T)},L(x,[{key:"levels",get:function(){var w=this.levelController.levels;return w||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(w){d.logger.log("set currentLevel:"+w),this.loadLevel=w,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(w){d.logger.log("set nextLevel:"+w),this.levelController.manualLevel=w,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(w){d.logger.log("set loadLevel:"+w),this.levelController.manualLevel=w}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(w){this.levelController.nextLoadLevel=w}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(w){d.logger.log("set firstLevel:"+w),this.levelController.firstLevel=w}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(w){d.logger.log("set startLevel:"+w),w!==-1&&(w=Math.max(w,this.minAutoLevel)),this.levelController.startLevel=w}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(w){var T=!!w;T!==this.config.capLevelToPlayerSize&&(T?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=T)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(w){this._autoLevelCapping!==w&&(d.logger.log("set autoLevelCapping:"+w),this._autoLevelCapping=w)}},{key:"bandwidthEstimate",get:function(){var w=this.abrController.bwEstimator;return w?w.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var w=this.levels,T=this.config.minAutoBitrate;if(!w)return 0;for(var _=w.length,u=0;u<_;u++)if(w[u].maxBitrate>T)return u;return 0}},{key:"maxAutoLevel",get:function(){var w=this.levels,T=this.autoLevelCapping,_;return T===-1&&w&&w.length?_=w.length-1:_=T,_}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(w){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,w)}},{key:"audioTracks",get:function(){var w=this.audioTrackController;return w?w.audioTracks:[]}},{key:"audioTrack",get:function(){var w=this.audioTrackController;return w?w.audioTrack:-1},set:function(w){var T=this.audioTrackController;T&&(T.audioTrack=w)}},{key:"subtitleTracks",get:function(){var w=this.subtitleTrackController;return w?w.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var w=this.subtitleTrackController;return w?w.subtitleTrack:-1},set:function(w){var T=this.subtitleTrackController;T&&(T.subtitleTrack=w)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var w=this.subtitleTrackController;return w?w.subtitleDisplay:!1},set:function(w){var T=this.subtitleTrackController;T&&(T.subtitleDisplay=w)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(w){this.config.lowLatencyMode=w}},{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 n.Events}},{key:"ErrorTypes",get:function(){return o.ErrorTypes}},{key:"ErrorDetails",get:function(){return o.ErrorDetails}},{key:"DefaultConfig",get:function(){return x.defaultConfig?x.defaultConfig:s.hlsDefaultConfig},set:function(w){x.defaultConfig=w}}]),x}();S.defaultConfig=void 0},"./src/is-supported.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"isSupported",function(){return F}),P.d(Z,"changeTypeSupported",function(){return K});var Q=P("./src/utils/mediasource-helper.ts");function B(){return self.SourceBuffer||self.WebKitSourceBuffer}function F(){var G=Object(Q.getMediaSource)();if(!G)return!1;var M=B(),R=G&&typeof G.isTypeSupported=="function"&&G.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),g=!M||M.prototype&&typeof M.prototype.appendBuffer=="function"&&typeof M.prototype.remove=="function";return!!R&&!!g}function K(){var G,M=B();return typeof(M==null||((G=M.prototype)===null||G===void 0)?void 0:G.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return d}),P.d(Z,"LoadError",function(){return c});var Q=P("./src/polyfills/number.ts"),B=P("./src/errors.ts");function F(l,n){l.prototype=Object.create(n.prototype),l.prototype.constructor=l,g(l,n)}function K(l){var n=typeof Map=="function"?new Map:void 0;return K=function(h){if(h===null||!R(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof n!="undefined"){if(n.has(h))return n.get(h);n.set(h,L)}function L(){return G(h,arguments,p(this).constructor)}return L.prototype=Object.create(h.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),g(L,h)},K(l)}function G(l,n,o){return M()?G=Reflect.construct:G=function(L,S,x){var O=[null];O.push.apply(O,S);var C=Function.bind.apply(L,O),w=new C;return x&&g(w,x.prototype),w},G.apply(null,arguments)}function M(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(l){return!1}}function R(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function g(l,n){return g=Object.setPrototypeOf||function(h,L){return h.__proto__=L,h},g(l,n)}function p(l){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)},p(l)}var f=Math.pow(2,17),d=function(){function l(o){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=o}var n=l.prototype;return n.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},n.abort=function(){this.loader&&this.loader.abort()},n.load=function(h,L){var S=this,x=h.url;if(!x)return Promise.reject(new c({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,networkDetails:null},"Fragment does not have a "+(x?"part list":"url")));this.abort();var O=this.config,C=O.fLoader,w=O.loader;return new Promise(function(T,_){S.loader&&S.loader.destroy();var u=S.loader=h.loader=C?new C(O):new w(O),E=s(h),m={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:f};h.stats=u.stats,u.load(E,m,{onSuccess:function(N,D,H,j){S.resetLoader(h,u),T({frag:h,part:null,payload:N.data,networkDetails:j})},onError:function(N,D,H){S.resetLoader(h,u),_(new c({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,response:N,networkDetails:H}))},onAbort:function(N,D,H){S.resetLoader(h,u),_(new c({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,networkDetails:H}))},onTimeout:function(N,D,H){S.resetLoader(h,u),_(new c({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,networkDetails:H}))},onProgress:function(N,D,H,j){L&&L({frag:h,part:null,payload:H,networkDetails:j})}})})},n.loadPart=function(h,L,S){var x=this;this.abort();var O=this.config,C=O.fLoader,w=O.loader;return new Promise(function(T,_){x.loader&&x.loader.destroy();var u=x.loader=h.loader=C?new C(O):new w(O),E=s(h,L),m={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:f};L.stats=u.stats,u.load(E,m,{onSuccess:function(N,D,H,j){x.resetLoader(h,u),x.updateStatsFromPart(h,L);var I={frag:h,part:L,payload:N.data,networkDetails:j};S(I),T(I)},onError:function(N,D,H){x.resetLoader(h,u),_(new c({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,part:L,response:N,networkDetails:H}))},onAbort:function(N,D,H){h.stats.aborted=L.stats.aborted,x.resetLoader(h,u),_(new c({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,part:L,networkDetails:H}))},onTimeout:function(N,D,H){x.resetLoader(h,u),_(new c({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,part:L,networkDetails:H}))}})})},n.updateStatsFromPart=function(h,L){var S=h.stats,x=L.stats,O=x.total;if(S.loaded+=x.loaded,O){var C=Math.round(h.duration/L.duration),w=Math.min(Math.round(S.loaded/O),C),T=C-w,_=T*Math.round(S.loaded/w);S.total=S.loaded+_}else S.total=Math.max(S.loaded,S.total);var u=S.loading,E=x.loading;u.start?u.first+=E.first-E.start:(u.start=E.start,u.first=E.first),u.end=E.end},n.resetLoader=function(h,L){h.loader=null,this.loader===L&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),L.destroy()},l}();function s(l,n){n===void 0&&(n=null);var o=n||l,h={frag:l,part:n,responseType:"arraybuffer",url:o.url,headers:{},rangeStart:0,rangeEnd:0},L=o.byteRangeStartOffset,S=o.byteRangeEndOffset;return Object(Q.isFiniteNumber)(L)&&Object(Q.isFiniteNumber)(S)&&(h.rangeStart=L,h.rangeEnd=S),h}var c=function(l){F(n,l);function n(o){for(var h,L=arguments.length,S=new Array(L>1?L-1:0),x=1;x<L;x++)S[x-1]=arguments[x];return h=l.call.apply(l,[this].concat(S))||this,h.data=void 0,h.data=o,h}return n}(K(Error))},"./src/loader/fragment.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"ElementaryStreamTypes",function(){return d}),P.d(Z,"BaseSegment",function(){return s}),P.d(Z,"Fragment",function(){return c}),P.d(Z,"Part",function(){return l});var Q=P("./src/polyfills/number.ts"),B=P("./node_modules/url-toolkit/src/url-toolkit.js"),F=P.n(B),K=P("./src/utils/logger.ts"),G=P("./src/loader/level-key.ts"),M=P("./src/loader/load-stats.ts");function R(n,o){n.prototype=Object.create(o.prototype),n.prototype.constructor=n,g(n,o)}function g(n,o){return g=Object.setPrototypeOf||function(L,S){return L.__proto__=S,L},g(n,o)}function p(n,o){for(var h=0;h<o.length;h++){var L=o[h];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(n,L.key,L)}}function f(n,o,h){return o&&p(n.prototype,o),h&&p(n,h),n}var d;(function(n){n.AUDIO="audio",n.VIDEO="video",n.AUDIOVIDEO="audiovideo"})(d||(d={}));var s=function(){function n(h){var L;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(L={},L[d.AUDIO]=null,L[d.VIDEO]=null,L[d.AUDIOVIDEO]=null,L),this.baseurl=h}var o=n.prototype;return o.setByteRange=function(L,S){var x=L.split("@",2),O=[];x.length===1?O[0]=S?S.byteRangeEndOffset:0:O[0]=parseInt(x[1]),O[1]=parseInt(x[0])+O[0],this._byteRange=O},f(n,[{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(B.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(L){this._url=L}}]),n}(),c=function(n){R(o,n);function o(L,S){var x;return x=n.call(this,S)||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 M.LoadStats,x.urlId=0,x.data=void 0,x.bitrateTest=!1,x.title=null,x.initSegment=null,x.type=L,x}var h=o.prototype;return h.createInitializationVector=function(S){for(var x=new Uint8Array(16),O=12;O<16;O++)x[O]=S>>8*(15-O)&255;return x},h.setDecryptDataFromLevelKey=function(S,x){var O=S;return(S==null?void 0:S.method)==="AES-128"&&S.uri&&!S.iv&&(O=G.LevelKey.fromURI(S.uri),O.method=S.method,O.iv=this.createInitializationVector(x),O.keyFormat="identity"),O},h.setElementaryStreamInfo=function(S,x,O,C,w,T){T===void 0&&(T=!1);var _=this.elementaryStreams,u=_[S];if(!u){_[S]={startPTS:x,endPTS:O,startDTS:C,endDTS:w,partial:T};return}u.startPTS=Math.min(u.startPTS,x),u.endPTS=Math.max(u.endPTS,O),u.startDTS=Math.min(u.startDTS,C),u.endDTS=Math.max(u.endDTS,w)},h.clearElementaryStreamInfo=function(){var S=this.elementaryStreams;S[d.AUDIO]=null,S[d.VIDEO]=null,S[d.AUDIOVIDEO]=null},f(o,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var S=this.sn;typeof S!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&K.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),S=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,S)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(Q.isFiniteNumber)(this.programDateTime))return null;var S=Object(Q.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+S*1e3}},{key:"encrypted",get:function(){var S;return!!((S=this.decryptdata)!==null&&S!==void 0&&S.keyFormat&&this.decryptdata.uri)}}]),o}(s),l=function(n){R(o,n);function o(h,L,S,x,O){var C;C=n.call(this,S)||this,C.fragOffset=0,C.duration=0,C.gap=!1,C.independent=!1,C.relurl=void 0,C.fragment=void 0,C.index=void 0,C.stats=new M.LoadStats,C.duration=h.decimalFloatingPoint("DURATION"),C.gap=h.bool("GAP"),C.independent=h.bool("INDEPENDENT"),C.relurl=h.enumeratedString("URI"),C.fragment=L,C.index=x;var w=h.enumeratedString("BYTERANGE");return w&&C.setByteRange(w,O),O&&(C.fragOffset=O.fragOffset+O.duration),C}return f(o,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var L=this.elementaryStreams;return!!(L.audio||L.video||L.audiovideo)}}]),o}(s)},"./src/loader/key-loader.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return K});var Q=P("./src/events.ts"),B=P("./src/errors.ts"),F=P("./src/utils/logger.ts"),K=function(){function G(R){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=R,this._registerListeners()}var M=G.prototype;return M._registerListeners=function(){this.hls.on(Q.Events.KEY_LOADING,this.onKeyLoading,this)},M._unregisterListeners=function(){this.hls.off(Q.Events.KEY_LOADING,this.onKeyLoading)},M.destroy=function(){this._unregisterListeners();for(var g in this.loaders){var p=this.loaders[g];p&&p.destroy()}this.loaders={}},M.onKeyLoading=function(g,p){var f=p.frag,d=f.type,s=this.loaders[d];if(!f.decryptdata){F.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var c=f.decryptdata.uri;if(c!==this.decrypturl||this.decryptkey===null){var l=this.hls.config;if(s&&(F.logger.warn("abort previous key loader for type:"+d),s.abort()),!c){F.logger.warn("key uri is falsy");return}var n=l.loader,o=f.loader=this.loaders[d]=new n(l);this.decrypturl=c,this.decryptkey=null;var h={url:c,frag:f,responseType:"arraybuffer"},L={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},S={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};o.load(h,L,S)}else this.decryptkey&&(f.decryptdata.key=this.decryptkey,this.hls.trigger(Q.Events.KEY_LOADED,{frag:f}))},M.loadsuccess=function(g,p,f){var d=f.frag;if(!d.decryptdata){F.logger.error("after key load, decryptdata unset");return}this.decryptkey=d.decryptdata.key=new Uint8Array(g.data),d.loader=null,delete this.loaders[d.type],this.hls.trigger(Q.Events.KEY_LOADED,{frag:d})},M.loaderror=function(g,p){var f=p.frag,d=f.loader;d&&d.abort(),delete this.loaders[f.type],this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:f,response:g})},M.loadtimeout=function(g,p){var f=p.frag,d=f.loader;d&&d.abort(),delete this.loaders[f.type],this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:f})},G}()},"./src/loader/level-details.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"LevelDetails",function(){return G});var Q=P("./src/polyfills/number.ts");function B(M,R){for(var g=0;g<R.length;g++){var p=R[g];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(M,p.key,p)}}function F(M,R,g){return R&&B(M.prototype,R),g&&B(M,g),M}var K=10,G=function(){function M(g){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=g}var R=M.prototype;return R.reloaded=function(p){if(!p){this.advanced=!0,this.updated=!0;return}var f=this.lastPartSn-p.lastPartSn,d=this.lastPartIndex-p.lastPartIndex;this.updated=this.endSN!==p.endSN||!!d||!!f,this.advanced=this.endSN>p.endSN||f>0||f===0&&d>0,this.updated||this.advanced?this.misses=Math.floor(p.misses*.6):this.misses=p.misses+1,this.availabilityDelay=p.availabilityDelay},F(M,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Q.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||K}},{key:"drift",get:function(){var p=this.driftEndTime-this.driftStartTime;if(p>0){var f=this.driftEnd-this.driftStart;return f*1e3/p}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var p;return(p=this.fragments)!==null&&p!==void 0&&p.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 p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),M}()},"./src/loader/level-key.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"LevelKey",function(){return G});var Q=P("./node_modules/url-toolkit/src/url-toolkit.js"),B=P.n(Q);function F(M,R){for(var g=0;g<R.length;g++){var p=R[g];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(M,p.key,p)}}function K(M,R,g){return R&&F(M.prototype,R),g&&F(M,g),M}var G=function(){M.fromURL=function(g,p){return new M(g,p)},M.fromURI=function(g){return new M(g)};function M(R,g){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,g?this._uri=Object(Q.buildAbsoluteURL)(R,g,{alwaysNormalize:!0}):this._uri=R}return K(M,[{key:"uri",get:function(){return this._uri}}]),M}()},"./src/loader/load-stats.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"LoadStats",function(){return Q});var Q=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return o});var Q=P("./src/polyfills/number.ts"),B=P("./node_modules/url-toolkit/src/url-toolkit.js"),F=P.n(B),K=P("./src/loader/fragment.ts"),G=P("./src/loader/level-details.ts"),M=P("./src/loader/level-key.ts"),R=P("./src/utils/attr-list.ts"),g=P("./src/utils/logger.ts"),p=P("./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,d=/#EXT-X-MEDIA:(.*)/g,s=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),c=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),l=/\.(mp4|m4s|m4v|m4a)$/i;function n(O){var C,w;return l.test((C=(w=B.parseURL(O))===null||w===void 0?void 0:w.path)!=null?C:"")}var o=function(){function O(){}return O.findGroup=function(w,T){for(var _=0;_<w.length;_++){var u=w[_];if(u.id===T)return u}},O.convertAVC1ToAVCOTI=function(w){var T=w.split(".");if(T.length>2){var _=T.shift()+".";return _+=parseInt(T.shift()).toString(16),_+=("000"+parseInt(T.shift()).toString(16)).substr(-4),_}return w},O.resolve=function(w,T){return B.buildAbsoluteURL(T,w,{alwaysNormalize:!0})},O.parseMasterPlaylist=function(w,T){var _=[],u={},E=!1;f.lastIndex=0;for(var m;(m=f.exec(w))!=null;)if(m[1]){var b=new R.AttrList(m[1]),N={attrs:b,bitrate:b.decimalInteger("AVERAGE-BANDWIDTH")||b.decimalInteger("BANDWIDTH"),name:b.NAME,url:O.resolve(m[2],T)},D=b.decimalResolution("RESOLUTION");D&&(N.width=D.width,N.height=D.height),h((b.CODECS||"").split(/[ ,]+/).filter(function(j){return j}),N),N.videoCodec&&N.videoCodec.indexOf("avc1")!==-1&&(N.videoCodec=O.convertAVC1ToAVCOTI(N.videoCodec)),_.push(N)}else if(m[3]){var H=new R.AttrList(m[3]);H["DATA-ID"]&&(E=!0,u[H["DATA-ID"]]=H)}return{levels:_,sessionData:E?u:null}},O.parseMasterPlaylistMedia=function(w,T,_,u){u===void 0&&(u=[]);var E,m=[],b=0;for(d.lastIndex=0;(E=d.exec(w))!==null;){var N=new R.AttrList(E[1]);if(N.TYPE===_){var D={attrs:N,bitrate:0,id:b++,groupId:N["GROUP-ID"],instreamId:N["INSTREAM-ID"],name:N.NAME||N.LANGUAGE||"",type:_,default:N.bool("DEFAULT"),autoselect:N.bool("AUTOSELECT"),forced:N.bool("FORCED"),lang:N.LANGUAGE,url:N.URI?O.resolve(N.URI,T):""};if(u.length){var H=O.findGroup(u,D.groupId)||u[0];L(D,H,"audioCodec"),L(D,H,"textCodec")}m.push(D)}}return m},O.parseLevelPlaylist=function(w,T,_,u,E){var m=new G.LevelDetails(T),b=m.fragments,N=null,D=0,H=0,j=0,I=0,y=null,W=new K.Fragment(u,T),Y,ie,oe,we=-1,me=!1;for(s.lastIndex=0,m.m3u8=w;(Y=s.exec(w))!==null;){me&&(me=!1,W=new K.Fragment(u,T),W.start=j,W.sn=D,W.cc=I,W.level=_,N&&(W.initSegment=N,W.rawProgramDateTime=N.rawProgramDateTime));var Se=Y[1];if(Se){W.duration=parseFloat(Se);var Ce=(" "+Y[2]).slice(1);W.title=Ce||null,W.tagList.push(Ce?["INF",Se,Ce]:["INF",Se])}else if(Y[3])Object(Q.isFiniteNumber)(W.duration)&&(W.start=j,oe&&(W.levelkey=oe),W.sn=D,W.level=_,W.cc=I,W.urlId=E,b.push(W),W.relurl=(" "+Y[3]).slice(1),x(W,y),y=W,j+=W.duration,D++,H=0,me=!0);else if(Y[4]){var xe=(" "+Y[4]).slice(1);y?W.setByteRange(xe,y):W.setByteRange(xe)}else if(Y[5])W.rawProgramDateTime=(" "+Y[5]).slice(1),W.tagList.push(["PROGRAM-DATE-TIME",W.rawProgramDateTime]),we===-1&&(we=b.length);else{if(Y=Y[0].match(c),!Y){g.logger.warn("No matches on slow regex match for level playlist!");continue}for(ie=1;ie<Y.length&&!(typeof Y[ie]!="undefined");ie++);var pe=(" "+Y[ie]).slice(1),le=(" "+Y[ie+1]).slice(1),te=Y[ie+2]?(" "+Y[ie+2]).slice(1):"";switch(pe){case"PLAYLIST-TYPE":m.type=le.toUpperCase();break;case"MEDIA-SEQUENCE":D=m.startSN=parseInt(le);break;case"SKIP":{var de=new R.AttrList(le),se=de.decimalInteger("SKIPPED-SEGMENTS");if(Object(Q.isFiniteNumber)(se)){m.skippedSegments=se;for(var Oe=se;Oe--;)b.unshift(null);D+=se}var ke=de.enumeratedString("RECENTLY-REMOVED-DATERANGES");ke&&(m.recentlyRemovedDateranges=ke.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(le);break;case"VERSION":m.version=parseInt(le);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(le||te)&&W.tagList.push(te?[le,te]:[le]);break;case"DIS":I++;case"GAP":W.tagList.push([pe]);break;case"BITRATE":W.tagList.push([pe,le]);break;case"DISCONTINUITY-SEQ":I=parseInt(le);break;case"KEY":{var Te,Le=new R.AttrList(le),Me=Le.enumeratedString("METHOD"),je=Le.URI,Fe=Le.hexadecimalInteger("IV"),Ne=Le.enumeratedString("KEYFORMATVERSIONS"),Ue=Le.enumeratedString("KEYID"),Je=(Te=Le.enumeratedString("KEYFORMAT"))!=null?Te:"identity",tt=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(tt.indexOf(Je)>-1){g.logger.warn("Keyformat "+Je+" is not supported from the manifest");continue}else if(Je!=="identity")continue;Me&&(oe=M.LevelKey.fromURL(T,je),je&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Me)>=0&&(oe.method=Me,oe.keyFormat=Je,Ue&&(oe.keyID=Ue),Ne&&(oe.keyFormatVersions=Ne),oe.iv=Fe));break}case"START":{var et=new R.AttrList(le),Ze=et.decimalFloatingPoint("TIME-OFFSET");Object(Q.isFiniteNumber)(Ze)&&(m.startTimeOffset=Ze);break}case"MAP":{var dt=new R.AttrList(le);W.relurl=dt.URI,dt.BYTERANGE&&W.setByteRange(dt.BYTERANGE),W.level=_,W.sn="initSegment",oe&&(W.levelkey=oe),W.initSegment=null,N=W,me=!0;break}case"SERVER-CONTROL":{var it=new R.AttrList(le);m.canBlockReload=it.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=it.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&it.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=it.optionalFloat("PART-HOLD-BACK",0),m.holdBack=it.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var at=new R.AttrList(le);m.partTarget=at.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ie=m.partList;Ie||(Ie=m.partList=[]);var st=H>0?Ie[Ie.length-1]:void 0,$e=H++,De=new K.Part(new R.AttrList(le),W,T,$e,st);Ie.push(De),W.duration+=De.duration;break}case"PRELOAD-HINT":{var He=new R.AttrList(le);m.preloadHint=He;break}case"RENDITION-REPORT":{var Ee=new R.AttrList(le);m.renditionReports=m.renditionReports||[],m.renditionReports.push(Ee);break}default:g.logger.warn("line parsed but not handled: "+Y);break}}}y&&!y.relurl?(b.pop(),j-=y.duration,m.partList&&(m.fragmentHint=y)):m.partList&&(x(W,y),W.cc=I,m.fragmentHint=W);var fe=b.length,_e=b[0],re=b[fe-1];if(j+=m.skippedSegments*m.targetduration,j>0&&fe&&re){m.averagetargetduration=j/fe;var ae=re.sn;m.endSN=ae!=="initSegment"?ae:0,_e&&(m.startCC=_e.cc,_e.initSegment||m.fragments.every(function(he){return he.relurl&&n(he.relurl)})&&(g.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),W=new K.Fragment(u,T),W.relurl=re.relurl,W.level=_,W.sn="initSegment",_e.initSegment=W,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(j+=m.fragmentHint.duration),m.totalduration=j,m.endCC=I,we>0&&S(b,we),m},O}();function h(O,C){["video","audio","text"].forEach(function(w){var T=O.filter(function(u){return Object(p.isCodecType)(u,w)});if(T.length){var _=T.filter(function(u){return u.lastIndexOf("avc1",0)===0||u.lastIndexOf("mp4a",0)===0});C[w+"Codec"]=_.length>0?_[0]:T[0],O=O.filter(function(u){return T.indexOf(u)===-1})}}),C.unknownCodecs=O}function L(O,C,w){var T=C[w];T&&(O[w]=T)}function S(O,C){for(var w=O[C],T=C;T--;){var _=O[T];if(!_)return;_.programDateTime=w.programDateTime-_.duration*1e3,w=_}}function x(O,C){O.rawProgramDateTime?O.programDateTime=Date.parse(O.rawProgramDateTime):C!=null&&C.programDateTime&&(O.programDateTime=C.endProgramDateTime),Object(Q.isFiniteNumber)(O.programDateTime)||(O.programDateTime=null,O.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/polyfills/number.ts"),B=P("./src/events.ts"),F=P("./src/errors.ts"),K=P("./src/utils/logger.ts"),G=P("./src/utils/mp4-tools.ts"),M=P("./src/loader/m3u8-parser.ts"),R=P("./src/types/loader.ts"),g=P("./src/utils/attr-list.ts");function p(s){var c=s.type;switch(c){case R.PlaylistContextType.AUDIO_TRACK:return R.PlaylistLevelType.AUDIO;case R.PlaylistContextType.SUBTITLE_TRACK:return R.PlaylistLevelType.SUBTITLE;default:return R.PlaylistLevelType.MAIN}}function f(s,c){var l=s.url;return(l===void 0||l.indexOf("data:")===0)&&(l=c.url),l}var d=function(){function s(l){this.hls=void 0,this.loaders=Object.create(null),this.hls=l,this.registerListeners()}var c=s.prototype;return c.registerListeners=function(){var n=this.hls;n.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),n.on(B.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),n.on(B.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},c.unregisterListeners=function(){var n=this.hls;n.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(B.Events.LEVEL_LOADING,this.onLevelLoading,this),n.off(B.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),n.off(B.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},c.createInternalLoader=function(n){var o=this.hls.config,h=o.pLoader,L=o.loader,S=h||L,x=new S(o);return n.loader=x,this.loaders[n.type]=x,x},c.getInternalLoader=function(n){return this.loaders[n.type]},c.resetInternalLoader=function(n){this.loaders[n]&&delete this.loaders[n]},c.destroyInternalLoaders=function(){for(var n in this.loaders){var o=this.loaders[n];o&&o.destroy(),this.resetInternalLoader(n)}},c.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},c.onManifestLoading=function(n,o){var h=o.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:R.PlaylistContextType.MANIFEST,url:h,deliveryDirectives:null})},c.onLevelLoading=function(n,o){var h=o.id,L=o.level,S=o.url,x=o.deliveryDirectives;this.load({id:h,groupId:null,level:L,responseType:"text",type:R.PlaylistContextType.LEVEL,url:S,deliveryDirectives:x})},c.onAudioTrackLoading=function(n,o){var h=o.id,L=o.groupId,S=o.url,x=o.deliveryDirectives;this.load({id:h,groupId:L,level:null,responseType:"text",type:R.PlaylistContextType.AUDIO_TRACK,url:S,deliveryDirectives:x})},c.onSubtitleTrackLoading=function(n,o){var h=o.id,L=o.groupId,S=o.url,x=o.deliveryDirectives;this.load({id:h,groupId:L,level:null,responseType:"text",type:R.PlaylistContextType.SUBTITLE_TRACK,url:S,deliveryDirectives:x})},c.load=function(n){var o,h=this.hls.config,L=this.getInternalLoader(n);if(L){var S=L.context;if(S&&S.url===n.url){K.logger.trace("[playlist-loader]: playlist request ongoing");return}K.logger.log("[playlist-loader]: aborting previous loader for type: "+n.type),L.abort()}var x,O,C,w;switch(n.type){case R.PlaylistContextType.MANIFEST:x=h.manifestLoadingMaxRetry,O=h.manifestLoadingTimeOut,C=h.manifestLoadingRetryDelay,w=h.manifestLoadingMaxRetryTimeout;break;case R.PlaylistContextType.LEVEL:case R.PlaylistContextType.AUDIO_TRACK:case R.PlaylistContextType.SUBTITLE_TRACK:x=0,O=h.levelLoadingTimeOut;break;default:x=h.levelLoadingMaxRetry,O=h.levelLoadingTimeOut,C=h.levelLoadingRetryDelay,w=h.levelLoadingMaxRetryTimeout;break}if(L=this.createInternalLoader(n),(o=n.deliveryDirectives)!==null&&o!==void 0&&o.part){var T;if(n.type===R.PlaylistContextType.LEVEL&&n.level!==null?T=this.hls.levels[n.level].details:n.type===R.PlaylistContextType.AUDIO_TRACK&&n.id!==null?T=this.hls.audioTracks[n.id].details:n.type===R.PlaylistContextType.SUBTITLE_TRACK&&n.id!==null&&(T=this.hls.subtitleTracks[n.id].details),T){var _=T.partTarget,u=T.targetduration;_&&u&&(O=Math.min(Math.max(_*3,u*.8)*1e3,O))}}var E={timeout:O,maxRetry:x,retryDelay:C,maxRetryDelay:w,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};L.load(n,E,m)},c.loadsuccess=function(n,o,h,L){if(L===void 0&&(L=null),h.isSidxRequest){this.handleSidxRequest(n,h),this.handlePlaylistLoaded(n,o,h,L);return}this.resetInternalLoader(h.type);var S=n.data;if(S.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(n,h,"no EXTM3U delimiter",L);return}o.parsing.start=performance.now(),S.indexOf("#EXTINF:")>0||S.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(n,o,h,L):this.handleMasterPlaylist(n,o,h,L)},c.loaderror=function(n,o,h){h===void 0&&(h=null),this.handleNetworkError(o,h,!1,n)},c.loadtimeout=function(n,o,h){h===void 0&&(h=null),this.handleNetworkError(o,h,!0)},c.handleMasterPlaylist=function(n,o,h,L){var S=this.hls,x=n.data,O=f(n,h),C=M.default.parseMasterPlaylist(x,O),w=C.levels,T=C.sessionData;if(!w.length){this.handleManifestParsingError(n,h,"no level found in manifest",L);return}var _=w.map(function(D){return{id:D.attrs.AUDIO,audioCodec:D.audioCodec}}),u=w.map(function(D){return{id:D.attrs.SUBTITLES,textCodec:D.textCodec}}),E=M.default.parseMasterPlaylistMedia(x,O,"AUDIO",_),m=M.default.parseMasterPlaylistMedia(x,O,"SUBTITLES",u),b=M.default.parseMasterPlaylistMedia(x,O,"CLOSED-CAPTIONS");if(E.length){var N=E.some(function(D){return!D.url});!N&&w[0].audioCodec&&!w[0].attrs.AUDIO&&(K.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),E.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new g.AttrList({}),bitrate:0,url:""}))}S.trigger(B.Events.MANIFEST_LOADED,{levels:w,audioTracks:E,subtitles:m,captions:b,url:O,stats:o,networkDetails:L,sessionData:T})},c.handleTrackOrLevelPlaylist=function(n,o,h,L){var S=this.hls,x=h.id,O=h.level,C=h.type,w=f(n,h),T=Object(Q.isFiniteNumber)(x)?x:0,_=Object(Q.isFiniteNumber)(O)?O:T,u=p(h),E=M.default.parseLevelPlaylist(n.data,w,_,u,T);if(!E.fragments.length){S.trigger(B.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:w,reason:"no fragments found in level",level:typeof h.level=="number"?h.level:void 0});return}if(C===R.PlaylistContextType.MANIFEST){var m={attrs:new g.AttrList({}),bitrate:0,details:E,name:"",url:w};S.trigger(B.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:w,stats:o,networkDetails:L,sessionData:null})}if(o.parsing.end=performance.now(),E.needSidxRanges){var b,N=(b=E.fragments[0].initSegment)===null||b===void 0?void 0:b.url;this.load({url:N,isSidxRequest:!0,type:C,level:O,levelDetails:E,id:x,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}h.levelDetails=E,this.handlePlaylistLoaded(n,o,h,L)},c.handleSidxRequest=function(n,o){var h=Object(G.parseSegmentIndex)(new Uint8Array(n.data));if(!h)return;var L=h.references,S=o.levelDetails;L.forEach(function(x,O){var C=x.info,w=S.fragments[O];w.byteRange.length===0&&w.setByteRange(String(1+C.end-C.start)+"@"+String(C.start)),w.initSegment&&w.initSegment.setByteRange(String(h.moovEndOffset)+"@0")})},c.handleManifestParsingError=function(n,o,h,L){this.hls.trigger(B.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:o.type===R.PlaylistContextType.MANIFEST,url:n.url,reason:h,response:n,context:o,networkDetails:L})},c.handleNetworkError=function(n,o,h,L){h===void 0&&(h=!1),K.logger.warn("[playlist-loader]: A network "+(h?"timeout":"error")+" occurred while loading "+n.type+" level: "+n.level+" id: "+n.id+' group-id: "'+n.groupId+'"');var S=F.ErrorDetails.UNKNOWN,x=!1,O=this.getInternalLoader(n);switch(n.type){case R.PlaylistContextType.MANIFEST:S=h?F.ErrorDetails.MANIFEST_LOAD_TIMEOUT:F.ErrorDetails.MANIFEST_LOAD_ERROR,x=!0;break;case R.PlaylistContextType.LEVEL:S=h?F.ErrorDetails.LEVEL_LOAD_TIMEOUT:F.ErrorDetails.LEVEL_LOAD_ERROR,x=!1;break;case R.PlaylistContextType.AUDIO_TRACK:S=h?F.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:F.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,x=!1;break;case R.PlaylistContextType.SUBTITLE_TRACK:S=h?F.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:F.ErrorDetails.SUBTITLE_LOAD_ERROR,x=!1;break}O&&this.resetInternalLoader(n.type);var C={type:F.ErrorTypes.NETWORK_ERROR,details:S,fatal:x,url:n.url,loader:O,context:n,networkDetails:o};L&&(C.response=L),this.hls.trigger(B.Events.ERROR,C)},c.handlePlaylistLoaded=function(n,o,h,L){var S=h.type,x=h.level,O=h.id,C=h.groupId,w=h.loader,T=h.levelDetails,_=h.deliveryDirectives;if(!(T!=null&&T.targetduration)){this.handleManifestParsingError(n,h,"invalid target duration",L);return}if(!w)return;T.live&&(w.getCacheAge&&(T.ageHeader=w.getCacheAge()||0),(!w.getCacheAge||isNaN(T.ageHeader))&&(T.ageHeader=0));switch(S){case R.PlaylistContextType.MANIFEST:case R.PlaylistContextType.LEVEL:this.hls.trigger(B.Events.LEVEL_LOADED,{details:T,level:x||0,id:O||0,stats:o,networkDetails:L,deliveryDirectives:_});break;case R.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(B.Events.AUDIO_TRACK_LOADED,{details:T,id:O||0,groupId:C||"",stats:o,networkDetails:L,deliveryDirectives:_});break;case R.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(B.Events.SUBTITLE_TRACK_LOADED,{details:T,id:O||0,groupId:C||"",stats:o,networkDetails:L,deliveryDirectives:_});break}},s}();Z.default=d},"./src/polyfills/number.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"isFiniteNumber",function(){return Q}),P.d(Z,"MAX_SAFE_INTEGER",function(){return B});var Q=Number.isFinite||function(F){return typeof F=="number"&&isFinite(F)},B=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=function(){function B(){}return B.getSilentFrame=function(K,G){switch(K){case"mp4a.40.2":if(G===1)return new Uint8Array([0,200,0,128,35,128]);if(G===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(G===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(G===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(G===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(G===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(G===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(G===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(G===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},B}();Z.default=Q},"./src/remux/mp4-generator.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=Math.pow(2,32)-1,B=function(){function F(){}return F.init=function(){F.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 G;for(G in F.types)F.types.hasOwnProperty(G)&&(F.types[G]=[G.charCodeAt(0),G.charCodeAt(1),G.charCodeAt(2),G.charCodeAt(3)]);var M=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),R=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);F.HDLR_TYPES={video:M,audio:R};var g=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),p=new Uint8Array([0,0,0,0,0,0,0,0]);F.STTS=F.STSC=F.STCO=p,F.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),F.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),F.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),F.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var f=new Uint8Array([105,115,111,109]),d=new Uint8Array([97,118,99,49]),s=new Uint8Array([0,0,0,1]);F.FTYP=F.box(F.types.ftyp,f,s,f,d),F.DINF=F.box(F.types.dinf,F.box(F.types.dref,g))},F.box=function(G){for(var M=8,R=arguments.length,g=new Array(R>1?R-1:0),p=1;p<R;p++)g[p-1]=arguments[p];for(var f=g.length,d=f;f--;)M+=g[f].byteLength;var s=new Uint8Array(M);for(s[0]=M>>24&255,s[1]=M>>16&255,s[2]=M>>8&255,s[3]=M&255,s.set(G,4),f=0,M=8;f<d;f++)s.set(g[f],M),M+=g[f].byteLength;return s},F.hdlr=function(G){return F.box(F.types.hdlr,F.HDLR_TYPES[G])},F.mdat=function(G){return F.box(F.types.mdat,G)},F.mdhd=function(G,M){M*=G;var R=Math.floor(M/(Q+1)),g=Math.floor(M%(Q+1));return F.box(F.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,G>>24&255,G>>16&255,G>>8&255,G&255,R>>24,R>>16&255,R>>8&255,R&255,g>>24,g>>16&255,g>>8&255,g&255,85,196,0,0]))},F.mdia=function(G){return F.box(F.types.mdia,F.mdhd(G.timescale,G.duration),F.hdlr(G.type),F.minf(G))},F.mfhd=function(G){return F.box(F.types.mfhd,new Uint8Array([0,0,0,0,G>>24,G>>16&255,G>>8&255,G&255]))},F.minf=function(G){return G.type==="audio"?F.box(F.types.minf,F.box(F.types.smhd,F.SMHD),F.DINF,F.stbl(G)):F.box(F.types.minf,F.box(F.types.vmhd,F.VMHD),F.DINF,F.stbl(G))},F.moof=function(G,M,R){return F.box(F.types.moof,F.mfhd(G),F.traf(R,M))},F.moov=function(G){for(var M=G.length,R=[];M--;)R[M]=F.trak(G[M]);return F.box.apply(null,[F.types.moov,F.mvhd(G[0].timescale,G[0].duration)].concat(R).concat(F.mvex(G)))},F.mvex=function(G){for(var M=G.length,R=[];M--;)R[M]=F.trex(G[M]);return F.box.apply(null,[F.types.mvex].concat(R))},F.mvhd=function(G,M){M*=G;var R=Math.floor(M/(Q+1)),g=Math.floor(M%(Q+1)),p=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,G>>24&255,G>>16&255,G>>8&255,G&255,R>>24,R>>16&255,R>>8&255,R&255,g>>24,g>>16&255,g>>8&255,g&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 F.box(F.types.mvhd,p)},F.sdtp=function(G){var M=G.samples||[],R=new Uint8Array(4+M.length),g,p;for(g=0;g<M.length;g++)p=M[g].flags,R[g+4]=p.dependsOn<<4|p.isDependedOn<<2|p.hasRedundancy;return F.box(F.types.sdtp,R)},F.stbl=function(G){return F.box(F.types.stbl,F.stsd(G),F.box(F.types.stts,F.STTS),F.box(F.types.stsc,F.STSC),F.box(F.types.stsz,F.STSZ),F.box(F.types.stco,F.STCO))},F.avc1=function(G){var M=[],R=[],g,p,f;for(g=0;g<G.sps.length;g++)p=G.sps[g],f=p.byteLength,M.push(f>>>8&255),M.push(f&255),M=M.concat(Array.prototype.slice.call(p));for(g=0;g<G.pps.length;g++)p=G.pps[g],f=p.byteLength,R.push(f>>>8&255),R.push(f&255),R=R.concat(Array.prototype.slice.call(p));var d=F.box(F.types.avcC,new Uint8Array([1,M[3],M[4],M[5],252|3,224|G.sps.length].concat(M).concat([G.pps.length]).concat(R))),s=G.width,c=G.height,l=G.pixelRatio[0],n=G.pixelRatio[1];return F.box(F.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,s>>8&255,s&255,c>>8&255,c&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),d,F.box(F.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),F.box(F.types.pasp,new Uint8Array([l>>24,l>>16&255,l>>8&255,l&255,n>>24,n>>16&255,n>>8&255,n&255])))},F.esds=function(G){var M=G.config.length;return new Uint8Array([0,0,0,0,3,23+M,0,1,0,4,15+M,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([M]).concat(G.config).concat([6,1,2]))},F.mp4a=function(G){var M=G.samplerate;return F.box(F.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,G.channelCount,0,16,0,0,0,0,M>>8&255,M&255,0,0]),F.box(F.types.esds,F.esds(G)))},F.mp3=function(G){var M=G.samplerate;return F.box(F.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,G.channelCount,0,16,0,0,0,0,M>>8&255,M&255,0,0]))},F.stsd=function(G){return G.type==="audio"?!G.isAAC&&G.codec==="mp3"?F.box(F.types.stsd,F.STSD,F.mp3(G)):F.box(F.types.stsd,F.STSD,F.mp4a(G)):F.box(F.types.stsd,F.STSD,F.avc1(G))},F.tkhd=function(G){var M=G.id,R=G.duration*G.timescale,g=G.width,p=G.height,f=Math.floor(R/(Q+1)),d=Math.floor(R%(Q+1));return F.box(F.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,0,0,0,0,f>>24,f>>16&255,f>>8&255,f&255,d>>24,d>>16&255,d>>8&255,d&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,g>>8&255,g&255,0,0,p>>8&255,p&255,0,0]))},F.traf=function(G,M){var R=F.sdtp(G),g=G.id,p=Math.floor(M/(Q+1)),f=Math.floor(M%(Q+1));return F.box(F.types.traf,F.box(F.types.tfhd,new Uint8Array([0,0,0,0,g>>24,g>>16&255,g>>8&255,g&255])),F.box(F.types.tfdt,new Uint8Array([1,0,0,0,p>>24,p>>16&255,p>>8&255,p&255,f>>24,f>>16&255,f>>8&255,f&255])),F.trun(G,R.length+16+20+8+16+8+8),R)},F.trak=function(G){return G.duration=G.duration||4294967295,F.box(F.types.trak,F.tkhd(G),F.mdia(G))},F.trex=function(G){var M=G.id;return F.box(F.types.trex,new Uint8Array([0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},F.trun=function(G,M){var R=G.samples||[],g=R.length,p=12+16*g,f=new Uint8Array(p),d,s,c,l,n,o;for(M+=8+p,f.set([0,0,15,1,g>>>24&255,g>>>16&255,g>>>8&255,g&255,M>>>24&255,M>>>16&255,M>>>8&255,M&255],0),d=0;d<g;d++)s=R[d],c=s.duration,l=s.size,n=s.flags,o=s.cts,f.set([c>>>24&255,c>>>16&255,c>>>8&255,c&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255,n.isLeading<<2|n.dependsOn,n.isDependedOn<<6|n.hasRedundancy<<4|n.paddingValue<<1|n.isNonSync,n.degradPrio&240<<8,n.degradPrio&15,o>>>24&255,o>>>16&255,o>>>8&255,o&255],12+16*d);return F.box(F.types.trun,f)},F.initSegment=function(G){F.types||F.init();var M=F.moov(G),R=new Uint8Array(F.FTYP.byteLength+M.byteLength);return R.set(F.FTYP),R.set(M,F.FTYP.byteLength),R},F}();B.types=void 0,B.HDLR_TYPES=void 0,B.STTS=void 0,B.STSC=void 0,B.STCO=void 0,B.STSZ=void 0,B.VMHD=void 0,B.SMHD=void 0,B.STSD=void 0,B.FTYP=void 0,B.DINF=void 0,Z.default=B},"./src/remux/mp4-remuxer.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return o}),P.d(Z,"normalizePts",function(){return h});var Q=P("./src/polyfills/number.ts"),B=P("./src/remux/aac-helper.ts"),F=P("./src/remux/mp4-generator.ts"),K=P("./src/events.ts"),G=P("./src/errors.ts"),M=P("./src/utils/logger.ts"),R=P("./src/types/loader.ts"),g=P("./src/utils/timescale-conversion.ts");function p(){return p=Object.assign||function(O){for(var C=1;C<arguments.length;C++){var w=arguments[C];for(var T in w)Object.prototype.hasOwnProperty.call(w,T)&&(O[T]=w[T])}return O},p.apply(this,arguments)}var f=10*1e3,d=1024,s=1152,c=null,l=null,n=!1,o=function(){function O(w,T,_,u){if(u===void 0&&(u=""),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=w,this.config=T,this.typeSupported=_,this.ISGenerated=!1,c===null){var E=navigator.userAgent||"",m=E.match(/Chrome\/(\d+)/i);c=m?parseInt(m[1]):0}if(l===null){var b=navigator.userAgent.match(/Safari\/(\d+)/i);l=b?parseInt(b[1]):0}n=!!c&&c<75||!!l&&l<600}var C=O.prototype;return C.destroy=function(){},C.resetTimeStamp=function(T){M.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=T},C.resetNextTimestamp=function(){M.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},C.resetInitSegment=function(){M.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},C.getVideoStartPts=function(T){var _=!1,u=T.reduce(function(E,m){var b=m.pts-E;return b<-4294967296?(_=!0,h(E,m.pts)):b>0?E:m.pts},T[0].pts);return _&&M.logger.debug("PTS rollover detected"),u},C.remux=function(T,_,u,E,m,b,N,D){var H,j,I,y,W,Y,ie=m,oe=m,we=T.pid>-1,me=_.pid>-1,Se=_.samples.length,Ce=T.samples.length>0,xe=Se>1,pe=(!we||Ce)&&(!me||xe)||this.ISGenerated||N;if(pe){this.ISGenerated||(I=this.generateIS(T,_,m));var le=this.isVideoContiguous,te=-1;if(xe&&(te=L(_.samples),!le&&this.config.forceKeyFrameOnDiscontinuity))if(Y=!0,te>0){M.logger.warn("[mp4-remuxer]: Dropped "+te+" out of "+Se+" video samples due to a missing keyframe");var de=this.getVideoStartPts(_.samples);_.samples=_.samples.slice(te),_.dropped+=te,oe+=(_.samples[0].pts-de)/(_.timescale||9e4)}else te===-1&&(M.logger.warn("[mp4-remuxer]: No keyframe found out of "+Se+" video samples"),Y=!1);if(this.ISGenerated){if(Ce&&xe){var se=this.getVideoStartPts(_.samples),Oe=h(T.samples[0].pts,se)-se,ke=Oe/_.inputTimeScale;ie+=Math.max(0,ke),oe+=Math.max(0,-ke)}if(Ce){if(T.samplerate||(M.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),I=this.generateIS(T,_,m)),j=this.remuxAudio(T,ie,this.isAudioContiguous,b,me||xe||D===R.PlaylistLevelType.AUDIO?oe:void 0),xe){var Te=j?j.endPTS-j.startPTS:0;_.inputTimeScale||(M.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),I=this.generateIS(T,_,m)),H=this.remuxVideo(_,oe,le,Te)}}else xe&&(H=this.remuxVideo(_,oe,le,0));H&&(H.firstKeyFrame=te,H.independent=te!==-1)}}return this.ISGenerated&&(u.samples.length&&(W=this.remuxID3(u,m)),E.samples.length&&(y=this.remuxText(E,m))),{audio:j,video:H,initSegment:I,independent:Y,text:y,id3:W}},C.generateIS=function(T,_,u){var E=T.samples,m=_.samples,b=this.typeSupported,N={},D=!Object(Q.isFiniteNumber)(this._initPTS),H="audio/mp4",j,I,y;if(D&&(j=I=Infinity),T.config&&E.length&&(T.timescale=T.samplerate,T.isAAC||(b.mpeg?(H="audio/mpeg",T.codec=""):b.mp3&&(T.codec="mp3")),N.audio={id:"audio",container:H,codec:T.codec,initSegment:!T.isAAC&&b.mpeg?new Uint8Array(0):F.default.initSegment([T]),metadata:{channelCount:T.channelCount}},D&&(y=T.inputTimeScale,j=I=E[0].pts-Math.round(y*u))),_.sps&&_.pps&&m.length&&(_.timescale=_.inputTimeScale,N.video={id:"main",container:"video/mp4",codec:_.codec,initSegment:F.default.initSegment([_]),metadata:{width:_.width,height:_.height}},D)){y=_.inputTimeScale;var W=this.getVideoStartPts(m),Y=Math.round(y*u);I=Math.min(I,h(m[0].dts,W)-Y),j=Math.min(j,W-Y)}if(Object.keys(N).length)return this.ISGenerated=!0,D&&(this._initPTS=j,this._initDTS=I),{tracks:N,initPTS:j,timescale:y}},C.remuxVideo=function(T,_,u,E){var m=T.inputTimeScale,b=T.samples,N=[],D=b.length,H=this._initPTS,j=this.nextAvcDts,I=8,y,W,Y,ie=Number.POSITIVE_INFINITY,oe=Number.NEGATIVE_INFINITY,we=0,me=!1;if(!u||j===null){var Se=_*m,Ce=b[0].pts-h(b[0].dts,b[0].pts);j=Se-Ce}for(var xe=0;xe<D;xe++){var pe=b[xe];if(pe.pts=h(pe.pts-H,j),pe.dts=h(pe.dts-H,j),pe.dts>pe.pts){var le=9e4*.2;we=Math.max(Math.min(we,pe.pts-pe.dts),-1*le)}pe.dts<b[xe>0?xe-1:xe].dts&&(me=!0)}me&&b.sort(function(Ct,xt){var ut=Ct.dts-xt.dts,Ut=Ct.pts-xt.pts;return ut||Ut}),W=b[0].dts,Y=b[b.length-1].dts;var te=Math.round((Y-W)/(D-1));if(we<0){if(we<te*-2){M.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(g.toMsFromMpegTsClock)(-te,!0)+" ms");for(var de=we,se=0;se<D;se++)b[se].dts=de=Math.max(de,b[se].pts-te),b[se].pts=Math.max(de,b[se].pts)}else{M.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(g.toMsFromMpegTsClock)(we,!0)+" ms to overcome this issue");for(var Oe=0;Oe<D;Oe++)b[Oe].dts=b[Oe].dts+we}W=b[0].dts}if(u){var ke=W-j,Te=ke>te,Le=ke<-1;if(Te||Le){Te?M.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(ke,!0)+" ms ("+ke+"dts) hole between fragments detected, filling it"):M.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(-ke,!0)+" ms ("+ke+"dts) overlapping between fragments detected"),W=j;var Me=b[0].pts-ke;b[0].dts=W,b[0].pts=Me,M.logger.log("Video: First PTS/DTS adjusted: "+Object(g.toMsFromMpegTsClock)(Me,!0)+"/"+Object(g.toMsFromMpegTsClock)(W,!0)+", delta: "+Object(g.toMsFromMpegTsClock)(ke,!0)+" ms")}}n&&(W=Math.max(0,W));for(var je=0,Fe=0,Ne=0;Ne<D;Ne++){for(var Ue=b[Ne],Je=Ue.units,tt=Je.length,et=0,Ze=0;Ze<tt;Ze++)et+=Je[Ze].data.length;Fe+=et,je+=tt,Ue.length=et,Ue.dts=Math.max(Ue.dts,W),Ue.pts=Math.max(Ue.pts,Ue.dts,0),ie=Math.min(Ue.pts,ie),oe=Math.max(Ue.pts,oe)}Y=b[D-1].dts;var dt=Fe+4*je+8,it;try{it=new Uint8Array(dt)}catch(Ct){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:G.ErrorTypes.MUX_ERROR,details:G.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:dt,reason:"fail allocating video mdat "+dt});return}var at=new DataView(it.buffer);at.setUint32(0,dt),it.set(F.default.types.mdat,4);for(var Ie=0;Ie<D;Ie++){for(var st=b[Ie],$e=st.units,De=0,He=0,Ee=$e.length;He<Ee;He++){var fe=$e[He],_e=fe.data,re=fe.data.byteLength;at.setUint32(I,re),I+=4,it.set(_e,I),I+=re,De+=4+re}if(Ie<D-1)y=b[Ie+1].dts-st.dts;else{var ae=this.config,he=st.dts-b[Ie>0?Ie-1:Ie].dts;if(ae.stretchShortVideoTrack&&this.nextAudioPts!==null){var ve=Math.floor(ae.maxBufferHole*m),be=(E?ie+E*m:this.nextAudioPts)-st.pts;be>ve?(y=be-he,y<0&&(y=he),M.logger.log("[mp4-remuxer]: It is approximately "+be/90+" ms to the next segment; using duration "+y/90+" ms for the last video frame.")):y=he}else y=he}var Pe=Math.round(st.pts-st.dts);N.push(new S(st.key,y,De,Pe))}if(N.length&&c&&c<70){var Ge=N[0].flags;Ge.dependsOn=2,Ge.isNonSync=0}console.assert(y!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=j=Y+y,this.isVideoContiguous=!0;var ot=F.default.moof(T.sequenceNumber++,W,p({},T,{samples:N})),ct="video",ft={data1:ot,data2:it,startPTS:ie/m,endPTS:(oe+y)/m,startDTS:W/m,endDTS:j/m,type:ct,hasAudio:!1,hasVideo:!0,nb:N.length,dropped:T.dropped};return T.samples=[],T.dropped=0,console.assert(it.length,"MDAT length must not be zero"),ft},C.remuxAudio=function(T,_,u,E,m){var b=T.inputTimeScale,N=T.samplerate?T.samplerate:b,D=b/N,H=T.isAAC?d:s,j=H*D,I=this._initPTS,y=!T.isAAC&&this.typeSupported.mpeg,W=[],Y=T.samples,ie=y?0:8,oe=this.nextAudioPts||-1,we=_*b;if(this.isAudioContiguous=u=u||Y.length&&oe>0&&(E&&Math.abs(we-oe)<9e3||Math.abs(h(Y[0].pts-I,we)-oe)<20*j),Y.forEach(function(_e){_e.pts=h(_e.pts-I,we)}),!u||oe<0){if(Y=Y.filter(function(_e){return _e.pts>=0}),!Y.length)return;m===0?oe=0:E?oe=Math.max(0,we):oe=Y[0].pts}if(T.isAAC)for(var me=m!==void 0,Se=this.config.maxAudioFramesDrift,Ce=0,xe=oe;Ce<Y.length;Ce++){var pe=Y[Ce],le=pe.pts,te=le-xe,de=Math.abs(1e3*te/b);if(te<=-Se*j&&me)Ce===0&&(M.logger.warn("Audio frame @ "+(le/b).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*te/b)+" ms."),this.nextAudioPts=oe=xe=le);else if(te>=Se*j&&de<f&&me){var se=Math.round(te/j);xe=le-se*j,xe<0&&(se--,xe+=j),Ce===0&&(this.nextAudioPts=oe=xe),M.logger.warn("[mp4-remuxer]: Injecting "+se+" audio frame @ "+(xe/b).toFixed(3)+"s due to "+Math.round(1e3*te/b)+" ms gap.");for(var Oe=0;Oe<se;Oe++){var ke=Math.max(xe,0),Te=B.default.getSilentFrame(T.manifestCodec||T.codec,T.channelCount);Te||(M.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Te=pe.unit.subarray()),Y.splice(Ce,0,{unit:Te,pts:ke}),xe+=j,Ce++}}pe.pts=xe,xe+=j}for(var Le=null,Me=null,je,Fe=0,Ne=Y.length;Ne--;)Fe+=Y[Ne].unit.byteLength;for(var Ue=0,Je=Y.length;Ue<Je;Ue++){var tt=Y[Ue],et=tt.unit,Ze=tt.pts;if(Me!==null){var dt=W[Ue-1];dt.duration=Math.round((Ze-Me)/D)}else if(u&&T.isAAC&&(Ze=oe),Le=Ze,Fe>0){Fe+=ie;try{je=new Uint8Array(Fe)}catch(_e){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:G.ErrorTypes.MUX_ERROR,details:G.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Fe,reason:"fail allocating audio mdat "+Fe});return}if(!y){var it=new DataView(je.buffer);it.setUint32(0,Fe),je.set(F.default.types.mdat,4)}}else return;je.set(et,ie);var at=et.byteLength;ie+=at,W.push(new S(!0,H,at,0)),Me=Ze}var Ie=W.length;if(!Ie)return;var st=W[W.length-1];this.nextAudioPts=oe=Me+D*st.duration;var $e=y?new Uint8Array(0):F.default.moof(T.sequenceNumber++,Le/D,p({},T,{samples:W}));T.samples=[];var De=Le/b,He=oe/b,Ee="audio",fe={data1:$e,data2:je,startPTS:De,endPTS:He,startDTS:De,endDTS:He,type:Ee,hasAudio:!0,hasVideo:!1,nb:Ie};return this.isAudioContiguous=!0,console.assert(je.length,"MDAT length must not be zero"),fe},C.remuxEmptyAudio=function(T,_,u,E){var m=T.inputTimeScale,b=T.samplerate?T.samplerate:m,N=m/b,D=this.nextAudioPts,H=(D!==null?D:E.startDTS*m)+this._initDTS,j=E.endDTS*m+this._initDTS,I=N*d,y=Math.ceil((j-H)/I),W=B.default.getSilentFrame(T.manifestCodec||T.codec,T.channelCount);if(M.logger.warn("[mp4-remuxer]: remux empty Audio"),!W){M.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Y=[],ie=0;ie<y;ie++){var oe=H+ie*I;Y.push({unit:W,pts:oe,dts:oe})}return T.samples=Y,this.remuxAudio(T,_,u,!1)},C.remuxID3=function(T,_){var u=T.samples.length;if(!u)return;for(var E=T.inputTimeScale,m=this._initPTS,b=this._initDTS,N=0;N<u;N++){var D=T.samples[N];D.pts=h(D.pts-m,_*E)/E,D.dts=h(D.dts-b,_*E)/E}var H=T.samples;return T.samples=[],{samples:H}},C.remuxText=function(T,_){var u=T.samples.length;if(!u)return;for(var E=T.inputTimeScale,m=this._initPTS,b=0;b<u;b++){var N=T.samples[b];N.pts=h(N.pts-m,_*E)/E}T.samples.sort(function(H,j){return H.pts-j.pts});var D=T.samples;return T.samples=[],{samples:D}},O}();function h(O,C){var w;if(C===null)return O;for(C<O?w=-8589934592:w=8589934592;Math.abs(O-C)>4294967296;)O+=w;return O}function L(O){for(var C=0;C<O.length;C++)if(O[C].key)return C;return-1}var S=function(C,w,T,_){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=w,this.size=T,this.cts=_,this.flags=new x(C)},x=function(C){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=C?2:1,this.isNonSync=C?0:1}},"./src/remux/passthrough-remuxer.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/polyfills/number.ts"),B=P("./src/utils/mp4-tools.ts"),F=P("./src/loader/fragment.ts"),K=P("./src/utils/logger.ts"),G=function(){function g(){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 p=g.prototype;return p.destroy=function(){},p.resetTimeStamp=function(d){this.initPTS=d,this.lastEndDTS=null},p.resetNextTimestamp=function(){this.lastEndDTS=null},p.resetInitSegment=function(d,s,c){this.audioCodec=s,this.videoCodec=c,this.generateInitSegment(d),this.emitInitSegment=!0},p.generateInitSegment=function(d){var s=this.audioCodec,c=this.videoCodec;if(!d||!d.byteLength){this.initTracks=void 0,this.initData=void 0;return}var l=this.initData=Object(B.parseInitSegment)(d);s||(s=R(l.audio,F.ElementaryStreamTypes.AUDIO)),c||(c=R(l.video,F.ElementaryStreamTypes.VIDEO));var n={};l.audio&&l.video?n.audiovideo={container:"video/mp4",codec:s+","+c,initSegment:d,id:"main"}:l.audio?n.audio={container:"audio/mp4",codec:s,initSegment:d,id:"audio"}:l.video?n.video={container:"video/mp4",codec:c,initSegment:d,id:"main"}:K.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=n},p.remux=function(d,s,c,l,n){var o=this.initPTS,h=this.lastEndDTS,L={audio:void 0,video:void 0,text:l,id3:c,initSegment:void 0};Object(Q.isFiniteNumber)(h)||(h=this.lastEndDTS=n||0);var S=s.samples;if(!S||!S.length)return L;var x={initPTS:void 0,timescale:1},O=this.initData;if((!O||!O.length)&&(this.generateInitSegment(S),O=this.initData),!O||!O.length)return K.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),L;this.emitInitSegment&&(x.tracks=this.initTracks,this.emitInitSegment=!1),Object(Q.isFiniteNumber)(o)||(this.initPTS=x.initPTS=o=M(O,S,h));var C=Object(B.getDuration)(S,O),w=h,T=C+w;Object(B.offsetStartDTS)(O,S,o),C>0?this.lastEndDTS=T:(K.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var _=!!O.audio,u=!!O.video,E="";_&&(E+="audio"),u&&(E+="video");var m={data1:S,startPTS:w,startDTS:w,endPTS:T,endDTS:T,type:E,hasAudio:_,hasVideo:u,nb:1,dropped:0};return L.audio=m.type==="audio"?m:void 0,L.video=m.type!=="audio"?m:void 0,L.text=l,L.id3=c,L.initSegment=x,L},g}(),M=function(p,f,d){return Object(B.getStartDTS)(p,f)-d};function R(g,p){var f=g==null?void 0:g.codec;return f&&f.length>4?f:f==="hvc1"?"hvc1.1.c.L120.90":f==="av01"?"av01.0.04M.08":f==="avc1"||p===F.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Z.default=G},"./src/task-loop.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return Q});var Q=function(){function B(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var F=B.prototype;return F.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},F.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},F.onHandlerDestroyed=function(){},F.hasInterval=function(){return!!this._tickInterval},F.hasNextTick=function(){return!!this._tickTimer},F.setInterval=function(G){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,G),!0)},F.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},F.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},F.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},F.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},F.doTick=function(){},B}()},"./src/types/cmcd.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"CMCDVersion",function(){return Q}),P.d(Z,"CMCDObjectType",function(){return B}),P.d(Z,"CMCDStreamingFormat",function(){return F}),P.d(Z,"CMCDStreamType",function(){return K});var Q=1,B;(function(G){G.MANIFEST="m",G.AUDIO="a",G.VIDEO="v",G.MUXED="av",G.INIT="i",G.CAPTION="c",G.TIMED_TEXT="tt",G.KEY="k",G.OTHER="o"})(B||(B={}));var F;(function(G){G.DASH="d",G.HLS="h",G.SMOOTH="s",G.OTHER="o"})(F||(F={}));var K;(function(G){G.VOD="v",G.LIVE="l"})(K||(K={}))},"./src/types/level.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"HlsSkip",function(){return F}),P.d(Z,"getSkipValue",function(){return K}),P.d(Z,"HlsUrlParameters",function(){return G}),P.d(Z,"Level",function(){return M});function Q(R,g){for(var p=0;p<g.length;p++){var f=g[p];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(R,f.key,f)}}function B(R,g,p){return g&&Q(R.prototype,g),p&&Q(R,p),R}var F;(function(R){R.No="",R.Yes="YES",R.v2="v2"})(F||(F={}));function K(R,g){var p=R.canSkipUntil,f=R.canSkipDateRanges,d=R.endSN,s=g!==void 0?g-d:0;return p&&s<p?f?F.v2:F.Yes:F.No}var G=function(){function R(p,f,d){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=p,this.part=f,this.skip=d}var g=R.prototype;return g.addDirectives=function(f){var d=new self.URL(f);return this.msn!==void 0&&d.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&d.searchParams.set("_HLS_part",this.part.toString()),this.skip&&d.searchParams.set("_HLS_skip",this.skip),d.toString()},R}(),M=function(){function R(g){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=[g.url],this.attrs=g.attrs,this.bitrate=g.bitrate,g.details&&(this.details=g.details),this.id=g.id||0,this.name=g.name,this.width=g.width||0,this.height=g.height||0,this.audioCodec=g.audioCodec,this.videoCodec=g.videoCodec,this.unknownCodecs=g.unknownCodecs,this.codecSet=[g.videoCodec,g.audioCodec].filter(function(p){return p}).join(",").replace(/\.[^.,]+/g,"")}return B(R,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(p){var f=p%this.url.length;this._urlId!==f&&(this.details=void 0,this._urlId=f)}}]),R}()},"./src/types/loader.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"PlaylistContextType",function(){return Q}),P.d(Z,"PlaylistLevelType",function(){return B});var Q;(function(F){F.MANIFEST="manifest",F.LEVEL="level",F.AUDIO_TRACK="audioTrack",F.SUBTITLE_TRACK="subtitleTrack"})(Q||(Q={}));var B;(function(F){F.MAIN="main",F.AUDIO="audio",F.SUBTITLE="subtitle"})(B||(B={}))},"./src/types/transmuxer.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"ChunkMetadata",function(){return Q});var Q=function(K,G,M,R,g,p){R===void 0&&(R=0),g===void 0&&(g=-1),p===void 0&&(p=!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=B(),this.buffering={audio:B(),video:B(),audiovideo:B()},this.level=K,this.sn=G,this.id=M,this.size=R,this.part=g,this.partial=p};function B(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"AttrList",function(){return F});var Q=/^(\d+)x(\d+)$/,B=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,F=function(){function K(M){typeof M=="string"&&(M=K.parseAttrList(M));for(var R in M)M.hasOwnProperty(R)&&(this[R]=M[R])}var G=K.prototype;return G.decimalInteger=function(R){var g=parseInt(this[R],10);return g>Number.MAX_SAFE_INTEGER?Infinity:g},G.hexadecimalInteger=function(R){if(this[R]){var g=(this[R]||"0x").slice(2);g=(g.length&1?"0":"")+g;for(var p=new Uint8Array(g.length/2),f=0;f<g.length/2;f++)p[f]=parseInt(g.slice(f*2,f*2+2),16);return p}else return null},G.hexadecimalIntegerAsNumber=function(R){var g=parseInt(this[R],16);return g>Number.MAX_SAFE_INTEGER?Infinity:g},G.decimalFloatingPoint=function(R){return parseFloat(this[R])},G.optionalFloat=function(R,g){var p=this[R];return p?parseFloat(p):g},G.enumeratedString=function(R){return this[R]},G.bool=function(R){return this[R]==="YES"},G.decimalResolution=function(R){var g=Q.exec(this[R]);return g===null?void 0:{width:parseInt(g[1],10),height:parseInt(g[2],10)}},K.parseAttrList=function(R){var g,p={},f='"';for(B.lastIndex=0;(g=B.exec(R))!==null;){var d=g[2];d.indexOf(f)===0&&d.lastIndexOf(f)===d.length-1&&(d=d.slice(1,-1)),p[g[1]]=d}return p},K}()},"./src/utils/binary-search.ts":function(ue,Z,P){"use strict";P.r(Z);var Q={search:function(F,K){for(var G=0,M=F.length-1,R=null,g=null;G<=M;){R=(G+M)/2|0,g=F[R];var p=K(g);if(p>0)G=R+1;else if(p<0)M=R-1;else return g}return null}};Z.default=Q},"./src/utils/buffer-helper.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"BufferHelper",function(){return F});var Q=P("./src/utils/logger.ts"),B={length:0,start:function(){return 0},end:function(){return 0}},F=function(){function K(){}return K.isBuffered=function(M,R){try{if(M){for(var g=K.getBuffered(M),p=0;p<g.length;p++)if(R>=g.start(p)&&R<=g.end(p))return!0}}catch(f){}return!1},K.bufferInfo=function(M,R,g){try{if(M){var p=K.getBuffered(M),f=[],d;for(d=0;d<p.length;d++)f.push({start:p.start(d),end:p.end(d)});return this.bufferedInfo(f,R,g)}}catch(s){}return{len:0,start:R,end:R,nextStart:void 0}},K.bufferedInfo=function(M,R,g){R=Math.max(0,R),M.sort(function(x,O){var C=x.start-O.start;return C||O.end-x.end});var p=[];if(g)for(var f=0;f<M.length;f++){var d=p.length;if(d){var s=p[d-1].end;M[f].start-s<g?M[f].end>s&&(p[d-1].end=M[f].end):p.push(M[f])}else p.push(M[f])}else p=M;for(var c=0,l,n=R,o=R,h=0;h<p.length;h++){var L=p[h].start,S=p[h].end;if(R+g>=L&&R<S)n=L,o=S,c=o-R;else if(R+g<L){l=L;break}}return{len:c,start:n||0,end:o||0,nextStart:l}},K.getBuffered=function(M){try{return M.buffered}catch(R){return Q.logger.log("failed to get media.buffered",R),B}},K}()},"./src/utils/cea-608-parser.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"Row",function(){return o}),P.d(Z,"CaptionScreen",function(){return h});var Q=P("./src/utils/logger.ts"),B={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},F=function(T){var _=T;return B.hasOwnProperty(T)&&(_=B[T]),String.fromCharCode(_)},K=15,G=100,M={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},R={17:2,18:4,21:6,22:8,23:10,19:13,20:15},g={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},p={25:2,26:4,29:6,30:8,31:10,27:13,28:15},f=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],d;(function(w){w[w.ERROR=0]="ERROR",w[w.TEXT=1]="TEXT",w[w.WARNING=2]="WARNING",w[w.INFO=2]="INFO",w[w.DEBUG=3]="DEBUG",w[w.DATA=3]="DATA"})(d||(d={}));var s=function(){function w(){this.time=null,this.verboseLevel=d.ERROR}var T=w.prototype;return T.log=function(u,E){this.verboseLevel>=u&&Q.logger.log(this.time+" ["+u+"] "+E)},w}(),c=function(T){for(var _=[],u=0;u<T.length;u++)_.push(T[u].toString(16));return _},l=function(){function w(_,u,E,m,b){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=_||"white",this.underline=u||!1,this.italics=E||!1,this.background=m||"black",this.flash=b||!1}var T=w.prototype;return T.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},T.setStyles=function(u){for(var E=["foreground","underline","italics","background","flash"],m=0;m<E.length;m++){var b=E[m];u.hasOwnProperty(b)&&(this[b]=u[b])}},T.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},T.equals=function(u){return this.foreground===u.foreground&&this.underline===u.underline&&this.italics===u.italics&&this.background===u.background&&this.flash===u.flash},T.copy=function(u){this.foreground=u.foreground,this.underline=u.underline,this.italics=u.italics,this.background=u.background,this.flash=u.flash},T.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},w}(),n=function(){function w(_,u,E,m,b,N){this.uchar=void 0,this.penState=void 0,this.uchar=_||" ",this.penState=new l(u,E,m,b,N)}var T=w.prototype;return T.reset=function(){this.uchar=" ",this.penState.reset()},T.setChar=function(u,E){this.uchar=u,this.penState.copy(E)},T.setPenState=function(u){this.penState.copy(u)},T.equals=function(u){return this.uchar===u.uchar&&this.penState.equals(u.penState)},T.copy=function(u){this.uchar=u.uchar,this.penState.copy(u.penState)},T.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},w}(),o=function(){function w(_){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var u=0;u<G;u++)this.chars.push(new n);this.logger=_,this.pos=0,this.currPenState=new l}var T=w.prototype;return T.equals=function(u){for(var E=!0,m=0;m<G;m++)if(!this.chars[m].equals(u.chars[m])){E=!1;break}return E},T.copy=function(u){for(var E=0;E<G;E++)this.chars[E].copy(u.chars[E])},T.isEmpty=function(){for(var u=!0,E=0;E<G;E++)if(!this.chars[E].isEmpty()){u=!1;break}return u},T.setCursor=function(u){this.pos!==u&&(this.pos=u),this.pos<0?(this.logger.log(d.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>G&&(this.logger.log(d.DEBUG,"Too large cursor position "+this.pos),this.pos=G)},T.moveCursor=function(u){var E=this.pos+u;if(u>1)for(var m=this.pos+1;m<E+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(E)},T.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},T.insertChar=function(u){u>=144&&this.backSpace();var E=F(u);if(this.pos>=G){this.logger.log(d.ERROR,"Cannot insert "+u.toString(16)+" ("+E+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(E,this.currPenState),this.moveCursor(1)},T.clearFromPos=function(u){var E;for(E=u;E<G;E++)this.chars[E].reset()},T.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},T.clearToEndOfRow=function(){this.clearFromPos(this.pos)},T.getTextString=function(){for(var u=[],E=!0,m=0;m<G;m++){var b=this.chars[m].uchar;b!==" "&&(E=!1),u.push(b)}return E?"":u.join("")},T.setPenStyles=function(u){this.currPenState.setStyles(u);var E=this.chars[this.pos];E.setPenState(this.currPenState)},w}(),h=function(){function w(_){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var u=0;u<K;u++)this.rows.push(new o(_));this.logger=_,this.currRow=K-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var T=w.prototype;return T.reset=function(){for(var u=0;u<K;u++)this.rows[u].clear();this.currRow=K-1},T.equals=function(u){for(var E=!0,m=0;m<K;m++)if(!this.rows[m].equals(u.rows[m])){E=!1;break}return E},T.copy=function(u){for(var E=0;E<K;E++)this.rows[E].copy(u.rows[E])},T.isEmpty=function(){for(var u=!0,E=0;E<K;E++)if(!this.rows[E].isEmpty()){u=!1;break}return u},T.backSpace=function(){var u=this.rows[this.currRow];u.backSpace()},T.clearToEndOfRow=function(){var u=this.rows[this.currRow];u.clearToEndOfRow()},T.insertChar=function(u){var E=this.rows[this.currRow];E.insertChar(u)},T.setPen=function(u){var E=this.rows[this.currRow];E.setPenStyles(u)},T.moveCursor=function(u){var E=this.rows[this.currRow];E.moveCursor(u)},T.setCursor=function(u){this.logger.log(d.INFO,"setCursor: "+u);var E=this.rows[this.currRow];E.setCursor(u)},T.setPAC=function(u){this.logger.log(d.INFO,"pacData = "+JSON.stringify(u));var E=u.row-1;if(this.nrRollUpRows&&E<this.nrRollUpRows-1&&(E=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==E){for(var m=0;m<K;m++)this.rows[m].clear();var b=this.currRow+1-this.nrRollUpRows,N=this.lastOutputScreen;if(N){var D=N.rows[b].cueStartTime,H=this.logger.time;if(D&&H!==null&&D<H)for(var j=0;j<this.nrRollUpRows;j++)this.rows[E-this.nrRollUpRows+j+1].copy(N.rows[b+j])}}this.currRow=E;var I=this.rows[this.currRow];if(u.indent!==null){var y=u.indent,W=Math.max(y-1,0);I.setCursor(u.indent),u.color=I.chars[W].penState.foreground}var Y={foreground:u.color,underline:u.underline,italics:u.italics,background:"black",flash:!1};this.setPen(Y)},T.setBkgData=function(u){this.logger.log(d.INFO,"bkgData = "+JSON.stringify(u)),this.backSpace(),this.setPen(u),this.insertChar(32)},T.setRollUpRows=function(u){this.nrRollUpRows=u},T.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(d.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(d.TEXT,this.getDisplayText());var u=this.currRow+1-this.nrRollUpRows,E=this.rows.splice(u,1)[0];E.clear(),this.rows.splice(this.currRow,0,E),this.logger.log(d.INFO,"Rolling up")},T.getDisplayText=function(u){u=u||!1;for(var E=[],m="",b=-1,N=0;N<K;N++){var D=this.rows[N].getTextString();D&&(b=N+1,u?E.push("Row "+b+": '"+D+"'"):E.push(D.trim()))}return E.length>0&&(u?m="["+E.join(" | ")+"]":m=E.join(`
|
|
`)),m},T.getTextAndFormat=function(){return this.rows},w}(),L=function(){function w(_,u,E){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=_,this.outputFilter=u,this.mode=null,this.verbose=0,this.displayedMemory=new h(E),this.nonDisplayedMemory=new h(E),this.lastOutputScreen=new h(E),this.currRollUpRow=this.displayedMemory.rows[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=E}var T=w.prototype;return T.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},T.getHandler=function(){return this.outputFilter},T.setHandler=function(u){this.outputFilter=u},T.setPAC=function(u){this.writeScreen.setPAC(u)},T.setBkgData=function(u){this.writeScreen.setBkgData(u)},T.setMode=function(u){if(u===this.mode)return;this.mode=u,this.logger.log(d.INFO,"MODE="+u),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=u},T.insertChars=function(u){for(var E=0;E<u.length;E++)this.writeScreen.insertChar(u[E]);var m=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(d.INFO,m+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(d.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},T.ccRCL=function(){this.logger.log(d.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},T.ccBS=function(){if(this.logger.log(d.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},T.ccAOF=function(){},T.ccAON=function(){},T.ccDER=function(){this.logger.log(d.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},T.ccRU=function(u){this.logger.log(d.INFO,"RU("+u+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(u)},T.ccFON=function(){this.logger.log(d.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},T.ccRDC=function(){this.logger.log(d.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},T.ccTR=function(){this.logger.log(d.INFO,"TR"),this.setMode("MODE_TEXT")},T.ccRTD=function(){this.logger.log(d.INFO,"RTD"),this.setMode("MODE_TEXT")},T.ccEDM=function(){this.logger.log(d.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},T.ccCR=function(){this.logger.log(d.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},T.ccENM=function(){this.logger.log(d.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},T.ccEOC=function(){if(this.logger.log(d.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var u=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=u,this.writeScreen=this.nonDisplayedMemory,this.logger.log(d.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},T.ccTO=function(u){this.logger.log(d.INFO,"TO("+u+") - Tab Offset"),this.writeScreen.moveCursor(u)},T.ccMIDROW=function(u){var E={flash:!1};if(E.underline=u%2===1,E.italics=u>=46,E.italics)E.foreground="white";else{var m=Math.floor(u/2)-16,b=["white","green","blue","cyan","red","yellow","magenta"];E.foreground=b[m]}this.logger.log(d.INFO,"MIDROW: "+JSON.stringify(E)),this.writeScreen.setPen(E)},T.outputDataUpdate=function(u){u===void 0&&(u=!1);var E=this.logger.time;if(E===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=E:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,E,this.lastOutputScreen),u&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:E),this.lastOutputScreen.copy(this.displayedMemory))},T.cueSplitAtTime=function(u){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,u,this.displayedMemory),this.cueStartTime=u))},w}(),S=function(){function w(_,u,E){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new s;this.channels=[null,new L(_,u,m),new L(_+1,E,m)],this.cmdHistory=C(),this.logger=m}var T=w.prototype;return T.getHandler=function(u){return this.channels[u].getHandler()},T.setHandler=function(u,E){this.channels[u].setHandler(E)},T.addData=function(u,E){var m,b,N,D=!1;this.logger.time=u;for(var H=0;H<E.length;H+=2){if(b=E[H]&127,N=E[H+1]&127,b===0&&N===0)continue;if(this.logger.log(d.DATA,"["+c([E[H],E[H+1]])+"] -> ("+c([b,N])+")"),m=this.parseCmd(b,N),m||(m=this.parseMidrow(b,N)),m||(m=this.parsePAC(b,N)),m||(m=this.parseBackgroundAttributes(b,N)),!m&&(D=this.parseChars(b,N),D)){var j=this.currentChannel;if(j&&j>0){var I=this.channels[j];I.insertChars(D)}else this.logger.log(d.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!D&&this.logger.log(d.WARNING,"Couldn't parse cleaned data "+c([b,N])+" orig: "+c([E[H],E[H+1]]))}},T.parseCmd=function(u,E){var m=this.cmdHistory,b=(u===20||u===28||u===21||u===29)&&E>=32&&E<=47,N=(u===23||u===31)&&E>=33&&E<=35;if(!(b||N))return!1;if(O(u,E,m))return x(null,null,m),this.logger.log(d.DEBUG,"Repeated command ("+c([u,E])+") is dropped"),!0;var D=u===20||u===21||u===23?1:2,H=this.channels[D];return u===20||u===21||u===28||u===29?E===32?H.ccRCL():E===33?H.ccBS():E===34?H.ccAOF():E===35?H.ccAON():E===36?H.ccDER():E===37?H.ccRU(2):E===38?H.ccRU(3):E===39?H.ccRU(4):E===40?H.ccFON():E===41?H.ccRDC():E===42?H.ccTR():E===43?H.ccRTD():E===44?H.ccEDM():E===45?H.ccCR():E===46?H.ccENM():E===47&&H.ccEOC():H.ccTO(E-32),x(u,E,m),this.currentChannel=D,!0},T.parseMidrow=function(u,E){var m=0;if((u===17||u===25)&&E>=32&&E<=47){if(u===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(d.ERROR,"Mismatch channel in midrow parsing"),!1;var b=this.channels[m];return b?(b.ccMIDROW(E),this.logger.log(d.DEBUG,"MIDROW ("+c([u,E])+")"),!0):!1}return!1},T.parsePAC=function(u,E){var m,b=this.cmdHistory,N=(u>=17&&u<=23||u>=25&&u<=31)&&E>=64&&E<=127,D=(u===16||u===24)&&E>=64&&E<=95;if(!(N||D))return!1;if(O(u,E,b))return x(null,null,b),!0;var H=u<=23?1:2;E>=64&&E<=95?m=H===1?M[u]:g[u]:m=H===1?R[u]:p[u];var j=this.channels[H];return j?(j.setPAC(this.interpretPAC(m,E)),x(u,E,b),this.currentChannel=H,!0):!1},T.interpretPAC=function(u,E){var m,b={color:null,italics:!1,indent:null,underline:!1,row:u};return E>95?m=E-96:m=E-64,b.underline=(m&1)===1,m<=13?b.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(b.italics=!0,b.color="white"):b.indent=Math.floor((m-16)/2)*4,b},T.parseChars=function(u,E){var m,b=null,N=null;if(u>=25?(m=2,N=u-8):(m=1,N=u),N>=17&&N<=19){var D;N===17?D=E+80:N===18?D=E+112:D=E+144,this.logger.log(d.INFO,"Special char '"+F(D)+"' in channel "+m),b=[D]}else u>=32&&u<=127&&(b=E===0?[u]:[u,E]);if(b){var H=c(b);this.logger.log(d.DEBUG,"Char codes = "+H.join(",")),x(u,E,this.cmdHistory)}return b},T.parseBackgroundAttributes=function(u,E){var m=(u===16||u===24)&&E>=32&&E<=47,b=(u===23||u===31)&&E>=45&&E<=47;if(!(m||b))return!1;var N,D={};u===16||u===24?(N=Math.floor((E-32)/2),D.background=f[N],E%2===1&&(D.background=D.background+"_semi")):E===45?D.background="transparent":(D.foreground="black",E===47&&(D.underline=!0));var H=u<=23?1:2,j=this.channels[H];return j.setBkgData(D),x(u,E,this.cmdHistory),!0},T.reset=function(){for(var u=0;u<Object.keys(this.channels).length;u++){var E=this.channels[u];E&&E.reset()}this.cmdHistory=C()},T.cueSplitAtTime=function(u){for(var E=0;E<this.channels.length;E++){var m=this.channels[E];m&&m.cueSplitAtTime(u)}},w}();function x(w,T,_){_.a=w,_.b=T}function O(w,T,_){return _.a===w&&_.b===T}function C(){return{a:null,b:null}}Z.default=S},"./src/utils/codecs.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"isCodecType",function(){return B}),P.d(Z,"isCodecSupportedInMp4",function(){return F});var Q={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function B(K,G){var M=Q[G];return!!M&&M[K.slice(0,4)]===!0}function F(K,G){return MediaSource.isTypeSupported((G||"video")+'/mp4;codecs="'+K+'"')}},"./src/utils/cues.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/utils/vttparser.ts"),B=P("./src/utils/webvtt-parser.ts"),F=P("./src/utils/texttrack-utils.ts"),K=/\s/,G={newCue:function(R,g,p,f){for(var d=[],s,c,l,n,o,h=self.VTTCue||self.TextTrackCue,L=0;L<f.rows.length;L++)if(s=f.rows[L],l=!0,n=0,o="",!s.isEmpty()){for(var S=0;S<s.chars.length;S++)K.test(s.chars[S].uchar)&&l?n++:(o+=s.chars[S].uchar,l=!1);s.cueStartTime=g,g===p&&(p+=1e-4),n>=16?n--:n++;var x=Object(Q.fixLineBreaks)(o.trim()),O=Object(B.generateCueId)(g,p,x);(!R||!R.cues||!R.cues.getCueById(O))&&(c=new h(g,p,x),c.id=O,c.line=L+1,c.align="left",c.position=10+Math.min(80,Math.floor(n*8/32)*10),d.push(c))}return R&&d.length&&(d.sort(function(C,w){return C.line==="auto"||w.line==="auto"?0:C.line>8&&w.line>8?w.line-C.line:C.line-w.line}),d.forEach(function(C){return Object(F.addCueToTrack)(R,C)})),d}};Z.default=G},"./src/utils/discontinuities.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"findFirstFragWithCC",function(){return K}),P.d(Z,"shouldAlignOnDiscontinuities",function(){return G}),P.d(Z,"findDiscontinuousReferenceFrag",function(){return M}),P.d(Z,"adjustSlidingStart",function(){return g}),P.d(Z,"alignStream",function(){return p}),P.d(Z,"alignPDT",function(){return d}),P.d(Z,"alignFragmentByPDTDelta",function(){return s}),P.d(Z,"alignMediaPlaylistByPDT",function(){return c});var Q=P("./src/polyfills/number.ts"),B=P("./src/utils/logger.ts"),F=P("./src/controller/level-helper.ts");function K(l,n){for(var o=null,h=0,L=l.length;h<L;h++){var S=l[h];if(S&&S.cc===n){o=S;break}}return o}function G(l,n,o){return!!(n.details&&(o.endCC>o.startCC||l&&l.cc<o.startCC))}function M(l,n){var o=l.fragments,h=n.fragments;if(!h.length||!o.length){B.logger.log("No fragments to align");return}var L=K(o,h[0].cc);if(!L||L&&!L.startPTS){B.logger.log("No frag in previous level to align on");return}return L}function R(l,n){if(l){var o=l.start+n;l.start=l.startPTS=o,l.endPTS=o+l.duration}}function g(l,n){for(var o=n.fragments,h=0,L=o.length;h<L;h++)R(o[h],l);n.fragmentHint&&R(n.fragmentHint,l),n.alignedSliding=!0}function p(l,n,o){if(!n)return;f(l,o,n),!o.alignedSliding&&n.details&&d(o,n.details),!o.alignedSliding&&n.details&&!o.skippedSegments&&Object(F.adjustSliding)(n.details,o)}function f(l,n,o){if(G(l,o,n)){var h=M(o.details,n);h&&Object(Q.isFiniteNumber)(h.start)&&(B.logger.log("Adjusting PTS using last level due to CC increase within current level "+n.url),g(h.start,n))}}function d(l,n){if(!n.fragments.length||!l.hasProgramDateTime||!n.hasProgramDateTime)return;var o=n.fragments[0].programDateTime,h=l.fragments[0].programDateTime,L=(h-o)/1e3+n.fragments[0].start;L&&Object(Q.isFiniteNumber)(L)&&(B.logger.log("Adjusting PTS using programDateTime delta "+(h-o)+"ms, sliding:"+L.toFixed(3)+" "+l.url+" "),g(L,l))}function s(l,n){var o=l.programDateTime;if(!o)return;var h=(o-n)/1e3;l.start=l.startPTS=h,l.endPTS=h+l.duration}function c(l,n){if(!n.fragments.length||!l.hasProgramDateTime||!n.hasProgramDateTime)return;var o=n.fragments[0].programDateTime,h=n.fragments[0].start,L=o-h*1e3;l.fragments.forEach(function(S){s(S,L)}),l.fragmentHint&&s(l.fragmentHint,L),l.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/utils/ewma.ts"),B=function(){function F(G,M,R){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=R,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Q.default(G),this.fast_=new Q.default(M)}var K=F.prototype;return K.update=function(M,R){var g=this.slow_,p=this.fast_;this.slow_.halfLife!==M&&(this.slow_=new Q.default(M,g.getEstimate(),g.getTotalWeight())),this.fast_.halfLife!==R&&(this.fast_=new Q.default(R,p.getEstimate(),p.getTotalWeight()))},K.sample=function(M,R){M=Math.max(M,this.minDelayMs_);var g=8*R,p=M/1e3,f=g/p;this.fast_.sample(p,f),this.slow_.sample(p,f)},K.canEstimate=function(){var M=this.fast_;return M&&M.getTotalWeight()>=this.minWeight_},K.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},K.destroy=function(){},F}();Z.default=B},"./src/utils/ewma.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=function(){function B(K,G,M){G===void 0&&(G=0),M===void 0&&(M=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=K,this.alpha_=K?Math.exp(Math.log(.5)/K):0,this.estimate_=G,this.totalWeight_=M}var F=B.prototype;return F.sample=function(G,M){var R=Math.pow(this.alpha_,G);this.estimate_=M*(1-R)+R*this.estimate_,this.totalWeight_+=G},F.getTotalWeight=function(){return this.totalWeight_},F.getEstimate=function(){if(this.alpha_){var G=1-Math.pow(this.alpha_,this.totalWeight_);if(G)return this.estimate_/G}return this.estimate_},B}();Z.default=Q},"./src/utils/fetch-loader.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"fetchSupported",function(){return s});var Q=P("./src/polyfills/number.ts"),B=P("./src/loader/load-stats.ts"),F=P("./src/demux/chunk-cache.ts");function K(h,L){h.prototype=Object.create(L.prototype),h.prototype.constructor=h,p(h,L)}function G(h){var L=typeof Map=="function"?new Map:void 0;return G=function(x){if(x===null||!g(x))return x;if(typeof x!="function")throw new TypeError("Super expression must either be null or a function");if(typeof L!="undefined"){if(L.has(x))return L.get(x);L.set(x,O)}function O(){return M(x,arguments,f(this).constructor)}return O.prototype=Object.create(x.prototype,{constructor:{value:O,enumerable:!1,writable:!0,configurable:!0}}),p(O,x)},G(h)}function M(h,L,S){return R()?M=Reflect.construct:M=function(O,C,w){var T=[null];T.push.apply(T,C);var _=Function.bind.apply(O,T),u=new _;return w&&p(u,w.prototype),u},M.apply(null,arguments)}function R(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(h){return!1}}function g(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function p(h,L){return p=Object.setPrototypeOf||function(x,O){return x.__proto__=O,x},p(h,L)}function f(h){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(S){return S.__proto__||Object.getPrototypeOf(S)},f(h)}function d(){return d=Object.assign||function(h){for(var L=1;L<arguments.length;L++){var S=arguments[L];for(var x in S)Object.prototype.hasOwnProperty.call(S,x)&&(h[x]=S[x])}return h},d.apply(this,arguments)}function s(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(h){}return!1}var c=function(){function h(S){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=S.fetchSetup||n,this.controller=new self.AbortController,this.stats=new B.LoadStats}var L=h.prototype;return L.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},L.abortInternal=function(){var x=this.response;(!x||!x.ok)&&(this.stats.aborted=!0,this.controller.abort())},L.abort=function(){var x;this.abortInternal(),(x=this.callbacks)!==null&&x!==void 0&&x.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},L.load=function(x,O,C){var w=this,T=this.stats;if(T.loading.start)throw new Error("Loader can only be used once.");T.loading.start=self.performance.now();var _=l(x,this.controller.signal),u=C.onProgress,E=x.responseType==="arraybuffer",m=E?"byteLength":"length";this.context=x,this.config=O,this.callbacks=C,this.request=this.fetchSetup(x,_),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){w.abortInternal(),C.onTimeout(T,x,w.response)},O.timeout),self.fetch(this.request).then(function(b){if(w.response=w.loader=b,!b.ok){var N=b.status,D=b.statusText;throw new o(D||"fetch, bad network response",N,b)}return T.loading.first=Math.max(self.performance.now(),T.loading.start),T.total=parseInt(b.headers.get("Content-Length")||"0"),u&&Object(Q.isFiniteNumber)(O.highWaterMark)?w.loadProgressively(b,T,x,O.highWaterMark,u):E?b.arrayBuffer():b.text()}).then(function(b){var N=w.response;self.clearTimeout(w.requestTimeout),T.loading.end=Math.max(self.performance.now(),T.loading.first),T.loaded=T.total=b[m];var D={url:N.url,data:b};u&&!Object(Q.isFiniteNumber)(O.highWaterMark)&&u(T,x,b,N),C.onSuccess(D,T,x,N)}).catch(function(b){if(self.clearTimeout(w.requestTimeout),T.aborted)return;var N=b.code||0;C.onError({code:N,text:b.message},x,b.details)})},L.getCacheAge=function(){var x=null;if(this.response){var O=this.response.headers.get("age");x=O?parseFloat(O):null}return x},L.loadProgressively=function(x,O,C,w,T){w===void 0&&(w=0);var _=new F.default,u=x.body.getReader(),E=function m(){return u.read().then(function(b){if(b.done)return _.dataLength&&T(O,C,_.flush(),x),Promise.resolve(new ArrayBuffer(0));var N=b.value,D=N.length;return O.loaded+=D,D<w||_.dataLength?(_.push(N),_.dataLength>=w&&T(O,C,_.flush(),x)):T(O,C,N,x),m()}).catch(function(){return Promise.reject()})};return E()},h}();function l(h,L){var S={method:"GET",mode:"cors",credentials:"same-origin",signal:L,headers:new self.Headers(d({},h.headers))};return h.rangeEnd&&S.headers.set("Range","bytes="+h.rangeStart+"-"+String(h.rangeEnd-1)),S}function n(h,L){return new self.Request(h.url,L)}var o=function(h){K(L,h);function L(S,x,O){var C;return C=h.call(this,S)||this,C.code=void 0,C.details=void 0,C.code=x,C.details=O,C}return L}(G(Error));Z.default=c},"./src/utils/imsc1-ttml-parser.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"IMSC1_CODEC",function(){return g}),P.d(Z,"parseIMSC1",function(){return s});var Q=P("./src/utils/mp4-tools.ts"),B=P("./src/utils/vttparser.ts"),F=P("./src/utils/vttcue.ts"),K=P("./src/demux/id3.ts"),G=P("./src/utils/timescale-conversion.ts"),M=P("./src/utils/webvtt-parser.ts");function R(){return R=Object.assign||function(w){for(var T=1;T<arguments.length;T++){var _=arguments[T];for(var u in _)Object.prototype.hasOwnProperty.call(_,u)&&(w[u]=_[u])}return w},R.apply(this,arguments)}var g="stpp.ttml.im1t",p=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,f=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,d={left:"start",center:"center",right:"end",start:"start",end:"end"};function s(w,T,_,u,E){var m=Object(Q.findBox)(new Uint8Array(w),["mdat"]);if(m.length===0){E(new Error("Could not parse IMSC1 mdat"));return}var b=m[0],N=Object(K.utf8ArrayToStr)(new Uint8Array(w,b.start,b.end-b.start)),D=Object(G.toTimescaleFromScale)(T,1,_);try{u(c(N,D))}catch(H){E(H)}}function c(w,T){var _=new DOMParser,u=_.parseFromString(w,"text/xml"),E=u.getElementsByTagName("tt")[0];if(!E)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},b=Object.keys(m).reduce(function(I,y){return I[y]=E.getAttribute("ttp:"+y)||m[y],I},{}),N=E.getAttribute("xml:space")!=="preserve",D=n(l(E,"styling","style")),H=n(l(E,"layout","region")),j=l(E,"body","[begin]");return[].map.call(j,function(I){var y=o(I,N);if(!y||!I.hasAttribute("begin"))return null;var W=x(I.getAttribute("begin"),b),Y=x(I.getAttribute("dur"),b),ie=x(I.getAttribute("end"),b);if(W===null)throw S(I);if(ie===null){if(Y===null)throw S(I);ie=W+Y}var oe=new F.default(W-T,ie-T,y);oe.id=Object(M.generateCueId)(oe.startTime,oe.endTime,oe.text);var we=H[I.getAttribute("region")],me=D[I.getAttribute("style")];oe.position=10,oe.size=80;var Se=h(we,me),Ce=Se.textAlign;if(Ce){var xe=d[Ce];xe&&(oe.lineAlign=xe),oe.align=Ce}return R(oe,Se),oe}).filter(function(I){return I!==null})}function l(w,T,_){var u=w.getElementsByTagName(T)[0];return u?[].slice.call(u.querySelectorAll(_)):[]}function n(w){return w.reduce(function(T,_){var u=_.getAttribute("xml:id");return u&&(T[u]=_),T},{})}function o(w,T){return[].slice.call(w.childNodes).reduce(function(_,u,E){var m;return u.nodeName==="br"&&E?_+`
|
|
`:(m=u.childNodes)!==null&&m!==void 0&&m.length?o(u,T):T?_+u.textContent.trim().replace(/\s+/g," "):_+u.textContent},"")}function h(w,T){var _="http://www.w3.org/ns/ttml#styling",u=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return u.reduce(function(E,m){var b=L(T,_,m)||L(w,_,m);return b&&(E[m]=b),E},{})}function L(w,T,_){return w.hasAttributeNS(T,_)?w.getAttributeNS(T,_):null}function S(w){return new Error("Could not parse ttml timestamp "+w)}function x(w,T){if(!w)return null;var _=Object(B.parseTimeStamp)(w);return _===null&&(p.test(w)?_=O(w,T):f.test(w)&&(_=C(w,T))),_}function O(w,T){var _=p.exec(w),u=(_[4]|0)+(_[5]|0)/T.subFrameRate;return(_[1]|0)*3600+(_[2]|0)*60+(_[3]|0)+u/T.frameRate}function C(w,T){var _=f.exec(w),u=Number(_[1]),E=_[2];switch(E){case"h":return u*3600;case"m":return u*60;case"ms":return u*1e3;case"f":return u/T.frameRate;case"t":return u/T.tickRate}return u}},"./src/utils/logger.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"enableLogs",function(){return M}),P.d(Z,"logger",function(){return R});var Q=function(){},B={trace:Q,debug:Q,log:Q,warn:Q,info:Q,error:Q},F=B;function K(g){var p=self.console[g];return p?p.bind(self.console,"["+g+"] >"):Q}function G(g){for(var p=arguments.length,f=new Array(p>1?p-1:0),d=1;d<p;d++)f[d-1]=arguments[d];f.forEach(function(s){F[s]=g[s]?g[s].bind(g):K(s)})}function M(g){if(self.console&&g===!0||typeof g=="object"){G(g,"debug","log","info","warn","error");try{F.log()}catch(p){F=B}}else F=B}var R=F},"./src/utils/mediakeys-helper.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"KeySystems",function(){return Q}),P.d(Z,"requestMediaKeySystemAccess",function(){return B});var Q;(function(F){F.WIDEVINE="com.widevine.alpha",F.PLAYREADY="com.microsoft.playready"})(Q||(Q={}));var B=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"getMediaSource",function(){return Q});function Q(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"bin2str",function(){return G}),P.d(Z,"readUint16",function(){return M}),P.d(Z,"readUint32",function(){return R}),P.d(Z,"writeUint32",function(){return g}),P.d(Z,"findBox",function(){return p}),P.d(Z,"parseSegmentIndex",function(){return f}),P.d(Z,"parseInitSegment",function(){return d}),P.d(Z,"getStartDTS",function(){return s}),P.d(Z,"getDuration",function(){return c}),P.d(Z,"computeRawDurationFromSamples",function(){return l}),P.d(Z,"offsetStartDTS",function(){return n}),P.d(Z,"segmentValidRange",function(){return o}),P.d(Z,"appendUint8Array",function(){return h});var Q=P("./src/utils/typed-array.ts"),B=P("./src/loader/fragment.ts"),F=Math.pow(2,32)-1,K=[].push;function G(L){return String.fromCharCode.apply(null,L)}function M(L,S){"data"in L&&(S+=L.start,L=L.data);var x=L[S]<<8|L[S+1];return x<0?65536+x:x}function R(L,S){"data"in L&&(S+=L.start,L=L.data);var x=L[S]<<24|L[S+1]<<16|L[S+2]<<8|L[S+3];return x<0?4294967296+x:x}function g(L,S,x){"data"in L&&(S+=L.start,L=L.data),L[S]=x>>24,L[S+1]=x>>16&255,L[S+2]=x>>8&255,L[S+3]=x&255}function p(L,S){var x=[];if(!S.length)return x;var O,C,w;"data"in L?(O=L.data,C=L.start,w=L.end):(O=L,C=0,w=O.byteLength);for(var T=C;T<w;){var _=R(O,T),u=G(O.subarray(T+4,T+8)),E=_>1?T+_:w;if(u===S[0])if(S.length===1)x.push({data:O,start:T+8,end:E});else{var m=p({data:O,start:T+8,end:E},S.slice(1));m.length&&K.apply(x,m)}T=E}return x}function f(L){var S=p(L,["moov"]),x=S[0],O=x?x.end:null,C=p(L,["sidx"]);if(!C||!C[0])return null;var w=[],T=C[0],_=T.data[0],u=_===0?8:16,E=R(T,u);u+=4;var m=0,b=0;_===0?u+=8:u+=16,u+=2;var N=T.end+b,D=M(T,u);u+=2;for(var H=0;H<D;H++){var j=u,I=R(T,j);j+=4;var y=I&2147483647,W=(I&2147483648)>>>31;if(W===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Y=R(T,j);j+=4,w.push({referenceSize:y,subsegmentDuration:Y,info:{duration:Y/E,start:N,end:N+y-1}}),N+=y,j+=4,u=j}return{earliestPresentationTime:m,timescale:E,version:_,referencesCount:D,references:w,moovEndOffset:O}}function d(L){for(var S=[],x=p(L,["moov","trak"]),O=0;O<x.length;O++){var C=x[O],w=p(C,["tkhd"])[0];if(w){var T=w.data[w.start],_=T===0?12:20,u=R(w,_),E=p(C,["mdia","mdhd"])[0];if(E){T=E.data[E.start],_=T===0?12:20;var m=R(E,_),b=p(C,["mdia","hdlr"])[0];if(b){var N=G(b.data.subarray(b.start+8,b.start+12)),D={soun:B.ElementaryStreamTypes.AUDIO,vide:B.ElementaryStreamTypes.VIDEO}[N];if(D){var H=p(C,["mdia","minf","stbl","stsd"])[0],j=void 0;H&&(j=G(H.data.subarray(H.start+12,H.start+16))),S[u]={timescale:m,type:D},S[D]={timescale:m,id:u,codec:j}}}}}}var I=p(L,["moov","mvex","trex"]);return I.forEach(function(y){var W=R(y,4),Y=S[W];Y&&(Y.default={duration:R(y,12),flags:R(y,20)})}),S}function s(L,S){return p(S,["moof","traf"]).reduce(function(x,O){var C=p(O,["tfdt"])[0],w=C.data[C.start],T=p(O,["tfhd"]).reduce(function(_,u){var E=R(u,4),m=L[E];if(m){var b=R(C,4);w===1&&(b*=Math.pow(2,32),b+=R(C,8));var N=m.timescale||9e4,D=b/N;if(isFinite(D)&&(_===null||D<_))return D}return _},null);return T!==null&&isFinite(T)&&(x===null||T<x)?T:x},null)||0}function c(L,S){for(var x=0,O=0,C=0,w=p(L,["moof","traf"]),T=0;T<w.length;T++){var _=w[T],u=p(_,["tfhd"])[0],E=R(u,4),m=S[E];if(!m)continue;var b=m.default,N=R(u,0)|(b==null?void 0:b.flags),D=b==null?void 0:b.duration;N&8&&(N&2?D=R(u,12):D=R(u,8));for(var H=m.timescale||9e4,j=p(_,["trun"]),I=0;I<j.length;I++){if(D){var y=R(j[I],4);x=D*y}else x=l(j[I]);m.type===B.ElementaryStreamTypes.VIDEO?O+=x/H:m.type===B.ElementaryStreamTypes.AUDIO&&(C+=x/H)}}if(O===0&&C===0){var W=f(L);if(W!=null&&W.references)return W.references.reduce(function(Y,ie){return Y+ie.info.duration||0},0)}return O||C}function l(L){var S=R(L,0),x=8;S&1&&(x+=4),S&4&&(x+=4);for(var O=0,C=R(L,4),w=0;w<C;w++){if(S&256){var T=R(L,x);O+=T,x+=4}S&512&&(x+=4),S&1024&&(x+=4),S&2048&&(x+=4)}return O}function n(L,S,x){p(S,["moof","traf"]).forEach(function(O){p(O,["tfhd"]).forEach(function(C){var w=R(C,4),T=L[w];if(!T)return;var _=T.timescale||9e4;p(O,["tfdt"]).forEach(function(u){var E=u.data[u.start],m=R(u,4);if(E===0)g(u,4,m-x*_);else{m*=Math.pow(2,32),m+=R(u,8),m-=x*_,m=Math.max(m,0);var b=Math.floor(m/(F+1)),N=Math.floor(m%(F+1));g(u,4,b),g(u,8,N)}})})})}function o(L){var S={valid:null,remainder:null},x=p(L,["moof"]);if(x){if(x.length<2)return S.remainder=L,S}else return S;var O=x[x.length-1];return S.valid=Object(Q.sliceUint8)(L,0,O.start-8),S.remainder=Object(Q.sliceUint8)(L,O.start-8),S}function h(L,S){var x=new Uint8Array(L.length+S.length);return x.set(L),x.set(S,L.length),x}},"./src/utils/output-filter.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return Q});var Q=function(){function B(K,G){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=K,this.trackName=G}var F=B.prototype;return F.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},F.newCue=function(G,M,R){(this.startTime===null||this.startTime>G)&&(this.startTime=G),this.endTime=M,this.screen=R,this.timelineController.createCaptionsTrack(this.trackName)},F.reset=function(){this.cueRanges=[]},B}()},"./src/utils/texttrack-utils.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"sendAddTrackEvent",function(){return B}),P.d(Z,"addCueToTrack",function(){return F}),P.d(Z,"clearCurrentCues",function(){return K}),P.d(Z,"removeCuesInRange",function(){return G}),P.d(Z,"getCuesInRange",function(){return R});var Q=P("./src/utils/logger.ts");function B(g,p){var f;try{f=new Event("addtrack")}catch(d){f=document.createEvent("Event"),f.initEvent("addtrack",!1,!1)}f.track=g,p.dispatchEvent(f)}function F(g,p){var f=g.mode;if(f==="disabled"&&(g.mode="hidden"),g.cues&&!g.cues.getCueById(p.id))try{if(g.addCue(p),!g.cues.getCueById(p.id))throw new Error("addCue is failed for: "+p)}catch(s){Q.logger.debug("[texttrack-utils]: "+s);var d=new self.TextTrackCue(p.startTime,p.endTime,p.text);d.id=p.id,g.addCue(d)}f==="disabled"&&(g.mode=f)}function K(g){var p=g.mode;if(p==="disabled"&&(g.mode="hidden"),g.cues)for(var f=g.cues.length;f--;)g.removeCue(g.cues[f]);p==="disabled"&&(g.mode=p)}function G(g,p,f){var d=g.mode;if(d==="disabled"&&(g.mode="hidden"),g.cues&&g.cues.length>0)for(var s=R(g.cues,p,f),c=0;c<s.length;c++)g.removeCue(s[c]);d==="disabled"&&(g.mode=d)}function M(g,p){if(p<g[0].startTime)return 0;var f=g.length-1;if(p>g[f].endTime)return-1;for(var d=0,s=f;d<=s;){var c=Math.floor((s+d)/2);if(p<g[c].startTime)s=c-1;else if(p>g[c].startTime&&d<f)d=c+1;else return c}return g[d].startTime-p<p-g[s].startTime?d:s}function R(g,p,f){var d=[],s=M(g,p);if(s>-1)for(var c=s,l=g.length;c<l;c++){var n=g[c];if(n.startTime>=p&&n.endTime<=f)d.push(n);else if(n.startTime>f)return d}return d}},"./src/utils/time-ranges.ts":function(ue,Z,P){"use strict";P.r(Z);var Q={toString:function(F){for(var K="",G=F.length,M=0;M<G;M++)K+="["+F.start(M).toFixed(3)+","+F.end(M).toFixed(3)+"]";return K}};Z.default=Q},"./src/utils/timescale-conversion.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"toTimescaleFromBase",function(){return B}),P.d(Z,"toTimescaleFromScale",function(){return F}),P.d(Z,"toMsFromMpegTsClock",function(){return K}),P.d(Z,"toMpegTsClockFromTimescale",function(){return G});var Q=9e4;function B(M,R,g,p){g===void 0&&(g=1),p===void 0&&(p=!1);var f=M*R*g;return p?Math.round(f):f}function F(M,R,g,p){return g===void 0&&(g=1),p===void 0&&(p=!1),B(M,R,1/g,p)}function K(M,R){return R===void 0&&(R=!1),B(M,1e3,1/Q,R)}function G(M,R){return R===void 0&&(R=1),B(M,Q,1/R)}},"./src/utils/typed-array.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"sliceUint8",function(){return Q});function Q(B,F,K){return Uint8Array.prototype.slice?B.slice(F,K):new Uint8Array(Array.prototype.slice.call(B,F,K))}},"./src/utils/vttcue.ts":function(ue,Z,P){"use strict";P.r(Z),Z.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Q=["","lr","rl"],B=["start","middle","end","left","right"];function F(g,p){if(typeof p!="string")return!1;if(!Array.isArray(g))return!1;var f=p.toLowerCase();return~g.indexOf(f)?f:!1}function K(g){return F(Q,g)}function G(g){return F(B,g)}function M(g){for(var p=arguments.length,f=new Array(p>1?p-1:0),d=1;d<p;d++)f[d-1]=arguments[d];for(var s=1;s<arguments.length;s++){var c=arguments[s];for(var l in c)g[l]=c[l]}return g}function R(g,p,f){var d=this,s={enumerable:!0};d.hasBeenReset=!1;var c="",l=!1,n=g,o=p,h=f,L=null,S="",x=!0,O="auto",C="start",w=50,T="middle",_=50,u="middle";Object.defineProperty(d,"id",M({},s,{get:function(){return c},set:function(m){c=""+m}})),Object.defineProperty(d,"pauseOnExit",M({},s,{get:function(){return l},set:function(m){l=!!m}})),Object.defineProperty(d,"startTime",M({},s,{get:function(){return n},set:function(m){if(typeof m!="number")throw new TypeError("Start time must be set to a number.");n=m,this.hasBeenReset=!0}})),Object.defineProperty(d,"endTime",M({},s,{get:function(){return o},set:function(m){if(typeof m!="number")throw new TypeError("End time must be set to a number.");o=m,this.hasBeenReset=!0}})),Object.defineProperty(d,"text",M({},s,{get:function(){return h},set:function(m){h=""+m,this.hasBeenReset=!0}})),Object.defineProperty(d,"region",M({},s,{get:function(){return L},set:function(m){L=m,this.hasBeenReset=!0}})),Object.defineProperty(d,"vertical",M({},s,{get:function(){return S},set:function(m){var b=K(m);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");S=b,this.hasBeenReset=!0}})),Object.defineProperty(d,"snapToLines",M({},s,{get:function(){return x},set:function(m){x=!!m,this.hasBeenReset=!0}})),Object.defineProperty(d,"line",M({},s,{get:function(){return O},set:function(m){if(typeof m!="number"&&m!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");O=m,this.hasBeenReset=!0}})),Object.defineProperty(d,"lineAlign",M({},s,{get:function(){return C},set:function(m){var b=G(m);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");C=b,this.hasBeenReset=!0}})),Object.defineProperty(d,"position",M({},s,{get:function(){return w},set:function(m){if(m<0||m>100)throw new Error("Position must be between 0 and 100.");w=m,this.hasBeenReset=!0}})),Object.defineProperty(d,"positionAlign",M({},s,{get:function(){return T},set:function(m){var b=G(m);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");T=b,this.hasBeenReset=!0}})),Object.defineProperty(d,"size",M({},s,{get:function(){return _},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");_=m,this.hasBeenReset=!0}})),Object.defineProperty(d,"align",M({},s,{get:function(){return u},set:function(m){var b=G(m);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");u=b,this.hasBeenReset=!0}})),d.displayState=void 0}return R.prototype.getCueAsHTML=function(){var g=self.WebVTT;return g.convertCueToDOMTree(self,this.text)},R}()},"./src/utils/vttparser.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"parseTimeStamp",function(){return F}),P.d(Z,"fixLineBreaks",function(){return p}),P.d(Z,"VTTParser",function(){return f});var Q=P("./src/utils/vttcue.ts"),B=function(){function d(){}var s=d.prototype;return s.decode=function(l,n){if(!l)return"";if(typeof l!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(l))},d}();function F(d){function s(l,n,o,h){return(l|0)*3600+(n|0)*60+(o|0)+parseFloat(h||0)}var c=d.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return c?parseFloat(c[2])>59?s(c[2],c[3],0,c[4]):s(c[1],c[2],c[3],c[4]):null}var K=function(){function d(){this.values=Object.create(null)}var s=d.prototype;return s.set=function(l,n){!this.get(l)&&n!==""&&(this.values[l]=n)},s.get=function(l,n,o){return o?this.has(l)?this.values[l]:n[o]:this.has(l)?this.values[l]:n},s.has=function(l){return l in this.values},s.alt=function(l,n,o){for(var h=0;h<o.length;++h)if(n===o[h]){this.set(l,n);break}},s.integer=function(l,n){/^-?\d+$/.test(n)&&this.set(l,parseInt(n,10))},s.percent=function(l,n){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(n)){var o=parseFloat(n);if(o>=0&&o<=100)return this.set(l,o),!0}return!1},d}();function G(d,s,c,l){var n=l?d.split(l):[d];for(var o in n){if(typeof n[o]!="string")continue;var h=n[o].split(c);if(h.length!==2)continue;var L=h[0],S=h[1];s(L,S)}}var M=new Q.default(0,0,""),R=M.align==="middle"?"middle":"center";function g(d,s,c){var l=d;function n(){var L=F(d);if(L===null)throw new Error("Malformed timestamp: "+l);return d=d.replace(/^[^\sa-zA-Z-]+/,""),L}function o(L,S){var x=new K;G(L,function(w,T){var _;switch(w){case"region":for(var u=c.length-1;u>=0;u--)if(c[u].id===T){x.set(w,c[u].region);break}break;case"vertical":x.alt(w,T,["rl","lr"]);break;case"line":_=T.split(","),x.integer(w,_[0]),x.percent(w,_[0])&&x.set("snapToLines",!1),x.alt(w,_[0],["auto"]),_.length===2&&x.alt("lineAlign",_[1],["start",R,"end"]);break;case"position":_=T.split(","),x.percent(w,_[0]),_.length===2&&x.alt("positionAlign",_[1],["start",R,"end","line-left","line-right","auto"]);break;case"size":x.percent(w,T);break;case"align":x.alt(w,T,["start",R,"end","left","right"]);break}},/:/,/\s/),S.region=x.get("region",null),S.vertical=x.get("vertical","");var O=x.get("line","auto");O==="auto"&&M.line===-1&&(O=-1),S.line=O,S.lineAlign=x.get("lineAlign","start"),S.snapToLines=x.get("snapToLines",!0),S.size=x.get("size",100),S.align=x.get("align",R);var C=x.get("position","auto");C==="auto"&&M.position===50&&(C=S.align==="start"||S.align==="left"?0:S.align==="end"||S.align==="right"?100:50),S.position=C}function h(){d=d.replace(/^\s+/,"")}if(h(),s.startTime=n(),h(),d.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+l);d=d.substr(3),h(),s.endTime=n(),h(),o(d,s)}function p(d){return d.replace(/<br(?: \/)?>/gi,`
|
|
`)}var f=function(){function d(){this.state="INITIAL",this.buffer="",this.decoder=new B,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var s=d.prototype;return s.parse=function(l){var n=this;l&&(n.buffer+=n.decoder.decode(l,{stream:!0}));function o(){var C=n.buffer,w=0;for(C=p(C);w<C.length&&C[w]!=="\r"&&C[w]!==`
|
|
`;)++w;var T=C.substr(0,w);return C[w]==="\r"&&++w,C[w]===`
|
|
`&&++w,n.buffer=C.substr(w),T}function h(C){G(C,function(w,T){},/:/)}try{var L="";if(n.state==="INITIAL"){if(!/\r\n|\n/.test(n.buffer))return this;L=o();var S=L.match(/^()?WEBVTT([ \t].*)?$/);if(!S||!S[0])throw new Error("Malformed WebVTT signature.");n.state="HEADER"}for(var x=!1;n.buffer;){if(!/\r\n|\n/.test(n.buffer))return this;x?x=!1:L=o();switch(n.state){case"HEADER":/:/.test(L)?h(L):L||(n.state="ID");continue;case"NOTE":L||(n.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(L)){n.state="NOTE";break}if(!L)continue;if(n.cue=new Q.default(0,0,""),n.state="CUE",L.indexOf("-->")===-1){n.cue.id=L;continue}case"CUE":if(!n.cue){n.state="BADCUE";continue}try{g(L,n.cue,n.regionList)}catch(C){n.cue=null,n.state="BADCUE";continue}n.state="CUETEXT";continue;case"CUETEXT":{var O=L.indexOf("-->")!==-1;if(!L||O&&(x=!0)){n.oncue&&n.cue&&n.oncue(n.cue),n.cue=null,n.state="ID";continue}if(n.cue===null)continue;n.cue.text&&(n.cue.text+=`
|
|
`),n.cue.text+=L}continue;case"BADCUE":L||(n.state="ID")}}}catch(C){n.state==="CUETEXT"&&n.cue&&n.oncue&&n.oncue(n.cue),n.cue=null,n.state=n.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},s.flush=function(){var l=this;try{if((l.cue||l.state==="HEADER")&&(l.buffer+=`
|
|
|
|
`,l.parse()),l.state==="INITIAL"||l.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(n){l.onparsingerror&&l.onparsingerror(n)}return l.onflush&&l.onflush(),this},d}()},"./src/utils/webvtt-parser.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"generateCueId",function(){return f}),P.d(Z,"parseWebVTT",function(){return s});var Q=P("./src/polyfills/number.ts"),B=P("./src/utils/vttparser.ts"),F=P("./src/demux/id3.ts"),K=P("./src/utils/timescale-conversion.ts"),G=P("./src/remux/mp4-remuxer.ts"),M=/\r\n|\n\r|\n|\r/g,R=function(l,n,o){return o===void 0&&(o=0),l.substr(o,n.length)===n},g=function(l){var n=parseInt(l.substr(-3)),o=parseInt(l.substr(-6,2)),h=parseInt(l.substr(-9,2)),L=l.length>9?parseInt(l.substr(0,l.indexOf(":"))):0;if(!Object(Q.isFiniteNumber)(n)||!Object(Q.isFiniteNumber)(o)||!Object(Q.isFiniteNumber)(h)||!Object(Q.isFiniteNumber)(L))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+l);return n+=1e3*o,n+=60*1e3*h,n+=60*60*1e3*L,n},p=function(l){for(var n=5381,o=l.length;o;)n=n*33^l.charCodeAt(--o);return(n>>>0).toString()};function f(c,l,n){return p(c.toString())+p(l.toString())+p(n)}var d=function(l,n,o){var h=l[n],L=l[h.prevCC];if(!L||!L.new&&h.new){l.ccOffset=l.presentationOffset=h.start,h.new=!1;return}for(;(S=L)!==null&&S!==void 0&&S.new;){var S;l.ccOffset+=h.start-L.start,h.new=!1,h=L,L=l[h.prevCC]}l.presentationOffset=o};function s(c,l,n,o,h,L,S,x){var O=new B.VTTParser,C=Object(F.utf8ArrayToStr)(new Uint8Array(c)).trim().replace(M,`
|
|
`).split(`
|
|
`),w=[],T=Object(K.toMpegTsClockFromTimescale)(l,n),_="00:00.000",u=0,E=0,m,b=!0,N=!1;O.oncue=function(D){var H=o[h],j=o.ccOffset,I=(u-T)/9e4;if(H!=null&&H.new&&(E!==void 0?j=o.ccOffset=H.start:d(o,h,I)),I&&(j=I-o.presentationOffset),N){var y=D.endTime-D.startTime,W=Object(G.normalizePts)((D.startTime+j-E)*9e4,L*9e4)/9e4;D.startTime=W,D.endTime=W+y}var Y=D.text.trim();D.text=decodeURIComponent(encodeURIComponent(Y)),D.id||(D.id=f(D.startTime,D.endTime,Y)),D.endTime>0&&w.push(D)},O.onparsingerror=function(D){m=D},O.onflush=function(){if(m){x(m);return}S(w)},C.forEach(function(D){if(b)if(R(D,"X-TIMESTAMP-MAP=")){b=!1,N=!0,D.substr(16).split(",").forEach(function(H){R(H,"LOCAL:")?_=H.substr(6):R(H,"MPEGTS:")&&(u=parseInt(H.substr(7)))});try{E=g(_)/1e3}catch(H){N=!1,m=H}return}else D===""&&(b=!1);O.parse(D+`
|
|
`)}),O.flush()}},"./src/utils/xhr-loader.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/utils/logger.ts"),B=P("./src/loader/load-stats.ts"),F=/^age:\s*[\d.]+\s*$/m,K=function(){function G(R){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=R?R.xhrSetup:null,this.stats=new B.LoadStats,this.retryDelay=0}var M=G.prototype;return M.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},M.abortInternal=function(){var g=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),g&&(g.onreadystatechange=null,g.onprogress=null,g.readyState!==4&&(this.stats.aborted=!0,g.abort()))},M.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},M.load=function(g,p,f){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=g,this.config=p,this.callbacks=f,this.retryDelay=p.retryDelay,this.loadInternal()},M.loadInternal=function(){var g=this.config,p=this.context;if(!g)return;var f=this.loader=new self.XMLHttpRequest,d=this.stats;d.loading.first=0,d.loaded=0;var s=this.xhrSetup;try{if(s)try{s(f,p.url)}catch(n){f.open("GET",p.url,!0),s(f,p.url)}f.readyState||f.open("GET",p.url,!0);var c=this.context.headers;if(c)for(var l in c)f.setRequestHeader(l,c[l])}catch(n){this.callbacks.onError({code:f.status,text:n.message},p,f);return}p.rangeEnd&&f.setRequestHeader("Range","bytes="+p.rangeStart+"-"+(p.rangeEnd-1)),f.onreadystatechange=this.readystatechange.bind(this),f.onprogress=this.loadprogress.bind(this),f.responseType=p.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),g.timeout),f.send()},M.readystatechange=function(){var g=this.context,p=this.loader,f=this.stats;if(!g||!p)return;var d=p.readyState,s=this.config;if(f.aborted)return;if(d>=2)if(self.clearTimeout(this.requestTimeout),f.loading.first===0&&(f.loading.first=Math.max(self.performance.now(),f.loading.start)),d===4){p.onreadystatechange=null,p.onprogress=null;var c=p.status;if(c>=200&&c<300){f.loading.end=Math.max(self.performance.now(),f.loading.first);var l,n;if(g.responseType==="arraybuffer"?(l=p.response,n=l.byteLength):(l=p.responseText,n=l.length),f.loaded=f.total=n,!this.callbacks)return;var o=this.callbacks.onProgress;if(o&&o(f,g,l,p),!this.callbacks)return;var h={url:p.responseURL,data:l};this.callbacks.onSuccess(h,f,g,p)}else f.retry>=s.maxRetry||c>=400&&c<499?(Q.logger.error(c+" while loading "+g.url),this.callbacks.onError({code:c,text:p.statusText},g,p)):(Q.logger.warn(c+" while loading "+g.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,s.maxRetryDelay),f.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout)},M.loadtimeout=function(){Q.logger.warn("timeout while loading "+this.context.url);var g=this.callbacks;g&&(this.abortInternal(),g.onTimeout(this.stats,this.context,this.loader))},M.loadprogress=function(g){var p=this.stats;p.loaded=g.loaded,g.lengthComputable&&(p.total=g.total)},M.getCacheAge=function(){var g=null;if(this.loader&&F.test(this.loader.getAllResponseHeaders())){var p=this.loader.getResponseHeader("age");g=p?parseFloat(p):null}return g},G}();Z.default=K}}).default})},vHTk:function(gt,Ye,ne){gt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wzkS:function(gt,Ye,ne){"use strict";ne.d(Ye,"c",function(){return B}),ne.d(Ye,"b",function(){return F}),ne.d(Ye,"d",function(){return K}),ne.d(Ye,"a",function(){return M}),ne.d(Ye,"e",function(){return R});var ue=ne("9og8"),Z=ne("WmNS"),P=ne.n(Z),Q=ne("ErOA");function B(g){return Object(Q.c)("libraries/".concat(g,".json"))}function F(){return Object(Q.c)("library_tags.json")}function K(g){return G.apply(this,arguments)}function G(){return G=Object(ue.a)(P.a.mark(function g(p){var f;return P.a.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,Object(Q.b)("attachments/".concat(p,".json"));case 2:return f=s.sent,s.abrupt("return",f.status===0);case 4:case"end":return s.stop()}},g)})),G.apply(this,arguments)}function M(g){return Object(Q.f)("libraries.json",g)}function R(g,p){return Object(Q.g)("libraries/".concat(g,".json"),p)}},y5JW:function(gt,Ye,ne){"use strict";ne.d(Ye,"c",function(){return c}),ne.d(Ye,"a",function(){return l});var ue=ne("DZo9"),Z=ne("8z0m"),P=ne("+L6B"),Q=ne("2/Rp"),B=ne("9og8"),F=ne("miYZ"),K=ne("tsqr"),G=ne("k1fw"),M=ne("oBTY"),R=ne("WmNS"),g=ne.n(R),p=ne("q1tI"),f=ne.n(p),d=ne("m3rI"),s=ne("wzkS"),c="\u3000\u3000";function l(n){var o=["Bytes","KB","MB","GB","TB"];if(n==0)return"0 Byte";var h=parseInt(""+Math.floor(Math.log(n)/Math.log(1024)),10);return(n/Math.pow(1024,h)).toFixed(1)+" "+o[h]}Ye.b=function(n){var o=n.value,h=o===void 0?[]:o,L=n.action,S=n.onChange,x=n.className,O=n.maxSize,C=O===void 0?150:O,w=n.title,T=w===void 0?"\u6587\u4EF6\u4E0A\u4F20":w,_=n.accept,u=_===void 0?null:_,E={multiple:!1,fileList:h,accept:u,withCredentials:!0,beforeUpload:function(N){var D=N.size/1024/1024;return!0},action:"".concat(d.a.API_SERVER,"/api/attachments.json"),onChange:function(N){var D,H,j=Object(M.a)(N.fileList);if(j=j.map(function(W){return W.name.indexOf(c)===-1&&(W.name="".concat(W.name).concat(c).concat(l(W.size))),Object(G.a)({},W)}),N.file.status==="done"&&((D=N.file)===null||D===void 0||((H=D.response)===null||H===void 0)?void 0:H.status)===-1){var I,y;K.b.error((I=N.file)===null||I===void 0||((y=I.response)===null||y===void 0)?void 0:y.message),S([]);return}S(j)},onRemove:function(){var b=Object(B.a)(g.a.mark(function D(H){var j,I,y;return g.a.wrap(function(Y){for(;;)switch(Y.prev=Y.next){case 0:if(j=H.size/1024/1024,!(H.status==="uploading")){Y.next=3;break}return Y.abrupt("return",!0);case 3:if(j<C){Y.next=7;break}return Y.abrupt("return",!0);case 7:if(I=H.response?H.response.id:H.uid,!I){Y.next=15;break}return Y.next=11,Object(s.d)(H.response?H.response.id:H.id);case 11:return y=Y.sent,Y.abrupt("return",y);case 15:return Y.abrupt("return",!0);case 16:case"end":return Y.stop()}},D)}));function N(D){return b.apply(this,arguments)}return N}()};function m(b){b.preventDefault(),b.stopPropagation()}return f.a.createElement("div",{className:"single-upload ".concat(x||"")},f.a.createElement(Z.a,E,f.a.createElement(Q.a,{type:"primary",title:h.length>0?"\u6BCF\u6B21\u53EA\u80FD\u4E0A\u4F20\u4E00\u4E2A\u8D44\u6E90\uFF0C \u5220\u9664\u4E0B\u9762\u8D44\u6E90\u53EF\u91CD\u65B0\u4E0A\u4F20 ":"",disabled:h.length>0,ghost:!0},T),f.a.createElement("span",{onClick:m,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",C,"M)"," ")))}}}]);
|