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.
208 lines
901 KiB
208 lines
901 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[82,5,6,7],{"+NIl":function(tt,je,q){(function(re){re(q("VrN/"))})(function(re){"use strict";re.defineMode("stex",function(V,D){"use strict";function z(d,s){d.cmdState.push(s)}function U(d){return d.cmdState.length>0?d.cmdState[d.cmdState.length-1]:null}function M(d){var s=d.cmdState.pop();s&&s.closeBracket()}function W(d){for(var s=d.cmdState,c=s.length-1;c>=0;c--){var o=s[c];if(o.name=="DEFAULT")continue;return o}return{styleIdentifier:function(){return null}}}function B(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 P={};P.importmodule=B("importmodule","tag",["string","builtin"]),P.documentclass=B("documentclass","tag",["","atom"]),P.usepackage=B("usepackage","tag",["atom"]),P.begin=B("begin","tag",["atom"]),P.end=B("end","tag",["atom"]),P.label=B("label","tag",["atom"]),P.ref=B("ref","tag",["atom"]),P.eqref=B("eqref","tag",["atom"]),P.cite=B("cite","tag",["atom"]),P.bibitem=B("bibitem","tag",["atom"]),P.Bibitem=B("Bibitem","tag",["atom"]),P.RBibitem=B("RBibitem","tag",["atom"]),P.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function A(d,s){d.f=s}function g(d,s){var c;if(d.match(/^\\[a-zA-Z@]+/)){var o=d.current().slice(1);return c=P.hasOwnProperty(o)?P[o]:P.DEFAULT,c=new c,z(s,c),A(s,f),c.style}if(d.match(/^\\[$&%#{}_]/))return"tag";if(d.match(/^\\[,;!\/\\]/))return"tag";if(d.match("\\["))return A(s,function(u,h){return p(u,h,"\\]")}),"keyword";if(d.match("\\("))return A(s,function(u,h){return p(u,h,"\\)")}),"keyword";if(d.match("$$"))return A(s,function(u,h){return p(u,h,"$$")}),"keyword";if(d.match("$"))return A(s,function(u,h){return p(u,h,"$")}),"keyword";var i=d.next();if(i=="%")return d.skipToEnd(),"comment";if(i=="}"||i=="]"){if(c=U(s),c)c.closeBracket(i),A(s,f);else return"error";return"bracket"}else return i=="{"||i=="["?(c=P.DEFAULT,c=new c,z(s,c),"bracket"):/\d/.test(i)?(d.eatWhile(/[\w.%]/),"atom"):(d.eatWhile(/[\w\-_]/),c=W(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 A(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 o=d.next();return o=="{"||o=="}"||o=="["||o=="]"||o=="("||o==")"?"bracket":o=="%"?(d.skipToEnd(),"comment"):"error"}function f(d,s){var c=d.peek(),o;return c=="{"||c=="["?(o=U(s),o.openBracket(c),d.eat(c),A(s,g),"bracket"):/[ \t\r]/.test(c)?(d.eat(c),null):(A(s,g),M(s),g(d,s))}return{startState:function(){var d=D.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:"%"}}),re.defineMIME("text/x-stex","stex"),re.defineMIME("text/x-latex","stex")})},"+ua5":function(tt,je,q){},"19Vz":function(tt,je,q){(function(re){re(q("VrN/"))})(function(re){re.defineOption("placeholder","",function(B,P,A){var g=A&&A!=re.Init;if(P&&!g)B.on("blur",U),B.on("change",M),B.on("swapDoc",M),re.on(B.getInputField(),"compositionupdate",B.state.placeholderCompose=function(){z(B)}),M(B);else if(!P&&g){B.off("blur",U),B.off("change",M),B.off("swapDoc",M),re.off(B.getInputField(),"compositionupdate",B.state.placeholderCompose),V(B);var p=B.getWrapperElement();p.className=p.className.replace(" CodeMirror-empty","")}P&&!B.hasFocus()&&U(B)});function V(B){B.state.placeholder&&(B.state.placeholder.parentNode.removeChild(B.state.placeholder),B.state.placeholder=null)}function D(B){V(B);var P=B.state.placeholder=document.createElement("pre");P.style.cssText="height: 0; overflow: visible",P.style.direction=B.getOption("direction"),P.className="CodeMirror-placeholder CodeMirror-line-like";var A=B.getOption("placeholder");typeof A=="string"&&(A=document.createTextNode(A)),P.appendChild(A),B.display.lineSpace.insertBefore(P,B.display.lineSpace.firstChild)}function z(B){setTimeout(function(){var P=!1,A=B.getInputField();A.nodeName=="TEXTAREA"?P=!A.value:B.lineCount()==1&&(P=!/[^\u200b]/.test(A.querySelector(".CodeMirror-line").textContent)),P?D(B):V(B)},20)}function U(B){W(B)&&D(B)}function M(B){var P=B.getWrapperElement(),A=W(B);P.className=P.className.replace(" CodeMirror-empty","")+(A?" CodeMirror-empty":""),A?D(B):V(B)}function W(B){return B.lineCount()===1&&B.getLine(0)===""}})},"1eCo":function(tt,je,q){(function(re){re(q("VrN/"))})(function(re){"use strict";var V={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};re.defineMode("xml",function(z,U){var M=z.indentUnit,W={},B=U.htmlMode?V:D;for(var P in B)W[P]=B[P];for(var P in U)W[P]=U[P];var A,g;function p(l,b){function m(I){return b.tokenize=I,I(l,b)}var y=l.next();if(y=="<")return l.eat("!")?l.eat("[")?l.match("CDATA[")?m(s("atom","]]>")):null:l.match("--")?m(s("comment","-->")):l.match("DOCTYPE",!0,!0)?(l.eatWhile(/[\w\._\-]/),m(c(1))):null:l.eat("?")?(l.eatWhile(/[\w\._\-]/),b.tokenize=s("meta","?>"),"meta"):(A=l.eat("/")?"closeTag":"openTag",b.tokenize=f,"tag bracket");if(y=="&"){var k;return l.eat("#")?l.eat("x")?k=l.eatWhile(/[a-fA-F\d]/)&&l.eat(";"):k=l.eatWhile(/[\d]/)&&l.eat(";"):k=l.eatWhile(/[\w\.\-:]/)&&l.eat(";"),k?"atom":"error"}else return l.eatWhile(/[^&<]/),null}p.isInText=!0;function f(l,b){var m=l.next();if(m==">"||m=="/"&&l.eat(">"))return b.tokenize=p,A=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return A="equals",null;if(m=="<"){b.tokenize=p,b.state=h,b.tagName=b.tagStart=null;var y=b.tokenize(l,b);return y?y+" tag error":"tag error"}else return/[\'\"]/.test(m)?(b.tokenize=d(m),b.stringStartCol=l.column(),b.tokenize(l,b)):(l.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function d(l){var b=function(m,y){for(;!m.eol();)if(m.next()==l){y.tokenize=f;break}return"string"};return b.isInAttribute=!0,b}function s(l,b){return function(m,y){for(;!m.eol();){if(m.match(b)){y.tokenize=p;break}m.next()}return l}}function c(l){return function(b,m){for(var y;(y=b.next())!=null;){if(y=="<")return m.tokenize=c(l+1),m.tokenize(b,m);if(y==">")if(l==1){m.tokenize=p;break}else return m.tokenize=c(l-1),m.tokenize(b,m)}return"meta"}}function o(l,b,m){this.prev=l.context,this.tagName=b,this.indent=l.indented,this.startOfLine=m,(W.doNotIndent.hasOwnProperty(b)||l.context&&l.context.noIndent)&&(this.noIndent=!0)}function i(l){l.context&&(l.context=l.context.prev)}function u(l,b){for(var m;;){if(!l.context)return;if(m=l.context.tagName,!W.contextGrabbers.hasOwnProperty(m)||!W.contextGrabbers[m].hasOwnProperty(b))return;i(l)}}function h(l,b,m){return l=="openTag"?(m.tagStart=b.column(),R):l=="closeTag"?S:h}function R(l,b,m){return l=="word"?(m.tagName=b.current(),g="tag",x):W.allowMissingTagName&&l=="endTag"?(g="tag bracket",x(l,b,m)):(g="error",R)}function S(l,b,m){if(l=="word"){var y=b.current();return m.context&&m.context.tagName!=y&&W.implicitlyClosed.hasOwnProperty(m.context.tagName)&&i(m),m.context&&m.context.tagName==y||W.matchClosing===!1?(g="tag",E):(g="tag error",O)}else return W.allowMissingTagName&&l=="endTag"?(g="tag bracket",E(l,b,m)):(g="error",O)}function E(l,b,m){return l!="endTag"?(g="error",E):(i(m),h)}function O(l,b,m){return g="error",E(l,b,m)}function x(l,b,m){if(l=="word")return g="attribute",w;if(l=="endTag"||l=="selfcloseTag"){var y=m.tagName,k=m.tagStart;return m.tagName=m.tagStart=null,l=="selfcloseTag"||W.autoSelfClosers.hasOwnProperty(y)?u(m,y):(u(m,y),m.context=new o(m,y,k==m.indented)),h}return g="error",x}function w(l,b,m){return l=="equals"?T:(W.allowMissing||(g="error"),x(l,b,m))}function T(l,b,m){return l=="string"?_:l=="word"&&W.allowUnquoted?(g="string",x):(g="error",x(l,b,m))}function _(l,b,m){return l=="string"?_:x(l,b,m)}return{startState:function(l){var b={tokenize:p,state:h,indented:l||0,tagName:null,tagStart:null,context:null};return l!=null&&(b.baseIndent=l),b},token:function(l,b){if(!b.tagName&&l.sol()&&(b.indented=l.indentation()),l.eatSpace())return null;A=null;var m=b.tokenize(l,b);return(m||A)&&m!="comment"&&(g=null,b.state=b.state(A||m,l,b),g&&(m=g=="error"?m+" error":g)),m},indent:function(l,b,m){var y=l.context;if(l.tokenize.isInAttribute)return l.tagStart==l.indented?l.stringStartCol+1:l.indented+M;if(y&&y.noIndent)return re.Pass;if(l.tokenize!=f&&l.tokenize!=p)return m?m.match(/^(\s*)/)[0].length:0;if(l.tagName)return W.multilineTagIndentPastTag!==!1?l.tagStart+l.tagName.length+2:l.tagStart+M*(W.multilineTagIndentFactor||1);if(W.alignCDATA&&/<!\[CDATA\[/.test(b))return 0;var k=b&&/^<(\/)?([\w_:\.-]*)/.exec(b);if(k&&k[1])for(;y;)if(y.tagName==k[2]){y=y.prev;break}else if(W.implicitlyClosed.hasOwnProperty(y.tagName))y=y.prev;else break;else if(k)for(;y;){var I=W.contextGrabbers[y.tagName];if(I&&I.hasOwnProperty(k[2]))y=y.prev;else break}for(;y&&y.prev&&!y.startOfLine;)y=y.prev;return y?y.indent+M:l.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:W.htmlMode?"html":"xml",helperType:W.htmlMode?"html":"xml",skipAttribute:function(l){l.state==T&&(l.state=x)},xmlCurrentTag:function(l){return l.tagName?{name:l.tagName,close:l.type=="closeTag"}:null},xmlCurrentContext:function(l){for(var b=[],m=l.context;m;m=m.prev)m.tagName&&b.push(m.tagName);return b.reverse()}}}),re.defineMIME("text/xml","xml"),re.defineMIME("application/xml","xml"),re.mimeModes.hasOwnProperty("text/html")||re.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"500L":function(tt,je,q){"use strict";q.d(je,"a",function(){return S});var re=q("+L6B"),V=q("2/Rp"),D=q("2qtc"),z=q("kLXV"),U=q("9og8"),M=q("k1fw"),W=q("miYZ"),B=q("tsqr"),P=q("oBTY"),A=q("tJVT"),g=q("DZo9"),p=q("8z0m"),f=q("WmNS"),d=q.n(f),s=q("cDcd"),c=q.n(s),o=q("m3rI"),i=q("wzkS"),u=q("y5JW"),h=q("LtfV"),R=p.a.Dragger;function S(E){var O=[];return E&&E.length>0&&(O=E.map(function(x){return{uid:x.id,id:x.id,name:x.title+u.c+x.filesize,url:x.url,filesize:x.filesize,status:"done",response:{id:x.id}}})),O}je.b=function(E){var O=E.value,x=E.onChange,w=E.action,T=E.className,_=E.maxSize,l=_===void 0?150:_,b=E.title,m=b===void 0?"\u4E0A\u4F20\u9644\u4EF6":b,y=E.showRemoveModal,k=y===void 0?!1:y,I=E.accept,N=I===void 0?"":I,F=E.additionalText,C=E.isDragger,v=E.number,j=v===void 0?1e3:v,K=E.aloneClear,J=K===void 0?!1:K,te=Object(s.useState)(!1),ve=Object(A.a)(te,2),ue=ve[0],de=ve[1],oe=Object(s.useState)(O||[]),me=Object(A.a)(oe,2),ae=me[0],fe=me[1];Object(s.useEffect)(function(){O&&(fe(Object(P.a)(O)),j===(O==null?void 0:O.length)&&de(!0))},[O]);var Q=function(){setTimeout(function(){ae.pop(),fe(Object(P.a)(ae))},500)},ie={multiple:!0,disabled:ue,accept:N,withCredentials:!0,fileList:ae,beforeUpload:function(Se,be){var ye=Se.size/1024/1024;return ae.concat(be).length>j?(ae.pop(),fe(Object(P.a)(ae)),B.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(j,"\u4E2A\u6587\u4EF6")),J?Promise.reject():(Q(),!1)):!0},action:w||"".concat(o.a.API_SERVER,"/api/attachments.json"),onChange:function(Se){var be,ye,xe=Object(P.a)(Se.fileList);if(Se.file.status==="done"&&((be=Se.file)===null||be===void 0||((ye=be.response)===null||ye===void 0)?void 0:ye.status)===-1){var De,Ie;B.b.error((De=Se.file)===null||De===void 0||((Ie=De.response)===null||Ie===void 0)?void 0:Ie.message);return}xe.length>=j?de(!0):de(!1),fe(Object(P.a)(xe)),xe=xe.map(function(Ae){var Le;if(Ae!=null&&(Le=Ae.response)!==null&&Le!==void 0&&Le.id){var Ue;Ae.url="/api/attachments/".concat(Ae==null||((Ue=Ae.response)===null||Ue===void 0)?void 0:Ue.id)}return Ae.name.indexOf(u.c)===-1&&(Ae.name="".concat(Ae.name).concat(u.c).concat(Object(u.a)(Ae.size))),Object(M.a)({},Ae)}),console.log("info:",Se),x(xe)},onRemove:function(){var Te=Object(U.a)(d.a.mark(function be(ye){var xe;return d.a.wrap(function(Ie){for(;;)switch(Ie.prev=Ie.next){case 0:if(xe=function(){var Ae=Object(U.a)(d.a.mark(function Le(){var Ue,He;return d.a.wrap(function(Fe){for(;;)switch(Fe.prev=Fe.next){case 0:if(Ue=ye.response?ye.response.id:ye.id,!Ue){Fe.next=8;break}return Fe.next=4,Object(i.d)(ye.response?ye.response.id:ye.uid);case 4:return He=Fe.sent,Fe.abrupt("return",He);case 8:return Fe.abrupt("return",!0);case 9:case"end":return Fe.stop()}},Le)}));return function(){return Ae.apply(this,arguments)}}(),!k){Ie.next=5;break}return Ie.abrupt("return",new Promise(function(Ae,Le){z.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 Ue=Object(U.a)(d.a.mark(function We(){var Fe;return d.a.wrap(function(Ve){for(;;)switch(Ve.prev=Ve.next){case 0:return Ve.next=2,xe();case 2:Fe=Ve.sent,B.b.success("\u5220\u9664\u6210\u529F"),Ae(!0);case 5:case"end":return Ve.stop()}},We)}));function He(){return Ue.apply(this,arguments)}return He}(),onCancel:function(){return Ae(!1)}})}));case 5:return Ie.next=7,xe();case 7:return Ie.abrupt("return",Ie.sent);case 8:case"end":return Ie.stop()}},be)}));function Se(be){return Te.apply(this,arguments)}return Se}()};function ee(Te){Te.preventDefault(),Te.stopPropagation()}return c.a.createElement("div",{className:"multi-upload ".concat(T||"")},C&&c.a.createElement(R,ie,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",l,"MB)"," "),F),!C&&c.a.createElement(p.a,ie,c.a.createElement(V.a,{disabled:ue},m),c.a.createElement("span",{onClick:ee,style:{marginLeft:10,color:"#FA6400"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",l,"MB)"," ")))}},"55Ip":function(tt,je,q){"use strict";q.d(je,"a",function(){return u});var re=q("Ty5D"),V=q("dI71"),D=q("cDcd"),z=q.n(D),U=q("YS25"),M=q("17x9"),W=q.n(M),B=q("wx14"),P=q("zLVn"),A=q("9R94"),g=function(T){Object(V.a)(_,T);function _(){for(var b,m=arguments.length,y=new Array(m),k=0;k<m;k++)y[k]=arguments[k];return b=T.call.apply(T,[this].concat(y))||this,b.history=Object(U.a)(b.props),b}var l=_.prototype;return l.render=function(){return z.a.createElement(re.c,{history:this.history,children:this.props.children})},_}(z.a.Component),p=function(T){Object(V.a)(_,T);function _(){for(var b,m=arguments.length,y=new Array(m),k=0;k<m;k++)y[k]=arguments[k];return b=T.call.apply(T,[this].concat(y))||this,b.history=Object(U.b)(b.props),b}var l=_.prototype;return l.render=function(){return z.a.createElement(re.c,{history:this.history,children:this.props.children})},_}(z.a.Component),f=function(_,l){return typeof _=="function"?_(l):_},d=function(_,l){return typeof _=="string"?Object(U.c)(_,null,null,l):_},s=function(_){return _},c=z.a.forwardRef;typeof c=="undefined"&&(c=s);function o(T){return!!(T.metaKey||T.altKey||T.ctrlKey||T.shiftKey)}var i=c(function(T,_){var l=T.innerRef,b=T.navigate,m=T.onClick,y=Object(P.a)(T,["innerRef","navigate","onClick"]),k=y.target,I=Object(B.a)({},y,{onClick:function(F){try{m&&m(F)}catch(C){throw F.preventDefault(),C}!F.defaultPrevented&&F.button===0&&(!k||k==="_self")&&!o(F)&&(F.preventDefault(),b())}});return s!==c?I.ref=_||l:I.ref=l,z.a.createElement("a",I)}),u=c(function(T,_){var l=T.component,b=l===void 0?i:l,m=T.replace,y=T.to,k=T.innerRef,I=Object(P.a)(T,["component","replace","to","innerRef"]);return z.a.createElement(re.e.Consumer,null,function(N){N||Object(A.a)(!1);var F=N.history,C=d(f(y,N.location),N.location),v=C?F.createHref(C):"",j=Object(B.a)({},I,{href:v,navigate:function(){var J=f(y,N.location),te=m?F.replace:F.push;te(J)}});return s!==c?j.ref=_||k:j.innerRef=k,z.a.createElement(b,j)})});if(!1)var h,R;var S=function(_){return _},E=z.a.forwardRef;typeof E=="undefined"&&(E=S);function O(){for(var T=arguments.length,_=new Array(T),l=0;l<T;l++)_[l]=arguments[l];return _.filter(function(b){return b}).join(" ")}var x=E(function(T,_){var l=T["aria-current"],b=l===void 0?"page":l,m=T.activeClassName,y=m===void 0?"active":m,k=T.activeStyle,I=T.className,N=T.exact,F=T.isActive,C=T.location,v=T.sensitive,j=T.strict,K=T.style,J=T.to,te=T.innerRef,ve=Object(P.a)(T,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return z.a.createElement(re.e.Consumer,null,function(ue){ue||Object(A.a)(!1);var de=C||ue.location,oe=d(f(J,de),de),me=oe.pathname,ae=me&&me.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),fe=ae?Object(re.f)(de.pathname,{path:ae,exact:N,sensitive:v,strict:j}):null,Q=!!(F?F(fe,de):fe),ie=Q?O(I,y):I,ee=Q?Object(B.a)({},K,{},k):K,Te=Object(B.a)({"aria-current":Q&&b||null,className:ie,style:ee,to:oe},ve);return S!==E?Te.ref=_||te:Te.innerRef=te,z.a.createElement(u,Te)})});if(!1)var w},"5VLF":function(tt,je,q){"use strict";var re,V;function D(z,U,M){var W=function(B,P){return z.js_beautify(B,P)};return W.js=z.js_beautify,W.css=U.css_beautify,W.html=M.html_beautify,W.js_beautify=z.js_beautify,W.css_beautify=U.css_beautify,W.html_beautify=M.html_beautify,W}!(re=[q("6UM0"),q("TXwP"),q("psGv")],V=function(z,U,M){return D(z,U,M)}.apply(je,re),V!==void 0&&(tt.exports=V))},"6UM0":function(tt,je,q){var re,V;(function(){var D;(function(){"use strict";var U=[function(P,A,g){var p=g(1).Beautifier,f=g(5).Options;function d(s,c){var o=new p(s,c);return o.beautify()}P.exports=d,P.exports.defaultOptions=function(){return new f}},function(P,A,g){var p=g(2).Output,f=g(3).Token,d=g(4),s=g(5).Options,c=g(7).Tokenizer,o=g(7).line_starters,i=g(7).positionable_operators,u=g(7).TOKEN;function h(v,j){return j.indexOf(v)!==-1}function R(v){return v.replace(/^\s+/g,"")}function S(v){for(var j={},K=0;K<v.length;K++)j[v[K].replace(/-/g,"_")]=v[K];return j}function E(v,j){return v&&v.type===u.RESERVED&&v.text===j}function O(v,j){return v&&v.type===u.RESERVED&&h(v.text,j)}var x=["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],l={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function b(v,j){if(j.multiline_frame||j.mode===l.ForInitializer||j.mode===l.Conditional)return;v.remove_indent(j.start_line_index)}function m(v){v=v.replace(d.allLineBreaks,`
|
|
`);for(var j=[],K=v.indexOf(`
|
|
`);K!==-1;)j.push(v.substring(0,K)),v=v.substring(K+1),K=v.indexOf(`
|
|
`);return v.length&&j.push(v),j}function y(v){return v===l.ArrayLiteral}function k(v){return h(v,[l.Expression,l.ForInitializer,l.Conditional])}function I(v,j){for(var K=0;K<v.length;K++){var J=v[K].trim();if(J.charAt(0)!==j)return!1}return!0}function N(v,j){for(var K=0,J=v.length,te;K<J;K++)if(te=v[K],te&&te.indexOf(j)!==0)return!1;return!0}function F(v,j){j=j||{},this._source_text=v||"",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(j)}F.prototype.create_flags=function(v,j){var K=0;v&&(K=v.indentation_level,!this._output.just_added_newline()&&v.line_indent_level>K&&(K=v.line_indent_level));var J={mode:j,parent:v,last_token:v?v.last_token:new f(u.START_BLOCK,""),last_word:v?v.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:K,alignment:0,line_indent_level:v?v.line_indent_level:K,start_line_index:this._output.get_line_number(),ternary_depth:0};return J},F.prototype._reset=function(v){var j=v.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new p(this._options,j),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(l.BlockStatement);var K=new c(v,this._options);return this._tokens=K.tokenize(),v},F.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var v,j=this._reset(this._source_text),K=this._options.eol;this._options.eol==="auto"&&(K=`
|
|
`,j&&d.lineBreak.test(j||"")&&(K=j.match(d.lineBreak)[0]));for(var J=this._tokens.next();J;)this.handle_token(J),this._last_last_text=this._flags.last_token.text,this._flags.last_token=J,J=this._tokens.next();return v=this._output.get_code(K),v},F.prototype.handle_token=function(v,j){v.type===u.START_EXPR?this.handle_start_expr(v):v.type===u.END_EXPR?this.handle_end_expr(v):v.type===u.START_BLOCK?this.handle_start_block(v):v.type===u.END_BLOCK?this.handle_end_block(v):v.type===u.WORD?this.handle_word(v):v.type===u.RESERVED?this.handle_word(v):v.type===u.SEMICOLON?this.handle_semicolon(v):v.type===u.STRING?this.handle_string(v):v.type===u.EQUALS?this.handle_equals(v):v.type===u.OPERATOR?this.handle_operator(v):v.type===u.COMMA?this.handle_comma(v):v.type===u.BLOCK_COMMENT?this.handle_block_comment(v,j):v.type===u.COMMENT?this.handle_comment(v,j):v.type===u.DOT?this.handle_dot(v):v.type===u.EOF?this.handle_eof(v):v.type===u.UNKNOWN?this.handle_unknown(v,j):this.handle_unknown(v,j)},F.prototype.handle_whitespace_and_comments=function(v,j){var K=v.newlines,J=this._options.keep_array_indentation&&y(this._flags.mode);if(v.comments_before)for(var te=v.comments_before.next();te;)this.handle_whitespace_and_comments(te,j),this.handle_token(te,j),te=v.comments_before.next();if(J)for(var ve=0;ve<K;ve+=1)this.print_newline(ve>0,j);else if(this._options.max_preserve_newlines&&K>this._options.max_preserve_newlines&&(K=this._options.max_preserve_newlines),this._options.preserve_newlines&&K>1){this.print_newline(!1,j);for(var ue=1;ue<K;ue+=1)this.print_newline(!0,j)}};var C=["async","break","continue","return","throw","yield"];F.prototype.allow_wrap_or_preserved_newline=function(v,j){if(j=j===void 0?!1:j,this._output.just_added_newline())return;var K=this._options.preserve_newlines&&v.newlines||j,J=h(this._flags.last_token.text,i)||h(v.text,i);if(J){var te=h(this._flags.last_token.text,i)&&h(this._options.operator_position,_)||h(v.text,i);K=K&&te}if(K)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(O(this._flags.last_token,C))return;this._output.set_wrap_point()}},F.prototype.print_newline=function(v,j){if(!j&&(this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==u.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")))for(var K=this._tokens.peek();this._flags.mode===l.Statement&&!(this._flags.if_block&&E(K,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(v)&&(this._flags.multiline_frame=!0)},F.prototype.print_token_line_indentation=function(v){this._output.just_added_newline()&&(this._options.keep_array_indentation&&v.newlines&&(v.text==="["||y(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(v.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))},F.prototype.print_token=function(v){if(this._output.raw){this._output.add_raw_token(v);return}if(this._options.comma_first&&v.previous&&v.previous.type===u.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var j=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(j),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(v),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(v),this._output.non_breaking_space=!0,this._output.add_token(v.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},F.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},F.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))},F.prototype.set_mode=function(v){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,v),this._flags=this.create_flags(this._previous_flags,v),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},F.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===l.Statement&&b(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},F.prototype.start_of_object_property=function(){return this._flags.parent.mode===l.ObjectLiteral&&this._flags.mode===l.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||O(this._flags.last_token,["get","set"]))},F.prototype.start_of_statement=function(v){var j=!1;return j=j||O(this._flags.last_token,["var","let","const"])&&v.type===u.WORD,j=j||E(this._flags.last_token,"do"),j=j||!(this._flags.parent.mode===l.ObjectLiteral&&this._flags.mode===l.Statement)&&O(this._flags.last_token,C)&&!v.newlines,j=j||E(this._flags.last_token,"else")&&!(E(v,"if")&&!v.comments_before),j=j||this._flags.last_token.type===u.END_EXPR&&(this._previous_flags.mode===l.ForInitializer||this._previous_flags.mode===l.Conditional),j=j||this._flags.last_token.type===u.WORD&&this._flags.mode===l.BlockStatement&&!this._flags.in_case&&!(v.text==="--"||v.text==="++")&&this._last_last_text!=="function"&&v.type!==u.WORD&&v.type!==u.RESERVED,j=j||this._flags.mode===l.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||O(this._flags.last_token,["get","set"])),j?(this.set_mode(l.Statement),this.indent(),this.handle_whitespace_and_comments(v,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v,O(v,["do","for","if","while"])),!0):!1},F.prototype.handle_start_expr=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v);var j=l.Expression;if(v.text==="["){if(this._flags.last_token.type===u.WORD||this._flags.last_token.text===")"){O(this._flags.last_token,o)&&(this._output.space_before_token=!0),this.print_token(v),this.set_mode(j),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}j=l.ArrayLiteral,y(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,[u.START_EXPR,u.END_EXPR,u.WORD,u.OPERATOR,u.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===u.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,j=l.ForInitializer):h(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,j=l.Conditional):h(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&v.whitespace_before===""?this._output.space_before_token=!1:(h(this._flags.last_token.text,o)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===u.EQUALS||this._flags.last_token.type===u.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v);else if(this._flags.last_token.type===u.WORD){this._output.space_before_token=!1;var K=this._tokens.peek(-3);if(this._options.space_after_named_function&&K){var J=this._tokens.peek(-4);O(K,["async","function"])||K.text==="*"&&O(J,["async","function"])?this._output.space_before_token=!0:this._flags.mode===l.ObjectLiteral?(K.text==="{"||K.text===","||K.text==="*"&&(J.text==="{"||J.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(v);(this._flags.last_token.type===u.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===l.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===u.START_BLOCK?this.print_newline():(this._flags.last_token.type===u.END_EXPR||this._flags.last_token.type===u.START_EXPR||this._flags.last_token.type===u.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===u.COMMA)&&this.allow_wrap_or_preserved_newline(v,v.newlines),this.print_token(v),this.set_mode(j),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},F.prototype.handle_end_expr=function(v){for(;this._flags.mode===l.Statement;)this.restore_mode();this.handle_whitespace_and_comments(v),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(v,v.text==="]"&&y(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===u.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(v),this.restore_mode(),b(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===l.Conditional&&(this._previous_flags.mode=l.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},F.prototype.handle_start_block=function(v){this.handle_whitespace_and_comments(v);var j=this._tokens.peek(),K=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===u.END_EXPR?(this.set_mode(l.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(l.BlockStatement):K&&(h(K.text,[":",","])&&h(j.type,[u.STRING,u.WORD,u.RESERVED])||h(j.text,["get","set","..."])&&h(K.type,[u.WORD,u.RESERVED]))?h(this._last_last_text,["class","interface"])&&!h(K.text,[":",","])?this.set_mode(l.BlockStatement):this.set_mode(l.ObjectLiteral):this._flags.last_token.type===u.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(l.BlockStatement):h(this._flags.last_token.type,[u.EQUALS,u.START_EXPR,u.COMMA,u.OPERATOR])||O(this._flags.last_token,["return","throw","import","default"])?this.set_mode(l.ObjectLiteral):this.set_mode(l.BlockStatement),this._flags.last_token&&(O(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var J=!j.comments_before&&j.text==="}",te=J&&this._flags.last_word==="function"&&this._flags.last_token.type===u.END_EXPR;if(this._options.brace_preserve_inline){var ve=0,ue=null;this._flags.inline_frame=!0;do if(ve+=1,ue=this._tokens.peek(ve-1),ue.newlines){this._flags.inline_frame=!1;break}while(ue.type!==u.EOF&&!(ue.type===u.END_BLOCK&&ue.opened===v))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&v.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==u.OPERATOR&&(te||this._flags.last_token.type===u.EQUALS||O(this._flags.last_token,x)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(y(this._previous_flags.mode)&&(this._flags.last_token.type===u.START_EXPR||this._flags.last_token.type===u.COMMA)&&((this._flags.last_token.type===u.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===u.COMMA||this._flags.last_token.type===u.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(v),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==u.OPERATOR&&this._flags.last_token.type!==u.START_EXPR&&(this._flags.last_token.type===u.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(v),this.indent(),!J&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},F.prototype.handle_end_block=function(v){for(this.handle_whitespace_and_comments(v);this._flags.mode===l.Statement;)this.restore_mode();var j=this._flags.last_token.type===u.START_BLOCK;this._flags.inline_frame&&!j?this._output.space_before_token=!0:this._options.brace_style==="expand"?j||this.print_newline():j||(y(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(v)},F.prototype.handle_word=function(v){if(v.type===u.RESERVED){if(h(v.text,["set","get"])&&this._flags.mode!==l.ObjectLiteral)v.type=u.WORD;else if(v.text==="import"&&h(this._tokens.peek().text,["(","."]))v.type=u.WORD;else if(h(v.text,["as","from"])&&!this._flags.import_block)v.type=u.WORD;else if(this._flags.mode===l.ObjectLiteral){var j=this._tokens.peek();j.text===":"&&(v.type=u.WORD)}}if(this.start_of_statement(v)?O(this._flags.last_token,["var","let","const"])&&v.type===u.WORD&&(this._flags.declaration_statement=!0):v.newlines&&!k(this._flags.mode)&&(this._flags.last_token.type!==u.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==u.EQUALS&&(this._options.preserve_newlines||!O(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(v),this.print_newline()):this.handle_whitespace_and_comments(v),this._flags.do_block&&!this._flags.do_while)if(E(v,"while")){this._output.space_before_token=!0,this.print_token(v),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&&E(v,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===l.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&O(v,["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(v),this._flags.in_case=!0;return}if((this._flags.last_token.type===u.COMMA||this._flags.last_token.type===u.START_EXPR||this._flags.last_token.type===u.EQUALS||this._flags.last_token.type===u.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v)),E(v,"function")){(h(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(h(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===u.OPERATOR))&&(!this._output.just_added_blankline()&&!v.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===u.RESERVED||this._flags.last_token.type===u.WORD?O(this._flags.last_token,["get","set","new","export"])||O(this._flags.last_token,C)?this._output.space_before_token=!0:E(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===u.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(k(this._flags.mode)||y(this._flags.mode))||this.print_newline(),this.print_token(v),this._flags.last_word=v.text;return}var K="NONE";if(this._flags.last_token.type===u.END_BLOCK?this._previous_flags.inline_frame?K="SPACE":O(v,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&v.newlines?K="NEWLINE":(K="SPACE",this._output.space_before_token=!0):K="NEWLINE":this._flags.last_token.type===u.SEMICOLON&&this._flags.mode===l.BlockStatement?K="NEWLINE":this._flags.last_token.type===u.SEMICOLON&&k(this._flags.mode)?K="SPACE":this._flags.last_token.type===u.STRING?K="NEWLINE":this._flags.last_token.type===u.RESERVED||this._flags.last_token.type===u.WORD||this._flags.last_token.text==="*"&&(h(this._last_last_text,["function","yield"])||this._flags.mode===l.ObjectLiteral&&h(this._last_last_text,["{",","]))?K="SPACE":this._flags.last_token.type===u.START_BLOCK?this._flags.inline_frame?K="SPACE":K="NEWLINE":this._flags.last_token.type===u.END_EXPR&&(this._output.space_before_token=!0,K="NEWLINE"),O(v,o)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?K="SPACE":K="NEWLINE"),O(v,["else","catch","finally"]))if((!(this._flags.last_token.type===u.END_BLOCK&&this._previous_flags.mode===l.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&v.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var J=this._output.current_line;J.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else K==="NEWLINE"?O(this._flags.last_token,x)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&O(v,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==u.END_EXPR?(this._flags.last_token.type!==u.START_EXPR||!O(v,["var","let","const"]))&&this._flags.last_token.text!==":"&&(E(v,"if")&&E(v.previous,"else")?this._output.space_before_token=!0:this.print_newline()):O(v,o)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&y(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():K==="SPACE"&&(this._output.space_before_token=!0);v.previous&&(v.previous.type===u.WORD||v.previous.type===u.RESERVED)&&(this._output.space_before_token=!0),this.print_token(v),this._flags.last_word=v.text,v.type===u.RESERVED&&(v.text==="do"?this._flags.do_block=!0:v.text==="if"?this._flags.if_block=!0:v.text==="import"?this._flags.import_block=!0:this._flags.import_block&&E(v,"from")&&(this._flags.import_block=!1))},F.prototype.handle_semicolon=function(v){this.start_of_statement(v)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(v);for(var j=this._tokens.peek();this._flags.mode===l.Statement&&!(this._flags.if_block&&E(j,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(v)},F.prototype.handle_string=function(v){v.text.startsWith("`")&&v.newlines===0&&v.whitespace_before===""&&(v.previous.text===")"||this._flags.last_token.type===u.WORD)||(this.start_of_statement(v)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(v),this._flags.last_token.type===u.RESERVED||this._flags.last_token.type===u.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===u.COMMA||this._flags.last_token.type===u.START_EXPR||this._flags.last_token.type===u.EQUALS||this._flags.last_token.type===u.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v):v.text.startsWith("`")&&this._flags.last_token.type===u.END_EXPR&&(v.previous.text==="]"||v.previous.text===")")&&v.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(v)},F.prototype.handle_equals=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(v),this._output.space_before_token=!0},F.prototype.handle_comma=function(v){this.handle_whitespace_and_comments(v,!0),this.print_token(v),this._output.space_before_token=!0,this._flags.declaration_statement?(k(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(v)):this._flags.mode===l.ObjectLiteral||this._flags.mode===l.Statement&&this._flags.parent.mode===l.ObjectLiteral?(this._flags.mode===l.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(v)},F.prototype.handle_operator=function(v){var j=v.text==="*"&&(O(this._flags.last_token,["function","yield"])||h(this._flags.last_token.type,[u.START_BLOCK,u.COMMA,u.END_BLOCK,u.SEMICOLON])),K=h(v.text,["-","+"])&&(h(this._flags.last_token.type,[u.START_BLOCK,u.START_EXPR,u.EQUALS,u.OPERATOR])||h(this._flags.last_token.text,o)||this._flags.last_token.text===",");if(!this.start_of_statement(v)){var J=!j;this.handle_whitespace_and_comments(v,J)}if(v.text==="*"&&this._flags.last_token.type===u.DOT){this.print_token(v);return}if(v.text==="::"){this.print_token(v);return}if(this._flags.last_token.type===u.OPERATOR&&h(this._options.operator_position,_)&&this.allow_wrap_or_preserved_newline(v),v.text===":"&&this._flags.in_case){this.print_token(v),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==u.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 te=!0,ve=!0,ue=!1;if(v.text===":"?this._flags.ternary_depth===0?te=!1:(this._flags.ternary_depth-=1,ue=!0):v.text==="?"&&(this._flags.ternary_depth+=1),!K&&!j&&this._options.preserve_newlines&&h(v.text,i)){var de=v.text===":",oe=de&&ue,me=de&&!ue;switch(this._options.operator_position){case T.before_newline:this._output.space_before_token=!me,this.print_token(v),(!de||oe)&&this.allow_wrap_or_preserved_newline(v),this._output.space_before_token=!0;return;case T.after_newline:this._output.space_before_token=!0,!de||oe?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(v):this._output.space_before_token=!1,this.print_token(v),this._output.space_before_token=!0;return;case T.preserve_newline:me||this.allow_wrap_or_preserved_newline(v),te=!(this._output.just_added_newline()||me),this._output.space_before_token=te,this.print_token(v),this._output.space_before_token=!0;return}}if(j){this.allow_wrap_or_preserved_newline(v),te=!1;var ae=this._tokens.peek();ve=ae&&h(ae.type,[u.WORD,u.RESERVED])}else if(v.text==="...")this.allow_wrap_or_preserved_newline(v),te=this._flags.last_token.type===u.START_BLOCK,ve=!1;else if(h(v.text,["--","++","!","~"])||K){if((this._flags.last_token.type===u.COMMA||this._flags.last_token.type===u.START_EXPR)&&this.allow_wrap_or_preserved_newline(v),te=!1,ve=!1,v.newlines&&(v.text==="--"||v.text==="++"||v.text==="~")){var fe=O(this._flags.last_token,x)&&v.newlines;fe&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(fe,!0)}this._flags.last_token.text===";"&&k(this._flags.mode)&&(te=!0),this._flags.last_token.type===u.RESERVED?te=!0:this._flags.last_token.type===u.END_EXPR?te=!(this._flags.last_token.text==="]"&&(v.text==="--"||v.text==="++")):this._flags.last_token.type===u.OPERATOR&&(te=h(v.text,["--","-","++","+"])&&h(this._flags.last_token.text,["--","-","++","+"]),h(v.text,["+","-"])&&h(this._flags.last_token.text,["--","++"])&&(ve=!0)),(this._flags.mode===l.BlockStatement&&!this._flags.inline_frame||this._flags.mode===l.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||te,this.print_token(v),this._output.space_before_token=ve},F.prototype.handle_block_comment=function(v,j){if(this._output.raw){this._output.add_raw_token(v),v.directives&&v.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(v.directives){this.print_newline(!1,j),this.print_token(v),v.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!d.newline.test(v.text)&&!v.newlines){this._output.space_before_token=!0,this.print_token(v),this._output.space_before_token=!0;return}else this.print_block_commment(v,j)},F.prototype.print_block_commment=function(v,j){var K=m(v.text),J,te=!1,ve=!1,ue=v.whitespace_before,de=ue.length;if(this.print_newline(!1,j),this.print_token_line_indentation(v),this._output.add_token(K[0]),this.print_newline(!1,j),K.length>1){for(K=K.slice(1),te=I(K,"*"),ve=N(K,ue),te&&(this._flags.alignment=1),J=0;J<K.length;J++)te?(this.print_token_line_indentation(v),this._output.add_token(R(K[J]))):ve&&K[J]?(this.print_token_line_indentation(v),this._output.add_token(K[J].substring(de))):(this._output.current_line.set_indent(-1),this._output.add_token(K[J])),this.print_newline(!1,j);this._flags.alignment=0}},F.prototype.handle_comment=function(v,j){v.newlines?this.print_newline(!1,j):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(v),this.print_newline(!1,j)},F.prototype.handle_dot=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),O(this._flags.last_token,x)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(v,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(v)},F.prototype.handle_unknown=function(v,j){this.print_token(v),v.text[v.text.length-1]===`
|
|
`&&this.print_newline(!1,j)},F.prototype.handle_eof=function(v){for(;this._flags.mode===l.Statement;)this.restore_mode();this.handle_whitespace_and_comments(v)},P.exports.Beautifier=F},function(P){function A(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=[]}A.prototype.clone_empty=function(){var f=new A(this.__parent);return f.set_indent(this.__indent_count,this.__alignment_count),f},A.prototype.item=function(f){return f<0?this.__items[this.__items.length+f]:this.__items[f]},A.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},A.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))},A.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)},A.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},A.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},A.prototype.is_empty=function(){return this.__items.length===0},A.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},A.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},A.prototype.pop=function(){var f=null;return this.is_empty()||(f=this.__items.pop(),this.__character_count-=f.length),f},A.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},A.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},A.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},A.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 A(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 A(this)),this.previous_line=this.__lines[this.__lines.length-2];break}s--}},P.exports.Output=p},function(P){function A(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}P.exports.Token=A},function(P,A){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+"])*";A.identifier=new RegExp(s+c,"g"),A.identifierStart=new RegExp(s),A.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+p+f+d+"])+");var o=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;A.newline=/[\n\r\u2028\u2029]/,A.lineBreak=new RegExp(`\r
|
|
|`+A.newline.source),A.allLineBreaks=new RegExp(A.lineBreak.source,"g")},function(P,A,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 o=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var i=0;i<o.length;i++)o[i]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=o[i];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,P.exports.Options=d},function(P){function A(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"])}A.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},A.prototype._get_boolean=function(f,d){var s=this.raw_options[f],c=s===void 0?!!d:!!s;return c},A.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},A.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},A.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]},A.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},A.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}P.exports.Options=A,P.exports.normalizeOpts=p,P.exports.mergeOpts=g},function(P,A,g){var p=g(8).InputScanner,f=g(9).Tokenizer,d=g(9).TOKEN,s=g(13).Directives,c=g(4),o=g(12).Pattern,i=g(14).TemplatablePattern;function u(I,N){return N.indexOf(I)!==-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},R=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_]+)?/,E=/[0-9]/,O=/[^\d\.]/,x=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".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(","),l=_.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),b=new RegExp("^(?:"+l.join("|")+")$"),m,y=function(I,N){f.call(this,I,N),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var F=new o(this._input),C=new i(this._input).read_options(this._options);this.__patterns={template:C,identifier:C.starting_with(c.identifier).matching(c.identifierMatch),number:F.matching(S),punct:F.matching(T),comment:F.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:F.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:F.matching(/<!--/),html_comment_end:F.matching(/-->/),include:F.starting_with(/#include/).until_after(c.lineBreak),shebang:F.starting_with(/#!/).until_after(c.lineBreak),xml:F.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:C.until(/['\\\n\r\u2028\u2029]/),double_quote:C.until(/["\\\n\r\u2028\u2029]/),template_text:C.until(/[`\\$]/),template_expression:C.until(/[`}\\]/)}};y.prototype=new f,y.prototype._is_comment=function(I){return I.type===h.COMMENT||I.type===h.BLOCK_COMMENT||I.type===h.UNKNOWN},y.prototype._is_opening=function(I){return I.type===h.START_BLOCK||I.type===h.START_EXPR},y.prototype._is_closing=function(I,N){return(I.type===h.END_BLOCK||I.type===h.END_EXPR)&&N&&(I.text==="]"&&N.text==="["||I.text===")"&&N.text==="("||I.text==="}"&&N.text==="{")},y.prototype._reset=function(){m=!1},y.prototype._get_next_token=function(I,N){var F=null;this._readWhitespace();var C=this._input.peek();return C===null?this._create_token(h.EOF,""):(F=F||this._read_non_javascript(C),F=F||this._read_string(C),F=F||this._read_word(I),F=F||this._read_singles(C),F=F||this._read_comment(C),F=F||this._read_regexp(C,I),F=F||this._read_xml(C,I),F=F||this._read_punctuation(),F=F||this._create_token(h.UNKNOWN,this._input.next()),F)},y.prototype._read_word=function(I){var N;if(N=this.__patterns.identifier.read(),N!=="")return N=N.replace(c.allLineBreaks,`
|
|
`),!(I.type===h.DOT||I.type===h.RESERVED&&(I.text==="set"||I.text==="get"))&&b.test(N)?(N==="in"||N==="of")&&(I.type===h.WORD||I.type===h.STRING)?this._create_token(h.OPERATOR,N):this._create_token(h.RESERVED,N):this._create_token(h.WORD,N);if(N=this.__patterns.number.read(),N!=="")return this._create_token(h.WORD,N)},y.prototype._read_singles=function(I){var N=null;return I==="("||I==="["?N=this._create_token(h.START_EXPR,I):I===")"||I==="]"?N=this._create_token(h.END_EXPR,I):I==="{"?N=this._create_token(h.START_BLOCK,I):I==="}"?N=this._create_token(h.END_BLOCK,I):I===";"?N=this._create_token(h.SEMICOLON,I):I==="."&&O.test(this._input.peek(1))?N=this._create_token(h.DOT,I):I===","&&(N=this._create_token(h.COMMA,I)),N&&this._input.next(),N},y.prototype._read_punctuation=function(){var I=this.__patterns.punct.read();if(I!=="")return I==="="?this._create_token(h.EQUALS,I):I==="?."?this._create_token(h.DOT,I):this._create_token(h.OPERATOR,I)},y.prototype._read_non_javascript=function(I){var N="";if(I==="#"){if(this._is_first_token()&&(N=this.__patterns.shebang.read(),N))return this._create_token(h.UNKNOWN,N.trim()+`
|
|
`);if(N=this.__patterns.include.read(),N)return this._create_token(h.UNKNOWN,N.trim()+`
|
|
`);I=this._input.next();var F="#";if(this._input.hasNext()&&this._input.testChar(E)){do I=this._input.next(),F+=I;while(this._input.hasNext()&&I!=="#"&&I!=="=");return I==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(F+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(F+="{}",this._input.next(),this._input.next())),this._create_token(h.WORD,F)}this._input.back()}else if(I==="<"&&this._is_first_token()){if(N=this.__patterns.html_comment_start.read(),N){for(;this._input.hasNext()&&!this._input.testChar(c.newline);)N+=this._input.next();return m=!0,this._create_token(h.COMMENT,N)}}else if(m&&I==="-"&&(N=this.__patterns.html_comment_end.read(),N))return m=!1,this._create_token(h.COMMENT,N);return null},y.prototype._read_comment=function(I){var N=null;if(I==="/"){var F="";if(this._input.peek(1)==="*"){F=this.__patterns.block_comment.read();var C=R.get_directives(F);C&&C.ignore==="start"&&(F+=R.readIgnored(this._input)),F=F.replace(c.allLineBreaks,`
|
|
`),N=this._create_token(h.BLOCK_COMMENT,F),N.directives=C}else this._input.peek(1)==="/"&&(F=this.__patterns.comment.read(),N=this._create_token(h.COMMENT,F))}return N},y.prototype._read_string=function(I){if(I==="`"||I==="'"||I==='"'){var N=this._input.next();return this.has_char_escapes=!1,I==="`"?N+=this._read_string_recursive("`",!0,"${"):N+=this._read_string_recursive(I),this.has_char_escapes&&this._options.unescape_strings&&(N=k(N)),this._input.peek()===I&&(N+=this._input.next()),N=N.replace(c.allLineBreaks,`
|
|
`),this._create_token(h.STRING,N)}return null},y.prototype._allow_regexp_or_xml=function(I){return I.type===h.RESERVED&&u(I.text,["return","case","throw","else","do","typeof","yield"])||I.type===h.END_EXPR&&I.text===")"&&I.opened.previous.type===h.RESERVED&&u(I.opened.previous.text,["if","while","for"])||u(I.type,[h.COMMENT,h.START_EXPR,h.START_BLOCK,h.START,h.END_BLOCK,h.OPERATOR,h.EQUALS,h.EOF,h.SEMICOLON,h.COMMA])},y.prototype._read_regexp=function(I,N){if(I==="/"&&this._allow_regexp_or_xml(N)){for(var F=this._input.next(),C=!1,v=!1;this._input.hasNext()&&(C||v||this._input.peek()!==I)&&!this._input.testChar(c.newline);)F+=this._input.peek(),C?C=!1:(C=this._input.peek()==="\\",this._input.peek()==="["?v=!0:this._input.peek()==="]"&&(v=!1)),this._input.next();return this._input.peek()===I&&(F+=this._input.next(),F+=this._input.read(c.identifier)),this._create_token(h.STRING,F)}return null},y.prototype._read_xml=function(I,N){if(this._options.e4x&&I==="<"&&this._allow_regexp_or_xml(N)){var F="",C=this.__patterns.xml.read_match();if(C){for(var v=C[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),j=v.indexOf("{")===0,K=0;C;){var J=!!C[1],te=C[2],ve=!!C[C.length-1]||te.slice(0,8)==="![CDATA[";if(!ve&&(te===v||j&&te.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(J?--K:++K),F+=C[0],K<=0)break;C=this.__patterns.xml.read_match()}return C||(F+=this._input.match(/[\s\S]*/g)[0]),F=F.replace(c.allLineBreaks,`
|
|
`),this._create_token(h.STRING,F)}}return null};function k(I){for(var N="",F=0,C=new p(I),v=null;C.hasNext();)if(v=C.match(/([\s]|[^\\]|\\\\)+/g),v&&(N+=v[0]),C.peek()==="\\"){if(C.next(),C.peek()==="x")v=C.match(/x([0-9A-Fa-f]{2})/g);else if(C.peek()==="u")v=C.match(/u([0-9A-Fa-f]{4})/g);else{N+="\\",C.hasNext()&&(N+=C.next());continue}if(!v)return I;if(F=parseInt(v[1],16),F>126&&F<=255&&v[0].indexOf("x")===0)return I;if(F>=0&&F<32){N+="\\"+v[0];continue}else F===34||F===39||F===92?N+="\\"+String.fromCharCode(F):N+=String.fromCharCode(F)}return N}y.prototype._read_string_recursive=function(I,N,F){var C,v;I==="'"?v=this.__patterns.single_quote:I==='"'?v=this.__patterns.double_quote:I==="`"?v=this.__patterns.template_text:I==="}"&&(v=this.__patterns.template_expression);for(var j=v.read(),K="";this._input.hasNext();){if(K=this._input.next(),K===I||!N&&c.newline.test(K)){this._input.back();break}else K==="\\"&&this._input.hasNext()?(C=this._input.peek(),C==="x"||C==="u"?this.has_char_escapes=!0:C==="\r"&&this._input.peek(1)===`
|
|
`&&this._input.next(),K+=this._input.next()):F&&(F==="${"&&K==="$"&&this._input.peek()==="{"&&(K+=this._input.next()),F===K&&(I==="`"?K+=this._read_string_recursive("}",N,"`"):K+=this._read_string_recursive("`",N,"${"),this._input.hasNext()&&(K+=this._input.next())));K+=v.read(),j+=K}return j},P.exports.Tokenizer=y,P.exports.TOKEN=h,P.exports.positionable_operators=x.slice(),P.exports.line_starters=_.slice()},function(P){var A=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&&!(A&&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&&A&&(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},P.exports.InputScanner=g},function(P,A,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"},o=function(i,u){this._input=new p(i),this._options=u||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new s(this._input)};o.prototype.tokenize=function(){this._input.restart(),this.__tokens=new d,this._reset();for(var i,u=new f(c.START,""),h=null,R=[],S=new d;u.type!==c.EOF;){for(i=this._get_next_token(u,h);this._is_comment(i);)S.add(i),i=this._get_next_token(u,h);S.isEmpty()||(i.comments_before=S,S=new d),i.parent=h,this._is_opening(i)?(R.push(h),h=i):h&&this._is_closing(i,h)&&(i.opened=h,h.closed=i,h=R.pop(),i.parent=h),i.previous=u,u.next=i,this.__tokens.add(i),u=i}return this.__tokens},o.prototype._is_first_token=function(){return this.__tokens.isEmpty()},o.prototype._reset=function(){},o.prototype._get_next_token=function(i,u){this._readWhitespace();var h=this._input.read(/.+/g);return h?this._create_token(c.RAW,h):this._create_token(c.EOF,"")},o.prototype._is_comment=function(i){return!1},o.prototype._is_opening=function(i){return!1},o.prototype._is_closing=function(i,u){return!1},o.prototype._create_token=function(i,u){var h=new f(i,u,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return h},o.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},P.exports.Tokenizer=o,P.exports.TOKEN=c},function(P){function A(g){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=g}A.prototype.restart=function(){this.__position=0},A.prototype.isEmpty=function(){return this.__tokens_length===0},A.prototype.hasNext=function(){return this.__position<this.__tokens_length},A.prototype.next=function(){var g=null;return this.hasNext()&&(g=this.__tokens[this.__position],this.__position+=1),g},A.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},A.prototype.add=function(g){this.__parent_token&&(g.parent=this.__parent_token),this.__tokens.push(g),this.__tokens_length+=1},P.exports.TokenStream=A},function(P,A,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,o=[],i=d.exec(s);i;)o.push(s.substring(c,i.index)),c=i.index+i[0].length,i=d.exec(s);return c<s.length?o.push(s.substring(c,s.length)):o.push(""),o},P.exports.WhitespacePattern=f},function(P){function A(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)}A.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},A.prototype.read_match=function(){return this._input.match(this._match_pattern)},A.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},A.prototype.until=function(g){var p=this._create();return p._until_after=!1,p._until_pattern=this._input.get_regexp(g),p._update(),p},A.prototype.starting_with=function(g){var p=this._create();return p._starting_pattern=this._input.get_regexp(g,!0),p._update(),p},A.prototype.matching=function(g){var p=this._create();return p._match_pattern=this._input.get_regexp(g,!0),p._update(),p},A.prototype._create=function(){return new A(this._input,this)},A.prototype._update=function(){},P.exports.Pattern=A},function(P){function A(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")}A.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},A.prototype.readIgnored=function(g){return g.readUntilAfter(this.__directives_end_ignore_pattern)},P.exports.Directives=A},function(P,A,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 o=new p(s);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}/)}}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 o in f)c._disabled[o]=s.templating.indexOf(o)===-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 o=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&o==="?"&&(s=s||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&o==="%"&&(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},P.exports.TemplatablePattern=d}],M={};function W(P){var A=M[P];if(A!==void 0)return A.exports;var g=M[P]={exports:{}};return U[P](g,g.exports,W),g.exports}var B=W(0);D=B})();var z=D;!(re=[],V=function(){return{js_beautify:z}}.apply(je,re),V!==void 0&&(tt.exports=V))})()},"7Cbv":function(tt,je,q){"use strict";var re=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),V=new Uint8Array(16);function D(){if(!re)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return re(V)}var z=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function U(f){return typeof f=="string"&&z.test(f)}for(var M=U,W=[],B=0;B<256;++B)W.push((B+256).toString(16).substr(1));function P(f){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=(W[f[d+0]]+W[f[d+1]]+W[f[d+2]]+W[f[d+3]]+"-"+W[f[d+4]]+W[f[d+5]]+"-"+W[f[d+6]]+W[f[d+7]]+"-"+W[f[d+8]]+W[f[d+9]]+"-"+W[f[d+10]]+W[f[d+11]]+W[f[d+12]]+W[f[d+13]]+W[f[d+14]]+W[f[d+15]]).toLowerCase();if(!M(s))throw TypeError("Stringified UUID is invalid");return s}var A=P;function g(f,d,s){f=f||{};var c=f.random||(f.rng||D)();if(c[6]=c[6]&15|64,c[8]=c[8]&63|128,d){s=s||0;for(var o=0;o<16;++o)d[s+o]=c[o];return d}return A(c)}var p=je.a=g},"7ahc":function(tt,je,q){"use strict";q.d(je,"a",function(){return R});var re=q("k1fw"),V=q("0Owb"),D=q("+L6B"),z=q("2/Rp"),U=q("y8nQ"),M=q("Vl3Y"),W=q("tJVT"),B=q("OaEy"),P=q("2fM7"),A=q("cDcd"),g=q.n(A),p=q("VrN/"),f=q.n(p),d=q("p77/"),s=q.n(d),c=q("c5Ni"),o=q.n(c),i=P.a.Option,u={labelCol:{span:4},wrapperCol:{span:20}},h={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};je.b=function(S){var E=S.callback,O=S.onCancel,x=Object(A.useState)("python"),w=Object(W.a)(x,2),T=w[0],_=w[1];function l(m){_(h[m][1])}function b(m){E(m)}return g.a.createElement(M.a,Object(V.a)({},u,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:b}),g.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},g.a.createElement(P.a,{onChange:l},Object.keys(h).map(function(m){return g.a.createElement(i,{key:m,value:m},h[m][0])}))),g.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},g.a.createElement(R,{mode:T})),g.a.createElement("div",{className:"flex-container flex-end"},g.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),g.a.createElement(z.a,{type:"ghost",onClick:O},"\u53D6\u6D88")))};function R(S){var E=S.value,O=S.onChange,x=S.mode,w=S.options,T=w===void 0?{}:w,_=Object(A.useRef)(),l=Object(A.useState)(),b=Object(W.a)(l,2),m=b[0],y=b[1];return Object(A.useEffect)(function(){if(m){function k(I){var N=I.getValue();O&&O(N)}return m.on("change",k),function(){m.off("change",k)}}},[m,O]),Object(A.useEffect)(function(){m&&m.setOption("mode",x)},[m,x]),Object(A.useEffect)(function(){m&&((E!==m.getValue()||E==="")&&setTimeout(function(){m.setValue(E||" ")},300))},[m,E]),Object(A.useEffect)(function(){if(_.current&&!m){var k=f.a.fromTextArea(_.current,Object(re.a)({mode:x,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},T));y(k)}},[_.current,m]),g.a.createElement("div",{className:"my-codemirror-container"},g.a.createElement("textarea",{ref:_}))}},"8EBN":function(tt,je,q){(function(re){re(q("VrN/"))})(function(re){"use strict";re.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var V=0;V<re.modeInfo.length;V++){var D=re.modeInfo[V];D.mimes&&(D.mime=D.mimes[0])}re.findModeByMIME=function(z){z=z.toLowerCase();for(var U=0;U<re.modeInfo.length;U++){var M=re.modeInfo[U];if(M.mime==z)return M;if(M.mimes){for(var W=0;W<M.mimes.length;W++)if(M.mimes[W]==z)return M}}if(/\+xml$/.test(z))return re.findModeByMIME("application/xml");if(/\+json$/.test(z))return re.findModeByMIME("application/json")},re.findModeByExtension=function(z){z=z.toLowerCase();for(var U=0;U<re.modeInfo.length;U++){var M=re.modeInfo[U];if(M.ext){for(var W=0;W<M.ext.length;W++)if(M.ext[W]==z)return M}}},re.findModeByFileName=function(z){for(var U=0;U<re.modeInfo.length;U++){var M=re.modeInfo[U];if(M.file&&M.file.test(z))return M}var W=z.lastIndexOf("."),B=W>-1&&z.substring(W+1,z.length);if(B)return re.findModeByExtension(B)},re.findModeByName=function(z){z=z.toLowerCase();for(var U=0;U<re.modeInfo.length;U++){var M=re.modeInfo[U];if(M.name.toLowerCase()==z)return M;if(M.alias){for(var W=0;W<M.alias.length;W++)if(M.alias[W].toLowerCase()==z)return M}}}})},"8hTe":function(tt,je,q){tt.exports={button:"button___1wy9m"}},"9Bee":function(tt,je,q){"use strict";var re=q("DYRE"),V=q("zeV3"),D=q("+L6B"),z=q("2/Rp"),U=q("k1fw"),M=q("tJVT"),W=q("cDcd"),B=q.n(W),P=q("vg9a"),A=q("DlQD"),g=q.n(A),p=q("rUJ1");function f(de,oe){var me=de.match(/^(\s+)(?:```)/);if(me===null)return oe;var ae=me[1];return oe.split(`
|
|
`).map(function(fe){var Q=fe.match(/^\s+/);if(Q===null)return fe;var ie=Object(M.a)(Q,1),ee=ie[0];return ee.length>=ae.length?fe.slice(ae.length):fe}).join(`
|
|
`)}var d=[],s=["<ul>"],c=new g.a.Renderer,o=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function i(){d.length=0,s=["<ul>"]}var u={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function h(de,oe,me,ae){if(oe>=de.length||de[oe].level<=me)return oe;var fe=de[oe];ae.push("<li><a href='#"+fe.anchor+"'>"+fe.text+"</a>"),oe++;var Q=[];return oe=h(de,oe,fe.level,Q),Q.length>0&&(ae.push("<ul>"),Q.forEach(function(ie){ae.push(ie)}),ae.push("</ul>")),ae.push("</li>"),oe=h(de,oe,me,ae),oe}function R(){return h(d,0,0,s),s.push("</ul>"),s.join("")}var S={heading:function(oe){var me=o.exec(oe);if(me)return{type:"heading",raw:me[0],depth:me[1].length,text:me[2]}},fences:function(oe){var me=this.rules.block.fences.exec(oe);if(me){var ae=me[0],fe=f(ae,me[3]||""),Q=me[2]?me[2].trim():me[2];if(["latex","katex","math"].indexOf(Q)>=0){var ie=x(),ee=fe;fe=ie,w[ie]={type:"block",expression:ee}}return{type:"code",raw:ae,lang:Q,text:fe}}}},E=/(?:\${2})([^\n`]+?)(?:\${2})/gi,O=0,x=function(){return"__special_katext_id_".concat(O++,"__")},w={};function T(){return w}function _(){O=0,w={}}function l(de){return de=de.replace(E,function(oe,me){var ae=x();return w[ae]={type:"inline",expression:me},ae}),de}var b=c.listitem;c.listitem=function(de){return b(l(de))};var m=c.paragraph;c.paragraph=function(de){return m(l(de))};var y=c.tablecell;c.tablecell=function(de,oe){return y(l(de),oe)},c.code=function(de,oe,me){var ae=(oe||"").match(/\S*/)[0];return ae?["latex","katex","math"].indexOf(ae)>=0?"<p class='editormd-tex'>".concat(de,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(oe,'">').concat(me?de:Object(p.escape)(de,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(me?de:Object(p.escape)(de,!0))+"</code></pre>"},c.heading=function(de,oe,me){var ae=this.options.headerPrefix+me.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return d.push({anchor:ae,level:oe,text:de}),"<h"+oe+' id="'+ae+'">'+de+"</h"+oe+">"},g.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),g.a.use({tokenizer:S,renderer:c});var k=g.a,I=q("SJMd"),N=q("ulZh"),F=q.n(N),C=q("m3rI"),v=q("Oy/b"),j=q("p5ED"),K=q("8hTe"),J=q.n(K),te=/<pre[^>]*>/g;function ve(de){var oe=document.createElement("div");return oe.innerHTML=de,oe.childNodes.length===0?"":oe.childNodes[0].nodeValue}var ue=je.a=function(de){var oe=de.value,me=oe===void 0?"":oe,ae=de.edit,fe=ae===void 0?!1:ae,Q=de.className,ie=de.showTextOnly,ee=de.showLines,Te=de.replaces,Se=de.zoomImg,be=de.hasMask,ye=de.style,xe=ye===void 0?{}:ye,De=de.stylesPrev,Ie=De===void 0?{}:De,Ae=String(me),Le=Object(W.useRef)(),Ue=Object(W.useRef)(),He=Object(W.useState)(""),We=Object(M.a)(He,2),Fe=We[0],Je=We[1],Ve=Object(W.useState)("office"),$e=Object(M.a)(Ve,2),Ce=$e[0],qe=$e[1],ze=Object(W.useMemo)(function(){try{var ge=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Y=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Z=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Ae=Ae.replace(ge,"("+C.a.API_SERVER+"/api/attachments/").replace(Y,'"'+C.a.API_SERVER+"/api/attachments/").replace(Z,'"'+C.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(Re){}var ne=k(Ae),le=T();if(Ae.match(/\[TOC\]/)&&(ne=ne.replace("<p>[TOC]</p>",R()),i()),ne=ne.replace(/(__special_katext_id_\d+__)/g,function(Re,ke){var Qe=le[ke],nt=Qe.type,rt=Qe.expression;return Object(v.renderToString)(ve(rt)||"",{displayMode:nt==="block",throwOnError:!1,output:"html"})}),ne=ne.replace(/▁/g,"\u2581\u2581\u2581"),_(),ie){var pe=document.createElement("div");return pe.innerHTML=ne,pe.innerText}return setTimeout(function(){return _e()},500),ne},[Ae]),Oe=Object(W.useRef)();u.WebkitLineClamp=ee,ee&&(xe=Object(U.a)(Object(U.a)({},xe),u));function Me(ge){var Y=ge.target;if(Y.tagName.toUpperCase()==="IMG"){if(Se){var Z=Y.getAttribute("src");Je(Z),qe("image")}}else if(Y.tagName.toUpperCase()==="A"){var ne=Y.getAttribute("href");if(ne.indexOf("office")>-1)ge.preventDefault(),Je(ne),qe("office");else if(ne.indexOf("application/pdf")>-1)ge.preventDefault(),Je(ne),qe("pdf");else if(ne.indexOf("text/html")>-1)ge.preventDefault(),Je(ne),qe("html");else if(ne.startsWith("#")){ge.preventDefault();var le=document.getElementById(ne.replace("#",""));le&&le.scrollIntoView(!0)}}}var _e=function(){var Y,Z=(Y=Oe.current)===null||Y===void 0?void 0:Y.querySelectorAll("video");Z==null||Z.forEach(function(ne){if(ne.oncontextmenu=function(){return!1},ne.src.indexOf(".m3u8")>-1&&!ne.canPlayType("application/vnd.apple.mpegurl")){if(F.a.isSupported()){var le=new F.a;le.loadSource(ne.src),le.attachMedia(ne)}}})};Object(W.useEffect)(function(){if(Oe.current&&ze&&(ze.match(te)&&window.PR.prettyPrint()),Oe.current)return Oe.current.addEventListener("click",Me),function(){Oe.current.removeEventListener("click",Me),_(),i()}},[ze,Oe.current,Me]);var he=function(Y){if(!fe)return;Y.target.nodeName==="IMG"?(Le.current.style.display="flex",Le.current.style.width=Y.target.clientWidth+"px",Le.current.style.height=Y.target.clientHeight+"px",Le.current.style.top=Y.target.offsetTop+"px",Le.current.style.left=Y.target.offsetLeft+"px",Ue.current.src=Y.target.getAttribute("src")):Le.current.style.display="none"};return B.a.createElement("div",{style:{position:"relative"}},B.a.createElement("div",{ref:Oe,style:Object(U.a)({},xe),className:"".concat(Q||""," markdown-body ").concat(J.a.mdBody),onMouseOver:he,dangerouslySetInnerHTML:{__html:ze}}),B.a.createElement("div",{ref:Le,className:J.a.button},B.a.createElement(V.a,null,B.a.createElement(z.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),B.a.createElement(z.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),B.a.createElement("img",{ref:Ue,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),B.a.createElement(j.a,{close:!0,data:Fe,type:Fe!=null&&Fe.length?Ce:"",style:Object(U.a)({},Ie),onClose:function(){return Je("")}}))}},"9VGf":function(tt,je,q){"use strict";q.d(je,"a",function(){return D});var re=q("cDcd"),V=q.n(re);function D(z,U){var M=Object(re.useRef)();Object(re.useEffect)(function(){M.current=z}),Object(re.useEffect)(function(){function W(){M.current()}if(U!==null){var B=setInterval(W,U);return function(){return clearInterval(B)}}},[U])}},BU3w:function(tt,je,q){"use strict";q.d(je,"a",function(){return M});var re=q("MNnm"),V="rc-util-key";function D(W){if(W.attachTo)return W.attachTo;var B=document.querySelector("head");return B||document.body}function z(W){var B,P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(re.a)())return null;var A=document.createElement("style");if((B=P.csp)===null||B===void 0?void 0:B.nonce){var g;A.nonce=(g=P.csp)===null||g===void 0?void 0:g.nonce}A.innerHTML=W;var p=D(P),f=p.firstChild;return P.prepend&&p.prepend?p.prepend(A):P.prepend&&f?p.insertBefore(A,f):p.appendChild(A),A}var U=new Map;function M(W,B){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},A=D(P);if(!U.has(A)){var g=z("",P),p=g.parentNode;U.set(A,p),p.removeChild(g)}var f=Array.from(U.get(A).children).find(function(i){return i.tagName==="STYLE"&&i[V]===B});if(f){var d,s;if(((d=P.csp)===null||d===void 0?void 0:d.nonce)&&f.nonce!==((s=P.csp)===null||s===void 0?void 0:s.nonce)){var c;f.nonce=(c=P.csp)===null||c===void 0?void 0:c.nonce}return f.innerHTML!==W&&(f.innerHTML=W),f}var o=z(W,P);return o[V]=B,o}},Bd2K:function(tt,je,q){(function(re){re(q("VrN/"),q("osHv"))})(function(re){re.defineOption("autoCloseTags",!1,function(P,A,g){if(g!=re.Init&&g&&P.removeKeyMap("autoCloseTags"),!A)return;var p={name:"autoCloseTags"};(typeof A!="object"||A.whenClosing!==!1)&&(p["'/'"]=function(f){return M(f)}),(typeof A!="object"||A.whenOpening!==!1)&&(p["'>'"]=function(f){return z(f)}),P.addKeyMap(p)});var V=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function z(P){if(P.getOption("disableInput"))return re.Pass;for(var A=P.listSelections(),g=[],p=P.getOption("autoCloseTags"),f=0;f<A.length;f++){if(!A[f].empty())return re.Pass;var d=A[f].head,s=P.getTokenAt(d),c=re.innerMode(P.getMode(),s.state),o=c.state,i=c.mode.xmlCurrentTag&&c.mode.xmlCurrentTag(o),u=i&&i.name;if(!u)return re.Pass;var h=c.mode.configuration=="html",R=typeof p=="object"&&p.dontCloseTags||h&&V,S=typeof p=="object"&&p.indentTags||h&&D;s.end>d.ch&&(u=u.slice(0,u.length-s.end+d.ch));var E=u.toLowerCase();if(!u||s.type=="string"&&(s.end!=d.ch||!/[\"\']/.test(s.string.charAt(s.string.length-1))||s.string.length==1)||s.type=="tag"&&i.close||s.string.indexOf("/")==d.ch-s.start-1||R&&W(R,E)>-1||B(P,c.mode.xmlCurrentContext&&c.mode.xmlCurrentContext(o)||[],u,d,!0))return re.Pass;var O=typeof p=="object"&&p.emptyTags;if(O&&W(O,u)>-1){g[f]={text:"/>",newPos:re.Pos(d.line,d.ch+2)};continue}var x=S&&W(S,E)>-1;g[f]={indent:x,text:">"+(x?`
|
|
|
|
`:"")+"</"+u+">",newPos:x?re.Pos(d.line+1,0):re.Pos(d.line,d.ch+1)}}for(var w=typeof p=="object"&&p.dontIndentOnAutoClose,f=A.length-1;f>=0;f--){var T=g[f];P.replaceRange(T.text,A[f].head,A[f].anchor,"+insert");var _=P.listSelections().slice(0);_[f]={head:T.newPos,anchor:T.newPos},P.setSelections(_),!w&&T.indent&&(P.indentLine(T.newPos.line,null,!0),P.indentLine(T.newPos.line+1,null,!0))}}function U(P,A){for(var g=P.listSelections(),p=[],f=A?"/":"</",d=P.getOption("autoCloseTags"),s=typeof d=="object"&&d.dontIndentOnSlash,c=0;c<g.length;c++){if(!g[c].empty())return re.Pass;var o=g[c].head,i=P.getTokenAt(o),u=re.innerMode(P.getMode(),i.state),h=u.state;if(A&&(i.type=="string"||i.string.charAt(0)!="<"||i.start!=o.ch-1))return re.Pass;var R,S=u.mode.name!="xml"&&P.getMode().name=="htmlmixed";if(S&&u.mode.name=="javascript")R=f+"script";else if(S&&u.mode.name=="css")R=f+"style";else{var E=u.mode.xmlCurrentContext&&u.mode.xmlCurrentContext(h);if(!E||E.length&&B(P,E,E[E.length-1],o))return re.Pass;R=f+E[E.length-1]}P.getLine(o.line).charAt(i.end)!=">"&&(R+=">"),p[c]=R}if(P.replaceSelections(p),g=P.listSelections(),!s)for(var c=0;c<g.length;c++)(c==g.length-1||g[c].head.line<g[c+1].head.line)&&P.indentLine(g[c].head.line)}function M(P){return P.getOption("disableInput")?re.Pass:U(P,!0)}re.commands.closeTag=function(P){return U(P)};function W(P,A){if(P.indexOf)return P.indexOf(A);for(var g=0,p=P.length;g<p;++g)if(P[g]==A)return g;return-1}function B(P,A,g,p,f){if(!re.scanForClosingTag)return!1;var d=Math.min(P.lastLine()+1,p.line+500),s=re.scanForClosingTag(P,p,null,d);if(!s||s.tag!=g)return!1;for(var c=f?1:0,o=A.length-1;o>=0&&A[o]==g;o--)++c;p=s.to;for(var o=1;o<c;o++){var i=re.scanForClosingTag(P,p,null,d);if(!i||i.tag!=g)return!1;p=i.to}return!0}})},BjJ7:function(tt,je,q){"use strict";q.d(je,"d",function(){return V}),q.d(je,"c",function(){return D}),q.d(je,"e",function(){return z}),q.d(je,"b",function(){return U}),q.d(je,"a",function(){return W});var re=q("m3rI");function V(B){var P=!0;if(B.length>0){for(var A=0;A<B.length;A++)if(B[A].compile_success==0||!B[A].compile_success){P=!1;break}}else P=!1;return P}function D(B){for(var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",A=[],g=0;g<B.length;g++){var p=B[g],f=P?"".concat(P,"/").concat(p.name):"".concat(p.name);A.push({title:p.name,isLeaf:!(p.type==="tree"),key:f})}return A}function z(B,P,A){for(var g=0;g<B.length;g++){var p=B[g];if(p.key===P){p.children=A;break}p.children&&z(p.children,P,A)}return B}function U(B,P,A){var g;return function(){var p=this,f=arguments,d=function(){g=null,A||B.apply(p,f)},s=A&&!g;clearTimeout(g),g=setTimeout(d,P),s&&B.apply(p,f)}}var M=!0,W=re.a.API_SERVER},"C+DQ":function(tt,je,q){},DlQD:function(tt,je,q){(function(re,V){tt.exports=V()})(this,function(){"use strict";function re(_e,he){for(var ge=0;ge<he.length;ge++){var Y=he[ge];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(_e,Y.key,Y)}}function V(_e,he,ge){return he&&re(_e.prototype,he),ge&&re(_e,ge),_e}function D(_e,he){if(!_e)return;if(typeof _e=="string")return z(_e,he);var ge=Object.prototype.toString.call(_e).slice(8,-1);if(ge==="Object"&&_e.constructor&&(ge=_e.constructor.name),ge==="Map"||ge==="Set")return Array.from(_e);if(ge==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ge))return z(_e,he)}function z(_e,he){(he==null||he>_e.length)&&(he=_e.length);for(var ge=0,Y=new Array(he);ge<he;ge++)Y[ge]=_e[ge];return Y}function U(_e,he){var ge;if(typeof Symbol=="undefined"||_e[Symbol.iterator]==null){if(Array.isArray(_e)||(ge=D(_e))||he&&_e&&typeof _e.length=="number"){ge&&(_e=ge);var Y=0;return function(){return Y>=_e.length?{done:!0}:{done:!1,value:_e[Y++]}}}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 ge=_e[Symbol.iterator](),ge.next.bind(ge)}function M(_e,he){return he={exports:{}},_e(he,he.exports),he.exports}var W=M(function(_e){function he(){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 ge(Y){_e.exports.defaults=Y}_e.exports={defaults:he(),getDefaults:he,changeDefaults:ge}}),B=W.defaults,P=W.getDefaults,A=W.changeDefaults,g=/[&<>"']/,p=/[&<>"']/g,f=/[<>"']|&(?!#?\w+;)/,d=/[<>"']|&(?!#?\w+;)/g,s={"&":"&","<":"<",">":">",'"':""","'":"'"},c=function(he){return s[he]};function o(_e,he){if(he){if(g.test(_e))return _e.replace(p,c)}else if(f.test(_e))return _e.replace(d,c);return _e}var i=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function u(_e){return _e.replace(i,function(he,ge){return ge=ge.toLowerCase(),ge==="colon"?":":ge.charAt(0)==="#"?ge.charAt(1)==="x"?String.fromCharCode(parseInt(ge.substring(2),16)):String.fromCharCode(+ge.substring(1)):""})}var h=/(^|[^\[])\^/g;function R(_e,he){_e=_e.source||_e,he=he||"";var ge={replace:function(Z,ne){return ne=ne.source||ne,ne=ne.replace(h,"$1"),_e=_e.replace(Z,ne),ge},getRegex:function(){return new RegExp(_e,he)}};return ge}var S=/[^\w:]/g,E=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(_e,he,ge){if(_e){var Y;try{Y=decodeURIComponent(u(ge)).replace(S,"").toLowerCase()}catch(Z){return null}if(Y.indexOf("javascript:")===0||Y.indexOf("vbscript:")===0||Y.indexOf("data:")===0)return null}he&&!E.test(ge)&&(ge=l(he,ge));try{ge=encodeURI(ge).replace(/%25/g,"%")}catch(Z){return null}return ge}var x={},w=/^[^:]+:\/*[^/]*$/,T=/^([^:]+:)[\s\S]*$/,_=/^([^:]+:\/*[^/]*)[\s\S]*$/;function l(_e,he){x[" "+_e]||(w.test(_e)?x[" "+_e]=_e+"/":x[" "+_e]=k(_e,"/",!0)),_e=x[" "+_e];var ge=_e.indexOf(":")===-1;return he.substring(0,2)==="//"?ge?he:_e.replace(T,"$1")+he:he.charAt(0)==="/"?ge?he:_e.replace(_,"$1")+he:_e+he}var b={exec:function(){}};function m(_e){for(var he=1,ge,Y;he<arguments.length;he++){ge=arguments[he];for(Y in ge)Object.prototype.hasOwnProperty.call(ge,Y)&&(_e[Y]=ge[Y])}return _e}function y(_e,he){var ge=_e.replace(/\|/g,function(ne,le,pe){for(var Re=!1,ke=le;--ke>=0&&pe[ke]==="\\";)Re=!Re;return Re?"|":" |"}),Y=ge.split(/ \|/),Z=0;if(Y.length>he)Y.splice(he);else for(;Y.length<he;)Y.push("");for(;Z<Y.length;Z++)Y[Z]=Y[Z].trim().replace(/\\\|/g,"|");return Y}function k(_e,he,ge){var Y=_e.length;if(Y===0)return"";for(var Z=0;Z<Y;){var ne=_e.charAt(Y-Z-1);if(ne===he&&!ge)Z++;else if(ne!==he&&ge)Z++;else break}return _e.substr(0,Y-Z)}function I(_e,he){if(_e.indexOf(he[1])===-1)return-1;for(var ge=_e.length,Y=0,Z=0;Z<ge;Z++)if(_e[Z]==="\\")Z++;else if(_e[Z]===he[0])Y++;else if(_e[Z]===he[1]&&(Y--,Y<0))return Z;return-1}function N(_e){_e&&_e.sanitize&&!_e.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var F={escape:o,unescape:u,edit:R,cleanUrl:O,resolveUrl:l,noopTest:b,merge:m,splitCells:y,rtrim:k,findClosingBracket:I,checkSanitizeDeprecation:N},C=W.defaults,v=F.rtrim,j=F.splitCells,K=F.escape,J=F.findClosingBracket;function te(_e,he,ge){var Y=he.href,Z=he.title?K(he.title):null,ne=_e[1].replace(/\\([\[\]])/g,"$1");return _e[0].charAt(0)!=="!"?{type:"link",raw:ge,href:Y,title:Z,text:ne}:{type:"image",raw:ge,href:Y,title:Z,text:K(ne)}}function ve(_e,he){var ge=_e.match(/^(\s+)(?:```)/);if(ge===null)return he;var Y=ge[1];return he.split(`
|
|
`).map(function(Z){var ne=Z.match(/^\s+/);if(ne===null)return Z;var le=ne[0];return le.length>=Y.length?Z.slice(Y.length):Z}).join(`
|
|
`)}var ue=function(){function _e(ge){this.options=ge||C}var he=_e.prototype;return he.space=function(Y){var Z=this.rules.block.newline.exec(Y);if(Z)return Z[0].length>1?{type:"space",raw:Z[0]}:{raw:`
|
|
`}},he.code=function(Y,Z){var ne=this.rules.block.code.exec(Y);if(ne){var le=Z[Z.length-1];if(le&&le.type==="paragraph")return{raw:ne[0],text:ne[0].trimRight()};var pe=ne[0].replace(/^ {4}/gm,"");return{type:"code",raw:ne[0],codeBlockStyle:"indented",text:this.options.pedantic?pe:v(pe,`
|
|
`)}}},he.fences=function(Y){var Z=this.rules.block.fences.exec(Y);if(Z){var ne=Z[0],le=ve(ne,Z[3]||"");return{type:"code",raw:ne,lang:Z[2]?Z[2].trim():Z[2],text:le}}},he.heading=function(Y){var Z=this.rules.block.heading.exec(Y);if(Z)return{type:"heading",raw:Z[0],depth:Z[1].length,text:Z[2]}},he.nptable=function(Y){var Z=this.rules.block.nptable.exec(Y);if(Z){var ne={type:"table",header:j(Z[1].replace(/^ *| *\| *$/g,"")),align:Z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Z[3]?Z[3].replace(/\n$/,"").split(`
|
|
`):[],raw:Z[0]};if(ne.header.length===ne.align.length){var le=ne.align.length,pe;for(pe=0;pe<le;pe++)/^ *-+: *$/.test(ne.align[pe])?ne.align[pe]="right":/^ *:-+: *$/.test(ne.align[pe])?ne.align[pe]="center":/^ *:-+ *$/.test(ne.align[pe])?ne.align[pe]="left":ne.align[pe]=null;for(le=ne.cells.length,pe=0;pe<le;pe++)ne.cells[pe]=j(ne.cells[pe],ne.header.length);return ne}}},he.hr=function(Y){var Z=this.rules.block.hr.exec(Y);if(Z)return{type:"hr",raw:Z[0]}},he.blockquote=function(Y){var Z=this.rules.block.blockquote.exec(Y);if(Z){var ne=Z[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Z[0],text:ne}}},he.list=function(Y){var Z=this.rules.block.list.exec(Y);if(Z){for(var ne=Z[0],le=Z[2],pe=le.length>1,Re=le[le.length-1]===")",ke={type:"list",raw:ne,ordered:pe,start:pe?+le.slice(0,-1):"",loose:!1,items:[]},Qe=Z[0].match(this.rules.block.item),nt=!1,rt,Et,ct,st,Ot,Tt,Bt,Mt=Qe.length,yt=0;yt<Mt;yt++)rt=Qe[yt],ne=rt,Et=rt.length,rt=rt.replace(/^ *([*+-]|\d+[.)]) */,""),~rt.indexOf(`
|
|
`)&&(Et-=rt.length,rt=this.options.pedantic?rt.replace(/^ {1,4}/gm,""):rt.replace(new RegExp("^ {1,"+Et+"}","gm"),"")),yt!==Mt-1&&(ct=this.rules.block.bullet.exec(Qe[yt+1])[0],(pe?ct.length===1||!Re&&ct[ct.length-1]===")":ct.length>1||this.options.smartLists&&ct!==le)&&(st=Qe.slice(yt+1).join(`
|
|
`),ke.raw=ke.raw.substring(0,ke.raw.length-st.length),yt=Mt-1)),Ot=nt||/\n\n(?!\s*$)/.test(rt),yt!==Mt-1&&(nt=rt.charAt(rt.length-1)===`
|
|
`,Ot||(Ot=nt)),Ot&&(ke.loose=!0),Tt=/^\[[ xX]\] /.test(rt),Bt=void 0,Tt&&(Bt=rt[1]!==" ",rt=rt.replace(/^\[[ xX]\] +/,"")),ke.items.push({type:"list_item",raw:ne,task:Tt,checked:Bt,loose:Ot,text:rt});return ke}},he.html=function(Y){var Z=this.rules.block.html.exec(Y);if(Z)return{type:this.options.sanitize?"paragraph":"html",raw:Z[0],pre:!this.options.sanitizer&&(Z[1]==="pre"||Z[1]==="script"||Z[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Z[0]):K(Z[0]):Z[0]}},he.def=function(Y){var Z=this.rules.block.def.exec(Y);if(Z){Z[3]&&(Z[3]=Z[3].substring(1,Z[3].length-1));var ne=Z[1].toLowerCase().replace(/\s+/g," ");return{tag:ne,raw:Z[0],href:Z[2],title:Z[3]}}},he.table=function(Y){var Z=this.rules.block.table.exec(Y);if(Z){var ne={type:"table",header:j(Z[1].replace(/^ *| *\| *$/g,"")),align:Z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Z[3]?Z[3].replace(/\n$/,"").split(`
|
|
`):[]};if(ne.header.length===ne.align.length){ne.raw=Z[0];var le=ne.align.length,pe;for(pe=0;pe<le;pe++)/^ *-+: *$/.test(ne.align[pe])?ne.align[pe]="right":/^ *:-+: *$/.test(ne.align[pe])?ne.align[pe]="center":/^ *:-+ *$/.test(ne.align[pe])?ne.align[pe]="left":ne.align[pe]=null;for(le=ne.cells.length,pe=0;pe<le;pe++)ne.cells[pe]=j(ne.cells[pe].replace(/^ *\| *| *\| *$/g,""),ne.header.length);return ne}}},he.lheading=function(Y){var Z=this.rules.block.lheading.exec(Y);if(Z)return{type:"heading",raw:Z[0],depth:Z[2].charAt(0)==="="?1:2,text:Z[1]}},he.paragraph=function(Y){var Z=this.rules.block.paragraph.exec(Y);if(Z)return{type:"paragraph",raw:Z[0],text:Z[1].charAt(Z[1].length-1)===`
|
|
`?Z[1].slice(0,-1):Z[1]}},he.text=function(Y,Z){var ne=this.rules.block.text.exec(Y);if(ne){var le=Z[Z.length-1];return le&&le.type==="text"?{raw:ne[0],text:ne[0]}:{type:"text",raw:ne[0],text:ne[0]}}},he.escape=function(Y){var Z=this.rules.inline.escape.exec(Y);if(Z)return{type:"escape",raw:Z[0],text:K(Z[1])}},he.tag=function(Y,Z,ne){var le=this.rules.inline.tag.exec(Y);if(le)return!Z&&/^<a /i.test(le[0])?Z=!0:Z&&/^<\/a>/i.test(le[0])&&(Z=!1),!ne&&/^<(pre|code|kbd|script)(\s|>)/i.test(le[0])?ne=!0:ne&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(le[0])&&(ne=!1),{type:this.options.sanitize?"text":"html",raw:le[0],inLink:Z,inRawBlock:ne,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):K(le[0]):le[0]}},he.link=function(Y){var Z=this.rules.inline.link.exec(Y);if(Z){var ne=J(Z[2],"()");if(ne>-1){var le=Z[0].indexOf("!")===0?5:4,pe=le+Z[1].length+ne;Z[2]=Z[2].substring(0,ne),Z[0]=Z[0].substring(0,pe).trim(),Z[3]=""}var Re=Z[2],ke="";if(this.options.pedantic){var Qe=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Re);Qe?(Re=Qe[1],ke=Qe[3]):ke=""}else ke=Z[3]?Z[3].slice(1,-1):"";Re=Re.trim().replace(/^<([\s\S]*)>$/,"$1");var nt=te(Z,{href:Re&&Re.replace(this.rules.inline._escapes,"$1"),title:ke&&ke.replace(this.rules.inline._escapes,"$1")},Z[0]);return nt}},he.reflink=function(Y,Z){var ne;if((ne=this.rules.inline.reflink.exec(Y))||(ne=this.rules.inline.nolink.exec(Y))){var le=(ne[2]||ne[1]).replace(/\s+/g," ");if(le=Z[le.toLowerCase()],!le||!le.href){var pe=ne[0].charAt(0);return{type:"text",raw:pe,text:pe}}var Re=te(ne,le,ne[0]);return Re}},he.strong=function(Y,Z,ne){ne===void 0&&(ne="");var le=this.rules.inline.strong.start.exec(Y);if(le&&(!le[1]||le[1]&&(ne===""||this.rules.inline.punctuation.exec(ne)))){Z=Z.slice(-1*Y.length);var pe=le[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;pe.lastIndex=0;for(var Re;(le=pe.exec(Z))!=null;)if(Re=this.rules.inline.strong.middle.exec(Z.slice(0,le.index+3)),Re)return{type:"strong",raw:Y.slice(0,Re[0].length),text:Y.slice(2,Re[0].length-2)}}},he.em=function(Y,Z,ne){ne===void 0&&(ne="");var le=this.rules.inline.em.start.exec(Y);if(le&&(!le[1]||le[1]&&(ne===""||this.rules.inline.punctuation.exec(ne)))){Z=Z.slice(-1*Y.length);var pe=le[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;pe.lastIndex=0;for(var Re;(le=pe.exec(Z))!=null;)if(Re=this.rules.inline.em.middle.exec(Z.slice(0,le.index+2)),Re)return{type:"em",raw:Y.slice(0,Re[0].length),text:Y.slice(1,Re[0].length-1)}}},he.codespan=function(Y){var Z=this.rules.inline.code.exec(Y);if(Z){var ne=Z[2].replace(/\n/g," "),le=/[^ ]/.test(ne),pe=ne.startsWith(" ")&&ne.endsWith(" ");return le&&pe&&(ne=ne.substring(1,ne.length-1)),ne=K(ne,!0),{type:"codespan",raw:Z[0],text:ne}}},he.br=function(Y){var Z=this.rules.inline.br.exec(Y);if(Z)return{type:"br",raw:Z[0]}},he.del=function(Y){var Z=this.rules.inline.del.exec(Y);if(Z)return{type:"del",raw:Z[0],text:Z[1]}},he.autolink=function(Y,Z){var ne=this.rules.inline.autolink.exec(Y);if(ne){var le,pe;return ne[2]==="@"?(le=K(this.options.mangle?Z(ne[1]):ne[1]),pe="mailto:"+le):(le=K(ne[1]),pe=le),{type:"link",raw:ne[0],text:le,href:pe,tokens:[{type:"text",raw:le,text:le}]}}},he.url=function(Y,Z){var ne;if(ne=this.rules.inline.url.exec(Y)){var le,pe;if(ne[2]==="@")le=K(this.options.mangle?Z(ne[0]):ne[0]),pe="mailto:"+le;else{var Re;do Re=ne[0],ne[0]=this.rules.inline._backpedal.exec(ne[0])[0];while(Re!==ne[0]);le=K(ne[0]),ne[1]==="www."?pe="http://"+le:pe=le}return{type:"link",raw:ne[0],text:le,href:pe,tokens:[{type:"text",raw:le,text:le}]}}},he.inlineText=function(Y,Z,ne){var le=this.rules.inline.text.exec(Y);if(le){var pe;return Z?pe=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):K(le[0]):le[0]:pe=K(this.options.smartypants?ne(le[0]):le[0]),{type:"text",raw:le[0],text:pe}}},_e}(),de=F.noopTest,oe=F.edit,me=F.merge,ae={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:de,table:de,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ae._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ae._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ae.def=oe(ae.def).replace("label",ae._label).replace("title",ae._title).getRegex(),ae.bullet=/(?:[*+-]|\d{1,9}[.)])/,ae.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ae.item=oe(ae.item,"gm").replace(/bull/g,ae.bullet).getRegex(),ae.list=oe(ae.list).replace(/bull/g,ae.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ae.def.source+")").getRegex(),ae._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",ae._comment=/<!--(?!-?>)[\s\S]*?-->/,ae.html=oe(ae.html,"i").replace("comment",ae._comment).replace("tag",ae._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ae.paragraph=oe(ae._paragraph).replace("hr",ae.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",ae._tag).getRegex(),ae.blockquote=oe(ae.blockquote).replace("paragraph",ae.paragraph).getRegex(),ae.normal=me({},ae),ae.gfm=me({},ae.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*|$)"}),ae.gfm.nptable=oe(ae.gfm.nptable).replace("hr",ae.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",ae._tag).getRegex(),ae.gfm.table=oe(ae.gfm.table).replace("hr",ae.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",ae._tag).getRegex(),ae.pedantic=me({},ae.normal,{html:oe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ae._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:de,paragraph:oe(ae.normal._paragraph).replace("hr",ae.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ae.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var fe={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:de,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:de,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};fe._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",fe.punctuation=oe(fe.punctuation).replace(/punctuation/g,fe._punctuation).getRegex(),fe._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",fe._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",fe.em.start=oe(fe.em.start).replace(/punctuation/g,fe._punctuation).getRegex(),fe.em.middle=oe(fe.em.middle).replace(/punctuation/g,fe._punctuation).replace(/overlapSkip/g,fe._overlapSkip).getRegex(),fe.em.endAst=oe(fe.em.endAst,"g").replace(/punctuation/g,fe._punctuation).getRegex(),fe.em.endUnd=oe(fe.em.endUnd,"g").replace(/punctuation/g,fe._punctuation).getRegex(),fe.strong.start=oe(fe.strong.start).replace(/punctuation/g,fe._punctuation).getRegex(),fe.strong.middle=oe(fe.strong.middle).replace(/punctuation/g,fe._punctuation).replace(/blockSkip/g,fe._blockSkip).getRegex(),fe.strong.endAst=oe(fe.strong.endAst,"g").replace(/punctuation/g,fe._punctuation).getRegex(),fe.strong.endUnd=oe(fe.strong.endUnd,"g").replace(/punctuation/g,fe._punctuation).getRegex(),fe.blockSkip=oe(fe._blockSkip,"g").getRegex(),fe.overlapSkip=oe(fe._overlapSkip,"g").getRegex(),fe._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,fe._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,fe._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])?)+(?![-_])/,fe.autolink=oe(fe.autolink).replace("scheme",fe._scheme).replace("email",fe._email).getRegex(),fe._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,fe.tag=oe(fe.tag).replace("comment",ae._comment).replace("attribute",fe._attribute).getRegex(),fe._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,fe._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,fe._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,fe.link=oe(fe.link).replace("label",fe._label).replace("href",fe._href).replace("title",fe._title).getRegex(),fe.reflink=oe(fe.reflink).replace("label",fe._label).getRegex(),fe.reflinkSearch=oe(fe.reflinkSearch,"g").replace("reflink",fe.reflink).replace("nolink",fe.nolink).getRegex(),fe.normal=me({},fe),fe.pedantic=me({},fe.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:oe(/^!?\[(label)\]\((.*?)\)/).replace("label",fe._label).getRegex(),reflink:oe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",fe._label).getRegex()}),fe.gfm=me({},fe.normal,{escape:oe(fe.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),fe.gfm.url=oe(fe.gfm.url,"i").replace("email",fe.gfm._extended_email).getRegex(),fe.breaks=me({},fe.gfm,{br:oe(fe.br).replace("{2,}","*").getRegex(),text:oe(fe.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Q={block:ae,inline:fe},ie=W.defaults,ee=Q.block,Te=Q.inline;function Se(_e){return _e.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 be(_e){var he="",ge,Y,Z=_e.length;for(ge=0;ge<Z;ge++)Y=_e.charCodeAt(ge),Math.random()>.5&&(Y="x"+Y.toString(16)),he+="&#"+Y+";";return he}var ye=function(){function _e(ge){this.tokens=[],this.tokens.links=Object.create(null),this.options=ge||ie,this.options.tokenizer=this.options.tokenizer||new ue,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Y={block:ee.normal,inline:Te.normal};this.options.pedantic?(Y.block=ee.pedantic,Y.inline=Te.pedantic):this.options.gfm&&(Y.block=ee.gfm,this.options.breaks?Y.inline=Te.breaks:Y.inline=Te.gfm),this.tokenizer.rules=Y}_e.lex=function(Y,Z){var ne=new _e(Z);return ne.lex(Y)};var he=_e.prototype;return he.lex=function(Y){return Y=Y.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(Y,this.tokens,!0),this.inline(this.tokens),this.tokens},he.blockTokens=function(Y,Z,ne){Z===void 0&&(Z=[]),ne===void 0&&(ne=!0),Y=Y.replace(/^ +$/gm,"");for(var le,pe,Re,ke;Y;){if(le=this.tokenizer.space(Y)){Y=Y.substring(le.raw.length),le.type&&Z.push(le);continue}if(le=this.tokenizer.code(Y,Z)){Y=Y.substring(le.raw.length),le.type?Z.push(le):(ke=Z[Z.length-1],ke.raw+=`
|
|
`+le.raw,ke.text+=`
|
|
`+le.text);continue}if(le=this.tokenizer.fences(Y)){Y=Y.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.heading(Y)){Y=Y.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.nptable(Y)){Y=Y.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.hr(Y)){Y=Y.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.blockquote(Y)){Y=Y.substring(le.raw.length),le.tokens=this.blockTokens(le.text,[],ne),Z.push(le);continue}if(le=this.tokenizer.list(Y)){for(Y=Y.substring(le.raw.length),Re=le.items.length,pe=0;pe<Re;pe++)le.items[pe].tokens=this.blockTokens(le.items[pe].text,[],!1);Z.push(le);continue}if(le=this.tokenizer.html(Y)){Y=Y.substring(le.raw.length),Z.push(le);continue}if(ne&&(le=this.tokenizer.def(Y))){Y=Y.substring(le.raw.length),this.tokens.links[le.tag]||(this.tokens.links[le.tag]={href:le.href,title:le.title});continue}if(le=this.tokenizer.table(Y)){Y=Y.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.lheading(Y)){Y=Y.substring(le.raw.length),Z.push(le);continue}if(ne&&(le=this.tokenizer.paragraph(Y))){Y=Y.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.text(Y,Z)){Y=Y.substring(le.raw.length),le.type?Z.push(le):(ke=Z[Z.length-1],ke.raw+=`
|
|
`+le.raw,ke.text+=`
|
|
`+le.text);continue}if(Y){var Qe="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(Qe);break}else throw new Error(Qe)}}return Z},he.inline=function(Y){var Z,ne,le,pe,Re,ke,Qe=Y.length;for(Z=0;Z<Qe;Z++){ke=Y[Z];switch(ke.type){case"paragraph":case"text":case"heading":{ke.tokens=[],this.inlineTokens(ke.text,ke.tokens);break}case"table":{for(ke.tokens={header:[],cells:[]},pe=ke.header.length,ne=0;ne<pe;ne++)ke.tokens.header[ne]=[],this.inlineTokens(ke.header[ne],ke.tokens.header[ne]);for(pe=ke.cells.length,ne=0;ne<pe;ne++)for(Re=ke.cells[ne],ke.tokens.cells[ne]=[],le=0;le<Re.length;le++)ke.tokens.cells[ne][le]=[],this.inlineTokens(Re[le],ke.tokens.cells[ne][le]);break}case"blockquote":{this.inline(ke.tokens);break}case"list":{for(pe=ke.items.length,ne=0;ne<pe;ne++)this.inline(ke.items[ne].tokens);break}}}return Y},he.inlineTokens=function(Y,Z,ne,le,pe){Z===void 0&&(Z=[]),ne===void 0&&(ne=!1),le===void 0&&(le=!1),pe===void 0&&(pe="");var Re,ke=Y,Qe;if(this.tokens.links){var nt=Object.keys(this.tokens.links);if(nt.length>0)for(;(Qe=this.tokenizer.rules.inline.reflinkSearch.exec(ke))!=null;)nt.includes(Qe[0].slice(Qe[0].lastIndexOf("[")+1,-1))&&(ke=ke.slice(0,Qe.index)+"["+"a".repeat(Qe[0].length-2)+"]"+ke.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Qe=this.tokenizer.rules.inline.blockSkip.exec(ke))!=null;)ke=ke.slice(0,Qe.index)+"["+"a".repeat(Qe[0].length-2)+"]"+ke.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Y;){if(Re=this.tokenizer.escape(Y)){Y=Y.substring(Re.raw.length),Z.push(Re);continue}if(Re=this.tokenizer.tag(Y,ne,le)){Y=Y.substring(Re.raw.length),ne=Re.inLink,le=Re.inRawBlock,Z.push(Re);continue}if(Re=this.tokenizer.link(Y)){Y=Y.substring(Re.raw.length),Re.type==="link"&&(Re.tokens=this.inlineTokens(Re.text,[],!0,le)),Z.push(Re);continue}if(Re=this.tokenizer.reflink(Y,this.tokens.links)){Y=Y.substring(Re.raw.length),Re.type==="link"&&(Re.tokens=this.inlineTokens(Re.text,[],!0,le)),Z.push(Re);continue}if(Re=this.tokenizer.strong(Y,ke,pe)){Y=Y.substring(Re.raw.length),Re.tokens=this.inlineTokens(Re.text,[],ne,le),Z.push(Re);continue}if(Re=this.tokenizer.em(Y,ke,pe)){Y=Y.substring(Re.raw.length),Re.tokens=this.inlineTokens(Re.text,[],ne,le),Z.push(Re);continue}if(Re=this.tokenizer.codespan(Y)){Y=Y.substring(Re.raw.length),Z.push(Re);continue}if(Re=this.tokenizer.br(Y)){Y=Y.substring(Re.raw.length),Z.push(Re);continue}if(Re=this.tokenizer.del(Y)){Y=Y.substring(Re.raw.length),Re.tokens=this.inlineTokens(Re.text,[],ne,le),Z.push(Re);continue}if(Re=this.tokenizer.autolink(Y,be)){Y=Y.substring(Re.raw.length),Z.push(Re);continue}if(!ne&&(Re=this.tokenizer.url(Y,be))){Y=Y.substring(Re.raw.length),Z.push(Re);continue}if(Re=this.tokenizer.inlineText(Y,le,Se)){Y=Y.substring(Re.raw.length),pe=Re.raw.slice(-1),Z.push(Re);continue}if(Y){var rt="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(rt);break}else throw new Error(rt)}}return Z},V(_e,null,[{key:"rules",get:function(){return{block:ee,inline:Te}}}]),_e}(),xe=W.defaults,De=F.cleanUrl,Ie=F.escape,Ae=function(){function _e(ge){this.options=ge||xe}var he=_e.prototype;return he.code=function(Y,Z,ne){var le=(Z||"").match(/\S*/)[0];if(this.options.highlight){var pe=this.options.highlight(Y,le);pe!=null&&pe!==Y&&(ne=!0,Y=pe)}return le?'<pre><code class="'+this.options.langPrefix+Ie(le,!0)+'">'+(ne?Y:Ie(Y,!0))+`</code></pre>
|
|
`:"<pre><code>"+(ne?Y:Ie(Y,!0))+`</code></pre>
|
|
`},he.blockquote=function(Y){return`<blockquote>
|
|
`+Y+`</blockquote>
|
|
`},he.html=function(Y){return Y},he.heading=function(Y,Z,ne,le){return this.options.headerIds?"<h"+Z+' id="'+this.options.headerPrefix+le.slug(ne)+'">'+Y+"</h"+Z+`>
|
|
`:"<h"+Z+">"+Y+"</h"+Z+`>
|
|
`},he.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},he.list=function(Y,Z,ne){var le=Z?"ol":"ul",pe=Z&&ne!==1?' start="'+ne+'"':"";return"<"+le+pe+`>
|
|
`+Y+"</"+le+`>
|
|
`},he.listitem=function(Y){return"<li>"+Y+`</li>
|
|
`},he.checkbox=function(Y){return"<input "+(Y?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},he.paragraph=function(Y){return"<p>"+Y+`</p>
|
|
`},he.table=function(Y,Z){return Z&&(Z="<tbody>"+Z+"</tbody>"),`<table>
|
|
<thead>
|
|
`+Y+`</thead>
|
|
`+Z+`</table>
|
|
`},he.tablerow=function(Y){return`<tr>
|
|
`+Y+`</tr>
|
|
`},he.tablecell=function(Y,Z){var ne=Z.header?"th":"td",le=Z.align?"<"+ne+' align="'+Z.align+'">':"<"+ne+">";return le+Y+"</"+ne+`>
|
|
`},he.strong=function(Y){return"<strong>"+Y+"</strong>"},he.em=function(Y){return"<em>"+Y+"</em>"},he.codespan=function(Y){return"<code>"+Y+"</code>"},he.br=function(){return this.options.xhtml?"<br/>":"<br>"},he.del=function(Y){return"<del>"+Y+"</del>"},he.link=function(Y,Z,ne){if(Y=De(this.options.sanitize,this.options.baseUrl,Y),Y===null)return ne;var le='<a href="'+Ie(Y)+'"';return Z&&(le+=' title="'+Z+'"'),le+=">"+ne+"</a>",le},he.image=function(Y,Z,ne){if(Y=De(this.options.sanitize,this.options.baseUrl,Y),Y===null)return ne;var le='<img src="'+Y+'" alt="'+ne+'"';return Z&&(le+=' title="'+Z+'"'),le+=this.options.xhtml?"/>":">",le},he.text=function(Y){return Y},_e}(),Le=function(){function _e(){}var he=_e.prototype;return he.strong=function(Y){return Y},he.em=function(Y){return Y},he.codespan=function(Y){return Y},he.del=function(Y){return Y},he.html=function(Y){return Y},he.text=function(Y){return Y},he.link=function(Y,Z,ne){return""+ne},he.image=function(Y,Z,ne){return""+ne},he.br=function(){return""},_e}(),Ue=function(){function _e(){this.seen={}}var he=_e.prototype;return he.slug=function(Y){var Z=Y.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Z)){var ne=Z;do this.seen[ne]++,Z=ne+"-"+this.seen[ne];while(this.seen.hasOwnProperty(Z))}return this.seen[Z]=0,Z},_e}(),He=W.defaults,We=F.unescape,Fe=function(){function _e(ge){this.options=ge||He,this.options.renderer=this.options.renderer||new Ae,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Le,this.slugger=new Ue}_e.parse=function(Y,Z){var ne=new _e(Z);return ne.parse(Y)};var he=_e.prototype;return he.parse=function(Y,Z){Z===void 0&&(Z=!0);var ne="",le,pe,Re,ke,Qe,nt,rt,Et,ct,st,Ot,Tt,Bt,Mt,yt,pn,bn,dt,mt=Y.length;for(le=0;le<mt;le++){st=Y[le];switch(st.type){case"space":continue;case"hr":{ne+=this.renderer.hr();continue}case"heading":{ne+=this.renderer.heading(this.parseInline(st.tokens),st.depth,We(this.parseInline(st.tokens,this.textRenderer)),this.slugger);continue}case"code":{ne+=this.renderer.code(st.text,st.lang,st.escaped);continue}case"table":{for(Et="",rt="",ke=st.header.length,pe=0;pe<ke;pe++)rt+=this.renderer.tablecell(this.parseInline(st.tokens.header[pe]),{header:!0,align:st.align[pe]});for(Et+=this.renderer.tablerow(rt),ct="",ke=st.cells.length,pe=0;pe<ke;pe++){for(nt=st.tokens.cells[pe],rt="",Qe=nt.length,Re=0;Re<Qe;Re++)rt+=this.renderer.tablecell(this.parseInline(nt[Re]),{header:!1,align:st.align[Re]});ct+=this.renderer.tablerow(rt)}ne+=this.renderer.table(Et,ct);continue}case"blockquote":{ct=this.parse(st.tokens),ne+=this.renderer.blockquote(ct);continue}case"list":{for(Ot=st.ordered,Tt=st.start,Bt=st.loose,ke=st.items.length,ct="",pe=0;pe<ke;pe++)yt=st.items[pe],pn=yt.checked,bn=yt.task,Mt="",yt.task&&(dt=this.renderer.checkbox(pn),Bt?yt.tokens.length>0&&yt.tokens[0].type==="text"?(yt.tokens[0].text=dt+" "+yt.tokens[0].text,yt.tokens[0].tokens&&yt.tokens[0].tokens.length>0&&yt.tokens[0].tokens[0].type==="text"&&(yt.tokens[0].tokens[0].text=dt+" "+yt.tokens[0].tokens[0].text)):yt.tokens.unshift({type:"text",text:dt}):Mt+=dt),Mt+=this.parse(yt.tokens,Bt),ct+=this.renderer.listitem(Mt,bn,pn);ne+=this.renderer.list(ct,Ot,Tt);continue}case"html":{ne+=this.renderer.html(st.text);continue}case"paragraph":{ne+=this.renderer.paragraph(this.parseInline(st.tokens));continue}case"text":{for(ct=st.tokens?this.parseInline(st.tokens):st.text;le+1<mt&&Y[le+1].type==="text";)st=Y[++le],ct+=`
|
|
`+(st.tokens?this.parseInline(st.tokens):st.text);ne+=Z?this.renderer.paragraph(ct):ct;continue}default:{var xt='Token with "'+st.type+'" type was not found.';if(this.options.silent){console.error(xt);return}else throw new Error(xt)}}}return ne},he.parseInline=function(Y,Z){Z=Z||this.renderer;var ne="",le,pe,Re=Y.length;for(le=0;le<Re;le++){pe=Y[le];switch(pe.type){case"escape":{ne+=Z.text(pe.text);break}case"html":{ne+=Z.html(pe.text);break}case"link":{ne+=Z.link(pe.href,pe.title,this.parseInline(pe.tokens,Z));break}case"image":{ne+=Z.image(pe.href,pe.title,pe.text);break}case"strong":{ne+=Z.strong(this.parseInline(pe.tokens,Z));break}case"em":{ne+=Z.em(this.parseInline(pe.tokens,Z));break}case"codespan":{ne+=Z.codespan(pe.text);break}case"br":{ne+=Z.br();break}case"del":{ne+=Z.del(this.parseInline(pe.tokens,Z));break}case"text":{ne+=Z.text(pe.text);break}default:{var ke='Token with "'+pe.type+'" type was not found.';if(this.options.silent){console.error(ke);return}else throw new Error(ke)}}}return ne},_e}(),Je=F.merge,Ve=F.checkSanitizeDeprecation,$e=F.escape,Ce=W.getDefaults,qe=W.changeDefaults,ze=W.defaults;function Oe(_e,he,ge){if(typeof _e=="undefined"||_e===null)throw new Error("marked(): input parameter is undefined or null");if(typeof _e!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(_e)+", string expected");if(typeof he=="function"&&(ge=he,he=null),he=Je({},Oe.defaults,he||{}),Ve(he),ge){var Y=he.highlight,Z;try{Z=ye.lex(_e,he)}catch(Re){return ge(Re)}var ne=function(ke){var Qe;if(!ke)try{Qe=Fe.parse(Z,he)}catch(nt){ke=nt}return he.highlight=Y,ke?ge(ke):ge(null,Qe)};if(!Y||Y.length<3)return ne();if(delete he.highlight,!Z.length)return ne();var le=0;Oe.walkTokens(Z,function(Re){Re.type==="code"&&(le++,setTimeout(function(){Y(Re.text,Re.lang,function(ke,Qe){if(ke)return ne(ke);Qe!=null&&Qe!==Re.text&&(Re.text=Qe,Re.escaped=!0),le--,le===0&&ne()})},0))}),le===0&&ne();return}try{var pe=ye.lex(_e,he);return he.walkTokens&&Oe.walkTokens(pe,he.walkTokens),Fe.parse(pe,he)}catch(Re){if(Re.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,he.silent)return"<p>An error occurred:</p><pre>"+$e(Re.message+"",!0)+"</pre>";throw Re}}Oe.options=Oe.setOptions=function(_e){return Je(Oe.defaults,_e),qe(Oe.defaults),Oe},Oe.getDefaults=Ce,Oe.defaults=ze,Oe.use=function(_e){var he=Je({},_e);if(_e.renderer&&function(){var Y=Oe.defaults.renderer||new Ae,Z=function(pe){var Re=Y[pe];Y[pe]=function(){for(var ke=arguments.length,Qe=new Array(ke),nt=0;nt<ke;nt++)Qe[nt]=arguments[nt];var rt=_e.renderer[pe].apply(Y,Qe);return rt===!1&&(rt=Re.apply(Y,Qe)),rt}};for(var ne in _e.renderer)Z(ne);he.renderer=Y}(),_e.tokenizer&&function(){var Y=Oe.defaults.tokenizer||new ue,Z=function(pe){var Re=Y[pe];Y[pe]=function(){for(var ke=arguments.length,Qe=new Array(ke),nt=0;nt<ke;nt++)Qe[nt]=arguments[nt];var rt=_e.tokenizer[pe].apply(Y,Qe);return rt===!1&&(rt=Re.apply(Y,Qe)),rt}};for(var ne in _e.tokenizer)Z(ne);he.tokenizer=Y}(),_e.walkTokens){var ge=Oe.defaults.walkTokens;he.walkTokens=function(Y){_e.walkTokens(Y),ge&&ge(Y)}}Oe.setOptions(he)},Oe.walkTokens=function(_e,he){for(var ge=U(_e),Y;!(Y=ge()).done;){var Z=Y.value;he(Z);switch(Z.type){case"table":{for(var ne=U(Z.tokens.header),le;!(le=ne()).done;){var pe=le.value;Oe.walkTokens(pe,he)}for(var Re=U(Z.tokens.cells),ke;!(ke=Re()).done;)for(var Qe=ke.value,nt=U(Qe),rt;!(rt=nt()).done;){var Et=rt.value;Oe.walkTokens(Et,he)}break}case"list":{Oe.walkTokens(Z.items,he);break}default:Z.tokens&&Oe.walkTokens(Z.tokens,he)}}},Oe.Parser=Fe,Oe.parser=Fe.parse,Oe.Renderer=Ae,Oe.TextRenderer=Le,Oe.Lexer=ye,Oe.lexer=ye.lex,Oe.Tokenizer=ue,Oe.Slugger=Ue,Oe.parse=Oe;var Me=Oe;return Me})},ELLl:function(tt,je,q){(function(re){re(q("VrN/"))})(function(re){var V={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=re.Pos;re.defineOption("autoCloseBrackets",!1,function(s,c,o){o&&o!=re.Init&&(s.removeKeyMap(U),s.state.closeBrackets=null),c&&(M(z(c,"pairs")),s.state.closeBrackets=c,s.addKeyMap(U))});function z(s,c){return c=="pairs"&&typeof s=="string"?s:typeof s=="object"&&s[c]!=null?s[c]:V[c]}var U={Backspace:P,Enter:A};function M(s){for(var c=0;c<s.length;c++){var o=s.charAt(c),i="'"+o+"'";U[i]||(U[i]=W(o))}}M(V.pairs+"`");function W(s){return function(c){return p(c,s)}}function B(s){var c=s.state.closeBrackets;if(!c||c.override)return c;var o=s.getModeAt(s.getCursor());return o.closeBrackets||c}function P(s){var c=B(s);if(!c||s.getOption("disableInput"))return re.Pass;for(var o=z(c,"pairs"),i=s.listSelections(),u=0;u<i.length;u++){if(!i[u].empty())return re.Pass;var h=f(s,i[u].head);if(!h||o.indexOf(h)%2!=0)return re.Pass}for(var u=i.length-1;u>=0;u--){var R=i[u].head;s.replaceRange("",D(R.line,R.ch-1),D(R.line,R.ch+1),"+delete")}}function A(s){var c=B(s),o=c&&z(c,"explode");if(!o||s.getOption("disableInput"))return re.Pass;for(var i=s.listSelections(),u=0;u<i.length;u++){if(!i[u].empty())return re.Pass;var h=f(s,i[u].head);if(!h||o.indexOf(h)%2!=0)return re.Pass}s.operation(function(){var R=s.lineSeparator()||`
|
|
`;s.replaceSelection(R+R,null),s.execCommand("goCharLeft"),i=s.listSelections();for(var S=0;S<i.length;S++){var E=i[S].head.line;s.indentLine(E,null,!0),s.indentLine(E+1,null,!0)}})}function g(s){var c=re.cmpPos(s.anchor,s.head)>0;return{anchor:new D(s.anchor.line,s.anchor.ch+(c?-1:1)),head:new D(s.head.line,s.head.ch+(c?1:-1))}}function p(s,c){var o=B(s);if(!o||s.getOption("disableInput"))return re.Pass;var i=z(o,"pairs"),u=i.indexOf(c);if(u==-1)return re.Pass;for(var h=z(o,"closeBefore"),R=z(o,"triples"),S=i.charAt(u+1)==c,E=s.listSelections(),O=u%2==0,x,w=0;w<E.length;w++){var T=E[w],_=T.head,l,b=s.getRange(_,D(_.line,_.ch+1));if(O&&!T.empty())l="surround";else if((S||!O)&&b==c)S&&d(s,_)?l="both":R.indexOf(c)>=0&&s.getRange(_,D(_.line,_.ch+3))==c+c+c?l="skipThree":l="skip";else if(S&&_.ch>1&&R.indexOf(c)>=0&&s.getRange(D(_.line,_.ch-2),_)==c+c){if(_.ch>2&&/\bstring/.test(s.getTokenTypeAt(D(_.line,_.ch-2))))return re.Pass;l="addFour"}else if(S){var m=_.ch==0?" ":s.getRange(D(_.line,_.ch-1),_);if(!re.isWordChar(b)&&m!=c&&!re.isWordChar(m))l="both";else return re.Pass}else if(O&&(b.length===0||/\s/.test(b)||h.indexOf(b)>-1))l="both";else return re.Pass;if(!x)x=l;else if(x!=l)return re.Pass}var y=u%2?i.charAt(u-1):c,k=u%2?c:i.charAt(u+1);s.operation(function(){if(x=="skip")s.execCommand("goCharRight");else if(x=="skipThree")for(var I=0;I<3;I++)s.execCommand("goCharRight");else if(x=="surround"){for(var N=s.getSelections(),I=0;I<N.length;I++)N[I]=y+N[I]+k;s.replaceSelections(N,"around"),N=s.listSelections().slice();for(var I=0;I<N.length;I++)N[I]=g(N[I]);s.setSelections(N)}else x=="both"?(s.replaceSelection(y+k,null),s.triggerElectric(y+k),s.execCommand("goCharLeft")):x=="addFour"&&(s.replaceSelection(y+y+y+y,"before"),s.execCommand("goCharRight"))})}function f(s,c){var o=s.getRange(D(c.line,c.ch-1),D(c.line,c.ch+1));return o.length==2?o:null}function d(s,c){var o=s.getTokenAt(D(c.line,c.ch+1));return/\bstring/.test(o.type)&&o.start==c.ch&&(c.ch==0||!/\bstring/.test(s.getTokenTypeAt(c)))}})},GfqC:function(tt,je,q){"use strict";var re=q("cDcd"),V=q.n(re),D=q("TSYQ"),z=q.n(D);function U(F,C){var v="cannot "+F.method+" "+F.action+" "+C.status+"'",j=new Error(v);return j.status=C.status,j.method=F.method,j.url=F.action,j}function M(F){var C=F.responseText||F.response;if(!C)return C;try{return JSON.parse(C)}catch(v){return C}}function W(F){var C=new XMLHttpRequest;F.onProgress&&C.upload&&(C.upload.onprogress=function(J){J.total>0&&(J.percent=J.loaded/J.total*100),F.onProgress(J)});var v=new FormData;F.data&&Object.keys(F.data).forEach(function(K){var J=F.data[K];if(Array.isArray(J)){J.forEach(function(te){v.append(K+"[]",te)});return}v.append(K,F.data[K])}),F.file instanceof Blob?v.append(F.filename,F.file,F.file.name):v.append(F.filename,F.file),C.onerror=function(J){F.onError(J)},C.onload=function(){return C.status<200||C.status>=300?F.onError(U(F,C),M(C)):F.onSuccess(M(C),C)},C.open(F.method,F.action,!0),F.withCredentials&&"withCredentials"in C&&(C.withCredentials=!0);var j=F.headers||{};return j["X-Requested-With"]!==null&&C.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(j).forEach(function(K){j[K]!==null&&C.setRequestHeader(K,j[K])}),C.send(v),{abort:function(){C.abort()}}}var B=+new Date,P=0;function A(){return"rc-upload-"+B+"-"+ ++P}function g(F,C){return F.indexOf(C,F.length-C.length)!==-1}var p=function(F,C){if(F&&C){var v=Array.isArray(C)?C:C.split(","),j=F.name||"",K=F.type||"",J=K.replace(/\/.*$/,"");return v.some(function(te){var ve=te.trim();return ve.charAt(0)==="."?g(j.toLowerCase(),ve.toLowerCase()):/\/\*$/.test(ve)?J===ve.replace(/\/.*$/,""):K===ve})}return!0};function f(F,C){var v=F.createReader(),j=[];function K(){v.readEntries(function(J){var te=Array.prototype.slice.apply(J);j=j.concat(te);var ve=!te.length;ve?C(j):K()})}K()}var d=function(C,v,j){var K=function J(te,ve){ve=ve||"",te.isFile?te.file(function(ue){j(ue)&&(te.fullPath&&!ue.webkitRelativePath&&(Object.defineProperties(ue,{webkitRelativePath:{writable:!0}}),ue.webkitRelativePath=te.fullPath.replace(/^\//,""),Object.defineProperties(ue,{webkitRelativePath:{writable:!1}})),v([ue]))}):te.isDirectory&&f(te,function(ue){ue.forEach(function(de){J(de,""+ve+te.name+"/")})})};C.forEach(function(J){K(J.webkitGetAsEntry())})},s=d,c=Object.assign||function(F){for(var C=1;C<arguments.length;C++){var v=arguments[C];for(var j in v)Object.prototype.hasOwnProperty.call(v,j)&&(F[j]=v[j])}return F},o=function(){function F(C,v){var j=[],K=!0,J=!1,te=void 0;try{for(var ve=C[Symbol.iterator](),ue;!(K=(ue=ve.next()).done)&&!(j.push(ue.value),v&&j.length===v);K=!0);}catch(de){J=!0,te=de}finally{try{!K&&ve.return&&ve.return()}finally{if(J)throw te}}return j}return function(C,v){if(Array.isArray(C))return C;if(Symbol.iterator in Object(C))return F(C,v);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function F(C,v){for(var j=0;j<v.length;j++){var K=v[j];K.enumerable=K.enumerable||!1,K.configurable=!0,"value"in K&&(K.writable=!0),Object.defineProperty(C,K.key,K)}}return function(C,v,j){return v&&F(C.prototype,v),j&&F(C,j),C}}();function u(F,C,v){return C in F?Object.defineProperty(F,C,{value:v,enumerable:!0,configurable:!0,writable:!0}):F[C]=v,F}function h(F,C){var v={};for(var j in F){if(C.indexOf(j)>=0)continue;if(!Object.prototype.hasOwnProperty.call(F,j))continue;v[j]=F[j]}return v}function R(F,C){if(!(F instanceof C))throw new TypeError("Cannot call a class as a function")}function S(F,C){if(!F)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return C&&(typeof C=="object"||typeof C=="function")?C:F}function E(F,C){if(typeof C!="function"&&C!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof C);F.prototype=Object.create(C&&C.prototype,{constructor:{value:F,enumerable:!1,writable:!0,configurable:!0}}),C&&(Object.setPrototypeOf?Object.setPrototypeOf(F,C):F.__proto__=C)}var O=function(C){return Object.keys(C).reduce(function(v,j){return(j.substr(0,5)==="data-"||j.substr(0,5)==="aria-"||j==="role")&&(v[j]=C[j]),v},{})},x=function(F){E(C,F);function C(){var v,j,K,J;R(this,C);for(var te=arguments.length,ve=Array(te),ue=0;ue<te;ue++)ve[ue]=arguments[ue];return J=(j=(K=S(this,(v=C.__proto__||Object.getPrototypeOf(C)).call.apply(v,[this].concat(ve))),K),K.state={uid:A()},K.reqs={},K.onChange=function(de){var oe=de.target.files;K.uploadFiles(oe),K.reset()},K.onClick=function(de){var oe=K.fileInput;if(!oe)return;var me=K.props,ae=me.children,fe=me.onClick;ae&&ae.type==="button"&&(oe.parentNode.focus(),oe.parentNode.querySelector("button").blur()),oe.click(),fe&&fe(de)},K.onKeyDown=function(de){de.key==="Enter"&&K.onClick()},K.onFileDrop=function(de){var oe=K.props.multiple;if(de.preventDefault(),de.type==="dragover")return;if(K.props.directory)s(Array.prototype.slice.call(de.dataTransfer.items),K.uploadFiles,function(ae){return p(ae,K.props.accept)});else{var me=Array.prototype.slice.call(de.dataTransfer.files).filter(function(ae){return p(ae,K.props.accept)});oe===!1&&(me=me.slice(0,1)),K.uploadFiles(me)}},K.uploadFiles=function(de){var oe=Array.prototype.slice.call(de);oe.map(function(me){return me.uid=A(),me}).forEach(function(me){K.upload(me,oe)})},K.saveFileInput=function(de){K.fileInput=de},j),S(K,J)}return i(C,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(j,K){var J=this,te=this.props;if(!te.beforeUpload)return setTimeout(function(){return J.post(j)},0);var ve=te.beforeUpload(j,K);ve&&ve.then?ve.then(function(ue){var de=Object.prototype.toString.call(ue);return de==="[object File]"||de==="[object Blob]"?J.post(ue):J.post(j)}).catch(function(ue){console.log(ue)}):ve!==!1&&setTimeout(function(){return J.post(j)},0);return}},{key:"post",value:function(j){var K=this;if(!this._isMounted)return;var J=this.props,te=J.onStart,ve=J.onProgress,ue=J.transformFile,de=ue===void 0?function(oe){return oe}:ue;new Promise(function(oe){var me=J.action;return typeof me=="function"&&(me=me(j)),oe(me)}).then(function(oe){var me=j.uid,ae=J.customRequest||W,fe=Promise.resolve(de(j)).then(function(Q){var ie=J.data;return typeof ie=="function"&&(ie=ie(Q)),Promise.all([Q,ie])}).catch(function(Q){console.error(Q)});fe.then(function(Q){var ie=o(Q,2),ee=ie[0],Te=ie[1],Se={action:oe,filename:J.name,data:Te,file:ee,headers:J.headers,withCredentials:J.withCredentials,method:J.method||"post",onProgress:ve?function(be){ve(be,j)}:null,onSuccess:function(ye,xe){delete K.reqs[me],J.onSuccess(ye,j,xe)},onError:function(ye,xe){delete K.reqs[me],J.onError(ye,xe,j)}};te(j),K.reqs[me]=ae(Se)})})}},{key:"reset",value:function(){this.setState({uid:A()})}},{key:"abort",value:function(j){var K=this.reqs;if(j){var J=j;j&&j.uid&&(J=j.uid),K[J]&&K[J].abort&&K[J].abort(),delete K[J]}else Object.keys(K).forEach(function(te){K[te]&&K[te].abort&&K[te].abort(),delete K[te]})}},{key:"render",value:function(){var j,K=this.props,J=K.component,te=K.prefixCls,ve=K.className,ue=K.disabled,de=K.id,oe=K.style,me=K.multiple,ae=K.accept,fe=K.children,Q=K.directory,ie=K.openFileDialogOnClick,ee=K.onMouseEnter,Te=K.onMouseLeave,Se=h(K,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),be=z()((j={},u(j,te,!0),u(j,te+"-disabled",ue),u(j,ve,ve),j)),ye=ue?{}:{onClick:ie?this.onClick:function(){},onKeyDown:ie?this.onKeyDown:function(){},onMouseEnter:ee,onMouseLeave:Te,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return V.a.createElement(J,c({},ye,{className:be,role:"button",style:oe}),V.a.createElement("input",c({},O(Se),{id:de,type:"file",ref:this.saveFileInput,onClick:function(De){return De.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ae,directory:Q?"directory":null,webkitdirectory:Q?"webkitdirectory":null,multiple:me,onChange:this.onChange})),fe)}}]),C}(re.Component),w=x,T=Object.assign||function(F){for(var C=1;C<arguments.length;C++){var v=arguments[C];for(var j in v)Object.prototype.hasOwnProperty.call(v,j)&&(F[j]=v[j])}return F},_=function(){function F(C,v){for(var j=0;j<v.length;j++){var K=v[j];K.enumerable=K.enumerable||!1,K.configurable=!0,"value"in K&&(K.writable=!0),Object.defineProperty(C,K.key,K)}}return function(C,v,j){return v&&F(C.prototype,v),j&&F(C,j),C}}();function l(F,C){if(!(F instanceof C))throw new TypeError("Cannot call a class as a function")}function b(F,C){if(!F)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return C&&(typeof C=="object"||typeof C=="function")?C:F}function m(F,C){if(typeof C!="function"&&C!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof C);F.prototype=Object.create(C&&C.prototype,{constructor:{value:F,enumerable:!1,writable:!0,configurable:!0}}),C&&(Object.setPrototypeOf?Object.setPrototypeOf(F,C):F.__proto__=C)}function y(){}var k=function(F){m(C,F);function C(){var v,j,K,J;l(this,C);for(var te=arguments.length,ve=Array(te),ue=0;ue<te;ue++)ve[ue]=arguments[ue];return J=(j=(K=b(this,(v=C.__proto__||Object.getPrototypeOf(C)).call.apply(v,[this].concat(ve))),K),K.saveUploader=function(de){K.uploader=de},j),b(K,J)}return _(C,[{key:"abort",value:function(j){this.uploader.abort(j)}},{key:"render",value:function(){return V.a.createElement(w,T({},this.props,{ref:this.saveUploader}))}}]),C}(re.Component);k.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:y,onError:y,onSuccess:y,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var I=k,N=je.a=I},HmJG:function(tt,je,q){},LdHM:function(tt,je,q){"use strict";q.d(je,"b",function(){return h}),q.d(je,"a",function(){return S});var re=q("1OyB"),V=q("vuIU"),D=q("Ji7U"),z=q("LK+K"),U=q("cDcd"),M=q("rePB"),W=q("Ff2n"),B=q("ODXe"),P=q("4IlW"),A=q("bX4T"),g=q("YrtM"),p=q("TSYQ"),f=q.n(p),d=q("+nKL"),s=q("8OUc"),c=function(j,K){var J=j.prefixCls,te=j.id,ve=j.flattenOptions,ue=j.childrenAsData,de=j.values,oe=j.searchValue,me=j.multiple,ae=j.defaultActiveFirstOption,fe=j.height,Q=j.itemHeight,ie=j.notFoundContent,ee=j.open,Te=j.menuItemSelectedIcon,Se=j.virtual,be=j.onSelect,ye=j.onToggleOpen,xe=j.onActiveValue,De=j.onScroll,Ie=j.onMouseEnter,Ae="".concat(J,"-item"),Le=Object(g.a)(function(){return ve},[ee,ve],function(Me,_e){return _e[0]&&Me[1]!==_e[1]}),Ue=U.useRef(null),He=function(_e){_e.preventDefault()},We=function(_e){Ue.current&&Ue.current.scrollTo({index:_e})},Fe=function(_e){for(var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ge=Le.length,Y=0;Y<ge;Y+=1){var Z=(_e+Y*he+ge)%ge,ne=Le[Z],le=ne.group,pe=ne.data;if(!le&&!pe.disabled)return Z}return-1},Je=U.useState(function(){return Fe(0)}),Ve=Object(B.a)(Je,2),$e=Ve[0],Ce=Ve[1],qe=function(_e){Ce(_e);var he=Le[_e];if(!he){xe(null,-1);return}xe(he.data.value,_e)};U.useEffect(function(){qe(ae!==!1?Fe(0):-1)},[Le.length,oe]),U.useEffect(function(){var Me=setTimeout(function(){if(!me&&ee&&de.size===1){var _e=Array.from(de)[0],he=Le.findIndex(function(ge){var Y=ge.data;return Y.value===_e});qe(he),We(he)}});return function(){return clearTimeout(Me)}},[ee]);var ze=function(_e){_e!==void 0&&be(_e,{selected:!de.has(_e)}),me||ye(!1)};if(U.useImperativeHandle(K,function(){return{onKeyDown:function(_e){var he=_e.which;switch(he){case P.a.UP:case P.a.DOWN:{var ge=0;if(he===P.a.UP?ge=-1:he===P.a.DOWN&&(ge=1),ge!==0){var Y=Fe($e+ge,ge);We(Y),qe(Y)}break}case P.a.ENTER:{var Z=Le[$e];Z&&!Z.data.disabled?ze(Z.data.value):ze(void 0),ee&&_e.preventDefault();break}case P.a.ESC:ye(!1)}},onKeyUp:function(){},scrollTo:function(_e){We(_e)}}}),Le.length===0)return U.createElement("div",{role:"listbox",id:"".concat(te,"_list"),className:"".concat(Ae,"-empty"),onMouseDown:He},ie);function Oe(Me){var _e=Le[Me];if(!_e)return null;var he=_e.data||{},ge=he.value,Y=he.label,Z=he.children,ne=Object(A.a)(he,!0),le=ue?Z:Y;return _e?U.createElement("div",Object.assign({"aria-label":typeof le=="string"?le:null},ne,{key:Me,role:"option",id:"".concat(te,"_list_").concat(Me),"aria-selected":de.has(ge)}),ge):null}return U.createElement(U.Fragment,null,U.createElement("div",{role:"listbox",id:"".concat(te,"_list"),style:{height:0,width:0,overflow:"hidden"}},Oe($e-1),Oe($e),Oe($e+1)),U.createElement(d.a,{itemKey:"key",ref:Ue,data:Le,height:fe,itemHeight:Q,fullHeight:!1,onMouseDown:He,onScroll:De,virtual:Se,onMouseEnter:Ie},function(Me,_e){var he,ge=Me.group,Y=Me.groupOption,Z=Me.data,ne=Z.label,le=Z.key;if(ge)return U.createElement("div",{className:f()(Ae,"".concat(Ae,"-group"))},ne!==void 0?ne:le);var pe=Z.disabled,Re=Z.value,ke=Z.title,Qe=Z.children,nt=Z.style,rt=Z.className,Et=Object(W.a)(Z,["disabled","value","title","children","style","className"]),ct=de.has(Re),st="".concat(Ae,"-option"),Ot=f()(Ae,st,rt,(he={},Object(M.a)(he,"".concat(st,"-grouped"),Y),Object(M.a)(he,"".concat(st,"-active"),$e===_e&&!pe),Object(M.a)(he,"".concat(st,"-disabled"),pe),Object(M.a)(he,"".concat(st,"-selected"),ct),he)),Tt=ue?Qe:ne,Bt=!Te||typeof Te=="function"||ct;return U.createElement("div",Object.assign({},Et,{"aria-selected":ct,className:Ot,title:ke,onMouseMove:function(){if($e===_e||pe)return;qe(_e)},onClick:function(){pe||ze(Re)},style:nt}),U.createElement("div",{className:"".concat(st,"-content")},Tt||Re),U.isValidElement(Te)||ct,Bt&&U.createElement(s.a,{className:"".concat(Ae,"-option-state"),customizeIcon:Te,customizeIconProps:{isSelected:ct}},ct?"\u2713":null))}))},o=U.forwardRef(c);o.displayName="OptionList";var i=o,u=function(){return null};u.isSelectOption=!0;var h=u,R=function(){return null};R.isSelectOptGroup=!0;var S=R,E=q("VTBJ"),O=q("Zm9Q");function x(v){var j=v.key,K=v.props,J=K.children,te=K.value,ve=Object(W.a)(K,["children","value"]);return Object(E.a)({key:j,value:te!==void 0?te:j,children:J},ve)}function w(v){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(O.a)(v).map(function(K,J){if(!U.isValidElement(K)||!K.type)return null;var te=K.type.isSelectOptGroup,ve=K.key,ue=K.props,de=ue.children,oe=Object(W.a)(ue,["children"]);return j||!te?x(K):Object(E.a)(Object(E.a)({key:"__RC_SELECT_GRP__".concat(ve===null?J:ve,"__"),label:ve},oe),{},{options:w(de)})}).filter(function(K){return K})}var T=q("2Qr1"),_=q("qNPg"),l=q("U8pU"),b=q("Kwbf"),m=q("WKfj");function y(v){var j=v.mode,K=v.options,J=v.children,te=v.backfill,ve=v.allowClear,ue=v.placeholder,de=v.getInputElement,oe=v.showSearch,me=v.onSearch,ae=v.defaultOpen,fe=v.autoFocus,Q=v.labelInValue,ie=v.value,ee=v.inputValue,Te=v.optionLabelProp,Se=j==="multiple"||j==="tags",be=oe!==void 0?oe:Se||j==="combobox",ye=K||w(J);if(Object(b.a)(j!=="tags"||ye.every(function(Ae){return!Ae.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),j==="tags"||j==="combobox"){var xe=ye.some(function(Ae){return Ae.options?Ae.options.some(function(Le){return typeof("value"in Le?Le.value:Le.key)=="number"}):typeof("value"in Ae?Ae.value:Ae.key)=="number"});Object(b.a)(!xe,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(b.a)(j!=="combobox"||!Te,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(b.a)(j==="combobox"||!te,"`backfill` only works with `combobox` mode."),Object(b.a)(j==="combobox"||!de,"`getInputElement` only work with `combobox` mode."),Object(b.b)(j!=="combobox"||!de||!ve||!ue,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),me&&!be&&j!=="combobox"&&j!=="tags"&&Object(b.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(b.b)(!ae||fe,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ie!=null){var De=Object(m.d)(ie);Object(b.a)(!Q||De.every(function(Ae){return Object(l.a)(Ae)==="object"&&("key"in Ae||"value"in Ae)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(b.a)(!Se||Array.isArray(ie),"`value` should be array when `mode` is `multiple` or `tags`")}if(J){var Ie=null;Object(O.a)(J).some(function(Ae){if(!U.isValidElement(Ae)||!Ae.type)return!1;var Le=Ae.type;if(Le.isSelectOption)return!1;if(Le.isSelectOptGroup){var Ue=Object(O.a)(Ae.props.children).every(function(He){return!U.isValidElement(He)||!Ae.type||He.type.isSelectOption?!0:(Ie=He.type,!1)});return!Ue}return Ie=Le,!0}),Ie&&Object(b.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ie.displayName||Ie.name||Ie,"`.")),Object(b.a)(ee===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var k=y,I=Object(_.a)({prefixCls:"rc-select",components:{optionList:i},convertChildrenToData:w,flattenOptions:T.d,getLabeledValue:T.e,filterOptions:T.b,isValueDisabled:T.g,findValueOption:T.c,warningProps:k,fillOptionsWithMissingValue:T.a}),N=function(v){Object(D.a)(K,v);var j=Object(z.a)(K);function K(){var J;return Object(re.a)(this,K),J=j.apply(this,arguments),J.selectRef=U.createRef(),J.focus=function(){J.selectRef.current.focus()},J.blur=function(){J.selectRef.current.blur()},J}return Object(V.a)(K,[{key:"render",value:function(){return U.createElement(I,Object.assign({ref:this.selectRef},this.props))}}]),K}(U.Component);N.Option=h,N.OptGroup=S;var F=N,C=je.c=F},M8RZ:function(tt,je,q){"use strict";q.d(je,"a",function(){return P});var re=q("fWQN"),V=q("mtLc"),D=q("yKVA"),z=q("879j"),U=q("cDcd"),M=q.n(U),W=q("faye"),B=q.n(W),P=function(A){Object(D.a)(p,A);var g=Object(z.a)(p);function p(f){var d;Object(re.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(V.a)(p,[{key:"render",value:function(){var d=this.props.children;return Object(W.createPortal)(d,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),p}(M.a.Component)},Ot1p:function(tt,je,q){"use strict";var re=q("2qtc"),V=q("kLXV"),D=q("rAM+"),z=q("miYZ"),U=q("tsqr"),M=q("9og8"),W=q("tJVT"),B=q("jrin"),P=q("WmNS"),A=q.n(P),g=q("cDcd"),p=q.n(g),f=q("VrN/"),d=q.n(f),s=q("bdgK"),c=q("p77/"),o=q("Bd2K"),i=q("ELLl"),u=q("19Vz"),h=q("lZu9"),R=q("+NIl"),S=q("kSUc"),E=q("9Bee"),O=function(pe){var Re=pe.value,ke=Re===void 0?"":Re,Qe=pe.className,nt=pe.showTextOnly,rt=pe.showLines,Et=pe.style,ct=Et===void 0?{}:Et,st=Object(g.useMemo)(function(){return""},[ke]);return p.a.createElement(p.a.Fragment,null,p.a.createElement("div",{dangerouslySetInnerHTML:{__html:st}}))},x=q("0Owb"),w=q("dejd"),T=q("C+DQ"),_=q("1vsH"),l=q("m3rI"),b=[{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(pe){var Re=pe.onActionCallback,ke=pe.title,Qe=pe.icon,nt=pe.actionName,rt=pe.className,Et=rt===void 0?"":rt,ct=pe.children;function st(){Re(nt)}return p.a.createElement("a",{title:ke,className:Et,onClick:st},p.a.createElement("i",{className:"md-iconfont ".concat(Qe)}),ct)}var y=function(pe){var Re=pe.watch,ke=pe.showNullButton,Qe=pe.onActionCallback,nt=pe.fullScreen,rt=pe.insertTemp,Et=pe.hidetoolBar,ct=pe.uuid,st=pe.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(_.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(_.G)("_educoder_session"),"&key=").concat(ct,"&api=").concat(encodeURIComponent(l.a.PROXY_SERVER)));var Ot=[].concat(b,[{title:"".concat(Re?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Re?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return p.a.createElement("ul",{className:"markdown-toolbar-container"},!Et&&Ot.map(function(Tt,Bt){return p.a.createElement("li",{key:Bt},Tt.actionName?p.a.createElement(m,Object(x.a)({},Tt,{onActionCallback:Qe})):p.a.createElement("span",{className:"v-line"}))}),ke?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:Qe},p.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,rt&&p.a.createElement("li",null,p.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(rt),onActionCallback:Qe},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(nt?"icon-shrink":"icon-enlarge"),title:nt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Qe})))},k=q("M8RZ"),I=q("+L6B"),N=q("2/Rp"),F=q("y8nQ"),C=q("Vl3Y"),v=q("5NDa"),j=q("5rEg"),K={labelCol:{span:4},wrapperCol:{span:20}},J=function(pe){var Re=pe.callback,ke=pe.onCancel;function Qe(nt){Re(nt)}return p.a.createElement(C.a,Object(x.a)({},K,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Qe}),p.a.createElement(C.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},p.a.createElement(j.a,null)),p.a.createElement(C.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},p.a.createElement(j.a,null)),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(N.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(N.a,{type:"ghost",onClick:ke},"\u53D6\u6D88")))},te=q("7ahc"),ve=q("HmJG"),ue=q("BjJ7"),de=C.a.useForm,oe={width:280,marginRight:10},me={labelCol:{span:5},wrapperCol:{span:19}},ae=function(pe){var Re=pe.callback,ke=pe.onCancel,Qe=de(),nt=Object(W.a)(Qe,1),rt=nt[0];function Et(Ot){Re(Ot)}function ct(Ot,Tt){if(Ot.status===-1){U.b.error(Ot.message);return}rt.setFieldsValue({src:"/api/attachments/".concat(Ot.id),type:Tt.type})}function st(Ot){var Tt=Ot.target.files[0];Q(Tt,ct)}return p.a.createElement(C.a,Object(x.a)({form:rt},me,{className:"upload-image-panel",onFinish:Et}),p.a.createElement(C.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},p.a.createElement("div",{className:"flex-container"},p.a.createElement(C.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},p.a.createElement(j.a,{style:oe})),p.a.createElement(fe,{onFileChange:st}))),p.a.createElement(C.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},p.a.createElement(j.a,{style:{width:264}})),p.a.createElement(C.a.Item,{style:{textAlign:"right"}},p.a.createElement(N.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(N.a,{type:"ghost",onClick:ke},"\u53D6\u6D88")))};function fe(pe){var Re=pe.onFileChange;return p.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",p.a.createElement("input",{type:"file",onChange:Re}))}function Q(pe,Re){if(!pe)throw new String("\u6CA1\u6709\u6587\u4EF6");var ke=new FormData;ke.append("editormd-image-file",pe),ke.append("file_param_name","editormd-image-file"),ke.append("byxhr","true");var Qe=new window.XMLHttpRequest;Qe.withCredentials=!0,Qe.addEventListener("load",function(nt){Re(JSON.parse(nt.target.responseText),pe)},!1),Qe.addEventListener("error",function(nt){console.error(nt)},!1),Qe.open("POST","".concat(ue.a,"/api/attachments.json")),Qe.send(ke)}var ie=q("giR+"),ee=q("fyUT"),Te=q("7Kak"),Se=q("9yH6"),be=Se.a.Group,ye={margin:"0 8px"},xe=function(pe){var Re=pe.callback,ke=pe.onCancel;function Qe(nt){Re(nt)}return p.a.createElement(C.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Qe},p.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},p.a.createElement("span",{style:ye},"\u5355\u5143\u683C\u6570\uFF1A"),p.a.createElement("span",{style:ye},"\u884C\u6570"),p.a.createElement(C.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},p.a.createElement(ee.a,null)),p.a.createElement("span",{style:ye},"\u5217\u6570"),p.a.createElement(C.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},p.a.createElement(ee.a,null))),p.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},p.a.createElement("span",{style:ye},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),p.a.createElement(C.a.Item,{name:"align"},p.a.createElement(be,null,p.a.createElement(Se.a,{value:"default"},p.a.createElement("i",{className:"fa fa-align-justify"})),p.a.createElement(Se.a,{value:"left"},p.a.createElement("i",{className:"fa fa-align-left"})),p.a.createElement(Se.a,{value:"center"},p.a.createElement("i",{className:"fa fa-align-center"})),p.a.createElement(Se.a,{value:"right"},p.a.createElement("i",{className:"fa fa-align-right"}))))),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(N.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(N.a,{type:"ghost",onClick:ke},"\u53D6\u6D88")))},De=q("ErOA"),Ie=q("7Cbv"),Ae="link",Le="upload-image",Ue="code-block",He="add-table",We="------------",Fe={default:We,left:":".concat(We),center:":".concat(We,":"),right:"".concat(We,":")},Je=q("9VGf"),Ve,$e;function Ce(){}var qe=0,ze=1e4,Oe="\u2581",Me=`
|
|
**\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 _e(pe){return/^\d+$/.test(pe)?"".concat(pe,"px"):pe}var he=navigator.platform.toUpperCase().indexOf("MAC")>=0,ge=he?"Cmd":"Ctrl",Y=["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"],Z=(Ve={},Object(B.a)(Ve,ge+"-B","bold"),Object(B.a)(Ve,ge+"-I","italic"),Ve),ne=($e={},Object(B.a)($e,Ae,"\u6DFB\u52A0\u94FE\u63A5"),Object(B.a)($e,Ue,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(B.a)($e,Le,"\u6DFB\u52A0\u6587\u4EF6"),Object(B.a)($e,He,"\u6DFB\u52A0\u8868\u683C"),$e),le=je.a=function(pe){var Re=pe.defaultValue,ke=Re===void 0?"":Re,Qe=pe.onChange,nt=pe.width,rt=nt===void 0?"100%":nt,Et=pe.height,ct=Et===void 0?400:Et,st=pe.miniToolbar,Ot=st===void 0?!1:st,Tt=pe.isFocus,Bt=Tt===void 0?!1:Tt,Mt=pe.watch,yt=pe.insertTemp,pn=pe.mode,bn=pn===void 0?"markdown":pn,dt=pe.id,mt=dt===void 0?"markdown-editor-id":dt,xt=pe.showResizeBar,Dt=xt===void 0?!1:xt,Wt=pe.noStorage,qn=Wt===void 0?!1:Wt,Gr=pe.showNullButton,Nt=Gr===void 0?!1:Gr,it=pe.hidetoolBar,kn=it===void 0?!1:it,gr=pe.fullScreen,rn=gr===void 0?!1:gr,St=pe.onBlur,En=pe.onCMBeforeChange,Mn=pe.onFullScreen,vr=pe.className,Be=vr===void 0?"":vr,ht=pe.disablePaste,zr=ht===void 0?!1:ht,_r=pe.placeholder,yr=_r===void 0?"":_r,er=pe.values,br=er===void 0?"":er,pt=Object(g.useState)(null),Ai=Object(W.a)(pt,2),Ke=Ai[0],Er=Ai[1],_n=Object(g.useState)(ke),Vr=Object(W.a)(_n,2),tr=Vr[0],Tn=Vr[1],Xr=Object(g.useState)(Mt),Yr=Object(W.a)(Xr,2),xn=Yr[0],$r=Yr[1],Ri=Object(g.useState)(rn),Qr=Object(W.a)(Ri,2),wn=Qr[0],Ci=Qr[1],aa=Object(g.useState)(""),Jr=Object(W.a)(aa,2),en=Jr[0],Kn=Jr[1],sa=Object(g.useState)(0),nr=Object(W.a)(sa,2),Sn=nr[0],Zr=nr[1],oa=Object(g.useState)(ct),Li=Object(W.a)(oa,2),Ii=Li[0],Tr=Li[1],Di=Object(g.useState)(!1),Pi=Object(W.a)(Di,2),la=Pi[0],xr=Pi[1],rr=Object(g.useRef)(Object(Ie.a)()),ir=Object(g.useRef)(!1),wr=Object(g.useRef)(),Nn=Object(g.useRef)(),Fn=Object(g.useRef)(),Un=Object(g.useRef)(),Sr=Object(g.useRef)(),ki=function(){var at=Object(M.a)(A.a.mark(function ft(){var lt,vt;return A.a.wrap(function(Lt){for(;;)switch(Lt.prev=Lt.next){case 0:return Lt.next=2,Object(De.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:rr.current}});case 2:vt=Lt.sent,vt!=null&&(lt=vt.attachments)!==null&<!==void 0&<.length&&(console.log("cm:",Ke,Nn),vt.attachments.map(function(bt){bt.content_type.indexOf("image")>-1?Ke.replaceSelection(".concat(bt.content_type,")")):bt.content_type.indexOf("video")>-1?Ke.replaceSelection('<video width="100%" controls src="'.concat(l.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):bt.content_type.indexOf("pdf")>-1?Ke.replaceSelection('<a href="'.concat(l.a.API_SERVER,"/api/attachments/").concat(bt.id,"?type=").concat(bt.content_type,'&disposition=inline" target="_blank">').concat(bt.name,"</a>")):Ke.replaceSelection("[".concat(bt.name,"](").concat(l.a.API_SERVER,"/api/attachments/").concat(bt.id,"?type=").concat(bt.content_type,")"))}));case 4:case"end":return Lt.stop()}},ft)}));return function(){return at.apply(this,arguments)}}();Object(g.useEffect)(function(){Tn(br),Ke==null||Ke.setValue(br)},[br]),Object(g.useEffect)(function(){Mn==null||Mn(wn)},[wn]),Object(g.useEffect)(function(){if(Nn.current){var at=d.a.fromTextArea(Nn.current,{mode:bn,lineNumbers:!Ot,lineWrapping:!0,value:ke,autoCloseTags:!0,autoCloseBrackets:!0});Bt&&at.focus();function ft(lt,vt){if(zr){vt.preventDefault();return}var wt=vt.clipboardData;if(wt){var Lt=wt.types.toString(),bt=wt.items;if(Lt==="Files"||wt.types.indexOf("Files")>-1){if(vt.preventDefault(),bn=="stex")return;try{var Kt,an=bt[1];((Kt=bt[0])===null||Kt===void 0?void 0:Kt.kind)==="file"&&(an=bt[0]);var _t=an.getAsFile(),Bn=_t.name.split(".").pop();Q(_t,function(At){if(At.id){var sn,Jt,yn;(_t==null||((sn=_t.type)===null||sn===void 0)?void 0:sn.indexOf("image"))>-1?at.replaceSelection(".concat(At.content_type,")")):(_t==null||((Jt=_t.type)===null||Jt===void 0)?void 0:Jt.indexOf("video"))>-1?at.replaceSelection('<video width="100%" controls src="'.concat(l.a.API_SERVER,"/api/attachments/").concat(At.id,'"></video>')):(_t==null||((yn=_t.type)===null||yn===void 0)?void 0:yn.indexOf("pdf"))>-1?at.replaceSelection('<a href="'.concat(l.a.API_SERVER,"/api/attachments/").concat(At.id,"?type=").concat(_t.type,'&disposition=inline" target="_blank">').concat(_t.name,"</a>")):Y.includes(Bn)?at.replaceSelection('<a href="'.concat(l.a.API_SERVER,"/api/attachments/").concat(At.id,'?type=office&disposition=inline" target="_blank">').concat(_t.name,"</a>")):at.replaceSelection("[".concat(_t.name,"](").concat(l.a.API_SERVER,"/api/attachments/").concat(At.id,"?type=").concat(At.content_type,")"))}else(At==null?void 0:At.status)===401&&(document.location.href="/user/login")})}catch(At){U.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return at.on("paste",ft),at.on("dragleave",function(lt,vt){Fn.current.classList.remove("mouse-hover-md")}),at.on("dragover",function(lt,vt){Fn.current.classList.add("mouse-hover-md")}),at.on("drop",function(lt,vt){Fn.current.classList.add("mouse-hover-md");var wt;if(wt=vt.dataTransfer.files,wt.length>0){vt.preventDefault(),vt.stopPropagation();for(var Lt=function(an){var _t=wt[an],Bn=_t.name.split(".").pop();Q(_t,function(At){if(At.id){var sn,Jt,yn;(_t==null||((sn=_t.type)===null||sn===void 0)?void 0:sn.indexOf("image"))>-1?at.replaceSelection(".concat(At.content_type,")")):(_t==null||((Jt=_t.type)===null||Jt===void 0)?void 0:Jt.indexOf("video"))>-1?at.replaceSelection('<video width="100%" controls src="'.concat(l.a.API_SERVER,"/api/attachments/").concat(At.id,'"></video>')):(_t==null||((yn=_t.type)===null||yn===void 0)?void 0:yn.indexOf("pdf"))>-1?at.replaceSelection('<a href="'.concat(l.a.API_SERVER,"/api/attachments/").concat(At.id,"?type=").concat(_t.type,'&disposition=inline" target="_blank">').concat(_t.name,"</a>")):Y.includes(Bn)?at.replaceSelection('<a href="'.concat(l.a.API_SERVER,"/api/attachments/").concat(At.id,'?type=office&disposition=inline" target="_blank">').concat(_t.name,"</a>")):at.replaceSelection("[".concat(_t.name,"](").concat(l.a.API_SERVER,"/api/attachments/").concat(At.id,"?type=").concat(At.content_type,")"))}else(At==null?void 0:At.status)===401&&(document.location.href="/user/login")})},bt=0;bt<wt.length;bt++)Lt(bt)}}),Er(at),function(){at.off("paste",ft)}}},[]);var mn=Object(g.useCallback)(function(){if(Fn.current)try{}catch(at){console.log(at,"---- to set md editor body height")}},[Ii,Fn,wn]);Object(g.useEffect)(function(){function at(){var lt=new s.default(function(vt){var wt=Object(D.a)(vt),Lt;try{for(wt.s();!(Lt=wt.n()).done;){var bt=Lt.value;(bt.target.offsetHeight>0||bt.target.offsetWidth>0)&&(mn(),Ke.setSize("100%","100%"),Ke.refresh())}}catch(Kt){wt.e(Kt)}finally{wt.f()}});return lt.observe(Nn.current.parentElement),lt}if(Ke){var ft=at();return function(){ft.unobserve(Nn.current.parentElement)}}},[Ke,mn]),Object(g.useEffect)(function(){if(Ke){for(var at=[],ft=function(){var bt=vt[lt];wt=Object(W.a)(bt,2);var Kt=wt[0],an=wt[1],_t=Object(B.a)({},Kt,function(){Mi(an)});at.push(_t),Ke.addKeyMap(_t)},lt=0,vt=Object.entries(Z);lt<vt.length;lt++){var wt;ft()}return wr.current=setInterval(function(){ir.current&&ki()},4e3),function(){clearInterval(wr.current);var Lt=Object(D.a)(at),bt;try{for(Lt.s();!(bt=Lt.n()).done;){var Kt=bt.value;Ke.removeKeyMap(Kt)}}catch(an){Lt.e(an)}finally{Lt.f()}}}},[Ke]),Object(g.useEffect)(function(){rn!==wn&&Ci(rn)},[rn]),Object(Je.a)(function(){if(!qn&&Sn>0){var at=new Date().getTime(),ft=window.sessionStorage.getItem(mt);at>=Sn+ze&&(!ft||ft!==tr)&&(window.sessionStorage.setItem(mt,tr),xr(!0))}},ze),Object(g.useEffect)(function(){$r(Mt)},[Ke,Mt]),Object(g.useEffect)(function(){Ke&&(Bt&&Ke.focus())},[Ke,Bt]),Object(g.useEffect)(function(){if(xn&&Ke){var at=Ke.getScrollerElement();function ft(lt){var vt=lt.target;if(Sr.current){var wt=vt.scrollTop/vt.scrollHeight;Sr.current.scrollTop=Sr.current.scrollHeight*wt}}return at.addEventListener("scroll",ft),function(){at.removeEventListener("scroll",ft)}}},[Ke,xn]),Object(g.useEffect)(function(){if(Ke&&En){function at(ft,lt){En(ft,lt)}return Ke.on("beforeChange",at),function(){Ke.off("beforeChange",at)}}},[Ke,En]),Object(g.useEffect)(function(){if(Ke&&St){function at(){St(Ke.getValue())}return Ke.on("blur",at),function(){Ke.off("blur",at)}}},[Ke,St]),Object(g.useEffect)(function(){if(Ke){function at(ft){var lt=ft.getValue();Tn(lt),Zr(new Date().getTime()),ft.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Qe&&Qe(lt)}return Ke.on("change",at),function(){Ke.off("change",at)}}},[Ke,Qe]),Object(g.useEffect)(function(){Ke&&(ke==null?(Ke.setValue(""),Tn("")):ke!==Ke.getValue()&&(Ke.setValue(ke),Tn(ke),Ke.setCursor(Ke.lineCount(),0)))},[Ke,ke]);var Mi=Object(g.useCallback)(function(at){var ft=Ke.getCursor(),lt=Ke.getSelection(),vt=lt.split(`
|
|
`);switch(at){case"bold":return Ke.replaceSelection("**"+lt+"**"),lt===""&&Ke.setCursor(ft.line,ft.ch+2),Ke.focus();case"italic":return Ke.replaceSelection("*"+lt+"*"),lt===""&&Ke.setCursor(ft.line,ft.ch+1),Ke.focus();case"code":return Ke.replaceSelection("`"+lt+"`"),lt===""&&Ke.setCursor(ft.line,ft.ch+1),Ke.focus();case"inline-latex":return Ke.replaceSelection("`$$"+lt+"$$`"),lt===""&&Ke.setCursor(ft.line,ft.ch+3),Ke.focus();case"latex":return Ke.replaceSelection("```latex\n"+lt+"\n```"),Ke.setCursor(ft.line+1,lt.length+1),Ke.focus();case"line-break":return Ke.replaceSelection(`<br/>
|
|
`),Ke.focus();case"list-ul":return lt===""?Ke.replaceSelection("- "+lt):Ke.replaceSelection(vt.map(function(wt){return wt===""?"":"- ".concat(wt)}).join(`
|
|
`)),Ke.focus();case"list-ol":return lt===""?Ke.replaceSelection("1. "+lt):Ke.replaceSelection(vt.map(function(wt,Lt){return wt===""?"":"".concat(Lt+1,". ").concat(wt)}).join(`
|
|
`)),Ke.focus();case"add-null-ch":return lt===""&&Ke.setCursor(ft.line,ft.ch+1),Ke.replaceSelection(Oe),Ke.focus();case"inster-template-1":return lt===""&&Ke.setCursor(ft.line,ft.ch),Ke.replaceSelection(Me),Ke.focus();case"eraser":return Ke.setValue(""),Ke.focus();case"trigger-watch":return $r(!xn),Ke.focus();case"trigger-full-screen":return Ci(!wn),Ke.focus();case Ae:Kn(Ae);return;case Ue:Kn(Ue);return;case Le:Kn(Le);return;case He:Kn(He);return;default:throw new Error}},[Ke,xn,wn]),Or=Object(g.useCallback)(function(at){Kn("");switch(en){case Ae:var ft=at.title,lt=at.link;return Ke.replaceSelection("[".concat(ft,"](").concat(lt,")")),Ke.focus();case Ue:var vt=at.language,wt=at.content;return Ke.replaceSelection(["```"+vt,wt,"```"].join(`
|
|
`)),Ke.focus();case Le:var Lt=at.src,bt=at.alt;return bt?Ke.replaceSelection(".concat(Lt,' "').concat(bt,'" )')):Ke.replaceSelection("")),Ke.focus();case He:for(var Kt=at.row,an=at.col,_t=at.align,Bn=`
|
|
`,At=0;At<Kt;At++){for(var sn=[],Jt=[],yn=0;yn<an;yn++)At===1&&Jt.push(Fe[_t]),sn.push(" ");At===1&&(Bn+="| ".concat(Jt.join(" | "),` |
|
|
`)),Bn+="| ".concat(sn.join(an===1?"":" | "),` |
|
|
`)}return Ke.replaceSelection(Bn+`
|
|
`),Ke.focus();default:throw new Error}},[Ke,en]),qr=Object(g.useMemo)(function(){switch(en){case Ae:return p.a.createElement(J,{callback:Or,onCancel:Gn});case Ue:return p.a.createElement(te.b,{callback:Or,onCancel:Gn});case Le:return p.a.createElement(ae,{callback:Or,onCancel:Gn});case He:return p.a.createElement(xe,{callback:Or,onCancel:Gn});default:return null}},[en]);function Gn(){Kn("")}Object(g.useEffect)(function(){if(Un.current){var at=Un.current,ft=!1,lt=0;function vt(bt){ft=!0,lt=bt.pageY}function wt(){ft=!1}function Lt(bt){if(ft){var Kt=bt.pageY-lt;Kt<0&&(Kt=0),Kt>300&&(Kt=300);var an=ct+Kt+"px";Tr(an)}}return at.addEventListener("mousedown",vt),document.addEventListener("mousemove",Lt),document.addEventListener("mouseup",wt),function(){at.removeEventListener("mousedown",vt),document.removeEventListener("mousemove",Lt),document.removeEventListener("mouseup",wt)}}},[Ke,Un]),Object(g.useEffect)(function(){Tr(ct)},[ct]);var Ln=_e(rt),ei=_e(Ii),On={width:Ln,height:ei},ti=Object(g.useMemo)(function(){if(Sn){var at=new Date(Sn),ft=at.getHours(),lt=at.getMinutes(),vt=at.getSeconds();return ft=ft<10?"0"+ft:ft,lt=lt<10?"0"+lt:lt,vt=vt<10?"0"+vt:vt,"".concat(ft,":").concat(lt,":").concat(vt)}return 0},[Sn]);function Ni(){window.sessionStorage.removeItem(mt),xr(!1),Zr(0)}function ar(){xr(!1),Zr(0),Ke.setValue(window.sessionStorage.getItem(mt))}function ua(at,ft){var lt=Ke.getValue();lt=lt.replace(at,ft),Tn(lt),Ke==null||Ke.setValue(lt)}return p.a.createElement(g.Fragment,null,p.a.createElement("div",{className:"markdown-editor-wrapper",ref:Fn},p.a.createElement("div",{className:"markdown-editor-container ".concat(Be," ").concat(xn?"on-preview":""," ").concat(Ot?"mini":""," ").concat(wn?"full-screen":""),style:On},p.a.createElement(y,{insertTemp:yt,watch:xn,fullScreen:wn,showNullButton:Nt,onActionCallback:Mi,hidetoolBar:kn,uuid:rr.current,setOpenPhones:function(){ir.current=!0}}),p.a.createElement("div",{className:"markdown-editor-body"},p.a.createElement("div",{className:"codemirror-container"},p.a.createElement("textarea",{ref:Nn,placeholder:yr})),xn?p.a.createElement("div",{ref:Sr,className:"preview-container"},bn==="stex"&&p.a.createElement(O,{value:tr}),bn!=="stex"&&p.a.createElement(E.a,{edit:!0,value:tr,replaces:ua})):null))),Dt?p.a.createElement("a",{ref:Un,className:"editor-resize"}):null,p.a.createElement(k.a,null,ne[en]?p.a.createElement(V.a,{centered:!0,title:ne[en],visible:!0,onCancel:Gn,footer:null,className:"markdown-popup-form"},qr):null))}},SJMd:function(tt,je){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var q,re,V,D=!1,z,U;window.PR_SHOULD_USE_CONTINUATION=!0;var M,W;(function(){var B=window,P=["break,continue,do,else,for,if,return,while"],A=[P,"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=[A,"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"],o="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",i=[P,"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"],u=[P,"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=[P,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],R=[p,d,f,c,o,i,u,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/,E="str",O="kwd",x="com",w="typ",T="lit",_="pun",l="pln",b="tag",m="dec",y="src",k="atn",I="atv",N="nocode",F="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function C(be){for(var ye=0,xe=!1,De=!1,Ie=0,Ae=be.length;Ie<Ae;++Ie){var Le=be[Ie];if(Le.ignoreCase)De=!0;else if(/[a-z]/i.test(Le.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){xe=!0,De=!1;break}}var Ue={b:8,t:9,n:10,v:11,f:12,r:13};function He($e){var Ce=$e.charCodeAt(0);if(Ce!==92)return Ce;var qe=$e.charAt(1);return Ce=Ue[qe],Ce||("0"<=qe&&qe<="7"?parseInt($e.substring(1),8):qe==="u"||qe==="x"?parseInt($e.substring(2),16):$e.charCodeAt(1))}function We($e){if($e<32)return($e<16?"\\x0":"\\x")+$e.toString(16);var Ce=String.fromCharCode($e);return Ce==="\\"||Ce==="-"||Ce==="]"||Ce==="^"?"\\"+Ce:Ce}function Fe($e){var Ce=$e.substring(1,$e.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")),qe=[],ze=Ce[0]==="^",Oe=["["];ze&&Oe.push("^");for(var Me=ze?1:0,_e=Ce.length;Me<_e;++Me){var he=Ce[Me];if(/\\[bdsw]/i.test(he))Oe.push(he);else{var ge=He(he),Y;Me+2<_e&&Ce[Me+1]==="-"?(Y=He(Ce[Me+2]),Me+=2):Y=ge,qe.push([ge,Y]),Y<65||ge>122||(Y<65||ge>90||qe.push([Math.max(65,ge)|32,Math.min(Y,90)|32]),Y<97||ge>122||qe.push([Math.max(97,ge)&~32,Math.min(Y,122)&~32]))}}qe.sort(function(pe,Re){return pe[0]-Re[0]||Re[1]-pe[1]});for(var Z=[],ne=[],Me=0;Me<qe.length;++Me){var le=qe[Me];le[0]<=ne[1]+1?ne[1]=Math.max(ne[1],le[1]):Z.push(ne=le)}for(var Me=0;Me<Z.length;++Me){var le=Z[Me];Oe.push(We(le[0])),le[1]>le[0]&&(le[1]+1>le[0]&&Oe.push("-"),Oe.push(We(le[1])))}return Oe.push("]"),Oe.join("")}function Je($e){for(var Ce=$e.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")),qe=Ce.length,ze=[],Oe=0,Me=0;Oe<qe;++Oe){var _e=Ce[Oe];if(_e==="(")++Me;else if(_e.charAt(0)==="\\"){var he=+_e.substring(1);he&&(he<=Me?ze[he]=-1:Ce[Oe]=We(he))}}for(var Oe=1;Oe<ze.length;++Oe)ze[Oe]===-1&&(ze[Oe]=++ye);for(var Oe=0,Me=0;Oe<qe;++Oe){var _e=Ce[Oe];if(_e==="(")++Me,ze[Me]||(Ce[Oe]="(?:");else if(_e.charAt(0)==="\\"){var he=+_e.substring(1);he&&he<=Me&&(Ce[Oe]="\\"+ze[he])}}for(var Oe=0;Oe<qe;++Oe)Ce[Oe]==="^"&&Ce[Oe+1]!=="^"&&(Ce[Oe]="");if($e.ignoreCase&&xe)for(var Oe=0;Oe<qe;++Oe){var _e=Ce[Oe],ge=_e.charAt(0);_e.length>=2&&ge==="["?Ce[Oe]=Fe(_e):ge!=="\\"&&(Ce[Oe]=_e.replace(/[a-zA-Z]/g,function(ne){var le=ne.charCodeAt(0);return"["+String.fromCharCode(le&~32,le|32)+"]"}))}return Ce.join("")}for(var Ve=[],Ie=0,Ae=be.length;Ie<Ae;++Ie){var Le=be[Ie];if(Le.global||Le.multiline)throw new Error(""+Le);Ve.push("(?:"+Je(Le)+")")}return new RegExp(Ve.join("|"),De?"gi":"g")}function v(be,ye){var xe=/(?:^|\s)nocode(?:\s|$)/,De=[],Ie=0,Ae=[],Le=0;function Ue(He){var We=He.nodeType;if(We==1){if(xe.test(He.className))return;for(var Fe=He.firstChild;Fe;Fe=Fe.nextSibling)Ue(Fe);var Je=He.nodeName.toLowerCase();(Je==="br"||Je==="li")&&(De[Le]=`
|
|
`,Ae[Le<<1]=Ie++,Ae[Le++<<1|1]=He)}else if(We==3||We==4){var Ve=He.nodeValue;Ve.length&&(ye?Ve=Ve.replace(/\r\n?/g,`
|
|
`):Ve=Ve.replace(/[ \t\r\n]+/g," "),De[Le]=Ve,Ae[Le<<1]=Ie,Ie+=Ve.length,Ae[Le++<<1|1]=He)}}return Ue(be),{sourceCode:De.join("").replace(/\n$/,""),spans:Ae}}function j(be,ye,xe,De,Ie){if(!xe)return;var Ae={sourceNode:be,pre:1,langExtension:null,numberLines:null,sourceCode:xe,spans:null,basePos:ye,decorations:null};De(Ae),Ie.push.apply(Ie,Ae.decorations)}var K=/\S/;function J(be){for(var ye=void 0,xe=be.firstChild;xe;xe=xe.nextSibling){var De=xe.nodeType;ye=De===1?ye?be:xe:De===3&&K.test(xe.nodeValue)?be:ye}return ye===be?void 0:ye}function te(be,ye){var xe={},De;(function(){for(var Le=be.concat(ye),Ue=[],He={},We=0,Fe=Le.length;We<Fe;++We){var Je=Le[We],Ve=Je[3];if(Ve)for(var $e=Ve.length;--$e>=0;)xe[Ve.charAt($e)]=Je;var Ce=Je[1],qe=""+Ce;He.hasOwnProperty(qe)||(Ue.push(Ce),He[qe]=null)}Ue.push(/[\0-\uffff]/),De=C(Ue)})();var Ie=ye.length,Ae=function(Le){for(var Ue=Le.sourceCode,He=Le.basePos,We=Le.sourceNode,Fe=[He,l],Je=0,Ve=Ue.match(De)||[],$e={},Ce=0,qe=Ve.length;Ce<qe;++Ce){var ze=Ve[Ce],Oe=$e[ze],Me=void 0,_e;if(typeof Oe=="string")_e=!1;else{var he=xe[ze.charAt(0)];if(he)Me=ze.match(he[1]),Oe=he[0];else{for(var ge=0;ge<Ie;++ge)if(he=ye[ge],Me=ze.match(he[1]),Me){Oe=he[0];break}Me||(Oe=l)}_e=Oe.length>=5&&Oe.substring(0,5)==="lang-",_e&&!(Me&&typeof Me[1]=="string")&&(_e=!1,Oe=y),_e||($e[ze]=Oe)}var Y=Je;if(Je+=ze.length,!_e)Fe.push(He+Y,Oe);else{var Z=Me[1],ne=ze.indexOf(Z),le=ne+Z.length;Me[2]&&(le=ze.length-Me[2].length,ne=le-Z.length);var pe=Oe.substring(5);j(We,He+Y,ze.substring(0,ne),Ae,Fe),j(We,He+Y+ne,Z,fe(pe,Z),Fe),j(We,He+Y+le,ze.substring(le),Ae,Fe)}}Le.decorations=Fe};return Ae}function ve(be){var ye=[],xe=[];be.tripleQuotedStrings?ye.push([E,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):be.multiLineStrings?ye.push([E,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):ye.push([E,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),be.verbatimStrings&&xe.push([E,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var De=be.hashComments;De&&(be.cStyleComments?(De>1?ye.push([x,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):ye.push([x,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),xe.push([E,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):ye.push([x,/^#[^\r\n]*/,null,"#"])),be.cStyleComments&&(xe.push([x,/^\/\/[^\r\n]*/,null]),xe.push([x,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ie=be.regexLiterals;if(Ie){var Ae=Ie>1?"":`
|
|
\r`,Le=Ae?".":"[\\S\\s]",Ue="/(?=[^/*"+Ae+"])(?:[^/\\x5B\\x5C"+Ae+"]|\\x5C"+Le+"|\\x5B(?:[^\\x5C\\x5D"+Ae+"]|\\x5C"+Le+")*(?:\\x5D|$))+/";xe.push(["lang-regex",RegExp("^"+F+"("+Ue+")")])}var He=be.types;He&&xe.push([w,He]);var We=(""+be.keywords).replace(/^ | $/g,"");We.length&&xe.push([O,new RegExp("^(?:"+We.replace(/[\s,]+/g,"|")+")\\b"),null]),ye.push([l,/^\s+/,null,` \r
|
|
\xA0`]);var Fe="^.[^\\s\\w.$@'\"`/\\\\]*";return be.regexLiterals&&(Fe+="(?!s*/)"),xe.push([T,/^@[a-z_$][a-z_$@0-9]*/i,null],[w,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[l,/^[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"],[l,/^\\[\s\S]?/,null],[_,new RegExp(Fe),null]),te(ye,xe)}var ue=ve({keywords:R,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function de(be,ye,xe){for(var De=/(?:^|\s)nocode(?:\s|$)/,Ie=/\r\n?|\n/,Ae=be.ownerDocument,Le=Ae.createElement("li");be.firstChild;)Le.appendChild(be.firstChild);var Ue=[Le];function He(Ce){var qe=Ce.nodeType;if(qe==1&&!De.test(Ce.className))if(Ce.nodeName==="br")We(Ce),Ce.parentNode&&Ce.parentNode.removeChild(Ce);else for(var ze=Ce.firstChild;ze;ze=ze.nextSibling)He(ze);else if((qe==3||qe==4)&&xe){var Oe=Ce.nodeValue,Me=Oe.match(Ie);if(Me){var _e=Oe.substring(0,Me.index);Ce.nodeValue=_e;var he=Oe.substring(Me.index+Me[0].length);if(he){var ge=Ce.parentNode;ge.insertBefore(Ae.createTextNode(he),Ce.nextSibling)}We(Ce),_e||Ce.parentNode.removeChild(Ce)}}}function We(Ce){for(;!Ce.nextSibling;)if(Ce=Ce.parentNode,!Ce)return;function qe(Me,_e){var he=_e?Me.cloneNode(!1):Me,ge=Me.parentNode;if(ge){var Y=qe(ge,1),Z=Me.nextSibling;Y.appendChild(he);for(var ne=Z;ne;ne=Z)Z=ne.nextSibling,Y.appendChild(ne)}return he}for(var ze=qe(Ce.nextSibling,0),Oe;(Oe=ze.parentNode)&&Oe.nodeType===1;)ze=Oe;Ue.push(ze)}for(var Fe=0;Fe<Ue.length;++Fe)He(Ue[Fe]);ye===(ye|0)&&Ue[0].setAttribute("value",ye);var Je=Ae.createElement("ol");Je.className="linenums";for(var Ve=Math.max(0,ye-1|0)||0,Fe=0,$e=Ue.length;Fe<$e;++Fe)Le=Ue[Fe],Le.className="L"+(Fe+Ve)%10,Le.firstChild||Le.appendChild(Ae.createTextNode("\xA0")),Je.appendChild(Le);be.appendChild(Je)}function oe(be){var ye=/\bMSIE\s(\d+)/.exec(navigator.userAgent);ye=ye&&+ye[1]<=8;var xe=/\n/g,De=be.sourceCode,Ie=De.length,Ae=0,Le=be.spans,Ue=Le.length,He=0,We=be.decorations,Fe=We.length,Je=0;We[Fe]=Ie;var Ve,$e;for($e=Ve=0;$e<Fe;)We[$e]!==We[$e+2]?(We[Ve++]=We[$e++],We[Ve++]=We[$e++]):$e+=2;for(Fe=Ve,$e=Ve=0;$e<Fe;){for(var Ce=We[$e],qe=We[$e+1],ze=$e+2;ze+2<=Fe&&We[ze+1]===qe;)ze+=2;We[Ve++]=Ce,We[Ve++]=qe,$e=ze}Fe=We.length=Ve;var Oe=be.sourceNode,Me="";Oe&&(Me=Oe.style.display,Oe.style.display="none");try{for(var _e=null;He<Ue;){var he=Le[He],ge=Le[He+2]||Ie,Y=We[Je+2]||Ie,ze=Math.min(ge,Y),Z=Le[He+1],ne;if(Z.nodeType!==1&&(ne=De.substring(Ae,ze))){ye&&(ne=ne.replace(xe,"\r")),Z.nodeValue=ne;var le=Z.ownerDocument,pe=le.createElement("span");pe.className=We[Je+1];var Re=Z.parentNode;Re.replaceChild(pe,Z),pe.appendChild(Z),Ae<ge&&(Le[He+1]=Z=le.createTextNode(De.substring(ze,ge)),Re.insertBefore(Z,pe.nextSibling))}Ae=ze,Ae>=ge&&(He+=2),Ae>=Y&&(Je+=2)}}finally{Oe&&(Oe.style.display=Me)}}var me={};function ae(be,ye){for(var xe=ye.length;--xe>=0;){var De=ye[xe];me.hasOwnProperty(De)?B.console&&console.warn("cannot override language handler %s",De):me[De]=be}}function fe(be,ye){return be&&me.hasOwnProperty(be)||(be=/^\s*</.test(ye)?"default-markup":"default-code"),me[be]}ae(ue,["default-code"]),ae(te([],[[l,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[x,/^<\!--[\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"]),ae(te([[l,/^[\s]+/,null,` \r
|
|
`],[I,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[b,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[k,/^(?!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"]),ae(te([],[[I,/^[\s\S]+/]]),["uq.val"]),ae(ve({keywords:p,hashComments:!0,cStyleComments:!0,types:S}),["c","cc","cpp","cxx","cyc","m"]),ae(ve({keywords:"null,true,false"}),["json"]),ae(ve({keywords:d,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:S}),["cs"]),ae(ve({keywords:f,cStyleComments:!0}),["java"]),ae(ve({keywords:h,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ae(ve({keywords:i,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ae(ve({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ae(ve({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ae(ve({keywords:c,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ae(ve({keywords:s,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ae(te([],[[E,/^[\s\S]+/]]),["regex"]);function Q(be){var ye=be.langExtension;try{var xe=v(be.sourceNode,be.pre),De=xe.sourceCode;be.sourceCode=De,be.spans=xe.spans,be.basePos=0,fe(ye,De)(be),oe(be)}catch(Ie){B.console&&console.log(Ie&&Ie.stack||Ie)}}function ie(be,ye,xe){var De=xe||!1,Ie=ye||null,Ae=document.createElement("div");Ae.innerHTML="<pre>"+be+"</pre>",Ae=Ae.firstChild,De&&de(Ae,De,!0);var Le={langExtension:Ie,numberLines:De,sourceNode:Ae,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Q(Le),Ae.innerHTML}function ee(be,ye){var xe=ye||document.body,De=xe.ownerDocument||document;function Ie(he){return xe.getElementsByTagName(he)}for(var Ae=[Ie("pre"),Ie("code"),Ie("xmp")],Le=[],Ue=0;Ue<Ae.length;++Ue)for(var He=0,We=Ae[Ue].length;He<We;++He)Le.push(Ae[Ue][He]);Ae=null;var Fe=Date;Fe.now||(Fe={now:function(){return+new Date}});var Je=0,Ve=/\blang(?:uage)?-([\w.]+)(?!\S)/,$e=/\bprettyprint\b/,Ce=/\bprettyprinted\b/,qe=/pre|xmp/i,ze=/^code$/i,Oe=/^(?:pre|code|xmp)$/i,Me={};function _e(){for(var he=B.PR_SHOULD_USE_CONTINUATION?Fe.now()+250:Infinity;Je<Le.length&&Fe.now()<he;Je++){for(var ge=Le[Je],Y=Me,Z=ge;Z=Z.previousSibling;){var ne=Z.nodeType,le=(ne===7||ne===8)&&Z.nodeValue;if(le?!/^\??prettify\b/.test(le):ne!==3||/\S/.test(Z.nodeValue))break;if(le){Y={},le.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Mt,yt,pn){Y[yt]=pn});break}}var pe=ge.className;if((Y!==Me||$e.test(pe))&&!Ce.test(pe)){for(var Re=!1,ke=ge.parentNode;ke;ke=ke.parentNode){var Qe=ke.tagName;if(Oe.test(Qe)&&ke.className&&$e.test(ke.className)){Re=!0;break}}if(!Re){ge.className+=" prettyprinted";var nt=Y.lang;if(!nt){nt=pe.match(Ve);var rt;!nt&&(rt=J(ge))&&ze.test(rt.tagName)&&(nt=rt.className.match(Ve)),nt&&(nt=nt[1])}var Et;if(qe.test(ge.tagName))Et=1;else{var ct=ge.currentStyle,st=De.defaultView,Ot=ct?ct.whiteSpace:st&&st.getComputedStyle?st.getComputedStyle(ge,null).getPropertyValue("white-space"):0;Et=Ot&&Ot.substring(0,3)==="pre"}var Tt=Y.linenums;(Tt=Tt==="true"||+Tt)||(Tt=pe.match(/\blinenums\b(?::(\d+))?/),Tt=Tt?Tt[1]&&Tt[1].length?+Tt[1]:!0:!1),Tt&&de(ge,Tt,Et);var Bt={langExtension:nt,sourceNode:ge,numberLines:Tt,pre:Et,sourceCode:null,basePos:null,spans:null,decorations:null};Q(Bt)}}}Je<Le.length?B.setTimeout(_e,250):typeof be=="function"&&be()}_e()}var Te=B.PR={createSimpleLexer:te,registerLangHandler:ae,sourceDecorator:ve,PR_ATTRIB_NAME:k,PR_ATTRIB_VALUE:I,PR_COMMENT:x,PR_DECLARATION:m,PR_KEYWORD:O,PR_LITERAL:T,PR_NOCODE:N,PR_PLAIN:l,PR_PUNCTUATION:_,PR_SOURCE:y,PR_STRING:E,PR_TAG:b,PR_TYPE:w,prettyPrintOne:D?B.prettyPrintOne=ie:M=ie,prettyPrint:W=D?B.prettyPrint=ee:W=ee},Se=B.define;typeof Se=="function"&&Se.amd&&Se("google-code-prettify",[],function(){return Te})})()},TXwP:function(tt,je,q){var re,V;(function(){var D;(function(){"use strict";var U=[,,function(P){function A(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=[]}A.prototype.clone_empty=function(){var f=new A(this.__parent);return f.set_indent(this.__indent_count,this.__alignment_count),f},A.prototype.item=function(f){return f<0?this.__items[this.__items.length+f]:this.__items[f]},A.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},A.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))},A.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)},A.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},A.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},A.prototype.is_empty=function(){return this.__items.length===0},A.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},A.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},A.prototype.pop=function(){var f=null;return this.is_empty()||(f=this.__items.pop(),this.__character_count-=f.length),f},A.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},A.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},A.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},A.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 A(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 A(this)),this.previous_line=this.__lines[this.__lines.length-2];break}s--}},P.exports.Output=p},,,,function(P){function A(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"])}A.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},A.prototype._get_boolean=function(f,d){var s=this.raw_options[f],c=s===void 0?!!d:!!s;return c},A.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},A.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},A.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]},A.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},A.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}P.exports.Options=A,P.exports.normalizeOpts=p,P.exports.mergeOpts=g},,function(P){var A=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&&!(A&&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&&A&&(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},P.exports.InputScanner=g},,,,,function(P){function A(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")}A.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},A.prototype.readIgnored=function(g){return g.readUntilAfter(this.__directives_end_ignore_pattern)},P.exports.Directives=A},,function(P,A,g){var p=g(16).Beautifier,f=g(17).Options;function d(s,c){var o=new p(s,c);return o.beautify()}P.exports=d,P.exports.defaultOptions=function(){return new f}},function(P,A,g){var p=g(17).Options,f=g(2).Output,d=g(8).InputScanner,s=g(13).Directives,c=new s(/\/\*/,/\*\//),o=/\r\n|[\r\n]/,i=/\r\n|[\r\n]/g,u=/\s/,h=/(?:\s|\n)+/g,R=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,S=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function E(O,x){this._source_text=O||"",this._options=new p(x),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"]}E.prototype.eatString=function(O){var x="";for(this._ch=this._input.next();this._ch;){if(x+=this._ch,this._ch==="\\")x+=this._input.next();else if(O.indexOf(this._ch)!==-1||this._ch===`
|
|
`)break;this._ch=this._input.next()}return x},E.prototype.eatWhitespace=function(O){for(var x=u.test(this._input.peek()),w=0;u.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 x},E.prototype.foundNestedPseudoClass=function(){for(var O=0,x=1,w=this._input.peek(x);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;x++,w=this._input.peek(x)}return!1},E.prototype.print_string=function(O){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(O)},E.prototype.preserveSingleSpace=function(O){O&&(this._output.space_before_token=!0)},E.prototype.indent=function(){this._indentLevel++},E.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},E.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var O=this._source_text,x=this._options.eol;x==="auto"&&(x=`
|
|
`,O&&o.test(O||"")&&(x=O.match(o)[0])),O=O.replace(i,`
|
|
`);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,l=!1,b=!1,m=!1,y=!1,k=!1,I=this._ch,N=!1,F,C,v;F=this._input.read(h),C=F!=="",v=I,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),I=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var j=this._input.read(R),K=c.get_directives(j);K&&K.ignore==="start"&&(j+=c.readIgnored(this._input)),this.print_string(j),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(C),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var J=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);J.match(/[ :]$/)&&(J=this.eatString(": ").replace(/\s$/,""),this.print_string(J),this._output.space_before_token=!0),J=J.replace(/\s$/,""),J==="extend"?m=!0:J==="import"&&(y=!0),J in this.NESTED_AT_RULE?(this._nestedLevel+=1,J in this.CONDITIONAL_GROUP_RULE&&(b=!0)):!_&&T===0&&J.indexOf(":")!==-1&&(l=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(C),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")l&&(l=!1,this.outdent()),b?(b=!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)):(v==="("?this._output.space_before_token=!1:v!==","&&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(),v==="{"&&this._output.trim(!0),y=!1,m=!1,l&&(this.outdent(),l=!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 te=0;te<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;te++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[te])){N=!0;break}(_||b)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!m&&T===0?(this.print_string(":"),l||(l=!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 ve=v==='"'||v==="'";this.preserveSingleSpace(ve||C),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")N=!1,T===0?(l&&(this.outdent(),l=!1),m=!1,y=!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 ue=!1;this._input.lookBack("with")&&(ue=!0),this.preserveSingleSpace(C||ue),this.print_string(this._ch),l&&v==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),k=!0):(this.eatWhitespace(),T++,this.indent())}else if(this._ch===")")T&&(T--,this.outdent()),k&&this._input.peek()===";"&&this._options.selector_separator_newline&&(k=!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&&(!l||k)&&T===0&&!y&&!m?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!l&&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&&u.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(C),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),u.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 de=v==='"'||v==="'";this.preserveSingleSpace(de||C),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
`&&N&&this._output.add_new_line()}var oe=this._output.get_code(x);return oe},P.exports.Beautifier=E},function(P,A,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 o=0;o<c.length;o++)c[o]!=="expand"?this.brace_style="collapse":this.brace_style=c[o]}f.prototype=new p,P.exports.Options=f}],M={};function W(P){var A=M[P];if(A!==void 0)return A.exports;var g=M[P]={exports:{}};return U[P](g,g.exports,W),g.exports}var B=W(15);D=B})();var z=D;!(re=[],V=function(){return{css_beautify:z}}.apply(je,re),V!==void 0&&(tt.exports=V))})()},"VrN/":function(tt,je,q){(function(re,V){tt.exports=V()})(this,function(){"use strict";var re=navigator.userAgent,V=navigator.platform,D=/gecko\/\d/i.test(re),z=/MSIE \d/.test(re),U=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(re),M=/Edge\/(\d+)/.exec(re),W=z||U||M,B=W&&(z?document.documentMode||6:+(M||U)[1]),P=!M&&/WebKit\//.test(re),A=P&&/Qt\/\d+\.\d+/.test(re),g=!M&&/Chrome\//.test(re),p=/Opera\//.test(re),f=/Apple Computer/.test(navigator.vendor),d=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(re),s=/PhantomJS/.test(re),c=!M&&/AppleWebKit/.test(re)&&/Mobile\/\w+/.test(re),o=/Android/.test(re),i=c||o||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(re),u=c||/Mac/.test(V),h=/\bCrOS\b/.test(re),R=/win/i.test(V),S=p&&re.match(/Version\/(\d*\.\d*)/);S&&(S=Number(S[1])),S&&S>=15&&(p=!1,P=!0);var E=u&&(A||p&&(S==null||S<12.11)),O=D||W&&B>=9;function x(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var w=function(e,t){var r=e.className,n=x(t).exec(r);if(n){var a=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(a?n[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 l(e,t,r,n){var a=document.createElement(e);if(r&&(a.className=r),n&&(a.style.cssText=n),typeof t=="string")a.appendChild(document.createTextNode(t));else if(t)for(var L=0;L<t.length;++L)a.appendChild(t[L]);return a}function b(e,t,r,n){var a=l(e,t,r,n);return a.setAttribute("role","presentation"),a}var m;document.createRange?m=function(e,t,r,n){var a=document.createRange();return a.setEnd(n||e,r),a.setStart(e,t),a}:m=function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(a){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};function y(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 k(){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 I(e,t){var r=e.className;x(t).test(r)||(e.className+=(r?" ":"")+t)}function N(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!x(r[n]).test(t)&&(t+=" "+r[n]);return t}var F=function(e){e.select()};c?F=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:W&&(F=function(e){try{e.select()}catch(t){}});function C(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function v(e,t,r){t||(t={});for(var n in e)e.hasOwnProperty(n)&&(r!==!1||!t.hasOwnProperty(n))&&(t[n]=e[n]);return t}function j(e,t,r,n,a){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var L=n||0,H=a||0;;){var G=e.indexOf(" ",L);if(G<0||G>=t)return H+(t-L);H+=G-L,H+=r-H%r,L=G+1}}var K=function(){this.id=null,this.f=null,this.time=0,this.handler=C(this.onTimeout,this)};K.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},K.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 J(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}var te=50,ve={toString:function(){return"CodeMirror.Pass"}},ue={scroll:!1},de={origin:"*mouse"},oe={origin:"+move"};function me(e,t,r){for(var n=0,a=0;;){var L=e.indexOf(" ",n);L==-1&&(L=e.length);var H=L-n;if(L==e.length||a+H>=t)return n+Math.min(H,t-a);if(a+=L-n,a+=r-a%r,n=L+1,a>=t)return n}}var ae=[""];function fe(e){for(;ae.length<=e;)ae.push(Q(ae)+" ");return ae[e]}function Q(e){return e[e.length-1]}function ie(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function ee(e,t,r){for(var n=0,a=r(t);n<e.length&&r(e[n])<=a;)n++;e.splice(n,0,t)}function Te(){}function Se(e,t){var r;return Object.create?r=Object.create(e):(Te.prototype=e,r=new Te),t&&v(t,r),r}var be=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ye(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||be.test(e))}function xe(e,t){return t?t.source.indexOf("\\w")>-1&&ye(e)?!0:t.test(e):ye(e)}function De(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ie=/[\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 Ae(e){return e.charCodeAt(0)>=768&&Ie.test(e)}function Le(e,t,r){for(;(r<0?t>0:t<e.length)&&Ae(e.charAt(t));)t+=r;return t}function Ue(e,t,r){for(var n=t>r?-1:1;;){if(t==r)return t;var a=(t+r)/2,L=n<0?Math.ceil(a):Math.floor(a);if(L==t)return e(L)?t:r;e(L)?r=L:t=L+n}}function He(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var a=!1,L=0;L<e.length;++L){var H=e[L];(H.from<r&&H.to>t||t==r&&H.to==t)&&(n(Math.max(H.from,t),Math.min(H.to,r),H.level==1?"rtl":"ltr",L),a=!0)}a||n(t,r,"ltr")}var We=null;function Fe(e,t,r){var n;We=null;for(var a=0;a<e.length;++a){var L=e[a];if(L.from<t&&L.to>t)return a;L.to==t&&(L.from!=L.to&&r=="before"?n=a:We=a),L.from==t&&(L.from!=L.to&&r!="before"?n=a:We=a)}return n!=null?n:We}var Je=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r($){return $<=247?e.charAt($):1424<=$&&$<=1524?"R":1536<=$&&$<=1785?t.charAt($-1536):1774<=$&&$<=2220?"r":8192<=$&&$<=8203?"w":$==8204?"b":"L"}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,a=/[stwN]/,L=/[LRr]/,H=/[Lb1n]/,G=/[1n]/;function X($,se,ce){this.level=$,this.from=se,this.to=ce}return function($,se){var ce=se=="ltr"?"L":"R";if($.length==0||se=="ltr"&&!n.test($))return!1;for(var we=$.length,Ee=[],Pe=0;Pe<we;++Pe)Ee.push(r($.charCodeAt(Pe)));for(var Ne=0,Ge=ce;Ne<we;++Ne){var Xe=Ee[Ne];Xe=="m"?Ee[Ne]=Ge:Ge=Xe}for(var Ze=0,Ye=ce;Ze<we;++Ze){var et=Ee[Ze];et=="1"&&Ye=="r"?Ee[Ze]="n":L.test(et)&&(Ye=et,et=="r"&&(Ee[Ze]="R"))}for(var ut=1,ot=Ee[0];ut<we-1;++ut){var gt=Ee[ut];gt=="+"&&ot=="1"&&Ee[ut+1]=="1"?Ee[ut]="1":gt==","&&ot==Ee[ut+1]&&(ot=="1"||ot=="n")&&(Ee[ut]=ot),ot=gt}for(var It=0;It<we;++It){var Xt=Ee[It];if(Xt==",")Ee[It]="N";else if(Xt=="%"){var kt=void 0;for(kt=It+1;kt<we&&Ee[kt]=="%";++kt);for(var fn=It&&Ee[It-1]=="!"||kt<we&&Ee[kt]=="1"?"1":"N",un=It;un<kt;++un)Ee[un]=fn;It=kt-1}}for(var jt=0,dn=ce;jt<we;++jt){var Qt=Ee[jt];dn=="L"&&Qt=="1"?Ee[jt]="L":L.test(Qt)&&(dn=Qt)}for(var Gt=0;Gt<we;++Gt)if(a.test(Ee[Gt])){var Ht=void 0;for(Ht=Gt+1;Ht<we&&a.test(Ee[Ht]);++Ht);for(var Ft=(Gt?Ee[Gt-1]:ce)=="L",cn=(Ht<we?Ee[Ht]:ce)=="L",Wr=Ft==cn?Ft?"L":"R":ce,Zn=Gt;Zn<Ht;++Zn)Ee[Zn]=Wr;Gt=Ht-1}for(var qt=[],Pn,Yt=0;Yt<we;)if(H.test(Ee[Yt])){var Va=Yt;for(++Yt;Yt<we&&H.test(Ee[Yt]);++Yt);qt.push(new X(0,Va,Yt))}else{var Wn=Yt,pr=qt.length,mr=se=="rtl"?1:0;for(++Yt;Yt<we&&Ee[Yt]!="L";++Yt);for(var nn=Wn;nn<Yt;)if(G.test(Ee[nn])){Wn<nn&&(qt.splice(pr,0,new X(1,Wn,nn)),pr+=mr);var Kr=nn;for(++nn;nn<Yt&&G.test(Ee[nn]);++nn);qt.splice(pr,0,new X(2,Kr,nn)),pr+=mr,Wn=nn}else++nn;Wn<Yt&&qt.splice(pr,0,new X(1,Wn,Yt))}return se=="ltr"&&(qt[0].level==1&&(Pn=$.match(/^\s+/))&&(qt[0].from=Pn[0].length,qt.unshift(new X(0,0,Pn[0].length))),Q(qt).level==1&&(Pn=$.match(/\s+$/))&&(Q(qt).to-=Pn[0].length,qt.push(new X(0,we-Pn[0].length,we)))),se=="rtl"?qt.reverse():qt}}();function Ve(e,t){var r=e.order;return r==null&&(r=e.order=Je(e.text,t)),r}var $e=[],Ce=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||$e).concat(r)}};function qe(e,t){return e._handlers&&e._handlers[t]||$e}function ze(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers,a=n&&n[t];if(a){var L=J(a,r);L>-1&&(n[t]=a.slice(0,L).concat(a.slice(L+1)))}}}function Oe(e,t){var r=qe(e,t);if(!r.length)return;for(var n=Array.prototype.slice.call(arguments,2),a=0;a<r.length;++a)r[a].apply(null,n)}function Me(e,t,r){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Oe(e,r||t.type,e,t),ne(t)||t.codemirrorIgnore}function _e(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)J(r,t[n])==-1&&r.push(t[n])}function he(e,t){return qe(e,t).length>0}function ge(e){e.prototype.on=function(t,r){Ce(this,t,r)},e.prototype.off=function(t,r){ze(this,t,r)}}function Y(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Z(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ne(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function le(e){Y(e),Z(e)}function pe(e){return e.target||e.srcElement}function Re(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),u&&e.ctrlKey&&t==1&&(t=3),t}var ke=function(){if(W&&B<9)return!1;var e=l("div");return"draggable"in e||"dragDrop"in e}(),Qe;function nt(e){if(Qe==null){var t=l("span","\u200B");_(e,l("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Qe=t.offsetWidth<=1&&t.offsetHeight>2&&!(W&&B<8))}var r=Qe?l("span","\u200B"):l("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var rt;function Et(e){if(rt!=null)return rt;var t=_(e,document.createTextNode("A\u062EA")),r=m(t,0,1).getBoundingClientRect(),n=m(t,1,2).getBoundingClientRect();return T(e),!r||r.left==r.right?!1:rt=n.right-r.right<3}var ct=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,r=[],n=e.length;t<=n;){var a=e.indexOf(`
|
|
`,t);a==-1&&(a=e.length);var L=e.slice(t,e.charAt(a-1)=="\r"?a-1:a),H=L.indexOf("\r");H!=-1?(r.push(L.slice(0,H)),t+=H+1):(r.push(L),t=a+1)}return r}:function(e){return e.split(/\r\n?|\n/)},st=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(r){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Ot=function(){var e=l("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Tt=null;function Bt(e){if(Tt!=null)return Tt;var t=_(e,l("span","x")),r=t.getBoundingClientRect(),n=m(t,0,1).getBoundingClientRect();return Tt=Math.abs(r.left-n.left)>1}var Mt={},yt={};function pn(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Mt[e]=t}function bn(e,t){yt[e]=t}function dt(e){if(typeof e=="string"&&yt.hasOwnProperty(e))e=yt[e];else if(e&&typeof e.name=="string"&&yt.hasOwnProperty(e.name)){var t=yt[e.name];typeof t=="string"&&(t={name:t}),e=Se(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return dt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return dt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function mt(e,t){t=dt(t);var r=Mt[t.name];if(!r)return mt(e,"text/plain");var n=r(e,t);if(xt.hasOwnProperty(t.name)){var a=xt[t.name];for(var L in a){if(!a.hasOwnProperty(L))continue;n.hasOwnProperty(L)&&(n["_"+L]=n[L]),n[L]=a[L]}}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var H in t.modeProps)n[H]=t.modeProps[H];return n}var xt={};function Dt(e,t){var r=xt.hasOwnProperty(e)?xt[e]:xt[e]={};v(t,r)}function Wt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var a=t[n];a instanceof Array&&(a=a.concat([])),r[n]=a}return r}function qn(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 Gr(e,t,r){return e.startState?e.startState(t,r):!0}var Nt=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};Nt.prototype.eol=function(){return this.pos>=this.string.length},Nt.prototype.sol=function(){return this.pos==this.lineStart},Nt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Nt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Nt.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},Nt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Nt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Nt.prototype.skipToEnd=function(){this.pos=this.string.length},Nt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Nt.prototype.backUp=function(e){this.pos-=e},Nt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=j(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?j(this.string,this.lineStart,this.tabSize):0)},Nt.prototype.indentation=function(){return j(this.string,null,this.tabSize)-(this.lineStart?j(this.string,this.lineStart,this.tabSize):0)},Nt.prototype.match=function(e,t,r){if(typeof e=="string"){var n=function(H){return r?H.toLowerCase():H},a=this.string.substr(this.pos,e.length);if(n(a)==n(e))return t!==!1&&(this.pos+=e.length),!0}else{var L=this.string.slice(this.pos).match(e);return L&&L.index>0?null:(L&&t!==!1&&(this.pos+=L[0].length),L)}},Nt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Nt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Nt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Nt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function it(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 n=0;;++n){var a=r.children[n],L=a.chunkSize();if(t<L){r=a;break}t-=L}return r.lines[t]}function kn(e,t,r){var n=[],a=t.line;return e.iter(t.line,r.line+1,function(L){var H=L.text;a==r.line&&(H=H.slice(0,r.ch)),a==t.line&&(H=H.slice(t.ch)),n.push(H),++a}),n}function gr(e,t,r){var n=[];return e.iter(t,r,function(a){n.push(a.text)}),n}function rn(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function St(e){if(e.parent==null)return null;for(var t=e.parent,r=J(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var a=0;!(n.children[a]==t);++a)r+=n.children[a].chunkSize();return r+t.first}function En(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var a=e.children[n],L=a.height;if(t<L){e=a;continue e}t-=L,r+=a.chunkSize()}return r}while(!e.lines);for(var H=0;H<e.lines.length;++H){var G=e.lines[H],X=G.height;if(t<X)break;t-=X}return r+H}function Mn(e,t){return t>=e.first&&t<e.first+e.size}function vr(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Be(e,t,r){if(r===void 0&&(r=null),!(this instanceof Be))return new Be(e,t,r);this.line=e,this.ch=t,this.sticky=r}function ht(e,t){return e.line-t.line||e.ch-t.ch}function zr(e,t){return e.sticky==t.sticky&&ht(e,t)==0}function _r(e){return Be(e.line,e.ch)}function yr(e,t){return ht(e,t)<0?t:e}function er(e,t){return ht(e,t)<0?e:t}function br(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function pt(e,t){if(t.line<e.first)return Be(e.first,0);var r=e.first+e.size-1;return t.line>r?Be(r,it(e,r).text.length):Ai(t,it(e,t.line).text.length)}function Ai(e,t){var r=e.ch;return r==null||r>t?Be(e.line,t):r<0?Be(e.line,0):e}function Ke(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=pt(e,t[n]);return r}var Er=function(e,t){this.state=e,this.lookAhead=t},_n=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};_n.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},_n.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}},_n.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},_n.fromSaved=function(e,t,r){return t instanceof Er?new _n(e,Wt(e.mode,t.state),r,t.lookAhead):new _n(e,Wt(e.mode,t),r)},_n.prototype.save=function(e){var t=e!==!1?Wt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Er(t,this.maxLookAhead):t};function Vr(e,t,r,n){var a=[e.state.modeGen],L={};wn(e,t.text,e.doc.mode,r,function($,se){return a.push($,se)},L,n);for(var H=r.state,G=function($){r.baseTokens=a;var se=e.state.overlays[$],ce=1,we=0;r.state=!0,wn(e,t.text,se.mode,r,function(Ee,Pe){for(var Ne=ce;we<Ee;){var Ge=a[ce];Ge>Ee&&a.splice(ce,1,Ee,a[ce+1],Ge),ce+=2,we=Math.min(Ee,Ge)}if(!Pe)return;if(se.opaque)a.splice(Ne,ce-Ne,Ee,"overlay "+Pe),ce=Ne+2;else for(;Ne<ce;Ne+=2){var Xe=a[Ne+1];a[Ne+1]=(Xe?Xe+" ":"")+"overlay "+Pe}},L),r.state=H,r.baseTokens=null,r.baseTokenPos=1},X=0;X<e.state.overlays.length;++X)G(X);return{styles:a,classes:L.bgClass||L.textClass?L:null}}function tr(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Tn(e,St(t)),a=t.text.length>e.options.maxHighlightLength&&Wt(e.doc.mode,n.state),L=Vr(e,t,n);a&&(n.state=a),t.stateAfter=n.save(!a),t.styles=L.styles,L.classes?t.styleClasses=L.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 Tn(e,t,r){var n=e.doc,a=e.display;if(!n.mode.startState)return new _n(n,!0,t);var L=Ci(e,t,r),H=L>n.first&&it(n,L-1).stateAfter,G=H?_n.fromSaved(n,H,L):new _n(n,Gr(n.mode),L);return n.iter(L,t,function(X){Xr(e,X.text,G);var $=G.line;X.stateAfter=$==t-1||$%5==0||$>=a.viewFrom&&$<a.viewTo?G.save():null,G.nextLine()}),r&&(n.modeFrontier=G.line),G}function Xr(e,t,r,n){var a=e.doc.mode,L=new Nt(t,e.options.tabSize,r);for(L.start=L.pos=n||0,t==""&&Yr(a,r.state);!L.eol();)xn(a,L,r.state),L.start=L.pos}function Yr(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var r=qn(e,t);if(r.mode.blankLine)return r.mode.blankLine(r.state)}function xn(e,t,r,n){for(var a=0;a<10;a++){n&&(n[0]=qn(e,r).mode);var L=e.token(t,r);if(t.pos>t.start)return L}throw new Error("Mode "+e.name+" failed to advance stream.")}var $r=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function Ri(e,t,r,n){var a=e.doc,L=a.mode,H;t=pt(a,t);var G=it(a,t.line),X=Tn(e,t.line,r),$=new Nt(G.text,e.options.tabSize,X),se;for(n&&(se=[]);(n||$.pos<t.ch)&&!$.eol();)$.start=$.pos,H=xn(L,$,X.state),n&&se.push(new $r($,H,Wt(a.mode,X.state)));return n?se:new $r($,H,X.state)}function Qr(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 n=r[1]?"bgClass":"textClass";t[n]==null?t[n]=r[2]:new RegExp("(?:^|\\s)"+r[2]+"(?:$|\\s)").test(t[n])||(t[n]+=" "+r[2])}return e}function wn(e,t,r,n,a,L,H){var G=r.flattenSpans;G==null&&(G=e.options.flattenSpans);var X=0,$=null,se=new Nt(t,e.options.tabSize,n),ce,we=e.options.addModeClass&&[null];for(t==""&&Qr(Yr(r,n.state),L);!se.eol();){if(se.pos>e.options.maxHighlightLength?(G=!1,H&&Xr(e,t,n,se.pos),se.pos=t.length,ce=null):ce=Qr(xn(r,se,n.state,we),L),we){var Ee=we[0].name;Ee&&(ce="m-"+(ce?Ee+" "+ce:Ee))}if(!G||$!=ce){for(;X<se.start;)X=Math.min(se.start,X+5e3),a(X,$);$=ce}se.start=se.pos}for(;X<se.pos;){var Pe=Math.min(se.pos,X+5e3);a(Pe,$),X=Pe}}function Ci(e,t,r){for(var n,a,L=e.doc,H=r?-1:t-(e.doc.mode.innerMode?1e3:100),G=t;G>H;--G){if(G<=L.first)return L.first;var X=it(L,G-1),$=X.stateAfter;if($&&(!r||G+($ instanceof Er?$.lookAhead:0)<=L.modeFrontier))return G;var se=j(X.text,null,e.options.tabSize);(a==null||n>se)&&(a=G-1,n=se)}return a}function aa(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var r=e.first,n=t-1;n>r;n--){var a=it(e,n).stateAfter;if(a&&(!(a instanceof Er)||n+a.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}var Jr=!1,en=!1;function Kn(){Jr=!0}function sa(){en=!0}function nr(e,t,r){this.marker=e,this.from=t,this.to=r}function Sn(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Zr(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function oa(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Li(e,t,r){var n;if(e)for(var a=0;a<e.length;++a){var L=e[a],H=L.marker,G=L.from==null||(H.inclusiveLeft?L.from<=t:L.from<t);if(G||L.from==t&&H.type=="bookmark"&&(!r||!L.marker.insertLeft)){var X=L.to==null||(H.inclusiveRight?L.to>=t:L.to>t);(n||(n=[])).push(new nr(H,L.from,X?null:L.to))}}return n}function Ii(e,t,r){var n;if(e)for(var a=0;a<e.length;++a){var L=e[a],H=L.marker,G=L.to==null||(H.inclusiveRight?L.to>=t:L.to>t);if(G||L.from==t&&H.type=="bookmark"&&(!r||L.marker.insertLeft)){var X=L.from==null||(H.inclusiveLeft?L.from<=t:L.from<t);(n||(n=[])).push(new nr(H,X?null:L.from-t,L.to==null?null:L.to-t))}}return n}function Tr(e,t){if(t.full)return null;var r=Mn(e,t.from.line)&&it(e,t.from.line).markedSpans,n=Mn(e,t.to.line)&&it(e,t.to.line).markedSpans;if(!r&&!n)return null;var a=t.from.ch,L=t.to.ch,H=ht(t.from,t.to)==0,G=Li(r,a,H),X=Ii(n,L,H),$=t.text.length==1,se=Q(t.text).length+($?a:0);if(G)for(var ce=0;ce<G.length;++ce){var we=G[ce];if(we.to==null){var Ee=Sn(X,we.marker);Ee?$&&(we.to=Ee.to==null?null:Ee.to+se):we.to=a}}if(X)for(var Pe=0;Pe<X.length;++Pe){var Ne=X[Pe];if(Ne.to!=null&&(Ne.to+=se),Ne.from==null){var Ge=Sn(G,Ne.marker);Ge||(Ne.from=se,$&&(G||(G=[])).push(Ne))}else Ne.from+=se,$&&(G||(G=[])).push(Ne)}G&&(G=Di(G)),X&&X!=G&&(X=Di(X));var Xe=[G];if(!$){var Ze=t.text.length-2,Ye;if(Ze>0&&G)for(var et=0;et<G.length;++et)G[et].to==null&&(Ye||(Ye=[])).push(new nr(G[et].marker,null,null));for(var ut=0;ut<Ze;++ut)Xe.push(Ye);Xe.push(X)}return Xe}function Di(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 Pi(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(Ee){if(Ee.markedSpans)for(var Pe=0;Pe<Ee.markedSpans.length;++Pe){var Ne=Ee.markedSpans[Pe].marker;Ne.readOnly&&(!n||J(n,Ne)==-1)&&(n||(n=[])).push(Ne)}}),!n)return null;for(var a=[{from:t,to:r}],L=0;L<n.length;++L)for(var H=n[L],G=H.find(0),X=0;X<a.length;++X){var $=a[X];if(ht($.to,G.from)<0||ht($.from,G.to)>0)continue;var se=[X,1],ce=ht($.from,G.from),we=ht($.to,G.to);(ce<0||!H.inclusiveLeft&&!ce)&&se.push({from:$.from,to:G.from}),(we>0||!H.inclusiveRight&&!we)&&se.push({from:G.to,to:$.to}),a.splice.apply(a,se),X+=se.length-3}return a}function la(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 xr(e,t){if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}function rr(e){return e.inclusiveLeft?-1:0}function ir(e){return e.inclusiveRight?1:0}function wr(e,t){var r=e.lines.length-t.lines.length;if(r!=0)return r;var n=e.find(),a=t.find(),L=ht(n.from,a.from)||rr(e)-rr(t);if(L)return-L;var H=ht(n.to,a.to)||ir(e)-ir(t);return H||t.id-e.id}function Nn(e,t){var r=en&&e.markedSpans,n;if(r)for(var a=void 0,L=0;L<r.length;++L)a=r[L],a.marker.collapsed&&(t?a.from:a.to)==null&&(!n||wr(n,a.marker)<0)&&(n=a.marker);return n}function Fn(e){return Nn(e,!0)}function Un(e){return Nn(e,!1)}function Sr(e,t){var r=en&&e.markedSpans,n;if(r)for(var a=0;a<r.length;++a){var L=r[a];L.marker.collapsed&&(L.from==null||L.from<t)&&(L.to==null||L.to>t)&&(!n||wr(n,L.marker)<0)&&(n=L.marker)}return n}function ki(e,t,r,n,a){var L=it(e,t),H=en&&L.markedSpans;if(H)for(var G=0;G<H.length;++G){var X=H[G];if(!X.marker.collapsed)continue;var $=X.marker.find(0),se=ht($.from,r)||rr(X.marker)-rr(a),ce=ht($.to,n)||ir(X.marker)-ir(a);if(se>=0&&ce<=0||se<=0&&ce>=0)continue;if(se<=0&&(X.marker.inclusiveRight&&a.inclusiveLeft?ht($.to,r)>=0:ht($.to,r)>0)||se>=0&&(X.marker.inclusiveRight&&a.inclusiveLeft?ht($.from,n)<=0:ht($.from,n)<0))return!0}}function mn(e){for(var t;t=Fn(e);)e=t.find(-1,!0).line;return e}function Mi(e){for(var t;t=Un(e);)e=t.find(1,!0).line;return e}function Or(e){for(var t,r;t=Un(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function qr(e,t){var r=it(e,t),n=mn(r);return r==n?t:St(n)}function Gn(e,t){if(t>e.lastLine())return t;var r=it(e,t),n;if(!Ln(e,r))return t;for(;n=Un(r);)r=n.find(1,!0).line;return St(r)+1}function Ln(e,t){var r=en&&t.markedSpans;if(r)for(var n=void 0,a=0;a<r.length;++a){if(n=r[a],!n.marker.collapsed)continue;if(n.from==null)return!0;if(n.marker.widgetNode)continue;if(n.from==0&&n.marker.inclusiveLeft&&ei(e,t,n))return!0}}function ei(e,t,r){if(r.to==null){var n=r.marker.find(1,!0);return ei(e,n.line,Sn(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var a=void 0,L=0;L<t.markedSpans.length;++L)if(a=t.markedSpans[L],a.marker.collapsed&&!a.marker.widgetNode&&a.from==r.to&&(a.to==null||a.to!=r.from)&&(a.marker.inclusiveLeft||r.marker.inclusiveRight)&&ei(e,t,a))return!0}function On(e){e=mn(e);for(var t=0,r=e.parent,n=0;n<r.lines.length;++n){var a=r.lines[n];if(a==e)break;t+=a.height}for(var L=r.parent;L;r=L,L=r.parent)for(var H=0;H<L.children.length;++H){var G=L.children[H];if(G==r)break;t+=G.height}return t}function ti(e){if(e.height==0)return 0;for(var t=e.text.length,r,n=e;r=Fn(n);){var a=r.find(0,!0);n=a.from.line,t+=a.from.ch-a.to.ch}for(n=e;r=Un(n);){var L=r.find(0,!0);t-=n.text.length-L.from.ch,n=L.to.line,t+=n.text.length-L.to.ch}return t}function Ni(e){var t=e.display,r=e.doc;t.maxLine=it(r,r.first),t.maxLineLength=ti(t.maxLine),t.maxLineChanged=!0,r.iter(function(n){var a=ti(n);a>t.maxLineLength&&(t.maxLineLength=a,t.maxLine=n)})}var ar=function(e,t,r){this.text=e,xr(this,t),this.height=r?r(this):1};ar.prototype.lineNo=function(){return St(this)},ge(ar);function ua(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),la(e),xr(e,r);var a=n?n(e):1;a!=e.height&&rn(e,a)}function at(e){e.parent=null,la(e)}var ft={},lt={};function vt(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?lt:ft;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function wt(e,t){var r=b("span",null,null,P?"padding-right: .1px":null),n={pre:b("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 L=a?t.rest[a-1]:t.line,H=void 0;n.pos=0,n.addToken=bt,Et(e.display.measure)&&(H=Ve(L,e.doc.direction))&&(n.addToken=an(n.addToken,H)),n.map=[];var G=t!=e.display.externalMeasured&&St(L);Bn(L,n,tr(e,L,G)),L.styleClasses&&(L.styleClasses.bgClass&&(n.bgClass=N(L.styleClasses.bgClass,n.bgClass||"")),L.styleClasses.textClass&&(n.textClass=N(L.styleClasses.textClass,n.textClass||""))),n.map.length==0&&n.map.push(0,0,n.content.appendChild(nt(e.display.measure))),a==0?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(P){var X=n.content.lastChild;(/\bcm-tab\b/.test(X.className)||X.querySelector&&X.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return Oe(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=N(n.pre.className,n.textClass||"")),n}function Lt(e){var t=l("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function bt(e,t,r,n,a,L,H){if(!t)return;var G=e.splitSpaces?Kt(t,e.trailingSpace):t,X=e.cm.state.specialChars,$=!1,se;if(!X.test(t))e.col+=t.length,se=document.createTextNode(G),e.map.push(e.pos,e.pos+t.length,se),W&&B<9&&($=!0),e.pos+=t.length;else{se=document.createDocumentFragment();for(var ce=0;;){X.lastIndex=ce;var we=X.exec(t),Ee=we?we.index-ce:t.length-ce;if(Ee){var Pe=document.createTextNode(G.slice(ce,ce+Ee));W&&B<9?se.appendChild(l("span",[Pe])):se.appendChild(Pe),e.map.push(e.pos,e.pos+Ee,Pe),e.col+=Ee,e.pos+=Ee}if(!we)break;ce+=Ee+1;var Ne=void 0;if(we[0]==" "){var Ge=e.cm.options.tabSize,Xe=Ge-e.col%Ge;Ne=se.appendChild(l("span",fe(Xe),"cm-tab")),Ne.setAttribute("role","presentation"),Ne.setAttribute("cm-text"," "),e.col+=Xe}else we[0]=="\r"||we[0]==`
|
|
`?(Ne=se.appendChild(l("span",we[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ne.setAttribute("cm-text",we[0]),e.col+=1):(Ne=e.cm.options.specialCharPlaceholder(we[0]),Ne.setAttribute("cm-text",we[0]),W&&B<9?se.appendChild(l("span",[Ne])):se.appendChild(Ne),e.col+=1);e.map.push(e.pos,e.pos+1,Ne),e.pos++}}if(e.trailingSpace=G.charCodeAt(t.length-1)==32,r||n||a||$||L||H){var Ze=r||"";n&&(Ze+=n),a&&(Ze+=a);var Ye=l("span",[se],Ze,L);if(H)for(var et in H)H.hasOwnProperty(et)&&et!="style"&&et!="class"&&Ye.setAttribute(et,H[et]);return e.content.appendChild(Ye)}e.content.appendChild(se)}function Kt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",a=0;a<e.length;a++){var L=e.charAt(a);L==" "&&r&&(a==e.length-1||e.charCodeAt(a+1)==32)&&(L="\xA0"),n+=L,r=L==" "}return n}function an(e,t){return function(r,n,a,L,H,G,X){a=a?a+" cm-force-border":"cm-force-border";for(var $=r.pos,se=$+n.length;;){for(var ce=void 0,we=0;we<t.length&&!(ce=t[we],ce.to>$&&ce.from<=$);we++);if(ce.to>=se)return e(r,n,a,L,H,G,X);e(r,n.slice(0,ce.to-$),a,L,null,G,X),L=null,n=n.slice(ce.to-$),$=ce.to}}}function _t(e,t,r,n){var a=!n&&r.widgetNode;a&&e.map.push(e.pos,e.pos+t,a),!n&&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 Bn(e,t,r){var n=e.markedSpans,a=e.text,L=0;if(!n){for(var H=1;H<r.length;H+=2)t.addToken(t,a.slice(L,L=r[H]),vt(r[H+1],t.cm.options));return}for(var G=a.length,X=0,$=1,se="",ce,we,Ee=0,Pe,Ne,Ge,Xe,Ze;;){if(Ee==X){Pe=Ne=Ge=we="",Ze=null,Xe=null,Ee=Infinity;for(var Ye=[],et=void 0,ut=0;ut<n.length;++ut){var ot=n[ut],gt=ot.marker;if(gt.type=="bookmark"&&ot.from==X&>.widgetNode)Ye.push(gt);else if(ot.from<=X&&(ot.to==null||ot.to>X||gt.collapsed&&ot.to==X&&ot.from==X)){if(ot.to!=null&&ot.to!=X&&Ee>ot.to&&(Ee=ot.to,Ne=""),gt.className&&(Pe+=" "+gt.className),gt.css&&(we=(we?we+";":"")+gt.css),gt.startStyle&&ot.from==X&&(Ge+=" "+gt.startStyle),gt.endStyle&&ot.to==Ee&&(et||(et=[])).push(gt.endStyle,ot.to),gt.title&&((Ze||(Ze={})).title=gt.title),gt.attributes)for(var It in gt.attributes)(Ze||(Ze={}))[It]=gt.attributes[It];gt.collapsed&&(!Xe||wr(Xe.marker,gt)<0)&&(Xe=ot)}else ot.from>X&&Ee>ot.from&&(Ee=ot.from)}if(et)for(var Xt=0;Xt<et.length;Xt+=2)et[Xt+1]==Ee&&(Ne+=" "+et[Xt]);if(!Xe||Xe.from==X)for(var kt=0;kt<Ye.length;++kt)_t(t,0,Ye[kt]);if(Xe&&(Xe.from||0)==X){if(_t(t,(Xe.to==null?G+1:Xe.to)-X,Xe.marker,Xe.from==null),Xe.to==null)return;Xe.to==X&&(Xe=!1)}}if(X>=G)break;for(var fn=Math.min(G,Ee);;){if(se){var un=X+se.length;if(!Xe){var jt=un>fn?se.slice(0,fn-X):se;t.addToken(t,jt,ce?ce+Pe:Pe,Ge,X+jt.length==Ee?Ne:"",we,Ze)}if(un>=fn){se=se.slice(fn-X),X=fn;break}X=un,Ge=""}se=a.slice(L,L=r[$++]),ce=vt(r[$++],t.cm.options)}}}function At(e,t,r){this.line=t,this.rest=Or(t),this.size=this.rest?St(Q(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Ln(e,t)}function sn(e,t,r){for(var n=[],a,L=t;L<r;L=a){var H=new At(e.doc,it(e.doc,L),L);a=L+H.size,n.push(H)}return n}var Jt=null;function yn(e){Jt?Jt.ops.push(e):e.ownsGroup=Jt={ops:[e],delayedCallbacks:[]}}function Lo(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var a=e.ops[n];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{Jt=null,t(r)}}var ni=null;function $t(e,t){var r=qe(e,t);if(!r.length)return;var n=Array.prototype.slice.call(arguments,2),a;Jt?a=Jt.delayedCallbacks:ni?a=ni:(a=ni=[],setTimeout(Do,0));for(var L=function(G){a.push(function(){return r[G].apply(null,n)})},H=0;H<r.length;++H)L(H)}function Do(){var e=ni;ni=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,r,n){for(var a=0;a<t.changes.length;a++){var L=t.changes[a];L=="text"?ko(e,t):L=="gutter"?Qa(e,t,r,n):L=="class"?da(e,t):L=="widget"&&Mo(e,t,n)}t.changes=null}function ri(e){return e.node==e.text&&(e.node=l("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),W&&B<8&&(e.node.style.zIndex=2)),e.node}function Po(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 n=ri(t);t.background=n.insertBefore(l("div",null,r),n.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):wt(e,t)}function ko(e,t){var r=t.text.className,n=$a(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,da(e,t)):r&&(t.text.className=r)}function da(e,t){Po(e,t),t.line.wrapClass?ri(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,n){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=ri(t);t.gutterBackground=l("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),a.insertBefore(t.gutterBackground,t.text)}var L=t.line.gutterMarkers;if(e.options.lineNumbers||L){var H=ri(t),G=t.gutter=l("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(G),H.insertBefore(G,t.text),t.line.gutterClass&&(G.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!L||!L["CodeMirror-linenumbers"])&&(t.lineNumber=G.appendChild(l("div",vr(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),L)for(var X=0;X<e.display.gutterSpecs.length;++X){var $=e.display.gutterSpecs[X].className,se=L.hasOwnProperty($)&&L[$];se&&G.appendChild(l("div",[se],"CodeMirror-gutter-elt","left: "+n.gutterLeft[$]+"px; width: "+n.gutterWidth[$]+"px"))}}}function Mo(e,t,r){t.alignable&&(t.alignable=null);for(var n=x("CodeMirror-linewidget"),a=t.node.firstChild,L=void 0;a;a=L)L=a.nextSibling,n.test(a.className)&&t.node.removeChild(a);Ja(e,t,r)}function No(e,t,r,n){var a=$a(e,t);return t.text=t.node=a.pre,a.bgClass&&(t.bgClass=a.bgClass),a.textClass&&(t.textClass=a.textClass),da(e,t),Qa(e,t,r,n),Ja(e,t,n),t.node}function Ja(e,t,r){if(Za(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)Za(e,t.rest[n],t,r,!1)}function Za(e,t,r,n,a){if(!t.widgets)return;for(var L=ri(r),H=0,G=t.widgets;H<G.length;++H){var X=G[H],$=l("div",[X.node],"CodeMirror-linewidget"+(X.className?" "+X.className:""));X.handleMouseEvents||$.setAttribute("cm-ignore-events","true"),Fo(X,$,r,n),e.display.input.setUneditable($),a&&X.above?L.insertBefore($,r.gutter||r.text):L.appendChild($),$t(X,"redraw")}}function Fo(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var a=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(a-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=a+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function ii(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!y(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,l("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function jn(e,t){for(var r=pe(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 Fi(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=_(e.measure,l("pre","x","CodeMirror-line-like")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return!isNaN(n.left)&&!isNaN(n.right)&&(e.cachedPaddingH=n),n}function In(e){return te-e.display.nativeBarWidth}function sr(e){return e.display.scroller.clientWidth-In(e)-e.display.barWidth}function ha(e){return e.display.scroller.clientHeight-In(e)-e.display.barHeight}function Uo(e,t,r){var n=e.options.lineWrapping,a=n&&sr(e);if(!t.measure.heights||n&&t.measure.width!=a){var L=t.measure.heights=[];if(n){t.measure.width=a;for(var H=t.text.firstChild.getClientRects(),G=0;G<H.length-1;G++){var X=H[G],$=H[G+1];Math.abs(X.bottom-$.bottom)>2&&L.push((X.bottom+$.top)/2-r.top)}}L.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 n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var a=0;a<e.rest.length;a++)if(St(e.rest[a])>r)return{map:e.measure.maps[a],cache:e.measure.caches[a],before:!0}}function Bo(e,t){t=mn(t);var r=St(t),n=e.display.externalMeasured=new At(e.doc,t,r);n.lineN=r;var a=n.built=wt(e,n);return n.text=a.pre,_(e.display.lineMeasure,a.pre),n}function ts(e,t,r,n){return Dn(e,Ar(e,t),r,n)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[ur(e,t)];var r=e.display.externalMeasured;if(r&&t>=r.lineN&&t<r.lineN+r.size)return r}function Ar(e,t){var r=St(t),n=fa(e,r);n&&!n.text?n=null:n&&n.changes&&(Ya(e,n,r,ya(e)),e.curOp.forceUpdate=!0),n||(n=Bo(e,t));var a=es(n,t,r);return{line:t,view:n,rect:null,map:a.map,cache:a.cache,before:a.before,hasHeights:!1}}function Dn(e,t,r,n,a){t.before&&(r=-1);var L=r+(n||""),H;return t.cache.hasOwnProperty(L)?H=t.cache[L]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Uo(e,t.view,t.rect),t.hasHeights=!0),H=Ho(e,t,r,n),H.bogus||(t.cache[L]=H)),{left:H.left,right:H.right,top:a?H.rtop:H.top,bottom:a?H.rbottom:H.bottom}}var ns={left:0,right:0,top:0,bottom:0};function rs(e,t,r){for(var n,a,L,H,G,X,$=0;$<e.length;$+=3)if(G=e[$],X=e[$+1],t<G?(a=0,L=1,H="left"):t<X?(a=t-G,L=a+1):($==e.length-3||t==X&&e[$+3]>t)&&(L=X-G,a=L-1,t>=X&&(H="right")),a!=null){if(n=e[$+2],G==X&&r==(n.insertLeft?"left":"right")&&(H=r),r=="left"&&a==0)for(;$&&e[$-2]==e[$-3]&&e[$-1].insertLeft;)n=e[($-=3)+2],H="left";if(r=="right"&&a==X-G)for(;$<e.length-3&&e[$+3]==e[$+4]&&!e[$+5].insertLeft;)n=e[($+=3)+2],H="right";break}return{node:n,start:a,end:L,collapse:H,coverStart:G,coverEnd:X}}function jo(e,t){var r=ns;if(t=="left")for(var n=0;n<e.length&&!((r=e[n]).left!=r.right);n++);else for(var a=e.length-1;a>=0&&!((r=e[a]).left!=r.right);a--);return r}function Ho(e,t,r,n){var a=rs(t.map,r,n),L=a.node,H=a.start,G=a.end,X=a.collapse,$;if(L.nodeType==3){for(var se=0;se<4;se++){for(;H&&Ae(t.line.text.charAt(a.coverStart+H));)--H;for(;a.coverStart+G<a.coverEnd&&Ae(t.line.text.charAt(a.coverStart+G));)++G;if(W&&B<9&&H==0&&G==a.coverEnd-a.coverStart?$=L.parentNode.getBoundingClientRect():$=jo(m(L,H,G).getClientRects(),n),$.left||$.right||H==0)break;G=H,H=H-1,X="right"}W&&B<11&&($=Wo(e.display.measure,$))}else{H>0&&(X=n="right");var ce;e.options.lineWrapping&&(ce=L.getClientRects()).length>1?$=ce[n=="right"?ce.length-1:0]:$=L.getBoundingClientRect()}if(W&&B<9&&!H&&(!$||!$.left&&!$.right)){var we=L.parentNode.getClientRects()[0];we?$={left:we.left,right:we.left+Cr(e.display),top:we.top,bottom:we.bottom}:$=ns}for(var Ee=$.top-t.rect.top,Pe=$.bottom-t.rect.top,Ne=(Ee+Pe)/2,Ge=t.view.measure.heights,Xe=0;Xe<Ge.length-1&&!(Ne<Ge[Xe]);Xe++);var Ze=Xe?Ge[Xe-1]:0,Ye=Ge[Xe],et={left:(X=="right"?$.right:$.left)-t.rect.left,right:(X=="left"?$.left:$.right)-t.rect.left,top:Ze,bottom:Ye};return!$.left&&!$.right&&(et.bogus=!0),e.options.singleCursorHeightPerLine||(et.rtop=Ee,et.rbottom=Pe),et}function Wo(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Bt(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}function is(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++)is(e.display.view[t])}function ai(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&&o?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function os(){return g&&o?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=ii(e.widgets[r]));return t}function Ui(e,t,r,n,a){if(!a){var L=pa(t);r.top+=L,r.bottom+=L}if(n=="line")return r;n||(n="local");var H=On(t);if(n=="local"?H+=Fi(e.display):H-=e.display.viewOffset,n=="page"||n=="window"){var G=e.display.lineSpace.getBoundingClientRect();H+=G.top+(n=="window"?0:os());var X=G.left+(n=="window"?0:ss());r.left+=X,r.right+=X}return r.top+=H,r.bottom+=H,r}function ls(e,t,r){if(r=="div")return t;var n=t.left,a=t.top;if(r=="page")n-=ss(),a-=os();else if(r=="local"||!r){var L=e.display.sizer.getBoundingClientRect();n+=L.left,a+=L.top}var H=e.display.lineSpace.getBoundingClientRect();return{left:n-H.left,top:a-H.top}}function ma(e,t,r,n,a){return n||(n=it(e.doc,t.line)),Ui(e,n,ts(e,n,t.ch,a),r)}function An(e,t,r,n,a,L){n=n||it(e.doc,t.line),a||(a=Ar(e,n));function H(Pe,Ne){var Ge=Dn(e,a,Pe,Ne?"right":"left",L);return Ne?Ge.left=Ge.right:Ge.right=Ge.left,Ui(e,n,Ge,r)}var G=Ve(n,e.doc.direction),X=t.ch,$=t.sticky;if(X>=n.text.length?(X=n.text.length,$="before"):X<=0&&(X=0,$="after"),!G)return H($=="before"?X-1:X,$=="before");function se(Pe,Ne,Ge){var Xe=G[Ne],Ze=Xe.level==1;return H(Ge?Pe-1:Pe,Ze!=Ge)}var ce=Fe(G,X,$),we=We,Ee=se(X,ce,$=="before");return we!=null&&(Ee.other=se(X,we,$!="before")),Ee}function us(e,t){var r=0;t=pt(e.doc,t),e.options.lineWrapping||(r=Cr(e.display)*t.ch);var n=it(e.doc,t.line),a=On(n)+Fi(e.display);return{left:r,right:r,top:a,bottom:a+n.height}}function ga(e,t,r,n,a){var L=Be(e,t,r);return L.xRel=a,n&&(L.outside=n),L}function va(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,r<0)return ga(n.first,0,null,-1,-1);var a=En(n,r),L=n.first+n.size-1;if(a>L)return ga(n.first+n.size-1,it(n,L).text.length,null,1,1);t<0&&(t=0);for(var H=it(n,a);;){var G=Ko(e,H,a,t,r),X=Sr(H,G.ch+(G.xRel>0||G.outside>0?1:0));if(!X)return G;var $=X.find(1);if($.line==a)return $;H=it(n,a=$.line)}}function ds(e,t,r,n){n-=pa(t);var a=t.text.length,L=Ue(function(H){return Dn(e,r,H-1).bottom<=n},a,0);return a=Ue(function(H){return Dn(e,r,H).top>n},L,a),{begin:L,end:a}}function cs(e,t,r,n){r||(r=Ar(e,t));var a=Ui(e,t,Dn(e,r,n),"line").top;return ds(e,t,r,a)}function _a(e,t,r,n){return e.bottom<=r?!1:e.top>r?!0:(n?e.left:e.right)>t}function Ko(e,t,r,n,a){a-=On(t);var L=Ar(e,t),H=pa(t),G=0,X=t.text.length,$=!0,se=Ve(t,e.doc.direction);if(se){var ce=(e.options.lineWrapping?zo:Go)(e,t,r,L,se,n,a);$=ce.level!=1,G=$?ce.from:ce.to-1,X=$?ce.to:ce.from-1}var we=null,Ee=null,Pe=Ue(function(ut){var ot=Dn(e,L,ut);return ot.top+=H,ot.bottom+=H,_a(ot,n,a,!1)?(ot.top<=a&&ot.left<=n&&(we=ut,Ee=ot),!0):!1},G,X),Ne,Ge,Xe=!1;if(Ee){var Ze=n-Ee.left<Ee.right-n,Ye=Ze==$;Pe=we+(Ye?0:1),Ge=Ye?"after":"before",Ne=Ze?Ee.left:Ee.right}else{!$&&(Pe==X||Pe==G)&&Pe++,Ge=Pe==0?"after":Pe==t.text.length?"before":Dn(e,L,Pe-($?1:0)).bottom+H<=a==$?"after":"before";var et=An(e,Be(r,Pe,Ge),"line",t,L);Ne=et.left,Xe=a<et.top?-1:a>=et.bottom?1:0}return Pe=Le(t.text,Pe,1),ga(r,Pe,Ge,Xe,n-Ne)}function Go(e,t,r,n,a,L,H){var G=Ue(function(ce){var we=a[ce],Ee=we.level!=1;return _a(An(e,Be(r,Ee?we.to:we.from,Ee?"before":"after"),"line",t,n),L,H,!0)},0,a.length-1),X=a[G];if(G>0){var $=X.level!=1,se=An(e,Be(r,$?X.from:X.to,$?"after":"before"),"line",t,n);_a(se,L,H,!0)&&se.top>H&&(X=a[G-1])}return X}function zo(e,t,r,n,a,L,H){var G=ds(e,t,n,H),X=G.begin,$=G.end;/\s/.test(t.text.charAt($-1))&&$--;for(var se=null,ce=null,we=0;we<a.length;we++){var Ee=a[we];if(Ee.from>=$||Ee.to<=X)continue;var Pe=Ee.level!=1,Ne=Dn(e,n,Pe?Math.min($,Ee.to)-1:Math.max(X,Ee.from)).right,Ge=Ne<L?L-Ne+1e9:Ne-L;(!se||ce>Ge)&&(se=Ee,ce=Ge)}return se||(se=a[a.length-1]),se.from<X&&(se={from:X,to:se.to,level:se.level}),se.to>$&&(se={from:se.from,to:$,level:se.level}),se}var or;function Rr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(or==null){or=l("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)or.appendChild(document.createTextNode("x")),or.appendChild(l("br"));or.appendChild(document.createTextNode("x"))}_(e.measure,or);var r=or.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),T(e.measure),r||1}function Cr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=l("span","xxxxxxxxxx"),r=l("pre",[t],"CodeMirror-line-like");_(e.measure,r);var n=t.getBoundingClientRect(),a=(n.right-n.left)/10;return a>2&&(e.cachedCharWidth=a),a||10}function ya(e){for(var t=e.display,r={},n={},a=t.gutters.clientLeft,L=t.gutters.firstChild,H=0;L;L=L.nextSibling,++H){var G=e.display.gutterSpecs[H].className;r[G]=L.offsetLeft+L.clientLeft+a,n[G]=L.clientWidth}return{fixedPos:ba(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function ba(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function hs(e){var t=Rr(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/Cr(e.display)-3);return function(a){if(Ln(e.doc,a))return 0;var L=0;if(a.widgets)for(var H=0;H<a.widgets.length;H++)a.widgets[H].height&&(L+=a.widgets[H].height);return r?L+(Math.ceil(a.text.length/n)||1)*t:L+t}}function Ea(e){var t=e.doc,r=hs(e);t.iter(function(n){var a=r(n);a!=n.height&&rn(n,a)})}function lr(e,t,r,n){var a=e.display;if(!r&&pe(t).getAttribute("cm-not-content")=="true")return null;var L,H,G=a.lineSpace.getBoundingClientRect();try{L=t.clientX-G.left,H=t.clientY-G.top}catch(ce){return null}var X=va(e,L,H),$;if(n&&X.xRel>0&&($=it(e.doc,X.line).text).length==X.ch){var se=j($,$.length,e.options.tabSize)-$.length;X=Be(X.line,Math.max(0,Math.round((L-qa(e.display).left)/Cr(e.display))-se))}return X}function ur(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if(t-=r[n].size,t<0)return n}function on(e,t,r,n){t==null&&(t=e.doc.first),r==null&&(r=e.doc.first+e.doc.size),n||(n=0);var a=e.display;if(n&&r<a.viewTo&&(a.updateLineNumbers==null||a.updateLineNumbers>t)&&(a.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=a.viewTo)en&&qr(e.doc,t)<a.viewTo&&Vn(e);else if(r<=a.viewFrom)en&&Gn(e.doc,r+n)>a.viewFrom?Vn(e):(a.viewFrom+=n,a.viewTo+=n);else if(t<=a.viewFrom&&r>=a.viewTo)Vn(e);else if(t<=a.viewFrom){var L=Bi(e,r,r+n,1);L?(a.view=a.view.slice(L.index),a.viewFrom=L.lineN,a.viewTo+=n):Vn(e)}else if(r>=a.viewTo){var H=Bi(e,t,t,-1);H?(a.view=a.view.slice(0,H.index),a.viewTo=H.lineN):Vn(e)}else{var G=Bi(e,t,t,-1),X=Bi(e,r,r+n,1);G&&X?(a.view=a.view.slice(0,G.index).concat(sn(e,G.lineN,X.lineN)).concat(a.view.slice(X.index)),a.viewTo+=n):Vn(e)}var $=a.externalMeasured;$&&(r<$.lineN?$.lineN+=n:t<$.lineN+$.size&&(a.externalMeasured=null))}function zn(e,t,r){e.curOp.viewChanged=!0;var n=e.display,a=e.display.externalMeasured;if(a&&t>=a.lineN&&t<a.lineN+a.size&&(n.externalMeasured=null),t<n.viewFrom||t>=n.viewTo)return;var L=n.view[ur(e,t)];if(L.node==null)return;var H=L.changes||(L.changes=[]);J(H,r)==-1&&H.push(r)}function Vn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Bi(e,t,r,n){var a=ur(e,t),L,H=e.display.view;if(!en||r==e.doc.first+e.doc.size)return{index:a,lineN:r};for(var G=e.display.viewFrom,X=0;X<a;X++)G+=H[X].size;if(G!=t){if(n>0){if(a==H.length-1)return null;L=G+H[a].size-t,a++}else L=G-t;t+=L,r+=L}for(;qr(e.doc,r)!=r;){if(a==(n<0?0:H.length-1))return null;r+=n*H[a-(n<0?1:0)].size,a+=n}return{index:a,lineN:r}}function Vo(e,t,r){var n=e.display,a=n.view;a.length==0||t>=n.viewTo||r<=n.viewFrom?(n.view=sn(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=sn(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(ur(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(sn(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,ur(e,r)))),n.viewTo=r}function fs(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var a=t[n];!a.hidden&&(!a.node||a.changes)&&++r}return r}function si(e){e.display.input.showSelection(e.display.input.prepareSelection())}function ps(e,t){t===void 0&&(t=!0);for(var r=e.doc,n={},a=n.cursors=document.createDocumentFragment(),L=n.selection=document.createDocumentFragment(),H=0;H<r.sel.ranges.length;H++){if(!t&&H==r.sel.primIndex)continue;var G=r.sel.ranges[H];if(G.from().line>=e.display.viewTo||G.to().line<e.display.viewFrom)continue;var X=G.empty();(X||e.options.showCursorWhenSelecting)&&ms(e,G.head,a),X||Xo(e,G,L)}return n}function ms(e,t,r){var n=An(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),a=r.appendChild(l("div","\xA0","CodeMirror-cursor"));if(a.style.left=n.left+"px",a.style.top=n.top+"px",a.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var L=r.appendChild(l("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));L.style.display="",L.style.left=n.other.left+"px",L.style.top=n.other.top+"px",L.style.height=(n.other.bottom-n.other.top)*.85+"px"}}function ji(e,t){return e.top-t.top||e.left-t.left}function Xo(e,t,r){var n=e.display,a=e.doc,L=document.createDocumentFragment(),H=qa(e.display),G=H.left,X=Math.max(n.sizerWidth,sr(e)-n.sizer.offsetLeft)-H.right,$=a.direction=="ltr";function se(Ye,et,ut,ot){et<0&&(et=0),et=Math.round(et),ot=Math.round(ot),L.appendChild(l("div",null,"CodeMirror-selected","position: absolute; left: "+Ye+`px;
|
|
top: `+et+"px; width: "+(ut==null?X-Ye:ut)+`px;
|
|
height: `+(ot-et)+"px"))}function ce(Ye,et,ut){var ot=it(a,Ye),gt=ot.text.length,It,Xt;function kt(jt,dn){return ma(e,Be(Ye,jt),"div",ot,dn)}function fn(jt,dn,Qt){var Gt=cs(e,ot,null,jt),Ht=dn=="ltr"==(Qt=="after")?"left":"right",Ft=Qt=="after"?Gt.begin:Gt.end-(/\s/.test(ot.text.charAt(Gt.end-1))?2:1);return kt(Ft,Ht)[Ht]}var un=Ve(ot,a.direction);return He(un,et||0,ut==null?gt:ut,function(jt,dn,Qt,Gt){var Ht=Qt=="ltr",Ft=kt(jt,Ht?"left":"right"),cn=kt(dn-1,Ht?"right":"left"),Wr=et==null&&jt==0,Zn=ut==null&&dn==gt,qt=Gt==0,Pn=!un||Gt==un.length-1;if(cn.top-Ft.top<=3){var Yt=($?Wr:Zn)&&qt,Va=($?Zn:Wr)&&Pn,Wn=Yt?G:(Ht?Ft:cn).left,pr=Va?X:(Ht?cn:Ft).right;se(Wn,Ft.top,pr-Wn,Ft.bottom)}else{var mr,nn,Kr,Xa;Ht?(mr=$&&Wr&&qt?G:Ft.left,nn=$?X:fn(jt,Qt,"before"),Kr=$?G:fn(dn,Qt,"after"),Xa=$&&Zn&&Pn?X:cn.right):(mr=$?fn(jt,Qt,"before"):G,nn=!$&&Wr&&qt?X:Ft.right,Kr=!$&&Zn&&Pn?G:cn.left,Xa=$?fn(dn,Qt,"after"):X),se(mr,Ft.top,nn-mr,Ft.bottom),Ft.bottom<cn.top&&se(G,Ft.bottom,null,cn.top),se(Kr,cn.top,Xa-Kr,cn.bottom)}(!It||ji(Ft,It)<0)&&(It=Ft),ji(cn,It)<0&&(It=cn),(!Xt||ji(Ft,Xt)<0)&&(Xt=Ft),ji(cn,Xt)<0&&(Xt=cn)}),{start:It,end:Xt}}var we=t.from(),Ee=t.to();if(we.line==Ee.line)ce(we.line,we.ch,Ee.ch);else{var Pe=it(a,we.line),Ne=it(a,Ee.line),Ge=mn(Pe)==mn(Ne),Xe=ce(we.line,we.ch,Ge?Pe.text.length+1:null).end,Ze=ce(Ee.line,Ge?0:null,Ee.ch).start;Ge&&(Xe.top<Ze.top-2?(se(Xe.right,Xe.top,null,Xe.bottom),se(G,Ze.top,Ze.left,Ze.bottom)):se(Xe.right,Xe.top,Ze.left-Xe.right,Xe.bottom)),Xe.bottom<Ze.top&&se(G,Xe.bottom,null,Ze.top)}r.appendChild(L)}function Ta(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()||Lr(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(),xa(e))}function vs(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Lr(e))},100)}function xa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Oe(e,"focus",e,t),e.state.focused=!0,I(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),P&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ta(e)}function Lr(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Oe(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 Hi(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var a=t.view[n],L=e.options.lineWrapping,H=void 0,G=0;if(a.hidden)continue;if(W&&B<8){var X=a.node.offsetTop+a.node.offsetHeight;H=X-r,r=X}else{var $=a.node.getBoundingClientRect();H=$.bottom-$.top,!L&&a.text.firstChild&&(G=a.text.firstChild.getBoundingClientRect().right-$.left-1)}var se=a.line.height-H;if((se>.005||se<-.005)&&(rn(a.line,H),_s(a.line),a.rest))for(var ce=0;ce<a.rest.length;ce++)_s(a.rest[ce]);if(G>e.display.sizerWidth){var we=Math.ceil(G/Cr(e.display));we>e.display.maxLineLength&&(e.display.maxLineLength=we,e.display.maxLine=a.line,e.display.maxLineChanged=!0)}}}function _s(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode;n&&(r.height=n.offsetHeight)}}function Wi(e,t,r){var n=r&&r.top!=null?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-Fi(e));var a=r&&r.bottom!=null?r.bottom:n+e.wrapper.clientHeight,L=En(t,n),H=En(t,a);if(r&&r.ensure){var G=r.ensure.from.line,X=r.ensure.to.line;G<L?(L=G,H=En(t,On(it(t,G))+e.wrapper.clientHeight)):Math.min(X,t.lastLine())>=H&&(L=En(t,On(it(t,X))-e.wrapper.clientHeight),H=X)}return{from:L,to:Math.max(H,L+1)}}function Yo(e,t){if(Me(e,"scrollCursorIntoView"))return;var r=e.display,n=r.sizer.getBoundingClientRect(),a=null;if(t.top+n.top<0?a=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(a=!1),a!=null&&!s){var L=l("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-r.viewOffset-Fi(e.display))+`px;
|
|
height: `+(t.bottom-t.top+In(e)+r.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(L),L.scrollIntoView(a),e.display.lineSpace.removeChild(L)}}function $o(e,t,r,n){n==null&&(n=0);var a;!e.options.lineWrapping&&t==r&&(t=t.ch?Be(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,r=t.sticky=="before"?Be(t.line,t.ch+1,"before"):t);for(var L=0;L<5;L++){var H=!1,G=An(e,t),X=!r||r==t?G:An(e,r);a={left:Math.min(G.left,X.left),top:Math.min(G.top,X.top)-n,right:Math.max(G.left,X.left),bottom:Math.max(G.bottom,X.bottom)+n};var $=wa(e,a),se=e.doc.scrollTop,ce=e.doc.scrollLeft;if($.scrollTop!=null&&(li(e,$.scrollTop),Math.abs(e.doc.scrollTop-se)>1&&(H=!0)),$.scrollLeft!=null&&(dr(e,$.scrollLeft),Math.abs(e.doc.scrollLeft-ce)>1&&(H=!0)),!H)break}return a}function Qo(e,t){var r=wa(e,t);r.scrollTop!=null&&li(e,r.scrollTop),r.scrollLeft!=null&&dr(e,r.scrollLeft)}function wa(e,t){var r=e.display,n=Rr(e.display);t.top<0&&(t.top=0);var a=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,L=ha(e),H={};t.bottom-t.top>L&&(t.bottom=t.top+L);var G=e.doc.height+ca(r),X=t.top<n,$=t.bottom>G-n;if(t.top<a)H.scrollTop=X?0:t.top;else if(t.bottom>a+L){var se=Math.min(t.top,($?G:t.bottom)-L);se!=a&&(H.scrollTop=se)}var ce=e.options.fixedGutter?0:r.gutters.offsetWidth,we=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-ce,Ee=sr(e)-r.gutters.offsetWidth,Pe=t.right-t.left>Ee;return Pe&&(t.right=t.left+Ee),t.left<10?H.scrollLeft=0:t.left<we?H.scrollLeft=Math.max(0,t.left+ce-(Pe?0:10)):t.right>Ee+we-3&&(H.scrollLeft=t.right+(Pe?0:10)-Ee),H}function Sa(e,t){if(t==null)return;Ki(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Ir(e){Ki(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function oi(e,t,r){(t!=null||r!=null)&&Ki(e),t!=null&&(e.curOp.scrollLeft=t),r!=null&&(e.curOp.scrollTop=r)}function Jo(e,t){Ki(e),e.curOp.scrollToPos=t}function Ki(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=us(e,t.from),n=us(e,t.to);ys(e,r,n,t.margin)}}function ys(e,t,r,n){var a=wa(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});oi(e,a.scrollLeft,a.scrollTop)}function li(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||Aa(e,{top:t}),bs(e,t,!0),D&&Aa(e),ci(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 dr(e,t,r,n){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)&&!n)return;e.doc.scrollLeft=t,Ss(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function ui(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+ca(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:n,scrollHeight:n+In(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var cr=function(e,t,r){this.cm=r;var n=this.vert=l("div",[l("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),a=this.horiz=l("div",[l("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=a.tabIndex=-1,e(n),e(a),Ce(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Ce(a,"scroll",function(){a.clientWidth&&t(a.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,W&&B<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};cr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var a=e.viewHeight-(t?n: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?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var L=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+L)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(n==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},cr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},cr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},cr.prototype.zeroWidthHack=function(){var e=u&&!d?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new K,this.disableVert=new K},cr.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function n(){var a=e.getBoundingClientRect(),L=r=="vert"?document.elementFromPoint(a.right-1,(a.top+a.bottom)/2):document.elementFromPoint((a.right+a.left)/2,a.bottom-1);L!=e?e.style.pointerEvents="none":t.set(1e3,n)}t.set(1e3,n)},cr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var di=function(){};di.prototype.update=function(){return{bottom:0,right:0}},di.prototype.setScrollLeft=function(){},di.prototype.setScrollTop=function(){},di.prototype.clear=function(){};function Dr(e,t){t||(t=ui(e));var r=e.display.barWidth,n=e.display.barHeight;Es(e,t);for(var a=0;a<4&&r!=e.display.barWidth||n!=e.display.barHeight;a++)r!=e.display.barWidth&&e.options.lineWrapping&&Hi(e),Es(e,ui(e)),r=e.display.barWidth,n=e.display.barHeight}function Es(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}var Ts={native:cr,null:di};function xs(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&w(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ts[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ce(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"?dr(e,t):li(e,t)},e),e.display.scrollbars.addClass&&I(e.display.wrapper,e.display.scrollbars.addClass)}var Zo=0;function hr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zo},yn(e.curOp)}function fr(e){var t=e.curOp;t&&Io(t,function(r){for(var n=0;n<r.ops.length;n++)r.ops[n].cm.curOp=null;qo(r)})}function qo(e){for(var t=e.ops,r=0;r<t.length;r++)el(t[r]);for(var n=0;n<t.length;n++)tl(t[n]);for(var a=0;a<t.length;a++)nl(t[a]);for(var L=0;L<t.length;L++)rl(t[L]);for(var H=0;H<t.length;H++)il(t[H])}function el(e){var t=e.cm,r=t.display;sl(t),e.updateMaxLine&&Ni(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 Gi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Oa(e.cm,e.update)}function nl(e){var t=e.cm,r=t.display;e.updatedDisplay&&Hi(t),e.barMeasure=ui(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+In(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-sr(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&&dr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==k();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Dr(t,e.barMeasure),e.updatedDisplay&&Ca(t,e.barMeasure),e.selectionChanged&&Ta(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&gs(e.cm)}function il(e){var t=e.cm,r=t.display,n=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&&dr(t,e.scrollLeft,!0,!0),e.scrollToPos){var a=$o(t,pt(n,e.scrollToPos.from),pt(n,e.scrollToPos.to),e.scrollToPos.margin);Yo(t,a)}var L=e.maybeHiddenMarkers,H=e.maybeUnhiddenMarkers;if(L)for(var G=0;G<L.length;++G)L[G].lines.length||Oe(L[G],"hide");if(H)for(var X=0;X<H.length;++X)H[X].lines.length&&Oe(H[X],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Oe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function hn(e,t){if(e.curOp)return t();hr(e);try{return t()}finally{fr(e)}}function zt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);hr(e);try{return t.apply(e,arguments)}finally{fr(e)}}}function tn(e){return function(){if(this.curOp)return e.apply(this,arguments);hr(this);try{return e.apply(this,arguments)}finally{fr(this)}}}function Vt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);hr(t);try{return e.apply(this,arguments)}finally{fr(t)}}}function ci(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,C(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var r=+new Date+e.options.workTime,n=Tn(e,t.highlightFrontier),a=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(L){if(n.line>=e.display.viewFrom){var H=L.styles,G=L.text.length>e.options.maxHighlightLength?Wt(t.mode,n.state):null,X=Vr(e,L,n,!0);G&&(n.state=G),L.styles=X.styles;var $=L.styleClasses,se=X.classes;se?L.styleClasses=se:$&&(L.styleClasses=null);for(var ce=!H||H.length!=L.styles.length||$!=se&&(!$||!se||$.bgClass!=se.bgClass||$.textClass!=se.textClass),we=0;!ce&&we<H.length;++we)ce=H[we]!=L.styles[we];ce&&a.push(n.line),L.stateAfter=n.save(),n.nextLine()}else L.text.length<=e.options.maxHighlightLength&&Xr(e,L.text,n),L.stateAfter=n.line%5==0?n.save():null,n.nextLine();if(+new Date>r)return ci(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),a.length&&hn(e,function(){for(var L=0;L<a.length;L++)zn(e,a[L],"text")})}var Gi=function(e,t,r){var n=e.display;this.viewport=t,this.visible=Wi(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=sr(e),this.force=r,this.dims=ya(e),this.events=[]};Gi.prototype.signal=function(e,t){he(e,t)&&this.events.push(arguments)},Gi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Oe.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=In(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=In(e)+"px",t.scrollbarsClipped=!0)}function ol(e){if(e.hasFocus())return null;var t=k();if(!t||!y(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&y(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset)}return r}function ll(e){if(!e||!e.activeElt||e.activeElt==k())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&y(document.body,e.anchorNode)&&y(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 Oa(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return Vn(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;Os(e)&&(Vn(e),t.dims=ya(e));var a=n.first+n.size,L=Math.max(t.visible.from-e.options.viewportMargin,n.first),H=Math.min(a,t.visible.to+e.options.viewportMargin);r.viewFrom<L&&L-r.viewFrom<20&&(L=Math.max(n.first,r.viewFrom)),r.viewTo>H&&r.viewTo-H<20&&(H=Math.min(a,r.viewTo)),en&&(L=qr(e.doc,L),H=Gn(e.doc,H));var G=L!=r.viewFrom||H!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Vo(e,L,H),r.viewOffset=On(it(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var X=fs(e);if(!G&&X==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var $=ol(e);return X>4&&(r.lineDiv.style.display="none"),ul(e,r.updateLineNumbers,t.dims),X>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,ll($),T(r.cursorDiv),T(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,G&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,ci(e,400)),r.updateLineNumbers=null,!0}function ws(e,t){for(var r=t.viewport,n=!0;;n=!1){if(!n||!e.options.lineWrapping||t.oldDisplayWidth==sr(e)){if(r&&r.top!=null&&(r={top:Math.min(e.doc.height+ca(e.display)-ha(e),r.top)}),t.visible=Wi(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else n&&(t.visible=Wi(e.display,e.doc,r));if(!Oa(e,t))break;Hi(e);var a=ui(e);si(e),Dr(e,a),Ca(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 Gi(e,t);if(Oa(e,r)){Hi(e),ws(e,r);var n=ui(e);si(e),Dr(e,n),Ca(e,n),r.finish()}}function ul(e,t,r){var n=e.display,a=e.options.lineNumbers,L=n.lineDiv,H=L.firstChild;function G(Pe){var Ne=Pe.nextSibling;return P&&u&&e.display.currentWheelTarget==Pe?Pe.style.display="none":Pe.parentNode.removeChild(Pe),Ne}for(var X=n.view,$=n.viewFrom,se=0;se<X.length;se++){var ce=X[se];if(!ce.hidden)if(!ce.node||ce.node.parentNode!=L){var we=No(e,ce,$,r);L.insertBefore(we,H)}else{for(;H!=ce.node;)H=G(H);var Ee=a&&t!=null&&t<=$&&ce.lineNumber;ce.changes&&(J(ce.changes,"gutter")>-1&&(Ee=!1),Ya(e,ce,$,r)),Ee&&(T(ce.lineNumber),ce.lineNumber.appendChild(document.createTextNode(vr(e.options,$)))),H=ce.node.nextSibling}$+=ce.size}for(;H;)H=G(H)}function Ra(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Ca(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+In(e)+"px"}function Ss(e){var t=e.display,r=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var n=ba(t)-t.scroller.scrollLeft+e.doc.scrollLeft,a=t.gutters.offsetWidth,L=n+"px",H=0;H<r.length;H++)if(!r[H].hidden){e.options.fixedGutter&&(r[H].gutter&&(r[H].gutter.style.left=L),r[H].gutterBackground&&(r[H].gutterBackground.style.left=L));var G=r[H].alignable;if(G)for(var X=0;X<G.length;X++)G[X].style.left=L}e.options.fixedGutter&&(t.gutters.style.left=n+a+"px")}function Os(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=vr(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var a=n.measure.appendChild(l("div",[l("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),L=a.firstChild.offsetWidth,H=a.offsetWidth-L;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(L,n.lineGutter.offsetWidth-H)+1,n.lineNumWidth=n.lineNumInnerWidth+H,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",Ra(e.display),!0}return!1}function La(e,t){for(var r=[],n=!1,a=0;a<e.length;a++){var L=e[a],H=null;if(typeof L!="string"&&(H=L.style,L=L.className),L=="CodeMirror-linenumbers")if(t)n=!0;else continue;r.push({className:L,style:H})}return t&&!n&&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 n=0;n<r.length;++n){var a=r[n],L=a.className,H=a.style,G=t.appendChild(l("div",null,"CodeMirror-gutter "+L));H&&(G.style.cssText=H),L=="CodeMirror-linenumbers"&&(e.lineGutter=G,G.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",Ra(e)}function hi(e){As(e.display),on(e),Ss(e)}function dl(e,t,r,n){var a=this;this.input=r,a.scrollbarFiller=l("div",null,"CodeMirror-scrollbar-filler"),a.scrollbarFiller.setAttribute("cm-not-content","true"),a.gutterFiller=l("div",null,"CodeMirror-gutter-filler"),a.gutterFiller.setAttribute("cm-not-content","true"),a.lineDiv=b("div",null,"CodeMirror-code"),a.selectionDiv=l("div",null,null,"position: relative; z-index: 1"),a.cursorDiv=l("div",null,"CodeMirror-cursors"),a.measure=l("div",null,"CodeMirror-measure"),a.lineMeasure=l("div",null,"CodeMirror-measure"),a.lineSpace=b("div",[a.measure,a.lineMeasure,a.selectionDiv,a.cursorDiv,a.lineDiv],null,"position: relative; outline: none");var L=b("div",[a.lineSpace],"CodeMirror-lines");a.mover=l("div",[L],null,"position: relative"),a.sizer=l("div",[a.mover],"CodeMirror-sizer"),a.sizerWidth=null,a.heightForcer=l("div",null,null,"position: absolute; height: "+te+"px; width: 1px;"),a.gutters=l("div",null,"CodeMirror-gutters"),a.lineGutter=null,a.scroller=l("div",[a.sizer,a.heightForcer,a.gutters],"CodeMirror-scroll"),a.scroller.setAttribute("tabIndex","-1"),a.wrapper=l("div",[a.scrollbarFiller,a.gutterFiller,a.scroller],"CodeMirror"),W&&B<8&&(a.gutters.style.zIndex=-1,a.scroller.style.paddingRight=0),!P&&!(D&&i)&&(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(n.gutters,n.lineNumbers),As(a),r.init(a)}var zi=0,gn=null;W?gn=-.53:D?gn=15:g?gn=-.7:f&&(gn=-1/3);function Rs(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 cl(e){var t=Rs(e);return t.x*=gn,t.y*=gn,t}function Cs(e,t){var r=Rs(t),n=r.x,a=r.y,L=e.display,H=L.scroller,G=H.scrollWidth>H.clientWidth,X=H.scrollHeight>H.clientHeight;if(!(n&&G||a&&X))return;if(a&&u&&P){e:for(var $=t.target,se=L.view;$!=H;$=$.parentNode)for(var ce=0;ce<se.length;ce++)if(se[ce].node==$){e.display.currentWheelTarget=$;break e}}if(n&&!D&&!p&&gn!=null){a&&X&&li(e,Math.max(0,H.scrollTop+a*gn)),dr(e,Math.max(0,H.scrollLeft+n*gn)),(!a||a&&X)&&Y(t),L.wheelStartX=null;return}if(a&&gn!=null){var we=a*gn,Ee=e.doc.scrollTop,Pe=Ee+L.wrapper.clientHeight;we<0?Ee=Math.max(0,Ee+we-50):Pe=Math.min(e.doc.height,Pe+we+50),Aa(e,{top:Ee,bottom:Pe})}zi<20&&(L.wheelStartX==null?(L.wheelStartX=H.scrollLeft,L.wheelStartY=H.scrollTop,L.wheelDX=n,L.wheelDY=a,setTimeout(function(){if(L.wheelStartX==null)return;var Ne=H.scrollLeft-L.wheelStartX,Ge=H.scrollTop-L.wheelStartY,Xe=Ge&&L.wheelDY&&Ge/L.wheelDY||Ne&&L.wheelDX&&Ne/L.wheelDX;if(L.wheelStartX=L.wheelStartY=null,!Xe)return;gn=(gn*zi+Xe)/(zi+1),++zi},200)):(L.wheelDX+=n,L.wheelDY+=a))}var vn=function(e,t){this.ranges=e,this.primIndex=t};vn.prototype.primary=function(){return this.ranges[this.primIndex]},vn.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],n=e.ranges[t];if(!zr(r.anchor,n.anchor)||!zr(r.head,n.head))return!1}return!0},vn.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Rt(_r(this.ranges[t].anchor),_r(this.ranges[t].head));return new vn(e,this.primIndex)},vn.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},vn.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(ht(t,n.from())>=0&&ht(e,n.to())<=0)return r}return-1};var Rt=function(e,t){this.anchor=e,this.head=t};Rt.prototype.from=function(){return er(this.anchor,this.head)},Rt.prototype.to=function(){return yr(this.anchor,this.head)},Rt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Rn(e,t,r){var n=e&&e.options.selectionsMayTouch,a=t[r];t.sort(function(we,Ee){return ht(we.from(),Ee.from())}),r=J(t,a);for(var L=1;L<t.length;L++){var H=t[L],G=t[L-1],X=ht(G.to(),H.from());if(n&&!H.empty()?X>0:X>=0){var $=er(G.from(),H.from()),se=yr(G.to(),H.to()),ce=G.empty()?H.from()==H.head:G.from()==G.head;L<=r&&--r,t.splice(--L,2,new Rt(ce?se:$,ce?$:se))}}return new vn(t,r)}function Xn(e,t){return new vn([new Rt(e,t||e)],0)}function Yn(e){return e.text?Be(e.from.line+e.text.length-1,Q(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ls(e,t){if(ht(e,t.from)<0)return e;if(ht(e,t.to)<=0)return Yn(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=Yn(t).ch-t.to.ch),Be(r,n)}function Ia(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var a=e.sel.ranges[n];r.push(new Rt(Ls(a.anchor,t),Ls(a.head,t)))}return Rn(e.cm,r,e.sel.primIndex)}function Is(e,t,r){return e.line==t.line?Be(r.line,e.ch-t.ch+r.ch):Be(r.line+(e.line-t.line),e.ch)}function hl(e,t,r){for(var n=[],a=Be(e.first,0),L=a,H=0;H<t.length;H++){var G=t[H],X=Is(G.from,a,L),$=Is(Yn(G),a,L);if(a=G.to,L=$,r=="around"){var se=e.sel.ranges[H],ce=ht(se.head,se.anchor)<0;n[H]=new Rt(ce?$:X,ce?X:$)}else n[H]=new Rt(X,X)}return new vn(n,e.sel.primIndex)}function Da(e){e.doc.mode=mt(e.options,e.doc.modeOption),fi(e)}function fi(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,ci(e,100),e.state.modeGen++,e.curOp&&on(e)}function Ds(e,t){return t.from.ch==0&&t.to.ch==0&&Q(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Pa(e,t,r,n){function a(Ze){return r?r[Ze]:null}function L(Ze,Ye,et){ua(Ze,Ye,et,n),$t(Ze,"change",Ze,t)}function H(Ze,Ye){for(var et=[],ut=Ze;ut<Ye;++ut)et.push(new ar($[ut],a(ut),n));return et}var G=t.from,X=t.to,$=t.text,se=it(e,G.line),ce=it(e,X.line),we=Q($),Ee=a($.length-1),Pe=X.line-G.line;if(t.full)e.insert(0,H(0,$.length)),e.remove($.length,e.size-$.length);else if(Ds(e,t)){var Ne=H(0,$.length-1);L(ce,ce.text,Ee),Pe&&e.remove(G.line,Pe),Ne.length&&e.insert(G.line,Ne)}else if(se==ce)if($.length==1)L(se,se.text.slice(0,G.ch)+we+se.text.slice(X.ch),Ee);else{var Ge=H(1,$.length-1);Ge.push(new ar(we+se.text.slice(X.ch),Ee,n)),L(se,se.text.slice(0,G.ch)+$[0],a(0)),e.insert(G.line+1,Ge)}else if($.length==1)L(se,se.text.slice(0,G.ch)+$[0]+ce.text.slice(X.ch),a(0)),e.remove(G.line+1,Pe);else{L(se,se.text.slice(0,G.ch)+$[0],a(0)),L(ce,we+ce.text.slice(X.ch),Ee);var Xe=H(1,$.length-1);Pe>1&&e.remove(G.line+1,Pe-1),e.insert(G.line+1,Xe)}$t(e,"change",e,t)}function $n(e,t,r){function n(a,L,H){if(a.linked)for(var G=0;G<a.linked.length;++G){var X=a.linked[G];if(X.doc==L)continue;var $=H&&X.sharedHist;if(r&&!$)continue;t(X.doc,$),n(X.doc,a,$)}}n(e,null,!0)}function Ps(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ea(e),Da(e),ks(e),e.options.lineWrapping||Ni(e),e.options.mode=t.modeOption,on(e)}function ks(e){(e.doc.direction=="rtl"?I:w)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){hn(e,function(){ks(e),on(e)})}function Vi(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 ka(e,t){var r={from:_r(t.from),to:Yn(t),text:kn(e,t.from,t.to)};return Fs(e,r,t.from.line,t.to.line+1),$n(e,function(n){return Fs(n,r,t.from.line,t.to.line+1)},!0),r}function Ms(e){for(;e.length;){var t=Q(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Ms(e.done),Q(e.done);if(e.done.length&&!Q(e.done).ranges)return Q(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Q(e.done)}function Ns(e,t,r,n){var a=e.history;a.undone.length=0;var L=+new Date,H,G;if((a.lastOp==n||a.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&a.lastModTime>L-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(H=pl(a,a.lastOp==n)))G=Q(H.changes),ht(t.from,t.to)==0&&ht(t.from,G.to)==0?G.to=Yn(t):H.changes.push(ka(e,t));else{var X=Q(a.done);for((!X||!X.ranges)&&Xi(e.sel,a.done),H={changes:[ka(e,t)],generation:a.generation},a.done.push(H);a.done.length>a.undoDepth;)a.done.shift(),a.done[0].ranges||a.done.shift()}a.done.push(r),a.generation=++a.maxGeneration,a.lastModTime=a.lastSelTime=L,a.lastOp=a.lastSelOp=n,a.lastOrigin=a.lastSelOrigin=t.origin,G||Oe(e,"historyAdded")}function ml(e,t,r,n){var a=t.charAt(0);return a=="*"||a=="+"&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,r,n){var a=e.history,L=n&&n.origin;r==a.lastSelOp||L&&a.lastSelOrigin==L&&(a.lastModTime==a.lastSelTime&&a.lastOrigin==L||ml(e,L,Q(a.done),t))?a.done[a.done.length-1]=t:Xi(t,a.done),a.lastSelTime=+new Date,a.lastSelOrigin=L,a.lastSelOp=r,n&&n.clearRedo!==!1&&Ms(a.undone)}function Xi(e,t){var r=Q(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Fs(e,t,r,n){var a=t["spans_"+e.id],L=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(H){H.markedSpans&&((a||(a=t["spans_"+e.id]={}))[L]=H.markedSpans),++L})}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 _l(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],a=0;a<t.text.length;++a)n.push(vl(r[a]));return n}function Us(e,t){var r=_l(e,t),n=Tr(e,t);if(!r)return n;if(!n)return r;for(var a=0;a<r.length;++a){var L=r[a],H=n[a];if(L&&H){e:for(var G=0;G<H.length;++G){for(var X=H[G],$=0;$<L.length;++$)if(L[$].marker==X.marker)continue e;L.push(X)}}else H&&(r[a]=H)}return r}function Pr(e,t,r){for(var n=[],a=0;a<e.length;++a){var L=e[a];if(L.ranges){n.push(r?vn.prototype.deepCopy.call(L):L);continue}var H=L.changes,G=[];n.push({changes:G});for(var X=0;X<H.length;++X){var $=H[X],se=void 0;if(G.push({from:$.from,to:$.to,text:$.text}),t)for(var ce in $)(se=ce.match(/^spans_(\d+)$/))&&(J(t,Number(se[1]))>-1&&(Q(G)[ce]=$[ce],delete $[ce]))}}return n}function Ma(e,t,r,n){if(n){var a=e.anchor;if(r){var L=ht(t,a)<0;L!=ht(r,a)<0?(a=t,t=r):L!=ht(t,r)<0&&(t=r)}return new Rt(a,t)}else return new Rt(r||t,t)}function Yi(e,t,r,n,a){a==null&&(a=e.cm&&(e.cm.display.shift||e.extend)),Zt(e,new vn([Ma(e.sel.primary(),t,r,a)],0),n)}function Bs(e,t,r){for(var n=[],a=e.cm&&(e.cm.display.shift||e.extend),L=0;L<e.sel.ranges.length;L++)n[L]=Ma(e.sel.ranges[L],t[L],null,a);var H=Rn(e.cm,n,e.sel.primIndex);Zt(e,H,r)}function Na(e,t,r,n){var a=e.sel.ranges.slice(0);a[t]=r,Zt(e,Rn(e.cm,a,e.sel.primIndex),n)}function js(e,t,r,n){Zt(e,Xn(t,r),n)}function yl(e,t,r){var n={ranges:t.ranges,update:function(a){this.ranges=[];for(var L=0;L<a.length;L++)this.ranges[L]=new Rt(pt(e,a[L].anchor),pt(e,a[L].head))},origin:r&&r.origin};return Oe(e,"beforeSelectionChange",e,n),e.cm&&Oe(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?Rn(e.cm,n.ranges,n.ranges.length-1):t}function Hs(e,t,r){var n=e.history.done,a=Q(n);a&&a.ranges?(n[n.length-1]=t,$i(e,t,r)):Zt(e,t,r)}function Zt(e,t,r){$i(e,t,r),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function $i(e,t,r){(he(e,"beforeSelectionChange")||e.cm&&he(e.cm,"beforeSelectionChange"))&&(t=yl(e,t,r));var n=r&&r.bias||(ht(t.primary().head,e.sel.primary().head)<0?-1:1);Ws(e,Gs(e,t,n,!0)),!(r&&r.scroll===!1)&&e.cm&&Ir(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,_e(e.cm)),$t(e,"cursorActivity",e)}function Ks(e){Ws(e,Gs(e,e.sel,null,!1))}function Gs(e,t,r,n){for(var a,L=0;L<t.ranges.length;L++){var H=t.ranges[L],G=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[L],X=Qi(e,H.anchor,G&&G.anchor,r,n),$=Qi(e,H.head,G&&G.head,r,n);(a||X!=H.anchor||$!=H.head)&&(a||(a=t.ranges.slice(0,L)),a[L]=new Rt(X,$))}return a?Rn(e.cm,a,t.primIndex):t}function kr(e,t,r,n,a){var L=it(e,t.line);if(L.markedSpans)for(var H=0;H<L.markedSpans.length;++H){var G=L.markedSpans[H],X=G.marker,$="selectLeft"in X?!X.selectLeft:X.inclusiveLeft,se="selectRight"in X?!X.selectRight:X.inclusiveRight;if((G.from==null||($?G.from<=t.ch:G.from<t.ch))&&(G.to==null||(se?G.to>=t.ch:G.to>t.ch))){if(a&&(Oe(X,"beforeCursorEnter"),X.explicitlyCleared))if(L.markedSpans){--H;continue}else break;if(!X.atomic)continue;if(r){var ce=X.find(n<0?1:-1),we=void 0;if((n<0?se:$)&&(ce=zs(e,ce,-n,ce&&ce.line==t.line?L:null)),ce&&ce.line==t.line&&(we=ht(ce,r))&&(n<0?we<0:we>0))return kr(e,ce,t,n,a)}var Ee=X.find(n<0?-1:1);return(n<0?$:se)&&(Ee=zs(e,Ee,n,Ee.line==t.line?L:null)),Ee?kr(e,Ee,t,n,a):null}}return t}function Qi(e,t,r,n,a){var L=n||1,H=kr(e,t,r,L,a)||!a&&kr(e,t,r,L,!0)||kr(e,t,r,-L,a)||!a&&kr(e,t,r,-L,!0);return H||(e.cantEdit=!0,Be(e.first,0))}function zs(e,t,r,n){return r<0&&t.ch==0?t.line>e.first?pt(e,Be(t.line-1)):null:r>0&&t.ch==(n||it(e,t.line)).text.length?t.line<e.first+e.size-1?Be(t.line+1,0):null:new Be(t.line,t.ch+r)}function Vs(e){e.setSelection(Be(e.firstLine(),0),Be(e.lastLine()),ue)}function Xs(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return n.canceled=!0}};return r&&(n.update=function(a,L,H,G){a&&(n.from=pt(e,a)),L&&(n.to=pt(e,L)),H&&(n.text=H),G!==void 0&&(n.origin=G)}),Oe(e,"beforeChange",e,n),e.cm&&Oe(e.cm,"beforeChange",e.cm,n),n.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:n.from,to:n.to,text:n.text,origin:n.origin}}function Mr(e,t,r){if(e.cm){if(!e.cm.curOp)return zt(e.cm,Mr)(e,t,r);if(e.cm.state.suppressEdits)return}if((he(e,"beforeChange")||e.cm&&he(e.cm,"beforeChange"))&&(t=Xs(e,t,!0),!t))return;var n=Jr&&!r&&Pi(e,t.from,t.to);if(n)for(var a=n.length-1;a>=0;--a)Ys(e,{from:n[a].from,to:n[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]==""&&ht(t.from,t.to)==0)return;var r=Ia(e,t);Ns(e,t,r,e.cm?e.cm.curOp.id:NaN),pi(e,t,r,Tr(e,t));var n=[];$n(e,function(a,L){!L&&J(n,a.history)==-1&&(Zs(a.history,t),n.push(a.history)),pi(a,t,null,Tr(a,t))})}function Ji(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(n&&!r)return;for(var a=e.history,L,H=e.sel,G=t=="undo"?a.done:a.undone,X=t=="undo"?a.undone:a.done,$=0;$<G.length&&!(L=G[$],r?L.ranges&&!L.equals(e.sel):!L.ranges);$++);if($==G.length)return;for(a.lastOrigin=a.lastSelOrigin=null;;)if(L=G.pop(),L.ranges){if(Xi(L,X),r&&!L.equals(e.sel)){Zt(e,L,{clearRedo:!1});return}H=L}else if(n){G.push(L);return}else break;var se=[];Xi(H,X),X.push({changes:se,generation:a.generation}),a.generation=L.generation||++a.maxGeneration;for(var ce=he(e,"beforeChange")||e.cm&&he(e.cm,"beforeChange"),we=function(Ne){var Ge=L.changes[Ne];if(Ge.origin=t,ce&&!Xs(e,Ge,!1))return G.length=0,{};se.push(ka(e,Ge));var Xe=Ne?Ia(e,Ge):Q(G);pi(e,Ge,Xe,Us(e,Ge)),!Ne&&e.cm&&e.cm.scrollIntoView({from:Ge.from,to:Yn(Ge)});var Ze=[];$n(e,function(Ye,et){!et&&J(Ze,Ye.history)==-1&&(Zs(Ye.history,Ge),Ze.push(Ye.history)),pi(Ye,Ge,null,Us(Ye,Ge))})},Ee=L.changes.length-1;Ee>=0;--Ee){var Pe=we(Ee);if(Pe)return Pe.v}}function $s(e,t){if(t==0)return;if(e.first+=t,e.sel=new vn(ie(e.sel.ranges,function(a){return new Rt(Be(a.anchor.line+t,a.anchor.ch),Be(a.head.line+t,a.head.ch))}),e.sel.primIndex),e.cm){on(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)zn(e.cm,n,"gutter")}}function pi(e,t,r,n){if(e.cm&&!e.cm.curOp)return zt(e.cm,pi)(e,t,r,n);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:Be(e.first,0),to:Be(t.to.line+a,t.to.ch),text:[Q(t.text)],origin:t.origin}}var L=e.lastLine();t.to.line>L&&(t={from:t.from,to:Be(L,it(e,L).text.length),text:[t.text[0]],origin:t.origin}),t.removed=kn(e,t.from,t.to),r||(r=Ia(e,t)),e.cm?bl(e.cm,t,n):Pa(e,t,n),$i(e,r,ue),e.cantEdit&&Qi(e,Be(e.firstLine(),0))&&(e.cantEdit=!1)}function bl(e,t,r){var n=e.doc,a=e.display,L=t.from,H=t.to,G=!1,X=L.line;e.options.lineWrapping||(X=St(mn(it(n,L.line))),n.iter(X,H.line+1,function(Ee){if(Ee==a.maxLine)return G=!0,!0})),n.sel.contains(t.from,t.to)>-1&&_e(e),Pa(n,t,r,hs(e)),e.options.lineWrapping||(n.iter(X,L.line+t.text.length,function(Ee){var Pe=ti(Ee);Pe>a.maxLineLength&&(a.maxLine=Ee,a.maxLineLength=Pe,a.maxLineChanged=!0,G=!1)}),G&&(e.curOp.updateMaxLine=!0)),aa(n,L.line),ci(e,400);var $=t.text.length-(H.line-L.line)-1;t.full?on(e):L.line==H.line&&t.text.length==1&&!Ds(e.doc,t)?zn(e,L.line,"text"):on(e,L.line,H.line+1,$);var se=he(e,"changes"),ce=he(e,"change");if(ce||se){var we={from:L,to:H,text:t.text,removed:t.removed,origin:t.origin};ce&&$t(e,"change",e,we),se&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(we)}e.display.selForContextMenu=null}function Nr(e,t,r,n,a){var L;n||(n=r),ht(n,r)<0&&(L=[n,r],r=L[0],n=L[1]),typeof t=="string"&&(t=e.splitLines(t)),Mr(e,{from:r,to:n,text:t,origin:a})}function Qs(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function Js(e,t,r,n){for(var a=0;a<e.length;++a){var L=e[a],H=!0;if(L.ranges){L.copied||(L=e[a]=L.deepCopy(),L.copied=!0);for(var G=0;G<L.ranges.length;G++)Qs(L.ranges[G].anchor,t,r,n),Qs(L.ranges[G].head,t,r,n);continue}for(var X=0;X<L.changes.length;++X){var $=L.changes[X];if(r<$.from.line)$.from=Be($.from.line+n,$.from.ch),$.to=Be($.to.line+n,$.to.ch);else if(t<=$.to.line){H=!1;break}}H||(e.splice(0,a+1),a=0)}}function Zs(e,t){var r=t.from.line,n=t.to.line,a=t.text.length-(n-r)-1;Js(e.done,r,n,a),Js(e.undone,r,n,a)}function mi(e,t,r,n){var a=t,L=t;return typeof t=="number"?L=it(e,br(e,t)):a=St(t),a==null?null:(n(L,a)&&e.cm&&zn(e.cm,a,r),L)}function gi(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}gi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;r<n;++r){var a=this.lines[r];this.height-=a.height,at(a),$t(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 n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}};function vi(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var a=e[n];t+=a.chunkSize(),r+=a.height,a.parent=this}this.size=t,this.height=r,this.parent=null}vi.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],a=n.chunkSize();if(e<a){var L=Math.min(t,a-e),H=n.height;if(n.removeInner(e,L),this.height-=H-n.height,a==L&&(this.children.splice(r--,1),n.parent=null),(t-=L)==0)break;e=0}else e-=a}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof gi))){var G=[];this.collapse(G),this.children=[new gi(G)],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 n=0;n<this.children.length;++n){var a=this.children[n],L=a.chunkSize();if(e<=L){if(a.insertInner(e,t,r),a.lines&&a.lines.length>50){for(var H=a.lines.length%25+25,G=H;G<a.lines.length;){var X=new gi(a.lines.slice(G,G+=25));a.height-=X.height,this.children.splice(++n,0,X),X.parent=this}a.lines=a.lines.slice(0,H),this.maybeSpill()}break}e-=L}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new vi(t);if(e.parent){e.size-=r.size,e.height-=r.height;var a=J(e.parent.children,e);e.parent.children.splice(a+1,0,r)}else{var n=new vi(e.children);n.parent=e,e.children=[n,r],e=n}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var a=this.children[n],L=a.chunkSize();if(e<L){var H=Math.min(t,L-e);if(a.iterN(e,H,r))return!0;if((t-=H)==0)break;e=0}else e-=L}}};var _i=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};_i.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=St(r);if(n==null||!t)return;for(var a=0;a<t.length;++a)t[a]==this&&t.splice(a--,1);t.length||(r.widgets=null);var L=ii(this);rn(r,Math.max(0,r.height-L)),e&&(hn(e,function(){qs(e,r,-L),zn(e,n,"widget")}),$t(e,"lineWidgetCleared",e,this,n))},_i.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var a=ii(this)-t;if(!a)return;Ln(this.doc,n)||rn(n,n.height+a),r&&hn(r,function(){r.curOp.forceUpdate=!0,qs(r,n,a),$t(r,"lineWidgetChanged",r,e,St(n))})},ge(_i);function qs(e,t,r){On(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Sa(e,r)}function El(e,t,r,n){var a=new _i(e,r,n),L=e.cm;return L&&a.noHScroll&&(L.display.alignWidgets=!0),mi(e,t,"widget",function(H){var G=H.widgets||(H.widgets=[]);if(a.insertAt==null?G.push(a):G.splice(Math.min(G.length-1,Math.max(0,a.insertAt)),0,a),a.line=H,L&&!Ln(e,H)){var X=On(H)<e.scrollTop;rn(H,H.height+ii(a)),X&&Sa(L,a.height),L.curOp.forceUpdate=!0}return!0}),L&&$t(L,"lineWidgetAdded",L,a,typeof t=="number"?t:St(t)),a}var eo=0,Qn=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++eo};Qn.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&hr(e),he(this,"clear")){var r=this.find();r&&$t(this,"clear",r.from,r.to)}for(var n=null,a=null,L=0;L<this.lines.length;++L){var H=this.lines[L],G=Sn(H.markedSpans,this);e&&!this.collapsed?zn(e,St(H),"text"):e&&(G.to!=null&&(a=St(H)),G.from!=null&&(n=St(H))),H.markedSpans=Zr(H.markedSpans,G),G.from==null&&this.collapsed&&!Ln(this.doc,H)&&e&&rn(H,Rr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var X=0;X<this.lines.length;++X){var $=mn(this.lines[X]),se=ti($);se>e.display.maxLineLength&&(e.display.maxLine=$,e.display.maxLineLength=se,e.display.maxLineChanged=!0)}n!=null&&e&&this.collapsed&&on(e,n,a+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ks(e.doc)),e&&$t(e,"markerCleared",e,this,n,a),t&&fr(e),this.parent&&this.parent.clear()},Qn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var r,n,a=0;a<this.lines.length;++a){var L=this.lines[a],H=Sn(L.markedSpans,this);if(H.from!=null&&(r=Be(t?L:St(L),H.from),e==-1))return r;if(H.to!=null&&(n=Be(t?L:St(L),H.to),e==1))return n}return r&&{from:r,to:n}},Qn.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,n=this.doc.cm;if(!t||!n)return;hn(n,function(){var a=t.line,L=St(t.line),H=fa(n,L);if(H&&(is(H),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!Ln(r.doc,a)&&r.height!=null){var G=r.height;r.height=null;var X=ii(r)-G;X&&rn(a,a.height+X)}$t(n,"markerChanged",n,e)})},Qn.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||J(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Qn.prototype.detachLine=function(e){if(this.lines.splice(J(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ge(Qn);function Fr(e,t,r,n,a){if(n&&n.shared)return Tl(e,t,r,n,a);if(e.cm&&!e.cm.curOp)return zt(e.cm,Fr)(e,t,r,n,a);var L=new Qn(e,a),H=ht(t,r);if(n&&v(n,L,!1),H>0||H==0&&L.clearWhenEmpty!==!1)return L;if(L.replacedWith&&(L.collapsed=!0,L.widgetNode=b("span",[L.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||L.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(L.widgetNode.insertLeft=!0)),L.collapsed){if(ki(e,t.line,t,r,L)||t.line!=r.line&&ki(e,r.line,t,r,L))throw new Error("Inserting collapsed marker partially overlapping an existing one");sa()}L.addToHistory&&Ns(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var G=t.line,X=e.cm,$;if(e.iter(G,r.line+1,function(ce){X&&L.collapsed&&!X.options.lineWrapping&&mn(ce)==X.display.maxLine&&($=!0),L.collapsed&&G!=t.line&&rn(ce,0),oa(ce,new nr(L,G==t.line?t.ch:null,G==r.line?r.ch:null)),++G}),L.collapsed&&e.iter(t.line,r.line+1,function(ce){Ln(e,ce)&&rn(ce,0)}),L.clearOnEnter&&Ce(L,"beforeCursorEnter",function(){return L.clear()}),L.readOnly&&(Kn(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),L.collapsed&&(L.id=++eo,L.atomic=!0),X){if($&&(X.curOp.updateMaxLine=!0),L.collapsed)on(X,t.line,r.line+1);else if(L.className||L.startStyle||L.endStyle||L.css||L.attributes||L.title)for(var se=t.line;se<=r.line;se++)zn(X,se,"text");L.atomic&&Ks(X.doc),$t(X,"markerAdded",X,L)}return L}var yi=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};yi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();$t(this,"clear")},yi.prototype.find=function(e,t){return this.primary.find(e,t)},ge(yi);function Tl(e,t,r,n,a){n=v(n),n.shared=!1;var L=[Fr(e,t,r,n,a)],H=L[0],G=n.widgetNode;return $n(e,function(X){G&&(n.widgetNode=G.cloneNode(!0)),L.push(Fr(X,pt(X,t),pt(X,r),n,a));for(var $=0;$<X.linked.length;++$)if(X.linked[$].isParent)return;H=Q(L)}),new yi(L,H)}function to(e){return e.findMarks(Be(e.first,0),e.clipPos(Be(e.lastLine())),function(t){return t.parent})}function xl(e,t){for(var r=0;r<t.length;r++){var n=t[r],a=n.find(),L=e.clipPos(a.from),H=e.clipPos(a.to);if(ht(L,H)){var G=Fr(e,L,H,n.primary,n.primary.type);n.markers.push(G),G.parent=n}}}function wl(e){for(var t=function(n){var a=e[n],L=[a.primary.doc];$n(a.primary.doc,function(X){return L.push(X)});for(var H=0;H<a.markers.length;H++){var G=a.markers[H];J(L,G.doc)==-1&&(G.parent=null,a.markers.splice(H--,1))}},r=0;r<e.length;r++)t(r)}var Sl=0,ln=function(e,t,r,n,a){if(!(this instanceof ln))return new ln(e,t,r,n,a);r==null&&(r=0),vi.call(this,[new gi([new ar("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var L=Be(r,0);this.sel=Xn(L),this.history=new Vi(null),this.id=++Sl,this.modeOption=t,this.lineSep=n,this.direction=a=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Pa(this,{from:L,to:L,text:e}),Zt(this,Xn(L),ue)};ln.prototype=Se(vi.prototype,{constructor:ln,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,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=gr(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Vt(function(e){var t=Be(this.first,0),r=this.first+this.size-1;Mr(this,{from:t,to:Be(r,it(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&oi(this.cm,0,0),Zt(this,Xn(t),ue)}),replaceRange:function(e,t,r,n){t=pt(this,t),r=r?pt(this,r):t,Nr(this,e,t,r,n)},getRange:function(e,t,r){var n=kn(this,pt(this,e),pt(this,t));return r===!1?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Mn(this,e))return it(this,e)},getLineNumber:function(e){return St(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=it(this,e)),mn(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return pt(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:Vt(function(e,t,r){js(this,pt(this,typeof e=="number"?Be(e,t||0):e),null,r)}),setSelection:Vt(function(e,t,r){js(this,pt(this,e),pt(this,t||e),r)}),extendSelection:Vt(function(e,t,r){Yi(this,pt(this,e),t&&pt(this,t),r)}),extendSelections:Vt(function(e,t){Bs(this,Ke(this,e),t)}),extendSelectionsBy:Vt(function(e,t){var r=ie(this.sel.ranges,e);Bs(this,Ke(this,r),t)}),setSelections:Vt(function(e,t,r){if(!e.length)return;for(var n=[],a=0;a<e.length;a++)n[a]=new Rt(pt(this,e[a].anchor),pt(this,e[a].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Zt(this,Rn(this.cm,n,t),r)}),addSelection:Vt(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new Rt(pt(this,e),pt(this,t||e))),Zt(this,Rn(this.cm,n,n.length-1),r)}),getSelection:function(e){for(var t=this.sel.ranges,r,n=0;n<t.length;n++){var a=kn(this,t[n].from(),t[n].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,n=0;n<r.length;n++){var a=kn(this,r[n].from(),r[n].to());e!==!1&&(a=a.join(e||this.lineSeparator())),t[n]=a}return t},replaceSelection:function(e,t,r){for(var n=[],a=0;a<this.sel.ranges.length;a++)n[a]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:Vt(function(e,t,r){for(var n=[],a=this.sel,L=0;L<a.ranges.length;L++){var H=a.ranges[L];n[L]={from:H.from(),to:H.to(),text:this.splitLines(e[L]),origin:r}}for(var G=t&&t!="end"&&hl(this,n,t),X=n.length-1;X>=0;X--)Mr(this,n[X]);G?Hs(this,G):this.cm&&Ir(this.cm)}),undo:Vt(function(){Ji(this,"undo")}),redo:Vt(function(){Ji(this,"redo")}),undoSelection:Vt(function(){Ji(this,"undo",!0)}),redoSelection:Vt(function(){Ji(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,n=0;n<e.done.length;n++)e.done[n].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 Vi(this.history.maxGeneration),$n(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:Pr(this.history.done),undone:Pr(this.history.undone)}},setHistory:function(e){var t=this.history=new Vi(this.history.maxGeneration);t.done=Pr(e.done.slice(0),null,!0),t.undone=Pr(e.undone.slice(0),null,!0)},setGutterMarker:Vt(function(e,t,r){return mi(this,e,"gutter",function(n){var a=n.gutterMarkers||(n.gutterMarkers={});return a[t]=r,!r&&De(a)&&(n.gutterMarkers=null),!0})}),clearGutter:Vt(function(e){var t=this;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&mi(t,r,"gutter",function(){return r.gutterMarkers[e]=null,De(r.gutterMarkers)&&(r.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Mn(this,e))return null;if(t=e,e=it(this,e),!e)return null}else if(t=St(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:Vt(function(e,t,r){return mi(this,e,t=="gutter"?"gutter":"class",function(n){var a=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!n[a])n[a]=r;else{if(x(r).test(n[a]))return!1;n[a]+=" "+r}return!0})}),removeLineClass:Vt(function(e,t,r){return mi(this,e,t=="gutter"?"gutter":"class",function(n){var a=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",L=n[a];if(L)if(r==null)n[a]=null;else{var H=L.match(x(r));if(!H)return!1;var G=H.index+H[0].length;n[a]=L.slice(0,H.index)+(!H.index||G==L.length?"":" ")+L.slice(G)||null}else return!1;return!0})}),addLineWidget:Vt(function(e,t,r){return El(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return Fr(this,pt(this,e),pt(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=pt(this,e),Fr(this,e,e,r,"bookmark")},findMarksAt:function(e){e=pt(this,e);var t=[],r=it(this,e.line).markedSpans;if(r)for(var n=0;n<r.length;++n){var a=r[n];(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=pt(this,e),t=pt(this,t);var n=[],a=e.line;return this.iter(e.line,t.line+1,function(L){var H=L.markedSpans;if(H)for(var G=0;G<H.length;G++){var X=H[G];!(X.to!=null&&a==e.line&&e.ch>=X.to||X.from==null&&a!=e.line||X.from!=null&&a==t.line&&X.from>=t.ch)&&(!r||r(X.marker))&&n.push(X.marker.parent||X.marker)}++a}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)r[n].from!=null&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first,n=this.lineSeparator().length;return this.iter(function(a){var L=a.text.length+n;if(L>e)return t=e,!0;e-=L,++r}),pt(this,Be(r,t))},indexFromPos:function(e){e=pt(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(n){t+=n.text.length+r}),t},copy:function(e){var t=new ln(gr(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 n=new ln(gr(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],xl(n,to(this)),n},unlinkDoc:function(e){if(e instanceof Pt&&(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 n=[e.id];$n(e,function(a){return n.push(a.id)},!0),e.history=new Vi(null),e.history.done=Pr(this.history.done,n),e.history.undone=Pr(this.history.undone,n)}},iterLinkedDocs:function(e){$n(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):ct(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Vt(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)})}),ln.prototype.eachLine=ln.prototype.iter;var no=0;function Ol(e){var t=this;if(ro(t),Me(t,e)||jn(t.display,e))return;Y(e),W&&(no=+new Date);var r=lr(t,e,!0),n=e.dataTransfer.files;if(!r||t.isReadOnly())return;if(n&&n.length&&window.FileReader&&window.File)for(var a=n.length,L=Array(a),H=0,G=function(){++H==a&&zt(t,function(){r=pt(t.doc,r);var Ee={from:r,to:r,text:t.doc.splitLines(L.filter(function(Pe){return Pe!=null}).join(t.doc.lineSeparator())),origin:"paste"};Mr(t.doc,Ee),Hs(t.doc,Xn(pt(t.doc,r),pt(t.doc,Yn(Ee))))})()},X=function(Ee,Pe){if(t.options.allowDropFileTypes&&J(t.options.allowDropFileTypes,Ee.type)==-1){G();return}var Ne=new FileReader;Ne.onerror=function(){return G()},Ne.onload=function(){var Ge=Ne.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ge)){G();return}L[Pe]=Ge,G()},Ne.readAsText(Ee)},$=0;$<n.length;$++)X(n[$],$);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 se=e.dataTransfer.getData("Text");if(se){var ce;if(t.state.draggingText&&!t.state.draggingText.copy&&(ce=t.listSelections()),$i(t.doc,Xn(r,r)),ce)for(var we=0;we<ce.length;++we)Nr(t.doc,"",ce[we].anchor,ce[we].head,"drag");t.replaceSelection(se,"around","paste"),t.display.input.focus()}}catch(Ee){}}}function Al(e,t){if(W&&(!e.state.draggingText||+new Date-no<100)){le(t);return}if(Me(e,t)||jn(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!f){var r=l("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 Rl(e,t){var r=lr(e,t);if(!r)return;var n=document.createDocumentFragment();ms(e,r,n),e.display.dragCursor||(e.display.dragCursor=l("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),_(e.display.dragCursor,n)}function ro(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function io(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),r=[],n=0;n<t.length;n++){var a=t[n].CodeMirror;a&&r.push(a)}r.length&&r[0].operation(function(){for(var L=0;L<r.length;L++)e(r[L])})}var ao=!1;function Cl(){if(ao)return;Ll(),ao=!0}function Ll(){var e;Ce(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,io(Il)},100))}),Ce(window,"blur",function(){return io(Lr)})}function Il(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Jn={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"},bi=0;bi<10;bi++)Jn[bi+48]=Jn[bi+96]=String(bi);for(var Zi=65;Zi<=90;Zi++)Jn[Zi]=String.fromCharCode(Zi);for(var Ei=1;Ei<=12;Ei++)Jn[Ei+111]=Jn[Ei+63235]="F"+Ei;var Hn={};Hn.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"},Hn.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"},Hn.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"},Hn.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"]},Hn.default=u?Hn.macDefault:Hn.pcDefault;function Dl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var r,n,a,L,H=0;H<t.length-1;H++){var G=t[H];if(/^(cmd|meta|m)$/i.test(G))L=!0;else if(/^a(lt)?$/i.test(G))r=!0;else if(/^(c|ctrl|control)$/i.test(G))n=!0;else if(/^s(hift)?$/i.test(G))a=!0;else throw new Error("Unrecognized modifier name: "+G)}return r&&(e="Alt-"+e),n&&(e="Ctrl-"+e),L&&(e="Cmd-"+e),a&&(e="Shift-"+e),e}function Pl(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if(n=="..."){delete e[r];continue}for(var a=ie(r.split(" "),Dl),L=0;L<a.length;L++){var H=void 0,G=void 0;L==a.length-1?(G=a.join(" "),H=n):(G=a.slice(0,L+1).join(" "),H="...");var X=t[G];if(!X)t[G]=H;else if(X!=H)throw new Error("Inconsistent bindings for "+G)}delete e[r]}for(var $ in t)e[$]=t[$];return e}function Ur(e,t,r,n){t=qi(t);var a=t.call?t.call(e,n):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 Ur(e,t.fallthrough,r,n);for(var L=0;L<t.fallthrough.length;L++){var H=Ur(e,t.fallthrough[L],r,n);if(H)return H}}}function so(e){var t=typeof e=="string"?e:Jn[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function oo(e,t,r){var n=e;return t.altKey&&n!="Alt"&&(e="Alt-"+e),(E?t.metaKey:t.ctrlKey)&&n!="Ctrl"&&(e="Ctrl-"+e),(E?t.ctrlKey:t.metaKey)&&n!="Mod"&&(e="Cmd-"+e),!r&&t.shiftKey&&n!="Shift"&&(e="Shift-"+e),e}function lo(e,t){if(p&&e.keyCode==34&&e.char)return!1;var r=Jn[e.keyCode];return r==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(r=e.code),oo(r,e,t))}function qi(e){return typeof e=="string"?Hn[e]:e}function Br(e,t){for(var r=e.doc.sel.ranges,n=[],a=0;a<r.length;a++){for(var L=t(r[a]);n.length&&ht(L.from,Q(n).to)<=0;){var H=n.pop();if(ht(H.from,L.from)<0){L.from=H.from;break}}n.push(L)}hn(e,function(){for(var G=n.length-1;G>=0;G--)Nr(e.doc,"",n[G].from,n[G].to,"+delete");Ir(e)})}function Fa(e,t,r){var n=Le(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Ua(e,t,r){var n=Fa(e,t.ch,r);return n==null?null:new Be(t.line,n,r<0?"after":"before")}function Ba(e,t,r,n,a){if(e){t.doc.direction=="rtl"&&(a=-a);var L=Ve(r,t.doc.direction);if(L){var H=a<0?Q(L):L[0],G=a<0==(H.level==1),X=G?"after":"before",$;if(H.level>0||t.doc.direction=="rtl"){var se=Ar(t,r);$=a<0?r.text.length-1:0;var ce=Dn(t,se,$).top;$=Ue(function(we){return Dn(t,se,we).top==ce},a<0==(H.level==1)?H.from:H.to-1,$),X=="before"&&($=Fa(r,$,1))}else $=a<0?H.to:H.from;return new Be(n,$,X)}}return new Be(n,a<0?r.text.length:0,a<0?"before":"after")}function kl(e,t,r,n){var a=Ve(t,e.doc.direction);if(!a)return Ua(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var L=Fe(a,r.ch,r.sticky),H=a[L];if(e.doc.direction=="ltr"&&H.level%2==0&&(n>0?H.to>r.ch:H.from<r.ch))return Ua(t,r,n);var G=function(Xe,Ze){return Fa(t,Xe instanceof Be?Xe.ch:Xe,Ze)},X,$=function(Xe){return e.options.lineWrapping?(X=X||Ar(e,t),cs(e,t,X,Xe)):{begin:0,end:t.text.length}},se=$(r.sticky=="before"?G(r,-1):r.ch);if(e.doc.direction=="rtl"||H.level==1){var ce=H.level==1==n<0,we=G(r,ce?1:-1);if(we!=null&&(ce?we<=H.to&&we<=se.end:we>=H.from&&we>=se.begin)){var Ee=ce?"before":"after";return new Be(r.line,we,Ee)}}var Pe=function(Xe,Ze,Ye){for(var et=function(It,Xt){return Xt?new Be(r.line,G(It,1),"before"):new Be(r.line,It,"after")};Xe>=0&&Xe<a.length;Xe+=Ze){var ut=a[Xe],ot=Ze>0==(ut.level!=1),gt=ot?Ye.begin:G(Ye.end,-1);if(ut.from<=gt&><ut.to)return et(gt,ot);if(gt=ot?ut.from:G(ut.to,-1),Ye.begin<=gt&><Ye.end)return et(gt,ot)}},Ne=Pe(L+n,n,se);if(Ne)return Ne;var Ge=n>0?se.end:G(se.begin,-1);return Ge!=null&&!(n>0&&Ge==t.text.length)&&(Ne=Pe(n>0?0:a.length-1,n,$(Ge)),Ne)?Ne:null}var Ti={selectAll:Vs,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ue)},killLine:function(e){return Br(e,function(t){if(t.empty()){var r=it(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:Be(t.head.line+1,0)}:{from:t.head,to:Be(t.head.line,r)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Br(e,function(t){return{from:Be(t.from().line,0),to:pt(e.doc,Be(t.to().line+1,0))}})},delLineLeft:function(e){return Br(e,function(t){return{from:Be(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Br(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return{from:n,to:t.from()}})},delWrappedLineRight:function(e){return Br(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Be(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Be(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return uo(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return co(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")},oe)},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")},oe)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return n.ch<e.getLine(n.line).search(/\S/)?co(e,t.head):n},oe)},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(),n=e.options.tabSize,a=0;a<r.length;a++){var L=r[a].from(),H=j(e.getLine(L.line),L.ch,n);t.push(fe(n-H%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return hn(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++){if(!t[n].empty())continue;var a=t[n].head,L=it(e.doc,a.line).text;if(L){if(a.ch==L.length&&(a=new Be(a.line,a.ch-1)),a.ch>0)a=new Be(a.line,a.ch+1),e.replaceRange(L.charAt(a.ch-1)+L.charAt(a.ch-2),Be(a.line,a.ch-2),a,"+transpose");else if(a.line>e.doc.first){var H=it(e.doc,a.line-1).text;H&&(a=new Be(a.line,1),e.replaceRange(L.charAt(0)+e.doc.lineSeparator()+H.charAt(H.length-1),Be(a.line-1,H.length-1),a,"+transpose"))}}r.push(new Rt(a,a))}e.setSelections(r)})},newlineAndIndent:function(e){return hn(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 n=0;n<t.length;n++)e.indentLine(t[n].from().line,null,!0);Ir(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function uo(e,t){var r=it(e.doc,t),n=mn(r);return n!=r&&(t=St(n)),Ba(!0,e,n,t,1)}function Ml(e,t){var r=it(e.doc,t),n=Mi(r);return n!=r&&(t=St(n)),Ba(!0,e,r,t,-1)}function co(e,t){var r=uo(e,t.line),n=it(e.doc,r.line),a=Ve(n,e.doc.direction);if(!a||a[0].level==0){var L=Math.max(r.ch,n.text.search(/\S/)),H=t.line==r.line&&t.ch<=L&&t.ch;return Be(r.line,H?0:L,r.sticky)}return r}function ea(e,t,r){if(typeof t=="string"&&(t=Ti[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,a=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),a=t(e)!=ve}finally{e.display.shift=n,e.state.suppressEdits=!1}return a}function Nl(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var a=Ur(t,e.state.keyMaps[n],r,e);if(a)return a}return e.options.extraKeys&&Ur(t,e.options.extraKeys,r,e)||Ur(t,e.options.keyMap,r,e)}var Fl=new K;function xi(e,t,r,n){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())}),ho(e,a+" "+t,r,n))return!0}return ho(e,t,r,n)}function ho(e,t,r,n){var a=Nl(e,t,n);return a=="multi"&&(e.state.keySeq=t),a=="handled"&&$t(e,"keyHandled",e,t,r),(a=="handled"||a=="multi")&&(Y(r),Ta(e)),!!a}function fo(e,t){var r=lo(t,!0);return r?t.shiftKey&&!e.state.keySeq?xi(e,"Shift-"+r,t,function(n){return ea(e,n,!0)})||xi(e,r,t,function(n){if(typeof n=="string"?/^go[A-Z]/.test(n):n.motion)return ea(e,n)}):xi(e,r,t,function(n){return ea(e,n)}):!1}function Ul(e,t,r){return xi(e,"'"+r+"'",t,function(n){return ea(e,n,!0)})}var ja=null;function po(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=k(),Me(t,e))return;W&&B<11&&e.keyCode==27&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=r==16||e.shiftKey;var n=fo(t,e);p&&(ja=n?r:null,!n&&r==88&&!Ot&&(u?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),D&&!u&&!n&&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;I(t,"CodeMirror-crosshair");function r(n){(n.keyCode==18||!n.altKey)&&(w(t,"CodeMirror-crosshair"),ze(document,"keyup",r),ze(document,"mouseover",r))}Ce(document,"keyup",r),Ce(document,"mouseover",r)}function mo(e){e.keyCode==16&&(this.doc.sel.shift=!1),Me(this,e)}function go(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(jn(t.display,e)||Me(t,e)||e.ctrlKey&&!e.altKey||u&&e.metaKey)return;var r=e.keyCode,n=e.charCode;if(p&&r==ja){ja=null,Y(e);return}if(p&&(!e.which||e.which<10)&&fo(t,e))return;var a=String.fromCharCode(n==null?r:n);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&&ht(t,this.pos)==0&&r==this.button};var wi,Si;function Hl(e,t){var r=+new Date;return Si&&Si.compare(r,e,t)?(wi=Si=null,"triple"):wi&&wi.compare(r,e,t)?(Si=new Ha(r,e,t),wi=null,"double"):(wi=new Ha(r,e,t),Si=null,"single")}function vo(e){var t=this,r=t.display;if(Me(t,e)||r.activeTouch&&r.input.supportsTouch())return;if(r.input.ensurePolled(),r.shift=e.shiftKey,jn(r,e)){P||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));return}if(Wa(t,e))return;var n=lr(t,e),a=Re(e),L=n?Hl(n,a):"single";if(window.focus(),a==1&&t.state.selectingText&&t.state.selectingText(e),n&&Wl(t,a,n,L,e))return;a==1?n?Gl(t,n,L,e):pe(e)==r.scroller&&Y(e):a==2?(n&&Yi(t.doc,n),setTimeout(function(){return r.input.focus()},20)):a==3&&(O?t.display.input.onContextMenu(e):vs(t))}function Wl(e,t,r,n,a){var L="Click";return n=="double"?L="Double"+L:n=="triple"&&(L="Triple"+L),L=(t==1?"Left":t==2?"Middle":"Right")+L,xi(e,oo(L,a),a,function(H){if(typeof H=="string"&&(H=Ti[H]),!H)return!1;var G=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),G=H(e,r)!=ve}finally{e.state.suppressEdits=!1}return G})}function Kl(e,t,r){var n=e.getOption("configureMouse"),a=n?n(e,t,r):{};if(a.unit==null){var L=h?r.shiftKey&&r.metaKey:r.altKey;a.unit=L?"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=u?r.metaKey:r.ctrlKey),a.moveOnDrag==null&&(a.moveOnDrag=!(u?r.altKey:r.ctrlKey)),a}function Gl(e,t,r,n){W?setTimeout(C(gs,e),0):e.curOp.focus=k();var a=Kl(e,r,n),L=e.doc.sel,H;e.options.dragDrop&&ke&&!e.isReadOnly()&&r=="single"&&(H=L.contains(t))>-1&&(ht((H=L.ranges[H]).from(),t)<0||t.xRel>0)&&(ht(H.to(),t)>0||t.xRel<0)?zl(e,n,t,a):Vl(e,n,t,a)}function zl(e,t,r,n){var a=e.display,L=!1,H=zt(e,function($){P&&(a.scroller.draggable=!1),e.state.draggingText=!1,ze(a.wrapper.ownerDocument,"mouseup",H),ze(a.wrapper.ownerDocument,"mousemove",G),ze(a.scroller,"dragstart",X),ze(a.scroller,"drop",H),L||(Y($),n.addNew||Yi(e.doc,r,null,null,n.extend),P&&!f||W&&B==9?setTimeout(function(){a.wrapper.ownerDocument.body.focus({preventScroll:!0}),a.input.focus()},20):a.input.focus())}),G=function($){L=L||Math.abs(t.clientX-$.clientX)+Math.abs(t.clientY-$.clientY)>=10},X=function(){return L=!0};P&&(a.scroller.draggable=!0),e.state.draggingText=H,H.copy=!n.moveOnDrag,a.scroller.dragDrop&&a.scroller.dragDrop(),Ce(a.wrapper.ownerDocument,"mouseup",H),Ce(a.wrapper.ownerDocument,"mousemove",G),Ce(a.scroller,"dragstart",X),Ce(a.scroller,"drop",H),vs(e),setTimeout(function(){return a.input.focus()},20)}function _o(e,t,r){if(r=="char")return new Rt(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new Rt(Be(t.line,0),pt(e.doc,Be(t.line+1,0)));var n=r(e,t);return new Rt(n.from,n.to)}function Vl(e,t,r,n){var a=e.display,L=e.doc;Y(t);var H,G,X=L.sel,$=X.ranges;if(n.addNew&&!n.extend?(G=L.sel.contains(r),G>-1?H=$[G]:H=new Rt(r,r)):(H=L.sel.primary(),G=L.sel.primIndex),n.unit=="rectangle")n.addNew||(H=new Rt(r,r)),r=lr(e,t,!0,!0),G=-1;else{var se=_o(e,r,n.unit);n.extend?H=Ma(H,se.anchor,se.head,n.extend):H=se}n.addNew?G==-1?(G=$.length,Zt(L,Rn(e,$.concat([H]),G),{scroll:!1,origin:"*mouse"})):$.length>1&&$[G].empty()&&n.unit=="char"&&!n.extend?(Zt(L,Rn(e,$.slice(0,G).concat($.slice(G+1)),0),{scroll:!1,origin:"*mouse"}),X=L.sel):Na(L,G,H,de):(G=0,Zt(L,new vn([H],0),de),X=L.sel);var ce=r;function we(Ye){if(ht(ce,Ye)==0)return;if(ce=Ye,n.unit=="rectangle"){for(var et=[],ut=e.options.tabSize,ot=j(it(L,r.line).text,r.ch,ut),gt=j(it(L,Ye.line).text,Ye.ch,ut),It=Math.min(ot,gt),Xt=Math.max(ot,gt),kt=Math.min(r.line,Ye.line),fn=Math.min(e.lastLine(),Math.max(r.line,Ye.line));kt<=fn;kt++){var un=it(L,kt).text,jt=me(un,It,ut);It==Xt?et.push(new Rt(Be(kt,jt),Be(kt,jt))):un.length>jt&&et.push(new Rt(Be(kt,jt),Be(kt,me(un,Xt,ut))))}et.length||et.push(new Rt(r,r)),Zt(L,Rn(e,X.ranges.slice(0,G).concat(et),G),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ye)}else{var dn=H,Qt=_o(e,Ye,n.unit),Gt=dn.anchor,Ht;ht(Qt.anchor,Gt)>0?(Ht=Qt.head,Gt=er(dn.from(),Qt.anchor)):(Ht=Qt.anchor,Gt=yr(dn.to(),Qt.head));var Ft=X.ranges.slice(0);Ft[G]=Xl(e,new Rt(pt(L,Gt),Ht)),Zt(L,Rn(e,Ft,G),de)}}var Ee=a.wrapper.getBoundingClientRect(),Pe=0;function Ne(Ye){var et=++Pe,ut=lr(e,Ye,!0,n.unit=="rectangle");if(!ut)return;if(ht(ut,ce)!=0){e.curOp.focus=k(),we(ut);var ot=Wi(a,L);(ut.line>=ot.to||ut.line<ot.from)&&setTimeout(zt(e,function(){Pe==et&&Ne(Ye)}),150)}else{var gt=Ye.clientY<Ee.top?-20:Ye.clientY>Ee.bottom?20:0;gt&&setTimeout(zt(e,function(){if(Pe!=et)return;a.scroller.scrollTop+=gt,Ne(Ye)}),50)}}function Ge(Ye){e.state.selectingText=!1,Pe=Infinity,Ye&&(Y(Ye),a.input.focus()),ze(a.wrapper.ownerDocument,"mousemove",Xe),ze(a.wrapper.ownerDocument,"mouseup",Ze),L.history.lastSelOrigin=null}var Xe=zt(e,function(Ye){Ye.buttons===0||!Re(Ye)?Ge(Ye):Ne(Ye)}),Ze=zt(e,Ge);e.state.selectingText=Ze,Ce(a.wrapper.ownerDocument,"mousemove",Xe),Ce(a.wrapper.ownerDocument,"mouseup",Ze)}function Xl(e,t){var r=t.anchor,n=t.head,a=it(e.doc,r.line);if(ht(r,n)==0&&r.sticky==n.sticky)return t;var L=Ve(a);if(!L)return t;var H=Fe(L,r.ch,r.sticky),G=L[H];if(G.from!=r.ch&&G.to!=r.ch)return t;var X=H+(G.from==r.ch==(G.level!=1)?0:1);if(X==0||X==L.length)return t;var $;if(n.line!=r.line)$=(n.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var se=Fe(L,n.ch,n.sticky),ce=se-H||(n.ch-r.ch)*(G.level==1?-1:1);se==X-1||se==X?$=ce<0:$=ce>0}var we=L[X+($?-1:0)],Ee=$==(we.level==1),Pe=Ee?we.from:we.to,Ne=Ee?"after":"before";return r.ch==Pe&&r.sticky==Ne?t:new Rt(new Be(r.line,Pe,Ne),n)}function yo(e,t,r,n){var a,L;if(t.touches)a=t.touches[0].clientX,L=t.touches[0].clientY;else try{a=t.clientX,L=t.clientY}catch(we){return!1}if(a>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&Y(t);var H=e.display,G=H.lineDiv.getBoundingClientRect();if(L>G.bottom||!he(e,r))return ne(t);L-=G.top-H.viewOffset;for(var X=0;X<e.display.gutterSpecs.length;++X){var $=H.gutters.childNodes[X];if($&&$.getBoundingClientRect().right>=a){var se=En(e.doc,L),ce=e.display.gutterSpecs[X];return Oe(e,r,e,se,ce.className,t),ne(t)}}}function Wa(e,t){return yo(e,t,"gutterClick",!0)}function bo(e,t){if(jn(e.display,t)||Yl(e,t))return;if(Me(e,t,"contextmenu"))return;O||e.display.input.onContextMenu(t)}function Yl(e,t){return he(e,"gutterContextMenu")?yo(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-"),ai(e)}var jr={toString:function(){return"CodeMirror.Init"}},To={},ta={};function $l(e){var t=e.optionHandlers;function r(n,a,L,H){e.defaults[n]=a,L&&(t[n]=H?function(G,X,$){$!=jr&&L(G,X,$)}:L)}e.defineOption=r,e.Init=jr,r("value","",function(n,a){return n.setValue(a)},!0),r("mode",null,function(n,a){n.doc.modeOption=a,Da(n)},!0),r("indentUnit",2,Da,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(n){fi(n),ai(n),on(n)},!0),r("lineSeparator",null,function(n,a){if(n.doc.lineSep=a,!a)return;var L=[],H=n.doc.first;n.doc.iter(function(X){for(var $=0;;){var se=X.text.indexOf(a,$);if(se==-1)break;$=se+a.length,L.push(Be(H,se))}H++});for(var G=L.length-1;G>=0;G--)Nr(n.doc,a,L[G],Be(L[G].line,L[G].ch+a.length))}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(n,a,L){n.state.specialChars=new RegExp(a.source+(a.test(" ")?"":"| "),"g"),L!=jr&&n.refresh()}),r("specialCharPlaceholder",Lt,function(n){return n.refresh()},!0),r("electricChars",!0),r("inputStyle",i?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),r("spellcheck",!1,function(n,a){return n.getInputField().spellcheck=a},!0),r("autocorrect",!1,function(n,a){return n.getInputField().autocorrect=a},!0),r("autocapitalize",!1,function(n,a){return n.getInputField().autocapitalize=a},!0),r("rtlMoveVisually",!R),r("wholeLineUpdateBefore",!0),r("theme","default",function(n){Eo(n),hi(n)},!0),r("keyMap","default",function(n,a,L){var H=qi(a),G=L!=jr&&qi(L);G&&G.detach&&G.detach(n,H),H.attach&&H.attach(n,G||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Jl,!0),r("gutters",[],function(n,a){n.display.gutterSpecs=La(a,n.options.lineNumbers),hi(n)},!0),r("fixedGutter",!0,function(n,a){n.display.gutters.style.left=a?ba(n.display)+"px":"0",n.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(n){return Dr(n)},!0),r("scrollbarStyle","native",function(n){xs(n),Dr(n),n.display.scrollbars.setScrollTop(n.doc.scrollTop),n.display.scrollbars.setScrollLeft(n.doc.scrollLeft)},!0),r("lineNumbers",!1,function(n,a){n.display.gutterSpecs=La(n.options.gutters,a),hi(n)},!0),r("firstLineNumber",1,hi,!0),r("lineNumberFormatter",function(n){return n},hi,!0),r("showCursorWhenSelecting",!1,si,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(n,a){a=="nocursor"&&(Lr(n),n.display.input.blur()),n.display.input.readOnlyChanged(a)}),r("screenReaderLabel",null,function(n,a){a=a===""?null:a,n.display.input.screenReaderLabelChanged(a)}),r("disableInput",!1,function(n,a){a||n.display.input.reset()},!0),r("dragDrop",!0,Ql),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,si,!0),r("singleCursorHeightPerLine",!0,si,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,fi,!0),r("addModeClass",!1,fi,!0),r("pollInterval",100),r("undoDepth",200,function(n,a){return n.doc.history.undoDepth=a}),r("historyEventDelay",1250),r("viewportMargin",10,function(n){return n.refresh()},!0),r("maxHighlightLength",1e4,fi,!0),r("moveInputWithCursor",!0,function(n,a){a||n.display.input.resetPosition()}),r("tabindex",null,function(n,a){return n.display.input.getField().tabIndex=a||""}),r("autofocus",null),r("direction","ltr",function(n,a){return n.doc.setDirection(a)},!0),r("phrases",null)}function Ql(e,t,r){var n=r&&r!=jr;if(!t!=!n){var a=e.display.dragFunctions,L=t?Ce:ze;L(e.display.scroller,"dragstart",a.start),L(e.display.scroller,"dragenter",a.enter),L(e.display.scroller,"dragover",a.over),L(e.display.scroller,"dragleave",a.leave),L(e.display.scroller,"drop",a.drop)}}function Jl(e){e.options.lineWrapping?(I(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(w(e.display.wrapper,"CodeMirror-wrap"),Ni(e)),Ea(e),on(e),ai(e),setTimeout(function(){return Dr(e)},100)}function Pt(e,t){var r=this;if(!(this instanceof Pt))return new Pt(e,t);this.options=t=t?v(t):{},v(To,t,!1);var n=t.value;typeof n=="string"?n=new ln(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var a=new Pt.inputStyles[t.inputStyle](this),L=this.display=new dl(e,n,a,t);L.wrapper.CodeMirror=this,Eo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),xs(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 K,keySeq:null,specialChars:null},t.autofocus&&!i&&L.input.focus(),W&&B<11&&setTimeout(function(){return r.display.input.reset(!0)},20),Zl(this),Cl(),hr(this),this.curOp.forceUpdate=!0,Ps(this,n),t.autofocus&&!i||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&xa(r)},20):Lr(this);for(var H in ta)ta.hasOwnProperty(H)&&ta[H](this,t[H],jr);Os(this),t.finishInit&&t.finishInit(this);for(var G=0;G<Ka.length;++G)Ka[G](this);fr(this),P&&t.lineWrapping&&getComputedStyle(L.lineDiv).textRendering=="optimizelegibility"&&(L.lineDiv.style.textRendering="auto")}Pt.defaults=To,Pt.optionHandlers=ta;function Zl(e){var t=e.display;Ce(t.scroller,"mousedown",zt(e,vo)),W&&B<11?Ce(t.scroller,"dblclick",zt(e,function(X){if(Me(e,X))return;var $=lr(e,X);if(!$||Wa(e,X)||jn(e.display,X))return;Y(X);var se=e.findWordAt($);Yi(e.doc,se.anchor,se.head)})):Ce(t.scroller,"dblclick",function(X){return Me(e,X)||Y(X)}),Ce(t.scroller,"contextmenu",function(X){return bo(e,X)}),Ce(t.input.getField(),"contextmenu",function(X){t.scroller.contains(X.target)||bo(e,X)});var r,n={end:0};function a(){t.activeTouch&&(r=setTimeout(function(){return t.activeTouch=null},1e3),n=t.activeTouch,n.end=+new Date)}function L(X){if(X.touches.length!=1)return!1;var $=X.touches[0];return $.radiusX<=1&&$.radiusY<=1}function H(X,$){if($.left==null)return!0;var se=$.left-X.left,ce=$.top-X.top;return se*se+ce*ce>20*20}Ce(t.scroller,"touchstart",function(X){if(!Me(e,X)&&!L(X)&&!Wa(e,X)){t.input.ensurePolled(),clearTimeout(r);var $=+new Date;t.activeTouch={start:$,moved:!1,prev:$-n.end<=300?n:null},X.touches.length==1&&(t.activeTouch.left=X.touches[0].pageX,t.activeTouch.top=X.touches[0].pageY)}}),Ce(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ce(t.scroller,"touchend",function(X){var $=t.activeTouch;if($&&!jn(t,X)&&$.left!=null&&!$.moved&&new Date-$.start<300){var se=e.coordsChar(t.activeTouch,"page"),ce;!$.prev||H($,$.prev)?ce=new Rt(se,se):!$.prev.prev||H($,$.prev.prev)?ce=e.findWordAt(se):ce=new Rt(Be(se.line,0),pt(e.doc,Be(se.line+1,0))),e.setSelection(ce.anchor,ce.head),e.focus(),Y(X)}a()}),Ce(t.scroller,"touchcancel",a),Ce(t.scroller,"scroll",function(){t.scroller.clientHeight&&(li(e,t.scroller.scrollTop),dr(e,t.scroller.scrollLeft,!0),Oe(e,"scroll",e))}),Ce(t.scroller,"mousewheel",function(X){return Cs(e,X)}),Ce(t.scroller,"DOMMouseScroll",function(X){return Cs(e,X)}),Ce(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(X){Me(e,X)||le(X)},over:function(X){Me(e,X)||(Rl(e,X),le(X))},start:function(X){return Al(e,X)},drop:zt(e,Ol),leave:function(X){Me(e,X)||ro(e)}};var G=t.input.getField();Ce(G,"keyup",function(X){return mo.call(e,X)}),Ce(G,"keydown",zt(e,po)),Ce(G,"keypress",zt(e,go)),Ce(G,"focus",function(X){return xa(e,X)}),Ce(G,"blur",function(X){return Lr(e,X)})}var Ka=[];Pt.defineInitHook=function(e){return Ka.push(e)};function Oi(e,t,r,n){var a=e.doc,L;r==null&&(r="add"),r=="smart"&&(a.mode.indent?L=Tn(e,t).state:r="prev");var H=e.options.tabSize,G=it(a,t),X=j(G.text,null,H);G.stateAfter&&(G.stateAfter=null);var $=G.text.match(/^\s*/)[0],se;if(!n&&!/\S/.test(G.text))se=0,r="not";else if(r=="smart"&&(se=a.mode.indent(L,G.text.slice($.length),G.text),se==ve||se>150)){if(!n)return;r="prev"}r=="prev"?t>a.first?se=j(it(a,t-1).text,null,H):se=0:r=="add"?se=X+e.options.indentUnit:r=="subtract"?se=X-e.options.indentUnit:typeof r=="number"&&(se=X+r),se=Math.max(0,se);var ce="",we=0;if(e.options.indentWithTabs)for(var Ee=Math.floor(se/H);Ee;--Ee)we+=H,ce+=" ";if(we<se&&(ce+=fe(se-we)),ce!=$)return Nr(a,ce,Be(t,0),Be(t,$.length),"+input"),G.stateAfter=null,!0;for(var Pe=0;Pe<a.sel.ranges.length;Pe++){var Ne=a.sel.ranges[Pe];if(Ne.head.line==t&&Ne.head.ch<$.length){var Ge=Be(t,$.length);Na(a,Pe,new Rt(Ge,Ge));break}}}var Cn=null;function na(e){Cn=e}function Ga(e,t,r,n,a){var L=e.doc;e.display.shift=!1,n||(n=L.sel);var H=+new Date-200,G=a=="paste"||e.state.pasteIncoming>H,X=ct(t),$=null;if(G&&n.ranges.length>1)if(Cn&&Cn.text.join(`
|
|
`)==t){if(n.ranges.length%Cn.text.length==0){$=[];for(var se=0;se<Cn.text.length;se++)$.push(L.splitLines(Cn.text[se]))}}else X.length==n.ranges.length&&e.options.pasteLinesPerSelection&&($=ie(X,function(Xe){return[Xe]}));for(var ce=e.curOp.updateInput,we=n.ranges.length-1;we>=0;we--){var Ee=n.ranges[we],Pe=Ee.from(),Ne=Ee.to();Ee.empty()&&(r&&r>0?Pe=Be(Pe.line,Pe.ch-r):e.state.overwrite&&!G?Ne=Be(Ne.line,Math.min(it(L,Ne.line).text.length,Ne.ch+Q(X).length)):G&&Cn&&Cn.lineWise&&Cn.text.join(`
|
|
`)==X.join(`
|
|
`)&&(Pe=Ne=Be(Pe.line,0)));var Ge={from:Pe,to:Ne,text:$?$[we%$.length]:X,origin:a||(G?"paste":e.state.cutIncoming>H?"cut":"+input")};Mr(e.doc,Ge),$t(e,"inputRead",e,Ge)}t&&!G&&wo(e,t),Ir(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ce),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function xo(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&hn(t,function(){return Ga(t,r,0,null,"paste")}),!0}function wo(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var a=r.ranges[n];if(a.head.ch>100||n&&r.ranges[n-1].head.line==a.head.line)continue;var L=e.getModeAt(a.head),H=!1;if(L.electricChars){for(var G=0;G<L.electricChars.length;G++)if(t.indexOf(L.electricChars.charAt(G))>-1){H=Oi(e,a.head.line,"smart");break}}else L.electricInput&&(L.electricInput.test(it(e.doc,a.head.line).text.slice(0,a.head.ch))&&(H=Oi(e,a.head.line,"smart")));H&&$t(e,"electricInput",e,a.head.line)}}function So(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var a=e.doc.sel.ranges[n].head.line,L={anchor:Be(a,0),head:Be(a+1,0)};r.push(L),t.push(e.getRange(L.anchor,L.head))}return{text:t,ranges:r}}function Oo(e,t,r,n){e.setAttribute("autocorrect",r?"":"off"),e.setAttribute("autocapitalize",n?"":"off"),e.setAttribute("spellcheck",!!t)}function Ao(){var e=l("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=l("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return P?e.style.width="1000px":e.setAttribute("wrap","off"),c&&(e.style.border="1px solid black"),Oo(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(n,a){var L=this.options,H=L[n];if(L[n]==a&&n!="mode")return;L[n]=a,t.hasOwnProperty(n)&&zt(this,t[n])(this,a,H),Oe(this,"optionChange",this,n)},getOption:function(n){return this.options[n]},getDoc:function(){return this.doc},addKeyMap:function(n,a){this.state.keyMaps[a?"push":"unshift"](qi(n))},removeKeyMap:function(n){for(var a=this.state.keyMaps,L=0;L<a.length;++L)if(a[L]==n||a[L].name==n)return a.splice(L,1),!0},addOverlay:tn(function(n,a){var L=n.token?n:e.getMode(this.options,n);if(L.startState)throw new Error("Overlays may not be stateful.");ee(this.state.overlays,{mode:L,modeSpec:n,opaque:a&&a.opaque,priority:a&&a.priority||0},function(H){return H.priority}),this.state.modeGen++,on(this)}),removeOverlay:tn(function(n){for(var a=this.state.overlays,L=0;L<a.length;++L){var H=a[L].modeSpec;if(H==n||typeof n=="string"&&H.name==n){a.splice(L,1),this.state.modeGen++,on(this);return}}}),indentLine:tn(function(n,a,L){typeof a!="string"&&typeof a!="number"&&(a==null?a=this.options.smartIndent?"smart":"prev":a=a?"add":"subtract"),Mn(this.doc,n)&&Oi(this,n,a,L)}),indentSelection:tn(function(n){for(var a=this.doc.sel.ranges,L=-1,H=0;H<a.length;H++){var G=a[H];if(G.empty())G.head.line>L&&(Oi(this,G.head.line,n,!0),L=G.head.line,H==this.doc.sel.primIndex&&Ir(this));else{var X=G.from(),$=G.to(),se=Math.max(L,X.line);L=Math.min(this.lastLine(),$.line-($.ch?0:1))+1;for(var ce=se;ce<L;++ce)Oi(this,ce,n);var we=this.doc.sel.ranges;X.ch==0&&a.length==we.length&&we[H].from().ch>0&&Na(this.doc,H,new Rt(X,we[H].to()),ue)}}}),getTokenAt:function(n,a){return Ri(this,n,a)},getLineTokens:function(n,a){return Ri(this,Be(n),a,!0)},getTokenTypeAt:function(n){n=pt(this.doc,n);var a=tr(this,it(this.doc,n.line)),L=0,H=(a.length-1)/2,G=n.ch,X;if(G==0)X=a[2];else for(;;){var $=L+H>>1;if(($?a[$*2-1]:0)>=G)H=$;else if(a[$*2+1]<G)L=$+1;else{X=a[$*2+2];break}}var se=X?X.indexOf("overlay "):-1;return se<0?X:se==0?null:X.slice(0,se-1)},getModeAt:function(n){var a=this.doc.mode;return a.innerMode?e.innerMode(a,this.getTokenAt(n).state).mode:a},getHelper:function(n,a){return this.getHelpers(n,a)[0]},getHelpers:function(n,a){var L=[];if(!r.hasOwnProperty(a))return L;var H=r[a],G=this.getModeAt(n);if(typeof G[a]=="string")H[G[a]]&&L.push(H[G[a]]);else if(G[a])for(var X=0;X<G[a].length;X++){var $=H[G[a][X]];$&&L.push($)}else G.helperType&&H[G.helperType]?L.push(H[G.helperType]):H[G.name]&&L.push(H[G.name]);for(var se=0;se<H._global.length;se++){var ce=H._global[se];ce.pred(G,this)&&J(L,ce.val)==-1&&L.push(ce.val)}return L},getStateAfter:function(n,a){var L=this.doc;return n=br(L,n==null?L.first+L.size-1:n),Tn(this,n+1,a).state},cursorCoords:function(n,a){var L,H=this.doc.sel.primary();return n==null?L=H.head:typeof n=="object"?L=pt(this.doc,n):L=n?H.from():H.to(),An(this,L,a||"page")},charCoords:function(n,a){return ma(this,pt(this.doc,n),a||"page")},coordsChar:function(n,a){return n=ls(this,n,a||"page"),va(this,n.left,n.top)},lineAtHeight:function(n,a){return n=ls(this,{top:n,left:0},a||"page").top,En(this.doc,n+this.display.viewOffset)},heightAtLine:function(n,a,L){var H=!1,G;if(typeof n=="number"){var X=this.doc.first+this.doc.size-1;n<this.doc.first?n=this.doc.first:n>X&&(n=X,H=!0),G=it(this.doc,n)}else G=n;return Ui(this,G,{top:0,left:0},a||"page",L||H).top+(H?this.doc.height-On(G):0)},defaultTextHeight:function(){return Rr(this.display)},defaultCharWidth:function(){return Cr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,a,L,H,G){var X=this.display;n=An(this,pt(this.doc,n));var $=n.bottom,se=n.left;if(a.style.position="absolute",a.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(a),X.sizer.appendChild(a),H=="over")$=n.top;else if(H=="above"||H=="near"){var ce=Math.max(X.wrapper.clientHeight,this.doc.height),we=Math.max(X.sizer.clientWidth,X.lineSpace.clientWidth);(H=="above"||n.bottom+a.offsetHeight>ce)&&n.top>a.offsetHeight?$=n.top-a.offsetHeight:n.bottom+a.offsetHeight<=ce&&($=n.bottom),se+a.offsetWidth>we&&(se=we-a.offsetWidth)}a.style.top=$+"px",a.style.left=a.style.right="",G=="right"?(se=X.sizer.clientWidth-a.offsetWidth,a.style.right="0px"):(G=="left"?se=0:G=="middle"&&(se=(X.sizer.clientWidth-a.offsetWidth)/2),a.style.left=se+"px"),L&&Qo(this,{left:se,top:$,right:se+a.offsetWidth,bottom:$+a.offsetHeight})},triggerOnKeyDown:tn(po),triggerOnKeyPress:tn(go),triggerOnKeyUp:mo,triggerOnMouseDown:tn(vo),execCommand:function(n){if(Ti.hasOwnProperty(n))return Ti[n].call(null,this)},triggerElectric:tn(function(n){wo(this,n)}),findPosH:function(n,a,L,H){var G=1;a<0&&(G=-1,a=-a);for(var X=pt(this.doc,n),$=0;$<a&&!(X=za(this.doc,X,G,L,H),X.hitSide);++$);return X},moveH:tn(function(n,a){var L=this;this.extendSelectionsBy(function(H){return L.display.shift||L.doc.extend||H.empty()?za(L.doc,H.head,n,a,L.options.rtlMoveVisually):n<0?H.from():H.to()},oe)}),deleteH:tn(function(n,a){var L=this.doc.sel,H=this.doc;L.somethingSelected()?H.replaceSelection("",null,"+delete"):Br(this,function(G){var X=za(H,G.head,n,a,!1);return n<0?{from:X,to:G.head}:{from:G.head,to:X}})}),findPosV:function(n,a,L,H){var G=1,X=H;a<0&&(G=-1,a=-a);for(var $=pt(this.doc,n),se=0;se<a;++se){var ce=An(this,$,"div");if(X==null?X=ce.left:ce.left=X,$=Ro(this,ce,G,L),$.hitSide)break}return $},moveV:tn(function(n,a){var L=this,H=this.doc,G=[],X=!this.display.shift&&!H.extend&&H.sel.somethingSelected();if(H.extendSelectionsBy(function(se){if(X)return n<0?se.from():se.to();var ce=An(L,se.head,"div");se.goalColumn!=null&&(ce.left=se.goalColumn),G.push(ce.left);var we=Ro(L,ce,n,a);return a=="page"&&se==H.sel.primary()&&Sa(L,ma(L,we,"div").top-ce.top),we},oe),G.length)for(var $=0;$<H.sel.ranges.length;$++)H.sel.ranges[$].goalColumn=G[$]}),findWordAt:function(n){var a=this.doc,L=it(a,n.line).text,H=n.ch,G=n.ch;if(L){var X=this.getHelper(n,"wordChars");(n.sticky=="before"||G==L.length)&&H?--H:++G;for(var $=L.charAt(H),se=xe($,X)?function(ce){return xe(ce,X)}:/\s/.test($)?function(ce){return/\s/.test(ce)}:function(ce){return!/\s/.test(ce)&&!xe(ce)};H>0&&se(L.charAt(H-1));)--H;for(;G<L.length&&se(L.charAt(G));)++G}return new Rt(Be(n.line,H),Be(n.line,G))},toggleOverwrite:function(n){if(n!=null&&n==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?I(this.display.cursorDiv,"CodeMirror-overwrite"):w(this.display.cursorDiv,"CodeMirror-overwrite"),Oe(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==k()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:tn(function(n,a){oi(this,n,a)}),getScrollInfo:function(){var n=this.display.scroller;return{left:n.scrollLeft,top:n.scrollTop,height:n.scrollHeight-In(this)-this.display.barHeight,width:n.scrollWidth-In(this)-this.display.barWidth,clientHeight:ha(this),clientWidth:sr(this)}},scrollIntoView:tn(function(n,a){n==null?(n={from:this.doc.sel.primary().head,to:null},a==null&&(a=this.options.cursorScrollMargin)):typeof n=="number"?n={from:Be(n,0),to:null}:n.from==null&&(n={from:n,to:null}),n.to||(n.to=n.from),n.margin=a||0,n.from.line!=null?Jo(this,n):ys(this,n.from,n.to,n.margin)}),setSize:tn(function(n,a){var L=this,H=function(X){return typeof X=="number"||/^\d+$/.test(String(X))?X+"px":X};n!=null&&(this.display.wrapper.style.width=H(n)),a!=null&&(this.display.wrapper.style.height=H(a)),this.options.lineWrapping&&as(this);var G=this.display.viewFrom;this.doc.iter(G,this.display.viewTo,function(X){if(X.widgets){for(var $=0;$<X.widgets.length;$++)if(X.widgets[$].noHScroll){zn(L,G,"widget");break}}++G}),this.curOp.forceUpdate=!0,Oe(this,"refresh",this)}),operation:function(n){return hn(this,n)},startOperation:function(){return hr(this)},endOperation:function(){return fr(this)},refresh:tn(function(){var n=this.display.cachedTextHeight;on(this),this.curOp.forceUpdate=!0,ai(this),oi(this,this.doc.scrollLeft,this.doc.scrollTop),Ra(this.display),(n==null||Math.abs(n-Rr(this.display))>.5||this.options.lineWrapping)&&Ea(this),Oe(this,"refresh",this)}),swapDoc:tn(function(n){var a=this.doc;return a.cm=null,this.state.selectingText&&this.state.selectingText(),Ps(this,n),ai(this),this.display.input.reset(),oi(this,n.scrollLeft,n.scrollTop),this.curOp.forceScroll=!0,$t(this,"swapDoc",this,a),a}),phrase:function(n){var a=this.options.phrases;return a&&Object.prototype.hasOwnProperty.call(a,n)?a[n]:n},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}},ge(e),e.registerHelper=function(n,a,L){r.hasOwnProperty(n)||(r[n]=e[n]={_global:[]}),r[n][a]=L},e.registerGlobalHelper=function(n,a,L,H){e.registerHelper(n,a,H),r[n]._global.push({pred:L,val:H})}}function za(e,t,r,n,a){var L=t,H=r,G=it(e,t.line),X=a&&e.direction=="rtl"?-r:r;function $(){var Ze=t.line+X;return Ze<e.first||Ze>=e.first+e.size?!1:(t=new Be(Ze,t.ch,t.sticky),G=it(e,Ze))}function se(Ze){var Ye;if(n=="codepoint"){var et=G.text.charCodeAt(t.ch+(n>0?0:-1));isNaN(et)?Ye=null:Ye=new Be(t.line,Math.max(0,Math.min(G.text.length,t.ch+r*(et>=55296&&et<56320?2:1))),-r)}else a?Ye=kl(e.cm,G,t,r):Ye=Ua(G,t,r);if(Ye==null)if(!Ze&&$())t=Ba(a,e.cm,G,t.line,X);else return!1;else t=Ye;return!0}if(n=="char"||n=="codepoint")se();else if(n=="column")se(!0);else if(n=="word"||n=="group")for(var ce=null,we=n=="group",Ee=e.cm&&e.cm.getHelper(t,"wordChars"),Pe=!0;!(r<0&&!se(!Pe));Pe=!1){var Ne=G.text.charAt(t.ch)||`
|
|
`,Ge=xe(Ne,Ee)?"w":we&&Ne==`
|
|
`?"n":!we||/\s/.test(Ne)?null:"p";if(we&&!Pe&&!Ge&&(Ge="s"),ce&&ce!=Ge){r<0&&(r=1,se(),t.sticky="after");break}if(Ge&&(ce=Ge),r>0&&!se(!Pe))break}var Xe=Qi(e,t,L,H,!0);return zr(L,Xe)&&(Xe.hitSide=!0),Xe}function Ro(e,t,r,n){var a=e.doc,L=t.left,H;if(n=="page"){var G=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),X=Math.max(G-.5*Rr(e.display),3);H=(r>0?t.bottom:t.top)+r*X}else n=="line"&&(H=r>0?t.bottom+3:t.top-3);for(var $;!($=va(e,L,H),!$.outside);){if(r<0?H<=0:H>=a.height){$.hitSide=!0;break}H+=r*5}return $}var Ct=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new K,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Ct.prototype.init=function(e){var t=this,r=this,n=r.cm,a=r.div=e.lineDiv;Oo(a,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize);function L(G){for(var X=G.target;X;X=X.parentNode){if(X==a)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(X.className))break}return!1}Ce(a,"paste",function(G){if(!L(G)||Me(n,G)||xo(G,n))return;B<=11&&setTimeout(zt(n,function(){return t.updateFromDOM()}),20)}),Ce(a,"compositionstart",function(G){t.composing={data:G.data,done:!1}}),Ce(a,"compositionupdate",function(G){t.composing||(t.composing={data:G.data,done:!1})}),Ce(a,"compositionend",function(G){t.composing&&(G.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ce(a,"touchstart",function(){return r.forceCompositionEnd()}),Ce(a,"input",function(){t.composing||t.readFromDOMSoon()});function H(G){if(!L(G)||Me(n,G))return;if(n.somethingSelected())na({lineWise:!1,text:n.getSelections()}),G.type=="cut"&&n.replaceSelection("",null,"cut");else if(n.options.lineWiseCopyCut){var X=So(n);na({lineWise:!0,text:X.text}),G.type=="cut"&&n.operation(function(){n.setSelections(X.ranges,0,ue),n.replaceSelection("",null,"cut")})}else return;if(G.clipboardData){G.clipboardData.clearData();var $=Cn.text.join(`
|
|
`);if(G.clipboardData.setData("Text",$),G.clipboardData.getData("Text")==$){G.preventDefault();return}}var se=Ao(),ce=se.firstChild;n.display.lineSpace.insertBefore(se,n.display.lineSpace.firstChild),ce.value=Cn.text.join(`
|
|
`);var we=document.activeElement;F(ce),setTimeout(function(){n.display.lineSpace.removeChild(se),we.focus(),we==a&&r.showPrimarySelection()},50)}Ce(a,"copy",H),Ce(a,"cut",H)},Ct.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Ct.prototype.prepareSelection=function(){var e=ps(this.cm,!1);return e.focus=document.activeElement==this.div,e},Ct.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Ct.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Ct.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),n=r.from(),a=r.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||a.line<t.display.viewFrom){e.removeAllRanges();return}var L=ra(t,e.anchorNode,e.anchorOffset),H=ra(t,e.focusNode,e.focusOffset);if(L&&!L.bad&&H&&!H.bad&&ht(er(L,H),n)==0&&ht(yr(L,H),a)==0)return;var G=t.display.view,X=n.line>=t.display.viewFrom&&Co(t,n)||{node:G[0].measure.map[2],offset:0},$=a.line<t.display.viewTo&&Co(t,a);if(!$){var se=G[G.length-1].measure,ce=se.maps?se.maps[se.maps.length-1]:se.map;$={node:ce[ce.length-1],offset:ce[ce.length-2]-ce[ce.length-3]}}if(!X||!$){e.removeAllRanges();return}var we=e.rangeCount&&e.getRangeAt(0),Ee;try{Ee=m(X.node,X.offset,$.offset,$.node)}catch(Pe){}Ee&&(!D&&t.state.focused?(e.collapse(X.node,X.offset),Ee.collapsed||(e.removeAllRanges(),e.addRange(Ee))):(e.removeAllRanges(),e.addRange(Ee)),we&&e.anchorNode==null?e.addRange(we):D&&this.startGracePeriod()),this.rememberSelection()},Ct.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)},Ct.prototype.showMultipleSelections=function(e){_(this.cm.display.cursorDiv,e.cursors),_(this.cm.display.selectionDiv,e.selection)},Ct.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Ct.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return y(this.div,t)},Ct.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Ct.prototype.blur=function(){this.div.blur()},Ct.prototype.getField=function(){return this.div},Ct.prototype.supportsTouch=function(){return!0},Ct.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():hn(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)},Ct.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Ct.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(o&&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=ra(t,e.anchorNode,e.anchorOffset),n=ra(t,e.focusNode,e.focusOffset);r&&n&&hn(t,function(){Zt(t.doc,Xn(r,n),ue),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})},Ct.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,r=e.doc.sel.primary(),n=r.from(),a=r.to();if(n.ch==0&&n.line>e.firstLine()&&(n=Be(n.line-1,it(e.doc,n.line-1).length)),a.ch==it(e.doc,a.line).text.length&&a.line<e.lastLine()&&(a=Be(a.line+1,0)),n.line<t.viewFrom||a.line>t.viewTo-1)return!1;var L,H,G;n.line==t.viewFrom||(L=ur(e,n.line))==0?(H=St(t.view[0].line),G=t.view[0].node):(H=St(t.view[L].line),G=t.view[L-1].node.nextSibling);var X=ur(e,a.line),$,se;if(X==t.view.length-1?($=t.viewTo-1,se=t.lineDiv.lastChild):($=St(t.view[X+1].line)-1,se=t.view[X+1].node.previousSibling),!G)return!1;for(var ce=e.doc.splitLines(tu(e,G,se,H,$)),we=kn(e.doc,Be(H,0),Be($,it(e.doc,$).text.length));ce.length>1&&we.length>1;)if(Q(ce)==Q(we))ce.pop(),we.pop(),$--;else if(ce[0]==we[0])ce.shift(),we.shift(),H++;else break;for(var Ee=0,Pe=0,Ne=ce[0],Ge=we[0],Xe=Math.min(Ne.length,Ge.length);Ee<Xe&&Ne.charCodeAt(Ee)==Ge.charCodeAt(Ee);)++Ee;for(var Ze=Q(ce),Ye=Q(we),et=Math.min(Ze.length-(ce.length==1?Ee:0),Ye.length-(we.length==1?Ee:0));Pe<et&&Ze.charCodeAt(Ze.length-Pe-1)==Ye.charCodeAt(Ye.length-Pe-1);)++Pe;if(ce.length==1&&we.length==1&&H==n.line)for(;Ee&&Ee>n.ch&&Ze.charCodeAt(Ze.length-Pe-1)==Ye.charCodeAt(Ye.length-Pe-1);)Ee--,Pe++;ce[ce.length-1]=Ze.slice(0,Ze.length-Pe).replace(/^\u200b+/,""),ce[0]=ce[0].slice(Ee).replace(/\u200b+$/,"");var ut=Be(H,Ee),ot=Be($,we.length?Q(we).length-Pe:0);if(ce.length>1||ce[0]||ht(ut,ot))return Nr(e.doc,ce,ut,ot,"+input"),!0},Ct.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ct.prototype.reset=function(){this.forceCompositionEnd()},Ct.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Ct.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)},Ct.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&hn(this.cm,function(){return on(e.cm)})},Ct.prototype.setUneditable=function(e){e.contentEditable="false"},Ct.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||zt(this.cm,Ga)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Ct.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Ct.prototype.onContextMenu=function(){},Ct.prototype.resetPosition=function(){},Ct.prototype.needsContentAttribute=!0;function Co(e,t){var r=fa(e,t.line);if(!r||r.hidden)return null;var n=it(e.doc,t.line),a=es(r,n,t.line),L=Ve(n,e.doc.direction),H="left";if(L){var G=Fe(L,t.ch);H=G%2?"right":"left"}var X=rs(a.map,t.ch,H);return X.offset=X.collapse=="right"?X.end:X.start,X}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Hr(e,t){return t&&(e.bad=!0),e}function tu(e,t,r,n,a){var L="",H=!1,G=e.doc.lineSeparator(),X=!1;function $(Ee){return function(Pe){return Pe.id==Ee}}function se(){H&&(L+=G,X&&(L+=G),H=X=!1)}function ce(Ee){Ee&&(se(),L+=Ee)}function we(Ee){if(Ee.nodeType==1){var Pe=Ee.getAttribute("cm-text");if(Pe){ce(Pe);return}var Ne=Ee.getAttribute("cm-marker"),Ge;if(Ne){var Xe=e.findMarks(Be(n,0),Be(a+1,0),$(+Ne));Xe.length&&(Ge=Xe[0].find(0))&&ce(kn(e.doc,Ge.from,Ge.to).join(G));return}if(Ee.getAttribute("contenteditable")=="false")return;var Ze=/^(pre|div|p|li|table|br)$/i.test(Ee.nodeName);if(!/^br$/i.test(Ee.nodeName)&&Ee.textContent.length==0)return;Ze&&se();for(var Ye=0;Ye<Ee.childNodes.length;Ye++)we(Ee.childNodes[Ye]);/^(pre|p)$/i.test(Ee.nodeName)&&(X=!0),Ze&&(H=!0)}else Ee.nodeType==3&&ce(Ee.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(we(t),t==r);)t=t.nextSibling,X=!1;return L}function ra(e,t,r){var n;if(t==e.display.lineDiv){if(n=e.display.lineDiv.childNodes[r],!n)return Hr(e.clipPos(Be(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var a=0;a<e.display.view.length;a++){var L=e.display.view[a];if(L.node==n)return nu(L,t,r)}}function nu(e,t,r){var n=e.text.firstChild,a=!1;if(!t||!y(n,t))return Hr(Be(St(e.line),0),!0);if(t==n&&(a=!0,t=n.childNodes[r],r=0,!t)){var L=e.rest?Q(e.rest):e.line;return Hr(Be(St(L),L.text.length),a)}var H=t.nodeType==3?t:null,G=t;for(!H&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(H=t.firstChild,r&&(r=H.nodeValue.length));G.parentNode!=n;)G=G.parentNode;var X=e.measure,$=X.maps;function se(Ge,Xe,Ze){for(var Ye=-1;Ye<($?$.length:0);Ye++)for(var et=Ye<0?X.map:$[Ye],ut=0;ut<et.length;ut+=3){var ot=et[ut+2];if(ot==Ge||ot==Xe){var gt=St(Ye<0?e.line:e.rest[Ye]),It=et[ut]+Ze;return(Ze<0||ot!=Ge)&&(It=et[ut+(Ze?1:0)]),Be(gt,It)}}}var ce=se(H,G,r);if(ce)return Hr(ce,a);for(var we=G.nextSibling,Ee=H?H.nodeValue.length-r:0;we;we=we.nextSibling){if(ce=se(we,we.firstChild,0),ce)return Hr(Be(ce.line,ce.ch-Ee),a);Ee+=we.textContent.length}for(var Pe=G.previousSibling,Ne=r;Pe;Pe=Pe.previousSibling){if(ce=se(Pe,Pe.firstChild,-1),ce)return Hr(Be(ce.line,ce.ch+Ne),a);Ne+=Pe.textContent.length}}var Ut=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new K,this.hasSelection=!1,this.composing=null};Ut.prototype.init=function(e){var t=this,r=this,n=this.cm;this.createField(e);var a=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),c&&(a.style.width="0px"),Ce(a,"input",function(){W&&B>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),Ce(a,"paste",function(H){if(Me(n,H)||xo(H,n))return;n.state.pasteIncoming=+new Date,r.fastPoll()});function L(H){if(Me(n,H))return;if(n.somethingSelected())na({lineWise:!1,text:n.getSelections()});else if(n.options.lineWiseCopyCut){var G=So(n);na({lineWise:!0,text:G.text}),H.type=="cut"?n.setSelections(G.ranges,null,ue):(r.prevInput="",a.value=G.text.join(`
|
|
`),F(a))}else return;H.type=="cut"&&(n.state.cutIncoming=+new Date)}Ce(a,"cut",L),Ce(a,"copy",L),Ce(e.scroller,"paste",function(H){if(jn(e,H)||Me(n,H))return;if(!a.dispatchEvent){n.state.pasteIncoming=+new Date,r.focus();return}var G=new Event("paste");G.clipboardData=H.clipboardData,a.dispatchEvent(G)}),Ce(e.lineSpace,"selectstart",function(H){jn(e,H)||Y(H)}),Ce(a,"compositionstart",function(){var H=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:H,range:n.markText(H,n.getCursor("to"),{className:"CodeMirror-composing"})}}),Ce(a,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},Ut.prototype.createField=function(e){this.wrapper=Ao(),this.textarea=this.wrapper.firstChild},Ut.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Ut.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=ps(e);if(e.options.moveInputWithCursor){var a=An(e,r.sel.primary().head,"div"),L=t.wrapper.getBoundingClientRect(),H=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,a.top+H.top-L.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,a.left+H.left-L.left))}return n},Ut.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")},Ut.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&&F(this.textarea),W&&B>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",W&&B>=9&&(this.hasSelection=null))},Ut.prototype.getField=function(){return this.textarea},Ut.prototype.supportsTouch=function(){return!1},Ut.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!i||k()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ut.prototype.blur=function(){this.textarea.blur()},Ut.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ut.prototype.receivedFocus=function(){this.slowPoll()},Ut.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()})},Ut.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function r(){var n=t.poll();!n&&!e?(e=!0,t.polling.set(60,r)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,r)},Ut.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||st(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var a=r.value;if(a==n&&!t.somethingSelected())return!1;if(W&&B>=9&&this.hasSelection===a||u&&/[\uf700-\uf7ff]/.test(a))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var L=a.charCodeAt(0);if(L==8203&&!n&&(n="\u200B"),L==8666)return this.reset(),this.cm.execCommand("undo")}for(var H=0,G=Math.min(n.length,a.length);H<G&&n.charCodeAt(H)==a.charCodeAt(H);)++H;return hn(t,function(){Ga(t,a.slice(H),n.length-H,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},Ut.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ut.prototype.onKeyPress=function(){W&&B>=9&&(this.hasSelection=null),this.fastPoll()},Ut.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,a=t.textarea;t.contextMenuPending&&t.contextMenuPending();var L=lr(r,e),H=n.scroller.scrollTop;if(!L||p)return;var G=r.options.resetSelectionOnContextMenu;G&&r.doc.sel.contains(L)==-1&&zt(r,Zt)(r.doc,Xn(L),ue);var X=a.style.cssText,$=t.wrapper.style.cssText,se=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",a.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-se.top-5)+"px; left: "+(e.clientX-se.left-5)+`px;
|
|
z-index: 1000; background: `+(W?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ce;P&&(ce=window.scrollY),n.input.focus(),P&&window.scrollTo(null,ce),n.input.reset(),r.somethingSelected()||(a.value=t.prevInput=" "),t.contextMenuPending=Ee,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll);function we(){if(a.selectionStart!=null){var Ne=r.somethingSelected(),Ge="\u200B"+(Ne?a.value:"");a.value="\u21DA",a.value=Ge,t.prevInput=Ne?"":"\u200B",a.selectionStart=1,a.selectionEnd=Ge.length,n.selForContextMenu=r.doc.sel}}function Ee(){if(t.contextMenuPending!=Ee)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=$,a.style.cssText=X,W&&B<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=H),a.selectionStart!=null){(!W||W&&B<9)&&we();var Ne=0,Ge=function(){n.selForContextMenu==r.doc.sel&&a.selectionStart==0&&a.selectionEnd>0&&t.prevInput=="\u200B"?zt(r,Vs)(r):Ne++<10?n.detectingSelectAll=setTimeout(Ge,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(Ge,200)}}if(W&&B>=9&&we(),O){le(e);var Pe=function(){ze(window,"mouseup",Pe),setTimeout(Ee,20)};Ce(window,"mouseup",Pe)}else setTimeout(Ee,50)},Ut.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Ut.prototype.setUneditable=function(){},Ut.prototype.needsContentAttribute=!1;function ru(e,t){if(t=t?v(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=k();t.autofocus=r==e||e.getAttribute("autofocus")!=null&&r==document.body}function n(){e.value=G.getValue()}var a;if(e.form&&(Ce(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var L=e.form;a=L.submit;try{var H=L.submit=function(){n(),L.submit=a,L.submit(),L.submit=H}}catch(X){}}t.finishInit=function(X){X.save=n,X.getTextArea=function(){return e},X.toTextArea=function(){X.toTextArea=isNaN,n(),e.parentNode.removeChild(X.getWrapperElement()),e.style.display="",e.form&&(ze(e.form,"submit",n),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=a))}},e.style.display="none";var G=Pt(function(X){return e.parentNode.insertBefore(X,e.nextSibling)},t);return G}function iu(e){e.off=ze,e.on=Ce,e.wheelEventPixels=cl,e.Doc=ln,e.splitLines=ct,e.countColumn=j,e.findColumn=me,e.isWordChar=ye,e.Pass=ve,e.signal=Oe,e.Line=ar,e.changeEnd=Yn,e.scrollbarModel=Ts,e.Pos=Be,e.cmpPos=ht,e.modes=Mt,e.mimeModes=yt,e.resolveMode=dt,e.getMode=mt,e.modeExtensions=xt,e.extendMode=Dt,e.copyState=Wt,e.startState=Gr,e.innerMode=qn,e.commands=Ti,e.keyMap=Hn,e.keyName=lo,e.isModifierKey=so,e.lookupKey=Ur,e.normalizeKeyMap=Pl,e.StringStream=Nt,e.SharedTextMarker=yi,e.TextMarker=Qn,e.LineWidget=_i,e.e_preventDefault=Y,e.e_stopPropagation=Z,e.e_stop=le,e.addClass=I,e.contains=y,e.rmClass=w,e.keyNames=Jn}$l(Pt),ql(Pt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ia in ln.prototype)ln.prototype.hasOwnProperty(ia)&&J(au,ia)<0&&(Pt.prototype[ia]=function(e){return function(){return e.apply(this.doc,arguments)}}(ln.prototype[ia]));return ge(ln),Pt.inputStyles={textarea:Ut,contenteditable:Ct},Pt.defineMode=function(e){!Pt.defaults.mode&&e!="null"&&(Pt.defaults.mode=e),pn.apply(this,arguments)},Pt.defineMIME=bn,Pt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Pt.defineMIME("text/plain","null"),Pt.defineExtension=function(e,t){Pt.prototype[e]=t},Pt.defineDocExtension=function(e,t){ln.prototype[e]=t},Pt.fromTextArea=ru,iu(Pt),Pt.version="5.58.2",Pt})},Y1PL:function(tt,je,q){"use strict";q.r(je),q.d(je,"ResizableTextArea",function(){return J});var re=q("wx14"),V=q("1OyB"),D=q("vuIU"),z=q("Ji7U"),U=q("LK+K"),M=q("cDcd"),W=q("VTBJ"),B=q("rePB"),P=q("Zm9Q"),A=q("Kwbf"),g=q("c+Xe"),p=q("m+aA"),f=q("bdgK"),d=new Map;function s(ue){ue.forEach(function(de){var oe,me=de.target;(oe=d.get(me))===null||oe===void 0||oe.forEach(function(ae){return ae(me)})})}var c=new f.default(s),o=null,i=null;function u(ue,de){d.has(ue)||(d.set(ue,new Set),c.observe(ue)),d.get(ue).add(de)}function h(ue,de){d.has(ue)&&(d.get(ue).delete(de),d.get(ue).size||(c.unobserve(ue),d.delete(ue)))}var R=function(ue){Object(z.a)(oe,ue);var de=Object(U.a)(oe);function oe(){return Object(V.a)(this,oe),de.apply(this,arguments)}return Object(D.a)(oe,[{key:"render",value:function(){return this.props.children}}]),oe}(M.Component),S=M.createContext(null);function E(ue){var de=ue.children,oe=ue.onBatchResize,me=M.useRef(0),ae=M.useRef([]),fe=M.useContext(S),Q=M.useCallback(function(ie,ee,Te){me.current+=1;var Se=me.current;ae.current.push({size:ie,element:ee,data:Te}),Promise.resolve().then(function(){Se===me.current&&(oe==null||oe(ae.current),ae.current=[])}),fe==null||fe(ie,ee,Te)},[oe,fe]);return M.createElement(S.Provider,{value:Q},de)}function O(ue){var de=ue.children,oe=ue.disabled,me=M.useRef(null),ae=M.useRef(null),fe=M.useContext(S),Q=M.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ie=M.isValidElement(de)&&Object(g.c)(de),ee=ie?de.ref:null,Te=M.useMemo(function(){return Object(g.a)(ee,me)},[ee,me]),Se=M.useRef(ue);Se.current=ue;var be=M.useCallback(function(ye){var xe=Se.current,De=xe.onResize,Ie=xe.data,Ae=ye.getBoundingClientRect(),Le=Ae.width,Ue=Ae.height,He=ye.offsetWidth,We=ye.offsetHeight,Fe=Math.floor(Le),Je=Math.floor(Ue);if(Q.current.width!==Fe||Q.current.height!==Je||Q.current.offsetWidth!==He||Q.current.offsetHeight!==We){var Ve={width:Fe,height:Je,offsetWidth:He,offsetHeight:We};Q.current=Ve;var $e=He===Math.round(Le)?Le:He,Ce=We===Math.round(Ue)?Ue:We,qe=Object(W.a)(Object(W.a)({},Ve),{},{offsetWidth:$e,offsetHeight:Ce});fe==null||fe(qe,ye,Ie),De&&Promise.resolve().then(function(){De(qe,ye)})}},[]);return M.useEffect(function(){var ye=Object(p.a)(me.current)||Object(p.a)(ae.current);return ye&&!oe&&u(ye,be),function(){return h(ye,be)}},[me.current,oe]),M.createElement(R,{ref:ae},ie?M.cloneElement(de,{ref:Te}):de)}var x="rc-observer-key";function w(ue){var de=ue.children,oe=Object(P.a)(de);return oe.map(function(me,ae){var fe=(me==null?void 0:me.key)||"".concat(x,"-").concat(ae);return M.createElement(O,Object(re.a)({},ue,{key:fe}),me)})}w.Collection=E;var T=w,_=q("bT9E"),l=q("TSYQ"),b=q.n(l),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
|
|
`,y=["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"],k={},I;function N(ue){var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,oe=ue.getAttribute("id")||ue.getAttribute("data-reactid")||ue.getAttribute("name");if(de&&k[oe])return k[oe];var me=window.getComputedStyle(ue),ae=me.getPropertyValue("box-sizing")||me.getPropertyValue("-moz-box-sizing")||me.getPropertyValue("-webkit-box-sizing"),fe=parseFloat(me.getPropertyValue("padding-bottom"))+parseFloat(me.getPropertyValue("padding-top")),Q=parseFloat(me.getPropertyValue("border-bottom-width"))+parseFloat(me.getPropertyValue("border-top-width")),ie=y.map(function(Te){return"".concat(Te,":").concat(me.getPropertyValue(Te))}).join(";"),ee={sizingStyle:ie,paddingSize:fe,borderSize:Q,boxSizing:ae};return de&&oe&&(k[oe]=ee),ee}function F(ue){var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,oe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,me=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;I||(I=document.createElement("textarea"),I.setAttribute("tab-index","-1"),I.setAttribute("aria-hidden","true"),document.body.appendChild(I)),ue.getAttribute("wrap")?I.setAttribute("wrap",ue.getAttribute("wrap")):I.removeAttribute("wrap");var ae=N(ue,de),fe=ae.paddingSize,Q=ae.borderSize,ie=ae.boxSizing,ee=ae.sizingStyle;I.setAttribute("style","".concat(ee,";").concat(m)),I.value=ue.value||ue.placeholder||"";var Te=Number.MIN_SAFE_INTEGER,Se=Number.MAX_SAFE_INTEGER,be=I.scrollHeight,ye;if(ie==="border-box"?be+=Q:ie==="content-box"&&(be-=fe),oe!==null||me!==null){I.value=" ";var xe=I.scrollHeight-fe;oe!==null&&(Te=xe*oe,ie==="border-box"&&(Te=Te+fe+Q),be=Math.max(Te,be)),me!==null&&(Se=xe*me,ie==="border-box"&&(Se=Se+fe+Q),ye=be>Se?"":"hidden",be=Math.min(Se,be))}return{height:be,minHeight:Te,maxHeight:Se,overflowY:ye,resize:"none"}}var C=q("Gytx"),v=q.n(C),j;(function(ue){ue[ue.NONE=0]="NONE",ue[ue.RESIZING=1]="RESIZING",ue[ue.RESIZED=2]="RESIZED"})(j||(j={}));var K=function(ue){Object(z.a)(oe,ue);var de=Object(U.a)(oe);function oe(me){var ae;return Object(V.a)(this,oe),ae=de.call(this,me),ae.nextFrameActionId=void 0,ae.resizeFrameId=void 0,ae.textArea=void 0,ae.saveTextArea=function(fe){ae.textArea=fe},ae.handleResize=function(fe){var Q=ae.state.resizeStatus,ie=ae.props,ee=ie.autoSize,Te=ie.onResize;if(Q!==j.NONE)return;typeof Te=="function"&&Te(fe),ee&&ae.resizeOnNextFrame()},ae.resizeOnNextFrame=function(){cancelAnimationFrame(ae.nextFrameActionId),ae.nextFrameActionId=requestAnimationFrame(ae.resizeTextarea)},ae.resizeTextarea=function(){var fe=ae.props.autoSize;if(!fe||!ae.textArea)return;var Q=fe.minRows,ie=fe.maxRows,ee=F(ae.textArea,!1,Q,ie);ae.setState({textareaStyles:ee,resizeStatus:j.RESIZING},function(){cancelAnimationFrame(ae.resizeFrameId),ae.resizeFrameId=requestAnimationFrame(function(){ae.setState({resizeStatus:j.RESIZED},function(){ae.resizeFrameId=requestAnimationFrame(function(){ae.setState({resizeStatus:j.NONE}),ae.fixFirefoxAutoScroll()})})})})},ae.renderTextArea=function(){var fe=ae.props,Q=fe.prefixCls,ie=Q===void 0?"rc-textarea":Q,ee=fe.autoSize,Te=fe.onResize,Se=fe.className,be=fe.disabled,ye=ae.state,xe=ye.textareaStyles,De=ye.resizeStatus,Ie=Object(_.a)(ae.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ae=b()(ie,Se,Object(B.a)({},"".concat(ie,"-disabled"),be));"value"in Ie&&(Ie.value=Ie.value||"");var Le=Object(W.a)(Object(W.a)(Object(W.a)({},ae.props.style),xe),De===j.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return M.createElement(T,{onResize:ae.handleResize,disabled:!(ee||Te)},M.createElement("textarea",Object(re.a)({},Ie,{className:Ae,style:Le,ref:ae.saveTextArea})))},ae.state={textareaStyles:{},resizeStatus:j.NONE},ae}return Object(D.a)(oe,[{key:"componentDidUpdate",value:function(ae){(ae.value!==this.props.value||!v()(ae.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 ae=this.textArea.selectionStart,fe=this.textArea.selectionEnd;this.textArea.setSelectionRange(ae,fe)}}catch(Q){}}},{key:"render",value:function(){return this.renderTextArea()}}]),oe}(M.Component),J=K,te=function(ue){Object(z.a)(oe,ue);var de=Object(U.a)(oe);function oe(me){var ae;Object(V.a)(this,oe),ae=de.call(this,me),ae.resizableTextArea=void 0,ae.focus=function(){ae.resizableTextArea.textArea.focus()},ae.saveTextArea=function(Q){ae.resizableTextArea=Q},ae.handleChange=function(Q){var ie=ae.props.onChange;ae.setValue(Q.target.value,function(){ae.resizableTextArea.resizeTextarea()}),ie&&ie(Q)},ae.handleKeyDown=function(Q){var ie=ae.props,ee=ie.onPressEnter,Te=ie.onKeyDown;Q.keyCode===13&&ee&&ee(Q),Te&&Te(Q)};var fe=typeof me.value=="undefined"||me.value===null?me.defaultValue:me.value;return ae.state={value:fe},ae}return Object(D.a)(oe,[{key:"setValue",value:function(ae,fe){"value"in this.props||this.setState({value:ae},fe)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return M.createElement(J,Object(re.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ae){return"value"in ae?{value:ae.value}:null}}]),oe}(M.Component),ve=je.default=te},ZW9T:function(tt,je,q){"use strict";q.d(je,"a",function(){return F});var re=q("k1fw"),V=q("miYZ"),D=q("tsqr"),z=q("rAM+"),U=q("tJVT"),M=q("PpiC"),W=q("cDcd"),B=q.n(W),P=q("bdgK"),A=q("oBTY"),g=q("9og8"),p=q("WmNS"),f=q.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(`
|
|
`)}]},o={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
|
|
`)}]},i=q("5VLF"),u=q.n(i),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"]}},R=function(v,j){return j.map(function(K){return{label:K,kind:v.languages.CompletionItemKind.Keyword,insertText:K}})},S=function(v){return Object.keys(h.tables).map(function(j){return{label:j,kind:v.languages.CompletionItemKind.Variable,insertText:j}})},E=function(v,j){var K=h.tables[v];return K?K.map(function(J){return{label:J,kind:j.languages.CompletionItemKind.Field,insertText:J}}):[]};function O(C,v,j,K,J){var te=v.getWordUntilPosition(j),ve={startLineNumber:j.lineNumber,endLineNumber:j.lineNumber,startColumn:te.startColumn,endColumn:te.endColumn},ue=K.map(function(de){return{label:de,kind:C.languages.CompletionItemKind.Keyword,insertText:de,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ve}});return J.map(function(de){ue.push(Object(re.a)(Object(re.a)({},de),{},{range:ve}))}),ue}var x=function(C){h.languages.map(function(J){return C.languages.registerDocumentFormattingEditProvider(J,{provideDocumentFormattingEdits:function(ve,ue,de){return Object(g.a)(f.a.mark(function oe(){var me;return f.a.wrap(function(fe){for(;;)switch(fe.prev=fe.next){case 0:return me=u()(ve.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}),fe.abrupt("return",[{range:ve.getFullModelRange(),text:me}]);case 2:case"end":return fe.stop()}},oe)}))()}}),J});var v=c.quickKey.map(function(J){return{label:J.label,kind:C.languages.CompletionItemKind.Method,insertText:J.content,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),j=o.quickKey.map(function(J){return{label:J.label,kind:C.languages.CompletionItemKind.Method,insertText:J.content,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),K=s.quickKey.map(function(J){return{label:J.label,kind:C.languages.CompletionItemKind.Method,insertText:J.content,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet}});C.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(A.a)(c.keywords),Object(A.a)(c.quickKey.map(function(J){return J.label}))),provideCompletionItems:function(te,ve){var ue=te.getValueInRange({startLineNumber:ve.lineNumber,startColumn:1,endLineNumber:ve.lineNumber,endColumn:ve.column}),de=ue.match(/cu/gim);console.log("match:",de,ve,ue,te);var oe=[],me=ve.lineNumber,ae=ve.column,fe=te.getValueInRange({startLineNumber:me,startColumn:0,endLineNumber:me,endColumn:ae}),Q=fe.trim().split(/\s+/),ie=Q[Q.length-1];if(ie.endsWith(".")){var ee=ie.slice(0,ie.length-1);Object.keys(h.tables).includes(ee)&&(oe=Object(A.a)(E(ee,C)))}else ie==="."?oe=[]:oe=[].concat(Object(A.a)(S(C)),Object(A.a)(R(C,c.keywords)),Object(A.a)(v));return{suggestions:oe}}}),C.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(A.a)(d.keywords)),provideCompletionItems:function(te,ve){var ue=te.getValueInRange({startLineNumber:ve.lineNumber,startColumn:1,endLineNumber:ve.lineNumber,endColumn:ve.column}),de=ue.match(/cu/gim);console.log("match:",de,ve,ue,te);var oe=[],me=ve.lineNumber,ae=ve.column,fe=te.getValueInRange({startLineNumber:me,startColumn:0,endLineNumber:me,endColumn:ae}),Q=fe.trim().split(/\s+/),ie=Q[Q.length-1];if(ie.endsWith(".")){var ee=ie.slice(0,ie.length-1);Object.keys(h.tables).includes(ee)&&(oe=Object(A.a)(E(ee,C)))}else ie==="."?oe=[]:oe=[].concat(Object(A.a)(S(C)),Object(A.a)(R(C,d.keywords)));return{suggestions:oe}}}),C.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(A.a)(s.keywords)),provideCompletionItems:function(te,ve){var ue=[],de=ve.lineNumber,oe=ve.column,me=te.getValueInRange({startLineNumber:de,startColumn:0,endLineNumber:de,endColumn:oe}),ae=me.trim().split(/\s+/),fe=ae[ae.length-1];if(fe.endsWith(".")){var Q=fe.slice(0,fe.length-1);Object.keys(h.tables).includes(Q)&&(ue=Object(A.a)(E(Q,C)))}else fe==="."?ue=[]:ue=[].concat(Object(A.a)(S(C)),Object(A.a)(R(C,s.keywords)),Object(A.a)(K));return{suggestions:ue}}}),C.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(A.a)(o.keywords)),provideCompletionItems:function(te,ve){var ue=[],de=ve.lineNumber,oe=ve.column,me=te.getValueInRange({startLineNumber:de,startColumn:0,endLineNumber:de,endColumn:oe}),ae=me.trim().split(/\s+/),fe=ae[ae.length-1];if(fe.endsWith(".")){var Q=fe.slice(0,fe.length-1);Object.keys(h.tables).includes(Q)&&(ue=Object(A.a)(E(Q,C)))}else fe==="."?ue=[]:ue=[].concat(Object(A.a)(S(C)),Object(A.a)(R(C,o.keywords)),Object(A.a)(j));return{suggestions:ue}}})},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=q("LvDl"),_=q("+ua5");function l(C){return/^\d+$/.test(C)?"".concat(C,"px"):C}function b(){}var m=!1,y={"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 k(){var C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],v=C;if(Array.isArray(C)){for(var j=0;j<C.length;j++){var K=y[C[j]];if(K)return K}return v[0]}return y[v]||v}var I=null,N=je.b=function(C){var v=C.width,j=v===void 0?"100%":v,K=C.height,J=K===void 0?"100%":K,te=C.value,ve=C.language,ue=ve===void 0?"javascript":ve,de=C.style,oe=de===void 0?{}:de,me=C.options,ae=me===void 0?{}:me,fe=C.overrideServices,Q=fe===void 0?{}:fe,ie=C.theme,ee=ie===void 0?"vs-dark":ie,Te=C.onEditBlur,Se=C.onSave,be=C.autoHeight,ye=be===void 0?!1:be,xe=C.forbidCopy,De=xe===void 0?!1:xe,Ie=C.onChange,Ae=Ie===void 0?b:Ie,Le=C.editorDidMount,Ue=Le===void 0?b:Le,He=C.onFocus,We=He===void 0?b:He,Fe=C.filename,Je=Fe===void 0?"educoder.txt":Fe,Ve=C.errorLine,$e=C.errorContent,Ce=$e===void 0?"":$e,qe=Object(M.a)(C,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),ze=Object(W.useRef)(),Oe=Object(W.useRef)({}),Me=Object(W.useRef)(),_e=Object(W.useRef)(!1),he=Object(W.useRef)(),ge=Object(W.useState)(!1),Y=Object(U.a)(ge,2),Z=Y[0],ne=Y[1];function le(){var dt;return ze.current&&(dt=new P.default(function(mt){var xt=Object(z.a)(mt),Dt;try{for(xt.s();!(Dt=xt.n()).done;){var Wt=Dt.value;(Wt.target.offsetHeight>0||Wt.target.offsetWidth>0)&&Oe.current.instance.layout()}}catch(qn){xt.e(qn)}finally{xt.f()}}),dt.observe(ze.current)),dt}function pe(){D.b.warn(decodeURIComponent(w))}var Re=function(){var mt=Oe.current.instance;if(te!=null&&mt&&Z){var xt=mt.getModel();xt&&te!==xt.getValue()&&(m=!0,xt.setValue(te),mt.layout(),m=!1)}};Object(W.useEffect)(function(){Me.current&&clearTimeout(Me.current),Me.current=setTimeout(function(){Re()},500)},[te,Z,Oe.current]),Object(W.useEffect)(function(){if(Ve&&Oe.current&&Oe.current.instance){var dt=Oe.current.instance;dt.changeViewZones(function(xt){var Dt=document.createElement("div");Dt.style.padding="10px 20px",Dt.style.width="calc(100% - 20px)",Dt.className="my-error-line-wrp",Dt.innerHTML=Ce,xt.addZone({afterLineNumber:Ve||11,heightInLines:3,domNode:Dt})});var mt={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}};dt.addOverlayWidget(mt),dt.revealPositionInCenter({lineNumber:20,column:1})}},[Ve,Oe.current,Z]);function ke(){var dt=Oe.current.instance;if(dt){var mt=dt.getSelection(),xt=Oe.current.pastePos||{},Dt=new I.Range(xt.startLineNumber||mt.endLineNumber,xt.startColumn||mt.endColumn,xt.endLineNumber||mt.endLineNumber,xt.endColumn||mt.endColumn);setTimeout(function(){dt.executeEdits("",[{range:Dt,text:""}])},300)}}function Qe(dt){(window.navigator.platform.match("Mac")?dt.metaKey:dt.ctrlKey)&&dt.keyCode==83&&(dt.preventDefault(),Se())}var nt=function(){if(ye&&Oe.current.instance){var mt=Oe.current.instance.getContentHeight();pn(mt<J?J:mt)}else pn(J)};function rt(dt){var mt=document.createEvent("MouseEvents");mt.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),dt.dispatchEvent(mt)}function Et(dt,mt){var xt=window.URL||window.webkitURL||window,Dt=new Blob([mt]),Wt=document.createElementNS("http://www.w3.org/1999/xhtml","a");Wt.href=xt.createObjectURL(Dt),Wt.download=dt,rt(Wt)}Object(W.useEffect)(function(){nt()},[nt]),Object(W.useEffect)(function(){ze.current&&!Z&&q.e(27).then(q.t.bind(null,"M/lh",7)).then(function(dt){try{I=dt,Oe.current.instance=I.editor.create(ze.current,{value:te,language:k(ue),theme:ee,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},Q);var mt=Oe.current.instance;if(Ue(mt,I),setTimeout(function(){nt(),Oe.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Et(Je||"educoder.txt",mt.getValue())}})},500),Oe.current.subscription=mt.onDidChangeModelContent(function(Dt){_e.current?clearTimeout(he.current):(nt(),Ae(mt.getValue(),Dt)),he.current=setTimeout(function(){_e.current=!1},500)}),window.Monaco||x(I),De&&(mt.addCommand(I.KeyMod.CtrlCmd|I.KeyMod.Shift|I.KeyCode.KEY_V,function(){return pe(),null}),mt.addCommand(I.KeyMod.CtrlCmd|I.KeyCode.KEY_C,function(){return pe(),null})),window.Monaco=I,Te&&mt.onDidBlurEditorWidget(function(){Te(mt.getValue())}),We&&mt.onDidFocusEditorText(function(){We(mt.getValue())}),De){mt.addCommand(I.KeyMod.CtrlCmd|I.KeyCode.KEY_V,function(){return pe(),null}),mt.onDidPaste(function(Dt){Oe.current.pastePos=Dt});try{window.addEventListener("paste",ke)}catch(Dt){}}var xt=le();return ne(!0),function(){var Dt=Oe.current.instance;Dt.dispose();var Wt=Dt.getModel();Wt&&Wt.dispose(),Oe.current.subscription&&Oe.current.subscription.dispose(),De&&window.removeEventListener("paste",ke),xt.unobserve(ze.current)}}catch(Dt){}})},[]),Object(W.useEffect)(function(){var dt=Oe.current.instance;if(dt&&Z)return document.addEventListener("keydown",Qe,!1),function(){document.removeEventListener("keydown",Qe)}},[Se,Z]),Object(W.useEffect)(function(){var dt=Oe.current.instance;if(dt&&Z){var mt=k(ue);I.editor.setModelLanguage(dt.getModel(),mt),console.log("language:",ue,dt.getModel(),mt)}},[ue,Z]),Object(W.useEffect)(function(){var dt=Oe.current.instance;dt&&Z&&I.editor.setTheme(ee)},[ee,Z]),Object(W.useEffect)(function(){var dt=Oe.current.instance;dt&&Z&&(dt.updateOptions(Object(re.a)({},ae)),setTimeout(function(){dt.getModel().updateOptions(Object(re.a)({},ae))},200))},[JSON.stringify(ae),Z]),Object(W.useEffect)(function(){var dt=Oe.current.instance;dt&&Z&&dt.layout()},[j,J,Z]);var ct=Object(W.useState)(l(j)),st=Object(U.a)(ct,2),Ot=st[0],Tt=st[1],Bt=Object(W.useState)(l(J)),Mt=Object(U.a)(Bt,2),yt=Mt[0],pn=Mt[1],bn=Object(re.a)(Object(re.a)({},oe),{},{width:Ot,height:yt});return B.a.createElement("div",{className:"my-monaco-editor",ref:ze,style:bn})};function F(C){var v=C.width,j=v===void 0?"100%":v,K=C.height,J=K===void 0?"100%":K,te=C.original,ve=C.modified,ue=C.language,de=C.options,oe=de===void 0?{}:de,me=Object(W.useRef)(),ae=Object(W.useState)(null),fe=Object(U.a)(ae,2),Q=fe[0],ie=fe[1];function ee(ye){var xe;return me.current&&(xe=new P.default(function(De){var Ie=Object(z.a)(De),Ae;try{for(Ie.s();!(Ae=Ie.n()).done;){var Le=Ae.value;(Le.target.offsetHeight>0||Le.target.offsetWidth>0)&&ye.layout()}}catch(Ue){Ie.e(Ue)}finally{Ie.f()}}),xe.observe(me.current)),xe}Object(W.useEffect)(function(){me.current&&q.e(27).then(q.t.bind(null,"M/lh",7)).then(function(ye){I=ye;var xe=I.editor.createDiffEditor(me.current,Object(re.a)(Object(re.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},oe),{},{wordWrap:!0}));ie(xe);var De=ee(xe);return function(){xe.dispose();var Ie=xe.getModel();Ie&&Ie.dispose(),De.unobserve(me.current)}})},[]),Object(W.useEffect)(function(){Q&&Q.setModel({original:I.editor.createModel(te,ue),modified:I.editor.createModel(ve,ue)})},[te,ve,ue,Q]);var Te=l(j),Se=l(J),be={width:Te,height:Se};return B.a.createElement("div",{className:"my-diff-editor",ref:me,style:be})}},ZpRC:function(tt,je,q){"use strict";function re(g){return typeof g=="object"&&g!=null&&g.nodeType===1}function V(g,p){return(!p||g!=="hidden")&&g!=="visible"&&g!=="clip"}function D(g,p){if(g.clientHeight<g.scrollHeight||g.clientWidth<g.scrollWidth){var f=getComputedStyle(g,null);return V(f.overflowY,p)||V(f.overflowX,p)||function(d){var s=function(c){if(!c.ownerDocument||!c.ownerDocument.defaultView)return null;try{return c.ownerDocument.defaultView.frameElement}catch(o){return null}}(d);return!!s&&(s.clientHeight<d.scrollHeight||s.clientWidth<d.scrollWidth)}(g)}return!1}function z(g,p,f,d,s,c,o,i){return c<g&&o>p||c>g&&o<p?0:c<=g&&i<=f||o>=p&&i>=f?c-g-d:o>p&&i<f||c<g&&i>f?o-p+s:0}var U=function(g,p){var f=window,d=p.scrollMode,s=p.block,c=p.inline,o=p.boundary,i=p.skipOverflowHiddenElements,u=typeof o=="function"?o:function(xe){return xe!==o};if(!re(g))throw new TypeError("Invalid target");for(var h=document.scrollingElement||document.documentElement,R=[],S=g;re(S)&&u(S);){if((S=S.parentElement)===h){R.push(S);break}S!=null&&S===document.body&&D(S)&&!D(document.documentElement)||S!=null&&D(S,i)&&R.push(S)}for(var E=f.visualViewport?f.visualViewport.width:innerWidth,O=f.visualViewport?f.visualViewport.height:innerHeight,x=window.scrollX||pageXOffset,w=window.scrollY||pageYOffset,T=g.getBoundingClientRect(),_=T.height,l=T.width,b=T.top,m=T.right,y=T.bottom,k=T.left,I=s==="start"||s==="nearest"?b:s==="end"?y:b+_/2,N=c==="center"?k+l/2:c==="end"?m:k,F=[],C=0;C<R.length;C++){var v=R[C],j=v.getBoundingClientRect(),K=j.height,J=j.width,te=j.top,ve=j.right,ue=j.bottom,de=j.left;if(d==="if-needed"&&b>=0&&k>=0&&y<=O&&m<=E&&b>=te&&y<=ue&&k>=de&&m<=ve)return F;var oe=getComputedStyle(v),me=parseInt(oe.borderLeftWidth,10),ae=parseInt(oe.borderTopWidth,10),fe=parseInt(oe.borderRightWidth,10),Q=parseInt(oe.borderBottomWidth,10),ie=0,ee=0,Te="offsetWidth"in v?v.offsetWidth-v.clientWidth-me-fe:0,Se="offsetHeight"in v?v.offsetHeight-v.clientHeight-ae-Q:0;if(h===v)ie=s==="start"?I:s==="end"?I-O:s==="nearest"?z(w,w+O,O,ae,Q,w+I,w+I+_,_):I-O/2,ee=c==="start"?N:c==="center"?N-E/2:c==="end"?N-E:z(x,x+E,E,me,fe,x+N,x+N+l,l),ie=Math.max(0,ie+w),ee=Math.max(0,ee+x);else{ie=s==="start"?I-te-ae:s==="end"?I-ue+Q+Se:s==="nearest"?z(te,ue,K,ae,Q+Se,I,I+_,_):I-(te+K/2)+Se/2,ee=c==="start"?N-de-me:c==="center"?N-(de+J/2)+Te/2:c==="end"?N-ve+fe+Te:z(de,ve,J,me,fe+Te,N,N+l,l);var be=v.scrollLeft,ye=v.scrollTop;I+=ye-(ie=Math.max(0,Math.min(ye+ie,v.scrollHeight-K+Se))),N+=be-(ee=Math.max(0,Math.min(be+ee,v.scrollWidth-J+Te)))}F.push({el:v,top:ie,left:ee})}return F};function M(g){return g===Object(g)&&Object.keys(g).length!==0}function W(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,o=d.left;s.scroll&&f?s.scroll({top:c,left:o,behavior:p}):(s.scrollTop=c,s.scrollLeft=o)})}function B(g){return g===!1?{block:"end",inline:"nearest"}:M(g)?g:{block:"start",inline:"nearest"}}function P(g,p){var f=!g.ownerDocument.documentElement.contains(g);if(M(p)&&typeof p.behavior=="function")return p.behavior(f?[]:U(g,p));if(f)return;var d=B(p);return W(U(g,d),d.behavior)}var A=je.a=P},Zss7:function(tt,je,q){var re;(function(V){var D=/^\s+/,z=/\s+$/,U=0,M=V.round,W=V.min,B=V.max,P=V.random;function A(Q,ie){if(Q=Q||"",ie=ie||{},Q instanceof A)return Q;if(!(this instanceof A))return new A(Q,ie);var ee=g(Q);this._originalInput=Q,this._r=ee.r,this._g=ee.g,this._b=ee.b,this._a=ee.a,this._roundA=M(100*this._a)/100,this._format=ie.format||ee.format,this._gradientType=ie.gradientType,this._r<1&&(this._r=M(this._r)),this._g<1&&(this._g=M(this._g)),this._b<1&&(this._b=M(this._b)),this._ok=ee.ok,this._tc_id=U++}A.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 Q=this.toRgb();return(Q.r*299+Q.g*587+Q.b*114)/1e3},getLuminance:function(){var Q=this.toRgb(),ie,ee,Te,Se,be,ye;return ie=Q.r/255,ee=Q.g/255,Te=Q.b/255,ie<=.03928?Se=ie/12.92:Se=V.pow((ie+.055)/1.055,2.4),ee<=.03928?be=ee/12.92:be=V.pow((ee+.055)/1.055,2.4),Te<=.03928?ye=Te/12.92:ye=V.pow((Te+.055)/1.055,2.4),.2126*Se+.7152*be+.0722*ye},setAlpha:function(Q){return this._a=F(Q),this._roundA=M(100*this._a)/100,this},toHsv:function(){var Q=s(this._r,this._g,this._b);return{h:Q.h*360,s:Q.s,v:Q.v,a:this._a}},toHsvString:function(){var Q=s(this._r,this._g,this._b),ie=M(Q.h*360),ee=M(Q.s*100),Te=M(Q.v*100);return this._a==1?"hsv("+ie+", "+ee+"%, "+Te+"%)":"hsva("+ie+", "+ee+"%, "+Te+"%, "+this._roundA+")"},toHsl:function(){var Q=f(this._r,this._g,this._b);return{h:Q.h*360,s:Q.s,l:Q.l,a:this._a}},toHslString:function(){var Q=f(this._r,this._g,this._b),ie=M(Q.h*360),ee=M(Q.s*100),Te=M(Q.l*100);return this._a==1?"hsl("+ie+", "+ee+"%, "+Te+"%)":"hsla("+ie+", "+ee+"%, "+Te+"%, "+this._roundA+")"},toHex:function(Q){return o(this._r,this._g,this._b,Q)},toHexString:function(Q){return"#"+this.toHex(Q)},toHex8:function(Q){return i(this._r,this._g,this._b,this._a,Q)},toHex8String:function(Q){return"#"+this.toHex8(Q)},toRgb:function(){return{r:M(this._r),g:M(this._g),b:M(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+M(this._r)+", "+M(this._g)+", "+M(this._b)+")":"rgba("+M(this._r)+", "+M(this._g)+", "+M(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:M(C(this._r,255)*100)+"%",g:M(C(this._g,255)*100)+"%",b:M(C(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+M(C(this._r,255)*100)+"%, "+M(C(this._g,255)*100)+"%, "+M(C(this._b,255)*100)+"%)":"rgba("+M(C(this._r,255)*100)+"%, "+M(C(this._g,255)*100)+"%, "+M(C(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:I[o(this._r,this._g,this._b,!0)]||!1},toFilter:function(Q){var ie="#"+u(this._r,this._g,this._b,this._a),ee=ie,Te=this._gradientType?"GradientType = 1, ":"";if(Q){var Se=A(Q);ee="#"+u(Se._r,Se._g,Se._b,Se._a)}return"progid:DXImageTransform.Microsoft.gradient("+Te+"startColorstr="+ie+",endColorstr="+ee+")"},toString:function(Q){var ie=!!Q;Q=Q||this._format;var ee=!1,Te=this._a<1&&this._a>=0,Se=!ie&&Te&&(Q==="hex"||Q==="hex6"||Q==="hex3"||Q==="hex4"||Q==="hex8"||Q==="name");return Se?Q==="name"&&this._a===0?this.toName():this.toRgbString():(Q==="rgb"&&(ee=this.toRgbString()),Q==="prgb"&&(ee=this.toPercentageRgbString()),(Q==="hex"||Q==="hex6")&&(ee=this.toHexString()),Q==="hex3"&&(ee=this.toHexString(!0)),Q==="hex4"&&(ee=this.toHex8String(!0)),Q==="hex8"&&(ee=this.toHex8String()),Q==="name"&&(ee=this.toName()),Q==="hsl"&&(ee=this.toHslString()),Q==="hsv"&&(ee=this.toHsvString()),ee||this.toHexString())},clone:function(){return A(this.toString())},_applyModification:function(Q,ie){var ee=Q.apply(null,[this].concat([].slice.call(ie)));return this._r=ee._r,this._g=ee._g,this._b=ee._b,this.setAlpha(ee._a),this},lighten:function(){return this._applyModification(E,arguments)},brighten:function(){return this._applyModification(O,arguments)},darken:function(){return this._applyModification(x,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(R,arguments)},greyscale:function(){return this._applyModification(S,arguments)},spin:function(){return this._applyModification(w,arguments)},_applyCombination:function(Q,ie){return Q.apply(null,[this].concat([].slice.call(ie)))},analogous:function(){return this._applyCombination(m,arguments)},complement:function(){return this._applyCombination(T,arguments)},monochromatic:function(){return this._applyCombination(y,arguments)},splitcomplement:function(){return this._applyCombination(b,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(l,arguments)}},A.fromRatio=function(Q,ie){if(typeof Q=="object"){var ee={};for(var Te in Q)Q.hasOwnProperty(Te)&&(Te==="a"?ee[Te]=Q[Te]:ee[Te]=ve(Q[Te]));Q=ee}return A(Q,ie)};function g(Q){var ie={r:0,g:0,b:0},ee=1,Te=null,Se=null,be=null,ye=!1,xe=!1;return typeof Q=="string"&&(Q=ae(Q)),typeof Q=="object"&&(me(Q.r)&&me(Q.g)&&me(Q.b)?(ie=p(Q.r,Q.g,Q.b),ye=!0,xe=String(Q.r).substr(-1)==="%"?"prgb":"rgb"):me(Q.h)&&me(Q.s)&&me(Q.v)?(Te=ve(Q.s),Se=ve(Q.v),ie=c(Q.h,Te,Se),ye=!0,xe="hsv"):me(Q.h)&&me(Q.s)&&me(Q.l)&&(Te=ve(Q.s),be=ve(Q.l),ie=d(Q.h,Te,be),ye=!0,xe="hsl"),Q.hasOwnProperty("a")&&(ee=Q.a)),ee=F(ee),{ok:ye,format:Q.format||xe,r:W(255,B(ie.r,0)),g:W(255,B(ie.g,0)),b:W(255,B(ie.b,0)),a:ee}}function p(Q,ie,ee){return{r:C(Q,255)*255,g:C(ie,255)*255,b:C(ee,255)*255}}function f(Q,ie,ee){Q=C(Q,255),ie=C(ie,255),ee=C(ee,255);var Te=B(Q,ie,ee),Se=W(Q,ie,ee),be,ye,xe=(Te+Se)/2;if(Te==Se)be=ye=0;else{var De=Te-Se;ye=xe>.5?De/(2-Te-Se):De/(Te+Se);switch(Te){case Q:be=(ie-ee)/De+(ie<ee?6:0);break;case ie:be=(ee-Q)/De+2;break;case ee:be=(Q-ie)/De+4;break}be/=6}return{h:be,s:ye,l:xe}}function d(Q,ie,ee){var Te,Se,be;Q=C(Q,360),ie=C(ie,100),ee=C(ee,100);function ye(Ie,Ae,Le){return Le<0&&(Le+=1),Le>1&&(Le-=1),Le<1/6?Ie+(Ae-Ie)*6*Le:Le<1/2?Ae:Le<2/3?Ie+(Ae-Ie)*(2/3-Le)*6:Ie}if(ie===0)Te=Se=be=ee;else{var xe=ee<.5?ee*(1+ie):ee+ie-ee*ie,De=2*ee-xe;Te=ye(De,xe,Q+1/3),Se=ye(De,xe,Q),be=ye(De,xe,Q-1/3)}return{r:Te*255,g:Se*255,b:be*255}}function s(Q,ie,ee){Q=C(Q,255),ie=C(ie,255),ee=C(ee,255);var Te=B(Q,ie,ee),Se=W(Q,ie,ee),be,ye,xe=Te,De=Te-Se;if(ye=Te===0?0:De/Te,Te==Se)be=0;else{switch(Te){case Q:be=(ie-ee)/De+(ie<ee?6:0);break;case ie:be=(ee-Q)/De+2;break;case ee:be=(Q-ie)/De+4;break}be/=6}return{h:be,s:ye,v:xe}}function c(Q,ie,ee){Q=C(Q,360)*6,ie=C(ie,100),ee=C(ee,100);var Te=V.floor(Q),Se=Q-Te,be=ee*(1-ie),ye=ee*(1-Se*ie),xe=ee*(1-(1-Se)*ie),De=Te%6,Ie=[ee,ye,be,be,xe,ee][De],Ae=[xe,ee,ee,ye,be,be][De],Le=[be,be,xe,ee,ee,ye][De];return{r:Ie*255,g:Ae*255,b:Le*255}}function o(Q,ie,ee,Te){var Se=[te(M(Q).toString(16)),te(M(ie).toString(16)),te(M(ee).toString(16))];return Te&&Se[0].charAt(0)==Se[0].charAt(1)&&Se[1].charAt(0)==Se[1].charAt(1)&&Se[2].charAt(0)==Se[2].charAt(1)?Se[0].charAt(0)+Se[1].charAt(0)+Se[2].charAt(0):Se.join("")}function i(Q,ie,ee,Te,Se){var be=[te(M(Q).toString(16)),te(M(ie).toString(16)),te(M(ee).toString(16)),te(ue(Te))];return Se&&be[0].charAt(0)==be[0].charAt(1)&&be[1].charAt(0)==be[1].charAt(1)&&be[2].charAt(0)==be[2].charAt(1)&&be[3].charAt(0)==be[3].charAt(1)?be[0].charAt(0)+be[1].charAt(0)+be[2].charAt(0)+be[3].charAt(0):be.join("")}function u(Q,ie,ee,Te){var Se=[te(ue(Te)),te(M(Q).toString(16)),te(M(ie).toString(16)),te(M(ee).toString(16))];return Se.join("")}A.equals=function(Q,ie){return!Q||!ie?!1:A(Q).toRgbString()==A(ie).toRgbString()},A.random=function(){return A.fromRatio({r:P(),g:P(),b:P()})};function h(Q,ie){ie=ie===0?0:ie||10;var ee=A(Q).toHsl();return ee.s-=ie/100,ee.s=v(ee.s),A(ee)}function R(Q,ie){ie=ie===0?0:ie||10;var ee=A(Q).toHsl();return ee.s+=ie/100,ee.s=v(ee.s),A(ee)}function S(Q){return A(Q).desaturate(100)}function E(Q,ie){ie=ie===0?0:ie||10;var ee=A(Q).toHsl();return ee.l+=ie/100,ee.l=v(ee.l),A(ee)}function O(Q,ie){ie=ie===0?0:ie||10;var ee=A(Q).toRgb();return ee.r=B(0,W(255,ee.r-M(255*-(ie/100)))),ee.g=B(0,W(255,ee.g-M(255*-(ie/100)))),ee.b=B(0,W(255,ee.b-M(255*-(ie/100)))),A(ee)}function x(Q,ie){ie=ie===0?0:ie||10;var ee=A(Q).toHsl();return ee.l-=ie/100,ee.l=v(ee.l),A(ee)}function w(Q,ie){var ee=A(Q).toHsl(),Te=(ee.h+ie)%360;return ee.h=Te<0?360+Te:Te,A(ee)}function T(Q){var ie=A(Q).toHsl();return ie.h=(ie.h+180)%360,A(ie)}function _(Q){var ie=A(Q).toHsl(),ee=ie.h;return[A(Q),A({h:(ee+120)%360,s:ie.s,l:ie.l}),A({h:(ee+240)%360,s:ie.s,l:ie.l})]}function l(Q){var ie=A(Q).toHsl(),ee=ie.h;return[A(Q),A({h:(ee+90)%360,s:ie.s,l:ie.l}),A({h:(ee+180)%360,s:ie.s,l:ie.l}),A({h:(ee+270)%360,s:ie.s,l:ie.l})]}function b(Q){var ie=A(Q).toHsl(),ee=ie.h;return[A(Q),A({h:(ee+72)%360,s:ie.s,l:ie.l}),A({h:(ee+216)%360,s:ie.s,l:ie.l})]}function m(Q,ie,ee){ie=ie||6,ee=ee||30;var Te=A(Q).toHsl(),Se=360/ee,be=[A(Q)];for(Te.h=(Te.h-(Se*ie>>1)+720)%360;--ie;)Te.h=(Te.h+Se)%360,be.push(A(Te));return be}function y(Q,ie){ie=ie||6;for(var ee=A(Q).toHsv(),Te=ee.h,Se=ee.s,be=ee.v,ye=[],xe=1/ie;ie--;)ye.push(A({h:Te,s:Se,v:be})),be=(be+xe)%1;return ye}A.mix=function(Q,ie,ee){ee=ee===0?0:ee||50;var Te=A(Q).toRgb(),Se=A(ie).toRgb(),be=ee/100,ye={r:(Se.r-Te.r)*be+Te.r,g:(Se.g-Te.g)*be+Te.g,b:(Se.b-Te.b)*be+Te.b,a:(Se.a-Te.a)*be+Te.a};return A(ye)},A.readability=function(Q,ie){var ee=A(Q),Te=A(ie);return(V.max(ee.getLuminance(),Te.getLuminance())+.05)/(V.min(ee.getLuminance(),Te.getLuminance())+.05)},A.isReadable=function(Q,ie,ee){var Te=A.readability(Q,ie),Se,be;be=!1,Se=fe(ee);switch(Se.level+Se.size){case"AAsmall":case"AAAlarge":be=Te>=4.5;break;case"AAlarge":be=Te>=3;break;case"AAAsmall":be=Te>=7;break}return be},A.mostReadable=function(Q,ie,ee){var Te=null,Se=0,be,ye,xe,De;ee=ee||{},ye=ee.includeFallbackColors,xe=ee.level,De=ee.size;for(var Ie=0;Ie<ie.length;Ie++)be=A.readability(Q,ie[Ie]),be>Se&&(Se=be,Te=A(ie[Ie]));return A.isReadable(Q,Te,{level:xe,size:De})||!ye?Te:(ee.includeFallbackColors=!1,A.mostReadable(Q,["#fff","#000"],ee))};var k=A.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"},I=A.hexNames=N(k);function N(Q){var ie={};for(var ee in Q)Q.hasOwnProperty(ee)&&(ie[Q[ee]]=ee);return ie}function F(Q){return Q=parseFloat(Q),(isNaN(Q)||Q<0||Q>1)&&(Q=1),Q}function C(Q,ie){K(Q)&&(Q="100%");var ee=J(Q);return Q=W(ie,B(0,parseFloat(Q))),ee&&(Q=parseInt(Q*ie,10)/100),V.abs(Q-ie)<1e-6?1:Q%ie/parseFloat(ie)}function v(Q){return W(1,B(0,Q))}function j(Q){return parseInt(Q,16)}function K(Q){return typeof Q=="string"&&Q.indexOf(".")!=-1&&parseFloat(Q)===1}function J(Q){return typeof Q=="string"&&Q.indexOf("%")!=-1}function te(Q){return Q.length==1?"0"+Q:""+Q}function ve(Q){return Q<=1&&(Q=Q*100+"%"),Q}function ue(Q){return V.round(parseFloat(Q)*255).toString(16)}function de(Q){return j(Q)/255}var oe=function(){var Q="[-\\+]?\\d+%?",ie="[-\\+]?\\d*\\.\\d+%?",ee="(?:"+ie+")|(?:"+Q+")",Te="[\\s|\\(]+("+ee+")[,|\\s]+("+ee+")[,|\\s]+("+ee+")\\s*\\)?",Se="[\\s|\\(]+("+ee+")[,|\\s]+("+ee+")[,|\\s]+("+ee+")[,|\\s]+("+ee+")\\s*\\)?";return{CSS_UNIT:new RegExp(ee),rgb:new RegExp("rgb"+Te),rgba:new RegExp("rgba"+Se),hsl:new RegExp("hsl"+Te),hsla:new RegExp("hsla"+Se),hsv:new RegExp("hsv"+Te),hsva:new RegExp("hsva"+Se),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 me(Q){return!!oe.CSS_UNIT.exec(Q)}function ae(Q){Q=Q.replace(D,"").replace(z,"").toLowerCase();var ie=!1;if(k[Q])Q=k[Q],ie=!0;else if(Q=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ee;return(ee=oe.rgb.exec(Q))?{r:ee[1],g:ee[2],b:ee[3]}:(ee=oe.rgba.exec(Q))?{r:ee[1],g:ee[2],b:ee[3],a:ee[4]}:(ee=oe.hsl.exec(Q))?{h:ee[1],s:ee[2],l:ee[3]}:(ee=oe.hsla.exec(Q))?{h:ee[1],s:ee[2],l:ee[3],a:ee[4]}:(ee=oe.hsv.exec(Q))?{h:ee[1],s:ee[2],v:ee[3]}:(ee=oe.hsva.exec(Q))?{h:ee[1],s:ee[2],v:ee[3],a:ee[4]}:(ee=oe.hex8.exec(Q))?{r:j(ee[1]),g:j(ee[2]),b:j(ee[3]),a:de(ee[4]),format:ie?"name":"hex8"}:(ee=oe.hex6.exec(Q))?{r:j(ee[1]),g:j(ee[2]),b:j(ee[3]),format:ie?"name":"hex"}:(ee=oe.hex4.exec(Q))?{r:j(ee[1]+""+ee[1]),g:j(ee[2]+""+ee[2]),b:j(ee[3]+""+ee[3]),a:de(ee[4]+""+ee[4]),format:ie?"name":"hex8"}:(ee=oe.hex3.exec(Q))?{r:j(ee[1]+""+ee[1]),g:j(ee[2]+""+ee[2]),b:j(ee[3]+""+ee[3]),format:ie?"name":"hex"}:!1}function fe(Q){var ie,ee;return Q=Q||{level:"AA",size:"small"},ie=(Q.level||"AA").toUpperCase(),ee=(Q.size||"small").toLowerCase(),ie!=="AA"&&ie!=="AAA"&&(ie="AA"),ee!=="small"&&ee!=="large"&&(ee="small"),{level:ie,size:ee}}tt.exports?tt.exports=A:!(re=function(){return A}.call(je,q,je,tt),re!==void 0&&(tt.exports=re))})(Math)},bT9E:function(tt,je,q){"use strict";q.d(je,"a",function(){return V});var re=q("VTBJ");function V(D,z){var U=Object(re.a)({},D);return Array.isArray(z)&&z.forEach(function(M){delete U[M]}),U}},c5Ni:function(tt,je,q){},dejd:function(tt,je,q){},dmUQ:function(tt,je,q){"use strict";var re=q("Ff2n"),V=q("rePB"),D=q("1OyB"),z=q("vuIU"),U=q("Ji7U"),M=q("md7G"),W=q("foSv"),B=q("cDcd"),P=q.n(B),A=q("TSYQ"),g=q.n(A),p=q("4IlW");function f(_,l){var b=Object.keys(_);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(_);l&&(m=m.filter(function(y){return Object.getOwnPropertyDescriptor(_,y).enumerable})),b.push.apply(b,m)}return b}function d(_){for(var l=1;l<arguments.length;l++){var b=arguments[l]!=null?arguments[l]:{};l%2?f(Object(b),!0).forEach(function(m){Object(V.a)(_,m,b[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(_,Object.getOwnPropertyDescriptors(b)):f(Object(b)).forEach(function(m){Object.defineProperty(_,m,Object.getOwnPropertyDescriptor(b,m))})}return _}function s(_){var l=c();return function(){var m=Object(W.a)(_),y;if(l){var k=Object(W.a)(this).constructor;y=Reflect.construct(m,arguments,k)}else y=m.apply(this,arguments);return Object(M.a)(this,y)}}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 o(){}function i(_){_.preventDefault()}var u=function(l){return l.replace(/[^\w.-]+/g,"")},h=200,R=600,S=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,E=function(l){return l!=null},O=function(l,b){return b===l||typeof b=="number"&&typeof l=="number"&&isNaN(b)&&isNaN(l)},x=function(_){Object(U.a)(b,_);var l=s(b);function b(m){var y;Object(D.a)(this,b),y=l.call(this,m),y.onKeyDown=function(N){var F=y.props,C=F.onKeyDown,v=F.onPressEnter;if(N.keyCode===p.a.UP){var j=y.getRatio(N);y.up(N,j,null),y.stop()}else if(N.keyCode===p.a.DOWN){var K=y.getRatio(N);y.down(N,K,null),y.stop()}else N.keyCode===p.a.ENTER&&v&&v(N);if(y.recordCursorPosition(),y.lastKeyCode=N.keyCode,C){for(var J=arguments.length,te=new Array(J>1?J-1:0),ve=1;ve<J;ve++)te[ve-1]=arguments[ve];C.apply(void 0,[N].concat(te))}},y.onKeyUp=function(N){var F=y.props.onKeyUp;if(y.stop(),y.recordCursorPosition(),F){for(var C=arguments.length,v=new Array(C>1?C-1:0),j=1;j<C;j++)v[j-1]=arguments[j];F.apply(void 0,[N].concat(v))}},y.onChange=function(N){var F=y.props.onChange;y.state.focused&&(y.inputting=!0),y.rawInput=y.props.parser(y.getValueFromEvent(N)),y.setState({inputValue:y.rawInput}),F(y.toNumber(y.rawInput))},y.onMouseUp=function(){var N=y.props.onMouseUp;y.recordCursorPosition(),N&&N.apply(void 0,arguments)},y.onFocus=function(){var N;y.setState({focused:!0}),(N=y.props).onFocus.apply(N,arguments)},y.onBlur=function(){var N=y.props.onBlur;y.inputting=!1,y.setState({focused:!1});var F=y.getCurrentValidValue(y.state.inputValue),C=y.setValue(F,o);if(N){var v=y.input.value,j=y.getInputDisplayValue({focus:!1,value:C});y.input.value=j&&Number(j),N.apply(void 0,arguments),y.input.value=v}},y.getRatio=function(N){var F=1;return N.metaKey||N.ctrlKey?F=.1:N.shiftKey&&(F=10),F},y.getFullNum=function(N){return isNaN(N)?N:/e/i.test(String(N))?Number(N).toFixed(18).replace(/\.?0+$/,""):N},y.getPrecision=function(N){if(E(y.props.precision))return y.props.precision;var F=String(N);if(F.indexOf("e-")>=0)return parseInt(F.slice(F.indexOf("e-")+2),10);var C=0;return F.indexOf(".")>=0&&(C=F.length-F.indexOf(".")-1),C},y.getInputDisplayValue=function(N){var F=N||y.state,C=F.focused,v=F.inputValue,j=F.value,K;C?K=v:K=y.toPrecisionAsStep(j),K==null&&(K="");var J=y.formatWrapper(K);return E(y.props.decimalSeparator)&&(J=J.toString().replace(".",y.props.decimalSeparator)),J},y.recordCursorPosition=function(){try{y.cursorStart=y.input.selectionStart,y.cursorEnd=y.input.selectionEnd,y.currentValue=y.input.value,y.cursorBefore=y.input.value.substring(0,y.cursorStart),y.cursorAfter=y.input.value.substring(y.cursorEnd)}catch(N){}},y.restoreByAfter=function(N){if(N===void 0)return!1;var F=y.input.value,C=F.lastIndexOf(N);if(C===-1)return!1;var v=y.cursorBefore.length;return y.lastKeyCode===p.a.DELETE&&y.cursorBefore.charAt(v-1)===N[0]?(y.fixCaret(v,v),!0):C+N.length===F.length?(y.fixCaret(C,C),!0):!1},y.partRestoreByAfter=function(N){return N===void 0?!1:Array.prototype.some.call(N,function(F,C){var v=N.substring(C);return y.restoreByAfter(v)})},y.isNotCompleteNumber=function(N){return isNaN(N)||N===""||N===null||N&&N.toString().indexOf(".")===N.toString().length-1},y.stop=function(){y.autoStepTimer&&clearTimeout(y.autoStepTimer)},y.down=function(N,F,C){y.pressingUpOrDown=!0,y.step("down",N,F,C)},y.up=function(N,F,C){y.pressingUpOrDown=!0,y.step("up",N,F,C)},y.saveInput=function(N){y.input=N};var k=m.value;k===void 0&&(k=m.defaultValue),y.state={focused:m.autoFocus};var I=y.getValidValue(y.toNumber(k));return y.state=d(d({},y.state),{},{inputValue:y.toPrecisionAsStep(I),value:I}),y}return Object(z.a)(b,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(y){var k=this.props,I=k.value,N=k.onChange,F=k.max,C=k.min,v=this.state.focused;if(y){if(!O(y.value,I)||!O(y.max,F)||!O(y.min,C)){var j=v?I:this.getValidValue(I),K;this.pressingUpOrDown?K=j:this.inputting?K=this.rawInput:K=this.toPrecisionAsStep(j),this.setState({value:j,inputValue:K})}var J="value"in this.props?I:this.state.value;"max"in this.props&&y.max!==F&&typeof J=="number"&&J>F&&N&&N(F),"min"in this.props&&y.min!==C&&typeof J=="number"&&J<C&&N&&N(C)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var te=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===p.a.BACKSPACE?te=this.cursorStart-1:this.lastKeyCode===p.a.DELETE&&(te=this.cursorStart):te=this.input.value.length,this.fixCaret(te,te)}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(ve){}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(y){var k=y;return k===""?k="":this.isNotCompleteNumber(parseFloat(k))?k=this.state.value:k=this.getValidValue(k),this.toNumber(k)}},{key:"getValueFromEvent",value:function(y){var k=y.target.value.trim().replace(/。/g,".");return E(this.props.decimalSeparator)&&(k=k.replace(this.props.decimalSeparator,".")),k}},{key:"getValidValue",value:function(y){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,N=parseFloat(y);return isNaN(N)?y:(N<k&&(N=k),N>I&&(N=I),N)}},{key:"setValue",value:function(y,k){var I=this.props.precision,N=this.isNotCompleteNumber(parseFloat(y))?null:parseFloat(y),F=this.state.value,C=F===void 0?null:F,v=this.state.inputValue,j=v===void 0?null:v,K=typeof N=="number"?N.toFixed(I):"".concat(N),J=N!==C||K!=="".concat(j);return"value"in this.props?(j=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:j},k)):this.setState({value:N,inputValue:this.toPrecisionAsStep(y)},k),J&&this.props.onChange(N),N}},{key:"getMaxPrecision",value:function(y){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,I=this.props,N=I.precision,F=I.step;if(E(N))return N;var C=this.getPrecision(k),v=this.getPrecision(F),j=this.getPrecision(y);return y?Math.max(j,C+v):C+v}},{key:"getPrecisionFactor",value:function(y){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,I=this.getMaxPrecision(y,k);return Math.pow(10,I)}},{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(y){return this.props.formatter?this.props.formatter(y):y}},{key:"toPrecisionAsStep",value:function(y){if(this.isNotCompleteNumber(y)||y==="")return y;var k=Math.abs(this.getMaxPrecision(y));return isNaN(k)?y.toString():Number(y).toFixed(k)}},{key:"toNumber",value:function(y){var k=this.props.precision,I=this.state.focused,N=y&&y.length>16&&I;return this.isNotCompleteNumber(y)||N?y:E(k)?Math.round(y*Math.pow(10,k))/Math.pow(10,k):Number(y)}},{key:"upStep",value:function(y,k){var I=this.props.step,N=this.getPrecisionFactor(y,k),F=Math.abs(this.getMaxPrecision(y,k)),C=((N*y+N*I*k)/N).toFixed(F);return this.toNumber(C)}},{key:"downStep",value:function(y,k){var I=this.props.step,N=this.getPrecisionFactor(y,k),F=Math.abs(this.getMaxPrecision(y,k)),C=((N*y-N*I*k)/N).toFixed(F);return this.toNumber(C)}},{key:"step",value:function(y,k){var I=this,N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,F=arguments.length>3?arguments[3]:void 0;this.stop(),k&&(k.persist(),k.preventDefault());var C=this.props;if(C.disabled)return;var v=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(v))return;var j=this["".concat(y,"Step")](v,N),K=j>C.max||j<C.min;if(j>C.max?j=C.max:j<C.min&&(j=C.min),this.setValue(j,null),this.setState({focused:!0},function(){I.pressingUpOrDown=!1}),K)return;this.autoStepTimer=setTimeout(function(){I[y](k,N,!0)},F?h:R)}},{key:"fixCaret",value:function(y,k){if(y===void 0||k===void 0||!this.input||!this.input.value)return;try{var I=this.input.selectionStart,N=this.input.selectionEnd;(y!==I||k!==N)&&this.input.setSelectionRange(y,k)}catch(F){}}},{key:"render",value:function(){var y,k=this.props,I=k.prefixCls,N=k.disabled,F=k.readOnly,C=k.useTouch,v=k.autoComplete,j=k.upHandler,K=k.downHandler,J=k.className,te=k.max,ve=k.min,ue=k.style,de=k.title,oe=k.onMouseEnter,me=k.onMouseLeave,ae=k.onMouseOver,fe=k.onMouseOut,Q=k.required,ie=k.onClick,ee=k.tabIndex,Te=k.type,Se=k.placeholder,be=k.id,ye=k.inputMode,xe=k.pattern,De=k.step,Ie=k.maxLength,Ae=k.autoFocus,Le=k.name,Ue=k.onPaste,He=k.onInput,We=Object(re.a)(k,["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"]),Fe=this.state,Je=Fe.value,Ve=Fe.focused,$e=g()(I,(y={},Object(V.a)(y,J,!!J),Object(V.a)(y,"".concat(I,"-disabled"),N),Object(V.a)(y,"".concat(I,"-focused"),Ve),y)),Ce={};Object.keys(We).forEach(function(le){(le.substr(0,5)==="data-"||le.substr(0,5)==="aria-"||le==="role")&&(Ce[le]=We[le])});var qe=!F&&!N,ze=this.getInputDisplayValue(null),Oe=(Je||Je===0)&&(isNaN(Je)||Number(Je)>=te),Me=(Je||Je===0)&&(isNaN(Je)||Number(Je)<=ve),_e=Oe||N||F,he=Me||N||F,ge=g()("".concat(I,"-handler"),"".concat(I,"-handler-up"),Object(V.a)({},"".concat(I,"-handler-up-disabled"),_e)),Y=g()("".concat(I,"-handler"),"".concat(I,"-handler-down"),Object(V.a)({},"".concat(I,"-handler-down-disabled"),he)),Z=C?{onTouchStart:_e?o:this.up,onTouchEnd:this.stop}:{onMouseDown:_e?o:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ne=C?{onTouchStart:he?o:this.down,onTouchEnd:this.stop}:{onMouseDown:he?o:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return P.a.createElement("div",{className:$e,style:ue,title:de,onMouseEnter:oe,onMouseLeave:me,onMouseOver:ae,onMouseOut:fe,onFocus:function(){return null},onBlur:function(){return null}},P.a.createElement("div",{className:"".concat(I,"-handler-wrap")},P.a.createElement("span",Object.assign({unselectable:"on"},Z,{role:"button","aria-label":"Increase Value","aria-disabled":_e,className:ge}),j||P.a.createElement("span",{unselectable:"on",className:"".concat(I,"-handler-up-inner"),onClick:i})),P.a.createElement("span",Object.assign({unselectable:"on"},ne,{role:"button","aria-label":"Decrease Value","aria-disabled":he,className:Y}),K||P.a.createElement("span",{unselectable:"on",className:"".concat(I,"-handler-down-inner"),onClick:i}))),P.a.createElement("div",{className:"".concat(I,"-input-wrap")},P.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":ve,"aria-valuemax":te,"aria-valuenow":Je,required:Q,type:Te,placeholder:Se,onPaste:Ue,onClick:ie,onMouseUp:this.onMouseUp,className:"".concat(I,"-input"),tabIndex:ee,autoComplete:v,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:qe?this.onKeyDown:o,onKeyUp:qe?this.onKeyUp:o,autoFocus:Ae,maxLength:Ie,readOnly:F,disabled:N,max:te,min:ve,step:De,name:Le,title:de,id:be,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(ze),pattern:xe,inputMode:ye,onInput:He},Ce))))}}]),b}(P.a.Component);x.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:S,min:-S,step:1,style:{},onChange:o,onKeyDown:o,onPressEnter:o,onFocus:o,onBlur:o,parser:u,required:!1,autoComplete:"off"};var w=x,T=je.a=w},gMzb:function(tt,je,q){"use strict";var re=q("k1fw"),V=q("oBTY"),D=q("9og8"),z=q("tJVT"),U=q("sRBo"),M=q("kaz8"),W=q("WmNS"),B=q.n(W),P=q("cDcd"),A=q.n(P),g=q("9kvl"),p=q("wlus"),f=q("w5pM"),d=q("ErOA"),s=q("OaEy"),c=q("2fM7"),o=q("y8nQ"),i=q("Vl3Y"),u=q("Ty5D"),h=q("yQHh"),R=q.n(h),S=M.a.Group,E=function(l){var b,m,y,k,I,N,F,C,v=l.classroomList,j=l.loading,K=l.user,J=l.exercise_id,te=J===void 0?null:J,ve=l.homework_common_id,ue=ve===void 0?null:ve,de=l.setitem,oe=l.item,me=l.type,ae=l.rz,fe=l.dispatch,Q=Object(P.useState)([]),ie=Object(z.a)(Q,2),ee=ie[0],Te=ie[1],Se=Object(P.useState)({zydatas:[],jbdatas:[],kcdatas:[],zsdatas:[],page:1,per_page:20}),be=Object(z.a)(Se,2),ye=be[0],xe=be[1],De=Object(u.i)(),Ie=Object(P.useState)(!1),Ae=Object(z.a)(Ie,2),Le=Ae[0],Ue=Ae[1],He=Object(P.useState)(!1),We=Object(z.a)(He,2),Fe=We[0],Je=We[1],Ve=i.a.useForm(),$e=Object(z.a)(Ve,1),Ce=$e[0];Object(P.useEffect)(function(){ae&&(ye.zydatas=ae,xe(Object(re.a)({},ye)),oe!=null&&oe.ec_course_id&&qe())},[oe,ae]);function qe(){return ze.apply(this,arguments)}function ze(){return ze=Object(D.a)(B.a.mark(function Y(){return B.a.wrap(function(ne){for(;;)switch(ne.prev=ne.next){case 0:return console.log("----",oe),ne.next=3,Oe(oe==null?void 0:oe.ec_major_school_id);case 3:return ne.next=5,_e(oe==null?void 0:oe.ec_year_id);case 5:return ne.next=7,ge(oe==null?void 0:oe.ec_course_id);case 7:Ce.setFieldsValue({ec_course_id:oe==null?void 0:oe.ec_course_id,ec_major_school_id:oe==null?void 0:oe.ec_major_school_id,ec_point_ids:oe==null?void 0:oe.ec_point_ids,ec_year_id:oe==null?void 0:oe.ec_year_id});case 8:case"end":return ne.stop()}},Y)})),ze.apply(this,arguments)}function Oe(Y){return Me.apply(this,arguments)}function Me(){return Me=Object(D.a)(B.a.mark(function Y(Z){var ne;return B.a.wrap(function(pe){for(;;)switch(pe.prev=pe.next){case 0:return pe.next=2,Object(d.a)("/api/ec_major_schools/".concat(Z,"/ec_years/get_year_list.json"),{method:"get"});case 2:ne=pe.sent,ye.jbdatas=ne==null?void 0:ne.data,xe(Object(re.a)({},ye)),Ce.setFieldsValue({ec_year_id:"",ec_course_id:"",ec_point_ids:[]});case 6:case"end":return pe.stop()}},Y)})),Me.apply(this,arguments)}function _e(Y){return he.apply(this,arguments)}function he(){return he=Object(D.a)(B.a.mark(function Y(Z){var ne;return B.a.wrap(function(pe){for(;;)switch(pe.prev=pe.next){case 0:return pe.next=2,Object(d.a)("/api/ec_years/".concat(Z,"/ec_courses/get_courses.json"),{method:"get"});case 2:ne=pe.sent,ye.kcdatas=ne==null?void 0:ne.data,xe(Object(re.a)({},ye)),Ce.setFieldsValue({ec_course_id:"",ec_point_ids:[]});case 6:case"end":return pe.stop()}},Y)})),he.apply(this,arguments)}var ge=function(){var Y=Object(D.a)(B.a.mark(function Z(ne){var le;return B.a.wrap(function(Re){for(;;)switch(Re.prev=Re.next){case 0:return Re.next=2,Object(d.a)("/api/ec_courses/".concat(ne,"/ec_points.json"),{method:"get",params:{ec_course_id:ne}});case 2:le=Re.sent,ye.zsdatas=le==null?void 0:le.data,xe(Object(re.a)({},ye));case 5:case"end":return Re.stop()}},Z)}));return function(ne){return Y.apply(this,arguments)}}();return A.a.createElement("div",{className:R.a.from},A.a.createElement(i.a,{form:Ce,layout:"inline",onValuesChange:function(Z){console.log("----",Z),Z.ec_major_school_id&&(ye.jbdatas=[],ye.kcdatas=[],ye.zsdatas=[],xe(Object(re.a)({},ye)),Oe(Z.ec_major_school_id)),Z.ec_year_id&&(ye.kcdatas=[],ye.zsdatas=[],xe(Object(re.a)({},ye)),_e(Z.ec_year_id)),Z.ec_course_id&&(ye.zsdatas=[],xe(Object(re.a)({},ye)),ge(Z.ec_course_id))},onFinish:function(){var Y=Object(D.a)(B.a.mark(function Z(ne){return B.a.wrap(function(pe){for(;;)switch(pe.prev=pe.next){case 0:de(ne);case 1:case"end":return pe.stop()}},Z)}));return function(Z){return Y.apply(this,arguments)}}()},A.a.createElement(i.a.Item,{label:"\u8BA4\u8BC1\u4E13\u4E1A",name:"ec_major_school_id"},A.a.createElement(c.a,{style:{width:150},disabled:((b=ye.zydatas)===null||b===void 0?void 0:b.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BA4\u8BC1\u4E13\u4E1A"},ye==null||((m=ye.zydatas)===null||m===void 0)?void 0:m.map(function(Y,Z){return A.a.createElement(c.a.Option,{key:Z,value:Y==null?void 0:Y.ec_major_school_id},Y==null?void 0:Y.name)}))),A.a.createElement(i.a.Item,{label:"\u8BA4\u8BC1\u5C4A\u522B",name:"ec_year_id"},A.a.createElement(c.a,{style:{width:150},disabled:((y=ye.jbdatas)===null||y===void 0?void 0:y.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BA4\u8BC1\u5C4A\u522B"},ye==null||((k=ye.jbdatas)===null||k===void 0)?void 0:k.map(function(Y,Z){return A.a.createElement(c.a.Option,{key:Z,value:Y==null?void 0:Y.ec_year_id},Y==null?void 0:Y.year)}))),A.a.createElement(i.a.Item,{label:"\u8BFE\u7A0B",name:"ec_course_id"},A.a.createElement(c.a,{style:{width:150},disabled:((I=ye.kcdatas)===null||I===void 0?void 0:I.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BFE\u7A0B"},ye==null||((N=ye.kcdatas)===null||N===void 0)?void 0:N.map(function(Y,Z){return A.a.createElement(c.a.Option,{key:Z,value:Y==null?void 0:Y.id},Y==null?void 0:Y.name)}))),A.a.createElement(i.a.Item,{label:"\u77E5\u8BC6\u70B9",name:"ec_point_ids"},A.a.createElement(c.a,{onChange:function(){Ce.submit()},style:{width:150},mode:"multiple",disabled:((F=ye.zsdatas)===null||F===void 0?void 0:F.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u77E5\u8BC6\u70B9"},ye==null||((C=ye.zsdatas)===null||C===void 0)?void 0:C.map(function(Y,Z){return A.a.createElement(c.a.Option,{key:Z,value:Y==null?void 0:Y.id},Y==null?void 0:Y.name)})))))},O=Object(g.a)(function(_){var l=_.classroomList,b=_.loading,m=_.globalSetting,y=_.user;return{classroomList:l,globalSetting:m,loading:b.effects,user:y}})(E),x=M.a.Group,w=function(l){var b,m,y,k=l.classroomList,I=l.loading,N=l.user,F=l.exercise_id,C=F===void 0?null:F,v=l.homework_common_id,j=v===void 0?null:v,K=l.setitem,J=l.type,te=l.dispatch,ve=Object(P.useState)([{}]),ue=Object(z.a)(ve,2),de=ue[0],oe=ue[1],me=Object(P.useState)([]),ae=Object(z.a)(me,2),fe=ae[0],Q=ae[1];function ie(){return ee.apply(this,arguments)}function ee(){return ee=Object(D.a)(B.a.mark(function be(){var ye,xe,De,Ie,Ae;return B.a.wrap(function(Ue){for(;;)switch(Ue.prev=Ue.next){case 0:return Ue.next=2,Object(d.a)("/api/ec_courses/".concat(0,"/ec_points/get_work_points.json"),{method:"get",params:{exercise_id:C,homework_common_id:j}});case 2:xe=Ue.sent,(xe==null||((ye=xe.data)===null||ye===void 0)?void 0:ye.length)>0&&(Ae=[],xe==null||((De=xe.data)===null||De===void 0)||De.map(function(He){var We;He==null||((We=He.ec_point_ids)===null||We===void 0)||We.map(function(Fe){Ae.push(Fe)})}),K(Object(re.a)(Object(re.a)({},xe==null||((Ie=xe.data)===null||Ie===void 0)?void 0:Ie[0]),{},{ec_point_ids:Ae})),oe(xe==null?void 0:xe.data));case 4:case"end":return Ue.stop()}},be)})),ee.apply(this,arguments)}Object(P.useEffect)(function(){var be,ye;N!=null&&(be=N.userInfo)!==null&&be!==void 0&&(ye=be.course)!==null&&ye!==void 0&&ye.course_school_id&&Te()},[N==null||((b=N.userInfo)===null||b===void 0||((m=b.course)===null||m===void 0))?void 0:m.course_school_id]);function Te(){return Se.apply(this,arguments)}function Se(){return Se=Object(D.a)(B.a.mark(function be(){var ye,xe,De;return B.a.wrap(function(Ae){for(;;)switch(Ae.prev=Ae.next){case 0:return Ae.next=2,Object(d.a)("/api/schools/".concat(N==null||((ye=N.userInfo)===null||ye===void 0||((xe=ye.course)===null||xe===void 0))?void 0:xe.course_school_id,"/ec_majors/get_major_list.json"),{method:"get"});case 2:De=Ae.sent,Q(De==null?void 0:De.data),(j||C)&&ie();case 5:case"end":return Ae.stop()}},be)})),Se.apply(this,arguments)}return console.log(de),A.a.createElement("div",{style:{display:(y=N.userInfo.course)!==null&&y!==void 0&&y.is_openengineering?"":"none"}},A.a.createElement("p",{style:{fontSize:"16px",fontWeight:400}},"\u5DE5\u7A0B\u8BA4\u8BC1\u8003\u6838\u77E5\u8BC6\u70B9"),de==null?void 0:de.map(function(be,ye){return A.a.createElement("div",{style:{display:"flex",alignItems:"center",marginBottom:"10px"}},A.a.createElement(O,{rz:fe,item:be,type:ye,setitem:function(De){de.splice(ye,1,De),oe(Object(V.a)(de));var Ie=[];de==null||de.map(function(Ae){var Le;Ae==null||((Le=Ae.ec_point_ids)===null||Le===void 0)||Le.map(function(Ue){Ie.push(Ue)})}),K(Object(re.a)(Object(re.a)({},De),{},{ec_point_ids:Ie}))}}),ye!=0&&A.a.createElement(p.a,{onClick:function(){de.splice(ye,1),oe(Object(V.a)(de))},style:{marginLeft:10,fontSize:"20px"}}),A.a.createElement(f.a,{onClick:function(){de.push({}),oe(Object(V.a)(de))},style:{marginLeft:10,fontSize:"20px"}}))}))},T=je.a=Object(g.a)(function(_){var l=_.classroomList,b=_.loading,m=_.globalSetting,y=_.user;return{classroomList:l,globalSetting:m,loading:b.effects,user:y}})(w)},h78n:function(tt,je,q){"use strict";q.d(je,"a",function(){return y});var re=q("cDcd"),V=q.n(re),D=q("TSYQ"),z=q.n(D),U={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},M=function(N){var F=N.map(function(){return Object(re.useRef)()}),C=Object(re.useRef)();return Object(re.useEffect)(function(){var v=Date.now(),j=!1;Object.keys(F).forEach(function(K){var J=F[K].current;if(!J)return;j=!0;var te=J.style;te.transitionDuration=".3s, .3s, .3s, .06s",C.current&&v-C.current<100&&(te.transitionDuration="0s, 0s")}),j&&(C.current=Date.now())}),[F]};function W(){return W=Object.assign||function(I){for(var N=1;N<arguments.length;N++){var F=arguments[N];for(var C in F)Object.prototype.hasOwnProperty.call(F,C)&&(I[C]=F[C])}return I},W.apply(this,arguments)}function B(I,N){return f(I)||p(I,N)||A(I,N)||P()}function P(){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 A(I,N){if(!I)return;if(typeof I=="string")return g(I,N);var F=Object.prototype.toString.call(I).slice(8,-1);if(F==="Object"&&I.constructor&&(F=I.constructor.name),F==="Map"||F==="Set")return Array.from(I);if(F==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(F))return g(I,N)}function g(I,N){(N==null||N>I.length)&&(N=I.length);for(var F=0,C=new Array(N);F<N;F++)C[F]=I[F];return C}function p(I,N){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(I)))return;var F=[],C=!0,v=!1,j=void 0;try{for(var K=I[Symbol.iterator](),J;!(C=(J=K.next()).done)&&!(F.push(J.value),N&&F.length===N);C=!0);}catch(te){v=!0,j=te}finally{try{!C&&K.return!=null&&K.return()}finally{if(v)throw j}}return F}function f(I){if(Array.isArray(I))return I}function d(I,N){if(I==null)return{};var F=s(I,N),C,v;if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(I);for(v=0;v<j.length;v++){if(C=j[v],N.indexOf(C)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(I,C))continue;F[C]=I[C]}}return F}function s(I,N){if(I==null)return{};var F={},C=Object.keys(I),v,j;for(j=0;j<C.length;j++){if(v=C[j],N.indexOf(v)>=0)continue;F[v]=I[v]}return F}var c=function(N){var F=N.className,C=N.percent,v=N.prefixCls,j=N.strokeColor,K=N.strokeLinecap,J=N.strokeWidth,te=N.style,ve=N.trailColor,ue=N.trailWidth,de=N.transition,oe=d(N,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete oe.gapPosition;var me=Array.isArray(C)?C:[C],ae=Array.isArray(j)?j:[j],fe=M(me),Q=B(fe,1),ie=Q[0],ee=J/2,Te=100-J/2,Se="M ".concat(K==="round"?ee:0,",").concat(ee,`
|
|
L `).concat(K==="round"?Te:100,",").concat(ee),be="0 0 100 ".concat(J),ye=0;return V.a.createElement("svg",W({className:z()("".concat(v,"-line"),F),viewBox:be,preserveAspectRatio:"none",style:te},oe),V.a.createElement("path",{className:"".concat(v,"-line-trail"),d:Se,strokeLinecap:K,stroke:ve,strokeWidth:ue||J,fillOpacity:"0"}),me.map(function(xe,De){var Ie={strokeDasharray:"".concat(xe,"px, 100px"),strokeDashoffset:"-".concat(ye,"px"),transition:de||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Ae=ae[De]||ae[ae.length-1];return ye+=xe,V.a.createElement("path",{key:De,className:"".concat(v,"-line-path"),d:Se,strokeLinecap:K,stroke:Ae,strokeWidth:J,fillOpacity:"0",ref:ie[De],style:Ie})}))};c.defaultProps=U;var o=c;function i(){return i=Object.assign||function(I){for(var N=1;N<arguments.length;N++){var F=arguments[N];for(var C in F)Object.prototype.hasOwnProperty.call(F,C)&&(I[C]=F[C])}return I},i.apply(this,arguments)}function u(I,N){return O(I)||E(I,N)||R(I,N)||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 R(I,N){if(!I)return;if(typeof I=="string")return S(I,N);var F=Object.prototype.toString.call(I).slice(8,-1);if(F==="Object"&&I.constructor&&(F=I.constructor.name),F==="Map"||F==="Set")return Array.from(I);if(F==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(F))return S(I,N)}function S(I,N){(N==null||N>I.length)&&(N=I.length);for(var F=0,C=new Array(N);F<N;F++)C[F]=I[F];return C}function E(I,N){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(I)))return;var F=[],C=!0,v=!1,j=void 0;try{for(var K=I[Symbol.iterator](),J;!(C=(J=K.next()).done)&&!(F.push(J.value),N&&F.length===N);C=!0);}catch(te){v=!0,j=te}finally{try{!C&&K.return!=null&&K.return()}finally{if(v)throw j}}return F}function O(I){if(Array.isArray(I))return I}function x(I,N){if(I==null)return{};var F=w(I,N),C,v;if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(I);for(v=0;v<j.length;v++){if(C=j[v],N.indexOf(C)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(I,C))continue;F[C]=I[C]}}return F}function w(I,N){if(I==null)return{};var F={},C=Object.keys(I),v,j;for(j=0;j<C.length;j++){if(v=C[j],N.indexOf(v)>=0)continue;F[v]=I[v]}return F}var T=0;function _(I){return+I.replace("%","")}function l(I){return Array.isArray(I)?I:[I]}function b(I,N,F,C){var v=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,j=arguments.length>5?arguments[5]:void 0,K=50-C/2,J=0,te=-K,ve=0,ue=-2*K;switch(j){case"left":J=-K,te=0,ve=2*K,ue=0;break;case"right":J=K,te=0,ve=-2*K,ue=0;break;case"bottom":te=K,ue=2*K;break;default:}var de="M 50,50 m ".concat(J,",").concat(te,`
|
|
a `).concat(K,",").concat(K," 0 1 1 ").concat(ve,",").concat(-ue,`
|
|
a `).concat(K,",").concat(K," 0 1 1 ").concat(-ve,",").concat(ue),oe=Math.PI*2*K,me={stroke:F,strokeDasharray:"".concat(N/100*(oe-v),"px ").concat(oe,"px"),strokeDashoffset:"-".concat(v/2+I/100*(oe-v),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:de,pathStyle:me}}var m=function(N){var F=N.prefixCls,C=N.strokeWidth,v=N.trailWidth,j=N.gapDegree,K=N.gapPosition,J=N.trailColor,te=N.strokeLinecap,ve=N.style,ue=N.className,de=N.strokeColor,oe=N.percent,me=x(N,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ae=Object(re.useMemo)(function(){return T+=1,T},[]),fe=b(0,100,J,C,j,K),Q=fe.pathString,ie=fe.pathStyle,ee=l(oe),Te=l(de),Se=Te.find(function(Ie){return Object.prototype.toString.call(Ie)==="[object Object]"}),be=M(ee),ye=u(be,1),xe=ye[0],De=function(){var Ae=0;return ee.map(function(Le,Ue){var He=Te[Ue]||Te[Te.length-1],We=Object.prototype.toString.call(He)==="[object Object]"?"url(#".concat(F,"-gradient-").concat(ae,")"):"",Fe=b(Ae,Le,He,C,j,K);return Ae+=Le,V.a.createElement("path",{key:Ue,className:"".concat(F,"-circle-path"),d:Fe.pathString,stroke:We,strokeLinecap:te,strokeWidth:C,opacity:Le===0?0:1,fillOpacity:"0",style:Fe.pathStyle,ref:xe[Ue]})})};return V.a.createElement("svg",i({className:z()("".concat(F,"-circle"),ue),viewBox:"0 0 100 100",style:ve},me),Se&&V.a.createElement("defs",null,V.a.createElement("linearGradient",{id:"".concat(F,"-gradient-").concat(ae),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Se).sort(function(Ie,Ae){return _(Ie)-_(Ae)}).map(function(Ie,Ae){return V.a.createElement("stop",{key:Ae,offset:Ie,stopColor:Se[Ie]})}))),V.a.createElement("path",{className:"".concat(F,"-circle-trail"),d:Q,stroke:J,strokeLinecap:te,strokeWidth:v||C,fillOpacity:"0",style:ie}),De().reverse())};m.defaultProps=U;var y=m,k={Line:o,Circle:y}},kSUc:function(tt,je,q){},lLeG:function(tt,je,q){tt.exports={bg:"bg___f0e4_",flexRow:"flexRow___1-S6r",flexJustifyCenter:"flexJustifyCenter___3KkrV",flexAlignEnd:"flexAlignEnd___146T7",flexAlignCenter:"flexAlignCenter___2UVve",flexColumn:"flexColumn___nj9sg",formWrap:"formWrap___2eqbH",titleWrap:"titleWrap___1gkN2",fieldWrap:"fieldWrap___2l5q8",mdWrap:"mdWrap___38Ffu",backgroundFa:"backgroundFa___2gBUv",button:"button___3jgMh"}},lZu9:function(tt,je,q){(function(re){re(q("VrN/"),q("1eCo"),q("8EBN"))})(function(re){"use strict";re.defineMode("markdown",function(V,D){var z=re.getMode(V,"text/html"),U=z.name=="null";function M(C){if(re.findModeByName){var v=re.findModeByName(C);v&&(C=v.mime||v.mimes[0])}var j=re.getMode(V,C);return j.name=="null"?null:j}D.highlightFormatting===void 0&&(D.highlightFormatting=!1),D.maxBlockquoteDepth===void 0&&(D.maxBlockquoteDepth=0),D.taskLists===void 0&&(D.taskLists=!1),D.strikethrough===void 0&&(D.strikethrough=!1),D.emoji===void 0&&(D.emoji=!1),D.fencedCodeBlockHighlighting===void 0&&(D.fencedCodeBlockHighlighting=!0),D.fencedCodeBlockDefaultMode===void 0&&(D.fencedCodeBlockDefaultMode="text/plain"),D.xml===void 0&&(D.xml=!0),D.tokenTypeOverrides===void 0&&(D.tokenTypeOverrides={});var W={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var B in W)W.hasOwnProperty(B)&&D.tokenTypeOverrides[B]&&(W[B]=D.tokenTypeOverrides[B]);var P=/^([*\-_])(?:\s*\1){2,}\s*$/,A=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,g=/^\[(x| )\](?=\s)/i,p=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,f=/^ {0,3}(?:\={1,}|-{2,})\s*$/,d=/^[^#!\[\]*_\\<>` "'(~:]+/,s=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,c=/^\s*\[[^\]]+?\]:.*$/,o=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,i=" ";function u(C,v,j){return v.f=v.inline=j,j(C,v)}function h(C,v,j){return v.f=v.block=j,j(C,v)}function R(C){return!C||!/\S/.test(C.string)}function S(C){if(C.linkTitle=!1,C.linkHref=!1,C.linkText=!1,C.em=!1,C.strong=!1,C.strikethrough=!1,C.quote=0,C.indentedCode=!1,C.f==O){var v=U;if(!v){var j=re.innerMode(z,C.htmlState);v=j.mode.name=="xml"&&j.state.tagStart===null&&!j.state.context&&j.state.tokenize.isInText}v&&(C.f=_,C.block=E,C.htmlState=null)}return C.trailingSpace=0,C.trailingSpaceNewLine=!1,C.prevLine=C.thisLine,C.thisLine={stream:null},null}function E(C,v){var j=C.column()===v.indentation,K=R(v.prevLine.stream),J=v.indentedCode,te=v.prevLine.hr,ve=v.list!==!1,ue=(v.listStack[v.listStack.length-1]||0)+3;v.indentedCode=!1;var de=v.indentation;if(v.indentationDiff===null&&(v.indentationDiff=v.indentation,ve)){for(v.list=null;de<v.listStack[v.listStack.length-1];)v.listStack.pop(),v.listStack.length?v.indentation=v.listStack[v.listStack.length-1]:v.list=!1;v.list!==!1&&(v.indentationDiff=de-v.listStack[v.listStack.length-1])}var oe=!K&&!te&&!v.prevLine.header&&(!ve||!J)&&!v.prevLine.fencedCodeEnd,me=(v.list===!1||te||K)&&v.indentation<=ue&&C.match(P),ae=null;if(v.indentationDiff>=4&&(J||v.prevLine.fencedCodeEnd||v.prevLine.header||K))return C.skipToEnd(),v.indentedCode=!0,W.code;if(C.eatSpace())return null;if(j&&v.indentation<=ue&&(ae=C.match(p))&&ae[1].length<=6)return v.quote=0,v.header=ae[1].length,v.thisLine.header=!0,D.highlightFormatting&&(v.formatting="header"),v.f=v.inline,w(v);if(v.indentation<=ue&&C.eat(">"))return v.quote=j?1:v.quote+1,D.highlightFormatting&&(v.formatting="quote"),C.eatSpace(),w(v);if(!me&&!v.setext&&j&&v.indentation<=ue&&(ae=C.match(A))){var fe=ae[1]?"ol":"ul";return v.indentation=de+C.current().length,v.list=!0,v.quote=0,v.listStack.push(v.indentation),v.em=!1,v.strong=!1,v.code=!1,v.strikethrough=!1,D.taskLists&&C.match(g,!1)&&(v.taskList=!0),v.f=v.inline,D.highlightFormatting&&(v.formatting=["list","list-"+fe]),w(v)}else{if(j&&v.indentation<=ue&&(ae=C.match(s,!0)))return v.quote=0,v.fencedEndRE=new RegExp(ae[1]+"+ *$"),v.localMode=D.fencedCodeBlockHighlighting&&M(ae[2]||D.fencedCodeBlockDefaultMode),v.localMode&&(v.localState=re.startState(v.localMode)),v.f=v.block=x,D.highlightFormatting&&(v.formatting="code-block"),v.code=-1,w(v);if(v.setext||(!oe||!ve)&&!v.quote&&v.list===!1&&!v.code&&!me&&!c.test(C.string)&&(ae=C.lookAhead(1))&&(ae=ae.match(f)))return v.setext?(v.header=v.setext,v.setext=0,C.skipToEnd(),D.highlightFormatting&&(v.formatting="header")):(v.header=ae[0].charAt(0)=="="?1:2,v.setext=v.header),v.thisLine.header=!0,v.f=v.inline,w(v);if(me)return C.skipToEnd(),v.hr=!0,v.thisLine.hr=!0,W.hr;if(C.peek()==="[")return u(C,v,k)}return u(C,v,v.inline)}function O(C,v){var j=z.token(C,v.htmlState);if(!U){var K=re.innerMode(z,v.htmlState);(K.mode.name=="xml"&&K.state.tagStart===null&&!K.state.context&&K.state.tokenize.isInText||v.md_inside&&C.current().indexOf(">")>-1)&&(v.f=_,v.block=E,v.htmlState=null)}return j}function x(C,v){var j=v.listStack[v.listStack.length-1]||0,K=v.indentation<j,J=j+3;if(v.fencedEndRE&&v.indentation<=J&&(K||C.match(v.fencedEndRE))){D.highlightFormatting&&(v.formatting="code-block");var te;return K||(te=w(v)),v.localMode=v.localState=null,v.block=E,v.f=_,v.fencedEndRE=null,v.code=0,v.thisLine.fencedCodeEnd=!0,K?h(C,v,v.block):te}else return v.localMode?v.localMode.token(C,v.localState):(C.skipToEnd(),W.code)}function w(C){var v=[];if(C.formatting){v.push(W.formatting),typeof C.formatting=="string"&&(C.formatting=[C.formatting]);for(var j=0;j<C.formatting.length;j++)v.push(W.formatting+"-"+C.formatting[j]),C.formatting[j]==="header"&&v.push(W.formatting+"-"+C.formatting[j]+"-"+C.header),C.formatting[j]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=C.quote?v.push(W.formatting+"-"+C.formatting[j]+"-"+C.quote):v.push("error"))}if(C.taskOpen)return v.push("meta"),v.length?v.join(" "):null;if(C.taskClosed)return v.push("property"),v.length?v.join(" "):null;if(C.linkHref?v.push(W.linkHref,"url"):(C.strong&&v.push(W.strong),C.em&&v.push(W.em),C.strikethrough&&v.push(W.strikethrough),C.emoji&&v.push(W.emoji),C.linkText&&v.push(W.linkText),C.code&&v.push(W.code),C.image&&v.push(W.image),C.imageAltText&&v.push(W.imageAltText,"link"),C.imageMarker&&v.push(W.imageMarker)),C.header&&v.push(W.header,W.header+"-"+C.header),C.quote&&(v.push(W.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=C.quote?v.push(W.quote+"-"+C.quote):v.push(W.quote+"-"+D.maxBlockquoteDepth)),C.list!==!1){var K=(C.listStack.length-1)%3;K?K===1?v.push(W.list2):v.push(W.list3):v.push(W.list1)}return C.trailingSpaceNewLine?v.push("trailing-space-new-line"):C.trailingSpace&&v.push("trailing-space-"+(C.trailingSpace%2?"a":"b")),v.length?v.join(" "):null}function T(C,v){return C.match(d,!0)?w(v):void 0}function _(C,v){var j=v.text(C,v);if(typeof j!="undefined")return j;if(v.list)return v.list=null,w(v);if(v.taskList){var K=C.match(g,!0)[1]===" ";return K?v.taskOpen=!0:v.taskClosed=!0,D.highlightFormatting&&(v.formatting="task"),v.taskList=!1,w(v)}if(v.taskOpen=!1,v.taskClosed=!1,v.header&&C.match(/^#+$/,!0))return D.highlightFormatting&&(v.formatting="header"),w(v);var J=C.next();if(v.linkTitle){v.linkTitle=!1;var te=J;J==="("&&(te=")"),te=(te+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var ve="^\\s*(?:[^"+te+"\\\\]+|\\\\\\\\|\\\\.)"+te;if(C.match(new RegExp(ve),!0))return W.linkHref}if(J==="`"){var ue=v.formatting;D.highlightFormatting&&(v.formatting="code"),C.eatWhile("`");var de=C.current().length;if(v.code==0&&(!v.quote||de==1))return v.code=de,w(v);if(de==v.code){var oe=w(v);return v.code=0,oe}else return v.formatting=ue,w(v)}else if(v.code)return w(v);if(J==="\\"&&(C.next(),D.highlightFormatting)){var me=w(v),ae=W.formatting+"-escape";return me?me+" "+ae:ae}if(J==="!"&&C.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return v.imageMarker=!0,v.image=!0,D.highlightFormatting&&(v.formatting="image"),w(v);if(J==="["&&v.imageMarker&&C.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return v.imageMarker=!1,v.imageAltText=!0,D.highlightFormatting&&(v.formatting="image"),w(v);if(J==="]"&&v.imageAltText){D.highlightFormatting&&(v.formatting="image");var me=w(v);return v.imageAltText=!1,v.image=!1,v.inline=v.f=b,me}if(J==="["&&!v.image)return v.linkText&&C.match(/^.*?\]/)||(v.linkText=!0,D.highlightFormatting&&(v.formatting="link")),w(v);if(J==="]"&&v.linkText){D.highlightFormatting&&(v.formatting="link");var me=w(v);return v.linkText=!1,v.inline=v.f=C.match(/\(.*?\)| ?\[.*?\]/,!1)?b:_,me}if(J==="<"&&C.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){v.f=v.inline=l,D.highlightFormatting&&(v.formatting="link");var me=w(v);return me?me+=" ":me="",me+W.linkInline}if(J==="<"&&C.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){v.f=v.inline=l,D.highlightFormatting&&(v.formatting="link");var me=w(v);return me?me+=" ":me="",me+W.linkEmail}if(D.xml&&J==="<"&&C.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var fe=C.string.indexOf(">",C.pos);if(fe!=-1){var Q=C.string.substring(C.start,fe);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Q)&&(v.md_inside=!0)}return C.backUp(1),v.htmlState=re.startState(z),h(C,v,O)}if(D.xml&&J==="<"&&C.match(/^\/\w*?>/))return v.md_inside=!1,"tag";if(J==="*"||J==="_"){for(var ie=1,ee=C.pos==1?" ":C.string.charAt(C.pos-2);ie<3&&C.eat(J);)ie++;var Te=C.peek()||" ",Se=!/\s/.test(Te)&&(!o.test(Te)||/\s/.test(ee)||o.test(ee)),be=!/\s/.test(ee)&&(!o.test(ee)||/\s/.test(Te)||o.test(Te)),ye=null,xe=null;if(ie%2&&(!v.em&&Se&&(J==="*"||!be||o.test(ee))?ye=!0:v.em==J&&be&&(J==="*"||!Se||o.test(Te))&&(ye=!1)),ie>1&&(!v.strong&&Se&&(J==="*"||!be||o.test(ee))?xe=!0:v.strong==J&&be&&(J==="*"||!Se||o.test(Te))&&(xe=!1)),xe!=null||ye!=null){D.highlightFormatting&&(v.formatting=ye==null?"strong":xe==null?"em":"strong em"),ye===!0&&(v.em=J),xe===!0&&(v.strong=J);var oe=w(v);return ye===!1&&(v.em=!1),xe===!1&&(v.strong=!1),oe}}else if(J===" "&&(C.eat("*")||C.eat("_"))){if(C.peek()===" ")return w(v);C.backUp(1)}if(D.strikethrough){if(J==="~"&&C.eatWhile(J)){if(v.strikethrough){D.highlightFormatting&&(v.formatting="strikethrough");var oe=w(v);return v.strikethrough=!1,oe}else if(C.match(/^[^\s]/,!1))return v.strikethrough=!0,D.highlightFormatting&&(v.formatting="strikethrough"),w(v)}else if(J===" "&&C.match(/^~~/,!0)){if(C.peek()===" ")return w(v);C.backUp(2)}}if(D.emoji&&J===":"&&C.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){v.emoji=!0,D.highlightFormatting&&(v.formatting="emoji");var De=w(v);return v.emoji=!1,De}return J===" "&&(C.match(/^ +$/,!1)?v.trailingSpace++:v.trailingSpace&&(v.trailingSpaceNewLine=!0)),w(v)}function l(C,v){var j=C.next();if(j===">"){v.f=v.inline=_,D.highlightFormatting&&(v.formatting="link");var K=w(v);return K?K+=" ":K="",K+W.linkInline}return C.match(/^[^>]+/,!0),W.linkInline}function b(C,v){if(C.eatSpace())return null;var j=C.next();return j==="("||j==="["?(v.f=v.inline=y(j==="("?")":"]"),D.highlightFormatting&&(v.formatting="link-string"),v.linkHref=!0,w(v)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function y(C){return function(v,j){var K=v.next();if(K===C){j.f=j.inline=_,D.highlightFormatting&&(j.formatting="link-string");var J=w(j);return j.linkHref=!1,J}return v.match(m[C]),j.linkHref=!0,w(j)}}function k(C,v){return C.match(/^([^\]\\]|\\.)*\]:/,!1)?(v.f=I,C.next(),D.highlightFormatting&&(v.formatting="link"),v.linkText=!0,w(v)):u(C,v,_)}function I(C,v){if(C.match(/^\]:/,!0)){v.f=v.inline=N,D.highlightFormatting&&(v.formatting="link");var j=w(v);return v.linkText=!1,j}return C.match(/^([^\]\\]|\\.)+/,!0),W.linkText}function N(C,v){return C.eatSpace()?null:(C.match(/^[^\s]+/,!0),C.peek()===void 0?v.linkTitle=!0:C.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),v.f=v.inline=_,W.linkHref+" url")}var F={startState:function(){return{f:E,prevLine:{stream:null},thisLine:{stream:null},block:E,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(C){return{f:C.f,prevLine:C.prevLine,thisLine:C.thisLine,block:C.block,htmlState:C.htmlState&&re.copyState(z,C.htmlState),indentation:C.indentation,localMode:C.localMode,localState:C.localMode?re.copyState(C.localMode,C.localState):null,inline:C.inline,text:C.text,formatting:!1,linkText:C.linkText,linkTitle:C.linkTitle,linkHref:C.linkHref,code:C.code,em:C.em,strong:C.strong,strikethrough:C.strikethrough,emoji:C.emoji,header:C.header,setext:C.setext,hr:C.hr,taskList:C.taskList,list:C.list,listStack:C.listStack.slice(0),quote:C.quote,indentedCode:C.indentedCode,trailingSpace:C.trailingSpace,trailingSpaceNewLine:C.trailingSpaceNewLine,md_inside:C.md_inside,fencedEndRE:C.fencedEndRE}},token:function(C,v){if(v.formatting=!1,C!=v.thisLine.stream){if(v.header=0,v.hr=!1,C.match(/^\s*$/,!0))return S(v),null;if(v.prevLine=v.thisLine,v.thisLine={stream:C},v.taskList=!1,v.trailingSpace=0,v.trailingSpaceNewLine=!1,!v.localState&&(v.f=v.block,v.f!=O)){var j=C.match(/^\s*/,!0)[0].replace(/\t/g,i).length;if(v.indentation=j,v.indentationDiff=null,j>0)return null}}return v.f(C,v)},innerMode:function(C){return C.block==O?{state:C.htmlState,mode:z}:C.localState?{state:C.localState,mode:C.localMode}:{state:C,mode:F}},indent:function(C,v,j){return C.block==O&&z.indent?z.indent(C.htmlState,v,j):C.localState&&C.localMode.indent?C.localMode.indent(C.localState,v,j):re.Pass},blankLine:S,getType:w,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return F},"xml"),re.defineMIME("text/markdown","markdown"),re.defineMIME("text/x-markdown","markdown")})},osHv:function(tt,je,q){(function(re){re(q("VrN/"))})(function(re){"use strict";var V=re.Pos;function D(o,i){return o.line-i.line||o.ch-i.ch}var z="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",U=z+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",M=new RegExp("<(/?)(["+z+"]["+U+"]*)","g");function W(o,i,u,h){this.line=i,this.ch=u,this.cm=o,this.text=o.getLine(i),this.min=h?Math.max(h.from,o.firstLine()):o.firstLine(),this.max=h?Math.min(h.to-1,o.lastLine()):o.lastLine()}function B(o,i){var u=o.cm.getTokenTypeAt(V(o.line,i));return u&&/\btag\b/.test(u)}function P(o){return o.line>=o.max?void 0:(o.ch=0,o.text=o.cm.getLine(++o.line),!0)}function A(o){return o.line<=o.min?void 0:(o.text=o.cm.getLine(--o.line),o.ch=o.text.length,!0)}function g(o){for(;;){var i=o.text.indexOf(">",o.ch);if(i==-1){if(P(o))continue;return}if(!B(o,i+1)){o.ch=i+1;continue}var u=o.text.lastIndexOf("/",i),h=u>-1&&!/\S/.test(o.text.slice(u+1,i));return o.ch=i+1,h?"selfClose":"regular"}}function p(o){for(;;){var i=o.ch?o.text.lastIndexOf("<",o.ch-1):-1;if(i==-1){if(A(o))continue;return}if(!B(o,i+1)){o.ch=i;continue}M.lastIndex=i,o.ch=i;var u=M.exec(o.text);if(u&&u.index==i)return u}}function f(o){for(;;){M.lastIndex=o.ch;var i=M.exec(o.text);if(!i){if(P(o))continue;return}if(!B(o,i.index+1)){o.ch=i.index+1;continue}return o.ch=i.index+i[0].length,i}}function d(o){for(;;){var i=o.ch?o.text.lastIndexOf(">",o.ch-1):-1;if(i==-1){if(A(o))continue;return}if(!B(o,i+1)){o.ch=i;continue}var u=o.text.lastIndexOf("/",i),h=u>-1&&!/\S/.test(o.text.slice(u+1,i));return o.ch=i+1,h?"selfClose":"regular"}}function s(o,i){for(var u=[];;){var h=f(o),R,S=o.line,E=o.ch-(h?h[0].length:0);if(!h||!(R=g(o)))return;if(R=="selfClose")continue;if(h[1]){for(var O=u.length-1;O>=0;--O)if(u[O]==h[2]){u.length=O;break}if(O<0&&(!i||i==h[2]))return{tag:h[2],from:V(S,E),to:V(o.line,o.ch)}}else u.push(h[2])}}function c(o,i){for(var u=[];;){var h=d(o);if(!h)return;if(h=="selfClose"){p(o);continue}var R=o.line,S=o.ch,E=p(o);if(!E)return;if(E[1])u.push(E[2]);else{for(var O=u.length-1;O>=0;--O)if(u[O]==E[2]){u.length=O;break}if(O<0&&(!i||i==E[2]))return{tag:E[2],from:V(o.line,o.ch),to:V(R,S)}}}}re.registerHelper("fold","xml",function(o,i){for(var u=new W(o,i.line,0);;){var h=f(u);if(!h||u.line!=i.line)return;var R=g(u);if(!R)return;if(!h[1]&&R!="selfClose"){var S=V(u.line,u.ch),E=s(u,h[2]);return E&&D(E.from,S)>0?{from:S,to:E.from}:null}}}),re.findMatchingTag=function(o,i,u){var h=new W(o,i.line,i.ch,u);if(h.text.indexOf(">")==-1&&h.text.indexOf("<")==-1)return;var R=g(h),S=R&&V(h.line,h.ch),E=R&&p(h);if(!R||!E||D(h,i)>0)return;var O={from:V(h.line,h.ch),to:S,tag:E[2]};return R=="selfClose"?{open:O,close:null,at:"open"}:E[1]?{open:c(h,E[2]),close:O,at:"close"}:(h=new W(o,S.line,S.ch,u),{open:O,close:s(h,E[2]),at:"open"})},re.findEnclosingTag=function(o,i,u,h){for(var R=new W(o,i.line,i.ch,u);;){var S=c(R,h);if(!S)break;var E=new W(o,i.line,i.ch,u),O=s(E,S.tag);if(O)return{open:S,close:O}}},re.scanForClosingTag=function(o,i,u,h){var R=new W(o,i.line,i.ch,h?{from:0,to:h}:null);return s(R,u)}})},p5ED:function(tt,je,q){"use strict";var re=q("+L6B"),V=q("2/Rp"),D=q("5Dmo"),z=q("3S7+"),U=q("k1fw"),M=q("tJVT"),W=q("cDcd"),B=q.n(W),P=q("vHTk"),A=q.n(P),g=q("yEEn"),p=q("ZW9T"),f=q("1vsH");je.a=function(d){var s=d.name,c=d.data,o=d.theme,i=d.type,u=d.filename,h=d.monacoEditor,R=d.className,S=d.style,E=d.close,O=d.onClose,x=d.hasMask,w=Object(W.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),T=Object(M.a)(w,2),_=T[0],l=T[1],b=Object(W.useState)(""),m=Object(M.a)(b,2),y=m[0],k=m[1],I,N=1024*1024,F=10*N,C=Object(W.useRef)();i==="office"&&(I=Object(f.V)(c).filesize,I>F&&(i="other")),u&&(h.filename=u),Object(W.useEffect)(function(){var K,J,te=(K=document.cookie)===null||K===void 0||((J=K.replace(/\s/g,""))===null||J===void 0)?void 0:J.split(";");te==null||te.map(function(ve){var ue=ve.split("=");ue[0]==="_educoder_session"&&k(ue[1])})},[]);var v=function(){if(c.startsWith("http")||c.startsWith("/")){j();return}Object(f.z)(u||"educoder",c,u)},j=function(){Object(f.x)(u||s,c)};return console.log("data:",c,"fileanme:",u," name:",s),B.a.createElement("div",{style:Object(U.a)({},S||{}),className:"".concat(x&&A.a.bgBlack," ").concat(i?A.a.wrp:"hide")},E&&B.a.createElement("div",{className:A.a.close,ref:C},B.a.createElement(z.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return C.current}},B.a.createElement("span",{onClick:j},B.a.createElement("i",{className:"icon-quxiaozhiding"}))),B.a.createElement(z.a,{title:"\u5173\u95ED",getPopupContainer:function(){return C.current}},B.a.createElement("span",{className:"",onClick:O},B.a.createElement("i",{className:"icon-guanbi1"})))),B.a.createElement("div",{className:"".concat(A.a[R]," ").concat(R," ").concat(A.a.monaco," ").concat(i==="txt"?"show":"hide")},i==="txt"&&B.a.createElement(p.b,h)),i==="audio"&&B.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}),i==="video"&&B.a.createElement(B.a.Fragment,null,c!=null&&c.startsWith("/")?B.a.createElement("video",{controls:!0,src:"".concat(c),autoPlay:!0}):B.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(c),autoPlay:!0})),i==="html"&&B.a.createElement("iframe",{src:c+"&disposition=inline"}),i==="pdf"&&B.a.createElement("embed",{className:A.a.embed,src:c}),i==="image"&&B.a.createElement(B.a.Fragment,null,B.a.createElement("img",{src:"".concat(c!=null&&c.startsWith("/")||(c==null?void 0:c.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(c)})),i==="other"&&B.a.createElement("div",null,B.a.createElement(V.a,{type:"primary",size:"large",onClick:v},B.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(i==="download"||i==="office")&&B.a.createElement(V.a,{type:"primary",size:"large",onClick:v},B.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(tt,je,q){},psGv:function(tt,je,q){var re,V;(function(){var D;(function(){"use strict";var W=[,,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 o=this.__base_string_length;return c=c||0,s<0&&(o=0),o+=s*this.__indent_size,o+=c,o},f.prototype.get_indent_string=function(s,c){var o=this.__base_string;return c=c||0,s<0&&(s=0,o=""),c+=s*this.__indent_size,this.__ensure_cache(c),o+=this.__cache[c],o},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,o="";this.__indent_size&&s>=this.__indent_size&&(c=Math.floor(s/this.__indent_size),s-=c*this.__indent_size,o=new Array(c+1).join(this.__indent_string)),s&&(o+=new Array(s+1).join(" ")),this.__cache.push(o)};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 o=this.__lines.join(`
|
|
`);return s!==`
|
|
`&&(o=o.replace(/[\n]/g,s)),o},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 o=this.__lines.length-2;o>=0;){var i=this.__lines[o];if(i.is_empty())break;if(i.item(0).indexOf(s)!==0&&i.item(-1)!==c){this.__lines.splice(o+1,0,new p(this)),this.previous_line=this.__lines[this.__lines.length-2];break}o--}},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 o=this.raw_options[s],i=c||[];return typeof o=="object"?o!==null&&typeof o.concat=="function"&&(i=o.concat()):typeof o=="string"&&(i=o.split(/[^a-zA-Z0-9_\/\-]+/)),i},p.prototype._get_boolean=function(s,c){var o=this.raw_options[s],i=o===void 0?!!c:!!o;return i},p.prototype._get_characters=function(s,c){var o=this.raw_options[s],i=c||"";return typeof o=="string"&&(i=o.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),i},p.prototype._get_number=function(s,c){var o=this.raw_options[s];c=parseInt(c,10),isNaN(c)&&(c=0);var i=parseInt(o,10);return isNaN(i)&&(i=c),i},p.prototype._get_selection=function(s,c,o){var i=this._get_selection_list(s,c,o);if(i.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 i[0]},p.prototype._get_selection_list=function(s,c,o){if(!c||c.length===0)throw new Error("Selection list cannot be empty.");if(o=o||[c[0]],!this._is_valid_selection(o,c))throw new Error("Invalid Default Value!");var i=this._get_array(s,o);if(!this._is_valid_selection(i,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 i},p.prototype._is_valid_selection=function(s,c){return s.length&&c.length&&!s.some(function(o){return c.indexOf(o)===-1})};function f(s,c){var o={};s=d(s);var i;for(i in s)i!==c&&(o[i]=s[i]);if(c&&s[c])for(i in s[c])o[i]=s[c][i];return o}function d(s){var c={},o;for(o in s){var i=o.replace(/-/g,"_");c[i]=s[o]}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 o="",i;return d&&(i=this.match(d),i&&(o+=i[0])),s&&(i||!d)&&(o+=this.readUntil(s,c)),o},f.prototype.readUntil=function(d,s){var c="",o=this.__position;d.lastIndex=this.__position;var i=d.exec(this.__input);return i?(o=i.index,s&&(o+=i[0].length)):o=this.__input_length,c=this.__input.substring(this.__position,o),this.__position=o,c},f.prototype.readUntilAfter=function(d){return this.readUntil(d,!0)},f.prototype.get_regexp=function(d,s){var c=null,o="g";return s&&p&&(o="y"),typeof d=="string"&&d!==""?c=new RegExp(d,o):d&&(c=new RegExp(d.source,o)),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,o=f(11).WhitespacePattern,i={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},u=function(h,R){this._input=new d(h),this._options=R||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new o(this._input)};u.prototype.tokenize=function(){this._input.restart(),this.__tokens=new c,this._reset();for(var h,R=new s(i.START,""),S=null,E=[],O=new c;R.type!==i.EOF;){for(h=this._get_next_token(R,S);this._is_comment(h);)O.add(h),h=this._get_next_token(R,S);O.isEmpty()||(h.comments_before=O,O=new c),h.parent=S,this._is_opening(h)?(E.push(S),S=h):S&&this._is_closing(h,S)&&(h.opened=S,S.closed=h,S=E.pop(),h.parent=S),h.previous=R,R.next=h,this.__tokens.add(h),R=h}return this.__tokens},u.prototype._is_first_token=function(){return this.__tokens.isEmpty()},u.prototype._reset=function(){},u.prototype._get_next_token=function(h,R){this._readWhitespace();var S=this._input.read(/.+/g);return S?this._create_token(i.RAW,S):this._create_token(i.EOF,"")},u.prototype._is_comment=function(h){return!1},u.prototype._is_opening=function(h){return!1},u.prototype._is_closing=function(h,R){return!1},u.prototype._create_token=function(h,R){var S=new s(h,R,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return S},u.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},g.exports.Tokenizer=u,g.exports.TOKEN=i},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,o){d.call(this,c,o),o?this._line_regexp=this._input.get_regexp(o._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,o){c+="\\t ",o+="\\n\\r",this._match_pattern=this._input.get_regexp("["+c+o+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+o+"]")},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 o=this.__split(this._newline_regexp,c);this.newline_count=o.length-1,this.whitespace_before_token=o[this.newline_count]}return c},s.prototype.matching=function(c,o){var i=this._create();return i.__set_whitespace_patterns(c,o),i._update(),i},s.prototype._create=function(){return new s(this._input,this)},s.prototype.__split=function(c,o){c.lastIndex=0;for(var i=0,u=[],h=c.exec(o);h;)u.push(o.substring(i,h.index)),i=h.index+h[0].length,h=c.exec(o);return i<o.length?u.push(o.substring(i,o.length)):u.push(""),u},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(o,i){d.call(this,o,i),this.__template_pattern=null,this._disabled=Object.assign({},s),this._excluded=Object.assign({},s),i&&(this.__template_pattern=this._input.get_regexp(i.__template_pattern),this._excluded=Object.assign(this._excluded,i._excluded),this._disabled=Object.assign(this._disabled,i._disabled));var u=new d(o);this.__patterns={handlebars_comment:u.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:u.starting_with(/{{{/).until_after(/}}}/),handlebars:u.starting_with(/{{/).until_after(/}}/),php:u.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:u.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:u.starting_with(/{%/).until_after(/%}/),django_value:u.starting_with(/{{/).until_after(/}}/),django_comment:u.starting_with(/{#/).until_after(/#}/),smarty:u.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:u.starting_with(/{\*/).until_after(/\*}/),smarty_literal:u.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(o){var i=this._create();return i._disabled[o]=!0,i._update(),i},c.prototype.read_options=function(o){var i=this._create();for(var u in s)i._disabled[u]=o.templating.indexOf(u)===-1;return i._update(),i},c.prototype.exclude=function(o){var i=this._create();return i._excluded[o]=!0,i._update(),i},c.prototype.read=function(){var o="";this._match_pattern?o=this._input.read(this._starting_pattern):o=this._input.read(this._starting_pattern,this.__template_pattern);for(var i=this._read_template();i;)this._match_pattern?i+=this._input.read(this._match_pattern):i+=this._input.readUntil(this.__template_pattern),o+=i,i=this._read_template();return this._until_after&&(o+=this._input.readUntilAfter(this._until_pattern)),o},c.prototype.__set_templated_pattern=function(){var o=[];this._disabled.php||o.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||o.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||o.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(o.push(this.__patterns.django._starting_pattern.source),o.push(this.__patterns.django_value._starting_pattern.source),o.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||o.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&o.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+o.join("|")+")")},c.prototype._read_template=function(){var o="",i=this._input.peek();if(i==="<"){var u=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&u==="?"&&(o=o||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&u==="%"&&(o=o||this.__patterns.erb.read())}else i==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(o=o||this.__patterns.handlebars_comment.read(),o=o||this.__patterns.handlebars_unescaped.read(),o=o||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(o=o||this.__patterns.django_value.read()),this._excluded.django||(o=o||this.__patterns.django_comment.read(),o=o||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(o=o||this.__patterns.smarty_comment.read(),o=o||this.__patterns.smarty_literal.read(),o=o||this.__patterns.smarty.read()));return o},g.exports.TemplatablePattern=c},,,,function(g,p,f){var d=f(19).Beautifier,s=f(20).Options;function c(o,i,u,h){var R=new d(o,i,u,h);return R.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,o=f(21).TOKEN,i=/\r\n|[\r\n]/,u=/\r\n|[\r\n]/g,h=function(b,m){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=b.max_preserve_newlines,this.preserve_newlines=b.preserve_newlines,this._output=new s(b,m)};h.prototype.current_line_has_match=function(b){return this._output.current_line.has_match(b)},h.prototype.set_space_before_token=function(b,m){this._output.space_before_token=b,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(b){this._output.add_raw_token(b)},h.prototype.print_preserved_newlines=function(b){var m=0;b.type!==o.TEXT&&b.previous.type!==o.TEXT&&(m=b.newlines?1:0),this.preserve_newlines&&(m=b.newlines<this.max_preserve_newlines+1?b.newlines:this.max_preserve_newlines+1);for(var y=0;y<m;y++)this.print_newline(y>0);return m!==0},h.prototype.traverse_whitespace=function(b){return b.whitespace_before||b.newlines?(this.print_preserved_newlines(b)||(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(b){this._output.add_new_line(b)},h.prototype.print_token=function(b){b.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(b.text))},h.prototype.indent=function(){this.indent_level++},h.prototype.get_full_indent=function(b){return b=this.indent_level+(b||0),b<1?"":this._output.get_indent_string(b)};var R=function(b){for(var m=null,y=b.next;y.type!==o.EOF&&b.closed!==y;){if(y.type===o.ATTRIBUTE&&y.text==="type"){y.next&&y.next.type===o.EQUALS&&y.next.next&&y.next.next.type===o.VALUE&&(m=y.next.next.text);break}y=y.next}return m},S=function(b,m){var y=null,k=null;return m.closed?(b==="script"?y="text/javascript":b==="style"&&(y="text/css"),y=R(m)||y,y.search("text/css")>-1?k="css":y.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?k="javascript":y.search(/(text|application|dojo)\/(x-)?(html)/)>-1?k="html":y.search(/test\/null/)>-1&&(k="null"),k):null};function E(b,m){return m.indexOf(b)!==-1}function O(b,m,y){this.parent=b||null,this.tag=m?m.tag_name:"",this.indent_level=y||0,this.parser_token=m||null}function x(b){this._printer=b,this._current_frame=null}x.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},x.prototype.record_tag=function(b){var m=new O(this._current_frame,b,this._printer.indent_level);this._current_frame=m},x.prototype._try_pop_frame=function(b){var m=null;return b&&(m=b.parser_token,this._printer.indent_level=b.indent_level,this._current_frame=b.parent),m},x.prototype._get_frame=function(b,m){for(var y=this._current_frame;y&&!(b.indexOf(y.tag)!==-1);){if(m&&m.indexOf(y.tag)!==-1){y=null;break}y=y.parent}return y},x.prototype.try_pop=function(b,m){var y=this._get_frame([b],m);return this._try_pop_frame(y)},x.prototype.indent_to_tag=function(b){var m=this._get_frame(b);m&&(this._printer.indent_level=m.indent_level)};function w(b,m,y,k){this._source_text=b||"",m=m||{},this._js_beautify=y,this._css_beautify=k,this._tag_stack=null;var I=new d(m,"html");this._options=I,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 b=this._source_text,m=this._options.eol;this._options.eol==="auto"&&(m=`
|
|
`,b&&i.test(b)&&(m=b.match(i)[0])),b=b.replace(u,`
|
|
`);var y=b.match(/^[\t ]*/)[0],k={text:"",type:""},I=new T,N=new h(this._options,y),F=new c(b,this._options).tokenize();this._tag_stack=new x(N);for(var C=null,v=F.next();v.type!==o.EOF;)v.type===o.TAG_OPEN||v.type===o.COMMENT?(C=this._handle_tag_open(N,v,I,k),I=C):v.type===o.ATTRIBUTE||v.type===o.EQUALS||v.type===o.VALUE||v.type===o.TEXT&&!I.tag_complete?C=this._handle_inside_tag(N,v,I,F):v.type===o.TAG_CLOSE?C=this._handle_tag_close(N,v,I):v.type===o.TEXT?C=this._handle_text(N,v,I):N.add_raw_token(v),k=C,v=F.next();var j=N._output.get_code(m);return j},w.prototype._handle_tag_close=function(b,m,y){var k={text:m.text,type:m.type};return b.alignment_size=0,y.tag_complete=!0,b.set_space_before_token(m.newlines||m.whitespace_before!=="",!0),y.is_unformatted?b.add_raw_token(m):(y.tag_start_char==="<"&&(b.set_space_before_token(m.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&y.has_wrapped_attrs&&b.print_newline(!1)),b.print_token(m)),y.indent_content&&!(y.is_unformatted||y.is_content_unformatted)&&(b.indent(),y.indent_content=!1),!y.is_inline_element&&!(y.is_unformatted||y.is_content_unformatted)&&b.set_wrap_point(),k},w.prototype._handle_inside_tag=function(b,m,y,k){var I=y.has_wrapped_attrs,N={text:m.text,type:m.type};if(b.set_space_before_token(m.newlines||m.whitespace_before!=="",!0),y.is_unformatted)b.add_raw_token(m);else if(y.tag_start_char==="{"&&m.type===o.TEXT)b.print_preserved_newlines(m)?(m.newlines=0,b.add_raw_token(m)):b.print_token(m);else{if(m.type===o.ATTRIBUTE?(b.set_space_before_token(!0),y.attr_count+=1):(m.type===o.EQUALS||m.type===o.VALUE&&m.previous.type===o.EQUALS)&&b.set_space_before_token(!1),m.type===o.ATTRIBUTE&&y.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(b.traverse_whitespace(m),I=I||m.newlines!==0),this._is_wrap_attributes_force)){var F=y.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&y.attr_count===1){var C=!0,v=0,j;do{if(j=k.peek(v),j.type===o.ATTRIBUTE){C=!1;break}v+=1}while(v<4&&j.type!==o.EOF&&j.type!==o.TAG_CLOSE);F=!C}F&&(b.print_newline(!1),I=!0)}b.print_token(m),I=I||b.previous_token_wrapped(),y.has_wrapped_attrs=I}return N},w.prototype._handle_text=function(b,m,y){var k={text:m.text,type:"TK_CONTENT"};return y.custom_beautifier_name?this._print_custom_beatifier_text(b,m,y):y.is_unformatted||y.is_content_unformatted?b.add_raw_token(m):(b.traverse_whitespace(m),b.print_token(m)),k},w.prototype._print_custom_beatifier_text=function(b,m,y){var k=this;if(m.text!==""){var I=m.text,N,F=1,C="",v="";y.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?N=this._js_beautify:y.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?N=this._css_beautify:y.custom_beautifier_name==="html"&&(N=function(ue,de){var oe=new w(ue,de,k._js_beautify,k._css_beautify);return oe.beautify()}),this._options.indent_scripts==="keep"?F=0:this._options.indent_scripts==="separate"&&(F=-b.indent_level);var j=b.get_full_indent(F);if(I=I.replace(/\n[ \t]*$/,""),y.custom_beautifier_name!=="html"&&I[0]==="<"&&I.match(/^(<!--|<!\[CDATA\[)/)){var K=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(I);if(!K){b.add_raw_token(m);return}C=j+K[1]+`
|
|
`,I=K[4],K[5]&&(v=j+K[5]),I=I.replace(/\n[ \t]*$/,""),(K[2]||K[3].indexOf(`
|
|
`)!==-1)&&(K=K[3].match(/[ \t]+$/),K&&(m.whitespace_before=K[0]))}if(I)if(N){var J=function(){this.eol=`
|
|
`};J.prototype=this._options.raw_options;var te=new J;I=N(j+I,te)}else{var ve=m.whitespace_before;ve&&(I=I.replace(new RegExp(`
|
|
(`+ve+")?","g"),`
|
|
`)),I=j+I.replace(/\n/g,`
|
|
`+j)}C&&(I?I=C+I+`
|
|
`+v:I=C+v),b.print_newline(!1),I&&(m.text=I,m.whitespace_before="",m.newlines=0,b.add_raw_token(m),b.print_newline(!0))}},w.prototype._handle_tag_open=function(b,m,y,k){var I=this._get_tag_open_token(m);return(y.is_unformatted||y.is_content_unformatted)&&!y.is_empty_element&&m.type===o.TAG_OPEN&&m.text.indexOf("</")===0?(b.add_raw_token(m),I.start_tag_token=this._tag_stack.try_pop(I.tag_name)):(b.traverse_whitespace(m),this._set_tag_position(b,m,I,y,k),I.is_inline_element||b.set_wrap_point(),b.print_token(m)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(I.alignment_size=m.text.length+1),!I.tag_complete&&!I.is_unformatted&&(b.alignment_size=I.alignment_size),I};var T=function(b,m){if(this.parent=b||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 y;this.tag_start_char=m.text[0],this.text=m.text,this.tag_start_char==="<"?(y=m.text.match(/^<([^\s>]*)/),this.tag_check=y?y[1]:""):(y=m.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=y?y[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===o.COMMENT&&(this.tag_complete=!0),this.is_start_tag=this.tag_check.charAt(0)!=="/",this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||m.closed&&m.closed.text==="/>";var k=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(k=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(k)))}};w.prototype._get_tag_open_token=function(b){var m=new T(this._tag_stack.get_parser_token(),b);return m.alignment_size=this._options.wrap_attributes_indent_size,m.is_end_tag=m.is_end_tag||E(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&&E(m.tag_check,this._options.unformatted),m.is_content_unformatted=!m.is_empty_element&&E(m.tag_check,this._options.content_unformatted),m.is_inline_element=E(m.tag_name,this._options.inline)||m.tag_name.includes("-")||m.tag_start_char==="{",m},w.prototype._set_tag_position=function(b,m,y,k,I){if(y.is_empty_element||(y.is_end_tag?y.start_tag_token=this._tag_stack.try_pop(y.tag_name):(this._do_optional_end_element(y)&&(y.is_inline_element||b.print_newline(!1)),this._tag_stack.record_tag(y),(y.tag_name==="script"||y.tag_name==="style")&&!(y.is_unformatted||y.is_content_unformatted)&&(y.custom_beautifier_name=S(y.tag_check,m)))),E(y.tag_check,this._options.extra_liners)&&(b.print_newline(!1),b._output.just_added_blankline()||b.print_newline(!0)),y.is_empty_element){if(y.tag_start_char==="{"&&y.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),y.indent_content=!0;var N=b.current_line_has_match(/{{#if/);N||b.print_newline(!1)}y.tag_name==="!--"&&I.type===o.TAG_CLOSE&&k.is_end_tag&&y.text.indexOf(`
|
|
`)===-1||(y.is_inline_element||y.is_unformatted||b.print_newline(!1),this._calcluate_parent_multiline(b,y))}else if(y.is_end_tag){var F=!1;F=y.start_tag_token&&y.start_tag_token.multiline_content,F=F||!y.is_inline_element&&!(k.is_inline_element||k.is_unformatted)&&!(I.type===o.TAG_CLOSE&&y.start_tag_token===k)&&I.type!=="TK_CONTENT",(y.is_content_unformatted||y.is_unformatted)&&(F=!1),F&&b.print_newline(!1)}else y.indent_content=!y.custom_beautifier_name,y.tag_start_char==="<"&&(y.tag_name==="html"?y.indent_content=this._options.indent_inner_html:y.tag_name==="head"?y.indent_content=this._options.indent_head_inner_html:y.tag_name==="body"&&(y.indent_content=this._options.indent_body_inner_html)),!(y.is_inline_element||y.is_unformatted)&&(I.type!=="TK_CONTENT"||y.is_content_unformatted)&&b.print_newline(!1),this._calcluate_parent_multiline(b,y)},w.prototype._calcluate_parent_multiline=function(b,m){m.parent&&b._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"],l=["a","audio","del","ins","map","noscript","video"];w.prototype._do_optional_end_element=function(b){var m=null;if(b.is_empty_element||!b.is_start_tag||!b.parent)return;if(b.tag_name==="body")m=m||this._tag_stack.try_pop("head");else if(b.tag_name==="li")m=m||this._tag_stack.try_pop("li",["ol","ul"]);else if(b.tag_name==="dd"||b.tag_name==="dt")m=m||this._tag_stack.try_pop("dt",["dl"]),m=m||this._tag_stack.try_pop("dd",["dl"]);else if(b.parent.tag_name==="p"&&_.indexOf(b.tag_name)!==-1){var y=b.parent.parent;(!y||l.indexOf(y.tag_name)===-1)&&(m=m||this._tag_stack.try_pop("p"))}else b.tag_name==="rp"||b.tag_name==="rt"?(m=m||this._tag_stack.try_pop("rt",["ruby","rtc"]),m=m||this._tag_stack.try_pop("rp",["ruby","rtc"])):b.tag_name==="optgroup"?m=m||this._tag_stack.try_pop("optgroup",["select"]):b.tag_name==="option"?m=m||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):b.tag_name==="colgroup"?m=m||this._tag_stack.try_pop("caption",["table"]):b.tag_name==="thead"?(m=m||this._tag_stack.try_pop("caption",["table"]),m=m||this._tag_stack.try_pop("colgroup",["table"])):b.tag_name==="tbody"||b.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"])):b.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"])):(b.tag_name==="th"||b.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 b.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,o=f(14).TemplatablePattern,i=f(12).Pattern,u={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(/<\!--/,/-->/),R=function(S,E){d.call(this,S,E),this._current_tag_name="";var O=new o(this._input).read_options(this._options),x=new i(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:x.starting_with(/{{!--/).until_after(/--}}/),handlebars:x.starting_with(/{{/).until_after(/}}/),handlebars_open:x.until(/[\n\r\t }]/),handlebars_raw_close:x.until(/}}/),comment:x.starting_with(/<!--/).until_after(/-->/),cdata:x.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:x.starting_with(/<!\[/).until_after(/]>/),processing:x.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=x.matching(w).until_after(w)}};R.prototype=new d,R.prototype._is_comment=function(S){return!1},R.prototype._is_opening=function(S){return S.type===u.TAG_OPEN},R.prototype._is_closing=function(S,E){return S.type===u.TAG_CLOSE&&E&&((S.text===">"||S.text==="/>")&&E.text[0]==="<"||S.text==="}}"&&E.text[0]==="{"&&E.text[1]==="{")},R.prototype._reset=function(){this._current_tag_name=""},R.prototype._get_next_token=function(S,E){var O=null;this._readWhitespace();var x=this._input.peek();return x===null?this._create_token(u.EOF,""):(O=O||this._read_open_handlebars(x,E),O=O||this._read_attribute(x,S,E),O=O||this._read_close(x,E),O=O||this._read_raw_content(x,S,E),O=O||this._read_content_word(x),O=O||this._read_comment_or_cdata(x),O=O||this._read_processing(x),O=O||this._read_open(x,E),O=O||this._create_token(u.UNKNOWN,this._input.next()),O)},R.prototype._read_comment_or_cdata=function(S){var E=null,O=null,x=null;if(S==="<"){var w=this._input.peek(1);w==="!"&&(O=this.__patterns.comment.read(),O?(x=h.get_directives(O),x&&x.ignore==="start"&&(O+=h.readIgnored(this._input))):O=this.__patterns.cdata.read()),O&&(E=this._create_token(u.COMMENT,O),E.directives=x)}return E},R.prototype._read_processing=function(S){var E=null,O=null,x=null;if(S==="<"){var w=this._input.peek(1);(w==="!"||w==="?")&&(O=this.__patterns.conditional_comment.read(),O=O||this.__patterns.processing.read()),O&&(E=this._create_token(u.COMMENT,O),E.directives=x)}return E},R.prototype._read_open=function(S,E){var O=null,x=null;return E||S==="<"&&(O=this._input.next(),this._input.peek()==="/"&&(O+=this._input.next()),O+=this.__patterns.element_name.read(),x=this._create_token(u.TAG_OPEN,O)),x},R.prototype._read_open_handlebars=function(S,E){var O=null,x=null;return E||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(),x=this._create_token(u.COMMENT,O)):(O=this.__patterns.handlebars_open.read(),x=this._create_token(u.TAG_OPEN,O))),x},R.prototype._read_close=function(S,E){var O=null,x=null;return E&&(E.text[0]==="<"&&(S===">"||S==="/"&&this._input.peek(1)===">")?(O=this._input.next(),S==="/"&&(O+=this._input.next()),x=this._create_token(u.TAG_CLOSE,O)):E.text[0]==="{"&&S==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),x=this._create_token(u.TAG_CLOSE,"}}"))),x},R.prototype._read_attribute=function(S,E,O){var x=null,w="";if(O&&O.text[0]==="<")if(S==="=")x=this._create_token(u.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(),x=this._create_token(u.VALUE,T)}else w=this.__patterns.attribute.read(),w&&(E.type===u.EQUALS?x=this._create_token(u.VALUE,w):x=this._create_token(u.ATTRIBUTE,w));return x},R.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)},R.prototype._read_raw_content=function(S,E,O){var x="";if(O&&O.text[0]==="{")x=this.__patterns.handlebars_raw_close.read();else if(E.type===u.TAG_CLOSE&&E.opened.text[0]==="<"&&E.text[0]!=="/"){var w=E.opened.text.substr(1).toLowerCase();if(w==="script"||w==="style"){var T=this._read_comment_or_cdata(S);if(T)return T.type=u.TEXT,T;x=this._input.readUntil(new RegExp("</"+w+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(w)&&(x=this._input.readUntil(new RegExp("</"+w+"[\\n\\r\\t ]*?>","ig")))}return x?this._create_token(u.TEXT,x):null},R.prototype._read_content_word=function(S){var E="";if(this._options.unformatted_content_delimiter&&(S===this._options.unformatted_content_delimiter[0]&&(E=this.__patterns.unformatted_content_delimiter.read())),E||(E=this.__patterns.word.read()),E)return this._create_token(u.TEXT,E)},g.exports.Tokenizer=R,g.exports.TOKEN=u}],B={};function P(g){var p=B[g];if(p!==void 0)return p.exports;var f=B[g]={exports:{}};return W[g](f,f.exports,P),f.exports}var A=P(18);D=A})();var z=D;if(!0)!(re=[q,q("6UM0"),q("TXwP")],V=function(W){var B=q("6UM0"),P=q("TXwP");return{html_beautify:function(A,g){return z(A,g,B.js_beautify,P.css_beautify)}}}.apply(je,re),V!==void 0&&(tt.exports=V));else var U,M})()},"rAM+":function(tt,je,q){"use strict";q.d(je,"a",function(){return V});var re=q("Qw5x");function V(D,z){var U;if(typeof Symbol=="undefined"||D[Symbol.iterator]==null){if(Array.isArray(D)||(U=Object(re.a)(D))||z&&D&&typeof D.length=="number"){U&&(D=U);var M=0,W=function(){};return{s:W,n:function(){return M>=D.length?{done:!0}:{done:!1,value:D[M++]}},e:function(p){throw p},f:W}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var B=!0,P=!1,A;return{s:function(){U=D[Symbol.iterator]()},n:function(){var p=U.next();return B=p.done,p},e:function(p){P=!0,A=p},f:function(){try{!B&&U.return!=null&&U.return()}finally{if(P)throw A}}}}},rUJ1:function(tt,je){const q=/[&<>"']/,re=/[&<>"']/g,V=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,z={"&":"&","<":"<",">":">",'"':""","'":"'"},U=x=>z[x];function M(x,w){if(w){if(q.test(x))return x.replace(re,U)}else if(V.test(x))return x.replace(D,U);return x}const W=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function B(x){return x.replace(W,(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 P=/(^|[^\[])\^/g;function A(x,w){x=x.source||x,w=w||"";const T={replace:(_,l)=>(l=l.source||l,l=l.replace(P,"$1"),x=x.replace(_,l),T),getRegex:()=>new RegExp(x,w)};return T}const g=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function f(x,w,T){if(x){let _;try{_=decodeURIComponent(B(T)).replace(g,"").toLowerCase()}catch(l){return null}if(_.indexOf("javascript:")===0||_.indexOf("vbscript:")===0||_.indexOf("data:")===0)return null}w&&!p.test(T)&&(T=i(w,T));try{T=encodeURI(T).replace(/%25/g,"%")}catch(_){return null}return T}const d={},s=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,o=/^([^:]+:\/*[^/]*)[\s\S]*$/;function i(x,w){d[" "+x]||(s.test(x)?d[" "+x]=x+"/":d[" "+x]=S(x,"/",!0)),x=d[" "+x];const T=x.indexOf(":")===-1;return w.substring(0,2)==="//"?T?w:x.replace(c,"$1")+w:w.charAt(0)==="/"?T?w:x.replace(o,"$1")+w:x+w}const u={exec:function(){}};function h(x){let w=1,T,_;for(;w<arguments.length;w++){T=arguments[w];for(_ in T)Object.prototype.hasOwnProperty.call(T,_)&&(x[_]=T[_])}return x}function R(x,w){const T=x.replace(/\|/g,(b,m,y)=>{let k=!1,I=m;for(;--I>=0&&y[I]==="\\";)k=!k;return k?"|":" |"}),_=T.split(/ \|/);let l=0;if(_.length>w)_.splice(w);else for(;_.length<w;)_.push("");for(;l<_.length;l++)_[l]=_[l].trim().replace(/\\\|/g,"|");return _}function S(x,w,T){const _=x.length;if(_===0)return"";let l=0;for(;l<_;){const b=x.charAt(_-l-1);if(b===w&&!T)l++;else if(b!==w&&T)l++;else break}return x.substr(0,_-l)}function E(x,w){if(x.indexOf(w[1])===-1)return-1;const T=x.length;let _=0,l=0;for(;l<T;l++)if(x[l]==="\\")l++;else if(x[l]===w[0])_++;else if(x[l]===w[1]&&(_--,_<0))return l;return-1}function O(x){x&&x.sanitize&&!x.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")}tt.exports={escape:M,unescape:B,edit:A,cleanUrl:f,resolveUrl:i,noopTest:u,merge:h,splitCells:R,rtrim:S,findClosingBracket:E,checkSanitizeDeprecation:O}},tt94:function(tt,je,q){"use strict";q.r(je);var re=q("+L6B"),V=q("2/Rp"),D=q("sRBo"),z=q("kaz8"),U=q("14J3"),M=q("BMrR"),W=q("jCWc"),B=q("kPKH"),P=q("giR+"),A=q("fyUT"),g=q("5NDa"),p=q("5rEg"),f=q("sPJy"),d=q("bE4q"),s=q("k1fw"),c=q("miYZ"),o=q("tsqr"),i=q("9og8"),u=q("y8nQ"),h=q("Vl3Y"),R=q("tJVT"),S=q("WmNS"),E=q.n(S),O=q("cDcd"),x=q.n(O),w=q("9kvl"),T=q("55Ip"),_=q("1vsH"),l=q("Ot1p"),b=q("XYT7"),m=q("lLeG"),y=q.n(m),k=q("500L"),I=q("gMzb"),N=q("ErOA"),F=function(v){var j,K=v.shixunHomeworks,J=v.newCourse,te=v.globalSetting,ve=v.loading,ue=v.dispatch,de=v.match,oe=h.a.useForm(),me=Object(R.a)(oe,1),ae=me[0],fe=Object(O.useState)({}),Q=Object(R.a)(fe,2),ie=Q[0],ee=Q[1],Te=Object(O.useRef)(),Se=K.commonHomeWorkAddDefaultData,be=Object(O.useState)({}),ye=Object(R.a)(be,2),xe=ye[0],De=ye[1];Object(O.useEffect)(function(){setTimeout(function(){document.body.scrollIntoView()},300);var Ue=de.params,He=Ue.coursesId,We=Ue.categoryId;ue({type:"shixunHomeworks/addCommonHomeWorkDefaultData",payload:{category:We,coursesId:He,type:3}})},[]);var Ie=function(){var Ue=Object(i.a)(E.a.mark(function He(We){var Fe,Je,Ve,$e,Ce,qe,ze;return E.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:if(!(ie.min_num>ie.max_num)){Me.next=3;break}return o.b.info("\u6700\u5927\u4EBA\u6570\u4E0D\u80FD\u5C0F\u4E8E\u6700\u5C0F\u4EBA\u6570"),Me.abrupt("return");case 3:return Fe=Object(s.a)({},ie),Fe.attachment_ids&&(Fe.attachment_ids=Fe==null||((Je=Fe.attachment_ids)===null||Je===void 0)?void 0:Je.map(function(_e){return _e.response.id})),Fe.reference_attachment_ids&&(Fe.reference_attachment_ids=Fe==null||((Ve=Fe.reference_attachment_ids)===null||Ve===void 0)?void 0:Ve.map(function(_e){return _e.response.id})),$e=de.params,Ce=$e.coursesId,qe=$e.categoryId,Me.next=9,Object(b.a)(Object(s.a)(Object(s.a)({coursesId:Ce,category:qe},Fe),{},{type:3}));case 9:ze=Me.sent,ze.status===0&&(Ae(ze.homework_id),Object(_.eb)(["\u6559\u5B66\u8BFE\u5802","\u5206\u7EC4\u4F5C\u4E1A","\u65B0\u5EFA\u5206\u7EC4\u4F5C\u4E1A"]),w.d.push("/classrooms/".concat(Ce,"/group_homework/").concat(ze.homework_id,"/detail")));case 11:case"end":return Me.stop()}},He)}));return function(We){return Ue.apply(this,arguments)}}();function Ae(Ue){return Le.apply(this,arguments)}function Le(){return Le=Object(i.a)(E.a.mark(function Ue(He){var We;return E.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:if(xe!=null&&xe.ec_point_ids){Je.next=2;break}return Je.abrupt("return");case 2:return Je.next=4,Object(N.a)("/api/ec_courses/".concat(xe==null?void 0:xe.ec_course_id,"/ec_points/set_work_points.json"),{method:"post",body:Object(s.a)({homework_common_id:He},xe)});case 4:We=Je.sent;case 5:case"end":return Je.stop()}},Ue)})),Le.apply(this,arguments)}return x.a.createElement("section",{className:y.a.bg},Se.course_name&&x.a.createElement("section",{className:"animated fadeIn"},x.a.createElement("aside",{className:"mt10"},Se.category&&x.a.createElement(d.a,{separator:">"},x.a.createElement(d.a.Item,null,x.a.createElement(T.a,{to:"/classrooms/".concat(Se.course_id,"/group_homework")},Se.course_name)),x.a.createElement(d.a.Item,null,x.a.createElement(T.a,{to:"/classrooms/".concat(Se.course_id,"/group_homework")},Se.category.category_name)),x.a.createElement(d.a.Item,null,"\u65B0\u5EFA\u8BE6\u60C5")))),x.a.createElement("aside",{className:"font24 bold mt20 mb20"},"\u65B0\u5EFA\u5206\u7EC4\u4F5C\u4E1A"),x.a.createElement(h.a,{form:ae,className:y.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){ee(Object(s.a)({},ae.getFieldsValue()))},initialValues:{base_on_project:!1},onFinish:Ie},x.a.createElement("div",{className:y.a.fieldWrap},x.a.createElement(h.a.Item,{name:"name",label:"\u6807\u9898:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},x.a.createElement(p.a,{maxLength:60,suffix:"".concat(((j=ie.name)===null||j===void 0?void 0:j.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),x.a.createElement("div",{className:y.a.mdWrap},x.a.createElement(h.a.Item,{name:"description",label:"\u5185\u5BB9:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u4E1A\u7684\u7B80\u4ECB"},{max:5e3,message:"\u4F5C\u4E1A\u7B80\u4ECB\u6700\u5927\u9650\u52365000\u4E2A\u5B57\u7B26"}]},x.a.createElement(l.a,{watch:!0,defaultValue:ie.intro})),x.a.createElement("div",null,x.a.createElement(h.a.Item,{name:"attachment_ids"},x.a.createElement(k.b,null))),x.a.createElement(M.a,{gutter:[20,20]},x.a.createElement(B.a,{flex:"230px"},x.a.createElement(h.a.Item,{name:"min_num",label:"\u5206\u7EC4\u8BBE\u7F6E",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5C0F\u4EBA\u6570"}]},x.a.createElement(A.a,{style:{width:200},min:1,placeholder:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5C0F\u4EBA\u6570"}))),x.a.createElement(B.a,{flex:"230px"},x.a.createElement(h.a.Item,{name:"max_num",label:x.a.createElement("div",null,"\xA0"),rules:[{required:!0,message:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5927\u4EBA\u6570"}]},x.a.createElement(A.a,{style:{width:200},max:100,placeholder:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5927\u4EBA\u6570"}))),x.a.createElement(B.a,null,x.a.createElement("div",{className:"mt30"},"\uFF08\u5B66\u751F\u63D0\u4EA4\u4F5C\u54C1\u65F6\u9700\u8981\u5173\u8054\u540C\u7EC4\u6210\u5458\uFF0C\u7EC4\u5185\u6210\u5458\u4F5C\u54C1\u5171\u4EAB\uFF09"))),x.a.createElement(M.a,null,x.a.createElement(B.a,null,x.a.createElement(h.a.Item,{name:"base_on_project",valuePropName:"checked"},x.a.createElement(z.a,{value:!0},"\u57FA\u4E8E\u9879\u76EE\u5B9E\u65BD")),x.a.createElement("span",{className:"c-light-black"},"\uFF08\u9009\u4E2D\uFF0C\u5219\u5FC5\u987B\u5728\u672C\u5E73\u53F0\u521B\u5EFA\u9879\u76EE\uFF0C\u9879\u76EE\u7BA1\u7406\u5458\u53EF\u4EE5\u63D0\u4EA4\u4F5C\u54C1\uFF1B\u4E0D\u9009\u4E2D\uFF0C\u65E0\u9700\u5728\u5E73\u53F0\u521B\u5EFA\u9879\u76EE\uFF0C\u4EFB\u610F\u5C0F\u7EC4\u6210\u5458\u5747\u53EF\u4EE5\u63D0\u4EA4\u4F5C\u54C1\uFF09")))),x.a.createElement("div",{className:y.a.mdWrap},x.a.createElement(h.a.Item,{name:"reference_answer",label:"\u53C2\u8003\u7B54\u6848:"},x.a.createElement(l.a,{watch:!0,defaultValue:ie.notice})),x.a.createElement("div",null,x.a.createElement(h.a.Item,{name:"reference_attachment_ids"},x.a.createElement(k.b,null))))),x.a.createElement("div",{className:y.a.mdWrap},x.a.createElement(I.a,{setitem:function(He){return De(Object(s.a)({},He))}})),x.a.createElement("div",{className:y.a.backgroundFa},x.a.createElement("div",{className:"pt40 mb30"},x.a.createElement(h.a.Item,null,x.a.createElement(V.a,{size:"large",type:"primary",onClick:function(){ae.submit()},className:"".concat(y.a.button," mr20"),htmlType:"submit",loading:ve["newCourse/editCourse"]||ve["newCourse/submitCourse"]},"\u63D0\u4EA4"),x.a.createElement(V.a,{size:"large",type:"primary",ghost:!0,className:y.a.button,onClick:function(){return w.d.push("/classrooms/".concat(de.params.coursesId,"/group_homework"))}},"\u53D6\u6D88")))))};je.default=Object(w.a)(function(C){var v=C.shixunHomeworks,j=C.newCourse,K=C.loading,J=C.globalSetting;return{shixunHomeworks:v,newCourse:j,globalSetting:J,loading:K.effects}})(F)},ulZh:function(tt,je,q){typeof window!="undefined"&&function(V,D){tt.exports=D()}(this,function(){return function(re){var V={};function D(z){if(V[z])return V[z].exports;var U=V[z]={i:z,l:!1,exports:{}};return re[z].call(U.exports,U,U.exports,D),U.l=!0,U.exports}return D.m=re,D.c=V,D.d=function(z,U,M){D.o(z,U)||Object.defineProperty(z,U,{enumerable:!0,get:M})},D.r=function(z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(z,"__esModule",{value:!0})},D.t=function(z,U){if(U&1&&(z=D(z)),U&8)return z;if(U&4&&typeof z=="object"&&z&&z.__esModule)return z;var M=Object.create(null);if(D.r(M),Object.defineProperty(M,"default",{enumerable:!0,value:z}),U&2&&typeof z!="string")for(var W in z)D.d(M,W,function(B){return z[B]}.bind(null,W));return M},D.n=function(z){var U=z&&z.__esModule?function(){return z.default}:function(){return z};return D.d(U,"a",U),U},D.o=function(z,U){return Object.prototype.hasOwnProperty.call(z,U)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(re,V,D){"use strict";var z=Object.prototype.hasOwnProperty,U="~";function M(){}Object.create&&(M.prototype=Object.create(null),new M().__proto__||(U=!1));function W(g,p,f){this.fn=g,this.context=p,this.once=f||!1}function B(g,p,f,d,s){if(typeof f!="function")throw new TypeError("The listener must be a function");var c=new W(f,d||g,s),o=U?U+p:p;return g._events[o]?g._events[o].fn?g._events[o]=[g._events[o],c]:g._events[o].push(c):(g._events[o]=c,g._eventsCount++),g}function P(g,p){--g._eventsCount===0?g._events=new M:delete g._events[p]}function A(){this._events=new M,this._eventsCount=0}A.prototype.eventNames=function(){var p=[],f,d;if(this._eventsCount===0)return p;for(d in f=this._events)z.call(f,d)&&p.push(U?d.slice(1):d);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(f)):p},A.prototype.listeners=function(p){var f=U?U+p:p,d=this._events[f];if(!d)return[];if(d.fn)return[d.fn];for(var s=0,c=d.length,o=new Array(c);s<c;s++)o[s]=d[s].fn;return o},A.prototype.listenerCount=function(p){var f=U?U+p:p,d=this._events[f];return d?d.fn?1:d.length:0},A.prototype.emit=function(p,f,d,s,c,o){var i=U?U+p:p;if(!this._events[i])return!1;var u=this._events[i],h=arguments.length,R,S;if(u.fn){u.once&&this.removeListener(p,u.fn,void 0,!0);switch(h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,f),!0;case 3:return u.fn.call(u.context,f,d),!0;case 4:return u.fn.call(u.context,f,d,s),!0;case 5:return u.fn.call(u.context,f,d,s,c),!0;case 6:return u.fn.call(u.context,f,d,s,c,o),!0}for(S=1,R=new Array(h-1);S<h;S++)R[S-1]=arguments[S];u.fn.apply(u.context,R)}else{var E=u.length,O;for(S=0;S<E;S++){u[S].once&&this.removeListener(p,u[S].fn,void 0,!0);switch(h){case 1:u[S].fn.call(u[S].context);break;case 2:u[S].fn.call(u[S].context,f);break;case 3:u[S].fn.call(u[S].context,f,d);break;case 4:u[S].fn.call(u[S].context,f,d,s);break;default:if(!R)for(O=1,R=new Array(h-1);O<h;O++)R[O-1]=arguments[O];u[S].fn.apply(u[S].context,R)}}}return!0},A.prototype.on=function(p,f,d){return B(this,p,f,d,!1)},A.prototype.once=function(p,f,d){return B(this,p,f,d,!0)},A.prototype.removeListener=function(p,f,d,s){var c=U?U+p:p;if(!this._events[c])return this;if(!f)return P(this,c),this;var o=this._events[c];if(o.fn)o.fn===f&&(!s||o.once)&&(!d||o.context===d)&&P(this,c);else{for(var i=0,u=[],h=o.length;i<h;i++)(o[i].fn!==f||s&&!o[i].once||d&&o[i].context!==d)&&u.push(o[i]);u.length?this._events[c]=u.length===1?u[0]:u:P(this,c)}return this},A.prototype.removeAllListeners=function(p){var f;return p?(f=U?U+p:p,this._events[f]&&P(this,f)):(this._events=new M,this._eventsCount=0),this},A.prototype.off=A.prototype.removeListener,A.prototype.addListener=A.prototype.on,A.prefixed=U,A.EventEmitter=A,re.exports=A},"./node_modules/url-toolkit/src/url-toolkit.js":function(re,V,D){(function(z){var U=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,M=/^([^\/?#]*)([^]*)$/,W=/(?:\/|^)\.(?=\/)/g,B=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,P={buildAbsoluteURL:function(A,g,p){if(p=p||{},A=A.trim(),g=g.trim(),!g){if(!p.alwaysNormalize)return A;var f=P.parseURL(A);if(!f)throw new Error("Error trying to parse base URL.");return f.path=P.normalizePath(f.path),P.buildURLFromParts(f)}var d=P.parseURL(g);if(!d)throw new Error("Error trying to parse relative URL.");if(d.scheme)return p.alwaysNormalize?(d.path=P.normalizePath(d.path),P.buildURLFromParts(d)):g;var s=P.parseURL(A);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&s.path[0]!=="/"){var c=M.exec(s.path);s.netLoc=c[1],s.path=c[2]}s.netLoc&&!s.path&&(s.path="/");var o={scheme:s.scheme,netLoc:d.netLoc,path:null,params:d.params,query:d.query,fragment:d.fragment};if(!d.netLoc&&(o.netLoc=s.netLoc,d.path[0]!=="/"))if(!d.path)o.path=s.path,d.params||(o.params=s.params,d.query||(o.query=s.query));else{var i=s.path,u=i.substring(0,i.lastIndexOf("/")+1)+d.path;o.path=P.normalizePath(u)}return o.path===null&&(o.path=p.alwaysNormalize?P.normalizePath(d.path):d.path),P.buildURLFromParts(o)},parseURL:function(A){var g=U.exec(A);return g?{scheme:g[1]||"",netLoc:g[2]||"",path:g[3]||"",params:g[4]||"",query:g[5]||"",fragment:g[6]||""}:null},normalizePath:function(A){for(A=A.split("").reverse().join("").replace(W,"");A.length!==(A=A.replace(B,"")).length;);return A.split("").reverse().join("")},buildURLFromParts:function(A){return A.scheme+A.netLoc+A.path+A.params+A.query+A.fragment}};re.exports=P})(this)},"./node_modules/webworkify-webpack/index.js":function(re,V,D){function z(p){var f={};function d(c){if(f[c])return f[c].exports;var o=f[c]={i:c,l:!1,exports:{}};return p[c].call(o.exports,o,o.exports,d),o.l=!0,o.exports}d.m=p,d.c=f,d.i=function(c){return c},d.d=function(c,o,i){d.o(c,o)||Object.defineProperty(c,o,{configurable:!1,enumerable:!0,get:i})},d.r=function(c){Object.defineProperty(c,"__esModule",{value:!0})},d.n=function(c){var o=c&&c.__esModule?function(){return c.default}:function(){return c};return d.d(o,"a",o),o},d.o=function(c,o){return Object.prototype.hasOwnProperty.call(c,o)},d.p="/",d.oe=function(c){throw console.error(c),c};var s=d(d.s=ENTRY_MODULE);return s.default||s}var U="[\\.|\\-|\\+|\\w|/|@]+",M="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+U+").*?\\)";function W(p){return(p+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function B(p){return!isNaN(1*p)}function P(p,f,d){var s={};s[d]=[];var c=f.toString(),o=c.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!o)return s;for(var i=o[1],u=new RegExp("(\\\\n|\\W)"+W(i)+M,"g"),h;h=u.exec(c);){if(h[3]==="dll-reference")continue;s[d].push(h[3])}for(u=new RegExp("\\("+W(i)+'\\("(dll-reference\\s('+U+'))"\\)\\)'+M,"g");h=u.exec(c);)p[h[2]]||(s[d].push(h[1]),p[h[2]]=D(h[1]).m),s[h[2]]=s[h[2]]||[],s[h[2]].push(h[4]);for(var R=Object.keys(s),S=0;S<R.length;S++)for(var E=0;E<s[R[S]].length;E++)B(s[R[S]][E])&&(s[R[S]][E]=1*s[R[S]][E]);return s}function A(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:{}};A(d);)for(var o=Object.keys(d),i=0;i<o.length;i++){var u=o[i],h=d[u],R=h.pop();if(c[u]=c[u]||{},c[u][R]||!p[u][R])continue;c[u][R]=!0,s[u]=s[u]||[],s[u].push(R);for(var S=P(p,p[u][R],u),E=Object.keys(S),O=0;O<E.length;O++)d[E[O]]=d[E[O]]||[],d[E[O]]=d[E[O]].concat(S[E[O]])}return s}re.exports=function(p,f){f=f||{};var d={main:D.m},s=f.all?{main:Object.keys(d.main)}:g(d,p),c="";Object.keys(s).filter(function(R){return R!=="main"}).forEach(function(R){for(var S=0;s[R][S];)S++;s[R].push(S),d[R][S]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",c=c+"var "+R+" = ("+z.toString().replace("ENTRY_MODULE",JSON.stringify(S))+")({"+s[R].map(function(E){return""+JSON.stringify(E)+": "+d[R][E].toString()}).join(",")+`});
|
|
`}),c=c+"new (("+z.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+s.main.map(function(R){return""+JSON.stringify(R)+": "+d.main[R].toString()}).join(",")+"}))(self);";var o=new window.Blob([c],{type:"text/javascript"});if(f.bare)return o;var i=window.URL||window.webkitURL||window.mozURL||window.msURL,u=i.createObjectURL(o),h=new window.Worker(u);return h.objectURL=u,h}},"./src/config.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"hlsDefaultConfig",function(){return O}),D.d(V,"mergeConfig",function(){return w}),D.d(V,"enableStreamingMode",function(){return T});var z=D("./src/controller/abr-controller.ts"),U=D("./src/controller/audio-stream-controller.ts"),M=D("./src/controller/audio-track-controller.ts"),W=D("./src/controller/subtitle-stream-controller.ts"),B=D("./src/controller/subtitle-track-controller.ts"),P=D("./src/controller/buffer-controller.ts"),A=D("./src/controller/timeline-controller.ts"),g=D("./src/controller/cap-level-controller.ts"),p=D("./src/controller/fps-controller.ts"),f=D("./src/controller/eme-controller.ts"),d=D("./src/controller/cmcd-controller.ts"),s=D("./src/utils/xhr-loader.ts"),c=D("./src/utils/fetch-loader.ts"),o=D("./src/utils/cues.ts"),i=D("./src/utils/mediakeys-helper.ts"),u=D("./src/utils/logger.ts");function h(){return h=Object.assign||function(_){for(var l=1;l<arguments.length;l++){var b=arguments[l];for(var m in b)Object.prototype.hasOwnProperty.call(b,m)&&(_[m]=b[m])}return _},h.apply(this,arguments)}function R(_,l){var b=Object.keys(_);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(_);l&&(m=m.filter(function(y){return Object.getOwnPropertyDescriptor(_,y).enumerable})),b.push.apply(b,m)}return b}function S(_){for(var l=1;l<arguments.length;l++){var b=arguments[l]!=null?arguments[l]:{};l%2?R(Object(b),!0).forEach(function(m){E(_,m,b[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(_,Object.getOwnPropertyDescriptors(b)):R(Object(b)).forEach(function(m){Object.defineProperty(_,m,Object.getOwnPropertyDescriptor(b,m))})}return _}function E(_,l,b){return l in _?Object.defineProperty(_,l,{value:b,enumerable:!0,configurable:!0,writable:!0}):_[l]=b,_}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:z.default,bufferController:P.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:i.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},x()),{},{subtitleStreamController:W.SubtitleStreamController,subtitleTrackController:B.default,timelineController:A.TimelineController,audioStreamController:U.default,audioTrackController:M.default,emeController:f.default,cmcdController:d.default});function x(){return{cueHandler:o.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function w(_,l){if((l.liveSyncDurationCount||l.liveMaxLatencyDurationCount)&&(l.liveSyncDuration||l.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(l.liveMaxLatencyDurationCount!==void 0&&(l.liveSyncDurationCount===void 0||l.liveMaxLatencyDurationCount<=l.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(l.liveMaxLatencyDuration!==void 0&&(l.liveSyncDuration===void 0||l.liveMaxLatencyDuration<=l.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return h({},_,l)}function T(_){var l=_.loader;if(l!==c.default&&l!==s.default)u.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),_.progressive=!1;else{var b=Object(c.fetchSupported)();b&&(_.loader=c.default,_.progressive=!0,_.enableSoftwareAES=!0,u.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(re,V,D){"use strict";D.r(V);var z=D("./src/polyfills/number.ts"),U=D("./src/utils/ewma-bandwidth-estimator.ts"),M=D("./src/events.ts"),W=D("./src/utils/buffer-helper.ts"),B=D("./src/errors.ts"),P=D("./src/types/loader.ts"),A=D("./src/utils/logger.ts");function g(d,s){for(var c=0;c<s.length;c++){var o=s[c];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(d,o.key,o)}}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 o=c.config;this.bwEstimator=new U.default(o.abrEwmaSlowVoD,o.abrEwmaFastVoD,o.abrEwmaDefaultEstimate),this.registerListeners()}var s=d.prototype;return s.registerListeners=function(){var o=this.hls;o.on(M.Events.FRAG_LOADING,this.onFragLoading,this),o.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),o.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),o.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.on(M.Events.ERROR,this.onError,this)},s.unregisterListeners=function(){var o=this.hls;o.off(M.Events.FRAG_LOADING,this.onFragLoading,this),o.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),o.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),o.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.off(M.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(o,i){var u=i.frag;if(u.type===P.PlaylistLevelType.MAIN&&!this.timer){var h;this.fragCurrent=u,this.partCurrent=(h=i.part)!=null?h:null,this.timer=self.setInterval(this.onCheck,100)}},s.onLevelLoaded=function(o,i){var u=this.hls.config;i.details.live?this.bwEstimator.update(u.abrEwmaSlowLive,u.abrEwmaFastLive):this.bwEstimator.update(u.abrEwmaSlowVoD,u.abrEwmaFastVoD)},s._abandonRulesCheck=function(){var o=this.fragCurrent,i=this.partCurrent,u=this.hls,h=u.autoLevelEnabled,R=u.config,S=u.media;if(!o||!S)return;var E=i?i.stats:o.stats,O=i?i.duration:o.duration;if(E.aborted){A.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 x=performance.now()-E.loading.start,w=Math.abs(S.playbackRate);if(x<=500*O/w)return;var T=u.levels,_=u.minAutoLevel,l=T[o.level],b=E.total||Math.max(E.loaded,Math.round(O*l.maxBitrate/8)),m=Math.max(1,E.bwEstimate?E.bwEstimate/8:E.loaded*1e3/x),y=(b-E.loaded)/m,k=S.currentTime,I=(W.BufferHelper.bufferInfo(S,k,R.maxBufferHole).end-k)/w;if(I>=2*O/w||y<=I)return;var N=Number.POSITIVE_INFINITY,F;for(F=o.level-1;F>_;F--){var C=T[F].maxBitrate;if(N=O*C/(8*.8*m),N<I)break}if(N>=y)return;var v=this.bwEstimator.getEstimate();A.logger.warn("Fragment "+o.sn+(i?" part "+i.index:"")+" of level "+o.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+F+`
|
|
Current BW estimate: `+(Object(z.isFiniteNumber)(v)?(v/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+y.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+N.toFixed(3)+` s
|
|
Time to underbuffer: `+I.toFixed(3)+" s"),u.nextLoadLevel=F,this.bwEstimator.sample(x,E.loaded),this.clearTimer(),o.loader&&(this.fragCurrent=this.partCurrent=null,o.loader.abort()),u.trigger(M.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:o,part:i,stats:E})},s.onFragLoaded=function(o,i){var u=i.frag,h=i.part;if(u.type===P.PlaylistLevelType.MAIN&&Object(z.isFiniteNumber)(u.sn)){var R=h?h.stats:u.stats,S=h?h.duration:u.duration;if(this.clearTimer(),this.lastLoadedFragLevel=u.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var E=this.hls.levels[u.level],O=(E.loaded?E.loaded.bytes:0)+R.loaded,x=(E.loaded?E.loaded.duration:0)+S;E.loaded={bytes:O,duration:x},E.realBitrate=Math.round(8*O/x)}if(u.bitrateTest){var w={stats:R,frag:u,part:h,id:u.type};this.onFragBuffered(M.Events.FRAG_BUFFERED,w),u.bitrateTest=!1}}},s.onFragBuffered=function(o,i){var u=i.frag,h=i.part,R=h?h.stats:u.stats;if(R.aborted)return;if(u.type!==P.PlaylistLevelType.MAIN||u.sn==="initSegment")return;var S=R.parsing.end-R.loading.start;this.bwEstimator.sample(S,R.loaded),R.bwEstimate=this.bwEstimator.getEstimate(),u.bitrateTest?this.bitrateTestDelay=S/1e3:this.bitrateTestDelay=0},s.onError=function(o,i){switch(i.details){case B.ErrorDetails.FRAG_LOAD_ERROR:case B.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},s.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},s.getNextABRAutoLevel=function(){var o=this.fragCurrent,i=this.partCurrent,u=this.hls,h=u.maxAutoLevel,R=u.config,S=u.minAutoLevel,E=u.media,O=i?i.duration:o?o.duration:0,x=E?E.currentTime:0,w=E&&E.playbackRate!==0?Math.abs(E.playbackRate):1,T=this.bwEstimator?this.bwEstimator.getEstimate():R.abrEwmaDefaultEstimate,_=(W.BufferHelper.bufferInfo(E,x,R.maxBufferHole).end-x)/w,l=this.findBestLevel(T,S,h,_,R.abrBandWidthFactor,R.abrBandWidthUpFactor);if(l>=0)return l;A.logger.trace((_?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var b=O?Math.min(O,R.maxStarvationDelay):R.maxStarvationDelay,m=R.abrBandWidthFactor,y=R.abrBandWidthUpFactor;if(!_){var k=this.bitrateTestDelay;if(k){var I=O?Math.min(O,R.maxLoadingDelay):R.maxLoadingDelay;b=I-k,A.logger.trace("bitrate test took "+Math.round(1e3*k)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*b)+" ms"),m=y=1}}return l=this.findBestLevel(T,S,h,_+b,m,y),Math.max(l,0)},s.findBestLevel=function(o,i,u,h,R,S){for(var E,O=this.fragCurrent,x=this.partCurrent,w=this.lastLoadedFragLevel,T=this.hls.levels,_=T[w],l=!!(_!=null&&(E=_.details)!==null&&E!==void 0&&E.live),b=_==null?void 0:_.codecSet,m=x?x.duration:O?O.duration:0,y=u;y>=i;y--){var k=T[y];if(!k||b&&k.codecSet!==b)continue;var I=k.details,N=(x?I==null?void 0:I.partTarget:I==null?void 0:I.averagetargetduration)||m,F=void 0;y<=w?F=R*o:F=S*o;var C=T[y].maxBitrate,v=C*N/F;if(A.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+y+"/"+Math.round(F)+"/"+C+"/"+N+"/"+h+"/"+v),F>C&&(!v||l&&!this.bitrateTestDelay||v<h))return y}return-1},p(d,[{key:"nextAutoLevel",get:function(){var o=this._nextAutoLevel,i=this.bwEstimator;if(o!==-1&&(!i||!i.canEstimate()))return o;var u=this.getNextABRAutoLevel();return o!==-1&&(u=Math.min(o,u)),u},set:function(o){this._nextAutoLevel=o}}]),d}();V.default=f},"./src/controller/audio-stream-controller.ts":function(re,V,D){"use strict";D.r(V);var z=D("./src/polyfills/number.ts"),U=D("./src/controller/base-stream-controller.ts"),M=D("./src/events.ts"),W=D("./src/utils/buffer-helper.ts"),B=D("./src/controller/fragment-tracker.ts"),P=D("./src/types/level.ts"),A=D("./src/types/loader.ts"),g=D("./src/loader/fragment.ts"),p=D("./src/demux/chunk-cache.ts"),f=D("./src/demux/transmuxer-interface.ts"),d=D("./src/types/transmuxer.ts"),s=D("./src/controller/fragment-finders.ts"),c=D("./src/utils/discontinuities.ts"),o=D("./src/errors.ts"),i=D("./src/utils/logger.ts");function u(){return u=Object.assign||function(O){for(var x=1;x<arguments.length;x++){var w=arguments[x];for(var T in w)Object.prototype.hasOwnProperty.call(w,T)&&(O[T]=w[T])}return O},u.apply(this,arguments)}function h(O,x){O.prototype=Object.create(x.prototype),O.prototype.constructor=O,R(O,x)}function R(O,x){return R=Object.setPrototypeOf||function(T,_){return T.__proto__=_,T},R(O,x)}var S=100,E=function(O){h(x,O);function x(T,_){var l;return l=O.call(this,T,_,"[audio-stream-controller]")||this,l.videoBuffer=null,l.videoTrackCC=-1,l.waitingVideoCC=-1,l.audioSwitch=!1,l.trackId=-1,l.waitingData=null,l.mainDetails=null,l.bufferFlushed=!1,l._registerListeners(),l}var w=x.prototype;return w.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},w._registerListeners=function(){var _=this.hls;_.on(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),_.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.on(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),_.on(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),_.on(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),_.on(M.Events.ERROR,this.onError,this),_.on(M.Events.BUFFER_RESET,this.onBufferReset,this),_.on(M.Events.BUFFER_CREATED,this.onBufferCreated,this),_.on(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),_.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),_.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},w._unregisterListeners=function(){var _=this.hls;_.off(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),_.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.off(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),_.off(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),_.off(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),_.off(M.Events.ERROR,this.onError,this),_.off(M.Events.BUFFER_RESET,this.onBufferReset,this),_.off(M.Events.BUFFER_CREATED,this.onBufferCreated,this),_.off(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),_.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),_.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},w.onInitPtsFound=function(_,l){var b=l.frag,m=l.id,y=l.initPTS;if(m==="main"){var k=b.cc;this.initPTS[b.cc]=y,this.log("InitPTS for cc: "+k+" found from main: "+y),this.videoTrackCC=k,this.state===U.State.WAITING_INIT_PTS&&this.tick()}},w.startLoad=function(_){if(!this.levels){this.startPosition=_,this.state=U.State.STOPPED;return}var l=this.lastCurrentTime;this.stopLoad(),this.setInterval(S),this.fragLoadError=0,l>0&&_===-1?(this.log("Override startPosition with lastCurrentTime @"+l.toFixed(3)),this.state=U.State.IDLE):(this.loadedmetadata=!1,this.state=U.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=_,this.tick()},w.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_TRACK:{var _,l=this.levels,b=this.trackId,m=l==null||((_=l[b])===null||_===void 0)?void 0:_.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=U.State.WAITING_INIT_PTS}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var y,k=performance.now(),I=this.retryDate;(!I||k>=I||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=U.State.IDLE);break}case U.State.WAITING_INIT_PTS:{var N=this.waitingData;if(N){var F=N.frag,C=N.part,v=N.cache,j=N.complete;if(this.initPTS[F.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.FRAG_LOADING;var K=v.flush(),J={frag:F,part:C,payload:K,networkDetails:null};this._handleFragmentLoadProgress(J),j&&O.prototype._handleFragmentLoadComplete.call(this,J)}else if(this.videoTrackCC!==this.waitingVideoCC)i.logger.log("Waiting fragment cc ("+F.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var te=this.getLoadPosition(),ve=W.BufferHelper.bufferInfo(this.mediaBuffer,te,this.config.maxBufferHole),ue=Object(s.fragmentWithinToleranceTest)(ve.end,this.config.maxFragLookUpTolerance,F);ue<0&&(i.logger.log("Waiting fragment cc ("+F.cc+") @ "+F.start+" cancelled because another fragment at "+ve.end+" is needed"),this.clearWaitingFragment())}}else this.state=U.State.IDLE}}this.onTickEnd()},w.clearWaitingFragment=function(){var _=this.waitingData;_&&(this.fragmentTracker.removeFragment(_.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.IDLE)},w.onTickEnd=function(){var _=this.media;if(!_||!_.readyState)return;var l=this.mediaBuffer?this.mediaBuffer:_,b=l.buffered;!this.loadedmetadata&&b.length&&(this.loadedmetadata=!0),this.lastCurrentTime=_.currentTime},w.doTickIdle=function(){var _,l,b=this.hls,m=this.levels,y=this.media,k=this.trackId,I=b.config;if(!m||!m[k])return;if(!y&&(this.startFragRequested||!I.startFragPrefetch))return;var N=m[k],F=N.details;if(!F||F.live&&this.levelLastLoaded!==k||this.waitForCdnTuneIn(F)){this.state=U.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,g.ElementaryStreamTypes.AUDIO,A.PlaylistLevelType.AUDIO));var C=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,A.PlaylistLevelType.AUDIO);if(C===null)return;var v=C.len,j=this.getMaxBufferLength(),K=this.audioSwitch;if(v>=j&&!K)return;if(!K&&this._streamEnded(C,F)){b.trigger(M.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var J=F.fragments,te=J[0].start,ve=C.end;if(K){var ue=this.getLoadPosition();ve=ue,F.PTSKnown&&ue<te&&((C.end>te||C.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),y.currentTime=te+.05))}var de=this.getNextFragment(ve,F);if(!de){this.bufferFlushed=!0;return}((_=de.decryptdata)===null||_===void 0?void 0:_.keyFormat)==="identity"&&!((l=de.decryptdata)!==null&&l!==void 0&&l.key)?this.loadKey(de,F):this.loadFragment(de,F,ve)},w.getMaxBufferLength=function(){var _=O.prototype.getMaxBufferLength.call(this),l=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,A.PlaylistLevelType.MAIN);return l===null?_:Math.max(_,l.len)},w.onMediaDetaching=function(){this.videoBuffer=null,O.prototype.onMediaDetaching.call(this)},w.onAudioTracksUpdated=function(_,l){var b=l.audioTracks;this.resetTransmuxer(),this.levels=b.map(function(m){return new P.Level(m)})},w.onAudioTrackSwitching=function(_,l){var b=!!l.url;this.trackId=l.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),b?this.setInterval(S):this.resetTransmuxer(),b?(this.audioSwitch=!0,this.state=U.State.IDLE):this.state=U.State.STOPPED,this.tick()},w.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},w.onLevelLoaded=function(_,l){this.mainDetails=l.details},w.onAudioTrackLoaded=function(_,l){var b,m=this.levels,y=l.details,k=l.id;if(!m){this.warn("Audio tracks were reset while loading level "+k);return}this.log("Track "+k+" loaded ["+y.startSN+","+y.endSN+"],duration:"+y.totalduration);var I=m[k],N=0;if(y.live||(b=I.details)!==null&&b!==void 0&&b.live){var F=this.mainDetails;if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed||!F)return;!I.details&&y.hasProgramDateTime&&F.hasProgramDateTime?(Object(c.alignMediaPlaylistByPDT)(y,F),N=y.fragments[0].start):N=this.alignPlaylists(y,I.details)}I.details=y,this.levelLastLoaded=k,!this.startFragRequested&&(this.mainDetails||!y.live)&&this.setStartPosition(I.details,N),this.state===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(y)&&(this.state=U.State.IDLE),this.tick()},w._handleFragmentLoadProgress=function(_){var l,b=_.frag,m=_.part,y=_.payload,k=this.config,I=this.trackId,N=this.levels;if(!N){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+b.sn+" of level "+b.level+" will not be buffered");return}var F=N[I];console.assert(F,"Audio track is defined on fragment load progress");var C=F.details;console.assert(C,"Audio track details are defined on fragment load progress");var v=k.defaultAudioCodec||F.audioCodec||"mp4a.40.2",j=this.transmuxer;j||(j=this.transmuxer=new f.default(this.hls,A.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var K=this.initPTS[b.cc],J=(l=b.initSegment)===null||l===void 0?void 0:l.data;if(K!==void 0){var te=!1,ve=m?m.index:-1,ue=ve!==-1,de=new d.ChunkMetadata(b.level,b.sn,b.stats.chunkCount,y.byteLength,ve,ue);j.push(y,J,v,"",b,m,C.totalduration,te,de,K)}else{i.logger.log("Unknown video PTS for cc "+b.cc+", waiting for video PTS before demuxing audio frag "+b.sn+" of ["+C.startSN+" ,"+C.endSN+"],track "+I);var oe=this.waitingData=this.waitingData||{frag:b,part:m,cache:new p.default,complete:!1},me=oe.cache;me.push(new Uint8Array(y)),this.waitingVideoCC=this.videoTrackCC,this.state=U.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(_,l){var b=l.tracks.audio;b&&(this.mediaBuffer=b.buffer),l.tracks.video&&(this.videoBuffer=l.tracks.video.buffer)},w.onFragBuffered=function(_,l){var b=l.frag,m=l.part;if(b.type!==A.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(b)){this.warn("Fragment "+b.sn+(m?" p: "+m.index:"")+" of level "+b.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}b.sn!=="initSegment"&&(this.fragPrevious=b,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(b,m)},w.onError=function(_,l){switch(l.details){case o.ErrorDetails.FRAG_LOAD_ERROR:case o.ErrorDetails.FRAG_LOAD_TIMEOUT:case o.ErrorDetails.KEY_LOAD_ERROR:case o.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(A.PlaylistLevelType.AUDIO,l);break;case o.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case o.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==U.State.ERROR&&this.state!==U.State.STOPPED&&(this.state=l.fatal?U.State.ERROR:U.State.IDLE,this.warn(l.details+" while loading frag, switching to "+this.state+" state"));break;case o.ErrorDetails.BUFFER_FULL_ERROR:if(l.parent==="audio"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var b=!0,m=this.getFwdBufferInfo(this.mediaBuffer,A.PlaylistLevelType.AUDIO);m&&m.len>.5&&(b=!this.reduceMaxBufferLength(m.len)),b&&(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(_,l){var b=l.type;b===g.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},w._handleTransmuxComplete=function(_){var l,b="audio",m=this.hls,y=_.remuxResult,k=_.chunkMeta,I=this.getCurrentContext(k);if(!I){this.warn("The loading context changed while buffering fragment "+k.sn+" of level "+k.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(k.level);return}var N=I.frag,F=I.part,C=y.audio,v=y.text,j=y.id3,K=y.initSegment;if(this.fragContextChanged(N))return;if(this.state=U.State.PARSING,this.audioSwitch&&C&&this.completeAudioSwitch(),K!=null&&K.tracks&&(this._bufferInitSegment(K.tracks,N,k),m.trigger(M.Events.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:b,tracks:K.tracks})),C){var J=C.startPTS,te=C.endPTS,ve=C.startDTS,ue=C.endDTS;F&&(F.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:J,endPTS:te,startDTS:ve,endDTS:ue}),N.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,J,te,ve,ue),this.bufferFragmentData(C,N,F,k)}if(j!=null&&(l=j.samples)!==null&&l!==void 0&&l.length){var de=u({frag:N,id:b},j);m.trigger(M.Events.FRAG_PARSING_METADATA,de)}if(v){var oe=u({frag:N,id:b},v);m.trigger(M.Events.FRAG_PARSING_USERDATA,oe)}},w._bufferInitSegment=function(_,l,b){if(this.state!==U.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(M.Events.BUFFER_CODECS,_);var y=m.initSegment;if(y!=null&&y.byteLength){var k={type:"audio",frag:l,part:null,chunkMeta:b,parent:l.type,data:y};this.hls.trigger(M.Events.BUFFER_APPENDING,k)}this.tick()},w.loadFragment=function(_,l,b){var m=this.fragmentTracker.getState(_);this.fragCurrent=_,(this.audioSwitch||m===B.FragmentState.NOT_LOADED||m===B.FragmentState.PARTIAL)&&(_.sn==="initSegment"?this._loadInitSegment(_):l.live&&!Object(z.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=U.State.WAITING_INIT_PTS):(this.startFragRequested=!0,O.prototype.loadFragment.call(this,_,l,b)))},w.completeAudioSwitch=function(){var _=this.hls,l=this.media,b=this.trackId;l&&(this.log("Switching audio track : flushing all audio"),O.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,_.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:b})},x}(U.default);V.default=E},"./src/controller/audio-track-controller.ts":function(re,V,D){"use strict";D.r(V);var z=D("./src/events.ts"),U=D("./src/errors.ts"),M=D("./src/controller/base-playlist-controller.ts"),W=D("./src/types/loader.ts");function B(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 P(f,d,s){return d&&B(f.prototype,d),s&&B(f,s),f}function A(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,o){return c.__proto__=o,c},g(f,d)}var p=function(f){A(d,f);function d(c){var o;return o=f.call(this,c,"[audio-track-controller]")||this,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.trackName="",o.selectDefaultTrack=!0,o.registerListeners(),o}var s=d.prototype;return s.registerListeners=function(){var o=this.hls;o.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.on(z.Events.ERROR,this.onError,this)},s.unregisterListeners=function(){var o=this.hls;o.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.off(z.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(o,i){this.tracks=i.audioTracks||[]},s.onAudioTrackLoaded=function(o,i){var u=i.id,h=i.details,R=this.tracksInGroup[u];if(!R){this.warn("Invalid audio track id "+u);return}var S=R.details;R.details=i.details,this.log("audioTrack "+u+" loaded ["+h.startSN+"-"+h.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,i,S))},s.onLevelLoading=function(o,i){this.switchLevel(i.level)},s.onLevelSwitching=function(o,i){this.switchLevel(i.level)},s.switchLevel=function(o){var i=this.hls.levels[o];if(!(i!=null&&i.audioGroupIds))return;var u=i.audioGroupIds[i.urlId];if(this.groupId!==u){this.groupId=u;var h=this.tracks.filter(function(S){return!u||S.groupId===u});this.selectDefaultTrack&&!h.some(function(S){return S.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=h;var R={audioTracks:h};this.log("Updating audio tracks, "+h.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(z.Events.AUDIO_TRACKS_UPDATED,R),this.selectInitialTrack()}},s.onError=function(o,i){if(f.prototype.onError.call(this,o,i),i.fatal||!i.context)return;i.context.type===W.PlaylistContextType.AUDIO_TRACK&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&this.retryLoadingOrFail(i)},s.setAudioTrack=function(o){var i=this.tracksInGroup;if(o<0||o>=i.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var u=i[this.trackId];this.log("Now switching to audio-track index "+o);var h=i[o],R=h.id,S=h.groupId,E=S===void 0?"":S,O=h.name,x=h.type,w=h.url;if(this.trackId=o,this.trackName=O,this.selectDefaultTrack=!1,this.hls.trigger(z.Events.AUDIO_TRACK_SWITCHING,{id:R,groupId:E,name:O,type:x,url:w}),h.details&&!h.details.live)return;var T=this.switchParams(h.url,u==null?void 0:u.details);this.loadPlaylist(T)},s.selectInitialTrack=function(){var o=this.tracksInGroup;console.assert(o.length,"Initial audio track should be selected when tracks are known");var i=this.trackName,u=this.findTrackId(i)||this.findTrackId();u!==-1?this.setAudioTrack(u):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},s.findTrackId=function(o){for(var i=this.tracksInGroup,u=0;u<i.length;u++){var h=i[u];if((!this.selectDefaultTrack||h.default)&&(!o||o===h.name))return h.id}return-1},s.loadPlaylist=function(o){var i=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(i)){var u=i.id,h=i.groupId,R=i.url;if(o)try{R=o.addDirectives(R)}catch(S){this.warn("Could not construct new URL with HLS Delivery Directives: "+S)}this.log("loading audio-track playlist for id: "+u),this.clearTimer(),this.hls.trigger(z.Events.AUDIO_TRACK_LOADING,{url:R,id:u,groupId:h,deliveryDirectives:o||null})}},P(d,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1,this.setAudioTrack(o)}}]),d}(M.default);V.default=p},"./src/controller/base-playlist-controller.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"default",function(){return P});var z=D("./src/polyfills/number.ts"),U=D("./src/types/level.ts"),M=D("./src/controller/level-helper.ts"),W=D("./src/utils/logger.ts"),B=D("./src/errors.ts"),P=function(){function A(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=W.logger.log.bind(W.logger,f+":"),this.warn=W.logger.warn.bind(W.logger,f+":"),this.hls=p}var g=A.prototype;return g.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},g.onError=function(f,d){d.fatal&&d.type===B.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 o=s[c],i=""+o.URI;if(i===f.substr(-i.length)){var u=parseInt(o["LAST-MSN"]),h=parseInt(o["LAST-PART"]);if(d&&this.hls.config.lowLatencyMode){var R=Math.min(d.age-d.partTarget,d.targetduration);h!==void 0&&R>d.partTarget&&(h+=1)}if(Object(z.isFiniteNumber)(u))return new U.HlsUrlParameters(u,Object(z.isFiniteNumber)(h)?h:void 0,U.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,o=d.details,i=d.stats,u=i.loading.end?Math.max(0,self.performance.now()-i.loading.end):0;if(o.advancedDateTime=Date.now()-u,o.live||s!=null&&s.live){if(o.reloaded(s),s&&this.log("live playlist "+f+" "+(o.advanced?"REFRESHED "+o.lastPartSn+"-"+o.lastPartIndex:"MISSED")),s&&o.fragments.length>0&&Object(M.mergeDetails)(s,o),!this.canLoad||!o.live)return;var h,R=void 0,S=void 0;if(o.canBlockReload&&o.endSN&&o.advanced){var E=this.hls.config.lowLatencyMode,O=o.lastPartSn,x=o.endSN,w=o.lastPartIndex,T=w!==-1,_=O===x,l=E?0:w;T?(R=_?x+1:O,S=_?l:w+1):R=x+1;var b=o.age,m=b+o.ageHeader,y=Math.min(m-o.partTarget,o.targetduration*1.5);if(y>0){if(s&&y>s.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+s.tuneInGoal+" to: "+y+" with playlist age: "+o.age),y=0;else{var k=Math.floor(y/o.targetduration);if(R+=k,S!==void 0){var I=Math.round(y%o.targetduration/o.partTarget);S+=I}this.log("CDN Tune-in age: "+o.ageHeader+"s last advanced "+b.toFixed(2)+"s goal: "+y+" skip sn "+k+" to part "+S)}o.tuneInGoal=y}if(h=this.getDeliveryDirectives(o,d.deliveryDirectives,R,S),E||!_){this.loadPlaylist(h);return}}else h=this.getDeliveryDirectives(o,d.deliveryDirectives,R,S);var N=Object(M.computeReloadInterval)(o,i);R!==void 0&&o.canBlockReload&&(N-=o.partTarget||1),this.log("reload live playlist "+f+" in "+Math.round(N)+" ms"),this.timer=self.setTimeout(function(){return c.loadPlaylist(h)},N)}else this.clearTimer()},g.getDeliveryDirectives=function(f,d,s,c){var o=Object(U.getSkipValue)(f,s);return d!=null&&d.skip&&f.deltaUpdateFailed&&(s=d.msn,c=d.part,o=U.HlsSkip.No),new U.HlsUrlParameters(s,c,o)},g.retryLoadingOrFail=function(f){var d=this,s=this.hls.config,c=this.retryCount<s.levelLoadingMaxRetry;if(c){var o;if(this.retryCount++,f.details.indexOf("LoadTimeOut")>-1&&(o=f.context)!==null&&o!==void 0&&o.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+f.details+'"'),this.loadPlaylist();else{var i=Math.min(Math.pow(2,this.retryCount)*s.levelLoadingRetryDelay,s.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return d.loadPlaylist()},i),this.warn("retry playlist loading #"+this.retryCount+" in "+i+' ms after "'+f.details+'"')}}else this.warn('cannot recover from error "'+f.details+'"'),this.clearTimer(),f.fatal=!0;return c},A}()},"./src/controller/base-stream-controller.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"State",function(){return x}),D.d(V,"default",function(){return w});var z=D("./src/polyfills/number.ts"),U=D("./src/task-loop.ts"),M=D("./src/controller/fragment-tracker.ts"),W=D("./src/utils/buffer-helper.ts"),B=D("./src/utils/logger.ts"),P=D("./src/events.ts"),A=D("./src/errors.ts"),g=D("./src/types/transmuxer.ts"),p=D("./src/utils/mp4-tools.ts"),f=D("./src/utils/discontinuities.ts"),d=D("./src/controller/fragment-finders.ts"),s=D("./src/controller/level-helper.ts"),c=D("./src/loader/fragment-loader.ts"),o=D("./src/crypt/decrypter.ts"),i=D("./src/utils/time-ranges.ts"),u=D("./src/types/loader.ts");function h(T,_){for(var l=0;l<_.length;l++){var b=_[l];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(T,b.key,b)}}function R(T,_,l){return _&&h(T.prototype,_),l&&h(T,l),T}function S(T){if(T===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return T}function E(T,_){T.prototype=Object.create(_.prototype),T.prototype.constructor=T,O(T,_)}function O(T,_){return O=Object.setPrototypeOf||function(b,m){return b.__proto__=m,b},O(T,_)}var x={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){E(_,T);function _(b,m,y){var k;return k=T.call(this)||this,k.hls=void 0,k.fragPrevious=null,k.fragCurrent=null,k.fragmentTracker=void 0,k.transmuxer=null,k._state=x.STOPPED,k.media=void 0,k.mediaBuffer=void 0,k.config=void 0,k.bitrateTest=!1,k.lastCurrentTime=0,k.nextLoadPosition=0,k.startPosition=0,k.loadedmetadata=!1,k.fragLoadError=0,k.retryDate=0,k.levels=null,k.fragmentLoader=void 0,k.levelLastLoaded=null,k.startFragRequested=!1,k.decrypter=void 0,k.initPTS=[],k.onvseeking=null,k.onvended=null,k.logPrefix="",k.log=void 0,k.warn=void 0,k.logPrefix=y,k.log=B.logger.log.bind(B.logger,y+":"),k.warn=B.logger.warn.bind(B.logger,y+":"),k.hls=b,k.fragmentLoader=new c.default(b.config),k.fragmentTracker=m,k.config=b.config,k.decrypter=new o.default(b,b.config),b.on(P.Events.KEY_LOADED,k.onKeyLoaded,S(k)),k}var l=_.prototype;return l.doTick=function(){this.onTickEnd()},l.onTickEnd=function(){},l.startLoad=function(m){},l.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=x.STOPPED},l._streamEnded=function(m,y){var k=this.fragCurrent,I=this.fragmentTracker;if(!y.live&&k&&k.sn===y.endSN&&!m.nextStart){var N=I.getState(k);return N===M.FragmentState.PARTIAL||N===M.FragmentState.OK}return!1},l.onMediaAttached=function(m,y){var k=this.media=this.mediaBuffer=y.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),k.addEventListener("seeking",this.onvseeking),k.addEventListener("ended",this.onvended);var I=this.config;this.levels&&I.autoStartLoad&&this.state===x.STOPPED&&this.startLoad(I.startPosition)},l.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()},l.onMediaSeeking=function(){var m=this.config,y=this.fragCurrent,k=this.media,I=this.mediaBuffer,N=this.state,F=k?k.currentTime:0,C=W.BufferHelper.bufferInfo(I||k,F,m.maxBufferHole);if(this.log("media seeking to "+(Object(z.isFiniteNumber)(F)?F.toFixed(3):F)+", state: "+N),N===x.ENDED)this.resetLoadingState();else if(y&&!C.len){var v=m.maxFragLookUpTolerance,j=y.start-v,K=y.start+y.duration+v,J=F>K;(F<j||J)&&(J&&y.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),y.loader.abort()),this.resetLoadingState())}k&&(this.lastCurrentTime=F),!this.loadedmetadata&&!C.len&&(this.nextLoadPosition=this.startPosition=F),this.tickImmediate()},l.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},l.onKeyLoaded=function(m,y){if(this.state!==x.KEY_LOADING||y.frag!==this.fragCurrent||!this.levels)return;this.state=x.IDLE;var k=this.levels[y.frag.level].details;k&&this.loadFragment(y.frag,k,y.frag.start)},l.onHandlerDestroying=function(){this.stopLoad(),T.prototype.onHandlerDestroying.call(this)},l.onHandlerDestroyed=function(){this.state=x.STOPPED,this.hls.off(P.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)},l.loadKey=function(m,y){this.log("Loading key for "+m.sn+" of ["+y.startSN+"-"+y.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=x.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(P.Events.KEY_LOADING,{frag:m})},l.loadFragment=function(m,y,k){this._loadFragForPlayback(m,y,k)},l._loadFragForPlayback=function(m,y,k){var I=this,N=function(C){if(I.fragContextChanged(m)){I.warn("Fragment "+m.sn+(C.part?" p: "+C.part.index:"")+" of level "+m.level+" was dropped during download."),I.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,I._handleFragmentLoadProgress(C)};this._doFragLoad(m,y,k,N).then(function(F){if(!F)return;I.fragLoadError=0;var C=I.state;if(I.fragContextChanged(m)){(C===x.FRAG_LOADING||C===x.BACKTRACKING||!I.fragCurrent&&C===x.PARSING)&&(I.fragmentTracker.removeFragment(m),I.state=x.IDLE);return}if("payload"in F&&(I.log("Loaded fragment "+m.sn+" of level "+m.level),I.hls.trigger(P.Events.FRAG_LOADED,F),I.state===x.BACKTRACKING)){I.fragmentTracker.backtrack(m,F),I.resetFragmentLoading(m);return}I._handleFragmentLoadComplete(F)}).catch(function(F){I.warn(F),I.resetFragmentLoading(m)})},l.flushMainBuffer=function(m,y,k){if(k===void 0&&(k=null),!(m-y))return;var I={startOffset:m,endOffset:y,type:k};this.fragLoadError=0,this.hls.trigger(P.Events.BUFFER_FLUSHING,I)},l._loadInitSegment=function(m){var y=this;this._doFragLoad(m).then(function(k){if(!k||y.fragContextChanged(m)||!y.levels)throw new Error("init load aborted");return k}).then(function(k){var I=y.hls,N=k.payload,F=m.decryptdata;if(N&&N.byteLength>0&&F&&F.key&&F.iv&&F.method==="AES-128"){var C=self.performance.now();return y.decrypter.webCryptoDecrypt(new Uint8Array(N),F.key.buffer,F.iv.buffer).then(function(v){var j=self.performance.now();return I.trigger(P.Events.FRAG_DECRYPTED,{frag:m,payload:v,stats:{tstart:C,tdecrypt:j}}),k.payload=v,k})}return k}).then(function(k){var I=y.fragCurrent,N=y.hls,F=y.levels;if(!F)throw new Error("init load aborted, missing levels");var C=F[m.level].details;console.assert(C,"Level details are defined when init segment is loaded");var v=m.stats;y.state=x.IDLE,y.fragLoadError=0,m.data=new Uint8Array(k.payload),v.parsing.start=v.buffering.start=self.performance.now(),v.parsing.end=v.buffering.end=self.performance.now(),k.frag===I&&N.trigger(P.Events.FRAG_BUFFERED,{stats:v,frag:I,part:null,id:m.type}),y.tick()}).catch(function(k){y.warn(k),y.resetFragmentLoading(m)})},l.fragContextChanged=function(m){var y=this.fragCurrent;return!m||!y||m.level!==y.level||m.sn!==y.sn||m.urlId!==y.urlId},l.fragBufferedComplete=function(m,y){var k=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(y?" part: "+y.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+i.default.toString(W.BufferHelper.getBuffered(k))),this.state=x.IDLE,this.tick()},l._handleFragmentLoadComplete=function(m){var y=this.transmuxer;if(!y)return;var k=m.frag,I=m.part,N=m.partsLoaded,F=!N||N.length===0||N.some(function(v){return!v}),C=new g.ChunkMetadata(k.level,k.sn,k.stats.chunkCount+1,0,I?I.index:-1,!F);y.flush(C)},l._handleFragmentLoadProgress=function(m){},l._doFragLoad=function(m,y,k,I){var N=this;if(k===void 0&&(k=null),!this.levels)throw new Error("frag load aborted, missing levels");if(k=Math.max(m.start,k||0),this.config.lowLatencyMode&&y){var F=y.partList;if(F&&I){k>m.end&&y.fragmentHint&&(m=y.fragmentHint);var C=this.getNextPart(F,m,k);if(C>-1){var v=F[C];return this.log("Loading part sn: "+m.sn+" p: "+v.index+" cc: "+m.cc+" of playlist ["+y.startSN+"-"+y.endSN+"] parts [0-"+C+"-"+(F.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(k.toFixed(3))),this.nextLoadPosition=v.start+v.duration,this.state=x.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:m,part:F[C],targetBufferTime:k}),this.doFragPartsLoad(m,F,C,I).catch(function(j){return N.handleFragLoadError(j)})}else if(!m.url||this.loadedEndOfParts(F,k))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(y?"of ["+y.startSN+"-"+y.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(k.toFixed(3))),Object(z.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=x.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:m,targetBufferTime:k}),this.fragmentLoader.load(m,I).catch(function(j){return N.handleFragLoadError(j)})},l.doFragPartsLoad=function(m,y,k,I){var N=this;return new Promise(function(F,C){var v=[],j=function K(J){var te=y[J];N.fragmentLoader.loadPart(m,te,I).then(function(ve){v[te.index]=ve;var ue=ve.part;N.hls.trigger(P.Events.FRAG_LOADED,ve);var de=y[J+1];if(de&&de.fragment===m)K(J+1);else return F({frag:m,part:ue,partsLoaded:v})}).catch(C)};j(k)})},l.handleFragLoadError=function(m){var y=m.data;return y&&y.details===A.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(y.frag,y.part):this.hls.trigger(P.Events.ERROR,y),null},l._handleTransmuxerFlush=function(m){var y=this.getCurrentContext(m);if(!y||this.state!==x.PARSING){this.fragCurrent||(this.state=x.IDLE);return}var k=y.frag,I=y.part,N=y.level,F=self.performance.now();k.stats.parsing.end=F,I&&(I.stats.parsing.end=F),this.updateLevelTiming(k,I,N,m.partial)},l.getCurrentContext=function(m){var y=this.levels,k=m.level,I=m.sn,N=m.part;if(!y||!y[k])return this.warn("Levels object was unset while buffering fragment "+I+" of level "+k+". The current chunk will not be buffered."),null;var F=y[k],C=N>-1?Object(s.getPartWith)(F,I,N):null,v=C?C.fragment:Object(s.getFragmentWithSN)(F,I,this.fragCurrent);return v?{frag:v,part:C,level:F}:null},l.bufferFragmentData=function(m,y,k,I){if(!m||this.state!==x.PARSING)return;var N=m.data1,F=m.data2,C=N;if(N&&F&&(C=Object(p.appendUint8Array)(N,F)),!C||!C.length)return;var v={type:m.type,frag:y,part:k,chunkMeta:I,parent:y.type,data:C};this.hls.trigger(P.Events.BUFFER_APPENDING,v),m.dropped&&m.independent&&!k&&this.flushBufferGap(y)},l.flushBufferGap=function(m){var y=this.media;if(!y)return;if(!W.BufferHelper.isBuffered(y,y.currentTime)){this.flushMainBuffer(0,m.start);return}var k=y.currentTime,I=W.BufferHelper.bufferInfo(y,k,0),N=m.duration,F=Math.min(this.config.maxFragLookUpTolerance*2,N*.25),C=Math.max(Math.min(m.start-F,I.end-F),k+F);m.start-C>F&&this.flushMainBuffer(C,m.start)},l.getFwdBufferInfo=function(m,y){var k=this.config,I=this.getLoadPosition();if(!Object(z.isFiniteNumber)(I))return null;var N=W.BufferHelper.bufferInfo(m,I,k.maxBufferHole);if(N.len===0&&N.nextStart!==void 0){var F=this.fragmentTracker.getBufferedFrag(I,y);if(F&&N.nextStart<F.end)return W.BufferHelper.bufferInfo(m,I,Math.max(N.nextStart,k.maxBufferHole))}return N},l.getMaxBufferLength=function(m){var y=this.config,k;return m?k=Math.max(8*y.maxBufferSize/m,y.maxBufferLength):k=y.maxBufferLength,Math.min(k,y.maxMaxBufferLength)},l.reduceMaxBufferLength=function(m){var y=this.config,k=m||y.maxBufferLength;return y.maxMaxBufferLength>=k?(y.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+y.maxMaxBufferLength+"s"),!0):!1},l.getNextFragment=function(m,y){var k,I,N=y.fragments,F=N.length;if(!F)return null;var C=this.config,v=N[0].start,j;if(y.live){var K=C.initialLiveManifestSize;if(F<K)return this.warn("Not enough fragments to start playback (have: "+F+", need: "+K+")"),null;!y.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(j=this.getInitialLiveFragment(y,N),this.startPosition=j?this.hls.liveSyncPosition||j.start:m)}else m<=v&&(j=N[0]);if(!j){var J=C.lowLatencyMode?y.partEnd:y.fragmentEnd;j=this.getFragmentAtPosition(m,J,y)}return(k=j)!==null&&k!==void 0&&k.initSegment&&!((I=j)!==null&&I!==void 0&&I.initSegment.data)&&!this.bitrateTest&&(j=j.initSegment),j},l.getNextPart=function(m,y,k){for(var I=-1,N=!1,F=!0,C=0,v=m.length;C<v;C++){var j=m[C];if(F=F&&!j.independent,I>-1&&k<j.start)break;var K=j.loaded;!K&&(N||j.independent||F)&&j.fragment===y&&(I=C),N=K}return I},l.loadedEndOfParts=function(m,y){var k=m[m.length-1];return k&&y>k.start&&k.loaded},l.getInitialLiveFragment=function(m,y){var k=this.fragPrevious,I=null;if(k){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+k.programDateTime),I=Object(d.findFragmentByPDT)(y,k.endProgramDateTime,this.config.maxFragLookUpTolerance)),!I){var N=k.sn+1;if(N>=m.startSN&&N<=m.endSN){var F=y[N-m.startSN];k.cc===F.cc&&(I=F,this.log("Live playlist, switching playlist, load frag with next SN: "+I.sn))}I||(I=Object(d.findFragWithCC)(y,k.cc),I&&this.log("Live playlist, switching playlist, load frag with same CC: "+I.sn))}}else{var C=this.hls.liveSyncPosition;C!==null&&(I=this.getFragmentAtPosition(C,this.bitrateTest?m.fragmentEnd:m.edge,m))}return I},l.getFragmentAtPosition=function(m,y,k){var I=this.config,N=this.fragPrevious,F=k.fragments,C=k.endSN,v=k.fragmentHint,j=I.maxFragLookUpTolerance,K=!!(I.lowLatencyMode&&k.partList&&v);K&&v&&!this.bitrateTest&&(F=F.concat(v),C=v.sn);var J;if(m<y){var te=m>y-j?0:j;J=Object(d.findFragmentByPTS)(N,F,m,te)}else J=F[F.length-1];if(J){var ve=J.sn-k.startSN,ue=N&&J.level===N.level,de=F[ve+1],oe=this.fragmentTracker.getState(J);if(oe===M.FragmentState.BACKTRACKED){J=null;for(var me=ve;F[me]&&this.fragmentTracker.getState(F[me])===M.FragmentState.BACKTRACKED;)N?J=F[me--]:J=F[--me];J||(J=de)}else N&&J.sn===N.sn&&!K&&(ue&&(J.sn<C&&this.fragmentTracker.getState(de)!==M.FragmentState.OK?(this.log("SN "+J.sn+" just loaded, load next one: "+de.sn),J=de):J=null))}return J},l.synchronizeToLiveEdge=function(m){var y=this.config,k=this.media;if(!k)return;var I=this.hls.liveSyncPosition,N=k.currentTime,F=m.fragments[0].start,C=m.edge,v=N>=F-y.maxFragLookUpTolerance&&N<=C;if(I!==null&&k.duration>I&&(N<I||!v)){var j=y.liveMaxLatencyDuration!==void 0?y.liveMaxLatencyDuration:y.liveMaxLatencyDurationCount*m.targetduration;(!v&&k.readyState<4||N<C-j)&&(this.loadedmetadata||(this.nextLoadPosition=I),k.readyState&&(this.warn("Playback: "+N.toFixed(3)+" is located too far from the end of live sliding playlist: "+C+", reset currentTime to : "+I.toFixed(3)),k.currentTime=I))}},l.alignPlaylists=function(m,y){var k=this.levels,I=this.levelLastLoaded,N=this.fragPrevious,F=I!==null?k[I]:null,C=m.fragments.length;if(!C)return this.warn("No fragments in live playlist"),0;var v=m.fragments[0].start,j=!y,K=m.alignedSliding&&Object(z.isFiniteNumber)(v);if(j||!K&&!v){Object(f.alignStream)(N,F,m);var J=m.fragments[0].start;return this.log("Live playlist sliding: "+J.toFixed(2)+" start-sn: "+(y?y.startSN:"na")+"->"+m.startSN+" prev-sn: "+(N?N.sn:"na")+" fragments: "+C),J}return v},l.waitForCdnTuneIn=function(m){var y=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*y)},l.setStartPosition=function(m,y){var k=this.startPosition;if(k<y&&(k=-1),k===-1||this.lastCurrentTime===-1){var I=m.startTimeOffset;Object(z.isFiniteNumber)(I)?(k=y+I,I<0&&(k+=m.totalduration),k=Math.min(Math.max(y,k),y+m.totalduration),this.log("Start time offset "+I+" found in playlist, adjust startPosition to "+k),this.startPosition=k):m.live?k=this.hls.liveSyncPosition||y:this.startPosition=k=0,this.lastCurrentTime=k}this.nextLoadPosition=k},l.getLoadPosition=function(){var m=this.media,y=0;return this.loadedmetadata&&m?y=m.currentTime:this.nextLoadPosition&&(y=this.nextLoadPosition),y},l.handleFragLoadAborted=function(m,y){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(y?" part"+y.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},l.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=x.IDLE)},l.onFragmentOrKeyLoadError=function(m,y){if(y.fatal)return;var k=y.frag;if(!k||k.type!==m)return;var I=this.fragCurrent;console.assert(I&&k.sn===I.sn&&k.level===I.level&&k.urlId===I.urlId,"Frag load error must match current frag to retry");var N=this.config;if(this.fragLoadError+1<=N.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(k.level))return;var F=Math.min(Math.pow(2,this.fragLoadError)*N.fragLoadingRetryDelay,N.fragLoadingMaxRetryTimeout);this.warn("Fragment "+k.sn+" of "+m+" "+k.level+" failed to load, retrying in "+F+"ms"),this.retryDate=self.performance.now()+F,this.fragLoadError++,this.state=x.FRAG_LOADING_WAITING_RETRY}else y.levelRetry?(m===u.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=x.IDLE):(B.logger.error(y.details+" reaches max retry, redispatch as fatal ..."),y.fatal=!0,this.hls.stopLoad(),this.state=x.ERROR)},l.afterBufferFlushed=function(m,y,k){if(!m)return;var I=W.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(y,I,k),this.state===x.ENDED&&this.resetLoadingState()},l.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=x.IDLE},l.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var y=this.levels?this.levels[m].details:null;if(y!=null&&y.live)return this.startPosition=-1,this.setStartPosition(y,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},l.updateLevelTiming=function(m,y,k,I){var N=this,F=k.details;console.assert(!!F,"level.details must be defined");var C=Object.keys(m.elementaryStreams).reduce(function(v,j){var K=m.elementaryStreams[j];if(K){var J=K.endPTS-K.startPTS;if(J<=0)return N.warn("Could not parse fragment "+m.sn+" "+j+" duration reliably ("+J+") resetting transmuxer to fallback to playlist timing"),N.resetTransmuxer(),v||!1;var te=I?0:Object(s.updateFragPTSDTS)(F,m,K.startPTS,K.endPTS,K.startDTS,K.endDTS);return N.hls.trigger(P.Events.LEVEL_PTS_UPDATED,{details:F,level:k,drift:te,type:j,frag:m,start:K.startPTS,end:K.endPTS}),!0}return v},!1);C?(this.state=x.PARSED,this.hls.trigger(P.Events.FRAG_PARSED,{frag:m,part:y})):this.resetLoadingState()},l.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},R(_,[{key:"state",get:function(){return this._state},set:function(m){var y=this._state;y!==m&&(this._state=m,this.log(y+"->"+m))}}]),_}(U.default)},"./src/controller/buffer-controller.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"default",function(){return d});var z=D("./src/polyfills/number.ts"),U=D("./src/events.ts"),M=D("./src/utils/logger.ts"),W=D("./src/errors.ts"),B=D("./src/utils/buffer-helper.ts"),P=D("./src/utils/mediasource-helper.ts"),A=D("./src/loader/fragment.ts"),g=D("./src/controller/buffer-operation-queue.ts"),p=Object(P.getMediaSource)(),f=/([ha]vc.)(?:\.[^.,]+)+/,d=function(){function s(o){var i=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 u=i.hls,h=i.media,R=i.mediaSource;M.logger.log("[buffer-controller]: Media source opened"),h&&(i.updateMediaElementDuration(),u.trigger(U.Events.MEDIA_ATTACHED,{media:h})),R&&R.removeEventListener("sourceopen",i._onMediaSourceOpen),i.checkPendingTracks()},this._onMediaSourceClose=function(){M.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){M.logger.log("[buffer-controller]: Media source ended")},this.hls=o,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 i=this.hls;i.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(U.Events.BUFFER_RESET,this.onBufferReset,this),i.on(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),i.on(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),i.on(U.Events.BUFFER_EOS,this.onBufferEos,this),i.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),i.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),i.on(U.Events.FRAG_PARSED,this.onFragParsed,this),i.on(U.Events.FRAG_CHANGED,this.onFragChanged,this)},c.unregisterListeners=function(){var i=this.hls;i.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(U.Events.BUFFER_RESET,this.onBufferReset,this),i.off(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),i.off(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),i.off(U.Events.BUFFER_EOS,this.onBufferEos,this),i.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),i.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),i.off(U.Events.FRAG_PARSED,this.onFragParsed,this),i.off(U.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(i,u){var h=2;(u.audio&&!u.video||!u.altAudio)&&(h=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=h,this.details=null,M.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},c.onMediaAttaching=function(i,u){var h=this.media=u.media;if(h&&p){var R=this.mediaSource=new p;R.addEventListener("sourceopen",this._onMediaSourceOpen),R.addEventListener("sourceended",this._onMediaSourceEnded),R.addEventListener("sourceclose",this._onMediaSourceClose),h.src=self.URL.createObjectURL(R),this._objectUrl=h.src}},c.onMediaDetaching=function(){var i=this.media,u=this.mediaSource,h=this._objectUrl;if(u){if(M.logger.log("[buffer-controller]: media source detaching"),u.readyState==="open")try{u.endOfStream()}catch(R){M.logger.warn("[buffer-controller]: onMediaDetaching: "+R.message+" while calling endOfStream")}this.onBufferReset(),u.removeEventListener("sourceopen",this._onMediaSourceOpen),u.removeEventListener("sourceended",this._onMediaSourceEnded),u.removeEventListener("sourceclose",this._onMediaSourceClose),i&&(h&&self.URL.revokeObjectURL(h),i.src===h?(i.removeAttribute("src"),i.load()):M.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(U.Events.MEDIA_DETACHED,void 0)},c.onBufferReset=function(){var i=this;this.getSourceBufferTypes().forEach(function(u){var h=i.sourceBuffer[u];try{h&&(i.removeBufferListeners(u),i.mediaSource&&i.mediaSource.removeSourceBuffer(h),i.sourceBuffer[u]=void 0)}catch(R){M.logger.warn("[buffer-controller]: Failed to reset the "+u+" buffer",R)}}),this._initSourceBuffer()},c.onBufferCodecs=function(i,u){var h=this,R=this.getSourceBufferTypes().length;if(Object.keys(u).forEach(function(S){if(R){var E=h.tracks[S];if(E&&typeof E.buffer.changeType=="function"){var O=u[S],x=O.codec,w=O.levelCodec,T=O.container,_=(E.levelCodec||E.codec).replace(f,"$1"),l=(w||x).replace(f,"$1");if(_!==l){var b=T+";codecs="+(w||x);h.appendChangeType(S,b)}}}else h.pendingTracks[S]=u[S]}),R)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},c.appendChangeType=function(i,u){var h=this,R=this.operationQueue,S={execute:function(){var O=h.sourceBuffer[i];O&&(M.logger.log("[buffer-controller]: changing "+i+" sourceBuffer type to "+u),O.changeType(u)),R.shiftAndExecuteNext(i)},onStart:function(){},onComplete:function(){},onError:function(O){M.logger.warn("[buffer-controller]: Failed to change "+i+" SourceBuffer type",O)}};R.append(S,i)},c.onBufferAppending=function(i,u){var h=this,R=this.hls,S=this.operationQueue,E=this.tracks,O=u.data,x=u.type,w=u.frag,T=u.part,_=u.chunkMeta,l=_.buffering[x],b=self.performance.now();l.start=b;var m=w.stats.buffering,y=T?T.stats.buffering:null;m.start===0&&(m.start=b),y&&y.start===0&&(y.start=b);var k=E.audio,I=x==="audio"&&_.id===1&&(k==null?void 0:k.container)==="audio/mpeg",N={execute:function(){if(l.executeStart=self.performance.now(),I){var C=h.sourceBuffer[x];if(C){var v=w.start-C.timestampOffset;Math.abs(v)>=.1&&(M.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+w.start+" (delta: "+v+") sn: "+w.sn+")"),C.timestampOffset=w.start)}}h.appendExecutor(O,x)},onStart:function(){},onComplete:function(){var C=self.performance.now();l.executeEnd=l.end=C,m.first===0&&(m.first=C),y&&y.first===0&&(y.first=C);var v=h.sourceBuffer,j={};for(var K in v)j[K]=B.BufferHelper.getBuffered(v[K]);h.appendError=0,h.hls.trigger(U.Events.BUFFER_APPENDED,{type:x,frag:w,part:T,chunkMeta:_,parent:w.type,timeRanges:j})},onError:function(C){M.logger.error("[buffer-controller]: Error encountered while trying to append to the "+x+" SourceBuffer",C);var v={type:W.ErrorTypes.MEDIA_ERROR,parent:w.type,details:W.ErrorDetails.BUFFER_APPEND_ERROR,err:C,fatal:!1};C.code===DOMException.QUOTA_EXCEEDED_ERR?v.details=W.ErrorDetails.BUFFER_FULL_ERROR:(h.appendError++,v.details=W.ErrorDetails.BUFFER_APPEND_ERROR,h.appendError>R.config.appendErrorMaxRetry&&(M.logger.error("[buffer-controller]: Failed "+R.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),v.fatal=!0)),R.trigger(U.Events.ERROR,v)}};S.append(N,x)},c.onBufferFlushing=function(i,u){var h=this,R=this.operationQueue,S=function(O){return{execute:h.removeExecutor.bind(h,O,u.startOffset,u.endOffset),onStart:function(){},onComplete:function(){h.hls.trigger(U.Events.BUFFER_FLUSHED,{type:O})},onError:function(w){M.logger.warn("[buffer-controller]: Failed to remove from "+O+" SourceBuffer",w)}}};u.type?R.append(S(u.type),u.type):this.getSourceBufferTypes().forEach(function(E){R.append(S(E),E)})},c.onFragParsed=function(i,u){var h=this,R=u.frag,S=u.part,E=[],O=S?S.elementaryStreams:R.elementaryStreams;O[A.ElementaryStreamTypes.AUDIOVIDEO]?E.push("audiovideo"):(O[A.ElementaryStreamTypes.AUDIO]&&E.push("audio"),O[A.ElementaryStreamTypes.VIDEO]&&E.push("video"));var x=function(){var T=self.performance.now();R.stats.buffering.end=T,S&&(S.stats.buffering.end=T);var _=S?S.stats:R.stats;h.hls.trigger(U.Events.FRAG_BUFFERED,{frag:R,part:S,stats:_,id:R.type})};E.length===0&&M.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+R.type+" level: "+R.level+" sn: "+R.sn),this.blockBuffers(x,E)},c.onFragChanged=function(i,u){this.flushBackBuffer()},c.onBufferEos=function(i,u){var h=this,R=this.getSourceBufferTypes().reduce(function(S,E){var O=h.sourceBuffer[E];return(!u.type||u.type===E)&&(O&&!O.ended&&(O.ended=!0,M.logger.log("[buffer-controller]: "+E+" sourceBuffer now EOS"))),S&&!!(!O||O.ended)},!0);R&&this.blockBuffers(function(){var S=h.mediaSource;if(!S||S.readyState!=="open")return;S.endOfStream()})},c.onLevelUpdated=function(i,u){var h=u.details;if(!h.fragments.length)return;this.details=h,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},c.flushBackBuffer=function(){var i=this.hls,u=this.details,h=this.media,R=this.sourceBuffer;if(!h||u===null)return;var S=this.getSourceBufferTypes();if(!S.length)return;var E=u.live&&i.config.liveBackBufferLength!==null?i.config.liveBackBufferLength:i.config.backBufferLength;if(!Object(z.isFiniteNumber)(E)||E<0)return;var O=h.currentTime,x=u.levelTargetDuration,w=Math.max(E,x),T=Math.floor(O/x)*x-w;S.forEach(function(_){var l=R[_];if(l){var b=B.BufferHelper.getBuffered(l);b.length>0&&T>b.start(0)&&(i.trigger(U.Events.BACK_BUFFER_REACHED,{bufferEnd:T}),u.live&&i.trigger(U.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:T}),i.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:T,type:_}))}})},c.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var i=this.details,u=this.hls,h=this.media,R=this.mediaSource,S=i.fragments[0].start+i.totalduration,E=h.duration,O=Object(z.isFiniteNumber)(R.duration)?R.duration:0;i.live&&u.config.liveDurationInfinity?(M.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),R.duration=Infinity,this.updateSeekableRange(i)):(S>O&&S>E||!Object(z.isFiniteNumber)(E))&&(M.logger.log("[buffer-controller]: Updating Media Source duration to "+S.toFixed(3)),R.duration=S)},c.updateSeekableRange=function(i){var u=this.mediaSource,h=i.fragments,R=h.length;if(R&&i.live&&u!==null&&u!==void 0&&u.setLiveSeekableRange){var S=Math.max(0,h[0].start),E=Math.max(S,S+i.totalduration);u.setLiveSeekableRange(S,E)}},c.checkPendingTracks=function(){var i=this.bufferCodecEventsExpected,u=this.operationQueue,h=this.pendingTracks,R=Object.keys(h).length;if(R&&!i||R===2){this.createSourceBuffers(h),this.pendingTracks={};var S=this.getSourceBufferTypes();if(S.length===0){this.hls.trigger(U.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}S.forEach(function(E){u.executeNext(E)})}},c.createSourceBuffers=function(i){var u=this.sourceBuffer,h=this.mediaSource;if(!h)throw Error("createSourceBuffers called when mediaSource was null");var R=0;for(var S in i)if(!u[S]){var E=i[S];if(!E)throw Error("source buffer exists for track "+S+", however track does not");var O=E.levelCodec||E.codec,x=E.container+";codecs="+O;M.logger.log("[buffer-controller]: creating sourceBuffer("+x+")");try{var w=u[S]=h.addSourceBuffer(x),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:E.container,levelCodec:E.levelCodec,id:E.id},R++}catch(_){M.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+_.message),this.hls.trigger(U.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:_,mimeType:x})}}R&&this.hls.trigger(U.Events.BUFFER_CREATED,{tracks:this.tracks})},c._onSBUpdateStart=function(i){var u=this.operationQueue,h=u.current(i);h.onStart()},c._onSBUpdateEnd=function(i){var u=this.operationQueue,h=u.current(i);h.onComplete(),u.shiftAndExecuteNext(i)},c._onSBUpdateError=function(i,u){M.logger.error("[buffer-controller]: "+i+" SourceBuffer error",u),this.hls.trigger(U.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var h=this.operationQueue.current(i);h&&h.onError(u)},c.removeExecutor=function(i,u,h){var R=this.media,S=this.mediaSource,E=this.operationQueue,O=this.sourceBuffer,x=O[i];if(!R||!S||!x){M.logger.warn("[buffer-controller]: Attempting to remove from the "+i+" SourceBuffer, but it does not exist"),E.shiftAndExecuteNext(i);return}var w=Object(z.isFiniteNumber)(R.duration)?R.duration:Infinity,T=Object(z.isFiniteNumber)(S.duration)?S.duration:Infinity,_=Math.max(0,u),l=Math.min(h,w,T);l>_?(M.logger.log("[buffer-controller]: Removing ["+_+","+l+"] from the "+i+" SourceBuffer"),console.assert(!x.updating,i+" sourceBuffer must not be updating"),x.remove(_,l)):E.shiftAndExecuteNext(i)},c.appendExecutor=function(i,u){var h=this.operationQueue,R=this.sourceBuffer,S=R[u];if(!S){M.logger.warn("[buffer-controller]: Attempting to append to the "+u+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(u);return}S.ended=!1,console.assert(!S.updating,u+" sourceBuffer must not be updating"),S.appendBuffer(i)},c.blockBuffers=function(i,u){var h=this;if(u===void 0&&(u=this.getSourceBufferTypes()),!u.length){M.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(i);return}var R=this.operationQueue,S=u.map(function(E){return R.appendBlocker(E)});Promise.all(S).then(function(){i(),u.forEach(function(E){var O=h.sourceBuffer[E];(!O||!O.updating)&&R.shiftAndExecuteNext(E)})})},c.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},c.addBufferListener=function(i,u,h){var R=this.sourceBuffer[i];if(!R)return;var S=h.bind(this,i);this.listeners[i].push({event:u,listener:S}),R.addEventListener(u,S)},c.removeBufferListeners=function(i){var u=this.sourceBuffer[i];if(!u)return;this.listeners[i].forEach(function(h){u.removeEventListener(h.event,h.listener)})},s}()},"./src/controller/buffer-operation-queue.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"default",function(){return U});var z=D("./src/utils/logger.ts"),U=function(){function M(B){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=B}var W=M.prototype;return W.append=function(P,A){var g=this.queues[A];g.push(P),g.length===1&&this.buffers[A]&&this.executeNext(A)},W.insertAbort=function(P,A){var g=this.queues[A];g.unshift(P),this.executeNext(A)},W.appendBlocker=function(P){var A,g=new Promise(function(f){A=f}),p={execute:A,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(p,P),g},W.executeNext=function(P){var A=this.buffers,g=this.queues,p=A[P],f=g[P];if(f.length){var d=f[0];try{d.execute()}catch(s){z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),d.onError(s),(!p||!p.updating)&&(f.shift(),this.executeNext(P))}}},W.shiftAndExecuteNext=function(P){this.queues[P].shift(),this.executeNext(P)},W.current=function(P){return this.queues[P][0]},M}()},"./src/controller/cap-level-controller.ts":function(re,V,D){"use strict";D.r(V);var z=D("./src/events.ts");function U(B,P){for(var A=0;A<P.length;A++){var g=P[A];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(B,g.key,g)}}function M(B,P,A){return P&&U(B.prototype,P),A&&U(B,A),B}var W=function(){function B(A){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=A,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var P=B.prototype;return P.setStreamController=function(g){this.streamController=g},P.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},P.registerListeners=function(){var g=this.hls;g.on(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.on(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.unregisterListener=function(){var g=this.hls;g.off(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.off(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.onFpsDropLevelCapping=function(g,p){B.isLevelAllowed(p.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(p.droppedLevel)},P.onMediaAttaching=function(g,p){this.media=p.media instanceof HTMLVideoElement?p.media:null},P.onManifestParsed=function(g,p){var f=this.hls;this.restrictedLevels=[],this.firstLevel=p.firstLevel,f.config.capLevelToPlayerSize&&p.video&&this.startCapping()},P.onBufferCodecs=function(g,p){var f=this.hls;f.config.capLevelToPlayerSize&&p.video&&this.startCapping()},P.onMediaDetaching=function(){this.stopCapping()},P.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}}},P.getMaxLevel=function(g){var p=this,f=this.hls.levels;if(!f.length)return-1;var d=f.filter(function(s,c){return B.isLevelAllowed(c,p.restrictedLevels)&&c<=g});return this.clientRect=null,B.getMaxLevelByMediaSize(d,this.mediaWidth,this.mediaHeight)},P.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()},P.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},P.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},B.isLevelAllowed=function(g,p){return p===void 0&&(p=[]),p.indexOf(g)===-1},B.getMaxLevelByMediaSize=function(g,p,f){if(!g||!g.length)return-1;for(var d=function(u,h){return h?u.width!==h.width||u.height!==h.height:!0},s=g.length-1,c=0;c<g.length;c+=1){var o=g[c];if((o.width>=p||o.height>=f)&&d(o,g[c+1])){s=c;break}}return s},M(B,[{key:"mediaWidth",get:function(){return this.getDimensions().width*B.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*B.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var g=1;try{g=self.devicePixelRatio}catch(p){}return g}}]),B}();V.default=W},"./src/controller/cmcd-controller.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"default",function(){return d});var z=D("./src/events.ts"),U=D("./src/types/cmcd.ts"),M=D("./src/utils/buffer-helper.ts"),W=D("./src/utils/logger.ts");function B(s,c){for(var o=0;o<c.length;o++){var i=c[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(s,i.key,i)}}function P(s,c,o){return c&&B(s.prototype,c),o&&B(s,o),s}function A(s,c){var o=typeof Symbol!="undefined"&&s[Symbol.iterator]||s["@@iterator"];if(o)return(o=o.call(s)).next.bind(o);if(Array.isArray(s)||(o=g(s))||c&&s&&typeof s.length=="number"){o&&(s=o);var i=0;return function(){return i>=s.length?{done:!0}:{done:!1,value:s[i++]}}}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 o=Object.prototype.toString.call(s).slice(8,-1);if(o==="Object"&&s.constructor&&(o=s.constructor.name),o==="Map"||o==="Set")return Array.from(s);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return p(s,c)}function p(s,c){(c==null||c>s.length)&&(c=s.length);for(var o=0,i=new Array(c);o<c;o++)i[o]=s[o];return i}function f(){return f=Object.assign||function(s){for(var c=1;c<arguments.length;c++){var o=arguments[c];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(s[i]=o[i])}return s},f.apply(this,arguments)}var d=function(){function s(o){var i=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(){i.initialized&&(i.starved=!0),i.buffering=!0},this.onPlaying=function(){i.initialized||(i.initialized=!0),i.buffering=!1},this.applyPlaylistData=function(R){try{i.apply(R,{ot:U.CMCDObjectType.MANIFEST,su:!i.initialized})}catch(S){W.logger.warn("Could not generate manifest CMCD data.",S)}},this.applyFragmentData=function(R){try{var S=R.frag,E=i.hls.levels[S.level],O=i.getObjectType(S),x={d:S.duration*1e3,ot:O};(O===U.CMCDObjectType.VIDEO||O===U.CMCDObjectType.AUDIO||O==U.CMCDObjectType.MUXED)&&(x.br=E.bitrate/1e3,x.tb=i.getTopBandwidth(O),x.bl=i.getBufferLength(O)),i.apply(R,x)}catch(w){W.logger.warn("Could not generate segment CMCD data.",w)}},this.hls=o;var u=this.config=o.config,h=u.cmcd;h!=null&&(u.pLoader=this.createPlaylistLoader(),u.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 i=this.hls;i.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.on(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),i.on(z.Events.BUFFER_CREATED,this.onBufferCreated,this)},c.unregisterListeners=function(){var i=this.hls;i.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.off(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),i.off(z.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(i,u){this.media=u.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(i,u){var h,R;this.audioBuffer=(h=u.tracks.audio)===null||h===void 0?void 0:h.buffer,this.videoBuffer=(R=u.tracks.video)===null||R===void 0?void 0:R.buffer},c.createData=function(){var i;return{v:U.CMCDVersion,sf:U.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(i=this.media)===null||i===void 0?void 0:i.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},c.apply=function(i,u){u===void 0&&(u={}),f(u,this.createData());var h=u.ot===U.CMCDObjectType.INIT||u.ot===U.CMCDObjectType.VIDEO||u.ot===U.CMCDObjectType.MUXED;if(this.starved&&h&&(u.bs=!0,u.su=!0,this.starved=!1),u.su==null&&(u.su=this.buffering),this.useHeaders){var R=s.toHeaders(u);if(!Object.keys(R).length)return;i.headers||(i.headers={}),f(i.headers,R)}else{var S=s.toQuery(u);if(!S)return;i.url=s.appendQueryToUri(i.url,S)}},c.getObjectType=function(i){var u=i.type;return u==="subtitle"?U.CMCDObjectType.TIMED_TEXT:i.sn==="initSegment"?U.CMCDObjectType.INIT:u==="audio"?U.CMCDObjectType.AUDIO:u==="main"?this.hls.audioTracks.length?U.CMCDObjectType.VIDEO:U.CMCDObjectType.MUXED:void 0},c.getTopBandwidth=function(i){for(var u=0,h=i===U.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,R=A(h),S;!(S=R()).done;){var E=S.value;E.bitrate>u&&(u=E.bitrate)}return u>0?u:NaN},c.getBufferLength=function(i){var u=this.hls.media,h=i===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!h||!u)return NaN;var R=M.BufferHelper.bufferInfo(h,u.currentTime,this.config.maxBufferHole);return R.len*1e3},c.createPlaylistLoader=function(){var i=this.config.pLoader,u=this.applyPlaylistData,h=i||this.config.loader;return function(){function R(E){this.loader=void 0,this.loader=new h(E)}var S=R.prototype;return S.destroy=function(){this.loader.destroy()},S.abort=function(){this.loader.abort()},S.load=function(O,x,w){u(O),this.loader.load(O,x,w)},P(R,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),R}()},c.createFragmentLoader=function(){var i=this.config.fLoader,u=this.applyFragmentData,h=i||this.config.loader;return function(){function R(E){this.loader=void 0,this.loader=new h(E)}var S=R.prototype;return S.destroy=function(){this.loader.destroy()},S.abort=function(){this.loader.abort()},S.load=function(O,x,w){u(O),this.loader.load(O,x,w)},P(R,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),R}()},s.uuid=function(){var i=URL.createObjectURL(new Blob),u=i.toString();return URL.revokeObjectURL(i),u.substr(u.lastIndexOf("/")+1)},s.serialize=function(i){for(var u=[],h=function(I){return!Number.isNaN(I)&&I!=null&&I!==""&&I!==!1},R=function(I){return Math.round(I)},S=function(I){return R(I/100)*100},E=function(I){return encodeURIComponent(I)},O={br:R,d:R,bl:S,dl:S,mtp:S,nor:E,rtp:S,tb:R},x=Object.keys(i||{}).sort(),w=A(x),T;!(T=w()).done;){var _=T.value,l=i[_];if(!h(l))continue;if(_==="v"&&l===1)continue;if(_=="pr"&&l===1)continue;var b=O[_];b&&(l=b(l));var m=typeof l,y=void 0;_==="ot"||_==="sf"||_==="st"?y=_+"="+l:m==="boolean"?y=_:m==="number"?y=_+"="+l:y=_+"="+JSON.stringify(l),u.push(y)}return u.join(",")},s.toHeaders=function(i){for(var u=Object.keys(i),h={},R=["Object","Request","Session","Status"],S=[{},{},{},{}],E={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,x=u;O<x.length;O++){var w=x[O],T=E[w]!=null?E[w]:1;S[T][w]=i[w]}for(var _=0;_<S.length;_++){var l=s.serialize(S[_]);l&&(h["CMCD-"+R[_]]=l)}return h},s.toQuery=function(i){return"CMCD="+encodeURIComponent(s.serialize(i))},s.appendQueryToUri=function(i,u){if(!u)return i;var h=i.includes("?")?"&":"?";return""+i+h+u},s}()},"./src/controller/eme-controller.ts":function(re,V,D){"use strict";D.r(V);var z=D("./src/events.ts"),U=D("./src/errors.ts"),M=D("./src/utils/logger.ts"),W=D("./src/utils/mediakeys-helper.ts");function B(d,s){for(var c=0;c<s.length;c++){var o=s[c];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(d,o.key,o)}}function P(d,s,c){return s&&B(d.prototype,s),c&&B(d,c),d}var A=3,g=function(s,c,o){var i={audioCapabilities:[],videoCapabilities:[]};return s.forEach(function(u){i.audioCapabilities.push({contentType:'audio/mp4; codecs="'+u+'"',robustness:o.audioRobustness||""})}),c.forEach(function(u){i.videoCapabilities.push({contentType:'video/mp4; codecs="'+u+'"',robustness:o.videoRobustness||""})}),[i]},p=function(s,c,o,i){switch(s){case W.KeySystems.WIDEVINE:return g(c,o,i);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(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},s._unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},s.getLicenseServerUrl=function(o){switch(o){case W.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+o+'"')},s._attemptKeySystemAccess=function(o,i,u){var h=this,R=p(o,i,u,this._drmSystemOptions);M.logger.log("Requesting encrypted media key-system access");var S=this.requestMediaKeySystemAccess(o,R);this.mediaKeysPromise=S.then(function(E){return h._onMediaKeySystemAccessObtained(o,E)}),S.catch(function(E){M.logger.error('Failed to obtain key-system "'+o+'" access:',E)})},s._onMediaKeySystemAccessObtained=function(o,i){var u=this;M.logger.log('Access for key-system "'+o+'" obtained');var h={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:i,mediaKeySystemDomain:o};this._mediaKeysList.push(h);var R=Promise.resolve().then(function(){return i.createMediaKeys()}).then(function(S){return h.mediaKeys=S,M.logger.log('Media-keys created for key-system "'+o+'"'),u._onMediaKeysCreated(),S});return R.catch(function(S){M.logger.error("Failed to create media-keys:",S)}),R},s._onMediaKeysCreated=function(){var o=this;this._mediaKeysList.forEach(function(i){i.mediaKeysSession||(i.mediaKeysSession=i.mediaKeys.createSession(),o._onNewMediaKeySession(i.mediaKeysSession))})},s._onNewMediaKeySession=function(o){var i=this;M.logger.log("New key-system session "+o.sessionId),o.addEventListener("message",function(u){i._onKeySessionMessage(o,u.message)},!1)},s._onKeySessionMessage=function(o,i){M.logger.log("Got EME message event, creating license request"),this._requestLicense(i,function(u){M.logger.log("Received license data (length: "+(u&&u.byteLength)+"), updating key-session"),o.update(u)})},s.onMediaEncrypted=function(o){var i=this;if(M.logger.log('Media is encrypted using "'+o.initDataType+'" init data type'),!this.mediaKeysPromise){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var u=function(R){if(!i._media)return;i._attemptSetMediaKeys(R),i._generateRequestWithPreferredKeySession(o.initDataType,o.initData)};this.mediaKeysPromise.then(u).catch(u)},s._attemptSetMediaKeys=function(o){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var i=this._mediaKeysList[0];if(!i||!i.mediaKeys){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}M.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(i.mediaKeys),this._hasSetMediaKeys=!0}},s._generateRequestWithPreferredKeySession=function(o,i){var u=this,h=this._mediaKeysList[0];if(!h){M.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(h.mediaKeysSessionInitialized){M.logger.warn("Key-Session already initialized but requested again");return}var R=h.mediaKeysSession;if(!R){M.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!i){M.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}M.logger.log('Generating key-session request for "'+o+'" init data type'),h.mediaKeysSessionInitialized=!0,R.generateRequest(o,i).then(function(){M.logger.debug("Key-session generation succeeded")}).catch(function(S){M.logger.error("Error generating key-session request:",S),u.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},s._createLicenseXhr=function(o,i,u){var h=new XMLHttpRequest;h.responseType="arraybuffer",h.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,h,o,i,u);var R=this._licenseXhrSetup;if(R)try{R.call(this.hls,h,o),R=void 0}catch(S){M.logger.error(S)}try{h.readyState||h.open("POST",o,!0),R&&R.call(this.hls,h,o)}catch(S){throw new Error("issue setting up KeySystem license XHR "+S)}return h},s._onLicenseRequestReadyStageChange=function(o,i,u,h){switch(o.readyState){case 4:if(o.status===200){this._requestLicenseFailureCount=0,M.logger.log("License request succeeded");var R=o.response,S=this._licenseResponseCallback;if(S)try{R=S.call(this.hls,o,i)}catch(O){M.logger.error(O)}h(R)}else{if(M.logger.error("License Request XHR failed ("+i+"). Status: "+o.status+" ("+o.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>A){this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var E=A-this._requestLicenseFailureCount+1;M.logger.warn("Retrying license request, "+E+" attempts left"),this._requestLicense(u,h)}break}},s._generateLicenseRequestChallenge=function(o,i){switch(o.mediaKeySystemDomain){case W.KeySystems.WIDEVINE:return i}throw new Error("unsupported key-system: "+o.mediaKeySystemDomain)},s._requestLicense=function(o,i){M.logger.log("Requesting content license for key-system");var u=this._mediaKeysList[0];if(!u){M.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var h=this.getLicenseServerUrl(u.mediaKeySystemDomain),R=this._createLicenseXhr(h,o,i);M.logger.log("Sending license request to URL: "+h);var S=this._generateLicenseRequestChallenge(u,o);R.send(S)}catch(E){M.logger.error("Failure requesting DRM license: "+E),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},s.onMediaAttached=function(o,i){if(!this._emeEnabled)return;var u=i.media;this._media=u,u.addEventListener("encrypted",this._onMediaEncrypted)},s.onMediaDetached=function(){var o=this._media,i=this._mediaKeysList;if(!o)return;o.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(i.map(function(u){if(u.mediaKeysSession)return u.mediaKeysSession.close().catch(function(){})})).then(function(){return o.setMediaKeys(null)}).catch(function(){})},s.onManifestParsed=function(o,i){if(!this._emeEnabled)return;var u=i.levels.map(function(R){return R.audioCodec}).filter(function(R){return!!R}),h=i.levels.map(function(R){return R.videoCodec}).filter(function(R){return!!R});this._attemptKeySystemAccess(W.KeySystems.WIDEVINE,u,h)},P(d,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),d}();V.default=f},"./src/controller/fps-controller.ts":function(re,V,D){"use strict";D.r(V);var z=D("./src/events.ts"),U=D("./src/utils/logger.ts"),M=function(){function W(P){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=P,this.registerListeners()}var B=W.prototype;return B.setStreamController=function(A){this.streamController=A},B.registerListeners=function(){this.hls.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},B.unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},B.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},B.onMediaAttaching=function(A,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)}},B.checkFPS=function(A,g,p){var f=performance.now();if(g){if(this.lastTime){var d=f-this.lastTime,s=p-this.lastDroppedFrames,c=g-this.lastDecodedFrames,o=1e3*s/d,i=this.hls;if(i.trigger(z.Events.FPS_DROP,{currentDropped:s,currentDecoded:c,totalDroppedFrames:p}),o>0&&s>i.config.fpsDroppedMonitoringThreshold*c){var u=i.currentLevel;U.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(i.autoLevelCapping===-1||i.autoLevelCapping>=u)&&(u=u-1,i.trigger(z.Events.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:i.currentLevel}),i.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=f,this.lastDroppedFrames=p,this.lastDecodedFrames=g}},B.checkFPSInterval=function(){var A=this.media;if(A)if(this.isVideoPlaybackQualityAvailable){var g=A.getVideoPlaybackQuality();this.checkFPS(A,g.totalVideoFrames,g.droppedVideoFrames)}else this.checkFPS(A,A.webkitDecodedFrameCount,A.webkitDroppedFrameCount)},W}();V.default=M},"./src/controller/fragment-finders.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"findFragmentByPDT",function(){return M}),D.d(V,"findFragmentByPTS",function(){return W}),D.d(V,"fragmentWithinToleranceTest",function(){return B}),D.d(V,"pdtWithinToleranceTest",function(){return P}),D.d(V,"findFragWithCC",function(){return A});var z=D("./src/polyfills/number.ts"),U=D("./src/utils/binary-search.ts");function M(g,p,f){if(p===null||!Array.isArray(g)||!g.length||!Object(z.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 o=g[c];if(P(p,f,o))return o}return null}function W(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&&B(f,d,s)===0)return s;var c=U.default.search(p,B.bind(null,f,d));return c||s}function B(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 P(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 A(g,p){return U.default.search(g,function(f){return f.cc<p?1:f.cc>p?-1:0})}},"./src/controller/fragment-tracker.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"FragmentState",function(){return M}),D.d(V,"FragmentTracker",function(){return W});var z=D("./src/events.ts"),U=D("./src/types/loader.ts"),M;(function(A){A.NOT_LOADED="NOT_LOADED",A.BACKTRACKED="BACKTRACKED",A.APPENDING="APPENDING",A.PARTIAL="PARTIAL",A.OK="OK"})(M||(M={}));var W=function(){function A(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=A.prototype;return g._registerListeners=function(){var f=this.hls;f.on(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),f.on(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.on(z.Events.FRAG_LOADED,this.onFragLoaded,this)},g._unregisterListeners=function(){var f=this.hls;f.off(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),f.off(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.off(z.Events.FRAG_LOADED,this.onFragLoaded,this)},g.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},g.getAppendedFrag=function(f,d){if(d===U.PlaylistLevelType.MAIN){var s=this.activeFragment,c=this.activeParts;if(!s)return null;if(c)for(var o=c.length;o--;){var i=c[o],u=i?i.end:s.appendedPTS;if(i.start<=f&&u!==void 0&&f<=u)return o>9&&(this.activeParts=c.slice(o-9)),i}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),o=c.length;o--;){var i=s[c[o]];if((i==null?void 0:i.body.type)===d&&i.buffered){var u=i.body;if(u.start<=f&&f<=u.end)return u}}return null},g.detectEvictedFragments=function(f,d,s){var c=this;Object.keys(this.fragments).forEach(function(o){var i=c.fragments[o];if(!i)return;if(!i.buffered){i.body.type===s&&c.removeFragment(i.body);return}var u=i.range[f];if(!u)return;u.time.some(function(h){var R=!c.isTimeBuffered(h.startPTS,h.endPTS,d);return R&&c.removeFragment(i.body),R})})},g.detectPartialFragments=function(f){var d=this,s=this.timeRanges,c=f.frag,o=f.part;if(!s||c.sn==="initSegment")return;var i=P(c),u=this.fragments[i];if(!u)return;Object.keys(s).forEach(function(h){var R=c.elementaryStreams[h];if(!R)return;var S=s[h],E=o!==null||R.partial===!0;u.range[h]=d.getBufferedTimes(c,o,E,S)}),u.backtrack=u.loaded=null,Object.keys(u.range).length?u.buffered=!0:this.removeFragment(u.body)},g.fragBuffered=function(f){var d=P(f),s=this.fragments[d];s&&(s.backtrack=s.loaded=null,s.buffered=!0)},g.getBufferedTimes=function(f,d,s,c){for(var o={time:[],partial:s},i=d?d.start:f.start,u=d?d.end:f.end,h=f.minEndPTS||u,R=f.maxStartPTS||i,S=0;S<c.length;S++){var E=c.start(S)-this.bufferPadding,O=c.end(S)+this.bufferPadding;if(R>=E&&h<=O){o.time.push({startPTS:Math.max(i,c.start(S)),endPTS:Math.min(u,c.end(S))});break}else if(i<O&&u>E)o.partial=!0,o.time.push({startPTS:Math.max(i,c.start(S)),endPTS:Math.min(u,c.end(S))});else if(u<=E)break}return o},g.getPartialFragment=function(f){var d=null,s,c,o,i=0,u=this.bufferPadding,h=this.fragments;return Object.keys(h).forEach(function(R){var S=h[R];if(!S)return;B(S)&&(c=S.body.start-u,o=S.body.end+u,f>=c&&f<=o&&(s=Math.min(f-c,o-f),i<=s&&(d=S.body,i=s)))}),d},g.getState=function(f){var d=P(f),s=this.fragments[d];return s?s.buffered?B(s)?M.PARTIAL:M.OK:s.backtrack?M.BACKTRACKED:M.APPENDING:M.NOT_LOADED},g.backtrack=function(f,d){var s=P(f),c=this.fragments[s];if(!c||c.backtrack)return null;var o=c.backtrack=d||c.loaded;return c.loaded=null,o},g.getBacktrackData=function(f){var d=P(f),s=this.fragments[d];if(s){var c,o=s.backtrack;if(o!=null&&(c=o.payload)!==null&&c!==void 0&&c.byteLength)return o;this.removeFragment(f)}return null},g.isTimeBuffered=function(f,d,s){for(var c,o,i=0;i<s.length;i++){if(c=s.start(i)-this.bufferPadding,o=s.end(i)+this.bufferPadding,f>=c&&d<=o)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 o=P(s);this.fragments[o]={body:s,loaded:d,backtrack:null,buffered:!1,range:Object.create(null)}},g.onBufferAppended=function(f,d){var s=this,c=d.frag,o=d.part,i=d.timeRanges;if(c.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=c,o){var u=this.activeParts;u||(this.activeParts=u=[]),u.push(o)}else this.activeParts=null;this.timeRanges=i,Object.keys(i).forEach(function(h){var R=i[h];if(s.detectEvictedFragments(h,R),!o)for(var S=0;S<R.length;S++)c.appendedPTS=Math.max(R.end(S),c.appendedPTS||0)})},g.onFragBuffered=function(f,d){this.detectPartialFragments(d)},g.hasFragment=function(f){var d=P(f);return!!this.fragments[d]},g.removeFragmentsInRange=function(f,d,s){var c=this;Object.keys(this.fragments).forEach(function(o){var i=c.fragments[o];if(!i)return;if(i.buffered){var u=i.body;u.type===s&&u.start<d&&u.end>f&&c.removeFragment(u)}})},g.removeFragment=function(f){var d=P(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},A}();function B(A){var g,p;return A.buffered&&(((g=A.range.video)===null||g===void 0?void 0:g.partial)||((p=A.range.audio)===null||p===void 0?void 0:p.partial))}function P(A){return A.type+"_"+A.level+"_"+A.urlId+"_"+A.sn}},"./src/controller/gap-controller.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"STALL_MINIMUM_DURATION_MS",function(){return B}),D.d(V,"MAX_START_GAP_JUMP",function(){return P}),D.d(V,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return A}),D.d(V,"SKIP_BUFFER_RANGE_START",function(){return g}),D.d(V,"default",function(){return p});var z=D("./src/utils/buffer-helper.ts"),U=D("./src/errors.ts"),M=D("./src/events.ts"),W=D("./src/utils/logger.ts"),B=250,P=2,A=.1,g=.05,p=function(){function f(s,c,o,i){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=o,this.hls=i}var d=f.prototype;return d.destroy=function(){this.hls=this.fragmentTracker=this.media=null},d.poll=function(c){var o=this.config,i=this.media,u=this.stalled,h=i.currentTime,R=i.seeking,S=this.seeking&&!R,E=!this.seeking&&R;if(this.seeking=R,h!==c){if(this.moved=!0,u!==null){if(this.stallReported){var O=self.performance.now()-u;W.logger.warn("playback not stuck anymore @"+h+", after "+Math.round(O)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((E||S)&&(this.stalled=null),i.paused||i.ended||i.playbackRate===0||!z.BufferHelper.getBuffered(i).length)return;var x=z.BufferHelper.bufferInfo(i,h,0),w=x.len>0,T=x.nextStart||0;if(!w&&!T)return;if(R){var _=x.len>P,l=!T||T-h>P&&!this.fragmentTracker.getPartialFragment(h);if(_||l)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var b,m=Math.max(T,x.start||0)-h,y=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,k=y==null||((b=y.details)===null||b===void 0)?void 0:b.live,I=k?y.details.targetduration*2:P;if(m>0&&m<=I){this._trySkipBufferHole(null);return}}var N=self.performance.now();if(u===null){this.stalled=N;return}var F=N-u;!R&&F>=B&&this._reportStall(x.len);var C=z.BufferHelper.bufferInfo(i,h,o.maxBufferHole);this._tryFixBufferStall(C,F)},d._tryFixBufferStall=function(c,o){var i=this.config,u=this.fragmentTracker,h=this.media,R=h.currentTime,S=u.getPartialFragment(R);if(S){var E=this._trySkipBufferHole(S);if(E)return}c.len>i.maxBufferHole&&o>i.highBufferWatchdogPeriod*1e3&&(W.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},d._reportStall=function(c){var o=this.hls,i=this.media,u=this.stallReported;u||(this.stallReported=!0,W.logger.warn("Playback stalling at @"+i.currentTime+" due to low buffer (buffer="+c+")"),o.trigger(M.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:c}))},d._trySkipBufferHole=function(c){for(var o=this.config,i=this.hls,u=this.media,h=u.currentTime,R=0,S=z.BufferHelper.getBuffered(u),E=0;E<S.length;E++){var O=S.start(E);if(h+o.maxBufferHole>=R&&h<O){var x=Math.max(O+g,u.currentTime+A);return W.logger.warn("skipping hole, adjusting currentTime from "+h+" to "+x),this.moved=!0,this.stalled=null,u.currentTime=x,c&&i.trigger(M.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+h+" to "+x,frag:c}),x}R=S.end(E)}return 0},d._tryNudgeBuffer=function(){var c=this.config,o=this.hls,i=this.media,u=i.currentTime,h=(this.nudgeRetry||0)+1;if(this.nudgeRetry=h,h<c.nudgeMaxRetry){var R=u+h*c.nudgeOffset;W.logger.warn("Nudging 'currentTime' from "+u+" to "+R),i.currentTime=R,o.trigger(M.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else W.logger.error("Playhead still not moving while enough data buffered @"+u+" after "+c.nudgeMaxRetry+" nudges"),o.trigger(M.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},f}()},"./src/controller/id3-track-controller.ts":function(re,V,D){"use strict";D.r(V);var z=D("./src/events.ts"),U=D("./src/utils/texttrack-utils.ts"),M=D("./src/demux/id3.ts"),W=.25,B=function(){function P(g){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=g,this._registerListeners()}var A=P.prototype;return A.destroy=function(){this._unregisterListeners()},A._registerListeners=function(){var p=this.hls;p.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},A._unregisterListeners=function(){var p=this.hls;p.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},A.onMediaAttached=function(p,f){this.media=f.media},A.onMediaDetaching=function(){if(!this.id3Track)return;Object(U.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},A.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(U.sendAddTrackEvent)(d,this.media),d}return this.media.addTextTrack("metadata","id3")},A.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,o=0;o<s.length;o++){var i=M.getID3Frames(s[o].data);if(i){var u=s[o].pts,h=o<s.length-1?s[o+1].pts:d.end,R=h-u;R<=0&&(h=u+W);for(var S=0;S<i.length;S++){var E=i[S];if(!M.isTimeStampFrame(E)){var O=new c(u,h,"");O.value=E,this.id3Track.addCue(O)}}}}},A.onBufferFlushing=function(p,f){var d=f.startOffset,s=f.endOffset,c=f.type;if(!c||c==="audio"){var o=this.id3Track;o&&Object(U.removeCuesInRange)(o,d,s)}},P}();V.default=B},"./src/controller/latency-controller.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"default",function(){return P});var z=D("./src/errors.ts"),U=D("./src/events.ts"),M=D("./src/utils/logger.ts");function W(A,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(A,f.key,f)}}function B(A,g,p){return g&&W(A.prototype,g),p&&W(A,p),A}var P=function(){function A(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=A.prototype;return g.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},g.registerListeners=function(){this.hls.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(U.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){this.hls.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(U.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(U.Events.ERROR,this.onError)},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!==z.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,M.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,o=c.lowLatencyMode,i=c.maxLiveSyncPlaybackRate;if(!o||i===1)return;var u=this.targetLatency;if(u===null)return;var h=s-u,R=Math.min(this.maxLatency,u+d.targetduration),S=h<R;if(d.live&&S&&h>.05&&this.forwardBufferLength>1){var E=Math.min(2,Math.max(1,i)),O=Math.round(2/(1+Math.exp(-.75*h-this.edgeStalled))*20)/20;f.playbackRate=Math.min(E,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},B(A,[{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,o=this.config,i=o.liveSyncDuration,u=o.liveSyncDurationCount,h=o.lowLatencyMode,R=this.hls.userConfig,S=h&&s||d;(R.liveSyncDuration||R.liveSyncDurationCount||S===0)&&(S=i!==void 0?i:u*c);var E=c,O=1;return S+Math.min(this.stallCount*O,E)}},{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,o=f-d-this.edgeStalled,i=c-s.totalduration,u=c-(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(i,o),u)}},{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}}]),A}()},"./src/controller/level-controller.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"default",function(){return o});var z=D("./src/types/level.ts"),U=D("./src/events.ts"),M=D("./src/errors.ts"),W=D("./src/utils/codecs.ts"),B=D("./src/controller/level-helper.ts"),P=D("./src/controller/base-playlist-controller.ts"),A=D("./src/types/loader.ts");function g(){return g=Object.assign||function(i){for(var u=1;u<arguments.length;u++){var h=arguments[u];for(var R in h)Object.prototype.hasOwnProperty.call(h,R)&&(i[R]=h[R])}return i},g.apply(this,arguments)}function p(i,u){for(var h=0;h<u.length;h++){var R=u[h];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(i,R.key,R)}}function f(i,u,h){return u&&p(i.prototype,u),h&&p(i,h),i}function d(i,u){i.prototype=Object.create(u.prototype),i.prototype.constructor=i,s(i,u)}function s(i,u){return s=Object.setPrototypeOf||function(R,S){return R.__proto__=S,R},s(i,u)}var c=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),o=function(i){d(u,i);function u(R){var S;return S=i.call(this,R,"[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=u.prototype;return h._registerListeners=function(){var S=this.hls;S.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),S.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),S.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),S.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),S.on(U.Events.ERROR,this.onError,this)},h._unregisterListeners=function(){var S=this.hls;S.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),S.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),S.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),S.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),S.off(U.Events.ERROR,this.onError,this)},h.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,i.prototype.destroy.call(this)},h.startLoad=function(){var S=this._levels;S.forEach(function(E){E.loadError=0}),i.prototype.startLoad.call(this)},h.onManifestLoaded=function(S,E){var O=[],x=[],w=[],T,_={},l,b=!1,m=!1,y=!1;if(E.levels.forEach(function(F){var C=F.attrs;b=b||!!(F.width&&F.height),m=m||!!F.videoCodec,y=y||!!F.audioCodec,c&&F.audioCodec&&F.audioCodec.indexOf("mp4a.40.34")!==-1&&(F.audioCodec=void 0);var v=F.bitrate+"-"+F.attrs.RESOLUTION+"-"+F.attrs.CODECS;l=_[v],l?l.url.push(F.url):(l=new z.Level(F),_[v]=l,O.push(l)),C&&(C.AUDIO&&Object(B.addGroupId)(l,"audio",C.AUDIO),C.SUBTITLES&&Object(B.addGroupId)(l,"text",C.SUBTITLES))}),(b||m)&&y&&(O=O.filter(function(F){var C=F.videoCodec,v=F.width,j=F.height;return!!C||!!(v&&j)})),O=O.filter(function(F){var C=F.audioCodec,v=F.videoCodec;return(!C||Object(W.isCodecSupportedInMp4)(C,"audio"))&&(!v||Object(W.isCodecSupportedInMp4)(v,"video"))}),E.audioTracks&&(x=E.audioTracks.filter(function(F){return!F.audioCodec||Object(W.isCodecSupportedInMp4)(F.audioCodec,"audio")}),Object(B.assignTrackIdsByGroup)(x)),E.subtitles&&(w=E.subtitles,Object(B.assignTrackIdsByGroup)(w)),O.length>0){T=O[0].bitrate,O.sort(function(F,C){return F.bitrate-C.bitrate}),this._levels=O;for(var k=0;k<O.length;k++)if(O[k].bitrate===T){this._firstLevel=k,this.log("manifest loaded, "+O.length+" level(s) found, first bitrate: "+T);break}var I=y&&!m,N={levels:O,audioTracks:x,subtitleTracks:w,firstLevel:this._firstLevel,stats:E.stats,audio:y,video:m,altAudio:!I&&x.some(function(F){return!!F.url})};this.hls.trigger(U.Events.MANIFEST_PARSED,N),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(U.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:E.url,reason:"no level with compatible codecs found in manifest"})},h.onError=function(S,E){if(i.prototype.onError.call(this,S,E),E.fatal)return;var O=E.context,x=this._levels[this.currentLevelIndex];if(O&&(O.type===A.PlaylistContextType.AUDIO_TRACK&&x.audioGroupIds&&O.groupId===x.audioGroupIds[x.urlId]||O.type===A.PlaylistContextType.SUBTITLE_TRACK&&x.textGroupIds&&O.groupId===x.textGroupIds[x.urlId])){this.redundantFailover(this.currentLevelIndex);return}var w=!1,T=!0,_;switch(E.details){case M.ErrorDetails.FRAG_LOAD_ERROR:case M.ErrorDetails.FRAG_LOAD_TIMEOUT:case M.ErrorDetails.KEY_LOAD_ERROR:case M.ErrorDetails.KEY_LOAD_TIMEOUT:if(E.frag){var l=this._levels[E.frag.level];l?(l.fragmentError++,l.fragmentError>this.hls.config.fragLoadingMaxRetry&&(_=E.frag.level)):_=E.frag.level}break;case M.ErrorDetails.LEVEL_LOAD_ERROR:case M.ErrorDetails.LEVEL_LOAD_TIMEOUT:O&&(O.deliveryDirectives&&(T=!1),_=O.level),w=!0;break;case M.ErrorDetails.REMUX_ALLOC_ERROR:_=E.level,w=!0;break}_!==void 0&&this.recoverLevel(E,_,w,T)},h.recoverLevel=function(S,E,O,x){var w=S.details,T=this._levels[E];if(T.loadError++,O){var _=this.retryLoadingOrFail(S);if(_)S.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(x){var l=T.url.length;if(l>1&&T.loadError<l)S.levelRetry=!0,this.redundantFailover(E);else if(this.manualLevelIndex===-1){var b=E===0?this._levels.length-1:E-1;this.currentLevelIndex!==b&&this._levels[b].loadError===0&&(this.warn(w+": switch to "+b),S.levelRetry=!0,this.hls.nextAutoLevel=b)}}},h.redundantFailover=function(S){var E=this._levels[S],O=E.url.length;if(O>1){var x=(E.urlId+1)%O;this.warn("Switching to redundant URL-id "+x),this._levels.forEach(function(w){w.urlId=x}),this.level=S}},h.onFragLoaded=function(S,E){var O=E.frag;if(O!==void 0&&O.type===A.PlaylistLevelType.MAIN){var x=this._levels[O.level];x!==void 0&&(x.fragmentError=0,x.loadError=0)}},h.onLevelLoaded=function(S,E){var O,x=E.level,w=E.details,T=this._levels[x];if(!T){var _;this.warn("Invalid level index "+x),(_=E.deliveryDirectives)!==null&&_!==void 0&&_.skip&&(w.deltaUpdateFailed=!0);return}x===this.currentLevelIndex?(T.fragmentError===0&&(T.loadError=0,this.retryCount=0),this.playlistLoaded(x,E,T.details)):(O=E.deliveryDirectives)!==null&&O!==void 0&&O.skip&&(w.deltaUpdateFailed=!0)},h.onAudioTrackSwitched=function(S,E){var O=this.hls.levels[this.currentLevelIndex];if(!O)return;if(O.audioGroupIds){for(var x=-1,w=this.hls.audioTracks[E.id].groupId,T=0;T<O.audioGroupIds.length;T++)if(O.audioGroupIds[T]===w){x=T;break}x!==O.urlId&&(O.urlId=x,this.startLoad())}},h.loadPlaylist=function(S){var E=this.currentLevelIndex,O=this._levels[E];if(this.canLoad&&O&&O.url.length>0){var x=O.urlId,w=O.url[x];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 "+E+(S?" at sn "+S.msn+" part "+S.part:"")+" with URL-id "+x+" "+w),this.clearTimer(),this.hls.trigger(U.Events.LEVEL_LOADING,{url:w,level:E,id:x,deliveryDirectives:S||null})}},h.removeLevel=function(S,E){var O=function(T,_){return _!==E},x=this._levels.filter(function(w,T){return T!==S?!0:w.url.length>1&&E!==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(l){l.level=T}),w});this._levels=x,this.hls.trigger(U.Events.LEVELS_UPDATED,{levels:x})},f(u,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(S){var E,O=this._levels;if(O.length===0)return;if(this.currentLevelIndex===S&&(E=O[S])!==null&&E!==void 0&&E.details)return;if(S<0||S>=O.length){var x=S<0;if(this.hls.trigger(U.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.LEVEL_SWITCH_ERROR,level:S,fatal:x,reason:"invalid level idx"}),x)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 l=g({},_,{level:S,maxBitrate:_.maxBitrate,uri:_.uri,urlId:_.urlId});delete l._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,l);var b=_.details;if(!b||b.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)}}]),u}(P.default)},"./src/controller/level-helper.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"addGroupId",function(){return M}),D.d(V,"assignTrackIdsByGroup",function(){return W}),D.d(V,"updatePTS",function(){return B}),D.d(V,"updateFragPTSDTS",function(){return A}),D.d(V,"mergeDetails",function(){return g}),D.d(V,"mapPartIntersection",function(){return p}),D.d(V,"mapFragmentIntersection",function(){return f}),D.d(V,"adjustSliding",function(){return d}),D.d(V,"addSliding",function(){return s}),D.d(V,"computeReloadInterval",function(){return c}),D.d(V,"getFragmentWithSN",function(){return o}),D.d(V,"getPartWith",function(){return i});var z=D("./src/polyfills/number.ts"),U=D("./src/utils/logger.ts");function M(u,h,R){switch(h){case"audio":u.audioGroupIds||(u.audioGroupIds=[]),u.audioGroupIds.push(R);break;case"text":u.textGroupIds||(u.textGroupIds=[]),u.textGroupIds.push(R);break}}function W(u){var h={};u.forEach(function(R){var S=R.groupId||"";R.id=h[S]=h[S]||0,h[S]++})}function B(u,h,R){var S=u[h],E=u[R];P(S,E)}function P(u,h){var R=h.startPTS;if(Object(z.isFiniteNumber)(R)){var S=0,E;h.sn>u.sn?(S=R-u.start,E=u):(S=u.start-R,E=h),E.duration!==S&&(E.duration=S)}else if(h.sn>u.sn){var O=u.cc===h.cc;O&&u.minEndPTS?h.start=u.start+(u.minEndPTS-u.start):h.start=u.start+u.duration}else h.start=Math.max(u.start-h.duration,0)}function A(u,h,R,S,E,O){var x=S-R;x<=0&&(U.logger.warn("Fragment should have a positive duration",h),S=R+h.duration,O=E+h.duration);var w=R,T=S,_=h.startPTS,l=h.endPTS;if(Object(z.isFiniteNumber)(_)){var b=Math.abs(_-R);Object(z.isFiniteNumber)(h.deltaPTS)?h.deltaPTS=Math.max(b,h.deltaPTS):h.deltaPTS=b,w=Math.max(R,_),R=Math.min(R,_),E=Math.min(E,h.startDTS),T=Math.min(S,l),S=Math.max(S,l),O=Math.max(O,h.endDTS)}h.duration=S-R;var m=R-h.start;h.appendedPTS=S,h.start=h.startPTS=R,h.maxStartPTS=w,h.startDTS=E,h.endPTS=S,h.minEndPTS=T,h.endDTS=O;var y=h.sn;if(!u||y<u.startSN||y>u.endSN)return 0;var k,I=y-u.startSN,N=u.fragments;for(N[I]=h,k=I;k>0;k--)P(N[k],N[k-1]);for(k=I;k<N.length-1;k++)P(N[k],N[k+1]);return u.fragmentHint&&P(N[N.length-1],u.fragmentHint),u.PTSKnown=u.alignedSliding=!0,m}function g(u,h){for(var R=null,S=u.fragments,E=S.length-1;E>=0;E--){var O=S[E].initSegment;if(O){R=O;break}}u.fragmentHint&&delete u.fragmentHint.endPTS;var x=0,w;if(f(u,h,function(k,I){k.relurl&&(x=k.cc-I.cc),Object(z.isFiniteNumber)(k.startPTS)&&Object(z.isFiniteNumber)(k.endPTS)&&(I.start=I.startPTS=k.startPTS,I.startDTS=k.startDTS,I.appendedPTS=k.appendedPTS,I.maxStartPTS=k.maxStartPTS,I.endPTS=k.endPTS,I.endDTS=k.endDTS,I.minEndPTS=k.minEndPTS,I.duration=k.endPTS-k.startPTS,I.duration&&(w=I),h.PTSKnown=h.alignedSliding=!0),I.elementaryStreams=k.elementaryStreams,I.loader=k.loader,I.stats=k.stats,I.urlId=k.urlId,k.initSegment&&(I.initSegment=k.initSegment,R=k.initSegment)}),R){var T=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments;T.forEach(function(k){var I;(!k.initSegment||k.initSegment.relurl===((I=R)===null||I===void 0?void 0:I.relurl))&&(k.initSegment=R)})}if(h.skippedSegments&&(h.deltaUpdateFailed=h.fragments.some(function(k){return!k}),h.deltaUpdateFailed)){U.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 l=h.fragments;if(x){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var b=0;b<l.length;b++)l[b].cc+=x}h.skippedSegments&&(h.startCC=h.fragments[0].cc),p(u.partList,h.partList,function(k,I){I.elementaryStreams=k.elementaryStreams,I.stats=k.stats}),w?A(h,w,w.startPTS,w.endPTS,w.startDTS,w.endDTS):d(u,h),l.length&&(h.totalduration=h.edge-l[0].start),h.driftStartTime=u.driftStartTime,h.driftStart=u.driftStart;var m=h.advancedDateTime;if(h.advanced&&m){var y=h.edge;h.driftStart||(h.driftStartTime=m,h.driftStart=y),h.driftEndTime=m,h.driftEnd=y}else h.driftEndTime=u.driftEndTime,h.driftEnd=u.driftEnd,h.advancedDateTime=u.advancedDateTime}function p(u,h,R){if(u&&h)for(var S=0,E=0,O=u.length;E<=O;E++){var x=u[E],w=h[E+S];x&&w&&x.index===w.index&&x.fragment.sn===w.fragment.sn?R(x,w):S--}}function f(u,h,R){for(var S=h.skippedSegments,E=Math.max(u.startSN,h.startSN)-h.startSN,O=(u.fragmentHint?1:0)+(S?h.endSN:Math.min(u.endSN,h.endSN))-h.startSN,x=h.startSN-u.startSN,w=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments,T=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,_=E;_<=O;_++){var l=T[x+_],b=w[_];S&&!b&&_<S&&(b=h.fragments[_]=l),l&&b&&R(l,b)}}function d(u,h){var R=h.startSN+h.skippedSegments-u.startSN,S=u.fragments;if(R<0||R>=S.length)return;s(h,S[R].start)}function s(u,h){if(h){for(var R=u.fragments,S=u.skippedSegments;S<R.length;S++)R[S].start+=h;u.fragmentHint&&(u.fragmentHint.start+=h)}}function c(u,h){var R=1e3*u.levelTargetDuration,S=R/2,E=u.age,O=E>0&&E<R*3,x=h.loading.end-h.loading.start,w,T=u.availabilityDelay;if(u.updated===!1)if(O){var _=333*u.misses;w=Math.max(Math.min(S,x*2),_),u.availabilityDelay=(u.availabilityDelay||0)+w}else w=S;else O?(T=Math.min(T||R/2,E),u.availabilityDelay=T,w=T+R-E):w=R-x;return Math.round(w)}function o(u,h,R){if(!u||!u.details)return null;var S=u.details,E=S.fragments[h-S.startSN];return E||(E=S.fragmentHint,E&&E.sn===h?E:h<S.startSN&&R&&R.sn===h?R:null)}function i(u,h,R){if(!u||!u.details)return null;var S=u.details.partList;if(S)for(var E=S.length;E--;){var O=S[E];if(O.index===R&&O.fragment.sn===h)return O}return null}},"./src/controller/stream-controller.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"default",function(){return S});var z=D("./src/polyfills/number.ts"),U=D("./src/controller/base-stream-controller.ts"),M=D("./src/is-supported.ts"),W=D("./src/events.ts"),B=D("./src/utils/buffer-helper.ts"),P=D("./src/controller/fragment-tracker.ts"),A=D("./src/types/loader.ts"),g=D("./src/loader/fragment.ts"),p=D("./src/demux/transmuxer-interface.ts"),f=D("./src/types/transmuxer.ts"),d=D("./src/controller/gap-controller.ts"),s=D("./src/errors.ts"),c=D("./src/utils/logger.ts");function o(E,O){for(var x=0;x<O.length;x++){var w=O[x];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(E,w.key,w)}}function i(E,O,x){return O&&o(E.prototype,O),x&&o(E,x),E}function u(E,O){E.prototype=Object.create(O.prototype),E.prototype.constructor=E,h(E,O)}function h(E,O){return h=Object.setPrototypeOf||function(w,T){return w.__proto__=T,w},h(E,O)}var R=100,S=function(E){u(O,E);function O(w,T){var _;return _=E.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 x=O.prototype;return x._registerListeners=function(){var T=this.hls;T.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),T.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),T.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),T.on(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),T.on(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),T.on(W.Events.ERROR,this.onError,this),T.on(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),T.on(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),T.on(W.Events.BUFFER_CREATED,this.onBufferCreated,this),T.on(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),T.on(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),T.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x._unregisterListeners=function(){var T=this.hls;T.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),T.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),T.off(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),T.off(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),T.off(W.Events.ERROR,this.onError,this),T.off(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),T.off(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),T.off(W.Events.BUFFER_CREATED,this.onBufferCreated,this),T.off(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),T.off(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),T.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},x.startLoad=function(T){if(this.levels){var _=this.lastCurrentTime,l=this.hls;if(this.stopLoad(),this.setInterval(R),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var b=l.startLevel;b===-1&&(l.config.testBandwidth?(b=0,this.bitrateTest=!0):b=l.nextAutoLevel),this.level=l.nextLoadLevel=b,this.loadedmetadata=!1}_>0&&T===-1&&(this.log("Override startPosition with lastCurrentTime @"+_.toFixed(3)),T=_),this.state=U.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=T,this.tick()}else this._forceStartLoad=!0,this.state=U.State.STOPPED},x.stopLoad=function(){this._forceStartLoad=!1,E.prototype.stopLoad.call(this)},x.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_LEVEL:{var T,_=this.levels,l=this.level,b=_==null||((T=_[l])===null||T===void 0)?void 0:T.details;if(b&&(!b.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(b))break;this.state=U.State.IDLE;break}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var m,y=self.performance.now(),k=this.retryDate;(!k||y>=k||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=U.State.IDLE)}break;default:break}this.onTickEnd()},x.onTickEnd=function(){E.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},x.doTickIdle=function(){var T,_,l=this.hls,b=this.levelLastLoaded,m=this.levels,y=this.media,k=l.config,I=l.nextLoadLevel;if(b===null||!y&&(this.startFragRequested||!k.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[I])return;var N=m[I];this.level=l.nextLoadLevel=I;var F=N.details;if(!F||this.state===U.State.WAITING_LEVEL||F.live&&this.levelLastLoaded!==I){this.state=U.State.WAITING_LEVEL;return}var C=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:y,A.PlaylistLevelType.MAIN);if(C===null)return;var v=C.len,j=this.getMaxBufferLength(N.maxBitrate);if(v>=j)return;if(this._streamEnded(C,F)){var K={};this.altAudio&&(K.type="video"),this.hls.trigger(W.Events.BUFFER_EOS,K),this.state=U.State.ENDED;return}var J=C.end,te=this.getNextFragment(J,F);if(this.couldBacktrack&&!this.fragPrevious&&te&&te.sn!=="initSegment"){var ve=te.sn-F.startSN;ve>1&&(te=F.fragments[ve-1],this.fragmentTracker.removeFragment(te))}if(te&&this.fragmentTracker.getState(te)===P.FragmentState.OK&&this.nextLoadPosition>J){var ue=this.audioOnly&&!this.altAudio?g.ElementaryStreamTypes.AUDIO:g.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(y,ue,A.PlaylistLevelType.MAIN),te=this.getNextFragment(this.nextLoadPosition,F)}if(!te)return;te.initSegment&&!te.initSegment.data&&!this.bitrateTest&&(te=te.initSegment),((T=te.decryptdata)===null||T===void 0?void 0:T.keyFormat)==="identity"&&!((_=te.decryptdata)!==null&&_!==void 0&&_.key)?this.loadKey(te,F):this.loadFragment(te,F,J)},x.loadFragment=function(T,_,l){var b,m=this.fragmentTracker.getState(T);if(this.fragCurrent=T,m===P.FragmentState.BACKTRACKED){var y=this.fragmentTracker.getBacktrackData(T);if(y){this._handleFragmentLoadProgress(y),this._handleFragmentLoadComplete(y);return}else m=P.FragmentState.NOT_LOADED}m===P.FragmentState.NOT_LOADED||m===P.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,E.prototype.loadFragment.call(this,T,_,l)):m===P.FragmentState.APPENDING?this.reduceMaxBufferLength(T.duration)&&this.fragmentTracker.removeFragment(T):((b=this.media)===null||b===void 0?void 0:b.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},x.getAppendedFrag=function(T){var _=this.fragmentTracker.getAppendedFrag(T,A.PlaylistLevelType.MAIN);return _&&"fragment"in _?_.fragment:_},x.getBufferedFrag=function(T){return this.fragmentTracker.getBufferedFrag(T,A.PlaylistLevelType.MAIN)},x.followingBufferedFrag=function(T){return T?this.getBufferedFrag(T.end+.5):null},x.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},x.nextLevelSwitch=function(){var T=this.levels,_=this.media;if(_!=null&&_.readyState){var l,b=this.getAppendedFrag(_.currentTime);if(b&&b.start>1&&this.flushMainBuffer(0,b.start-1),!_.paused&&T){var m=this.hls.nextLoadLevel,y=T[m],k=this.fragLastKbps;k&&this.fragCurrent?l=this.fragCurrent.duration*y.maxBitrate/(1e3*k)+1:l=0}else l=0;var I=this.getBufferedFrag(_.currentTime+l);if(I){var N=this.followingBufferedFrag(I);if(N){this.abortCurrentFrag();var F=N.maxStartPTS?N.maxStartPTS:N.start,C=N.duration,v=Math.max(I.end,F+Math.min(Math.max(C-this.config.maxFragLookUpTolerance,C*.5),C*.75));this.flushMainBuffer(v,Number.POSITIVE_INFINITY)}}}},x.abortCurrentFrag=function(){var T=this.fragCurrent;this.fragCurrent=null,T!=null&&T.loader&&T.loader.abort(),this.state===U.State.KEY_LOADING&&(this.state=U.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},x.flushMainBuffer=function(T,_){E.prototype.flushMainBuffer.call(this,T,_,this.altAudio?"video":null)},x.onMediaAttached=function(T,_){E.prototype.onMediaAttached.call(this,T,_);var l=_.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),l.addEventListener("playing",this.onvplaying),l.addEventListener("seeked",this.onvseeked),this.gapController=new d.default(this.config,l,this.fragmentTracker,this.hls)},x.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),E.prototype.onMediaDetaching.call(this)},x.onMediaPlaying=function(){this.tick()},x.onMediaSeeked=function(){var T=this.media,_=T?T.currentTime:null;Object(z.isFiniteNumber)(_)&&this.log("Media seeked to "+_.toFixed(3)),this.tick()},x.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(W.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},x.onManifestParsed=function(T,_){var l=!1,b=!1,m;_.levels.forEach(function(y){m=y.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(l=!0),m.indexOf("mp4a.40.5")!==-1&&(b=!0))}),this.audioCodecSwitch=l&&b&&!Object(M.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},x.onLevelLoading=function(T,_){var l=this.levels;if(!l||this.state!==U.State.IDLE)return;var b=l[_.level];(!b.details||b.details.live&&this.levelLastLoaded!==_.level||this.waitForCdnTuneIn(b.details))&&(this.state=U.State.WAITING_LEVEL)},x.onLevelLoaded=function(T,_){var l,b=this.levels,m=_.level,y=_.details,k=y.totalduration;if(!b){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+y.startSN+","+y.endSN+"], cc ["+y.startCC+", "+y.endCC+"] duration:"+k);var I=this.fragCurrent;I&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(I.level!==_.level&&I.loader&&(this.state=U.State.IDLE,I.loader.abort()));var N=b[m],F=0;if(y.live||(l=N.details)!==null&&l!==void 0&&l.live){if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed)return;F=this.alignPlaylists(y,N.details)}if(N.details=y,this.levelLastLoaded=m,this.hls.trigger(W.Events.LEVEL_UPDATED,{details:y,level:m}),this.state===U.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(y))return;this.state=U.State.IDLE}this.startFragRequested?y.live&&this.synchronizeToLiveEdge(y):this.setStartPosition(y,F),this.tick()},x._handleFragmentLoadProgress=function(T){var _,l=T.frag,b=T.part,m=T.payload,y=this.levels;if(!y){this.warn("Levels were reset while fragment load was in progress. Fragment "+l.sn+" of level "+l.level+" will not be buffered");return}var k=y[l.level],I=k.details;if(!I){this.warn("Dropping fragment "+l.sn+" of level "+l.level+" after level details were reset");return}var N=k.videoCodec,F=I.PTSKnown||!I.live,C=(_=l.initSegment)===null||_===void 0?void 0:_.data,v=this._getAudioCodec(k),j=this.transmuxer=this.transmuxer||new p.default(this.hls,A.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),K=b?b.index:-1,J=K!==-1,te=new f.ChunkMetadata(l.level,l.sn,l.stats.chunkCount,m.byteLength,K,J),ve=this.initPTS[l.cc];j.push(m,C,v,N,l,b,I.totalduration,F,te,ve)},x.onAudioTrackSwitching=function(T,_){var l=this.altAudio,b=!!_.url,m=_.id;if(!b){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var y=this.fragCurrent;y!=null&&y.loader&&(this.log("Switching to main audio track, cancel main fragment load"),y.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var k=this.hls;l&&k.trigger(W.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),k.trigger(W.Events.AUDIO_TRACK_SWITCHED,{id:m})}},x.onAudioTrackSwitched=function(T,_){var l=_.id,b=!!this.hls.audioTracks[l].url;if(b){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=b,this.tick()},x.onBufferCreated=function(T,_){var l=_.tracks,b,m,y=!1;for(var k in l){var I=l[k];if(I.id==="main"){if(m=k,b=I,k==="video"){var N=l[k];N&&(this.videoBuffer=N.buffer)}}else y=!0}y&&b?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=b.buffer):this.mediaBuffer=this.media},x.onFragBuffered=function(T,_){var l=_.frag,b=_.part;if(l&&l.type!==A.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(l)){this.warn("Fragment "+l.sn+(b?" p: "+b.index:"")+" of level "+l.level+" finished buffering, but was aborted. state: "+this.state),this.state===U.State.PARSED&&(this.state=U.State.IDLE);return}var m=b?b.stats:l.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),l.sn!=="initSegment"&&(this.fragPrevious=l),this.fragBufferedComplete(l,b)},x.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(A.PlaylistLevelType.MAIN,_);break;case s.ErrorDetails.LEVEL_LOAD_ERROR:case s.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==U.State.ERROR&&(_.fatal?(this.warn(""+_.details),this.state=U.State.ERROR):!_.levelRetry&&this.state===U.State.WAITING_LEVEL&&(this.state=U.State.IDLE));break;case s.ErrorDetails.BUFFER_FULL_ERROR:if(_.parent==="main"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var l=!0,b=this.getFwdBufferInfo(this.media,A.PlaylistLevelType.MAIN);b&&b.len>.5&&(l=!this.reduceMaxBufferLength(b.len)),l&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},x.checkBuffer=function(){var T=this.media,_=this.gapController;if(!T||!_||!T.readyState)return;var l=B.BufferHelper.getBuffered(T);!this.loadedmetadata&&l.length?(this.loadedmetadata=!0,this.seekToStartPos()):_.poll(this.lastCurrentTime),this.lastCurrentTime=T.currentTime},x.onFragLoadEmergencyAborted=function(){this.state=U.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},x.onBufferFlushed=function(T,_){var l=_.type;if(l!==g.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var b=(l===g.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(b,l,A.PlaylistLevelType.MAIN)}},x.onLevelsUpdated=function(T,_){this.levels=_.levels},x.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},x.seekToStartPos=function(){var T=this.media,_=T.currentTime,l=this.startPosition;if(l>=0&&_<l){if(T.seeking){c.logger.log("could not seek to "+l+", already seeking at "+_);return}var b=B.BufferHelper.getBuffered(T),m=b.length?b.start(0):0,y=m-l;y>0&&(y<this.config.maxBufferHole||y<this.config.maxFragLookUpTolerance)&&(c.logger.log("adjusting start position by "+y+" to match buffer start"),l+=y,this.startPosition=l),this.log("seek to target start position "+l+" from current time "+_),T.currentTime=l}},x._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"),_},x._loadBitrateTestFrag=function(T){var _=this;this._doFragLoad(T).then(function(l){var b=_.hls;if(!l||b.nextLoadLevel||_.fragContextChanged(T))return;_.fragLoadError=0,_.state=U.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(),b.trigger(W.Events.FRAG_LOADED,l)})},x._handleTransmuxComplete=function(T){var _,l="main",b=this.hls,m=T.remuxResult,y=T.chunkMeta,k=this.getCurrentContext(y);if(!k){this.warn("The loading context changed while buffering fragment "+y.sn+" of level "+y.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(y.level);return}var I=k.frag,N=k.part,F=k.level,C=m.video,v=m.text,j=m.id3,K=m.initSegment,J=this.altAudio?void 0:m.audio;if(this.fragContextChanged(I))return;if(this.state=U.State.PARSING,K){K.tracks&&(this._bufferInitSegment(F,K.tracks,I,y),b.trigger(W.Events.FRAG_PARSING_INIT_SEGMENT,{frag:I,id:l,tracks:K.tracks}));var te=K.initPTS,ve=K.timescale;Object(z.isFiniteNumber)(te)&&(this.initPTS[I.cc]=te,b.trigger(W.Events.INIT_PTS_FOUND,{frag:I,id:l,initPTS:te,timescale:ve}))}if(C&&m.independent!==!1){if(F.details){var ue=C.startPTS,de=C.endPTS,oe=C.startDTS,me=C.endDTS;if(N)N.elementaryStreams[C.type]={startPTS:ue,endPTS:de,startDTS:oe,endDTS:me};else if(C.firstKeyFrame&&C.independent&&(this.couldBacktrack=!0),C.dropped&&C.independent){var ae=this.getLoadPosition()+this.config.maxBufferHole;if(ae<ue){this.backtrack(I);return}I.setElementaryStreamInfo(C.type,I.start,de,I.start,me,!0)}I.setElementaryStreamInfo(C.type,ue,de,oe,me),this.bufferFragmentData(C,I,N,y)}}else if(m.independent===!1){this.backtrack(I);return}if(J){var fe=J.startPTS,Q=J.endPTS,ie=J.startDTS,ee=J.endDTS;N&&(N.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:fe,endPTS:Q,startDTS:ie,endDTS:ee}),I.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,fe,Q,ie,ee),this.bufferFragmentData(J,I,N,y)}if(j!=null&&(_=j.samples)!==null&&_!==void 0&&_.length){var Te={frag:I,id:l,samples:j.samples};b.trigger(W.Events.FRAG_PARSING_METADATA,Te)}if(v){var Se={frag:I,id:l,samples:v.samples};b.trigger(W.Events.FRAG_PARSING_USERDATA,Se)}},x._bufferInitSegment=function(T,_,l,b){var m=this;if(this.state!==U.State.PARSING)return;this.audioOnly=!!_.audio&&!_.video,this.altAudio&&!this.audioOnly&&delete _.audio;var y=_.audio,k=_.video,I=_.audiovideo;if(y){var N=T.audioCodec,F=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(N&&(N.indexOf("mp4a.40.5")!==-1?N="mp4a.40.2":N="mp4a.40.5"),y.metadata.channelCount!==1&&F.indexOf("firefox")===-1&&(N="mp4a.40.5")),F.indexOf("android")!==-1&&y.container!=="audio/mpeg"&&(N="mp4a.40.2",this.log("Android: force audio codec to "+N)),T.audioCodec&&T.audioCodec!==N&&this.log('Swapping manifest audio codec "'+T.audioCodec+'" for "'+N+'"'),y.levelCodec=N,y.id="main",this.log("Init audio buffer, container:"+y.container+", codecs[selected/level/parsed]=["+(N||"")+"/"+(T.audioCodec||"")+"/"+y.codec+"]")}k&&(k.levelCodec=T.videoCodec,k.id="main",this.log("Init video buffer, container:"+k.container+", codecs[level/parsed]=["+(T.videoCodec||"")+"/"+k.codec+"]")),I&&this.log("Init audiovideo buffer, container:"+I.container+", codecs[level/parsed]=["+(T.attrs.CODECS||"")+"/"+I.codec+"]"),this.hls.trigger(W.Events.BUFFER_CODECS,_),Object.keys(_).forEach(function(C){var v=_[C],j=v.initSegment;j!=null&&j.byteLength&&m.hls.trigger(W.Events.BUFFER_APPENDING,{type:C,data:j,frag:l,part:null,chunkMeta:b,parent:l.type})}),this.tick()},x.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=U.State.BACKTRACKING},x.checkFragmentChanged=function(){var T=this.media,_=null;if(T&&T.readyState>1&&T.seeking===!1){var l=T.currentTime;if(B.BufferHelper.isBuffered(T,l)?_=this.getAppendedFrag(l):B.BufferHelper.isBuffered(T,l+.1)&&(_=this.getAppendedFrag(l+.1)),_){var b=this.fragPlaying,m=_.level;(!b||_.sn!==b.sn||b.level!==m||_.urlId!==b.urlId)&&(this.hls.trigger(W.Events.FRAG_CHANGED,{frag:_}),(!b||b.level!==m)&&this.hls.trigger(W.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=_)}}},i(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}(U.default)},"./src/controller/subtitle-stream-controller.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"SubtitleStreamController",function(){return u});var z=D("./src/events.ts"),U=D("./src/utils/logger.ts"),M=D("./src/utils/buffer-helper.ts"),W=D("./src/controller/fragment-finders.ts"),B=D("./src/utils/discontinuities.ts"),P=D("./src/controller/level-helper.ts"),A=D("./src/controller/fragment-tracker.ts"),g=D("./src/controller/base-stream-controller.ts"),p=D("./src/types/loader.ts"),f=D("./src/types/level.ts");function d(h,R){for(var S=0;S<R.length;S++){var E=R[S];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(h,E.key,E)}}function s(h,R,S){return R&&d(h.prototype,R),S&&d(h,S),h}function c(h,R){h.prototype=Object.create(R.prototype),h.prototype.constructor=h,o(h,R)}function o(h,R){return o=Object.setPrototypeOf||function(E,O){return E.__proto__=O,E},o(h,R)}var i=500,u=function(h){c(R,h);function R(E,O){var x;return x=h.call(this,E,O,"[subtitle-stream-controller]")||this,x.levels=[],x.currentTrackId=-1,x.tracksBuffered=[],x.mainDetails=null,x._registerListeners(),x}var S=R.prototype;return S.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},S._registerListeners=function(){var O=this.hls;O.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),O.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),O.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),O.on(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),O.on(z.Events.ERROR,this.onError,this),O.on(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),O.on(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),O.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),O.on(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),O.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S._unregisterListeners=function(){var O=this.hls;O.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),O.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),O.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),O.off(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),O.off(z.Events.ERROR,this.onError,this),O.off(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),O.off(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),O.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),O.off(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),O.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S.startLoad=function(){this.stopLoad(),this.state=g.State.IDLE,this.setInterval(i),this.tick()},S.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},S.onLevelLoaded=function(O,x){this.mainDetails=x.details},S.onSubtitleFragProcessed=function(O,x){var w=x.frag,T=x.success;if(this.fragPrevious=w,this.state=g.State.IDLE,!T)return;var _=this.tracksBuffered[this.currentTrackId];if(!_)return;for(var l,b=w.start,m=0;m<_.length;m++)if(b>=_[m].start&&b<=_[m].end){l=_[m];break}var y=w.start+w.duration;l?l.end=y:(l={start:b,end:y},_.push(l)),this.fragmentTracker.fragBuffered(w)},S.onBufferFlushing=function(O,x){var w=x.startOffset,T=x.endOffset;if(w===0&&T!==Number.POSITIVE_INFINITY){var _=this.currentTrackId,l=this.levels;if(!l.length||!l[_]||!l[_].details)return;var b=l[_].details,m=b.targetduration,y=T-m;if(y<=0)return;x.endOffsetSubtitles=Math.max(0,y),this.tracksBuffered.forEach(function(k){for(var I=0;I<k.length;){if(k[I].end<=y){k.shift();continue}else if(k[I].start<y)k[I].start=y;else break;I++}}),this.fragmentTracker.removeFragmentsInRange(w,y,p.PlaylistLevelType.SUBTITLE)}},S.onError=function(O,x){var w,T=x.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,x){var w=this,T=x.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,x){if(this.currentTrackId=x.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(i)},S.onSubtitleTrackLoaded=function(O,x){var w,T=x.details,_=x.id,l=this.currentTrackId,b=this.levels;if(!b.length)return;var m=b[l];if(_>=b.length||_!==l||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,T.live||(w=m.details)!==null&&w!==void 0&&w.live){var y=this.mainDetails;if(T.deltaUpdateFailed||!y)return;var k=y.fragments[0];if(!m.details)T.hasProgramDateTime&&y.hasProgramDateTime?Object(B.alignMediaPlaylistByPDT)(T,y):k&&Object(P.addSliding)(T,k.start);else{var I=this.alignPlaylists(T,m.details);I===0&&k&&Object(P.addSliding)(T,k.start)}}if(m.details=T,this.levelLastLoaded=_,this.tick(),T.live&&!this.fragCurrent&&this.media&&this.state===g.State.IDLE){var N=Object(W.findFragmentByPTS)(null,T.fragments,this.media.currentTime,0);N||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},S._handleFragmentLoadComplete=function(O){var x=O.frag,w=O.payload,T=x.decryptdata,_=this.hls;if(this.fragContextChanged(x))return;if(w&&w.byteLength>0&&T&&T.key&&T.iv&&T.method==="AES-128"){var l=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(w),T.key.buffer,T.iv.buffer).then(function(b){var m=performance.now();_.trigger(z.Events.FRAG_DECRYPTED,{frag:x,payload:b,stats:{tstart:l,tdecrypt:m}})})}},S.doTick=function(){if(!this.media){this.state=g.State.IDLE;return}if(this.state===g.State.IDLE){var O,x=this.currentTrackId,w=this.levels;if(!w.length||!w[x]||!w[x].details)return;var T=w[x].details,_=T.targetduration,l=this.config,b=this.media,m=M.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,b.currentTime-_,l.maxBufferHole),y=m.end,k=m.len,I=this.getMaxBufferLength()+_;if(k>I)return;console.assert(T,"Subtitle track details are defined on idle subtitle stream controller tick");var N=T.fragments,F=N.length,C=T.edge,v,j=this.fragPrevious;if(y<C){var K=l.maxFragLookUpTolerance;j&&T.hasProgramDateTime&&(v=Object(W.findFragmentByPDT)(N,j.endProgramDateTime,K)),v||(v=Object(W.findFragmentByPTS)(j,N,y,K),!v&&j&&j.start<N[0].start&&(v=N[0]))}else v=N[F-1];(O=v)!==null&&O!==void 0&&O.encrypted?(U.logger.log("Loading key for "+v.sn),this.state=g.State.KEY_LOADING,this.hls.trigger(z.Events.KEY_LOADING,{frag:v})):v&&this.fragmentTracker.getState(v)===A.FragmentState.NOT_LOADED&&this.loadFragment(v,T,y)}},S.loadFragment=function(O,x,w){this.fragCurrent=O,h.prototype.loadFragment.call(this,O,x,w)},s(R,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),R}(g.default)},"./src/controller/subtitle-track-controller.ts":function(re,V,D){"use strict";D.r(V);var z=D("./src/events.ts"),U=D("./src/utils/texttrack-utils.ts"),M=D("./src/controller/base-playlist-controller.ts"),W=D("./src/types/loader.ts");function B(d,s){for(var c=0;c<s.length;c++){var o=s[c];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(d,o.key,o)}}function P(d,s,c){return s&&B(d.prototype,s),c&&B(d,c),d}function A(d,s){d.prototype=Object.create(s.prototype),d.prototype.constructor=d,g(d,s)}function g(d,s){return g=Object.setPrototypeOf||function(o,i){return o.__proto__=i,o},g(d,s)}var p=function(d){A(s,d);function s(o){var i;return i=d.call(this,o,"[subtitle-track-controller]")||this,i.media=null,i.tracks=[],i.groupId=null,i.tracksInGroup=[],i.trackId=-1,i.selectDefaultTrack=!0,i.queuedDefaultTrack=-1,i.trackChangeListener=function(){return i.onTextTracksChanged()},i.asyncPollTrackChange=function(){return i.pollTrackChange(0)},i.useTextTrackPolling=!1,i.subtitlePollingInterval=-1,i.subtitleDisplay=!0,i.registerListeners(),i}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 i=this.hls;i.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),i.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),i.on(z.Events.ERROR,this.onError,this)},c.unregisterListeners=function(){var i=this.hls;i.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),i.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),i.off(z.Events.ERROR,this.onError,this)},c.onMediaAttached=function(i,u){if(this.media=u.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(i){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,i)},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 i=f(this.media.textTracks);i.forEach(function(u){Object(U.clearCurrentCues)(u)}),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(i,u){this.tracks=u.subtitleTracks},c.onSubtitleTrackLoaded=function(i,u){var h=u.id,R=u.details,S=this.trackId,E=this.tracksInGroup[S];if(!E){this.warn("Invalid subtitle track id "+h);return}var O=E.details;E.details=u.details,this.log("subtitle track "+h+" loaded ["+R.startSN+"-"+R.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,u,O))},c.onLevelLoading=function(i,u){this.switchLevel(u.level)},c.onLevelSwitching=function(i,u){this.switchLevel(u.level)},c.switchLevel=function(i){var u=this.hls.levels[i];if(!(u!=null&&u.textGroupIds))return;var h=u.textGroupIds[u.urlId];if(this.groupId!==h){var R=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,S=this.tracks.filter(function(x){return!h||x.groupId===h});this.tracksInGroup=S;var E=this.findTrackId(R==null?void 0:R.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(z.Events.SUBTITLE_TRACKS_UPDATED,O),E!==-1&&this.setSubtitleTrack(E,R)}},c.findTrackId=function(i){for(var u=this.tracksInGroup,h=0;h<u.length;h++){var R=u[h];if((!this.selectDefaultTrack||R.default)&&(!i||i===R.name))return R.id}return-1},c.onError=function(i,u){if(d.prototype.onError.call(this,i,u),u.fatal||!u.context)return;u.context.type===W.PlaylistContextType.SUBTITLE_TRACK&&u.context.id===this.trackId&&u.context.groupId===this.groupId&&this.retryLoadingOrFail(u)},c.loadPlaylist=function(i){var u=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(u)){var h=u.id,R=u.groupId,S=u.url;if(i)try{S=i.addDirectives(S)}catch(E){this.warn("Could not construct new URL with HLS Delivery Directives: "+E)}this.log("Loading subtitle playlist for id "+h),this.hls.trigger(z.Events.SUBTITLE_TRACK_LOADING,{url:S,id:h,groupId:R,deliveryDirectives:i||null})}},c.toggleTrackModes=function(i){var u=this,h=this.media,R=this.subtitleDisplay,S=this.trackId;if(!h)return;var E=f(h.textTracks),O=E.filter(function(T){return T.groupId===u.groupId});if(i===-1)[].slice.call(E).forEach(function(T){T.mode="disabled"});else{var x=O[S];x&&(x.mode="disabled")}var w=O[i];w&&(w.mode=R?"showing":"hidden")},c.setSubtitleTrack=function(i,u){var h,R=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=i;return}if(this.trackId!==i&&this.toggleTrackModes(i),this.trackId===i&&(i===-1||(h=R[i])!==null&&h!==void 0&&h.details)||i<-1||i>=R.length)return;this.clearTimer();var S=R[i];if(this.log("Switching to subtitle track "+i),this.trackId=i,S){var E=S.id,O=S.groupId,x=O===void 0?"":O,w=S.name,T=S.type,_=S.url;this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:E,groupId:x,name:w,type:T,url:_});var l=this.switchParams(S.url,u==null?void 0:u.details);this.loadPlaylist(l)}else this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:i})},c.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var i=-1,u=f(this.media.textTracks),h=0;h<u.length;h++)if(u[h].mode==="hidden")i=h;else if(u[h].mode==="showing"){i=h;break}this.subtitleTrack!==i&&(this.subtitleTrack=i)},P(s,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(i){this.selectDefaultTrack=!1;var u=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(i,u)}}]),s}(M.default);function f(d){for(var s=[],c=0;c<d.length;c++){var o=d[c];o.kind==="subtitles"&&o.label&&s.push(d[c])}return s}V.default=p},"./src/controller/timeline-controller.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"TimelineController",function(){return f});var z=D("./src/polyfills/number.ts"),U=D("./src/events.ts"),M=D("./src/utils/cea-608-parser.ts"),W=D("./src/utils/output-filter.ts"),B=D("./src/utils/webvtt-parser.ts"),P=D("./src/utils/texttrack-utils.ts"),A=D("./src/utils/imsc1-ttml-parser.ts"),g=D("./src/types/loader.ts"),p=D("./src/utils/logger.ts"),f=function(){function o(u){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=u,this.config=u.config,this.Cues=u.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 W.default(this,"textTrack1"),R=new W.default(this,"textTrack2"),S=new W.default(this,"textTrack3"),E=new W.default(this,"textTrack4");this.cea608Parser1=new M.default(1,h,R),this.cea608Parser2=new M.default(3,S,E)}u.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.on(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.on(U.Events.FRAG_LOADING,this.onFragLoading,this),u.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.on(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.on(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var i=o.prototype;return i.destroy=function(){var h=this.hls;h.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),h.off(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),h.off(U.Events.FRAG_LOADING,this.onFragLoading,this),h.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),h.off(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),h.off(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),h.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},i.addCues=function(h,R,S,E,O){for(var x=!1,w=O.length;w--;){var T=O[w],_=s(T[0],T[1],R,S);if(_>=0&&(T[0]=Math.min(T[0],R),T[1]=Math.max(T[1],S),x=!0,_/(S-R)>.5))return}if(x||O.push([R,S]),this.config.renderTextTracksNatively){var l=this.captionsTracks[h];this.Cues.newCue(l,R,S,E)}else{var b=this.Cues.newCue(null,R,S,E);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:b,track:h})}},i.onInitPtsFound=function(h,R){var S=this,E=R.frag,O=R.id,x=R.initPTS,w=R.timescale,T=this.unparsedVttFrags;O==="main"&&(this.initPTS[E.cc]=x,this.timescale[E.cc]=w),T.length&&(this.unparsedVttFrags=[],T.forEach(function(_){S.onFragLoaded(U.Events.FRAG_LOADED,_)}))},i.getExistingTrack=function(h){var R=this.media;if(R)for(var S=0;S<R.textTracks.length;S++){var E=R.textTracks[S];if(E[h])return E}return null},i.createCaptionsTrack=function(h){this.config.renderTextTracksNatively?this.createNativeTrack(h):this.createNonNativeTrack(h)},i.createNativeTrack=function(h){if(this.captionsTracks[h])return;var R=this.captionsProperties,S=this.captionsTracks,E=this.media,O=R[h],x=O.label,w=O.languageCode,T=this.getExistingTrack(h);if(T)S[h]=T,Object(P.clearCurrentCues)(S[h]),Object(P.sendAddTrackEvent)(S[h],E);else{var _=this.createTextTrack("captions",x,w);_&&(_[h]=!0,S[h]=_)}},i.createNonNativeTrack=function(h){if(this.nonNativeCaptionsTracks[h])return;var R=this.captionsProperties[h];if(!R)return;var S=R.label,E={_id:h,label:S,kind:"captions",default:R.media?!!R.media.default:!1,closedCaptions:R.media};this.nonNativeCaptionsTracks[h]=E,this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[E]})},i.createTextTrack=function(h,R,S){var E=this.media;return E?E.addTextTrack(h,R,S):void 0},i.onMediaAttaching=function(h,R){this.media=R.media,this._cleanTracks()},i.onMediaDetaching=function(){var h=this.captionsTracks;Object.keys(h).forEach(function(R){Object(P.clearCurrentCues)(h[R]),delete h[R]}),this.nonNativeCaptionsTracks={}},i.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())},i._cleanTracks=function(){var h=this.media;if(!h)return;var R=h.textTracks;if(R)for(var S=0;S<R.length;S++)Object(P.clearCurrentCues)(R[S])},i.onSubtitleTracksUpdated=function(h,R){var S=this;this.textTracks=[];var E=R.subtitleTracks||[],O=E.some(function(_){return _.textCodec===A.IMSC1_CODEC});if(this.config.enableWebVTT||O&&this.config.enableIMSC1){var x=this.tracks&&E&&this.tracks.length===E.length;if(this.tracks=E||[],this.config.renderTextTracksNatively){var w=this.media?this.media.textTracks:[];this.tracks.forEach(function(_,l){var b;if(l<w.length){for(var m=null,y=0;y<w.length;y++)if(d(w[y],_)){m=w[y];break}m&&(b=m)}b?Object(P.clearCurrentCues)(b):(b=S.createTextTrack("subtitles",_.name,_.lang),b&&(b.mode="disabled")),b&&(b.groupId=_.groupId,S.textTracks.push(b))})}else if(!x&&this.tracks&&this.tracks.length){var T=this.tracks.map(function(_){return{label:_.name,kind:_.type.toLowerCase(),default:_.default,subtitleTrack:_}});this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:T})}}},i.onManifestLoaded=function(h,R){var S=this;this.config.enableCEA708Captions&&R.captions&&R.captions.forEach(function(E){var O=/(?:CC|SERVICE)([1-4])/.exec(E.instreamId);if(!O)return;var x="textTrack"+O[1],w=S.captionsProperties[x];if(!w)return;w.label=E.name,E.lang&&(w.languageCode=E.lang),w.media=E})},i.onFragLoading=function(h,R){var S=this.cea608Parser1,E=this.cea608Parser2,O=this.lastSn,x=this.lastPartIndex;if(!this.enabled||!(S&&E))return;if(R.frag.type===g.PlaylistLevelType.MAIN){var w,T,_=R.frag.sn,l=(w=R==null||((T=R.part)===null||T===void 0)?void 0:T.index)!=null?w:-1;_===O+1||_===O&&l===x+1||(S.reset(),E.reset()),this.lastSn=_,this.lastPartIndex=l}},i.onFragLoaded=function(h,R){var S=R.frag,E=R.payload,O=this.initPTS,x=this.unparsedVttFrags;if(S.type===g.PlaylistLevelType.SUBTITLE)if(E.byteLength){if(!Object(z.isFiniteNumber)(O[S.cc])){x.push(R),O.length&&this.hls.trigger(U.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===A.IMSC1_CODEC?this._parseIMSC1(S,E):this._parseVTTs(S,E,_)}}else this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:S,error:new Error("Empty subtitle payload")})},i._parseIMSC1=function(h,R){var S=this,E=this.hls;Object(A.parseIMSC1)(R,this.initPTS[h.cc],this.timescale[h.cc],function(O){S._appendCues(O,h.level),E.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(O){p.logger.log("Failed to parse IMSC1: "+O),E.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:O})})},i._parseVTTs=function(h,R,S){var E=this,O=this.hls;Object(B.parseWebVTT)(R,this.initPTS[h.cc],this.timescale[h.cc],S,h.cc,h.start,function(x){E._appendCues(x,h.level),O.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(x){E._fallbackToIMSC1(h,R),p.logger.log("Failed to parse VTT cue: "+x),O.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:x})})},i._fallbackToIMSC1=function(h,R){var S=this,E=this.tracks[h.level];E.textCodec||Object(A.parseIMSC1)(R,this.initPTS[h.cc],this.timescale[h.cc],function(){E.textCodec=A.IMSC1_CODEC,S._parseIMSC1(h,R)},function(){E.textCodec="wvtt"})},i._appendCues=function(h,R){var S=this.hls;if(this.config.renderTextTracksNatively){var E=this.textTracks[R];if(E.mode==="disabled")return;h.forEach(function(w){return Object(P.addCueToTrack)(E,w)})}else{var O=this.tracks[R],x=O.default?"default":"subtitles"+R;S.trigger(U.Events.CUES_PARSED,{type:"subtitles",cues:h,track:x})}},i.onFragDecrypted=function(h,R){var S=R.frag;if(S.type===g.PlaylistLevelType.SUBTITLE){if(!Object(z.isFiniteNumber)(this.initPTS[S.cc])){this.unparsedVttFrags.push(R);return}this.onFragLoaded(U.Events.FRAG_LOADED,R)}},i.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},i.onFragParsingUserdata=function(h,R){var S=this.cea608Parser1,E=this.cea608Parser2;if(!this.enabled||!(S&&E))return;for(var O=0;O<R.samples.length;O++){var x=R.samples[O].bytes;if(x){var w=this.extractCea608Data(x);S.addData(R.samples[O].pts,w[0]),E.addData(R.samples[O].pts,w[1])}}},i.onBufferFlushing=function(h,R){var S=R.startOffset,E=R.endOffset,O=R.endOffsetSubtitles,x=R.type,w=this.media;if(!w||w.currentTime<E)return;if(!x||x==="video"){var T=this.captionsTracks;Object.keys(T).forEach(function(l){return Object(P.removeCuesInRange)(T[l],S,E)})}if(this.config.renderTextTracksNatively&&(S===0&&O!==void 0)){var _=this.textTracks;Object.keys(_).forEach(function(l){return Object(P.removeCuesInRange)(_[l],S,O)})}},i.extractCea608Data=function(h){for(var R=h[0]&31,S=2,E=[[],[]],O=0;O<R;O++){var x=h[S++],w=127&h[S++],T=127&h[S++],_=(4&x)!==0,l=3&x;if(w===0&&T===0)continue;_&&((l===0||l===1)&&(E[l].push(w),E[l].push(T)))}return E},o}();function d(o,i){return o&&o.label===i.name&&!(o.textTrack1||o.textTrack2)}function s(o,i,u,h){return Math.min(i,h)-Math.max(o,u)}function c(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"default",function(){return z});var z=function(){function U(W,B){this.subtle=void 0,this.aesIV=void 0,this.subtle=W,this.aesIV=B}var M=U.prototype;return M.decrypt=function(B,P){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},P,B)},U}()},"./src/crypt/aes-decryptor.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"removePadding",function(){return U}),D.d(V,"default",function(){return M});var z=D("./src/utils/typed-array.ts");function U(W){var B=W.byteLength,P=B&&new DataView(W.buffer).getUint8(B-1);return P?Object(z.sliceUint8)(W,0,B-P):W}var M=function(){function W(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var B=W.prototype;return B.uint8ArrayToUint32Array_=function(A){for(var g=new DataView(A),p=new Uint32Array(4),f=0;f<4;f++)p[f]=g.getUint32(f*4);return p},B.initTable=function(){var A=this.sBox,g=this.invSBox,p=this.subMix,f=p[0],d=p[1],s=p[2],c=p[3],o=this.invSubMix,i=o[0],u=o[1],h=o[2],R=o[3],S=new Uint32Array(256),E=0,O=0,x=0;for(x=0;x<256;x++)x<128?S[x]=x<<1:S[x]=x<<1^283;for(x=0;x<256;x++){var w=O^O<<1^O<<2^O<<3^O<<4;w=w>>>8^w&255^99,A[E]=w,g[w]=E;var T=S[E],_=S[T],l=S[_],b=S[w]*257^w*16843008;f[E]=b<<24|b>>>8,d[E]=b<<16|b>>>16,s[E]=b<<8|b>>>24,c[E]=b,b=l*16843009^_*65537^T*257^E*16843008,i[w]=b<<24|b>>>8,u[w]=b<<16|b>>>16,h[w]=b<<8|b>>>24,R[w]=b,E?(E=T^S[S[S[l^T]]],O^=S[S[O]]):E=O=1}},B.expandKey=function(A){for(var g=this.uint8ArrayToUint32Array_(A),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,o,i=this.keySchedule=new Uint32Array(s),u=this.invKeySchedule=new Uint32Array(s),h=this.sBox,R=this.rcon,S=this.invSubMix,E=S[0],O=S[1],x=S[2],w=S[3],T,_;for(c=0;c<s;c++){if(c<d){T=i[c]=g[c];continue}_=T,c%d===0?(_=_<<8|_>>>24,_=h[_>>>24]<<24|h[_>>>16&255]<<16|h[_>>>8&255]<<8|h[_&255],_^=R[c/d|0]<<24):d>6&&c%d===4&&(_=h[_>>>24]<<24|h[_>>>16&255]<<16|h[_>>>8&255]<<8|h[_&255]),i[c]=T=(i[c-d]^_)>>>0}for(o=0;o<s;o++)c=s-o,o&3?_=i[c]:_=i[c-4],o<4||c<=4?u[o]=_:u[o]=E[h[_>>>24]]^O[h[_>>>16&255]]^x[h[_>>>8&255]]^w[h[_&255]],u[o]=u[o]>>>0},B.networkToHostOrderSwap=function(A){return A<<24|(A&65280)<<8|(A&16711680)>>8|A>>>24},B.decrypt=function(A,g,p){for(var f=this.keySize+6,d=this.invKeySchedule,s=this.invSBox,c=this.invSubMix,o=c[0],i=c[1],u=c[2],h=c[3],R=this.uint8ArrayToUint32Array_(p),S=R[0],E=R[1],O=R[2],x=R[3],w=new Int32Array(A),T=new Int32Array(w.length),_,l,b,m,y,k,I,N,F,C,v,j,K,J,te=this.networkToHostOrderSwap;g<w.length;){for(F=te(w[g]),C=te(w[g+1]),v=te(w[g+2]),j=te(w[g+3]),y=F^d[0],k=j^d[1],I=v^d[2],N=C^d[3],K=4,J=1;J<f;J++)_=o[y>>>24]^i[k>>16&255]^u[I>>8&255]^h[N&255]^d[K],l=o[k>>>24]^i[I>>16&255]^u[N>>8&255]^h[y&255]^d[K+1],b=o[I>>>24]^i[N>>16&255]^u[y>>8&255]^h[k&255]^d[K+2],m=o[N>>>24]^i[y>>16&255]^u[k>>8&255]^h[I&255]^d[K+3],y=_,k=l,I=b,N=m,K=K+4;_=s[y>>>24]<<24^s[k>>16&255]<<16^s[I>>8&255]<<8^s[N&255]^d[K],l=s[k>>>24]<<24^s[I>>16&255]<<16^s[N>>8&255]<<8^s[y&255]^d[K+1],b=s[I>>>24]<<24^s[N>>16&255]<<16^s[y>>8&255]<<8^s[k&255]^d[K+2],m=s[N>>>24]<<24^s[y>>16&255]<<16^s[k>>8&255]<<8^s[I&255]^d[K+3],T[g]=te(_^S),T[g+1]=te(m^E),T[g+2]=te(b^O),T[g+3]=te(l^x),S=F,E=C,O=v,x=j,g=g+4}return T.buffer},W}()},"./src/crypt/decrypter.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"default",function(){return g});var z=D("./src/crypt/aes-crypto.ts"),U=D("./src/crypt/fast-aes-key.ts"),M=D("./src/crypt/aes-decryptor.ts"),W=D("./src/utils/logger.ts"),B=D("./src/utils/mp4-tools.ts"),P=D("./src/utils/typed-array.ts"),A=16,g=function(){function p(d,s,c){var o=c===void 0?{}:c,i=o.removePKCS7Padding,u=i===void 0?!0:i;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=u,u)try{var h=self.crypto;h&&(this.subtle=h.subtle||h.webkitSubtle)}catch(R){}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(M.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,o,i){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(s),c,o);var u=this.flush();u&&i(u.buffer)}else this.webCryptoDecrypt(new Uint8Array(s),c,o).then(i)},f.softwareDecrypt=function(s,c,o){var i=this.currentIV,u=this.currentResult,h=this.remainderData;this.logOnce("JS AES decrypt"),h&&(s=Object(B.appendUint8Array)(h,s),this.remainderData=null);var R=this.getValidChunk(s);if(!R.length)return null;i&&(o=i);var S=this.softwareDecrypter;S||(S=this.softwareDecrypter=new M.default),S.expandKey(c);var E=u;return this.currentResult=S.decrypt(R.buffer,0,o),this.currentIV=Object(P.sliceUint8)(R,-16).buffer,E||null},f.webCryptoDecrypt=function(s,c,o){var i=this,u=this.subtle;return(this.key!==c||!this.fastAesKey)&&(this.key=c,this.fastAesKey=new U.default(u,c)),this.fastAesKey.expandKey().then(function(h){if(!u)return Promise.reject(new Error("web crypto not initialized"));var R=new z.default(u,o);return R.decrypt(s.buffer,h)}).catch(function(h){return i.onWebCryptoError(h,s,c,o)})},f.onWebCryptoError=function(s,c,o,i){return W.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",s),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(c,o,i)},f.getValidChunk=function(s){var c=s,o=s.length-s.length%A;return o!==s.length&&(c=Object(P.sliceUint8)(s,0,o),this.remainderData=Object(P.sliceUint8)(s,o)),c},f.logOnce=function(s){if(!this.logEnabled)return;W.logger.log("[decrypter.ts]: "+s),this.logEnabled=!1},p}()},"./src/crypt/fast-aes-key.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"default",function(){return z});var z=function(){function U(W,B){this.subtle=void 0,this.key=void 0,this.subtle=W,this.key=B}var M=U.prototype;return M.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},U}()},"./src/demux/aacdemuxer.ts":function(re,V,D){"use strict";D.r(V);var z=D("./src/demux/base-audio-demuxer.ts"),U=D("./src/demux/adts.ts"),M=D("./src/utils/logger.ts"),W=D("./src/demux/id3.ts");function B(g,p){g.prototype=Object.create(p.prototype),g.prototype.constructor=g,P(g,p)}function P(g,p){return P=Object.setPrototypeOf||function(d,s){return d.__proto__=s,d},P(g,p)}var A=function(g){B(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,o){g.prototype.resetInitSegment.call(this,s,c,o),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:s,duration:o,inputTimeScale:9e4,dropped:0}},p.probe=function(s){if(!s)return!1;for(var c=W.getID3Data(s,0)||[],o=c.length,i=s.length;o<i;o++)if(U.probe(s,o))return M.logger.log("ADTS sync word found !"),!0;return!1},f.canParse=function(s,c){return U.canParse(s,c)},f.appendFrame=function(s,c,o){U.initTrackConfig(s,this.observer,c,o,s.manifestCodec);var i=U.appendFrame(s,c,o,this.initPTS,this.frameIndex);if(i&&i.missing===0)return i},p}(z.default);A.minProbeByteLength=9,V.default=A},"./src/demux/adts.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"getAudioConfig",function(){return W}),D.d(V,"isHeaderPattern",function(){return B}),D.d(V,"getHeaderLength",function(){return P}),D.d(V,"getFullFrameLength",function(){return A}),D.d(V,"canGetFrameLength",function(){return g}),D.d(V,"isHeader",function(){return p}),D.d(V,"canParse",function(){return f}),D.d(V,"probe",function(){return d}),D.d(V,"initTrackConfig",function(){return s}),D.d(V,"getFrameDuration",function(){return c}),D.d(V,"parseFrameHeader",function(){return o}),D.d(V,"appendFrame",function(){return i});var z=D("./src/utils/logger.ts"),U=D("./src/errors.ts"),M=D("./src/events.ts");function W(u,h,R,S){var E,O,x,w,T=navigator.userAgent.toLowerCase(),_=S,l=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];E=((h[R+2]&192)>>>6)+1;var b=(h[R+2]&60)>>>2;if(b>l.length-1){u.trigger(M.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+b});return}return x=(h[R+2]&1)<<2,x|=(h[R+3]&192)>>>6,z.logger.log("manifest codec:"+S+", ADTS type:"+E+", samplingIndex:"+b),/firefox/i.test(T)?b>=6?(E=5,w=new Array(4),O=b-3):(E=2,w=new Array(2),O=b):T.indexOf("android")!==-1?(E=2,w=new Array(2),O=b):(E=5,w=new Array(4),S&&(S.indexOf("mp4a.40.29")!==-1||S.indexOf("mp4a.40.5")!==-1)||!S&&b>=6?O=b-3:((S&&S.indexOf("mp4a.40.2")!==-1&&(b>=6&&x===1||/vivaldi/i.test(T))||!S&&x===1)&&(E=2,w=new Array(2)),O=b)),w[0]=E<<3,w[0]|=(b&14)>>1,w[1]|=(b&1)<<7,w[1]|=x<<3,E===5&&(w[1]|=(O&14)>>1,w[2]=(O&1)<<7,w[2]|=2<<2,w[3]=0),{config:w,samplerate:l[b],channelCount:x,codec:"mp4a.40."+E,manifestCodec:_}}function B(u,h){return u[h]===255&&(u[h+1]&246)===240}function P(u,h){return u[h+1]&1?7:9}function A(u,h){return(u[h+3]&3)<<11|u[h+4]<<3|(u[h+5]&224)>>>5}function g(u,h){return h+5<u.length}function p(u,h){return h+1<u.length&&B(u,h)}function f(u,h){return g(u,h)&&B(u,h)&&A(u,h)<=u.length-h}function d(u,h){if(p(u,h)){var R=P(u,h);if(h+R>=u.length)return!1;var S=A(u,h);if(S<=R)return!1;var E=h+S;return E===u.length||p(u,E)}return!1}function s(u,h,R,S,E){if(!u.samplerate){var O=W(h,R,S,E);if(!O)return;u.config=O.config,u.samplerate=O.samplerate,u.channelCount=O.channelCount,u.codec=O.codec,u.manifestCodec=O.manifestCodec,z.logger.log("parsed codec:"+u.codec+", rate:"+O.samplerate+", channels:"+O.channelCount)}}function c(u){return 1024*9e4/u}function o(u,h,R,S,E){var O=P(u,h),x=A(u,h);if(x-=O,x>0){var w=R+S*E;return{headerLength:O,frameLength:x,stamp:w}}}function i(u,h,R,S,E){var O=c(u.samplerate),x=o(h,R,S,E,O);if(x){var w=x.frameLength,T=x.headerLength,_=x.stamp,l=T+w,b=Math.max(0,R+l-h.length),m;b?(m=new Uint8Array(l-T),m.set(h.subarray(R+T,h.length),0)):m=h.subarray(R+T,R+l);var y={unit:m,pts:_};return b||u.samples.push(y),{sample:y,length:l,missing:b}}}},"./src/demux/base-audio-demuxer.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"initPTSFn",function(){return A});var z=D("./src/polyfills/number.ts"),U=D("./src/demux/id3.ts"),M=D("./src/demux/dummy-demuxed-track.ts"),W=D("./src/utils/mp4-tools.ts"),B=D("./src/utils/typed-array.ts"),P=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(W.appendUint8Array)(this.cachedData,d),this.cachedData=null);var c=U.getID3Data(d,0),o=c?c.length:0,i,u,h=this._audioTrack,R=this._id3Track,S=c?U.getTimeStamp(c):void 0,E=d.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=A(S,s)),c&&c.length>0&&R.samples.push({pts:this.initPTS,dts:this.initPTS,data:c}),u=this.initPTS;o<E;){if(this.canParse(d,o)){var O=this.appendFrame(h,d,o);O?(this.frameIndex++,u=O.sample.pts,o+=O.length,i=o):o=E}else U.canParse(d,o)?(c=U.getID3Data(d,o),R.samples.push({pts:u,dts:u,data:c}),o+=c.length,i=o):o++;if(o===E&&i!==E){var x=Object(B.sliceUint8)(d,i);this.cachedData?this.cachedData=Object(W.appendUint8Array)(this.cachedData,x):this.cachedData=x}}return{audioTrack:h,avcTrack:Object(M.dummyTrack)(),id3Track:R,textTrack:Object(M.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(M.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(M.dummyTrack)()}},p.destroy=function(){},g}(),A=function(p,f){return Object(z.isFiniteNumber)(p)?p*90:f*9e4};V.default=P},"./src/demux/chunk-cache.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"default",function(){return z});var z=function(){function M(){this.chunks=[],this.dataLength=0}var W=M.prototype;return W.push=function(P){this.chunks.push(P),this.dataLength+=P.length},W.flush=function(){var P=this.chunks,A=this.dataLength,g;if(P.length)P.length===1?g=P[0]:g=U(P,A);else return new Uint8Array(0);return this.reset(),g},W.reset=function(){this.chunks.length=0,this.dataLength=0},M}();function U(M,W){for(var B=new Uint8Array(W),P=0,A=0;A<M.length;A++){var g=M[A];B.set(g,P),P+=g.length}return B}},"./src/demux/dummy-demuxed-track.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"dummyTrack",function(){return z});function z(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(re,V,D){"use strict";D.r(V);var z=D("./src/utils/logger.ts"),U=function(){function M(B){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=B,this.bytesAvailable=B.byteLength,this.word=0,this.bitsAvailable=0}var W=M.prototype;return W.loadWord=function(){var P=this.data,A=this.bytesAvailable,g=P.byteLength-A,p=new Uint8Array(4),f=Math.min(4,A);if(f===0)throw new Error("no bytes available");p.set(P.subarray(g,g+f)),this.word=new DataView(p.buffer).getUint32(0),this.bitsAvailable=f*8,this.bytesAvailable-=f},W.skipBits=function(P){var A;this.bitsAvailable>P?(this.word<<=P,this.bitsAvailable-=P):(P-=this.bitsAvailable,A=P>>3,P-=A>>3,this.bytesAvailable-=A,this.loadWord(),this.word<<=P,this.bitsAvailable-=P)},W.readBits=function(P){var A=Math.min(this.bitsAvailable,P),g=this.word>>>32-A;return P>32&&z.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=A,this.bitsAvailable>0?this.word<<=A:this.bytesAvailable>0&&this.loadWord(),A=P-A,A>0&&this.bitsAvailable?g<<A|this.readBits(A):g},W.skipLZ=function(){var P;for(P=0;P<this.bitsAvailable;++P)if((this.word&2147483648>>>P)!==0)return this.word<<=P,this.bitsAvailable-=P,P;return this.loadWord(),P+this.skipLZ()},W.skipUEG=function(){this.skipBits(1+this.skipLZ())},W.skipEG=function(){this.skipBits(1+this.skipLZ())},W.readUEG=function(){var P=this.skipLZ();return this.readBits(P+1)-1},W.readEG=function(){var P=this.readUEG();return 1&P?1+P>>>1:-1*(P>>>1)},W.readBoolean=function(){return this.readBits(1)===1},W.readUByte=function(){return this.readBits(8)},W.readUShort=function(){return this.readBits(16)},W.readUInt=function(){return this.readBits(32)},W.skipScalingList=function(P){for(var A=8,g=8,p,f=0;f<P;f++)g!==0&&(p=this.readEG(),g=(A+p+256)%256),A=g===0?A:g},W.readSPS=function(){var P=0,A=0,g=0,p=0,f,d,s,c=this.readUByte.bind(this),o=this.readBits.bind(this),i=this.readUEG.bind(this),u=this.readBoolean.bind(this),h=this.skipBits.bind(this),R=this.skipEG.bind(this),S=this.skipUEG.bind(this),E=this.skipScalingList.bind(this);c();var O=c();if(o(5),h(3),c(),S(),O===100||O===110||O===122||O===244||O===44||O===83||O===86||O===118||O===128){var x=i();if(x===3&&h(1),S(),S(),h(1),u())for(d=x!==3?8:12,s=0;s<d;s++)u()&&(s<6?E(16):E(64))}S();var w=i();if(w===0)i();else if(w===1)for(h(1),R(),R(),f=i(),s=0;s<f;s++)R();S(),h(1);var T=i(),_=i(),l=o(1);l===0&&h(1),h(1),u()&&(P=i(),A=i(),g=i(),p=i());var b=[1,1];if(u()&&u()){var m=c();switch(m){case 1:b=[1,1];break;case 2:b=[12,11];break;case 3:b=[10,11];break;case 4:b=[16,11];break;case 5:b=[40,33];break;case 6:b=[24,11];break;case 7:b=[20,11];break;case 8:b=[32,11];break;case 9:b=[80,33];break;case 10:b=[18,11];break;case 11:b=[15,11];break;case 12:b=[64,33];break;case 13:b=[160,99];break;case 14:b=[4,3];break;case 15:b=[3,2];break;case 16:b=[2,1];break;case 255:{b=[c()<<8|c(),c()<<8|c()];break}}}return{width:Math.ceil((T+1)*16-P*2-A*2),height:(2-l)*(_+1)*16-(l?2:4)*(g+p),pixelRatio:b}},W.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},M}();V.default=U},"./src/demux/id3.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"isHeader",function(){return z}),D.d(V,"isFooter",function(){return U}),D.d(V,"getID3Data",function(){return M}),D.d(V,"canParse",function(){return B}),D.d(V,"getTimeStamp",function(){return P}),D.d(V,"isTimeStampFrame",function(){return A}),D.d(V,"getID3Frames",function(){return p}),D.d(V,"decodeFrame",function(){return f}),D.d(V,"utf8ArrayToStr",function(){return i}),D.d(V,"testables",function(){return u});var z=function(E,O){return O+10<=E.length&&(E[O]===73&&E[O+1]===68&&E[O+2]===51&&(E[O+3]<255&&E[O+4]<255&&(E[O+6]<128&&E[O+7]<128&&E[O+8]<128&&E[O+9]<128)))},U=function(E,O){return O+10<=E.length&&(E[O]===51&&E[O+1]===68&&E[O+2]===73&&(E[O+3]<255&&E[O+4]<255&&(E[O+6]<128&&E[O+7]<128&&E[O+8]<128&&E[O+9]<128)))},M=function(E,O){for(var x=O,w=0;z(E,O);){w+=10;var T=W(E,O+6);w+=T,U(E,O+10)&&(w+=10),O+=w}return w>0?E.subarray(x,x+w):void 0},W=function(E,O){var x=0;return x=(E[O]&127)<<21,x|=(E[O+1]&127)<<14,x|=(E[O+2]&127)<<7,x|=E[O+3]&127,x},B=function(E,O){return z(E,O)&&W(E,O+6)+10<=E.length-O},P=function(E){for(var O=p(E),x=0;x<O.length;x++){var w=O[x];if(A(w))return o(w)}return},A=function(E){return E&&E.key==="PRIV"&&E.info==="com.apple.streaming.transportStreamTimestamp"},g=function(E){var O=String.fromCharCode(E[0],E[1],E[2],E[3]),x=W(E,4),w=10;return{type:O,size:x,data:E.subarray(w,w+x)}},p=function(E){for(var O=0,x=[];z(E,O);){var w=W(E,O+6);O+=10;for(var T=O+w;O+8<T;){var _=g(E.subarray(O)),l=f(_);l&&x.push(l),O+=_.size+10}U(E,O)&&(O+=10)}return x},f=function(E){return E.type==="PRIV"?d(E):E.type[0]==="W"?c(E):s(E)},d=function(E){if(E.size<2)return;var O=i(E.data,!0),x=new Uint8Array(E.data.subarray(O.length+1));return{key:E.type,info:O,data:x.buffer}},s=function(E){if(E.size<2)return;if(E.type==="TXXX"){var O=1,x=i(E.data.subarray(O),!0);O+=x.length+1;var w=i(E.data.subarray(O));return{key:E.type,info:x,data:w}}var T=i(E.data.subarray(1));return{key:E.type,data:T}},c=function(E){if(E.type==="WXXX"){if(E.size<2)return;var O=1,x=i(E.data.subarray(O),!0);O+=x.length+1;var w=i(E.data.subarray(O));return{key:E.type,info:x,data:w}}var T=i(E.data);return{key:E.type,data:T}},o=function(E){if(E.data.byteLength===8){var O=new Uint8Array(E.data),x=O[3]&1,w=(O[4]<<23)+(O[5]<<15)+(O[6]<<7)+O[7];return w/=45,x&&(w+=4772185884e-2),Math.round(w)}return},i=function(E,O){O===void 0&&(O=!1);var x=R();if(x){var w=x.decode(E);if(O){var T=w.indexOf("\0");return T!==-1?w.substring(0,T):w}return w.replace(/\0/g,"")}for(var _=E.length,l,b,m,y="",k=0;k<_;){if(l=E[k++],l===0&&O)return y;if(l===0||l===3)continue;switch(l>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:y+=String.fromCharCode(l);break;case 12:case 13:b=E[k++],y+=String.fromCharCode((l&31)<<6|b&63);break;case 14:b=E[k++],m=E[k++],y+=String.fromCharCode((l&15)<<12|(b&63)<<6|(m&63)<<0);break;default:}}return y},u={decodeTextFrame:s},h;function R(){return!h&&typeof self.TextDecoder!="undefined"&&(h=new self.TextDecoder("utf-8")),h}},"./src/demux/mp3demuxer.ts":function(re,V,D){"use strict";D.r(V);var z=D("./src/demux/base-audio-demuxer.ts"),U=D("./src/demux/id3.ts"),M=D("./src/utils/logger.ts"),W=D("./src/demux/mpegaudio.ts");function B(g,p){g.prototype=Object.create(p.prototype),g.prototype.constructor=g,P(g,p)}function P(g,p){return P=Object.setPrototypeOf||function(d,s){return d.__proto__=s,d},P(g,p)}var A=function(g){B(p,g);function p(){return g.apply(this,arguments)||this}var f=p.prototype;return f.resetInitSegment=function(s,c,o){g.prototype.resetInitSegment.call(this,s,c,o),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:s,duration:o,inputTimeScale:9e4,dropped:0}},p.probe=function(s){if(!s)return!1;for(var c=U.getID3Data(s,0)||[],o=c.length,i=s.length;o<i;o++)if(W.probe(s,o))return M.logger.log("MPEG Audio sync word found !"),!0;return!1},f.canParse=function(s,c){return W.canParse(s,c)},f.appendFrame=function(s,c,o){return this.initPTS===null?void 0:W.appendFrame(s,c,o,this.initPTS,this.frameIndex)},p}(z.default);A.minProbeByteLength=4,V.default=A},"./src/demux/mp4demuxer.ts":function(re,V,D){"use strict";D.r(V);var z=D("./src/utils/mp4-tools.ts"),U=D("./src/demux/dummy-demuxed-track.ts"),M=function(){function W(P,A){this.remainderData=null,this.config=void 0,this.config=A}var B=W.prototype;return B.resetTimeStamp=function(){},B.resetInitSegment=function(){},B.resetContiguity=function(){},W.probe=function(A){return Object(z.findBox)({data:A,start:0,end:Math.min(A.length,16384)},["moof"]).length>0},B.demux=function(A){var g=A,p=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(g=Object(z.appendUint8Array)(this.remainderData,A));var f=Object(z.segmentValidRange)(g);this.remainderData=f.remainder,p.samples=f.valid||new Uint8Array}else p.samples=g;return{audioTrack:Object(U.dummyTrack)(),avcTrack:p,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},B.flush=function(){var A=Object(U.dummyTrack)();return A.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(U.dummyTrack)(),avcTrack:A,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},B.demuxSampleAes=function(A,g,p){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},B.destroy=function(){},W}();M.minProbeByteLength=1024,V.default=M},"./src/demux/mpegaudio.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"appendFrame",function(){return P}),D.d(V,"parseHeader",function(){return A}),D.d(V,"isHeaderPattern",function(){return g}),D.d(V,"isHeader",function(){return p}),D.d(V,"canParse",function(){return f}),D.d(V,"probe",function(){return d});var z=null,U=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],M=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],W=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],B=[0,1,1,4];function P(s,c,o,i,u){if(o+24>c.length)return;var h=A(c,o);if(h&&o+h.frameLength<=c.length){var R=h.samplesPerFrame*9e4/h.sampleRate,S=i+u*R,E={unit:c.subarray(o,o+h.frameLength),pts:S,dts:S};return s.config=[],s.channelCount=h.channelCount,s.samplerate=h.sampleRate,s.samples.push(E),{sample:E,length:h.frameLength,missing:0}}}function A(s,c){var o=s[c+1]>>3&3,i=s[c+1]>>1&3,u=s[c+2]>>4&15,h=s[c+2]>>2&3;if(o!==1&&u!==0&&u!==15&&h!==3){var R=s[c+2]>>1&1,S=s[c+3]>>6,E=o===3?3-i:i===3?3:4,O=U[E*14+u-1]*1e3,x=o===3?0:o===2?1:2,w=M[x*3+h],T=S===3?1:2,_=W[o][i],l=B[i],b=_*8*l,m=Math.floor(_*O/w+R)*l;if(z===null){var y=navigator.userAgent||"",k=y.match(/Chrome\/(\d+)/i);z=k?parseInt(k[1]):0}var I=!!z&&z<=87;return I&&i===2&&O>=224e3&&S===0&&(s[c+3]=s[c+3]|128),{sampleRate:w,channelCount:T,frameLength:m,samplesPerFrame:b}}}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 o=4;return g(s,c)&&o<=s.length-c}function d(s,c){if(c+1<s.length&&g(s,c)){var o=4,i=A(s,c),u=o;i!=null&&i.frameLength&&(u=i.frameLength);var h=c+u;return h===s.length||p(s,h)}return!1}},"./src/demux/sample-aes.ts":function(re,V,D){"use strict";D.r(V);var z=D("./src/crypt/decrypter.ts"),U=D("./src/demux/tsdemuxer.ts"),M=function(){function W(P,A,g){this.keyData=void 0,this.decrypter=void 0,this.keyData=g,this.decrypter=new z.default(P,A,{removePKCS7Padding:!1})}var B=W.prototype;return B.decryptBuffer=function(A,g){this.decrypter.decrypt(A,this.keyData.key.buffer,this.keyData.iv.buffer,g)},B.decryptAacSample=function(A,g,p,f){var d=A[g].unit,s=d.subarray(16,d.length-d.length%16),c=s.buffer.slice(s.byteOffset,s.byteOffset+s.length),o=this;this.decryptBuffer(c,function(i){var u=new Uint8Array(i);d.set(u,16),f||o.decryptAacSamples(A,g+1,p)})},B.decryptAacSamples=function(A,g,p){for(;;g++){if(g>=A.length){p();return}if(A[g].unit.length<32)continue;var f=this.decrypter.isSync();if(this.decryptAacSample(A,g,p,f),!f)return}},B.getAvcEncryptedData=function(A){for(var g=Math.floor((A.length-48)/160)*16+16,p=new Int8Array(g),f=0,d=32;d<=A.length-16;d+=160,f+=16)p.set(A.subarray(d,d+16),f);return p},B.getAvcDecryptedUnit=function(A,g){for(var p=new Uint8Array(g),f=0,d=32;d<=A.length-16;d+=160,f+=16)A.set(p.subarray(f,f+16),d);return A},B.decryptAvcSample=function(A,g,p,f,d,s){var c=Object(U.discardEPB)(d.data),o=this.getAvcEncryptedData(c),i=this;this.decryptBuffer(o.buffer,function(u){d.data=i.getAvcDecryptedUnit(c,u),s||i.decryptAvcSamples(A,g,p+1,f)})},B.decryptAvcSamples=function(A,g,p,f){if(A instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;g++,p=0){if(g>=A.length){f();return}for(var d=A[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(A,g,p,f,s,c),!c)return}}},W}();V.default=M},"./src/demux/transmuxer-interface.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"default",function(){return d});var z=D("./node_modules/webworkify-webpack/index.js"),U=D.n(z),M=D("./src/events.ts"),W=D("./src/demux/transmuxer.ts"),B=D("./src/utils/logger.ts"),P=D("./src/errors.ts"),A=D("./src/utils/mediasource-helper.ts"),g=D("./node_modules/eventemitter3/index.js"),p=D.n(g),f=Object(A.getMediaSource)()||{isTypeSupported:function(){return!1}},d=function(){function s(o,i,u,h){var R=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=o,this.id=i,this.onTransmuxComplete=u,this.onFlush=h;var S=o.config,E=function(_,l){l=l||{},l.frag=R.frag,l.id=R.id,o.trigger(_,l)};this.observer=new g.EventEmitter,this.observer.on(M.Events.FRAG_DECRYPTED,E),this.observer.on(M.Events.ERROR,E);var O={mp4:f.isTypeSupported("video/mp4"),mpeg:f.isTypeSupported("audio/mpeg"),mp3:f.isTypeSupported('audio/mp4; codecs="mp3"')},x=navigator.vendor;if(S.enableWorker&&typeof Worker!="undefined"){B.logger.log("demuxing in webworker");var w;try{w=this.worker=z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),w.addEventListener("message",this.onwmsg),w.onerror=function(T){o.trigger(M.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(T.message+" ("+T.filename+":"+T.lineno+")")})},w.postMessage({cmd:"init",typeSupported:O,vendor:x,id:i,config:JSON.stringify(S)})}catch(T){B.logger.warn("Error in worker:",T),B.logger.error("Error while initializing DemuxerWorker, fallback to inline"),w&&self.URL.revokeObjectURL(w.objectURL),this.transmuxer=new W.default(this.observer,O,S,x,i),this.worker=null}}else this.transmuxer=new W.default(this.observer,O,S,x,i)}var c=s.prototype;return c.destroy=function(){var i=this.worker;if(i)i.removeEventListener("message",this.onwmsg),i.terminate(),this.worker=null;else{var u=this.transmuxer;u&&(u.destroy(),this.transmuxer=null)}var h=this.observer;h&&h.removeAllListeners(),this.observer=null},c.push=function(i,u,h,R,S,E,O,x,w,T){var _=this;w.transmuxing.start=self.performance.now();var l=this.transmuxer,b=this.worker,m=E?E.start:S.start,y=S.decryptdata,k=this.frag,I=!(k&&S.cc===k.cc),N=!(k&&w.level===k.level),F=k?w.sn-k.sn:-1,C=this.part?w.part-this.part.index:1,v=!N&&(F===1||F===0&&C===1),j=self.performance.now();(N||F||S.stats.parsing.start===0)&&(S.stats.parsing.start=j),E&&(C||!v)&&(E.stats.parsing.start=j);var K=new W.TransmuxState(I,v,x,N,m);if(!v||I){B.logger.log("[transmuxer-interface, "+S.type+"]: Starting new transmux session for sn: "+w.sn+" p: "+w.part+" level: "+w.level+" id: "+w.id+`
|
|
discontinuity: `+I+`
|
|
trackSwitch: `+N+`
|
|
contiguous: `+v+`
|
|
accurateTimeOffset: `+x+`
|
|
timeOffset: `+m);var J=new W.TransmuxConfig(h,R,u,O,T);this.configureTransmuxer(J)}if(this.frag=S,this.part=E,b)b.postMessage({cmd:"demux",data:i,decryptdata:y,chunkMeta:w,state:K},i instanceof ArrayBuffer?[i]:[]);else if(l){var te=l.push(i,y,w,K);Object(W.isPromise)(te)?te.then(function(ve){_.handleTransmuxComplete(ve)}):this.handleTransmuxComplete(te)}},c.flush=function(i){var u=this;i.transmuxing.start=self.performance.now();var h=this.transmuxer,R=this.worker;if(R)R.postMessage({cmd:"flush",chunkMeta:i});else if(h){var S=h.flush(i);Object(W.isPromise)(S)?S.then(function(E){u.handleFlushResult(E,i)}):this.handleFlushResult(S,i)}},c.handleFlushResult=function(i,u){var h=this;i.forEach(function(R){h.handleTransmuxComplete(R)}),this.onFlush(u)},c.onWorkerMessage=function(i){var u=i.data,h=this.hls;switch(u.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.id=this.id,h.trigger(u.event,u.data);break}}},c.configureTransmuxer=function(i){var u=this.worker,h=this.transmuxer;u?u.postMessage({cmd:"configure",config:i}):h&&h.configure(i)},c.handleTransmuxComplete=function(i){i.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(i)},s}()},"./src/demux/transmuxer-worker.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"default",function(){return P});var z=D("./src/demux/transmuxer.ts"),U=D("./src/events.ts"),M=D("./src/utils/logger.ts"),W=D("./node_modules/eventemitter3/index.js"),B=D.n(W);function P(d){var s=new W.EventEmitter,c=function(i,u){d.postMessage({event:i,data:u})};s.on(U.Events.FRAG_DECRYPTED,c),s.on(U.Events.ERROR,c),d.addEventListener("message",function(o){var i=o.data;switch(i.cmd){case"init":{var u=JSON.parse(i.config);d.transmuxer=new z.default(s,i.typeSupported,u,i.vendor,i.id),Object(M.enableLogs)(u.debug),c("init",null);break}case"configure":{d.transmuxer.configure(i.config);break}case"demux":{var h=d.transmuxer.push(i.data,i.decryptdata,i.chunkMeta,i.state);Object(z.isPromise)(h)?h.then(function(E){A(d,E)}):A(d,h);break}case"flush":{var R=i.chunkMeta,S=d.transmuxer.flush(R);Object(z.isPromise)(S)?S.then(function(E){p(d,E,R)}):p(d,S,R);break}default:break}})}function A(d,s){if(f(s.remuxResult))return;var c=[],o=s.remuxResult,i=o.audio,u=o.video;i&&g(c,i),u&&g(c,u),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(o){A(d,o)}),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(re,V,D){"use strict";D.r(V),D.d(V,"default",function(){return u}),D.d(V,"isPromise",function(){return S}),D.d(V,"TransmuxConfig",function(){return E}),D.d(V,"TransmuxState",function(){return O});var z=D("./src/events.ts"),U=D("./src/errors.ts"),M=D("./src/crypt/decrypter.ts"),W=D("./src/demux/aacdemuxer.ts"),B=D("./src/demux/mp4demuxer.ts"),P=D("./src/demux/tsdemuxer.ts"),A=D("./src/demux/mp3demuxer.ts"),g=D("./src/remux/mp4-remuxer.ts"),p=D("./src/remux/passthrough-remuxer.ts"),f=D("./src/demux/chunk-cache.ts"),d=D("./src/utils/mp4-tools.ts"),s=D("./src/utils/logger.ts"),c;try{c=self.performance.now.bind(self.performance)}catch(x){s.logger.debug("Unable to use Performance API on this environment"),c=self.Date.now}var o=[{demux:P.default,remux:g.default},{demux:B.default,remux:p.default},{demux:W.default,remux:g.default},{demux:A.default,remux:g.default}],i=1024;o.forEach(function(x){var w=x.demux;i=Math.max(i,w.minProbeByteLength)});var u=function(){function x(T,_,l,b,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=l,this.vendor=b,this.id=m}var w=x.prototype;return w.configure=function(_){this.transmuxConfig=_,this.decrypter&&this.decrypter.reset()},w.push=function(_,l,b,m){var y=this,k=b.transmuxing;k.executeStart=c();var I=new Uint8Array(_),N=this.cache,F=this.config,C=this.currentTransmuxState,v=this.transmuxConfig;m&&(this.currentTransmuxState=m);var j=h(I,l);if(j&&j.method==="AES-128"){var K=this.getDecrypter();if(F.enableSoftwareAES){var J=K.softwareDecrypt(I,j.key.buffer,j.iv.buffer);if(!J)return k.executeEnd=c(),R(b);I=new Uint8Array(J)}else return this.decryptionPromise=K.webCryptoDecrypt(I,j.key.buffer,j.iv.buffer).then(function(ye){var xe=y.push(ye,null,b);return y.decryptionPromise=null,xe}),this.decryptionPromise}var te=m||C,ve=te.contiguous,ue=te.discontinuity,de=te.trackSwitch,oe=te.accurateTimeOffset,me=te.timeOffset,ae=v.audioCodec,fe=v.videoCodec,Q=v.defaultInitPts,ie=v.duration,ee=v.initSegmentData;if((ue||de)&&this.resetInitSegment(ee,ae,fe,ie),ue&&this.resetInitialTimestamp(Q),ve||this.resetContiguity(),this.needsProbing(I,ue,de)){if(N.dataLength){var Te=N.flush();I=Object(d.appendUint8Array)(Te,I)}this.configureTransmuxer(I,v)}var Se=this.transmux(I,j,me,oe,b),be=this.currentTransmuxState;return be.contiguous=!0,be.discontinuity=!1,be.trackSwitch=!1,k.executeEnd=c(),Se},w.flush=function(_){var l=this,b=_.transmuxing;b.executeStart=c();var m=this.decrypter,y=this.cache,k=this.currentTransmuxState,I=this.decryptionPromise;if(I)return I.then(function(){return l.flush(_)});var N=[],F=k.timeOffset;if(m){var C=m.flush();C&&N.push(this.push(C,null,_))}var v=y.dataLength;y.reset();var j=this.demuxer,K=this.remuxer;if(!j||!K)return v>=i&&this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),b.executeEnd=c(),[R(_)];var J=j.flush(F);return S(J)?J.then(function(te){return l.flushRemux(N,te,_),N}):(this.flushRemux(N,J,_),N)},w.flushRemux=function(_,l,b){var m=l.audioTrack,y=l.avcTrack,k=l.id3Track,I=l.textTrack,N=this.currentTransmuxState,F=N.accurateTimeOffset,C=N.timeOffset;s.logger.log("[transmuxer.ts]: Flushed fragment "+b.sn+(b.part>-1?" p: "+b.part:"")+" of level "+b.level);var v=this.remuxer.remux(m,y,k,I,C,F,!0,this.id);_.push({remuxResult:v,chunkMeta:b}),b.transmuxing.executeEnd=c()},w.resetInitialTimestamp=function(_){var l=this.demuxer,b=this.remuxer;if(!l||!b)return;l.resetTimeStamp(_),b.resetTimeStamp(_)},w.resetContiguity=function(){var _=this.demuxer,l=this.remuxer;if(!_||!l)return;_.resetContiguity(),l.resetNextTimestamp()},w.resetInitSegment=function(_,l,b,m){var y=this.demuxer,k=this.remuxer;if(!y||!k)return;y.resetInitSegment(l,b,m),k.resetInitSegment(_,l,b)},w.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},w.transmux=function(_,l,b,m,y){var k;return l&&l.method==="SAMPLE-AES"?k=this.transmuxSampleAes(_,l,b,m,y):k=this.transmuxUnencrypted(_,b,m,y),k},w.transmuxUnencrypted=function(_,l,b,m){var y=this.demuxer.demux(_,l,!1,!this.config.progressive),k=y.audioTrack,I=y.avcTrack,N=y.id3Track,F=y.textTrack,C=this.remuxer.remux(k,I,N,F,l,b,!1,this.id);return{remuxResult:C,chunkMeta:m}},w.transmuxSampleAes=function(_,l,b,m,y){var k=this;return this.demuxer.demuxSampleAes(_,l,b).then(function(I){var N=k.remuxer.remux(I.audioTrack,I.avcTrack,I.id3Track,I.textTrack,b,m,!1,k.id);return{remuxResult:N,chunkMeta:y}})},w.configureTransmuxer=function(_,l){for(var b=this.config,m=this.observer,y=this.typeSupported,k=this.vendor,I=l.audioCodec,N=l.defaultInitPts,F=l.duration,C=l.initSegmentData,v=l.videoCodec,j,K=0,J=o.length;K<J;K++)if(o[K].demux.probe(_)){j=o[K];break}j||(s.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),j={demux:B.default,remux:p.default});var te=this.demuxer,ve=this.remuxer,ue=j.remux,de=j.demux;(!ve||!(ve instanceof ue))&&(this.remuxer=new ue(m,b,y,k)),(!te||!(te instanceof de))&&(this.demuxer=new de(m,b,y),this.probe=de.probe),this.resetInitSegment(C,I,v,F),this.resetInitialTimestamp(N)},w.needsProbing=function(_,l,b){return!this.demuxer||!this.remuxer||l||b},w.getDecrypter=function(){var _=this.decrypter;return _||(_=this.decrypter=new M.default(this.observer,this.config)),_},x}();function h(x,w){var T=null;return x.byteLength>0&&w!=null&&w.key!=null&&w.iv!==null&&w.method!=null&&(T=w),T}var R=function(w){return{remuxResult:{},chunkMeta:w}};function S(x){return"then"in x&&x.then instanceof Function}var E=function(w,T,_,l,b){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=l,this.defaultInitPts=b},O=function(w,T,_,l,b){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=l,this.timeOffset=b}},"./src/demux/tsdemuxer.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"discardEPB",function(){return R});var z=D("./src/demux/adts.ts"),U=D("./src/demux/mpegaudio.ts"),M=D("./src/demux/exp-golomb.ts"),W=D("./src/demux/id3.ts"),B=D("./src/demux/sample-aes.ts"),P=D("./src/events.ts"),A=D("./src/utils/mp4-tools.ts"),g=D("./src/utils/logger.ts"),p=D("./src/errors.ts"),f={video:1,audio:2,id3:3,text:4},d=function(){function S(O,x,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=x,this.typeSupported=w}S.probe=function(x){var w=S.syncOffset(x);return w<0?!1:(w&&g.logger.warn("MPEG2-TS detected but first sync word found @ offset "+w+", junk ahead ?"),!0)},S.syncOffset=function(x){for(var w=Math.min(1e3,x.length-3*188),T=0;T<w;){if(x[T]===71&&x[T+188]===71&&x[T+2*188]===71)return T;T++}return-1},S.createTrack=function(x,w){return{container:x==="video"||x==="audio"?"video/mp2t":void 0,type:x,id:f[x],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:x==="audio"?w:void 0}};var E=S.prototype;return E.resetInitSegment=function(x,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=x,this.videoCodec=w,this._duration=T},E.resetTimeStamp=function(){},E.resetContiguity=function(){var x=this._audioTrack,w=this._avcTrack,T=this._id3Track;x&&(x.pesData=null),w&&(w.pesData=null),T&&(T.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},E.demux=function(x,w,T,_){T===void 0&&(T=!1),_===void 0&&(_=!1),T||(this.sampleAes=null);var l,b=this._avcTrack,m=this._audioTrack,y=this._id3Track,k=b.pid,I=b.pesData,N=m.pid,F=y.pid,C=m.pesData,v=y.pesData,j=!1,K=this.pmtParsed,J=this._pmtId,te=x.length;if(this.remainderData&&(x=Object(A.appendUint8Array)(this.remainderData,x),te=x.length,this.remainderData=null),te<188&&!_)return this.remainderData=x,{audioTrack:m,avcTrack:b,id3Track:y,textTrack:this._txtTrack};var ve=Math.max(0,S.syncOffset(x));te-=(te+ve)%188,te<x.byteLength&&!_&&(this.remainderData=new Uint8Array(x.buffer,te,x.buffer.byteLength-te));for(var ue=ve;ue<te;ue+=188)if(x[ue]===71){var de=!!(x[ue+1]&64),oe=((x[ue+1]&31)<<8)+x[ue+2],me=(x[ue+3]&48)>>4,ae=void 0;if(me>1){if(ae=ue+5+x[ue+4],ae===ue+188)continue}else ae=ue+4;switch(oe){case k:de&&(I&&(l=i(I))&&this.parseAVCPES(l,!1),I={data:[],size:0}),I&&(I.data.push(x.subarray(ae,ue+188)),I.size+=ue+188-ae);break;case N:de&&(C&&(l=i(C))&&(m.isAAC?this.parseAACPES(l):this.parseMPEGPES(l)),C={data:[],size:0}),C&&(C.data.push(x.subarray(ae,ue+188)),C.size+=ue+188-ae);break;case F:de&&(v&&(l=i(v))&&this.parseID3PES(l),v={data:[],size:0}),v&&(v.data.push(x.subarray(ae,ue+188)),v.size+=ue+188-ae);break;case 0:de&&(ae+=x[ae]+1),J=this._pmtId=c(x,ae);break;case J:{de&&(ae+=x[ae]+1);var fe=o(x,ae,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,T);k=fe.avc,k>0&&(b.pid=k),N=fe.audio,N>0&&(m.pid=N,m.isAAC=fe.isAAC),F=fe.id3,F>0&&(y.pid=F),j&&!K&&(g.logger.log("reparse from beginning"),j=!1,ue=ve-188),K=this.pmtParsed=!0;break}case 17:case 8191:break;default:j=!0;break}}else this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});b.pesData=I,m.pesData=C,y.pesData=v;var Q={audioTrack:m,avcTrack:b,id3Track:y,textTrack:this._txtTrack};return _&&this.extractRemainingSamples(Q),Q},E.flush=function(){var x=this.remainderData;this.remainderData=null;var w;return x?w=this.demux(x,-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},E.extractRemainingSamples=function(x){var w=x.audioTrack,T=x.avcTrack,_=x.id3Track,l=T.pesData,b=w.pesData,m=_.pesData,y;l&&(y=i(l))?(this.parseAVCPES(y,!0),T.pesData=null):T.pesData=l,b&&(y=i(b))?(w.isAAC?this.parseAACPES(y):this.parseMPEGPES(y),w.pesData=null):(b!=null&&b.size&&g.logger.log("last AAC PES packet truncated,might overlap between fragments"),w.pesData=b),m&&(y=i(m))?(this.parseID3PES(y),_.pesData=null):_.pesData=m},E.demuxSampleAes=function(x,w,T){var _=this.demux(x,T,!0,!this.config.progressive),l=this.sampleAes=new B.default(this.observer,this.config,w);return this.decrypt(_,l)},E.decrypt=function(x,w){return new Promise(function(T){var _=x.audioTrack,l=x.avcTrack;_.samples&&_.isAAC?w.decryptAacSamples(_.samples,0,function(){l.samples?w.decryptAvcSamples(l.samples,0,0,function(){T(x)}):T(x)}):l.samples&&w.decryptAvcSamples(l.samples,0,0,function(){T(x)})})},E.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},E.parseAVCPES=function(x,w){var T=this,_=this._avcTrack,l=this.parseAVCNALu(x.data),b=!1,m=this.avcSample,y,k=!1;x.data=null,m&&l.length&&!_.audFound&&(u(m,_),m=this.avcSample=s(!1,x.pts,x.dts,"")),l.forEach(function(I){switch(I.type){case 1:{y=!0,m||(m=T.avcSample=s(!0,x.pts,x.dts,"")),b&&(m.debug+="NDR "),m.frame=!0;var N=I.data;if(k&&N.length>4){var F=new M.default(N).readSliceType();(F===2||F===4||F===7||F===9)&&(m.key=!0)}break}case 5:y=!0,m||(m=T.avcSample=s(!0,x.pts,x.dts,"")),b&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{y=!0,b&&m&&(m.debug+="SEI ");var C=new M.default(R(I.data));C.readUByte();for(var v=0,j=0,K=!1,J=0;!K&&C.bytesAvailable>1;){v=0;do J=C.readUByte(),v+=J;while(J===255);j=0;do J=C.readUByte(),j+=J;while(J===255);if(v===4&&C.bytesAvailable!==0){K=!0;var te=C.readUByte();if(te===181){var ve=C.readUShort();if(ve===49){var ue=C.readUInt();if(ue===1195456820){var de=C.readUByte();if(de===3){for(var oe=C.readUByte(),me=C.readUByte(),ae=31&oe,fe=[oe,me],Q=0;Q<ae;Q++)fe.push(C.readUByte()),fe.push(C.readUByte()),fe.push(C.readUByte());h(T._txtTrack.samples,{type:3,pts:x.pts,bytes:fe})}}}}}else if(v===5&&C.bytesAvailable!==0){if(K=!0,j>16){for(var ie=[],ee=0;ee<16;ee++)ie.push(C.readUByte().toString(16)),(ee===3||ee===5||ee===7||ee===9)&&ie.push("-");for(var Te=j-16,Se=new Uint8Array(Te),be=0;be<Te;be++)Se[be]=C.readUByte();h(T._txtTrack.samples,{pts:x.pts,payloadType:v,uuid:ie.join(""),userData:Object(W.utf8ArrayToStr)(Se),userDataBytes:Se})}}else if(j<C.bytesAvailable)for(var ye=0;ye<j;ye++)C.readUByte()}break}case 7:if(y=!0,k=!0,b&&m&&(m.debug+="SPS "),!_.sps){var xe=new M.default(I.data),De=xe.readSPS();_.width=De.width,_.height=De.height,_.pixelRatio=De.pixelRatio,_.sps=[I.data],_.duration=T._duration;for(var Ie=I.data.subarray(1,4),Ae="avc1.",Le=0;Le<3;Le++){var Ue=Ie[Le].toString(16);Ue.length<2&&(Ue="0"+Ue),Ae+=Ue}_.codec=Ae}break;case 8:y=!0,b&&m&&(m.debug+="PPS "),_.pps||(_.pps=[I.data]);break;case 9:y=!1,_.audFound=!0,m&&u(m,_),m=T.avcSample=s(!1,x.pts,x.dts,b?"AUD ":"");break;case 12:y=!1;break;default:y=!1,m&&(m.debug+="unknown NAL "+I.type+" ");break}if(m&&y){var He=m.units;He.push(I)}}),w&&m&&(u(m,_),this.avcSample=null)},E.getLastNalUnit=function(){var x,w=this.avcSample,T;if(!w||w.units.length===0){var _=this._avcTrack.samples;w=_[_.length-1]}if((x=w)!==null&&x!==void 0&&x.units){var l=w.units;T=l[l.length-1]}return T},E.parseAVCNALu=function(x){var w=x.byteLength,T=this._avcTrack,_=T.naluState||0,l=_,b=[],m=0,y,k,I,N=-1,F=0;for(_===-1&&(N=0,F=x[0]&31,_=0,m=1);m<w;){if(y=x[m++],!_){_=y?0:1;continue}if(_===1){_=y?0:2;continue}if(!y)_=3;else if(y===1){if(N>=0){var C={data:x.subarray(N,m-_-1),type:F};b.push(C)}else{var v=this.getLastNalUnit();if(v&&(l&&m<=4-l&&(v.state&&(v.data=v.data.subarray(0,v.data.byteLength-l))),k=m-_-1,k>0)){var j=new Uint8Array(v.data.byteLength+k);j.set(v.data,0),j.set(x.subarray(0,k),v.data.byteLength),v.data=j,v.state=0}}m<w?(I=x[m]&31,N=m,F=I,_=0):_=-1}else _=0}if(N>=0&&_>=0){var K={data:x.subarray(N,w),type:F,state:_};b.push(K)}if(b.length===0){var J=this.getLastNalUnit();if(J){var te=new Uint8Array(J.data.byteLength+x.byteLength);te.set(J.data,0),te.set(x,J.data.byteLength),J.data=te}}return T.naluState=_,b},E.parseAACPES=function(x){var w=0,T=this._audioTrack,_=this.aacOverFlow,l=x.data;if(_){this.aacOverFlow=null;var b=_.sample.unit.byteLength,m=Math.min(_.missing,b),y=b-m;_.sample.unit.set(l.subarray(0,m),y),T.samples.push(_.sample),w=_.missing}var k,I;for(k=w,I=l.length;k<I-1&&!z.isHeader(l,k);k++);if(k!==w){var N,F;if(k<I-1?(N="AAC PES did not start with ADTS header,offset:"+k,F=!1):(N="no ADTS header found in AAC PES",F=!0),g.logger.warn("parsing error:"+N),this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:F,reason:N}),F)return}z.initTrackConfig(T,this.observer,l,k,this.audioCodec);var C;if(x.pts!==void 0)C=x.pts;else if(_){var v=z.getFrameDuration(T.samplerate);C=_.sample.pts+v}else{g.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var j=0;k<I;)if(z.isHeader(l,k)){if(k+5<I){var K=z.appendFrame(T,l,k,C,j);if(K)if(K.missing)this.aacOverFlow=K;else{k+=K.length,j++;continue}}break}else k++},E.parseMPEGPES=function(x){var w=x.data,T=w.length,_=0,l=0,b=x.pts;if(b===void 0){g.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;l<T;)if(U.isHeader(w,l)){var m=U.appendFrame(this._audioTrack,w,l,b,_);if(m)l+=m.length,_++;else break}else l++},E.parseID3PES=function(x){if(x.pts===void 0){g.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(x)},S}();d.minProbeByteLength=188;function s(S,E,O,x){return{key:S,frame:!1,pts:E,dts:O,units:[],debug:x,length:0}}function c(S,E){return(S[E+10]&31)<<8|S[E+11]}function o(S,E,O,x){var w={audio:-1,avc:-1,id3:-1,isAAC:!0},T=(S[E+1]&15)<<8|S[E+2],_=E+3+T-4,l=(S[E+10]&15)<<8|S[E+11];for(E+=12+l;E<_;){var b=(S[E+1]&31)<<8|S[E+2];switch(S[E]){case 207:if(!x){g.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:w.audio===-1&&(w.audio=b);break;case 21:w.id3===-1&&(w.id3=b);break;case 219:if(!x){g.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:w.avc===-1&&(w.avc=b);break;case 3:case 4:O?w.audio===-1&&(w.audio=b,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}E+=((S[E+3]&15)<<8|S[E+4])+5}return w}function i(S){var E=0,O,x,w,T,_,l=S.data;if(!S||S.size===0)return null;for(;l[0].length<19&&l.length>1;){var b=new Uint8Array(l[0].length+l[1].length);b.set(l[0]),b.set(l[1],l[0].length),l[0]=b,l.splice(1,1)}O=l[0];var m=(O[0]<<16)+(O[1]<<8)+O[2];if(m===1){if(x=(O[4]<<8)+O[5],x&&x>S.size-6)return null;var y=O[7];y&192&&(T=(O[9]&14)*536870912+(O[10]&255)*4194304+(O[11]&254)*16384+(O[12]&255)*128+(O[13]&254)/2,y&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 k=w+9;if(S.size<=k)return null;S.size-=k;for(var I=new Uint8Array(S.size),N=0,F=l.length;N<F;N++){O=l[N];var C=O.byteLength;if(k)if(k>C){k-=C;continue}else O=O.subarray(k),C-=k,k=0;I.set(O,E),E+=C}return x&&(x-=w+3),{data:I,pts:T,dts:_,len:x}}return null}function u(S,E){if(S.units.length&&S.frame){if(S.pts===void 0){var O=E.samples,x=O.length;if(x){var w=O[x-1];S.pts=w.pts,S.dts=w.dts}else{E.dropped++;return}}E.samples.push(S)}S.debug.length&&g.logger.log(S.pts+"/"+S.dts+":"+S.debug)}function h(S,E){var O=S.length;if(O>0){if(E.pts>=S[O-1].pts)S.push(E);else for(var x=O-1;x>=0;x--)if(E.pts<S[x].pts){S.splice(x,0,E);break}}else S.push(E)}function R(S){for(var E=S.byteLength,O=[],x=1;x<E-2;)S[x]===0&&S[x+1]===0&&S[x+2]===3?(O.push(x+2),x+=2):x++;if(O.length===0)return S;var w=E-O.length,T=new Uint8Array(w),_=0;for(x=0;x<w;_++,x++)_===O[0]&&(_++,O.shift()),T[x]=S[_];return T}V.default=d},"./src/errors.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"ErrorTypes",function(){return z}),D.d(V,"ErrorDetails",function(){return U});var z;(function(M){M.NETWORK_ERROR="networkError",M.MEDIA_ERROR="mediaError",M.KEY_SYSTEM_ERROR="keySystemError",M.MUX_ERROR="muxError",M.OTHER_ERROR="otherError"})(z||(z={}));var U;(function(M){M.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",M.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",M.KEY_SYSTEM_NO_SESSION="keySystemNoSession",M.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",M.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",M.MANIFEST_LOAD_ERROR="manifestLoadError",M.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",M.MANIFEST_PARSING_ERROR="manifestParsingError",M.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",M.LEVEL_EMPTY_ERROR="levelEmptyError",M.LEVEL_LOAD_ERROR="levelLoadError",M.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",M.LEVEL_SWITCH_ERROR="levelSwitchError",M.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",M.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",M.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",M.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",M.FRAG_LOAD_ERROR="fragLoadError",M.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",M.FRAG_DECRYPT_ERROR="fragDecryptError",M.FRAG_PARSING_ERROR="fragParsingError",M.REMUX_ALLOC_ERROR="remuxAllocError",M.KEY_LOAD_ERROR="keyLoadError",M.KEY_LOAD_TIMEOUT="keyLoadTimeOut",M.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",M.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",M.BUFFER_APPEND_ERROR="bufferAppendError",M.BUFFER_APPENDING_ERROR="bufferAppendingError",M.BUFFER_STALLED_ERROR="bufferStalledError",M.BUFFER_FULL_ERROR="bufferFullError",M.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",M.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",M.INTERNAL_EXCEPTION="internalException",M.INTERNAL_ABORTED="aborted",M.UNKNOWN="unknown"})(U||(U={}))},"./src/events.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"Events",function(){return z});var z;(function(U){U.MEDIA_ATTACHING="hlsMediaAttaching",U.MEDIA_ATTACHED="hlsMediaAttached",U.MEDIA_DETACHING="hlsMediaDetaching",U.MEDIA_DETACHED="hlsMediaDetached",U.BUFFER_RESET="hlsBufferReset",U.BUFFER_CODECS="hlsBufferCodecs",U.BUFFER_CREATED="hlsBufferCreated",U.BUFFER_APPENDING="hlsBufferAppending",U.BUFFER_APPENDED="hlsBufferAppended",U.BUFFER_EOS="hlsBufferEos",U.BUFFER_FLUSHING="hlsBufferFlushing",U.BUFFER_FLUSHED="hlsBufferFlushed",U.MANIFEST_LOADING="hlsManifestLoading",U.MANIFEST_LOADED="hlsManifestLoaded",U.MANIFEST_PARSED="hlsManifestParsed",U.LEVEL_SWITCHING="hlsLevelSwitching",U.LEVEL_SWITCHED="hlsLevelSwitched",U.LEVEL_LOADING="hlsLevelLoading",U.LEVEL_LOADED="hlsLevelLoaded",U.LEVEL_UPDATED="hlsLevelUpdated",U.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",U.LEVELS_UPDATED="hlsLevelsUpdated",U.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",U.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",U.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",U.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",U.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",U.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",U.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",U.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",U.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",U.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",U.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",U.CUES_PARSED="hlsCuesParsed",U.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",U.INIT_PTS_FOUND="hlsInitPtsFound",U.FRAG_LOADING="hlsFragLoading",U.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",U.FRAG_LOADED="hlsFragLoaded",U.FRAG_DECRYPTED="hlsFragDecrypted",U.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",U.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",U.FRAG_PARSING_METADATA="hlsFragParsingMetadata",U.FRAG_PARSED="hlsFragParsed",U.FRAG_BUFFERED="hlsFragBuffered",U.FRAG_CHANGED="hlsFragChanged",U.FPS_DROP="hlsFpsDrop",U.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",U.ERROR="hlsError",U.DESTROYING="hlsDestroying",U.KEY_LOADING="hlsKeyLoading",U.KEY_LOADED="hlsKeyLoaded",U.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",U.BACK_BUFFER_REACHED="hlsBackBufferReached"})(z||(z={}))},"./src/hls.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"default",function(){return S});var z=D("./node_modules/url-toolkit/src/url-toolkit.js"),U=D.n(z),M=D("./src/loader/playlist-loader.ts"),W=D("./src/loader/key-loader.ts"),B=D("./src/controller/id3-track-controller.ts"),P=D("./src/controller/latency-controller.ts"),A=D("./src/controller/level-controller.ts"),g=D("./src/controller/fragment-tracker.ts"),p=D("./src/controller/stream-controller.ts"),f=D("./src/is-supported.ts"),d=D("./src/utils/logger.ts"),s=D("./src/config.ts"),c=D("./node_modules/eventemitter3/index.js"),o=D.n(c),i=D("./src/events.ts"),u=D("./src/errors.ts");function h(E,O){for(var x=0;x<O.length;x++){var w=O[x];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(E,w.key,w)}}function R(E,O,x){return O&&h(E.prototype,O),x&&h(E,x),E}var S=function(){E.isSupported=function(){return Object(f.isSupported)()};function E(x){x===void 0&&(x={}),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)(E.DefaultConfig,x);this.userConfig=x,Object(d.enableLogs)(w.debug),this._autoLevelCapping=-1,w.progressive&&Object(s.enableStreamingMode)(w);var T=w.abrController,_=w.bufferController,l=w.capLevelController,b=w.fpsController,m=this.abrController=new T(this),y=this.bufferController=new _(this),k=this.capLevelController=new l(this),I=new b(this),N=new M.default(this),F=new W.default(this),C=new B.default(this),v=this.levelController=new A.default(this),j=new g.FragmentTracker(this),K=this.streamController=new p.default(this,j);k.setStreamController(K),I.setStreamController(K);var J=[v,K];this.networkControllers=J;var te=[N,F,m,y,k,I,C,j];this.audioTrackController=this.createController(w.audioTrackController,null,J),this.createController(w.audioStreamController,j,J),this.subtitleTrackController=this.createController(w.subtitleTrackController,null,J),this.createController(w.subtitleStreamController,j,J),this.createController(w.timelineController,null,te),this.emeController=this.createController(w.emeController,null,te),this.cmcdController=this.createController(w.cmcdController,null,te),this.latencyController=this.createController(P.default,null,te),this.coreComponents=te}var O=E.prototype;return O.createController=function(w,T,_){if(w){var l=T?new w(this,T):new w(this);return _&&_.push(l),l}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,_,l){_===void 0&&(_=this),this._emitter.off(w,T,_,l)},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(i.Events.ERROR,{type:u.ErrorTypes.OTHER_ERROR,details:u.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(i.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(i.Events.MEDIA_ATTACHING,{media:w})},O.detachMedia=function(){d.logger.log("detachMedia"),this.trigger(i.Events.MEDIA_DETACHING,void 0),this._media=null},O.loadSource=function(w){this.stopLoad();var T=this.media,_=this.url,l=this.url=z.buildAbsoluteURL(self.location.href,w,{alwaysNormalize:!0});d.logger.log("loadSource:"+l),T&&_&&_!==l&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(T)),this.trigger(i.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)},R(E,[{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,l=0;l<_;l++)if(w[l].maxBitrate>T)return l;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 i.Events}},{key:"ErrorTypes",get:function(){return u.ErrorTypes}},{key:"ErrorDetails",get:function(){return u.ErrorDetails}},{key:"DefaultConfig",get:function(){return E.defaultConfig?E.defaultConfig:s.hlsDefaultConfig},set:function(w){E.defaultConfig=w}}]),E}();S.defaultConfig=void 0},"./src/is-supported.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"isSupported",function(){return M}),D.d(V,"changeTypeSupported",function(){return W});var z=D("./src/utils/mediasource-helper.ts");function U(){return self.SourceBuffer||self.WebKitSourceBuffer}function M(){var B=Object(z.getMediaSource)();if(!B)return!1;var P=U(),A=B&&typeof B.isTypeSupported=="function"&&B.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),g=!P||P.prototype&&typeof P.prototype.appendBuffer=="function"&&typeof P.prototype.remove=="function";return!!A&&!!g}function W(){var B,P=U();return typeof(P==null||((B=P.prototype)===null||B===void 0)?void 0:B.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"default",function(){return d}),D.d(V,"LoadError",function(){return c});var z=D("./src/polyfills/number.ts"),U=D("./src/errors.ts");function M(o,i){o.prototype=Object.create(i.prototype),o.prototype.constructor=o,g(o,i)}function W(o){var i=typeof Map=="function"?new Map:void 0;return W=function(h){if(h===null||!A(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof i!="undefined"){if(i.has(h))return i.get(h);i.set(h,R)}function R(){return B(h,arguments,p(this).constructor)}return R.prototype=Object.create(h.prototype,{constructor:{value:R,enumerable:!1,writable:!0,configurable:!0}}),g(R,h)},W(o)}function B(o,i,u){return P()?B=Reflect.construct:B=function(R,S,E){var O=[null];O.push.apply(O,S);var x=Function.bind.apply(R,O),w=new x;return E&&g(w,E.prototype),w},B.apply(null,arguments)}function P(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(o){return!1}}function A(o){return Function.toString.call(o).indexOf("[native code]")!==-1}function g(o,i){return g=Object.setPrototypeOf||function(h,R){return h.__proto__=R,h},g(o,i)}function p(o){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(u){return u.__proto__||Object.getPrototypeOf(u)},p(o)}var f=Math.pow(2,17),d=function(){function o(u){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=u}var i=o.prototype;return i.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},i.abort=function(){this.loader&&this.loader.abort()},i.load=function(h,R){var S=this,E=h.url;if(!E)return Promise.reject(new c({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,networkDetails:null},"Fragment does not have a "+(E?"part list":"url")));this.abort();var O=this.config,x=O.fLoader,w=O.loader;return new Promise(function(T,_){S.loader&&S.loader.destroy();var l=S.loader=h.loader=x?new x(O):new w(O),b=s(h),m={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:f};h.stats=l.stats,l.load(b,m,{onSuccess:function(k,I,N,F){S.resetLoader(h,l),T({frag:h,part:null,payload:k.data,networkDetails:F})},onError:function(k,I,N){S.resetLoader(h,l),_(new c({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,response:k,networkDetails:N}))},onAbort:function(k,I,N){S.resetLoader(h,l),_(new c({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,networkDetails:N}))},onTimeout:function(k,I,N){S.resetLoader(h,l),_(new c({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,networkDetails:N}))},onProgress:function(k,I,N,F){R&&R({frag:h,part:null,payload:N,networkDetails:F})}})})},i.loadPart=function(h,R,S){var E=this;this.abort();var O=this.config,x=O.fLoader,w=O.loader;return new Promise(function(T,_){E.loader&&E.loader.destroy();var l=E.loader=h.loader=x?new x(O):new w(O),b=s(h,R),m={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:f};R.stats=l.stats,l.load(b,m,{onSuccess:function(k,I,N,F){E.resetLoader(h,l),E.updateStatsFromPart(h,R);var C={frag:h,part:R,payload:k.data,networkDetails:F};S(C),T(C)},onError:function(k,I,N){E.resetLoader(h,l),_(new c({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,part:R,response:k,networkDetails:N}))},onAbort:function(k,I,N){h.stats.aborted=R.stats.aborted,E.resetLoader(h,l),_(new c({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,part:R,networkDetails:N}))},onTimeout:function(k,I,N){E.resetLoader(h,l),_(new c({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,part:R,networkDetails:N}))}})})},i.updateStatsFromPart=function(h,R){var S=h.stats,E=R.stats,O=E.total;if(S.loaded+=E.loaded,O){var x=Math.round(h.duration/R.duration),w=Math.min(Math.round(S.loaded/O),x),T=x-w,_=T*Math.round(S.loaded/w);S.total=S.loaded+_}else S.total=Math.max(S.loaded,S.total);var l=S.loading,b=E.loading;l.start?l.first+=b.first-b.start:(l.start=b.start,l.first=b.first),l.end=b.end},i.resetLoader=function(h,R){h.loader=null,this.loader===R&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),R.destroy()},o}();function s(o,i){i===void 0&&(i=null);var u=i||o,h={frag:o,part:i,responseType:"arraybuffer",url:u.url,headers:{},rangeStart:0,rangeEnd:0},R=u.byteRangeStartOffset,S=u.byteRangeEndOffset;return Object(z.isFiniteNumber)(R)&&Object(z.isFiniteNumber)(S)&&(h.rangeStart=R,h.rangeEnd=S),h}var c=function(o){M(i,o);function i(u){for(var h,R=arguments.length,S=new Array(R>1?R-1:0),E=1;E<R;E++)S[E-1]=arguments[E];return h=o.call.apply(o,[this].concat(S))||this,h.data=void 0,h.data=u,h}return i}(W(Error))},"./src/loader/fragment.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"ElementaryStreamTypes",function(){return d}),D.d(V,"BaseSegment",function(){return s}),D.d(V,"Fragment",function(){return c}),D.d(V,"Part",function(){return o});var z=D("./src/polyfills/number.ts"),U=D("./node_modules/url-toolkit/src/url-toolkit.js"),M=D.n(U),W=D("./src/utils/logger.ts"),B=D("./src/loader/level-key.ts"),P=D("./src/loader/load-stats.ts");function A(i,u){i.prototype=Object.create(u.prototype),i.prototype.constructor=i,g(i,u)}function g(i,u){return g=Object.setPrototypeOf||function(R,S){return R.__proto__=S,R},g(i,u)}function p(i,u){for(var h=0;h<u.length;h++){var R=u[h];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(i,R.key,R)}}function f(i,u,h){return u&&p(i.prototype,u),h&&p(i,h),i}var d;(function(i){i.AUDIO="audio",i.VIDEO="video",i.AUDIOVIDEO="audiovideo"})(d||(d={}));var s=function(){function i(h){var R;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(R={},R[d.AUDIO]=null,R[d.VIDEO]=null,R[d.AUDIOVIDEO]=null,R),this.baseurl=h}var u=i.prototype;return u.setByteRange=function(R,S){var E=R.split("@",2),O=[];E.length===1?O[0]=S?S.byteRangeEndOffset:0:O[0]=parseInt(E[1]),O[1]=parseInt(E[0])+O[0],this._byteRange=O},f(i,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(U.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(R){this._url=R}}]),i}(),c=function(i){A(u,i);function u(R,S){var E;return E=i.call(this,S)||this,E._decryptdata=null,E.rawProgramDateTime=null,E.programDateTime=null,E.tagList=[],E.duration=0,E.sn=0,E.levelkey=void 0,E.type=void 0,E.loader=null,E.level=-1,E.cc=0,E.startPTS=void 0,E.endPTS=void 0,E.appendedPTS=void 0,E.startDTS=void 0,E.endDTS=void 0,E.start=0,E.deltaPTS=void 0,E.maxStartPTS=void 0,E.minEndPTS=void 0,E.stats=new P.LoadStats,E.urlId=0,E.data=void 0,E.bitrateTest=!1,E.title=null,E.initSegment=null,E.type=R,E}var h=u.prototype;return h.createInitializationVector=function(S){for(var E=new Uint8Array(16),O=12;O<16;O++)E[O]=S>>8*(15-O)&255;return E},h.setDecryptDataFromLevelKey=function(S,E){var O=S;return(S==null?void 0:S.method)==="AES-128"&&S.uri&&!S.iv&&(O=B.LevelKey.fromURI(S.uri),O.method=S.method,O.iv=this.createInitializationVector(E),O.keyFormat="identity"),O},h.setElementaryStreamInfo=function(S,E,O,x,w,T){T===void 0&&(T=!1);var _=this.elementaryStreams,l=_[S];if(!l){_[S]={startPTS:E,endPTS:O,startDTS:x,endDTS:w,partial:T};return}l.startPTS=Math.min(l.startPTS,E),l.endPTS=Math.max(l.endPTS,O),l.startDTS=Math.min(l.startDTS,x),l.endDTS=Math.max(l.endDTS,w)},h.clearElementaryStreamInfo=function(){var S=this.elementaryStreams;S[d.AUDIO]=null,S[d.VIDEO]=null,S[d.AUDIOVIDEO]=null},f(u,[{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&&W.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(z.isFiniteNumber)(this.programDateTime))return null;var S=Object(z.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)}}]),u}(s),o=function(i){A(u,i);function u(h,R,S,E,O){var x;x=i.call(this,S)||this,x.fragOffset=0,x.duration=0,x.gap=!1,x.independent=!1,x.relurl=void 0,x.fragment=void 0,x.index=void 0,x.stats=new P.LoadStats,x.duration=h.decimalFloatingPoint("DURATION"),x.gap=h.bool("GAP"),x.independent=h.bool("INDEPENDENT"),x.relurl=h.enumeratedString("URI"),x.fragment=R,x.index=E;var w=h.enumeratedString("BYTERANGE");return w&&x.setByteRange(w,O),O&&(x.fragOffset=O.fragOffset+O.duration),x}return f(u,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var R=this.elementaryStreams;return!!(R.audio||R.video||R.audiovideo)}}]),u}(s)},"./src/loader/key-loader.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"default",function(){return W});var z=D("./src/events.ts"),U=D("./src/errors.ts"),M=D("./src/utils/logger.ts"),W=function(){function B(A){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=A,this._registerListeners()}var P=B.prototype;return P._registerListeners=function(){this.hls.on(z.Events.KEY_LOADING,this.onKeyLoading,this)},P._unregisterListeners=function(){this.hls.off(z.Events.KEY_LOADING,this.onKeyLoading)},P.destroy=function(){this._unregisterListeners();for(var g in this.loaders){var p=this.loaders[g];p&&p.destroy()}this.loaders={}},P.onKeyLoading=function(g,p){var f=p.frag,d=f.type,s=this.loaders[d];if(!f.decryptdata){M.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var c=f.decryptdata.uri;if(c!==this.decrypturl||this.decryptkey===null){var o=this.hls.config;if(s&&(M.logger.warn("abort previous key loader for type:"+d),s.abort()),!c){M.logger.warn("key uri is falsy");return}var i=o.loader,u=f.loader=this.loaders[d]=new i(o);this.decrypturl=c,this.decryptkey=null;var h={url:c,frag:f,responseType:"arraybuffer"},R={timeout:o.fragLoadingTimeOut,maxRetry:0,retryDelay:o.fragLoadingRetryDelay,maxRetryDelay:o.fragLoadingMaxRetryTimeout,highWaterMark:0},S={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(h,R,S)}else this.decryptkey&&(f.decryptdata.key=this.decryptkey,this.hls.trigger(z.Events.KEY_LOADED,{frag:f}))},P.loadsuccess=function(g,p,f){var d=f.frag;if(!d.decryptdata){M.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(z.Events.KEY_LOADED,{frag:d})},P.loaderror=function(g,p){var f=p.frag,d=f.loader;d&&d.abort(),delete this.loaders[f.type],this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:f,response:g})},P.loadtimeout=function(g,p){var f=p.frag,d=f.loader;d&&d.abort(),delete this.loaders[f.type],this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:f})},B}()},"./src/loader/level-details.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"LevelDetails",function(){return B});var z=D("./src/polyfills/number.ts");function U(P,A){for(var g=0;g<A.length;g++){var p=A[g];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(P,p.key,p)}}function M(P,A,g){return A&&U(P.prototype,A),g&&U(P,g),P}var W=10,B=function(){function P(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 A=P.prototype;return A.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},M(P,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(z.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||W}},{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}}]),P}()},"./src/loader/level-key.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"LevelKey",function(){return B});var z=D("./node_modules/url-toolkit/src/url-toolkit.js"),U=D.n(z);function M(P,A){for(var g=0;g<A.length;g++){var p=A[g];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(P,p.key,p)}}function W(P,A,g){return A&&M(P.prototype,A),g&&M(P,g),P}var B=function(){P.fromURL=function(g,p){return new P(g,p)},P.fromURI=function(g){return new P(g)};function P(A,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(z.buildAbsoluteURL)(A,g,{alwaysNormalize:!0}):this._uri=A}return W(P,[{key:"uri",get:function(){return this._uri}}]),P}()},"./src/loader/load-stats.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"LoadStats",function(){return z});var z=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"default",function(){return u});var z=D("./src/polyfills/number.ts"),U=D("./node_modules/url-toolkit/src/url-toolkit.js"),M=D.n(U),W=D("./src/loader/fragment.ts"),B=D("./src/loader/level-details.ts"),P=D("./src/loader/level-key.ts"),A=D("./src/utils/attr-list.ts"),g=D("./src/utils/logger.ts"),p=D("./src/utils/codecs.ts"),f=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,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("|")),o=/\.(mp4|m4s|m4v|m4a)$/i;function i(O){var x,w;return o.test((x=(w=U.parseURL(O))===null||w===void 0?void 0:w.path)!=null?x:"")}var u=function(){function O(){}return O.findGroup=function(w,T){for(var _=0;_<w.length;_++){var l=w[_];if(l.id===T)return l}},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 U.buildAbsoluteURL(T,w,{alwaysNormalize:!0})},O.parseMasterPlaylist=function(w,T){var _=[],l={},b=!1;f.lastIndex=0;for(var m;(m=f.exec(w))!=null;)if(m[1]){var y=new A.AttrList(m[1]),k={attrs:y,bitrate:y.decimalInteger("AVERAGE-BANDWIDTH")||y.decimalInteger("BANDWIDTH"),name:y.NAME,url:O.resolve(m[2],T)},I=y.decimalResolution("RESOLUTION");I&&(k.width=I.width,k.height=I.height),h((y.CODECS||"").split(/[ ,]+/).filter(function(F){return F}),k),k.videoCodec&&k.videoCodec.indexOf("avc1")!==-1&&(k.videoCodec=O.convertAVC1ToAVCOTI(k.videoCodec)),_.push(k)}else if(m[3]){var N=new A.AttrList(m[3]);N["DATA-ID"]&&(b=!0,l[N["DATA-ID"]]=N)}return{levels:_,sessionData:b?l:null}},O.parseMasterPlaylistMedia=function(w,T,_,l){l===void 0&&(l=[]);var b,m=[],y=0;for(d.lastIndex=0;(b=d.exec(w))!==null;){var k=new A.AttrList(b[1]);if(k.TYPE===_){var I={attrs:k,bitrate:0,id:y++,groupId:k["GROUP-ID"],instreamId:k["INSTREAM-ID"],name:k.NAME||k.LANGUAGE||"",type:_,default:k.bool("DEFAULT"),autoselect:k.bool("AUTOSELECT"),forced:k.bool("FORCED"),lang:k.LANGUAGE,url:k.URI?O.resolve(k.URI,T):""};if(l.length){var N=O.findGroup(l,I.groupId)||l[0];R(I,N,"audioCodec"),R(I,N,"textCodec")}m.push(I)}}return m},O.parseLevelPlaylist=function(w,T,_,l,b){var m=new B.LevelDetails(T),y=m.fragments,k=null,I=0,N=0,F=0,C=0,v=null,j=new W.Fragment(l,T),K,J,te,ve=-1,ue=!1;for(s.lastIndex=0,m.m3u8=w;(K=s.exec(w))!==null;){ue&&(ue=!1,j=new W.Fragment(l,T),j.start=F,j.sn=I,j.cc=C,j.level=_,k&&(j.initSegment=k,j.rawProgramDateTime=k.rawProgramDateTime));var de=K[1];if(de){j.duration=parseFloat(de);var oe=(" "+K[2]).slice(1);j.title=oe||null,j.tagList.push(oe?["INF",de,oe]:["INF",de])}else if(K[3])Object(z.isFiniteNumber)(j.duration)&&(j.start=F,te&&(j.levelkey=te),j.sn=I,j.level=_,j.cc=C,j.urlId=b,y.push(j),j.relurl=(" "+K[3]).slice(1),E(j,v),v=j,F+=j.duration,I++,N=0,ue=!0);else if(K[4]){var me=(" "+K[4]).slice(1);v?j.setByteRange(me,v):j.setByteRange(me)}else if(K[5])j.rawProgramDateTime=(" "+K[5]).slice(1),j.tagList.push(["PROGRAM-DATE-TIME",j.rawProgramDateTime]),ve===-1&&(ve=y.length);else{if(K=K[0].match(c),!K){g.logger.warn("No matches on slow regex match for level playlist!");continue}for(J=1;J<K.length&&!(typeof K[J]!="undefined");J++);var ae=(" "+K[J]).slice(1),fe=(" "+K[J+1]).slice(1),Q=K[J+2]?(" "+K[J+2]).slice(1):"";switch(ae){case"PLAYLIST-TYPE":m.type=fe.toUpperCase();break;case"MEDIA-SEQUENCE":I=m.startSN=parseInt(fe);break;case"SKIP":{var ie=new A.AttrList(fe),ee=ie.decimalInteger("SKIPPED-SEGMENTS");if(Object(z.isFiniteNumber)(ee)){m.skippedSegments=ee;for(var Te=ee;Te--;)y.unshift(null);I+=ee}var Se=ie.enumeratedString("RECENTLY-REMOVED-DATERANGES");Se&&(m.recentlyRemovedDateranges=Se.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(fe);break;case"VERSION":m.version=parseInt(fe);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(fe||Q)&&j.tagList.push(Q?[fe,Q]:[fe]);break;case"DIS":C++;case"GAP":j.tagList.push([ae]);break;case"BITRATE":j.tagList.push([ae,fe]);break;case"DISCONTINUITY-SEQ":C=parseInt(fe);break;case"KEY":{var be,ye=new A.AttrList(fe),xe=ye.enumeratedString("METHOD"),De=ye.URI,Ie=ye.hexadecimalInteger("IV"),Ae=ye.enumeratedString("KEYFORMATVERSIONS"),Le=ye.enumeratedString("KEYID"),Ue=(be=ye.enumeratedString("KEYFORMAT"))!=null?be:"identity",He=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(He.indexOf(Ue)>-1){g.logger.warn("Keyformat "+Ue+" is not supported from the manifest");continue}else if(Ue!=="identity")continue;xe&&(te=P.LevelKey.fromURL(T,De),De&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(xe)>=0&&(te.method=xe,te.keyFormat=Ue,Le&&(te.keyID=Le),Ae&&(te.keyFormatVersions=Ae),te.iv=Ie));break}case"START":{var We=new A.AttrList(fe),Fe=We.decimalFloatingPoint("TIME-OFFSET");Object(z.isFiniteNumber)(Fe)&&(m.startTimeOffset=Fe);break}case"MAP":{var Je=new A.AttrList(fe);j.relurl=Je.URI,Je.BYTERANGE&&j.setByteRange(Je.BYTERANGE),j.level=_,j.sn="initSegment",te&&(j.levelkey=te),j.initSegment=null,k=j,ue=!0;break}case"SERVER-CONTROL":{var Ve=new A.AttrList(fe);m.canBlockReload=Ve.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=Ve.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&Ve.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=Ve.optionalFloat("PART-HOLD-BACK",0),m.holdBack=Ve.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var $e=new A.AttrList(fe);m.partTarget=$e.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ce=m.partList;Ce||(Ce=m.partList=[]);var qe=N>0?Ce[Ce.length-1]:void 0,ze=N++,Oe=new W.Part(new A.AttrList(fe),j,T,ze,qe);Ce.push(Oe),j.duration+=Oe.duration;break}case"PRELOAD-HINT":{var Me=new A.AttrList(fe);m.preloadHint=Me;break}case"RENDITION-REPORT":{var _e=new A.AttrList(fe);m.renditionReports=m.renditionReports||[],m.renditionReports.push(_e);break}default:g.logger.warn("line parsed but not handled: "+K);break}}}v&&!v.relurl?(y.pop(),F-=v.duration,m.partList&&(m.fragmentHint=v)):m.partList&&(E(j,v),j.cc=C,m.fragmentHint=j);var he=y.length,ge=y[0],Y=y[he-1];if(F+=m.skippedSegments*m.targetduration,F>0&&he&&Y){m.averagetargetduration=F/he;var Z=Y.sn;m.endSN=Z!=="initSegment"?Z:0,ge&&(m.startCC=ge.cc,ge.initSegment||m.fragments.every(function(ne){return ne.relurl&&i(ne.relurl)})&&(g.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),j=new W.Fragment(l,T),j.relurl=Y.relurl,j.level=_,j.sn="initSegment",ge.initSegment=j,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(F+=m.fragmentHint.duration),m.totalduration=F,m.endCC=C,ve>0&&S(y,ve),m},O}();function h(O,x){["video","audio","text"].forEach(function(w){var T=O.filter(function(l){return Object(p.isCodecType)(l,w)});if(T.length){var _=T.filter(function(l){return l.lastIndexOf("avc1",0)===0||l.lastIndexOf("mp4a",0)===0});x[w+"Codec"]=_.length>0?_[0]:T[0],O=O.filter(function(l){return T.indexOf(l)===-1})}}),x.unknownCodecs=O}function R(O,x,w){var T=x[w];T&&(O[w]=T)}function S(O,x){for(var w=O[x],T=x;T--;){var _=O[T];if(!_)return;_.programDateTime=w.programDateTime-_.duration*1e3,w=_}}function E(O,x){O.rawProgramDateTime?O.programDateTime=Date.parse(O.rawProgramDateTime):x!=null&&x.programDateTime&&(O.programDateTime=x.endProgramDateTime),Object(z.isFiniteNumber)(O.programDateTime)||(O.programDateTime=null,O.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(re,V,D){"use strict";D.r(V);var z=D("./src/polyfills/number.ts"),U=D("./src/events.ts"),M=D("./src/errors.ts"),W=D("./src/utils/logger.ts"),B=D("./src/utils/mp4-tools.ts"),P=D("./src/loader/m3u8-parser.ts"),A=D("./src/types/loader.ts"),g=D("./src/utils/attr-list.ts");function p(s){var c=s.type;switch(c){case A.PlaylistContextType.AUDIO_TRACK:return A.PlaylistLevelType.AUDIO;case A.PlaylistContextType.SUBTITLE_TRACK:return A.PlaylistLevelType.SUBTITLE;default:return A.PlaylistLevelType.MAIN}}function f(s,c){var o=s.url;return(o===void 0||o.indexOf("data:")===0)&&(o=c.url),o}var d=function(){function s(o){this.hls=void 0,this.loaders=Object.create(null),this.hls=o,this.registerListeners()}var c=s.prototype;return c.registerListeners=function(){var i=this.hls;i.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),i.on(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),i.on(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},c.unregisterListeners=function(){var i=this.hls;i.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(U.Events.LEVEL_LOADING,this.onLevelLoading,this),i.off(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),i.off(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},c.createInternalLoader=function(i){var u=this.hls.config,h=u.pLoader,R=u.loader,S=h||R,E=new S(u);return i.loader=E,this.loaders[i.type]=E,E},c.getInternalLoader=function(i){return this.loaders[i.type]},c.resetInternalLoader=function(i){this.loaders[i]&&delete this.loaders[i]},c.destroyInternalLoaders=function(){for(var i in this.loaders){var u=this.loaders[i];u&&u.destroy(),this.resetInternalLoader(i)}},c.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},c.onManifestLoading=function(i,u){var h=u.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:A.PlaylistContextType.MANIFEST,url:h,deliveryDirectives:null})},c.onLevelLoading=function(i,u){var h=u.id,R=u.level,S=u.url,E=u.deliveryDirectives;this.load({id:h,groupId:null,level:R,responseType:"text",type:A.PlaylistContextType.LEVEL,url:S,deliveryDirectives:E})},c.onAudioTrackLoading=function(i,u){var h=u.id,R=u.groupId,S=u.url,E=u.deliveryDirectives;this.load({id:h,groupId:R,level:null,responseType:"text",type:A.PlaylistContextType.AUDIO_TRACK,url:S,deliveryDirectives:E})},c.onSubtitleTrackLoading=function(i,u){var h=u.id,R=u.groupId,S=u.url,E=u.deliveryDirectives;this.load({id:h,groupId:R,level:null,responseType:"text",type:A.PlaylistContextType.SUBTITLE_TRACK,url:S,deliveryDirectives:E})},c.load=function(i){var u,h=this.hls.config,R=this.getInternalLoader(i);if(R){var S=R.context;if(S&&S.url===i.url){W.logger.trace("[playlist-loader]: playlist request ongoing");return}W.logger.log("[playlist-loader]: aborting previous loader for type: "+i.type),R.abort()}var E,O,x,w;switch(i.type){case A.PlaylistContextType.MANIFEST:E=h.manifestLoadingMaxRetry,O=h.manifestLoadingTimeOut,x=h.manifestLoadingRetryDelay,w=h.manifestLoadingMaxRetryTimeout;break;case A.PlaylistContextType.LEVEL:case A.PlaylistContextType.AUDIO_TRACK:case A.PlaylistContextType.SUBTITLE_TRACK:E=0,O=h.levelLoadingTimeOut;break;default:E=h.levelLoadingMaxRetry,O=h.levelLoadingTimeOut,x=h.levelLoadingRetryDelay,w=h.levelLoadingMaxRetryTimeout;break}if(R=this.createInternalLoader(i),(u=i.deliveryDirectives)!==null&&u!==void 0&&u.part){var T;if(i.type===A.PlaylistContextType.LEVEL&&i.level!==null?T=this.hls.levels[i.level].details:i.type===A.PlaylistContextType.AUDIO_TRACK&&i.id!==null?T=this.hls.audioTracks[i.id].details:i.type===A.PlaylistContextType.SUBTITLE_TRACK&&i.id!==null&&(T=this.hls.subtitleTracks[i.id].details),T){var _=T.partTarget,l=T.targetduration;_&&l&&(O=Math.min(Math.max(_*3,l*.8)*1e3,O))}}var b={timeout:O,maxRetry:E,retryDelay:x,maxRetryDelay:w,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};R.load(i,b,m)},c.loadsuccess=function(i,u,h,R){if(R===void 0&&(R=null),h.isSidxRequest){this.handleSidxRequest(i,h),this.handlePlaylistLoaded(i,u,h,R);return}this.resetInternalLoader(h.type);var S=i.data;if(S.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(i,h,"no EXTM3U delimiter",R);return}u.parsing.start=performance.now(),S.indexOf("#EXTINF:")>0||S.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(i,u,h,R):this.handleMasterPlaylist(i,u,h,R)},c.loaderror=function(i,u,h){h===void 0&&(h=null),this.handleNetworkError(u,h,!1,i)},c.loadtimeout=function(i,u,h){h===void 0&&(h=null),this.handleNetworkError(u,h,!0)},c.handleMasterPlaylist=function(i,u,h,R){var S=this.hls,E=i.data,O=f(i,h),x=P.default.parseMasterPlaylist(E,O),w=x.levels,T=x.sessionData;if(!w.length){this.handleManifestParsingError(i,h,"no level found in manifest",R);return}var _=w.map(function(I){return{id:I.attrs.AUDIO,audioCodec:I.audioCodec}}),l=w.map(function(I){return{id:I.attrs.SUBTITLES,textCodec:I.textCodec}}),b=P.default.parseMasterPlaylistMedia(E,O,"AUDIO",_),m=P.default.parseMasterPlaylistMedia(E,O,"SUBTITLES",l),y=P.default.parseMasterPlaylistMedia(E,O,"CLOSED-CAPTIONS");if(b.length){var k=b.some(function(I){return!I.url});!k&&w[0].audioCodec&&!w[0].attrs.AUDIO&&(W.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),b.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new g.AttrList({}),bitrate:0,url:""}))}S.trigger(U.Events.MANIFEST_LOADED,{levels:w,audioTracks:b,subtitles:m,captions:y,url:O,stats:u,networkDetails:R,sessionData:T})},c.handleTrackOrLevelPlaylist=function(i,u,h,R){var S=this.hls,E=h.id,O=h.level,x=h.type,w=f(i,h),T=Object(z.isFiniteNumber)(E)?E:0,_=Object(z.isFiniteNumber)(O)?O:T,l=p(h),b=P.default.parseLevelPlaylist(i.data,w,_,l,T);if(!b.fragments.length){S.trigger(U.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.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(x===A.PlaylistContextType.MANIFEST){var m={attrs:new g.AttrList({}),bitrate:0,details:b,name:"",url:w};S.trigger(U.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:w,stats:u,networkDetails:R,sessionData:null})}if(u.parsing.end=performance.now(),b.needSidxRanges){var y,k=(y=b.fragments[0].initSegment)===null||y===void 0?void 0:y.url;this.load({url:k,isSidxRequest:!0,type:x,level:O,levelDetails:b,id:E,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}h.levelDetails=b,this.handlePlaylistLoaded(i,u,h,R)},c.handleSidxRequest=function(i,u){var h=Object(B.parseSegmentIndex)(new Uint8Array(i.data));if(!h)return;var R=h.references,S=u.levelDetails;R.forEach(function(E,O){var x=E.info,w=S.fragments[O];w.byteRange.length===0&&w.setByteRange(String(1+x.end-x.start)+"@"+String(x.start)),w.initSegment&&w.initSegment.setByteRange(String(h.moovEndOffset)+"@0")})},c.handleManifestParsingError=function(i,u,h,R){this.hls.trigger(U.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:u.type===A.PlaylistContextType.MANIFEST,url:i.url,reason:h,response:i,context:u,networkDetails:R})},c.handleNetworkError=function(i,u,h,R){h===void 0&&(h=!1),W.logger.warn("[playlist-loader]: A network "+(h?"timeout":"error")+" occurred while loading "+i.type+" level: "+i.level+" id: "+i.id+' group-id: "'+i.groupId+'"');var S=M.ErrorDetails.UNKNOWN,E=!1,O=this.getInternalLoader(i);switch(i.type){case A.PlaylistContextType.MANIFEST:S=h?M.ErrorDetails.MANIFEST_LOAD_TIMEOUT:M.ErrorDetails.MANIFEST_LOAD_ERROR,E=!0;break;case A.PlaylistContextType.LEVEL:S=h?M.ErrorDetails.LEVEL_LOAD_TIMEOUT:M.ErrorDetails.LEVEL_LOAD_ERROR,E=!1;break;case A.PlaylistContextType.AUDIO_TRACK:S=h?M.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,E=!1;break;case A.PlaylistContextType.SUBTITLE_TRACK:S=h?M.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:M.ErrorDetails.SUBTITLE_LOAD_ERROR,E=!1;break}O&&this.resetInternalLoader(i.type);var x={type:M.ErrorTypes.NETWORK_ERROR,details:S,fatal:E,url:i.url,loader:O,context:i,networkDetails:u};R&&(x.response=R),this.hls.trigger(U.Events.ERROR,x)},c.handlePlaylistLoaded=function(i,u,h,R){var S=h.type,E=h.level,O=h.id,x=h.groupId,w=h.loader,T=h.levelDetails,_=h.deliveryDirectives;if(!(T!=null&&T.targetduration)){this.handleManifestParsingError(i,h,"invalid target duration",R);return}if(!w)return;T.live&&(w.getCacheAge&&(T.ageHeader=w.getCacheAge()||0),(!w.getCacheAge||isNaN(T.ageHeader))&&(T.ageHeader=0));switch(S){case A.PlaylistContextType.MANIFEST:case A.PlaylistContextType.LEVEL:this.hls.trigger(U.Events.LEVEL_LOADED,{details:T,level:E||0,id:O||0,stats:u,networkDetails:R,deliveryDirectives:_});break;case A.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:T,id:O||0,groupId:x||"",stats:u,networkDetails:R,deliveryDirectives:_});break;case A.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:T,id:O||0,groupId:x||"",stats:u,networkDetails:R,deliveryDirectives:_});break}},s}();V.default=d},"./src/polyfills/number.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"isFiniteNumber",function(){return z}),D.d(V,"MAX_SAFE_INTEGER",function(){return U});var z=Number.isFinite||function(M){return typeof M=="number"&&isFinite(M)},U=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(re,V,D){"use strict";D.r(V);var z=function(){function U(){}return U.getSilentFrame=function(W,B){switch(W){case"mp4a.40.2":if(B===1)return new Uint8Array([0,200,0,128,35,128]);if(B===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(B===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(B===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(B===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(B===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(B===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(B===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(B===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},U}();V.default=z},"./src/remux/mp4-generator.ts":function(re,V,D){"use strict";D.r(V);var z=Math.pow(2,32)-1,U=function(){function M(){}return M.init=function(){M.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var B;for(B in M.types)M.types.hasOwnProperty(B)&&(M.types[B]=[B.charCodeAt(0),B.charCodeAt(1),B.charCodeAt(2),B.charCodeAt(3)]);var P=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]),A=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);M.HDLR_TYPES={video:P,audio:A};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]);M.STTS=M.STSC=M.STCO=p,M.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),M.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),M.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),M.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var f=new Uint8Array([105,115,111,109]),d=new Uint8Array([97,118,99,49]),s=new Uint8Array([0,0,0,1]);M.FTYP=M.box(M.types.ftyp,f,s,f,d),M.DINF=M.box(M.types.dinf,M.box(M.types.dref,g))},M.box=function(B){for(var P=8,A=arguments.length,g=new Array(A>1?A-1:0),p=1;p<A;p++)g[p-1]=arguments[p];for(var f=g.length,d=f;f--;)P+=g[f].byteLength;var s=new Uint8Array(P);for(s[0]=P>>24&255,s[1]=P>>16&255,s[2]=P>>8&255,s[3]=P&255,s.set(B,4),f=0,P=8;f<d;f++)s.set(g[f],P),P+=g[f].byteLength;return s},M.hdlr=function(B){return M.box(M.types.hdlr,M.HDLR_TYPES[B])},M.mdat=function(B){return M.box(M.types.mdat,B)},M.mdhd=function(B,P){P*=B;var A=Math.floor(P/(z+1)),g=Math.floor(P%(z+1));return M.box(M.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,B>>24&255,B>>16&255,B>>8&255,B&255,A>>24,A>>16&255,A>>8&255,A&255,g>>24,g>>16&255,g>>8&255,g&255,85,196,0,0]))},M.mdia=function(B){return M.box(M.types.mdia,M.mdhd(B.timescale,B.duration),M.hdlr(B.type),M.minf(B))},M.mfhd=function(B){return M.box(M.types.mfhd,new Uint8Array([0,0,0,0,B>>24,B>>16&255,B>>8&255,B&255]))},M.minf=function(B){return B.type==="audio"?M.box(M.types.minf,M.box(M.types.smhd,M.SMHD),M.DINF,M.stbl(B)):M.box(M.types.minf,M.box(M.types.vmhd,M.VMHD),M.DINF,M.stbl(B))},M.moof=function(B,P,A){return M.box(M.types.moof,M.mfhd(B),M.traf(A,P))},M.moov=function(B){for(var P=B.length,A=[];P--;)A[P]=M.trak(B[P]);return M.box.apply(null,[M.types.moov,M.mvhd(B[0].timescale,B[0].duration)].concat(A).concat(M.mvex(B)))},M.mvex=function(B){for(var P=B.length,A=[];P--;)A[P]=M.trex(B[P]);return M.box.apply(null,[M.types.mvex].concat(A))},M.mvhd=function(B,P){P*=B;var A=Math.floor(P/(z+1)),g=Math.floor(P%(z+1)),p=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,B>>24&255,B>>16&255,B>>8&255,B&255,A>>24,A>>16&255,A>>8&255,A&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 M.box(M.types.mvhd,p)},M.sdtp=function(B){var P=B.samples||[],A=new Uint8Array(4+P.length),g,p;for(g=0;g<P.length;g++)p=P[g].flags,A[g+4]=p.dependsOn<<4|p.isDependedOn<<2|p.hasRedundancy;return M.box(M.types.sdtp,A)},M.stbl=function(B){return M.box(M.types.stbl,M.stsd(B),M.box(M.types.stts,M.STTS),M.box(M.types.stsc,M.STSC),M.box(M.types.stsz,M.STSZ),M.box(M.types.stco,M.STCO))},M.avc1=function(B){var P=[],A=[],g,p,f;for(g=0;g<B.sps.length;g++)p=B.sps[g],f=p.byteLength,P.push(f>>>8&255),P.push(f&255),P=P.concat(Array.prototype.slice.call(p));for(g=0;g<B.pps.length;g++)p=B.pps[g],f=p.byteLength,A.push(f>>>8&255),A.push(f&255),A=A.concat(Array.prototype.slice.call(p));var d=M.box(M.types.avcC,new Uint8Array([1,P[3],P[4],P[5],252|3,224|B.sps.length].concat(P).concat([B.pps.length]).concat(A))),s=B.width,c=B.height,o=B.pixelRatio[0],i=B.pixelRatio[1];return M.box(M.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,M.box(M.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),M.box(M.types.pasp,new Uint8Array([o>>24,o>>16&255,o>>8&255,o&255,i>>24,i>>16&255,i>>8&255,i&255])))},M.esds=function(B){var P=B.config.length;return new Uint8Array([0,0,0,0,3,23+P,0,1,0,4,15+P,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([P]).concat(B.config).concat([6,1,2]))},M.mp4a=function(B){var P=B.samplerate;return M.box(M.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,B.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]),M.box(M.types.esds,M.esds(B)))},M.mp3=function(B){var P=B.samplerate;return M.box(M.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,B.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]))},M.stsd=function(B){return B.type==="audio"?!B.isAAC&&B.codec==="mp3"?M.box(M.types.stsd,M.STSD,M.mp3(B)):M.box(M.types.stsd,M.STSD,M.mp4a(B)):M.box(M.types.stsd,M.STSD,M.avc1(B))},M.tkhd=function(B){var P=B.id,A=B.duration*B.timescale,g=B.width,p=B.height,f=Math.floor(A/(z+1)),d=Math.floor(A%(z+1));return M.box(M.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,P>>24&255,P>>16&255,P>>8&255,P&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]))},M.traf=function(B,P){var A=M.sdtp(B),g=B.id,p=Math.floor(P/(z+1)),f=Math.floor(P%(z+1));return M.box(M.types.traf,M.box(M.types.tfhd,new Uint8Array([0,0,0,0,g>>24,g>>16&255,g>>8&255,g&255])),M.box(M.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])),M.trun(B,A.length+16+20+8+16+8+8),A)},M.trak=function(B){return B.duration=B.duration||4294967295,M.box(M.types.trak,M.tkhd(B),M.mdia(B))},M.trex=function(B){var P=B.id;return M.box(M.types.trex,new Uint8Array([0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},M.trun=function(B,P){var A=B.samples||[],g=A.length,p=12+16*g,f=new Uint8Array(p),d,s,c,o,i,u;for(P+=8+p,f.set([0,0,15,1,g>>>24&255,g>>>16&255,g>>>8&255,g&255,P>>>24&255,P>>>16&255,P>>>8&255,P&255],0),d=0;d<g;d++)s=A[d],c=s.duration,o=s.size,i=s.flags,u=s.cts,f.set([c>>>24&255,c>>>16&255,c>>>8&255,c&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255,i.isLeading<<2|i.dependsOn,i.isDependedOn<<6|i.hasRedundancy<<4|i.paddingValue<<1|i.isNonSync,i.degradPrio&240<<8,i.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*d);return M.box(M.types.trun,f)},M.initSegment=function(B){M.types||M.init();var P=M.moov(B),A=new Uint8Array(M.FTYP.byteLength+P.byteLength);return A.set(M.FTYP),A.set(P,M.FTYP.byteLength),A},M}();U.types=void 0,U.HDLR_TYPES=void 0,U.STTS=void 0,U.STSC=void 0,U.STCO=void 0,U.STSZ=void 0,U.VMHD=void 0,U.SMHD=void 0,U.STSD=void 0,U.FTYP=void 0,U.DINF=void 0,V.default=U},"./src/remux/mp4-remuxer.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"default",function(){return u}),D.d(V,"normalizePts",function(){return h});var z=D("./src/polyfills/number.ts"),U=D("./src/remux/aac-helper.ts"),M=D("./src/remux/mp4-generator.ts"),W=D("./src/events.ts"),B=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),A=D("./src/types/loader.ts"),g=D("./src/utils/timescale-conversion.ts");function p(){return p=Object.assign||function(O){for(var x=1;x<arguments.length;x++){var w=arguments[x];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,o=null,i=!1,u=function(){function O(w,T,_,l){if(l===void 0&&(l=""),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 b=navigator.userAgent||"",m=b.match(/Chrome\/(\d+)/i);c=m?parseInt(m[1]):0}if(o===null){var y=navigator.userAgent.match(/Safari\/(\d+)/i);o=y?parseInt(y[1]):0}i=!!c&&c<75||!!o&&o<600}var x=O.prototype;return x.destroy=function(){},x.resetTimeStamp=function(T){P.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=T},x.resetNextTimestamp=function(){P.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},x.resetInitSegment=function(){P.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},x.getVideoStartPts=function(T){var _=!1,l=T.reduce(function(b,m){var y=m.pts-b;return y<-4294967296?(_=!0,h(b,m.pts)):y>0?b:m.pts},T[0].pts);return _&&P.logger.debug("PTS rollover detected"),l},x.remux=function(T,_,l,b,m,y,k,I){var N,F,C,v,j,K,J=m,te=m,ve=T.pid>-1,ue=_.pid>-1,de=_.samples.length,oe=T.samples.length>0,me=de>1,ae=(!ve||oe)&&(!ue||me)||this.ISGenerated||k;if(ae){this.ISGenerated||(C=this.generateIS(T,_,m));var fe=this.isVideoContiguous,Q=-1;if(me&&(Q=R(_.samples),!fe&&this.config.forceKeyFrameOnDiscontinuity))if(K=!0,Q>0){P.logger.warn("[mp4-remuxer]: Dropped "+Q+" out of "+de+" video samples due to a missing keyframe");var ie=this.getVideoStartPts(_.samples);_.samples=_.samples.slice(Q),_.dropped+=Q,te+=(_.samples[0].pts-ie)/(_.timescale||9e4)}else Q===-1&&(P.logger.warn("[mp4-remuxer]: No keyframe found out of "+de+" video samples"),K=!1);if(this.ISGenerated){if(oe&&me){var ee=this.getVideoStartPts(_.samples),Te=h(T.samples[0].pts,ee)-ee,Se=Te/_.inputTimeScale;J+=Math.max(0,Se),te+=Math.max(0,-Se)}if(oe){if(T.samplerate||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),C=this.generateIS(T,_,m)),F=this.remuxAudio(T,J,this.isAudioContiguous,y,ue||me||I===A.PlaylistLevelType.AUDIO?te:void 0),me){var be=F?F.endPTS-F.startPTS:0;_.inputTimeScale||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),C=this.generateIS(T,_,m)),N=this.remuxVideo(_,te,fe,be)}}else me&&(N=this.remuxVideo(_,te,fe,0));N&&(N.firstKeyFrame=Q,N.independent=Q!==-1)}}return this.ISGenerated&&(l.samples.length&&(j=this.remuxID3(l,m)),b.samples.length&&(v=this.remuxText(b,m))),{audio:F,video:N,initSegment:C,independent:K,text:v,id3:j}},x.generateIS=function(T,_,l){var b=T.samples,m=_.samples,y=this.typeSupported,k={},I=!Object(z.isFiniteNumber)(this._initPTS),N="audio/mp4",F,C,v;if(I&&(F=C=Infinity),T.config&&b.length&&(T.timescale=T.samplerate,T.isAAC||(y.mpeg?(N="audio/mpeg",T.codec=""):y.mp3&&(T.codec="mp3")),k.audio={id:"audio",container:N,codec:T.codec,initSegment:!T.isAAC&&y.mpeg?new Uint8Array(0):M.default.initSegment([T]),metadata:{channelCount:T.channelCount}},I&&(v=T.inputTimeScale,F=C=b[0].pts-Math.round(v*l))),_.sps&&_.pps&&m.length&&(_.timescale=_.inputTimeScale,k.video={id:"main",container:"video/mp4",codec:_.codec,initSegment:M.default.initSegment([_]),metadata:{width:_.width,height:_.height}},I)){v=_.inputTimeScale;var j=this.getVideoStartPts(m),K=Math.round(v*l);C=Math.min(C,h(m[0].dts,j)-K),F=Math.min(F,j-K)}if(Object.keys(k).length)return this.ISGenerated=!0,I&&(this._initPTS=F,this._initDTS=C),{tracks:k,initPTS:F,timescale:v}},x.remuxVideo=function(T,_,l,b){var m=T.inputTimeScale,y=T.samples,k=[],I=y.length,N=this._initPTS,F=this.nextAvcDts,C=8,v,j,K,J=Number.POSITIVE_INFINITY,te=Number.NEGATIVE_INFINITY,ve=0,ue=!1;if(!l||F===null){var de=_*m,oe=y[0].pts-h(y[0].dts,y[0].pts);F=de-oe}for(var me=0;me<I;me++){var ae=y[me];if(ae.pts=h(ae.pts-N,F),ae.dts=h(ae.dts-N,F),ae.dts>ae.pts){var fe=9e4*.2;ve=Math.max(Math.min(ve,ae.pts-ae.dts),-1*fe)}ae.dts<y[me>0?me-1:me].dts&&(ue=!0)}ue&&y.sort(function(Et,ct){var st=Et.dts-ct.dts,Ot=Et.pts-ct.pts;return st||Ot}),j=y[0].dts,K=y[y.length-1].dts;var Q=Math.round((K-j)/(I-1));if(ve<0){if(ve<Q*-2){P.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(g.toMsFromMpegTsClock)(-Q,!0)+" ms");for(var ie=ve,ee=0;ee<I;ee++)y[ee].dts=ie=Math.max(ie,y[ee].pts-Q),y[ee].pts=Math.max(ie,y[ee].pts)}else{P.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(g.toMsFromMpegTsClock)(ve,!0)+" ms to overcome this issue");for(var Te=0;Te<I;Te++)y[Te].dts=y[Te].dts+ve}j=y[0].dts}if(l){var Se=j-F,be=Se>Q,ye=Se<-1;if(be||ye){be?P.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(Se,!0)+" ms ("+Se+"dts) hole between fragments detected, filling it"):P.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(-Se,!0)+" ms ("+Se+"dts) overlapping between fragments detected"),j=F;var xe=y[0].pts-Se;y[0].dts=j,y[0].pts=xe,P.logger.log("Video: First PTS/DTS adjusted: "+Object(g.toMsFromMpegTsClock)(xe,!0)+"/"+Object(g.toMsFromMpegTsClock)(j,!0)+", delta: "+Object(g.toMsFromMpegTsClock)(Se,!0)+" ms")}}i&&(j=Math.max(0,j));for(var De=0,Ie=0,Ae=0;Ae<I;Ae++){for(var Le=y[Ae],Ue=Le.units,He=Ue.length,We=0,Fe=0;Fe<He;Fe++)We+=Ue[Fe].data.length;Ie+=We,De+=He,Le.length=We,Le.dts=Math.max(Le.dts,j),Le.pts=Math.max(Le.pts,Le.dts,0),J=Math.min(Le.pts,J),te=Math.max(Le.pts,te)}K=y[I-1].dts;var Je=Ie+4*De+8,Ve;try{Ve=new Uint8Array(Je)}catch(Et){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Je,reason:"fail allocating video mdat "+Je});return}var $e=new DataView(Ve.buffer);$e.setUint32(0,Je),Ve.set(M.default.types.mdat,4);for(var Ce=0;Ce<I;Ce++){for(var qe=y[Ce],ze=qe.units,Oe=0,Me=0,_e=ze.length;Me<_e;Me++){var he=ze[Me],ge=he.data,Y=he.data.byteLength;$e.setUint32(C,Y),C+=4,Ve.set(ge,C),C+=Y,Oe+=4+Y}if(Ce<I-1)v=y[Ce+1].dts-qe.dts;else{var Z=this.config,ne=qe.dts-y[Ce>0?Ce-1:Ce].dts;if(Z.stretchShortVideoTrack&&this.nextAudioPts!==null){var le=Math.floor(Z.maxBufferHole*m),pe=(b?J+b*m:this.nextAudioPts)-qe.pts;pe>le?(v=pe-ne,v<0&&(v=ne),P.logger.log("[mp4-remuxer]: It is approximately "+pe/90+" ms to the next segment; using duration "+v/90+" ms for the last video frame.")):v=ne}else v=ne}var Re=Math.round(qe.pts-qe.dts);k.push(new S(qe.key,v,Oe,Re))}if(k.length&&c&&c<70){var ke=k[0].flags;ke.dependsOn=2,ke.isNonSync=0}console.assert(v!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=F=K+v,this.isVideoContiguous=!0;var Qe=M.default.moof(T.sequenceNumber++,j,p({},T,{samples:k})),nt="video",rt={data1:Qe,data2:Ve,startPTS:J/m,endPTS:(te+v)/m,startDTS:j/m,endDTS:F/m,type:nt,hasAudio:!1,hasVideo:!0,nb:k.length,dropped:T.dropped};return T.samples=[],T.dropped=0,console.assert(Ve.length,"MDAT length must not be zero"),rt},x.remuxAudio=function(T,_,l,b,m){var y=T.inputTimeScale,k=T.samplerate?T.samplerate:y,I=y/k,N=T.isAAC?d:s,F=N*I,C=this._initPTS,v=!T.isAAC&&this.typeSupported.mpeg,j=[],K=T.samples,J=v?0:8,te=this.nextAudioPts||-1,ve=_*y;if(this.isAudioContiguous=l=l||K.length&&te>0&&(b&&Math.abs(ve-te)<9e3||Math.abs(h(K[0].pts-C,ve)-te)<20*F),K.forEach(function(ge){ge.pts=h(ge.pts-C,ve)}),!l||te<0){if(K=K.filter(function(ge){return ge.pts>=0}),!K.length)return;m===0?te=0:b?te=Math.max(0,ve):te=K[0].pts}if(T.isAAC)for(var ue=m!==void 0,de=this.config.maxAudioFramesDrift,oe=0,me=te;oe<K.length;oe++){var ae=K[oe],fe=ae.pts,Q=fe-me,ie=Math.abs(1e3*Q/y);if(Q<=-de*F&&ue)oe===0&&(P.logger.warn("Audio frame @ "+(fe/y).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Q/y)+" ms."),this.nextAudioPts=te=me=fe);else if(Q>=de*F&&ie<f&&ue){var ee=Math.round(Q/F);me=fe-ee*F,me<0&&(ee--,me+=F),oe===0&&(this.nextAudioPts=te=me),P.logger.warn("[mp4-remuxer]: Injecting "+ee+" audio frame @ "+(me/y).toFixed(3)+"s due to "+Math.round(1e3*Q/y)+" ms gap.");for(var Te=0;Te<ee;Te++){var Se=Math.max(me,0),be=U.default.getSilentFrame(T.manifestCodec||T.codec,T.channelCount);be||(P.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),be=ae.unit.subarray()),K.splice(oe,0,{unit:be,pts:Se}),me+=F,oe++}}ae.pts=me,me+=F}for(var ye=null,xe=null,De,Ie=0,Ae=K.length;Ae--;)Ie+=K[Ae].unit.byteLength;for(var Le=0,Ue=K.length;Le<Ue;Le++){var He=K[Le],We=He.unit,Fe=He.pts;if(xe!==null){var Je=j[Le-1];Je.duration=Math.round((Fe-xe)/I)}else if(l&&T.isAAC&&(Fe=te),ye=Fe,Ie>0){Ie+=J;try{De=new Uint8Array(Ie)}catch(ge){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ie,reason:"fail allocating audio mdat "+Ie});return}if(!v){var Ve=new DataView(De.buffer);Ve.setUint32(0,Ie),De.set(M.default.types.mdat,4)}}else return;De.set(We,J);var $e=We.byteLength;J+=$e,j.push(new S(!0,N,$e,0)),xe=Fe}var Ce=j.length;if(!Ce)return;var qe=j[j.length-1];this.nextAudioPts=te=xe+I*qe.duration;var ze=v?new Uint8Array(0):M.default.moof(T.sequenceNumber++,ye/I,p({},T,{samples:j}));T.samples=[];var Oe=ye/y,Me=te/y,_e="audio",he={data1:ze,data2:De,startPTS:Oe,endPTS:Me,startDTS:Oe,endDTS:Me,type:_e,hasAudio:!0,hasVideo:!1,nb:Ce};return this.isAudioContiguous=!0,console.assert(De.length,"MDAT length must not be zero"),he},x.remuxEmptyAudio=function(T,_,l,b){var m=T.inputTimeScale,y=T.samplerate?T.samplerate:m,k=m/y,I=this.nextAudioPts,N=(I!==null?I:b.startDTS*m)+this._initDTS,F=b.endDTS*m+this._initDTS,C=k*d,v=Math.ceil((F-N)/C),j=U.default.getSilentFrame(T.manifestCodec||T.codec,T.channelCount);if(P.logger.warn("[mp4-remuxer]: remux empty Audio"),!j){P.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var K=[],J=0;J<v;J++){var te=N+J*C;K.push({unit:j,pts:te,dts:te})}return T.samples=K,this.remuxAudio(T,_,l,!1)},x.remuxID3=function(T,_){var l=T.samples.length;if(!l)return;for(var b=T.inputTimeScale,m=this._initPTS,y=this._initDTS,k=0;k<l;k++){var I=T.samples[k];I.pts=h(I.pts-m,_*b)/b,I.dts=h(I.dts-y,_*b)/b}var N=T.samples;return T.samples=[],{samples:N}},x.remuxText=function(T,_){var l=T.samples.length;if(!l)return;for(var b=T.inputTimeScale,m=this._initPTS,y=0;y<l;y++){var k=T.samples[y];k.pts=h(k.pts-m,_*b)/b}T.samples.sort(function(N,F){return N.pts-F.pts});var I=T.samples;return T.samples=[],{samples:I}},O}();function h(O,x){var w;if(x===null)return O;for(x<O?w=-8589934592:w=8589934592;Math.abs(O-x)>4294967296;)O+=w;return O}function R(O){for(var x=0;x<O.length;x++)if(O[x].key)return x;return-1}var S=function(x,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 E(x)},E=function(x){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=x?2:1,this.isNonSync=x?0:1}},"./src/remux/passthrough-remuxer.ts":function(re,V,D){"use strict";D.r(V);var z=D("./src/polyfills/number.ts"),U=D("./src/utils/mp4-tools.ts"),M=D("./src/loader/fragment.ts"),W=D("./src/utils/logger.ts"),B=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 o=this.initData=Object(U.parseInitSegment)(d);s||(s=A(o.audio,M.ElementaryStreamTypes.AUDIO)),c||(c=A(o.video,M.ElementaryStreamTypes.VIDEO));var i={};o.audio&&o.video?i.audiovideo={container:"video/mp4",codec:s+","+c,initSegment:d,id:"main"}:o.audio?i.audio={container:"audio/mp4",codec:s,initSegment:d,id:"audio"}:o.video?i.video={container:"video/mp4",codec:c,initSegment:d,id:"main"}:W.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=i},p.remux=function(d,s,c,o,i){var u=this.initPTS,h=this.lastEndDTS,R={audio:void 0,video:void 0,text:o,id3:c,initSegment:void 0};Object(z.isFiniteNumber)(h)||(h=this.lastEndDTS=i||0);var S=s.samples;if(!S||!S.length)return R;var E={initPTS:void 0,timescale:1},O=this.initData;if((!O||!O.length)&&(this.generateInitSegment(S),O=this.initData),!O||!O.length)return W.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),R;this.emitInitSegment&&(E.tracks=this.initTracks,this.emitInitSegment=!1),Object(z.isFiniteNumber)(u)||(this.initPTS=E.initPTS=u=P(O,S,h));var x=Object(U.getDuration)(S,O),w=h,T=x+w;Object(U.offsetStartDTS)(O,S,u),x>0?this.lastEndDTS=T:(W.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var _=!!O.audio,l=!!O.video,b="";_&&(b+="audio"),l&&(b+="video");var m={data1:S,startPTS:w,startDTS:w,endPTS:T,endDTS:T,type:b,hasAudio:_,hasVideo:l,nb:1,dropped:0};return R.audio=m.type==="audio"?m:void 0,R.video=m.type!=="audio"?m:void 0,R.text=o,R.id3=c,R.initSegment=E,R},g}(),P=function(p,f,d){return Object(U.getStartDTS)(p,f)-d};function A(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===M.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}V.default=B},"./src/task-loop.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"default",function(){return z});var z=function(){function U(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var M=U.prototype;return M.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},M.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},M.onHandlerDestroyed=function(){},M.hasInterval=function(){return!!this._tickInterval},M.hasNextTick=function(){return!!this._tickTimer},M.setInterval=function(B){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,B),!0)},M.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},M.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},M.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},M.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},M.doTick=function(){},U}()},"./src/types/cmcd.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"CMCDVersion",function(){return z}),D.d(V,"CMCDObjectType",function(){return U}),D.d(V,"CMCDStreamingFormat",function(){return M}),D.d(V,"CMCDStreamType",function(){return W});var z=1,U;(function(B){B.MANIFEST="m",B.AUDIO="a",B.VIDEO="v",B.MUXED="av",B.INIT="i",B.CAPTION="c",B.TIMED_TEXT="tt",B.KEY="k",B.OTHER="o"})(U||(U={}));var M;(function(B){B.DASH="d",B.HLS="h",B.SMOOTH="s",B.OTHER="o"})(M||(M={}));var W;(function(B){B.VOD="v",B.LIVE="l"})(W||(W={}))},"./src/types/level.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"HlsSkip",function(){return M}),D.d(V,"getSkipValue",function(){return W}),D.d(V,"HlsUrlParameters",function(){return B}),D.d(V,"Level",function(){return P});function z(A,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(A,f.key,f)}}function U(A,g,p){return g&&z(A.prototype,g),p&&z(A,p),A}var M;(function(A){A.No="",A.Yes="YES",A.v2="v2"})(M||(M={}));function W(A,g){var p=A.canSkipUntil,f=A.canSkipDateRanges,d=A.endSN,s=g!==void 0?g-d:0;return p&&s<p?f?M.v2:M.Yes:M.No}var B=function(){function A(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=A.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()},A}(),P=function(){function A(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 U(A,[{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)}}]),A}()},"./src/types/loader.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"PlaylistContextType",function(){return z}),D.d(V,"PlaylistLevelType",function(){return U});var z;(function(M){M.MANIFEST="manifest",M.LEVEL="level",M.AUDIO_TRACK="audioTrack",M.SUBTITLE_TRACK="subtitleTrack"})(z||(z={}));var U;(function(M){M.MAIN="main",M.AUDIO="audio",M.SUBTITLE="subtitle"})(U||(U={}))},"./src/types/transmuxer.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"ChunkMetadata",function(){return z});var z=function(W,B,P,A,g,p){A===void 0&&(A=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=U(),this.buffering={audio:U(),video:U(),audiovideo:U()},this.level=W,this.sn=B,this.id=P,this.size=A,this.part=g,this.partial=p};function U(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"AttrList",function(){return M});var z=/^(\d+)x(\d+)$/,U=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,M=function(){function W(P){typeof P=="string"&&(P=W.parseAttrList(P));for(var A in P)P.hasOwnProperty(A)&&(this[A]=P[A])}var B=W.prototype;return B.decimalInteger=function(A){var g=parseInt(this[A],10);return g>Number.MAX_SAFE_INTEGER?Infinity:g},B.hexadecimalInteger=function(A){if(this[A]){var g=(this[A]||"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},B.hexadecimalIntegerAsNumber=function(A){var g=parseInt(this[A],16);return g>Number.MAX_SAFE_INTEGER?Infinity:g},B.decimalFloatingPoint=function(A){return parseFloat(this[A])},B.optionalFloat=function(A,g){var p=this[A];return p?parseFloat(p):g},B.enumeratedString=function(A){return this[A]},B.bool=function(A){return this[A]==="YES"},B.decimalResolution=function(A){var g=z.exec(this[A]);return g===null?void 0:{width:parseInt(g[1],10),height:parseInt(g[2],10)}},W.parseAttrList=function(A){var g,p={},f='"';for(U.lastIndex=0;(g=U.exec(A))!==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},W}()},"./src/utils/binary-search.ts":function(re,V,D){"use strict";D.r(V);var z={search:function(M,W){for(var B=0,P=M.length-1,A=null,g=null;B<=P;){A=(B+P)/2|0,g=M[A];var p=W(g);if(p>0)B=A+1;else if(p<0)P=A-1;else return g}return null}};V.default=z},"./src/utils/buffer-helper.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"BufferHelper",function(){return M});var z=D("./src/utils/logger.ts"),U={length:0,start:function(){return 0},end:function(){return 0}},M=function(){function W(){}return W.isBuffered=function(P,A){try{if(P){for(var g=W.getBuffered(P),p=0;p<g.length;p++)if(A>=g.start(p)&&A<=g.end(p))return!0}}catch(f){}return!1},W.bufferInfo=function(P,A,g){try{if(P){var p=W.getBuffered(P),f=[],d;for(d=0;d<p.length;d++)f.push({start:p.start(d),end:p.end(d)});return this.bufferedInfo(f,A,g)}}catch(s){}return{len:0,start:A,end:A,nextStart:void 0}},W.bufferedInfo=function(P,A,g){A=Math.max(0,A),P.sort(function(E,O){var x=E.start-O.start;return x||O.end-E.end});var p=[];if(g)for(var f=0;f<P.length;f++){var d=p.length;if(d){var s=p[d-1].end;P[f].start-s<g?P[f].end>s&&(p[d-1].end=P[f].end):p.push(P[f])}else p.push(P[f])}else p=P;for(var c=0,o,i=A,u=A,h=0;h<p.length;h++){var R=p[h].start,S=p[h].end;if(A+g>=R&&A<S)i=R,u=S,c=u-A;else if(A+g<R){o=R;break}}return{len:c,start:i||0,end:u||0,nextStart:o}},W.getBuffered=function(P){try{return P.buffered}catch(A){return z.logger.log("failed to get media.buffered",A),U}},W}()},"./src/utils/cea-608-parser.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"Row",function(){return u}),D.d(V,"CaptionScreen",function(){return h});var z=D("./src/utils/logger.ts"),U={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},M=function(T){var _=T;return U.hasOwnProperty(T)&&(_=U[T]),String.fromCharCode(_)},W=15,B=100,P={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},A={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(l,b){this.verboseLevel>=l&&z.logger.log(this.time+" ["+l+"] "+b)},w}(),c=function(T){for(var _=[],l=0;l<T.length;l++)_.push(T[l].toString(16));return _},o=function(){function w(_,l,b,m,y){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=l||!1,this.italics=b||!1,this.background=m||"black",this.flash=y||!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(l){for(var b=["foreground","underline","italics","background","flash"],m=0;m<b.length;m++){var y=b[m];l.hasOwnProperty(y)&&(this[y]=l[y])}},T.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},T.equals=function(l){return this.foreground===l.foreground&&this.underline===l.underline&&this.italics===l.italics&&this.background===l.background&&this.flash===l.flash},T.copy=function(l){this.foreground=l.foreground,this.underline=l.underline,this.italics=l.italics,this.background=l.background,this.flash=l.flash},T.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},w}(),i=function(){function w(_,l,b,m,y,k){this.uchar=void 0,this.penState=void 0,this.uchar=_||" ",this.penState=new o(l,b,m,y,k)}var T=w.prototype;return T.reset=function(){this.uchar=" ",this.penState.reset()},T.setChar=function(l,b){this.uchar=l,this.penState.copy(b)},T.setPenState=function(l){this.penState.copy(l)},T.equals=function(l){return this.uchar===l.uchar&&this.penState.equals(l.penState)},T.copy=function(l){this.uchar=l.uchar,this.penState.copy(l.penState)},T.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},w}(),u=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 l=0;l<B;l++)this.chars.push(new i);this.logger=_,this.pos=0,this.currPenState=new o}var T=w.prototype;return T.equals=function(l){for(var b=!0,m=0;m<B;m++)if(!this.chars[m].equals(l.chars[m])){b=!1;break}return b},T.copy=function(l){for(var b=0;b<B;b++)this.chars[b].copy(l.chars[b])},T.isEmpty=function(){for(var l=!0,b=0;b<B;b++)if(!this.chars[b].isEmpty()){l=!1;break}return l},T.setCursor=function(l){this.pos!==l&&(this.pos=l),this.pos<0?(this.logger.log(d.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>B&&(this.logger.log(d.DEBUG,"Too large cursor position "+this.pos),this.pos=B)},T.moveCursor=function(l){var b=this.pos+l;if(l>1)for(var m=this.pos+1;m<b+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(b)},T.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},T.insertChar=function(l){l>=144&&this.backSpace();var b=M(l);if(this.pos>=B){this.logger.log(d.ERROR,"Cannot insert "+l.toString(16)+" ("+b+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(b,this.currPenState),this.moveCursor(1)},T.clearFromPos=function(l){var b;for(b=l;b<B;b++)this.chars[b].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 l=[],b=!0,m=0;m<B;m++){var y=this.chars[m].uchar;y!==" "&&(b=!1),l.push(y)}return b?"":l.join("")},T.setPenStyles=function(l){this.currPenState.setStyles(l);var b=this.chars[this.pos];b.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 l=0;l<W;l++)this.rows.push(new u(_));this.logger=_,this.currRow=W-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var T=w.prototype;return T.reset=function(){for(var l=0;l<W;l++)this.rows[l].clear();this.currRow=W-1},T.equals=function(l){for(var b=!0,m=0;m<W;m++)if(!this.rows[m].equals(l.rows[m])){b=!1;break}return b},T.copy=function(l){for(var b=0;b<W;b++)this.rows[b].copy(l.rows[b])},T.isEmpty=function(){for(var l=!0,b=0;b<W;b++)if(!this.rows[b].isEmpty()){l=!1;break}return l},T.backSpace=function(){var l=this.rows[this.currRow];l.backSpace()},T.clearToEndOfRow=function(){var l=this.rows[this.currRow];l.clearToEndOfRow()},T.insertChar=function(l){var b=this.rows[this.currRow];b.insertChar(l)},T.setPen=function(l){var b=this.rows[this.currRow];b.setPenStyles(l)},T.moveCursor=function(l){var b=this.rows[this.currRow];b.moveCursor(l)},T.setCursor=function(l){this.logger.log(d.INFO,"setCursor: "+l);var b=this.rows[this.currRow];b.setCursor(l)},T.setPAC=function(l){this.logger.log(d.INFO,"pacData = "+JSON.stringify(l));var b=l.row-1;if(this.nrRollUpRows&&b<this.nrRollUpRows-1&&(b=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==b){for(var m=0;m<W;m++)this.rows[m].clear();var y=this.currRow+1-this.nrRollUpRows,k=this.lastOutputScreen;if(k){var I=k.rows[y].cueStartTime,N=this.logger.time;if(I&&N!==null&&I<N)for(var F=0;F<this.nrRollUpRows;F++)this.rows[b-this.nrRollUpRows+F+1].copy(k.rows[y+F])}}this.currRow=b;var C=this.rows[this.currRow];if(l.indent!==null){var v=l.indent,j=Math.max(v-1,0);C.setCursor(l.indent),l.color=C.chars[j].penState.foreground}var K={foreground:l.color,underline:l.underline,italics:l.italics,background:"black",flash:!1};this.setPen(K)},T.setBkgData=function(l){this.logger.log(d.INFO,"bkgData = "+JSON.stringify(l)),this.backSpace(),this.setPen(l),this.insertChar(32)},T.setRollUpRows=function(l){this.nrRollUpRows=l},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 l=this.currRow+1-this.nrRollUpRows,b=this.rows.splice(l,1)[0];b.clear(),this.rows.splice(this.currRow,0,b),this.logger.log(d.INFO,"Rolling up")},T.getDisplayText=function(l){l=l||!1;for(var b=[],m="",y=-1,k=0;k<W;k++){var I=this.rows[k].getTextString();I&&(y=k+1,l?b.push("Row "+y+": '"+I+"'"):b.push(I.trim()))}return b.length>0&&(l?m="["+b.join(" | ")+"]":m=b.join(`
|
|
`)),m},T.getTextAndFormat=function(){return this.rows},w}(),R=function(){function w(_,l,b){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=l,this.mode=null,this.verbose=0,this.displayedMemory=new h(b),this.nonDisplayedMemory=new h(b),this.lastOutputScreen=new h(b),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=b}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[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},T.getHandler=function(){return this.outputFilter},T.setHandler=function(l){this.outputFilter=l},T.setPAC=function(l){this.writeScreen.setPAC(l)},T.setBkgData=function(l){this.writeScreen.setBkgData(l)},T.setMode=function(l){if(l===this.mode)return;this.mode=l,this.logger.log(d.INFO,"MODE="+l),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=l},T.insertChars=function(l){for(var b=0;b<l.length;b++)this.writeScreen.insertChar(l[b]);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(l){this.logger.log(d.INFO,"RU("+l+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(l)},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 l=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=l,this.writeScreen=this.nonDisplayedMemory,this.logger.log(d.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},T.ccTO=function(l){this.logger.log(d.INFO,"TO("+l+") - Tab Offset"),this.writeScreen.moveCursor(l)},T.ccMIDROW=function(l){var b={flash:!1};if(b.underline=l%2===1,b.italics=l>=46,b.italics)b.foreground="white";else{var m=Math.floor(l/2)-16,y=["white","green","blue","cyan","red","yellow","magenta"];b.foreground=y[m]}this.logger.log(d.INFO,"MIDROW: "+JSON.stringify(b)),this.writeScreen.setPen(b)},T.outputDataUpdate=function(l){l===void 0&&(l=!1);var b=this.logger.time;if(b===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=b:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,b,this.lastOutputScreen),l&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:b),this.lastOutputScreen.copy(this.displayedMemory))},T.cueSplitAtTime=function(l){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,l,this.displayedMemory),this.cueStartTime=l))},w}(),S=function(){function w(_,l,b){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new s;this.channels=[null,new R(_,l,m),new R(_+1,b,m)],this.cmdHistory=x(),this.logger=m}var T=w.prototype;return T.getHandler=function(l){return this.channels[l].getHandler()},T.setHandler=function(l,b){this.channels[l].setHandler(b)},T.addData=function(l,b){var m,y,k,I=!1;this.logger.time=l;for(var N=0;N<b.length;N+=2){if(y=b[N]&127,k=b[N+1]&127,y===0&&k===0)continue;if(this.logger.log(d.DATA,"["+c([b[N],b[N+1]])+"] -> ("+c([y,k])+")"),m=this.parseCmd(y,k),m||(m=this.parseMidrow(y,k)),m||(m=this.parsePAC(y,k)),m||(m=this.parseBackgroundAttributes(y,k)),!m&&(I=this.parseChars(y,k),I)){var F=this.currentChannel;if(F&&F>0){var C=this.channels[F];C.insertChars(I)}else this.logger.log(d.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!I&&this.logger.log(d.WARNING,"Couldn't parse cleaned data "+c([y,k])+" orig: "+c([b[N],b[N+1]]))}},T.parseCmd=function(l,b){var m=this.cmdHistory,y=(l===20||l===28||l===21||l===29)&&b>=32&&b<=47,k=(l===23||l===31)&&b>=33&&b<=35;if(!(y||k))return!1;if(O(l,b,m))return E(null,null,m),this.logger.log(d.DEBUG,"Repeated command ("+c([l,b])+") is dropped"),!0;var I=l===20||l===21||l===23?1:2,N=this.channels[I];return l===20||l===21||l===28||l===29?b===32?N.ccRCL():b===33?N.ccBS():b===34?N.ccAOF():b===35?N.ccAON():b===36?N.ccDER():b===37?N.ccRU(2):b===38?N.ccRU(3):b===39?N.ccRU(4):b===40?N.ccFON():b===41?N.ccRDC():b===42?N.ccTR():b===43?N.ccRTD():b===44?N.ccEDM():b===45?N.ccCR():b===46?N.ccENM():b===47&&N.ccEOC():N.ccTO(b-32),E(l,b,m),this.currentChannel=I,!0},T.parseMidrow=function(l,b){var m=0;if((l===17||l===25)&&b>=32&&b<=47){if(l===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(d.ERROR,"Mismatch channel in midrow parsing"),!1;var y=this.channels[m];return y?(y.ccMIDROW(b),this.logger.log(d.DEBUG,"MIDROW ("+c([l,b])+")"),!0):!1}return!1},T.parsePAC=function(l,b){var m,y=this.cmdHistory,k=(l>=17&&l<=23||l>=25&&l<=31)&&b>=64&&b<=127,I=(l===16||l===24)&&b>=64&&b<=95;if(!(k||I))return!1;if(O(l,b,y))return E(null,null,y),!0;var N=l<=23?1:2;b>=64&&b<=95?m=N===1?P[l]:g[l]:m=N===1?A[l]:p[l];var F=this.channels[N];return F?(F.setPAC(this.interpretPAC(m,b)),E(l,b,y),this.currentChannel=N,!0):!1},T.interpretPAC=function(l,b){var m,y={color:null,italics:!1,indent:null,underline:!1,row:l};return b>95?m=b-96:m=b-64,y.underline=(m&1)===1,m<=13?y.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(y.italics=!0,y.color="white"):y.indent=Math.floor((m-16)/2)*4,y},T.parseChars=function(l,b){var m,y=null,k=null;if(l>=25?(m=2,k=l-8):(m=1,k=l),k>=17&&k<=19){var I;k===17?I=b+80:k===18?I=b+112:I=b+144,this.logger.log(d.INFO,"Special char '"+M(I)+"' in channel "+m),y=[I]}else l>=32&&l<=127&&(y=b===0?[l]:[l,b]);if(y){var N=c(y);this.logger.log(d.DEBUG,"Char codes = "+N.join(",")),E(l,b,this.cmdHistory)}return y},T.parseBackgroundAttributes=function(l,b){var m=(l===16||l===24)&&b>=32&&b<=47,y=(l===23||l===31)&&b>=45&&b<=47;if(!(m||y))return!1;var k,I={};l===16||l===24?(k=Math.floor((b-32)/2),I.background=f[k],b%2===1&&(I.background=I.background+"_semi")):b===45?I.background="transparent":(I.foreground="black",b===47&&(I.underline=!0));var N=l<=23?1:2,F=this.channels[N];return F.setBkgData(I),E(l,b,this.cmdHistory),!0},T.reset=function(){for(var l=0;l<Object.keys(this.channels).length;l++){var b=this.channels[l];b&&b.reset()}this.cmdHistory=x()},T.cueSplitAtTime=function(l){for(var b=0;b<this.channels.length;b++){var m=this.channels[b];m&&m.cueSplitAtTime(l)}},w}();function E(w,T,_){_.a=w,_.b=T}function O(w,T,_){return _.a===w&&_.b===T}function x(){return{a:null,b:null}}V.default=S},"./src/utils/codecs.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"isCodecType",function(){return U}),D.d(V,"isCodecSupportedInMp4",function(){return M});var z={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function U(W,B){var P=z[B];return!!P&&P[W.slice(0,4)]===!0}function M(W,B){return MediaSource.isTypeSupported((B||"video")+'/mp4;codecs="'+W+'"')}},"./src/utils/cues.ts":function(re,V,D){"use strict";D.r(V);var z=D("./src/utils/vttparser.ts"),U=D("./src/utils/webvtt-parser.ts"),M=D("./src/utils/texttrack-utils.ts"),W=/\s/,B={newCue:function(A,g,p,f){for(var d=[],s,c,o,i,u,h=self.VTTCue||self.TextTrackCue,R=0;R<f.rows.length;R++)if(s=f.rows[R],o=!0,i=0,u="",!s.isEmpty()){for(var S=0;S<s.chars.length;S++)W.test(s.chars[S].uchar)&&o?i++:(u+=s.chars[S].uchar,o=!1);s.cueStartTime=g,g===p&&(p+=1e-4),i>=16?i--:i++;var E=Object(z.fixLineBreaks)(u.trim()),O=Object(U.generateCueId)(g,p,E);(!A||!A.cues||!A.cues.getCueById(O))&&(c=new h(g,p,E),c.id=O,c.line=R+1,c.align="left",c.position=10+Math.min(80,Math.floor(i*8/32)*10),d.push(c))}return A&&d.length&&(d.sort(function(x,w){return x.line==="auto"||w.line==="auto"?0:x.line>8&&w.line>8?w.line-x.line:x.line-w.line}),d.forEach(function(x){return Object(M.addCueToTrack)(A,x)})),d}};V.default=B},"./src/utils/discontinuities.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"findFirstFragWithCC",function(){return W}),D.d(V,"shouldAlignOnDiscontinuities",function(){return B}),D.d(V,"findDiscontinuousReferenceFrag",function(){return P}),D.d(V,"adjustSlidingStart",function(){return g}),D.d(V,"alignStream",function(){return p}),D.d(V,"alignPDT",function(){return d}),D.d(V,"alignFragmentByPDTDelta",function(){return s}),D.d(V,"alignMediaPlaylistByPDT",function(){return c});var z=D("./src/polyfills/number.ts"),U=D("./src/utils/logger.ts"),M=D("./src/controller/level-helper.ts");function W(o,i){for(var u=null,h=0,R=o.length;h<R;h++){var S=o[h];if(S&&S.cc===i){u=S;break}}return u}function B(o,i,u){return!!(i.details&&(u.endCC>u.startCC||o&&o.cc<u.startCC))}function P(o,i){var u=o.fragments,h=i.fragments;if(!h.length||!u.length){U.logger.log("No fragments to align");return}var R=W(u,h[0].cc);if(!R||R&&!R.startPTS){U.logger.log("No frag in previous level to align on");return}return R}function A(o,i){if(o){var u=o.start+i;o.start=o.startPTS=u,o.endPTS=u+o.duration}}function g(o,i){for(var u=i.fragments,h=0,R=u.length;h<R;h++)A(u[h],o);i.fragmentHint&&A(i.fragmentHint,o),i.alignedSliding=!0}function p(o,i,u){if(!i)return;f(o,u,i),!u.alignedSliding&&i.details&&d(u,i.details),!u.alignedSliding&&i.details&&!u.skippedSegments&&Object(M.adjustSliding)(i.details,u)}function f(o,i,u){if(B(o,u,i)){var h=P(u.details,i);h&&Object(z.isFiniteNumber)(h.start)&&(U.logger.log("Adjusting PTS using last level due to CC increase within current level "+i.url),g(h.start,i))}}function d(o,i){if(!i.fragments.length||!o.hasProgramDateTime||!i.hasProgramDateTime)return;var u=i.fragments[0].programDateTime,h=o.fragments[0].programDateTime,R=(h-u)/1e3+i.fragments[0].start;R&&Object(z.isFiniteNumber)(R)&&(U.logger.log("Adjusting PTS using programDateTime delta "+(h-u)+"ms, sliding:"+R.toFixed(3)+" "+o.url+" "),g(R,o))}function s(o,i){var u=o.programDateTime;if(!u)return;var h=(u-i)/1e3;o.start=o.startPTS=h,o.endPTS=h+o.duration}function c(o,i){if(!i.fragments.length||!o.hasProgramDateTime||!i.hasProgramDateTime)return;var u=i.fragments[0].programDateTime,h=i.fragments[0].start,R=u-h*1e3;o.fragments.forEach(function(S){s(S,R)}),o.fragmentHint&&s(o.fragmentHint,R),o.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(re,V,D){"use strict";D.r(V);var z=D("./src/utils/ewma.ts"),U=function(){function M(B,P,A){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=A,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new z.default(B),this.fast_=new z.default(P)}var W=M.prototype;return W.update=function(P,A){var g=this.slow_,p=this.fast_;this.slow_.halfLife!==P&&(this.slow_=new z.default(P,g.getEstimate(),g.getTotalWeight())),this.fast_.halfLife!==A&&(this.fast_=new z.default(A,p.getEstimate(),p.getTotalWeight()))},W.sample=function(P,A){P=Math.max(P,this.minDelayMs_);var g=8*A,p=P/1e3,f=g/p;this.fast_.sample(p,f),this.slow_.sample(p,f)},W.canEstimate=function(){var P=this.fast_;return P&&P.getTotalWeight()>=this.minWeight_},W.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},W.destroy=function(){},M}();V.default=U},"./src/utils/ewma.ts":function(re,V,D){"use strict";D.r(V);var z=function(){function U(W,B,P){B===void 0&&(B=0),P===void 0&&(P=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=W,this.alpha_=W?Math.exp(Math.log(.5)/W):0,this.estimate_=B,this.totalWeight_=P}var M=U.prototype;return M.sample=function(B,P){var A=Math.pow(this.alpha_,B);this.estimate_=P*(1-A)+A*this.estimate_,this.totalWeight_+=B},M.getTotalWeight=function(){return this.totalWeight_},M.getEstimate=function(){if(this.alpha_){var B=1-Math.pow(this.alpha_,this.totalWeight_);if(B)return this.estimate_/B}return this.estimate_},U}();V.default=z},"./src/utils/fetch-loader.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"fetchSupported",function(){return s});var z=D("./src/polyfills/number.ts"),U=D("./src/loader/load-stats.ts"),M=D("./src/demux/chunk-cache.ts");function W(h,R){h.prototype=Object.create(R.prototype),h.prototype.constructor=h,p(h,R)}function B(h){var R=typeof Map=="function"?new Map:void 0;return B=function(E){if(E===null||!g(E))return E;if(typeof E!="function")throw new TypeError("Super expression must either be null or a function");if(typeof R!="undefined"){if(R.has(E))return R.get(E);R.set(E,O)}function O(){return P(E,arguments,f(this).constructor)}return O.prototype=Object.create(E.prototype,{constructor:{value:O,enumerable:!1,writable:!0,configurable:!0}}),p(O,E)},B(h)}function P(h,R,S){return A()?P=Reflect.construct:P=function(O,x,w){var T=[null];T.push.apply(T,x);var _=Function.bind.apply(O,T),l=new _;return w&&p(l,w.prototype),l},P.apply(null,arguments)}function A(){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,R){return p=Object.setPrototypeOf||function(E,O){return E.__proto__=O,E},p(h,R)}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 R=1;R<arguments.length;R++){var S=arguments[R];for(var E in S)Object.prototype.hasOwnProperty.call(S,E)&&(h[E]=S[E])}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||i,this.controller=new self.AbortController,this.stats=new U.LoadStats}var R=h.prototype;return R.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},R.abortInternal=function(){var E=this.response;(!E||!E.ok)&&(this.stats.aborted=!0,this.controller.abort())},R.abort=function(){var E;this.abortInternal(),(E=this.callbacks)!==null&&E!==void 0&&E.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},R.load=function(E,O,x){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 _=o(E,this.controller.signal),l=x.onProgress,b=E.responseType==="arraybuffer",m=b?"byteLength":"length";this.context=E,this.config=O,this.callbacks=x,this.request=this.fetchSetup(E,_),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){w.abortInternal(),x.onTimeout(T,E,w.response)},O.timeout),self.fetch(this.request).then(function(y){if(w.response=w.loader=y,!y.ok){var k=y.status,I=y.statusText;throw new u(I||"fetch, bad network response",k,y)}return T.loading.first=Math.max(self.performance.now(),T.loading.start),T.total=parseInt(y.headers.get("Content-Length")||"0"),l&&Object(z.isFiniteNumber)(O.highWaterMark)?w.loadProgressively(y,T,E,O.highWaterMark,l):b?y.arrayBuffer():y.text()}).then(function(y){var k=w.response;self.clearTimeout(w.requestTimeout),T.loading.end=Math.max(self.performance.now(),T.loading.first),T.loaded=T.total=y[m];var I={url:k.url,data:y};l&&!Object(z.isFiniteNumber)(O.highWaterMark)&&l(T,E,y,k),x.onSuccess(I,T,E,k)}).catch(function(y){if(self.clearTimeout(w.requestTimeout),T.aborted)return;var k=y.code||0;x.onError({code:k,text:y.message},E,y.details)})},R.getCacheAge=function(){var E=null;if(this.response){var O=this.response.headers.get("age");E=O?parseFloat(O):null}return E},R.loadProgressively=function(E,O,x,w,T){w===void 0&&(w=0);var _=new M.default,l=E.body.getReader(),b=function m(){return l.read().then(function(y){if(y.done)return _.dataLength&&T(O,x,_.flush(),E),Promise.resolve(new ArrayBuffer(0));var k=y.value,I=k.length;return O.loaded+=I,I<w||_.dataLength?(_.push(k),_.dataLength>=w&&T(O,x,_.flush(),E)):T(O,x,k,E),m()}).catch(function(){return Promise.reject()})};return b()},h}();function o(h,R){var S={method:"GET",mode:"cors",credentials:"same-origin",signal:R,headers:new self.Headers(d({},h.headers))};return h.rangeEnd&&S.headers.set("Range","bytes="+h.rangeStart+"-"+String(h.rangeEnd-1)),S}function i(h,R){return new self.Request(h.url,R)}var u=function(h){W(R,h);function R(S,E,O){var x;return x=h.call(this,S)||this,x.code=void 0,x.details=void 0,x.code=E,x.details=O,x}return R}(B(Error));V.default=c},"./src/utils/imsc1-ttml-parser.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"IMSC1_CODEC",function(){return g}),D.d(V,"parseIMSC1",function(){return s});var z=D("./src/utils/mp4-tools.ts"),U=D("./src/utils/vttparser.ts"),M=D("./src/utils/vttcue.ts"),W=D("./src/demux/id3.ts"),B=D("./src/utils/timescale-conversion.ts"),P=D("./src/utils/webvtt-parser.ts");function A(){return A=Object.assign||function(w){for(var T=1;T<arguments.length;T++){var _=arguments[T];for(var l in _)Object.prototype.hasOwnProperty.call(_,l)&&(w[l]=_[l])}return w},A.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,_,l,b){var m=Object(z.findBox)(new Uint8Array(w),["mdat"]);if(m.length===0){b(new Error("Could not parse IMSC1 mdat"));return}var y=m[0],k=Object(W.utf8ArrayToStr)(new Uint8Array(w,y.start,y.end-y.start)),I=Object(B.toTimescaleFromScale)(T,1,_);try{l(c(k,I))}catch(N){b(N)}}function c(w,T){var _=new DOMParser,l=_.parseFromString(w,"text/xml"),b=l.getElementsByTagName("tt")[0];if(!b)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},y=Object.keys(m).reduce(function(C,v){return C[v]=b.getAttribute("ttp:"+v)||m[v],C},{}),k=b.getAttribute("xml:space")!=="preserve",I=i(o(b,"styling","style")),N=i(o(b,"layout","region")),F=o(b,"body","[begin]");return[].map.call(F,function(C){var v=u(C,k);if(!v||!C.hasAttribute("begin"))return null;var j=E(C.getAttribute("begin"),y),K=E(C.getAttribute("dur"),y),J=E(C.getAttribute("end"),y);if(j===null)throw S(C);if(J===null){if(K===null)throw S(C);J=j+K}var te=new M.default(j-T,J-T,v);te.id=Object(P.generateCueId)(te.startTime,te.endTime,te.text);var ve=N[C.getAttribute("region")],ue=I[C.getAttribute("style")];te.position=10,te.size=80;var de=h(ve,ue),oe=de.textAlign;if(oe){var me=d[oe];me&&(te.lineAlign=me),te.align=oe}return A(te,de),te}).filter(function(C){return C!==null})}function o(w,T,_){var l=w.getElementsByTagName(T)[0];return l?[].slice.call(l.querySelectorAll(_)):[]}function i(w){return w.reduce(function(T,_){var l=_.getAttribute("xml:id");return l&&(T[l]=_),T},{})}function u(w,T){return[].slice.call(w.childNodes).reduce(function(_,l,b){var m;return l.nodeName==="br"&&b?_+`
|
|
`:(m=l.childNodes)!==null&&m!==void 0&&m.length?u(l,T):T?_+l.textContent.trim().replace(/\s+/g," "):_+l.textContent},"")}function h(w,T){var _="http://www.w3.org/ns/ttml#styling",l=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return l.reduce(function(b,m){var y=R(T,_,m)||R(w,_,m);return y&&(b[m]=y),b},{})}function R(w,T,_){return w.hasAttributeNS(T,_)?w.getAttributeNS(T,_):null}function S(w){return new Error("Could not parse ttml timestamp "+w)}function E(w,T){if(!w)return null;var _=Object(U.parseTimeStamp)(w);return _===null&&(p.test(w)?_=O(w,T):f.test(w)&&(_=x(w,T))),_}function O(w,T){var _=p.exec(w),l=(_[4]|0)+(_[5]|0)/T.subFrameRate;return(_[1]|0)*3600+(_[2]|0)*60+(_[3]|0)+l/T.frameRate}function x(w,T){var _=f.exec(w),l=Number(_[1]),b=_[2];switch(b){case"h":return l*3600;case"m":return l*60;case"ms":return l*1e3;case"f":return l/T.frameRate;case"t":return l/T.tickRate}return l}},"./src/utils/logger.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"enableLogs",function(){return P}),D.d(V,"logger",function(){return A});var z=function(){},U={trace:z,debug:z,log:z,warn:z,info:z,error:z},M=U;function W(g){var p=self.console[g];return p?p.bind(self.console,"["+g+"] >"):z}function B(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){M[s]=g[s]?g[s].bind(g):W(s)})}function P(g){if(self.console&&g===!0||typeof g=="object"){B(g,"debug","log","info","warn","error");try{M.log()}catch(p){M=U}}else M=U}var A=M},"./src/utils/mediakeys-helper.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"KeySystems",function(){return z}),D.d(V,"requestMediaKeySystemAccess",function(){return U});var z;(function(M){M.WIDEVINE="com.widevine.alpha",M.PLAYREADY="com.microsoft.playready"})(z||(z={}));var U=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"getMediaSource",function(){return z});function z(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"bin2str",function(){return B}),D.d(V,"readUint16",function(){return P}),D.d(V,"readUint32",function(){return A}),D.d(V,"writeUint32",function(){return g}),D.d(V,"findBox",function(){return p}),D.d(V,"parseSegmentIndex",function(){return f}),D.d(V,"parseInitSegment",function(){return d}),D.d(V,"getStartDTS",function(){return s}),D.d(V,"getDuration",function(){return c}),D.d(V,"computeRawDurationFromSamples",function(){return o}),D.d(V,"offsetStartDTS",function(){return i}),D.d(V,"segmentValidRange",function(){return u}),D.d(V,"appendUint8Array",function(){return h});var z=D("./src/utils/typed-array.ts"),U=D("./src/loader/fragment.ts"),M=Math.pow(2,32)-1,W=[].push;function B(R){return String.fromCharCode.apply(null,R)}function P(R,S){"data"in R&&(S+=R.start,R=R.data);var E=R[S]<<8|R[S+1];return E<0?65536+E:E}function A(R,S){"data"in R&&(S+=R.start,R=R.data);var E=R[S]<<24|R[S+1]<<16|R[S+2]<<8|R[S+3];return E<0?4294967296+E:E}function g(R,S,E){"data"in R&&(S+=R.start,R=R.data),R[S]=E>>24,R[S+1]=E>>16&255,R[S+2]=E>>8&255,R[S+3]=E&255}function p(R,S){var E=[];if(!S.length)return E;var O,x,w;"data"in R?(O=R.data,x=R.start,w=R.end):(O=R,x=0,w=O.byteLength);for(var T=x;T<w;){var _=A(O,T),l=B(O.subarray(T+4,T+8)),b=_>1?T+_:w;if(l===S[0])if(S.length===1)E.push({data:O,start:T+8,end:b});else{var m=p({data:O,start:T+8,end:b},S.slice(1));m.length&&W.apply(E,m)}T=b}return E}function f(R){var S=p(R,["moov"]),E=S[0],O=E?E.end:null,x=p(R,["sidx"]);if(!x||!x[0])return null;var w=[],T=x[0],_=T.data[0],l=_===0?8:16,b=A(T,l);l+=4;var m=0,y=0;_===0?l+=8:l+=16,l+=2;var k=T.end+y,I=P(T,l);l+=2;for(var N=0;N<I;N++){var F=l,C=A(T,F);F+=4;var v=C&2147483647,j=(C&2147483648)>>>31;if(j===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var K=A(T,F);F+=4,w.push({referenceSize:v,subsegmentDuration:K,info:{duration:K/b,start:k,end:k+v-1}}),k+=v,F+=4,l=F}return{earliestPresentationTime:m,timescale:b,version:_,referencesCount:I,references:w,moovEndOffset:O}}function d(R){for(var S=[],E=p(R,["moov","trak"]),O=0;O<E.length;O++){var x=E[O],w=p(x,["tkhd"])[0];if(w){var T=w.data[w.start],_=T===0?12:20,l=A(w,_),b=p(x,["mdia","mdhd"])[0];if(b){T=b.data[b.start],_=T===0?12:20;var m=A(b,_),y=p(x,["mdia","hdlr"])[0];if(y){var k=B(y.data.subarray(y.start+8,y.start+12)),I={soun:U.ElementaryStreamTypes.AUDIO,vide:U.ElementaryStreamTypes.VIDEO}[k];if(I){var N=p(x,["mdia","minf","stbl","stsd"])[0],F=void 0;N&&(F=B(N.data.subarray(N.start+12,N.start+16))),S[l]={timescale:m,type:I},S[I]={timescale:m,id:l,codec:F}}}}}}var C=p(R,["moov","mvex","trex"]);return C.forEach(function(v){var j=A(v,4),K=S[j];K&&(K.default={duration:A(v,12),flags:A(v,20)})}),S}function s(R,S){return p(S,["moof","traf"]).reduce(function(E,O){var x=p(O,["tfdt"])[0],w=x.data[x.start],T=p(O,["tfhd"]).reduce(function(_,l){var b=A(l,4),m=R[b];if(m){var y=A(x,4);w===1&&(y*=Math.pow(2,32),y+=A(x,8));var k=m.timescale||9e4,I=y/k;if(isFinite(I)&&(_===null||I<_))return I}return _},null);return T!==null&&isFinite(T)&&(E===null||T<E)?T:E},null)||0}function c(R,S){for(var E=0,O=0,x=0,w=p(R,["moof","traf"]),T=0;T<w.length;T++){var _=w[T],l=p(_,["tfhd"])[0],b=A(l,4),m=S[b];if(!m)continue;var y=m.default,k=A(l,0)|(y==null?void 0:y.flags),I=y==null?void 0:y.duration;k&8&&(k&2?I=A(l,12):I=A(l,8));for(var N=m.timescale||9e4,F=p(_,["trun"]),C=0;C<F.length;C++){if(I){var v=A(F[C],4);E=I*v}else E=o(F[C]);m.type===U.ElementaryStreamTypes.VIDEO?O+=E/N:m.type===U.ElementaryStreamTypes.AUDIO&&(x+=E/N)}}if(O===0&&x===0){var j=f(R);if(j!=null&&j.references)return j.references.reduce(function(K,J){return K+J.info.duration||0},0)}return O||x}function o(R){var S=A(R,0),E=8;S&1&&(E+=4),S&4&&(E+=4);for(var O=0,x=A(R,4),w=0;w<x;w++){if(S&256){var T=A(R,E);O+=T,E+=4}S&512&&(E+=4),S&1024&&(E+=4),S&2048&&(E+=4)}return O}function i(R,S,E){p(S,["moof","traf"]).forEach(function(O){p(O,["tfhd"]).forEach(function(x){var w=A(x,4),T=R[w];if(!T)return;var _=T.timescale||9e4;p(O,["tfdt"]).forEach(function(l){var b=l.data[l.start],m=A(l,4);if(b===0)g(l,4,m-E*_);else{m*=Math.pow(2,32),m+=A(l,8),m-=E*_,m=Math.max(m,0);var y=Math.floor(m/(M+1)),k=Math.floor(m%(M+1));g(l,4,y),g(l,8,k)}})})})}function u(R){var S={valid:null,remainder:null},E=p(R,["moof"]);if(E){if(E.length<2)return S.remainder=R,S}else return S;var O=E[E.length-1];return S.valid=Object(z.sliceUint8)(R,0,O.start-8),S.remainder=Object(z.sliceUint8)(R,O.start-8),S}function h(R,S){var E=new Uint8Array(R.length+S.length);return E.set(R),E.set(S,R.length),E}},"./src/utils/output-filter.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"default",function(){return z});var z=function(){function U(W,B){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=W,this.trackName=B}var M=U.prototype;return M.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},M.newCue=function(B,P,A){(this.startTime===null||this.startTime>B)&&(this.startTime=B),this.endTime=P,this.screen=A,this.timelineController.createCaptionsTrack(this.trackName)},M.reset=function(){this.cueRanges=[]},U}()},"./src/utils/texttrack-utils.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"sendAddTrackEvent",function(){return U}),D.d(V,"addCueToTrack",function(){return M}),D.d(V,"clearCurrentCues",function(){return W}),D.d(V,"removeCuesInRange",function(){return B}),D.d(V,"getCuesInRange",function(){return A});var z=D("./src/utils/logger.ts");function U(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 M(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){z.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 W(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 B(g,p,f){var d=g.mode;if(d==="disabled"&&(g.mode="hidden"),g.cues&&g.cues.length>0)for(var s=A(g.cues,p,f),c=0;c<s.length;c++)g.removeCue(s[c]);d==="disabled"&&(g.mode=d)}function P(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 A(g,p,f){var d=[],s=P(g,p);if(s>-1)for(var c=s,o=g.length;c<o;c++){var i=g[c];if(i.startTime>=p&&i.endTime<=f)d.push(i);else if(i.startTime>f)return d}return d}},"./src/utils/time-ranges.ts":function(re,V,D){"use strict";D.r(V);var z={toString:function(M){for(var W="",B=M.length,P=0;P<B;P++)W+="["+M.start(P).toFixed(3)+","+M.end(P).toFixed(3)+"]";return W}};V.default=z},"./src/utils/timescale-conversion.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"toTimescaleFromBase",function(){return U}),D.d(V,"toTimescaleFromScale",function(){return M}),D.d(V,"toMsFromMpegTsClock",function(){return W}),D.d(V,"toMpegTsClockFromTimescale",function(){return B});var z=9e4;function U(P,A,g,p){g===void 0&&(g=1),p===void 0&&(p=!1);var f=P*A*g;return p?Math.round(f):f}function M(P,A,g,p){return g===void 0&&(g=1),p===void 0&&(p=!1),U(P,A,1/g,p)}function W(P,A){return A===void 0&&(A=!1),U(P,1e3,1/z,A)}function B(P,A){return A===void 0&&(A=1),U(P,z,1/A)}},"./src/utils/typed-array.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"sliceUint8",function(){return z});function z(U,M,W){return Uint8Array.prototype.slice?U.slice(M,W):new Uint8Array(Array.prototype.slice.call(U,M,W))}},"./src/utils/vttcue.ts":function(re,V,D){"use strict";D.r(V),V.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var z=["","lr","rl"],U=["start","middle","end","left","right"];function M(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 W(g){return M(z,g)}function B(g){return M(U,g)}function P(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 o in c)g[o]=c[o]}return g}function A(g,p,f){var d=this,s={enumerable:!0};d.hasBeenReset=!1;var c="",o=!1,i=g,u=p,h=f,R=null,S="",E=!0,O="auto",x="start",w=50,T="middle",_=50,l="middle";Object.defineProperty(d,"id",P({},s,{get:function(){return c},set:function(m){c=""+m}})),Object.defineProperty(d,"pauseOnExit",P({},s,{get:function(){return o},set:function(m){o=!!m}})),Object.defineProperty(d,"startTime",P({},s,{get:function(){return i},set:function(m){if(typeof m!="number")throw new TypeError("Start time must be set to a number.");i=m,this.hasBeenReset=!0}})),Object.defineProperty(d,"endTime",P({},s,{get:function(){return u},set:function(m){if(typeof m!="number")throw new TypeError("End time must be set to a number.");u=m,this.hasBeenReset=!0}})),Object.defineProperty(d,"text",P({},s,{get:function(){return h},set:function(m){h=""+m,this.hasBeenReset=!0}})),Object.defineProperty(d,"region",P({},s,{get:function(){return R},set:function(m){R=m,this.hasBeenReset=!0}})),Object.defineProperty(d,"vertical",P({},s,{get:function(){return S},set:function(m){var y=W(m);if(y===!1)throw new SyntaxError("An invalid or illegal string was specified.");S=y,this.hasBeenReset=!0}})),Object.defineProperty(d,"snapToLines",P({},s,{get:function(){return E},set:function(m){E=!!m,this.hasBeenReset=!0}})),Object.defineProperty(d,"line",P({},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",P({},s,{get:function(){return x},set:function(m){var y=B(m);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");x=y,this.hasBeenReset=!0}})),Object.defineProperty(d,"position",P({},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",P({},s,{get:function(){return T},set:function(m){var y=B(m);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");T=y,this.hasBeenReset=!0}})),Object.defineProperty(d,"size",P({},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",P({},s,{get:function(){return l},set:function(m){var y=B(m);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");l=y,this.hasBeenReset=!0}})),d.displayState=void 0}return A.prototype.getCueAsHTML=function(){var g=self.WebVTT;return g.convertCueToDOMTree(self,this.text)},A}()},"./src/utils/vttparser.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"parseTimeStamp",function(){return M}),D.d(V,"fixLineBreaks",function(){return p}),D.d(V,"VTTParser",function(){return f});var z=D("./src/utils/vttcue.ts"),U=function(){function d(){}var s=d.prototype;return s.decode=function(o,i){if(!o)return"";if(typeof o!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(o))},d}();function M(d){function s(o,i,u,h){return(o|0)*3600+(i|0)*60+(u|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 W=function(){function d(){this.values=Object.create(null)}var s=d.prototype;return s.set=function(o,i){!this.get(o)&&i!==""&&(this.values[o]=i)},s.get=function(o,i,u){return u?this.has(o)?this.values[o]:i[u]:this.has(o)?this.values[o]:i},s.has=function(o){return o in this.values},s.alt=function(o,i,u){for(var h=0;h<u.length;++h)if(i===u[h]){this.set(o,i);break}},s.integer=function(o,i){/^-?\d+$/.test(i)&&this.set(o,parseInt(i,10))},s.percent=function(o,i){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(i)){var u=parseFloat(i);if(u>=0&&u<=100)return this.set(o,u),!0}return!1},d}();function B(d,s,c,o){var i=o?d.split(o):[d];for(var u in i){if(typeof i[u]!="string")continue;var h=i[u].split(c);if(h.length!==2)continue;var R=h[0],S=h[1];s(R,S)}}var P=new z.default(0,0,""),A=P.align==="middle"?"middle":"center";function g(d,s,c){var o=d;function i(){var R=M(d);if(R===null)throw new Error("Malformed timestamp: "+o);return d=d.replace(/^[^\sa-zA-Z-]+/,""),R}function u(R,S){var E=new W;B(R,function(w,T){var _;switch(w){case"region":for(var l=c.length-1;l>=0;l--)if(c[l].id===T){E.set(w,c[l].region);break}break;case"vertical":E.alt(w,T,["rl","lr"]);break;case"line":_=T.split(","),E.integer(w,_[0]),E.percent(w,_[0])&&E.set("snapToLines",!1),E.alt(w,_[0],["auto"]),_.length===2&&E.alt("lineAlign",_[1],["start",A,"end"]);break;case"position":_=T.split(","),E.percent(w,_[0]),_.length===2&&E.alt("positionAlign",_[1],["start",A,"end","line-left","line-right","auto"]);break;case"size":E.percent(w,T);break;case"align":E.alt(w,T,["start",A,"end","left","right"]);break}},/:/,/\s/),S.region=E.get("region",null),S.vertical=E.get("vertical","");var O=E.get("line","auto");O==="auto"&&P.line===-1&&(O=-1),S.line=O,S.lineAlign=E.get("lineAlign","start"),S.snapToLines=E.get("snapToLines",!0),S.size=E.get("size",100),S.align=E.get("align",A);var x=E.get("position","auto");x==="auto"&&P.position===50&&(x=S.align==="start"||S.align==="left"?0:S.align==="end"||S.align==="right"?100:50),S.position=x}function h(){d=d.replace(/^\s+/,"")}if(h(),s.startTime=i(),h(),d.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+o);d=d.substr(3),h(),s.endTime=i(),h(),u(d,s)}function p(d){return d.replace(/<br(?: \/)?>/gi,`
|
|
`)}var f=function(){function d(){this.state="INITIAL",this.buffer="",this.decoder=new U,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var s=d.prototype;return s.parse=function(o){var i=this;o&&(i.buffer+=i.decoder.decode(o,{stream:!0}));function u(){var x=i.buffer,w=0;for(x=p(x);w<x.length&&x[w]!=="\r"&&x[w]!==`
|
|
`;)++w;var T=x.substr(0,w);return x[w]==="\r"&&++w,x[w]===`
|
|
`&&++w,i.buffer=x.substr(w),T}function h(x){B(x,function(w,T){},/:/)}try{var R="";if(i.state==="INITIAL"){if(!/\r\n|\n/.test(i.buffer))return this;R=u();var S=R.match(/^()?WEBVTT([ \t].*)?$/);if(!S||!S[0])throw new Error("Malformed WebVTT signature.");i.state="HEADER"}for(var E=!1;i.buffer;){if(!/\r\n|\n/.test(i.buffer))return this;E?E=!1:R=u();switch(i.state){case"HEADER":/:/.test(R)?h(R):R||(i.state="ID");continue;case"NOTE":R||(i.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(R)){i.state="NOTE";break}if(!R)continue;if(i.cue=new z.default(0,0,""),i.state="CUE",R.indexOf("-->")===-1){i.cue.id=R;continue}case"CUE":if(!i.cue){i.state="BADCUE";continue}try{g(R,i.cue,i.regionList)}catch(x){i.cue=null,i.state="BADCUE";continue}i.state="CUETEXT";continue;case"CUETEXT":{var O=R.indexOf("-->")!==-1;if(!R||O&&(E=!0)){i.oncue&&i.cue&&i.oncue(i.cue),i.cue=null,i.state="ID";continue}if(i.cue===null)continue;i.cue.text&&(i.cue.text+=`
|
|
`),i.cue.text+=R}continue;case"BADCUE":R||(i.state="ID")}}}catch(x){i.state==="CUETEXT"&&i.cue&&i.oncue&&i.oncue(i.cue),i.cue=null,i.state=i.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},s.flush=function(){var o=this;try{if((o.cue||o.state==="HEADER")&&(o.buffer+=`
|
|
|
|
`,o.parse()),o.state==="INITIAL"||o.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(i){o.onparsingerror&&o.onparsingerror(i)}return o.onflush&&o.onflush(),this},d}()},"./src/utils/webvtt-parser.ts":function(re,V,D){"use strict";D.r(V),D.d(V,"generateCueId",function(){return f}),D.d(V,"parseWebVTT",function(){return s});var z=D("./src/polyfills/number.ts"),U=D("./src/utils/vttparser.ts"),M=D("./src/demux/id3.ts"),W=D("./src/utils/timescale-conversion.ts"),B=D("./src/remux/mp4-remuxer.ts"),P=/\r\n|\n\r|\n|\r/g,A=function(o,i,u){return u===void 0&&(u=0),o.substr(u,i.length)===i},g=function(o){var i=parseInt(o.substr(-3)),u=parseInt(o.substr(-6,2)),h=parseInt(o.substr(-9,2)),R=o.length>9?parseInt(o.substr(0,o.indexOf(":"))):0;if(!Object(z.isFiniteNumber)(i)||!Object(z.isFiniteNumber)(u)||!Object(z.isFiniteNumber)(h)||!Object(z.isFiniteNumber)(R))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+o);return i+=1e3*u,i+=60*1e3*h,i+=60*60*1e3*R,i},p=function(o){for(var i=5381,u=o.length;u;)i=i*33^o.charCodeAt(--u);return(i>>>0).toString()};function f(c,o,i){return p(c.toString())+p(o.toString())+p(i)}var d=function(o,i,u){var h=o[i],R=o[h.prevCC];if(!R||!R.new&&h.new){o.ccOffset=o.presentationOffset=h.start,h.new=!1;return}for(;(S=R)!==null&&S!==void 0&&S.new;){var S;o.ccOffset+=h.start-R.start,h.new=!1,h=R,R=o[h.prevCC]}o.presentationOffset=u};function s(c,o,i,u,h,R,S,E){var O=new U.VTTParser,x=Object(M.utf8ArrayToStr)(new Uint8Array(c)).trim().replace(P,`
|
|
`).split(`
|
|
`),w=[],T=Object(W.toMpegTsClockFromTimescale)(o,i),_="00:00.000",l=0,b=0,m,y=!0,k=!1;O.oncue=function(I){var N=u[h],F=u.ccOffset,C=(l-T)/9e4;if(N!=null&&N.new&&(b!==void 0?F=u.ccOffset=N.start:d(u,h,C)),C&&(F=C-u.presentationOffset),k){var v=I.endTime-I.startTime,j=Object(B.normalizePts)((I.startTime+F-b)*9e4,R*9e4)/9e4;I.startTime=j,I.endTime=j+v}var K=I.text.trim();I.text=decodeURIComponent(encodeURIComponent(K)),I.id||(I.id=f(I.startTime,I.endTime,K)),I.endTime>0&&w.push(I)},O.onparsingerror=function(I){m=I},O.onflush=function(){if(m){E(m);return}S(w)},x.forEach(function(I){if(y)if(A(I,"X-TIMESTAMP-MAP=")){y=!1,k=!0,I.substr(16).split(",").forEach(function(N){A(N,"LOCAL:")?_=N.substr(6):A(N,"MPEGTS:")&&(l=parseInt(N.substr(7)))});try{b=g(_)/1e3}catch(N){k=!1,m=N}return}else I===""&&(y=!1);O.parse(I+`
|
|
`)}),O.flush()}},"./src/utils/xhr-loader.ts":function(re,V,D){"use strict";D.r(V);var z=D("./src/utils/logger.ts"),U=D("./src/loader/load-stats.ts"),M=/^age:\s*[\d.]+\s*$/m,W=function(){function B(A){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=A?A.xhrSetup:null,this.stats=new U.LoadStats,this.retryDelay=0}var P=B.prototype;return P.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},P.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()))},P.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},P.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()},P.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(i){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 o in c)f.setRequestHeader(o,c[o])}catch(i){this.callbacks.onError({code:f.status,text:i.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()},P.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 o,i;if(g.responseType==="arraybuffer"?(o=p.response,i=o.byteLength):(o=p.responseText,i=o.length),f.loaded=f.total=i,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(f,g,o,p),!this.callbacks)return;var h={url:p.responseURL,data:o};this.callbacks.onSuccess(h,f,g,p)}else f.retry>=s.maxRetry||c>=400&&c<499?(z.logger.error(c+" while loading "+g.url),this.callbacks.onError({code:c,text:p.statusText},g,p)):(z.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)},P.loadtimeout=function(){z.logger.warn("timeout while loading "+this.context.url);var g=this.callbacks;g&&(this.abortInternal(),g.onTimeout(this.stats,this.context,this.loader))},P.loadprogress=function(g){var p=this.stats;p.loaded=g.loaded,g.lengthComputable&&(p.total=g.total)},P.getCacheAge=function(){var g=null;if(this.loader&&M.test(this.loader.getAllResponseHeaders())){var p=this.loader.getResponseHeader("age");g=p?parseFloat(p):null}return g},B}();V.default=W}}).default})},vHTk:function(tt,je,q){tt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wzkS:function(tt,je,q){"use strict";q.d(je,"c",function(){return U}),q.d(je,"b",function(){return M}),q.d(je,"d",function(){return W}),q.d(je,"a",function(){return P}),q.d(je,"e",function(){return A});var re=q("9og8"),V=q("WmNS"),D=q.n(V),z=q("ErOA");function U(g){return Object(z.c)("libraries/".concat(g,".json"))}function M(){return Object(z.c)("library_tags.json")}function W(g){return B.apply(this,arguments)}function B(){return B=Object(re.a)(D.a.mark(function g(p){var f;return D.a.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,Object(z.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)})),B.apply(this,arguments)}function P(g){return Object(z.f)("libraries.json",g)}function A(g,p){return Object(z.g)("libraries/".concat(g,".json"),p)}},y5JW:function(tt,je,q){"use strict";q.d(je,"c",function(){return c}),q.d(je,"a",function(){return o});var re=q("DZo9"),V=q("8z0m"),D=q("+L6B"),z=q("2/Rp"),U=q("9og8"),M=q("miYZ"),W=q("tsqr"),B=q("k1fw"),P=q("oBTY"),A=q("WmNS"),g=q.n(A),p=q("cDcd"),f=q.n(p),d=q("m3rI"),s=q("wzkS"),c="\u3000\u3000";function o(i){var u=["Bytes","KB","MB","GB","TB"];if(i==0)return"0 Byte";var h=parseInt(""+Math.floor(Math.log(i)/Math.log(1024)),10);return(i/Math.pow(1024,h)).toFixed(1)+" "+u[h]}je.b=function(i){var u=i.value,h=u===void 0?[]:u,R=i.action,S=i.onChange,E=i.className,O=i.maxSize,x=O===void 0?150:O,w=i.title,T=w===void 0?"\u6587\u4EF6\u4E0A\u4F20":w,_=i.accept,l=_===void 0?null:_,b={multiple:!1,fileList:h,accept:l,withCredentials:!0,beforeUpload:function(k){var I=k.size/1024/1024;return!0},action:"".concat(d.a.API_SERVER,"/api/attachments.json"),onChange:function(k){var I,N,F=Object(P.a)(k.fileList);if(F=F.map(function(j){return j.name.indexOf(c)===-1&&(j.name="".concat(j.name).concat(c).concat(o(j.size))),Object(B.a)({},j)}),k.file.status==="done"&&((I=k.file)===null||I===void 0||((N=I.response)===null||N===void 0)?void 0:N.status)===-1){var C,v;W.b.error((C=k.file)===null||C===void 0||((v=C.response)===null||v===void 0)?void 0:v.message),S([]);return}S(F)},onRemove:function(){var y=Object(U.a)(g.a.mark(function I(N){var F,C,v;return g.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:if(F=N.size/1024/1024,!(N.status==="uploading")){K.next=3;break}return K.abrupt("return",!0);case 3:if(F<x){K.next=7;break}return K.abrupt("return",!0);case 7:if(C=N.response?N.response.id:N.uid,!C){K.next=15;break}return K.next=11,Object(s.d)(N.response?N.response.id:N.id);case 11:return v=K.sent,K.abrupt("return",v);case 15:return K.abrupt("return",!0);case 16:case"end":return K.stop()}},I)}));function k(I){return y.apply(this,arguments)}return k}()};function m(y){y.preventDefault(),y.stopPropagation()}return f.a.createElement("div",{className:"single-upload ".concat(E||"")},f.a.createElement(V.a,b,f.a.createElement(z.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",x,"M)"," ")))}},yQHh:function(tt,je,q){}}]);
|