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.
143 lines
762 KiB
143 lines
762 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[47,5,6,7],{"+NIl":function(ot,Ge,Z){(function(re){re(Z("VrN/"))})(function(re){"use strict";re.defineMode("stex",function(G,L){"use strict";function z(_,x){_.cmdState.push(x)}function I(_){return _.cmdState.length>0?_.cmdState[_.cmdState.length-1]:null}function R(_){var x=_.cmdState.pop();x&&x.closeBracket()}function B(_){for(var x=_.cmdState,v=x.length-1;v>=0;v--){var d=x[v];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function U(_,x,v){return function(){this.name=_,this.bracketNo=0,this.style=x,this.styles=v,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var k={};k.importmodule=U("importmodule","tag",["string","builtin"]),k.documentclass=U("documentclass","tag",["","atom"]),k.usepackage=U("usepackage","tag",["atom"]),k.begin=U("begin","tag",["atom"]),k.end=U("end","tag",["atom"]),k.label=U("label","tag",["atom"]),k.ref=U("ref","tag",["atom"]),k.eqref=U("eqref","tag",["atom"]),k.cite=U("cite","tag",["atom"]),k.bibitem=U("bibitem","tag",["atom"]),k.Bibitem=U("Bibitem","tag",["atom"]),k.RBibitem=U("RBibitem","tag",["atom"]),k.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function A(_,x){_.f=x}function y(_,x){var v;if(_.match(/^\\[a-zA-Z@]+/)){var d=_.current().slice(1);return v=k.hasOwnProperty(d)?k[d]:k.DEFAULT,v=new v,z(x,v),A(x,O),v.style}if(_.match(/^\\[$&%#{}_]/))return"tag";if(_.match(/^\\[,;!\/\\]/))return"tag";if(_.match("\\["))return A(x,function(u,l){return S(u,l,"\\]")}),"keyword";if(_.match("\\("))return A(x,function(u,l){return S(u,l,"\\)")}),"keyword";if(_.match("$$"))return A(x,function(u,l){return S(u,l,"$$")}),"keyword";if(_.match("$"))return A(x,function(u,l){return S(u,l,"$")}),"keyword";var o=_.next();if(o=="%")return _.skipToEnd(),"comment";if(o=="}"||o=="]"){if(v=I(x),v)v.closeBracket(o),A(x,O);else return"error";return"bracket"}else return o=="{"||o=="["?(v=k.DEFAULT,v=new v,z(x,v),"bracket"):/\d/.test(o)?(_.eatWhile(/[\w.%]/),"atom"):(_.eatWhile(/[\w\-_]/),v=B(x),v.name=="begin"&&(v.argument=_.current()),v.styleIdentifier())}function S(_,x,v){if(_.eatSpace())return null;if(v&&_.match(v))return A(x,y),"keyword";if(_.match(/^\\[a-zA-Z@]+/))return"tag";if(_.match(/^[a-zA-Z]+/))return"variable-2";if(_.match(/^\\[$&%#{}_]/))return"tag";if(_.match(/^\\[,;!\/]/))return"tag";if(_.match(/^[\^_&]/))return"tag";if(_.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(_.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=_.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(_.skipToEnd(),"comment"):"error"}function O(_,x){var v=_.peek(),d;return v=="{"||v=="["?(d=I(x),d.openBracket(v),_.eat(v),A(x,y),"bracket"):/[ \t\r]/.test(v)?(_.eat(v),null):(A(x,y),R(x),y(_,x))}return{startState:function(){var _=L.inMathMode?function(x,v){return S(x,v)}:y;return{cmdState:[],f:_}},copyState:function(_){return{cmdState:_.cmdState.slice(),f:_.f}},token:function(_,x){return x.f(_,x)},blankLine:function(_){_.f=y,_.cmdState.length=0},lineComment:"%"}}),re.defineMIME("text/x-stex","stex"),re.defineMIME("text/x-latex","stex")})},"+ua5":function(ot,Ge,Z){},"19Vz":function(ot,Ge,Z){(function(re){re(Z("VrN/"))})(function(re){re.defineOption("placeholder","",function(U,k,A){var y=A&&A!=re.Init;if(k&&!y)U.on("blur",I),U.on("change",R),U.on("swapDoc",R),re.on(U.getInputField(),"compositionupdate",U.state.placeholderCompose=function(){z(U)}),R(U);else if(!k&&y){U.off("blur",I),U.off("change",R),U.off("swapDoc",R),re.off(U.getInputField(),"compositionupdate",U.state.placeholderCompose),G(U);var S=U.getWrapperElement();S.className=S.className.replace(" CodeMirror-empty","")}k&&!U.hasFocus()&&I(U)});function G(U){U.state.placeholder&&(U.state.placeholder.parentNode.removeChild(U.state.placeholder),U.state.placeholder=null)}function L(U){G(U);var k=U.state.placeholder=document.createElement("pre");k.style.cssText="height: 0; overflow: visible",k.style.direction=U.getOption("direction"),k.className="CodeMirror-placeholder CodeMirror-line-like";var A=U.getOption("placeholder");typeof A=="string"&&(A=document.createTextNode(A)),k.appendChild(A),U.display.lineSpace.insertBefore(k,U.display.lineSpace.firstChild)}function z(U){setTimeout(function(){var k=!1,A=U.getInputField();A.nodeName=="TEXTAREA"?k=!A.value:U.lineCount()==1&&(k=!/[^\u200b]/.test(A.querySelector(".CodeMirror-line").textContent)),k?L(U):G(U)},20)}function I(U){B(U)&&L(U)}function R(U){var k=U.getWrapperElement(),A=B(U);k.className=k.className.replace(" CodeMirror-empty","")+(A?" CodeMirror-empty":""),A?L(U):G(U)}function B(U){return U.lineCount()===1&&U.getLine(0)===""}})},"1eCo":function(ot,Ge,Z){(function(re){re(Z("VrN/"))})(function(re){"use strict";var G={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},L={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};re.defineMode("xml",function(z,I){var R=z.indentUnit,B={},U=I.htmlMode?G:L;for(var k in U)B[k]=U[k];for(var k in I)B[k]=I[k];var A,y;function S(a,g){function m(F){return g.tokenize=F,F(a,g)}var E=a.next();if(E=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?m(x("atom","]]>")):null:a.match("--")?m(x("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),m(v(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),g.tokenize=x("meta","?>"),"meta"):(A=a.eat("/")?"closeTag":"openTag",g.tokenize=O,"tag bracket");if(E=="&"){var M;return a.eat("#")?a.eat("x")?M=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):M=a.eatWhile(/[\d]/)&&a.eat(";"):M=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),M?"atom":"error"}else return a.eatWhile(/[^&<]/),null}S.isInText=!0;function O(a,g){var m=a.next();if(m==">"||m=="/"&&a.eat(">"))return g.tokenize=S,A=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return A="equals",null;if(m=="<"){g.tokenize=S,g.state=l,g.tagName=g.tagStart=null;var E=g.tokenize(a,g);return E?E+" tag error":"tag error"}else return/[\'\"]/.test(m)?(g.tokenize=_(m),g.stringStartCol=a.column(),g.tokenize(a,g)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function _(a){var g=function(m,E){for(;!m.eol();)if(m.next()==a){E.tokenize=O;break}return"string"};return g.isInAttribute=!0,g}function x(a,g){return function(m,E){for(;!m.eol();){if(m.match(g)){E.tokenize=S;break}m.next()}return a}}function v(a){return function(g,m){for(var E;(E=g.next())!=null;){if(E=="<")return m.tokenize=v(a+1),m.tokenize(g,m);if(E==">")if(a==1){m.tokenize=S;break}else return m.tokenize=v(a-1),m.tokenize(g,m)}return"meta"}}function d(a,g,m){this.prev=a.context,this.tagName=g,this.indent=a.indented,this.startOfLine=m,(B.doNotIndent.hasOwnProperty(g)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function u(a,g){for(var m;;){if(!a.context)return;if(m=a.context.tagName,!B.contextGrabbers.hasOwnProperty(m)||!B.contextGrabbers[m].hasOwnProperty(g))return;o(a)}}function l(a,g,m){return a=="openTag"?(m.tagStart=g.column(),w):a=="closeTag"?p:l}function w(a,g,m){return a=="word"?(m.tagName=g.current(),y="tag",b):B.allowMissingTagName&&a=="endTag"?(y="tag bracket",b(a,g,m)):(y="error",w)}function p(a,g,m){if(a=="word"){var E=g.current();return m.context&&m.context.tagName!=E&&B.implicitlyClosed.hasOwnProperty(m.context.tagName)&&o(m),m.context&&m.context.tagName==E||B.matchClosing===!1?(y="tag",f):(y="tag error",C)}else return B.allowMissingTagName&&a=="endTag"?(y="tag bracket",f(a,g,m)):(y="error",C)}function f(a,g,m){return a!="endTag"?(y="error",f):(o(m),l)}function C(a,g,m){return y="error",f(a,g,m)}function b(a,g,m){if(a=="word")return y="attribute",h;if(a=="endTag"||a=="selfcloseTag"){var E=m.tagName,M=m.tagStart;return m.tagName=m.tagStart=null,a=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(E)?u(m,E):(u(m,E),m.context=new d(m,E,M==m.indented)),l}return y="error",b}function h(a,g,m){return a=="equals"?c:(B.allowMissing||(y="error"),b(a,g,m))}function c(a,g,m){return a=="string"?s:a=="word"&&B.allowUnquoted?(y="string",b):(y="error",b(a,g,m))}function s(a,g,m){return a=="string"?s:b(a,g,m)}return{startState:function(a){var g={tokenize:S,state:l,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(g.baseIndent=a),g},token:function(a,g){if(!g.tagName&&a.sol()&&(g.indented=a.indentation()),a.eatSpace())return null;A=null;var m=g.tokenize(a,g);return(m||A)&&m!="comment"&&(y=null,g.state=g.state(A||m,a,g),y&&(m=y=="error"?m+" error":y)),m},indent:function(a,g,m){var E=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+R;if(E&&E.noIndent)return re.Pass;if(a.tokenize!=O&&a.tokenize!=S)return m?m.match(/^(\s*)/)[0].length:0;if(a.tagName)return B.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+R*(B.multilineTagIndentFactor||1);if(B.alignCDATA&&/<!\[CDATA\[/.test(g))return 0;var M=g&&/^<(\/)?([\w_:\.-]*)/.exec(g);if(M&&M[1])for(;E;)if(E.tagName==M[2]){E=E.prev;break}else if(B.implicitlyClosed.hasOwnProperty(E.tagName))E=E.prev;else break;else if(M)for(;E;){var F=B.contextGrabbers[E.tagName];if(F&&F.hasOwnProperty(M[2]))E=E.prev;else break}for(;E&&E.prev&&!E.startOfLine;)E=E.prev;return E?E.indent+R:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:B.htmlMode?"html":"xml",helperType:B.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=b)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var g=[],m=a.context;m;m=m.prev)m.tagName&&g.push(m.tagName);return g.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(ot,Ge,Z){"use strict";Z.d(Ge,"a",function(){return p});var re=Z("+L6B"),G=Z("2/Rp"),L=Z("2qtc"),z=Z("kLXV"),I=Z("9og8"),R=Z("k1fw"),B=Z("miYZ"),U=Z("tsqr"),k=Z("oBTY"),A=Z("tJVT"),y=Z("DZo9"),S=Z("8z0m"),O=Z("WmNS"),_=Z.n(O),x=Z("cDcd"),v=Z.n(x),d=Z("m3rI"),o=Z("wzkS"),u=Z("y5JW"),l=Z("LtfV"),w=S.a.Dragger;function p(f){var C=[];return f&&f.length>0&&(C=f.map(function(b){return{uid:b.id,id:b.id,name:b.title+u.c+b.filesize,url:b.url,filesize:b.filesize,status:"done",response:{id:b.id}}})),C}Ge.b=function(f){var C=f.value,b=f.onChange,h=f.action,c=f.className,s=f.maxSize,a=s===void 0?150:s,g=f.title,m=g===void 0?"\u4E0A\u4F20\u9644\u4EF6":g,E=f.showRemoveModal,M=E===void 0?!1:E,F=f.accept,j=F===void 0?"":F,W=f.additionalText,D=f.isDragger,P=f.number,H=P===void 0?1e3:P,Y=f.aloneClear,ee=Y===void 0?!1:Y,oe=Object(x.useState)(!1),Te=Object(A.a)(oe,2),ye=Te[0],he=Te[1],le=Object(x.useState)(C||[]),me=Object(A.a)(le,2),ie=me[0],pe=me[1];Object(x.useEffect)(function(){C&&(pe(Object(k.a)(C)),H===(C==null?void 0:C.length)&&he(!0))},[C]);var J=function(){setTimeout(function(){ie.pop(),pe(Object(k.a)(ie))},500)},ne={multiple:!0,disabled:ye,accept:j,withCredentials:!0,fileList:ie,beforeUpload:function(Ce,be){var ge=Ce.size/1024/1024;return ie.concat(be).length>H?(ie.pop(),pe(Object(k.a)(ie)),U.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(H,"\u4E2A\u6587\u4EF6")),ee?Promise.reject():(J(),!1)):!0},action:h||"".concat(d.a.API_SERVER,"/api/attachments.json"),onChange:function(Ce){var be,ge,Se=Object(k.a)(Ce.fileList);if(Ce.file.status==="done"&&((be=Ce.file)===null||be===void 0||((ge=be.response)===null||ge===void 0)?void 0:ge.status)===-1){var Le,Me;U.b.error((Le=Ce.file)===null||Le===void 0||((Me=Le.response)===null||Me===void 0)?void 0:Me.message);return}Se.length>=H?he(!0):he(!1),pe(Object(k.a)(Se)),Se=Se.map(function(_e){var Ae;if(_e!=null&&(Ae=_e.response)!==null&&Ae!==void 0&&Ae.id){var je;_e.url="/api/attachments/".concat(_e==null||((je=_e.response)===null||je===void 0)?void 0:je.id)}return _e.name.indexOf(u.c)===-1&&(_e.name="".concat(_e.name).concat(u.c).concat(Object(u.a)(_e.size))),Object(R.a)({},_e)}),console.log("info:",Ce),b(Se)},onRemove:function(){var xe=Object(I.a)(_.a.mark(function be(ge){var Se;return _.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:if(Se=function(){var _e=Object(I.a)(_.a.mark(function Ae(){var je,ze;return _.a.wrap(function(We){for(;;)switch(We.prev=We.next){case 0:if(je=ge.response?ge.response.id:ge.id,!je){We.next=8;break}return We.next=4,Object(o.d)(ge.response?ge.response.id:ge.uid);case 4:return ze=We.sent,We.abrupt("return",ze);case 8:return We.abrupt("return",!0);case 9:case"end":return We.stop()}},Ae)}));return function(){return _e.apply(this,arguments)}}(),!M){Me.next=5;break}return Me.abrupt("return",new Promise(function(_e,Ae){z.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:v.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var je=Object(I.a)(_.a.mark(function Ne(){var We;return _.a.wrap(function(Xe){for(;;)switch(Xe.prev=Xe.next){case 0:return Xe.next=2,Se();case 2:We=Xe.sent,U.b.success("\u5220\u9664\u6210\u529F"),_e(!0);case 5:case"end":return Xe.stop()}},Ne)}));function ze(){return je.apply(this,arguments)}return ze}(),onCancel:function(){return _e(!1)}})}));case 5:return Me.next=7,Se();case 7:return Me.abrupt("return",Me.sent);case 8:case"end":return Me.stop()}},be)}));function Ce(be){return xe.apply(this,arguments)}return Ce}()};function q(xe){xe.preventDefault(),xe.stopPropagation()}return v.a.createElement("div",{className:"multi-upload ".concat(c||"")},D&&v.a.createElement(w,ne,v.a.createElement("p",{className:"ant-upload-drag-icon"},v.a.createElement(l.a,null)),v.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",v.a.createElement("br",null),"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",a,"MB)"," "),W),!D&&v.a.createElement(S.a,ne,v.a.createElement(G.a,{disabled:ye},m),v.a.createElement("span",{onClick:q,style:{marginLeft:10,color:"#FA6400"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",a,"MB)"," ")))}},"55Ip":function(ot,Ge,Z){"use strict";Z.d(Ge,"a",function(){return u});var re=Z("Ty5D"),G=Z("dI71"),L=Z("cDcd"),z=Z.n(L),I=Z("YS25"),R=Z("17x9"),B=Z.n(R),U=Z("wx14"),k=Z("zLVn"),A=Z("9R94"),y=function(c){Object(G.a)(s,c);function s(){for(var g,m=arguments.length,E=new Array(m),M=0;M<m;M++)E[M]=arguments[M];return g=c.call.apply(c,[this].concat(E))||this,g.history=Object(I.a)(g.props),g}var a=s.prototype;return a.render=function(){return z.a.createElement(re.c,{history:this.history,children:this.props.children})},s}(z.a.Component),S=function(c){Object(G.a)(s,c);function s(){for(var g,m=arguments.length,E=new Array(m),M=0;M<m;M++)E[M]=arguments[M];return g=c.call.apply(c,[this].concat(E))||this,g.history=Object(I.b)(g.props),g}var a=s.prototype;return a.render=function(){return z.a.createElement(re.c,{history:this.history,children:this.props.children})},s}(z.a.Component),O=function(s,a){return typeof s=="function"?s(a):s},_=function(s,a){return typeof s=="string"?Object(I.c)(s,null,null,a):s},x=function(s){return s},v=z.a.forwardRef;typeof v=="undefined"&&(v=x);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=v(function(c,s){var a=c.innerRef,g=c.navigate,m=c.onClick,E=Object(k.a)(c,["innerRef","navigate","onClick"]),M=E.target,F=Object(U.a)({},E,{onClick:function(W){try{m&&m(W)}catch(D){throw W.preventDefault(),D}!W.defaultPrevented&&W.button===0&&(!M||M==="_self")&&!d(W)&&(W.preventDefault(),g())}});return x!==v?F.ref=s||a:F.ref=a,z.a.createElement("a",F)}),u=v(function(c,s){var a=c.component,g=a===void 0?o:a,m=c.replace,E=c.to,M=c.innerRef,F=Object(k.a)(c,["component","replace","to","innerRef"]);return z.a.createElement(re.e.Consumer,null,function(j){j||Object(A.a)(!1);var W=j.history,D=_(O(E,j.location),j.location),P=D?W.createHref(D):"",H=Object(U.a)({},F,{href:P,navigate:function(){var ee=O(E,j.location),oe=m?W.replace:W.push;oe(ee)}});return x!==v?H.ref=s||M:H.innerRef=M,z.a.createElement(g,H)})});if(!1)var l,w;var p=function(s){return s},f=z.a.forwardRef;typeof f=="undefined"&&(f=p);function C(){for(var c=arguments.length,s=new Array(c),a=0;a<c;a++)s[a]=arguments[a];return s.filter(function(g){return g}).join(" ")}var b=f(function(c,s){var a=c["aria-current"],g=a===void 0?"page":a,m=c.activeClassName,E=m===void 0?"active":m,M=c.activeStyle,F=c.className,j=c.exact,W=c.isActive,D=c.location,P=c.sensitive,H=c.strict,Y=c.style,ee=c.to,oe=c.innerRef,Te=Object(k.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return z.a.createElement(re.e.Consumer,null,function(ye){ye||Object(A.a)(!1);var he=D||ye.location,le=_(O(ee,he),he),me=le.pathname,ie=me&&me.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),pe=ie?Object(re.f)(he.pathname,{path:ie,exact:j,sensitive:P,strict:H}):null,J=!!(W?W(pe,he):pe),ne=J?C(F,E):F,q=J?Object(U.a)({},Y,{},M):Y,xe=Object(U.a)({"aria-current":J&&g||null,className:ne,style:q,to:le},Te);return p!==f?xe.ref=s||oe:xe.innerRef=oe,z.a.createElement(u,xe)})});if(!1)var h},"7Cbv":function(ot,Ge,Z){"use strict";var re=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),G=new Uint8Array(16);function L(){if(!re)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return re(G)}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 I(O){return typeof O=="string"&&z.test(O)}for(var R=I,B=[],U=0;U<256;++U)B.push((U+256).toString(16).substr(1));function k(O){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,x=(B[O[_+0]]+B[O[_+1]]+B[O[_+2]]+B[O[_+3]]+"-"+B[O[_+4]]+B[O[_+5]]+"-"+B[O[_+6]]+B[O[_+7]]+"-"+B[O[_+8]]+B[O[_+9]]+"-"+B[O[_+10]]+B[O[_+11]]+B[O[_+12]]+B[O[_+13]]+B[O[_+14]]+B[O[_+15]]).toLowerCase();if(!R(x))throw TypeError("Stringified UUID is invalid");return x}var A=k;function y(O,_,x){O=O||{};var v=O.random||(O.rng||L)();if(v[6]=v[6]&15|64,v[8]=v[8]&63|128,_){x=x||0;for(var d=0;d<16;++d)_[x+d]=v[d];return _}return A(v)}var S=Ge.a=y},"7ahc":function(ot,Ge,Z){"use strict";Z.d(Ge,"a",function(){return w});var re=Z("k1fw"),G=Z("0Owb"),L=Z("+L6B"),z=Z("2/Rp"),I=Z("y8nQ"),R=Z("Vl3Y"),B=Z("tJVT"),U=Z("OaEy"),k=Z("2fM7"),A=Z("cDcd"),y=Z.n(A),S=Z("VrN/"),O=Z.n(S),_=Z("p77/"),x=Z.n(_),v=Z("c5Ni"),d=Z.n(v),o=k.a.Option,u={labelCol:{span:4},wrapperCol:{span:20}},l={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"]};Ge.b=function(p){var f=p.callback,C=p.onCancel,b=Object(A.useState)("python"),h=Object(B.a)(b,2),c=h[0],s=h[1];function a(m){s(l[m][1])}function g(m){f(m)}return y.a.createElement(R.a,Object(G.a)({},u,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:g}),y.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},y.a.createElement(k.a,{onChange:a},Object.keys(l).map(function(m){return y.a.createElement(o,{key:m,value:m},l[m][0])}))),y.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},y.a.createElement(w,{mode:c})),y.a.createElement("div",{className:"flex-container flex-end"},y.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),y.a.createElement(z.a,{type:"ghost",onClick:C},"\u53D6\u6D88")))};function w(p){var f=p.value,C=p.onChange,b=p.mode,h=p.options,c=h===void 0?{}:h,s=Object(A.useRef)(),a=Object(A.useState)(),g=Object(B.a)(a,2),m=g[0],E=g[1];return Object(A.useEffect)(function(){if(m){function M(F){var j=F.getValue();C&&C(j)}return m.on("change",M),function(){m.off("change",M)}}},[m,C]),Object(A.useEffect)(function(){m&&m.setOption("mode",b)},[m,b]),Object(A.useEffect)(function(){m&&((f!==m.getValue()||f==="")&&setTimeout(function(){m.setValue(f||" ")},300))},[m,f]),Object(A.useEffect)(function(){if(s.current&&!m){var M=O.a.fromTextArea(s.current,Object(re.a)({mode:b,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));E(M)}},[s.current,m]),y.a.createElement("div",{className:"my-codemirror-container"},y.a.createElement("textarea",{ref:s}))}},"8EBN":function(ot,Ge,Z){(function(re){re(Z("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 G=0;G<re.modeInfo.length;G++){var L=re.modeInfo[G];L.mimes&&(L.mime=L.mimes[0])}re.findModeByMIME=function(z){z=z.toLowerCase();for(var I=0;I<re.modeInfo.length;I++){var R=re.modeInfo[I];if(R.mime==z)return R;if(R.mimes){for(var B=0;B<R.mimes.length;B++)if(R.mimes[B]==z)return R}}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 I=0;I<re.modeInfo.length;I++){var R=re.modeInfo[I];if(R.ext){for(var B=0;B<R.ext.length;B++)if(R.ext[B]==z)return R}}},re.findModeByFileName=function(z){for(var I=0;I<re.modeInfo.length;I++){var R=re.modeInfo[I];if(R.file&&R.file.test(z))return R}var B=z.lastIndexOf("."),U=B>-1&&z.substring(B+1,z.length);if(U)return re.findModeByExtension(U)},re.findModeByName=function(z){z=z.toLowerCase();for(var I=0;I<re.modeInfo.length;I++){var R=re.modeInfo[I];if(R.name.toLowerCase()==z)return R;if(R.alias){for(var B=0;B<R.alias.length;B++)if(R.alias[B].toLowerCase()==z)return R}}}})},"8hTe":function(ot,Ge,Z){ot.exports={button:"button___1wy9m"}},"9Bee":function(ot,Ge,Z){"use strict";var re=Z("DYRE"),G=Z("zeV3"),L=Z("+L6B"),z=Z("2/Rp"),I=Z("k1fw"),R=Z("tJVT"),B=Z("cDcd"),U=Z.n(B),k=Z("vg9a"),A=Z("DlQD"),y=Z.n(A),S=Z("rUJ1");function O(he,le){var me=he.match(/^(\s+)(?:```)/);if(me===null)return le;var ie=me[1];return le.split(`
|
|
`).map(function(pe){var J=pe.match(/^\s+/);if(J===null)return pe;var ne=Object(R.a)(J,1),q=ne[0];return q.length>=ie.length?pe.slice(ie.length):pe}).join(`
|
|
`)}var _=[],x=["<ul>"],v=new y.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function o(){_.length=0,x=["<ul>"]}var u={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function l(he,le,me,ie){if(le>=he.length||he[le].level<=me)return le;var pe=he[le];ie.push("<li><a href='#"+pe.anchor+"'>"+pe.text+"</a>"),le++;var J=[];return le=l(he,le,pe.level,J),J.length>0&&(ie.push("<ul>"),J.forEach(function(ne){ie.push(ne)}),ie.push("</ul>")),ie.push("</li>"),le=l(he,le,me,ie),le}function w(){return l(_,0,0,x),x.push("</ul>"),x.join("")}var p={heading:function(le){var me=d.exec(le);if(me)return{type:"heading",raw:me[0],depth:me[1].length,text:me[2]}},fences:function(le){var me=this.rules.block.fences.exec(le);if(me){var ie=me[0],pe=O(ie,me[3]||""),J=me[2]?me[2].trim():me[2];if(["latex","katex","math"].indexOf(J)>=0){var ne=b(),q=pe;pe=ne,h[ne]={type:"block",expression:q}}return{type:"code",raw:ie,lang:J,text:pe}}}},f=/(?:\${2})([^\n`]+?)(?:\${2})/gi,C=0,b=function(){return"__special_katext_id_".concat(C++,"__")},h={};function c(){return h}function s(){C=0,h={}}function a(he){return he=he.replace(f,function(le,me){var ie=b();return h[ie]={type:"inline",expression:me},ie}),he}var g=v.listitem;v.listitem=function(he){return g(a(he))};var m=v.paragraph;v.paragraph=function(he){return m(a(he))};var E=v.tablecell;v.tablecell=function(he,le){return E(a(he),le)},v.code=function(he,le,me){var ie=(le||"").match(/\S*/)[0];return ie?["latex","katex","math"].indexOf(ie)>=0?"<p class='editormd-tex'>".concat(he,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(le,'">').concat(me?he:Object(S.escape)(he,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(me?he:Object(S.escape)(he,!0))+"</code></pre>"},v.heading=function(he,le,me){var ie=this.options.headerPrefix+me.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return _.push({anchor:ie,level:le,text:he}),"<h"+le+' id="'+ie+'">'+he+"</h"+le+">"},y.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),y.a.use({tokenizer:p,renderer:v});var M=y.a,F=Z("SJMd"),j=Z("ulZh"),W=Z.n(j),D=Z("m3rI"),P=Z("Oy/b"),H=Z("p5ED"),Y=Z("8hTe"),ee=Z.n(Y),oe=/<pre[^>]*>/g;function Te(he){var le=document.createElement("div");return le.innerHTML=he,le.childNodes.length===0?"":le.childNodes[0].nodeValue}var ye=Ge.a=function(he){var le=he.value,me=le===void 0?"":le,ie=he.edit,pe=ie===void 0?!1:ie,J=he.className,ne=he.showTextOnly,q=he.showLines,xe=he.replaces,Ce=he.zoomImg,be=he.hasMask,ge=he.style,Se=ge===void 0?{}:ge,Le=he.stylesPrev,Me=Le===void 0?{}:Le,_e=String(me),Ae=Object(B.useRef)(),je=Object(B.useRef)(),ze=Object(B.useState)(""),Ne=Object(R.a)(ze,2),We=Ne[0],et=Ne[1],Xe=Object(B.useState)("office"),Ye=Object(R.a)(Xe,2),Oe=Ye[0],tt=Ye[1],$e=Object(B.useMemo)(function(){try{var ce=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,X=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Q=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;_e=_e.replace(ce,"("+D.a.API_SERVER+"/api/attachments/").replace(X,'"'+D.a.API_SERVER+"/api/attachments/").replace(Q,'"'+D.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(De){}var te=M(_e),se=c();if(_e.match(/\[TOC\]/)&&(te=te.replace("<p>[TOC]</p>",w()),o()),te=te.replace(/(__special_katext_id_\d+__)/g,function(De,Re){var Ie=se[Re],Ze=Ie.type,Ve=Ie.expression;return Object(P.renderToString)(Te(Ve)||"",{displayMode:Ze==="block",throwOnError:!1,output:"html"})}),te=te.replace(/▁/g,"\u2581\u2581\u2581"),s(),ne){var fe=document.createElement("div");return fe.innerHTML=te,fe.innerText}return setTimeout(function(){return ve()},500),te},[_e]),Pe=Object(B.useRef)();u.WebkitLineClamp=q,q&&(Se=Object(I.a)(Object(I.a)({},Se),u));function Fe(ce){var X=ce.target;if(X.tagName.toUpperCase()==="IMG"){if(Ce){var Q=X.getAttribute("src");et(Q),tt("image")}}else if(X.tagName.toUpperCase()==="A"){var te=X.getAttribute("href");if(te.indexOf("office")>-1)ce.preventDefault(),et(te),tt("office");else if(te.indexOf("application/pdf")>-1)ce.preventDefault(),et(te),tt("pdf");else if(te.indexOf("text/html")>-1)ce.preventDefault(),et(te),tt("html");else if(te.startsWith("#")){ce.preventDefault();var se=document.getElementById(te.replace("#",""));se&&se.scrollIntoView(!0)}}}var ve=function(){var X,Q=(X=Pe.current)===null||X===void 0?void 0:X.querySelectorAll("video");Q==null||Q.forEach(function(te){if(te.oncontextmenu=function(){return!1},te.src.indexOf(".m3u8")>-1&&!te.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var se=new W.a;se.loadSource(te.src),se.attachMedia(te)}}})};Object(B.useEffect)(function(){if(Pe.current&&$e&&($e.match(oe)&&window.PR.prettyPrint()),Pe.current)return Pe.current.addEventListener("click",Fe),function(){Pe.current.removeEventListener("click",Fe),s(),o()}},[$e,Pe.current,Fe]);var de=function(X){if(!pe)return;X.target.nodeName==="IMG"?(Ae.current.style.display="flex",Ae.current.style.width=X.target.clientWidth+"px",Ae.current.style.height=X.target.clientHeight+"px",Ae.current.style.top=X.target.offsetTop+"px",Ae.current.style.left=X.target.offsetLeft+"px",je.current.src=X.target.getAttribute("src")):Ae.current.style.display="none"};return U.a.createElement("div",{style:{position:"relative"}},U.a.createElement("div",{ref:Pe,style:Object(I.a)({},Se),className:"".concat(J||""," markdown-body ").concat(ee.a.mdBody),onMouseOver:de,dangerouslySetInnerHTML:{__html:$e}}),U.a.createElement("div",{ref:Ae,className:ee.a.button},U.a.createElement(G.a,null,U.a.createElement(z.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),U.a.createElement(z.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),U.a.createElement("img",{ref:je,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),U.a.createElement(H.a,{close:!0,data:We,type:We!=null&&We.length?Oe:"",style:Object(I.a)({},Me),onClose:function(){return et("")}}))}},"9VGf":function(ot,Ge,Z){"use strict";Z.d(Ge,"a",function(){return L});var re=Z("cDcd"),G=Z.n(re);function L(z,I){var R=Object(re.useRef)();Object(re.useEffect)(function(){R.current=z}),Object(re.useEffect)(function(){function B(){R.current()}if(I!==null){var U=setInterval(B,I);return function(){return clearInterval(U)}}},[I])}},BU3w:function(ot,Ge,Z){"use strict";Z.d(Ge,"a",function(){return R});var re=Z("MNnm"),G="rc-util-key";function L(B){if(B.attachTo)return B.attachTo;var U=document.querySelector("head");return U||document.body}function z(B){var U,k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(re.a)())return null;var A=document.createElement("style");if((U=k.csp)===null||U===void 0?void 0:U.nonce){var y;A.nonce=(y=k.csp)===null||y===void 0?void 0:y.nonce}A.innerHTML=B;var S=L(k),O=S.firstChild;return k.prepend&&S.prepend?S.prepend(A):k.prepend&&O?S.insertBefore(A,O):S.appendChild(A),A}var I=new Map;function R(B,U){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},A=L(k);if(!I.has(A)){var y=z("",k),S=y.parentNode;I.set(A,S),S.removeChild(y)}var O=Array.from(I.get(A).children).find(function(o){return o.tagName==="STYLE"&&o[G]===U});if(O){var _,x;if(((_=k.csp)===null||_===void 0?void 0:_.nonce)&&O.nonce!==((x=k.csp)===null||x===void 0?void 0:x.nonce)){var v;O.nonce=(v=k.csp)===null||v===void 0?void 0:v.nonce}return O.innerHTML!==B&&(O.innerHTML=B),O}var d=z(B,k);return d[G]=U,d}},Bd2K:function(ot,Ge,Z){(function(re){re(Z("VrN/"),Z("osHv"))})(function(re){re.defineOption("autoCloseTags",!1,function(k,A,y){if(y!=re.Init&&y&&k.removeKeyMap("autoCloseTags"),!A)return;var S={name:"autoCloseTags"};(typeof A!="object"||A.whenClosing!==!1)&&(S["'/'"]=function(O){return R(O)}),(typeof A!="object"||A.whenOpening!==!1)&&(S["'>'"]=function(O){return z(O)}),k.addKeyMap(S)});var G=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],L=["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(k){if(k.getOption("disableInput"))return re.Pass;for(var A=k.listSelections(),y=[],S=k.getOption("autoCloseTags"),O=0;O<A.length;O++){if(!A[O].empty())return re.Pass;var _=A[O].head,x=k.getTokenAt(_),v=re.innerMode(k.getMode(),x.state),d=v.state,o=v.mode.xmlCurrentTag&&v.mode.xmlCurrentTag(d),u=o&&o.name;if(!u)return re.Pass;var l=v.mode.configuration=="html",w=typeof S=="object"&&S.dontCloseTags||l&&G,p=typeof S=="object"&&S.indentTags||l&&L;x.end>_.ch&&(u=u.slice(0,u.length-x.end+_.ch));var f=u.toLowerCase();if(!u||x.type=="string"&&(x.end!=_.ch||!/[\"\']/.test(x.string.charAt(x.string.length-1))||x.string.length==1)||x.type=="tag"&&o.close||x.string.indexOf("/")==_.ch-x.start-1||w&&B(w,f)>-1||U(k,v.mode.xmlCurrentContext&&v.mode.xmlCurrentContext(d)||[],u,_,!0))return re.Pass;var C=typeof S=="object"&&S.emptyTags;if(C&&B(C,u)>-1){y[O]={text:"/>",newPos:re.Pos(_.line,_.ch+2)};continue}var b=p&&B(p,f)>-1;y[O]={indent:b,text:">"+(b?`
|
|
|
|
`:"")+"</"+u+">",newPos:b?re.Pos(_.line+1,0):re.Pos(_.line,_.ch+1)}}for(var h=typeof S=="object"&&S.dontIndentOnAutoClose,O=A.length-1;O>=0;O--){var c=y[O];k.replaceRange(c.text,A[O].head,A[O].anchor,"+insert");var s=k.listSelections().slice(0);s[O]={head:c.newPos,anchor:c.newPos},k.setSelections(s),!h&&c.indent&&(k.indentLine(c.newPos.line,null,!0),k.indentLine(c.newPos.line+1,null,!0))}}function I(k,A){for(var y=k.listSelections(),S=[],O=A?"/":"</",_=k.getOption("autoCloseTags"),x=typeof _=="object"&&_.dontIndentOnSlash,v=0;v<y.length;v++){if(!y[v].empty())return re.Pass;var d=y[v].head,o=k.getTokenAt(d),u=re.innerMode(k.getMode(),o.state),l=u.state;if(A&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=d.ch-1))return re.Pass;var w,p=u.mode.name!="xml"&&k.getMode().name=="htmlmixed";if(p&&u.mode.name=="javascript")w=O+"script";else if(p&&u.mode.name=="css")w=O+"style";else{var f=u.mode.xmlCurrentContext&&u.mode.xmlCurrentContext(l);if(!f||f.length&&U(k,f,f[f.length-1],d))return re.Pass;w=O+f[f.length-1]}k.getLine(d.line).charAt(o.end)!=">"&&(w+=">"),S[v]=w}if(k.replaceSelections(S),y=k.listSelections(),!x)for(var v=0;v<y.length;v++)(v==y.length-1||y[v].head.line<y[v+1].head.line)&&k.indentLine(y[v].head.line)}function R(k){return k.getOption("disableInput")?re.Pass:I(k,!0)}re.commands.closeTag=function(k){return I(k)};function B(k,A){if(k.indexOf)return k.indexOf(A);for(var y=0,S=k.length;y<S;++y)if(k[y]==A)return y;return-1}function U(k,A,y,S,O){if(!re.scanForClosingTag)return!1;var _=Math.min(k.lastLine()+1,S.line+500),x=re.scanForClosingTag(k,S,null,_);if(!x||x.tag!=y)return!1;for(var v=O?1:0,d=A.length-1;d>=0&&A[d]==y;d--)++v;S=x.to;for(var d=1;d<v;d++){var o=re.scanForClosingTag(k,S,null,_);if(!o||o.tag!=y)return!1;S=o.to}return!0}})},BjJ7:function(ot,Ge,Z){"use strict";Z.d(Ge,"d",function(){return G}),Z.d(Ge,"c",function(){return L}),Z.d(Ge,"e",function(){return z}),Z.d(Ge,"b",function(){return I}),Z.d(Ge,"a",function(){return B});var re=Z("m3rI");function G(U){var k=!0;if(U.length>0){for(var A=0;A<U.length;A++)if(U[A].compile_success==0||!U[A].compile_success){k=!1;break}}else k=!1;return k}function L(U){for(var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",A=[],y=0;y<U.length;y++){var S=U[y],O=k?"".concat(k,"/").concat(S.name):"".concat(S.name);A.push({title:S.name,isLeaf:!(S.type==="tree"),key:O})}return A}function z(U,k,A){for(var y=0;y<U.length;y++){var S=U[y];if(S.key===k){S.children=A;break}S.children&&z(S.children,k,A)}return U}function I(U,k,A){var y;return function(){var S=this,O=arguments,_=function(){y=null,A||U.apply(S,O)},x=A&&!y;clearTimeout(y),y=setTimeout(_,k),x&&U.apply(S,O)}}var R=!0,B=re.a.API_SERVER},"C+DQ":function(ot,Ge,Z){},DlQD:function(ot,Ge,Z){(function(re,G){ot.exports=G()})(this,function(){"use strict";function re(ve,de){for(var ce=0;ce<de.length;ce++){var X=de[ce];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(ve,X.key,X)}}function G(ve,de,ce){return de&&re(ve.prototype,de),ce&&re(ve,ce),ve}function L(ve,de){if(!ve)return;if(typeof ve=="string")return z(ve,de);var ce=Object.prototype.toString.call(ve).slice(8,-1);if(ce==="Object"&&ve.constructor&&(ce=ve.constructor.name),ce==="Map"||ce==="Set")return Array.from(ve);if(ce==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ce))return z(ve,de)}function z(ve,de){(de==null||de>ve.length)&&(de=ve.length);for(var ce=0,X=new Array(de);ce<de;ce++)X[ce]=ve[ce];return X}function I(ve,de){var ce;if(typeof Symbol=="undefined"||ve[Symbol.iterator]==null){if(Array.isArray(ve)||(ce=L(ve))||de&&ve&&typeof ve.length=="number"){ce&&(ve=ce);var X=0;return function(){return X>=ve.length?{done:!0}:{done:!1,value:ve[X++]}}}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 ce=ve[Symbol.iterator](),ce.next.bind(ce)}function R(ve,de){return de={exports:{}},ve(de,de.exports),de.exports}var B=R(function(ve){function de(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function ce(X){ve.exports.defaults=X}ve.exports={defaults:de(),getDefaults:de,changeDefaults:ce}}),U=B.defaults,k=B.getDefaults,A=B.changeDefaults,y=/[&<>"']/,S=/[&<>"']/g,O=/[<>"']|&(?!#?\w+;)/,_=/[<>"']|&(?!#?\w+;)/g,x={"&":"&","<":"<",">":">",'"':""","'":"'"},v=function(de){return x[de]};function d(ve,de){if(de){if(y.test(ve))return ve.replace(S,v)}else if(O.test(ve))return ve.replace(_,v);return ve}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function u(ve){return ve.replace(o,function(de,ce){return ce=ce.toLowerCase(),ce==="colon"?":":ce.charAt(0)==="#"?ce.charAt(1)==="x"?String.fromCharCode(parseInt(ce.substring(2),16)):String.fromCharCode(+ce.substring(1)):""})}var l=/(^|[^\[])\^/g;function w(ve,de){ve=ve.source||ve,de=de||"";var ce={replace:function(Q,te){return te=te.source||te,te=te.replace(l,"$1"),ve=ve.replace(Q,te),ce},getRegex:function(){return new RegExp(ve,de)}};return ce}var p=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function C(ve,de,ce){if(ve){var X;try{X=decodeURIComponent(u(ce)).replace(p,"").toLowerCase()}catch(Q){return null}if(X.indexOf("javascript:")===0||X.indexOf("vbscript:")===0||X.indexOf("data:")===0)return null}de&&!f.test(ce)&&(ce=a(de,ce));try{ce=encodeURI(ce).replace(/%25/g,"%")}catch(Q){return null}return ce}var b={},h=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ve,de){b[" "+ve]||(h.test(ve)?b[" "+ve]=ve+"/":b[" "+ve]=M(ve,"/",!0)),ve=b[" "+ve];var ce=ve.indexOf(":")===-1;return de.substring(0,2)==="//"?ce?de:ve.replace(c,"$1")+de:de.charAt(0)==="/"?ce?de:ve.replace(s,"$1")+de:ve+de}var g={exec:function(){}};function m(ve){for(var de=1,ce,X;de<arguments.length;de++){ce=arguments[de];for(X in ce)Object.prototype.hasOwnProperty.call(ce,X)&&(ve[X]=ce[X])}return ve}function E(ve,de){var ce=ve.replace(/\|/g,function(te,se,fe){for(var De=!1,Re=se;--Re>=0&&fe[Re]==="\\";)De=!De;return De?"|":" |"}),X=ce.split(/ \|/),Q=0;if(X.length>de)X.splice(de);else for(;X.length<de;)X.push("");for(;Q<X.length;Q++)X[Q]=X[Q].trim().replace(/\\\|/g,"|");return X}function M(ve,de,ce){var X=ve.length;if(X===0)return"";for(var Q=0;Q<X;){var te=ve.charAt(X-Q-1);if(te===de&&!ce)Q++;else if(te!==de&&ce)Q++;else break}return ve.substr(0,X-Q)}function F(ve,de){if(ve.indexOf(de[1])===-1)return-1;for(var ce=ve.length,X=0,Q=0;Q<ce;Q++)if(ve[Q]==="\\")Q++;else if(ve[Q]===de[0])X++;else if(ve[Q]===de[1]&&(X--,X<0))return Q;return-1}function j(ve){ve&&ve.sanitize&&!ve.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var W={escape:d,unescape:u,edit:w,cleanUrl:C,resolveUrl:a,noopTest:g,merge:m,splitCells:E,rtrim:M,findClosingBracket:F,checkSanitizeDeprecation:j},D=B.defaults,P=W.rtrim,H=W.splitCells,Y=W.escape,ee=W.findClosingBracket;function oe(ve,de,ce){var X=de.href,Q=de.title?Y(de.title):null,te=ve[1].replace(/\\([\[\]])/g,"$1");return ve[0].charAt(0)!=="!"?{type:"link",raw:ce,href:X,title:Q,text:te}:{type:"image",raw:ce,href:X,title:Q,text:Y(te)}}function Te(ve,de){var ce=ve.match(/^(\s+)(?:```)/);if(ce===null)return de;var X=ce[1];return de.split(`
|
|
`).map(function(Q){var te=Q.match(/^\s+/);if(te===null)return Q;var se=te[0];return se.length>=X.length?Q.slice(X.length):Q}).join(`
|
|
`)}var ye=function(){function ve(ce){this.options=ce||D}var de=ve.prototype;return de.space=function(X){var Q=this.rules.block.newline.exec(X);if(Q)return Q[0].length>1?{type:"space",raw:Q[0]}:{raw:`
|
|
`}},de.code=function(X,Q){var te=this.rules.block.code.exec(X);if(te){var se=Q[Q.length-1];if(se&&se.type==="paragraph")return{raw:te[0],text:te[0].trimRight()};var fe=te[0].replace(/^ {4}/gm,"");return{type:"code",raw:te[0],codeBlockStyle:"indented",text:this.options.pedantic?fe:P(fe,`
|
|
`)}}},de.fences=function(X){var Q=this.rules.block.fences.exec(X);if(Q){var te=Q[0],se=Te(te,Q[3]||"");return{type:"code",raw:te,lang:Q[2]?Q[2].trim():Q[2],text:se}}},de.heading=function(X){var Q=this.rules.block.heading.exec(X);if(Q)return{type:"heading",raw:Q[0],depth:Q[1].length,text:Q[2]}},de.nptable=function(X){var Q=this.rules.block.nptable.exec(X);if(Q){var te={type:"table",header:H(Q[1].replace(/^ *| *\| *$/g,"")),align:Q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Q[3]?Q[3].replace(/\n$/,"").split(`
|
|
`):[],raw:Q[0]};if(te.header.length===te.align.length){var se=te.align.length,fe;for(fe=0;fe<se;fe++)/^ *-+: *$/.test(te.align[fe])?te.align[fe]="right":/^ *:-+: *$/.test(te.align[fe])?te.align[fe]="center":/^ *:-+ *$/.test(te.align[fe])?te.align[fe]="left":te.align[fe]=null;for(se=te.cells.length,fe=0;fe<se;fe++)te.cells[fe]=H(te.cells[fe],te.header.length);return te}}},de.hr=function(X){var Q=this.rules.block.hr.exec(X);if(Q)return{type:"hr",raw:Q[0]}},de.blockquote=function(X){var Q=this.rules.block.blockquote.exec(X);if(Q){var te=Q[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Q[0],text:te}}},de.list=function(X){var Q=this.rules.block.list.exec(X);if(Q){for(var te=Q[0],se=Q[2],fe=se.length>1,De=se[se.length-1]===")",Re={type:"list",raw:te,ordered:fe,start:fe?+se.slice(0,-1):"",loose:!1,items:[]},Ie=Q[0].match(this.rules.block.item),Ze=!1,Ve,mt,dt,st,_t,bt,Bt,Ut=Ie.length,Et=0;Et<Ut;Et++)Ve=Ie[Et],te=Ve,mt=Ve.length,Ve=Ve.replace(/^ *([*+-]|\d+[.)]) */,""),~Ve.indexOf(`
|
|
`)&&(mt-=Ve.length,Ve=this.options.pedantic?Ve.replace(/^ {1,4}/gm,""):Ve.replace(new RegExp("^ {1,"+mt+"}","gm"),"")),Et!==Ut-1&&(dt=this.rules.block.bullet.exec(Ie[Et+1])[0],(fe?dt.length===1||!De&&dt[dt.length-1]===")":dt.length>1||this.options.smartLists&&dt!==se)&&(st=Ie.slice(Et+1).join(`
|
|
`),Re.raw=Re.raw.substring(0,Re.raw.length-st.length),Et=Ut-1)),_t=Ze||/\n\n(?!\s*$)/.test(Ve),Et!==Ut-1&&(Ze=Ve.charAt(Ve.length-1)===`
|
|
`,_t||(_t=Ze)),_t&&(Re.loose=!0),bt=/^\[[ xX]\] /.test(Ve),Bt=void 0,bt&&(Bt=Ve[1]!==" ",Ve=Ve.replace(/^\[[ xX]\] +/,"")),Re.items.push({type:"list_item",raw:te,task:bt,checked:Bt,loose:_t,text:Ve});return Re}},de.html=function(X){var Q=this.rules.block.html.exec(X);if(Q)return{type:this.options.sanitize?"paragraph":"html",raw:Q[0],pre:!this.options.sanitizer&&(Q[1]==="pre"||Q[1]==="script"||Q[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Q[0]):Y(Q[0]):Q[0]}},de.def=function(X){var Q=this.rules.block.def.exec(X);if(Q){Q[3]&&(Q[3]=Q[3].substring(1,Q[3].length-1));var te=Q[1].toLowerCase().replace(/\s+/g," ");return{tag:te,raw:Q[0],href:Q[2],title:Q[3]}}},de.table=function(X){var Q=this.rules.block.table.exec(X);if(Q){var te={type:"table",header:H(Q[1].replace(/^ *| *\| *$/g,"")),align:Q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Q[3]?Q[3].replace(/\n$/,"").split(`
|
|
`):[]};if(te.header.length===te.align.length){te.raw=Q[0];var se=te.align.length,fe;for(fe=0;fe<se;fe++)/^ *-+: *$/.test(te.align[fe])?te.align[fe]="right":/^ *:-+: *$/.test(te.align[fe])?te.align[fe]="center":/^ *:-+ *$/.test(te.align[fe])?te.align[fe]="left":te.align[fe]=null;for(se=te.cells.length,fe=0;fe<se;fe++)te.cells[fe]=H(te.cells[fe].replace(/^ *\| *| *\| *$/g,""),te.header.length);return te}}},de.lheading=function(X){var Q=this.rules.block.lheading.exec(X);if(Q)return{type:"heading",raw:Q[0],depth:Q[2].charAt(0)==="="?1:2,text:Q[1]}},de.paragraph=function(X){var Q=this.rules.block.paragraph.exec(X);if(Q)return{type:"paragraph",raw:Q[0],text:Q[1].charAt(Q[1].length-1)===`
|
|
`?Q[1].slice(0,-1):Q[1]}},de.text=function(X,Q){var te=this.rules.block.text.exec(X);if(te){var se=Q[Q.length-1];return se&&se.type==="text"?{raw:te[0],text:te[0]}:{type:"text",raw:te[0],text:te[0]}}},de.escape=function(X){var Q=this.rules.inline.escape.exec(X);if(Q)return{type:"escape",raw:Q[0],text:Y(Q[1])}},de.tag=function(X,Q,te){var se=this.rules.inline.tag.exec(X);if(se)return!Q&&/^<a /i.test(se[0])?Q=!0:Q&&/^<\/a>/i.test(se[0])&&(Q=!1),!te&&/^<(pre|code|kbd|script)(\s|>)/i.test(se[0])?te=!0:te&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(se[0])&&(te=!1),{type:this.options.sanitize?"text":"html",raw:se[0],inLink:Q,inRawBlock:te,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):Y(se[0]):se[0]}},de.link=function(X){var Q=this.rules.inline.link.exec(X);if(Q){var te=ee(Q[2],"()");if(te>-1){var se=Q[0].indexOf("!")===0?5:4,fe=se+Q[1].length+te;Q[2]=Q[2].substring(0,te),Q[0]=Q[0].substring(0,fe).trim(),Q[3]=""}var De=Q[2],Re="";if(this.options.pedantic){var Ie=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(De);Ie?(De=Ie[1],Re=Ie[3]):Re=""}else Re=Q[3]?Q[3].slice(1,-1):"";De=De.trim().replace(/^<([\s\S]*)>$/,"$1");var Ze=oe(Q,{href:De&&De.replace(this.rules.inline._escapes,"$1"),title:Re&&Re.replace(this.rules.inline._escapes,"$1")},Q[0]);return Ze}},de.reflink=function(X,Q){var te;if((te=this.rules.inline.reflink.exec(X))||(te=this.rules.inline.nolink.exec(X))){var se=(te[2]||te[1]).replace(/\s+/g," ");if(se=Q[se.toLowerCase()],!se||!se.href){var fe=te[0].charAt(0);return{type:"text",raw:fe,text:fe}}var De=oe(te,se,te[0]);return De}},de.strong=function(X,Q,te){te===void 0&&(te="");var se=this.rules.inline.strong.start.exec(X);if(se&&(!se[1]||se[1]&&(te===""||this.rules.inline.punctuation.exec(te)))){Q=Q.slice(-1*X.length);var fe=se[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;fe.lastIndex=0;for(var De;(se=fe.exec(Q))!=null;)if(De=this.rules.inline.strong.middle.exec(Q.slice(0,se.index+3)),De)return{type:"strong",raw:X.slice(0,De[0].length),text:X.slice(2,De[0].length-2)}}},de.em=function(X,Q,te){te===void 0&&(te="");var se=this.rules.inline.em.start.exec(X);if(se&&(!se[1]||se[1]&&(te===""||this.rules.inline.punctuation.exec(te)))){Q=Q.slice(-1*X.length);var fe=se[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;fe.lastIndex=0;for(var De;(se=fe.exec(Q))!=null;)if(De=this.rules.inline.em.middle.exec(Q.slice(0,se.index+2)),De)return{type:"em",raw:X.slice(0,De[0].length),text:X.slice(1,De[0].length-1)}}},de.codespan=function(X){var Q=this.rules.inline.code.exec(X);if(Q){var te=Q[2].replace(/\n/g," "),se=/[^ ]/.test(te),fe=te.startsWith(" ")&&te.endsWith(" ");return se&&fe&&(te=te.substring(1,te.length-1)),te=Y(te,!0),{type:"codespan",raw:Q[0],text:te}}},de.br=function(X){var Q=this.rules.inline.br.exec(X);if(Q)return{type:"br",raw:Q[0]}},de.del=function(X){var Q=this.rules.inline.del.exec(X);if(Q)return{type:"del",raw:Q[0],text:Q[1]}},de.autolink=function(X,Q){var te=this.rules.inline.autolink.exec(X);if(te){var se,fe;return te[2]==="@"?(se=Y(this.options.mangle?Q(te[1]):te[1]),fe="mailto:"+se):(se=Y(te[1]),fe=se),{type:"link",raw:te[0],text:se,href:fe,tokens:[{type:"text",raw:se,text:se}]}}},de.url=function(X,Q){var te;if(te=this.rules.inline.url.exec(X)){var se,fe;if(te[2]==="@")se=Y(this.options.mangle?Q(te[0]):te[0]),fe="mailto:"+se;else{var De;do De=te[0],te[0]=this.rules.inline._backpedal.exec(te[0])[0];while(De!==te[0]);se=Y(te[0]),te[1]==="www."?fe="http://"+se:fe=se}return{type:"link",raw:te[0],text:se,href:fe,tokens:[{type:"text",raw:se,text:se}]}}},de.inlineText=function(X,Q,te){var se=this.rules.inline.text.exec(X);if(se){var fe;return Q?fe=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):Y(se[0]):se[0]:fe=Y(this.options.smartypants?te(se[0]):se[0]),{type:"text",raw:se[0],text:fe}}},ve}(),he=W.noopTest,le=W.edit,me=W.merge,ie={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:he,table:he,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ie._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ie._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ie.def=le(ie.def).replace("label",ie._label).replace("title",ie._title).getRegex(),ie.bullet=/(?:[*+-]|\d{1,9}[.)])/,ie.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ie.item=le(ie.item,"gm").replace(/bull/g,ie.bullet).getRegex(),ie.list=le(ie.list).replace(/bull/g,ie.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ie.def.source+")").getRegex(),ie._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",ie._comment=/<!--(?!-?>)[\s\S]*?-->/,ie.html=le(ie.html,"i").replace("comment",ie._comment).replace("tag",ie._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ie.paragraph=le(ie._paragraph).replace("hr",ie.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",ie._tag).getRegex(),ie.blockquote=le(ie.blockquote).replace("paragraph",ie.paragraph).getRegex(),ie.normal=me({},ie),ie.gfm=me({},ie.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*|$)"}),ie.gfm.nptable=le(ie.gfm.nptable).replace("hr",ie.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",ie._tag).getRegex(),ie.gfm.table=le(ie.gfm.table).replace("hr",ie.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",ie._tag).getRegex(),ie.pedantic=me({},ie.normal,{html:le(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ie._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:he,paragraph:le(ie.normal._paragraph).replace("hr",ie.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ie.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var pe={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:he,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:he,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};pe._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",pe.punctuation=le(pe.punctuation).replace(/punctuation/g,pe._punctuation).getRegex(),pe._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",pe._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",pe.em.start=le(pe.em.start).replace(/punctuation/g,pe._punctuation).getRegex(),pe.em.middle=le(pe.em.middle).replace(/punctuation/g,pe._punctuation).replace(/overlapSkip/g,pe._overlapSkip).getRegex(),pe.em.endAst=le(pe.em.endAst,"g").replace(/punctuation/g,pe._punctuation).getRegex(),pe.em.endUnd=le(pe.em.endUnd,"g").replace(/punctuation/g,pe._punctuation).getRegex(),pe.strong.start=le(pe.strong.start).replace(/punctuation/g,pe._punctuation).getRegex(),pe.strong.middle=le(pe.strong.middle).replace(/punctuation/g,pe._punctuation).replace(/blockSkip/g,pe._blockSkip).getRegex(),pe.strong.endAst=le(pe.strong.endAst,"g").replace(/punctuation/g,pe._punctuation).getRegex(),pe.strong.endUnd=le(pe.strong.endUnd,"g").replace(/punctuation/g,pe._punctuation).getRegex(),pe.blockSkip=le(pe._blockSkip,"g").getRegex(),pe.overlapSkip=le(pe._overlapSkip,"g").getRegex(),pe._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,pe._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,pe._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])?)+(?![-_])/,pe.autolink=le(pe.autolink).replace("scheme",pe._scheme).replace("email",pe._email).getRegex(),pe._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,pe.tag=le(pe.tag).replace("comment",ie._comment).replace("attribute",pe._attribute).getRegex(),pe._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,pe._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,pe._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,pe.link=le(pe.link).replace("label",pe._label).replace("href",pe._href).replace("title",pe._title).getRegex(),pe.reflink=le(pe.reflink).replace("label",pe._label).getRegex(),pe.reflinkSearch=le(pe.reflinkSearch,"g").replace("reflink",pe.reflink).replace("nolink",pe.nolink).getRegex(),pe.normal=me({},pe),pe.pedantic=me({},pe.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:le(/^!?\[(label)\]\((.*?)\)/).replace("label",pe._label).getRegex(),reflink:le(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",pe._label).getRegex()}),pe.gfm=me({},pe.normal,{escape:le(pe.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),pe.gfm.url=le(pe.gfm.url,"i").replace("email",pe.gfm._extended_email).getRegex(),pe.breaks=me({},pe.gfm,{br:le(pe.br).replace("{2,}","*").getRegex(),text:le(pe.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var J={block:ie,inline:pe},ne=B.defaults,q=J.block,xe=J.inline;function Ce(ve){return ve.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function be(ve){var de="",ce,X,Q=ve.length;for(ce=0;ce<Q;ce++)X=ve.charCodeAt(ce),Math.random()>.5&&(X="x"+X.toString(16)),de+="&#"+X+";";return de}var ge=function(){function ve(ce){this.tokens=[],this.tokens.links=Object.create(null),this.options=ce||ne,this.options.tokenizer=this.options.tokenizer||new ye,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var X={block:q.normal,inline:xe.normal};this.options.pedantic?(X.block=q.pedantic,X.inline=xe.pedantic):this.options.gfm&&(X.block=q.gfm,this.options.breaks?X.inline=xe.breaks:X.inline=xe.gfm),this.tokenizer.rules=X}ve.lex=function(X,Q){var te=new ve(Q);return te.lex(X)};var de=ve.prototype;return de.lex=function(X){return X=X.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(X,this.tokens,!0),this.inline(this.tokens),this.tokens},de.blockTokens=function(X,Q,te){Q===void 0&&(Q=[]),te===void 0&&(te=!0),X=X.replace(/^ +$/gm,"");for(var se,fe,De,Re;X;){if(se=this.tokenizer.space(X)){X=X.substring(se.raw.length),se.type&&Q.push(se);continue}if(se=this.tokenizer.code(X,Q)){X=X.substring(se.raw.length),se.type?Q.push(se):(Re=Q[Q.length-1],Re.raw+=`
|
|
`+se.raw,Re.text+=`
|
|
`+se.text);continue}if(se=this.tokenizer.fences(X)){X=X.substring(se.raw.length),Q.push(se);continue}if(se=this.tokenizer.heading(X)){X=X.substring(se.raw.length),Q.push(se);continue}if(se=this.tokenizer.nptable(X)){X=X.substring(se.raw.length),Q.push(se);continue}if(se=this.tokenizer.hr(X)){X=X.substring(se.raw.length),Q.push(se);continue}if(se=this.tokenizer.blockquote(X)){X=X.substring(se.raw.length),se.tokens=this.blockTokens(se.text,[],te),Q.push(se);continue}if(se=this.tokenizer.list(X)){for(X=X.substring(se.raw.length),De=se.items.length,fe=0;fe<De;fe++)se.items[fe].tokens=this.blockTokens(se.items[fe].text,[],!1);Q.push(se);continue}if(se=this.tokenizer.html(X)){X=X.substring(se.raw.length),Q.push(se);continue}if(te&&(se=this.tokenizer.def(X))){X=X.substring(se.raw.length),this.tokens.links[se.tag]||(this.tokens.links[se.tag]={href:se.href,title:se.title});continue}if(se=this.tokenizer.table(X)){X=X.substring(se.raw.length),Q.push(se);continue}if(se=this.tokenizer.lheading(X)){X=X.substring(se.raw.length),Q.push(se);continue}if(te&&(se=this.tokenizer.paragraph(X))){X=X.substring(se.raw.length),Q.push(se);continue}if(se=this.tokenizer.text(X,Q)){X=X.substring(se.raw.length),se.type?Q.push(se):(Re=Q[Q.length-1],Re.raw+=`
|
|
`+se.raw,Re.text+=`
|
|
`+se.text);continue}if(X){var Ie="Infinite loop on byte: "+X.charCodeAt(0);if(this.options.silent){console.error(Ie);break}else throw new Error(Ie)}}return Q},de.inline=function(X){var Q,te,se,fe,De,Re,Ie=X.length;for(Q=0;Q<Ie;Q++){Re=X[Q];switch(Re.type){case"paragraph":case"text":case"heading":{Re.tokens=[],this.inlineTokens(Re.text,Re.tokens);break}case"table":{for(Re.tokens={header:[],cells:[]},fe=Re.header.length,te=0;te<fe;te++)Re.tokens.header[te]=[],this.inlineTokens(Re.header[te],Re.tokens.header[te]);for(fe=Re.cells.length,te=0;te<fe;te++)for(De=Re.cells[te],Re.tokens.cells[te]=[],se=0;se<De.length;se++)Re.tokens.cells[te][se]=[],this.inlineTokens(De[se],Re.tokens.cells[te][se]);break}case"blockquote":{this.inline(Re.tokens);break}case"list":{for(fe=Re.items.length,te=0;te<fe;te++)this.inline(Re.items[te].tokens);break}}}return X},de.inlineTokens=function(X,Q,te,se,fe){Q===void 0&&(Q=[]),te===void 0&&(te=!1),se===void 0&&(se=!1),fe===void 0&&(fe="");var De,Re=X,Ie;if(this.tokens.links){var Ze=Object.keys(this.tokens.links);if(Ze.length>0)for(;(Ie=this.tokenizer.rules.inline.reflinkSearch.exec(Re))!=null;)Ze.includes(Ie[0].slice(Ie[0].lastIndexOf("[")+1,-1))&&(Re=Re.slice(0,Ie.index)+"["+"a".repeat(Ie[0].length-2)+"]"+Re.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ie=this.tokenizer.rules.inline.blockSkip.exec(Re))!=null;)Re=Re.slice(0,Ie.index)+"["+"a".repeat(Ie[0].length-2)+"]"+Re.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;X;){if(De=this.tokenizer.escape(X)){X=X.substring(De.raw.length),Q.push(De);continue}if(De=this.tokenizer.tag(X,te,se)){X=X.substring(De.raw.length),te=De.inLink,se=De.inRawBlock,Q.push(De);continue}if(De=this.tokenizer.link(X)){X=X.substring(De.raw.length),De.type==="link"&&(De.tokens=this.inlineTokens(De.text,[],!0,se)),Q.push(De);continue}if(De=this.tokenizer.reflink(X,this.tokens.links)){X=X.substring(De.raw.length),De.type==="link"&&(De.tokens=this.inlineTokens(De.text,[],!0,se)),Q.push(De);continue}if(De=this.tokenizer.strong(X,Re,fe)){X=X.substring(De.raw.length),De.tokens=this.inlineTokens(De.text,[],te,se),Q.push(De);continue}if(De=this.tokenizer.em(X,Re,fe)){X=X.substring(De.raw.length),De.tokens=this.inlineTokens(De.text,[],te,se),Q.push(De);continue}if(De=this.tokenizer.codespan(X)){X=X.substring(De.raw.length),Q.push(De);continue}if(De=this.tokenizer.br(X)){X=X.substring(De.raw.length),Q.push(De);continue}if(De=this.tokenizer.del(X)){X=X.substring(De.raw.length),De.tokens=this.inlineTokens(De.text,[],te,se),Q.push(De);continue}if(De=this.tokenizer.autolink(X,be)){X=X.substring(De.raw.length),Q.push(De);continue}if(!te&&(De=this.tokenizer.url(X,be))){X=X.substring(De.raw.length),Q.push(De);continue}if(De=this.tokenizer.inlineText(X,se,Ce)){X=X.substring(De.raw.length),fe=De.raw.slice(-1),Q.push(De);continue}if(X){var Ve="Infinite loop on byte: "+X.charCodeAt(0);if(this.options.silent){console.error(Ve);break}else throw new Error(Ve)}}return Q},G(ve,null,[{key:"rules",get:function(){return{block:q,inline:xe}}}]),ve}(),Se=B.defaults,Le=W.cleanUrl,Me=W.escape,_e=function(){function ve(ce){this.options=ce||Se}var de=ve.prototype;return de.code=function(X,Q,te){var se=(Q||"").match(/\S*/)[0];if(this.options.highlight){var fe=this.options.highlight(X,se);fe!=null&&fe!==X&&(te=!0,X=fe)}return se?'<pre><code class="'+this.options.langPrefix+Me(se,!0)+'">'+(te?X:Me(X,!0))+`</code></pre>
|
|
`:"<pre><code>"+(te?X:Me(X,!0))+`</code></pre>
|
|
`},de.blockquote=function(X){return`<blockquote>
|
|
`+X+`</blockquote>
|
|
`},de.html=function(X){return X},de.heading=function(X,Q,te,se){return this.options.headerIds?"<h"+Q+' id="'+this.options.headerPrefix+se.slug(te)+'">'+X+"</h"+Q+`>
|
|
`:"<h"+Q+">"+X+"</h"+Q+`>
|
|
`},de.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},de.list=function(X,Q,te){var se=Q?"ol":"ul",fe=Q&&te!==1?' start="'+te+'"':"";return"<"+se+fe+`>
|
|
`+X+"</"+se+`>
|
|
`},de.listitem=function(X){return"<li>"+X+`</li>
|
|
`},de.checkbox=function(X){return"<input "+(X?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},de.paragraph=function(X){return"<p>"+X+`</p>
|
|
`},de.table=function(X,Q){return Q&&(Q="<tbody>"+Q+"</tbody>"),`<table>
|
|
<thead>
|
|
`+X+`</thead>
|
|
`+Q+`</table>
|
|
`},de.tablerow=function(X){return`<tr>
|
|
`+X+`</tr>
|
|
`},de.tablecell=function(X,Q){var te=Q.header?"th":"td",se=Q.align?"<"+te+' align="'+Q.align+'">':"<"+te+">";return se+X+"</"+te+`>
|
|
`},de.strong=function(X){return"<strong>"+X+"</strong>"},de.em=function(X){return"<em>"+X+"</em>"},de.codespan=function(X){return"<code>"+X+"</code>"},de.br=function(){return this.options.xhtml?"<br/>":"<br>"},de.del=function(X){return"<del>"+X+"</del>"},de.link=function(X,Q,te){if(X=Le(this.options.sanitize,this.options.baseUrl,X),X===null)return te;var se='<a href="'+Me(X)+'"';return Q&&(se+=' title="'+Q+'"'),se+=">"+te+"</a>",se},de.image=function(X,Q,te){if(X=Le(this.options.sanitize,this.options.baseUrl,X),X===null)return te;var se='<img src="'+X+'" alt="'+te+'"';return Q&&(se+=' title="'+Q+'"'),se+=this.options.xhtml?"/>":">",se},de.text=function(X){return X},ve}(),Ae=function(){function ve(){}var de=ve.prototype;return de.strong=function(X){return X},de.em=function(X){return X},de.codespan=function(X){return X},de.del=function(X){return X},de.html=function(X){return X},de.text=function(X){return X},de.link=function(X,Q,te){return""+te},de.image=function(X,Q,te){return""+te},de.br=function(){return""},ve}(),je=function(){function ve(){this.seen={}}var de=ve.prototype;return de.slug=function(X){var Q=X.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Q)){var te=Q;do this.seen[te]++,Q=te+"-"+this.seen[te];while(this.seen.hasOwnProperty(Q))}return this.seen[Q]=0,Q},ve}(),ze=B.defaults,Ne=W.unescape,We=function(){function ve(ce){this.options=ce||ze,this.options.renderer=this.options.renderer||new _e,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ae,this.slugger=new je}ve.parse=function(X,Q){var te=new ve(Q);return te.parse(X)};var de=ve.prototype;return de.parse=function(X,Q){Q===void 0&&(Q=!0);var te="",se,fe,De,Re,Ie,Ze,Ve,mt,dt,st,_t,bt,Bt,Ut,Et,_r,Rr,lr,pr=X.length;for(se=0;se<pr;se++){st=X[se];switch(st.type){case"space":continue;case"hr":{te+=this.renderer.hr();continue}case"heading":{te+=this.renderer.heading(this.parseInline(st.tokens),st.depth,Ne(this.parseInline(st.tokens,this.textRenderer)),this.slugger);continue}case"code":{te+=this.renderer.code(st.text,st.lang,st.escaped);continue}case"table":{for(mt="",Ve="",Re=st.header.length,fe=0;fe<Re;fe++)Ve+=this.renderer.tablecell(this.parseInline(st.tokens.header[fe]),{header:!0,align:st.align[fe]});for(mt+=this.renderer.tablerow(Ve),dt="",Re=st.cells.length,fe=0;fe<Re;fe++){for(Ze=st.tokens.cells[fe],Ve="",Ie=Ze.length,De=0;De<Ie;De++)Ve+=this.renderer.tablecell(this.parseInline(Ze[De]),{header:!1,align:st.align[De]});dt+=this.renderer.tablerow(Ve)}te+=this.renderer.table(mt,dt);continue}case"blockquote":{dt=this.parse(st.tokens),te+=this.renderer.blockquote(dt);continue}case"list":{for(_t=st.ordered,bt=st.start,Bt=st.loose,Re=st.items.length,dt="",fe=0;fe<Re;fe++)Et=st.items[fe],_r=Et.checked,Rr=Et.task,Ut="",Et.task&&(lr=this.renderer.checkbox(_r),Bt?Et.tokens.length>0&&Et.tokens[0].type==="text"?(Et.tokens[0].text=lr+" "+Et.tokens[0].text,Et.tokens[0].tokens&&Et.tokens[0].tokens.length>0&&Et.tokens[0].tokens[0].type==="text"&&(Et.tokens[0].tokens[0].text=lr+" "+Et.tokens[0].tokens[0].text)):Et.tokens.unshift({type:"text",text:lr}):Ut+=lr),Ut+=this.parse(Et.tokens,Bt),dt+=this.renderer.listitem(Ut,Rr,_r);te+=this.renderer.list(dt,_t,bt);continue}case"html":{te+=this.renderer.html(st.text);continue}case"paragraph":{te+=this.renderer.paragraph(this.parseInline(st.tokens));continue}case"text":{for(dt=st.tokens?this.parseInline(st.tokens):st.text;se+1<pr&&X[se+1].type==="text";)st=X[++se],dt+=`
|
|
`+(st.tokens?this.parseInline(st.tokens):st.text);te+=Q?this.renderer.paragraph(dt):dt;continue}default:{var fr='Token with "'+st.type+'" type was not found.';if(this.options.silent){console.error(fr);return}else throw new Error(fr)}}}return te},de.parseInline=function(X,Q){Q=Q||this.renderer;var te="",se,fe,De=X.length;for(se=0;se<De;se++){fe=X[se];switch(fe.type){case"escape":{te+=Q.text(fe.text);break}case"html":{te+=Q.html(fe.text);break}case"link":{te+=Q.link(fe.href,fe.title,this.parseInline(fe.tokens,Q));break}case"image":{te+=Q.image(fe.href,fe.title,fe.text);break}case"strong":{te+=Q.strong(this.parseInline(fe.tokens,Q));break}case"em":{te+=Q.em(this.parseInline(fe.tokens,Q));break}case"codespan":{te+=Q.codespan(fe.text);break}case"br":{te+=Q.br();break}case"del":{te+=Q.del(this.parseInline(fe.tokens,Q));break}case"text":{te+=Q.text(fe.text);break}default:{var Re='Token with "'+fe.type+'" type was not found.';if(this.options.silent){console.error(Re);return}else throw new Error(Re)}}}return te},ve}(),et=W.merge,Xe=W.checkSanitizeDeprecation,Ye=W.escape,Oe=B.getDefaults,tt=B.changeDefaults,$e=B.defaults;function Pe(ve,de,ce){if(typeof ve=="undefined"||ve===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ve!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ve)+", string expected");if(typeof de=="function"&&(ce=de,de=null),de=et({},Pe.defaults,de||{}),Xe(de),ce){var X=de.highlight,Q;try{Q=ge.lex(ve,de)}catch(De){return ce(De)}var te=function(Re){var Ie;if(!Re)try{Ie=We.parse(Q,de)}catch(Ze){Re=Ze}return de.highlight=X,Re?ce(Re):ce(null,Ie)};if(!X||X.length<3)return te();if(delete de.highlight,!Q.length)return te();var se=0;Pe.walkTokens(Q,function(De){De.type==="code"&&(se++,setTimeout(function(){X(De.text,De.lang,function(Re,Ie){if(Re)return te(Re);Ie!=null&&Ie!==De.text&&(De.text=Ie,De.escaped=!0),se--,se===0&&te()})},0))}),se===0&&te();return}try{var fe=ge.lex(ve,de);return de.walkTokens&&Pe.walkTokens(fe,de.walkTokens),We.parse(fe,de)}catch(De){if(De.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,de.silent)return"<p>An error occurred:</p><pre>"+Ye(De.message+"",!0)+"</pre>";throw De}}Pe.options=Pe.setOptions=function(ve){return et(Pe.defaults,ve),tt(Pe.defaults),Pe},Pe.getDefaults=Oe,Pe.defaults=$e,Pe.use=function(ve){var de=et({},ve);if(ve.renderer&&function(){var X=Pe.defaults.renderer||new _e,Q=function(fe){var De=X[fe];X[fe]=function(){for(var Re=arguments.length,Ie=new Array(Re),Ze=0;Ze<Re;Ze++)Ie[Ze]=arguments[Ze];var Ve=ve.renderer[fe].apply(X,Ie);return Ve===!1&&(Ve=De.apply(X,Ie)),Ve}};for(var te in ve.renderer)Q(te);de.renderer=X}(),ve.tokenizer&&function(){var X=Pe.defaults.tokenizer||new ye,Q=function(fe){var De=X[fe];X[fe]=function(){for(var Re=arguments.length,Ie=new Array(Re),Ze=0;Ze<Re;Ze++)Ie[Ze]=arguments[Ze];var Ve=ve.tokenizer[fe].apply(X,Ie);return Ve===!1&&(Ve=De.apply(X,Ie)),Ve}};for(var te in ve.tokenizer)Q(te);de.tokenizer=X}(),ve.walkTokens){var ce=Pe.defaults.walkTokens;de.walkTokens=function(X){ve.walkTokens(X),ce&&ce(X)}}Pe.setOptions(de)},Pe.walkTokens=function(ve,de){for(var ce=I(ve),X;!(X=ce()).done;){var Q=X.value;de(Q);switch(Q.type){case"table":{for(var te=I(Q.tokens.header),se;!(se=te()).done;){var fe=se.value;Pe.walkTokens(fe,de)}for(var De=I(Q.tokens.cells),Re;!(Re=De()).done;)for(var Ie=Re.value,Ze=I(Ie),Ve;!(Ve=Ze()).done;){var mt=Ve.value;Pe.walkTokens(mt,de)}break}case"list":{Pe.walkTokens(Q.items,de);break}default:Q.tokens&&Pe.walkTokens(Q.tokens,de)}}},Pe.Parser=We,Pe.parser=We.parse,Pe.Renderer=_e,Pe.TextRenderer=Ae,Pe.Lexer=ge,Pe.lexer=ge.lex,Pe.Tokenizer=ye,Pe.Slugger=je,Pe.parse=Pe;var Fe=Pe;return Fe})},ELLl:function(ot,Ge,Z){(function(re){re(Z("VrN/"))})(function(re){var G={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},L=re.Pos;re.defineOption("autoCloseBrackets",!1,function(x,v,d){d&&d!=re.Init&&(x.removeKeyMap(I),x.state.closeBrackets=null),v&&(R(z(v,"pairs")),x.state.closeBrackets=v,x.addKeyMap(I))});function z(x,v){return v=="pairs"&&typeof x=="string"?x:typeof x=="object"&&x[v]!=null?x[v]:G[v]}var I={Backspace:k,Enter:A};function R(x){for(var v=0;v<x.length;v++){var d=x.charAt(v),o="'"+d+"'";I[o]||(I[o]=B(d))}}R(G.pairs+"`");function B(x){return function(v){return S(v,x)}}function U(x){var v=x.state.closeBrackets;if(!v||v.override)return v;var d=x.getModeAt(x.getCursor());return d.closeBrackets||v}function k(x){var v=U(x);if(!v||x.getOption("disableInput"))return re.Pass;for(var d=z(v,"pairs"),o=x.listSelections(),u=0;u<o.length;u++){if(!o[u].empty())return re.Pass;var l=O(x,o[u].head);if(!l||d.indexOf(l)%2!=0)return re.Pass}for(var u=o.length-1;u>=0;u--){var w=o[u].head;x.replaceRange("",L(w.line,w.ch-1),L(w.line,w.ch+1),"+delete")}}function A(x){var v=U(x),d=v&&z(v,"explode");if(!d||x.getOption("disableInput"))return re.Pass;for(var o=x.listSelections(),u=0;u<o.length;u++){if(!o[u].empty())return re.Pass;var l=O(x,o[u].head);if(!l||d.indexOf(l)%2!=0)return re.Pass}x.operation(function(){var w=x.lineSeparator()||`
|
|
`;x.replaceSelection(w+w,null),x.execCommand("goCharLeft"),o=x.listSelections();for(var p=0;p<o.length;p++){var f=o[p].head.line;x.indentLine(f,null,!0),x.indentLine(f+1,null,!0)}})}function y(x){var v=re.cmpPos(x.anchor,x.head)>0;return{anchor:new L(x.anchor.line,x.anchor.ch+(v?-1:1)),head:new L(x.head.line,x.head.ch+(v?1:-1))}}function S(x,v){var d=U(x);if(!d||x.getOption("disableInput"))return re.Pass;var o=z(d,"pairs"),u=o.indexOf(v);if(u==-1)return re.Pass;for(var l=z(d,"closeBefore"),w=z(d,"triples"),p=o.charAt(u+1)==v,f=x.listSelections(),C=u%2==0,b,h=0;h<f.length;h++){var c=f[h],s=c.head,a,g=x.getRange(s,L(s.line,s.ch+1));if(C&&!c.empty())a="surround";else if((p||!C)&&g==v)p&&_(x,s)?a="both":w.indexOf(v)>=0&&x.getRange(s,L(s.line,s.ch+3))==v+v+v?a="skipThree":a="skip";else if(p&&s.ch>1&&w.indexOf(v)>=0&&x.getRange(L(s.line,s.ch-2),s)==v+v){if(s.ch>2&&/\bstring/.test(x.getTokenTypeAt(L(s.line,s.ch-2))))return re.Pass;a="addFour"}else if(p){var m=s.ch==0?" ":x.getRange(L(s.line,s.ch-1),s);if(!re.isWordChar(g)&&m!=v&&!re.isWordChar(m))a="both";else return re.Pass}else if(C&&(g.length===0||/\s/.test(g)||l.indexOf(g)>-1))a="both";else return re.Pass;if(!b)b=a;else if(b!=a)return re.Pass}var E=u%2?o.charAt(u-1):v,M=u%2?v:o.charAt(u+1);x.operation(function(){if(b=="skip")x.execCommand("goCharRight");else if(b=="skipThree")for(var F=0;F<3;F++)x.execCommand("goCharRight");else if(b=="surround"){for(var j=x.getSelections(),F=0;F<j.length;F++)j[F]=E+j[F]+M;x.replaceSelections(j,"around"),j=x.listSelections().slice();for(var F=0;F<j.length;F++)j[F]=y(j[F]);x.setSelections(j)}else b=="both"?(x.replaceSelection(E+M,null),x.triggerElectric(E+M),x.execCommand("goCharLeft")):b=="addFour"&&(x.replaceSelection(E+E+E+E,"before"),x.execCommand("goCharRight"))})}function O(x,v){var d=x.getRange(L(v.line,v.ch-1),L(v.line,v.ch+1));return d.length==2?d:null}function _(x,v){var d=x.getTokenAt(L(v.line,v.ch+1));return/\bstring/.test(d.type)&&d.start==v.ch&&(v.ch==0||!/\bstring/.test(x.getTokenTypeAt(v)))}})},GfqC:function(ot,Ge,Z){"use strict";var re=Z("cDcd"),G=Z.n(re),L=Z("TSYQ"),z=Z.n(L);function I(W,D){var P="cannot "+W.method+" "+W.action+" "+D.status+"'",H=new Error(P);return H.status=D.status,H.method=W.method,H.url=W.action,H}function R(W){var D=W.responseText||W.response;if(!D)return D;try{return JSON.parse(D)}catch(P){return D}}function B(W){var D=new XMLHttpRequest;W.onProgress&&D.upload&&(D.upload.onprogress=function(ee){ee.total>0&&(ee.percent=ee.loaded/ee.total*100),W.onProgress(ee)});var P=new FormData;W.data&&Object.keys(W.data).forEach(function(Y){var ee=W.data[Y];if(Array.isArray(ee)){ee.forEach(function(oe){P.append(Y+"[]",oe)});return}P.append(Y,W.data[Y])}),W.file instanceof Blob?P.append(W.filename,W.file,W.file.name):P.append(W.filename,W.file),D.onerror=function(ee){W.onError(ee)},D.onload=function(){return D.status<200||D.status>=300?W.onError(I(W,D),R(D)):W.onSuccess(R(D),D)},D.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in D&&(D.withCredentials=!0);var H=W.headers||{};return H["X-Requested-With"]!==null&&D.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(H).forEach(function(Y){H[Y]!==null&&D.setRequestHeader(Y,H[Y])}),D.send(P),{abort:function(){D.abort()}}}var U=+new Date,k=0;function A(){return"rc-upload-"+U+"-"+ ++k}function y(W,D){return W.indexOf(D,W.length-D.length)!==-1}var S=function(W,D){if(W&&D){var P=Array.isArray(D)?D:D.split(","),H=W.name||"",Y=W.type||"",ee=Y.replace(/\/.*$/,"");return P.some(function(oe){var Te=oe.trim();return Te.charAt(0)==="."?y(H.toLowerCase(),Te.toLowerCase()):/\/\*$/.test(Te)?ee===Te.replace(/\/.*$/,""):Y===Te})}return!0};function O(W,D){var P=W.createReader(),H=[];function Y(){P.readEntries(function(ee){var oe=Array.prototype.slice.apply(ee);H=H.concat(oe);var Te=!oe.length;Te?D(H):Y()})}Y()}var _=function(D,P,H){var Y=function ee(oe,Te){Te=Te||"",oe.isFile?oe.file(function(ye){H(ye)&&(oe.fullPath&&!ye.webkitRelativePath&&(Object.defineProperties(ye,{webkitRelativePath:{writable:!0}}),ye.webkitRelativePath=oe.fullPath.replace(/^\//,""),Object.defineProperties(ye,{webkitRelativePath:{writable:!1}})),P([ye]))}):oe.isDirectory&&O(oe,function(ye){ye.forEach(function(he){ee(he,""+Te+oe.name+"/")})})};D.forEach(function(ee){Y(ee.webkitGetAsEntry())})},x=_,v=Object.assign||function(W){for(var D=1;D<arguments.length;D++){var P=arguments[D];for(var H in P)Object.prototype.hasOwnProperty.call(P,H)&&(W[H]=P[H])}return W},d=function(){function W(D,P){var H=[],Y=!0,ee=!1,oe=void 0;try{for(var Te=D[Symbol.iterator](),ye;!(Y=(ye=Te.next()).done)&&!(H.push(ye.value),P&&H.length===P);Y=!0);}catch(he){ee=!0,oe=he}finally{try{!Y&&Te.return&&Te.return()}finally{if(ee)throw oe}}return H}return function(D,P){if(Array.isArray(D))return D;if(Symbol.iterator in Object(D))return W(D,P);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function W(D,P){for(var H=0;H<P.length;H++){var Y=P[H];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(D,Y.key,Y)}}return function(D,P,H){return P&&W(D.prototype,P),H&&W(D,H),D}}();function u(W,D,P){return D in W?Object.defineProperty(W,D,{value:P,enumerable:!0,configurable:!0,writable:!0}):W[D]=P,W}function l(W,D){var P={};for(var H in W){if(D.indexOf(H)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,H))continue;P[H]=W[H]}return P}function w(W,D){if(!(W instanceof D))throw new TypeError("Cannot call a class as a function")}function p(W,D){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return D&&(typeof D=="object"||typeof D=="function")?D:W}function f(W,D){if(typeof D!="function"&&D!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof D);W.prototype=Object.create(D&&D.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),D&&(Object.setPrototypeOf?Object.setPrototypeOf(W,D):W.__proto__=D)}var C=function(D){return Object.keys(D).reduce(function(P,H){return(H.substr(0,5)==="data-"||H.substr(0,5)==="aria-"||H==="role")&&(P[H]=D[H]),P},{})},b=function(W){f(D,W);function D(){var P,H,Y,ee;w(this,D);for(var oe=arguments.length,Te=Array(oe),ye=0;ye<oe;ye++)Te[ye]=arguments[ye];return ee=(H=(Y=p(this,(P=D.__proto__||Object.getPrototypeOf(D)).call.apply(P,[this].concat(Te))),Y),Y.state={uid:A()},Y.reqs={},Y.onChange=function(he){var le=he.target.files;Y.uploadFiles(le),Y.reset()},Y.onClick=function(he){var le=Y.fileInput;if(!le)return;var me=Y.props,ie=me.children,pe=me.onClick;ie&&ie.type==="button"&&(le.parentNode.focus(),le.parentNode.querySelector("button").blur()),le.click(),pe&&pe(he)},Y.onKeyDown=function(he){he.key==="Enter"&&Y.onClick()},Y.onFileDrop=function(he){var le=Y.props.multiple;if(he.preventDefault(),he.type==="dragover")return;if(Y.props.directory)x(Array.prototype.slice.call(he.dataTransfer.items),Y.uploadFiles,function(ie){return S(ie,Y.props.accept)});else{var me=Array.prototype.slice.call(he.dataTransfer.files).filter(function(ie){return S(ie,Y.props.accept)});le===!1&&(me=me.slice(0,1)),Y.uploadFiles(me)}},Y.uploadFiles=function(he){var le=Array.prototype.slice.call(he);le.map(function(me){return me.uid=A(),me}).forEach(function(me){Y.upload(me,le)})},Y.saveFileInput=function(he){Y.fileInput=he},H),p(Y,ee)}return o(D,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(H,Y){var ee=this,oe=this.props;if(!oe.beforeUpload)return setTimeout(function(){return ee.post(H)},0);var Te=oe.beforeUpload(H,Y);Te&&Te.then?Te.then(function(ye){var he=Object.prototype.toString.call(ye);return he==="[object File]"||he==="[object Blob]"?ee.post(ye):ee.post(H)}).catch(function(ye){console.log(ye)}):Te!==!1&&setTimeout(function(){return ee.post(H)},0);return}},{key:"post",value:function(H){var Y=this;if(!this._isMounted)return;var ee=this.props,oe=ee.onStart,Te=ee.onProgress,ye=ee.transformFile,he=ye===void 0?function(le){return le}:ye;new Promise(function(le){var me=ee.action;return typeof me=="function"&&(me=me(H)),le(me)}).then(function(le){var me=H.uid,ie=ee.customRequest||B,pe=Promise.resolve(he(H)).then(function(J){var ne=ee.data;return typeof ne=="function"&&(ne=ne(J)),Promise.all([J,ne])}).catch(function(J){console.error(J)});pe.then(function(J){var ne=d(J,2),q=ne[0],xe=ne[1],Ce={action:le,filename:ee.name,data:xe,file:q,headers:ee.headers,withCredentials:ee.withCredentials,method:ee.method||"post",onProgress:Te?function(be){Te(be,H)}:null,onSuccess:function(ge,Se){delete Y.reqs[me],ee.onSuccess(ge,H,Se)},onError:function(ge,Se){delete Y.reqs[me],ee.onError(ge,Se,H)}};oe(H),Y.reqs[me]=ie(Ce)})})}},{key:"reset",value:function(){this.setState({uid:A()})}},{key:"abort",value:function(H){var Y=this.reqs;if(H){var ee=H;H&&H.uid&&(ee=H.uid),Y[ee]&&Y[ee].abort&&Y[ee].abort(),delete Y[ee]}else Object.keys(Y).forEach(function(oe){Y[oe]&&Y[oe].abort&&Y[oe].abort(),delete Y[oe]})}},{key:"render",value:function(){var H,Y=this.props,ee=Y.component,oe=Y.prefixCls,Te=Y.className,ye=Y.disabled,he=Y.id,le=Y.style,me=Y.multiple,ie=Y.accept,pe=Y.children,J=Y.directory,ne=Y.openFileDialogOnClick,q=Y.onMouseEnter,xe=Y.onMouseLeave,Ce=l(Y,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),be=z()((H={},u(H,oe,!0),u(H,oe+"-disabled",ye),u(H,Te,Te),H)),ge=ye?{}:{onClick:ne?this.onClick:function(){},onKeyDown:ne?this.onKeyDown:function(){},onMouseEnter:q,onMouseLeave:xe,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return G.a.createElement(ee,v({},ge,{className:be,role:"button",style:le}),G.a.createElement("input",v({},C(Ce),{id:he,type:"file",ref:this.saveFileInput,onClick:function(Le){return Le.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ie,directory:J?"directory":null,webkitdirectory:J?"webkitdirectory":null,multiple:me,onChange:this.onChange})),pe)}}]),D}(re.Component),h=b,c=Object.assign||function(W){for(var D=1;D<arguments.length;D++){var P=arguments[D];for(var H in P)Object.prototype.hasOwnProperty.call(P,H)&&(W[H]=P[H])}return W},s=function(){function W(D,P){for(var H=0;H<P.length;H++){var Y=P[H];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(D,Y.key,Y)}}return function(D,P,H){return P&&W(D.prototype,P),H&&W(D,H),D}}();function a(W,D){if(!(W instanceof D))throw new TypeError("Cannot call a class as a function")}function g(W,D){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return D&&(typeof D=="object"||typeof D=="function")?D:W}function m(W,D){if(typeof D!="function"&&D!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof D);W.prototype=Object.create(D&&D.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),D&&(Object.setPrototypeOf?Object.setPrototypeOf(W,D):W.__proto__=D)}function E(){}var M=function(W){m(D,W);function D(){var P,H,Y,ee;a(this,D);for(var oe=arguments.length,Te=Array(oe),ye=0;ye<oe;ye++)Te[ye]=arguments[ye];return ee=(H=(Y=g(this,(P=D.__proto__||Object.getPrototypeOf(D)).call.apply(P,[this].concat(Te))),Y),Y.saveUploader=function(he){Y.uploader=he},H),g(Y,ee)}return s(D,[{key:"abort",value:function(H){this.uploader.abort(H)}},{key:"render",value:function(){return G.a.createElement(h,c({},this.props,{ref:this.saveUploader}))}}]),D}(re.Component);M.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:E,onError:E,onSuccess:E,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var F=M,j=Ge.a=F},HmJG:function(ot,Ge,Z){},LdHM:function(ot,Ge,Z){"use strict";Z.d(Ge,"b",function(){return l}),Z.d(Ge,"a",function(){return p});var re=Z("1OyB"),G=Z("vuIU"),L=Z("Ji7U"),z=Z("LK+K"),I=Z("cDcd"),R=Z("rePB"),B=Z("Ff2n"),U=Z("ODXe"),k=Z("4IlW"),A=Z("bX4T"),y=Z("YrtM"),S=Z("TSYQ"),O=Z.n(S),_=Z("+nKL"),x=Z("8OUc"),v=function(H,Y){var ee=H.prefixCls,oe=H.id,Te=H.flattenOptions,ye=H.childrenAsData,he=H.values,le=H.searchValue,me=H.multiple,ie=H.defaultActiveFirstOption,pe=H.height,J=H.itemHeight,ne=H.notFoundContent,q=H.open,xe=H.menuItemSelectedIcon,Ce=H.virtual,be=H.onSelect,ge=H.onToggleOpen,Se=H.onActiveValue,Le=H.onScroll,Me=H.onMouseEnter,_e="".concat(ee,"-item"),Ae=Object(y.a)(function(){return Te},[q,Te],function(Fe,ve){return ve[0]&&Fe[1]!==ve[1]}),je=I.useRef(null),ze=function(ve){ve.preventDefault()},Ne=function(ve){je.current&&je.current.scrollTo({index:ve})},We=function(ve){for(var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ce=Ae.length,X=0;X<ce;X+=1){var Q=(ve+X*de+ce)%ce,te=Ae[Q],se=te.group,fe=te.data;if(!se&&!fe.disabled)return Q}return-1},et=I.useState(function(){return We(0)}),Xe=Object(U.a)(et,2),Ye=Xe[0],Oe=Xe[1],tt=function(ve){Oe(ve);var de=Ae[ve];if(!de){Se(null,-1);return}Se(de.data.value,ve)};I.useEffect(function(){tt(ie!==!1?We(0):-1)},[Ae.length,le]),I.useEffect(function(){var Fe=setTimeout(function(){if(!me&&q&&he.size===1){var ve=Array.from(he)[0],de=Ae.findIndex(function(ce){var X=ce.data;return X.value===ve});tt(de),Ne(de)}});return function(){return clearTimeout(Fe)}},[q]);var $e=function(ve){ve!==void 0&&be(ve,{selected:!he.has(ve)}),me||ge(!1)};if(I.useImperativeHandle(Y,function(){return{onKeyDown:function(ve){var de=ve.which;switch(de){case k.a.UP:case k.a.DOWN:{var ce=0;if(de===k.a.UP?ce=-1:de===k.a.DOWN&&(ce=1),ce!==0){var X=We(Ye+ce,ce);Ne(X),tt(X)}break}case k.a.ENTER:{var Q=Ae[Ye];Q&&!Q.data.disabled?$e(Q.data.value):$e(void 0),q&&ve.preventDefault();break}case k.a.ESC:ge(!1)}},onKeyUp:function(){},scrollTo:function(ve){Ne(ve)}}}),Ae.length===0)return I.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),className:"".concat(_e,"-empty"),onMouseDown:ze},ne);function Pe(Fe){var ve=Ae[Fe];if(!ve)return null;var de=ve.data||{},ce=de.value,X=de.label,Q=de.children,te=Object(A.a)(de,!0),se=ye?Q:X;return ve?I.createElement("div",Object.assign({"aria-label":typeof se=="string"?se:null},te,{key:Fe,role:"option",id:"".concat(oe,"_list_").concat(Fe),"aria-selected":he.has(ce)}),ce):null}return I.createElement(I.Fragment,null,I.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),style:{height:0,width:0,overflow:"hidden"}},Pe(Ye-1),Pe(Ye),Pe(Ye+1)),I.createElement(_.a,{itemKey:"key",ref:je,data:Ae,height:pe,itemHeight:J,fullHeight:!1,onMouseDown:ze,onScroll:Le,virtual:Ce,onMouseEnter:Me},function(Fe,ve){var de,ce=Fe.group,X=Fe.groupOption,Q=Fe.data,te=Q.label,se=Q.key;if(ce)return I.createElement("div",{className:O()(_e,"".concat(_e,"-group"))},te!==void 0?te:se);var fe=Q.disabled,De=Q.value,Re=Q.title,Ie=Q.children,Ze=Q.style,Ve=Q.className,mt=Object(B.a)(Q,["disabled","value","title","children","style","className"]),dt=he.has(De),st="".concat(_e,"-option"),_t=O()(_e,st,Ve,(de={},Object(R.a)(de,"".concat(st,"-grouped"),X),Object(R.a)(de,"".concat(st,"-active"),Ye===ve&&!fe),Object(R.a)(de,"".concat(st,"-disabled"),fe),Object(R.a)(de,"".concat(st,"-selected"),dt),de)),bt=ye?Ie:te,Bt=!xe||typeof xe=="function"||dt;return I.createElement("div",Object.assign({},mt,{"aria-selected":dt,className:_t,title:Re,onMouseMove:function(){if(Ye===ve||fe)return;tt(ve)},onClick:function(){fe||$e(De)},style:Ze}),I.createElement("div",{className:"".concat(st,"-content")},bt||De),I.isValidElement(xe)||dt,Bt&&I.createElement(x.a,{className:"".concat(_e,"-option-state"),customizeIcon:xe,customizeIconProps:{isSelected:dt}},dt?"\u2713":null))}))},d=I.forwardRef(v);d.displayName="OptionList";var o=d,u=function(){return null};u.isSelectOption=!0;var l=u,w=function(){return null};w.isSelectOptGroup=!0;var p=w,f=Z("VTBJ"),C=Z("Zm9Q");function b(P){var H=P.key,Y=P.props,ee=Y.children,oe=Y.value,Te=Object(B.a)(Y,["children","value"]);return Object(f.a)({key:H,value:oe!==void 0?oe:H,children:ee},Te)}function h(P){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(C.a)(P).map(function(Y,ee){if(!I.isValidElement(Y)||!Y.type)return null;var oe=Y.type.isSelectOptGroup,Te=Y.key,ye=Y.props,he=ye.children,le=Object(B.a)(ye,["children"]);return H||!oe?b(Y):Object(f.a)(Object(f.a)({key:"__RC_SELECT_GRP__".concat(Te===null?ee:Te,"__"),label:Te},le),{},{options:h(he)})}).filter(function(Y){return Y})}var c=Z("2Qr1"),s=Z("qNPg"),a=Z("U8pU"),g=Z("Kwbf"),m=Z("WKfj");function E(P){var H=P.mode,Y=P.options,ee=P.children,oe=P.backfill,Te=P.allowClear,ye=P.placeholder,he=P.getInputElement,le=P.showSearch,me=P.onSearch,ie=P.defaultOpen,pe=P.autoFocus,J=P.labelInValue,ne=P.value,q=P.inputValue,xe=P.optionLabelProp,Ce=H==="multiple"||H==="tags",be=le!==void 0?le:Ce||H==="combobox",ge=Y||h(ee);if(Object(g.a)(H!=="tags"||ge.every(function(_e){return!_e.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),H==="tags"||H==="combobox"){var Se=ge.some(function(_e){return _e.options?_e.options.some(function(Ae){return typeof("value"in Ae?Ae.value:Ae.key)=="number"}):typeof("value"in _e?_e.value:_e.key)=="number"});Object(g.a)(!Se,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(g.a)(H!=="combobox"||!xe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(g.a)(H==="combobox"||!oe,"`backfill` only works with `combobox` mode."),Object(g.a)(H==="combobox"||!he,"`getInputElement` only work with `combobox` mode."),Object(g.b)(H!=="combobox"||!he||!Te||!ye,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),me&&!be&&H!=="combobox"&&H!=="tags"&&Object(g.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(g.b)(!ie||pe,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ne!=null){var Le=Object(m.d)(ne);Object(g.a)(!J||Le.every(function(_e){return Object(a.a)(_e)==="object"&&("key"in _e||"value"in _e)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(g.a)(!Ce||Array.isArray(ne),"`value` should be array when `mode` is `multiple` or `tags`")}if(ee){var Me=null;Object(C.a)(ee).some(function(_e){if(!I.isValidElement(_e)||!_e.type)return!1;var Ae=_e.type;if(Ae.isSelectOption)return!1;if(Ae.isSelectOptGroup){var je=Object(C.a)(_e.props.children).every(function(ze){return!I.isValidElement(ze)||!_e.type||ze.type.isSelectOption?!0:(Me=ze.type,!1)});return!je}return Me=Ae,!0}),Me&&Object(g.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Me.displayName||Me.name||Me,"`.")),Object(g.a)(q===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var M=E,F=Object(s.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:h,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:M,fillOptionsWithMissingValue:c.a}),j=function(P){Object(L.a)(Y,P);var H=Object(z.a)(Y);function Y(){var ee;return Object(re.a)(this,Y),ee=H.apply(this,arguments),ee.selectRef=I.createRef(),ee.focus=function(){ee.selectRef.current.focus()},ee.blur=function(){ee.selectRef.current.blur()},ee}return Object(G.a)(Y,[{key:"render",value:function(){return I.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),Y}(I.Component);j.Option=l,j.OptGroup=p;var W=j,D=Ge.c=W},M8RZ:function(ot,Ge,Z){"use strict";Z.d(Ge,"a",function(){return k});var re=Z("fWQN"),G=Z("mtLc"),L=Z("yKVA"),z=Z("879j"),I=Z("cDcd"),R=Z.n(I),B=Z("faye"),U=Z.n(B),k=function(A){Object(L.a)(S,A);var y=Object(z.a)(S);function S(O){var _;Object(re.a)(this,S),_=y.call(this,O);var x=window.document;return _.node=x.createElement("div"),x.body.appendChild(_.node),_}return Object(G.a)(S,[{key:"render",value:function(){var _=this.props.children;return Object(B.createPortal)(_,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),S}(R.a.Component)},Ot1p:function(ot,Ge,Z){"use strict";var re=Z("2qtc"),G=Z("kLXV"),L=Z("rAM+"),z=Z("miYZ"),I=Z("tsqr"),R=Z("9og8"),B=Z("tJVT"),U=Z("jrin"),k=Z("WmNS"),A=Z.n(k),y=Z("cDcd"),S=Z.n(y),O=Z("VrN/"),_=Z.n(O),x=Z("bdgK"),v=Z("p77/"),d=Z("Bd2K"),o=Z("ELLl"),u=Z("19Vz"),l=Z("lZu9"),w=Z("+NIl"),p=Z("kSUc"),f=Z("9Bee"),C=function(fe){var De=fe.value,Re=De===void 0?"":De,Ie=fe.className,Ze=fe.showTextOnly,Ve=fe.showLines,mt=fe.style,dt=mt===void 0?{}:mt,st=Object(y.useMemo)(function(){return""},[Re]);return S.a.createElement(S.a.Fragment,null,S.a.createElement("div",{dangerouslySetInnerHTML:{__html:st}}))},b=Z("0Owb"),h=Z("dejd"),c=Z("C+DQ"),s=Z("1vsH"),a=Z("m3rI"),g=[{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(fe){var De=fe.onActionCallback,Re=fe.title,Ie=fe.icon,Ze=fe.actionName,Ve=fe.className,mt=Ve===void 0?"":Ve,dt=fe.children;function st(){De(Ze)}return S.a.createElement("a",{title:Re,className:mt,onClick:st},S.a.createElement("i",{className:"md-iconfont ".concat(Ie)}),dt)}var E=function(fe){var De=fe.watch,Re=fe.showNullButton,Ie=fe.onActionCallback,Ze=fe.fullScreen,Ve=fe.insertTemp,mt=fe.hidetoolBar,dt=fe.uuid,st=fe.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(s.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(s.G)("_educoder_session"),"&key=").concat(dt,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var _t=[].concat(g,[{title:"".concat(De?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(De?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return S.a.createElement("ul",{className:"markdown-toolbar-container"},!mt&&_t.map(function(bt,Bt){return S.a.createElement("li",{key:Bt},bt.actionName?S.a.createElement(m,Object(b.a)({},bt,{onActionCallback:Ie})):S.a.createElement("span",{className:"v-line"}))}),Re?S.a.createElement("li",null,S.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Ie},S.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Ve&&S.a.createElement("li",null,S.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Ve),onActionCallback:Ie},S.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),S.a.createElement("li",{className:"btn-full-screen"},S.a.createElement(m,{icon:"".concat(Ze?"icon-shrink":"icon-enlarge"),title:Ze?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Ie})))},M=Z("M8RZ"),F=Z("+L6B"),j=Z("2/Rp"),W=Z("y8nQ"),D=Z("Vl3Y"),P=Z("5NDa"),H=Z("5rEg"),Y={labelCol:{span:4},wrapperCol:{span:20}},ee=function(fe){var De=fe.callback,Re=fe.onCancel;function Ie(Ze){De(Ze)}return S.a.createElement(D.a,Object(b.a)({},Y,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Ie}),S.a.createElement(D.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},S.a.createElement(H.a,null)),S.a.createElement(D.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},S.a.createElement(H.a,null)),S.a.createElement("div",{className:"flex-container flex-end"},S.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement(j.a,{type:"ghost",onClick:Re},"\u53D6\u6D88")))},oe=Z("7ahc"),Te=Z("HmJG"),ye=Z("BjJ7"),he=D.a.useForm,le={width:280,marginRight:10},me={labelCol:{span:5},wrapperCol:{span:19}},ie=function(fe){var De=fe.callback,Re=fe.onCancel,Ie=he(),Ze=Object(B.a)(Ie,1),Ve=Ze[0];function mt(_t){De(_t)}function dt(_t,bt){if(_t.status===-1){I.b.error(_t.message);return}Ve.setFieldsValue({src:"/api/attachments/".concat(_t.id),type:bt.type})}function st(_t){var bt=_t.target.files[0];J(bt,dt)}return S.a.createElement(D.a,Object(b.a)({form:Ve},me,{className:"upload-image-panel",onFinish:mt}),S.a.createElement(D.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},S.a.createElement("div",{className:"flex-container"},S.a.createElement(D.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},S.a.createElement(H.a,{style:le})),S.a.createElement(pe,{onFileChange:st}))),S.a.createElement(D.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},S.a.createElement(H.a,{style:{width:264}})),S.a.createElement(D.a.Item,{style:{textAlign:"right"}},S.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement(j.a,{type:"ghost",onClick:Re},"\u53D6\u6D88")))};function pe(fe){var De=fe.onFileChange;return S.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",S.a.createElement("input",{type:"file",onChange:De}))}function J(fe,De){if(!fe)throw new String("\u6CA1\u6709\u6587\u4EF6");var Re=new FormData;Re.append("editormd-image-file",fe),Re.append("file_param_name","editormd-image-file"),Re.append("byxhr","true");var Ie=new window.XMLHttpRequest;Ie.withCredentials=!0,Ie.addEventListener("load",function(Ze){De(JSON.parse(Ze.target.responseText),fe)},!1),Ie.addEventListener("error",function(Ze){console.error(Ze)},!1),Ie.open("POST","".concat(ye.a,"/api/attachments.json")),Ie.send(Re)}var ne=Z("giR+"),q=Z("fyUT"),xe=Z("7Kak"),Ce=Z("9yH6"),be=Ce.a.Group,ge={margin:"0 8px"},Se=function(fe){var De=fe.callback,Re=fe.onCancel;function Ie(Ze){De(Ze)}return S.a.createElement(D.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Ie},S.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},S.a.createElement("span",{style:ge},"\u5355\u5143\u683C\u6570\uFF1A"),S.a.createElement("span",{style:ge},"\u884C\u6570"),S.a.createElement(D.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},S.a.createElement(q.a,null)),S.a.createElement("span",{style:ge},"\u5217\u6570"),S.a.createElement(D.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},S.a.createElement(q.a,null))),S.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},S.a.createElement("span",{style:ge},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),S.a.createElement(D.a.Item,{name:"align"},S.a.createElement(be,null,S.a.createElement(Ce.a,{value:"default"},S.a.createElement("i",{className:"fa fa-align-justify"})),S.a.createElement(Ce.a,{value:"left"},S.a.createElement("i",{className:"fa fa-align-left"})),S.a.createElement(Ce.a,{value:"center"},S.a.createElement("i",{className:"fa fa-align-center"})),S.a.createElement(Ce.a,{value:"right"},S.a.createElement("i",{className:"fa fa-align-right"}))))),S.a.createElement("div",{className:"flex-container flex-end"},S.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement(j.a,{type:"ghost",onClick:Re},"\u53D6\u6D88")))},Le=Z("ErOA"),Me=Z("7Cbv"),_e="link",Ae="upload-image",je="code-block",ze="add-table",Ne="------------",We={default:Ne,left:":".concat(Ne),center:":".concat(Ne,":"),right:"".concat(Ne,":")},et=Z("9VGf"),Xe,Ye;function Oe(){}var tt=0,$e=1e4,Pe="\u2581",Fe=`
|
|
**\u6A21\u677F\u6807\u9898**
|
|
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function ve(fe){return/^\d+$/.test(fe)?"".concat(fe,"px"):fe}var de=navigator.platform.toUpperCase().indexOf("MAC")>=0,ce=de?"Cmd":"Ctrl",X=["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"],Q=(Xe={},Object(U.a)(Xe,ce+"-B","bold"),Object(U.a)(Xe,ce+"-I","italic"),Xe),te=(Ye={},Object(U.a)(Ye,_e,"\u6DFB\u52A0\u94FE\u63A5"),Object(U.a)(Ye,je,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(U.a)(Ye,Ae,"\u6DFB\u52A0\u6587\u4EF6"),Object(U.a)(Ye,ze,"\u6DFB\u52A0\u8868\u683C"),Ye),se=Ge.a=function(fe){var De=fe.defaultValue,Re=De===void 0?"":De,Ie=fe.onChange,Ze=fe.width,Ve=Ze===void 0?"100%":Ze,mt=fe.height,dt=mt===void 0?400:mt,st=fe.miniToolbar,_t=st===void 0?!1:st,bt=fe.isFocus,Bt=bt===void 0?!1:bt,Ut=fe.watch,Et=fe.insertTemp,_r=fe.mode,Rr=_r===void 0?"markdown":_r,lr=fe.id,pr=lr===void 0?"markdown-editor-id":lr,fr=fe.showResizeBar,ia=fr===void 0?!1:fr,Cr=fe.noStorage,Hn=Cr===void 0?!1:Cr,Kn=fe.showNullButton,Rt=Kn===void 0?!1:Kn,nt=fe.hidetoolBar,Pr=nt===void 0?!1:nt,mn=fe.fullScreen,Zt=mn===void 0?!1:mn,Tt=fe.onBlur,gr=fe.onCMBeforeChange,Mr=fe.onFullScreen,pn=fe.className,Be=pn===void 0?"":pn,ct=fe.disablePaste,zn=ct===void 0?!1:ct,gn=fe.placeholder,vn=gn===void 0?"":gn,Qr=fe.values,yn=Qr===void 0?"":Qr,ht=Object(y.useState)(null),Ci=Object(B.a)(ht,2),He=Ci[0],bn=Ci[1],hr=Object(y.useState)(Re),Gn=Object(B.a)(hr,2),Zr=Gn[0],vr=Gn[1],Vn=Object(y.useState)(Ut),Xn=Object(B.a)(Vn,2),yr=Xn[0],Yn=Xn[1],Ai=Object(y.useState)(Zt),$n=Object(B.a)(Ai,2),br=$n[0],Li=$n[1],aa=Object(y.useState)(""),Jn=Object(B.a)(aa,2),$t=Jn[0],Wr=Jn[1],oa=Object(y.useState)(0),qr=Object(B.a)(oa,2),Er=qr[0],Qn=qr[1],sa=Object(y.useState)(dt),Di=Object(B.a)(sa,2),Oi=Di[0],En=Di[1],Ri=Object(y.useState)(!1),Pi=Object(B.a)(Ri,2),la=Pi[0],xn=Pi[1],en=Object(y.useRef)(Object(Me.a)()),tn=Object(y.useRef)(!1),Tn=Object(y.useRef)(),kr=Object(y.useRef)(),Ir=Object(y.useRef)(),Ur=Object(y.useRef)(),Sn=Object(y.useRef)(),Mi=function(){var it=Object(R.a)(A.a.mark(function ft(){var lt,gt;return A.a.wrap(function(At){for(;;)switch(At.prev=At.next){case 0:return At.next=2,Object(Le.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:en.current}});case 2:gt=At.sent,gt!=null&&(lt=gt.attachments)!==null&<!==void 0&<.length&&(console.log("cm:",He,kr),gt.attachments.map(function(yt){yt.content_type.indexOf("image")>-1?He.replaceSelection(".concat(yt.content_type,")")):yt.content_type.indexOf("video")>-1?He.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):yt.content_type.indexOf("pdf")>-1?He.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(yt.id,"?type=").concat(yt.content_type,'&disposition=inline" target="_blank">').concat(yt.name,"</a>")):He.replaceSelection("[".concat(yt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(yt.id,"?type=").concat(yt.content_type,")"))}));case 4:case"end":return At.stop()}},ft)}));return function(){return it.apply(this,arguments)}}();Object(y.useEffect)(function(){vr(yn),He==null||He.setValue(yn)},[yn]),Object(y.useEffect)(function(){Mr==null||Mr(br)},[br]),Object(y.useEffect)(function(){if(kr.current){var it=_.a.fromTextArea(kr.current,{mode:Rr,lineNumbers:!_t,lineWrapping:!0,value:Re,autoCloseTags:!0,autoCloseBrackets:!0});Bt&&it.focus();function ft(lt,gt){if(zn){gt.preventDefault();return}var xt=gt.clipboardData;if(xt){var At=xt.types.toString(),yt=xt.items;if(At==="Files"||xt.types.indexOf("Files")>-1){if(gt.preventDefault(),Rr=="stex")return;try{var Ft,qt=yt[1];((Ft=yt[0])===null||Ft===void 0?void 0:Ft.kind)==="file"&&(qt=yt[0]);var vt=qt.getAsFile(),Fr=vt.name.split(".").pop();J(vt,function(St){if(St.id){var er,Vt,mr;(vt==null||((er=vt.type)===null||er===void 0)?void 0:er.indexOf("image"))>-1?it.replaceSelection(".concat(St.content_type,")")):(vt==null||((Vt=vt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?it.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,'"></video>')):(vt==null||((mr=vt.type)===null||mr===void 0)?void 0:mr.indexOf("pdf"))>-1?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(vt.type,'&disposition=inline" target="_blank">').concat(vt.name,"</a>")):X.includes(Fr)?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,'?type=office&disposition=inline" target="_blank">').concat(vt.name,"</a>")):it.replaceSelection("[".concat(vt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(St.content_type,")"))}else(St==null?void 0:St.status)===401&&(document.location.href="/user/login")})}catch(St){I.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return it.on("paste",ft),it.on("dragleave",function(lt,gt){Ir.current.classList.remove("mouse-hover-md")}),it.on("dragover",function(lt,gt){Ir.current.classList.add("mouse-hover-md")}),it.on("drop",function(lt,gt){Ir.current.classList.add("mouse-hover-md");var xt;if(xt=gt.dataTransfer.files,xt.length>0){gt.preventDefault(),gt.stopPropagation();for(var At=function(qt){var vt=xt[qt],Fr=vt.name.split(".").pop();J(vt,function(St){if(St.id){var er,Vt,mr;(vt==null||((er=vt.type)===null||er===void 0)?void 0:er.indexOf("image"))>-1?it.replaceSelection(".concat(St.content_type,")")):(vt==null||((Vt=vt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?it.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,'"></video>')):(vt==null||((mr=vt.type)===null||mr===void 0)?void 0:mr.indexOf("pdf"))>-1?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(vt.type,'&disposition=inline" target="_blank">').concat(vt.name,"</a>")):X.includes(Fr)?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,'?type=office&disposition=inline" target="_blank">').concat(vt.name,"</a>")):it.replaceSelection("[".concat(vt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(St.content_type,")"))}else(St==null?void 0:St.status)===401&&(document.location.href="/user/login")})},yt=0;yt<xt.length;yt++)At(yt)}}),bn(it),function(){it.off("paste",ft)}}},[]);var ur=Object(y.useCallback)(function(){if(Ir.current)try{}catch(it){console.log(it,"---- to set md editor body height")}},[Oi,Ir,br]);Object(y.useEffect)(function(){function it(){var lt=new x.default(function(gt){var xt=Object(L.a)(gt),At;try{for(xt.s();!(At=xt.n()).done;){var yt=At.value;(yt.target.offsetHeight>0||yt.target.offsetWidth>0)&&(ur(),He.setSize("100%","100%"),He.refresh())}}catch(Ft){xt.e(Ft)}finally{xt.f()}});return lt.observe(kr.current.parentElement),lt}if(He){var ft=it();return function(){ft.unobserve(kr.current.parentElement)}}},[He,ur]),Object(y.useEffect)(function(){if(He){for(var it=[],ft=function(){var yt=gt[lt];xt=Object(B.a)(yt,2);var Ft=xt[0],qt=xt[1],vt=Object(U.a)({},Ft,function(){ki(qt)});it.push(vt),He.addKeyMap(vt)},lt=0,gt=Object.entries(Q);lt<gt.length;lt++){var xt;ft()}return Tn.current=setInterval(function(){tn.current&&Mi()},4e3),function(){clearInterval(Tn.current);var At=Object(L.a)(it),yt;try{for(At.s();!(yt=At.n()).done;){var Ft=yt.value;He.removeKeyMap(Ft)}}catch(qt){At.e(qt)}finally{At.f()}}}},[He]),Object(y.useEffect)(function(){Zt!==br&&Li(Zt)},[Zt]),Object(et.a)(function(){if(!Hn&&Er>0){var it=new Date().getTime(),ft=window.sessionStorage.getItem(pr);it>=Er+$e&&(!ft||ft!==Zr)&&(window.sessionStorage.setItem(pr,Zr),xn(!0))}},$e),Object(y.useEffect)(function(){Yn(Ut)},[He,Ut]),Object(y.useEffect)(function(){He&&(Bt&&He.focus())},[He,Bt]),Object(y.useEffect)(function(){if(yr&&He){var it=He.getScrollerElement();function ft(lt){var gt=lt.target;if(Sn.current){var xt=gt.scrollTop/gt.scrollHeight;Sn.current.scrollTop=Sn.current.scrollHeight*xt}}return it.addEventListener("scroll",ft),function(){it.removeEventListener("scroll",ft)}}},[He,yr]),Object(y.useEffect)(function(){if(He&&gr){function it(ft,lt){gr(ft,lt)}return He.on("beforeChange",it),function(){He.off("beforeChange",it)}}},[He,gr]),Object(y.useEffect)(function(){if(He&&Tt){function it(){Tt(He.getValue())}return He.on("blur",it),function(){He.off("blur",it)}}},[He,Tt]),Object(y.useEffect)(function(){if(He){function it(ft){var lt=ft.getValue();vr(lt),Qn(new Date().getTime()),ft.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Ie&&Ie(lt)}return He.on("change",it),function(){He.off("change",it)}}},[He,Ie]),Object(y.useEffect)(function(){He&&(Re==null?(He.setValue(""),vr("")):Re!==He.getValue()&&(He.setValue(Re),vr(Re),He.setCursor(He.lineCount(),0)))},[He,Re]);var ki=Object(y.useCallback)(function(it){var ft=He.getCursor(),lt=He.getSelection(),gt=lt.split(`
|
|
`);switch(it){case"bold":return He.replaceSelection("**"+lt+"**"),lt===""&&He.setCursor(ft.line,ft.ch+2),He.focus();case"italic":return He.replaceSelection("*"+lt+"*"),lt===""&&He.setCursor(ft.line,ft.ch+1),He.focus();case"code":return He.replaceSelection("`"+lt+"`"),lt===""&&He.setCursor(ft.line,ft.ch+1),He.focus();case"inline-latex":return He.replaceSelection("`$$"+lt+"$$`"),lt===""&&He.setCursor(ft.line,ft.ch+3),He.focus();case"latex":return He.replaceSelection("```latex\n"+lt+"\n```"),He.setCursor(ft.line+1,lt.length+1),He.focus();case"line-break":return He.replaceSelection(`<br/>
|
|
`),He.focus();case"list-ul":return lt===""?He.replaceSelection("- "+lt):He.replaceSelection(gt.map(function(xt){return xt===""?"":"- ".concat(xt)}).join(`
|
|
`)),He.focus();case"list-ol":return lt===""?He.replaceSelection("1. "+lt):He.replaceSelection(gt.map(function(xt,At){return xt===""?"":"".concat(At+1,". ").concat(xt)}).join(`
|
|
`)),He.focus();case"add-null-ch":return lt===""&&He.setCursor(ft.line,ft.ch+1),He.replaceSelection(Pe),He.focus();case"inster-template-1":return lt===""&&He.setCursor(ft.line,ft.ch),He.replaceSelection(Fe),He.focus();case"eraser":return He.setValue(""),He.focus();case"trigger-watch":return Yn(!yr),He.focus();case"trigger-full-screen":return Li(!br),He.focus();case _e:Wr(_e);return;case je:Wr(je);return;case Ae:Wr(Ae);return;case ze:Wr(ze);return;default:throw new Error}},[He,yr,br]),wn=Object(y.useCallback)(function(it){Wr("");switch($t){case _e:var ft=it.title,lt=it.link;return He.replaceSelection("[".concat(ft,"](").concat(lt,")")),He.focus();case je:var gt=it.language,xt=it.content;return He.replaceSelection(["```"+gt,xt,"```"].join(`
|
|
`)),He.focus();case Ae:var At=it.src,yt=it.alt;return yt?He.replaceSelection(".concat(At,' "').concat(yt,'" )')):He.replaceSelection("")),He.focus();case ze:for(var Ft=it.row,qt=it.col,vt=it.align,Fr=`
|
|
`,St=0;St<Ft;St++){for(var er=[],Vt=[],mr=0;mr<qt;mr++)St===1&&Vt.push(We[vt]),er.push(" ");St===1&&(Fr+="| ".concat(Vt.join(" | "),` |
|
|
`)),Fr+="| ".concat(er.join(qt===1?"":" | "),` |
|
|
`)}return He.replaceSelection(Fr+`
|
|
`),He.focus();default:throw new Error}},[He,$t]),Zn=Object(y.useMemo)(function(){switch($t){case _e:return S.a.createElement(ee,{callback:wn,onCancel:Hr});case je:return S.a.createElement(oe.b,{callback:wn,onCancel:Hr});case Ae:return S.a.createElement(ie,{callback:wn,onCancel:Hr});case ze:return S.a.createElement(Se,{callback:wn,onCancel:Hr});default:return null}},[$t]);function Hr(){Wr("")}Object(y.useEffect)(function(){if(Ur.current){var it=Ur.current,ft=!1,lt=0;function gt(yt){ft=!0,lt=yt.pageY}function xt(){ft=!1}function At(yt){if(ft){var Ft=yt.pageY-lt;Ft<0&&(Ft=0),Ft>300&&(Ft=300);var qt=dt+Ft+"px";En(qt)}}return it.addEventListener("mousedown",gt),document.addEventListener("mousemove",At),document.addEventListener("mouseup",xt),function(){it.removeEventListener("mousedown",gt),document.removeEventListener("mousemove",At),document.removeEventListener("mouseup",xt)}}},[He,Ur]),Object(y.useEffect)(function(){En(dt)},[dt]);var Ar=ve(Ve),qn=ve(Oi),xr={width:Ar,height:qn},ei=Object(y.useMemo)(function(){if(Er){var it=new Date(Er),ft=it.getHours(),lt=it.getMinutes(),gt=it.getSeconds();return ft=ft<10?"0"+ft:ft,lt=lt<10?"0"+lt:lt,gt=gt<10?"0"+gt:gt,"".concat(ft,":").concat(lt,":").concat(gt)}return 0},[Er]);function Ii(){window.sessionStorage.removeItem(pr),xn(!1),Qn(0)}function rn(){xn(!1),Qn(0),He.setValue(window.sessionStorage.getItem(pr))}function ua(it,ft){var lt=He.getValue();lt=lt.replace(it,ft),vr(lt),He==null||He.setValue(lt)}return S.a.createElement(y.Fragment,null,S.a.createElement("div",{className:"markdown-editor-wrapper",ref:Ir},S.a.createElement("div",{className:"markdown-editor-container ".concat(Be," ").concat(yr?"on-preview":""," ").concat(_t?"mini":""," ").concat(br?"full-screen":""),style:xr},S.a.createElement(E,{insertTemp:Et,watch:yr,fullScreen:br,showNullButton:Rt,onActionCallback:ki,hidetoolBar:Pr,uuid:en.current,setOpenPhones:function(){tn.current=!0}}),S.a.createElement("div",{className:"markdown-editor-body"},S.a.createElement("div",{className:"codemirror-container"},S.a.createElement("textarea",{ref:kr,placeholder:vn})),yr?S.a.createElement("div",{ref:Sn,className:"preview-container"},Rr==="stex"&&S.a.createElement(C,{value:Zr}),Rr!=="stex"&&S.a.createElement(f.a,{edit:!0,value:Zr,replaces:ua})):null))),ia?S.a.createElement("a",{ref:Ur,className:"editor-resize"}):null,S.a.createElement(M.a,null,te[$t]?S.a.createElement(G.a,{centered:!0,title:te[$t],visible:!0,onCancel:Hr,footer:null,className:"markdown-popup-form"},Zn):null))}},SJMd:function(ot,Ge){/**
|
|
* @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 Z,re,G,L=!1,z,I;window.PR_SHOULD_USE_CONTINUATION=!0;var R,B;(function(){var U=window,k=["break,continue,do,else,for,if,return,while"],A=[k,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],y=[A,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],S=[y,"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"],O=[y,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],_=[y,"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"],x="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",v=[y,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[k,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],u=[k,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],l=[k,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],w=[S,_,O,v,d,o,u,l],p=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,f="str",C="kwd",b="com",h="typ",c="lit",s="pun",a="pln",g="tag",m="dec",E="src",M="atn",F="atv",j="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function D(be){for(var ge=0,Se=!1,Le=!1,Me=0,_e=be.length;Me<_e;++Me){var Ae=be[Me];if(Ae.ignoreCase)Le=!0;else if(/[a-z]/i.test(Ae.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Se=!0,Le=!1;break}}var je={b:8,t:9,n:10,v:11,f:12,r:13};function ze(Ye){var Oe=Ye.charCodeAt(0);if(Oe!==92)return Oe;var tt=Ye.charAt(1);return Oe=je[tt],Oe||("0"<=tt&&tt<="7"?parseInt(Ye.substring(1),8):tt==="u"||tt==="x"?parseInt(Ye.substring(2),16):Ye.charCodeAt(1))}function Ne(Ye){if(Ye<32)return(Ye<16?"\\x0":"\\x")+Ye.toString(16);var Oe=String.fromCharCode(Ye);return Oe==="\\"||Oe==="-"||Oe==="]"||Oe==="^"?"\\"+Oe:Oe}function We(Ye){var Oe=Ye.substring(1,Ye.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),tt=[],$e=Oe[0]==="^",Pe=["["];$e&&Pe.push("^");for(var Fe=$e?1:0,ve=Oe.length;Fe<ve;++Fe){var de=Oe[Fe];if(/\\[bdsw]/i.test(de))Pe.push(de);else{var ce=ze(de),X;Fe+2<ve&&Oe[Fe+1]==="-"?(X=ze(Oe[Fe+2]),Fe+=2):X=ce,tt.push([ce,X]),X<65||ce>122||(X<65||ce>90||tt.push([Math.max(65,ce)|32,Math.min(X,90)|32]),X<97||ce>122||tt.push([Math.max(97,ce)&~32,Math.min(X,122)&~32]))}}tt.sort(function(fe,De){return fe[0]-De[0]||De[1]-fe[1]});for(var Q=[],te=[],Fe=0;Fe<tt.length;++Fe){var se=tt[Fe];se[0]<=te[1]+1?te[1]=Math.max(te[1],se[1]):Q.push(te=se)}for(var Fe=0;Fe<Q.length;++Fe){var se=Q[Fe];Pe.push(Ne(se[0])),se[1]>se[0]&&(se[1]+1>se[0]&&Pe.push("-"),Pe.push(Ne(se[1])))}return Pe.push("]"),Pe.join("")}function et(Ye){for(var Oe=Ye.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),tt=Oe.length,$e=[],Pe=0,Fe=0;Pe<tt;++Pe){var ve=Oe[Pe];if(ve==="(")++Fe;else if(ve.charAt(0)==="\\"){var de=+ve.substring(1);de&&(de<=Fe?$e[de]=-1:Oe[Pe]=Ne(de))}}for(var Pe=1;Pe<$e.length;++Pe)$e[Pe]===-1&&($e[Pe]=++ge);for(var Pe=0,Fe=0;Pe<tt;++Pe){var ve=Oe[Pe];if(ve==="(")++Fe,$e[Fe]||(Oe[Pe]="(?:");else if(ve.charAt(0)==="\\"){var de=+ve.substring(1);de&&de<=Fe&&(Oe[Pe]="\\"+$e[de])}}for(var Pe=0;Pe<tt;++Pe)Oe[Pe]==="^"&&Oe[Pe+1]!=="^"&&(Oe[Pe]="");if(Ye.ignoreCase&&Se)for(var Pe=0;Pe<tt;++Pe){var ve=Oe[Pe],ce=ve.charAt(0);ve.length>=2&&ce==="["?Oe[Pe]=We(ve):ce!=="\\"&&(Oe[Pe]=ve.replace(/[a-zA-Z]/g,function(te){var se=te.charCodeAt(0);return"["+String.fromCharCode(se&~32,se|32)+"]"}))}return Oe.join("")}for(var Xe=[],Me=0,_e=be.length;Me<_e;++Me){var Ae=be[Me];if(Ae.global||Ae.multiline)throw new Error(""+Ae);Xe.push("(?:"+et(Ae)+")")}return new RegExp(Xe.join("|"),Le?"gi":"g")}function P(be,ge){var Se=/(?:^|\s)nocode(?:\s|$)/,Le=[],Me=0,_e=[],Ae=0;function je(ze){var Ne=ze.nodeType;if(Ne==1){if(Se.test(ze.className))return;for(var We=ze.firstChild;We;We=We.nextSibling)je(We);var et=ze.nodeName.toLowerCase();(et==="br"||et==="li")&&(Le[Ae]=`
|
|
`,_e[Ae<<1]=Me++,_e[Ae++<<1|1]=ze)}else if(Ne==3||Ne==4){var Xe=ze.nodeValue;Xe.length&&(ge?Xe=Xe.replace(/\r\n?/g,`
|
|
`):Xe=Xe.replace(/[ \t\r\n]+/g," "),Le[Ae]=Xe,_e[Ae<<1]=Me,Me+=Xe.length,_e[Ae++<<1|1]=ze)}}return je(be),{sourceCode:Le.join("").replace(/\n$/,""),spans:_e}}function H(be,ge,Se,Le,Me){if(!Se)return;var _e={sourceNode:be,pre:1,langExtension:null,numberLines:null,sourceCode:Se,spans:null,basePos:ge,decorations:null};Le(_e),Me.push.apply(Me,_e.decorations)}var Y=/\S/;function ee(be){for(var ge=void 0,Se=be.firstChild;Se;Se=Se.nextSibling){var Le=Se.nodeType;ge=Le===1?ge?be:Se:Le===3&&Y.test(Se.nodeValue)?be:ge}return ge===be?void 0:ge}function oe(be,ge){var Se={},Le;(function(){for(var Ae=be.concat(ge),je=[],ze={},Ne=0,We=Ae.length;Ne<We;++Ne){var et=Ae[Ne],Xe=et[3];if(Xe)for(var Ye=Xe.length;--Ye>=0;)Se[Xe.charAt(Ye)]=et;var Oe=et[1],tt=""+Oe;ze.hasOwnProperty(tt)||(je.push(Oe),ze[tt]=null)}je.push(/[\0-\uffff]/),Le=D(je)})();var Me=ge.length,_e=function(Ae){for(var je=Ae.sourceCode,ze=Ae.basePos,Ne=Ae.sourceNode,We=[ze,a],et=0,Xe=je.match(Le)||[],Ye={},Oe=0,tt=Xe.length;Oe<tt;++Oe){var $e=Xe[Oe],Pe=Ye[$e],Fe=void 0,ve;if(typeof Pe=="string")ve=!1;else{var de=Se[$e.charAt(0)];if(de)Fe=$e.match(de[1]),Pe=de[0];else{for(var ce=0;ce<Me;++ce)if(de=ge[ce],Fe=$e.match(de[1]),Fe){Pe=de[0];break}Fe||(Pe=a)}ve=Pe.length>=5&&Pe.substring(0,5)==="lang-",ve&&!(Fe&&typeof Fe[1]=="string")&&(ve=!1,Pe=E),ve||(Ye[$e]=Pe)}var X=et;if(et+=$e.length,!ve)We.push(ze+X,Pe);else{var Q=Fe[1],te=$e.indexOf(Q),se=te+Q.length;Fe[2]&&(se=$e.length-Fe[2].length,te=se-Q.length);var fe=Pe.substring(5);H(Ne,ze+X,$e.substring(0,te),_e,We),H(Ne,ze+X+te,Q,pe(fe,Q),We),H(Ne,ze+X+se,$e.substring(se),_e,We)}}Ae.decorations=We};return _e}function Te(be){var ge=[],Se=[];be.tripleQuotedStrings?ge.push([f,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):be.multiLineStrings?ge.push([f,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):ge.push([f,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),be.verbatimStrings&&Se.push([f,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Le=be.hashComments;Le&&(be.cStyleComments?(Le>1?ge.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):ge.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Se.push([f,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):ge.push([b,/^#[^\r\n]*/,null,"#"])),be.cStyleComments&&(Se.push([b,/^\/\/[^\r\n]*/,null]),Se.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Me=be.regexLiterals;if(Me){var _e=Me>1?"":`
|
|
\r`,Ae=_e?".":"[\\S\\s]",je="/(?=[^/*"+_e+"])(?:[^/\\x5B\\x5C"+_e+"]|\\x5C"+Ae+"|\\x5B(?:[^\\x5C\\x5D"+_e+"]|\\x5C"+Ae+")*(?:\\x5D|$))+/";Se.push(["lang-regex",RegExp("^"+W+"("+je+")")])}var ze=be.types;ze&&Se.push([h,ze]);var Ne=(""+be.keywords).replace(/^ | $/g,"");Ne.length&&Se.push([C,new RegExp("^(?:"+Ne.replace(/[\s,]+/g,"|")+")\\b"),null]),ge.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var We="^.[^\\s\\w.$@'\"`/\\\\]*";return be.regexLiterals&&(We+="(?!s*/)"),Se.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[h,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[s,new RegExp(We),null]),oe(ge,Se)}var ye=Te({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function he(be,ge,Se){for(var Le=/(?:^|\s)nocode(?:\s|$)/,Me=/\r\n?|\n/,_e=be.ownerDocument,Ae=_e.createElement("li");be.firstChild;)Ae.appendChild(be.firstChild);var je=[Ae];function ze(Oe){var tt=Oe.nodeType;if(tt==1&&!Le.test(Oe.className))if(Oe.nodeName==="br")Ne(Oe),Oe.parentNode&&Oe.parentNode.removeChild(Oe);else for(var $e=Oe.firstChild;$e;$e=$e.nextSibling)ze($e);else if((tt==3||tt==4)&&Se){var Pe=Oe.nodeValue,Fe=Pe.match(Me);if(Fe){var ve=Pe.substring(0,Fe.index);Oe.nodeValue=ve;var de=Pe.substring(Fe.index+Fe[0].length);if(de){var ce=Oe.parentNode;ce.insertBefore(_e.createTextNode(de),Oe.nextSibling)}Ne(Oe),ve||Oe.parentNode.removeChild(Oe)}}}function Ne(Oe){for(;!Oe.nextSibling;)if(Oe=Oe.parentNode,!Oe)return;function tt(Fe,ve){var de=ve?Fe.cloneNode(!1):Fe,ce=Fe.parentNode;if(ce){var X=tt(ce,1),Q=Fe.nextSibling;X.appendChild(de);for(var te=Q;te;te=Q)Q=te.nextSibling,X.appendChild(te)}return de}for(var $e=tt(Oe.nextSibling,0),Pe;(Pe=$e.parentNode)&&Pe.nodeType===1;)$e=Pe;je.push($e)}for(var We=0;We<je.length;++We)ze(je[We]);ge===(ge|0)&&je[0].setAttribute("value",ge);var et=_e.createElement("ol");et.className="linenums";for(var Xe=Math.max(0,ge-1|0)||0,We=0,Ye=je.length;We<Ye;++We)Ae=je[We],Ae.className="L"+(We+Xe)%10,Ae.firstChild||Ae.appendChild(_e.createTextNode("\xA0")),et.appendChild(Ae);be.appendChild(et)}function le(be){var ge=/\bMSIE\s(\d+)/.exec(navigator.userAgent);ge=ge&&+ge[1]<=8;var Se=/\n/g,Le=be.sourceCode,Me=Le.length,_e=0,Ae=be.spans,je=Ae.length,ze=0,Ne=be.decorations,We=Ne.length,et=0;Ne[We]=Me;var Xe,Ye;for(Ye=Xe=0;Ye<We;)Ne[Ye]!==Ne[Ye+2]?(Ne[Xe++]=Ne[Ye++],Ne[Xe++]=Ne[Ye++]):Ye+=2;for(We=Xe,Ye=Xe=0;Ye<We;){for(var Oe=Ne[Ye],tt=Ne[Ye+1],$e=Ye+2;$e+2<=We&&Ne[$e+1]===tt;)$e+=2;Ne[Xe++]=Oe,Ne[Xe++]=tt,Ye=$e}We=Ne.length=Xe;var Pe=be.sourceNode,Fe="";Pe&&(Fe=Pe.style.display,Pe.style.display="none");try{for(var ve=null;ze<je;){var de=Ae[ze],ce=Ae[ze+2]||Me,X=Ne[et+2]||Me,$e=Math.min(ce,X),Q=Ae[ze+1],te;if(Q.nodeType!==1&&(te=Le.substring(_e,$e))){ge&&(te=te.replace(Se,"\r")),Q.nodeValue=te;var se=Q.ownerDocument,fe=se.createElement("span");fe.className=Ne[et+1];var De=Q.parentNode;De.replaceChild(fe,Q),fe.appendChild(Q),_e<ce&&(Ae[ze+1]=Q=se.createTextNode(Le.substring($e,ce)),De.insertBefore(Q,fe.nextSibling))}_e=$e,_e>=ce&&(ze+=2),_e>=X&&(et+=2)}}finally{Pe&&(Pe.style.display=Fe)}}var me={};function ie(be,ge){for(var Se=ge.length;--Se>=0;){var Le=ge[Se];me.hasOwnProperty(Le)?U.console&&console.warn("cannot override language handler %s",Le):me[Le]=be}}function pe(be,ge){return be&&me.hasOwnProperty(be)||(be=/^\s*</.test(ge)?"default-markup":"default-code"),me[be]}ie(ye,["default-code"]),ie(oe([],[[a,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[b,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\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"]),ie(oe([[a,/^[\s]+/,null,` \r
|
|
`],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[g,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[M,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\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"]),ie(oe([],[[F,/^[\s\S]+/]]),["uq.val"]),ie(Te({keywords:S,hashComments:!0,cStyleComments:!0,types:p}),["c","cc","cpp","cxx","cyc","m"]),ie(Te({keywords:"null,true,false"}),["json"]),ie(Te({keywords:_,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:p}),["cs"]),ie(Te({keywords:O,cStyleComments:!0}),["java"]),ie(Te({keywords:l,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ie(Te({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ie(Te({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ie(Te({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ie(Te({keywords:v,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ie(Te({keywords:x,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ie(oe([],[[f,/^[\s\S]+/]]),["regex"]);function J(be){var ge=be.langExtension;try{var Se=P(be.sourceNode,be.pre),Le=Se.sourceCode;be.sourceCode=Le,be.spans=Se.spans,be.basePos=0,pe(ge,Le)(be),le(be)}catch(Me){U.console&&console.log(Me&&Me.stack||Me)}}function ne(be,ge,Se){var Le=Se||!1,Me=ge||null,_e=document.createElement("div");_e.innerHTML="<pre>"+be+"</pre>",_e=_e.firstChild,Le&&he(_e,Le,!0);var Ae={langExtension:Me,numberLines:Le,sourceNode:_e,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return J(Ae),_e.innerHTML}function q(be,ge){var Se=ge||document.body,Le=Se.ownerDocument||document;function Me(de){return Se.getElementsByTagName(de)}for(var _e=[Me("pre"),Me("code"),Me("xmp")],Ae=[],je=0;je<_e.length;++je)for(var ze=0,Ne=_e[je].length;ze<Ne;++ze)Ae.push(_e[je][ze]);_e=null;var We=Date;We.now||(We={now:function(){return+new Date}});var et=0,Xe=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ye=/\bprettyprint\b/,Oe=/\bprettyprinted\b/,tt=/pre|xmp/i,$e=/^code$/i,Pe=/^(?:pre|code|xmp)$/i,Fe={};function ve(){for(var de=U.PR_SHOULD_USE_CONTINUATION?We.now()+250:Infinity;et<Ae.length&&We.now()<de;et++){for(var ce=Ae[et],X=Fe,Q=ce;Q=Q.previousSibling;){var te=Q.nodeType,se=(te===7||te===8)&&Q.nodeValue;if(se?!/^\??prettify\b/.test(se):te!==3||/\S/.test(Q.nodeValue))break;if(se){X={},se.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ut,Et,_r){X[Et]=_r});break}}var fe=ce.className;if((X!==Fe||Ye.test(fe))&&!Oe.test(fe)){for(var De=!1,Re=ce.parentNode;Re;Re=Re.parentNode){var Ie=Re.tagName;if(Pe.test(Ie)&&Re.className&&Ye.test(Re.className)){De=!0;break}}if(!De){ce.className+=" prettyprinted";var Ze=X.lang;if(!Ze){Ze=fe.match(Xe);var Ve;!Ze&&(Ve=ee(ce))&&$e.test(Ve.tagName)&&(Ze=Ve.className.match(Xe)),Ze&&(Ze=Ze[1])}var mt;if(tt.test(ce.tagName))mt=1;else{var dt=ce.currentStyle,st=Le.defaultView,_t=dt?dt.whiteSpace:st&&st.getComputedStyle?st.getComputedStyle(ce,null).getPropertyValue("white-space"):0;mt=_t&&_t.substring(0,3)==="pre"}var bt=X.linenums;(bt=bt==="true"||+bt)||(bt=fe.match(/\blinenums\b(?::(\d+))?/),bt=bt?bt[1]&&bt[1].length?+bt[1]:!0:!1),bt&&he(ce,bt,mt);var Bt={langExtension:Ze,sourceNode:ce,numberLines:bt,pre:mt,sourceCode:null,basePos:null,spans:null,decorations:null};J(Bt)}}}et<Ae.length?U.setTimeout(ve,250):typeof be=="function"&&be()}ve()}var xe=U.PR={createSimpleLexer:oe,registerLangHandler:ie,sourceDecorator:Te,PR_ATTRIB_NAME:M,PR_ATTRIB_VALUE:F,PR_COMMENT:b,PR_DECLARATION:m,PR_KEYWORD:C,PR_LITERAL:c,PR_NOCODE:j,PR_PLAIN:a,PR_PUNCTUATION:s,PR_SOURCE:E,PR_STRING:f,PR_TAG:g,PR_TYPE:h,prettyPrintOne:L?U.prettyPrintOne=ne:R=ne,prettyPrint:B=L?U.prettyPrint=q:B=q},Ce=U.define;typeof Ce=="function"&&Ce.amd&&Ce("google-code-prettify",[],function(){return xe})})()},"VrN/":function(ot,Ge,Z){(function(re,G){ot.exports=G()})(this,function(){"use strict";var re=navigator.userAgent,G=navigator.platform,L=/gecko\/\d/i.test(re),z=/MSIE \d/.test(re),I=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(re),R=/Edge\/(\d+)/.exec(re),B=z||I||R,U=B&&(z?document.documentMode||6:+(R||I)[1]),k=!R&&/WebKit\//.test(re),A=k&&/Qt\/\d+\.\d+/.test(re),y=!R&&/Chrome\//.test(re),S=/Opera\//.test(re),O=/Apple Computer/.test(navigator.vendor),_=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(re),x=/PhantomJS/.test(re),v=!R&&/AppleWebKit/.test(re)&&/Mobile\/\w+/.test(re),d=/Android/.test(re),o=v||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(re),u=v||/Mac/.test(G),l=/\bCrOS\b/.test(re),w=/win/i.test(G),p=S&&re.match(/Version\/(\d*\.\d*)/);p&&(p=Number(p[1])),p&&p>=15&&(S=!1,k=!0);var f=u&&(A||S&&(p==null||p<12.11)),C=L||B&&U>=9;function b(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var h=function(e,t){var n=e.className,r=b(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function c(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function s(e,t){return c(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var T=0;T<t.length;++T)i.appendChild(t[T]);return i}function g(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var m;document.createRange?m=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:m=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function E(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function M(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function F(e,t){var n=e.className;b(t).test(n)||(e.className+=(n?" ":"")+t)}function j(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!b(n[r]).test(t)&&(t+=" "+n[r]);return t}var W=function(e){e.select()};v?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:B&&(W=function(e){try{e.select()}catch(t){}});function D(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function P(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function H(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var T=r||0,N=i||0;;){var K=e.indexOf(" ",T);if(K<0||K>=t)return N+(t-T);N+=K-T,N+=n-N%n,T=K+1}}var Y=function(){this.id=null,this.f=null,this.time=0,this.handler=D(this.onTimeout,this)};Y.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Y.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function ee(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var oe=50,Te={toString:function(){return"CodeMirror.Pass"}},ye={scroll:!1},he={origin:"*mouse"},le={origin:"+move"};function me(e,t,n){for(var r=0,i=0;;){var T=e.indexOf(" ",r);T==-1&&(T=e.length);var N=T-r;if(T==e.length||i+N>=t)return r+Math.min(N,t-i);if(i+=T-r,i+=n-i%n,r=T+1,i>=t)return r}}var ie=[""];function pe(e){for(;ie.length<=e;)ie.push(J(ie)+" ");return ie[e]}function J(e){return e[e.length-1]}function ne(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function q(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function xe(){}function Ce(e,t){var n;return Object.create?n=Object.create(e):(xe.prototype=e,n=new xe),t&&P(t,n),n}var be=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ge(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||be.test(e))}function Se(e,t){return t?t.source.indexOf("\\w")>-1&&ge(e)?!0:t.test(e):ge(e)}function Le(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Me=/[\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 _e(e){return e.charCodeAt(0)>=768&&Me.test(e)}function Ae(e,t,n){for(;(n<0?t>0:t<e.length)&&_e(e.charAt(t));)t+=n;return t}function je(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,T=r<0?Math.ceil(i):Math.floor(i);if(T==t)return e(T)?t:n;e(T)?n=T:t=T+r}}function ze(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,T=0;T<e.length;++T){var N=e[T];(N.from<n&&N.to>t||t==n&&N.to==t)&&(r(Math.max(N.from,t),Math.min(N.to,n),N.level==1?"rtl":"ltr",T),i=!0)}i||r(t,n,"ltr")}var Ne=null;function We(e,t,n){var r;Ne=null;for(var i=0;i<e.length;++i){var T=e[i];if(T.from<t&&T.to>t)return i;T.to==t&&(T.from!=T.to&&n=="before"?r=i:Ne=i),T.from==t&&(T.from!=T.to&&n!="before"?r=i:Ne=i)}return r!=null?r:Ne}var et=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n($){return $<=247?e.charAt($):1424<=$&&$<=1524?"R":1536<=$&&$<=1785?t.charAt($-1536):1774<=$&&$<=2220?"r":8192<=$&&$<=8203?"w":$==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,T=/[LRr]/,N=/[Lb1n]/,K=/[1n]/;function V($,ae,ue){this.level=$,this.from=ae,this.to=ue}return function($,ae){var ue=ae=="ltr"?"L":"R";if($.length==0||ae=="ltr"&&!r.test($))return!1;for(var we=$.length,Ee=[],ke=0;ke<we;++ke)Ee.push(n($.charCodeAt(ke)));for(var Ue=0,Ke=ue;Ue<we;++Ue){var Je=Ee[Ue];Je=="m"?Ee[Ue]=Ke:Ke=Je}for(var qe=0,Qe=ue;qe<we;++qe){var rt=Ee[qe];rt=="1"&&Qe=="r"?Ee[qe]="n":T.test(rt)&&(Qe=rt,rt=="r"&&(Ee[qe]="R"))}for(var ut=1,at=Ee[0];ut<we-1;++ut){var pt=Ee[ut];pt=="+"&&at=="1"&&Ee[ut+1]=="1"?Ee[ut]="1":pt==","&&at==Ee[ut+1]&&(at=="1"||at=="n")&&(Ee[ut]=at),at=pt}for(var Lt=0;Lt<we;++Lt){var Ht=Ee[Lt];if(Ht==",")Ee[Lt]="N";else if(Ht=="%"){var Ot=void 0;for(Ot=Lt+1;Ot<we&&Ee[Ot]=="%";++Ot);for(var sr=Lt&&Ee[Lt-1]=="!"||Ot<we&&Ee[Ot]=="1"?"1":"N",nr=Lt;nr<Ot;++nr)Ee[nr]=sr;Lt=Ot-1}}for(var kt=0,ir=ue;kt<we;++kt){var Gt=Ee[kt];ir=="L"&&Gt=="1"?Ee[kt]="L":T.test(Gt)&&(ir=Gt)}for(var Nt=0;Nt<we;++Nt)if(i.test(Ee[Nt])){var It=void 0;for(It=Nt+1;It<we&&i.test(Ee[It]);++It);for(var Pt=(Nt?Ee[Nt-1]:ue)=="L",ar=(It<we?Ee[It]:ue)=="L",jn=Pt==ar?Pt?"L":"R":ue,Jr=Nt;Jr<It;++Jr)Ee[Jr]=jn;Nt=It-1}for(var Yt=[],Or,Kt=0;Kt<we;)if(N.test(Ee[Kt])){var Va=Kt;for(++Kt;Kt<we&&N.test(Ee[Kt]);++Kt);Yt.push(new V(0,Va,Kt))}else{var jr=Kt,fn=Yt.length,hn=ae=="rtl"?1:0;for(++Kt;Kt<we&&Ee[Kt]!="L";++Kt);for(var Qt=jr;Qt<Kt;)if(K.test(Ee[Qt])){jr<Qt&&(Yt.splice(fn,0,new V(1,jr,Qt)),fn+=hn);var Wn=Qt;for(++Qt;Qt<Kt&&K.test(Ee[Qt]);++Qt);Yt.splice(fn,0,new V(2,Wn,Qt)),fn+=hn,jr=Qt}else++Qt;jr<Kt&&Yt.splice(fn,0,new V(1,jr,Kt))}return ae=="ltr"&&(Yt[0].level==1&&(Or=$.match(/^\s+/))&&(Yt[0].from=Or[0].length,Yt.unshift(new V(0,0,Or[0].length))),J(Yt).level==1&&(Or=$.match(/\s+$/))&&(J(Yt).to-=Or[0].length,Yt.push(new V(0,we-Or[0].length,we)))),ae=="rtl"?Yt.reverse():Yt}}();function Xe(e,t){var n=e.order;return n==null&&(n=e.order=et(e.text,t)),n}var Ye=[],Oe=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Ye).concat(n)}};function tt(e,t){return e._handlers&&e._handlers[t]||Ye}function $e(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var T=ee(i,n);T>-1&&(r[t]=i.slice(0,T).concat(i.slice(T+1)))}}}function Pe(e,t){var n=tt(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Fe(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Pe(e,n||t.type,e,t),te(t)||t.codemirrorIgnore}function ve(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)ee(n,t[r])==-1&&n.push(t[r])}function de(e,t){return tt(e,t).length>0}function ce(e){e.prototype.on=function(t,n){Oe(this,t,n)},e.prototype.off=function(t,n){$e(this,t,n)}}function X(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Q(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function te(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function se(e){X(e),Q(e)}function fe(e){return e.target||e.srcElement}function De(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 Re=function(){if(B&&U<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),Ie;function Ze(e){if(Ie==null){var t=a("span","\u200B");s(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ie=t.offsetWidth<=1&&t.offsetHeight>2&&!(B&&U<8))}var n=Ie?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var Ve;function mt(e){if(Ve!=null)return Ve;var t=s(e,document.createTextNode("A\u062EA")),n=m(t,0,1).getBoundingClientRect(),r=m(t,1,2).getBoundingClientRect();return c(e),!n||n.left==n.right?!1:Ve=r.right-n.right<3}var dt=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
|
|
`,t);i==-1&&(i=e.length);var T=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),N=T.indexOf("\r");N!=-1?(n.push(T.slice(0,N)),t+=N+1):(n.push(T),t=i+1)}return n}: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(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},_t=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),bt=null;function Bt(e){if(bt!=null)return bt;var t=s(e,a("span","x")),n=t.getBoundingClientRect(),r=m(t,0,1).getBoundingClientRect();return bt=Math.abs(n.left-r.left)>1}var Ut={},Et={};function _r(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ut[e]=t}function Rr(e,t){Et[e]=t}function lr(e){if(typeof e=="string"&&Et.hasOwnProperty(e))e=Et[e];else if(e&&typeof e.name=="string"&&Et.hasOwnProperty(e.name)){var t=Et[e.name];typeof t=="string"&&(t={name:t}),e=Ce(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return lr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return lr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function pr(e,t){t=lr(t);var n=Ut[t.name];if(!n)return pr(e,"text/plain");var r=n(e,t);if(fr.hasOwnProperty(t.name)){var i=fr[t.name];for(var T in i){if(!i.hasOwnProperty(T))continue;r.hasOwnProperty(T)&&(r["_"+T]=r[T]),r[T]=i[T]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var N in t.modeProps)r[N]=t.modeProps[N];return r}var fr={};function ia(e,t){var n=fr.hasOwnProperty(e)?fr[e]:fr[e]={};P(t,n)}function Cr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Hn(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Kn(e,t,n){return e.startState?e.startState(t,n):!0}var Rt=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Rt.prototype.eol=function(){return this.pos>=this.string.length},Rt.prototype.sol=function(){return this.pos==this.lineStart},Rt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Rt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Rt.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},Rt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Rt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Rt.prototype.skipToEnd=function(){this.pos=this.string.length},Rt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Rt.prototype.backUp=function(e){this.pos-=e},Rt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=H(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Rt.prototype.indentation=function(){return H(this.string,null,this.tabSize)-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Rt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(N){return n?N.toLowerCase():N},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var T=this.string.slice(this.pos).match(e);return T&&T.index>0?null:(T&&t!==!1&&(this.pos+=T[0].length),T)}},Rt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Rt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Rt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Rt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function nt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],T=i.chunkSize();if(t<T){n=i;break}t-=T}return n.lines[t]}function Pr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(T){var N=T.text;i==n.line&&(N=N.slice(0,n.ch)),i==t.line&&(N=N.slice(t.ch)),r.push(N),++i}),r}function mn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function Zt(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Tt(e){if(e.parent==null)return null;for(var t=e.parent,n=ee(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;!(r.children[i]==t);++i)n+=r.children[i].chunkSize();return n+t.first}function gr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],T=i.height;if(t<T){e=i;continue e}t-=T,n+=i.chunkSize()}return n}while(!e.lines);for(var N=0;N<e.lines.length;++N){var K=e.lines[N],V=K.height;if(t<V)break;t-=V}return n+N}function Mr(e,t){return t>=e.first&&t<e.first+e.size}function pn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Be(e,t,n){if(n===void 0&&(n=null),!(this instanceof Be))return new Be(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ct(e,t){return e.line-t.line||e.ch-t.ch}function zn(e,t){return e.sticky==t.sticky&&ct(e,t)==0}function gn(e){return Be(e.line,e.ch)}function vn(e,t){return ct(e,t)<0?t:e}function Qr(e,t){return ct(e,t)<0?e:t}function yn(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ht(e,t){if(t.line<e.first)return Be(e.first,0);var n=e.first+e.size-1;return t.line>n?Be(n,nt(e,n).text.length):Ci(t,nt(e,t.line).text.length)}function Ci(e,t){var n=e.ch;return n==null||n>t?Be(e.line,t):n<0?Be(e.line,0):e}function He(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ht(e,t[r]);return n}var bn=function(e,t){this.state=e,this.lookAhead=t},hr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};hr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},hr.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}},hr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},hr.fromSaved=function(e,t,n){return t instanceof bn?new hr(e,Cr(e.mode,t.state),n,t.lookAhead):new hr(e,Cr(e.mode,t),n)},hr.prototype.save=function(e){var t=e!==!1?Cr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new bn(t,this.maxLookAhead):t};function Gn(e,t,n,r){var i=[e.state.modeGen],T={};br(e,t.text,e.doc.mode,n,function($,ae){return i.push($,ae)},T,r);for(var N=n.state,K=function($){n.baseTokens=i;var ae=e.state.overlays[$],ue=1,we=0;n.state=!0,br(e,t.text,ae.mode,n,function(Ee,ke){for(var Ue=ue;we<Ee;){var Ke=i[ue];Ke>Ee&&i.splice(ue,1,Ee,i[ue+1],Ke),ue+=2,we=Math.min(Ee,Ke)}if(!ke)return;if(ae.opaque)i.splice(Ue,ue-Ue,Ee,"overlay "+ke),ue=Ue+2;else for(;Ue<ue;Ue+=2){var Je=i[Ue+1];i[Ue+1]=(Je?Je+" ":"")+"overlay "+ke}},T),n.state=N,n.baseTokens=null,n.baseTokenPos=1},V=0;V<e.state.overlays.length;++V)K(V);return{styles:i,classes:T.bgClass||T.textClass?T:null}}function Zr(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=vr(e,Tt(t)),i=t.text.length>e.options.maxHighlightLength&&Cr(e.doc.mode,r.state),T=Gn(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=T.styles,T.classes?t.styleClasses=T.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function vr(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new hr(r,!0,t);var T=Li(e,t,n),N=T>r.first&&nt(r,T-1).stateAfter,K=N?hr.fromSaved(r,N,T):new hr(r,Kn(r.mode),T);return r.iter(T,t,function(V){Vn(e,V.text,K);var $=K.line;V.stateAfter=$==t-1||$%5==0||$>=i.viewFrom&&$<i.viewTo?K.save():null,K.nextLine()}),n&&(r.modeFrontier=K.line),K}function Vn(e,t,n,r){var i=e.doc.mode,T=new Rt(t,e.options.tabSize,n);for(T.start=T.pos=r||0,t==""&&Xn(i,n.state);!T.eol();)yr(i,T,n.state),T.start=T.pos}function Xn(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Hn(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function yr(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Hn(e,n).mode);var T=e.token(t,n);if(t.pos>t.start)return T}throw new Error("Mode "+e.name+" failed to advance stream.")}var Yn=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Ai(e,t,n,r){var i=e.doc,T=i.mode,N;t=ht(i,t);var K=nt(i,t.line),V=vr(e,t.line,n),$=new Rt(K.text,e.options.tabSize,V),ae;for(r&&(ae=[]);(r||$.pos<t.ch)&&!$.eol();)$.start=$.pos,N=yr(T,$,V.state),r&&ae.push(new Yn($,N,Cr(i.mode,V.state)));return r?ae:new Yn($,N,V.state)}function $n(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function br(e,t,n,r,i,T,N){var K=n.flattenSpans;K==null&&(K=e.options.flattenSpans);var V=0,$=null,ae=new Rt(t,e.options.tabSize,r),ue,we=e.options.addModeClass&&[null];for(t==""&&$n(Xn(n,r.state),T);!ae.eol();){if(ae.pos>e.options.maxHighlightLength?(K=!1,N&&Vn(e,t,r,ae.pos),ae.pos=t.length,ue=null):ue=$n(yr(n,ae,r.state,we),T),we){var Ee=we[0].name;Ee&&(ue="m-"+(ue?Ee+" "+ue:Ee))}if(!K||$!=ue){for(;V<ae.start;)V=Math.min(ae.start,V+5e3),i(V,$);$=ue}ae.start=ae.pos}for(;V<ae.pos;){var ke=Math.min(ae.pos,V+5e3);i(ke,$),V=ke}}function Li(e,t,n){for(var r,i,T=e.doc,N=n?-1:t-(e.doc.mode.innerMode?1e3:100),K=t;K>N;--K){if(K<=T.first)return T.first;var V=nt(T,K-1),$=V.stateAfter;if($&&(!n||K+($ instanceof bn?$.lookAhead:0)<=T.modeFrontier))return K;var ae=H(V.text,null,e.options.tabSize);(i==null||r>ae)&&(i=K-1,r=ae)}return i}function aa(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var i=nt(e,r).stateAfter;if(i&&(!(i instanceof bn)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Jn=!1,$t=!1;function Wr(){Jn=!0}function oa(){$t=!0}function qr(e,t,n){this.marker=e,this.from=t,this.to=n}function Er(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Qn(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function sa(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Di(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var T=e[i],N=T.marker,K=T.from==null||(N.inclusiveLeft?T.from<=t:T.from<t);if(K||T.from==t&&N.type=="bookmark"&&(!n||!T.marker.insertLeft)){var V=T.to==null||(N.inclusiveRight?T.to>=t:T.to>t);(r||(r=[])).push(new qr(N,T.from,V?null:T.to))}}return r}function Oi(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var T=e[i],N=T.marker,K=T.to==null||(N.inclusiveRight?T.to>=t:T.to>t);if(K||T.from==t&&N.type=="bookmark"&&(!n||T.marker.insertLeft)){var V=T.from==null||(N.inclusiveLeft?T.from<=t:T.from<t);(r||(r=[])).push(new qr(N,V?null:T.from-t,T.to==null?null:T.to-t))}}return r}function En(e,t){if(t.full)return null;var n=Mr(e,t.from.line)&&nt(e,t.from.line).markedSpans,r=Mr(e,t.to.line)&&nt(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,T=t.to.ch,N=ct(t.from,t.to)==0,K=Di(n,i,N),V=Oi(r,T,N),$=t.text.length==1,ae=J(t.text).length+($?i:0);if(K)for(var ue=0;ue<K.length;++ue){var we=K[ue];if(we.to==null){var Ee=Er(V,we.marker);Ee?$&&(we.to=Ee.to==null?null:Ee.to+ae):we.to=i}}if(V)for(var ke=0;ke<V.length;++ke){var Ue=V[ke];if(Ue.to!=null&&(Ue.to+=ae),Ue.from==null){var Ke=Er(K,Ue.marker);Ke||(Ue.from=ae,$&&(K||(K=[])).push(Ue))}else Ue.from+=ae,$&&(K||(K=[])).push(Ue)}K&&(K=Ri(K)),V&&V!=K&&(V=Ri(V));var Je=[K];if(!$){var qe=t.text.length-2,Qe;if(qe>0&&K)for(var rt=0;rt<K.length;++rt)K[rt].to==null&&(Qe||(Qe=[])).push(new qr(K[rt].marker,null,null));for(var ut=0;ut<qe;++ut)Je.push(Qe);Je.push(V)}return Je}function Ri(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Pi(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(Ee){if(Ee.markedSpans)for(var ke=0;ke<Ee.markedSpans.length;++ke){var Ue=Ee.markedSpans[ke].marker;Ue.readOnly&&(!r||ee(r,Ue)==-1)&&(r||(r=[])).push(Ue)}}),!r)return null;for(var i=[{from:t,to:n}],T=0;T<r.length;++T)for(var N=r[T],K=N.find(0),V=0;V<i.length;++V){var $=i[V];if(ct($.to,K.from)<0||ct($.from,K.to)>0)continue;var ae=[V,1],ue=ct($.from,K.from),we=ct($.to,K.to);(ue<0||!N.inclusiveLeft&&!ue)&&ae.push({from:$.from,to:K.from}),(we>0||!N.inclusiveRight&&!we)&&ae.push({from:K.to,to:$.to}),i.splice.apply(i,ae),V+=ae.length-3}return i}function la(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function xn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function en(e){return e.inclusiveLeft?-1:0}function tn(e){return e.inclusiveRight?1:0}function Tn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),T=ct(r.from,i.from)||en(e)-en(t);if(T)return-T;var N=ct(r.to,i.to)||tn(e)-tn(t);return N||t.id-e.id}function kr(e,t){var n=$t&&e.markedSpans,r;if(n)for(var i=void 0,T=0;T<n.length;++T)i=n[T],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Tn(r,i.marker)<0)&&(r=i.marker);return r}function Ir(e){return kr(e,!0)}function Ur(e){return kr(e,!1)}function Sn(e,t){var n=$t&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var T=n[i];T.marker.collapsed&&(T.from==null||T.from<t)&&(T.to==null||T.to>t)&&(!r||Tn(r,T.marker)<0)&&(r=T.marker)}return r}function Mi(e,t,n,r,i){var T=nt(e,t),N=$t&&T.markedSpans;if(N)for(var K=0;K<N.length;++K){var V=N[K];if(!V.marker.collapsed)continue;var $=V.marker.find(0),ae=ct($.from,n)||en(V.marker)-en(i),ue=ct($.to,r)||tn(V.marker)-tn(i);if(ae>=0&&ue<=0||ae<=0&&ue>=0)continue;if(ae<=0&&(V.marker.inclusiveRight&&i.inclusiveLeft?ct($.to,n)>=0:ct($.to,n)>0)||ae>=0&&(V.marker.inclusiveRight&&i.inclusiveLeft?ct($.from,r)<=0:ct($.from,r)<0))return!0}}function ur(e){for(var t;t=Ir(e);)e=t.find(-1,!0).line;return e}function ki(e){for(var t;t=Ur(e);)e=t.find(1,!0).line;return e}function wn(e){for(var t,n;t=Ur(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Zn(e,t){var n=nt(e,t),r=ur(n);return n==r?t:Tt(r)}function Hr(e,t){if(t>e.lastLine())return t;var n=nt(e,t),r;if(!Ar(e,n))return t;for(;r=Ur(n);)n=r.find(1,!0).line;return Tt(n)+1}function Ar(e,t){var n=$t&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i){if(r=n[i],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&qn(e,t,r))return!0}}function qn(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return qn(e,r.line,Er(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,T=0;T<t.markedSpans.length;++T)if(i=t.markedSpans[T],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&qn(e,t,i))return!0}function xr(e){e=ur(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var T=n.parent;T;n=T,T=n.parent)for(var N=0;N<T.children.length;++N){var K=T.children[N];if(K==n)break;t+=K.height}return t}function ei(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Ir(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Ur(r);){var T=n.find(0,!0);t-=r.text.length-T.from.ch,r=T.to.line,t+=r.text.length-T.to.ch}return t}function Ii(e){var t=e.display,n=e.doc;t.maxLine=nt(n,n.first),t.maxLineLength=ei(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=ei(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var rn=function(e,t,n){this.text=e,xn(this,t),this.height=n?n(this):1};rn.prototype.lineNo=function(){return Tt(this)},ce(rn);function ua(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),la(e),xn(e,n);var i=r?r(e):1;i!=e.height&&Zt(e,i)}function it(e){e.parent=null,la(e)}var ft={},lt={};function gt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?lt:ft;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function xt(e,t){var n=g("span",null,null,k?"padding-right: .1px":null),r={pre:g("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var T=i?t.rest[i-1]:t.line,N=void 0;r.pos=0,r.addToken=yt,mt(e.display.measure)&&(N=Xe(T,e.doc.direction))&&(r.addToken=qt(r.addToken,N)),r.map=[];var K=t!=e.display.externalMeasured&&Tt(T);Fr(T,r,Zr(e,T,K)),T.styleClasses&&(T.styleClasses.bgClass&&(r.bgClass=j(T.styleClasses.bgClass,r.bgClass||"")),T.styleClasses.textClass&&(r.textClass=j(T.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Ze(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(k){var V=r.content.lastChild;(/\bcm-tab\b/.test(V.className)||V.querySelector&&V.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Pe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=j(r.pre.className,r.textClass||"")),r}function At(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function yt(e,t,n,r,i,T,N){if(!t)return;var K=e.splitSpaces?Ft(t,e.trailingSpace):t,V=e.cm.state.specialChars,$=!1,ae;if(!V.test(t))e.col+=t.length,ae=document.createTextNode(K),e.map.push(e.pos,e.pos+t.length,ae),B&&U<9&&($=!0),e.pos+=t.length;else{ae=document.createDocumentFragment();for(var ue=0;;){V.lastIndex=ue;var we=V.exec(t),Ee=we?we.index-ue:t.length-ue;if(Ee){var ke=document.createTextNode(K.slice(ue,ue+Ee));B&&U<9?ae.appendChild(a("span",[ke])):ae.appendChild(ke),e.map.push(e.pos,e.pos+Ee,ke),e.col+=Ee,e.pos+=Ee}if(!we)break;ue+=Ee+1;var Ue=void 0;if(we[0]==" "){var Ke=e.cm.options.tabSize,Je=Ke-e.col%Ke;Ue=ae.appendChild(a("span",pe(Je),"cm-tab")),Ue.setAttribute("role","presentation"),Ue.setAttribute("cm-text"," "),e.col+=Je}else we[0]=="\r"||we[0]==`
|
|
`?(Ue=ae.appendChild(a("span",we[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ue.setAttribute("cm-text",we[0]),e.col+=1):(Ue=e.cm.options.specialCharPlaceholder(we[0]),Ue.setAttribute("cm-text",we[0]),B&&U<9?ae.appendChild(a("span",[Ue])):ae.appendChild(Ue),e.col+=1);e.map.push(e.pos,e.pos+1,Ue),e.pos++}}if(e.trailingSpace=K.charCodeAt(t.length-1)==32,n||r||i||$||T||N){var qe=n||"";r&&(qe+=r),i&&(qe+=i);var Qe=a("span",[ae],qe,T);if(N)for(var rt in N)N.hasOwnProperty(rt)&&rt!="style"&&rt!="class"&&Qe.setAttribute(rt,N[rt]);return e.content.appendChild(Qe)}e.content.appendChild(ae)}function Ft(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var T=e.charAt(i);T==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(T="\xA0"),r+=T,n=T==" "}return r}function qt(e,t){return function(n,r,i,T,N,K,V){i=i?i+" cm-force-border":"cm-force-border";for(var $=n.pos,ae=$+r.length;;){for(var ue=void 0,we=0;we<t.length&&!(ue=t[we],ue.to>$&&ue.from<=$);we++);if(ue.to>=ae)return e(n,r,i,T,N,K,V);e(n,r.slice(0,ue.to-$),i,T,null,K,V),T=null,r=r.slice(ue.to-$),$=ue.to}}}function vt(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Fr(e,t,n){var r=e.markedSpans,i=e.text,T=0;if(!r){for(var N=1;N<n.length;N+=2)t.addToken(t,i.slice(T,T=n[N]),gt(n[N+1],t.cm.options));return}for(var K=i.length,V=0,$=1,ae="",ue,we,Ee=0,ke,Ue,Ke,Je,qe;;){if(Ee==V){ke=Ue=Ke=we="",qe=null,Je=null,Ee=Infinity;for(var Qe=[],rt=void 0,ut=0;ut<r.length;++ut){var at=r[ut],pt=at.marker;if(pt.type=="bookmark"&&at.from==V&&pt.widgetNode)Qe.push(pt);else if(at.from<=V&&(at.to==null||at.to>V||pt.collapsed&&at.to==V&&at.from==V)){if(at.to!=null&&at.to!=V&&Ee>at.to&&(Ee=at.to,Ue=""),pt.className&&(ke+=" "+pt.className),pt.css&&(we=(we?we+";":"")+pt.css),pt.startStyle&&at.from==V&&(Ke+=" "+pt.startStyle),pt.endStyle&&at.to==Ee&&(rt||(rt=[])).push(pt.endStyle,at.to),pt.title&&((qe||(qe={})).title=pt.title),pt.attributes)for(var Lt in pt.attributes)(qe||(qe={}))[Lt]=pt.attributes[Lt];pt.collapsed&&(!Je||Tn(Je.marker,pt)<0)&&(Je=at)}else at.from>V&&Ee>at.from&&(Ee=at.from)}if(rt)for(var Ht=0;Ht<rt.length;Ht+=2)rt[Ht+1]==Ee&&(Ue+=" "+rt[Ht]);if(!Je||Je.from==V)for(var Ot=0;Ot<Qe.length;++Ot)vt(t,0,Qe[Ot]);if(Je&&(Je.from||0)==V){if(vt(t,(Je.to==null?K+1:Je.to)-V,Je.marker,Je.from==null),Je.to==null)return;Je.to==V&&(Je=!1)}}if(V>=K)break;for(var sr=Math.min(K,Ee);;){if(ae){var nr=V+ae.length;if(!Je){var kt=nr>sr?ae.slice(0,sr-V):ae;t.addToken(t,kt,ue?ue+ke:ke,Ke,V+kt.length==Ee?Ue:"",we,qe)}if(nr>=sr){ae=ae.slice(sr-V),V=sr;break}V=nr,Ke=""}ae=i.slice(T,T=n[$++]),ue=gt(n[$++],t.cm.options)}}}function St(e,t,n){this.line=t,this.rest=wn(t),this.size=this.rest?Tt(J(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Ar(e,t)}function er(e,t,n){for(var r=[],i,T=t;T<n;T=i){var N=new St(e.doc,nt(e.doc,T),T);i=T+N.size,r.push(N)}return r}var Vt=null;function mr(e){Vt?Vt.ops.push(e):e.ownsGroup=Vt={ops:[e],delayedCallbacks:[]}}function Os(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Rs(e,t){var n=e.ownsGroup;if(!n)return;try{Os(n)}finally{Vt=null,t(n)}}var ti=null;function zt(e,t){var n=tt(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Vt?i=Vt.delayedCallbacks:ti?i=ti:(i=ti=[],setTimeout(Ps,0));for(var T=function(K){i.push(function(){return n[K].apply(null,r)})},N=0;N<n.length;++N)T(N)}function Ps(){var e=ti;ti=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,n,r){for(var i=0;i<t.changes.length;i++){var T=t.changes[i];T=="text"?ks(e,t):T=="gutter"?Ja(e,t,n,r):T=="class"?da(e,t):T=="widget"&&Is(e,t,r)}t.changes=null}function ri(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),B&&U<8&&(e.node.style.zIndex=2)),e.node}function Ms(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=ri(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):xt(e,t)}function ks(e,t){var n=t.text.className,r=$a(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,da(e,t)):n&&(t.text.className=n)}function da(e,t){Ms(e,t),t.line.wrapClass?ri(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Ja(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=ri(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var T=t.line.gutterMarkers;if(e.options.lineNumbers||T){var N=ri(t),K=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(K),N.insertBefore(K,t.text),t.line.gutterClass&&(K.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!T||!T["CodeMirror-linenumbers"])&&(t.lineNumber=K.appendChild(a("div",pn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),T)for(var V=0;V<e.display.gutterSpecs.length;++V){var $=e.display.gutterSpecs[V].className,ae=T.hasOwnProperty($)&&T[$];ae&&K.appendChild(a("div",[ae],"CodeMirror-gutter-elt","left: "+r.gutterLeft[$]+"px; width: "+r.gutterWidth[$]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=b("CodeMirror-linewidget"),i=t.node.firstChild,T=void 0;i;i=T)T=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Qa(e,t,n)}function Us(e,t,n,r){var i=$a(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),da(e,t),Ja(e,t,n,r),Qa(e,t,r),t.node}function Qa(e,t,n){if(Za(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Za(e,t.rest[r],t,n,!1)}function Za(e,t,n,r,i){if(!t.widgets)return;for(var T=ri(n),N=0,K=t.widgets;N<K.length;++N){var V=K[N],$=a("div",[V.node],"CodeMirror-linewidget"+(V.className?" "+V.className:""));V.handleMouseEvents||$.setAttribute("cm-ignore-events","true"),Fs(V,$,n,r),e.display.input.setUneditable($),i&&V.above?T.insertBefore($,n.gutter||n.text):T.appendChild($),zt(V,"redraw")}}function Fs(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function ni(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!E(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),s(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Nr(e,t){for(var n=fe(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Ui(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=s(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Lr(e){return oe-e.display.nativeBarWidth}function nn(e){return e.display.scroller.clientWidth-Lr(e)-e.display.barWidth}function fa(e){return e.display.scroller.clientHeight-Lr(e)-e.display.barHeight}function Ns(e,t,n){var r=e.options.lineWrapping,i=r&&nn(e);if(!t.measure.heights||r&&t.measure.width!=i){var T=t.measure.heights=[];if(r){t.measure.width=i;for(var N=t.text.firstChild.getClientRects(),K=0;K<N.length-1;K++){var V=N[K],$=N[K+1];Math.abs(V.bottom-$.bottom)>2&&T.push((V.bottom+$.top)/2-n.top)}}T.push(n.bottom-n.top)}}function eo(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(Tt(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=ur(t);var n=Tt(t),r=e.display.externalMeasured=new St(e.doc,t,n);r.lineN=n;var i=r.built=xt(e,r);return r.text=i.pre,s(e.display.lineMeasure,i.pre),r}function to(e,t,n,r){return Dr(e,_n(e,t),n,r)}function ha(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[sn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function _n(e,t){var n=Tt(t),r=ha(e,n);r&&!r.text?r=null:r&&r.changes&&(Ya(e,r,n,ba(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=eo(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Dr(e,t,n,r,i){t.before&&(n=-1);var T=n+(r||""),N;return t.cache.hasOwnProperty(T)?N=t.cache[T]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ns(e,t.view,t.rect),t.hasHeights=!0),N=Ws(e,t,n,r),N.bogus||(t.cache[T]=N)),{left:N.left,right:N.right,top:i?N.rtop:N.top,bottom:i?N.rbottom:N.bottom}}var ro={left:0,right:0,top:0,bottom:0};function no(e,t,n){for(var r,i,T,N,K,V,$=0;$<e.length;$+=3)if(K=e[$],V=e[$+1],t<K?(i=0,T=1,N="left"):t<V?(i=t-K,T=i+1):($==e.length-3||t==V&&e[$+3]>t)&&(T=V-K,i=T-1,t>=V&&(N="right")),i!=null){if(r=e[$+2],K==V&&n==(r.insertLeft?"left":"right")&&(N=n),n=="left"&&i==0)for(;$&&e[$-2]==e[$-3]&&e[$-1].insertLeft;)r=e[($-=3)+2],N="left";if(n=="right"&&i==V-K)for(;$<e.length-3&&e[$+3]==e[$+4]&&!e[$+5].insertLeft;)r=e[($+=3)+2],N="right";break}return{node:r,start:i,end:T,collapse:N,coverStart:K,coverEnd:V}}function js(e,t){var n=ro;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=no(t.map,n,r),T=i.node,N=i.start,K=i.end,V=i.collapse,$;if(T.nodeType==3){for(var ae=0;ae<4;ae++){for(;N&&_e(t.line.text.charAt(i.coverStart+N));)--N;for(;i.coverStart+K<i.coverEnd&&_e(t.line.text.charAt(i.coverStart+K));)++K;if(B&&U<9&&N==0&&K==i.coverEnd-i.coverStart?$=T.parentNode.getBoundingClientRect():$=js(m(T,N,K).getClientRects(),r),$.left||$.right||N==0)break;K=N,N=N-1,V="right"}B&&U<11&&($=Hs(e.display.measure,$))}else{N>0&&(V=r="right");var ue;e.options.lineWrapping&&(ue=T.getClientRects()).length>1?$=ue[r=="right"?ue.length-1:0]:$=T.getBoundingClientRect()}if(B&&U<9&&!N&&(!$||!$.left&&!$.right)){var we=T.parentNode.getClientRects()[0];we?$={left:we.left,right:we.left+An(e.display),top:we.top,bottom:we.bottom}:$=ro}for(var Ee=$.top-t.rect.top,ke=$.bottom-t.rect.top,Ue=(Ee+ke)/2,Ke=t.view.measure.heights,Je=0;Je<Ke.length-1&&!(Ue<Ke[Je]);Je++);var qe=Je?Ke[Je-1]:0,Qe=Ke[Je],rt={left:(V=="right"?$.right:$.left)-t.rect.left,right:(V=="left"?$.left:$.right)-t.rect.left,top:qe,bottom:Qe};return!$.left&&!$.right&&(rt.bogus=!0),e.options.singleCursorHeightPerLine||(rt.rtop=Ee,rt.rbottom=ke),rt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Bt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function io(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function ao(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)io(e.display.view[t])}function ii(e){ao(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function oo(){return y&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return y&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ma(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=ni(e.widgets[n]));return t}function Fi(e,t,n,r,i){if(!i){var T=ma(t);n.top+=T,n.bottom+=T}if(r=="line")return n;r||(r="local");var N=xr(t);if(r=="local"?N+=Ui(e.display):N-=e.display.viewOffset,r=="page"||r=="window"){var K=e.display.lineSpace.getBoundingClientRect();N+=K.top+(r=="window"?0:so());var V=K.left+(r=="window"?0:oo());n.left+=V,n.right+=V}return n.top+=N,n.bottom+=N,n}function lo(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=oo(),i-=so();else if(n=="local"||!n){var T=e.display.sizer.getBoundingClientRect();r+=T.left,i+=T.top}var N=e.display.lineSpace.getBoundingClientRect();return{left:r-N.left,top:i-N.top}}function pa(e,t,n,r,i){return r||(r=nt(e.doc,t.line)),Fi(e,r,to(e,r,t.ch,i),n)}function Tr(e,t,n,r,i,T){r=r||nt(e.doc,t.line),i||(i=_n(e,r));function N(ke,Ue){var Ke=Dr(e,i,ke,Ue?"right":"left",T);return Ue?Ke.left=Ke.right:Ke.right=Ke.left,Fi(e,r,Ke,n)}var K=Xe(r,e.doc.direction),V=t.ch,$=t.sticky;if(V>=r.text.length?(V=r.text.length,$="before"):V<=0&&(V=0,$="after"),!K)return N($=="before"?V-1:V,$=="before");function ae(ke,Ue,Ke){var Je=K[Ue],qe=Je.level==1;return N(Ke?ke-1:ke,qe!=Ke)}var ue=We(K,V,$),we=Ne,Ee=ae(V,ue,$=="before");return we!=null&&(Ee.other=ae(V,we,$!="before")),Ee}function uo(e,t){var n=0;t=ht(e.doc,t),e.options.lineWrapping||(n=An(e.display)*t.ch);var r=nt(e.doc,t.line),i=xr(r)+Ui(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function ga(e,t,n,r,i){var T=Be(e,t,n);return T.xRel=i,r&&(T.outside=r),T}function va(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return ga(r.first,0,null,-1,-1);var i=gr(r,n),T=r.first+r.size-1;if(i>T)return ga(r.first+r.size-1,nt(r,T).text.length,null,1,1);t<0&&(t=0);for(var N=nt(r,i);;){var K=Ks(e,N,i,t,n),V=Sn(N,K.ch+(K.xRel>0||K.outside>0?1:0));if(!V)return K;var $=V.find(1);if($.line==i)return $;N=nt(r,i=$.line)}}function co(e,t,n,r){r-=ma(t);var i=t.text.length,T=je(function(N){return Dr(e,n,N-1).bottom<=r},i,0);return i=je(function(N){return Dr(e,n,N).top>r},T,i),{begin:T,end:i}}function fo(e,t,n,r){n||(n=_n(e,t));var i=Fi(e,t,Dr(e,n,r),"line").top;return co(e,t,n,i)}function ya(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ks(e,t,n,r,i){i-=xr(t);var T=_n(e,t),N=ma(t),K=0,V=t.text.length,$=!0,ae=Xe(t,e.doc.direction);if(ae){var ue=(e.options.lineWrapping?Gs:zs)(e,t,n,T,ae,r,i);$=ue.level!=1,K=$?ue.from:ue.to-1,V=$?ue.to:ue.from-1}var we=null,Ee=null,ke=je(function(ut){var at=Dr(e,T,ut);return at.top+=N,at.bottom+=N,ya(at,r,i,!1)?(at.top<=i&&at.left<=r&&(we=ut,Ee=at),!0):!1},K,V),Ue,Ke,Je=!1;if(Ee){var qe=r-Ee.left<Ee.right-r,Qe=qe==$;ke=we+(Qe?0:1),Ke=Qe?"after":"before",Ue=qe?Ee.left:Ee.right}else{!$&&(ke==V||ke==K)&&ke++,Ke=ke==0?"after":ke==t.text.length?"before":Dr(e,T,ke-($?1:0)).bottom+N<=i==$?"after":"before";var rt=Tr(e,Be(n,ke,Ke),"line",t,T);Ue=rt.left,Je=i<rt.top?-1:i>=rt.bottom?1:0}return ke=Ae(t.text,ke,1),ga(n,ke,Ke,Je,r-Ue)}function zs(e,t,n,r,i,T,N){var K=je(function(ue){var we=i[ue],Ee=we.level!=1;return ya(Tr(e,Be(n,Ee?we.to:we.from,Ee?"before":"after"),"line",t,r),T,N,!0)},0,i.length-1),V=i[K];if(K>0){var $=V.level!=1,ae=Tr(e,Be(n,$?V.from:V.to,$?"after":"before"),"line",t,r);ya(ae,T,N,!0)&&ae.top>N&&(V=i[K-1])}return V}function Gs(e,t,n,r,i,T,N){var K=co(e,t,r,N),V=K.begin,$=K.end;/\s/.test(t.text.charAt($-1))&&$--;for(var ae=null,ue=null,we=0;we<i.length;we++){var Ee=i[we];if(Ee.from>=$||Ee.to<=V)continue;var ke=Ee.level!=1,Ue=Dr(e,r,ke?Math.min($,Ee.to)-1:Math.max(V,Ee.from)).right,Ke=Ue<T?T-Ue+1e9:Ue-T;(!ae||ue>Ke)&&(ae=Ee,ue=Ke)}return ae||(ae=i[i.length-1]),ae.from<V&&(ae={from:V,to:ae.to,level:ae.level}),ae.to>$&&(ae={from:ae.from,to:$,level:ae.level}),ae}var an;function Cn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(an==null){an=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)an.appendChild(document.createTextNode("x")),an.appendChild(a("br"));an.appendChild(document.createTextNode("x"))}s(e.measure,an);var n=an.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),c(e.measure),n||1}function An(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");s(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function ba(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,T=t.gutters.firstChild,N=0;T;T=T.nextSibling,++N){var K=e.display.gutterSpecs[N].className;n[K]=T.offsetLeft+T.clientLeft+i,r[K]=T.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ho(e){var t=Cn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/An(e.display)-3);return function(i){if(Ar(e.doc,i))return 0;var T=0;if(i.widgets)for(var N=0;N<i.widgets.length;N++)i.widgets[N].height&&(T+=i.widgets[N].height);return n?T+(Math.ceil(i.text.length/r)||1)*t:T+t}}function xa(e){var t=e.doc,n=ho(e);t.iter(function(r){var i=n(r);i!=r.height&&Zt(r,i)})}function on(e,t,n,r){var i=e.display;if(!n&&fe(t).getAttribute("cm-not-content")=="true")return null;var T,N,K=i.lineSpace.getBoundingClientRect();try{T=t.clientX-K.left,N=t.clientY-K.top}catch(ue){return null}var V=va(e,T,N),$;if(r&&V.xRel>0&&($=nt(e.doc,V.line).text).length==V.ch){var ae=H($,$.length,e.options.tabSize)-$.length;V=Be(V.line,Math.max(0,Math.round((T-qa(e.display).left)/An(e.display))-ae))}return V}function sn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function tr(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)$t&&Zn(e.doc,t)<i.viewTo&&zr(e);else if(n<=i.viewFrom)$t&&Hr(e.doc,n+r)>i.viewFrom?zr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)zr(e);else if(t<=i.viewFrom){var T=Ni(e,n,n+r,1);T?(i.view=i.view.slice(T.index),i.viewFrom=T.lineN,i.viewTo+=r):zr(e)}else if(n>=i.viewTo){var N=Ni(e,t,t,-1);N?(i.view=i.view.slice(0,N.index),i.viewTo=N.lineN):zr(e)}else{var K=Ni(e,t,t,-1),V=Ni(e,n,n+r,1);K&&V?(i.view=i.view.slice(0,K.index).concat(er(e,K.lineN,V.lineN)).concat(i.view.slice(V.index)),i.viewTo+=r):zr(e)}var $=i.externalMeasured;$&&(n<$.lineN?$.lineN+=r:t<$.lineN+$.size&&(i.externalMeasured=null))}function Kr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var T=r.view[sn(e,t)];if(T.node==null)return;var N=T.changes||(T.changes=[]);ee(N,n)==-1&&N.push(n)}function zr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ni(e,t,n,r){var i=sn(e,t),T,N=e.display.view;if(!$t||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var K=e.display.viewFrom,V=0;V<i;V++)K+=N[V].size;if(K!=t){if(r>0){if(i==N.length-1)return null;T=K+N[i].size-t,i++}else T=K-t;t+=T,n+=T}for(;Zn(e.doc,n)!=n;){if(i==(r<0?0:N.length-1))return null;n+=r*N[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=er(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=er(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(sn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(er(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,sn(e,n)))),r.viewTo=n}function mo(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function ai(e){e.display.input.showSelection(e.display.input.prepareSelection())}function po(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),T=r.selection=document.createDocumentFragment(),N=0;N<n.sel.ranges.length;N++){if(!t&&N==n.sel.primIndex)continue;var K=n.sel.ranges[N];if(K.from().line>=e.display.viewTo||K.to().line<e.display.viewFrom)continue;var V=K.empty();(V||e.options.showCursorWhenSelecting)&&go(e,K.head,i),V||Xs(e,K,T)}return r}function go(e,t,n){var r=Tr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(a("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var T=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));T.style.display="",T.style.left=r.other.left+"px",T.style.top=r.other.top+"px",T.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Bi(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,T=document.createDocumentFragment(),N=qa(e.display),K=N.left,V=Math.max(r.sizerWidth,nn(e)-r.sizer.offsetLeft)-N.right,$=i.direction=="ltr";function ae(Qe,rt,ut,at){rt<0&&(rt=0),rt=Math.round(rt),at=Math.round(at),T.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Qe+`px;
|
|
top: `+rt+"px; width: "+(ut==null?V-Qe:ut)+`px;
|
|
height: `+(at-rt)+"px"))}function ue(Qe,rt,ut){var at=nt(i,Qe),pt=at.text.length,Lt,Ht;function Ot(kt,ir){return pa(e,Be(Qe,kt),"div",at,ir)}function sr(kt,ir,Gt){var Nt=fo(e,at,null,kt),It=ir=="ltr"==(Gt=="after")?"left":"right",Pt=Gt=="after"?Nt.begin:Nt.end-(/\s/.test(at.text.charAt(Nt.end-1))?2:1);return Ot(Pt,It)[It]}var nr=Xe(at,i.direction);return ze(nr,rt||0,ut==null?pt:ut,function(kt,ir,Gt,Nt){var It=Gt=="ltr",Pt=Ot(kt,It?"left":"right"),ar=Ot(ir-1,It?"right":"left"),jn=rt==null&&kt==0,Jr=ut==null&&ir==pt,Yt=Nt==0,Or=!nr||Nt==nr.length-1;if(ar.top-Pt.top<=3){var Kt=($?jn:Jr)&&Yt,Va=($?Jr:jn)&&Or,jr=Kt?K:(It?Pt:ar).left,fn=Va?V:(It?ar:Pt).right;ae(jr,Pt.top,fn-jr,Pt.bottom)}else{var hn,Qt,Wn,Xa;It?(hn=$&&jn&&Yt?K:Pt.left,Qt=$?V:sr(kt,Gt,"before"),Wn=$?K:sr(ir,Gt,"after"),Xa=$&&Jr&&Or?V:ar.right):(hn=$?sr(kt,Gt,"before"):K,Qt=!$&&jn&&Yt?V:Pt.right,Wn=!$&&Jr&&Or?K:ar.left,Xa=$?sr(ir,Gt,"after"):V),ae(hn,Pt.top,Qt-hn,Pt.bottom),Pt.bottom<ar.top&&ae(K,Pt.bottom,null,ar.top),ae(Wn,ar.top,Xa-Wn,ar.bottom)}(!Lt||Bi(Pt,Lt)<0)&&(Lt=Pt),Bi(ar,Lt)<0&&(Lt=ar),(!Ht||Bi(Pt,Ht)<0)&&(Ht=Pt),Bi(ar,Ht)<0&&(Ht=ar)}),{start:Lt,end:Ht}}var we=t.from(),Ee=t.to();if(we.line==Ee.line)ue(we.line,we.ch,Ee.ch);else{var ke=nt(i,we.line),Ue=nt(i,Ee.line),Ke=ur(ke)==ur(Ue),Je=ue(we.line,we.ch,Ke?ke.text.length+1:null).end,qe=ue(Ee.line,Ke?0:null,Ee.ch).start;Ke&&(Je.top<qe.top-2?(ae(Je.right,Je.top,null,Je.bottom),ae(K,qe.top,qe.left,qe.bottom)):ae(Je.right,Je.top,qe.left-Je.right,Je.bottom)),Je.bottom<qe.top&&ae(K,Je.bottom,null,qe.top)}n.appendChild(T)}function Ta(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Ln(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function vo(e){e.state.focused||(e.display.input.focus(),Sa(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Ln(e))},100)}function Sa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Pe(e,"focus",e,t),e.state.focused=!0,F(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),k&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ta(e)}function Ln(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Pe(e,"blur",e,t),e.state.focused=!1,h(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function ji(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],T=e.options.lineWrapping,N=void 0,K=0;if(i.hidden)continue;if(B&&U<8){var V=i.node.offsetTop+i.node.offsetHeight;N=V-n,n=V}else{var $=i.node.getBoundingClientRect();N=$.bottom-$.top,!T&&i.text.firstChild&&(K=i.text.firstChild.getBoundingClientRect().right-$.left-1)}var ae=i.line.height-N;if((ae>.005||ae<-.005)&&(Zt(i.line,N),bo(i.line),i.rest))for(var ue=0;ue<i.rest.length;ue++)bo(i.rest[ue]);if(K>e.display.sizerWidth){var we=Math.ceil(K/An(e.display));we>e.display.maxLineLength&&(e.display.maxLineLength=we,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function bo(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Wi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Ui(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,T=gr(t,r),N=gr(t,i);if(n&&n.ensure){var K=n.ensure.from.line,V=n.ensure.to.line;K<T?(T=K,N=gr(t,xr(nt(t,K))+e.wrapper.clientHeight)):Math.min(V,t.lastLine())>=N&&(T=gr(t,xr(nt(t,V))-e.wrapper.clientHeight),N=V)}return{from:T,to:Math.max(N,T+1)}}function Ys(e,t){if(Fe(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!x){var T=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Ui(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Lr(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(T),T.scrollIntoView(i),e.display.lineSpace.removeChild(T)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Be(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Be(t.line,t.ch+1,"before"):t);for(var T=0;T<5;T++){var N=!1,K=Tr(e,t),V=!n||n==t?K:Tr(e,n);i={left:Math.min(K.left,V.left),top:Math.min(K.top,V.top)-r,right:Math.max(K.left,V.left),bottom:Math.max(K.bottom,V.bottom)+r};var $=wa(e,i),ae=e.doc.scrollTop,ue=e.doc.scrollLeft;if($.scrollTop!=null&&(si(e,$.scrollTop),Math.abs(e.doc.scrollTop-ae)>1&&(N=!0)),$.scrollLeft!=null&&(ln(e,$.scrollLeft),Math.abs(e.doc.scrollLeft-ue)>1&&(N=!0)),!N)break}return i}function Js(e,t){var n=wa(e,t);n.scrollTop!=null&&si(e,n.scrollTop),n.scrollLeft!=null&&ln(e,n.scrollLeft)}function wa(e,t){var n=e.display,r=Cn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,T=fa(e),N={};t.bottom-t.top>T&&(t.bottom=t.top+T);var K=e.doc.height+ca(n),V=t.top<r,$=t.bottom>K-r;if(t.top<i)N.scrollTop=V?0:t.top;else if(t.bottom>i+T){var ae=Math.min(t.top,($?K:t.bottom)-T);ae!=i&&(N.scrollTop=ae)}var ue=e.options.fixedGutter?0:n.gutters.offsetWidth,we=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ue,Ee=nn(e)-n.gutters.offsetWidth,ke=t.right-t.left>Ee;return ke&&(t.right=t.left+Ee),t.left<10?N.scrollLeft=0:t.left<we?N.scrollLeft=Math.max(0,t.left+ue-(ke?0:10)):t.right>Ee+we-3&&(N.scrollLeft=t.right+(ke?0:10)-Ee),N}function _a(e,t){if(t==null)return;Hi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Dn(e){Hi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function oi(e,t,n){(t!=null||n!=null)&&Hi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Qs(e,t){Hi(e),e.curOp.scrollToPos=t}function Hi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=uo(e,t.from),r=uo(e,t.to);Eo(e,n,r,t.margin)}}function Eo(e,t,n,r){var i=wa(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});oi(e,i.scrollLeft,i.scrollTop)}function si(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;L||Aa(e,{top:t}),xo(e,t,!0),L&&Aa(e),di(e,100)}function xo(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function ln(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Co(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function li(e){var t=e.display,n=t.gutters.offsetWidth,r=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?n:0,docHeight:r,scrollHeight:r+Lr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var un=function(e,t,n){this.cm=n;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Oe(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Oe(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,B&&U<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};un.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var T=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+T)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},un.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},un.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},un.prototype.zeroWidthHack=function(){var e=u&&!_?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Y,this.disableVert=new Y},un.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),T=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);T!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},un.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ui=function(){};ui.prototype.update=function(){return{bottom:0,right:0}},ui.prototype.setScrollLeft=function(){},ui.prototype.setScrollTop=function(){},ui.prototype.clear=function(){};function On(e,t){t||(t=li(e));var n=e.display.barWidth,r=e.display.barHeight;To(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&ji(e),To(e,li(e)),n=e.display.barWidth,r=e.display.barHeight}function To(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var So={native:un,null:ui};function wo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&h(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new So[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Oe(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?ln(e,t):si(e,t)},e),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function dn(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:++Zs},mr(e.curOp)}function cn(e){var t=e.curOp;t&&Rs(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;qs(n)})}function qs(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var r=0;r<t.length;r++)tl(t[r]);for(var i=0;i<t.length;i++)rl(t[i]);for(var T=0;T<t.length;T++)nl(t[T]);for(var N=0;N<t.length;N++)il(t[N])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&Ii(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Ki(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Ca(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&ji(t),e.barMeasure=li(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=to(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Lr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-nn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&ln(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==M();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&On(t,e.barMeasure),e.updatedDisplay&&Da(t,e.barMeasure),e.selectionChanged&&Ta(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&vo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&_o(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&xo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&ln(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,ht(r,e.scrollToPos.from),ht(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var T=e.maybeHiddenMarkers,N=e.maybeUnhiddenMarkers;if(T)for(var K=0;K<T.length;++K)T[K].lines.length||Pe(T[K],"hide");if(N)for(var V=0;V<N.length;++V)N[V].lines.length&&Pe(N[V],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Pe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function or(e,t){if(e.curOp)return t();dn(e);try{return t()}finally{cn(e)}}function jt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);dn(e);try{return t.apply(e,arguments)}finally{cn(e)}}}function Jt(e){return function(){if(this.curOp)return e.apply(this,arguments);dn(this);try{return e.apply(this,arguments)}finally{cn(this)}}}function Wt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);dn(t);try{return e.apply(this,arguments)}finally{cn(t)}}}function di(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,D(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=vr(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(T){if(r.line>=e.display.viewFrom){var N=T.styles,K=T.text.length>e.options.maxHighlightLength?Cr(t.mode,r.state):null,V=Gn(e,T,r,!0);K&&(r.state=K),T.styles=V.styles;var $=T.styleClasses,ae=V.classes;ae?T.styleClasses=ae:$&&(T.styleClasses=null);for(var ue=!N||N.length!=T.styles.length||$!=ae&&(!$||!ae||$.bgClass!=ae.bgClass||$.textClass!=ae.textClass),we=0;!ue&&we<N.length;++we)ue=N[we]!=T.styles[we];ue&&i.push(r.line),T.stateAfter=r.save(),r.nextLine()}else T.text.length<=e.options.maxHighlightLength&&Vn(e,T.text,r),T.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return di(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&or(e,function(){for(var T=0;T<i.length;T++)Kr(e,i[T],"text")})}var Ki=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Wi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=nn(e),this.force=n,this.dims=ba(e),this.events=[]};Ki.prototype.signal=function(e,t){de(e,t)&&this.events.push(arguments)},Ki.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Pe.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Lr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Lr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=M();if(!t||!E(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&E(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==M())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&E(document.body,e.anchorNode)&&E(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function Ca(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return zr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&mo(e)==0)return!1;Ao(e)&&(zr(e),t.dims=ba(e));var i=r.first+r.size,T=Math.max(t.visible.from-e.options.viewportMargin,r.first),N=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<T&&T-n.viewFrom<20&&(T=Math.max(r.first,n.viewFrom)),n.viewTo>N&&n.viewTo-N<20&&(N=Math.min(i,n.viewTo)),$t&&(T=Zn(e.doc,T),N=Hr(e.doc,N));var K=T!=n.viewFrom||N!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,T,N),n.viewOffset=xr(nt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var V=mo(e);if(!K&&V==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var $=sl(e);return V>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),V>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll($),c(n.cursorDiv),c(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,K&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,di(e,400)),n.updateLineNumbers=null,!0}function _o(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==nn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ca(e.display)-fa(e),n.top)}),t.visible=Wi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Wi(e.display,e.doc,n));if(!Ca(e,t))break;ji(e);var i=li(e);ai(e),On(e,i),Da(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Aa(e,t){var n=new Ki(e,t);if(Ca(e,n)){ji(e),_o(e,n);var r=li(e);ai(e),On(e,r),Da(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,T=r.lineDiv,N=T.firstChild;function K(ke){var Ue=ke.nextSibling;return k&&u&&e.display.currentWheelTarget==ke?ke.style.display="none":ke.parentNode.removeChild(ke),Ue}for(var V=r.view,$=r.viewFrom,ae=0;ae<V.length;ae++){var ue=V[ae];if(!ue.hidden)if(!ue.node||ue.node.parentNode!=T){var we=Us(e,ue,$,n);T.insertBefore(we,N)}else{for(;N!=ue.node;)N=K(N);var Ee=i&&t!=null&&t<=$&&ue.lineNumber;ue.changes&&(ee(ue.changes,"gutter")>-1&&(Ee=!1),Ya(e,ue,$,n)),Ee&&(c(ue.lineNumber),ue.lineNumber.appendChild(document.createTextNode(pn(e.options,$)))),N=ue.node.nextSibling}$+=ue.size}for(;N;)N=K(N)}function La(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Da(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Lr(e)+"px"}function Co(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,T=r+"px",N=0;N<n.length;N++)if(!n[N].hidden){e.options.fixedGutter&&(n[N].gutter&&(n[N].gutter.style.left=T),n[N].gutterBackground&&(n[N].gutterBackground.style.left=T));var K=n[N].alignable;if(K)for(var V=0;V<K.length;V++)K[V].style.left=T}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Ao(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=pn(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(a("div",[a("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),T=i.firstChild.offsetWidth,N=i.offsetWidth-T;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(T,r.lineGutter.offsetWidth-N)+1,r.lineNumWidth=r.lineNumInnerWidth+N,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",La(e.display),!0}return!1}function Oa(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var T=e[i],N=null;if(typeof T!="string"&&(N=T.style,T=T.className),T=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:T,style:N})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Lo(e){var t=e.gutters,n=e.gutterSpecs;c(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],T=i.className,N=i.style,K=t.appendChild(a("div",null,"CodeMirror-gutter "+T));N&&(K.style.cssText=N),T=="CodeMirror-linenumbers"&&(e.lineGutter=K,K.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",La(e)}function ci(e){Lo(e.display),tr(e),Co(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=g("div",null,"CodeMirror-code"),i.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=a("div",null,"CodeMirror-cursors"),i.measure=a("div",null,"CodeMirror-measure"),i.lineMeasure=a("div",null,"CodeMirror-measure"),i.lineSpace=g("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var T=g("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[T],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+oe+"px; width: 1px;"),i.gutters=a("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=a("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=a("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),B&&U<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!k&&!(L&&o)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=Oa(r.gutters,r.lineNumbers),Lo(i),n.init(i)}var zi=0,dr=null;B?dr=-.53:L?dr=15:y?dr=-.7:O&&(dr=-1/3);function Do(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function cl(e){var t=Do(e);return t.x*=dr,t.y*=dr,t}function Oo(e,t){var n=Do(t),r=n.x,i=n.y,T=e.display,N=T.scroller,K=N.scrollWidth>N.clientWidth,V=N.scrollHeight>N.clientHeight;if(!(r&&K||i&&V))return;if(i&&u&&k){e:for(var $=t.target,ae=T.view;$!=N;$=$.parentNode)for(var ue=0;ue<ae.length;ue++)if(ae[ue].node==$){e.display.currentWheelTarget=$;break e}}if(r&&!L&&!S&&dr!=null){i&&V&&si(e,Math.max(0,N.scrollTop+i*dr)),ln(e,Math.max(0,N.scrollLeft+r*dr)),(!i||i&&V)&&X(t),T.wheelStartX=null;return}if(i&&dr!=null){var we=i*dr,Ee=e.doc.scrollTop,ke=Ee+T.wrapper.clientHeight;we<0?Ee=Math.max(0,Ee+we-50):ke=Math.min(e.doc.height,ke+we+50),Aa(e,{top:Ee,bottom:ke})}zi<20&&(T.wheelStartX==null?(T.wheelStartX=N.scrollLeft,T.wheelStartY=N.scrollTop,T.wheelDX=r,T.wheelDY=i,setTimeout(function(){if(T.wheelStartX==null)return;var Ue=N.scrollLeft-T.wheelStartX,Ke=N.scrollTop-T.wheelStartY,Je=Ke&&T.wheelDY&&Ke/T.wheelDY||Ue&&T.wheelDX&&Ue/T.wheelDX;if(T.wheelStartX=T.wheelStartY=null,!Je)return;dr=(dr*zi+Je)/(zi+1),++zi},200)):(T.wheelDX+=r,T.wheelDY+=i))}var cr=function(e,t){this.ranges=e,this.primIndex=t};cr.prototype.primary=function(){return this.ranges[this.primIndex]},cr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!zn(n.anchor,r.anchor)||!zn(n.head,r.head))return!1}return!0},cr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new wt(gn(this.ranges[t].anchor),gn(this.ranges[t].head));return new cr(e,this.primIndex)},cr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},cr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ct(t,r.from())>=0&&ct(e,r.to())<=0)return n}return-1};var wt=function(e,t){this.anchor=e,this.head=t};wt.prototype.from=function(){return Qr(this.anchor,this.head)},wt.prototype.to=function(){return vn(this.anchor,this.head)},wt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Sr(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(we,Ee){return ct(we.from(),Ee.from())}),n=ee(t,i);for(var T=1;T<t.length;T++){var N=t[T],K=t[T-1],V=ct(K.to(),N.from());if(r&&!N.empty()?V>0:V>=0){var $=Qr(K.from(),N.from()),ae=vn(K.to(),N.to()),ue=K.empty()?N.from()==N.head:K.from()==K.head;T<=n&&--n,t.splice(--T,2,new wt(ue?ae:$,ue?$:ae))}}return new cr(t,n)}function Gr(e,t){return new cr([new wt(e,t||e)],0)}function Vr(e){return e.text?Be(e.from.line+e.text.length-1,J(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ro(e,t){if(ct(e,t.from)<0)return e;if(ct(e,t.to)<=0)return Vr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Vr(t).ch-t.to.ch),Be(n,r)}function Ra(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new wt(Ro(i.anchor,t),Ro(i.head,t)))}return Sr(e.cm,n,e.sel.primIndex)}function Po(e,t,n){return e.line==t.line?Be(n.line,e.ch-t.ch+n.ch):Be(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Be(e.first,0),T=i,N=0;N<t.length;N++){var K=t[N],V=Po(K.from,i,T),$=Po(Vr(K),i,T);if(i=K.to,T=$,n=="around"){var ae=e.sel.ranges[N],ue=ct(ae.head,ae.anchor)<0;r[N]=new wt(ue?$:V,ue?V:$)}else r[N]=new wt(V,V)}return new cr(r,e.sel.primIndex)}function Pa(e){e.doc.mode=pr(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,di(e,100),e.state.modeGen++,e.curOp&&tr(e)}function Mo(e,t){return t.from.ch==0&&t.to.ch==0&&J(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ma(e,t,n,r){function i(qe){return n?n[qe]:null}function T(qe,Qe,rt){ua(qe,Qe,rt,r),zt(qe,"change",qe,t)}function N(qe,Qe){for(var rt=[],ut=qe;ut<Qe;++ut)rt.push(new rn($[ut],i(ut),r));return rt}var K=t.from,V=t.to,$=t.text,ae=nt(e,K.line),ue=nt(e,V.line),we=J($),Ee=i($.length-1),ke=V.line-K.line;if(t.full)e.insert(0,N(0,$.length)),e.remove($.length,e.size-$.length);else if(Mo(e,t)){var Ue=N(0,$.length-1);T(ue,ue.text,Ee),ke&&e.remove(K.line,ke),Ue.length&&e.insert(K.line,Ue)}else if(ae==ue)if($.length==1)T(ae,ae.text.slice(0,K.ch)+we+ae.text.slice(V.ch),Ee);else{var Ke=N(1,$.length-1);Ke.push(new rn(we+ae.text.slice(V.ch),Ee,r)),T(ae,ae.text.slice(0,K.ch)+$[0],i(0)),e.insert(K.line+1,Ke)}else if($.length==1)T(ae,ae.text.slice(0,K.ch)+$[0]+ue.text.slice(V.ch),i(0)),e.remove(K.line+1,ke);else{T(ae,ae.text.slice(0,K.ch)+$[0],i(0)),T(ue,we+ue.text.slice(V.ch),Ee);var Je=N(1,$.length-1);ke>1&&e.remove(K.line+1,ke-1),e.insert(K.line+1,Je)}zt(e,"change",e,t)}function Xr(e,t,n){function r(i,T,N){if(i.linked)for(var K=0;K<i.linked.length;++K){var V=i.linked[K];if(V.doc==T)continue;var $=N&&V.sharedHist;if(n&&!$)continue;t(V.doc,$),r(V.doc,i,$)}}r(e,null,!0)}function ko(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,xa(e),Pa(e),Io(e),e.options.lineWrapping||Ii(e),e.options.mode=t.modeOption,tr(e)}function Io(e){(e.doc.direction=="rtl"?F:h)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){or(e,function(){Io(e),tr(e)})}function Gi(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 n={from:gn(t.from),to:Vr(t),text:Pr(e,t.from,t.to)};return No(e,n,t.from.line,t.to.line+1),Xr(e,function(r){return No(r,n,t.from.line,t.to.line+1)},!0),n}function Uo(e){for(;e.length;){var t=J(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Uo(e.done),J(e.done);if(e.done.length&&!J(e.done).ranges)return J(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),J(e.done)}function Fo(e,t,n,r){var i=e.history;i.undone.length=0;var T=+new Date,N,K;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>T-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(N=ml(i,i.lastOp==r)))K=J(N.changes),ct(t.from,t.to)==0&&ct(t.from,K.to)==0?K.to=Vr(t):N.changes.push(ka(e,t));else{var V=J(i.done);for((!V||!V.ranges)&&Vi(e.sel,i.done),N={changes:[ka(e,t)],generation:i.generation},i.done.push(N);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=T,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,K||Pe(e,"historyAdded")}function pl(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var i=e.history,T=r&&r.origin;n==i.lastSelOp||T&&i.lastSelOrigin==T&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==T||pl(e,T,J(i.done),t))?i.done[i.done.length-1]=t:Vi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=T,i.lastSelOp=n,r&&r.clearRedo!==!1&&Uo(i.undone)}function Vi(e,t){var n=J(t);n&&n.ranges&&n.equals(e)||t.push(e)}function No(e,t,n,r){var i=t["spans_"+e.id],T=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(N){N.markedSpans&&((i||(i=t["spans_"+e.id]={}))[T]=N.markedSpans),++T})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function Bo(e,t){var n=yl(e,t),r=En(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var T=n[i],N=r[i];if(T&&N){e:for(var K=0;K<N.length;++K){for(var V=N[K],$=0;$<T.length;++$)if(T[$].marker==V.marker)continue e;T.push(V)}}else N&&(n[i]=N)}return n}function Rn(e,t,n){for(var r=[],i=0;i<e.length;++i){var T=e[i];if(T.ranges){r.push(n?cr.prototype.deepCopy.call(T):T);continue}var N=T.changes,K=[];r.push({changes:K});for(var V=0;V<N.length;++V){var $=N[V],ae=void 0;if(K.push({from:$.from,to:$.to,text:$.text}),t)for(var ue in $)(ae=ue.match(/^spans_(\d+)$/))&&(ee(t,Number(ae[1]))>-1&&(J(K)[ue]=$[ue],delete $[ue]))}}return r}function Ia(e,t,n,r){if(r){var i=e.anchor;if(n){var T=ct(t,i)<0;T!=ct(n,i)<0?(i=t,t=n):T!=ct(t,n)<0&&(t=n)}return new wt(i,t)}else return new wt(n||t,t)}function Xi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Xt(e,new cr([Ia(e.sel.primary(),t,n,i)],0),r)}function jo(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),T=0;T<e.sel.ranges.length;T++)r[T]=Ia(e.sel.ranges[T],t[T],null,i);var N=Sr(e.cm,r,e.sel.primIndex);Xt(e,N,n)}function Ua(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Xt(e,Sr(e.cm,i,e.sel.primIndex),r)}function Wo(e,t,n,r){Xt(e,Gr(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var T=0;T<i.length;T++)this.ranges[T]=new wt(ht(e,i[T].anchor),ht(e,i[T].head))},origin:n&&n.origin};return Pe(e,"beforeSelectionChange",e,r),e.cm&&Pe(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Sr(e.cm,r.ranges,r.ranges.length-1):t}function Ho(e,t,n){var r=e.history.done,i=J(r);i&&i.ranges?(r[r.length-1]=t,Yi(e,t,n)):Xt(e,t,n)}function Xt(e,t,n){Yi(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Yi(e,t,n){(de(e,"beforeSelectionChange")||e.cm&&de(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(ct(t.primary().head,e.sel.primary().head)<0?-1:1);Ko(e,Go(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Dn(e.cm)}function Ko(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ve(e.cm)),zt(e,"cursorActivity",e)}function zo(e){Ko(e,Go(e,e.sel,null,!1))}function Go(e,t,n,r){for(var i,T=0;T<t.ranges.length;T++){var N=t.ranges[T],K=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[T],V=$i(e,N.anchor,K&&K.anchor,n,r),$=$i(e,N.head,K&&K.head,n,r);(i||V!=N.anchor||$!=N.head)&&(i||(i=t.ranges.slice(0,T)),i[T]=new wt(V,$))}return i?Sr(e.cm,i,t.primIndex):t}function Pn(e,t,n,r,i){var T=nt(e,t.line);if(T.markedSpans)for(var N=0;N<T.markedSpans.length;++N){var K=T.markedSpans[N],V=K.marker,$="selectLeft"in V?!V.selectLeft:V.inclusiveLeft,ae="selectRight"in V?!V.selectRight:V.inclusiveRight;if((K.from==null||($?K.from<=t.ch:K.from<t.ch))&&(K.to==null||(ae?K.to>=t.ch:K.to>t.ch))){if(i&&(Pe(V,"beforeCursorEnter"),V.explicitlyCleared))if(T.markedSpans){--N;continue}else break;if(!V.atomic)continue;if(n){var ue=V.find(r<0?1:-1),we=void 0;if((r<0?ae:$)&&(ue=Vo(e,ue,-r,ue&&ue.line==t.line?T:null)),ue&&ue.line==t.line&&(we=ct(ue,n))&&(r<0?we<0:we>0))return Pn(e,ue,t,r,i)}var Ee=V.find(r<0?-1:1);return(r<0?$:ae)&&(Ee=Vo(e,Ee,r,Ee.line==t.line?T:null)),Ee?Pn(e,Ee,t,r,i):null}}return t}function $i(e,t,n,r,i){var T=r||1,N=Pn(e,t,n,T,i)||!i&&Pn(e,t,n,T,!0)||Pn(e,t,n,-T,i)||!i&&Pn(e,t,n,-T,!0);return N||(e.cantEdit=!0,Be(e.first,0))}function Vo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ht(e,Be(t.line-1)):null:n>0&&t.ch==(r||nt(e,t.line)).text.length?t.line<e.first+e.size-1?Be(t.line+1,0):null:new Be(t.line,t.ch+n)}function Xo(e){e.setSelection(Be(e.firstLine(),0),Be(e.lastLine()),ye)}function Yo(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,T,N,K){i&&(r.from=ht(e,i)),T&&(r.to=ht(e,T)),N&&(r.text=N),K!==void 0&&(r.origin=K)}),Pe(e,"beforeChange",e,r),e.cm&&Pe(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function Mn(e,t,n){if(e.cm){if(!e.cm.curOp)return jt(e.cm,Mn)(e,t,n);if(e.cm.state.suppressEdits)return}if((de(e,"beforeChange")||e.cm&&de(e.cm,"beforeChange"))&&(t=Yo(e,t,!0),!t))return;var r=Jn&&!n&&Pi(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)$o(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else $o(e,t)}function $o(e,t){if(t.text.length==1&&t.text[0]==""&&ct(t.from,t.to)==0)return;var n=Ra(e,t);Fo(e,t,n,e.cm?e.cm.curOp.id:NaN),hi(e,t,n,En(e,t));var r=[];Xr(e,function(i,T){!T&&ee(r,i.history)==-1&&(qo(i.history,t),r.push(i.history)),hi(i,t,null,En(i,t))})}function Ji(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,T,N=e.sel,K=t=="undo"?i.done:i.undone,V=t=="undo"?i.undone:i.done,$=0;$<K.length&&!(T=K[$],n?T.ranges&&!T.equals(e.sel):!T.ranges);$++);if($==K.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(T=K.pop(),T.ranges){if(Vi(T,V),n&&!T.equals(e.sel)){Xt(e,T,{clearRedo:!1});return}N=T}else if(r){K.push(T);return}else break;var ae=[];Vi(N,V),V.push({changes:ae,generation:i.generation}),i.generation=T.generation||++i.maxGeneration;for(var ue=de(e,"beforeChange")||e.cm&&de(e.cm,"beforeChange"),we=function(Ue){var Ke=T.changes[Ue];if(Ke.origin=t,ue&&!Yo(e,Ke,!1))return K.length=0,{};ae.push(ka(e,Ke));var Je=Ue?Ra(e,Ke):J(K);hi(e,Ke,Je,Bo(e,Ke)),!Ue&&e.cm&&e.cm.scrollIntoView({from:Ke.from,to:Vr(Ke)});var qe=[];Xr(e,function(Qe,rt){!rt&&ee(qe,Qe.history)==-1&&(qo(Qe.history,Ke),qe.push(Qe.history)),hi(Qe,Ke,null,Bo(Qe,Ke))})},Ee=T.changes.length-1;Ee>=0;--Ee){var ke=we(Ee);if(ke)return ke.v}}function Jo(e,t){if(t==0)return;if(e.first+=t,e.sel=new cr(ne(e.sel.ranges,function(i){return new wt(Be(i.anchor.line+t,i.anchor.ch),Be(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){tr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Kr(e.cm,r,"gutter")}}function hi(e,t,n,r){if(e.cm&&!e.cm.curOp)return jt(e.cm,hi)(e,t,n,r);if(t.to.line<e.first){Jo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Jo(e,i),t={from:Be(e.first,0),to:Be(t.to.line+i,t.to.ch),text:[J(t.text)],origin:t.origin}}var T=e.lastLine();t.to.line>T&&(t={from:t.from,to:Be(T,nt(e,T).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Pr(e,t.from,t.to),n||(n=Ra(e,t)),e.cm?El(e.cm,t,r):Ma(e,t,r),Yi(e,n,ye),e.cantEdit&&$i(e,Be(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,T=t.from,N=t.to,K=!1,V=T.line;e.options.lineWrapping||(V=Tt(ur(nt(r,T.line))),r.iter(V,N.line+1,function(Ee){if(Ee==i.maxLine)return K=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ve(e),Ma(r,t,n,ho(e)),e.options.lineWrapping||(r.iter(V,T.line+t.text.length,function(Ee){var ke=ei(Ee);ke>i.maxLineLength&&(i.maxLine=Ee,i.maxLineLength=ke,i.maxLineChanged=!0,K=!1)}),K&&(e.curOp.updateMaxLine=!0)),aa(r,T.line),di(e,400);var $=t.text.length-(N.line-T.line)-1;t.full?tr(e):T.line==N.line&&t.text.length==1&&!Mo(e.doc,t)?Kr(e,T.line,"text"):tr(e,T.line,N.line+1,$);var ae=de(e,"changes"),ue=de(e,"change");if(ue||ae){var we={from:T,to:N,text:t.text,removed:t.removed,origin:t.origin};ue&&zt(e,"change",e,we),ae&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(we)}e.display.selForContextMenu=null}function kn(e,t,n,r,i){var T;r||(r=n),ct(r,n)<0&&(T=[r,n],n=T[0],r=T[1]),typeof t=="string"&&(t=e.splitLines(t)),Mn(e,{from:n,to:r,text:t,origin:i})}function Qo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Zo(e,t,n,r){for(var i=0;i<e.length;++i){var T=e[i],N=!0;if(T.ranges){T.copied||(T=e[i]=T.deepCopy(),T.copied=!0);for(var K=0;K<T.ranges.length;K++)Qo(T.ranges[K].anchor,t,n,r),Qo(T.ranges[K].head,t,n,r);continue}for(var V=0;V<T.changes.length;++V){var $=T.changes[V];if(n<$.from.line)$.from=Be($.from.line+r,$.from.ch),$.to=Be($.to.line+r,$.to.ch);else if(t<=$.to.line){N=!1;break}}N||(e.splice(0,i+1),i=0)}}function qo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Zo(e.done,n,r,i),Zo(e.undone,n,r,i)}function mi(e,t,n,r){var i=t,T=t;return typeof t=="number"?T=nt(e,yn(e,t)):i=Tt(t),i==null?null:(r(T,i)&&e.cm&&Kr(e.cm,i,n),T)}function pi(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}pi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,it(i),zt(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function gi(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}gi.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var T=Math.min(t,i-e),N=r.height;if(r.removeInner(e,T),this.height-=N-r.height,i==T&&(this.children.splice(n--,1),r.parent=null),(t-=T)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof pi))){var K=[];this.collapse(K),this.children=[new pi(K)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],T=i.chunkSize();if(e<=T){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var N=i.lines.length%25+25,K=N;K<i.lines.length;){var V=new pi(i.lines.slice(K,K+=25));i.height-=V.height,this.children.splice(++r,0,V),V.parent=this}i.lines=i.lines.slice(0,N),this.maybeSpill()}break}e-=T}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new gi(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=ee(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new gi(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],T=i.chunkSize();if(e<T){var N=Math.min(t,T-e);if(i.iterN(e,N,n))return!0;if((t-=N)==0)break;e=0}else e-=T}}};var vi=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};vi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Tt(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var T=ni(this);Zt(n,Math.max(0,n.height-T)),e&&(or(e,function(){es(e,n,-T),Kr(e,r,"widget")}),zt(e,"lineWidgetCleared",e,this,r))},vi.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=ni(this)-t;if(!i)return;Ar(this.doc,r)||Zt(r,r.height+i),n&&or(n,function(){n.curOp.forceUpdate=!0,es(n,r,i),zt(n,"lineWidgetChanged",n,e,Tt(r))})},ce(vi);function es(e,t,n){xr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&_a(e,n)}function xl(e,t,n,r){var i=new vi(e,n,r),T=e.cm;return T&&i.noHScroll&&(T.display.alignWidgets=!0),mi(e,t,"widget",function(N){var K=N.widgets||(N.widgets=[]);if(i.insertAt==null?K.push(i):K.splice(Math.min(K.length-1,Math.max(0,i.insertAt)),0,i),i.line=N,T&&!Ar(e,N)){var V=xr(N)<e.scrollTop;Zt(N,N.height+ni(i)),V&&_a(T,i.height),T.curOp.forceUpdate=!0}return!0}),T&&zt(T,"lineWidgetAdded",T,i,typeof t=="number"?t:Tt(t)),i}var ts=0,Yr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ts};Yr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&dn(e),de(this,"clear")){var n=this.find();n&&zt(this,"clear",n.from,n.to)}for(var r=null,i=null,T=0;T<this.lines.length;++T){var N=this.lines[T],K=Er(N.markedSpans,this);e&&!this.collapsed?Kr(e,Tt(N),"text"):e&&(K.to!=null&&(i=Tt(N)),K.from!=null&&(r=Tt(N))),N.markedSpans=Qn(N.markedSpans,K),K.from==null&&this.collapsed&&!Ar(this.doc,N)&&e&&Zt(N,Cn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var V=0;V<this.lines.length;++V){var $=ur(this.lines[V]),ae=ei($);ae>e.display.maxLineLength&&(e.display.maxLine=$,e.display.maxLineLength=ae,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&tr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&zo(e.doc)),e&&zt(e,"markerCleared",e,this,r,i),t&&cn(e),this.parent&&this.parent.clear()},Yr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var T=this.lines[i],N=Er(T.markedSpans,this);if(N.from!=null&&(n=Be(t?T:Tt(T),N.from),e==-1))return n;if(N.to!=null&&(r=Be(t?T:Tt(T),N.to),e==1))return r}return n&&{from:n,to:r}},Yr.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;or(r,function(){var i=t.line,T=Tt(t.line),N=ha(r,T);if(N&&(io(N),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Ar(n.doc,i)&&n.height!=null){var K=n.height;n.height=null;var V=ni(n)-K;V&&Zt(i,i.height+V)}zt(r,"markerChanged",r,e)})},Yr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ee(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Yr.prototype.detachLine=function(e){if(this.lines.splice(ee(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ce(Yr);function In(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return jt(e.cm,In)(e,t,n,r,i);var T=new Yr(e,i),N=ct(t,n);if(r&&P(r,T,!1),N>0||N==0&&T.clearWhenEmpty!==!1)return T;if(T.replacedWith&&(T.collapsed=!0,T.widgetNode=g("span",[T.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||T.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(T.widgetNode.insertLeft=!0)),T.collapsed){if(Mi(e,t.line,t,n,T)||t.line!=n.line&&Mi(e,n.line,t,n,T))throw new Error("Inserting collapsed marker partially overlapping an existing one");oa()}T.addToHistory&&Fo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var K=t.line,V=e.cm,$;if(e.iter(K,n.line+1,function(ue){V&&T.collapsed&&!V.options.lineWrapping&&ur(ue)==V.display.maxLine&&($=!0),T.collapsed&&K!=t.line&&Zt(ue,0),sa(ue,new qr(T,K==t.line?t.ch:null,K==n.line?n.ch:null)),++K}),T.collapsed&&e.iter(t.line,n.line+1,function(ue){Ar(e,ue)&&Zt(ue,0)}),T.clearOnEnter&&Oe(T,"beforeCursorEnter",function(){return T.clear()}),T.readOnly&&(Wr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),T.collapsed&&(T.id=++ts,T.atomic=!0),V){if($&&(V.curOp.updateMaxLine=!0),T.collapsed)tr(V,t.line,n.line+1);else if(T.className||T.startStyle||T.endStyle||T.css||T.attributes||T.title)for(var ae=t.line;ae<=n.line;ae++)Kr(V,ae,"text");T.atomic&&zo(V.doc),zt(V,"markerAdded",V,T)}return T}var yi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].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();zt(this,"clear")},yi.prototype.find=function(e,t){return this.primary.find(e,t)},ce(yi);function Tl(e,t,n,r,i){r=P(r),r.shared=!1;var T=[In(e,t,n,r,i)],N=T[0],K=r.widgetNode;return Xr(e,function(V){K&&(r.widgetNode=K.cloneNode(!0)),T.push(In(V,ht(V,t),ht(V,n),r,i));for(var $=0;$<V.linked.length;++$)if(V.linked[$].isParent)return;N=J(T)}),new yi(T,N)}function rs(e){return e.findMarks(Be(e.first,0),e.clipPos(Be(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),T=e.clipPos(i.from),N=e.clipPos(i.to);if(ct(T,N)){var K=In(e,T,N,r.primary,r.primary.type);r.markers.push(K),K.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],T=[i.primary.doc];Xr(i.primary.doc,function(V){return T.push(V)});for(var N=0;N<i.markers.length;N++){var K=i.markers[N];ee(T,K.doc)==-1&&(K.parent=null,i.markers.splice(N--,1))}},n=0;n<e.length;n++)t(n)}var _l=0,rr=function(e,t,n,r,i){if(!(this instanceof rr))return new rr(e,t,n,r,i);n==null&&(n=0),gi.call(this,[new pi([new rn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var T=Be(n,0);this.sel=Gr(T),this.history=new Gi(null),this.id=++_l,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Ma(this,{from:T,to:T,text:e}),Xt(this,Gr(T),ye)};rr.prototype=Ce(gi.prototype,{constructor:rr,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=mn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Wt(function(e){var t=Be(this.first,0),n=this.first+this.size-1;Mn(this,{from:t,to:Be(n,nt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&oi(this.cm,0,0),Xt(this,Gr(t),ye)}),replaceRange:function(e,t,n,r){t=ht(this,t),n=n?ht(this,n):t,kn(this,e,t,n,r)},getRange:function(e,t,n){var r=Pr(this,ht(this,e),ht(this,t));return n===!1?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Mr(this,e))return nt(this,e)},getLineNumber:function(e){return Tt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=nt(this,e)),ur(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ht(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Wt(function(e,t,n){Wo(this,ht(this,typeof e=="number"?Be(e,t||0):e),null,n)}),setSelection:Wt(function(e,t,n){Wo(this,ht(this,e),ht(this,t||e),n)}),extendSelection:Wt(function(e,t,n){Xi(this,ht(this,e),t&&ht(this,t),n)}),extendSelections:Wt(function(e,t){jo(this,He(this,e),t)}),extendSelectionsBy:Wt(function(e,t){var n=ne(this.sel.ranges,e);jo(this,He(this,n),t)}),setSelections:Wt(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new wt(ht(this,e[i].anchor),ht(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Xt(this,Sr(this.cm,r,t),n)}),addSelection:Wt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new wt(ht(this,e),ht(this,t||e))),Xt(this,Sr(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=Pr(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=Pr(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Wt(function(e,t,n){for(var r=[],i=this.sel,T=0;T<i.ranges.length;T++){var N=i.ranges[T];r[T]={from:N.from(),to:N.to(),text:this.splitLines(e[T]),origin:n}}for(var K=t&&t!="end"&&fl(this,r,t),V=r.length-1;V>=0;V--)Mn(this,r[V]);K?Ho(this,K):this.cm&&Dn(this.cm)}),undo:Wt(function(){Ji(this,"undo")}),redo:Wt(function(){Ji(this,"redo")}),undoSelection:Wt(function(){Ji(this,"undo",!0)}),redoSelection:Wt(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,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Gi(this.history.maxGeneration),Xr(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:Rn(this.history.done),undone:Rn(this.history.undone)}},setHistory:function(e){var t=this.history=new Gi(this.history.maxGeneration);t.done=Rn(e.done.slice(0),null,!0),t.undone=Rn(e.undone.slice(0),null,!0)},setGutterMarker:Wt(function(e,t,n){return mi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Le(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Wt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&mi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Le(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Mr(this,e))return null;if(t=e,e=nt(this,e),!e)return null}else if(t=Tt(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:Wt(function(e,t,n){return mi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(b(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Wt(function(e,t,n){return mi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",T=r[i];if(T)if(n==null)r[i]=null;else{var N=T.match(b(n));if(!N)return!1;var K=N.index+N[0].length;r[i]=T.slice(0,N.index)+(!N.index||K==T.length?"":" ")+T.slice(K)||null}else return!1;return!0})}),addLineWidget:Wt(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return In(this,ht(this,e),ht(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=ht(this,e),In(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ht(this,e);var t=[],n=nt(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=ht(this,e),t=ht(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(T){var N=T.markedSpans;if(N)for(var K=0;K<N.length;K++){var V=N[K];!(V.to!=null&&i==e.line&&e.ch>=V.to||V.from==null&&i!=e.line||V.from!=null&&i==t.line&&V.from>=t.ch)&&(!n||n(V.marker))&&r.push(V.marker.parent||V.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var T=i.text.length+r;if(T>e)return t=e,!0;e-=T,++n}),ht(this,Be(n,t))},indexFromPos:function(e){e=ht(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new rr(mn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new rr(mn(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(r,rs(this)),r},unlinkDoc:function(e){if(e instanceof Dt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(rs(this));break}if(e.history==this.history){var r=[e.id];Xr(e,function(i){return r.push(i.id)},!0),e.history=new Gi(null),e.history.done=Rn(this.history.done,r),e.history.undone=Rn(this.history.undone,r)}},iterLinkedDocs:function(e){Xr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):dt(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Wt(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&hl(this.cm)})}),rr.prototype.eachLine=rr.prototype.iter;var ns=0;function Cl(e){var t=this;if(is(t),Fe(t,e)||Nr(t.display,e))return;X(e),B&&(ns=+new Date);var n=on(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,T=Array(i),N=0,K=function(){++N==i&&jt(t,function(){n=ht(t.doc,n);var Ee={from:n,to:n,text:t.doc.splitLines(T.filter(function(ke){return ke!=null}).join(t.doc.lineSeparator())),origin:"paste"};Mn(t.doc,Ee),Ho(t.doc,Gr(ht(t.doc,n),ht(t.doc,Vr(Ee))))})()},V=function(Ee,ke){if(t.options.allowDropFileTypes&&ee(t.options.allowDropFileTypes,Ee.type)==-1){K();return}var Ue=new FileReader;Ue.onerror=function(){return K()},Ue.onload=function(){var Ke=Ue.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ke)){K();return}T[ke]=Ke,K()},Ue.readAsText(Ee)},$=0;$<r.length;$++)V(r[$],$);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ae=e.dataTransfer.getData("Text");if(ae){var ue;if(t.state.draggingText&&!t.state.draggingText.copy&&(ue=t.listSelections()),Yi(t.doc,Gr(n,n)),ue)for(var we=0;we<ue.length;++we)kn(t.doc,"",ue[we].anchor,ue[we].head,"drag");t.replaceSelection(ae,"around","paste"),t.display.input.focus()}}catch(Ee){}}}function Al(e,t){if(B&&(!e.state.draggingText||+new Date-ns<100)){se(t);return}if(Fe(e,t)||Nr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!O){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",S&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),S&&n.parentNode.removeChild(n)}}function Ll(e,t){var n=on(e,t);if(!n)return;var r=document.createDocumentFragment();go(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),s(e.display.dragCursor,r)}function is(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function as(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var T=0;T<n.length;T++)e(n[T])})}var os=!1;function Dl(){if(os)return;Ol(),os=!0}function Ol(){var e;Oe(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(Rl)},100))}),Oe(window,"blur",function(){return as(Ln)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var $r={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++)$r[bi+48]=$r[bi+96]=String(bi);for(var Qi=65;Qi<=90;Qi++)$r[Qi]=String.fromCharCode(Qi);for(var Ei=1;Ei<=12;Ei++)$r[Ei+111]=$r[Ei+63235]="F"+Ei;var Br={};Br.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"},Br.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"},Br.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"},Br.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"]},Br.default=u?Br.macDefault:Br.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,T,N=0;N<t.length-1;N++){var K=t[N];if(/^(cmd|meta|m)$/i.test(K))T=!0;else if(/^a(lt)?$/i.test(K))n=!0;else if(/^(c|ctrl|control)$/i.test(K))r=!0;else if(/^s(hift)?$/i.test(K))i=!0;else throw new Error("Unrecognized modifier name: "+K)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),T&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Ml(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=ne(n.split(" "),Pl),T=0;T<i.length;T++){var N=void 0,K=void 0;T==i.length-1?(K=i.join(" "),N=r):(K=i.slice(0,T+1).join(" "),N="...");var V=t[K];if(!V)t[K]=N;else if(V!=N)throw new Error("Inconsistent bindings for "+K)}delete e[n]}for(var $ in t)e[$]=t[$];return e}function Un(e,t,n,r){t=Zi(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Un(e,t.fallthrough,n,r);for(var T=0;T<t.fallthrough.length;T++){var N=Un(e,t.fallthrough[T],n,r);if(N)return N}}}function ss(e){var t=typeof e=="string"?e:$r[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ls(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(f?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(f?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function us(e,t){if(S&&e.keyCode==34&&e.char)return!1;var n=$r[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),ls(n,e,t))}function Zi(e){return typeof e=="string"?Br[e]:e}function Fn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var T=t(n[i]);r.length&&ct(T.from,J(r).to)<=0;){var N=r.pop();if(ct(N.from,T.from)<0){T.from=N.from;break}}r.push(T)}or(e,function(){for(var K=r.length-1;K>=0;K--)kn(e.doc,"",r[K].from,r[K].to,"+delete");Dn(e)})}function Fa(e,t,n){var r=Ae(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Na(e,t,n){var r=Fa(e,t.ch,n);return r==null?null:new Be(t.line,r,n<0?"after":"before")}function Ba(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var T=Xe(n,t.doc.direction);if(T){var N=i<0?J(T):T[0],K=i<0==(N.level==1),V=K?"after":"before",$;if(N.level>0||t.doc.direction=="rtl"){var ae=_n(t,n);$=i<0?n.text.length-1:0;var ue=Dr(t,ae,$).top;$=je(function(we){return Dr(t,ae,we).top==ue},i<0==(N.level==1)?N.from:N.to-1,$),V=="before"&&($=Fa(n,$,1))}else $=i<0?N.to:N.from;return new Be(r,$,V)}}return new Be(r,i<0?n.text.length:0,i<0?"before":"after")}function kl(e,t,n,r){var i=Xe(t,e.doc.direction);if(!i)return Na(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var T=We(i,n.ch,n.sticky),N=i[T];if(e.doc.direction=="ltr"&&N.level%2==0&&(r>0?N.to>n.ch:N.from<n.ch))return Na(t,n,r);var K=function(Je,qe){return Fa(t,Je instanceof Be?Je.ch:Je,qe)},V,$=function(Je){return e.options.lineWrapping?(V=V||_n(e,t),fo(e,t,V,Je)):{begin:0,end:t.text.length}},ae=$(n.sticky=="before"?K(n,-1):n.ch);if(e.doc.direction=="rtl"||N.level==1){var ue=N.level==1==r<0,we=K(n,ue?1:-1);if(we!=null&&(ue?we<=N.to&&we<=ae.end:we>=N.from&&we>=ae.begin)){var Ee=ue?"before":"after";return new Be(n.line,we,Ee)}}var ke=function(Je,qe,Qe){for(var rt=function(Lt,Ht){return Ht?new Be(n.line,K(Lt,1),"before"):new Be(n.line,Lt,"after")};Je>=0&&Je<i.length;Je+=qe){var ut=i[Je],at=qe>0==(ut.level!=1),pt=at?Qe.begin:K(Qe.end,-1);if(ut.from<=pt&&pt<ut.to)return rt(pt,at);if(pt=at?ut.from:K(ut.to,-1),Qe.begin<=pt&&pt<Qe.end)return rt(pt,at)}},Ue=ke(T+r,r,ae);if(Ue)return Ue;var Ke=r>0?ae.end:K(ae.begin,-1);return Ke!=null&&!(r>0&&Ke==t.text.length)&&(Ue=ke(r>0?0:i.length-1,r,$(Ke)),Ue)?Ue:null}var xi={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ye)},killLine:function(e){return Fn(e,function(t){if(t.empty()){var n=nt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Be(t.head.line+1,0)}:{from:t.head,to:Be(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Fn(e,function(t){return{from:Be(t.from().line,0),to:ht(e.doc,Be(t.to().line+1,0))}})},delLineLeft:function(e){return Fn(e,function(t){return{from:Be(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Fn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return Fn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Be(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Be(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return ds(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return cs(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},le)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},le)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?cs(e,t.head):r},le)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var T=n[i].from(),N=H(e.getLine(T.line),T.ch,r);t.push(pe(r-N%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return or(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,T=nt(e.doc,i.line).text;if(T){if(i.ch==T.length&&(i=new Be(i.line,i.ch-1)),i.ch>0)i=new Be(i.line,i.ch+1),e.replaceRange(T.charAt(i.ch-1)+T.charAt(i.ch-2),Be(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var N=nt(e.doc,i.line-1).text;N&&(i=new Be(i.line,1),e.replaceRange(T.charAt(0)+e.doc.lineSeparator()+N.charAt(N.length-1),Be(i.line-1,N.length-1),i,"+transpose"))}}n.push(new wt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return or(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Dn(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ds(e,t){var n=nt(e.doc,t),r=ur(n);return r!=n&&(t=Tt(r)),Ba(!0,e,r,t,1)}function Il(e,t){var n=nt(e.doc,t),r=ki(n);return r!=n&&(t=Tt(r)),Ba(!0,e,n,t,-1)}function cs(e,t){var n=ds(e,t.line),r=nt(e.doc,n.line),i=Xe(r,e.doc.direction);if(!i||i[0].level==0){var T=Math.max(n.ch,r.text.search(/\S/)),N=t.line==n.line&&t.ch<=T&&t.ch;return Be(n.line,N?0:T,n.sticky)}return n}function qi(e,t,n){if(typeof t=="string"&&(t=xi[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Te}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Ul(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Un(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Un(t,e.options.extraKeys,n,e)||Un(t,e.options.keyMap,n,e)}var Fl=new Y;function Ti(e,t,n,r){var i=e.state.keySeq;if(i){if(ss(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),fs(e,i+" "+t,n,r))return!0}return fs(e,t,n,r)}function fs(e,t,n,r){var i=Ul(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&zt(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(X(n),Ta(e)),!!i}function hs(e,t){var n=us(t,!0);return n?t.shiftKey&&!e.state.keySeq?Ti(e,"Shift-"+n,t,function(r){return qi(e,r,!0)})||Ti(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return qi(e,r)}):Ti(e,n,t,function(r){return qi(e,r)}):!1}function Nl(e,t,n){return Ti(e,"'"+n+"'",t,function(r){return qi(e,r,!0)})}var ja=null;function ms(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=M(),Fe(t,e))return;B&&U<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=hs(t,e);S&&(ja=r?n:null,!r&&n==88&&!_t&&(u?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),L&&!u&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;F(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(h(t,"CodeMirror-crosshair"),$e(document,"keyup",n),$e(document,"mouseover",n))}Oe(document,"keyup",n),Oe(document,"mouseover",n)}function ps(e){e.keyCode==16&&(this.doc.sel.shift=!1),Fe(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Nr(t.display,e)||Fe(t,e)||e.ctrlKey&&!e.altKey||u&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(S&&n==ja){ja=null,X(e);return}if(S&&(!e.which||e.which<10)&&hs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Nl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Wa=function(e,t,n){this.time=e,this.pos=t,this.button=n};Wa.prototype.compare=function(e,t,n){return this.time+jl>e&&ct(t,this.pos)==0&&n==this.button};var Si,wi;function Wl(e,t){var n=+new Date;return wi&&wi.compare(n,e,t)?(Si=wi=null,"triple"):Si&&Si.compare(n,e,t)?(wi=new Wa(n,e,t),Si=null,"double"):(Si=new Wa(n,e,t),wi=null,"single")}function vs(e){var t=this,n=t.display;if(Fe(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Nr(n,e)){k||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=on(t,e),i=De(e),T=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,T,e))return;i==1?r?zl(t,r,T,e):fe(e)==n.scroller&&X(e):i==2?(r&&Xi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(C?t.display.input.onContextMenu(e):yo(t))}function Hl(e,t,n,r,i){var T="Click";return r=="double"?T="Double"+T:r=="triple"&&(T="Triple"+T),T=(t==1?"Left":t==2?"Middle":"Right")+T,Ti(e,ls(T,i),i,function(N){if(typeof N=="string"&&(N=xi[N]),!N)return!1;var K=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),K=N(e,n)!=Te}finally{e.state.suppressEdits=!1}return K})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var T=l?n.shiftKey&&n.metaKey:n.altKey;i.unit=T?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=u?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(u?n.altKey:n.ctrlKey)),i}function zl(e,t,n,r){B?setTimeout(D(vo,e),0):e.curOp.focus=M();var i=Kl(e,n,r),T=e.doc.sel,N;e.options.dragDrop&&Re&&!e.isReadOnly()&&n=="single"&&(N=T.contains(t))>-1&&(ct((N=T.ranges[N]).from(),t)<0||t.xRel>0)&&(ct(N.to(),t)>0||t.xRel<0)?Gl(e,r,t,i):Vl(e,r,t,i)}function Gl(e,t,n,r){var i=e.display,T=!1,N=jt(e,function($){k&&(i.scroller.draggable=!1),e.state.draggingText=!1,$e(i.wrapper.ownerDocument,"mouseup",N),$e(i.wrapper.ownerDocument,"mousemove",K),$e(i.scroller,"dragstart",V),$e(i.scroller,"drop",N),T||(X($),r.addNew||Xi(e.doc,n,null,null,r.extend),k&&!O||B&&U==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),K=function($){T=T||Math.abs(t.clientX-$.clientX)+Math.abs(t.clientY-$.clientY)>=10},V=function(){return T=!0};k&&(i.scroller.draggable=!0),e.state.draggingText=N,N.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Oe(i.wrapper.ownerDocument,"mouseup",N),Oe(i.wrapper.ownerDocument,"mousemove",K),Oe(i.scroller,"dragstart",V),Oe(i.scroller,"drop",N),yo(e),setTimeout(function(){return i.input.focus()},20)}function ys(e,t,n){if(n=="char")return new wt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new wt(Be(t.line,0),ht(e.doc,Be(t.line+1,0)));var r=n(e,t);return new wt(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,T=e.doc;X(t);var N,K,V=T.sel,$=V.ranges;if(r.addNew&&!r.extend?(K=T.sel.contains(n),K>-1?N=$[K]:N=new wt(n,n)):(N=T.sel.primary(),K=T.sel.primIndex),r.unit=="rectangle")r.addNew||(N=new wt(n,n)),n=on(e,t,!0,!0),K=-1;else{var ae=ys(e,n,r.unit);r.extend?N=Ia(N,ae.anchor,ae.head,r.extend):N=ae}r.addNew?K==-1?(K=$.length,Xt(T,Sr(e,$.concat([N]),K),{scroll:!1,origin:"*mouse"})):$.length>1&&$[K].empty()&&r.unit=="char"&&!r.extend?(Xt(T,Sr(e,$.slice(0,K).concat($.slice(K+1)),0),{scroll:!1,origin:"*mouse"}),V=T.sel):Ua(T,K,N,he):(K=0,Xt(T,new cr([N],0),he),V=T.sel);var ue=n;function we(Qe){if(ct(ue,Qe)==0)return;if(ue=Qe,r.unit=="rectangle"){for(var rt=[],ut=e.options.tabSize,at=H(nt(T,n.line).text,n.ch,ut),pt=H(nt(T,Qe.line).text,Qe.ch,ut),Lt=Math.min(at,pt),Ht=Math.max(at,pt),Ot=Math.min(n.line,Qe.line),sr=Math.min(e.lastLine(),Math.max(n.line,Qe.line));Ot<=sr;Ot++){var nr=nt(T,Ot).text,kt=me(nr,Lt,ut);Lt==Ht?rt.push(new wt(Be(Ot,kt),Be(Ot,kt))):nr.length>kt&&rt.push(new wt(Be(Ot,kt),Be(Ot,me(nr,Ht,ut))))}rt.length||rt.push(new wt(n,n)),Xt(T,Sr(e,V.ranges.slice(0,K).concat(rt),K),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Qe)}else{var ir=N,Gt=ys(e,Qe,r.unit),Nt=ir.anchor,It;ct(Gt.anchor,Nt)>0?(It=Gt.head,Nt=Qr(ir.from(),Gt.anchor)):(It=Gt.anchor,Nt=vn(ir.to(),Gt.head));var Pt=V.ranges.slice(0);Pt[K]=Xl(e,new wt(ht(T,Nt),It)),Xt(T,Sr(e,Pt,K),he)}}var Ee=i.wrapper.getBoundingClientRect(),ke=0;function Ue(Qe){var rt=++ke,ut=on(e,Qe,!0,r.unit=="rectangle");if(!ut)return;if(ct(ut,ue)!=0){e.curOp.focus=M(),we(ut);var at=Wi(i,T);(ut.line>=at.to||ut.line<at.from)&&setTimeout(jt(e,function(){ke==rt&&Ue(Qe)}),150)}else{var pt=Qe.clientY<Ee.top?-20:Qe.clientY>Ee.bottom?20:0;pt&&setTimeout(jt(e,function(){if(ke!=rt)return;i.scroller.scrollTop+=pt,Ue(Qe)}),50)}}function Ke(Qe){e.state.selectingText=!1,ke=Infinity,Qe&&(X(Qe),i.input.focus()),$e(i.wrapper.ownerDocument,"mousemove",Je),$e(i.wrapper.ownerDocument,"mouseup",qe),T.history.lastSelOrigin=null}var Je=jt(e,function(Qe){Qe.buttons===0||!De(Qe)?Ke(Qe):Ue(Qe)}),qe=jt(e,Ke);e.state.selectingText=qe,Oe(i.wrapper.ownerDocument,"mousemove",Je),Oe(i.wrapper.ownerDocument,"mouseup",qe)}function Xl(e,t){var n=t.anchor,r=t.head,i=nt(e.doc,n.line);if(ct(n,r)==0&&n.sticky==r.sticky)return t;var T=Xe(i);if(!T)return t;var N=We(T,n.ch,n.sticky),K=T[N];if(K.from!=n.ch&&K.to!=n.ch)return t;var V=N+(K.from==n.ch==(K.level!=1)?0:1);if(V==0||V==T.length)return t;var $;if(r.line!=n.line)$=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ae=We(T,r.ch,r.sticky),ue=ae-N||(r.ch-n.ch)*(K.level==1?-1:1);ae==V-1||ae==V?$=ue<0:$=ue>0}var we=T[V+($?-1:0)],Ee=$==(we.level==1),ke=Ee?we.from:we.to,Ue=Ee?"after":"before";return n.ch==ke&&n.sticky==Ue?t:new wt(new Be(n.line,ke,Ue),r)}function bs(e,t,n,r){var i,T;if(t.touches)i=t.touches[0].clientX,T=t.touches[0].clientY;else try{i=t.clientX,T=t.clientY}catch(we){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&X(t);var N=e.display,K=N.lineDiv.getBoundingClientRect();if(T>K.bottom||!de(e,n))return te(t);T-=K.top-N.viewOffset;for(var V=0;V<e.display.gutterSpecs.length;++V){var $=N.gutters.childNodes[V];if($&&$.getBoundingClientRect().right>=i){var ae=gr(e.doc,T),ue=e.display.gutterSpecs[V];return Pe(e,n,e,ae,ue.className,t),te(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function Es(e,t){if(Nr(e.display,t)||Yl(e,t))return;if(Fe(e,t,"contextmenu"))return;C||e.display.input.onContextMenu(t)}function Yl(e,t){return de(e,"gutterContextMenu")?bs(e,t,"gutterContextMenu",!1):!1}function xs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ii(e)}var Nn={toString:function(){return"CodeMirror.Init"}},Ts={},ea={};function $l(e){var t=e.optionHandlers;function n(r,i,T,N){e.defaults[r]=i,T&&(t[r]=N?function(K,V,$){$!=Nn&&T(K,V,$)}:T)}e.defineOption=n,e.Init=Nn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Pa(r)},!0),n("indentUnit",2,Pa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){fi(r),ii(r),tr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var T=[],N=r.doc.first;r.doc.iter(function(V){for(var $=0;;){var ae=V.text.indexOf(i,$);if(ae==-1)break;$=ae+i.length,T.push(Be(N,ae))}N++});for(var K=T.length-1;K>=0;K--)kn(r.doc,i,T[K],Be(T[K].line,T[K].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,T){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),T!=Nn&&r.refresh()}),n("specialCharPlaceholder",At,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!w),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){xs(r),ci(r)},!0),n("keyMap","default",function(r,i,T){var N=Zi(i),K=T!=Nn&&Zi(T);K&&K.detach&&K.detach(r,N),N.attach&&N.attach(r,K||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ql,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Oa(i,r.options.lineNumbers),ci(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Ea(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return On(r)},!0),n("scrollbarStyle","native",function(r){wo(r),On(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=Oa(r.options.gutters,i),ci(r)},!0),n("firstLineNumber",1,ci,!0),n("lineNumberFormatter",function(r){return r},ci,!0),n("showCursorWhenSelecting",!1,ai,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Ln(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,ai,!0),n("singleCursorHeightPerLine",!0,ai,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,fi,!0),n("addModeClass",!1,fi,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,fi,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Jl(e,t,n){var r=n&&n!=Nn;if(!t!=!r){var i=e.display.dragFunctions,T=t?Oe:$e;T(e.display.scroller,"dragstart",i.start),T(e.display.scroller,"dragenter",i.enter),T(e.display.scroller,"dragover",i.over),T(e.display.scroller,"dragleave",i.leave),T(e.display.scroller,"drop",i.drop)}}function Ql(e){e.options.lineWrapping?(F(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(h(e.display.wrapper,"CodeMirror-wrap"),Ii(e)),xa(e),tr(e),ii(e),setTimeout(function(){return On(e)},100)}function Dt(e,t){var n=this;if(!(this instanceof Dt))return new Dt(e,t);this.options=t=t?P(t):{},P(Ts,t,!1);var r=t.value;typeof r=="string"?r=new rr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Dt.inputStyles[t.inputStyle](this),T=this.display=new dl(e,r,i,t);T.wrapper.CodeMirror=this,xs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),wo(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new Y,keySeq:null,specialChars:null},t.autofocus&&!o&&T.input.focus(),B&&U<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Dl(),dn(this),this.curOp.forceUpdate=!0,ko(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Sa(n)},20):Ln(this);for(var N in ea)ea.hasOwnProperty(N)&&ea[N](this,t[N],Nn);Ao(this),t.finishInit&&t.finishInit(this);for(var K=0;K<Ka.length;++K)Ka[K](this);cn(this),k&&t.lineWrapping&&getComputedStyle(T.lineDiv).textRendering=="optimizelegibility"&&(T.lineDiv.style.textRendering="auto")}Dt.defaults=Ts,Dt.optionHandlers=ea;function Zl(e){var t=e.display;Oe(t.scroller,"mousedown",jt(e,vs)),B&&U<11?Oe(t.scroller,"dblclick",jt(e,function(V){if(Fe(e,V))return;var $=on(e,V);if(!$||Ha(e,V)||Nr(e.display,V))return;X(V);var ae=e.findWordAt($);Xi(e.doc,ae.anchor,ae.head)})):Oe(t.scroller,"dblclick",function(V){return Fe(e,V)||X(V)}),Oe(t.scroller,"contextmenu",function(V){return Es(e,V)}),Oe(t.input.getField(),"contextmenu",function(V){t.scroller.contains(V.target)||Es(e,V)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function T(V){if(V.touches.length!=1)return!1;var $=V.touches[0];return $.radiusX<=1&&$.radiusY<=1}function N(V,$){if($.left==null)return!0;var ae=$.left-V.left,ue=$.top-V.top;return ae*ae+ue*ue>20*20}Oe(t.scroller,"touchstart",function(V){if(!Fe(e,V)&&!T(V)&&!Ha(e,V)){t.input.ensurePolled(),clearTimeout(n);var $=+new Date;t.activeTouch={start:$,moved:!1,prev:$-r.end<=300?r:null},V.touches.length==1&&(t.activeTouch.left=V.touches[0].pageX,t.activeTouch.top=V.touches[0].pageY)}}),Oe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Oe(t.scroller,"touchend",function(V){var $=t.activeTouch;if($&&!Nr(t,V)&&$.left!=null&&!$.moved&&new Date-$.start<300){var ae=e.coordsChar(t.activeTouch,"page"),ue;!$.prev||N($,$.prev)?ue=new wt(ae,ae):!$.prev.prev||N($,$.prev.prev)?ue=e.findWordAt(ae):ue=new wt(Be(ae.line,0),ht(e.doc,Be(ae.line+1,0))),e.setSelection(ue.anchor,ue.head),e.focus(),X(V)}i()}),Oe(t.scroller,"touchcancel",i),Oe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(si(e,t.scroller.scrollTop),ln(e,t.scroller.scrollLeft,!0),Pe(e,"scroll",e))}),Oe(t.scroller,"mousewheel",function(V){return Oo(e,V)}),Oe(t.scroller,"DOMMouseScroll",function(V){return Oo(e,V)}),Oe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(V){Fe(e,V)||se(V)},over:function(V){Fe(e,V)||(Ll(e,V),se(V))},start:function(V){return Al(e,V)},drop:jt(e,Cl),leave:function(V){Fe(e,V)||is(e)}};var K=t.input.getField();Oe(K,"keyup",function(V){return ps.call(e,V)}),Oe(K,"keydown",jt(e,ms)),Oe(K,"keypress",jt(e,gs)),Oe(K,"focus",function(V){return Sa(e,V)}),Oe(K,"blur",function(V){return Ln(e,V)})}var Ka=[];Dt.defineInitHook=function(e){return Ka.push(e)};function _i(e,t,n,r){var i=e.doc,T;n==null&&(n="add"),n=="smart"&&(i.mode.indent?T=vr(e,t).state:n="prev");var N=e.options.tabSize,K=nt(i,t),V=H(K.text,null,N);K.stateAfter&&(K.stateAfter=null);var $=K.text.match(/^\s*/)[0],ae;if(!r&&!/\S/.test(K.text))ae=0,n="not";else if(n=="smart"&&(ae=i.mode.indent(T,K.text.slice($.length),K.text),ae==Te||ae>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?ae=H(nt(i,t-1).text,null,N):ae=0:n=="add"?ae=V+e.options.indentUnit:n=="subtract"?ae=V-e.options.indentUnit:typeof n=="number"&&(ae=V+n),ae=Math.max(0,ae);var ue="",we=0;if(e.options.indentWithTabs)for(var Ee=Math.floor(ae/N);Ee;--Ee)we+=N,ue+=" ";if(we<ae&&(ue+=pe(ae-we)),ue!=$)return kn(i,ue,Be(t,0),Be(t,$.length),"+input"),K.stateAfter=null,!0;for(var ke=0;ke<i.sel.ranges.length;ke++){var Ue=i.sel.ranges[ke];if(Ue.head.line==t&&Ue.head.ch<$.length){var Ke=Be(t,$.length);Ua(i,ke,new wt(Ke,Ke));break}}}var wr=null;function ta(e){wr=e}function za(e,t,n,r,i){var T=e.doc;e.display.shift=!1,r||(r=T.sel);var N=+new Date-200,K=i=="paste"||e.state.pasteIncoming>N,V=dt(t),$=null;if(K&&r.ranges.length>1)if(wr&&wr.text.join(`
|
|
`)==t){if(r.ranges.length%wr.text.length==0){$=[];for(var ae=0;ae<wr.text.length;ae++)$.push(T.splitLines(wr.text[ae]))}}else V.length==r.ranges.length&&e.options.pasteLinesPerSelection&&($=ne(V,function(Je){return[Je]}));for(var ue=e.curOp.updateInput,we=r.ranges.length-1;we>=0;we--){var Ee=r.ranges[we],ke=Ee.from(),Ue=Ee.to();Ee.empty()&&(n&&n>0?ke=Be(ke.line,ke.ch-n):e.state.overwrite&&!K?Ue=Be(Ue.line,Math.min(nt(T,Ue.line).text.length,Ue.ch+J(V).length)):K&&wr&&wr.lineWise&&wr.text.join(`
|
|
`)==V.join(`
|
|
`)&&(ke=Ue=Be(ke.line,0)));var Ke={from:ke,to:Ue,text:$?$[we%$.length]:V,origin:i||(K?"paste":e.state.cutIncoming>N?"cut":"+input")};Mn(e.doc,Ke),zt(e,"inputRead",e,Ke)}t&&!K&&ws(e,t),Dn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ue),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ss(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&or(t,function(){return za(t,n,0,null,"paste")}),!0}function ws(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var T=e.getModeAt(i.head),N=!1;if(T.electricChars){for(var K=0;K<T.electricChars.length;K++)if(t.indexOf(T.electricChars.charAt(K))>-1){N=_i(e,i.head.line,"smart");break}}else T.electricInput&&(T.electricInput.test(nt(e.doc,i.head.line).text.slice(0,i.head.ch))&&(N=_i(e,i.head.line,"smart")));N&&zt(e,"electricInput",e,i.head.line)}}function _s(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,T={anchor:Be(i,0),head:Be(i+1,0)};n.push(T),t.push(e.getRange(T.anchor,T.head))}return{text:t,ranges:n}}function Cs(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function As(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return k?e.style.width="1000px":e.setAttribute("wrap","off"),v&&(e.style.border="1px solid black"),Cs(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var T=this.options,N=T[r];if(T[r]==i&&r!="mode")return;T[r]=i,t.hasOwnProperty(r)&&jt(this,t[r])(this,i,N),Pe(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](Zi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,T=0;T<i.length;++T)if(i[T]==r||i[T].name==r)return i.splice(T,1),!0},addOverlay:Jt(function(r,i){var T=r.token?r:e.getMode(this.options,r);if(T.startState)throw new Error("Overlays may not be stateful.");q(this.state.overlays,{mode:T,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(N){return N.priority}),this.state.modeGen++,tr(this)}),removeOverlay:Jt(function(r){for(var i=this.state.overlays,T=0;T<i.length;++T){var N=i[T].modeSpec;if(N==r||typeof r=="string"&&N.name==r){i.splice(T,1),this.state.modeGen++,tr(this);return}}}),indentLine:Jt(function(r,i,T){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Mr(this.doc,r)&&_i(this,r,i,T)}),indentSelection:Jt(function(r){for(var i=this.doc.sel.ranges,T=-1,N=0;N<i.length;N++){var K=i[N];if(K.empty())K.head.line>T&&(_i(this,K.head.line,r,!0),T=K.head.line,N==this.doc.sel.primIndex&&Dn(this));else{var V=K.from(),$=K.to(),ae=Math.max(T,V.line);T=Math.min(this.lastLine(),$.line-($.ch?0:1))+1;for(var ue=ae;ue<T;++ue)_i(this,ue,r);var we=this.doc.sel.ranges;V.ch==0&&i.length==we.length&&we[N].from().ch>0&&Ua(this.doc,N,new wt(V,we[N].to()),ye)}}}),getTokenAt:function(r,i){return Ai(this,r,i)},getLineTokens:function(r,i){return Ai(this,Be(r),i,!0)},getTokenTypeAt:function(r){r=ht(this.doc,r);var i=Zr(this,nt(this.doc,r.line)),T=0,N=(i.length-1)/2,K=r.ch,V;if(K==0)V=i[2];else for(;;){var $=T+N>>1;if(($?i[$*2-1]:0)>=K)N=$;else if(i[$*2+1]<K)T=$+1;else{V=i[$*2+2];break}}var ae=V?V.indexOf("overlay "):-1;return ae<0?V:ae==0?null:V.slice(0,ae-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var T=[];if(!n.hasOwnProperty(i))return T;var N=n[i],K=this.getModeAt(r);if(typeof K[i]=="string")N[K[i]]&&T.push(N[K[i]]);else if(K[i])for(var V=0;V<K[i].length;V++){var $=N[K[i][V]];$&&T.push($)}else K.helperType&&N[K.helperType]?T.push(N[K.helperType]):N[K.name]&&T.push(N[K.name]);for(var ae=0;ae<N._global.length;ae++){var ue=N._global[ae];ue.pred(K,this)&&ee(T,ue.val)==-1&&T.push(ue.val)}return T},getStateAfter:function(r,i){var T=this.doc;return r=yn(T,r==null?T.first+T.size-1:r),vr(this,r+1,i).state},cursorCoords:function(r,i){var T,N=this.doc.sel.primary();return r==null?T=N.head:typeof r=="object"?T=ht(this.doc,r):T=r?N.from():N.to(),Tr(this,T,i||"page")},charCoords:function(r,i){return pa(this,ht(this.doc,r),i||"page")},coordsChar:function(r,i){return r=lo(this,r,i||"page"),va(this,r.left,r.top)},lineAtHeight:function(r,i){return r=lo(this,{top:r,left:0},i||"page").top,gr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,T){var N=!1,K;if(typeof r=="number"){var V=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>V&&(r=V,N=!0),K=nt(this.doc,r)}else K=r;return Fi(this,K,{top:0,left:0},i||"page",T||N).top+(N?this.doc.height-xr(K):0)},defaultTextHeight:function(){return Cn(this.display)},defaultCharWidth:function(){return An(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,T,N,K){var V=this.display;r=Tr(this,ht(this.doc,r));var $=r.bottom,ae=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),V.sizer.appendChild(i),N=="over")$=r.top;else if(N=="above"||N=="near"){var ue=Math.max(V.wrapper.clientHeight,this.doc.height),we=Math.max(V.sizer.clientWidth,V.lineSpace.clientWidth);(N=="above"||r.bottom+i.offsetHeight>ue)&&r.top>i.offsetHeight?$=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=ue&&($=r.bottom),ae+i.offsetWidth>we&&(ae=we-i.offsetWidth)}i.style.top=$+"px",i.style.left=i.style.right="",K=="right"?(ae=V.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(K=="left"?ae=0:K=="middle"&&(ae=(V.sizer.clientWidth-i.offsetWidth)/2),i.style.left=ae+"px"),T&&Js(this,{left:ae,top:$,right:ae+i.offsetWidth,bottom:$+i.offsetHeight})},triggerOnKeyDown:Jt(ms),triggerOnKeyPress:Jt(gs),triggerOnKeyUp:ps,triggerOnMouseDown:Jt(vs),execCommand:function(r){if(xi.hasOwnProperty(r))return xi[r].call(null,this)},triggerElectric:Jt(function(r){ws(this,r)}),findPosH:function(r,i,T,N){var K=1;i<0&&(K=-1,i=-i);for(var V=ht(this.doc,r),$=0;$<i&&!(V=Ga(this.doc,V,K,T,N),V.hitSide);++$);return V},moveH:Jt(function(r,i){var T=this;this.extendSelectionsBy(function(N){return T.display.shift||T.doc.extend||N.empty()?Ga(T.doc,N.head,r,i,T.options.rtlMoveVisually):r<0?N.from():N.to()},le)}),deleteH:Jt(function(r,i){var T=this.doc.sel,N=this.doc;T.somethingSelected()?N.replaceSelection("",null,"+delete"):Fn(this,function(K){var V=Ga(N,K.head,r,i,!1);return r<0?{from:V,to:K.head}:{from:K.head,to:V}})}),findPosV:function(r,i,T,N){var K=1,V=N;i<0&&(K=-1,i=-i);for(var $=ht(this.doc,r),ae=0;ae<i;++ae){var ue=Tr(this,$,"div");if(V==null?V=ue.left:ue.left=V,$=Ls(this,ue,K,T),$.hitSide)break}return $},moveV:Jt(function(r,i){var T=this,N=this.doc,K=[],V=!this.display.shift&&!N.extend&&N.sel.somethingSelected();if(N.extendSelectionsBy(function(ae){if(V)return r<0?ae.from():ae.to();var ue=Tr(T,ae.head,"div");ae.goalColumn!=null&&(ue.left=ae.goalColumn),K.push(ue.left);var we=Ls(T,ue,r,i);return i=="page"&&ae==N.sel.primary()&&_a(T,pa(T,we,"div").top-ue.top),we},le),K.length)for(var $=0;$<N.sel.ranges.length;$++)N.sel.ranges[$].goalColumn=K[$]}),findWordAt:function(r){var i=this.doc,T=nt(i,r.line).text,N=r.ch,K=r.ch;if(T){var V=this.getHelper(r,"wordChars");(r.sticky=="before"||K==T.length)&&N?--N:++K;for(var $=T.charAt(N),ae=Se($,V)?function(ue){return Se(ue,V)}:/\s/.test($)?function(ue){return/\s/.test(ue)}:function(ue){return!/\s/.test(ue)&&!Se(ue)};N>0&&ae(T.charAt(N-1));)--N;for(;K<T.length&&ae(T.charAt(K));)++K}return new wt(Be(r.line,N),Be(r.line,K))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?F(this.display.cursorDiv,"CodeMirror-overwrite"):h(this.display.cursorDiv,"CodeMirror-overwrite"),Pe(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==M()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Jt(function(r,i){oi(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Lr(this)-this.display.barHeight,width:r.scrollWidth-Lr(this)-this.display.barWidth,clientHeight:fa(this),clientWidth:nn(this)}},scrollIntoView:Jt(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Be(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?Qs(this,r):Eo(this,r.from,r.to,r.margin)}),setSize:Jt(function(r,i){var T=this,N=function(V){return typeof V=="number"||/^\d+$/.test(String(V))?V+"px":V};r!=null&&(this.display.wrapper.style.width=N(r)),i!=null&&(this.display.wrapper.style.height=N(i)),this.options.lineWrapping&&ao(this);var K=this.display.viewFrom;this.doc.iter(K,this.display.viewTo,function(V){if(V.widgets){for(var $=0;$<V.widgets.length;$++)if(V.widgets[$].noHScroll){Kr(T,K,"widget");break}}++K}),this.curOp.forceUpdate=!0,Pe(this,"refresh",this)}),operation:function(r){return or(this,r)},startOperation:function(){return dn(this)},endOperation:function(){return cn(this)},refresh:Jt(function(){var r=this.display.cachedTextHeight;tr(this),this.curOp.forceUpdate=!0,ii(this),oi(this,this.doc.scrollLeft,this.doc.scrollTop),La(this.display),(r==null||Math.abs(r-Cn(this.display))>.5||this.options.lineWrapping)&&xa(this),Pe(this,"refresh",this)}),swapDoc:Jt(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),ko(this,r),ii(this),this.display.input.reset(),oi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,zt(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ce(e),e.registerHelper=function(r,i,T){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=T},e.registerGlobalHelper=function(r,i,T,N){e.registerHelper(r,i,N),n[r]._global.push({pred:T,val:N})}}function Ga(e,t,n,r,i){var T=t,N=n,K=nt(e,t.line),V=i&&e.direction=="rtl"?-n:n;function $(){var qe=t.line+V;return qe<e.first||qe>=e.first+e.size?!1:(t=new Be(qe,t.ch,t.sticky),K=nt(e,qe))}function ae(qe){var Qe;if(r=="codepoint"){var rt=K.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(rt)?Qe=null:Qe=new Be(t.line,Math.max(0,Math.min(K.text.length,t.ch+n*(rt>=55296&&rt<56320?2:1))),-n)}else i?Qe=kl(e.cm,K,t,n):Qe=Na(K,t,n);if(Qe==null)if(!qe&&$())t=Ba(i,e.cm,K,t.line,V);else return!1;else t=Qe;return!0}if(r=="char"||r=="codepoint")ae();else if(r=="column")ae(!0);else if(r=="word"||r=="group")for(var ue=null,we=r=="group",Ee=e.cm&&e.cm.getHelper(t,"wordChars"),ke=!0;!(n<0&&!ae(!ke));ke=!1){var Ue=K.text.charAt(t.ch)||`
|
|
`,Ke=Se(Ue,Ee)?"w":we&&Ue==`
|
|
`?"n":!we||/\s/.test(Ue)?null:"p";if(we&&!ke&&!Ke&&(Ke="s"),ue&&ue!=Ke){n<0&&(n=1,ae(),t.sticky="after");break}if(Ke&&(ue=Ke),n>0&&!ae(!ke))break}var Je=$i(e,t,T,N,!0);return zn(T,Je)&&(Je.hitSide=!0),Je}function Ls(e,t,n,r){var i=e.doc,T=t.left,N;if(r=="page"){var K=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),V=Math.max(K-.5*Cn(e.display),3);N=(n>0?t.bottom:t.top)+n*V}else r=="line"&&(N=n>0?t.bottom+3:t.top-3);for(var $;!($=va(e,T,N),!$.outside);){if(n<0?N<=0:N>=i.height){$.hitSide=!0;break}N+=n*5}return $}var Ct=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Y,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Ct.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;Cs(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function T(K){for(var V=K.target;V;V=V.parentNode){if(V==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(V.className))break}return!1}Oe(i,"paste",function(K){if(!T(K)||Fe(r,K)||Ss(K,r))return;U<=11&&setTimeout(jt(r,function(){return t.updateFromDOM()}),20)}),Oe(i,"compositionstart",function(K){t.composing={data:K.data,done:!1}}),Oe(i,"compositionupdate",function(K){t.composing||(t.composing={data:K.data,done:!1})}),Oe(i,"compositionend",function(K){t.composing&&(K.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Oe(i,"touchstart",function(){return n.forceCompositionEnd()}),Oe(i,"input",function(){t.composing||t.readFromDOMSoon()});function N(K){if(!T(K)||Fe(r,K))return;if(r.somethingSelected())ta({lineWise:!1,text:r.getSelections()}),K.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var V=_s(r);ta({lineWise:!0,text:V.text}),K.type=="cut"&&r.operation(function(){r.setSelections(V.ranges,0,ye),r.replaceSelection("",null,"cut")})}else return;if(K.clipboardData){K.clipboardData.clearData();var $=wr.text.join(`
|
|
`);if(K.clipboardData.setData("Text",$),K.clipboardData.getData("Text")==$){K.preventDefault();return}}var ae=As(),ue=ae.firstChild;r.display.lineSpace.insertBefore(ae,r.display.lineSpace.firstChild),ue.value=wr.text.join(`
|
|
`);var we=document.activeElement;W(ue),setTimeout(function(){r.display.lineSpace.removeChild(ae),we.focus(),we==i&&n.showPrimarySelection()},50)}Oe(i,"copy",N),Oe(i,"cut",N)},Ct.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Ct.prototype.prepareSelection=function(){var e=po(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,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var T=ra(t,e.anchorNode,e.anchorOffset),N=ra(t,e.focusNode,e.focusOffset);if(T&&!T.bad&&N&&!N.bad&&ct(Qr(T,N),r)==0&&ct(vn(T,N),i)==0)return;var K=t.display.view,V=r.line>=t.display.viewFrom&&Ds(t,r)||{node:K[0].measure.map[2],offset:0},$=i.line<t.display.viewTo&&Ds(t,i);if(!$){var ae=K[K.length-1].measure,ue=ae.maps?ae.maps[ae.maps.length-1]:ae.map;$={node:ue[ue.length-1],offset:ue[ue.length-2]-ue[ue.length-3]}}if(!V||!$){e.removeAllRanges();return}var we=e.rangeCount&&e.getRangeAt(0),Ee;try{Ee=m(V.node,V.offset,$.offset,$.node)}catch(ke){}Ee&&(!L&&t.state.focused?(e.collapse(V.node,V.offset),Ee.collapsed||(e.removeAllRanges(),e.addRange(Ee))):(e.removeAllRanges(),e.addRange(Ee)),we&&e.anchorNode==null?e.addRange(we):L&&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){s(this.cm.display.cursorDiv,e.cursors),s(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 E(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():or(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(d&&y&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=ra(t,e.anchorNode,e.anchorOffset),r=ra(t,e.focusNode,e.focusOffset);n&&r&&or(t,function(){Xt(t.doc,Gr(n,r),ye),(n.bad||r.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,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Be(r.line-1,nt(e.doc,r.line-1).length)),i.ch==nt(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Be(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var T,N,K;r.line==t.viewFrom||(T=sn(e,r.line))==0?(N=Tt(t.view[0].line),K=t.view[0].node):(N=Tt(t.view[T].line),K=t.view[T-1].node.nextSibling);var V=sn(e,i.line),$,ae;if(V==t.view.length-1?($=t.viewTo-1,ae=t.lineDiv.lastChild):($=Tt(t.view[V+1].line)-1,ae=t.view[V+1].node.previousSibling),!K)return!1;for(var ue=e.doc.splitLines(tu(e,K,ae,N,$)),we=Pr(e.doc,Be(N,0),Be($,nt(e.doc,$).text.length));ue.length>1&&we.length>1;)if(J(ue)==J(we))ue.pop(),we.pop(),$--;else if(ue[0]==we[0])ue.shift(),we.shift(),N++;else break;for(var Ee=0,ke=0,Ue=ue[0],Ke=we[0],Je=Math.min(Ue.length,Ke.length);Ee<Je&&Ue.charCodeAt(Ee)==Ke.charCodeAt(Ee);)++Ee;for(var qe=J(ue),Qe=J(we),rt=Math.min(qe.length-(ue.length==1?Ee:0),Qe.length-(we.length==1?Ee:0));ke<rt&&qe.charCodeAt(qe.length-ke-1)==Qe.charCodeAt(Qe.length-ke-1);)++ke;if(ue.length==1&&we.length==1&&N==r.line)for(;Ee&&Ee>r.ch&&qe.charCodeAt(qe.length-ke-1)==Qe.charCodeAt(Qe.length-ke-1);)Ee--,ke++;ue[ue.length-1]=qe.slice(0,qe.length-ke).replace(/^\u200b+/,""),ue[0]=ue[0].slice(Ee).replace(/\u200b+$/,"");var ut=Be(N,Ee),at=Be($,we.length?J(we).length-ke:0);if(ue.length>1||ue[0]||ct(ut,at))return kn(e.doc,ue,ut,at,"+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())&&or(this.cm,function(){return tr(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()||jt(this.cm,za)(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 Ds(e,t){var n=ha(e,t.line);if(!n||n.hidden)return null;var r=nt(e.doc,t.line),i=eo(n,r,t.line),T=Xe(r,e.doc.direction),N="left";if(T){var K=We(T,t.ch);N=K%2?"right":"left"}var V=no(i.map,t.ch,N);return V.offset=V.collapse=="right"?V.end:V.start,V}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Bn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var T="",N=!1,K=e.doc.lineSeparator(),V=!1;function $(Ee){return function(ke){return ke.id==Ee}}function ae(){N&&(T+=K,V&&(T+=K),N=V=!1)}function ue(Ee){Ee&&(ae(),T+=Ee)}function we(Ee){if(Ee.nodeType==1){var ke=Ee.getAttribute("cm-text");if(ke){ue(ke);return}var Ue=Ee.getAttribute("cm-marker"),Ke;if(Ue){var Je=e.findMarks(Be(r,0),Be(i+1,0),$(+Ue));Je.length&&(Ke=Je[0].find(0))&&ue(Pr(e.doc,Ke.from,Ke.to).join(K));return}if(Ee.getAttribute("contenteditable")=="false")return;var qe=/^(pre|div|p|li|table|br)$/i.test(Ee.nodeName);if(!/^br$/i.test(Ee.nodeName)&&Ee.textContent.length==0)return;qe&&ae();for(var Qe=0;Qe<Ee.childNodes.length;Qe++)we(Ee.childNodes[Qe]);/^(pre|p)$/i.test(Ee.nodeName)&&(V=!0),qe&&(N=!0)}else Ee.nodeType==3&&ue(Ee.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(we(t),t==n);)t=t.nextSibling,V=!1;return T}function ra(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Bn(e.clipPos(Be(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var T=e.display.view[i];if(T.node==r)return ru(T,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!E(r,t))return Bn(Be(Tt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var T=e.rest?J(e.rest):e.line;return Bn(Be(Tt(T),T.text.length),i)}var N=t.nodeType==3?t:null,K=t;for(!N&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(N=t.firstChild,n&&(n=N.nodeValue.length));K.parentNode!=r;)K=K.parentNode;var V=e.measure,$=V.maps;function ae(Ke,Je,qe){for(var Qe=-1;Qe<($?$.length:0);Qe++)for(var rt=Qe<0?V.map:$[Qe],ut=0;ut<rt.length;ut+=3){var at=rt[ut+2];if(at==Ke||at==Je){var pt=Tt(Qe<0?e.line:e.rest[Qe]),Lt=rt[ut]+qe;return(qe<0||at!=Ke)&&(Lt=rt[ut+(qe?1:0)]),Be(pt,Lt)}}}var ue=ae(N,K,n);if(ue)return Bn(ue,i);for(var we=K.nextSibling,Ee=N?N.nodeValue.length-n:0;we;we=we.nextSibling){if(ue=ae(we,we.firstChild,0),ue)return Bn(Be(ue.line,ue.ch-Ee),i);Ee+=we.textContent.length}for(var ke=K.previousSibling,Ue=n;ke;ke=ke.previousSibling){if(ue=ae(ke,ke.firstChild,-1),ue)return Bn(Be(ue.line,ue.ch+Ue),i);Ue+=ke.textContent.length}}var Mt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Y,this.hasSelection=!1,this.composing=null};Mt.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),v&&(i.style.width="0px"),Oe(i,"input",function(){B&&U>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Oe(i,"paste",function(N){if(Fe(r,N)||Ss(N,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function T(N){if(Fe(r,N))return;if(r.somethingSelected())ta({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var K=_s(r);ta({lineWise:!0,text:K.text}),N.type=="cut"?r.setSelections(K.ranges,null,ye):(n.prevInput="",i.value=K.text.join(`
|
|
`),W(i))}else return;N.type=="cut"&&(r.state.cutIncoming=+new Date)}Oe(i,"cut",T),Oe(i,"copy",T),Oe(e.scroller,"paste",function(N){if(Nr(e,N)||Fe(r,N))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var K=new Event("paste");K.clipboardData=N.clipboardData,i.dispatchEvent(K)}),Oe(e.lineSpace,"selectstart",function(N){Nr(e,N)||X(N)}),Oe(i,"compositionstart",function(){var N=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:N,range:r.markText(N,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Oe(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Mt.prototype.createField=function(e){this.wrapper=As(),this.textarea=this.wrapper.firstChild},Mt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Mt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=po(e);if(e.options.moveInputWithCursor){var i=Tr(e,n.sel.primary().head,"div"),T=t.wrapper.getBoundingClientRect(),N=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+N.top-T.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+N.left-T.left))}return r},Mt.prototype.showSelection=function(e){var t=this.cm,n=t.display;s(n.cursorDiv,e.cursors),s(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Mt.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&W(this.textarea),B&&U>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",B&&U>=9&&(this.hasSelection=null))},Mt.prototype.getField=function(){return this.textarea},Mt.prototype.supportsTouch=function(){return!1},Mt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||M()!=this.textarea))try{this.textarea.focus()}catch(e){}},Mt.prototype.blur=function(){this.textarea.blur()},Mt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Mt.prototype.receivedFocus=function(){this.slowPoll()},Mt.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()})},Mt.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},Mt.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||st(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(B&&U>=9&&this.hasSelection===i||u&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var T=i.charCodeAt(0);if(T==8203&&!r&&(r="\u200B"),T==8666)return this.reset(),this.cm.execCommand("undo")}for(var N=0,K=Math.min(r.length,i.length);N<K&&r.charCodeAt(N)==i.charCodeAt(N);)++N;return or(t,function(){za(t,i.slice(N),r.length-N,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
|
|
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Mt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Mt.prototype.onKeyPress=function(){B&&U>=9&&(this.hasSelection=null),this.fastPoll()},Mt.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var T=on(n,e),N=r.scroller.scrollTop;if(!T||S)return;var K=n.options.resetSelectionOnContextMenu;K&&n.doc.sel.contains(T)==-1&&jt(n,Xt)(n.doc,Gr(T),ye);var V=i.style.cssText,$=t.wrapper.style.cssText,ae=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-ae.top-5)+"px; left: "+(e.clientX-ae.left-5)+`px;
|
|
z-index: 1000; background: `+(B?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ue;k&&(ue=window.scrollY),r.input.focus(),k&&window.scrollTo(null,ue),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=Ee,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function we(){if(i.selectionStart!=null){var Ue=n.somethingSelected(),Ke="\u200B"+(Ue?i.value:"");i.value="\u21DA",i.value=Ke,t.prevInput=Ue?"":"\u200B",i.selectionStart=1,i.selectionEnd=Ke.length,r.selForContextMenu=n.doc.sel}}function Ee(){if(t.contextMenuPending!=Ee)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=$,i.style.cssText=V,B&&U<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=N),i.selectionStart!=null){(!B||B&&U<9)&&we();var Ue=0,Ke=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?jt(n,Xo)(n):Ue++<10?r.detectingSelectAll=setTimeout(Ke,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Ke,200)}}if(B&&U>=9&&we(),C){se(e);var ke=function(){$e(window,"mouseup",ke),setTimeout(Ee,20)};Oe(window,"mouseup",ke)}else setTimeout(Ee,50)},Mt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Mt.prototype.setUneditable=function(){},Mt.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?P(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=M();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=K.getValue()}var i;if(e.form&&(Oe(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var T=e.form;i=T.submit;try{var N=T.submit=function(){r(),T.submit=i,T.submit(),T.submit=N}}catch(V){}}t.finishInit=function(V){V.save=r,V.getTextArea=function(){return e},V.toTextArea=function(){V.toTextArea=isNaN,r(),e.parentNode.removeChild(V.getWrapperElement()),e.style.display="",e.form&&($e(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var K=Dt(function(V){return e.parentNode.insertBefore(V,e.nextSibling)},t);return K}function iu(e){e.off=$e,e.on=Oe,e.wheelEventPixels=cl,e.Doc=rr,e.splitLines=dt,e.countColumn=H,e.findColumn=me,e.isWordChar=ge,e.Pass=Te,e.signal=Pe,e.Line=rn,e.changeEnd=Vr,e.scrollbarModel=So,e.Pos=Be,e.cmpPos=ct,e.modes=Ut,e.mimeModes=Et,e.resolveMode=lr,e.getMode=pr,e.modeExtensions=fr,e.extendMode=ia,e.copyState=Cr,e.startState=Kn,e.innerMode=Hn,e.commands=xi,e.keyMap=Br,e.keyName=us,e.isModifierKey=ss,e.lookupKey=Un,e.normalizeKeyMap=Ml,e.StringStream=Rt,e.SharedTextMarker=yi,e.TextMarker=Yr,e.LineWidget=vi,e.e_preventDefault=X,e.e_stopPropagation=Q,e.e_stop=se,e.addClass=F,e.contains=E,e.rmClass=h,e.keyNames=$r}$l(Dt),ql(Dt);var au="iter insert remove copy getEditor constructor".split(" ");for(var na in rr.prototype)rr.prototype.hasOwnProperty(na)&&ee(au,na)<0&&(Dt.prototype[na]=function(e){return function(){return e.apply(this.doc,arguments)}}(rr.prototype[na]));return ce(rr),Dt.inputStyles={textarea:Mt,contenteditable:Ct},Dt.defineMode=function(e){!Dt.defaults.mode&&e!="null"&&(Dt.defaults.mode=e),_r.apply(this,arguments)},Dt.defineMIME=Rr,Dt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Dt.defineMIME("text/plain","null"),Dt.defineExtension=function(e,t){Dt.prototype[e]=t},Dt.defineDocExtension=function(e,t){rr.prototype[e]=t},Dt.fromTextArea=nu,iu(Dt),Dt.version="5.58.2",Dt})},Y1PL:function(ot,Ge,Z){"use strict";Z.r(Ge),Z.d(Ge,"ResizableTextArea",function(){return ee});var re=Z("wx14"),G=Z("1OyB"),L=Z("vuIU"),z=Z("Ji7U"),I=Z("LK+K"),R=Z("cDcd"),B=Z("VTBJ"),U=Z("rePB"),k=Z("Zm9Q"),A=Z("Kwbf"),y=Z("c+Xe"),S=Z("m+aA"),O=Z("bdgK"),_=new Map;function x(ye){ye.forEach(function(he){var le,me=he.target;(le=_.get(me))===null||le===void 0||le.forEach(function(ie){return ie(me)})})}var v=new O.default(x),d=null,o=null;function u(ye,he){_.has(ye)||(_.set(ye,new Set),v.observe(ye)),_.get(ye).add(he)}function l(ye,he){_.has(ye)&&(_.get(ye).delete(he),_.get(ye).size||(v.unobserve(ye),_.delete(ye)))}var w=function(ye){Object(z.a)(le,ye);var he=Object(I.a)(le);function le(){return Object(G.a)(this,le),he.apply(this,arguments)}return Object(L.a)(le,[{key:"render",value:function(){return this.props.children}}]),le}(R.Component),p=R.createContext(null);function f(ye){var he=ye.children,le=ye.onBatchResize,me=R.useRef(0),ie=R.useRef([]),pe=R.useContext(p),J=R.useCallback(function(ne,q,xe){me.current+=1;var Ce=me.current;ie.current.push({size:ne,element:q,data:xe}),Promise.resolve().then(function(){Ce===me.current&&(le==null||le(ie.current),ie.current=[])}),pe==null||pe(ne,q,xe)},[le,pe]);return R.createElement(p.Provider,{value:J},he)}function C(ye){var he=ye.children,le=ye.disabled,me=R.useRef(null),ie=R.useRef(null),pe=R.useContext(p),J=R.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ne=R.isValidElement(he)&&Object(y.c)(he),q=ne?he.ref:null,xe=R.useMemo(function(){return Object(y.a)(q,me)},[q,me]),Ce=R.useRef(ye);Ce.current=ye;var be=R.useCallback(function(ge){var Se=Ce.current,Le=Se.onResize,Me=Se.data,_e=ge.getBoundingClientRect(),Ae=_e.width,je=_e.height,ze=ge.offsetWidth,Ne=ge.offsetHeight,We=Math.floor(Ae),et=Math.floor(je);if(J.current.width!==We||J.current.height!==et||J.current.offsetWidth!==ze||J.current.offsetHeight!==Ne){var Xe={width:We,height:et,offsetWidth:ze,offsetHeight:Ne};J.current=Xe;var Ye=ze===Math.round(Ae)?Ae:ze,Oe=Ne===Math.round(je)?je:Ne,tt=Object(B.a)(Object(B.a)({},Xe),{},{offsetWidth:Ye,offsetHeight:Oe});pe==null||pe(tt,ge,Me),Le&&Promise.resolve().then(function(){Le(tt,ge)})}},[]);return R.useEffect(function(){var ge=Object(S.a)(me.current)||Object(S.a)(ie.current);return ge&&!le&&u(ge,be),function(){return l(ge,be)}},[me.current,le]),R.createElement(w,{ref:ie},ne?R.cloneElement(he,{ref:xe}):he)}var b="rc-observer-key";function h(ye){var he=ye.children,le=Object(k.a)(he);return le.map(function(me,ie){var pe=(me==null?void 0:me.key)||"".concat(b,"-").concat(ie);return R.createElement(C,Object(re.a)({},ye,{key:pe}),me)})}h.Collection=f;var c=h,s=Z("bT9E"),a=Z("TSYQ"),g=Z.n(a),m=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,E=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],M={},F;function j(ye){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,le=ye.getAttribute("id")||ye.getAttribute("data-reactid")||ye.getAttribute("name");if(he&&M[le])return M[le];var me=window.getComputedStyle(ye),ie=me.getPropertyValue("box-sizing")||me.getPropertyValue("-moz-box-sizing")||me.getPropertyValue("-webkit-box-sizing"),pe=parseFloat(me.getPropertyValue("padding-bottom"))+parseFloat(me.getPropertyValue("padding-top")),J=parseFloat(me.getPropertyValue("border-bottom-width"))+parseFloat(me.getPropertyValue("border-top-width")),ne=E.map(function(xe){return"".concat(xe,":").concat(me.getPropertyValue(xe))}).join(";"),q={sizingStyle:ne,paddingSize:pe,borderSize:J,boxSizing:ie};return he&&le&&(M[le]=q),q}function W(ye){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,le=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,me=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;F||(F=document.createElement("textarea"),F.setAttribute("tab-index","-1"),F.setAttribute("aria-hidden","true"),document.body.appendChild(F)),ye.getAttribute("wrap")?F.setAttribute("wrap",ye.getAttribute("wrap")):F.removeAttribute("wrap");var ie=j(ye,he),pe=ie.paddingSize,J=ie.borderSize,ne=ie.boxSizing,q=ie.sizingStyle;F.setAttribute("style","".concat(q,";").concat(m)),F.value=ye.value||ye.placeholder||"";var xe=Number.MIN_SAFE_INTEGER,Ce=Number.MAX_SAFE_INTEGER,be=F.scrollHeight,ge;if(ne==="border-box"?be+=J:ne==="content-box"&&(be-=pe),le!==null||me!==null){F.value=" ";var Se=F.scrollHeight-pe;le!==null&&(xe=Se*le,ne==="border-box"&&(xe=xe+pe+J),be=Math.max(xe,be)),me!==null&&(Ce=Se*me,ne==="border-box"&&(Ce=Ce+pe+J),ge=be>Ce?"":"hidden",be=Math.min(Ce,be))}return{height:be,minHeight:xe,maxHeight:Ce,overflowY:ge,resize:"none"}}var D=Z("Gytx"),P=Z.n(D),H;(function(ye){ye[ye.NONE=0]="NONE",ye[ye.RESIZING=1]="RESIZING",ye[ye.RESIZED=2]="RESIZED"})(H||(H={}));var Y=function(ye){Object(z.a)(le,ye);var he=Object(I.a)(le);function le(me){var ie;return Object(G.a)(this,le),ie=he.call(this,me),ie.nextFrameActionId=void 0,ie.resizeFrameId=void 0,ie.textArea=void 0,ie.saveTextArea=function(pe){ie.textArea=pe},ie.handleResize=function(pe){var J=ie.state.resizeStatus,ne=ie.props,q=ne.autoSize,xe=ne.onResize;if(J!==H.NONE)return;typeof xe=="function"&&xe(pe),q&&ie.resizeOnNextFrame()},ie.resizeOnNextFrame=function(){cancelAnimationFrame(ie.nextFrameActionId),ie.nextFrameActionId=requestAnimationFrame(ie.resizeTextarea)},ie.resizeTextarea=function(){var pe=ie.props.autoSize;if(!pe||!ie.textArea)return;var J=pe.minRows,ne=pe.maxRows,q=W(ie.textArea,!1,J,ne);ie.setState({textareaStyles:q,resizeStatus:H.RESIZING},function(){cancelAnimationFrame(ie.resizeFrameId),ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:H.RESIZED},function(){ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:H.NONE}),ie.fixFirefoxAutoScroll()})})})})},ie.renderTextArea=function(){var pe=ie.props,J=pe.prefixCls,ne=J===void 0?"rc-textarea":J,q=pe.autoSize,xe=pe.onResize,Ce=pe.className,be=pe.disabled,ge=ie.state,Se=ge.textareaStyles,Le=ge.resizeStatus,Me=Object(s.a)(ie.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),_e=g()(ne,Ce,Object(U.a)({},"".concat(ne,"-disabled"),be));"value"in Me&&(Me.value=Me.value||"");var Ae=Object(B.a)(Object(B.a)(Object(B.a)({},ie.props.style),Se),Le===H.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return R.createElement(c,{onResize:ie.handleResize,disabled:!(q||xe)},R.createElement("textarea",Object(re.a)({},Me,{className:_e,style:Ae,ref:ie.saveTextArea})))},ie.state={textareaStyles:{},resizeStatus:H.NONE},ie}return Object(L.a)(le,[{key:"componentDidUpdate",value:function(ie){(ie.value!==this.props.value||!P()(ie.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 ie=this.textArea.selectionStart,pe=this.textArea.selectionEnd;this.textArea.setSelectionRange(ie,pe)}}catch(J){}}},{key:"render",value:function(){return this.renderTextArea()}}]),le}(R.Component),ee=Y,oe=function(ye){Object(z.a)(le,ye);var he=Object(I.a)(le);function le(me){var ie;Object(G.a)(this,le),ie=he.call(this,me),ie.resizableTextArea=void 0,ie.focus=function(){ie.resizableTextArea.textArea.focus()},ie.saveTextArea=function(J){ie.resizableTextArea=J},ie.handleChange=function(J){var ne=ie.props.onChange;ie.setValue(J.target.value,function(){ie.resizableTextArea.resizeTextarea()}),ne&&ne(J)},ie.handleKeyDown=function(J){var ne=ie.props,q=ne.onPressEnter,xe=ne.onKeyDown;J.keyCode===13&&q&&q(J),xe&&xe(J)};var pe=typeof me.value=="undefined"||me.value===null?me.defaultValue:me.value;return ie.state={value:pe},ie}return Object(L.a)(le,[{key:"setValue",value:function(ie,pe){"value"in this.props||this.setState({value:ie},pe)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return R.createElement(ee,Object(re.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ie){return"value"in ie?{value:ie.value}:null}}]),le}(R.Component),Te=Ge.default=oe},ZW9T:function(ot,Ge,Z){"use strict";Z.d(Ge,"a",function(){return p});var re=Z("k1fw"),G=Z("miYZ"),L=Z("tsqr"),z=Z("rAM+"),I=Z("tJVT"),R=Z("PpiC"),B=Z("cDcd"),U=Z.n(B),k=Z("bdgK");function A(f,C,b,h,c){var s=C.getWordUntilPosition(b),a={startLineNumber:b.lineNumber,endLineNumber:b.lineNumber,startColumn:s.startColumn,endColumn:s.endColumn},g=h.map(function(m){return{label:m,kind:f.languages.CompletionItemKind.Keyword,insertText:m,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:a}});return c.map(function(m){g.push(Object(re.a)(Object(re.a)({},m),{},{range:a}))}),g}var y=function(f){var C={label:"ifelse",kind:f.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},b=["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","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];f.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(a,g){var m=A(f,a,g,b,[C]);return{suggestions:m}}});var h=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];f.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(a,g){var m=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],E=A(f,a,g,h,m);return{suggestions:E}}});var c=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];f.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(a,g){var m=[C,{label:"main",kind:f.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:f.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],E=A(f,a,g,c,m);return{suggestions:E}}})},S="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",O=Z("LvDl"),_=Z("+ua5");function x(f){return/^\d+$/.test(f)?"".concat(f,"px"):f}function v(){}var d=!1,o={"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 u(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],C=f;if(Array.isArray(f)){for(var b=0;b<f.length;b++){var h=o[f[b]];if(h)return h}return C[0]}return o[C]||C}var l=null,w=Ge.b=function(f){var C=f.width,b=C===void 0?"100%":C,h=f.height,c=h===void 0?"100%":h,s=f.value,a=f.language,g=a===void 0?"javascript":a,m=f.style,E=m===void 0?{}:m,M=f.options,F=M===void 0?{}:M,j=f.overrideServices,W=j===void 0?{}:j,D=f.theme,P=D===void 0?"vs-dark":D,H=f.onEditBlur,Y=f.onSave,ee=f.autoHeight,oe=ee===void 0?!1:ee,Te=f.forbidCopy,ye=Te===void 0?!1:Te,he=f.onChange,le=he===void 0?v:he,me=f.editorDidMount,ie=me===void 0?v:me,pe=f.onFocus,J=pe===void 0?v:pe,ne=f.filename,q=ne===void 0?"educoder.txt":ne,xe=f.errorLine,Ce=f.errorContent,be=Ce===void 0?"":Ce,ge=Object(R.a)(f,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),Se=Object(B.useRef)(),Le=Object(B.useRef)({}),Me=Object(B.useRef)(),_e=Object(B.useRef)(!1),Ae=Object(B.useRef)(),je=Object(B.useState)(!1),ze=Object(I.a)(je,2),Ne=ze[0],We=ze[1];function et(){var Re;return Se.current&&(Re=new k.default(function(Ie){var Ze=Object(z.a)(Ie),Ve;try{for(Ze.s();!(Ve=Ze.n()).done;){var mt=Ve.value;(mt.target.offsetHeight>0||mt.target.offsetWidth>0)&&Le.current.instance.layout()}}catch(dt){Ze.e(dt)}finally{Ze.f()}}),Re.observe(Se.current)),Re}function Xe(){L.b.warn(decodeURIComponent(S))}var Ye=function(){var Ie=Le.current.instance;if(s!=null&&Ie&&Ne){var Ze=Ie.getModel();Ze&&s!==Ze.getValue()&&(d=!0,Ze.setValue(s),Ie.layout(),d=!1)}};Object(B.useEffect)(function(){Me.current&&clearTimeout(Me.current),Me.current=setTimeout(function(){Ye()},500)},[s,Ne,Le.current]),Object(B.useEffect)(function(){if(xe&&Le.current&&Le.current.instance){var Re=Le.current.instance;Re.changeViewZones(function(Ze){var Ve=document.createElement("div");Ve.style.padding="10px 20px",Ve.style.width="calc(100% - 20px)",Ve.className="my-error-line-wrp",Ve.innerHTML=be,Ze.addZone({afterLineNumber:xe||11,heightInLines:3,domNode:Ve})});var Ie={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}};Re.addOverlayWidget(Ie),Re.revealPositionInCenter({lineNumber:20,column:1})}},[xe,Le.current,Ne]);function Oe(){var Re=Le.current.instance;if(Re){var Ie=Re.getSelection(),Ze=Le.current.pastePos||{},Ve=new l.Range(Ze.startLineNumber||Ie.endLineNumber,Ze.startColumn||Ie.endColumn,Ze.endLineNumber||Ie.endLineNumber,Ze.endColumn||Ie.endColumn);setTimeout(function(){Re.executeEdits("",[{range:Ve,text:""}])},300)}}function tt(Re){(window.navigator.platform.match("Mac")?Re.metaKey:Re.ctrlKey)&&Re.keyCode==83&&(Re.preventDefault(),Y())}var $e=function(){if(oe&&Le.current.instance){var Ie=Le.current.instance.getContentHeight();fe(Ie<c?c:Ie)}else fe(c)};function Pe(Re){var Ie=document.createEvent("MouseEvents");Ie.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Re.dispatchEvent(Ie)}function Fe(Re,Ie){var Ze=window.URL||window.webkitURL||window,Ve=new Blob([Ie]),mt=document.createElementNS("http://www.w3.org/1999/xhtml","a");mt.href=Ze.createObjectURL(Ve),mt.download=Re,Pe(mt)}Object(B.useEffect)(function(){$e()},[$e]),Object(B.useEffect)(function(){Se.current&&!Ne&&Z.e(27).then(Z.t.bind(null,"M/lh",7)).then(function(Re){try{l=Re,Le.current.instance=l.editor.create(Se.current,{value:s,language:u(g),theme:P,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},W);var Ie=Le.current.instance;if(ie(Ie,l),setTimeout(function(){$e(),Le.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Fe(q||"educoder.txt",Ie.getValue())}})},500),Le.current.subscription=Ie.onDidChangeModelContent(function(Ve){_e.current?clearTimeout(Ae.current):($e(),le(Ie.getValue(),Ve)),Ae.current=setTimeout(function(){_e.current=!1},500)}),window.Monaco||y(l),ye&&(Ie.addCommand(l.KeyMod.CtrlCmd|l.KeyMod.Shift|l.KeyCode.KEY_V,function(){return Xe(),null}),Ie.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_C,function(){return Xe(),null})),window.Monaco=l,H&&Ie.onDidBlurEditorWidget(function(){H(Ie.getValue())}),J&&Ie.onDidFocusEditorText(function(){J(Ie.getValue())}),ye){Ie.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_V,function(){return Xe(),null}),Ie.onDidPaste(function(Ve){Le.current.pastePos=Ve});try{window.addEventListener("paste",Oe)}catch(Ve){}}var Ze=et();return We(!0),function(){var Ve=Le.current.instance;Ve.dispose();var mt=Ve.getModel();mt&&mt.dispose(),Le.current.subscription&&Le.current.subscription.dispose(),ye&&window.removeEventListener("paste",Oe),Ze.unobserve(Se.current)}}catch(Ve){}})},[]),Object(B.useEffect)(function(){var Re=Le.current.instance;if(Re&&Ne)return document.addEventListener("keydown",tt,!1),function(){document.removeEventListener("keydown",tt)}},[Y,Ne]),Object(B.useEffect)(function(){var Re=Le.current.instance;if(Re&&Ne){var Ie=u(g);l.editor.setModelLanguage(Re.getModel(),Ie),console.log("language:",g,Re.getModel(),Ie)}},[g,Ne]),Object(B.useEffect)(function(){var Re=Le.current.instance;Re&&Ne&&l.editor.setTheme(P)},[P,Ne]),Object(B.useEffect)(function(){var Re=Le.current.instance;Re&&Ne&&(Re.updateOptions(Object(re.a)({},F)),setTimeout(function(){Re.getModel().updateOptions(Object(re.a)({},F))},200))},[JSON.stringify(F),Ne]),Object(B.useEffect)(function(){var Re=Le.current.instance;Re&&Ne&&Re.layout()},[b,c,Ne]);var ve=Object(B.useState)(x(b)),de=Object(I.a)(ve,2),ce=de[0],X=de[1],Q=Object(B.useState)(x(c)),te=Object(I.a)(Q,2),se=te[0],fe=te[1],De=Object(re.a)(Object(re.a)({},E),{},{width:ce,height:se});return U.a.createElement("div",{className:"my-monaco-editor",ref:Se,style:De})};function p(f){var C=f.width,b=C===void 0?"100%":C,h=f.height,c=h===void 0?"100%":h,s=f.original,a=f.modified,g=f.language,m=f.options,E=m===void 0?{}:m,M=Object(B.useRef)(),F=Object(B.useState)(null),j=Object(I.a)(F,2),W=j[0],D=j[1];function P(oe){var Te;return M.current&&(Te=new k.default(function(ye){var he=Object(z.a)(ye),le;try{for(he.s();!(le=he.n()).done;){var me=le.value;(me.target.offsetHeight>0||me.target.offsetWidth>0)&&oe.layout()}}catch(ie){he.e(ie)}finally{he.f()}}),Te.observe(M.current)),Te}Object(B.useEffect)(function(){M.current&&Z.e(27).then(Z.t.bind(null,"M/lh",7)).then(function(oe){l=oe;var Te=l.editor.createDiffEditor(M.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},E),{},{wordWrap:!0}));D(Te);var ye=P(Te);return function(){Te.dispose();var he=Te.getModel();he&&he.dispose(),ye.unobserve(M.current)}})},[]),Object(B.useEffect)(function(){W&&W.setModel({original:l.editor.createModel(s,g),modified:l.editor.createModel(a,g)})},[s,a,g,W]);var H=x(b),Y=x(c),ee={width:H,height:Y};return U.a.createElement("div",{className:"my-diff-editor",ref:M,style:ee})}},ZpRC:function(ot,Ge,Z){"use strict";function re(y){return typeof y=="object"&&y!=null&&y.nodeType===1}function G(y,S){return(!S||y!=="hidden")&&y!=="visible"&&y!=="clip"}function L(y,S){if(y.clientHeight<y.scrollHeight||y.clientWidth<y.scrollWidth){var O=getComputedStyle(y,null);return G(O.overflowY,S)||G(O.overflowX,S)||function(_){var x=function(v){if(!v.ownerDocument||!v.ownerDocument.defaultView)return null;try{return v.ownerDocument.defaultView.frameElement}catch(d){return null}}(_);return!!x&&(x.clientHeight<_.scrollHeight||x.clientWidth<_.scrollWidth)}(y)}return!1}function z(y,S,O,_,x,v,d,o){return v<y&&d>S||v>y&&d<S?0:v<=y&&o<=O||d>=S&&o>=O?v-y-_:d>S&&o<O||v<y&&o>O?d-S+x:0}var I=function(y,S){var O=window,_=S.scrollMode,x=S.block,v=S.inline,d=S.boundary,o=S.skipOverflowHiddenElements,u=typeof d=="function"?d:function(Se){return Se!==d};if(!re(y))throw new TypeError("Invalid target");for(var l=document.scrollingElement||document.documentElement,w=[],p=y;re(p)&&u(p);){if((p=p.parentElement)===l){w.push(p);break}p!=null&&p===document.body&&L(p)&&!L(document.documentElement)||p!=null&&L(p,o)&&w.push(p)}for(var f=O.visualViewport?O.visualViewport.width:innerWidth,C=O.visualViewport?O.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,c=y.getBoundingClientRect(),s=c.height,a=c.width,g=c.top,m=c.right,E=c.bottom,M=c.left,F=x==="start"||x==="nearest"?g:x==="end"?E:g+s/2,j=v==="center"?M+a/2:v==="end"?m:M,W=[],D=0;D<w.length;D++){var P=w[D],H=P.getBoundingClientRect(),Y=H.height,ee=H.width,oe=H.top,Te=H.right,ye=H.bottom,he=H.left;if(_==="if-needed"&&g>=0&&M>=0&&E<=C&&m<=f&&g>=oe&&E<=ye&&M>=he&&m<=Te)return W;var le=getComputedStyle(P),me=parseInt(le.borderLeftWidth,10),ie=parseInt(le.borderTopWidth,10),pe=parseInt(le.borderRightWidth,10),J=parseInt(le.borderBottomWidth,10),ne=0,q=0,xe="offsetWidth"in P?P.offsetWidth-P.clientWidth-me-pe:0,Ce="offsetHeight"in P?P.offsetHeight-P.clientHeight-ie-J:0;if(l===P)ne=x==="start"?F:x==="end"?F-C:x==="nearest"?z(h,h+C,C,ie,J,h+F,h+F+s,s):F-C/2,q=v==="start"?j:v==="center"?j-f/2:v==="end"?j-f:z(b,b+f,f,me,pe,b+j,b+j+a,a),ne=Math.max(0,ne+h),q=Math.max(0,q+b);else{ne=x==="start"?F-oe-ie:x==="end"?F-ye+J+Ce:x==="nearest"?z(oe,ye,Y,ie,J+Ce,F,F+s,s):F-(oe+Y/2)+Ce/2,q=v==="start"?j-he-me:v==="center"?j-(he+ee/2)+xe/2:v==="end"?j-Te+pe+xe:z(he,Te,ee,me,pe+xe,j,j+a,a);var be=P.scrollLeft,ge=P.scrollTop;F+=ge-(ne=Math.max(0,Math.min(ge+ne,P.scrollHeight-Y+Ce))),j+=be-(q=Math.max(0,Math.min(be+q,P.scrollWidth-ee+xe)))}W.push({el:P,top:ne,left:q})}return W};function R(y){return y===Object(y)&&Object.keys(y).length!==0}function B(y,S){S===void 0&&(S="auto");var O="scrollBehavior"in document.body.style;y.forEach(function(_){var x=_.el,v=_.top,d=_.left;x.scroll&&O?x.scroll({top:v,left:d,behavior:S}):(x.scrollTop=v,x.scrollLeft=d)})}function U(y){return y===!1?{block:"end",inline:"nearest"}:R(y)?y:{block:"start",inline:"nearest"}}function k(y,S){var O=!y.ownerDocument.documentElement.contains(y);if(R(S)&&typeof S.behavior=="function")return S.behavior(O?[]:I(y,S));if(O)return;var _=U(S);return B(I(y,_),_.behavior)}var A=Ge.a=k},Zss7:function(ot,Ge,Z){var re;(function(G){var L=/^\s+/,z=/\s+$/,I=0,R=G.round,B=G.min,U=G.max,k=G.random;function A(J,ne){if(J=J||"",ne=ne||{},J instanceof A)return J;if(!(this instanceof A))return new A(J,ne);var q=y(J);this._originalInput=J,this._r=q.r,this._g=q.g,this._b=q.b,this._a=q.a,this._roundA=R(100*this._a)/100,this._format=ne.format||q.format,this._gradientType=ne.gradientType,this._r<1&&(this._r=R(this._r)),this._g<1&&(this._g=R(this._g)),this._b<1&&(this._b=R(this._b)),this._ok=q.ok,this._tc_id=I++}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 J=this.toRgb();return(J.r*299+J.g*587+J.b*114)/1e3},getLuminance:function(){var J=this.toRgb(),ne,q,xe,Ce,be,ge;return ne=J.r/255,q=J.g/255,xe=J.b/255,ne<=.03928?Ce=ne/12.92:Ce=G.pow((ne+.055)/1.055,2.4),q<=.03928?be=q/12.92:be=G.pow((q+.055)/1.055,2.4),xe<=.03928?ge=xe/12.92:ge=G.pow((xe+.055)/1.055,2.4),.2126*Ce+.7152*be+.0722*ge},setAlpha:function(J){return this._a=W(J),this._roundA=R(100*this._a)/100,this},toHsv:function(){var J=x(this._r,this._g,this._b);return{h:J.h*360,s:J.s,v:J.v,a:this._a}},toHsvString:function(){var J=x(this._r,this._g,this._b),ne=R(J.h*360),q=R(J.s*100),xe=R(J.v*100);return this._a==1?"hsv("+ne+", "+q+"%, "+xe+"%)":"hsva("+ne+", "+q+"%, "+xe+"%, "+this._roundA+")"},toHsl:function(){var J=O(this._r,this._g,this._b);return{h:J.h*360,s:J.s,l:J.l,a:this._a}},toHslString:function(){var J=O(this._r,this._g,this._b),ne=R(J.h*360),q=R(J.s*100),xe=R(J.l*100);return this._a==1?"hsl("+ne+", "+q+"%, "+xe+"%)":"hsla("+ne+", "+q+"%, "+xe+"%, "+this._roundA+")"},toHex:function(J){return d(this._r,this._g,this._b,J)},toHexString:function(J){return"#"+this.toHex(J)},toHex8:function(J){return o(this._r,this._g,this._b,this._a,J)},toHex8String:function(J){return"#"+this.toHex8(J)},toRgb:function(){return{r:R(this._r),g:R(this._g),b:R(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+R(this._r)+", "+R(this._g)+", "+R(this._b)+")":"rgba("+R(this._r)+", "+R(this._g)+", "+R(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:R(D(this._r,255)*100)+"%",g:R(D(this._g,255)*100)+"%",b:R(D(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+R(D(this._r,255)*100)+"%, "+R(D(this._g,255)*100)+"%, "+R(D(this._b,255)*100)+"%)":"rgba("+R(D(this._r,255)*100)+"%, "+R(D(this._g,255)*100)+"%, "+R(D(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:F[d(this._r,this._g,this._b,!0)]||!1},toFilter:function(J){var ne="#"+u(this._r,this._g,this._b,this._a),q=ne,xe=this._gradientType?"GradientType = 1, ":"";if(J){var Ce=A(J);q="#"+u(Ce._r,Ce._g,Ce._b,Ce._a)}return"progid:DXImageTransform.Microsoft.gradient("+xe+"startColorstr="+ne+",endColorstr="+q+")"},toString:function(J){var ne=!!J;J=J||this._format;var q=!1,xe=this._a<1&&this._a>=0,Ce=!ne&&xe&&(J==="hex"||J==="hex6"||J==="hex3"||J==="hex4"||J==="hex8"||J==="name");return Ce?J==="name"&&this._a===0?this.toName():this.toRgbString():(J==="rgb"&&(q=this.toRgbString()),J==="prgb"&&(q=this.toPercentageRgbString()),(J==="hex"||J==="hex6")&&(q=this.toHexString()),J==="hex3"&&(q=this.toHexString(!0)),J==="hex4"&&(q=this.toHex8String(!0)),J==="hex8"&&(q=this.toHex8String()),J==="name"&&(q=this.toName()),J==="hsl"&&(q=this.toHslString()),J==="hsv"&&(q=this.toHsvString()),q||this.toHexString())},clone:function(){return A(this.toString())},_applyModification:function(J,ne){var q=J.apply(null,[this].concat([].slice.call(ne)));return this._r=q._r,this._g=q._g,this._b=q._b,this.setAlpha(q._a),this},lighten:function(){return this._applyModification(f,arguments)},brighten:function(){return this._applyModification(C,arguments)},darken:function(){return this._applyModification(b,arguments)},desaturate:function(){return this._applyModification(l,arguments)},saturate:function(){return this._applyModification(w,arguments)},greyscale:function(){return this._applyModification(p,arguments)},spin:function(){return this._applyModification(h,arguments)},_applyCombination:function(J,ne){return J.apply(null,[this].concat([].slice.call(ne)))},analogous:function(){return this._applyCombination(m,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(E,arguments)},splitcomplement:function(){return this._applyCombination(g,arguments)},triad:function(){return this._applyCombination(s,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},A.fromRatio=function(J,ne){if(typeof J=="object"){var q={};for(var xe in J)J.hasOwnProperty(xe)&&(xe==="a"?q[xe]=J[xe]:q[xe]=Te(J[xe]));J=q}return A(J,ne)};function y(J){var ne={r:0,g:0,b:0},q=1,xe=null,Ce=null,be=null,ge=!1,Se=!1;return typeof J=="string"&&(J=ie(J)),typeof J=="object"&&(me(J.r)&&me(J.g)&&me(J.b)?(ne=S(J.r,J.g,J.b),ge=!0,Se=String(J.r).substr(-1)==="%"?"prgb":"rgb"):me(J.h)&&me(J.s)&&me(J.v)?(xe=Te(J.s),Ce=Te(J.v),ne=v(J.h,xe,Ce),ge=!0,Se="hsv"):me(J.h)&&me(J.s)&&me(J.l)&&(xe=Te(J.s),be=Te(J.l),ne=_(J.h,xe,be),ge=!0,Se="hsl"),J.hasOwnProperty("a")&&(q=J.a)),q=W(q),{ok:ge,format:J.format||Se,r:B(255,U(ne.r,0)),g:B(255,U(ne.g,0)),b:B(255,U(ne.b,0)),a:q}}function S(J,ne,q){return{r:D(J,255)*255,g:D(ne,255)*255,b:D(q,255)*255}}function O(J,ne,q){J=D(J,255),ne=D(ne,255),q=D(q,255);var xe=U(J,ne,q),Ce=B(J,ne,q),be,ge,Se=(xe+Ce)/2;if(xe==Ce)be=ge=0;else{var Le=xe-Ce;ge=Se>.5?Le/(2-xe-Ce):Le/(xe+Ce);switch(xe){case J:be=(ne-q)/Le+(ne<q?6:0);break;case ne:be=(q-J)/Le+2;break;case q:be=(J-ne)/Le+4;break}be/=6}return{h:be,s:ge,l:Se}}function _(J,ne,q){var xe,Ce,be;J=D(J,360),ne=D(ne,100),q=D(q,100);function ge(Me,_e,Ae){return Ae<0&&(Ae+=1),Ae>1&&(Ae-=1),Ae<1/6?Me+(_e-Me)*6*Ae:Ae<1/2?_e:Ae<2/3?Me+(_e-Me)*(2/3-Ae)*6:Me}if(ne===0)xe=Ce=be=q;else{var Se=q<.5?q*(1+ne):q+ne-q*ne,Le=2*q-Se;xe=ge(Le,Se,J+1/3),Ce=ge(Le,Se,J),be=ge(Le,Se,J-1/3)}return{r:xe*255,g:Ce*255,b:be*255}}function x(J,ne,q){J=D(J,255),ne=D(ne,255),q=D(q,255);var xe=U(J,ne,q),Ce=B(J,ne,q),be,ge,Se=xe,Le=xe-Ce;if(ge=xe===0?0:Le/xe,xe==Ce)be=0;else{switch(xe){case J:be=(ne-q)/Le+(ne<q?6:0);break;case ne:be=(q-J)/Le+2;break;case q:be=(J-ne)/Le+4;break}be/=6}return{h:be,s:ge,v:Se}}function v(J,ne,q){J=D(J,360)*6,ne=D(ne,100),q=D(q,100);var xe=G.floor(J),Ce=J-xe,be=q*(1-ne),ge=q*(1-Ce*ne),Se=q*(1-(1-Ce)*ne),Le=xe%6,Me=[q,ge,be,be,Se,q][Le],_e=[Se,q,q,ge,be,be][Le],Ae=[be,be,Se,q,q,ge][Le];return{r:Me*255,g:_e*255,b:Ae*255}}function d(J,ne,q,xe){var Ce=[oe(R(J).toString(16)),oe(R(ne).toString(16)),oe(R(q).toString(16))];return xe&&Ce[0].charAt(0)==Ce[0].charAt(1)&&Ce[1].charAt(0)==Ce[1].charAt(1)&&Ce[2].charAt(0)==Ce[2].charAt(1)?Ce[0].charAt(0)+Ce[1].charAt(0)+Ce[2].charAt(0):Ce.join("")}function o(J,ne,q,xe,Ce){var be=[oe(R(J).toString(16)),oe(R(ne).toString(16)),oe(R(q).toString(16)),oe(ye(xe))];return Ce&&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(J,ne,q,xe){var Ce=[oe(ye(xe)),oe(R(J).toString(16)),oe(R(ne).toString(16)),oe(R(q).toString(16))];return Ce.join("")}A.equals=function(J,ne){return!J||!ne?!1:A(J).toRgbString()==A(ne).toRgbString()},A.random=function(){return A.fromRatio({r:k(),g:k(),b:k()})};function l(J,ne){ne=ne===0?0:ne||10;var q=A(J).toHsl();return q.s-=ne/100,q.s=P(q.s),A(q)}function w(J,ne){ne=ne===0?0:ne||10;var q=A(J).toHsl();return q.s+=ne/100,q.s=P(q.s),A(q)}function p(J){return A(J).desaturate(100)}function f(J,ne){ne=ne===0?0:ne||10;var q=A(J).toHsl();return q.l+=ne/100,q.l=P(q.l),A(q)}function C(J,ne){ne=ne===0?0:ne||10;var q=A(J).toRgb();return q.r=U(0,B(255,q.r-R(255*-(ne/100)))),q.g=U(0,B(255,q.g-R(255*-(ne/100)))),q.b=U(0,B(255,q.b-R(255*-(ne/100)))),A(q)}function b(J,ne){ne=ne===0?0:ne||10;var q=A(J).toHsl();return q.l-=ne/100,q.l=P(q.l),A(q)}function h(J,ne){var q=A(J).toHsl(),xe=(q.h+ne)%360;return q.h=xe<0?360+xe:xe,A(q)}function c(J){var ne=A(J).toHsl();return ne.h=(ne.h+180)%360,A(ne)}function s(J){var ne=A(J).toHsl(),q=ne.h;return[A(J),A({h:(q+120)%360,s:ne.s,l:ne.l}),A({h:(q+240)%360,s:ne.s,l:ne.l})]}function a(J){var ne=A(J).toHsl(),q=ne.h;return[A(J),A({h:(q+90)%360,s:ne.s,l:ne.l}),A({h:(q+180)%360,s:ne.s,l:ne.l}),A({h:(q+270)%360,s:ne.s,l:ne.l})]}function g(J){var ne=A(J).toHsl(),q=ne.h;return[A(J),A({h:(q+72)%360,s:ne.s,l:ne.l}),A({h:(q+216)%360,s:ne.s,l:ne.l})]}function m(J,ne,q){ne=ne||6,q=q||30;var xe=A(J).toHsl(),Ce=360/q,be=[A(J)];for(xe.h=(xe.h-(Ce*ne>>1)+720)%360;--ne;)xe.h=(xe.h+Ce)%360,be.push(A(xe));return be}function E(J,ne){ne=ne||6;for(var q=A(J).toHsv(),xe=q.h,Ce=q.s,be=q.v,ge=[],Se=1/ne;ne--;)ge.push(A({h:xe,s:Ce,v:be})),be=(be+Se)%1;return ge}A.mix=function(J,ne,q){q=q===0?0:q||50;var xe=A(J).toRgb(),Ce=A(ne).toRgb(),be=q/100,ge={r:(Ce.r-xe.r)*be+xe.r,g:(Ce.g-xe.g)*be+xe.g,b:(Ce.b-xe.b)*be+xe.b,a:(Ce.a-xe.a)*be+xe.a};return A(ge)},A.readability=function(J,ne){var q=A(J),xe=A(ne);return(G.max(q.getLuminance(),xe.getLuminance())+.05)/(G.min(q.getLuminance(),xe.getLuminance())+.05)},A.isReadable=function(J,ne,q){var xe=A.readability(J,ne),Ce,be;be=!1,Ce=pe(q);switch(Ce.level+Ce.size){case"AAsmall":case"AAAlarge":be=xe>=4.5;break;case"AAlarge":be=xe>=3;break;case"AAAsmall":be=xe>=7;break}return be},A.mostReadable=function(J,ne,q){var xe=null,Ce=0,be,ge,Se,Le;q=q||{},ge=q.includeFallbackColors,Se=q.level,Le=q.size;for(var Me=0;Me<ne.length;Me++)be=A.readability(J,ne[Me]),be>Ce&&(Ce=be,xe=A(ne[Me]));return A.isReadable(J,xe,{level:Se,size:Le})||!ge?xe:(q.includeFallbackColors=!1,A.mostReadable(J,["#fff","#000"],q))};var M=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"},F=A.hexNames=j(M);function j(J){var ne={};for(var q in J)J.hasOwnProperty(q)&&(ne[J[q]]=q);return ne}function W(J){return J=parseFloat(J),(isNaN(J)||J<0||J>1)&&(J=1),J}function D(J,ne){Y(J)&&(J="100%");var q=ee(J);return J=B(ne,U(0,parseFloat(J))),q&&(J=parseInt(J*ne,10)/100),G.abs(J-ne)<1e-6?1:J%ne/parseFloat(ne)}function P(J){return B(1,U(0,J))}function H(J){return parseInt(J,16)}function Y(J){return typeof J=="string"&&J.indexOf(".")!=-1&&parseFloat(J)===1}function ee(J){return typeof J=="string"&&J.indexOf("%")!=-1}function oe(J){return J.length==1?"0"+J:""+J}function Te(J){return J<=1&&(J=J*100+"%"),J}function ye(J){return G.round(parseFloat(J)*255).toString(16)}function he(J){return H(J)/255}var le=function(){var J="[-\\+]?\\d+%?",ne="[-\\+]?\\d*\\.\\d+%?",q="(?:"+ne+")|(?:"+J+")",xe="[\\s|\\(]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")\\s*\\)?",Ce="[\\s|\\(]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")\\s*\\)?";return{CSS_UNIT:new RegExp(q),rgb:new RegExp("rgb"+xe),rgba:new RegExp("rgba"+Ce),hsl:new RegExp("hsl"+xe),hsla:new RegExp("hsla"+Ce),hsv:new RegExp("hsv"+xe),hsva:new RegExp("hsva"+Ce),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(J){return!!le.CSS_UNIT.exec(J)}function ie(J){J=J.replace(L,"").replace(z,"").toLowerCase();var ne=!1;if(M[J])J=M[J],ne=!0;else if(J=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var q;return(q=le.rgb.exec(J))?{r:q[1],g:q[2],b:q[3]}:(q=le.rgba.exec(J))?{r:q[1],g:q[2],b:q[3],a:q[4]}:(q=le.hsl.exec(J))?{h:q[1],s:q[2],l:q[3]}:(q=le.hsla.exec(J))?{h:q[1],s:q[2],l:q[3],a:q[4]}:(q=le.hsv.exec(J))?{h:q[1],s:q[2],v:q[3]}:(q=le.hsva.exec(J))?{h:q[1],s:q[2],v:q[3],a:q[4]}:(q=le.hex8.exec(J))?{r:H(q[1]),g:H(q[2]),b:H(q[3]),a:he(q[4]),format:ne?"name":"hex8"}:(q=le.hex6.exec(J))?{r:H(q[1]),g:H(q[2]),b:H(q[3]),format:ne?"name":"hex"}:(q=le.hex4.exec(J))?{r:H(q[1]+""+q[1]),g:H(q[2]+""+q[2]),b:H(q[3]+""+q[3]),a:he(q[4]+""+q[4]),format:ne?"name":"hex8"}:(q=le.hex3.exec(J))?{r:H(q[1]+""+q[1]),g:H(q[2]+""+q[2]),b:H(q[3]+""+q[3]),format:ne?"name":"hex"}:!1}function pe(J){var ne,q;return J=J||{level:"AA",size:"small"},ne=(J.level||"AA").toUpperCase(),q=(J.size||"small").toLowerCase(),ne!=="AA"&&ne!=="AAA"&&(ne="AA"),q!=="small"&&q!=="large"&&(q="small"),{level:ne,size:q}}ot.exports?ot.exports=A:!(re=function(){return A}.call(Ge,Z,Ge,ot),re!==void 0&&(ot.exports=re))})(Math)},bT9E:function(ot,Ge,Z){"use strict";Z.d(Ge,"a",function(){return G});var re=Z("VTBJ");function G(L,z){var I=Object(re.a)({},L);return Array.isArray(z)&&z.forEach(function(R){delete I[R]}),I}},c5Ni:function(ot,Ge,Z){},dejd:function(ot,Ge,Z){},dmUQ:function(ot,Ge,Z){"use strict";var re=Z("Ff2n"),G=Z("rePB"),L=Z("1OyB"),z=Z("vuIU"),I=Z("Ji7U"),R=Z("md7G"),B=Z("foSv"),U=Z("cDcd"),k=Z.n(U),A=Z("TSYQ"),y=Z.n(A),S=Z("4IlW");function O(s,a){var g=Object.keys(s);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(s);a&&(m=m.filter(function(E){return Object.getOwnPropertyDescriptor(s,E).enumerable})),g.push.apply(g,m)}return g}function _(s){for(var a=1;a<arguments.length;a++){var g=arguments[a]!=null?arguments[a]:{};a%2?O(Object(g),!0).forEach(function(m){Object(G.a)(s,m,g[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(g)):O(Object(g)).forEach(function(m){Object.defineProperty(s,m,Object.getOwnPropertyDescriptor(g,m))})}return s}function x(s){var a=v();return function(){var m=Object(B.a)(s),E;if(a){var M=Object(B.a)(this).constructor;E=Reflect.construct(m,arguments,M)}else E=m.apply(this,arguments);return Object(R.a)(this,E)}}function v(){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(s){return!1}}function d(){}function o(s){s.preventDefault()}var u=function(a){return a.replace(/[^\w.-]+/g,"")},l=200,w=600,p=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,f=function(a){return a!=null},C=function(a,g){return g===a||typeof g=="number"&&typeof a=="number"&&isNaN(g)&&isNaN(a)},b=function(s){Object(I.a)(g,s);var a=x(g);function g(m){var E;Object(L.a)(this,g),E=a.call(this,m),E.onKeyDown=function(j){var W=E.props,D=W.onKeyDown,P=W.onPressEnter;if(j.keyCode===S.a.UP){var H=E.getRatio(j);E.up(j,H,null),E.stop()}else if(j.keyCode===S.a.DOWN){var Y=E.getRatio(j);E.down(j,Y,null),E.stop()}else j.keyCode===S.a.ENTER&&P&&P(j);if(E.recordCursorPosition(),E.lastKeyCode=j.keyCode,D){for(var ee=arguments.length,oe=new Array(ee>1?ee-1:0),Te=1;Te<ee;Te++)oe[Te-1]=arguments[Te];D.apply(void 0,[j].concat(oe))}},E.onKeyUp=function(j){var W=E.props.onKeyUp;if(E.stop(),E.recordCursorPosition(),W){for(var D=arguments.length,P=new Array(D>1?D-1:0),H=1;H<D;H++)P[H-1]=arguments[H];W.apply(void 0,[j].concat(P))}},E.onChange=function(j){var W=E.props.onChange;E.state.focused&&(E.inputting=!0),E.rawInput=E.props.parser(E.getValueFromEvent(j)),E.setState({inputValue:E.rawInput}),W(E.toNumber(E.rawInput))},E.onMouseUp=function(){var j=E.props.onMouseUp;E.recordCursorPosition(),j&&j.apply(void 0,arguments)},E.onFocus=function(){var j;E.setState({focused:!0}),(j=E.props).onFocus.apply(j,arguments)},E.onBlur=function(){var j=E.props.onBlur;E.inputting=!1,E.setState({focused:!1});var W=E.getCurrentValidValue(E.state.inputValue),D=E.setValue(W,d);if(j){var P=E.input.value,H=E.getInputDisplayValue({focus:!1,value:D});E.input.value=H&&Number(H),j.apply(void 0,arguments),E.input.value=P}},E.getRatio=function(j){var W=1;return j.metaKey||j.ctrlKey?W=.1:j.shiftKey&&(W=10),W},E.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},E.getPrecision=function(j){if(f(E.props.precision))return E.props.precision;var W=String(j);if(W.indexOf("e-")>=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var D=0;return W.indexOf(".")>=0&&(D=W.length-W.indexOf(".")-1),D},E.getInputDisplayValue=function(j){var W=j||E.state,D=W.focused,P=W.inputValue,H=W.value,Y;D?Y=P:Y=E.toPrecisionAsStep(H),Y==null&&(Y="");var ee=E.formatWrapper(Y);return f(E.props.decimalSeparator)&&(ee=ee.toString().replace(".",E.props.decimalSeparator)),ee},E.recordCursorPosition=function(){try{E.cursorStart=E.input.selectionStart,E.cursorEnd=E.input.selectionEnd,E.currentValue=E.input.value,E.cursorBefore=E.input.value.substring(0,E.cursorStart),E.cursorAfter=E.input.value.substring(E.cursorEnd)}catch(j){}},E.restoreByAfter=function(j){if(j===void 0)return!1;var W=E.input.value,D=W.lastIndexOf(j);if(D===-1)return!1;var P=E.cursorBefore.length;return E.lastKeyCode===S.a.DELETE&&E.cursorBefore.charAt(P-1)===j[0]?(E.fixCaret(P,P),!0):D+j.length===W.length?(E.fixCaret(D,D),!0):!1},E.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(W,D){var P=j.substring(D);return E.restoreByAfter(P)})},E.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},E.stop=function(){E.autoStepTimer&&clearTimeout(E.autoStepTimer)},E.down=function(j,W,D){E.pressingUpOrDown=!0,E.step("down",j,W,D)},E.up=function(j,W,D){E.pressingUpOrDown=!0,E.step("up",j,W,D)},E.saveInput=function(j){E.input=j};var M=m.value;M===void 0&&(M=m.defaultValue),E.state={focused:m.autoFocus};var F=E.getValidValue(E.toNumber(M));return E.state=_(_({},E.state),{},{inputValue:E.toPrecisionAsStep(F),value:F}),E}return Object(z.a)(g,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(E){var M=this.props,F=M.value,j=M.onChange,W=M.max,D=M.min,P=this.state.focused;if(E){if(!C(E.value,F)||!C(E.max,W)||!C(E.min,D)){var H=P?F:this.getValidValue(F),Y;this.pressingUpOrDown?Y=H:this.inputting?Y=this.rawInput:Y=this.toPrecisionAsStep(H),this.setState({value:H,inputValue:Y})}var ee="value"in this.props?F:this.state.value;"max"in this.props&&E.max!==W&&typeof ee=="number"&&ee>W&&j&&j(W),"min"in this.props&&E.min!==D&&typeof ee=="number"&&ee<D&&j&&j(D)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var oe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===S.a.BACKSPACE?oe=this.cursorStart-1:this.lastKeyCode===S.a.DELETE&&(oe=this.cursorStart):oe=this.input.value.length,this.fixCaret(oe,oe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case S.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case S.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Te){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(E){var M=E;return M===""?M="":this.isNotCompleteNumber(parseFloat(M))?M=this.state.value:M=this.getValidValue(M),this.toNumber(M)}},{key:"getValueFromEvent",value:function(E){var M=E.target.value.trim().replace(/。/g,".");return f(this.props.decimalSeparator)&&(M=M.replace(this.props.decimalSeparator,".")),M}},{key:"getValidValue",value:function(E){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,j=parseFloat(E);return isNaN(j)?E:(j<M&&(j=M),j>F&&(j=F),j)}},{key:"setValue",value:function(E,M){var F=this.props.precision,j=this.isNotCompleteNumber(parseFloat(E))?null:parseFloat(E),W=this.state.value,D=W===void 0?null:W,P=this.state.inputValue,H=P===void 0?null:P,Y=typeof j=="number"?j.toFixed(F):"".concat(j),ee=j!==D||Y!=="".concat(H);return"value"in this.props?(H=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:H},M)):this.setState({value:j,inputValue:this.toPrecisionAsStep(E)},M),ee&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(E){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.props,j=F.precision,W=F.step;if(f(j))return j;var D=this.getPrecision(M),P=this.getPrecision(W),H=this.getPrecision(E);return E?Math.max(H,D+P):D+P}},{key:"getPrecisionFactor",value:function(E){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.getMaxPrecision(E,M);return Math.pow(10,F)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(E){return this.props.formatter?this.props.formatter(E):E}},{key:"toPrecisionAsStep",value:function(E){if(this.isNotCompleteNumber(E)||E==="")return E;var M=Math.abs(this.getMaxPrecision(E));return isNaN(M)?E.toString():Number(E).toFixed(M)}},{key:"toNumber",value:function(E){var M=this.props.precision,F=this.state.focused,j=E&&E.length>16&&F;return this.isNotCompleteNumber(E)||j?E:f(M)?Math.round(E*Math.pow(10,M))/Math.pow(10,M):Number(E)}},{key:"upStep",value:function(E,M){var F=this.props.step,j=this.getPrecisionFactor(E,M),W=Math.abs(this.getMaxPrecision(E,M)),D=((j*E+j*F*M)/j).toFixed(W);return this.toNumber(D)}},{key:"downStep",value:function(E,M){var F=this.props.step,j=this.getPrecisionFactor(E,M),W=Math.abs(this.getMaxPrecision(E,M)),D=((j*E-j*F*M)/j).toFixed(W);return this.toNumber(D)}},{key:"step",value:function(E,M){var F=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),M&&(M.persist(),M.preventDefault());var D=this.props;if(D.disabled)return;var P=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(P))return;var H=this["".concat(E,"Step")](P,j),Y=H>D.max||H<D.min;if(H>D.max?H=D.max:H<D.min&&(H=D.min),this.setValue(H,null),this.setState({focused:!0},function(){F.pressingUpOrDown=!1}),Y)return;this.autoStepTimer=setTimeout(function(){F[E](M,j,!0)},W?l:w)}},{key:"fixCaret",value:function(E,M){if(E===void 0||M===void 0||!this.input||!this.input.value)return;try{var F=this.input.selectionStart,j=this.input.selectionEnd;(E!==F||M!==j)&&this.input.setSelectionRange(E,M)}catch(W){}}},{key:"render",value:function(){var E,M=this.props,F=M.prefixCls,j=M.disabled,W=M.readOnly,D=M.useTouch,P=M.autoComplete,H=M.upHandler,Y=M.downHandler,ee=M.className,oe=M.max,Te=M.min,ye=M.style,he=M.title,le=M.onMouseEnter,me=M.onMouseLeave,ie=M.onMouseOver,pe=M.onMouseOut,J=M.required,ne=M.onClick,q=M.tabIndex,xe=M.type,Ce=M.placeholder,be=M.id,ge=M.inputMode,Se=M.pattern,Le=M.step,Me=M.maxLength,_e=M.autoFocus,Ae=M.name,je=M.onPaste,ze=M.onInput,Ne=Object(re.a)(M,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),We=this.state,et=We.value,Xe=We.focused,Ye=y()(F,(E={},Object(G.a)(E,ee,!!ee),Object(G.a)(E,"".concat(F,"-disabled"),j),Object(G.a)(E,"".concat(F,"-focused"),Xe),E)),Oe={};Object.keys(Ne).forEach(function(se){(se.substr(0,5)==="data-"||se.substr(0,5)==="aria-"||se==="role")&&(Oe[se]=Ne[se])});var tt=!W&&!j,$e=this.getInputDisplayValue(null),Pe=(et||et===0)&&(isNaN(et)||Number(et)>=oe),Fe=(et||et===0)&&(isNaN(et)||Number(et)<=Te),ve=Pe||j||W,de=Fe||j||W,ce=y()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object(G.a)({},"".concat(F,"-handler-up-disabled"),ve)),X=y()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object(G.a)({},"".concat(F,"-handler-down-disabled"),de)),Q=D?{onTouchStart:ve?d:this.up,onTouchEnd:this.stop}:{onMouseDown:ve?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},te=D?{onTouchStart:de?d:this.down,onTouchEnd:this.stop}:{onMouseDown:de?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return k.a.createElement("div",{className:Ye,style:ye,title:he,onMouseEnter:le,onMouseLeave:me,onMouseOver:ie,onMouseOut:pe,onFocus:function(){return null},onBlur:function(){return null}},k.a.createElement("div",{className:"".concat(F,"-handler-wrap")},k.a.createElement("span",Object.assign({unselectable:"on"},Q,{role:"button","aria-label":"Increase Value","aria-disabled":ve,className:ce}),H||k.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-up-inner"),onClick:o})),k.a.createElement("span",Object.assign({unselectable:"on"},te,{role:"button","aria-label":"Decrease Value","aria-disabled":de,className:X}),Y||k.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-down-inner"),onClick:o}))),k.a.createElement("div",{className:"".concat(F,"-input-wrap")},k.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Te,"aria-valuemax":oe,"aria-valuenow":et,required:J,type:xe,placeholder:Ce,onPaste:je,onClick:ne,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:q,autoComplete:P,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:tt?this.onKeyDown:d,onKeyUp:tt?this.onKeyUp:d,autoFocus:_e,maxLength:Me,readOnly:W,disabled:j,max:oe,min:Te,step:Le,name:Ae,title:he,id:be,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum($e),pattern:Se,inputMode:ge,onInput:ze},Oe))))}}]),g}(k.a.Component);b.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:p,min:-p,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:u,required:!1,autoComplete:"off"};var h=b,c=Ge.a=h},gMzb:function(ot,Ge,Z){"use strict";var re=Z("k1fw"),G=Z("oBTY"),L=Z("9og8"),z=Z("tJVT"),I=Z("sRBo"),R=Z("kaz8"),B=Z("WmNS"),U=Z.n(B),k=Z("cDcd"),A=Z.n(k),y=Z("9kvl"),S=Z("wlus"),O=Z("w5pM"),_=Z("ErOA"),x=Z("OaEy"),v=Z("2fM7"),d=Z("y8nQ"),o=Z("Vl3Y"),u=Z("Ty5D"),l=Z("yQHh"),w=Z.n(l),p=R.a.Group,f=function(a){var g,m,E,M,F,j,W,D,P=a.classroomList,H=a.loading,Y=a.user,ee=a.exercise_id,oe=ee===void 0?null:ee,Te=a.homework_common_id,ye=Te===void 0?null:Te,he=a.setitem,le=a.item,me=a.type,ie=a.rz,pe=a.dispatch,J=Object(k.useState)([]),ne=Object(z.a)(J,2),q=ne[0],xe=ne[1],Ce=Object(k.useState)({zydatas:[],jbdatas:[],kcdatas:[],zsdatas:[],page:1,per_page:20}),be=Object(z.a)(Ce,2),ge=be[0],Se=be[1],Le=Object(u.i)(),Me=Object(k.useState)(!1),_e=Object(z.a)(Me,2),Ae=_e[0],je=_e[1],ze=Object(k.useState)(!1),Ne=Object(z.a)(ze,2),We=Ne[0],et=Ne[1],Xe=o.a.useForm(),Ye=Object(z.a)(Xe,1),Oe=Ye[0];Object(k.useEffect)(function(){ie&&(ge.zydatas=ie,Se(Object(re.a)({},ge)),le!=null&&le.ec_course_id&&tt())},[le,ie]);function tt(){return $e.apply(this,arguments)}function $e(){return $e=Object(L.a)(U.a.mark(function X(){return U.a.wrap(function(te){for(;;)switch(te.prev=te.next){case 0:return console.log("----",le),te.next=3,Pe(le==null?void 0:le.ec_major_school_id);case 3:return te.next=5,ve(le==null?void 0:le.ec_year_id);case 5:return te.next=7,ce(le==null?void 0:le.ec_course_id);case 7:Oe.setFieldsValue({ec_course_id:le==null?void 0:le.ec_course_id,ec_major_school_id:le==null?void 0:le.ec_major_school_id,ec_point_ids:le==null?void 0:le.ec_point_ids,ec_year_id:le==null?void 0:le.ec_year_id});case 8:case"end":return te.stop()}},X)})),$e.apply(this,arguments)}function Pe(X){return Fe.apply(this,arguments)}function Fe(){return Fe=Object(L.a)(U.a.mark(function X(Q){var te;return U.a.wrap(function(fe){for(;;)switch(fe.prev=fe.next){case 0:return fe.next=2,Object(_.a)("/api/ec_major_schools/".concat(Q,"/ec_years/get_year_list.json"),{method:"get"});case 2:te=fe.sent,ge.jbdatas=te==null?void 0:te.data,Se(Object(re.a)({},ge)),Oe.setFieldsValue({ec_year_id:"",ec_course_id:"",ec_point_ids:[]});case 6:case"end":return fe.stop()}},X)})),Fe.apply(this,arguments)}function ve(X){return de.apply(this,arguments)}function de(){return de=Object(L.a)(U.a.mark(function X(Q){var te;return U.a.wrap(function(fe){for(;;)switch(fe.prev=fe.next){case 0:return fe.next=2,Object(_.a)("/api/ec_years/".concat(Q,"/ec_courses/get_courses.json"),{method:"get"});case 2:te=fe.sent,ge.kcdatas=te==null?void 0:te.data,Se(Object(re.a)({},ge)),Oe.setFieldsValue({ec_course_id:"",ec_point_ids:[]});case 6:case"end":return fe.stop()}},X)})),de.apply(this,arguments)}var ce=function(){var X=Object(L.a)(U.a.mark(function Q(te){var se;return U.a.wrap(function(De){for(;;)switch(De.prev=De.next){case 0:return De.next=2,Object(_.a)("/api/ec_courses/".concat(te,"/ec_points.json"),{method:"get",params:{ec_course_id:te}});case 2:se=De.sent,ge.zsdatas=se==null?void 0:se.data,Se(Object(re.a)({},ge));case 5:case"end":return De.stop()}},Q)}));return function(te){return X.apply(this,arguments)}}();return A.a.createElement("div",{className:w.a.from},A.a.createElement(o.a,{form:Oe,layout:"inline",onValuesChange:function(Q){console.log("----",Q),Q.ec_major_school_id&&(ge.jbdatas=[],ge.kcdatas=[],ge.zsdatas=[],Se(Object(re.a)({},ge)),Pe(Q.ec_major_school_id)),Q.ec_year_id&&(ge.kcdatas=[],ge.zsdatas=[],Se(Object(re.a)({},ge)),ve(Q.ec_year_id)),Q.ec_course_id&&(ge.zsdatas=[],Se(Object(re.a)({},ge)),ce(Q.ec_course_id))},onFinish:function(){var X=Object(L.a)(U.a.mark(function Q(te){return U.a.wrap(function(fe){for(;;)switch(fe.prev=fe.next){case 0:he(te);case 1:case"end":return fe.stop()}},Q)}));return function(Q){return X.apply(this,arguments)}}()},A.a.createElement(o.a.Item,{label:"\u8BA4\u8BC1\u4E13\u4E1A",name:"ec_major_school_id"},A.a.createElement(v.a,{style:{width:150},disabled:((g=ge.zydatas)===null||g===void 0?void 0:g.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BA4\u8BC1\u4E13\u4E1A"},ge==null||((m=ge.zydatas)===null||m===void 0)?void 0:m.map(function(X,Q){return A.a.createElement(v.a.Option,{key:Q,value:X==null?void 0:X.ec_major_school_id},X==null?void 0:X.name)}))),A.a.createElement(o.a.Item,{label:"\u8BA4\u8BC1\u5C4A\u522B",name:"ec_year_id"},A.a.createElement(v.a,{style:{width:150},disabled:((E=ge.jbdatas)===null||E===void 0?void 0:E.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BA4\u8BC1\u5C4A\u522B"},ge==null||((M=ge.jbdatas)===null||M===void 0)?void 0:M.map(function(X,Q){return A.a.createElement(v.a.Option,{key:Q,value:X==null?void 0:X.ec_year_id},X==null?void 0:X.year)}))),A.a.createElement(o.a.Item,{label:"\u8BFE\u7A0B",name:"ec_course_id"},A.a.createElement(v.a,{style:{width:150},disabled:((F=ge.kcdatas)===null||F===void 0?void 0:F.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BFE\u7A0B"},ge==null||((j=ge.kcdatas)===null||j===void 0)?void 0:j.map(function(X,Q){return A.a.createElement(v.a.Option,{key:Q,value:X==null?void 0:X.id},X==null?void 0:X.name)}))),A.a.createElement(o.a.Item,{label:"\u77E5\u8BC6\u70B9",name:"ec_point_ids"},A.a.createElement(v.a,{onChange:function(){Oe.submit()},style:{width:150},mode:"multiple",disabled:((W=ge.zsdatas)===null||W===void 0?void 0:W.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u77E5\u8BC6\u70B9"},ge==null||((D=ge.zsdatas)===null||D===void 0)?void 0:D.map(function(X,Q){return A.a.createElement(v.a.Option,{key:Q,value:X==null?void 0:X.id},X==null?void 0:X.name)})))))},C=Object(y.a)(function(s){var a=s.classroomList,g=s.loading,m=s.globalSetting,E=s.user;return{classroomList:a,globalSetting:m,loading:g.effects,user:E}})(f),b=R.a.Group,h=function(a){var g,m,E,M=a.classroomList,F=a.loading,j=a.user,W=a.exercise_id,D=W===void 0?null:W,P=a.homework_common_id,H=P===void 0?null:P,Y=a.setitem,ee=a.type,oe=a.dispatch,Te=Object(k.useState)([{}]),ye=Object(z.a)(Te,2),he=ye[0],le=ye[1],me=Object(k.useState)([]),ie=Object(z.a)(me,2),pe=ie[0],J=ie[1];function ne(){return q.apply(this,arguments)}function q(){return q=Object(L.a)(U.a.mark(function be(){var ge,Se,Le,Me,_e;return U.a.wrap(function(je){for(;;)switch(je.prev=je.next){case 0:return je.next=2,Object(_.a)("/api/ec_courses/".concat(0,"/ec_points/get_work_points.json"),{method:"get",params:{exercise_id:D,homework_common_id:H}});case 2:Se=je.sent,(Se==null||((ge=Se.data)===null||ge===void 0)?void 0:ge.length)>0&&(_e=[],Se==null||((Le=Se.data)===null||Le===void 0)||Le.map(function(ze){var Ne;ze==null||((Ne=ze.ec_point_ids)===null||Ne===void 0)||Ne.map(function(We){_e.push(We)})}),Y(Object(re.a)(Object(re.a)({},Se==null||((Me=Se.data)===null||Me===void 0)?void 0:Me[0]),{},{ec_point_ids:_e})),le(Se==null?void 0:Se.data));case 4:case"end":return je.stop()}},be)})),q.apply(this,arguments)}Object(k.useEffect)(function(){var be,ge;j!=null&&(be=j.userInfo)!==null&&be!==void 0&&(ge=be.course)!==null&&ge!==void 0&&ge.course_school_id&&xe()},[j==null||((g=j.userInfo)===null||g===void 0||((m=g.course)===null||m===void 0))?void 0:m.course_school_id]);function xe(){return Ce.apply(this,arguments)}function Ce(){return Ce=Object(L.a)(U.a.mark(function be(){var ge,Se,Le;return U.a.wrap(function(_e){for(;;)switch(_e.prev=_e.next){case 0:return _e.next=2,Object(_.a)("/api/schools/".concat(j==null||((ge=j.userInfo)===null||ge===void 0||((Se=ge.course)===null||Se===void 0))?void 0:Se.course_school_id,"/ec_majors/get_major_list.json"),{method:"get"});case 2:Le=_e.sent,J(Le==null?void 0:Le.data),(H||D)&&ne();case 5:case"end":return _e.stop()}},be)})),Ce.apply(this,arguments)}return console.log(he),A.a.createElement("div",{style:{display:(E=j.userInfo.course)!==null&&E!==void 0&&E.is_openengineering?"":"none"}},A.a.createElement("p",{style:{fontSize:"16px",fontWeight:400}},"\u5DE5\u7A0B\u8BA4\u8BC1\u8003\u6838\u77E5\u8BC6\u70B9"),he==null?void 0:he.map(function(be,ge){return A.a.createElement("div",{style:{display:"flex",alignItems:"center",marginBottom:"10px"}},A.a.createElement(C,{rz:pe,item:be,type:ge,setitem:function(Le){he.splice(ge,1,Le),le(Object(G.a)(he));var Me=[];he==null||he.map(function(_e){var Ae;_e==null||((Ae=_e.ec_point_ids)===null||Ae===void 0)||Ae.map(function(je){Me.push(je)})}),Y(Object(re.a)(Object(re.a)({},Le),{},{ec_point_ids:Me}))}}),ge!=0&&A.a.createElement(S.a,{onClick:function(){he.splice(ge,1),le(Object(G.a)(he))},style:{marginLeft:10,fontSize:"20px"}}),A.a.createElement(O.a,{onClick:function(){he.push({}),le(Object(G.a)(he))},style:{marginLeft:10,fontSize:"20px"}}))}))},c=Ge.a=Object(y.a)(function(s){var a=s.classroomList,g=s.loading,m=s.globalSetting,E=s.user;return{classroomList:a,globalSetting:m,loading:g.effects,user:E}})(h)},gnOq:function(ot,Ge,Z){"use strict";Z.r(Ge);var re=Z("+L6B"),G=Z("2/Rp"),L=Z("5NDa"),z=Z("5rEg"),I=Z("sPJy"),R=Z("bE4q"),B=Z("k1fw"),U=Z("9og8"),k=Z("y8nQ"),A=Z("Vl3Y"),y=Z("tJVT"),S=Z("WmNS"),O=Z.n(S),_=Z("cDcd"),x=Z.n(_),v=Z("9kvl"),d=Z("55Ip"),o=Z("Ot1p"),u=Z("XYT7"),l=Z("we55"),w=Z.n(l),p=Z("500L"),f=Z("1vsH"),C=Z("gMzb"),b=Z("ErOA"),h=function(s){var a,g=s.shixunHomeworks,m=s.newCourse,E=s.globalSetting,M=s.loading,F=s.dispatch,j=s.match,W=A.a.useForm(),D=Object(y.a)(W,1),P=D[0],H=Object(_.useState)({}),Y=Object(y.a)(H,2),ee=Y[0],oe=Y[1],Te=Object(_.useState)(),ye=Object(y.a)(Te,2),he=ye[0],le=ye[1],me=Object(_.useRef)(),ie=g.commonHomeWorkAddDefaultData,pe=Object(_.useState)({}),J=Object(y.a)(pe,2),ne=J[0],q=J[1];Object(_.useEffect)(function(){var Se;setTimeout(function(){document.body.scrollIntoView()},300);var Le=j.params,Me=Le.coursesId,_e=Le.categoryId;me.current=(Se=j.params)===null||Se===void 0?void 0:Se.courseId,le(!!me.current),me.current&&xe(),F({type:"shixunHomeworks/addCommonHomeWorkDefaultData",payload:{category:_e,coursesId:Me,type:1}})},[]);var xe=function(){var Se=Object(U.a)(O.a.mark(function Le(){var Me;return O.a.wrap(function(Ae){for(;;)switch(Ae.prev=Ae.next){case 0:return Ae.next=2,F({type:"newCourse/getEditCourseData",payload:{id:me.current}});case 2:Me=Ae.sent,Me&&(P.setFieldsValue({name:Me.name}),P.setFieldsValue({intro:Me.description}),P.setFieldsValue({notice:Me.learning_notes}),oe({name:Me.name,intro:Me.description,notice:Me.learning_notes}));case 4:case"end":return Ae.stop()}},Le)}));return function(){return Se.apply(this,arguments)}}(),Ce=function(){var Se=Object(U.a)(O.a.mark(function Le(Me){var _e,Ae,je,ze,Ne,We,et;return O.a.wrap(function(Ye){for(;;)switch(Ye.prev=Ye.next){case 0:return _e=Object(B.a)({},ee),_e.attachment_ids&&(_e.attachment_ids=_e==null||((Ae=_e.attachment_ids)===null||Ae===void 0)?void 0:Ae.map(function(Oe){return Oe.response.id})),_e.reference_attachment_ids&&(_e.reference_attachment_ids=_e==null||((je=_e.reference_attachment_ids)===null||je===void 0)?void 0:je.map(function(Oe){return Oe.response.id})),ze=j.params,Ne=ze.coursesId,We=ze.categoryId,Ye.next=6,Object(u.a)(Object(B.a)(Object(B.a)({coursesId:Ne,category:We},_e),{},{base_on_project:!0,type:1}));case 6:et=Ye.sent,(et==null?void 0:et.status)===0&&(be(et.homework_id),Object(f.eb)(["\u6559\u5B66\u8BFE\u5802","\u56FE\u6587\u4F5C\u4E1A","\u65B0\u5EFA\u56FE\u6587\u4F5C\u4E1A"]),v.d.push("/classrooms/".concat(j.params.coursesId,"/common_homework/").concat(et.homework_id,"/detail")));case 8:case"end":return Ye.stop()}},Le)}));return function(Me){return Se.apply(this,arguments)}}();function be(Se){return ge.apply(this,arguments)}function ge(){return ge=Object(U.a)(O.a.mark(function Se(Le){var Me;return O.a.wrap(function(Ae){for(;;)switch(Ae.prev=Ae.next){case 0:if(ne!=null&&ne.ec_point_ids){Ae.next=2;break}return Ae.abrupt("return");case 2:return Ae.next=4,Object(b.a)("/api/ec_courses/".concat(ne==null?void 0:ne.ec_course_id,"/ec_points/set_work_points.json"),{method:"post",body:Object(B.a)({homework_common_id:Le},ne)});case 4:Me=Ae.sent;case 5:case"end":return Ae.stop()}},Se)})),ge.apply(this,arguments)}return x.a.createElement("section",{className:w.a.bg},ie.course_name&&x.a.createElement("section",{className:"animated fadeIn"},x.a.createElement("aside",{className:"mt10"},ie.category&&x.a.createElement(R.a,{separator:">"},x.a.createElement(R.a.Item,null,x.a.createElement(d.a,{to:"/classrooms/".concat(ie.course_id,"/common_homework")},ie.course_name)),x.a.createElement(R.a.Item,null,x.a.createElement(d.a,{to:"/classrooms/".concat(ie.course_id,"/common_homework")},ie.category.category_name)),x.a.createElement(R.a.Item,null,"\u65B0\u5EFA\u8BE6\u60C5")))),x.a.createElement("aside",{className:"font24 bold mt20 mb20"},"\u65B0\u5EFA\u56FE\u6587\u4F5C\u4E1A"),x.a.createElement(A.a,{form:P,className:w.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){console.log("onchange: ",P.getFieldsValue()),oe(Object(B.a)({},P.getFieldsValue()))},onFinish:Ce},x.a.createElement("div",{className:w.a.fieldWrap},x.a.createElement(A.a.Item,{name:"name",label:"\u6807\u9898:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},x.a.createElement(z.a,{maxLength:60,suffix:"".concat(((a=ee.name)===null||a===void 0?void 0:a.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),x.a.createElement("div",{className:w.a.mdWrap},x.a.createElement(A.a.Item,{name:"description",label:"\u7B80\u4ECB:",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(o.a,{watch:!0,defaultValue:ee.intro})),x.a.createElement("div",null,x.a.createElement(A.a.Item,{name:"attachment_ids"},x.a.createElement(p.b,null)))),x.a.createElement("div",{className:w.a.mdWrap},x.a.createElement(A.a.Item,{name:"reference_answer",label:"\u53C2\u8003\u7B54\u6848:"},x.a.createElement(o.a,{watch:!0,defaultValue:ee.notice})),x.a.createElement("div",null,x.a.createElement(A.a.Item,{name:"reference_attachment_ids"},x.a.createElement(p.b,null))))),x.a.createElement("div",{className:w.a.mdWrap},x.a.createElement(C.a,{setitem:function(Le){return q(Object(B.a)({},Le))}})),x.a.createElement("div",{className:w.a.backgroundFa},x.a.createElement("div",{className:"pt40 mb30"},x.a.createElement(A.a.Item,null,x.a.createElement(G.a,{size:"large",type:"primary",className:"".concat(w.a.button," mr20"),htmlType:"submit",onClick:function(){P.submit()},loading:M["newCourse/editCourse"]||M["newCourse/submitCourse"]},"\u63D0\u4EA4"),x.a.createElement(G.a,{size:"large",type:"primary",ghost:!0,className:w.a.button,onClick:function(){return v.d.push("/classrooms/".concat(j.params.coursesId,"/common_homework"))}},"\u53D6\u6D88")))))};Ge.default=Object(v.a)(function(c){var s=c.shixunHomeworks,a=c.newCourse,g=c.loading,m=c.globalSetting;return{shixunHomeworks:s,newCourse:a,globalSetting:m,loading:g.effects}})(h)},h78n:function(ot,Ge,Z){"use strict";Z.d(Ge,"a",function(){return E});var re=Z("cDcd"),G=Z.n(re),L=Z("TSYQ"),z=Z.n(L),I={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},R=function(j){var W=j.map(function(){return Object(re.useRef)()}),D=Object(re.useRef)();return Object(re.useEffect)(function(){var P=Date.now(),H=!1;Object.keys(W).forEach(function(Y){var ee=W[Y].current;if(!ee)return;H=!0;var oe=ee.style;oe.transitionDuration=".3s, .3s, .3s, .06s",D.current&&P-D.current<100&&(oe.transitionDuration="0s, 0s")}),H&&(D.current=Date.now())}),[W]};function B(){return B=Object.assign||function(F){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var D in W)Object.prototype.hasOwnProperty.call(W,D)&&(F[D]=W[D])}return F},B.apply(this,arguments)}function U(F,j){return O(F)||S(F,j)||A(F,j)||k()}function k(){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(F,j){if(!F)return;if(typeof F=="string")return y(F,j);var W=Object.prototype.toString.call(F).slice(8,-1);if(W==="Object"&&F.constructor&&(W=F.constructor.name),W==="Map"||W==="Set")return Array.from(F);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return y(F,j)}function y(F,j){(j==null||j>F.length)&&(j=F.length);for(var W=0,D=new Array(j);W<j;W++)D[W]=F[W];return D}function S(F,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var W=[],D=!0,P=!1,H=void 0;try{for(var Y=F[Symbol.iterator](),ee;!(D=(ee=Y.next()).done)&&!(W.push(ee.value),j&&W.length===j);D=!0);}catch(oe){P=!0,H=oe}finally{try{!D&&Y.return!=null&&Y.return()}finally{if(P)throw H}}return W}function O(F){if(Array.isArray(F))return F}function _(F,j){if(F==null)return{};var W=x(F,j),D,P;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(F);for(P=0;P<H.length;P++){if(D=H[P],j.indexOf(D)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,D))continue;W[D]=F[D]}}return W}function x(F,j){if(F==null)return{};var W={},D=Object.keys(F),P,H;for(H=0;H<D.length;H++){if(P=D[H],j.indexOf(P)>=0)continue;W[P]=F[P]}return W}var v=function(j){var W=j.className,D=j.percent,P=j.prefixCls,H=j.strokeColor,Y=j.strokeLinecap,ee=j.strokeWidth,oe=j.style,Te=j.trailColor,ye=j.trailWidth,he=j.transition,le=_(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete le.gapPosition;var me=Array.isArray(D)?D:[D],ie=Array.isArray(H)?H:[H],pe=R(me),J=U(pe,1),ne=J[0],q=ee/2,xe=100-ee/2,Ce="M ".concat(Y==="round"?q:0,",").concat(q,`
|
|
L `).concat(Y==="round"?xe:100,",").concat(q),be="0 0 100 ".concat(ee),ge=0;return G.a.createElement("svg",B({className:z()("".concat(P,"-line"),W),viewBox:be,preserveAspectRatio:"none",style:oe},le),G.a.createElement("path",{className:"".concat(P,"-line-trail"),d:Ce,strokeLinecap:Y,stroke:Te,strokeWidth:ye||ee,fillOpacity:"0"}),me.map(function(Se,Le){var Me={strokeDasharray:"".concat(Se,"px, 100px"),strokeDashoffset:"-".concat(ge,"px"),transition:he||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},_e=ie[Le]||ie[ie.length-1];return ge+=Se,G.a.createElement("path",{key:Le,className:"".concat(P,"-line-path"),d:Ce,strokeLinecap:Y,stroke:_e,strokeWidth:ee,fillOpacity:"0",ref:ne[Le],style:Me})}))};v.defaultProps=I;var d=v;function o(){return o=Object.assign||function(F){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var D in W)Object.prototype.hasOwnProperty.call(W,D)&&(F[D]=W[D])}return F},o.apply(this,arguments)}function u(F,j){return C(F)||f(F,j)||w(F,j)||l()}function l(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w(F,j){if(!F)return;if(typeof F=="string")return p(F,j);var W=Object.prototype.toString.call(F).slice(8,-1);if(W==="Object"&&F.constructor&&(W=F.constructor.name),W==="Map"||W==="Set")return Array.from(F);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return p(F,j)}function p(F,j){(j==null||j>F.length)&&(j=F.length);for(var W=0,D=new Array(j);W<j;W++)D[W]=F[W];return D}function f(F,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var W=[],D=!0,P=!1,H=void 0;try{for(var Y=F[Symbol.iterator](),ee;!(D=(ee=Y.next()).done)&&!(W.push(ee.value),j&&W.length===j);D=!0);}catch(oe){P=!0,H=oe}finally{try{!D&&Y.return!=null&&Y.return()}finally{if(P)throw H}}return W}function C(F){if(Array.isArray(F))return F}function b(F,j){if(F==null)return{};var W=h(F,j),D,P;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(F);for(P=0;P<H.length;P++){if(D=H[P],j.indexOf(D)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,D))continue;W[D]=F[D]}}return W}function h(F,j){if(F==null)return{};var W={},D=Object.keys(F),P,H;for(H=0;H<D.length;H++){if(P=D[H],j.indexOf(P)>=0)continue;W[P]=F[P]}return W}var c=0;function s(F){return+F.replace("%","")}function a(F){return Array.isArray(F)?F:[F]}function g(F,j,W,D){var P=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,H=arguments.length>5?arguments[5]:void 0,Y=50-D/2,ee=0,oe=-Y,Te=0,ye=-2*Y;switch(H){case"left":ee=-Y,oe=0,Te=2*Y,ye=0;break;case"right":ee=Y,oe=0,Te=-2*Y,ye=0;break;case"bottom":oe=Y,ye=2*Y;break;default:}var he="M 50,50 m ".concat(ee,",").concat(oe,`
|
|
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(Te,",").concat(-ye,`
|
|
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(-Te,",").concat(ye),le=Math.PI*2*Y,me={stroke:W,strokeDasharray:"".concat(j/100*(le-P),"px ").concat(le,"px"),strokeDashoffset:"-".concat(P/2+F/100*(le-P),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:he,pathStyle:me}}var m=function(j){var W=j.prefixCls,D=j.strokeWidth,P=j.trailWidth,H=j.gapDegree,Y=j.gapPosition,ee=j.trailColor,oe=j.strokeLinecap,Te=j.style,ye=j.className,he=j.strokeColor,le=j.percent,me=b(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ie=Object(re.useMemo)(function(){return c+=1,c},[]),pe=g(0,100,ee,D,H,Y),J=pe.pathString,ne=pe.pathStyle,q=a(le),xe=a(he),Ce=xe.find(function(Me){return Object.prototype.toString.call(Me)==="[object Object]"}),be=R(q),ge=u(be,1),Se=ge[0],Le=function(){var _e=0;return q.map(function(Ae,je){var ze=xe[je]||xe[xe.length-1],Ne=Object.prototype.toString.call(ze)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ie,")"):"",We=g(_e,Ae,ze,D,H,Y);return _e+=Ae,G.a.createElement("path",{key:je,className:"".concat(W,"-circle-path"),d:We.pathString,stroke:Ne,strokeLinecap:oe,strokeWidth:D,opacity:Ae===0?0:1,fillOpacity:"0",style:We.pathStyle,ref:Se[je]})})};return G.a.createElement("svg",o({className:z()("".concat(W,"-circle"),ye),viewBox:"0 0 100 100",style:Te},me),Ce&&G.a.createElement("defs",null,G.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(ie),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Ce).sort(function(Me,_e){return s(Me)-s(_e)}).map(function(Me,_e){return G.a.createElement("stop",{key:_e,offset:Me,stopColor:Ce[Me]})}))),G.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:J,stroke:ee,strokeLinecap:oe,strokeWidth:P||D,fillOpacity:"0",style:ne}),Le().reverse())};m.defaultProps=I;var E=m,M={Line:d,Circle:E}},kSUc:function(ot,Ge,Z){},lZu9:function(ot,Ge,Z){(function(re){re(Z("VrN/"),Z("1eCo"),Z("8EBN"))})(function(re){"use strict";re.defineMode("markdown",function(G,L){var z=re.getMode(G,"text/html"),I=z.name=="null";function R(D){if(re.findModeByName){var P=re.findModeByName(D);P&&(D=P.mime||P.mimes[0])}var H=re.getMode(G,D);return H.name=="null"?null:H}L.highlightFormatting===void 0&&(L.highlightFormatting=!1),L.maxBlockquoteDepth===void 0&&(L.maxBlockquoteDepth=0),L.taskLists===void 0&&(L.taskLists=!1),L.strikethrough===void 0&&(L.strikethrough=!1),L.emoji===void 0&&(L.emoji=!1),L.fencedCodeBlockHighlighting===void 0&&(L.fencedCodeBlockHighlighting=!0),L.fencedCodeBlockDefaultMode===void 0&&(L.fencedCodeBlockDefaultMode="text/plain"),L.xml===void 0&&(L.xml=!0),L.tokenTypeOverrides===void 0&&(L.tokenTypeOverrides={});var B={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 U in B)B.hasOwnProperty(U)&&L.tokenTypeOverrides[U]&&(B[U]=L.tokenTypeOverrides[U]);var k=/^([*\-_])(?:\s*\1){2,}\s*$/,A=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,y=/^\[(x| )\](?=\s)/i,S=L.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,O=/^ {0,3}(?:\={1,}|-{2,})\s*$/,_=/^[^#!\[\]*_\\<>` "'(~:]+/,x=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,v=/^\s*\[[^\]]+?\]:.*$/,d=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function u(D,P,H){return P.f=P.inline=H,H(D,P)}function l(D,P,H){return P.f=P.block=H,H(D,P)}function w(D){return!D||!/\S/.test(D.string)}function p(D){if(D.linkTitle=!1,D.linkHref=!1,D.linkText=!1,D.em=!1,D.strong=!1,D.strikethrough=!1,D.quote=0,D.indentedCode=!1,D.f==C){var P=I;if(!P){var H=re.innerMode(z,D.htmlState);P=H.mode.name=="xml"&&H.state.tagStart===null&&!H.state.context&&H.state.tokenize.isInText}P&&(D.f=s,D.block=f,D.htmlState=null)}return D.trailingSpace=0,D.trailingSpaceNewLine=!1,D.prevLine=D.thisLine,D.thisLine={stream:null},null}function f(D,P){var H=D.column()===P.indentation,Y=w(P.prevLine.stream),ee=P.indentedCode,oe=P.prevLine.hr,Te=P.list!==!1,ye=(P.listStack[P.listStack.length-1]||0)+3;P.indentedCode=!1;var he=P.indentation;if(P.indentationDiff===null&&(P.indentationDiff=P.indentation,Te)){for(P.list=null;he<P.listStack[P.listStack.length-1];)P.listStack.pop(),P.listStack.length?P.indentation=P.listStack[P.listStack.length-1]:P.list=!1;P.list!==!1&&(P.indentationDiff=he-P.listStack[P.listStack.length-1])}var le=!Y&&!oe&&!P.prevLine.header&&(!Te||!ee)&&!P.prevLine.fencedCodeEnd,me=(P.list===!1||oe||Y)&&P.indentation<=ye&&D.match(k),ie=null;if(P.indentationDiff>=4&&(ee||P.prevLine.fencedCodeEnd||P.prevLine.header||Y))return D.skipToEnd(),P.indentedCode=!0,B.code;if(D.eatSpace())return null;if(H&&P.indentation<=ye&&(ie=D.match(S))&&ie[1].length<=6)return P.quote=0,P.header=ie[1].length,P.thisLine.header=!0,L.highlightFormatting&&(P.formatting="header"),P.f=P.inline,h(P);if(P.indentation<=ye&&D.eat(">"))return P.quote=H?1:P.quote+1,L.highlightFormatting&&(P.formatting="quote"),D.eatSpace(),h(P);if(!me&&!P.setext&&H&&P.indentation<=ye&&(ie=D.match(A))){var pe=ie[1]?"ol":"ul";return P.indentation=he+D.current().length,P.list=!0,P.quote=0,P.listStack.push(P.indentation),P.em=!1,P.strong=!1,P.code=!1,P.strikethrough=!1,L.taskLists&&D.match(y,!1)&&(P.taskList=!0),P.f=P.inline,L.highlightFormatting&&(P.formatting=["list","list-"+pe]),h(P)}else{if(H&&P.indentation<=ye&&(ie=D.match(x,!0)))return P.quote=0,P.fencedEndRE=new RegExp(ie[1]+"+ *$"),P.localMode=L.fencedCodeBlockHighlighting&&R(ie[2]||L.fencedCodeBlockDefaultMode),P.localMode&&(P.localState=re.startState(P.localMode)),P.f=P.block=b,L.highlightFormatting&&(P.formatting="code-block"),P.code=-1,h(P);if(P.setext||(!le||!Te)&&!P.quote&&P.list===!1&&!P.code&&!me&&!v.test(D.string)&&(ie=D.lookAhead(1))&&(ie=ie.match(O)))return P.setext?(P.header=P.setext,P.setext=0,D.skipToEnd(),L.highlightFormatting&&(P.formatting="header")):(P.header=ie[0].charAt(0)=="="?1:2,P.setext=P.header),P.thisLine.header=!0,P.f=P.inline,h(P);if(me)return D.skipToEnd(),P.hr=!0,P.thisLine.hr=!0,B.hr;if(D.peek()==="[")return u(D,P,M)}return u(D,P,P.inline)}function C(D,P){var H=z.token(D,P.htmlState);if(!I){var Y=re.innerMode(z,P.htmlState);(Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText||P.md_inside&&D.current().indexOf(">")>-1)&&(P.f=s,P.block=f,P.htmlState=null)}return H}function b(D,P){var H=P.listStack[P.listStack.length-1]||0,Y=P.indentation<H,ee=H+3;if(P.fencedEndRE&&P.indentation<=ee&&(Y||D.match(P.fencedEndRE))){L.highlightFormatting&&(P.formatting="code-block");var oe;return Y||(oe=h(P)),P.localMode=P.localState=null,P.block=f,P.f=s,P.fencedEndRE=null,P.code=0,P.thisLine.fencedCodeEnd=!0,Y?l(D,P,P.block):oe}else return P.localMode?P.localMode.token(D,P.localState):(D.skipToEnd(),B.code)}function h(D){var P=[];if(D.formatting){P.push(B.formatting),typeof D.formatting=="string"&&(D.formatting=[D.formatting]);for(var H=0;H<D.formatting.length;H++)P.push(B.formatting+"-"+D.formatting[H]),D.formatting[H]==="header"&&P.push(B.formatting+"-"+D.formatting[H]+"-"+D.header),D.formatting[H]==="quote"&&(!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=D.quote?P.push(B.formatting+"-"+D.formatting[H]+"-"+D.quote):P.push("error"))}if(D.taskOpen)return P.push("meta"),P.length?P.join(" "):null;if(D.taskClosed)return P.push("property"),P.length?P.join(" "):null;if(D.linkHref?P.push(B.linkHref,"url"):(D.strong&&P.push(B.strong),D.em&&P.push(B.em),D.strikethrough&&P.push(B.strikethrough),D.emoji&&P.push(B.emoji),D.linkText&&P.push(B.linkText),D.code&&P.push(B.code),D.image&&P.push(B.image),D.imageAltText&&P.push(B.imageAltText,"link"),D.imageMarker&&P.push(B.imageMarker)),D.header&&P.push(B.header,B.header+"-"+D.header),D.quote&&(P.push(B.quote),!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=D.quote?P.push(B.quote+"-"+D.quote):P.push(B.quote+"-"+L.maxBlockquoteDepth)),D.list!==!1){var Y=(D.listStack.length-1)%3;Y?Y===1?P.push(B.list2):P.push(B.list3):P.push(B.list1)}return D.trailingSpaceNewLine?P.push("trailing-space-new-line"):D.trailingSpace&&P.push("trailing-space-"+(D.trailingSpace%2?"a":"b")),P.length?P.join(" "):null}function c(D,P){return D.match(_,!0)?h(P):void 0}function s(D,P){var H=P.text(D,P);if(typeof H!="undefined")return H;if(P.list)return P.list=null,h(P);if(P.taskList){var Y=D.match(y,!0)[1]===" ";return Y?P.taskOpen=!0:P.taskClosed=!0,L.highlightFormatting&&(P.formatting="task"),P.taskList=!1,h(P)}if(P.taskOpen=!1,P.taskClosed=!1,P.header&&D.match(/^#+$/,!0))return L.highlightFormatting&&(P.formatting="header"),h(P);var ee=D.next();if(P.linkTitle){P.linkTitle=!1;var oe=ee;ee==="("&&(oe=")"),oe=(oe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Te="^\\s*(?:[^"+oe+"\\\\]+|\\\\\\\\|\\\\.)"+oe;if(D.match(new RegExp(Te),!0))return B.linkHref}if(ee==="`"){var ye=P.formatting;L.highlightFormatting&&(P.formatting="code"),D.eatWhile("`");var he=D.current().length;if(P.code==0&&(!P.quote||he==1))return P.code=he,h(P);if(he==P.code){var le=h(P);return P.code=0,le}else return P.formatting=ye,h(P)}else if(P.code)return h(P);if(ee==="\\"&&(D.next(),L.highlightFormatting)){var me=h(P),ie=B.formatting+"-escape";return me?me+" "+ie:ie}if(ee==="!"&&D.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return P.imageMarker=!0,P.image=!0,L.highlightFormatting&&(P.formatting="image"),h(P);if(ee==="["&&P.imageMarker&&D.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return P.imageMarker=!1,P.imageAltText=!0,L.highlightFormatting&&(P.formatting="image"),h(P);if(ee==="]"&&P.imageAltText){L.highlightFormatting&&(P.formatting="image");var me=h(P);return P.imageAltText=!1,P.image=!1,P.inline=P.f=g,me}if(ee==="["&&!P.image)return P.linkText&&D.match(/^.*?\]/)||(P.linkText=!0,L.highlightFormatting&&(P.formatting="link")),h(P);if(ee==="]"&&P.linkText){L.highlightFormatting&&(P.formatting="link");var me=h(P);return P.linkText=!1,P.inline=P.f=D.match(/\(.*?\)| ?\[.*?\]/,!1)?g:s,me}if(ee==="<"&&D.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){P.f=P.inline=a,L.highlightFormatting&&(P.formatting="link");var me=h(P);return me?me+=" ":me="",me+B.linkInline}if(ee==="<"&&D.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){P.f=P.inline=a,L.highlightFormatting&&(P.formatting="link");var me=h(P);return me?me+=" ":me="",me+B.linkEmail}if(L.xml&&ee==="<"&&D.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var pe=D.string.indexOf(">",D.pos);if(pe!=-1){var J=D.string.substring(D.start,pe);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(J)&&(P.md_inside=!0)}return D.backUp(1),P.htmlState=re.startState(z),l(D,P,C)}if(L.xml&&ee==="<"&&D.match(/^\/\w*?>/))return P.md_inside=!1,"tag";if(ee==="*"||ee==="_"){for(var ne=1,q=D.pos==1?" ":D.string.charAt(D.pos-2);ne<3&&D.eat(ee);)ne++;var xe=D.peek()||" ",Ce=!/\s/.test(xe)&&(!d.test(xe)||/\s/.test(q)||d.test(q)),be=!/\s/.test(q)&&(!d.test(q)||/\s/.test(xe)||d.test(xe)),ge=null,Se=null;if(ne%2&&(!P.em&&Ce&&(ee==="*"||!be||d.test(q))?ge=!0:P.em==ee&&be&&(ee==="*"||!Ce||d.test(xe))&&(ge=!1)),ne>1&&(!P.strong&&Ce&&(ee==="*"||!be||d.test(q))?Se=!0:P.strong==ee&&be&&(ee==="*"||!Ce||d.test(xe))&&(Se=!1)),Se!=null||ge!=null){L.highlightFormatting&&(P.formatting=ge==null?"strong":Se==null?"em":"strong em"),ge===!0&&(P.em=ee),Se===!0&&(P.strong=ee);var le=h(P);return ge===!1&&(P.em=!1),Se===!1&&(P.strong=!1),le}}else if(ee===" "&&(D.eat("*")||D.eat("_"))){if(D.peek()===" ")return h(P);D.backUp(1)}if(L.strikethrough){if(ee==="~"&&D.eatWhile(ee)){if(P.strikethrough){L.highlightFormatting&&(P.formatting="strikethrough");var le=h(P);return P.strikethrough=!1,le}else if(D.match(/^[^\s]/,!1))return P.strikethrough=!0,L.highlightFormatting&&(P.formatting="strikethrough"),h(P)}else if(ee===" "&&D.match(/^~~/,!0)){if(D.peek()===" ")return h(P);D.backUp(2)}}if(L.emoji&&ee===":"&&D.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){P.emoji=!0,L.highlightFormatting&&(P.formatting="emoji");var Le=h(P);return P.emoji=!1,Le}return ee===" "&&(D.match(/^ +$/,!1)?P.trailingSpace++:P.trailingSpace&&(P.trailingSpaceNewLine=!0)),h(P)}function a(D,P){var H=D.next();if(H===">"){P.f=P.inline=s,L.highlightFormatting&&(P.formatting="link");var Y=h(P);return Y?Y+=" ":Y="",Y+B.linkInline}return D.match(/^[^>]+/,!0),B.linkInline}function g(D,P){if(D.eatSpace())return null;var H=D.next();return H==="("||H==="["?(P.f=P.inline=E(H==="("?")":"]"),L.highlightFormatting&&(P.formatting="link-string"),P.linkHref=!0,h(P)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function E(D){return function(P,H){var Y=P.next();if(Y===D){H.f=H.inline=s,L.highlightFormatting&&(H.formatting="link-string");var ee=h(H);return H.linkHref=!1,ee}return P.match(m[D]),H.linkHref=!0,h(H)}}function M(D,P){return D.match(/^([^\]\\]|\\.)*\]:/,!1)?(P.f=F,D.next(),L.highlightFormatting&&(P.formatting="link"),P.linkText=!0,h(P)):u(D,P,s)}function F(D,P){if(D.match(/^\]:/,!0)){P.f=P.inline=j,L.highlightFormatting&&(P.formatting="link");var H=h(P);return P.linkText=!1,H}return D.match(/^([^\]\\]|\\.)+/,!0),B.linkText}function j(D,P){return D.eatSpace()?null:(D.match(/^[^\s]+/,!0),D.peek()===void 0?P.linkTitle=!0:D.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),P.f=P.inline=s,B.linkHref+" url")}var W={startState:function(){return{f,prevLine:{stream:null},thisLine:{stream:null},block:f,htmlState:null,indentation:0,inline:s,text:c,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(D){return{f:D.f,prevLine:D.prevLine,thisLine:D.thisLine,block:D.block,htmlState:D.htmlState&&re.copyState(z,D.htmlState),indentation:D.indentation,localMode:D.localMode,localState:D.localMode?re.copyState(D.localMode,D.localState):null,inline:D.inline,text:D.text,formatting:!1,linkText:D.linkText,linkTitle:D.linkTitle,linkHref:D.linkHref,code:D.code,em:D.em,strong:D.strong,strikethrough:D.strikethrough,emoji:D.emoji,header:D.header,setext:D.setext,hr:D.hr,taskList:D.taskList,list:D.list,listStack:D.listStack.slice(0),quote:D.quote,indentedCode:D.indentedCode,trailingSpace:D.trailingSpace,trailingSpaceNewLine:D.trailingSpaceNewLine,md_inside:D.md_inside,fencedEndRE:D.fencedEndRE}},token:function(D,P){if(P.formatting=!1,D!=P.thisLine.stream){if(P.header=0,P.hr=!1,D.match(/^\s*$/,!0))return p(P),null;if(P.prevLine=P.thisLine,P.thisLine={stream:D},P.taskList=!1,P.trailingSpace=0,P.trailingSpaceNewLine=!1,!P.localState&&(P.f=P.block,P.f!=C)){var H=D.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(P.indentation=H,P.indentationDiff=null,H>0)return null}}return P.f(D,P)},innerMode:function(D){return D.block==C?{state:D.htmlState,mode:z}:D.localState?{state:D.localState,mode:D.localMode}:{state:D,mode:W}},indent:function(D,P,H){return D.block==C&&z.indent?z.indent(D.htmlState,P,H):D.localState&&D.localMode.indent?D.localMode.indent(D.localState,P,H):re.Pass},blankLine:p,getType:h,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),re.defineMIME("text/markdown","markdown"),re.defineMIME("text/x-markdown","markdown")})},osHv:function(ot,Ge,Z){(function(re){re(Z("VrN/"))})(function(re){"use strict";var G=re.Pos;function L(d,o){return d.line-o.line||d.ch-o.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",I=z+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",R=new RegExp("<(/?)(["+z+"]["+I+"]*)","g");function B(d,o,u,l){this.line=o,this.ch=u,this.cm=d,this.text=d.getLine(o),this.min=l?Math.max(l.from,d.firstLine()):d.firstLine(),this.max=l?Math.min(l.to-1,d.lastLine()):d.lastLine()}function U(d,o){var u=d.cm.getTokenTypeAt(G(d.line,o));return u&&/\btag\b/.test(u)}function k(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function A(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function y(d){for(;;){var o=d.text.indexOf(">",d.ch);if(o==-1){if(k(d))continue;return}if(!U(d,o+1)){d.ch=o+1;continue}var u=d.text.lastIndexOf("/",o),l=u>-1&&!/\S/.test(d.text.slice(u+1,o));return d.ch=o+1,l?"selfClose":"regular"}}function S(d){for(;;){var o=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(o==-1){if(A(d))continue;return}if(!U(d,o+1)){d.ch=o;continue}R.lastIndex=o,d.ch=o;var u=R.exec(d.text);if(u&&u.index==o)return u}}function O(d){for(;;){R.lastIndex=d.ch;var o=R.exec(d.text);if(!o){if(k(d))continue;return}if(!U(d,o.index+1)){d.ch=o.index+1;continue}return d.ch=o.index+o[0].length,o}}function _(d){for(;;){var o=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(o==-1){if(A(d))continue;return}if(!U(d,o+1)){d.ch=o;continue}var u=d.text.lastIndexOf("/",o),l=u>-1&&!/\S/.test(d.text.slice(u+1,o));return d.ch=o+1,l?"selfClose":"regular"}}function x(d,o){for(var u=[];;){var l=O(d),w,p=d.line,f=d.ch-(l?l[0].length:0);if(!l||!(w=y(d)))return;if(w=="selfClose")continue;if(l[1]){for(var C=u.length-1;C>=0;--C)if(u[C]==l[2]){u.length=C;break}if(C<0&&(!o||o==l[2]))return{tag:l[2],from:G(p,f),to:G(d.line,d.ch)}}else u.push(l[2])}}function v(d,o){for(var u=[];;){var l=_(d);if(!l)return;if(l=="selfClose"){S(d);continue}var w=d.line,p=d.ch,f=S(d);if(!f)return;if(f[1])u.push(f[2]);else{for(var C=u.length-1;C>=0;--C)if(u[C]==f[2]){u.length=C;break}if(C<0&&(!o||o==f[2]))return{tag:f[2],from:G(d.line,d.ch),to:G(w,p)}}}}re.registerHelper("fold","xml",function(d,o){for(var u=new B(d,o.line,0);;){var l=O(u);if(!l||u.line!=o.line)return;var w=y(u);if(!w)return;if(!l[1]&&w!="selfClose"){var p=G(u.line,u.ch),f=x(u,l[2]);return f&&L(f.from,p)>0?{from:p,to:f.from}:null}}}),re.findMatchingTag=function(d,o,u){var l=new B(d,o.line,o.ch,u);if(l.text.indexOf(">")==-1&&l.text.indexOf("<")==-1)return;var w=y(l),p=w&&G(l.line,l.ch),f=w&&S(l);if(!w||!f||L(l,o)>0)return;var C={from:G(l.line,l.ch),to:p,tag:f[2]};return w=="selfClose"?{open:C,close:null,at:"open"}:f[1]?{open:v(l,f[2]),close:C,at:"close"}:(l=new B(d,p.line,p.ch,u),{open:C,close:x(l,f[2]),at:"open"})},re.findEnclosingTag=function(d,o,u,l){for(var w=new B(d,o.line,o.ch,u);;){var p=v(w,l);if(!p)break;var f=new B(d,o.line,o.ch,u),C=x(f,p.tag);if(C)return{open:p,close:C}}},re.scanForClosingTag=function(d,o,u,l){var w=new B(d,o.line,o.ch,l?{from:0,to:l}:null);return x(w,u)}})},p5ED:function(ot,Ge,Z){"use strict";var re=Z("+L6B"),G=Z("2/Rp"),L=Z("5Dmo"),z=Z("3S7+"),I=Z("k1fw"),R=Z("tJVT"),B=Z("cDcd"),U=Z.n(B),k=Z("vHTk"),A=Z.n(k),y=Z("yEEn"),S=Z("ZW9T"),O=Z("1vsH");Ge.a=function(_){var x=_.name,v=_.data,d=_.theme,o=_.type,u=_.filename,l=_.monacoEditor,w=_.className,p=_.style,f=_.close,C=_.onClose,b=_.hasMask,h=Object(B.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),c=Object(R.a)(h,2),s=c[0],a=c[1],g=Object(B.useState)(""),m=Object(R.a)(g,2),E=m[0],M=m[1],F,j=1024*1024,W=10*j,D=Object(B.useRef)();o==="office"&&(F=Object(O.V)(v).filesize,F>W&&(o="other")),u&&(l.filename=u),Object(B.useEffect)(function(){var Y,ee,oe=(Y=document.cookie)===null||Y===void 0||((ee=Y.replace(/\s/g,""))===null||ee===void 0)?void 0:ee.split(";");oe==null||oe.map(function(Te){var ye=Te.split("=");ye[0]==="_educoder_session"&&M(ye[1])})},[]);var P=function(){if(v.startsWith("http")||v.startsWith("/")){H();return}Object(O.z)(u||"educoder",v,u)},H=function(){Object(O.x)(u||x,v)};return console.log("data:",v,"fileanme:",u," name:",x),U.a.createElement("div",{style:Object(I.a)({},p||{}),className:"".concat(b&&A.a.bgBlack," ").concat(o?A.a.wrp:"hide")},f&&U.a.createElement("div",{className:A.a.close,ref:D},U.a.createElement(z.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return D.current}},U.a.createElement("span",{onClick:H},U.a.createElement("i",{className:"icon-quxiaozhiding"}))),U.a.createElement(z.a,{title:"\u5173\u95ED",getPopupContainer:function(){return D.current}},U.a.createElement("span",{className:"",onClick:C},U.a.createElement("i",{className:"icon-guanbi1"})))),U.a.createElement("div",{className:"".concat(A.a[w]," ").concat(w," ").concat(A.a.monaco," ").concat(o==="txt"?"show":"hide")},o==="txt"&&U.a.createElement(S.b,l)),o==="audio"&&U.a.createElement("audio",{src:"".concat(v!=null&&v.startsWith("/")||(v==null?void 0:v.indexOf("https://"))>-1?v:"data:audio/mp3;base64,").concat(v),autoPlay:!0}),o==="video"&&U.a.createElement(U.a.Fragment,null,v!=null&&v.startsWith("/")?U.a.createElement("video",{controls:!0,src:"".concat(v),autoPlay:!0}):U.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(v),autoPlay:!0})),o==="html"&&U.a.createElement("iframe",{src:v+"&disposition=inline"}),o==="pdf"&&U.a.createElement("embed",{className:A.a.embed,src:v}),o==="image"&&U.a.createElement(U.a.Fragment,null,U.a.createElement("img",{src:"".concat(v!=null&&v.startsWith("/")||(v==null?void 0:v.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(v)})),o==="other"&&U.a.createElement("div",null,U.a.createElement(G.a,{type:"primary",size:"large",onClick:P},U.a.createElement(y.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&U.a.createElement(G.a,{type:"primary",size:"large",onClick:P},U.a.createElement(y.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(ot,Ge,Z){},"rAM+":function(ot,Ge,Z){"use strict";Z.d(Ge,"a",function(){return G});var re=Z("Qw5x");function G(L,z){var I;if(typeof Symbol=="undefined"||L[Symbol.iterator]==null){if(Array.isArray(L)||(I=Object(re.a)(L))||z&&L&&typeof L.length=="number"){I&&(L=I);var R=0,B=function(){};return{s:B,n:function(){return R>=L.length?{done:!0}:{done:!1,value:L[R++]}},e:function(S){throw S},f:B}}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 U=!0,k=!1,A;return{s:function(){I=L[Symbol.iterator]()},n:function(){var S=I.next();return U=S.done,S},e:function(S){k=!0,A=S},f:function(){try{!U&&I.return!=null&&I.return()}finally{if(k)throw A}}}}},rUJ1:function(ot,Ge){const Z=/[&<>"']/,re=/[&<>"']/g,G=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,z={"&":"&","<":"<",">":">",'"':""","'":"'"},I=b=>z[b];function R(b,h){if(h){if(Z.test(b))return b.replace(re,I)}else if(G.test(b))return b.replace(L,I);return b}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function U(b){return b.replace(B,(h,c)=>(c=c.toLowerCase(),c==="colon"?":":c.charAt(0)==="#"?c.charAt(1)==="x"?String.fromCharCode(parseInt(c.substring(2),16)):String.fromCharCode(+c.substring(1)):""))}const k=/(^|[^\[])\^/g;function A(b,h){b=b.source||b,h=h||"";const c={replace:(s,a)=>(a=a.source||a,a=a.replace(k,"$1"),b=b.replace(s,a),c),getRegex:()=>new RegExp(b,h)};return c}const y=/[^\w:]/g,S=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(b,h,c){if(b){let s;try{s=decodeURIComponent(U(c)).replace(y,"").toLowerCase()}catch(a){return null}if(s.indexOf("javascript:")===0||s.indexOf("vbscript:")===0||s.indexOf("data:")===0)return null}h&&!S.test(c)&&(c=o(h,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(s){return null}return c}const _={},x=/^[^:]+:\/*[^/]*$/,v=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(b,h){_[" "+b]||(x.test(b)?_[" "+b]=b+"/":_[" "+b]=p(b,"/",!0)),b=_[" "+b];const c=b.indexOf(":")===-1;return h.substring(0,2)==="//"?c?h:b.replace(v,"$1")+h:h.charAt(0)==="/"?c?h:b.replace(d,"$1")+h:b+h}const u={exec:function(){}};function l(b){let h=1,c,s;for(;h<arguments.length;h++){c=arguments[h];for(s in c)Object.prototype.hasOwnProperty.call(c,s)&&(b[s]=c[s])}return b}function w(b,h){const c=b.replace(/\|/g,(g,m,E)=>{let M=!1,F=m;for(;--F>=0&&E[F]==="\\";)M=!M;return M?"|":" |"}),s=c.split(/ \|/);let a=0;if(s.length>h)s.splice(h);else for(;s.length<h;)s.push("");for(;a<s.length;a++)s[a]=s[a].trim().replace(/\\\|/g,"|");return s}function p(b,h,c){const s=b.length;if(s===0)return"";let a=0;for(;a<s;){const g=b.charAt(s-a-1);if(g===h&&!c)a++;else if(g!==h&&c)a++;else break}return b.substr(0,s-a)}function f(b,h){if(b.indexOf(h[1])===-1)return-1;const c=b.length;let s=0,a=0;for(;a<c;a++)if(b[a]==="\\")a++;else if(b[a]===h[0])s++;else if(b[a]===h[1]&&(s--,s<0))return a;return-1}function C(b){b&&b.sanitize&&!b.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}ot.exports={escape:R,unescape:U,edit:A,cleanUrl:O,resolveUrl:o,noopTest:u,merge:l,splitCells:w,rtrim:p,findClosingBracket:f,checkSanitizeDeprecation:C}},ulZh:function(ot,Ge,Z){typeof window!="undefined"&&function(G,L){ot.exports=L()}(this,function(){return function(re){var G={};function L(z){if(G[z])return G[z].exports;var I=G[z]={i:z,l:!1,exports:{}};return re[z].call(I.exports,I,I.exports,L),I.l=!0,I.exports}return L.m=re,L.c=G,L.d=function(z,I,R){L.o(z,I)||Object.defineProperty(z,I,{enumerable:!0,get:R})},L.r=function(z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(z,"__esModule",{value:!0})},L.t=function(z,I){if(I&1&&(z=L(z)),I&8)return z;if(I&4&&typeof z=="object"&&z&&z.__esModule)return z;var R=Object.create(null);if(L.r(R),Object.defineProperty(R,"default",{enumerable:!0,value:z}),I&2&&typeof z!="string")for(var B in z)L.d(R,B,function(U){return z[U]}.bind(null,B));return R},L.n=function(z){var I=z&&z.__esModule?function(){return z.default}:function(){return z};return L.d(I,"a",I),I},L.o=function(z,I){return Object.prototype.hasOwnProperty.call(z,I)},L.p="/dist/",L(L.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(re,G,L){"use strict";var z=Object.prototype.hasOwnProperty,I="~";function R(){}Object.create&&(R.prototype=Object.create(null),new R().__proto__||(I=!1));function B(y,S,O){this.fn=y,this.context=S,this.once=O||!1}function U(y,S,O,_,x){if(typeof O!="function")throw new TypeError("The listener must be a function");var v=new B(O,_||y,x),d=I?I+S:S;return y._events[d]?y._events[d].fn?y._events[d]=[y._events[d],v]:y._events[d].push(v):(y._events[d]=v,y._eventsCount++),y}function k(y,S){--y._eventsCount===0?y._events=new R:delete y._events[S]}function A(){this._events=new R,this._eventsCount=0}A.prototype.eventNames=function(){var S=[],O,_;if(this._eventsCount===0)return S;for(_ in O=this._events)z.call(O,_)&&S.push(I?_.slice(1):_);return Object.getOwnPropertySymbols?S.concat(Object.getOwnPropertySymbols(O)):S},A.prototype.listeners=function(S){var O=I?I+S:S,_=this._events[O];if(!_)return[];if(_.fn)return[_.fn];for(var x=0,v=_.length,d=new Array(v);x<v;x++)d[x]=_[x].fn;return d},A.prototype.listenerCount=function(S){var O=I?I+S:S,_=this._events[O];return _?_.fn?1:_.length:0},A.prototype.emit=function(S,O,_,x,v,d){var o=I?I+S:S;if(!this._events[o])return!1;var u=this._events[o],l=arguments.length,w,p;if(u.fn){u.once&&this.removeListener(S,u.fn,void 0,!0);switch(l){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,O),!0;case 3:return u.fn.call(u.context,O,_),!0;case 4:return u.fn.call(u.context,O,_,x),!0;case 5:return u.fn.call(u.context,O,_,x,v),!0;case 6:return u.fn.call(u.context,O,_,x,v,d),!0}for(p=1,w=new Array(l-1);p<l;p++)w[p-1]=arguments[p];u.fn.apply(u.context,w)}else{var f=u.length,C;for(p=0;p<f;p++){u[p].once&&this.removeListener(S,u[p].fn,void 0,!0);switch(l){case 1:u[p].fn.call(u[p].context);break;case 2:u[p].fn.call(u[p].context,O);break;case 3:u[p].fn.call(u[p].context,O,_);break;case 4:u[p].fn.call(u[p].context,O,_,x);break;default:if(!w)for(C=1,w=new Array(l-1);C<l;C++)w[C-1]=arguments[C];u[p].fn.apply(u[p].context,w)}}}return!0},A.prototype.on=function(S,O,_){return U(this,S,O,_,!1)},A.prototype.once=function(S,O,_){return U(this,S,O,_,!0)},A.prototype.removeListener=function(S,O,_,x){var v=I?I+S:S;if(!this._events[v])return this;if(!O)return k(this,v),this;var d=this._events[v];if(d.fn)d.fn===O&&(!x||d.once)&&(!_||d.context===_)&&k(this,v);else{for(var o=0,u=[],l=d.length;o<l;o++)(d[o].fn!==O||x&&!d[o].once||_&&d[o].context!==_)&&u.push(d[o]);u.length?this._events[v]=u.length===1?u[0]:u:k(this,v)}return this},A.prototype.removeAllListeners=function(S){var O;return S?(O=I?I+S:S,this._events[O]&&k(this,O)):(this._events=new R,this._eventsCount=0),this},A.prototype.off=A.prototype.removeListener,A.prototype.addListener=A.prototype.on,A.prefixed=I,A.EventEmitter=A,re.exports=A},"./node_modules/url-toolkit/src/url-toolkit.js":function(re,G,L){(function(z){var I=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,R=/^([^\/?#]*)([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,U=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,k={buildAbsoluteURL:function(A,y,S){if(S=S||{},A=A.trim(),y=y.trim(),!y){if(!S.alwaysNormalize)return A;var O=k.parseURL(A);if(!O)throw new Error("Error trying to parse base URL.");return O.path=k.normalizePath(O.path),k.buildURLFromParts(O)}var _=k.parseURL(y);if(!_)throw new Error("Error trying to parse relative URL.");if(_.scheme)return S.alwaysNormalize?(_.path=k.normalizePath(_.path),k.buildURLFromParts(_)):y;var x=k.parseURL(A);if(!x)throw new Error("Error trying to parse base URL.");if(!x.netLoc&&x.path&&x.path[0]!=="/"){var v=R.exec(x.path);x.netLoc=v[1],x.path=v[2]}x.netLoc&&!x.path&&(x.path="/");var d={scheme:x.scheme,netLoc:_.netLoc,path:null,params:_.params,query:_.query,fragment:_.fragment};if(!_.netLoc&&(d.netLoc=x.netLoc,_.path[0]!=="/"))if(!_.path)d.path=x.path,_.params||(d.params=x.params,_.query||(d.query=x.query));else{var o=x.path,u=o.substring(0,o.lastIndexOf("/")+1)+_.path;d.path=k.normalizePath(u)}return d.path===null&&(d.path=S.alwaysNormalize?k.normalizePath(_.path):_.path),k.buildURLFromParts(d)},parseURL:function(A){var y=I.exec(A);return y?{scheme:y[1]||"",netLoc:y[2]||"",path:y[3]||"",params:y[4]||"",query:y[5]||"",fragment:y[6]||""}:null},normalizePath:function(A){for(A=A.split("").reverse().join("").replace(B,"");A.length!==(A=A.replace(U,"")).length;);return A.split("").reverse().join("")},buildURLFromParts:function(A){return A.scheme+A.netLoc+A.path+A.params+A.query+A.fragment}};re.exports=k})(this)},"./node_modules/webworkify-webpack/index.js":function(re,G,L){function z(S){var O={};function _(v){if(O[v])return O[v].exports;var d=O[v]={i:v,l:!1,exports:{}};return S[v].call(d.exports,d,d.exports,_),d.l=!0,d.exports}_.m=S,_.c=O,_.i=function(v){return v},_.d=function(v,d,o){_.o(v,d)||Object.defineProperty(v,d,{configurable:!1,enumerable:!0,get:o})},_.r=function(v){Object.defineProperty(v,"__esModule",{value:!0})},_.n=function(v){var d=v&&v.__esModule?function(){return v.default}:function(){return v};return _.d(d,"a",d),d},_.o=function(v,d){return Object.prototype.hasOwnProperty.call(v,d)},_.p="/",_.oe=function(v){throw console.error(v),v};var x=_(_.s=ENTRY_MODULE);return x.default||x}var I="[\\.|\\-|\\+|\\w|/|@]+",R="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+I+").*?\\)";function B(S){return(S+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function U(S){return!isNaN(1*S)}function k(S,O,_){var x={};x[_]=[];var v=O.toString(),d=v.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return x;for(var o=d[1],u=new RegExp("(\\\\n|\\W)"+B(o)+R,"g"),l;l=u.exec(v);){if(l[3]==="dll-reference")continue;x[_].push(l[3])}for(u=new RegExp("\\("+B(o)+'\\("(dll-reference\\s('+I+'))"\\)\\)'+R,"g");l=u.exec(v);)S[l[2]]||(x[_].push(l[1]),S[l[2]]=L(l[1]).m),x[l[2]]=x[l[2]]||[],x[l[2]].push(l[4]);for(var w=Object.keys(x),p=0;p<w.length;p++)for(var f=0;f<x[w[p]].length;f++)U(x[w[p]][f])&&(x[w[p]][f]=1*x[w[p]][f]);return x}function A(S){var O=Object.keys(S);return O.reduce(function(_,x){return _||S[x].length>0},!1)}function y(S,O){for(var _={main:[O]},x={main:[]},v={main:{}};A(_);)for(var d=Object.keys(_),o=0;o<d.length;o++){var u=d[o],l=_[u],w=l.pop();if(v[u]=v[u]||{},v[u][w]||!S[u][w])continue;v[u][w]=!0,x[u]=x[u]||[],x[u].push(w);for(var p=k(S,S[u][w],u),f=Object.keys(p),C=0;C<f.length;C++)_[f[C]]=_[f[C]]||[],_[f[C]]=_[f[C]].concat(p[f[C]])}return x}re.exports=function(S,O){O=O||{};var _={main:L.m},x=O.all?{main:Object.keys(_.main)}:y(_,S),v="";Object.keys(x).filter(function(w){return w!=="main"}).forEach(function(w){for(var p=0;x[w][p];)p++;x[w].push(p),_[w][p]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",v=v+"var "+w+" = ("+z.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+x[w].map(function(f){return""+JSON.stringify(f)+": "+_[w][f].toString()}).join(",")+`});
|
|
`}),v=v+"new (("+z.toString().replace("ENTRY_MODULE",JSON.stringify(S))+")({"+x.main.map(function(w){return""+JSON.stringify(w)+": "+_.main[w].toString()}).join(",")+"}))(self);";var d=new window.Blob([v],{type:"text/javascript"});if(O.bare)return d;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,u=o.createObjectURL(d),l=new window.Worker(u);return l.objectURL=u,l}},"./src/config.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"hlsDefaultConfig",function(){return C}),L.d(G,"mergeConfig",function(){return h}),L.d(G,"enableStreamingMode",function(){return c});var z=L("./src/controller/abr-controller.ts"),I=L("./src/controller/audio-stream-controller.ts"),R=L("./src/controller/audio-track-controller.ts"),B=L("./src/controller/subtitle-stream-controller.ts"),U=L("./src/controller/subtitle-track-controller.ts"),k=L("./src/controller/buffer-controller.ts"),A=L("./src/controller/timeline-controller.ts"),y=L("./src/controller/cap-level-controller.ts"),S=L("./src/controller/fps-controller.ts"),O=L("./src/controller/eme-controller.ts"),_=L("./src/controller/cmcd-controller.ts"),x=L("./src/utils/xhr-loader.ts"),v=L("./src/utils/fetch-loader.ts"),d=L("./src/utils/cues.ts"),o=L("./src/utils/mediakeys-helper.ts"),u=L("./src/utils/logger.ts");function l(){return l=Object.assign||function(s){for(var a=1;a<arguments.length;a++){var g=arguments[a];for(var m in g)Object.prototype.hasOwnProperty.call(g,m)&&(s[m]=g[m])}return s},l.apply(this,arguments)}function w(s,a){var g=Object.keys(s);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(s);a&&(m=m.filter(function(E){return Object.getOwnPropertyDescriptor(s,E).enumerable})),g.push.apply(g,m)}return g}function p(s){for(var a=1;a<arguments.length;a++){var g=arguments[a]!=null?arguments[a]:{};a%2?w(Object(g),!0).forEach(function(m){f(s,m,g[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(g)):w(Object(g)).forEach(function(m){Object.defineProperty(s,m,Object.getOwnPropertyDescriptor(g,m))})}return s}function f(s,a,g){return a in s?Object.defineProperty(s,a,{value:g,enumerable:!0,configurable:!0,writable:!0}):s[a]=g,s}var C=p(p({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:x.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:z.default,bufferController:k.default,capLevelController:y.default,fpsController:S.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},b()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:U.default,timelineController:A.TimelineController,audioStreamController:I.default,audioTrackController:R.default,emeController:O.default,cmcdController:_.default});function b(){return{cueHandler:d.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function h(s,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return l({},s,a)}function c(s){var a=s.loader;if(a!==v.default&&a!==x.default)u.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1;else{var g=Object(v.fetchSupported)();g&&(s.loader=v.default,s.progressive=!0,s.enableSoftwareAES=!0,u.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(re,G,L){"use strict";L.r(G);var z=L("./src/polyfills/number.ts"),I=L("./src/utils/ewma-bandwidth-estimator.ts"),R=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),U=L("./src/errors.ts"),k=L("./src/types/loader.ts"),A=L("./src/utils/logger.ts");function y(_,x){for(var v=0;v<x.length;v++){var d=x[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(_,d.key,d)}}function S(_,x,v){return x&&y(_.prototype,x),v&&y(_,v),_}var O=function(){function _(v){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=v;var d=v.config;this.bwEstimator=new I.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var x=_.prototype;return x.registerListeners=function(){var d=this.hls;d.on(R.Events.FRAG_LOADING,this.onFragLoading,this),d.on(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(R.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var d=this.hls;d.off(R.Events.FRAG_LOADING,this.onFragLoading,this),d.off(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(R.Events.ERROR,this.onError,this)},x.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},x.onFragLoading=function(d,o){var u=o.frag;if(u.type===k.PlaylistLevelType.MAIN&&!this.timer){var l;this.fragCurrent=u,this.partCurrent=(l=o.part)!=null?l:null,this.timer=self.setInterval(this.onCheck,100)}},x.onLevelLoaded=function(d,o){var u=this.hls.config;o.details.live?this.bwEstimator.update(u.abrEwmaSlowLive,u.abrEwmaFastLive):this.bwEstimator.update(u.abrEwmaSlowVoD,u.abrEwmaFastVoD)},x._abandonRulesCheck=function(){var d=this.fragCurrent,o=this.partCurrent,u=this.hls,l=u.autoLevelEnabled,w=u.config,p=u.media;if(!d||!p)return;var f=o?o.stats:d.stats,C=o?o.duration:d.duration;if(f.aborted){A.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!l||p.paused||!p.playbackRate||!p.readyState)return;var b=performance.now()-f.loading.start,h=Math.abs(p.playbackRate);if(b<=500*C/h)return;var c=u.levels,s=u.minAutoLevel,a=c[d.level],g=f.total||Math.max(f.loaded,Math.round(C*a.maxBitrate/8)),m=Math.max(1,f.bwEstimate?f.bwEstimate/8:f.loaded*1e3/b),E=(g-f.loaded)/m,M=p.currentTime,F=(B.BufferHelper.bufferInfo(p,M,w.maxBufferHole).end-M)/h;if(F>=2*C/h||E<=F)return;var j=Number.POSITIVE_INFINITY,W;for(W=d.level-1;W>s;W--){var D=c[W].maxBitrate;if(j=C*D/(8*.8*m),j<F)break}if(j>=E)return;var P=this.bwEstimator.getEstimate();A.logger.warn("Fragment "+d.sn+(o?" part "+o.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+W+`
|
|
Current BW estimate: `+(Object(z.isFiniteNumber)(P)?(P/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+E.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+j.toFixed(3)+` s
|
|
Time to underbuffer: `+F.toFixed(3)+" s"),u.nextLoadLevel=W,this.bwEstimator.sample(b,f.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),u.trigger(R.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:o,stats:f})},x.onFragLoaded=function(d,o){var u=o.frag,l=o.part;if(u.type===k.PlaylistLevelType.MAIN&&Object(z.isFiniteNumber)(u.sn)){var w=l?l.stats:u.stats,p=l?l.duration:u.duration;if(this.clearTimer(),this.lastLoadedFragLevel=u.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var f=this.hls.levels[u.level],C=(f.loaded?f.loaded.bytes:0)+w.loaded,b=(f.loaded?f.loaded.duration:0)+p;f.loaded={bytes:C,duration:b},f.realBitrate=Math.round(8*C/b)}if(u.bitrateTest){var h={stats:w,frag:u,part:l,id:u.type};this.onFragBuffered(R.Events.FRAG_BUFFERED,h),u.bitrateTest=!1}}},x.onFragBuffered=function(d,o){var u=o.frag,l=o.part,w=l?l.stats:u.stats;if(w.aborted)return;if(u.type!==k.PlaylistLevelType.MAIN||u.sn==="initSegment")return;var p=w.parsing.end-w.loading.start;this.bwEstimator.sample(p,w.loaded),w.bwEstimate=this.bwEstimator.getEstimate(),u.bitrateTest?this.bitrateTestDelay=p/1e3:this.bitrateTestDelay=0},x.onError=function(d,o){switch(o.details){case U.ErrorDetails.FRAG_LOAD_ERROR:case U.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},x.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},x.getNextABRAutoLevel=function(){var d=this.fragCurrent,o=this.partCurrent,u=this.hls,l=u.maxAutoLevel,w=u.config,p=u.minAutoLevel,f=u.media,C=o?o.duration:d?d.duration:0,b=f?f.currentTime:0,h=f&&f.playbackRate!==0?Math.abs(f.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():w.abrEwmaDefaultEstimate,s=(B.BufferHelper.bufferInfo(f,b,w.maxBufferHole).end-b)/h,a=this.findBestLevel(c,p,l,s,w.abrBandWidthFactor,w.abrBandWidthUpFactor);if(a>=0)return a;A.logger.trace((s?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var g=C?Math.min(C,w.maxStarvationDelay):w.maxStarvationDelay,m=w.abrBandWidthFactor,E=w.abrBandWidthUpFactor;if(!s){var M=this.bitrateTestDelay;if(M){var F=C?Math.min(C,w.maxLoadingDelay):w.maxLoadingDelay;g=F-M,A.logger.trace("bitrate test took "+Math.round(1e3*M)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*g)+" ms"),m=E=1}}return a=this.findBestLevel(c,p,l,s+g,m,E),Math.max(a,0)},x.findBestLevel=function(d,o,u,l,w,p){for(var f,C=this.fragCurrent,b=this.partCurrent,h=this.lastLoadedFragLevel,c=this.hls.levels,s=c[h],a=!!(s!=null&&(f=s.details)!==null&&f!==void 0&&f.live),g=s==null?void 0:s.codecSet,m=b?b.duration:C?C.duration:0,E=u;E>=o;E--){var M=c[E];if(!M||g&&M.codecSet!==g)continue;var F=M.details,j=(b?F==null?void 0:F.partTarget:F==null?void 0:F.averagetargetduration)||m,W=void 0;E<=h?W=w*d:W=p*d;var D=c[E].maxBitrate,P=D*j/W;if(A.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+E+"/"+Math.round(W)+"/"+D+"/"+j+"/"+l+"/"+P),W>D&&(!P||a&&!this.bitrateTestDelay||P<l))return E}return-1},S(_,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,o=this.bwEstimator;if(d!==-1&&(!o||!o.canEstimate()))return d;var u=this.getNextABRAutoLevel();return d!==-1&&(u=Math.min(d,u)),u},set:function(d){this._nextAutoLevel=d}}]),_}();G.default=O},"./src/controller/audio-stream-controller.ts":function(re,G,L){"use strict";L.r(G);var z=L("./src/polyfills/number.ts"),I=L("./src/controller/base-stream-controller.ts"),R=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),U=L("./src/controller/fragment-tracker.ts"),k=L("./src/types/level.ts"),A=L("./src/types/loader.ts"),y=L("./src/loader/fragment.ts"),S=L("./src/demux/chunk-cache.ts"),O=L("./src/demux/transmuxer-interface.ts"),_=L("./src/types/transmuxer.ts"),x=L("./src/controller/fragment-finders.ts"),v=L("./src/utils/discontinuities.ts"),d=L("./src/errors.ts"),o=L("./src/utils/logger.ts");function u(){return u=Object.assign||function(C){for(var b=1;b<arguments.length;b++){var h=arguments[b];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(C[c]=h[c])}return C},u.apply(this,arguments)}function l(C,b){C.prototype=Object.create(b.prototype),C.prototype.constructor=C,w(C,b)}function w(C,b){return w=Object.setPrototypeOf||function(c,s){return c.__proto__=s,c},w(C,b)}var p=100,f=function(C){l(b,C);function b(c,s){var a;return a=C.call(this,c,s,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var h=b.prototype;return h.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},h._registerListeners=function(){var s=this.hls;s.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.on(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.on(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.on(R.Events.ERROR,this.onError,this),s.on(R.Events.BUFFER_RESET,this.onBufferReset,this),s.on(R.Events.BUFFER_CREATED,this.onBufferCreated,this),s.on(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.on(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h._unregisterListeners=function(){var s=this.hls;s.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.off(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.off(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.off(R.Events.ERROR,this.onError,this),s.off(R.Events.BUFFER_RESET,this.onBufferReset,this),s.off(R.Events.BUFFER_CREATED,this.onBufferCreated,this),s.off(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.off(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h.onInitPtsFound=function(s,a){var g=a.frag,m=a.id,E=a.initPTS;if(m==="main"){var M=g.cc;this.initPTS[g.cc]=E,this.log("InitPTS for cc: "+M+" found from main: "+E),this.videoTrackCC=M,this.state===I.State.WAITING_INIT_PTS&&this.tick()}},h.startLoad=function(s){if(!this.levels){this.startPosition=s,this.state=I.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(p),this.fragLoadError=0,a>0&&s===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=I.State.IDLE):(this.loadedmetadata=!1,this.state=I.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=s,this.tick()},h.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_TRACK:{var s,a=this.levels,g=this.trackId,m=a==null||((s=a[g])===null||s===void 0)?void 0:s.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=I.State.WAITING_INIT_PTS}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var E,M=performance.now(),F=this.retryDate;(!F||M>=F||(E=this.media)!==null&&E!==void 0&&E.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=I.State.IDLE);break}case I.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var W=j.frag,D=j.part,P=j.cache,H=j.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.FRAG_LOADING;var Y=P.flush(),ee={frag:W,part:D,payload:Y,networkDetails:null};this._handleFragmentLoadProgress(ee),H&&C.prototype._handleFragmentLoadComplete.call(this,ee)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+W.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var oe=this.getLoadPosition(),Te=B.BufferHelper.bufferInfo(this.mediaBuffer,oe,this.config.maxBufferHole),ye=Object(x.fragmentWithinToleranceTest)(Te.end,this.config.maxFragLookUpTolerance,W);ye<0&&(o.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+Te.end+" is needed"),this.clearWaitingFragment())}}else this.state=I.State.IDLE}}this.onTickEnd()},h.clearWaitingFragment=function(){var s=this.waitingData;s&&(this.fragmentTracker.removeFragment(s.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.IDLE)},h.onTickEnd=function(){var s=this.media;if(!s||!s.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:s,g=a.buffered;!this.loadedmetadata&&g.length&&(this.loadedmetadata=!0),this.lastCurrentTime=s.currentTime},h.doTickIdle=function(){var s,a,g=this.hls,m=this.levels,E=this.media,M=this.trackId,F=g.config;if(!m||!m[M])return;if(!E&&(this.startFragRequested||!F.startFragPrefetch))return;var j=m[M],W=j.details;if(!W||W.live&&this.levelLastLoaded!==M||this.waitForCdnTuneIn(W)){this.state=I.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,y.ElementaryStreamTypes.AUDIO,A.PlaylistLevelType.AUDIO));var D=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,A.PlaylistLevelType.AUDIO);if(D===null)return;var P=D.len,H=this.getMaxBufferLength(),Y=this.audioSwitch;if(P>=H&&!Y)return;if(!Y&&this._streamEnded(D,W)){g.trigger(R.Events.BUFFER_EOS,{type:"audio"}),this.state=I.State.ENDED;return}var ee=W.fragments,oe=ee[0].start,Te=D.end;if(Y){var ye=this.getLoadPosition();Te=ye,W.PTSKnown&&ye<oe&&((D.end>oe||D.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),E.currentTime=oe+.05))}var he=this.getNextFragment(Te,W);if(!he){this.bufferFlushed=!0;return}((s=he.decryptdata)===null||s===void 0?void 0:s.keyFormat)==="identity"&&!((a=he.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(he,W):this.loadFragment(he,W,Te)},h.getMaxBufferLength=function(){var s=C.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,A.PlaylistLevelType.MAIN);return a===null?s:Math.max(s,a.len)},h.onMediaDetaching=function(){this.videoBuffer=null,C.prototype.onMediaDetaching.call(this)},h.onAudioTracksUpdated=function(s,a){var g=a.audioTracks;this.resetTransmuxer(),this.levels=g.map(function(m){return new k.Level(m)})},h.onAudioTrackSwitching=function(s,a){var g=!!a.url;this.trackId=a.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),g?this.setInterval(p):this.resetTransmuxer(),g?(this.audioSwitch=!0,this.state=I.State.IDLE):this.state=I.State.STOPPED,this.tick()},h.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},h.onLevelLoaded=function(s,a){this.mainDetails=a.details},h.onAudioTrackLoaded=function(s,a){var g,m=this.levels,E=a.details,M=a.id;if(!m){this.warn("Audio tracks were reset while loading level "+M);return}this.log("Track "+M+" loaded ["+E.startSN+","+E.endSN+"],duration:"+E.totalduration);var F=m[M],j=0;if(E.live||(g=F.details)!==null&&g!==void 0&&g.live){var W=this.mainDetails;if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed||!W)return;!F.details&&E.hasProgramDateTime&&W.hasProgramDateTime?(Object(v.alignMediaPlaylistByPDT)(E,W),j=E.fragments[0].start):j=this.alignPlaylists(E,F.details)}F.details=E,this.levelLastLoaded=M,!this.startFragRequested&&(this.mainDetails||!E.live)&&this.setStartPosition(F.details,j),this.state===I.State.WAITING_TRACK&&!this.waitForCdnTuneIn(E)&&(this.state=I.State.IDLE),this.tick()},h._handleFragmentLoadProgress=function(s){var a,g=s.frag,m=s.part,E=s.payload,M=this.config,F=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+g.sn+" of level "+g.level+" will not be buffered");return}var W=j[F];console.assert(W,"Audio track is defined on fragment load progress");var D=W.details;console.assert(D,"Audio track details are defined on fragment load progress");var P=M.defaultAudioCodec||W.audioCodec||"mp4a.40.2",H=this.transmuxer;H||(H=this.transmuxer=new O.default(this.hls,A.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Y=this.initPTS[g.cc],ee=(a=g.initSegment)===null||a===void 0?void 0:a.data;if(Y!==void 0){var oe=!1,Te=m?m.index:-1,ye=Te!==-1,he=new _.ChunkMetadata(g.level,g.sn,g.stats.chunkCount,E.byteLength,Te,ye);H.push(E,ee,P,"",g,m,D.totalduration,oe,he,Y)}else{o.logger.log("Unknown video PTS for cc "+g.cc+", waiting for video PTS before demuxing audio frag "+g.sn+" of ["+D.startSN+" ,"+D.endSN+"],track "+F);var le=this.waitingData=this.waitingData||{frag:g,part:m,cache:new S.default,complete:!1},me=le.cache;me.push(new Uint8Array(E)),this.waitingVideoCC=this.videoTrackCC,this.state=I.State.WAITING_INIT_PTS}},h._handleFragmentLoadComplete=function(s){if(this.waitingData){this.waitingData.complete=!0;return}C.prototype._handleFragmentLoadComplete.call(this,s)},h.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},h.onBufferCreated=function(s,a){var g=a.tracks.audio;g&&(this.mediaBuffer=g.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},h.onFragBuffered=function(s,a){var g=a.frag,m=a.part;if(g.type!==A.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(g)){this.warn("Fragment "+g.sn+(m?" p: "+m.index:"")+" of level "+g.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}g.sn!=="initSegment"&&(this.fragPrevious=g,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(g,m)},h.onError=function(s,a){switch(a.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(A.PlaylistLevelType.AUDIO,a);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==I.State.ERROR&&this.state!==I.State.STOPPED&&(this.state=a.fatal?I.State.ERROR:I.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var g=!0,m=this.getFwdBufferInfo(this.mediaBuffer,A.PlaylistLevelType.AUDIO);m&&m.len>.5&&(g=!this.reduceMaxBufferLength(m.len)),g&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,C.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},h.onBufferFlushed=function(s,a){var g=a.type;g===y.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},h._handleTransmuxComplete=function(s){var a,g="audio",m=this.hls,E=s.remuxResult,M=s.chunkMeta,F=this.getCurrentContext(M);if(!F){this.warn("The loading context changed while buffering fragment "+M.sn+" of level "+M.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(M.level);return}var j=F.frag,W=F.part,D=E.audio,P=E.text,H=E.id3,Y=E.initSegment;if(this.fragContextChanged(j))return;if(this.state=I.State.PARSING,this.audioSwitch&&D&&this.completeAudioSwitch(),Y!=null&&Y.tracks&&(this._bufferInitSegment(Y.tracks,j,M),m.trigger(R.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:g,tracks:Y.tracks})),D){var ee=D.startPTS,oe=D.endPTS,Te=D.startDTS,ye=D.endDTS;W&&(W.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:ee,endPTS:oe,startDTS:Te,endDTS:ye}),j.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,ee,oe,Te,ye),this.bufferFragmentData(D,j,W,M)}if(H!=null&&(a=H.samples)!==null&&a!==void 0&&a.length){var he=u({frag:j,id:g},H);m.trigger(R.Events.FRAG_PARSING_METADATA,he)}if(P){var le=u({frag:j,id:g},P);m.trigger(R.Events.FRAG_PARSING_USERDATA,le)}},h._bufferInitSegment=function(s,a,g){if(this.state!==I.State.PARSING)return;s.video&&delete s.video;var m=s.audio;if(!m)return;m.levelCodec=m.codec,m.id="audio",this.log("Init audio buffer, container:"+m.container+", codecs[parsed]=["+m.codec+"]"),this.hls.trigger(R.Events.BUFFER_CODECS,s);var E=m.initSegment;if(E!=null&&E.byteLength){var M={type:"audio",frag:a,part:null,chunkMeta:g,parent:a.type,data:E};this.hls.trigger(R.Events.BUFFER_APPENDING,M)}this.tick()},h.loadFragment=function(s,a,g){var m=this.fragmentTracker.getState(s);this.fragCurrent=s,(this.audioSwitch||m===U.FragmentState.NOT_LOADED||m===U.FragmentState.PARTIAL)&&(s.sn==="initSegment"?this._loadInitSegment(s):a.live&&!Object(z.isFiniteNumber)(this.initPTS[s.cc])?(this.log("Waiting for video PTS in continuity counter "+s.cc+" of live stream before loading audio fragment "+s.sn+" of level "+this.trackId),this.state=I.State.WAITING_INIT_PTS):(this.startFragRequested=!0,C.prototype.loadFragment.call(this,s,a,g)))},h.completeAudioSwitch=function(){var s=this.hls,a=this.media,g=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),C.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,s.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:g})},b}(I.default);G.default=f},"./src/controller/audio-track-controller.ts":function(re,G,L){"use strict";L.r(G);var z=L("./src/events.ts"),I=L("./src/errors.ts"),R=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function U(O,_){for(var x=0;x<_.length;x++){var v=_[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(O,v.key,v)}}function k(O,_,x){return _&&U(O.prototype,_),x&&U(O,x),O}function A(O,_){O.prototype=Object.create(_.prototype),O.prototype.constructor=O,y(O,_)}function y(O,_){return y=Object.setPrototypeOf||function(v,d){return v.__proto__=d,v},y(O,_)}var S=function(O){A(_,O);function _(v){var d;return d=O.call(this,v,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var x=_.prototype;return x.registerListeners=function(){var d=this.hls;d.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(z.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var d=this.hls;d.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(z.Events.ERROR,this.onError,this)},x.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,O.prototype.destroy.call(this)},x.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},x.onManifestParsed=function(d,o){this.tracks=o.audioTracks||[]},x.onAudioTrackLoaded=function(d,o){var u=o.id,l=o.details,w=this.tracksInGroup[u];if(!w){this.warn("Invalid audio track id "+u);return}var p=w.details;w.details=o.details,this.log("audioTrack "+u+" loaded ["+l.startSN+"-"+l.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,o,p))},x.onLevelLoading=function(d,o){this.switchLevel(o.level)},x.onLevelSwitching=function(d,o){this.switchLevel(o.level)},x.switchLevel=function(d){var o=this.hls.levels[d];if(!(o!=null&&o.audioGroupIds))return;var u=o.audioGroupIds[o.urlId];if(this.groupId!==u){this.groupId=u;var l=this.tracks.filter(function(p){return!u||p.groupId===u});this.selectDefaultTrack&&!l.some(function(p){return p.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=l;var w={audioTracks:l};this.log("Updating audio tracks, "+l.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(z.Events.AUDIO_TRACKS_UPDATED,w),this.selectInitialTrack()}},x.onError=function(d,o){if(O.prototype.onError.call(this,d,o),o.fatal||!o.context)return;o.context.type===B.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},x.setAudioTrack=function(d){var o=this.tracksInGroup;if(d<0||d>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var u=o[this.trackId];this.log("Now switching to audio-track index "+d);var l=o[d],w=l.id,p=l.groupId,f=p===void 0?"":p,C=l.name,b=l.type,h=l.url;if(this.trackId=d,this.trackName=C,this.selectDefaultTrack=!1,this.hls.trigger(z.Events.AUDIO_TRACK_SWITCHING,{id:w,groupId:f,name:C,type:b,url:h}),l.details&&!l.details.live)return;var c=this.switchParams(l.url,u==null?void 0:u.details);this.loadPlaylist(c)},x.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,u=this.findTrackId(o)||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:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},x.findTrackId=function(d){for(var o=this.tracksInGroup,u=0;u<o.length;u++){var l=o[u];if((!this.selectDefaultTrack||l.default)&&(!d||d===l.name))return l.id}return-1},x.loadPlaylist=function(d){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var u=o.id,l=o.groupId,w=o.url;if(d)try{w=d.addDirectives(w)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("loading audio-track playlist for id: "+u),this.clearTimer(),this.hls.trigger(z.Events.AUDIO_TRACK_LOADING,{url:w,id:u,groupId:l,deliveryDirectives:d||null})}},k(_,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),_}(R.default);G.default=S},"./src/controller/base-playlist-controller.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"default",function(){return k});var z=L("./src/polyfills/number.ts"),I=L("./src/types/level.ts"),R=L("./src/controller/level-helper.ts"),B=L("./src/utils/logger.ts"),U=L("./src/errors.ts"),k=function(){function A(S,O){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=B.logger.log.bind(B.logger,O+":"),this.warn=B.logger.warn.bind(B.logger,O+":"),this.hls=S}var y=A.prototype;return y.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},y.onError=function(O,_){_.fatal&&_.type===U.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},y.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},y.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},y.stopLoad=function(){this.canLoad=!1,this.clearTimer()},y.switchParams=function(O,_){var x=_==null?void 0:_.renditionReports;if(x)for(var v=0;v<x.length;v++){var d=x[v],o=""+d.URI;if(o===O.substr(-o.length)){var u=parseInt(d["LAST-MSN"]),l=parseInt(d["LAST-PART"]);if(_&&this.hls.config.lowLatencyMode){var w=Math.min(_.age-_.partTarget,_.targetduration);l!==void 0&&w>_.partTarget&&(l+=1)}if(Object(z.isFiniteNumber)(u))return new I.HlsUrlParameters(u,Object(z.isFiniteNumber)(l)?l:void 0,I.HlsSkip.No)}}},y.loadPlaylist=function(O){},y.shouldLoadTrack=function(O){return this.canLoad&&O&&!!O.url&&(!O.details||O.details.live)},y.playlistLoaded=function(O,_,x){var v=this,d=_.details,o=_.stats,u=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(d.advancedDateTime=Date.now()-u,d.live||x!=null&&x.live){if(d.reloaded(x),x&&this.log("live playlist "+O+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),x&&d.fragments.length>0&&Object(R.mergeDetails)(x,d),!this.canLoad||!d.live)return;var l,w=void 0,p=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var f=this.hls.config.lowLatencyMode,C=d.lastPartSn,b=d.endSN,h=d.lastPartIndex,c=h!==-1,s=C===b,a=f?0:h;c?(w=s?b+1:C,p=s?a:h+1):w=b+1;var g=d.age,m=g+d.ageHeader,E=Math.min(m-d.partTarget,d.targetduration*1.5);if(E>0){if(x&&E>x.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+x.tuneInGoal+" to: "+E+" with playlist age: "+d.age),E=0;else{var M=Math.floor(E/d.targetduration);if(w+=M,p!==void 0){var F=Math.round(E%d.targetduration/d.partTarget);p+=F}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+g.toFixed(2)+"s goal: "+E+" skip sn "+M+" to part "+p)}d.tuneInGoal=E}if(l=this.getDeliveryDirectives(d,_.deliveryDirectives,w,p),f||!s){this.loadPlaylist(l);return}}else l=this.getDeliveryDirectives(d,_.deliveryDirectives,w,p);var j=Object(R.computeReloadInterval)(d,o);w!==void 0&&d.canBlockReload&&(j-=d.partTarget||1),this.log("reload live playlist "+O+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return v.loadPlaylist(l)},j)}else this.clearTimer()},y.getDeliveryDirectives=function(O,_,x,v){var d=Object(I.getSkipValue)(O,x);return _!=null&&_.skip&&O.deltaUpdateFailed&&(x=_.msn,v=_.part,d=I.HlsSkip.No),new I.HlsUrlParameters(x,v,d)},y.retryLoadingOrFail=function(O){var _=this,x=this.hls.config,v=this.retryCount<x.levelLoadingMaxRetry;if(v){var d;if(this.retryCount++,O.details.indexOf("LoadTimeOut")>-1&&(d=O.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+O.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*x.levelLoadingRetryDelay,x.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return _.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+O.details+'"')}}else this.warn('cannot recover from error "'+O.details+'"'),this.clearTimer(),O.fatal=!0;return v},A}()},"./src/controller/base-stream-controller.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"State",function(){return b}),L.d(G,"default",function(){return h});var z=L("./src/polyfills/number.ts"),I=L("./src/task-loop.ts"),R=L("./src/controller/fragment-tracker.ts"),B=L("./src/utils/buffer-helper.ts"),U=L("./src/utils/logger.ts"),k=L("./src/events.ts"),A=L("./src/errors.ts"),y=L("./src/types/transmuxer.ts"),S=L("./src/utils/mp4-tools.ts"),O=L("./src/utils/discontinuities.ts"),_=L("./src/controller/fragment-finders.ts"),x=L("./src/controller/level-helper.ts"),v=L("./src/loader/fragment-loader.ts"),d=L("./src/crypt/decrypter.ts"),o=L("./src/utils/time-ranges.ts"),u=L("./src/types/loader.ts");function l(c,s){for(var a=0;a<s.length;a++){var g=s[a];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(c,g.key,g)}}function w(c,s,a){return s&&l(c.prototype,s),a&&l(c,a),c}function p(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function f(c,s){c.prototype=Object.create(s.prototype),c.prototype.constructor=c,C(c,s)}function C(c,s){return C=Object.setPrototypeOf||function(g,m){return g.__proto__=m,g},C(c,s)}var b={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},h=function(c){f(s,c);function s(g,m,E){var M;return M=c.call(this)||this,M.hls=void 0,M.fragPrevious=null,M.fragCurrent=null,M.fragmentTracker=void 0,M.transmuxer=null,M._state=b.STOPPED,M.media=void 0,M.mediaBuffer=void 0,M.config=void 0,M.bitrateTest=!1,M.lastCurrentTime=0,M.nextLoadPosition=0,M.startPosition=0,M.loadedmetadata=!1,M.fragLoadError=0,M.retryDate=0,M.levels=null,M.fragmentLoader=void 0,M.levelLastLoaded=null,M.startFragRequested=!1,M.decrypter=void 0,M.initPTS=[],M.onvseeking=null,M.onvended=null,M.logPrefix="",M.log=void 0,M.warn=void 0,M.logPrefix=E,M.log=U.logger.log.bind(U.logger,E+":"),M.warn=U.logger.warn.bind(U.logger,E+":"),M.hls=g,M.fragmentLoader=new v.default(g.config),M.fragmentTracker=m,M.config=g.config,M.decrypter=new d.default(g,g.config),g.on(k.Events.KEY_LOADED,M.onKeyLoaded,p(M)),M}var a=s.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(m){},a.stopLoad=function(){this.fragmentLoader.abort();var m=this.fragCurrent;m&&this.fragmentTracker.removeFragment(m),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=b.STOPPED},a._streamEnded=function(m,E){var M=this.fragCurrent,F=this.fragmentTracker;if(!E.live&&M&&M.sn===E.endSN&&!m.nextStart){var j=F.getState(M);return j===R.FragmentState.PARTIAL||j===R.FragmentState.OK}return!1},a.onMediaAttached=function(m,E){var M=this.media=this.mediaBuffer=E.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),M.addEventListener("seeking",this.onvseeking),M.addEventListener("ended",this.onvended);var F=this.config;this.levels&&F.autoStartLoad&&this.state===b.STOPPED&&this.startLoad(F.startPosition)},a.onMediaDetaching=function(){var m=this.media;m!=null&&m.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),m&&(m.removeEventListener("seeking",this.onvseeking),m.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var m=this.config,E=this.fragCurrent,M=this.media,F=this.mediaBuffer,j=this.state,W=M?M.currentTime:0,D=B.BufferHelper.bufferInfo(F||M,W,m.maxBufferHole);if(this.log("media seeking to "+(Object(z.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+j),j===b.ENDED)this.resetLoadingState();else if(E&&!D.len){var P=m.maxFragLookUpTolerance,H=E.start-P,Y=E.start+E.duration+P,ee=W>Y;(W<H||ee)&&(ee&&E.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),E.loader.abort()),this.resetLoadingState())}M&&(this.lastCurrentTime=W),!this.loadedmetadata&&!D.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(m,E){if(this.state!==b.KEY_LOADING||E.frag!==this.fragCurrent||!this.levels)return;this.state=b.IDLE;var M=this.levels[E.frag.level].details;M&&this.loadFragment(E.frag,M,E.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=b.STOPPED,this.hls.off(k.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,c.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(m,E){this.log("Loading key for "+m.sn+" of ["+E.startSN+"-"+E.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=b.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(k.Events.KEY_LOADING,{frag:m})},a.loadFragment=function(m,E,M){this._loadFragForPlayback(m,E,M)},a._loadFragForPlayback=function(m,E,M){var F=this,j=function(D){if(F.fragContextChanged(m)){F.warn("Fragment "+m.sn+(D.part?" p: "+D.part.index:"")+" of level "+m.level+" was dropped during download."),F.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,F._handleFragmentLoadProgress(D)};this._doFragLoad(m,E,M,j).then(function(W){if(!W)return;F.fragLoadError=0;var D=F.state;if(F.fragContextChanged(m)){(D===b.FRAG_LOADING||D===b.BACKTRACKING||!F.fragCurrent&&D===b.PARSING)&&(F.fragmentTracker.removeFragment(m),F.state=b.IDLE);return}if("payload"in W&&(F.log("Loaded fragment "+m.sn+" of level "+m.level),F.hls.trigger(k.Events.FRAG_LOADED,W),F.state===b.BACKTRACKING)){F.fragmentTracker.backtrack(m,W),F.resetFragmentLoading(m);return}F._handleFragmentLoadComplete(W)}).catch(function(W){F.warn(W),F.resetFragmentLoading(m)})},a.flushMainBuffer=function(m,E,M){if(M===void 0&&(M=null),!(m-E))return;var F={startOffset:m,endOffset:E,type:M};this.fragLoadError=0,this.hls.trigger(k.Events.BUFFER_FLUSHING,F)},a._loadInitSegment=function(m){var E=this;this._doFragLoad(m).then(function(M){if(!M||E.fragContextChanged(m)||!E.levels)throw new Error("init load aborted");return M}).then(function(M){var F=E.hls,j=M.payload,W=m.decryptdata;if(j&&j.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var D=self.performance.now();return E.decrypter.webCryptoDecrypt(new Uint8Array(j),W.key.buffer,W.iv.buffer).then(function(P){var H=self.performance.now();return F.trigger(k.Events.FRAG_DECRYPTED,{frag:m,payload:P,stats:{tstart:D,tdecrypt:H}}),M.payload=P,M})}return M}).then(function(M){var F=E.fragCurrent,j=E.hls,W=E.levels;if(!W)throw new Error("init load aborted, missing levels");var D=W[m.level].details;console.assert(D,"Level details are defined when init segment is loaded");var P=m.stats;E.state=b.IDLE,E.fragLoadError=0,m.data=new Uint8Array(M.payload),P.parsing.start=P.buffering.start=self.performance.now(),P.parsing.end=P.buffering.end=self.performance.now(),M.frag===F&&j.trigger(k.Events.FRAG_BUFFERED,{stats:P,frag:F,part:null,id:m.type}),E.tick()}).catch(function(M){E.warn(M),E.resetFragmentLoading(m)})},a.fragContextChanged=function(m){var E=this.fragCurrent;return!m||!E||m.level!==E.level||m.sn!==E.sn||m.urlId!==E.urlId},a.fragBufferedComplete=function(m,E){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(E?" part: "+E.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+o.default.toString(B.BufferHelper.getBuffered(M))),this.state=b.IDLE,this.tick()},a._handleFragmentLoadComplete=function(m){var E=this.transmuxer;if(!E)return;var M=m.frag,F=m.part,j=m.partsLoaded,W=!j||j.length===0||j.some(function(P){return!P}),D=new y.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,F?F.index:-1,!W);E.flush(D)},a._handleFragmentLoadProgress=function(m){},a._doFragLoad=function(m,E,M,F){var j=this;if(M===void 0&&(M=null),!this.levels)throw new Error("frag load aborted, missing levels");if(M=Math.max(m.start,M||0),this.config.lowLatencyMode&&E){var W=E.partList;if(W&&F){M>m.end&&E.fragmentHint&&(m=E.fragmentHint);var D=this.getNextPart(W,m,M);if(D>-1){var P=W[D];return this.log("Loading part sn: "+m.sn+" p: "+P.index+" cc: "+m.cc+" of playlist ["+E.startSN+"-"+E.endSN+"] parts [0-"+D+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=P.start+P.duration,this.state=b.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:m,part:W[D],targetBufferTime:M}),this.doFragPartsLoad(m,W,D,F).catch(function(H){return j.handleFragLoadError(H)})}else if(!m.url||this.loadedEndOfParts(W,M))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(E?"of ["+E.startSN+"-"+E.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(M.toFixed(3))),Object(z.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=b.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:m,targetBufferTime:M}),this.fragmentLoader.load(m,F).catch(function(H){return j.handleFragLoadError(H)})},a.doFragPartsLoad=function(m,E,M,F){var j=this;return new Promise(function(W,D){var P=[],H=function Y(ee){var oe=E[ee];j.fragmentLoader.loadPart(m,oe,F).then(function(Te){P[oe.index]=Te;var ye=Te.part;j.hls.trigger(k.Events.FRAG_LOADED,Te);var he=E[ee+1];if(he&&he.fragment===m)Y(ee+1);else return W({frag:m,part:ye,partsLoaded:P})}).catch(D)};H(M)})},a.handleFragLoadError=function(m){var E=m.data;return E&&E.details===A.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(E.frag,E.part):this.hls.trigger(k.Events.ERROR,E),null},a._handleTransmuxerFlush=function(m){var E=this.getCurrentContext(m);if(!E||this.state!==b.PARSING){this.fragCurrent||(this.state=b.IDLE);return}var M=E.frag,F=E.part,j=E.level,W=self.performance.now();M.stats.parsing.end=W,F&&(F.stats.parsing.end=W),this.updateLevelTiming(M,F,j,m.partial)},a.getCurrentContext=function(m){var E=this.levels,M=m.level,F=m.sn,j=m.part;if(!E||!E[M])return this.warn("Levels object was unset while buffering fragment "+F+" of level "+M+". The current chunk will not be buffered."),null;var W=E[M],D=j>-1?Object(x.getPartWith)(W,F,j):null,P=D?D.fragment:Object(x.getFragmentWithSN)(W,F,this.fragCurrent);return P?{frag:P,part:D,level:W}:null},a.bufferFragmentData=function(m,E,M,F){if(!m||this.state!==b.PARSING)return;var j=m.data1,W=m.data2,D=j;if(j&&W&&(D=Object(S.appendUint8Array)(j,W)),!D||!D.length)return;var P={type:m.type,frag:E,part:M,chunkMeta:F,parent:E.type,data:D};this.hls.trigger(k.Events.BUFFER_APPENDING,P),m.dropped&&m.independent&&!M&&this.flushBufferGap(E)},a.flushBufferGap=function(m){var E=this.media;if(!E)return;if(!B.BufferHelper.isBuffered(E,E.currentTime)){this.flushMainBuffer(0,m.start);return}var M=E.currentTime,F=B.BufferHelper.bufferInfo(E,M,0),j=m.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),D=Math.max(Math.min(m.start-W,F.end-W),M+W);m.start-D>W&&this.flushMainBuffer(D,m.start)},a.getFwdBufferInfo=function(m,E){var M=this.config,F=this.getLoadPosition();if(!Object(z.isFiniteNumber)(F))return null;var j=B.BufferHelper.bufferInfo(m,F,M.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(F,E);if(W&&j.nextStart<W.end)return B.BufferHelper.bufferInfo(m,F,Math.max(j.nextStart,M.maxBufferHole))}return j},a.getMaxBufferLength=function(m){var E=this.config,M;return m?M=Math.max(8*E.maxBufferSize/m,E.maxBufferLength):M=E.maxBufferLength,Math.min(M,E.maxMaxBufferLength)},a.reduceMaxBufferLength=function(m){var E=this.config,M=m||E.maxBufferLength;return E.maxMaxBufferLength>=M?(E.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+E.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(m,E){var M,F,j=E.fragments,W=j.length;if(!W)return null;var D=this.config,P=j[0].start,H;if(E.live){var Y=D.initialLiveManifestSize;if(W<Y)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+Y+")"),null;!E.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(H=this.getInitialLiveFragment(E,j),this.startPosition=H?this.hls.liveSyncPosition||H.start:m)}else m<=P&&(H=j[0]);if(!H){var ee=D.lowLatencyMode?E.partEnd:E.fragmentEnd;H=this.getFragmentAtPosition(m,ee,E)}return(M=H)!==null&&M!==void 0&&M.initSegment&&!((F=H)!==null&&F!==void 0&&F.initSegment.data)&&!this.bitrateTest&&(H=H.initSegment),H},a.getNextPart=function(m,E,M){for(var F=-1,j=!1,W=!0,D=0,P=m.length;D<P;D++){var H=m[D];if(W=W&&!H.independent,F>-1&&M<H.start)break;var Y=H.loaded;!Y&&(j||H.independent||W)&&H.fragment===E&&(F=D),j=Y}return F},a.loadedEndOfParts=function(m,E){var M=m[m.length-1];return M&&E>M.start&&M.loaded},a.getInitialLiveFragment=function(m,E){var M=this.fragPrevious,F=null;if(M){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+M.programDateTime),F=Object(_.findFragmentByPDT)(E,M.endProgramDateTime,this.config.maxFragLookUpTolerance)),!F){var j=M.sn+1;if(j>=m.startSN&&j<=m.endSN){var W=E[j-m.startSN];M.cc===W.cc&&(F=W,this.log("Live playlist, switching playlist, load frag with next SN: "+F.sn))}F||(F=Object(_.findFragWithCC)(E,M.cc),F&&this.log("Live playlist, switching playlist, load frag with same CC: "+F.sn))}}else{var D=this.hls.liveSyncPosition;D!==null&&(F=this.getFragmentAtPosition(D,this.bitrateTest?m.fragmentEnd:m.edge,m))}return F},a.getFragmentAtPosition=function(m,E,M){var F=this.config,j=this.fragPrevious,W=M.fragments,D=M.endSN,P=M.fragmentHint,H=F.maxFragLookUpTolerance,Y=!!(F.lowLatencyMode&&M.partList&&P);Y&&P&&!this.bitrateTest&&(W=W.concat(P),D=P.sn);var ee;if(m<E){var oe=m>E-H?0:H;ee=Object(_.findFragmentByPTS)(j,W,m,oe)}else ee=W[W.length-1];if(ee){var Te=ee.sn-M.startSN,ye=j&&ee.level===j.level,he=W[Te+1],le=this.fragmentTracker.getState(ee);if(le===R.FragmentState.BACKTRACKED){ee=null;for(var me=Te;W[me]&&this.fragmentTracker.getState(W[me])===R.FragmentState.BACKTRACKED;)j?ee=W[me--]:ee=W[--me];ee||(ee=he)}else j&&ee.sn===j.sn&&!Y&&(ye&&(ee.sn<D&&this.fragmentTracker.getState(he)!==R.FragmentState.OK?(this.log("SN "+ee.sn+" just loaded, load next one: "+he.sn),ee=he):ee=null))}return ee},a.synchronizeToLiveEdge=function(m){var E=this.config,M=this.media;if(!M)return;var F=this.hls.liveSyncPosition,j=M.currentTime,W=m.fragments[0].start,D=m.edge,P=j>=W-E.maxFragLookUpTolerance&&j<=D;if(F!==null&&M.duration>F&&(j<F||!P)){var H=E.liveMaxLatencyDuration!==void 0?E.liveMaxLatencyDuration:E.liveMaxLatencyDurationCount*m.targetduration;(!P&&M.readyState<4||j<D-H)&&(this.loadedmetadata||(this.nextLoadPosition=F),M.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+D+", reset currentTime to : "+F.toFixed(3)),M.currentTime=F))}},a.alignPlaylists=function(m,E){var M=this.levels,F=this.levelLastLoaded,j=this.fragPrevious,W=F!==null?M[F]:null,D=m.fragments.length;if(!D)return this.warn("No fragments in live playlist"),0;var P=m.fragments[0].start,H=!E,Y=m.alignedSliding&&Object(z.isFiniteNumber)(P);if(H||!Y&&!P){Object(O.alignStream)(j,W,m);var ee=m.fragments[0].start;return this.log("Live playlist sliding: "+ee.toFixed(2)+" start-sn: "+(E?E.startSN:"na")+"->"+m.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+D),ee}return P},a.waitForCdnTuneIn=function(m){var E=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*E)},a.setStartPosition=function(m,E){var M=this.startPosition;if(M<E&&(M=-1),M===-1||this.lastCurrentTime===-1){var F=m.startTimeOffset;Object(z.isFiniteNumber)(F)?(M=E+F,F<0&&(M+=m.totalduration),M=Math.min(Math.max(E,M),E+m.totalduration),this.log("Start time offset "+F+" found in playlist, adjust startPosition to "+M),this.startPosition=M):m.live?M=this.hls.liveSyncPosition||E:this.startPosition=M=0,this.lastCurrentTime=M}this.nextLoadPosition=M},a.getLoadPosition=function(){var m=this.media,E=0;return this.loadedmetadata&&m?E=m.currentTime:this.nextLoadPosition&&(E=this.nextLoadPosition),E},a.handleFragLoadAborted=function(m,E){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(E?" part"+E.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},a.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=b.IDLE)},a.onFragmentOrKeyLoadError=function(m,E){if(E.fatal)return;var M=E.frag;if(!M||M.type!==m)return;var F=this.fragCurrent;console.assert(F&&M.sn===F.sn&&M.level===F.level&&M.urlId===F.urlId,"Frag load error must match current frag to retry");var j=this.config;if(this.fragLoadError+1<=j.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(M.level))return;var W=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+M.sn+" of "+m+" "+M.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=b.FRAG_LOADING_WAITING_RETRY}else E.levelRetry?(m===u.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=b.IDLE):(U.logger.error(E.details+" reaches max retry, redispatch as fatal ..."),E.fatal=!0,this.hls.stopLoad(),this.state=b.ERROR)},a.afterBufferFlushed=function(m,E,M){if(!m)return;var F=B.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(E,F,M),this.state===b.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=b.IDLE},a.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var E=this.levels?this.levels[m].details:null;if(E!=null&&E.live)return this.startPosition=-1,this.setStartPosition(E,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(m,E,M,F){var j=this,W=M.details;console.assert(!!W,"level.details must be defined");var D=Object.keys(m.elementaryStreams).reduce(function(P,H){var Y=m.elementaryStreams[H];if(Y){var ee=Y.endPTS-Y.startPTS;if(ee<=0)return j.warn("Could not parse fragment "+m.sn+" "+H+" duration reliably ("+ee+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),P||!1;var oe=F?0:Object(x.updateFragPTSDTS)(W,m,Y.startPTS,Y.endPTS,Y.startDTS,Y.endDTS);return j.hls.trigger(k.Events.LEVEL_PTS_UPDATED,{details:W,level:M,drift:oe,type:H,frag:m,start:Y.startPTS,end:Y.endPTS}),!0}return P},!1);D?(this.state=b.PARSED,this.hls.trigger(k.Events.FRAG_PARSED,{frag:m,part:E})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},w(s,[{key:"state",get:function(){return this._state},set:function(m){var E=this._state;E!==m&&(this._state=m,this.log(E+"->"+m))}}]),s}(I.default)},"./src/controller/buffer-controller.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"default",function(){return _});var z=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),R=L("./src/utils/logger.ts"),B=L("./src/errors.ts"),U=L("./src/utils/buffer-helper.ts"),k=L("./src/utils/mediasource-helper.ts"),A=L("./src/loader/fragment.ts"),y=L("./src/controller/buffer-operation-queue.ts"),S=Object(k.getMediaSource)(),O=/([ha]vc.)(?:\.[^.,]+)+/,_=function(){function x(d){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var u=o.hls,l=o.media,w=o.mediaSource;R.logger.log("[buffer-controller]: Media source opened"),l&&(o.updateMediaElementDuration(),u.trigger(I.Events.MEDIA_ATTACHED,{media:l})),w&&w.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){R.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){R.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var v=x.prototype;return v.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},v.destroy=function(){this.unregisterListeners(),this.details=null},v.registerListeners=function(){var o=this.hls;o.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(I.Events.BUFFER_RESET,this.onBufferReset,this),o.on(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(I.Events.BUFFER_EOS,this.onBufferEos,this),o.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(I.Events.FRAG_PARSED,this.onFragParsed,this),o.on(I.Events.FRAG_CHANGED,this.onFragChanged,this)},v.unregisterListeners=function(){var o=this.hls;o.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(I.Events.BUFFER_RESET,this.onBufferReset,this),o.off(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(I.Events.BUFFER_EOS,this.onBufferEos,this),o.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(I.Events.FRAG_PARSED,this.onFragParsed,this),o.off(I.Events.FRAG_CHANGED,this.onFragChanged,this)},v._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new y.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},v.onManifestParsed=function(o,u){var l=2;(u.audio&&!u.video||!u.altAudio)&&(l=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=l,this.details=null,R.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},v.onMediaAttaching=function(o,u){var l=this.media=u.media;if(l&&S){var w=this.mediaSource=new S;w.addEventListener("sourceopen",this._onMediaSourceOpen),w.addEventListener("sourceended",this._onMediaSourceEnded),w.addEventListener("sourceclose",this._onMediaSourceClose),l.src=self.URL.createObjectURL(w),this._objectUrl=l.src}},v.onMediaDetaching=function(){var o=this.media,u=this.mediaSource,l=this._objectUrl;if(u){if(R.logger.log("[buffer-controller]: media source detaching"),u.readyState==="open")try{u.endOfStream()}catch(w){R.logger.warn("[buffer-controller]: onMediaDetaching: "+w.message+" while calling endOfStream")}this.onBufferReset(),u.removeEventListener("sourceopen",this._onMediaSourceOpen),u.removeEventListener("sourceended",this._onMediaSourceEnded),u.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(l&&self.URL.revokeObjectURL(l),o.src===l?(o.removeAttribute("src"),o.load()):R.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(I.Events.MEDIA_DETACHED,void 0)},v.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(u){var l=o.sourceBuffer[u];try{l&&(o.removeBufferListeners(u),o.mediaSource&&o.mediaSource.removeSourceBuffer(l),o.sourceBuffer[u]=void 0)}catch(w){R.logger.warn("[buffer-controller]: Failed to reset the "+u+" buffer",w)}}),this._initSourceBuffer()},v.onBufferCodecs=function(o,u){var l=this,w=this.getSourceBufferTypes().length;if(Object.keys(u).forEach(function(p){if(w){var f=l.tracks[p];if(f&&typeof f.buffer.changeType=="function"){var C=u[p],b=C.codec,h=C.levelCodec,c=C.container,s=(f.levelCodec||f.codec).replace(O,"$1"),a=(h||b).replace(O,"$1");if(s!==a){var g=c+";codecs="+(h||b);l.appendChangeType(p,g)}}}else l.pendingTracks[p]=u[p]}),w)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},v.appendChangeType=function(o,u){var l=this,w=this.operationQueue,p={execute:function(){var C=l.sourceBuffer[o];C&&(R.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+u),C.changeType(u)),w.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(C){R.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",C)}};w.append(p,o)},v.onBufferAppending=function(o,u){var l=this,w=this.hls,p=this.operationQueue,f=this.tracks,C=u.data,b=u.type,h=u.frag,c=u.part,s=u.chunkMeta,a=s.buffering[b],g=self.performance.now();a.start=g;var m=h.stats.buffering,E=c?c.stats.buffering:null;m.start===0&&(m.start=g),E&&E.start===0&&(E.start=g);var M=f.audio,F=b==="audio"&&s.id===1&&(M==null?void 0:M.container)==="audio/mpeg",j={execute:function(){if(a.executeStart=self.performance.now(),F){var D=l.sourceBuffer[b];if(D){var P=h.start-D.timestampOffset;Math.abs(P)>=.1&&(R.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+P+") sn: "+h.sn+")"),D.timestampOffset=h.start)}}l.appendExecutor(C,b)},onStart:function(){},onComplete:function(){var D=self.performance.now();a.executeEnd=a.end=D,m.first===0&&(m.first=D),E&&E.first===0&&(E.first=D);var P=l.sourceBuffer,H={};for(var Y in P)H[Y]=U.BufferHelper.getBuffered(P[Y]);l.appendError=0,l.hls.trigger(I.Events.BUFFER_APPENDED,{type:b,frag:h,part:c,chunkMeta:s,parent:h.type,timeRanges:H})},onError:function(D){R.logger.error("[buffer-controller]: Error encountered while trying to append to the "+b+" SourceBuffer",D);var P={type:B.ErrorTypes.MEDIA_ERROR,parent:h.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:D,fatal:!1};D.code===DOMException.QUOTA_EXCEEDED_ERR?P.details=B.ErrorDetails.BUFFER_FULL_ERROR:(l.appendError++,P.details=B.ErrorDetails.BUFFER_APPEND_ERROR,l.appendError>w.config.appendErrorMaxRetry&&(R.logger.error("[buffer-controller]: Failed "+w.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),P.fatal=!0)),w.trigger(I.Events.ERROR,P)}};p.append(j,b)},v.onBufferFlushing=function(o,u){var l=this,w=this.operationQueue,p=function(C){return{execute:l.removeExecutor.bind(l,C,u.startOffset,u.endOffset),onStart:function(){},onComplete:function(){l.hls.trigger(I.Events.BUFFER_FLUSHED,{type:C})},onError:function(h){R.logger.warn("[buffer-controller]: Failed to remove from "+C+" SourceBuffer",h)}}};u.type?w.append(p(u.type),u.type):this.getSourceBufferTypes().forEach(function(f){w.append(p(f),f)})},v.onFragParsed=function(o,u){var l=this,w=u.frag,p=u.part,f=[],C=p?p.elementaryStreams:w.elementaryStreams;C[A.ElementaryStreamTypes.AUDIOVIDEO]?f.push("audiovideo"):(C[A.ElementaryStreamTypes.AUDIO]&&f.push("audio"),C[A.ElementaryStreamTypes.VIDEO]&&f.push("video"));var b=function(){var c=self.performance.now();w.stats.buffering.end=c,p&&(p.stats.buffering.end=c);var s=p?p.stats:w.stats;l.hls.trigger(I.Events.FRAG_BUFFERED,{frag:w,part:p,stats:s,id:w.type})};f.length===0&&R.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+w.type+" level: "+w.level+" sn: "+w.sn),this.blockBuffers(b,f)},v.onFragChanged=function(o,u){this.flushBackBuffer()},v.onBufferEos=function(o,u){var l=this,w=this.getSourceBufferTypes().reduce(function(p,f){var C=l.sourceBuffer[f];return(!u.type||u.type===f)&&(C&&!C.ended&&(C.ended=!0,R.logger.log("[buffer-controller]: "+f+" sourceBuffer now EOS"))),p&&!!(!C||C.ended)},!0);w&&this.blockBuffers(function(){var p=l.mediaSource;if(!p||p.readyState!=="open")return;p.endOfStream()})},v.onLevelUpdated=function(o,u){var l=u.details;if(!l.fragments.length)return;this.details=l,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},v.flushBackBuffer=function(){var o=this.hls,u=this.details,l=this.media,w=this.sourceBuffer;if(!l||u===null)return;var p=this.getSourceBufferTypes();if(!p.length)return;var f=u.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(z.isFiniteNumber)(f)||f<0)return;var C=l.currentTime,b=u.levelTargetDuration,h=Math.max(f,b),c=Math.floor(C/b)*b-h;p.forEach(function(s){var a=w[s];if(a){var g=U.BufferHelper.getBuffered(a);g.length>0&&c>g.start(0)&&(o.trigger(I.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),u.live&&o.trigger(I.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(I.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:s}))}})},v.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,u=this.hls,l=this.media,w=this.mediaSource,p=o.fragments[0].start+o.totalduration,f=l.duration,C=Object(z.isFiniteNumber)(w.duration)?w.duration:0;o.live&&u.config.liveDurationInfinity?(R.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),w.duration=Infinity,this.updateSeekableRange(o)):(p>C&&p>f||!Object(z.isFiniteNumber)(f))&&(R.logger.log("[buffer-controller]: Updating Media Source duration to "+p.toFixed(3)),w.duration=p)},v.updateSeekableRange=function(o){var u=this.mediaSource,l=o.fragments,w=l.length;if(w&&o.live&&u!==null&&u!==void 0&&u.setLiveSeekableRange){var p=Math.max(0,l[0].start),f=Math.max(p,p+o.totalduration);u.setLiveSeekableRange(p,f)}},v.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,u=this.operationQueue,l=this.pendingTracks,w=Object.keys(l).length;if(w&&!o||w===2){this.createSourceBuffers(l),this.pendingTracks={};var p=this.getSourceBufferTypes();if(p.length===0){this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}p.forEach(function(f){u.executeNext(f)})}},v.createSourceBuffers=function(o){var u=this.sourceBuffer,l=this.mediaSource;if(!l)throw Error("createSourceBuffers called when mediaSource was null");var w=0;for(var p in o)if(!u[p]){var f=o[p];if(!f)throw Error("source buffer exists for track "+p+", however track does not");var C=f.levelCodec||f.codec,b=f.container+";codecs="+C;R.logger.log("[buffer-controller]: creating sourceBuffer("+b+")");try{var h=u[p]=l.addSourceBuffer(b),c=p;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[p]={buffer:h,codec:C,container:f.container,levelCodec:f.levelCodec,id:f.id},w++}catch(s){R.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+s.message),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:s,mimeType:b})}}w&&this.hls.trigger(I.Events.BUFFER_CREATED,{tracks:this.tracks})},v._onSBUpdateStart=function(o){var u=this.operationQueue,l=u.current(o);l.onStart()},v._onSBUpdateEnd=function(o){var u=this.operationQueue,l=u.current(o);l.onComplete(),u.shiftAndExecuteNext(o)},v._onSBUpdateError=function(o,u){R.logger.error("[buffer-controller]: "+o+" SourceBuffer error",u),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var l=this.operationQueue.current(o);l&&l.onError(u)},v.removeExecutor=function(o,u,l){var w=this.media,p=this.mediaSource,f=this.operationQueue,C=this.sourceBuffer,b=C[o];if(!w||!p||!b){R.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),f.shiftAndExecuteNext(o);return}var h=Object(z.isFiniteNumber)(w.duration)?w.duration:Infinity,c=Object(z.isFiniteNumber)(p.duration)?p.duration:Infinity,s=Math.max(0,u),a=Math.min(l,h,c);a>s?(R.logger.log("[buffer-controller]: Removing ["+s+","+a+"] from the "+o+" SourceBuffer"),console.assert(!b.updating,o+" sourceBuffer must not be updating"),b.remove(s,a)):f.shiftAndExecuteNext(o)},v.appendExecutor=function(o,u){var l=this.operationQueue,w=this.sourceBuffer,p=w[u];if(!p){R.logger.warn("[buffer-controller]: Attempting to append to the "+u+" SourceBuffer, but it does not exist"),l.shiftAndExecuteNext(u);return}p.ended=!1,console.assert(!p.updating,u+" sourceBuffer must not be updating"),p.appendBuffer(o)},v.blockBuffers=function(o,u){var l=this;if(u===void 0&&(u=this.getSourceBufferTypes()),!u.length){R.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var w=this.operationQueue,p=u.map(function(f){return w.appendBlocker(f)});Promise.all(p).then(function(){o(),u.forEach(function(f){var C=l.sourceBuffer[f];(!C||!C.updating)&&w.shiftAndExecuteNext(f)})})},v.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},v.addBufferListener=function(o,u,l){var w=this.sourceBuffer[o];if(!w)return;var p=l.bind(this,o);this.listeners[o].push({event:u,listener:p}),w.addEventListener(u,p)},v.removeBufferListeners=function(o){var u=this.sourceBuffer[o];if(!u)return;this.listeners[o].forEach(function(l){u.removeEventListener(l.event,l.listener)})},x}()},"./src/controller/buffer-operation-queue.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"default",function(){return I});var z=L("./src/utils/logger.ts"),I=function(){function R(U){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=U}var B=R.prototype;return B.append=function(k,A){var y=this.queues[A];y.push(k),y.length===1&&this.buffers[A]&&this.executeNext(A)},B.insertAbort=function(k,A){var y=this.queues[A];y.unshift(k),this.executeNext(A)},B.appendBlocker=function(k){var A,y=new Promise(function(O){A=O}),S={execute:A,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(S,k),y},B.executeNext=function(k){var A=this.buffers,y=this.queues,S=A[k],O=y[k];if(O.length){var _=O[0];try{_.execute()}catch(x){z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),_.onError(x),(!S||!S.updating)&&(O.shift(),this.executeNext(k))}}},B.shiftAndExecuteNext=function(k){this.queues[k].shift(),this.executeNext(k)},B.current=function(k){return this.queues[k][0]},R}()},"./src/controller/cap-level-controller.ts":function(re,G,L){"use strict";L.r(G);var z=L("./src/events.ts");function I(U,k){for(var A=0;A<k.length;A++){var y=k[A];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(U,y.key,y)}}function R(U,k,A){return k&&I(U.prototype,k),A&&I(U,A),U}var B=function(){function U(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 k=U.prototype;return k.setStreamController=function(y){this.streamController=y},k.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},k.registerListeners=function(){var y=this.hls;y.on(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.on(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.unregisterListener=function(){var y=this.hls;y.off(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.off(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.onFpsDropLevelCapping=function(y,S){U.isLevelAllowed(S.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(S.droppedLevel)},k.onMediaAttaching=function(y,S){this.media=S.media instanceof HTMLVideoElement?S.media:null},k.onManifestParsed=function(y,S){var O=this.hls;this.restrictedLevels=[],this.firstLevel=S.firstLevel,O.config.capLevelToPlayerSize&&S.video&&this.startCapping()},k.onBufferCodecs=function(y,S){var O=this.hls;O.config.capLevelToPlayerSize&&S.video&&this.startCapping()},k.onMediaDetaching=function(){this.stopCapping()},k.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var y=this.hls.levels;if(y.length){var S=this.hls;S.autoLevelCapping=this.getMaxLevel(y.length-1),S.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=S.autoLevelCapping}}},k.getMaxLevel=function(y){var S=this,O=this.hls.levels;if(!O.length)return-1;var _=O.filter(function(x,v){return U.isLevelAllowed(v,S.restrictedLevels)&&v<=y});return this.clientRect=null,U.getMaxLevelByMediaSize(_,this.mediaWidth,this.mediaHeight)},k.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},k.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},k.getDimensions=function(){if(this.clientRect)return this.clientRect;var y=this.media,S={width:0,height:0};if(y){var O=y.getBoundingClientRect();S.width=O.width,S.height=O.height,!S.width&&!S.height&&(S.width=O.right-O.left||y.width||0,S.height=O.bottom-O.top||y.height||0)}return this.clientRect=S,S},U.isLevelAllowed=function(y,S){return S===void 0&&(S=[]),S.indexOf(y)===-1},U.getMaxLevelByMediaSize=function(y,S,O){if(!y||!y.length)return-1;for(var _=function(u,l){return l?u.width!==l.width||u.height!==l.height:!0},x=y.length-1,v=0;v<y.length;v+=1){var d=y[v];if((d.width>=S||d.height>=O)&&_(d,y[v+1])){x=v;break}}return x},R(U,[{key:"mediaWidth",get:function(){return this.getDimensions().width*U.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*U.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var y=1;try{y=self.devicePixelRatio}catch(S){}return y}}]),U}();G.default=B},"./src/controller/cmcd-controller.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"default",function(){return _});var z=L("./src/events.ts"),I=L("./src/types/cmcd.ts"),R=L("./src/utils/buffer-helper.ts"),B=L("./src/utils/logger.ts");function U(x,v){for(var d=0;d<v.length;d++){var o=v[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(x,o.key,o)}}function k(x,v,d){return v&&U(x.prototype,v),d&&U(x,d),x}function A(x,v){var d=typeof Symbol!="undefined"&&x[Symbol.iterator]||x["@@iterator"];if(d)return(d=d.call(x)).next.bind(d);if(Array.isArray(x)||(d=y(x))||v&&x&&typeof x.length=="number"){d&&(x=d);var o=0;return function(){return o>=x.length?{done:!0}:{done:!1,value:x[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y(x,v){if(!x)return;if(typeof x=="string")return S(x,v);var d=Object.prototype.toString.call(x).slice(8,-1);if(d==="Object"&&x.constructor&&(d=x.constructor.name),d==="Map"||d==="Set")return Array.from(x);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return S(x,v)}function S(x,v){(v==null||v>x.length)&&(v=x.length);for(var d=0,o=new Array(v);d<v;d++)o[d]=x[d];return o}function O(){return O=Object.assign||function(x){for(var v=1;v<arguments.length;v++){var d=arguments[v];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(x[o]=d[o])}return x},O.apply(this,arguments)}var _=function(){function x(d){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(w){try{o.apply(w,{ot:I.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(p){B.logger.warn("Could not generate manifest CMCD data.",p)}},this.applyFragmentData=function(w){try{var p=w.frag,f=o.hls.levels[p.level],C=o.getObjectType(p),b={d:p.duration*1e3,ot:C};(C===I.CMCDObjectType.VIDEO||C===I.CMCDObjectType.AUDIO||C==I.CMCDObjectType.MUXED)&&(b.br=f.bitrate/1e3,b.tb=o.getTopBandwidth(C),b.bl=o.getBufferLength(C)),o.apply(w,b)}catch(h){B.logger.warn("Could not generate segment CMCD data.",h)}},this.hls=d;var u=this.config=d.config,l=u.cmcd;l!=null&&(u.pLoader=this.createPlaylistLoader(),u.fLoader=this.createFragmentLoader(),this.sid=l.sessionId||x.uuid(),this.cid=l.contentId,this.useHeaders=l.useHeaders===!0,this.registerListeners())}var v=x.prototype;return v.registerListeners=function(){var o=this.hls;o.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(z.Events.BUFFER_CREATED,this.onBufferCreated,this)},v.unregisterListeners=function(){var o=this.hls;o.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(z.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},v.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},v.onMediaAttached=function(o,u){this.media=u.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},v.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},v.onBufferCreated=function(o,u){var l,w;this.audioBuffer=(l=u.tracks.audio)===null||l===void 0?void 0:l.buffer,this.videoBuffer=(w=u.tracks.video)===null||w===void 0?void 0:w.buffer},v.createData=function(){var o;return{v:I.CMCDVersion,sf:I.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},v.apply=function(o,u){u===void 0&&(u={}),O(u,this.createData());var l=u.ot===I.CMCDObjectType.INIT||u.ot===I.CMCDObjectType.VIDEO||u.ot===I.CMCDObjectType.MUXED;if(this.starved&&l&&(u.bs=!0,u.su=!0,this.starved=!1),u.su==null&&(u.su=this.buffering),this.useHeaders){var w=x.toHeaders(u);if(!Object.keys(w).length)return;o.headers||(o.headers={}),O(o.headers,w)}else{var p=x.toQuery(u);if(!p)return;o.url=x.appendQueryToUri(o.url,p)}},v.getObjectType=function(o){var u=o.type;return u==="subtitle"?I.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?I.CMCDObjectType.INIT:u==="audio"?I.CMCDObjectType.AUDIO:u==="main"?this.hls.audioTracks.length?I.CMCDObjectType.VIDEO:I.CMCDObjectType.MUXED:void 0},v.getTopBandwidth=function(o){for(var u=0,l=o===I.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,w=A(l),p;!(p=w()).done;){var f=p.value;f.bitrate>u&&(u=f.bitrate)}return u>0?u:NaN},v.getBufferLength=function(o){var u=this.hls.media,l=o===I.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!l||!u)return NaN;var w=R.BufferHelper.bufferInfo(l,u.currentTime,this.config.maxBufferHole);return w.len*1e3},v.createPlaylistLoader=function(){var o=this.config.pLoader,u=this.applyPlaylistData,l=o||this.config.loader;return function(){function w(f){this.loader=void 0,this.loader=new l(f)}var p=w.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(C,b,h){u(C),this.loader.load(C,b,h)},k(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},v.createFragmentLoader=function(){var o=this.config.fLoader,u=this.applyFragmentData,l=o||this.config.loader;return function(){function w(f){this.loader=void 0,this.loader=new l(f)}var p=w.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(C,b,h){u(C),this.loader.load(C,b,h)},k(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},x.uuid=function(){var o=URL.createObjectURL(new Blob),u=o.toString();return URL.revokeObjectURL(o),u.substr(u.lastIndexOf("/")+1)},x.serialize=function(o){for(var u=[],l=function(F){return!Number.isNaN(F)&&F!=null&&F!==""&&F!==!1},w=function(F){return Math.round(F)},p=function(F){return w(F/100)*100},f=function(F){return encodeURIComponent(F)},C={br:w,d:w,bl:p,dl:p,mtp:p,nor:f,rtp:p,tb:w},b=Object.keys(o||{}).sort(),h=A(b),c;!(c=h()).done;){var s=c.value,a=o[s];if(!l(a))continue;if(s==="v"&&a===1)continue;if(s=="pr"&&a===1)continue;var g=C[s];g&&(a=g(a));var m=typeof a,E=void 0;s==="ot"||s==="sf"||s==="st"?E=s+"="+a:m==="boolean"?E=s:m==="number"?E=s+"="+a:E=s+"="+JSON.stringify(a),u.push(E)}return u.join(",")},x.toHeaders=function(o){for(var u=Object.keys(o),l={},w=["Object","Request","Session","Status"],p=[{},{},{},{}],f={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},C=0,b=u;C<b.length;C++){var h=b[C],c=f[h]!=null?f[h]:1;p[c][h]=o[h]}for(var s=0;s<p.length;s++){var a=x.serialize(p[s]);a&&(l["CMCD-"+w[s]]=a)}return l},x.toQuery=function(o){return"CMCD="+encodeURIComponent(x.serialize(o))},x.appendQueryToUri=function(o,u){if(!u)return o;var l=o.includes("?")?"&":"?";return""+o+l+u},x}()},"./src/controller/eme-controller.ts":function(re,G,L){"use strict";L.r(G);var z=L("./src/events.ts"),I=L("./src/errors.ts"),R=L("./src/utils/logger.ts"),B=L("./src/utils/mediakeys-helper.ts");function U(_,x){for(var v=0;v<x.length;v++){var d=x[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(_,d.key,d)}}function k(_,x,v){return x&&U(_.prototype,x),v&&U(_,v),_}var A=3,y=function(x,v,d){var o={audioCapabilities:[],videoCapabilities:[]};return x.forEach(function(u){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+u+'"',robustness:d.audioRobustness||""})}),v.forEach(function(u){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+u+'"',robustness:d.videoRobustness||""})}),[o]},S=function(x,v,d,o){switch(x){case B.KeySystems.WIDEVINE:return y(v,d,o);default:throw new Error("Unknown key-system: "+x)}},O=function(){function _(v){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=v,this._config=v.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 x=_.prototype;return x.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},x._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)},x._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)},x.getLicenseServerUrl=function(d){switch(d){case B.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},x._attemptKeySystemAccess=function(d,o,u){var l=this,w=S(d,o,u,this._drmSystemOptions);R.logger.log("Requesting encrypted media key-system access");var p=this.requestMediaKeySystemAccess(d,w);this.mediaKeysPromise=p.then(function(f){return l._onMediaKeySystemAccessObtained(d,f)}),p.catch(function(f){R.logger.error('Failed to obtain key-system "'+d+'" access:',f)})},x._onMediaKeySystemAccessObtained=function(d,o){var u=this;R.logger.log('Access for key-system "'+d+'" obtained');var l={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:d};this._mediaKeysList.push(l);var w=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(p){return l.mediaKeys=p,R.logger.log('Media-keys created for key-system "'+d+'"'),u._onMediaKeysCreated(),p});return w.catch(function(p){R.logger.error("Failed to create media-keys:",p)}),w},x._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),d._onNewMediaKeySession(o.mediaKeysSession))})},x._onNewMediaKeySession=function(d){var o=this;R.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(u){o._onKeySessionMessage(d,u.message)},!1)},x._onKeySessionMessage=function(d,o){R.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(u){R.logger.log("Received license data (length: "+(u&&u.byteLength)+"), updating key-session"),d.update(u)})},x.onMediaEncrypted=function(d){var o=this;if(R.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var u=function(w){if(!o._media)return;o._attemptSetMediaKeys(w),o._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(u).catch(u)},x._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}R.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},x._generateRequestWithPreferredKeySession=function(d,o){var u=this,l=this._mediaKeysList[0];if(!l){R.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(l.mediaKeysSessionInitialized){R.logger.warn("Key-Session already initialized but requested again");return}var w=l.mediaKeysSession;if(!w){R.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){R.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}R.logger.log('Generating key-session request for "'+d+'" init data type'),l.mediaKeysSessionInitialized=!0,w.generateRequest(d,o).then(function(){R.logger.debug("Key-session generation succeeded")}).catch(function(p){R.logger.error("Error generating key-session request:",p),u.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},x._createLicenseXhr=function(d,o,u){var l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,l,d,o,u);var w=this._licenseXhrSetup;if(w)try{w.call(this.hls,l,d),w=void 0}catch(p){R.logger.error(p)}try{l.readyState||l.open("POST",d,!0),w&&w.call(this.hls,l,d)}catch(p){throw new Error("issue setting up KeySystem license XHR "+p)}return l},x._onLicenseRequestReadyStageChange=function(d,o,u,l){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,R.logger.log("License request succeeded");var w=d.response,p=this._licenseResponseCallback;if(p)try{w=p.call(this.hls,d,o)}catch(C){R.logger.error(C)}l(w)}else{if(R.logger.error("License Request XHR failed ("+o+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>A){this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var f=A-this._requestLicenseFailureCount+1;R.logger.warn("Retrying license request, "+f+" attempts left"),this._requestLicense(u,l)}break}},x._generateLicenseRequestChallenge=function(d,o){switch(d.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},x._requestLicense=function(d,o){R.logger.log("Requesting content license for key-system");var u=this._mediaKeysList[0];if(!u){R.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var l=this.getLicenseServerUrl(u.mediaKeySystemDomain),w=this._createLicenseXhr(l,d,o);R.logger.log("Sending license request to URL: "+l);var p=this._generateLicenseRequestChallenge(u,d);w.send(p)}catch(f){R.logger.error("Failure requesting DRM license: "+f),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},x.onMediaAttached=function(d,o){if(!this._emeEnabled)return;var u=o.media;this._media=u,u.addEventListener("encrypted",this._onMediaEncrypted)},x.onMediaDetached=function(){var d=this._media,o=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(u){if(u.mediaKeysSession)return u.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},x.onManifestParsed=function(d,o){if(!this._emeEnabled)return;var u=o.levels.map(function(w){return w.audioCodec}).filter(function(w){return!!w}),l=o.levels.map(function(w){return w.videoCodec}).filter(function(w){return!!w});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,u,l)},k(_,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),_}();G.default=O},"./src/controller/fps-controller.ts":function(re,G,L){"use strict";L.r(G);var z=L("./src/events.ts"),I=L("./src/utils/logger.ts"),R=function(){function B(k){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=k,this.registerListeners()}var U=B.prototype;return U.setStreamController=function(A){this.streamController=A},U.registerListeners=function(){this.hls.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},U.unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},U.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},U.onMediaAttaching=function(A,y){var S=this.hls.config;if(S.capLevelOnFPSDrop){var O=y.media instanceof self.HTMLVideoElement?y.media:null;this.media=O,O&&typeof O.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),S.fpsDroppedMonitoringPeriod)}},U.checkFPS=function(A,y,S){var O=performance.now();if(y){if(this.lastTime){var _=O-this.lastTime,x=S-this.lastDroppedFrames,v=y-this.lastDecodedFrames,d=1e3*x/_,o=this.hls;if(o.trigger(z.Events.FPS_DROP,{currentDropped:x,currentDecoded:v,totalDroppedFrames:S}),d>0&&x>o.config.fpsDroppedMonitoringThreshold*v){var u=o.currentLevel;I.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=u)&&(u=u-1,o.trigger(z.Events.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:o.currentLevel}),o.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=O,this.lastDroppedFrames=S,this.lastDecodedFrames=y}},U.checkFPSInterval=function(){var A=this.media;if(A)if(this.isVideoPlaybackQualityAvailable){var y=A.getVideoPlaybackQuality();this.checkFPS(A,y.totalVideoFrames,y.droppedVideoFrames)}else this.checkFPS(A,A.webkitDecodedFrameCount,A.webkitDroppedFrameCount)},B}();G.default=R},"./src/controller/fragment-finders.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"findFragmentByPDT",function(){return R}),L.d(G,"findFragmentByPTS",function(){return B}),L.d(G,"fragmentWithinToleranceTest",function(){return U}),L.d(G,"pdtWithinToleranceTest",function(){return k}),L.d(G,"findFragWithCC",function(){return A});var z=L("./src/polyfills/number.ts"),I=L("./src/utils/binary-search.ts");function R(y,S,O){if(S===null||!Array.isArray(y)||!y.length||!Object(z.isFiniteNumber)(S))return null;var _=y[0].programDateTime;if(S<(_||0))return null;var x=y[y.length-1].endProgramDateTime;if(S>=(x||0))return null;O=O||0;for(var v=0;v<y.length;++v){var d=y[v];if(k(S,O,d))return d}return null}function B(y,S,O,_){O===void 0&&(O=0),_===void 0&&(_=0);var x=null;if(y?x=S[y.sn-S[0].sn+1]||null:O===0&&S[0].start===0&&(x=S[0]),x&&U(O,_,x)===0)return x;var v=I.default.search(S,U.bind(null,O,_));return v||x}function U(y,S,O){y===void 0&&(y=0),S===void 0&&(S=0);var _=Math.min(S,O.duration+(O.deltaPTS?O.deltaPTS:0));return O.start+O.duration-_<=y?1:O.start-_>y&&O.start?-1:0}function k(y,S,O){var _=Math.min(S,O.duration+(O.deltaPTS?O.deltaPTS:0))*1e3,x=O.endProgramDateTime||0;return x-_>y}function A(y,S){return I.default.search(y,function(O){return O.cc<S?1:O.cc>S?-1:0})}},"./src/controller/fragment-tracker.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"FragmentState",function(){return R}),L.d(G,"FragmentTracker",function(){return B});var z=L("./src/events.ts"),I=L("./src/types/loader.ts"),R;(function(A){A.NOT_LOADED="NOT_LOADED",A.BACKTRACKED="BACKTRACKED",A.APPENDING="APPENDING",A.PARTIAL="PARTIAL",A.OK="OK"})(R||(R={}));var B=function(){function A(S){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=S,this._registerListeners()}var y=A.prototype;return y._registerListeners=function(){var O=this.hls;O.on(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.on(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.on(z.Events.FRAG_LOADED,this.onFragLoaded,this)},y._unregisterListeners=function(){var O=this.hls;O.off(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.off(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.off(z.Events.FRAG_LOADED,this.onFragLoaded,this)},y.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},y.getAppendedFrag=function(O,_){if(_===I.PlaylistLevelType.MAIN){var x=this.activeFragment,v=this.activeParts;if(!x)return null;if(v)for(var d=v.length;d--;){var o=v[d],u=o?o.end:x.appendedPTS;if(o.start<=O&&u!==void 0&&O<=u)return d>9&&(this.activeParts=v.slice(d-9)),o}else if(x.start<=O&&x.appendedPTS!==void 0&&O<=x.appendedPTS)return x}return this.getBufferedFrag(O,_)},y.getBufferedFrag=function(O,_){for(var x=this.fragments,v=Object.keys(x),d=v.length;d--;){var o=x[v[d]];if((o==null?void 0:o.body.type)===_&&o.buffered){var u=o.body;if(u.start<=O&&O<=u.end)return u}}return null},y.detectEvictedFragments=function(O,_,x){var v=this;Object.keys(this.fragments).forEach(function(d){var o=v.fragments[d];if(!o)return;if(!o.buffered){o.body.type===x&&v.removeFragment(o.body);return}var u=o.range[O];if(!u)return;u.time.some(function(l){var w=!v.isTimeBuffered(l.startPTS,l.endPTS,_);return w&&v.removeFragment(o.body),w})})},y.detectPartialFragments=function(O){var _=this,x=this.timeRanges,v=O.frag,d=O.part;if(!x||v.sn==="initSegment")return;var o=k(v),u=this.fragments[o];if(!u)return;Object.keys(x).forEach(function(l){var w=v.elementaryStreams[l];if(!w)return;var p=x[l],f=d!==null||w.partial===!0;u.range[l]=_.getBufferedTimes(v,d,f,p)}),u.backtrack=u.loaded=null,Object.keys(u.range).length?u.buffered=!0:this.removeFragment(u.body)},y.fragBuffered=function(O){var _=k(O),x=this.fragments[_];x&&(x.backtrack=x.loaded=null,x.buffered=!0)},y.getBufferedTimes=function(O,_,x,v){for(var d={time:[],partial:x},o=_?_.start:O.start,u=_?_.end:O.end,l=O.minEndPTS||u,w=O.maxStartPTS||o,p=0;p<v.length;p++){var f=v.start(p)-this.bufferPadding,C=v.end(p)+this.bufferPadding;if(w>=f&&l<=C){d.time.push({startPTS:Math.max(o,v.start(p)),endPTS:Math.min(u,v.end(p))});break}else if(o<C&&u>f)d.partial=!0,d.time.push({startPTS:Math.max(o,v.start(p)),endPTS:Math.min(u,v.end(p))});else if(u<=f)break}return d},y.getPartialFragment=function(O){var _=null,x,v,d,o=0,u=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach(function(w){var p=l[w];if(!p)return;U(p)&&(v=p.body.start-u,d=p.body.end+u,O>=v&&O<=d&&(x=Math.min(O-v,d-O),o<=x&&(_=p.body,o=x)))}),_},y.getState=function(O){var _=k(O),x=this.fragments[_];return x?x.buffered?U(x)?R.PARTIAL:R.OK:x.backtrack?R.BACKTRACKED:R.APPENDING:R.NOT_LOADED},y.backtrack=function(O,_){var x=k(O),v=this.fragments[x];if(!v||v.backtrack)return null;var d=v.backtrack=_||v.loaded;return v.loaded=null,d},y.getBacktrackData=function(O){var _=k(O),x=this.fragments[_];if(x){var v,d=x.backtrack;if(d!=null&&(v=d.payload)!==null&&v!==void 0&&v.byteLength)return d;this.removeFragment(O)}return null},y.isTimeBuffered=function(O,_,x){for(var v,d,o=0;o<x.length;o++){if(v=x.start(o)-this.bufferPadding,d=x.end(o)+this.bufferPadding,O>=v&&_<=d)return!0;if(_<=v)return!1}return!1},y.onFragLoaded=function(O,_){var x=_.frag,v=_.part;if(x.sn==="initSegment"||x.bitrateTest||v)return;var d=k(x);this.fragments[d]={body:x,loaded:_,backtrack:null,buffered:!1,range:Object.create(null)}},y.onBufferAppended=function(O,_){var x=this,v=_.frag,d=_.part,o=_.timeRanges;if(v.type===I.PlaylistLevelType.MAIN)if(this.activeFragment=v,d){var u=this.activeParts;u||(this.activeParts=u=[]),u.push(d)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(l){var w=o[l];if(x.detectEvictedFragments(l,w),!d)for(var p=0;p<w.length;p++)v.appendedPTS=Math.max(w.end(p),v.appendedPTS||0)})},y.onFragBuffered=function(O,_){this.detectPartialFragments(_)},y.hasFragment=function(O){var _=k(O);return!!this.fragments[_]},y.removeFragmentsInRange=function(O,_,x){var v=this;Object.keys(this.fragments).forEach(function(d){var o=v.fragments[d];if(!o)return;if(o.buffered){var u=o.body;u.type===x&&u.start<_&&u.end>O&&v.removeFragment(u)}})},y.removeFragment=function(O){var _=k(O);O.stats.loaded=0,O.clearElementaryStreamInfo(),delete this.fragments[_]},y.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},A}();function U(A){var y,S;return A.buffered&&(((y=A.range.video)===null||y===void 0?void 0:y.partial)||((S=A.range.audio)===null||S===void 0?void 0:S.partial))}function k(A){return A.type+"_"+A.level+"_"+A.urlId+"_"+A.sn}},"./src/controller/gap-controller.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"STALL_MINIMUM_DURATION_MS",function(){return U}),L.d(G,"MAX_START_GAP_JUMP",function(){return k}),L.d(G,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return A}),L.d(G,"SKIP_BUFFER_RANGE_START",function(){return y}),L.d(G,"default",function(){return S});var z=L("./src/utils/buffer-helper.ts"),I=L("./src/errors.ts"),R=L("./src/events.ts"),B=L("./src/utils/logger.ts"),U=250,k=2,A=.1,y=.05,S=function(){function O(x,v,d,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=x,this.media=v,this.fragmentTracker=d,this.hls=o}var _=O.prototype;return _.destroy=function(){this.hls=this.fragmentTracker=this.media=null},_.poll=function(v){var d=this.config,o=this.media,u=this.stalled,l=o.currentTime,w=o.seeking,p=this.seeking&&!w,f=!this.seeking&&w;if(this.seeking=w,l!==v){if(this.moved=!0,u!==null){if(this.stallReported){var C=self.performance.now()-u;B.logger.warn("playback not stuck anymore @"+l+", after "+Math.round(C)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((f||p)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!z.BufferHelper.getBuffered(o).length)return;var b=z.BufferHelper.bufferInfo(o,l,0),h=b.len>0,c=b.nextStart||0;if(!h&&!c)return;if(w){var s=b.len>k,a=!c||c-l>k&&!this.fragmentTracker.getPartialFragment(l);if(s||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var g,m=Math.max(c,b.start||0)-l,E=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,M=E==null||((g=E.details)===null||g===void 0)?void 0:g.live,F=M?E.details.targetduration*2:k;if(m>0&&m<=F){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(u===null){this.stalled=j;return}var W=j-u;!w&&W>=U&&this._reportStall(b.len);var D=z.BufferHelper.bufferInfo(o,l,d.maxBufferHole);this._tryFixBufferStall(D,W)},_._tryFixBufferStall=function(v,d){var o=this.config,u=this.fragmentTracker,l=this.media,w=l.currentTime,p=u.getPartialFragment(w);if(p){var f=this._trySkipBufferHole(p);if(f)return}v.len>o.maxBufferHole&&d>o.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},_._reportStall=function(v){var d=this.hls,o=this.media,u=this.stallReported;u||(this.stallReported=!0,B.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+v+")"),d.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:v}))},_._trySkipBufferHole=function(v){for(var d=this.config,o=this.hls,u=this.media,l=u.currentTime,w=0,p=z.BufferHelper.getBuffered(u),f=0;f<p.length;f++){var C=p.start(f);if(l+d.maxBufferHole>=w&&l<C){var b=Math.max(C+y,u.currentTime+A);return B.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+b),this.moved=!0,this.stalled=null,u.currentTime=b,v&&o.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+l+" to "+b,frag:v}),b}w=p.end(f)}return 0},_._tryNudgeBuffer=function(){var v=this.config,d=this.hls,o=this.media,u=o.currentTime,l=(this.nudgeRetry||0)+1;if(this.nudgeRetry=l,l<v.nudgeMaxRetry){var w=u+l*v.nudgeOffset;B.logger.warn("Nudging 'currentTime' from "+u+" to "+w),o.currentTime=w,d.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else B.logger.error("Playhead still not moving while enough data buffered @"+u+" after "+v.nudgeMaxRetry+" nudges"),d.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},O}()},"./src/controller/id3-track-controller.ts":function(re,G,L){"use strict";L.r(G);var z=L("./src/events.ts"),I=L("./src/utils/texttrack-utils.ts"),R=L("./src/demux/id3.ts"),B=.25,U=function(){function k(y){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=y,this._registerListeners()}var A=k.prototype;return A.destroy=function(){this._unregisterListeners()},A._registerListeners=function(){var S=this.hls;S.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.on(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),S.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},A._unregisterListeners=function(){var S=this.hls;S.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.off(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),S.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},A.onMediaAttached=function(S,O){this.media=O.media},A.onMediaDetaching=function(){if(!this.id3Track)return;Object(I.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},A.getID3Track=function(S){if(!this.media)return;for(var O=0;O<S.length;O++){var _=S[O];if(_.kind==="metadata"&&_.label==="id3")return Object(I.sendAddTrackEvent)(_,this.media),_}return this.media.addTextTrack("metadata","id3")},A.onFragParsingMetadata=function(S,O){if(!this.media)return;var _=O.frag,x=O.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var v=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<x.length;d++){var o=R.getID3Frames(x[d].data);if(o){var u=x[d].pts,l=d<x.length-1?x[d+1].pts:_.end,w=l-u;w<=0&&(l=u+B);for(var p=0;p<o.length;p++){var f=o[p];if(!R.isTimeStampFrame(f)){var C=new v(u,l,"");C.value=f,this.id3Track.addCue(C)}}}}},A.onBufferFlushing=function(S,O){var _=O.startOffset,x=O.endOffset,v=O.type;if(!v||v==="audio"){var d=this.id3Track;d&&Object(I.removeCuesInRange)(d,_,x)}},k}();G.default=U},"./src/controller/latency-controller.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"default",function(){return k});var z=L("./src/errors.ts"),I=L("./src/events.ts"),R=L("./src/utils/logger.ts");function B(A,y){for(var S=0;S<y.length;S++){var O=y[S];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(A,O.key,O)}}function U(A,y,S){return y&&B(A.prototype,y),S&&B(A,S),A}var k=function(){function A(S){var O=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 O.timeupdate()},this.hls=S,this.config=S.config,this.registerListeners()}var y=A.prototype;return y.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},y.registerListeners=function(){this.hls.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(I.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){this.hls.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(I.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(I.Events.ERROR,this.onError)},y.onMediaAttached=function(O,_){this.media=_.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},y.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},y.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},y.onLevelUpdated=function(O,_){var x=_.details;this.levelDetails=x,x.advanced&&this.timeupdate(),!x.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},y.onError=function(O,_){if(_.details!==z.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,R.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},y.timeupdate=function(){var O=this.media,_=this.levelDetails;if(!O||!_)return;this.currentTime=O.currentTime;var x=this.computeLatency();if(x===null)return;this._latency=x;var v=this.config,d=v.lowLatencyMode,o=v.maxLiveSyncPlaybackRate;if(!d||o===1)return;var u=this.targetLatency;if(u===null)return;var l=x-u,w=Math.min(this.maxLatency,u+_.targetduration),p=l<w;if(_.live&&p&&l>.05&&this.forwardBufferLength>1){var f=Math.min(2,Math.max(1,o)),C=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20;O.playbackRate=Math.min(f,Math.max(1,C))}else O.playbackRate!==1&&O.playbackRate!==0&&(O.playbackRate=1)},y.estimateLiveEdge=function(){var O=this.levelDetails;return O===null?null:O.edge+O.age},y.computeLatency=function(){var O=this.estimateLiveEdge();return O===null?null:O-this.currentTime},U(A,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var O=this.config,_=this.levelDetails;return O.liveMaxLatencyDuration!==void 0?O.liveMaxLatencyDuration:_?O.liveMaxLatencyDurationCount*_.targetduration:0}},{key:"targetLatency",get:function(){var O=this.levelDetails;if(O===null)return null;var _=O.holdBack,x=O.partHoldBack,v=O.targetduration,d=this.config,o=d.liveSyncDuration,u=d.liveSyncDurationCount,l=d.lowLatencyMode,w=this.hls.userConfig,p=l&&x||_;(w.liveSyncDuration||w.liveSyncDurationCount||p===0)&&(p=o!==void 0?o:u*v);var f=v,C=1;return p+Math.min(this.stallCount*C,f)}},{key:"liveSyncPosition",get:function(){var O=this.estimateLiveEdge(),_=this.targetLatency,x=this.levelDetails;if(O===null||_===null||x===null)return null;var v=x.edge,d=O-_-this.edgeStalled,o=v-x.totalduration,u=v-(this.config.lowLatencyMode&&x.partTarget||x.targetduration);return Math.min(Math.max(o,d),u)}},{key:"drift",get:function(){var O=this.levelDetails;return O===null?1:O.drift}},{key:"edgeStalled",get:function(){var O=this.levelDetails;if(O===null)return 0;var _=(this.config.lowLatencyMode&&O.partTarget||O.targetduration)*3;return Math.max(O.age-_,0)}},{key:"forwardBufferLength",get:function(){var O=this.media,_=this.levelDetails;if(!O||!_)return 0;var x=O.buffered.length;return x?O.buffered.end(x-1):_.edge-this.currentTime}}]),A}()},"./src/controller/level-controller.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"default",function(){return d});var z=L("./src/types/level.ts"),I=L("./src/events.ts"),R=L("./src/errors.ts"),B=L("./src/utils/codecs.ts"),U=L("./src/controller/level-helper.ts"),k=L("./src/controller/base-playlist-controller.ts"),A=L("./src/types/loader.ts");function y(){return y=Object.assign||function(o){for(var u=1;u<arguments.length;u++){var l=arguments[u];for(var w in l)Object.prototype.hasOwnProperty.call(l,w)&&(o[w]=l[w])}return o},y.apply(this,arguments)}function S(o,u){for(var l=0;l<u.length;l++){var w=u[l];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function O(o,u,l){return u&&S(o.prototype,u),l&&S(o,l),o}function _(o,u){o.prototype=Object.create(u.prototype),o.prototype.constructor=o,x(o,u)}function x(o,u){return x=Object.setPrototypeOf||function(w,p){return w.__proto__=p,w},x(o,u)}var v=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(o){_(u,o);function u(w){var p;return p=o.call(this,w,"[level-controller]")||this,p._levels=[],p._firstLevel=-1,p._startLevel=void 0,p.currentLevelIndex=-1,p.manualLevelIndex=-1,p.onParsedComplete=void 0,p._registerListeners(),p}var l=u.prototype;return l._registerListeners=function(){var p=this.hls;p.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),p.on(I.Events.ERROR,this.onError,this)},l._unregisterListeners=function(){var p=this.hls;p.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),p.off(I.Events.ERROR,this.onError,this)},l.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},l.startLoad=function(){var p=this._levels;p.forEach(function(f){f.loadError=0}),o.prototype.startLoad.call(this)},l.onManifestLoaded=function(p,f){var C=[],b=[],h=[],c,s={},a,g=!1,m=!1,E=!1;if(f.levels.forEach(function(W){var D=W.attrs;g=g||!!(W.width&&W.height),m=m||!!W.videoCodec,E=E||!!W.audioCodec,v&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var P=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;a=s[P],a?a.url.push(W.url):(a=new z.Level(W),s[P]=a,C.push(a)),D&&(D.AUDIO&&Object(U.addGroupId)(a,"audio",D.AUDIO),D.SUBTITLES&&Object(U.addGroupId)(a,"text",D.SUBTITLES))}),(g||m)&&E&&(C=C.filter(function(W){var D=W.videoCodec,P=W.width,H=W.height;return!!D||!!(P&&H)})),C=C.filter(function(W){var D=W.audioCodec,P=W.videoCodec;return(!D||Object(B.isCodecSupportedInMp4)(D,"audio"))&&(!P||Object(B.isCodecSupportedInMp4)(P,"video"))}),f.audioTracks&&(b=f.audioTracks.filter(function(W){return!W.audioCodec||Object(B.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(U.assignTrackIdsByGroup)(b)),f.subtitles&&(h=f.subtitles,Object(U.assignTrackIdsByGroup)(h)),C.length>0){c=C[0].bitrate,C.sort(function(W,D){return W.bitrate-D.bitrate}),this._levels=C;for(var M=0;M<C.length;M++)if(C[M].bitrate===c){this._firstLevel=M,this.log("manifest loaded, "+C.length+" level(s) found, first bitrate: "+c);break}var F=E&&!m,j={levels:C,audioTracks:b,subtitleTracks:h,firstLevel:this._firstLevel,stats:f.stats,audio:E,video:m,altAudio:!F&&b.some(function(W){return!!W.url})};this.hls.trigger(I.Events.MANIFEST_PARSED,j),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:f.url,reason:"no level with compatible codecs found in manifest"})},l.onError=function(p,f){if(o.prototype.onError.call(this,p,f),f.fatal)return;var C=f.context,b=this._levels[this.currentLevelIndex];if(C&&(C.type===A.PlaylistContextType.AUDIO_TRACK&&b.audioGroupIds&&C.groupId===b.audioGroupIds[b.urlId]||C.type===A.PlaylistContextType.SUBTITLE_TRACK&&b.textGroupIds&&C.groupId===b.textGroupIds[b.urlId])){this.redundantFailover(this.currentLevelIndex);return}var h=!1,c=!0,s;switch(f.details){case R.ErrorDetails.FRAG_LOAD_ERROR:case R.ErrorDetails.FRAG_LOAD_TIMEOUT:case R.ErrorDetails.KEY_LOAD_ERROR:case R.ErrorDetails.KEY_LOAD_TIMEOUT:if(f.frag){var a=this._levels[f.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(s=f.frag.level)):s=f.frag.level}break;case R.ErrorDetails.LEVEL_LOAD_ERROR:case R.ErrorDetails.LEVEL_LOAD_TIMEOUT:C&&(C.deliveryDirectives&&(c=!1),s=C.level),h=!0;break;case R.ErrorDetails.REMUX_ALLOC_ERROR:s=f.level,h=!0;break}s!==void 0&&this.recoverLevel(f,s,h,c)},l.recoverLevel=function(p,f,C,b){var h=p.details,c=this._levels[f];if(c.loadError++,C){var s=this.retryLoadingOrFail(p);if(s)p.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(b){var a=c.url.length;if(a>1&&c.loadError<a)p.levelRetry=!0,this.redundantFailover(f);else if(this.manualLevelIndex===-1){var g=f===0?this._levels.length-1:f-1;this.currentLevelIndex!==g&&this._levels[g].loadError===0&&(this.warn(h+": switch to "+g),p.levelRetry=!0,this.hls.nextAutoLevel=g)}}},l.redundantFailover=function(p){var f=this._levels[p],C=f.url.length;if(C>1){var b=(f.urlId+1)%C;this.warn("Switching to redundant URL-id "+b),this._levels.forEach(function(h){h.urlId=b}),this.level=p}},l.onFragLoaded=function(p,f){var C=f.frag;if(C!==void 0&&C.type===A.PlaylistLevelType.MAIN){var b=this._levels[C.level];b!==void 0&&(b.fragmentError=0,b.loadError=0)}},l.onLevelLoaded=function(p,f){var C,b=f.level,h=f.details,c=this._levels[b];if(!c){var s;this.warn("Invalid level index "+b),(s=f.deliveryDirectives)!==null&&s!==void 0&&s.skip&&(h.deltaUpdateFailed=!0);return}b===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(b,f,c.details)):(C=f.deliveryDirectives)!==null&&C!==void 0&&C.skip&&(h.deltaUpdateFailed=!0)},l.onAudioTrackSwitched=function(p,f){var C=this.hls.levels[this.currentLevelIndex];if(!C)return;if(C.audioGroupIds){for(var b=-1,h=this.hls.audioTracks[f.id].groupId,c=0;c<C.audioGroupIds.length;c++)if(C.audioGroupIds[c]===h){b=c;break}b!==C.urlId&&(C.urlId=b,this.startLoad())}},l.loadPlaylist=function(p){var f=this.currentLevelIndex,C=this._levels[f];if(this.canLoad&&C&&C.url.length>0){var b=C.urlId,h=C.url[b];if(p)try{h=p.addDirectives(h)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+f+(p?" at sn "+p.msn+" part "+p.part:"")+" with URL-id "+b+" "+h),this.clearTimer(),this.hls.trigger(I.Events.LEVEL_LOADING,{url:h,level:f,id:b,deliveryDirectives:p||null})}},l.removeLevel=function(p,f){var C=function(c,s){return s!==f},b=this._levels.filter(function(h,c){return c!==p?!0:h.url.length>1&&f!==void 0?(h.url=h.url.filter(C),h.audioGroupIds&&(h.audioGroupIds=h.audioGroupIds.filter(C)),h.textGroupIds&&(h.textGroupIds=h.textGroupIds.filter(C)),h.urlId=0,!0):!1}).map(function(h,c){var s=h.details;return s!=null&&s.fragments&&s.fragments.forEach(function(a){a.level=c}),h});this._levels=b,this.hls.trigger(I.Events.LEVELS_UPDATED,{levels:b})},O(u,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(p){var f,C=this._levels;if(C.length===0)return;if(this.currentLevelIndex===p&&(f=C[p])!==null&&f!==void 0&&f.details)return;if(p<0||p>=C.length){var b=p<0;if(this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.LEVEL_SWITCH_ERROR,level:p,fatal:b,reason:"invalid level idx"}),b)return;p=Math.min(p,C.length-1)}this.clearTimer();var h=this.currentLevelIndex,c=C[h],s=C[p];this.log("switching to level "+p+" from "+h),this.currentLevelIndex=p;var a=y({},s,{level:p,maxBitrate:s.maxBitrate,uri:s.uri,urlId:s.urlId});delete a._urlId,this.hls.trigger(I.Events.LEVEL_SWITCHING,a);var g=s.details;if(!g||g.live){var m=this.switchParams(s.uri,c==null?void 0:c.details);this.loadPlaylist(m)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(p){this.manualLevelIndex=p,this._startLevel===void 0&&(this._startLevel=p),p!==-1&&(this.level=p)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(p){this._firstLevel=p}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var p=this.hls.config.startLevel;return p!==void 0?p:this._firstLevel}else return this._startLevel},set:function(p){this._startLevel=p}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(p){this.level=p,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=p)}}]),u}(k.default)},"./src/controller/level-helper.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"addGroupId",function(){return R}),L.d(G,"assignTrackIdsByGroup",function(){return B}),L.d(G,"updatePTS",function(){return U}),L.d(G,"updateFragPTSDTS",function(){return A}),L.d(G,"mergeDetails",function(){return y}),L.d(G,"mapPartIntersection",function(){return S}),L.d(G,"mapFragmentIntersection",function(){return O}),L.d(G,"adjustSliding",function(){return _}),L.d(G,"addSliding",function(){return x}),L.d(G,"computeReloadInterval",function(){return v}),L.d(G,"getFragmentWithSN",function(){return d}),L.d(G,"getPartWith",function(){return o});var z=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts");function R(u,l,w){switch(l){case"audio":u.audioGroupIds||(u.audioGroupIds=[]),u.audioGroupIds.push(w);break;case"text":u.textGroupIds||(u.textGroupIds=[]),u.textGroupIds.push(w);break}}function B(u){var l={};u.forEach(function(w){var p=w.groupId||"";w.id=l[p]=l[p]||0,l[p]++})}function U(u,l,w){var p=u[l],f=u[w];k(p,f)}function k(u,l){var w=l.startPTS;if(Object(z.isFiniteNumber)(w)){var p=0,f;l.sn>u.sn?(p=w-u.start,f=u):(p=u.start-w,f=l),f.duration!==p&&(f.duration=p)}else if(l.sn>u.sn){var C=u.cc===l.cc;C&&u.minEndPTS?l.start=u.start+(u.minEndPTS-u.start):l.start=u.start+u.duration}else l.start=Math.max(u.start-l.duration,0)}function A(u,l,w,p,f,C){var b=p-w;b<=0&&(I.logger.warn("Fragment should have a positive duration",l),p=w+l.duration,C=f+l.duration);var h=w,c=p,s=l.startPTS,a=l.endPTS;if(Object(z.isFiniteNumber)(s)){var g=Math.abs(s-w);Object(z.isFiniteNumber)(l.deltaPTS)?l.deltaPTS=Math.max(g,l.deltaPTS):l.deltaPTS=g,h=Math.max(w,s),w=Math.min(w,s),f=Math.min(f,l.startDTS),c=Math.min(p,a),p=Math.max(p,a),C=Math.max(C,l.endDTS)}l.duration=p-w;var m=w-l.start;l.appendedPTS=p,l.start=l.startPTS=w,l.maxStartPTS=h,l.startDTS=f,l.endPTS=p,l.minEndPTS=c,l.endDTS=C;var E=l.sn;if(!u||E<u.startSN||E>u.endSN)return 0;var M,F=E-u.startSN,j=u.fragments;for(j[F]=l,M=F;M>0;M--)k(j[M],j[M-1]);for(M=F;M<j.length-1;M++)k(j[M],j[M+1]);return u.fragmentHint&&k(j[j.length-1],u.fragmentHint),u.PTSKnown=u.alignedSliding=!0,m}function y(u,l){for(var w=null,p=u.fragments,f=p.length-1;f>=0;f--){var C=p[f].initSegment;if(C){w=C;break}}u.fragmentHint&&delete u.fragmentHint.endPTS;var b=0,h;if(O(u,l,function(M,F){M.relurl&&(b=M.cc-F.cc),Object(z.isFiniteNumber)(M.startPTS)&&Object(z.isFiniteNumber)(M.endPTS)&&(F.start=F.startPTS=M.startPTS,F.startDTS=M.startDTS,F.appendedPTS=M.appendedPTS,F.maxStartPTS=M.maxStartPTS,F.endPTS=M.endPTS,F.endDTS=M.endDTS,F.minEndPTS=M.minEndPTS,F.duration=M.endPTS-M.startPTS,F.duration&&(h=F),l.PTSKnown=l.alignedSliding=!0),F.elementaryStreams=M.elementaryStreams,F.loader=M.loader,F.stats=M.stats,F.urlId=M.urlId,M.initSegment&&(F.initSegment=M.initSegment,w=M.initSegment)}),w){var c=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments;c.forEach(function(M){var F;(!M.initSegment||M.initSegment.relurl===((F=w)===null||F===void 0?void 0:F.relurl))&&(M.initSegment=w)})}if(l.skippedSegments&&(l.deltaUpdateFailed=l.fragments.some(function(M){return!M}),l.deltaUpdateFailed)){I.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var s=l.skippedSegments;s--;)l.fragments.shift();l.startSN=l.fragments[0].sn,l.startCC=l.fragments[0].cc}var a=l.fragments;if(b){I.logger.warn("discontinuity sliding from playlist, take drift into account");for(var g=0;g<a.length;g++)a[g].cc+=b}l.skippedSegments&&(l.startCC=l.fragments[0].cc),S(u.partList,l.partList,function(M,F){F.elementaryStreams=M.elementaryStreams,F.stats=M.stats}),h?A(l,h,h.startPTS,h.endPTS,h.startDTS,h.endDTS):_(u,l),a.length&&(l.totalduration=l.edge-a[0].start),l.driftStartTime=u.driftStartTime,l.driftStart=u.driftStart;var m=l.advancedDateTime;if(l.advanced&&m){var E=l.edge;l.driftStart||(l.driftStartTime=m,l.driftStart=E),l.driftEndTime=m,l.driftEnd=E}else l.driftEndTime=u.driftEndTime,l.driftEnd=u.driftEnd,l.advancedDateTime=u.advancedDateTime}function S(u,l,w){if(u&&l)for(var p=0,f=0,C=u.length;f<=C;f++){var b=u[f],h=l[f+p];b&&h&&b.index===h.index&&b.fragment.sn===h.fragment.sn?w(b,h):p--}}function O(u,l,w){for(var p=l.skippedSegments,f=Math.max(u.startSN,l.startSN)-l.startSN,C=(u.fragmentHint?1:0)+(p?l.endSN:Math.min(u.endSN,l.endSN))-l.startSN,b=l.startSN-u.startSN,h=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,c=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,s=f;s<=C;s++){var a=c[b+s],g=h[s];p&&!g&&s<p&&(g=l.fragments[s]=a),a&&g&&w(a,g)}}function _(u,l){var w=l.startSN+l.skippedSegments-u.startSN,p=u.fragments;if(w<0||w>=p.length)return;x(l,p[w].start)}function x(u,l){if(l){for(var w=u.fragments,p=u.skippedSegments;p<w.length;p++)w[p].start+=l;u.fragmentHint&&(u.fragmentHint.start+=l)}}function v(u,l){var w=1e3*u.levelTargetDuration,p=w/2,f=u.age,C=f>0&&f<w*3,b=l.loading.end-l.loading.start,h,c=u.availabilityDelay;if(u.updated===!1)if(C){var s=333*u.misses;h=Math.max(Math.min(p,b*2),s),u.availabilityDelay=(u.availabilityDelay||0)+h}else h=p;else C?(c=Math.min(c||w/2,f),u.availabilityDelay=c,h=c+w-f):h=w-b;return Math.round(h)}function d(u,l,w){if(!u||!u.details)return null;var p=u.details,f=p.fragments[l-p.startSN];return f||(f=p.fragmentHint,f&&f.sn===l?f:l<p.startSN&&w&&w.sn===l?w:null)}function o(u,l,w){if(!u||!u.details)return null;var p=u.details.partList;if(p)for(var f=p.length;f--;){var C=p[f];if(C.index===w&&C.fragment.sn===l)return C}return null}},"./src/controller/stream-controller.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"default",function(){return p});var z=L("./src/polyfills/number.ts"),I=L("./src/controller/base-stream-controller.ts"),R=L("./src/is-supported.ts"),B=L("./src/events.ts"),U=L("./src/utils/buffer-helper.ts"),k=L("./src/controller/fragment-tracker.ts"),A=L("./src/types/loader.ts"),y=L("./src/loader/fragment.ts"),S=L("./src/demux/transmuxer-interface.ts"),O=L("./src/types/transmuxer.ts"),_=L("./src/controller/gap-controller.ts"),x=L("./src/errors.ts"),v=L("./src/utils/logger.ts");function d(f,C){for(var b=0;b<C.length;b++){var h=C[b];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(f,h.key,h)}}function o(f,C,b){return C&&d(f.prototype,C),b&&d(f,b),f}function u(f,C){f.prototype=Object.create(C.prototype),f.prototype.constructor=f,l(f,C)}function l(f,C){return l=Object.setPrototypeOf||function(h,c){return h.__proto__=c,h},l(f,C)}var w=100,p=function(f){u(C,f);function C(h,c){var s;return s=f.call(this,h,c,"[stream-controller]")||this,s.audioCodecSwap=!1,s.gapController=null,s.level=-1,s._forceStartLoad=!1,s.altAudio=!1,s.audioOnly=!1,s.fragPlaying=null,s.onvplaying=null,s.onvseeked=null,s.fragLastKbps=0,s.stalled=!1,s.couldBacktrack=!1,s.audioCodecSwitch=!1,s.videoBuffer=null,s._registerListeners(),s}var b=C.prototype;return b._registerListeners=function(){var c=this.hls;c.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(B.Events.ERROR,this.onError,this),c.on(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(B.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var c=this.hls;c.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(B.Events.ERROR,this.onError,this),c.off(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(B.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(c){if(this.levels){var s=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(w),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var g=a.startLevel;g===-1&&(a.config.testBandwidth?(g=0,this.bitrateTest=!0):g=a.nextAutoLevel),this.level=a.nextLoadLevel=g,this.loadedmetadata=!1}s>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+s.toFixed(3)),c=s),this.state=I.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=I.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,f.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_LEVEL:{var c,s=this.levels,a=this.level,g=s==null||((c=s[a])===null||c===void 0)?void 0:c.details;if(g&&(!g.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(g))break;this.state=I.State.IDLE;break}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var m,E=self.performance.now(),M=this.retryDate;(!M||E>=M||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=I.State.IDLE)}break;default:break}this.onTickEnd()},b.onTickEnd=function(){f.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var c,s,a=this.hls,g=this.levelLastLoaded,m=this.levels,E=this.media,M=a.config,F=a.nextLoadLevel;if(g===null||!E&&(this.startFragRequested||!M.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[F])return;var j=m[F];this.level=a.nextLoadLevel=F;var W=j.details;if(!W||this.state===I.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==F){this.state=I.State.WAITING_LEVEL;return}var D=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:E,A.PlaylistLevelType.MAIN);if(D===null)return;var P=D.len,H=this.getMaxBufferLength(j.maxBitrate);if(P>=H)return;if(this._streamEnded(D,W)){var Y={};this.altAudio&&(Y.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,Y),this.state=I.State.ENDED;return}var ee=D.end,oe=this.getNextFragment(ee,W);if(this.couldBacktrack&&!this.fragPrevious&&oe&&oe.sn!=="initSegment"){var Te=oe.sn-W.startSN;Te>1&&(oe=W.fragments[Te-1],this.fragmentTracker.removeFragment(oe))}if(oe&&this.fragmentTracker.getState(oe)===k.FragmentState.OK&&this.nextLoadPosition>ee){var ye=this.audioOnly&&!this.altAudio?y.ElementaryStreamTypes.AUDIO:y.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(E,ye,A.PlaylistLevelType.MAIN),oe=this.getNextFragment(this.nextLoadPosition,W)}if(!oe)return;oe.initSegment&&!oe.initSegment.data&&!this.bitrateTest&&(oe=oe.initSegment),((c=oe.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((s=oe.decryptdata)!==null&&s!==void 0&&s.key)?this.loadKey(oe,W):this.loadFragment(oe,W,ee)},b.loadFragment=function(c,s,a){var g,m=this.fragmentTracker.getState(c);if(this.fragCurrent=c,m===k.FragmentState.BACKTRACKED){var E=this.fragmentTracker.getBacktrackData(c);if(E){this._handleFragmentLoadProgress(E),this._handleFragmentLoadComplete(E);return}else m=k.FragmentState.NOT_LOADED}m===k.FragmentState.NOT_LOADED||m===k.FragmentState.PARTIAL?c.sn==="initSegment"?this._loadInitSegment(c):this.bitrateTest?(c.bitrateTest=!0,this.log("Fragment "+c.sn+" of level "+c.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(c)):(this.startFragRequested=!0,f.prototype.loadFragment.call(this,c,s,a)):m===k.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((g=this.media)===null||g===void 0?void 0:g.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(c){var s=this.fragmentTracker.getAppendedFrag(c,A.PlaylistLevelType.MAIN);return s&&"fragment"in s?s.fragment:s},b.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,A.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var c=this.levels,s=this.media;if(s!=null&&s.readyState){var a,g=this.getAppendedFrag(s.currentTime);if(g&&g.start>1&&this.flushMainBuffer(0,g.start-1),!s.paused&&c){var m=this.hls.nextLoadLevel,E=c[m],M=this.fragLastKbps;M&&this.fragCurrent?a=this.fragCurrent.duration*E.maxBitrate/(1e3*M)+1:a=0}else a=0;var F=this.getBufferedFrag(s.currentTime+a);if(F){var j=this.followingBufferedFrag(F);if(j){this.abortCurrentFrag();var W=j.maxStartPTS?j.maxStartPTS:j.start,D=j.duration,P=Math.max(F.end,W+Math.min(Math.max(D-this.config.maxFragLookUpTolerance,D*.5),D*.75));this.flushMainBuffer(P,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===I.State.KEY_LOADING&&(this.state=I.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(c,s){f.prototype.flushMainBuffer.call(this,c,s,this.altAudio?"video":null)},b.onMediaAttached=function(c,s){f.prototype.onMediaAttached.call(this,c,s);var a=s.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new _.default(this.config,a,this.fragmentTracker,this.hls)},b.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),f.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var c=this.media,s=c?c.currentTime:null;Object(z.isFiniteNumber)(s)&&this.log("Media seeked to "+s.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(B.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},b.onManifestParsed=function(c,s){var a=!1,g=!1,m;s.levels.forEach(function(E){m=E.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(a=!0),m.indexOf("mp4a.40.5")!==-1&&(g=!0))}),this.audioCodecSwitch=a&&g&&!Object(R.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=s.levels,this.startFragRequested=!1},b.onLevelLoading=function(c,s){var a=this.levels;if(!a||this.state!==I.State.IDLE)return;var g=a[s.level];(!g.details||g.details.live&&this.levelLastLoaded!==s.level||this.waitForCdnTuneIn(g.details))&&(this.state=I.State.WAITING_LEVEL)},b.onLevelLoaded=function(c,s){var a,g=this.levels,m=s.level,E=s.details,M=E.totalduration;if(!g){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+E.startSN+","+E.endSN+"], cc ["+E.startCC+", "+E.endCC+"] duration:"+M);var F=this.fragCurrent;F&&(this.state===I.State.FRAG_LOADING||this.state===I.State.FRAG_LOADING_WAITING_RETRY)&&(F.level!==s.level&&F.loader&&(this.state=I.State.IDLE,F.loader.abort()));var j=g[m],W=0;if(E.live||(a=j.details)!==null&&a!==void 0&&a.live){if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed)return;W=this.alignPlaylists(E,j.details)}if(j.details=E,this.levelLastLoaded=m,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:E,level:m}),this.state===I.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(E))return;this.state=I.State.IDLE}this.startFragRequested?E.live&&this.synchronizeToLiveEdge(E):this.setStartPosition(E,W),this.tick()},b._handleFragmentLoadProgress=function(c){var s,a=c.frag,g=c.part,m=c.payload,E=this.levels;if(!E){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var M=E[a.level],F=M.details;if(!F){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var j=M.videoCodec,W=F.PTSKnown||!F.live,D=(s=a.initSegment)===null||s===void 0?void 0:s.data,P=this._getAudioCodec(M),H=this.transmuxer=this.transmuxer||new S.default(this.hls,A.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Y=g?g.index:-1,ee=Y!==-1,oe=new O.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,m.byteLength,Y,ee),Te=this.initPTS[a.cc];H.push(m,D,P,j,a,g,F.totalduration,W,oe,Te)},b.onAudioTrackSwitching=function(c,s){var a=this.altAudio,g=!!s.url,m=s.id;if(!g){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var E=this.fragCurrent;E!=null&&E.loader&&(this.log("Switching to main audio track, cancel main fragment load"),E.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var M=this.hls;a&&M.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),M.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:m})}},b.onAudioTrackSwitched=function(c,s){var a=s.id,g=!!this.hls.audioTracks[a].url;if(g){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=g,this.tick()},b.onBufferCreated=function(c,s){var a=s.tracks,g,m,E=!1;for(var M in a){var F=a[M];if(F.id==="main"){if(m=M,g=F,M==="video"){var j=a[M];j&&(this.videoBuffer=j.buffer)}}else E=!0}E&&g?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=g.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(c,s){var a=s.frag,g=s.part;if(a&&a.type!==A.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(g?" p: "+g.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===I.State.PARSED&&(this.state=I.State.IDLE);return}var m=g?g.stats:a.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,g)},b.onError=function(c,s){switch(s.details){case x.ErrorDetails.FRAG_LOAD_ERROR:case x.ErrorDetails.FRAG_LOAD_TIMEOUT:case x.ErrorDetails.KEY_LOAD_ERROR:case x.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(A.PlaylistLevelType.MAIN,s);break;case x.ErrorDetails.LEVEL_LOAD_ERROR:case x.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==I.State.ERROR&&(s.fatal?(this.warn(""+s.details),this.state=I.State.ERROR):!s.levelRetry&&this.state===I.State.WAITING_LEVEL&&(this.state=I.State.IDLE));break;case x.ErrorDetails.BUFFER_FULL_ERROR:if(s.parent==="main"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var a=!0,g=this.getFwdBufferInfo(this.media,A.PlaylistLevelType.MAIN);g&&g.len>.5&&(a=!this.reduceMaxBufferLength(g.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},b.checkBuffer=function(){var c=this.media,s=this.gapController;if(!c||!s||!c.readyState)return;var a=U.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):s.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},b.onFragLoadEmergencyAborted=function(){this.state=I.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(c,s){var a=s.type;if(a!==y.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var g=(a===y.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(g,a,A.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(c,s){this.levels=s.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var c=this.media,s=c.currentTime,a=this.startPosition;if(a>=0&&s<a){if(c.seeking){v.logger.log("could not seek to "+a+", already seeking at "+s);return}var g=U.BufferHelper.getBuffered(c),m=g.length?g.start(0):0,E=m-a;E>0&&(E<this.config.maxBufferHole||E<this.config.maxFragLookUpTolerance)&&(v.logger.log("adjusting start position by "+E+" to match buffer start"),a+=E,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+s),c.currentTime=a}},b._getAudioCodec=function(c){var s=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&s&&(this.log("Swapping audio codec"),s.indexOf("mp4a.40.5")!==-1?s="mp4a.40.2":s="mp4a.40.5"),s},b._loadBitrateTestFrag=function(c){var s=this;this._doFragLoad(c).then(function(a){var g=s.hls;if(!a||g.nextLoadLevel||s.fragContextChanged(c))return;s.fragLoadError=0,s.state=I.State.IDLE,s.startFragRequested=!1,s.bitrateTest=!1;var m=c.stats;m.parsing.start=m.parsing.end=m.buffering.start=m.buffering.end=self.performance.now(),g.trigger(B.Events.FRAG_LOADED,a)})},b._handleTransmuxComplete=function(c){var s,a="main",g=this.hls,m=c.remuxResult,E=c.chunkMeta,M=this.getCurrentContext(E);if(!M){this.warn("The loading context changed while buffering fragment "+E.sn+" of level "+E.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(E.level);return}var F=M.frag,j=M.part,W=M.level,D=m.video,P=m.text,H=m.id3,Y=m.initSegment,ee=this.altAudio?void 0:m.audio;if(this.fragContextChanged(F))return;if(this.state=I.State.PARSING,Y){Y.tracks&&(this._bufferInitSegment(W,Y.tracks,F,E),g.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:a,tracks:Y.tracks}));var oe=Y.initPTS,Te=Y.timescale;Object(z.isFiniteNumber)(oe)&&(this.initPTS[F.cc]=oe,g.trigger(B.Events.INIT_PTS_FOUND,{frag:F,id:a,initPTS:oe,timescale:Te}))}if(D&&m.independent!==!1){if(W.details){var ye=D.startPTS,he=D.endPTS,le=D.startDTS,me=D.endDTS;if(j)j.elementaryStreams[D.type]={startPTS:ye,endPTS:he,startDTS:le,endDTS:me};else if(D.firstKeyFrame&&D.independent&&(this.couldBacktrack=!0),D.dropped&&D.independent){var ie=this.getLoadPosition()+this.config.maxBufferHole;if(ie<ye){this.backtrack(F);return}F.setElementaryStreamInfo(D.type,F.start,he,F.start,me,!0)}F.setElementaryStreamInfo(D.type,ye,he,le,me),this.bufferFragmentData(D,F,j,E)}}else if(m.independent===!1){this.backtrack(F);return}if(ee){var pe=ee.startPTS,J=ee.endPTS,ne=ee.startDTS,q=ee.endDTS;j&&(j.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:pe,endPTS:J,startDTS:ne,endDTS:q}),F.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,pe,J,ne,q),this.bufferFragmentData(ee,F,j,E)}if(H!=null&&(s=H.samples)!==null&&s!==void 0&&s.length){var xe={frag:F,id:a,samples:H.samples};g.trigger(B.Events.FRAG_PARSING_METADATA,xe)}if(P){var Ce={frag:F,id:a,samples:P.samples};g.trigger(B.Events.FRAG_PARSING_USERDATA,Ce)}},b._bufferInitSegment=function(c,s,a,g){var m=this;if(this.state!==I.State.PARSING)return;this.audioOnly=!!s.audio&&!s.video,this.altAudio&&!this.audioOnly&&delete s.audio;var E=s.audio,M=s.video,F=s.audiovideo;if(E){var j=c.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),E.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(j="mp4a.40.5")),W.indexOf("android")!==-1&&E.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),c.audioCodec&&c.audioCodec!==j&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+j+'"'),E.levelCodec=j,E.id="main",this.log("Init audio buffer, container:"+E.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(c.audioCodec||"")+"/"+E.codec+"]")}M&&(M.levelCodec=c.videoCodec,M.id="main",this.log("Init video buffer, container:"+M.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+M.codec+"]")),F&&this.log("Init audiovideo buffer, container:"+F.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+F.codec+"]"),this.hls.trigger(B.Events.BUFFER_CODECS,s),Object.keys(s).forEach(function(D){var P=s[D],H=P.initSegment;H!=null&&H.byteLength&&m.hls.trigger(B.Events.BUFFER_APPENDING,{type:D,data:H,frag:a,part:null,chunkMeta:g,parent:a.type})}),this.tick()},b.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var s=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,s?this.resetFragmentLoading(c):this.state=I.State.BACKTRACKING},b.checkFragmentChanged=function(){var c=this.media,s=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(U.BufferHelper.isBuffered(c,a)?s=this.getAppendedFrag(a):U.BufferHelper.isBuffered(c,a+.1)&&(s=this.getAppendedFrag(a+.1)),s){var g=this.fragPlaying,m=s.level;(!g||s.sn!==g.sn||g.level!==m||s.urlId!==g.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:s}),(!g||g.level!==m)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=s)}}},o(C,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var s=this.getAppendedFrag(c.currentTime);if(s)return s.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var s=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(s)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),C}(I.default)},"./src/controller/subtitle-stream-controller.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"SubtitleStreamController",function(){return u});var z=L("./src/events.ts"),I=L("./src/utils/logger.ts"),R=L("./src/utils/buffer-helper.ts"),B=L("./src/controller/fragment-finders.ts"),U=L("./src/utils/discontinuities.ts"),k=L("./src/controller/level-helper.ts"),A=L("./src/controller/fragment-tracker.ts"),y=L("./src/controller/base-stream-controller.ts"),S=L("./src/types/loader.ts"),O=L("./src/types/level.ts");function _(l,w){for(var p=0;p<w.length;p++){var f=w[p];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(l,f.key,f)}}function x(l,w,p){return w&&_(l.prototype,w),p&&_(l,p),l}function v(l,w){l.prototype=Object.create(w.prototype),l.prototype.constructor=l,d(l,w)}function d(l,w){return d=Object.setPrototypeOf||function(f,C){return f.__proto__=C,f},d(l,w)}var o=500,u=function(l){v(w,l);function w(f,C){var b;return b=l.call(this,f,C,"[subtitle-stream-controller]")||this,b.levels=[],b.currentTrackId=-1,b.tracksBuffered=[],b.mainDetails=null,b._registerListeners(),b}var p=w.prototype;return p.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},p._registerListeners=function(){var C=this.hls;C.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),C.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),C.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),C.on(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),C.on(z.Events.ERROR,this.onError,this),C.on(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),C.on(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),C.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),C.on(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),C.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p._unregisterListeners=function(){var C=this.hls;C.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),C.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),C.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),C.off(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),C.off(z.Events.ERROR,this.onError,this),C.off(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),C.off(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),C.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),C.off(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),C.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p.startLoad=function(){this.stopLoad(),this.state=y.State.IDLE,this.setInterval(o),this.tick()},p.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},p.onLevelLoaded=function(C,b){this.mainDetails=b.details},p.onSubtitleFragProcessed=function(C,b){var h=b.frag,c=b.success;if(this.fragPrevious=h,this.state=y.State.IDLE,!c)return;var s=this.tracksBuffered[this.currentTrackId];if(!s)return;for(var a,g=h.start,m=0;m<s.length;m++)if(g>=s[m].start&&g<=s[m].end){a=s[m];break}var E=h.start+h.duration;a?a.end=E:(a={start:g,end:E},s.push(a)),this.fragmentTracker.fragBuffered(h)},p.onBufferFlushing=function(C,b){var h=b.startOffset,c=b.endOffset;if(h===0&&c!==Number.POSITIVE_INFINITY){var s=this.currentTrackId,a=this.levels;if(!a.length||!a[s]||!a[s].details)return;var g=a[s].details,m=g.targetduration,E=c-m;if(E<=0)return;b.endOffsetSubtitles=Math.max(0,E),this.tracksBuffered.forEach(function(M){for(var F=0;F<M.length;){if(M[F].end<=E){M.shift();continue}else if(M[F].start<E)M[F].start=E;else break;F++}}),this.fragmentTracker.removeFragmentsInRange(h,E,S.PlaylistLevelType.SUBTITLE)}},p.onError=function(C,b){var h,c=b.frag;if(!c||c.type!==S.PlaylistLevelType.SUBTITLE)return;(h=this.fragCurrent)!==null&&h!==void 0&&h.loader&&this.fragCurrent.loader.abort(),this.state=y.State.IDLE},p.onSubtitleTracksUpdated=function(C,b){var h=this,c=b.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(s){return new O.Level(s)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(s){h.tracksBuffered[s.id]=[]}),this.mediaBuffer=null},p.onSubtitleTrackSwitch=function(C,b){if(this.currentTrackId=b.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var h=this.levels[this.currentTrackId];h!=null&&h.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,h&&this.setInterval(o)},p.onSubtitleTrackLoaded=function(C,b){var h,c=b.details,s=b.id,a=this.currentTrackId,g=this.levels;if(!g.length)return;var m=g[a];if(s>=g.length||s!==a||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(h=m.details)!==null&&h!==void 0&&h.live){var E=this.mainDetails;if(c.deltaUpdateFailed||!E)return;var M=E.fragments[0];if(!m.details)c.hasProgramDateTime&&E.hasProgramDateTime?Object(U.alignMediaPlaylistByPDT)(c,E):M&&Object(k.addSliding)(c,M.start);else{var F=this.alignPlaylists(c,m.details);F===0&&M&&Object(k.addSliding)(c,M.start)}}if(m.details=c,this.levelLastLoaded=s,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===y.State.IDLE){var j=Object(B.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},p._handleFragmentLoadComplete=function(C){var b=C.frag,h=C.payload,c=b.decryptdata,s=this.hls;if(this.fragContextChanged(b))return;if(h&&h.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(h),c.key.buffer,c.iv.buffer).then(function(g){var m=performance.now();s.trigger(z.Events.FRAG_DECRYPTED,{frag:b,payload:g,stats:{tstart:a,tdecrypt:m}})})}},p.doTick=function(){if(!this.media){this.state=y.State.IDLE;return}if(this.state===y.State.IDLE){var C,b=this.currentTrackId,h=this.levels;if(!h.length||!h[b]||!h[b].details)return;var c=h[b].details,s=c.targetduration,a=this.config,g=this.media,m=R.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,g.currentTime-s,a.maxBufferHole),E=m.end,M=m.len,F=this.getMaxBufferLength()+s;if(M>F)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var j=c.fragments,W=j.length,D=c.edge,P,H=this.fragPrevious;if(E<D){var Y=a.maxFragLookUpTolerance;H&&c.hasProgramDateTime&&(P=Object(B.findFragmentByPDT)(j,H.endProgramDateTime,Y)),P||(P=Object(B.findFragmentByPTS)(H,j,E,Y),!P&&H&&H.start<j[0].start&&(P=j[0]))}else P=j[W-1];(C=P)!==null&&C!==void 0&&C.encrypted?(I.logger.log("Loading key for "+P.sn),this.state=y.State.KEY_LOADING,this.hls.trigger(z.Events.KEY_LOADING,{frag:P})):P&&this.fragmentTracker.getState(P)===A.FragmentState.NOT_LOADED&&this.loadFragment(P,c,E)}},p.loadFragment=function(C,b,h){this.fragCurrent=C,l.prototype.loadFragment.call(this,C,b,h)},x(w,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),w}(y.default)},"./src/controller/subtitle-track-controller.ts":function(re,G,L){"use strict";L.r(G);var z=L("./src/events.ts"),I=L("./src/utils/texttrack-utils.ts"),R=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function U(_,x){for(var v=0;v<x.length;v++){var d=x[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(_,d.key,d)}}function k(_,x,v){return x&&U(_.prototype,x),v&&U(_,v),_}function A(_,x){_.prototype=Object.create(x.prototype),_.prototype.constructor=_,y(_,x)}function y(_,x){return y=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},y(_,x)}var S=function(_){A(x,_);function x(d){var o;return o=_.call(this,d,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var v=x.prototype;return v.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,_.prototype.destroy.call(this)},v.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.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.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(z.Events.ERROR,this.onError,this)},v.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.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.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(z.Events.ERROR,this.onError,this)},v.onMediaAttached=function(o,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)},v.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},v.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=O(this.media.textTracks);o.forEach(function(u){Object(I.clearCurrentCues)(u)}),this.subtitleTrack=-1,this.media=null},v.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},v.onManifestParsed=function(o,u){this.tracks=u.subtitleTracks},v.onSubtitleTrackLoaded=function(o,u){var l=u.id,w=u.details,p=this.trackId,f=this.tracksInGroup[p];if(!f){this.warn("Invalid subtitle track id "+l);return}var C=f.details;f.details=u.details,this.log("subtitle track "+l+" loaded ["+w.startSN+"-"+w.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,u,C))},v.onLevelLoading=function(o,u){this.switchLevel(u.level)},v.onLevelSwitching=function(o,u){this.switchLevel(u.level)},v.switchLevel=function(o){var u=this.hls.levels[o];if(!(u!=null&&u.textGroupIds))return;var l=u.textGroupIds[u.urlId];if(this.groupId!==l){var w=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,p=this.tracks.filter(function(b){return!l||b.groupId===l});this.tracksInGroup=p;var f=this.findTrackId(w==null?void 0:w.name)||this.findTrackId();this.groupId=l;var C={subtitleTracks:p};this.log("Updating subtitle tracks, "+p.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(z.Events.SUBTITLE_TRACKS_UPDATED,C),f!==-1&&this.setSubtitleTrack(f,w)}},v.findTrackId=function(o){for(var u=this.tracksInGroup,l=0;l<u.length;l++){var w=u[l];if((!this.selectDefaultTrack||w.default)&&(!o||o===w.name))return w.id}return-1},v.onError=function(o,u){if(_.prototype.onError.call(this,o,u),u.fatal||!u.context)return;u.context.type===B.PlaylistContextType.SUBTITLE_TRACK&&u.context.id===this.trackId&&u.context.groupId===this.groupId&&this.retryLoadingOrFail(u)},v.loadPlaylist=function(o){var u=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(u)){var l=u.id,w=u.groupId,p=u.url;if(o)try{p=o.addDirectives(p)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Loading subtitle playlist for id "+l),this.hls.trigger(z.Events.SUBTITLE_TRACK_LOADING,{url:p,id:l,groupId:w,deliveryDirectives:o||null})}},v.toggleTrackModes=function(o){var u=this,l=this.media,w=this.subtitleDisplay,p=this.trackId;if(!l)return;var f=O(l.textTracks),C=f.filter(function(c){return c.groupId===u.groupId});if(o===-1)[].slice.call(f).forEach(function(c){c.mode="disabled"});else{var b=C[p];b&&(b.mode="disabled")}var h=C[o];h&&(h.mode=w?"showing":"hidden")},v.setSubtitleTrack=function(o,u){var l,w=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(l=w[o])!==null&&l!==void 0&&l.details)||o<-1||o>=w.length)return;this.clearTimer();var p=w[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,p){var f=p.id,C=p.groupId,b=C===void 0?"":C,h=p.name,c=p.type,s=p.url;this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:f,groupId:b,name:h,type:c,url:s});var a=this.switchParams(p.url,u==null?void 0:u.details);this.loadPlaylist(a)}else this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:o})},v.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,u=O(this.media.textTracks),l=0;l<u.length;l++)if(u[l].mode==="hidden")o=l;else if(u[l].mode==="showing"){o=l;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},k(x,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var u=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,u)}}]),x}(R.default);function O(_){for(var x=[],v=0;v<_.length;v++){var d=_[v];d.kind==="subtitles"&&d.label&&x.push(_[v])}return x}G.default=S},"./src/controller/timeline-controller.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"TimelineController",function(){return O});var z=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),R=L("./src/utils/cea-608-parser.ts"),B=L("./src/utils/output-filter.ts"),U=L("./src/utils/webvtt-parser.ts"),k=L("./src/utils/texttrack-utils.ts"),A=L("./src/utils/imsc1-ttml-parser.ts"),y=L("./src/types/loader.ts"),S=L("./src/utils/logger.ts"),O=function(){function d(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=v(),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 l=new B.default(this,"textTrack1"),w=new B.default(this,"textTrack2"),p=new B.default(this,"textTrack3"),f=new B.default(this,"textTrack4");this.cea608Parser1=new R.default(1,l,w),this.cea608Parser2=new R.default(3,p,f)}u.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.on(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.on(I.Events.FRAG_LOADING,this.onFragLoading,this),u.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.on(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.on(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=d.prototype;return o.destroy=function(){var l=this.hls;l.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.off(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.off(I.Events.FRAG_LOADING,this.onFragLoading,this),l.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.off(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.off(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(l,w,p,f,C){for(var b=!1,h=C.length;h--;){var c=C[h],s=x(c[0],c[1],w,p);if(s>=0&&(c[0]=Math.min(c[0],w),c[1]=Math.max(c[1],p),b=!0,s/(p-w)>.5))return}if(b||C.push([w,p]),this.config.renderTextTracksNatively){var a=this.captionsTracks[l];this.Cues.newCue(a,w,p,f)}else{var g=this.Cues.newCue(null,w,p,f);this.hls.trigger(I.Events.CUES_PARSED,{type:"captions",cues:g,track:l})}},o.onInitPtsFound=function(l,w){var p=this,f=w.frag,C=w.id,b=w.initPTS,h=w.timescale,c=this.unparsedVttFrags;C==="main"&&(this.initPTS[f.cc]=b,this.timescale[f.cc]=h),c.length&&(this.unparsedVttFrags=[],c.forEach(function(s){p.onFragLoaded(I.Events.FRAG_LOADED,s)}))},o.getExistingTrack=function(l){var w=this.media;if(w)for(var p=0;p<w.textTracks.length;p++){var f=w.textTracks[p];if(f[l])return f}return null},o.createCaptionsTrack=function(l){this.config.renderTextTracksNatively?this.createNativeTrack(l):this.createNonNativeTrack(l)},o.createNativeTrack=function(l){if(this.captionsTracks[l])return;var w=this.captionsProperties,p=this.captionsTracks,f=this.media,C=w[l],b=C.label,h=C.languageCode,c=this.getExistingTrack(l);if(c)p[l]=c,Object(k.clearCurrentCues)(p[l]),Object(k.sendAddTrackEvent)(p[l],f);else{var s=this.createTextTrack("captions",b,h);s&&(s[l]=!0,p[l]=s)}},o.createNonNativeTrack=function(l){if(this.nonNativeCaptionsTracks[l])return;var w=this.captionsProperties[l];if(!w)return;var p=w.label,f={_id:l,label:p,kind:"captions",default:w.media?!!w.media.default:!1,closedCaptions:w.media};this.nonNativeCaptionsTracks[l]=f,this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[f]})},o.createTextTrack=function(l,w,p){var f=this.media;return f?f.addTextTrack(l,w,p):void 0},o.onMediaAttaching=function(l,w){this.media=w.media,this._cleanTracks()},o.onMediaDetaching=function(){var l=this.captionsTracks;Object.keys(l).forEach(function(w){Object(k.clearCurrentCues)(l[w]),delete l[w]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=v(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var l=this.media;if(!l)return;var w=l.textTracks;if(w)for(var p=0;p<w.length;p++)Object(k.clearCurrentCues)(w[p])},o.onSubtitleTracksUpdated=function(l,w){var p=this;this.textTracks=[];var f=w.subtitleTracks||[],C=f.some(function(s){return s.textCodec===A.IMSC1_CODEC});if(this.config.enableWebVTT||C&&this.config.enableIMSC1){var b=this.tracks&&f&&this.tracks.length===f.length;if(this.tracks=f||[],this.config.renderTextTracksNatively){var h=this.media?this.media.textTracks:[];this.tracks.forEach(function(s,a){var g;if(a<h.length){for(var m=null,E=0;E<h.length;E++)if(_(h[E],s)){m=h[E];break}m&&(g=m)}g?Object(k.clearCurrentCues)(g):(g=p.createTextTrack("subtitles",s.name,s.lang),g&&(g.mode="disabled")),g&&(g.groupId=s.groupId,p.textTracks.push(g))})}else if(!b&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(s){return{label:s.name,kind:s.type.toLowerCase(),default:s.default,subtitleTrack:s}});this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(l,w){var p=this;this.config.enableCEA708Captions&&w.captions&&w.captions.forEach(function(f){var C=/(?:CC|SERVICE)([1-4])/.exec(f.instreamId);if(!C)return;var b="textTrack"+C[1],h=p.captionsProperties[b];if(!h)return;h.label=f.name,f.lang&&(h.languageCode=f.lang),h.media=f})},o.onFragLoading=function(l,w){var p=this.cea608Parser1,f=this.cea608Parser2,C=this.lastSn,b=this.lastPartIndex;if(!this.enabled||!(p&&f))return;if(w.frag.type===y.PlaylistLevelType.MAIN){var h,c,s=w.frag.sn,a=(h=w==null||((c=w.part)===null||c===void 0)?void 0:c.index)!=null?h:-1;s===C+1||s===C&&a===b+1||(p.reset(),f.reset()),this.lastSn=s,this.lastPartIndex=a}},o.onFragLoaded=function(l,w){var p=w.frag,f=w.payload,C=this.initPTS,b=this.unparsedVttFrags;if(p.type===y.PlaylistLevelType.SUBTITLE)if(f.byteLength){if(!Object(z.isFiniteNumber)(C[p.cc])){b.push(w),C.length&&this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Missing initial subtitle PTS")});return}var h=p.decryptdata;if(h==null||h.key==null||h.method!=="AES-128"){var c=this.tracks[p.level],s=this.vttCCs;s[p.cc]||(s[p.cc]={start:p.start,prevCC:this.prevCC,new:!0},this.prevCC=p.cc),c&&c.textCodec===A.IMSC1_CODEC?this._parseIMSC1(p,f):this._parseVTTs(p,f,s)}}else this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(l,w){var p=this,f=this.hls;Object(A.parseIMSC1)(w,this.initPTS[l.cc],this.timescale[l.cc],function(C){p._appendCues(C,l.level),f.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(C){S.logger.log("Failed to parse IMSC1: "+C),f.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:C})})},o._parseVTTs=function(l,w,p){var f=this,C=this.hls;Object(U.parseWebVTT)(w,this.initPTS[l.cc],this.timescale[l.cc],p,l.cc,l.start,function(b){f._appendCues(b,l.level),C.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(b){f._fallbackToIMSC1(l,w),S.logger.log("Failed to parse VTT cue: "+b),C.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:b})})},o._fallbackToIMSC1=function(l,w){var p=this,f=this.tracks[l.level];f.textCodec||Object(A.parseIMSC1)(w,this.initPTS[l.cc],this.timescale[l.cc],function(){f.textCodec=A.IMSC1_CODEC,p._parseIMSC1(l,w)},function(){f.textCodec="wvtt"})},o._appendCues=function(l,w){var p=this.hls;if(this.config.renderTextTracksNatively){var f=this.textTracks[w];if(f.mode==="disabled")return;l.forEach(function(h){return Object(k.addCueToTrack)(f,h)})}else{var C=this.tracks[w],b=C.default?"default":"subtitles"+w;p.trigger(I.Events.CUES_PARSED,{type:"subtitles",cues:l,track:b})}},o.onFragDecrypted=function(l,w){var p=w.frag;if(p.type===y.PlaylistLevelType.SUBTITLE){if(!Object(z.isFiniteNumber)(this.initPTS[p.cc])){this.unparsedVttFrags.push(w);return}this.onFragLoaded(I.Events.FRAG_LOADED,w)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(l,w){var p=this.cea608Parser1,f=this.cea608Parser2;if(!this.enabled||!(p&&f))return;for(var C=0;C<w.samples.length;C++){var b=w.samples[C].bytes;if(b){var h=this.extractCea608Data(b);p.addData(w.samples[C].pts,h[0]),f.addData(w.samples[C].pts,h[1])}}},o.onBufferFlushing=function(l,w){var p=w.startOffset,f=w.endOffset,C=w.endOffsetSubtitles,b=w.type,h=this.media;if(!h||h.currentTime<f)return;if(!b||b==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(k.removeCuesInRange)(c[a],p,f)})}if(this.config.renderTextTracksNatively&&(p===0&&C!==void 0)){var s=this.textTracks;Object.keys(s).forEach(function(a){return Object(k.removeCuesInRange)(s[a],p,C)})}},o.extractCea608Data=function(l){for(var w=l[0]&31,p=2,f=[[],[]],C=0;C<w;C++){var b=l[p++],h=127&l[p++],c=127&l[p++],s=(4&b)!==0,a=3&b;if(h===0&&c===0)continue;s&&((a===0||a===1)&&(f[a].push(h),f[a].push(c)))}return f},d}();function _(d,o){return d&&d.label===o.name&&!(d.textTrack1||d.textTrack2)}function x(d,o,u,l){return Math.min(o,l)-Math.max(d,u)}function v(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"default",function(){return z});var z=function(){function I(B,U){this.subtle=void 0,this.aesIV=void 0,this.subtle=B,this.aesIV=U}var R=I.prototype;return R.decrypt=function(U,k){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},k,U)},I}()},"./src/crypt/aes-decryptor.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"removePadding",function(){return I}),L.d(G,"default",function(){return R});var z=L("./src/utils/typed-array.ts");function I(B){var U=B.byteLength,k=U&&new DataView(B.buffer).getUint8(U-1);return k?Object(z.sliceUint8)(B,0,U-k):B}var R=function(){function B(){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 U=B.prototype;return U.uint8ArrayToUint32Array_=function(A){for(var y=new DataView(A),S=new Uint32Array(4),O=0;O<4;O++)S[O]=y.getUint32(O*4);return S},U.initTable=function(){var A=this.sBox,y=this.invSBox,S=this.subMix,O=S[0],_=S[1],x=S[2],v=S[3],d=this.invSubMix,o=d[0],u=d[1],l=d[2],w=d[3],p=new Uint32Array(256),f=0,C=0,b=0;for(b=0;b<256;b++)b<128?p[b]=b<<1:p[b]=b<<1^283;for(b=0;b<256;b++){var h=C^C<<1^C<<2^C<<3^C<<4;h=h>>>8^h&255^99,A[f]=h,y[h]=f;var c=p[f],s=p[c],a=p[s],g=p[h]*257^h*16843008;O[f]=g<<24|g>>>8,_[f]=g<<16|g>>>16,x[f]=g<<8|g>>>24,v[f]=g,g=a*16843009^s*65537^c*257^f*16843008,o[h]=g<<24|g>>>8,u[h]=g<<16|g>>>16,l[h]=g<<8|g>>>24,w[h]=g,f?(f=c^p[p[p[a^c]]],C^=p[p[C]]):f=C=1}},U.expandKey=function(A){for(var y=this.uint8ArrayToUint32Array_(A),S=!0,O=0;O<y.length&&S;)S=y[O]===this.key[O],O++;if(S)return;this.key=y;var _=this.keySize=y.length;if(_!==4&&_!==6&&_!==8)throw new Error("Invalid aes key size="+_);var x=this.ksRows=(_+6+1)*4,v,d,o=this.keySchedule=new Uint32Array(x),u=this.invKeySchedule=new Uint32Array(x),l=this.sBox,w=this.rcon,p=this.invSubMix,f=p[0],C=p[1],b=p[2],h=p[3],c,s;for(v=0;v<x;v++){if(v<_){c=o[v]=y[v];continue}s=c,v%_===0?(s=s<<8|s>>>24,s=l[s>>>24]<<24|l[s>>>16&255]<<16|l[s>>>8&255]<<8|l[s&255],s^=w[v/_|0]<<24):_>6&&v%_===4&&(s=l[s>>>24]<<24|l[s>>>16&255]<<16|l[s>>>8&255]<<8|l[s&255]),o[v]=c=(o[v-_]^s)>>>0}for(d=0;d<x;d++)v=x-d,d&3?s=o[v]:s=o[v-4],d<4||v<=4?u[d]=s:u[d]=f[l[s>>>24]]^C[l[s>>>16&255]]^b[l[s>>>8&255]]^h[l[s&255]],u[d]=u[d]>>>0},U.networkToHostOrderSwap=function(A){return A<<24|(A&65280)<<8|(A&16711680)>>8|A>>>24},U.decrypt=function(A,y,S){for(var O=this.keySize+6,_=this.invKeySchedule,x=this.invSBox,v=this.invSubMix,d=v[0],o=v[1],u=v[2],l=v[3],w=this.uint8ArrayToUint32Array_(S),p=w[0],f=w[1],C=w[2],b=w[3],h=new Int32Array(A),c=new Int32Array(h.length),s,a,g,m,E,M,F,j,W,D,P,H,Y,ee,oe=this.networkToHostOrderSwap;y<h.length;){for(W=oe(h[y]),D=oe(h[y+1]),P=oe(h[y+2]),H=oe(h[y+3]),E=W^_[0],M=H^_[1],F=P^_[2],j=D^_[3],Y=4,ee=1;ee<O;ee++)s=d[E>>>24]^o[M>>16&255]^u[F>>8&255]^l[j&255]^_[Y],a=d[M>>>24]^o[F>>16&255]^u[j>>8&255]^l[E&255]^_[Y+1],g=d[F>>>24]^o[j>>16&255]^u[E>>8&255]^l[M&255]^_[Y+2],m=d[j>>>24]^o[E>>16&255]^u[M>>8&255]^l[F&255]^_[Y+3],E=s,M=a,F=g,j=m,Y=Y+4;s=x[E>>>24]<<24^x[M>>16&255]<<16^x[F>>8&255]<<8^x[j&255]^_[Y],a=x[M>>>24]<<24^x[F>>16&255]<<16^x[j>>8&255]<<8^x[E&255]^_[Y+1],g=x[F>>>24]<<24^x[j>>16&255]<<16^x[E>>8&255]<<8^x[M&255]^_[Y+2],m=x[j>>>24]<<24^x[E>>16&255]<<16^x[M>>8&255]<<8^x[F&255]^_[Y+3],c[y]=oe(s^p),c[y+1]=oe(m^f),c[y+2]=oe(g^C),c[y+3]=oe(a^b),p=W,f=D,C=P,b=H,y=y+4}return c.buffer},B}()},"./src/crypt/decrypter.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"default",function(){return y});var z=L("./src/crypt/aes-crypto.ts"),I=L("./src/crypt/fast-aes-key.ts"),R=L("./src/crypt/aes-decryptor.ts"),B=L("./src/utils/logger.ts"),U=L("./src/utils/mp4-tools.ts"),k=L("./src/utils/typed-array.ts"),A=16,y=function(){function S(_,x,v){var d=v===void 0?{}:v,o=d.removePKCS7Padding,u=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=_,this.config=x,this.removePKCS7Padding=u,u)try{var l=self.crypto;l&&(this.subtle=l.subtle||l.webkitSubtle)}catch(w){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var O=S.prototype;return O.destroy=function(){this.observer=null},O.isSync=function(){return this.config.enableSoftwareAES},O.flush=function(){var x=this.currentResult;if(!x){this.reset();return}var v=new Uint8Array(x);return this.reset(),this.removePKCS7Padding?Object(R.removePadding)(v):v},O.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},O.decrypt=function(x,v,d,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(x),v,d);var u=this.flush();u&&o(u.buffer)}else this.webCryptoDecrypt(new Uint8Array(x),v,d).then(o)},O.softwareDecrypt=function(x,v,d){var o=this.currentIV,u=this.currentResult,l=this.remainderData;this.logOnce("JS AES decrypt"),l&&(x=Object(U.appendUint8Array)(l,x),this.remainderData=null);var w=this.getValidChunk(x);if(!w.length)return null;o&&(d=o);var p=this.softwareDecrypter;p||(p=this.softwareDecrypter=new R.default),p.expandKey(v);var f=u;return this.currentResult=p.decrypt(w.buffer,0,d),this.currentIV=Object(k.sliceUint8)(w,-16).buffer,f||null},O.webCryptoDecrypt=function(x,v,d){var o=this,u=this.subtle;return(this.key!==v||!this.fastAesKey)&&(this.key=v,this.fastAesKey=new I.default(u,v)),this.fastAesKey.expandKey().then(function(l){if(!u)return Promise.reject(new Error("web crypto not initialized"));var w=new z.default(u,d);return w.decrypt(x.buffer,l)}).catch(function(l){return o.onWebCryptoError(l,x,v,d)})},O.onWebCryptoError=function(x,v,d,o){return B.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",x),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(v,d,o)},O.getValidChunk=function(x){var v=x,d=x.length-x.length%A;return d!==x.length&&(v=Object(k.sliceUint8)(x,0,d),this.remainderData=Object(k.sliceUint8)(x,d)),v},O.logOnce=function(x){if(!this.logEnabled)return;B.logger.log("[decrypter.ts]: "+x),this.logEnabled=!1},S}()},"./src/crypt/fast-aes-key.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"default",function(){return z});var z=function(){function I(B,U){this.subtle=void 0,this.key=void 0,this.subtle=B,this.key=U}var R=I.prototype;return R.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},I}()},"./src/demux/aacdemuxer.ts":function(re,G,L){"use strict";L.r(G);var z=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/adts.ts"),R=L("./src/utils/logger.ts"),B=L("./src/demux/id3.ts");function U(y,S){y.prototype=Object.create(S.prototype),y.prototype.constructor=y,k(y,S)}function k(y,S){return k=Object.setPrototypeOf||function(_,x){return _.__proto__=x,_},k(y,S)}var A=function(y){U(S,y);function S(_,x){var v;return v=y.call(this)||this,v.observer=void 0,v.config=void 0,v.observer=_,v.config=x,v}var O=S.prototype;return O.resetInitSegment=function(x,v,d){y.prototype.resetInitSegment.call(this,x,v,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:x,duration:d,inputTimeScale:9e4,dropped:0}},S.probe=function(x){if(!x)return!1;for(var v=B.getID3Data(x,0)||[],d=v.length,o=x.length;d<o;d++)if(I.probe(x,d))return R.logger.log("ADTS sync word found !"),!0;return!1},O.canParse=function(x,v){return I.canParse(x,v)},O.appendFrame=function(x,v,d){I.initTrackConfig(x,this.observer,v,d,x.manifestCodec);var o=I.appendFrame(x,v,d,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},S}(z.default);A.minProbeByteLength=9,G.default=A},"./src/demux/adts.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"getAudioConfig",function(){return B}),L.d(G,"isHeaderPattern",function(){return U}),L.d(G,"getHeaderLength",function(){return k}),L.d(G,"getFullFrameLength",function(){return A}),L.d(G,"canGetFrameLength",function(){return y}),L.d(G,"isHeader",function(){return S}),L.d(G,"canParse",function(){return O}),L.d(G,"probe",function(){return _}),L.d(G,"initTrackConfig",function(){return x}),L.d(G,"getFrameDuration",function(){return v}),L.d(G,"parseFrameHeader",function(){return d}),L.d(G,"appendFrame",function(){return o});var z=L("./src/utils/logger.ts"),I=L("./src/errors.ts"),R=L("./src/events.ts");function B(u,l,w,p){var f,C,b,h,c=navigator.userAgent.toLowerCase(),s=p,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];f=((l[w+2]&192)>>>6)+1;var g=(l[w+2]&60)>>>2;if(g>a.length-1){u.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+g});return}return b=(l[w+2]&1)<<2,b|=(l[w+3]&192)>>>6,z.logger.log("manifest codec:"+p+", ADTS type:"+f+", samplingIndex:"+g),/firefox/i.test(c)?g>=6?(f=5,h=new Array(4),C=g-3):(f=2,h=new Array(2),C=g):c.indexOf("android")!==-1?(f=2,h=new Array(2),C=g):(f=5,h=new Array(4),p&&(p.indexOf("mp4a.40.29")!==-1||p.indexOf("mp4a.40.5")!==-1)||!p&&g>=6?C=g-3:((p&&p.indexOf("mp4a.40.2")!==-1&&(g>=6&&b===1||/vivaldi/i.test(c))||!p&&b===1)&&(f=2,h=new Array(2)),C=g)),h[0]=f<<3,h[0]|=(g&14)>>1,h[1]|=(g&1)<<7,h[1]|=b<<3,f===5&&(h[1]|=(C&14)>>1,h[2]=(C&1)<<7,h[2]|=2<<2,h[3]=0),{config:h,samplerate:a[g],channelCount:b,codec:"mp4a.40."+f,manifestCodec:s}}function U(u,l){return u[l]===255&&(u[l+1]&246)===240}function k(u,l){return u[l+1]&1?7:9}function A(u,l){return(u[l+3]&3)<<11|u[l+4]<<3|(u[l+5]&224)>>>5}function y(u,l){return l+5<u.length}function S(u,l){return l+1<u.length&&U(u,l)}function O(u,l){return y(u,l)&&U(u,l)&&A(u,l)<=u.length-l}function _(u,l){if(S(u,l)){var w=k(u,l);if(l+w>=u.length)return!1;var p=A(u,l);if(p<=w)return!1;var f=l+p;return f===u.length||S(u,f)}return!1}function x(u,l,w,p,f){if(!u.samplerate){var C=B(l,w,p,f);if(!C)return;u.config=C.config,u.samplerate=C.samplerate,u.channelCount=C.channelCount,u.codec=C.codec,u.manifestCodec=C.manifestCodec,z.logger.log("parsed codec:"+u.codec+", rate:"+C.samplerate+", channels:"+C.channelCount)}}function v(u){return 1024*9e4/u}function d(u,l,w,p,f){var C=k(u,l),b=A(u,l);if(b-=C,b>0){var h=w+p*f;return{headerLength:C,frameLength:b,stamp:h}}}function o(u,l,w,p,f){var C=v(u.samplerate),b=d(l,w,p,f,C);if(b){var h=b.frameLength,c=b.headerLength,s=b.stamp,a=c+h,g=Math.max(0,w+a-l.length),m;g?(m=new Uint8Array(a-c),m.set(l.subarray(w+c,l.length),0)):m=l.subarray(w+c,w+a);var E={unit:m,pts:s};return g||u.samples.push(E),{sample:E,length:a,missing:g}}}},"./src/demux/base-audio-demuxer.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"initPTSFn",function(){return A});var z=L("./src/polyfills/number.ts"),I=L("./src/demux/id3.ts"),R=L("./src/demux/dummy-demuxed-track.ts"),B=L("./src/utils/mp4-tools.ts"),U=L("./src/utils/typed-array.ts"),k=function(){function y(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var S=y.prototype;return S.resetInitSegment=function(_,x,v){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},S.resetTimeStamp=function(){},S.resetContiguity=function(){},S.canParse=function(_,x){return!1},S.appendFrame=function(_,x,v){},S.demux=function(_,x){this.cachedData&&(_=Object(B.appendUint8Array)(this.cachedData,_),this.cachedData=null);var v=I.getID3Data(_,0),d=v?v.length:0,o,u,l=this._audioTrack,w=this._id3Track,p=v?I.getTimeStamp(v):void 0,f=_.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=A(p,x)),v&&v.length>0&&w.samples.push({pts:this.initPTS,dts:this.initPTS,data:v}),u=this.initPTS;d<f;){if(this.canParse(_,d)){var C=this.appendFrame(l,_,d);C?(this.frameIndex++,u=C.sample.pts,d+=C.length,o=d):d=f}else I.canParse(_,d)?(v=I.getID3Data(_,d),w.samples.push({pts:u,dts:u,data:v}),d+=v.length,o=d):d++;if(d===f&&o!==f){var b=Object(U.sliceUint8)(_,o);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,b):this.cachedData=b}}return{audioTrack:l,avcTrack:Object(R.dummyTrack)(),id3Track:w,textTrack:Object(R.dummyTrack)()}},S.demuxSampleAes=function(_,x,v){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},S.flush=function(_){var x=this.cachedData;return x&&(this.cachedData=null,this.demux(x,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(R.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(R.dummyTrack)()}},S.destroy=function(){},y}(),A=function(S,O){return Object(z.isFiniteNumber)(S)?S*90:O*9e4};G.default=k},"./src/demux/chunk-cache.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"default",function(){return z});var z=function(){function R(){this.chunks=[],this.dataLength=0}var B=R.prototype;return B.push=function(k){this.chunks.push(k),this.dataLength+=k.length},B.flush=function(){var k=this.chunks,A=this.dataLength,y;if(k.length)k.length===1?y=k[0]:y=I(k,A);else return new Uint8Array(0);return this.reset(),y},B.reset=function(){this.chunks.length=0,this.dataLength=0},R}();function I(R,B){for(var U=new Uint8Array(B),k=0,A=0;A<R.length;A++){var y=R[A];U.set(y,k),k+=y.length}return U}},"./src/demux/dummy-demuxed-track.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"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,G,L){"use strict";L.r(G);var z=L("./src/utils/logger.ts"),I=function(){function R(U){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=U,this.bytesAvailable=U.byteLength,this.word=0,this.bitsAvailable=0}var B=R.prototype;return B.loadWord=function(){var k=this.data,A=this.bytesAvailable,y=k.byteLength-A,S=new Uint8Array(4),O=Math.min(4,A);if(O===0)throw new Error("no bytes available");S.set(k.subarray(y,y+O)),this.word=new DataView(S.buffer).getUint32(0),this.bitsAvailable=O*8,this.bytesAvailable-=O},B.skipBits=function(k){var A;this.bitsAvailable>k?(this.word<<=k,this.bitsAvailable-=k):(k-=this.bitsAvailable,A=k>>3,k-=A>>3,this.bytesAvailable-=A,this.loadWord(),this.word<<=k,this.bitsAvailable-=k)},B.readBits=function(k){var A=Math.min(this.bitsAvailable,k),y=this.word>>>32-A;return k>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=k-A,A>0&&this.bitsAvailable?y<<A|this.readBits(A):y},B.skipLZ=function(){var k;for(k=0;k<this.bitsAvailable;++k)if((this.word&2147483648>>>k)!==0)return this.word<<=k,this.bitsAvailable-=k,k;return this.loadWord(),k+this.skipLZ()},B.skipUEG=function(){this.skipBits(1+this.skipLZ())},B.skipEG=function(){this.skipBits(1+this.skipLZ())},B.readUEG=function(){var k=this.skipLZ();return this.readBits(k+1)-1},B.readEG=function(){var k=this.readUEG();return 1&k?1+k>>>1:-1*(k>>>1)},B.readBoolean=function(){return this.readBits(1)===1},B.readUByte=function(){return this.readBits(8)},B.readUShort=function(){return this.readBits(16)},B.readUInt=function(){return this.readBits(32)},B.skipScalingList=function(k){for(var A=8,y=8,S,O=0;O<k;O++)y!==0&&(S=this.readEG(),y=(A+S+256)%256),A=y===0?A:y},B.readSPS=function(){var k=0,A=0,y=0,S=0,O,_,x,v=this.readUByte.bind(this),d=this.readBits.bind(this),o=this.readUEG.bind(this),u=this.readBoolean.bind(this),l=this.skipBits.bind(this),w=this.skipEG.bind(this),p=this.skipUEG.bind(this),f=this.skipScalingList.bind(this);v();var C=v();if(d(5),l(3),v(),p(),C===100||C===110||C===122||C===244||C===44||C===83||C===86||C===118||C===128){var b=o();if(b===3&&l(1),p(),p(),l(1),u())for(_=b!==3?8:12,x=0;x<_;x++)u()&&(x<6?f(16):f(64))}p();var h=o();if(h===0)o();else if(h===1)for(l(1),w(),w(),O=o(),x=0;x<O;x++)w();p(),l(1);var c=o(),s=o(),a=d(1);a===0&&l(1),l(1),u()&&(k=o(),A=o(),y=o(),S=o());var g=[1,1];if(u()&&u()){var m=v();switch(m){case 1:g=[1,1];break;case 2:g=[12,11];break;case 3:g=[10,11];break;case 4:g=[16,11];break;case 5:g=[40,33];break;case 6:g=[24,11];break;case 7:g=[20,11];break;case 8:g=[32,11];break;case 9:g=[80,33];break;case 10:g=[18,11];break;case 11:g=[15,11];break;case 12:g=[64,33];break;case 13:g=[160,99];break;case 14:g=[4,3];break;case 15:g=[3,2];break;case 16:g=[2,1];break;case 255:{g=[v()<<8|v(),v()<<8|v()];break}}}return{width:Math.ceil((c+1)*16-k*2-A*2),height:(2-a)*(s+1)*16-(a?2:4)*(y+S),pixelRatio:g}},B.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},R}();G.default=I},"./src/demux/id3.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"isHeader",function(){return z}),L.d(G,"isFooter",function(){return I}),L.d(G,"getID3Data",function(){return R}),L.d(G,"canParse",function(){return U}),L.d(G,"getTimeStamp",function(){return k}),L.d(G,"isTimeStampFrame",function(){return A}),L.d(G,"getID3Frames",function(){return S}),L.d(G,"decodeFrame",function(){return O}),L.d(G,"utf8ArrayToStr",function(){return o}),L.d(G,"testables",function(){return u});var z=function(f,C){return C+10<=f.length&&(f[C]===73&&f[C+1]===68&&f[C+2]===51&&(f[C+3]<255&&f[C+4]<255&&(f[C+6]<128&&f[C+7]<128&&f[C+8]<128&&f[C+9]<128)))},I=function(f,C){return C+10<=f.length&&(f[C]===51&&f[C+1]===68&&f[C+2]===73&&(f[C+3]<255&&f[C+4]<255&&(f[C+6]<128&&f[C+7]<128&&f[C+8]<128&&f[C+9]<128)))},R=function(f,C){for(var b=C,h=0;z(f,C);){h+=10;var c=B(f,C+6);h+=c,I(f,C+10)&&(h+=10),C+=h}return h>0?f.subarray(b,b+h):void 0},B=function(f,C){var b=0;return b=(f[C]&127)<<21,b|=(f[C+1]&127)<<14,b|=(f[C+2]&127)<<7,b|=f[C+3]&127,b},U=function(f,C){return z(f,C)&&B(f,C+6)+10<=f.length-C},k=function(f){for(var C=S(f),b=0;b<C.length;b++){var h=C[b];if(A(h))return d(h)}return},A=function(f){return f&&f.key==="PRIV"&&f.info==="com.apple.streaming.transportStreamTimestamp"},y=function(f){var C=String.fromCharCode(f[0],f[1],f[2],f[3]),b=B(f,4),h=10;return{type:C,size:b,data:f.subarray(h,h+b)}},S=function(f){for(var C=0,b=[];z(f,C);){var h=B(f,C+6);C+=10;for(var c=C+h;C+8<c;){var s=y(f.subarray(C)),a=O(s);a&&b.push(a),C+=s.size+10}I(f,C)&&(C+=10)}return b},O=function(f){return f.type==="PRIV"?_(f):f.type[0]==="W"?v(f):x(f)},_=function(f){if(f.size<2)return;var C=o(f.data,!0),b=new Uint8Array(f.data.subarray(C.length+1));return{key:f.type,info:C,data:b.buffer}},x=function(f){if(f.size<2)return;if(f.type==="TXXX"){var C=1,b=o(f.data.subarray(C),!0);C+=b.length+1;var h=o(f.data.subarray(C));return{key:f.type,info:b,data:h}}var c=o(f.data.subarray(1));return{key:f.type,data:c}},v=function(f){if(f.type==="WXXX"){if(f.size<2)return;var C=1,b=o(f.data.subarray(C),!0);C+=b.length+1;var h=o(f.data.subarray(C));return{key:f.type,info:b,data:h}}var c=o(f.data);return{key:f.type,data:c}},d=function(f){if(f.data.byteLength===8){var C=new Uint8Array(f.data),b=C[3]&1,h=(C[4]<<23)+(C[5]<<15)+(C[6]<<7)+C[7];return h/=45,b&&(h+=4772185884e-2),Math.round(h)}return},o=function(f,C){C===void 0&&(C=!1);var b=w();if(b){var h=b.decode(f);if(C){var c=h.indexOf("\0");return c!==-1?h.substring(0,c):h}return h.replace(/\0/g,"")}for(var s=f.length,a,g,m,E="",M=0;M<s;){if(a=f[M++],a===0&&C)return E;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:E+=String.fromCharCode(a);break;case 12:case 13:g=f[M++],E+=String.fromCharCode((a&31)<<6|g&63);break;case 14:g=f[M++],m=f[M++],E+=String.fromCharCode((a&15)<<12|(g&63)<<6|(m&63)<<0);break;default:}}return E},u={decodeTextFrame:x},l;function w(){return!l&&typeof self.TextDecoder!="undefined"&&(l=new self.TextDecoder("utf-8")),l}},"./src/demux/mp3demuxer.ts":function(re,G,L){"use strict";L.r(G);var z=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/id3.ts"),R=L("./src/utils/logger.ts"),B=L("./src/demux/mpegaudio.ts");function U(y,S){y.prototype=Object.create(S.prototype),y.prototype.constructor=y,k(y,S)}function k(y,S){return k=Object.setPrototypeOf||function(_,x){return _.__proto__=x,_},k(y,S)}var A=function(y){U(S,y);function S(){return y.apply(this,arguments)||this}var O=S.prototype;return O.resetInitSegment=function(x,v,d){y.prototype.resetInitSegment.call(this,x,v,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:x,duration:d,inputTimeScale:9e4,dropped:0}},S.probe=function(x){if(!x)return!1;for(var v=I.getID3Data(x,0)||[],d=v.length,o=x.length;d<o;d++)if(B.probe(x,d))return R.logger.log("MPEG Audio sync word found !"),!0;return!1},O.canParse=function(x,v){return B.canParse(x,v)},O.appendFrame=function(x,v,d){return this.initPTS===null?void 0:B.appendFrame(x,v,d,this.initPTS,this.frameIndex)},S}(z.default);A.minProbeByteLength=4,G.default=A},"./src/demux/mp4demuxer.ts":function(re,G,L){"use strict";L.r(G);var z=L("./src/utils/mp4-tools.ts"),I=L("./src/demux/dummy-demuxed-track.ts"),R=function(){function B(k,A){this.remainderData=null,this.config=void 0,this.config=A}var U=B.prototype;return U.resetTimeStamp=function(){},U.resetInitSegment=function(){},U.resetContiguity=function(){},B.probe=function(A){return Object(z.findBox)({data:A,start:0,end:Math.min(A.length,16384)},["moof"]).length>0},U.demux=function(A){var y=A,S=Object(I.dummyTrack)();if(this.config.progressive){this.remainderData&&(y=Object(z.appendUint8Array)(this.remainderData,A));var O=Object(z.segmentValidRange)(y);this.remainderData=O.remainder,S.samples=O.valid||new Uint8Array}else S.samples=y;return{audioTrack:Object(I.dummyTrack)(),avcTrack:S,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},U.flush=function(){var A=Object(I.dummyTrack)();return A.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(I.dummyTrack)(),avcTrack:A,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},U.demuxSampleAes=function(A,y,S){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},U.destroy=function(){},B}();R.minProbeByteLength=1024,G.default=R},"./src/demux/mpegaudio.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"appendFrame",function(){return k}),L.d(G,"parseHeader",function(){return A}),L.d(G,"isHeaderPattern",function(){return y}),L.d(G,"isHeader",function(){return S}),L.d(G,"canParse",function(){return O}),L.d(G,"probe",function(){return _});var z=null,I=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],R=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],B=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],U=[0,1,1,4];function k(x,v,d,o,u){if(d+24>v.length)return;var l=A(v,d);if(l&&d+l.frameLength<=v.length){var w=l.samplesPerFrame*9e4/l.sampleRate,p=o+u*w,f={unit:v.subarray(d,d+l.frameLength),pts:p,dts:p};return x.config=[],x.channelCount=l.channelCount,x.samplerate=l.sampleRate,x.samples.push(f),{sample:f,length:l.frameLength,missing:0}}}function A(x,v){var d=x[v+1]>>3&3,o=x[v+1]>>1&3,u=x[v+2]>>4&15,l=x[v+2]>>2&3;if(d!==1&&u!==0&&u!==15&&l!==3){var w=x[v+2]>>1&1,p=x[v+3]>>6,f=d===3?3-o:o===3?3:4,C=I[f*14+u-1]*1e3,b=d===3?0:d===2?1:2,h=R[b*3+l],c=p===3?1:2,s=B[d][o],a=U[o],g=s*8*a,m=Math.floor(s*C/h+w)*a;if(z===null){var E=navigator.userAgent||"",M=E.match(/Chrome\/(\d+)/i);z=M?parseInt(M[1]):0}var F=!!z&&z<=87;return F&&o===2&&C>=224e3&&p===0&&(x[v+3]=x[v+3]|128),{sampleRate:h,channelCount:c,frameLength:m,samplesPerFrame:g}}}function y(x,v){return x[v]===255&&(x[v+1]&224)===224&&(x[v+1]&6)!==0}function S(x,v){return v+1<x.length&&y(x,v)}function O(x,v){var d=4;return y(x,v)&&d<=x.length-v}function _(x,v){if(v+1<x.length&&y(x,v)){var d=4,o=A(x,v),u=d;o!=null&&o.frameLength&&(u=o.frameLength);var l=v+u;return l===x.length||S(x,l)}return!1}},"./src/demux/sample-aes.ts":function(re,G,L){"use strict";L.r(G);var z=L("./src/crypt/decrypter.ts"),I=L("./src/demux/tsdemuxer.ts"),R=function(){function B(k,A,y){this.keyData=void 0,this.decrypter=void 0,this.keyData=y,this.decrypter=new z.default(k,A,{removePKCS7Padding:!1})}var U=B.prototype;return U.decryptBuffer=function(A,y){this.decrypter.decrypt(A,this.keyData.key.buffer,this.keyData.iv.buffer,y)},U.decryptAacSample=function(A,y,S,O){var _=A[y].unit,x=_.subarray(16,_.length-_.length%16),v=x.buffer.slice(x.byteOffset,x.byteOffset+x.length),d=this;this.decryptBuffer(v,function(o){var u=new Uint8Array(o);_.set(u,16),O||d.decryptAacSamples(A,y+1,S)})},U.decryptAacSamples=function(A,y,S){for(;;y++){if(y>=A.length){S();return}if(A[y].unit.length<32)continue;var O=this.decrypter.isSync();if(this.decryptAacSample(A,y,S,O),!O)return}},U.getAvcEncryptedData=function(A){for(var y=Math.floor((A.length-48)/160)*16+16,S=new Int8Array(y),O=0,_=32;_<=A.length-16;_+=160,O+=16)S.set(A.subarray(_,_+16),O);return S},U.getAvcDecryptedUnit=function(A,y){for(var S=new Uint8Array(y),O=0,_=32;_<=A.length-16;_+=160,O+=16)A.set(S.subarray(O,O+16),_);return A},U.decryptAvcSample=function(A,y,S,O,_,x){var v=Object(I.discardEPB)(_.data),d=this.getAvcEncryptedData(v),o=this;this.decryptBuffer(d.buffer,function(u){_.data=o.getAvcDecryptedUnit(v,u),x||o.decryptAvcSamples(A,y,S+1,O)})},U.decryptAvcSamples=function(A,y,S,O){if(A instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;y++,S=0){if(y>=A.length){O();return}for(var _=A[y].units;!(S>=_.length);S++){var x=_[S];if(x.data.length<=48||x.type!==1&&x.type!==5)continue;var v=this.decrypter.isSync();if(this.decryptAvcSample(A,y,S,O,x,v),!v)return}}},B}();G.default=R},"./src/demux/transmuxer-interface.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"default",function(){return _});var z=L("./node_modules/webworkify-webpack/index.js"),I=L.n(z),R=L("./src/events.ts"),B=L("./src/demux/transmuxer.ts"),U=L("./src/utils/logger.ts"),k=L("./src/errors.ts"),A=L("./src/utils/mediasource-helper.ts"),y=L("./node_modules/eventemitter3/index.js"),S=L.n(y),O=Object(A.getMediaSource)()||{isTypeSupported:function(){return!1}},_=function(){function x(d,o,u,l){var w=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=d,this.id=o,this.onTransmuxComplete=u,this.onFlush=l;var p=d.config,f=function(s,a){a=a||{},a.frag=w.frag,a.id=w.id,d.trigger(s,a)};this.observer=new y.EventEmitter,this.observer.on(R.Events.FRAG_DECRYPTED,f),this.observer.on(R.Events.ERROR,f);var C={mp4:O.isTypeSupported("video/mp4"),mpeg:O.isTypeSupported("audio/mpeg"),mp3:O.isTypeSupported('audio/mp4; codecs="mp3"')},b=navigator.vendor;if(p.enableWorker&&typeof Worker!="undefined"){U.logger.log("demuxing in webworker");var h;try{h=this.worker=z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(c){d.trigger(R.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},h.postMessage({cmd:"init",typeSupported:C,vendor:b,id:o,config:JSON.stringify(p)})}catch(c){U.logger.warn("Error in worker:",c),U.logger.error("Error while initializing DemuxerWorker, fallback to inline"),h&&self.URL.revokeObjectURL(h.objectURL),this.transmuxer=new B.default(this.observer,C,p,b,o),this.worker=null}}else this.transmuxer=new B.default(this.observer,C,p,b,o)}var v=x.prototype;return v.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var u=this.transmuxer;u&&(u.destroy(),this.transmuxer=null)}var l=this.observer;l&&l.removeAllListeners(),this.observer=null},v.push=function(o,u,l,w,p,f,C,b,h,c){var s=this;h.transmuxing.start=self.performance.now();var a=this.transmuxer,g=this.worker,m=f?f.start:p.start,E=p.decryptdata,M=this.frag,F=!(M&&p.cc===M.cc),j=!(M&&h.level===M.level),W=M?h.sn-M.sn:-1,D=this.part?h.part-this.part.index:1,P=!j&&(W===1||W===0&&D===1),H=self.performance.now();(j||W||p.stats.parsing.start===0)&&(p.stats.parsing.start=H),f&&(D||!P)&&(f.stats.parsing.start=H);var Y=new B.TransmuxState(F,P,b,j,m);if(!P||F){U.logger.log("[transmuxer-interface, "+p.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
|
|
discontinuity: `+F+`
|
|
trackSwitch: `+j+`
|
|
contiguous: `+P+`
|
|
accurateTimeOffset: `+b+`
|
|
timeOffset: `+m);var ee=new B.TransmuxConfig(l,w,u,C,c);this.configureTransmuxer(ee)}if(this.frag=p,this.part=f,g)g.postMessage({cmd:"demux",data:o,decryptdata:E,chunkMeta:h,state:Y},o instanceof ArrayBuffer?[o]:[]);else if(a){var oe=a.push(o,E,h,Y);Object(B.isPromise)(oe)?oe.then(function(Te){s.handleTransmuxComplete(Te)}):this.handleTransmuxComplete(oe)}},v.flush=function(o){var u=this;o.transmuxing.start=self.performance.now();var l=this.transmuxer,w=this.worker;if(w)w.postMessage({cmd:"flush",chunkMeta:o});else if(l){var p=l.flush(o);Object(B.isPromise)(p)?p.then(function(f){u.handleFlushResult(f,o)}):this.handleFlushResult(p,o)}},v.handleFlushResult=function(o,u){var l=this;o.forEach(function(w){l.handleTransmuxComplete(w)}),this.onFlush(u)},v.onWorkerMessage=function(o){var u=o.data,l=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,l.trigger(u.event,u.data);break}}},v.configureTransmuxer=function(o){var u=this.worker,l=this.transmuxer;u?u.postMessage({cmd:"configure",config:o}):l&&l.configure(o)},v.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},x}()},"./src/demux/transmuxer-worker.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"default",function(){return k});var z=L("./src/demux/transmuxer.ts"),I=L("./src/events.ts"),R=L("./src/utils/logger.ts"),B=L("./node_modules/eventemitter3/index.js"),U=L.n(B);function k(_){var x=new B.EventEmitter,v=function(o,u){_.postMessage({event:o,data:u})};x.on(I.Events.FRAG_DECRYPTED,v),x.on(I.Events.ERROR,v),_.addEventListener("message",function(d){var o=d.data;switch(o.cmd){case"init":{var u=JSON.parse(o.config);_.transmuxer=new z.default(x,o.typeSupported,u,o.vendor,o.id),Object(R.enableLogs)(u.debug),v("init",null);break}case"configure":{_.transmuxer.configure(o.config);break}case"demux":{var l=_.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(z.isPromise)(l)?l.then(function(f){A(_,f)}):A(_,l);break}case"flush":{var w=o.chunkMeta,p=_.transmuxer.flush(w);Object(z.isPromise)(p)?p.then(function(f){S(_,f,w)}):S(_,p,w);break}default:break}})}function A(_,x){if(O(x.remuxResult))return;var v=[],d=x.remuxResult,o=d.audio,u=d.video;o&&y(v,o),u&&y(v,u),_.postMessage({event:"transmuxComplete",data:x},v)}function y(_,x){x.data1&&_.push(x.data1.buffer),x.data2&&_.push(x.data2.buffer)}function S(_,x,v){x.forEach(function(d){A(_,d)}),_.postMessage({event:"flush",data:v})}function O(_){return!_.audio&&!_.video&&!_.text&&!_.id3&&!_.initSegment}},"./src/demux/transmuxer.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"default",function(){return u}),L.d(G,"isPromise",function(){return p}),L.d(G,"TransmuxConfig",function(){return f}),L.d(G,"TransmuxState",function(){return C});var z=L("./src/events.ts"),I=L("./src/errors.ts"),R=L("./src/crypt/decrypter.ts"),B=L("./src/demux/aacdemuxer.ts"),U=L("./src/demux/mp4demuxer.ts"),k=L("./src/demux/tsdemuxer.ts"),A=L("./src/demux/mp3demuxer.ts"),y=L("./src/remux/mp4-remuxer.ts"),S=L("./src/remux/passthrough-remuxer.ts"),O=L("./src/demux/chunk-cache.ts"),_=L("./src/utils/mp4-tools.ts"),x=L("./src/utils/logger.ts"),v;try{v=self.performance.now.bind(self.performance)}catch(b){x.logger.debug("Unable to use Performance API on this environment"),v=self.Date.now}var d=[{demux:k.default,remux:y.default},{demux:U.default,remux:S.default},{demux:B.default,remux:y.default},{demux:A.default,remux:y.default}],o=1024;d.forEach(function(b){var h=b.demux;o=Math.max(o,h.minProbeByteLength)});var u=function(){function b(c,s,a,g,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 O.default,this.observer=c,this.typeSupported=s,this.config=a,this.vendor=g,this.id=m}var h=b.prototype;return h.configure=function(s){this.transmuxConfig=s,this.decrypter&&this.decrypter.reset()},h.push=function(s,a,g,m){var E=this,M=g.transmuxing;M.executeStart=v();var F=new Uint8Array(s),j=this.cache,W=this.config,D=this.currentTransmuxState,P=this.transmuxConfig;m&&(this.currentTransmuxState=m);var H=l(F,a);if(H&&H.method==="AES-128"){var Y=this.getDecrypter();if(W.enableSoftwareAES){var ee=Y.softwareDecrypt(F,H.key.buffer,H.iv.buffer);if(!ee)return M.executeEnd=v(),w(g);F=new Uint8Array(ee)}else return this.decryptionPromise=Y.webCryptoDecrypt(F,H.key.buffer,H.iv.buffer).then(function(ge){var Se=E.push(ge,null,g);return E.decryptionPromise=null,Se}),this.decryptionPromise}var oe=m||D,Te=oe.contiguous,ye=oe.discontinuity,he=oe.trackSwitch,le=oe.accurateTimeOffset,me=oe.timeOffset,ie=P.audioCodec,pe=P.videoCodec,J=P.defaultInitPts,ne=P.duration,q=P.initSegmentData;if((ye||he)&&this.resetInitSegment(q,ie,pe,ne),ye&&this.resetInitialTimestamp(J),Te||this.resetContiguity(),this.needsProbing(F,ye,he)){if(j.dataLength){var xe=j.flush();F=Object(_.appendUint8Array)(xe,F)}this.configureTransmuxer(F,P)}var Ce=this.transmux(F,H,me,le,g),be=this.currentTransmuxState;return be.contiguous=!0,be.discontinuity=!1,be.trackSwitch=!1,M.executeEnd=v(),Ce},h.flush=function(s){var a=this,g=s.transmuxing;g.executeStart=v();var m=this.decrypter,E=this.cache,M=this.currentTransmuxState,F=this.decryptionPromise;if(F)return F.then(function(){return a.flush(s)});var j=[],W=M.timeOffset;if(m){var D=m.flush();D&&j.push(this.push(D,null,s))}var P=E.dataLength;E.reset();var H=this.demuxer,Y=this.remuxer;if(!H||!Y)return P>=o&&this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),g.executeEnd=v(),[w(s)];var ee=H.flush(W);return p(ee)?ee.then(function(oe){return a.flushRemux(j,oe,s),j}):(this.flushRemux(j,ee,s),j)},h.flushRemux=function(s,a,g){var m=a.audioTrack,E=a.avcTrack,M=a.id3Track,F=a.textTrack,j=this.currentTransmuxState,W=j.accurateTimeOffset,D=j.timeOffset;x.logger.log("[transmuxer.ts]: Flushed fragment "+g.sn+(g.part>-1?" p: "+g.part:"")+" of level "+g.level);var P=this.remuxer.remux(m,E,M,F,D,W,!0,this.id);s.push({remuxResult:P,chunkMeta:g}),g.transmuxing.executeEnd=v()},h.resetInitialTimestamp=function(s){var a=this.demuxer,g=this.remuxer;if(!a||!g)return;a.resetTimeStamp(s),g.resetTimeStamp(s)},h.resetContiguity=function(){var s=this.demuxer,a=this.remuxer;if(!s||!a)return;s.resetContiguity(),a.resetNextTimestamp()},h.resetInitSegment=function(s,a,g,m){var E=this.demuxer,M=this.remuxer;if(!E||!M)return;E.resetInitSegment(a,g,m),M.resetInitSegment(s,a,g)},h.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},h.transmux=function(s,a,g,m,E){var M;return a&&a.method==="SAMPLE-AES"?M=this.transmuxSampleAes(s,a,g,m,E):M=this.transmuxUnencrypted(s,g,m,E),M},h.transmuxUnencrypted=function(s,a,g,m){var E=this.demuxer.demux(s,a,!1,!this.config.progressive),M=E.audioTrack,F=E.avcTrack,j=E.id3Track,W=E.textTrack,D=this.remuxer.remux(M,F,j,W,a,g,!1,this.id);return{remuxResult:D,chunkMeta:m}},h.transmuxSampleAes=function(s,a,g,m,E){var M=this;return this.demuxer.demuxSampleAes(s,a,g).then(function(F){var j=M.remuxer.remux(F.audioTrack,F.avcTrack,F.id3Track,F.textTrack,g,m,!1,M.id);return{remuxResult:j,chunkMeta:E}})},h.configureTransmuxer=function(s,a){for(var g=this.config,m=this.observer,E=this.typeSupported,M=this.vendor,F=a.audioCodec,j=a.defaultInitPts,W=a.duration,D=a.initSegmentData,P=a.videoCodec,H,Y=0,ee=d.length;Y<ee;Y++)if(d[Y].demux.probe(s)){H=d[Y];break}H||(x.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),H={demux:U.default,remux:S.default});var oe=this.demuxer,Te=this.remuxer,ye=H.remux,he=H.demux;(!Te||!(Te instanceof ye))&&(this.remuxer=new ye(m,g,E,M)),(!oe||!(oe instanceof he))&&(this.demuxer=new he(m,g,E),this.probe=he.probe),this.resetInitSegment(D,F,P,W),this.resetInitialTimestamp(j)},h.needsProbing=function(s,a,g){return!this.demuxer||!this.remuxer||a||g},h.getDecrypter=function(){var s=this.decrypter;return s||(s=this.decrypter=new R.default(this.observer,this.config)),s},b}();function l(b,h){var c=null;return b.byteLength>0&&h!=null&&h.key!=null&&h.iv!==null&&h.method!=null&&(c=h),c}var w=function(h){return{remuxResult:{},chunkMeta:h}};function p(b){return"then"in b&&b.then instanceof Function}var f=function(h,c,s,a,g){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=h,this.videoCodec=c,this.initSegmentData=s,this.duration=a,this.defaultInitPts=g},C=function(h,c,s,a,g){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=h,this.contiguous=c,this.accurateTimeOffset=s,this.trackSwitch=a,this.timeOffset=g}},"./src/demux/tsdemuxer.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"discardEPB",function(){return w});var z=L("./src/demux/adts.ts"),I=L("./src/demux/mpegaudio.ts"),R=L("./src/demux/exp-golomb.ts"),B=L("./src/demux/id3.ts"),U=L("./src/demux/sample-aes.ts"),k=L("./src/events.ts"),A=L("./src/utils/mp4-tools.ts"),y=L("./src/utils/logger.ts"),S=L("./src/errors.ts"),O={video:1,audio:2,id3:3,text:4},_=function(){function p(C,b,h){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=C,this.config=b,this.typeSupported=h}p.probe=function(b){var h=p.syncOffset(b);return h<0?!1:(h&&y.logger.warn("MPEG2-TS detected but first sync word found @ offset "+h+", junk ahead ?"),!0)},p.syncOffset=function(b){for(var h=Math.min(1e3,b.length-3*188),c=0;c<h;){if(b[c]===71&&b[c+188]===71&&b[c+2*188]===71)return c;c++}return-1},p.createTrack=function(b,h){return{container:b==="video"||b==="audio"?"video/mp2t":void 0,type:b,id:O[b],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:b==="audio"?h:void 0}};var f=p.prototype;return f.resetInitSegment=function(b,h,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=p.createTrack("video",c),this._audioTrack=p.createTrack("audio",c),this._id3Track=p.createTrack("id3",c),this._txtTrack=p.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=b,this.videoCodec=h,this._duration=c},f.resetTimeStamp=function(){},f.resetContiguity=function(){var b=this._audioTrack,h=this._avcTrack,c=this._id3Track;b&&(b.pesData=null),h&&(h.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},f.demux=function(b,h,c,s){c===void 0&&(c=!1),s===void 0&&(s=!1),c||(this.sampleAes=null);var a,g=this._avcTrack,m=this._audioTrack,E=this._id3Track,M=g.pid,F=g.pesData,j=m.pid,W=E.pid,D=m.pesData,P=E.pesData,H=!1,Y=this.pmtParsed,ee=this._pmtId,oe=b.length;if(this.remainderData&&(b=Object(A.appendUint8Array)(this.remainderData,b),oe=b.length,this.remainderData=null),oe<188&&!s)return this.remainderData=b,{audioTrack:m,avcTrack:g,id3Track:E,textTrack:this._txtTrack};var Te=Math.max(0,p.syncOffset(b));oe-=(oe+Te)%188,oe<b.byteLength&&!s&&(this.remainderData=new Uint8Array(b.buffer,oe,b.buffer.byteLength-oe));for(var ye=Te;ye<oe;ye+=188)if(b[ye]===71){var he=!!(b[ye+1]&64),le=((b[ye+1]&31)<<8)+b[ye+2],me=(b[ye+3]&48)>>4,ie=void 0;if(me>1){if(ie=ye+5+b[ye+4],ie===ye+188)continue}else ie=ye+4;switch(le){case M:he&&(F&&(a=o(F))&&this.parseAVCPES(a,!1),F={data:[],size:0}),F&&(F.data.push(b.subarray(ie,ye+188)),F.size+=ye+188-ie);break;case j:he&&(D&&(a=o(D))&&(m.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),D={data:[],size:0}),D&&(D.data.push(b.subarray(ie,ye+188)),D.size+=ye+188-ie);break;case W:he&&(P&&(a=o(P))&&this.parseID3PES(a),P={data:[],size:0}),P&&(P.data.push(b.subarray(ie,ye+188)),P.size+=ye+188-ie);break;case 0:he&&(ie+=b[ie]+1),ee=this._pmtId=v(b,ie);break;case ee:{he&&(ie+=b[ie]+1);var pe=d(b,ie,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);M=pe.avc,M>0&&(g.pid=M),j=pe.audio,j>0&&(m.pid=j,m.isAAC=pe.isAAC),W=pe.id3,W>0&&(E.pid=W),H&&!Y&&(y.logger.log("reparse from beginning"),H=!1,ye=Te-188),Y=this.pmtParsed=!0;break}case 17:case 8191:break;default:H=!0;break}}else this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});g.pesData=F,m.pesData=D,E.pesData=P;var J={audioTrack:m,avcTrack:g,id3Track:E,textTrack:this._txtTrack};return s&&this.extractRemainingSamples(J),J},f.flush=function(){var b=this.remainderData;this.remainderData=null;var h;return b?h=this.demux(b,-1,!1,!0):h={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(h),this.sampleAes?this.decrypt(h,this.sampleAes):h},f.extractRemainingSamples=function(b){var h=b.audioTrack,c=b.avcTrack,s=b.id3Track,a=c.pesData,g=h.pesData,m=s.pesData,E;a&&(E=o(a))?(this.parseAVCPES(E,!0),c.pesData=null):c.pesData=a,g&&(E=o(g))?(h.isAAC?this.parseAACPES(E):this.parseMPEGPES(E),h.pesData=null):(g!=null&&g.size&&y.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=g),m&&(E=o(m))?(this.parseID3PES(E),s.pesData=null):s.pesData=m},f.demuxSampleAes=function(b,h,c){var s=this.demux(b,c,!0,!this.config.progressive),a=this.sampleAes=new U.default(this.observer,this.config,h);return this.decrypt(s,a)},f.decrypt=function(b,h){return new Promise(function(c){var s=b.audioTrack,a=b.avcTrack;s.samples&&s.isAAC?h.decryptAacSamples(s.samples,0,function(){a.samples?h.decryptAvcSamples(a.samples,0,0,function(){c(b)}):c(b)}):a.samples&&h.decryptAvcSamples(a.samples,0,0,function(){c(b)})})},f.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},f.parseAVCPES=function(b,h){var c=this,s=this._avcTrack,a=this.parseAVCNALu(b.data),g=!1,m=this.avcSample,E,M=!1;b.data=null,m&&a.length&&!s.audFound&&(u(m,s),m=this.avcSample=x(!1,b.pts,b.dts,"")),a.forEach(function(F){switch(F.type){case 1:{E=!0,m||(m=c.avcSample=x(!0,b.pts,b.dts,"")),g&&(m.debug+="NDR "),m.frame=!0;var j=F.data;if(M&&j.length>4){var W=new R.default(j).readSliceType();(W===2||W===4||W===7||W===9)&&(m.key=!0)}break}case 5:E=!0,m||(m=c.avcSample=x(!0,b.pts,b.dts,"")),g&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{E=!0,g&&m&&(m.debug+="SEI ");var D=new R.default(w(F.data));D.readUByte();for(var P=0,H=0,Y=!1,ee=0;!Y&&D.bytesAvailable>1;){P=0;do ee=D.readUByte(),P+=ee;while(ee===255);H=0;do ee=D.readUByte(),H+=ee;while(ee===255);if(P===4&&D.bytesAvailable!==0){Y=!0;var oe=D.readUByte();if(oe===181){var Te=D.readUShort();if(Te===49){var ye=D.readUInt();if(ye===1195456820){var he=D.readUByte();if(he===3){for(var le=D.readUByte(),me=D.readUByte(),ie=31&le,pe=[le,me],J=0;J<ie;J++)pe.push(D.readUByte()),pe.push(D.readUByte()),pe.push(D.readUByte());l(c._txtTrack.samples,{type:3,pts:b.pts,bytes:pe})}}}}}else if(P===5&&D.bytesAvailable!==0){if(Y=!0,H>16){for(var ne=[],q=0;q<16;q++)ne.push(D.readUByte().toString(16)),(q===3||q===5||q===7||q===9)&&ne.push("-");for(var xe=H-16,Ce=new Uint8Array(xe),be=0;be<xe;be++)Ce[be]=D.readUByte();l(c._txtTrack.samples,{pts:b.pts,payloadType:P,uuid:ne.join(""),userData:Object(B.utf8ArrayToStr)(Ce),userDataBytes:Ce})}}else if(H<D.bytesAvailable)for(var ge=0;ge<H;ge++)D.readUByte()}break}case 7:if(E=!0,M=!0,g&&m&&(m.debug+="SPS "),!s.sps){var Se=new R.default(F.data),Le=Se.readSPS();s.width=Le.width,s.height=Le.height,s.pixelRatio=Le.pixelRatio,s.sps=[F.data],s.duration=c._duration;for(var Me=F.data.subarray(1,4),_e="avc1.",Ae=0;Ae<3;Ae++){var je=Me[Ae].toString(16);je.length<2&&(je="0"+je),_e+=je}s.codec=_e}break;case 8:E=!0,g&&m&&(m.debug+="PPS "),s.pps||(s.pps=[F.data]);break;case 9:E=!1,s.audFound=!0,m&&u(m,s),m=c.avcSample=x(!1,b.pts,b.dts,g?"AUD ":"");break;case 12:E=!1;break;default:E=!1,m&&(m.debug+="unknown NAL "+F.type+" ");break}if(m&&E){var ze=m.units;ze.push(F)}}),h&&m&&(u(m,s),this.avcSample=null)},f.getLastNalUnit=function(){var b,h=this.avcSample,c;if(!h||h.units.length===0){var s=this._avcTrack.samples;h=s[s.length-1]}if((b=h)!==null&&b!==void 0&&b.units){var a=h.units;c=a[a.length-1]}return c},f.parseAVCNALu=function(b){var h=b.byteLength,c=this._avcTrack,s=c.naluState||0,a=s,g=[],m=0,E,M,F,j=-1,W=0;for(s===-1&&(j=0,W=b[0]&31,s=0,m=1);m<h;){if(E=b[m++],!s){s=E?0:1;continue}if(s===1){s=E?0:2;continue}if(!E)s=3;else if(E===1){if(j>=0){var D={data:b.subarray(j,m-s-1),type:W};g.push(D)}else{var P=this.getLastNalUnit();if(P&&(a&&m<=4-a&&(P.state&&(P.data=P.data.subarray(0,P.data.byteLength-a))),M=m-s-1,M>0)){var H=new Uint8Array(P.data.byteLength+M);H.set(P.data,0),H.set(b.subarray(0,M),P.data.byteLength),P.data=H,P.state=0}}m<h?(F=b[m]&31,j=m,W=F,s=0):s=-1}else s=0}if(j>=0&&s>=0){var Y={data:b.subarray(j,h),type:W,state:s};g.push(Y)}if(g.length===0){var ee=this.getLastNalUnit();if(ee){var oe=new Uint8Array(ee.data.byteLength+b.byteLength);oe.set(ee.data,0),oe.set(b,ee.data.byteLength),ee.data=oe}}return c.naluState=s,g},f.parseAACPES=function(b){var h=0,c=this._audioTrack,s=this.aacOverFlow,a=b.data;if(s){this.aacOverFlow=null;var g=s.sample.unit.byteLength,m=Math.min(s.missing,g),E=g-m;s.sample.unit.set(a.subarray(0,m),E),c.samples.push(s.sample),h=s.missing}var M,F;for(M=h,F=a.length;M<F-1&&!z.isHeader(a,M);M++);if(M!==h){var j,W;if(M<F-1?(j="AAC PES did not start with ADTS header,offset:"+M,W=!1):(j="no ADTS header found in AAC PES",W=!0),y.logger.warn("parsing error:"+j),this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:j}),W)return}z.initTrackConfig(c,this.observer,a,M,this.audioCodec);var D;if(b.pts!==void 0)D=b.pts;else if(s){var P=z.getFrameDuration(c.samplerate);D=s.sample.pts+P}else{y.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var H=0;M<F;)if(z.isHeader(a,M)){if(M+5<F){var Y=z.appendFrame(c,a,M,D,H);if(Y)if(Y.missing)this.aacOverFlow=Y;else{M+=Y.length,H++;continue}}break}else M++},f.parseMPEGPES=function(b){var h=b.data,c=h.length,s=0,a=0,g=b.pts;if(g===void 0){y.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(I.isHeader(h,a)){var m=I.appendFrame(this._audioTrack,h,a,g,s);if(m)a+=m.length,s++;else break}else a++},f.parseID3PES=function(b){if(b.pts===void 0){y.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(b)},p}();_.minProbeByteLength=188;function x(p,f,C,b){return{key:p,frame:!1,pts:f,dts:C,units:[],debug:b,length:0}}function v(p,f){return(p[f+10]&31)<<8|p[f+11]}function d(p,f,C,b){var h={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(p[f+1]&15)<<8|p[f+2],s=f+3+c-4,a=(p[f+10]&15)<<8|p[f+11];for(f+=12+a;f<s;){var g=(p[f+1]&31)<<8|p[f+2];switch(p[f]){case 207:if(!b){y.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:h.audio===-1&&(h.audio=g);break;case 21:h.id3===-1&&(h.id3=g);break;case 219:if(!b){y.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:h.avc===-1&&(h.avc=g);break;case 3:case 4:C?h.audio===-1&&(h.audio=g,h.isAAC=!1):y.logger.log("MPEG audio found, not supported in this browser");break;case 36:y.logger.warn("Unsupported HEVC stream type found");break;default:break}f+=((p[f+3]&15)<<8|p[f+4])+5}return h}function o(p){var f=0,C,b,h,c,s,a=p.data;if(!p||p.size===0)return null;for(;a[0].length<19&&a.length>1;){var g=new Uint8Array(a[0].length+a[1].length);g.set(a[0]),g.set(a[1],a[0].length),a[0]=g,a.splice(1,1)}C=a[0];var m=(C[0]<<16)+(C[1]<<8)+C[2];if(m===1){if(b=(C[4]<<8)+C[5],b&&b>p.size-6)return null;var E=C[7];E&192&&(c=(C[9]&14)*536870912+(C[10]&255)*4194304+(C[11]&254)*16384+(C[12]&255)*128+(C[13]&254)/2,E&64?(s=(C[14]&14)*536870912+(C[15]&255)*4194304+(C[16]&254)*16384+(C[17]&255)*128+(C[18]&254)/2,c-s>60*9e4&&(y.logger.warn(Math.round((c-s)/9e4)+"s delta between PTS and DTS, align them"),c=s)):s=c),h=C[8];var M=h+9;if(p.size<=M)return null;p.size-=M;for(var F=new Uint8Array(p.size),j=0,W=a.length;j<W;j++){C=a[j];var D=C.byteLength;if(M)if(M>D){M-=D;continue}else C=C.subarray(M),D-=M,M=0;F.set(C,f),f+=D}return b&&(b-=h+3),{data:F,pts:c,dts:s,len:b}}return null}function u(p,f){if(p.units.length&&p.frame){if(p.pts===void 0){var C=f.samples,b=C.length;if(b){var h=C[b-1];p.pts=h.pts,p.dts=h.dts}else{f.dropped++;return}}f.samples.push(p)}p.debug.length&&y.logger.log(p.pts+"/"+p.dts+":"+p.debug)}function l(p,f){var C=p.length;if(C>0){if(f.pts>=p[C-1].pts)p.push(f);else for(var b=C-1;b>=0;b--)if(f.pts<p[b].pts){p.splice(b,0,f);break}}else p.push(f)}function w(p){for(var f=p.byteLength,C=[],b=1;b<f-2;)p[b]===0&&p[b+1]===0&&p[b+2]===3?(C.push(b+2),b+=2):b++;if(C.length===0)return p;var h=f-C.length,c=new Uint8Array(h),s=0;for(b=0;b<h;s++,b++)s===C[0]&&(s++,C.shift()),c[b]=p[s];return c}G.default=_},"./src/errors.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"ErrorTypes",function(){return z}),L.d(G,"ErrorDetails",function(){return I});var z;(function(R){R.NETWORK_ERROR="networkError",R.MEDIA_ERROR="mediaError",R.KEY_SYSTEM_ERROR="keySystemError",R.MUX_ERROR="muxError",R.OTHER_ERROR="otherError"})(z||(z={}));var I;(function(R){R.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",R.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",R.KEY_SYSTEM_NO_SESSION="keySystemNoSession",R.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",R.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",R.MANIFEST_LOAD_ERROR="manifestLoadError",R.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",R.MANIFEST_PARSING_ERROR="manifestParsingError",R.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",R.LEVEL_EMPTY_ERROR="levelEmptyError",R.LEVEL_LOAD_ERROR="levelLoadError",R.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",R.LEVEL_SWITCH_ERROR="levelSwitchError",R.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",R.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",R.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",R.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",R.FRAG_LOAD_ERROR="fragLoadError",R.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",R.FRAG_DECRYPT_ERROR="fragDecryptError",R.FRAG_PARSING_ERROR="fragParsingError",R.REMUX_ALLOC_ERROR="remuxAllocError",R.KEY_LOAD_ERROR="keyLoadError",R.KEY_LOAD_TIMEOUT="keyLoadTimeOut",R.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",R.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",R.BUFFER_APPEND_ERROR="bufferAppendError",R.BUFFER_APPENDING_ERROR="bufferAppendingError",R.BUFFER_STALLED_ERROR="bufferStalledError",R.BUFFER_FULL_ERROR="bufferFullError",R.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",R.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",R.INTERNAL_EXCEPTION="internalException",R.INTERNAL_ABORTED="aborted",R.UNKNOWN="unknown"})(I||(I={}))},"./src/events.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"Events",function(){return z});var z;(function(I){I.MEDIA_ATTACHING="hlsMediaAttaching",I.MEDIA_ATTACHED="hlsMediaAttached",I.MEDIA_DETACHING="hlsMediaDetaching",I.MEDIA_DETACHED="hlsMediaDetached",I.BUFFER_RESET="hlsBufferReset",I.BUFFER_CODECS="hlsBufferCodecs",I.BUFFER_CREATED="hlsBufferCreated",I.BUFFER_APPENDING="hlsBufferAppending",I.BUFFER_APPENDED="hlsBufferAppended",I.BUFFER_EOS="hlsBufferEos",I.BUFFER_FLUSHING="hlsBufferFlushing",I.BUFFER_FLUSHED="hlsBufferFlushed",I.MANIFEST_LOADING="hlsManifestLoading",I.MANIFEST_LOADED="hlsManifestLoaded",I.MANIFEST_PARSED="hlsManifestParsed",I.LEVEL_SWITCHING="hlsLevelSwitching",I.LEVEL_SWITCHED="hlsLevelSwitched",I.LEVEL_LOADING="hlsLevelLoading",I.LEVEL_LOADED="hlsLevelLoaded",I.LEVEL_UPDATED="hlsLevelUpdated",I.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",I.LEVELS_UPDATED="hlsLevelsUpdated",I.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",I.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",I.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",I.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",I.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",I.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",I.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",I.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",I.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",I.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",I.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",I.CUES_PARSED="hlsCuesParsed",I.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",I.INIT_PTS_FOUND="hlsInitPtsFound",I.FRAG_LOADING="hlsFragLoading",I.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",I.FRAG_LOADED="hlsFragLoaded",I.FRAG_DECRYPTED="hlsFragDecrypted",I.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",I.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",I.FRAG_PARSING_METADATA="hlsFragParsingMetadata",I.FRAG_PARSED="hlsFragParsed",I.FRAG_BUFFERED="hlsFragBuffered",I.FRAG_CHANGED="hlsFragChanged",I.FPS_DROP="hlsFpsDrop",I.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",I.ERROR="hlsError",I.DESTROYING="hlsDestroying",I.KEY_LOADING="hlsKeyLoading",I.KEY_LOADED="hlsKeyLoaded",I.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",I.BACK_BUFFER_REACHED="hlsBackBufferReached"})(z||(z={}))},"./src/hls.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"default",function(){return p});var z=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(z),R=L("./src/loader/playlist-loader.ts"),B=L("./src/loader/key-loader.ts"),U=L("./src/controller/id3-track-controller.ts"),k=L("./src/controller/latency-controller.ts"),A=L("./src/controller/level-controller.ts"),y=L("./src/controller/fragment-tracker.ts"),S=L("./src/controller/stream-controller.ts"),O=L("./src/is-supported.ts"),_=L("./src/utils/logger.ts"),x=L("./src/config.ts"),v=L("./node_modules/eventemitter3/index.js"),d=L.n(v),o=L("./src/events.ts"),u=L("./src/errors.ts");function l(f,C){for(var b=0;b<C.length;b++){var h=C[b];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(f,h.key,h)}}function w(f,C,b){return C&&l(f.prototype,C),b&&l(f,b),f}var p=function(){f.isSupported=function(){return Object(O.isSupported)()};function f(b){b===void 0&&(b={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new v.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 h=this.config=Object(x.mergeConfig)(f.DefaultConfig,b);this.userConfig=b,Object(_.enableLogs)(h.debug),this._autoLevelCapping=-1,h.progressive&&Object(x.enableStreamingMode)(h);var c=h.abrController,s=h.bufferController,a=h.capLevelController,g=h.fpsController,m=this.abrController=new c(this),E=this.bufferController=new s(this),M=this.capLevelController=new a(this),F=new g(this),j=new R.default(this),W=new B.default(this),D=new U.default(this),P=this.levelController=new A.default(this),H=new y.FragmentTracker(this),Y=this.streamController=new S.default(this,H);M.setStreamController(Y),F.setStreamController(Y);var ee=[P,Y];this.networkControllers=ee;var oe=[j,W,m,E,M,F,D,H];this.audioTrackController=this.createController(h.audioTrackController,null,ee),this.createController(h.audioStreamController,H,ee),this.subtitleTrackController=this.createController(h.subtitleTrackController,null,ee),this.createController(h.subtitleStreamController,H,ee),this.createController(h.timelineController,null,oe),this.emeController=this.createController(h.emeController,null,oe),this.cmcdController=this.createController(h.cmcdController,null,oe),this.latencyController=this.createController(k.default,null,oe),this.coreComponents=oe}var C=f.prototype;return C.createController=function(h,c,s){if(h){var a=c?new h(this,c):new h(this);return s&&s.push(a),a}return null},C.on=function(h,c,s){s===void 0&&(s=this),this._emitter.on(h,c,s)},C.once=function(h,c,s){s===void 0&&(s=this),this._emitter.once(h,c,s)},C.removeAllListeners=function(h){this._emitter.removeAllListeners(h)},C.off=function(h,c,s,a){s===void 0&&(s=this),this._emitter.off(h,c,s,a)},C.listeners=function(h){return this._emitter.listeners(h)},C.emit=function(h,c,s){return this._emitter.emit(h,c,s)},C.trigger=function(h,c){if(this.config.debug)return this.emit(h,h,c);try{return this.emit(h,h,c)}catch(s){_.logger.error("An internal error happened while handling event "+h+'. Error message: "'+s.message+'". Here is a stacktrace:',s),this.trigger(o.Events.ERROR,{type:u.ErrorTypes.OTHER_ERROR,details:u.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:h,error:s})}return!1},C.listenerCount=function(h){return this._emitter.listenerCount(h)},C.destroy=function(){_.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(h){return h.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(h){return h.destroy()}),this.coreComponents.length=0},C.attachMedia=function(h){_.logger.log("attachMedia"),this._media=h,this.trigger(o.Events.MEDIA_ATTACHING,{media:h})},C.detachMedia=function(){_.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},C.loadSource=function(h){this.stopLoad();var c=this.media,s=this.url,a=this.url=z.buildAbsoluteURL(self.location.href,h,{alwaysNormalize:!0});_.logger.log("loadSource:"+a),c&&s&&s!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.Events.MANIFEST_LOADING,{url:h})},C.startLoad=function(h){h===void 0&&(h=-1),_.logger.log("startLoad("+h+")"),this.networkControllers.forEach(function(c){c.startLoad(h)})},C.stopLoad=function(){_.logger.log("stopLoad"),this.networkControllers.forEach(function(h){h.stopLoad()})},C.swapAudioCodec=function(){_.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},C.recoverMediaError=function(){_.logger.log("recoverMediaError");var h=this._media;this.detachMedia(),h&&this.attachMedia(h)},C.removeLevel=function(h,c){c===void 0&&(c=0),this.levelController.removeLevel(h,c)},w(f,[{key:"levels",get:function(){var h=this.levelController.levels;return h||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(h){_.logger.log("set currentLevel:"+h),this.loadLevel=h,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(h){_.logger.log("set nextLevel:"+h),this.levelController.manualLevel=h,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(h){_.logger.log("set loadLevel:"+h),this.levelController.manualLevel=h}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(h){this.levelController.nextLoadLevel=h}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(h){_.logger.log("set firstLevel:"+h),this.levelController.firstLevel=h}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(h){_.logger.log("set startLevel:"+h),h!==-1&&(h=Math.max(h,this.minAutoLevel)),this.levelController.startLevel=h}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(h){var c=!!h;c!==this.config.capLevelToPlayerSize&&(c?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=c)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(h){this._autoLevelCapping!==h&&(_.logger.log("set autoLevelCapping:"+h),this._autoLevelCapping=h)}},{key:"bandwidthEstimate",get:function(){var h=this.abrController.bwEstimator;return h?h.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var h=this.levels,c=this.config.minAutoBitrate;if(!h)return 0;for(var s=h.length,a=0;a<s;a++)if(h[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var h=this.levels,c=this.autoLevelCapping,s;return c===-1&&h&&h.length?s=h.length-1:s=c,s}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(h){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,h)}},{key:"audioTracks",get:function(){var h=this.audioTrackController;return h?h.audioTracks:[]}},{key:"audioTrack",get:function(){var h=this.audioTrackController;return h?h.audioTrack:-1},set:function(h){var c=this.audioTrackController;c&&(c.audioTrack=h)}},{key:"subtitleTracks",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTrack:-1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleTrack=h)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var h=this.subtitleTrackController;return h?h.subtitleDisplay:!1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=h)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(h){this.config.lowLatencyMode=h}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return u.ErrorTypes}},{key:"ErrorDetails",get:function(){return u.ErrorDetails}},{key:"DefaultConfig",get:function(){return f.defaultConfig?f.defaultConfig:x.hlsDefaultConfig},set:function(h){f.defaultConfig=h}}]),f}();p.defaultConfig=void 0},"./src/is-supported.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"isSupported",function(){return R}),L.d(G,"changeTypeSupported",function(){return B});var z=L("./src/utils/mediasource-helper.ts");function I(){return self.SourceBuffer||self.WebKitSourceBuffer}function R(){var U=Object(z.getMediaSource)();if(!U)return!1;var k=I(),A=U&&typeof U.isTypeSupported=="function"&&U.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),y=!k||k.prototype&&typeof k.prototype.appendBuffer=="function"&&typeof k.prototype.remove=="function";return!!A&&!!y}function B(){var U,k=I();return typeof(k==null||((U=k.prototype)===null||U===void 0)?void 0:U.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"default",function(){return _}),L.d(G,"LoadError",function(){return v});var z=L("./src/polyfills/number.ts"),I=L("./src/errors.ts");function R(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,y(d,o)}function B(d){var o=typeof Map=="function"?new Map:void 0;return B=function(l){if(l===null||!A(l))return l;if(typeof l!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(l))return o.get(l);o.set(l,w)}function w(){return U(l,arguments,S(this).constructor)}return w.prototype=Object.create(l.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),y(w,l)},B(d)}function U(d,o,u){return k()?U=Reflect.construct:U=function(w,p,f){var C=[null];C.push.apply(C,p);var b=Function.bind.apply(w,C),h=new b;return f&&y(h,f.prototype),h},U.apply(null,arguments)}function k(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function A(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function y(d,o){return y=Object.setPrototypeOf||function(l,w){return l.__proto__=w,l},y(d,o)}function S(d){return S=Object.setPrototypeOf?Object.getPrototypeOf:function(u){return u.__proto__||Object.getPrototypeOf(u)},S(d)}var O=Math.pow(2,17),_=function(){function d(u){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=u}var o=d.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(l,w){var p=this,f=l.url;if(!f)return Promise.reject(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,networkDetails:null},"Fragment does not have a "+(f?"part list":"url")));this.abort();var C=this.config,b=C.fLoader,h=C.loader;return new Promise(function(c,s){p.loader&&p.loader.destroy();var a=p.loader=l.loader=b?new b(C):new h(C),g=x(l),m={timeout:C.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:C.fragLoadingMaxRetryTimeout,highWaterMark:O};l.stats=a.stats,a.load(g,m,{onSuccess:function(M,F,j,W){p.resetLoader(l,a),c({frag:l,part:null,payload:M.data,networkDetails:W})},onError:function(M,F,j){p.resetLoader(l,a),s(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,response:M,networkDetails:j}))},onAbort:function(M,F,j){p.resetLoader(l,a),s(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,networkDetails:j}))},onTimeout:function(M,F,j){p.resetLoader(l,a),s(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,networkDetails:j}))},onProgress:function(M,F,j,W){w&&w({frag:l,part:null,payload:j,networkDetails:W})}})})},o.loadPart=function(l,w,p){var f=this;this.abort();var C=this.config,b=C.fLoader,h=C.loader;return new Promise(function(c,s){f.loader&&f.loader.destroy();var a=f.loader=l.loader=b?new b(C):new h(C),g=x(l,w),m={timeout:C.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:C.fragLoadingMaxRetryTimeout,highWaterMark:O};w.stats=a.stats,a.load(g,m,{onSuccess:function(M,F,j,W){f.resetLoader(l,a),f.updateStatsFromPart(l,w);var D={frag:l,part:w,payload:M.data,networkDetails:W};p(D),c(D)},onError:function(M,F,j){f.resetLoader(l,a),s(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,part:w,response:M,networkDetails:j}))},onAbort:function(M,F,j){l.stats.aborted=w.stats.aborted,f.resetLoader(l,a),s(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,part:w,networkDetails:j}))},onTimeout:function(M,F,j){f.resetLoader(l,a),s(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,part:w,networkDetails:j}))}})})},o.updateStatsFromPart=function(l,w){var p=l.stats,f=w.stats,C=f.total;if(p.loaded+=f.loaded,C){var b=Math.round(l.duration/w.duration),h=Math.min(Math.round(p.loaded/C),b),c=b-h,s=c*Math.round(p.loaded/h);p.total=p.loaded+s}else p.total=Math.max(p.loaded,p.total);var a=p.loading,g=f.loading;a.start?a.first+=g.first-g.start:(a.start=g.start,a.first=g.first),a.end=g.end},o.resetLoader=function(l,w){l.loader=null,this.loader===w&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),w.destroy()},d}();function x(d,o){o===void 0&&(o=null);var u=o||d,l={frag:d,part:o,responseType:"arraybuffer",url:u.url,headers:{},rangeStart:0,rangeEnd:0},w=u.byteRangeStartOffset,p=u.byteRangeEndOffset;return Object(z.isFiniteNumber)(w)&&Object(z.isFiniteNumber)(p)&&(l.rangeStart=w,l.rangeEnd=p),l}var v=function(d){R(o,d);function o(u){for(var l,w=arguments.length,p=new Array(w>1?w-1:0),f=1;f<w;f++)p[f-1]=arguments[f];return l=d.call.apply(d,[this].concat(p))||this,l.data=void 0,l.data=u,l}return o}(B(Error))},"./src/loader/fragment.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"ElementaryStreamTypes",function(){return _}),L.d(G,"BaseSegment",function(){return x}),L.d(G,"Fragment",function(){return v}),L.d(G,"Part",function(){return d});var z=L("./src/polyfills/number.ts"),I=L("./node_modules/url-toolkit/src/url-toolkit.js"),R=L.n(I),B=L("./src/utils/logger.ts"),U=L("./src/loader/level-key.ts"),k=L("./src/loader/load-stats.ts");function A(o,u){o.prototype=Object.create(u.prototype),o.prototype.constructor=o,y(o,u)}function y(o,u){return y=Object.setPrototypeOf||function(w,p){return w.__proto__=p,w},y(o,u)}function S(o,u){for(var l=0;l<u.length;l++){var w=u[l];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function O(o,u,l){return u&&S(o.prototype,u),l&&S(o,l),o}var _;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(_||(_={}));var x=function(){function o(l){var w;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(w={},w[_.AUDIO]=null,w[_.VIDEO]=null,w[_.AUDIOVIDEO]=null,w),this.baseurl=l}var u=o.prototype;return u.setByteRange=function(w,p){var f=w.split("@",2),C=[];f.length===1?C[0]=p?p.byteRangeEndOffset:0:C[0]=parseInt(f[1]),C[1]=parseInt(f[0])+C[0],this._byteRange=C},O(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(I.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(w){this._url=w}}]),o}(),v=function(o){A(u,o);function u(w,p){var f;return f=o.call(this,p)||this,f._decryptdata=null,f.rawProgramDateTime=null,f.programDateTime=null,f.tagList=[],f.duration=0,f.sn=0,f.levelkey=void 0,f.type=void 0,f.loader=null,f.level=-1,f.cc=0,f.startPTS=void 0,f.endPTS=void 0,f.appendedPTS=void 0,f.startDTS=void 0,f.endDTS=void 0,f.start=0,f.deltaPTS=void 0,f.maxStartPTS=void 0,f.minEndPTS=void 0,f.stats=new k.LoadStats,f.urlId=0,f.data=void 0,f.bitrateTest=!1,f.title=null,f.initSegment=null,f.type=w,f}var l=u.prototype;return l.createInitializationVector=function(p){for(var f=new Uint8Array(16),C=12;C<16;C++)f[C]=p>>8*(15-C)&255;return f},l.setDecryptDataFromLevelKey=function(p,f){var C=p;return(p==null?void 0:p.method)==="AES-128"&&p.uri&&!p.iv&&(C=U.LevelKey.fromURI(p.uri),C.method=p.method,C.iv=this.createInitializationVector(f),C.keyFormat="identity"),C},l.setElementaryStreamInfo=function(p,f,C,b,h,c){c===void 0&&(c=!1);var s=this.elementaryStreams,a=s[p];if(!a){s[p]={startPTS:f,endPTS:C,startDTS:b,endDTS:h,partial:c};return}a.startPTS=Math.min(a.startPTS,f),a.endPTS=Math.max(a.endPTS,C),a.startDTS=Math.min(a.startDTS,b),a.endDTS=Math.max(a.endDTS,h)},l.clearElementaryStreamInfo=function(){var p=this.elementaryStreams;p[_.AUDIO]=null,p[_.VIDEO]=null,p[_.AUDIOVIDEO]=null},O(u,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var p=this.sn;typeof p!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&B.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),p=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,p)}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 p=Object(z.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+p*1e3}},{key:"encrypted",get:function(){var p;return!!((p=this.decryptdata)!==null&&p!==void 0&&p.keyFormat&&this.decryptdata.uri)}}]),u}(x),d=function(o){A(u,o);function u(l,w,p,f,C){var b;b=o.call(this,p)||this,b.fragOffset=0,b.duration=0,b.gap=!1,b.independent=!1,b.relurl=void 0,b.fragment=void 0,b.index=void 0,b.stats=new k.LoadStats,b.duration=l.decimalFloatingPoint("DURATION"),b.gap=l.bool("GAP"),b.independent=l.bool("INDEPENDENT"),b.relurl=l.enumeratedString("URI"),b.fragment=w,b.index=f;var h=l.enumeratedString("BYTERANGE");return h&&b.setByteRange(h,C),C&&(b.fragOffset=C.fragOffset+C.duration),b}return O(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 w=this.elementaryStreams;return!!(w.audio||w.video||w.audiovideo)}}]),u}(x)},"./src/loader/key-loader.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"default",function(){return B});var z=L("./src/events.ts"),I=L("./src/errors.ts"),R=L("./src/utils/logger.ts"),B=function(){function U(A){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=A,this._registerListeners()}var k=U.prototype;return k._registerListeners=function(){this.hls.on(z.Events.KEY_LOADING,this.onKeyLoading,this)},k._unregisterListeners=function(){this.hls.off(z.Events.KEY_LOADING,this.onKeyLoading)},k.destroy=function(){this._unregisterListeners();for(var y in this.loaders){var S=this.loaders[y];S&&S.destroy()}this.loaders={}},k.onKeyLoading=function(y,S){var O=S.frag,_=O.type,x=this.loaders[_];if(!O.decryptdata){R.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var v=O.decryptdata.uri;if(v!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(x&&(R.logger.warn("abort previous key loader for type:"+_),x.abort()),!v){R.logger.warn("key uri is falsy");return}var o=d.loader,u=O.loader=this.loaders[_]=new o(d);this.decrypturl=v,this.decryptkey=null;var l={url:v,frag:O,responseType:"arraybuffer"},w={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(l,w,p)}else this.decryptkey&&(O.decryptdata.key=this.decryptkey,this.hls.trigger(z.Events.KEY_LOADED,{frag:O}))},k.loadsuccess=function(y,S,O){var _=O.frag;if(!_.decryptdata){R.logger.error("after key load, decryptdata unset");return}this.decryptkey=_.decryptdata.key=new Uint8Array(y.data),_.loader=null,delete this.loaders[_.type],this.hls.trigger(z.Events.KEY_LOADED,{frag:_})},k.loaderror=function(y,S){var O=S.frag,_=O.loader;_&&_.abort(),delete this.loaders[O.type],this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:O,response:y})},k.loadtimeout=function(y,S){var O=S.frag,_=O.loader;_&&_.abort(),delete this.loaders[O.type],this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:O})},U}()},"./src/loader/level-details.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"LevelDetails",function(){return U});var z=L("./src/polyfills/number.ts");function I(k,A){for(var y=0;y<A.length;y++){var S=A[y];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(k,S.key,S)}}function R(k,A,y){return A&&I(k.prototype,A),y&&I(k,y),k}var B=10,U=function(){function k(y){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=y}var A=k.prototype;return A.reloaded=function(S){if(!S){this.advanced=!0,this.updated=!0;return}var O=this.lastPartSn-S.lastPartSn,_=this.lastPartIndex-S.lastPartIndex;this.updated=this.endSN!==S.endSN||!!_||!!O,this.advanced=this.endSN>S.endSN||O>0||O===0&&_>0,this.updated||this.advanced?this.misses=Math.floor(S.misses*.6):this.misses=S.misses+1,this.availabilityDelay=S.availabilityDelay},R(k,[{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||B}},{key:"drift",get:function(){var S=this.driftEndTime-this.driftStartTime;if(S>0){var O=this.driftEnd-this.driftStart;return O*1e3/S}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var S;return(S=this.fragments)!==null&&S!==void 0&&S.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),k}()},"./src/loader/level-key.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"LevelKey",function(){return U});var z=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(z);function R(k,A){for(var y=0;y<A.length;y++){var S=A[y];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(k,S.key,S)}}function B(k,A,y){return A&&R(k.prototype,A),y&&R(k,y),k}var U=function(){k.fromURL=function(y,S){return new k(y,S)},k.fromURI=function(y){return new k(y)};function k(A,y){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,y?this._uri=Object(z.buildAbsoluteURL)(A,y,{alwaysNormalize:!0}):this._uri=A}return B(k,[{key:"uri",get:function(){return this._uri}}]),k}()},"./src/loader/load-stats.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"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,G,L){"use strict";L.r(G),L.d(G,"default",function(){return u});var z=L("./src/polyfills/number.ts"),I=L("./node_modules/url-toolkit/src/url-toolkit.js"),R=L.n(I),B=L("./src/loader/fragment.ts"),U=L("./src/loader/level-details.ts"),k=L("./src/loader/level-key.ts"),A=L("./src/utils/attr-list.ts"),y=L("./src/utils/logger.ts"),S=L("./src/utils/codecs.ts"),O=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,_=/#EXT-X-MEDIA:(.*)/g,x=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),v=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),d=/\.(mp4|m4s|m4v|m4a)$/i;function o(C){var b,h;return d.test((b=(h=I.parseURL(C))===null||h===void 0?void 0:h.path)!=null?b:"")}var u=function(){function C(){}return C.findGroup=function(h,c){for(var s=0;s<h.length;s++){var a=h[s];if(a.id===c)return a}},C.convertAVC1ToAVCOTI=function(h){var c=h.split(".");if(c.length>2){var s=c.shift()+".";return s+=parseInt(c.shift()).toString(16),s+=("000"+parseInt(c.shift()).toString(16)).substr(-4),s}return h},C.resolve=function(h,c){return I.buildAbsoluteURL(c,h,{alwaysNormalize:!0})},C.parseMasterPlaylist=function(h,c){var s=[],a={},g=!1;O.lastIndex=0;for(var m;(m=O.exec(h))!=null;)if(m[1]){var E=new A.AttrList(m[1]),M={attrs:E,bitrate:E.decimalInteger("AVERAGE-BANDWIDTH")||E.decimalInteger("BANDWIDTH"),name:E.NAME,url:C.resolve(m[2],c)},F=E.decimalResolution("RESOLUTION");F&&(M.width=F.width,M.height=F.height),l((E.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=C.convertAVC1ToAVCOTI(M.videoCodec)),s.push(M)}else if(m[3]){var j=new A.AttrList(m[3]);j["DATA-ID"]&&(g=!0,a[j["DATA-ID"]]=j)}return{levels:s,sessionData:g?a:null}},C.parseMasterPlaylistMedia=function(h,c,s,a){a===void 0&&(a=[]);var g,m=[],E=0;for(_.lastIndex=0;(g=_.exec(h))!==null;){var M=new A.AttrList(g[1]);if(M.TYPE===s){var F={attrs:M,bitrate:0,id:E++,groupId:M["GROUP-ID"],instreamId:M["INSTREAM-ID"],name:M.NAME||M.LANGUAGE||"",type:s,default:M.bool("DEFAULT"),autoselect:M.bool("AUTOSELECT"),forced:M.bool("FORCED"),lang:M.LANGUAGE,url:M.URI?C.resolve(M.URI,c):""};if(a.length){var j=C.findGroup(a,F.groupId)||a[0];w(F,j,"audioCodec"),w(F,j,"textCodec")}m.push(F)}}return m},C.parseLevelPlaylist=function(h,c,s,a,g){var m=new U.LevelDetails(c),E=m.fragments,M=null,F=0,j=0,W=0,D=0,P=null,H=new B.Fragment(a,c),Y,ee,oe,Te=-1,ye=!1;for(x.lastIndex=0,m.m3u8=h;(Y=x.exec(h))!==null;){ye&&(ye=!1,H=new B.Fragment(a,c),H.start=W,H.sn=F,H.cc=D,H.level=s,M&&(H.initSegment=M,H.rawProgramDateTime=M.rawProgramDateTime));var he=Y[1];if(he){H.duration=parseFloat(he);var le=(" "+Y[2]).slice(1);H.title=le||null,H.tagList.push(le?["INF",he,le]:["INF",he])}else if(Y[3])Object(z.isFiniteNumber)(H.duration)&&(H.start=W,oe&&(H.levelkey=oe),H.sn=F,H.level=s,H.cc=D,H.urlId=g,E.push(H),H.relurl=(" "+Y[3]).slice(1),f(H,P),P=H,W+=H.duration,F++,j=0,ye=!0);else if(Y[4]){var me=(" "+Y[4]).slice(1);P?H.setByteRange(me,P):H.setByteRange(me)}else if(Y[5])H.rawProgramDateTime=(" "+Y[5]).slice(1),H.tagList.push(["PROGRAM-DATE-TIME",H.rawProgramDateTime]),Te===-1&&(Te=E.length);else{if(Y=Y[0].match(v),!Y){y.logger.warn("No matches on slow regex match for level playlist!");continue}for(ee=1;ee<Y.length&&!(typeof Y[ee]!="undefined");ee++);var ie=(" "+Y[ee]).slice(1),pe=(" "+Y[ee+1]).slice(1),J=Y[ee+2]?(" "+Y[ee+2]).slice(1):"";switch(ie){case"PLAYLIST-TYPE":m.type=pe.toUpperCase();break;case"MEDIA-SEQUENCE":F=m.startSN=parseInt(pe);break;case"SKIP":{var ne=new A.AttrList(pe),q=ne.decimalInteger("SKIPPED-SEGMENTS");if(Object(z.isFiniteNumber)(q)){m.skippedSegments=q;for(var xe=q;xe--;)E.unshift(null);F+=q}var Ce=ne.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ce&&(m.recentlyRemovedDateranges=Ce.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(pe);break;case"VERSION":m.version=parseInt(pe);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(pe||J)&&H.tagList.push(J?[pe,J]:[pe]);break;case"DIS":D++;case"GAP":H.tagList.push([ie]);break;case"BITRATE":H.tagList.push([ie,pe]);break;case"DISCONTINUITY-SEQ":D=parseInt(pe);break;case"KEY":{var be,ge=new A.AttrList(pe),Se=ge.enumeratedString("METHOD"),Le=ge.URI,Me=ge.hexadecimalInteger("IV"),_e=ge.enumeratedString("KEYFORMATVERSIONS"),Ae=ge.enumeratedString("KEYID"),je=(be=ge.enumeratedString("KEYFORMAT"))!=null?be:"identity",ze=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(ze.indexOf(je)>-1){y.logger.warn("Keyformat "+je+" is not supported from the manifest");continue}else if(je!=="identity")continue;Se&&(oe=k.LevelKey.fromURL(c,Le),Le&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Se)>=0&&(oe.method=Se,oe.keyFormat=je,Ae&&(oe.keyID=Ae),_e&&(oe.keyFormatVersions=_e),oe.iv=Me));break}case"START":{var Ne=new A.AttrList(pe),We=Ne.decimalFloatingPoint("TIME-OFFSET");Object(z.isFiniteNumber)(We)&&(m.startTimeOffset=We);break}case"MAP":{var et=new A.AttrList(pe);H.relurl=et.URI,et.BYTERANGE&&H.setByteRange(et.BYTERANGE),H.level=s,H.sn="initSegment",oe&&(H.levelkey=oe),H.initSegment=null,M=H,ye=!0;break}case"SERVER-CONTROL":{var Xe=new A.AttrList(pe);m.canBlockReload=Xe.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=Xe.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&Xe.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=Xe.optionalFloat("PART-HOLD-BACK",0),m.holdBack=Xe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ye=new A.AttrList(pe);m.partTarget=Ye.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Oe=m.partList;Oe||(Oe=m.partList=[]);var tt=j>0?Oe[Oe.length-1]:void 0,$e=j++,Pe=new B.Part(new A.AttrList(pe),H,c,$e,tt);Oe.push(Pe),H.duration+=Pe.duration;break}case"PRELOAD-HINT":{var Fe=new A.AttrList(pe);m.preloadHint=Fe;break}case"RENDITION-REPORT":{var ve=new A.AttrList(pe);m.renditionReports=m.renditionReports||[],m.renditionReports.push(ve);break}default:y.logger.warn("line parsed but not handled: "+Y);break}}}P&&!P.relurl?(E.pop(),W-=P.duration,m.partList&&(m.fragmentHint=P)):m.partList&&(f(H,P),H.cc=D,m.fragmentHint=H);var de=E.length,ce=E[0],X=E[de-1];if(W+=m.skippedSegments*m.targetduration,W>0&&de&&X){m.averagetargetduration=W/de;var Q=X.sn;m.endSN=Q!=="initSegment"?Q:0,ce&&(m.startCC=ce.cc,ce.initSegment||m.fragments.every(function(te){return te.relurl&&o(te.relurl)})&&(y.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),H=new B.Fragment(a,c),H.relurl=X.relurl,H.level=s,H.sn="initSegment",ce.initSegment=H,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(W+=m.fragmentHint.duration),m.totalduration=W,m.endCC=D,Te>0&&p(E,Te),m},C}();function l(C,b){["video","audio","text"].forEach(function(h){var c=C.filter(function(a){return Object(S.isCodecType)(a,h)});if(c.length){var s=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});b[h+"Codec"]=s.length>0?s[0]:c[0],C=C.filter(function(a){return c.indexOf(a)===-1})}}),b.unknownCodecs=C}function w(C,b,h){var c=b[h];c&&(C[h]=c)}function p(C,b){for(var h=C[b],c=b;c--;){var s=C[c];if(!s)return;s.programDateTime=h.programDateTime-s.duration*1e3,h=s}}function f(C,b){C.rawProgramDateTime?C.programDateTime=Date.parse(C.rawProgramDateTime):b!=null&&b.programDateTime&&(C.programDateTime=b.endProgramDateTime),Object(z.isFiniteNumber)(C.programDateTime)||(C.programDateTime=null,C.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(re,G,L){"use strict";L.r(G);var z=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),R=L("./src/errors.ts"),B=L("./src/utils/logger.ts"),U=L("./src/utils/mp4-tools.ts"),k=L("./src/loader/m3u8-parser.ts"),A=L("./src/types/loader.ts"),y=L("./src/utils/attr-list.ts");function S(x){var v=x.type;switch(v){case A.PlaylistContextType.AUDIO_TRACK:return A.PlaylistLevelType.AUDIO;case A.PlaylistContextType.SUBTITLE_TRACK:return A.PlaylistLevelType.SUBTITLE;default:return A.PlaylistLevelType.MAIN}}function O(x,v){var d=x.url;return(d===void 0||d.indexOf("data:")===0)&&(d=v.url),d}var _=function(){function x(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var v=x.prototype;return v.registerListeners=function(){var o=this.hls;o.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},v.unregisterListeners=function(){var o=this.hls;o.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(I.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},v.createInternalLoader=function(o){var u=this.hls.config,l=u.pLoader,w=u.loader,p=l||w,f=new p(u);return o.loader=f,this.loaders[o.type]=f,f},v.getInternalLoader=function(o){return this.loaders[o.type]},v.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},v.destroyInternalLoaders=function(){for(var o in this.loaders){var u=this.loaders[o];u&&u.destroy(),this.resetInternalLoader(o)}},v.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},v.onManifestLoading=function(o,u){var l=u.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:A.PlaylistContextType.MANIFEST,url:l,deliveryDirectives:null})},v.onLevelLoading=function(o,u){var l=u.id,w=u.level,p=u.url,f=u.deliveryDirectives;this.load({id:l,groupId:null,level:w,responseType:"text",type:A.PlaylistContextType.LEVEL,url:p,deliveryDirectives:f})},v.onAudioTrackLoading=function(o,u){var l=u.id,w=u.groupId,p=u.url,f=u.deliveryDirectives;this.load({id:l,groupId:w,level:null,responseType:"text",type:A.PlaylistContextType.AUDIO_TRACK,url:p,deliveryDirectives:f})},v.onSubtitleTrackLoading=function(o,u){var l=u.id,w=u.groupId,p=u.url,f=u.deliveryDirectives;this.load({id:l,groupId:w,level:null,responseType:"text",type:A.PlaylistContextType.SUBTITLE_TRACK,url:p,deliveryDirectives:f})},v.load=function(o){var u,l=this.hls.config,w=this.getInternalLoader(o);if(w){var p=w.context;if(p&&p.url===o.url){B.logger.trace("[playlist-loader]: playlist request ongoing");return}B.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),w.abort()}var f,C,b,h;switch(o.type){case A.PlaylistContextType.MANIFEST:f=l.manifestLoadingMaxRetry,C=l.manifestLoadingTimeOut,b=l.manifestLoadingRetryDelay,h=l.manifestLoadingMaxRetryTimeout;break;case A.PlaylistContextType.LEVEL:case A.PlaylistContextType.AUDIO_TRACK:case A.PlaylistContextType.SUBTITLE_TRACK:f=0,C=l.levelLoadingTimeOut;break;default:f=l.levelLoadingMaxRetry,C=l.levelLoadingTimeOut,b=l.levelLoadingRetryDelay,h=l.levelLoadingMaxRetryTimeout;break}if(w=this.createInternalLoader(o),(u=o.deliveryDirectives)!==null&&u!==void 0&&u.part){var c;if(o.type===A.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===A.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===A.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var s=c.partTarget,a=c.targetduration;s&&a&&(C=Math.min(Math.max(s*3,a*.8)*1e3,C))}}var g={timeout:C,maxRetry:f,retryDelay:b,maxRetryDelay:h,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};w.load(o,g,m)},v.loadsuccess=function(o,u,l,w){if(w===void 0&&(w=null),l.isSidxRequest){this.handleSidxRequest(o,l),this.handlePlaylistLoaded(o,u,l,w);return}this.resetInternalLoader(l.type);var p=o.data;if(p.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,l,"no EXTM3U delimiter",w);return}u.parsing.start=performance.now(),p.indexOf("#EXTINF:")>0||p.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,u,l,w):this.handleMasterPlaylist(o,u,l,w)},v.loaderror=function(o,u,l){l===void 0&&(l=null),this.handleNetworkError(u,l,!1,o)},v.loadtimeout=function(o,u,l){l===void 0&&(l=null),this.handleNetworkError(u,l,!0)},v.handleMasterPlaylist=function(o,u,l,w){var p=this.hls,f=o.data,C=O(o,l),b=k.default.parseMasterPlaylist(f,C),h=b.levels,c=b.sessionData;if(!h.length){this.handleManifestParsingError(o,l,"no level found in manifest",w);return}var s=h.map(function(F){return{id:F.attrs.AUDIO,audioCodec:F.audioCodec}}),a=h.map(function(F){return{id:F.attrs.SUBTITLES,textCodec:F.textCodec}}),g=k.default.parseMasterPlaylistMedia(f,C,"AUDIO",s),m=k.default.parseMasterPlaylistMedia(f,C,"SUBTITLES",a),E=k.default.parseMasterPlaylistMedia(f,C,"CLOSED-CAPTIONS");if(g.length){var M=g.some(function(F){return!F.url});!M&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(B.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new y.AttrList({}),bitrate:0,url:""}))}p.trigger(I.Events.MANIFEST_LOADED,{levels:h,audioTracks:g,subtitles:m,captions:E,url:C,stats:u,networkDetails:w,sessionData:c})},v.handleTrackOrLevelPlaylist=function(o,u,l,w){var p=this.hls,f=l.id,C=l.level,b=l.type,h=O(o,l),c=Object(z.isFiniteNumber)(f)?f:0,s=Object(z.isFiniteNumber)(C)?C:c,a=S(l),g=k.default.parseLevelPlaylist(o.data,h,s,a,c);if(!g.fragments.length){p.trigger(I.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:h,reason:"no fragments found in level",level:typeof l.level=="number"?l.level:void 0});return}if(b===A.PlaylistContextType.MANIFEST){var m={attrs:new y.AttrList({}),bitrate:0,details:g,name:"",url:h};p.trigger(I.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:h,stats:u,networkDetails:w,sessionData:null})}if(u.parsing.end=performance.now(),g.needSidxRanges){var E,M=(E=g.fragments[0].initSegment)===null||E===void 0?void 0:E.url;this.load({url:M,isSidxRequest:!0,type:b,level:C,levelDetails:g,id:f,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}l.levelDetails=g,this.handlePlaylistLoaded(o,u,l,w)},v.handleSidxRequest=function(o,u){var l=Object(U.parseSegmentIndex)(new Uint8Array(o.data));if(!l)return;var w=l.references,p=u.levelDetails;w.forEach(function(f,C){var b=f.info,h=p.fragments[C];h.byteRange.length===0&&h.setByteRange(String(1+b.end-b.start)+"@"+String(b.start)),h.initSegment&&h.initSegment.setByteRange(String(l.moovEndOffset)+"@0")})},v.handleManifestParsingError=function(o,u,l,w){this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:u.type===A.PlaylistContextType.MANIFEST,url:o.url,reason:l,response:o,context:u,networkDetails:w})},v.handleNetworkError=function(o,u,l,w){l===void 0&&(l=!1),B.logger.warn("[playlist-loader]: A network "+(l?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var p=R.ErrorDetails.UNKNOWN,f=!1,C=this.getInternalLoader(o);switch(o.type){case A.PlaylistContextType.MANIFEST:p=l?R.ErrorDetails.MANIFEST_LOAD_TIMEOUT:R.ErrorDetails.MANIFEST_LOAD_ERROR,f=!0;break;case A.PlaylistContextType.LEVEL:p=l?R.ErrorDetails.LEVEL_LOAD_TIMEOUT:R.ErrorDetails.LEVEL_LOAD_ERROR,f=!1;break;case A.PlaylistContextType.AUDIO_TRACK:p=l?R.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:R.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,f=!1;break;case A.PlaylistContextType.SUBTITLE_TRACK:p=l?R.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:R.ErrorDetails.SUBTITLE_LOAD_ERROR,f=!1;break}C&&this.resetInternalLoader(o.type);var b={type:R.ErrorTypes.NETWORK_ERROR,details:p,fatal:f,url:o.url,loader:C,context:o,networkDetails:u};w&&(b.response=w),this.hls.trigger(I.Events.ERROR,b)},v.handlePlaylistLoaded=function(o,u,l,w){var p=l.type,f=l.level,C=l.id,b=l.groupId,h=l.loader,c=l.levelDetails,s=l.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,l,"invalid target duration",w);return}if(!h)return;c.live&&(h.getCacheAge&&(c.ageHeader=h.getCacheAge()||0),(!h.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(p){case A.PlaylistContextType.MANIFEST:case A.PlaylistContextType.LEVEL:this.hls.trigger(I.Events.LEVEL_LOADED,{details:c,level:f||0,id:C||0,stats:u,networkDetails:w,deliveryDirectives:s});break;case A.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(I.Events.AUDIO_TRACK_LOADED,{details:c,id:C||0,groupId:b||"",stats:u,networkDetails:w,deliveryDirectives:s});break;case A.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADED,{details:c,id:C||0,groupId:b||"",stats:u,networkDetails:w,deliveryDirectives:s});break}},x}();G.default=_},"./src/polyfills/number.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"isFiniteNumber",function(){return z}),L.d(G,"MAX_SAFE_INTEGER",function(){return I});var z=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},I=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(re,G,L){"use strict";L.r(G);var z=function(){function I(){}return I.getSilentFrame=function(B,U){switch(B){case"mp4a.40.2":if(U===1)return new Uint8Array([0,200,0,128,35,128]);if(U===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(U===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(U===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(U===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(U===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(U===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(U===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(U===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},I}();G.default=z},"./src/remux/mp4-generator.ts":function(re,G,L){"use strict";L.r(G);var z=Math.pow(2,32)-1,I=function(){function R(){}return R.init=function(){R.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var U;for(U in R.types)R.types.hasOwnProperty(U)&&(R.types[U]=[U.charCodeAt(0),U.charCodeAt(1),U.charCodeAt(2),U.charCodeAt(3)]);var k=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),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]);R.HDLR_TYPES={video:k,audio:A};var y=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),S=new Uint8Array([0,0,0,0,0,0,0,0]);R.STTS=R.STSC=R.STCO=S,R.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),R.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),R.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),R.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var O=new Uint8Array([105,115,111,109]),_=new Uint8Array([97,118,99,49]),x=new Uint8Array([0,0,0,1]);R.FTYP=R.box(R.types.ftyp,O,x,O,_),R.DINF=R.box(R.types.dinf,R.box(R.types.dref,y))},R.box=function(U){for(var k=8,A=arguments.length,y=new Array(A>1?A-1:0),S=1;S<A;S++)y[S-1]=arguments[S];for(var O=y.length,_=O;O--;)k+=y[O].byteLength;var x=new Uint8Array(k);for(x[0]=k>>24&255,x[1]=k>>16&255,x[2]=k>>8&255,x[3]=k&255,x.set(U,4),O=0,k=8;O<_;O++)x.set(y[O],k),k+=y[O].byteLength;return x},R.hdlr=function(U){return R.box(R.types.hdlr,R.HDLR_TYPES[U])},R.mdat=function(U){return R.box(R.types.mdat,U)},R.mdhd=function(U,k){k*=U;var A=Math.floor(k/(z+1)),y=Math.floor(k%(z+1));return R.box(R.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,A>>24,A>>16&255,A>>8&255,A&255,y>>24,y>>16&255,y>>8&255,y&255,85,196,0,0]))},R.mdia=function(U){return R.box(R.types.mdia,R.mdhd(U.timescale,U.duration),R.hdlr(U.type),R.minf(U))},R.mfhd=function(U){return R.box(R.types.mfhd,new Uint8Array([0,0,0,0,U>>24,U>>16&255,U>>8&255,U&255]))},R.minf=function(U){return U.type==="audio"?R.box(R.types.minf,R.box(R.types.smhd,R.SMHD),R.DINF,R.stbl(U)):R.box(R.types.minf,R.box(R.types.vmhd,R.VMHD),R.DINF,R.stbl(U))},R.moof=function(U,k,A){return R.box(R.types.moof,R.mfhd(U),R.traf(A,k))},R.moov=function(U){for(var k=U.length,A=[];k--;)A[k]=R.trak(U[k]);return R.box.apply(null,[R.types.moov,R.mvhd(U[0].timescale,U[0].duration)].concat(A).concat(R.mvex(U)))},R.mvex=function(U){for(var k=U.length,A=[];k--;)A[k]=R.trex(U[k]);return R.box.apply(null,[R.types.mvex].concat(A))},R.mvhd=function(U,k){k*=U;var A=Math.floor(k/(z+1)),y=Math.floor(k%(z+1)),S=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,A>>24,A>>16&255,A>>8&255,A&255,y>>24,y>>16&255,y>>8&255,y&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return R.box(R.types.mvhd,S)},R.sdtp=function(U){var k=U.samples||[],A=new Uint8Array(4+k.length),y,S;for(y=0;y<k.length;y++)S=k[y].flags,A[y+4]=S.dependsOn<<4|S.isDependedOn<<2|S.hasRedundancy;return R.box(R.types.sdtp,A)},R.stbl=function(U){return R.box(R.types.stbl,R.stsd(U),R.box(R.types.stts,R.STTS),R.box(R.types.stsc,R.STSC),R.box(R.types.stsz,R.STSZ),R.box(R.types.stco,R.STCO))},R.avc1=function(U){var k=[],A=[],y,S,O;for(y=0;y<U.sps.length;y++)S=U.sps[y],O=S.byteLength,k.push(O>>>8&255),k.push(O&255),k=k.concat(Array.prototype.slice.call(S));for(y=0;y<U.pps.length;y++)S=U.pps[y],O=S.byteLength,A.push(O>>>8&255),A.push(O&255),A=A.concat(Array.prototype.slice.call(S));var _=R.box(R.types.avcC,new Uint8Array([1,k[3],k[4],k[5],252|3,224|U.sps.length].concat(k).concat([U.pps.length]).concat(A))),x=U.width,v=U.height,d=U.pixelRatio[0],o=U.pixelRatio[1];return R.box(R.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,x>>8&255,x&255,v>>8&255,v&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]),_,R.box(R.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),R.box(R.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,o>>24,o>>16&255,o>>8&255,o&255])))},R.esds=function(U){var k=U.config.length;return new Uint8Array([0,0,0,0,3,23+k,0,1,0,4,15+k,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([k]).concat(U.config).concat([6,1,2]))},R.mp4a=function(U){var k=U.samplerate;return R.box(R.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]),R.box(R.types.esds,R.esds(U)))},R.mp3=function(U){var k=U.samplerate;return R.box(R.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]))},R.stsd=function(U){return U.type==="audio"?!U.isAAC&&U.codec==="mp3"?R.box(R.types.stsd,R.STSD,R.mp3(U)):R.box(R.types.stsd,R.STSD,R.mp4a(U)):R.box(R.types.stsd,R.STSD,R.avc1(U))},R.tkhd=function(U){var k=U.id,A=U.duration*U.timescale,y=U.width,S=U.height,O=Math.floor(A/(z+1)),_=Math.floor(A%(z+1));return R.box(R.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,_>>24,_>>16&255,_>>8&255,_&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,y>>8&255,y&255,0,0,S>>8&255,S&255,0,0]))},R.traf=function(U,k){var A=R.sdtp(U),y=U.id,S=Math.floor(k/(z+1)),O=Math.floor(k%(z+1));return R.box(R.types.traf,R.box(R.types.tfhd,new Uint8Array([0,0,0,0,y>>24,y>>16&255,y>>8&255,y&255])),R.box(R.types.tfdt,new Uint8Array([1,0,0,0,S>>24,S>>16&255,S>>8&255,S&255,O>>24,O>>16&255,O>>8&255,O&255])),R.trun(U,A.length+16+20+8+16+8+8),A)},R.trak=function(U){return U.duration=U.duration||4294967295,R.box(R.types.trak,R.tkhd(U),R.mdia(U))},R.trex=function(U){var k=U.id;return R.box(R.types.trex,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},R.trun=function(U,k){var A=U.samples||[],y=A.length,S=12+16*y,O=new Uint8Array(S),_,x,v,d,o,u;for(k+=8+S,O.set([0,0,15,1,y>>>24&255,y>>>16&255,y>>>8&255,y&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255],0),_=0;_<y;_++)x=A[_],v=x.duration,d=x.size,o=x.flags,u=x.cts,O.set([v>>>24&255,v>>>16&255,v>>>8&255,v&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*_);return R.box(R.types.trun,O)},R.initSegment=function(U){R.types||R.init();var k=R.moov(U),A=new Uint8Array(R.FTYP.byteLength+k.byteLength);return A.set(R.FTYP),A.set(k,R.FTYP.byteLength),A},R}();I.types=void 0,I.HDLR_TYPES=void 0,I.STTS=void 0,I.STSC=void 0,I.STCO=void 0,I.STSZ=void 0,I.VMHD=void 0,I.SMHD=void 0,I.STSD=void 0,I.FTYP=void 0,I.DINF=void 0,G.default=I},"./src/remux/mp4-remuxer.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"default",function(){return u}),L.d(G,"normalizePts",function(){return l});var z=L("./src/polyfills/number.ts"),I=L("./src/remux/aac-helper.ts"),R=L("./src/remux/mp4-generator.ts"),B=L("./src/events.ts"),U=L("./src/errors.ts"),k=L("./src/utils/logger.ts"),A=L("./src/types/loader.ts"),y=L("./src/utils/timescale-conversion.ts");function S(){return S=Object.assign||function(C){for(var b=1;b<arguments.length;b++){var h=arguments[b];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(C[c]=h[c])}return C},S.apply(this,arguments)}var O=10*1e3,_=1024,x=1152,v=null,d=null,o=!1,u=function(){function C(h,c,s,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=h,this.config=c,this.typeSupported=s,this.ISGenerated=!1,v===null){var g=navigator.userAgent||"",m=g.match(/Chrome\/(\d+)/i);v=m?parseInt(m[1]):0}if(d===null){var E=navigator.userAgent.match(/Safari\/(\d+)/i);d=E?parseInt(E[1]):0}o=!!v&&v<75||!!d&&d<600}var b=C.prototype;return b.destroy=function(){},b.resetTimeStamp=function(c){k.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},b.resetNextTimestamp=function(){k.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},b.resetInitSegment=function(){k.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},b.getVideoStartPts=function(c){var s=!1,a=c.reduce(function(g,m){var E=m.pts-g;return E<-4294967296?(s=!0,l(g,m.pts)):E>0?g:m.pts},c[0].pts);return s&&k.logger.debug("PTS rollover detected"),a},b.remux=function(c,s,a,g,m,E,M,F){var j,W,D,P,H,Y,ee=m,oe=m,Te=c.pid>-1,ye=s.pid>-1,he=s.samples.length,le=c.samples.length>0,me=he>1,ie=(!Te||le)&&(!ye||me)||this.ISGenerated||M;if(ie){this.ISGenerated||(D=this.generateIS(c,s,m));var pe=this.isVideoContiguous,J=-1;if(me&&(J=w(s.samples),!pe&&this.config.forceKeyFrameOnDiscontinuity))if(Y=!0,J>0){k.logger.warn("[mp4-remuxer]: Dropped "+J+" out of "+he+" video samples due to a missing keyframe");var ne=this.getVideoStartPts(s.samples);s.samples=s.samples.slice(J),s.dropped+=J,oe+=(s.samples[0].pts-ne)/(s.timescale||9e4)}else J===-1&&(k.logger.warn("[mp4-remuxer]: No keyframe found out of "+he+" video samples"),Y=!1);if(this.ISGenerated){if(le&&me){var q=this.getVideoStartPts(s.samples),xe=l(c.samples[0].pts,q)-q,Ce=xe/s.inputTimeScale;ee+=Math.max(0,Ce),oe+=Math.max(0,-Ce)}if(le){if(c.samplerate||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),D=this.generateIS(c,s,m)),W=this.remuxAudio(c,ee,this.isAudioContiguous,E,ye||me||F===A.PlaylistLevelType.AUDIO?oe:void 0),me){var be=W?W.endPTS-W.startPTS:0;s.inputTimeScale||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),D=this.generateIS(c,s,m)),j=this.remuxVideo(s,oe,pe,be)}}else me&&(j=this.remuxVideo(s,oe,pe,0));j&&(j.firstKeyFrame=J,j.independent=J!==-1)}}return this.ISGenerated&&(a.samples.length&&(H=this.remuxID3(a,m)),g.samples.length&&(P=this.remuxText(g,m))),{audio:W,video:j,initSegment:D,independent:Y,text:P,id3:H}},b.generateIS=function(c,s,a){var g=c.samples,m=s.samples,E=this.typeSupported,M={},F=!Object(z.isFiniteNumber)(this._initPTS),j="audio/mp4",W,D,P;if(F&&(W=D=Infinity),c.config&&g.length&&(c.timescale=c.samplerate,c.isAAC||(E.mpeg?(j="audio/mpeg",c.codec=""):E.mp3&&(c.codec="mp3")),M.audio={id:"audio",container:j,codec:c.codec,initSegment:!c.isAAC&&E.mpeg?new Uint8Array(0):R.default.initSegment([c]),metadata:{channelCount:c.channelCount}},F&&(P=c.inputTimeScale,W=D=g[0].pts-Math.round(P*a))),s.sps&&s.pps&&m.length&&(s.timescale=s.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:s.codec,initSegment:R.default.initSegment([s]),metadata:{width:s.width,height:s.height}},F)){P=s.inputTimeScale;var H=this.getVideoStartPts(m),Y=Math.round(P*a);D=Math.min(D,l(m[0].dts,H)-Y),W=Math.min(W,H-Y)}if(Object.keys(M).length)return this.ISGenerated=!0,F&&(this._initPTS=W,this._initDTS=D),{tracks:M,initPTS:W,timescale:P}},b.remuxVideo=function(c,s,a,g){var m=c.inputTimeScale,E=c.samples,M=[],F=E.length,j=this._initPTS,W=this.nextAvcDts,D=8,P,H,Y,ee=Number.POSITIVE_INFINITY,oe=Number.NEGATIVE_INFINITY,Te=0,ye=!1;if(!a||W===null){var he=s*m,le=E[0].pts-l(E[0].dts,E[0].pts);W=he-le}for(var me=0;me<F;me++){var ie=E[me];if(ie.pts=l(ie.pts-j,W),ie.dts=l(ie.dts-j,W),ie.dts>ie.pts){var pe=9e4*.2;Te=Math.max(Math.min(Te,ie.pts-ie.dts),-1*pe)}ie.dts<E[me>0?me-1:me].dts&&(ye=!0)}ye&&E.sort(function(mt,dt){var st=mt.dts-dt.dts,_t=mt.pts-dt.pts;return st||_t}),H=E[0].dts,Y=E[E.length-1].dts;var J=Math.round((Y-H)/(F-1));if(Te<0){if(Te<J*-2){k.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(y.toMsFromMpegTsClock)(-J,!0)+" ms");for(var ne=Te,q=0;q<F;q++)E[q].dts=ne=Math.max(ne,E[q].pts-J),E[q].pts=Math.max(ne,E[q].pts)}else{k.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(y.toMsFromMpegTsClock)(Te,!0)+" ms to overcome this issue");for(var xe=0;xe<F;xe++)E[xe].dts=E[xe].dts+Te}H=E[0].dts}if(a){var Ce=H-W,be=Ce>J,ge=Ce<-1;if(be||ge){be?k.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(Ce,!0)+" ms ("+Ce+"dts) hole between fragments detected, filling it"):k.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(-Ce,!0)+" ms ("+Ce+"dts) overlapping between fragments detected"),H=W;var Se=E[0].pts-Ce;E[0].dts=H,E[0].pts=Se,k.logger.log("Video: First PTS/DTS adjusted: "+Object(y.toMsFromMpegTsClock)(Se,!0)+"/"+Object(y.toMsFromMpegTsClock)(H,!0)+", delta: "+Object(y.toMsFromMpegTsClock)(Ce,!0)+" ms")}}o&&(H=Math.max(0,H));for(var Le=0,Me=0,_e=0;_e<F;_e++){for(var Ae=E[_e],je=Ae.units,ze=je.length,Ne=0,We=0;We<ze;We++)Ne+=je[We].data.length;Me+=Ne,Le+=ze,Ae.length=Ne,Ae.dts=Math.max(Ae.dts,H),Ae.pts=Math.max(Ae.pts,Ae.dts,0),ee=Math.min(Ae.pts,ee),oe=Math.max(Ae.pts,oe)}Y=E[F-1].dts;var et=Me+4*Le+8,Xe;try{Xe=new Uint8Array(et)}catch(mt){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:et,reason:"fail allocating video mdat "+et});return}var Ye=new DataView(Xe.buffer);Ye.setUint32(0,et),Xe.set(R.default.types.mdat,4);for(var Oe=0;Oe<F;Oe++){for(var tt=E[Oe],$e=tt.units,Pe=0,Fe=0,ve=$e.length;Fe<ve;Fe++){var de=$e[Fe],ce=de.data,X=de.data.byteLength;Ye.setUint32(D,X),D+=4,Xe.set(ce,D),D+=X,Pe+=4+X}if(Oe<F-1)P=E[Oe+1].dts-tt.dts;else{var Q=this.config,te=tt.dts-E[Oe>0?Oe-1:Oe].dts;if(Q.stretchShortVideoTrack&&this.nextAudioPts!==null){var se=Math.floor(Q.maxBufferHole*m),fe=(g?ee+g*m:this.nextAudioPts)-tt.pts;fe>se?(P=fe-te,P<0&&(P=te),k.logger.log("[mp4-remuxer]: It is approximately "+fe/90+" ms to the next segment; using duration "+P/90+" ms for the last video frame.")):P=te}else P=te}var De=Math.round(tt.pts-tt.dts);M.push(new p(tt.key,P,Pe,De))}if(M.length&&v&&v<70){var Re=M[0].flags;Re.dependsOn=2,Re.isNonSync=0}console.assert(P!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=Y+P,this.isVideoContiguous=!0;var Ie=R.default.moof(c.sequenceNumber++,H,S({},c,{samples:M})),Ze="video",Ve={data1:Ie,data2:Xe,startPTS:ee/m,endPTS:(oe+P)/m,startDTS:H/m,endDTS:W/m,type:Ze,hasAudio:!1,hasVideo:!0,nb:M.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Xe.length,"MDAT length must not be zero"),Ve},b.remuxAudio=function(c,s,a,g,m){var E=c.inputTimeScale,M=c.samplerate?c.samplerate:E,F=E/M,j=c.isAAC?_:x,W=j*F,D=this._initPTS,P=!c.isAAC&&this.typeSupported.mpeg,H=[],Y=c.samples,ee=P?0:8,oe=this.nextAudioPts||-1,Te=s*E;if(this.isAudioContiguous=a=a||Y.length&&oe>0&&(g&&Math.abs(Te-oe)<9e3||Math.abs(l(Y[0].pts-D,Te)-oe)<20*W),Y.forEach(function(ce){ce.pts=l(ce.pts-D,Te)}),!a||oe<0){if(Y=Y.filter(function(ce){return ce.pts>=0}),!Y.length)return;m===0?oe=0:g?oe=Math.max(0,Te):oe=Y[0].pts}if(c.isAAC)for(var ye=m!==void 0,he=this.config.maxAudioFramesDrift,le=0,me=oe;le<Y.length;le++){var ie=Y[le],pe=ie.pts,J=pe-me,ne=Math.abs(1e3*J/E);if(J<=-he*W&&ye)le===0&&(k.logger.warn("Audio frame @ "+(pe/E).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*J/E)+" ms."),this.nextAudioPts=oe=me=pe);else if(J>=he*W&&ne<O&&ye){var q=Math.round(J/W);me=pe-q*W,me<0&&(q--,me+=W),le===0&&(this.nextAudioPts=oe=me),k.logger.warn("[mp4-remuxer]: Injecting "+q+" audio frame @ "+(me/E).toFixed(3)+"s due to "+Math.round(1e3*J/E)+" ms gap.");for(var xe=0;xe<q;xe++){var Ce=Math.max(me,0),be=I.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);be||(k.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),be=ie.unit.subarray()),Y.splice(le,0,{unit:be,pts:Ce}),me+=W,le++}}ie.pts=me,me+=W}for(var ge=null,Se=null,Le,Me=0,_e=Y.length;_e--;)Me+=Y[_e].unit.byteLength;for(var Ae=0,je=Y.length;Ae<je;Ae++){var ze=Y[Ae],Ne=ze.unit,We=ze.pts;if(Se!==null){var et=H[Ae-1];et.duration=Math.round((We-Se)/F)}else if(a&&c.isAAC&&(We=oe),ge=We,Me>0){Me+=ee;try{Le=new Uint8Array(Me)}catch(ce){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Me,reason:"fail allocating audio mdat "+Me});return}if(!P){var Xe=new DataView(Le.buffer);Xe.setUint32(0,Me),Le.set(R.default.types.mdat,4)}}else return;Le.set(Ne,ee);var Ye=Ne.byteLength;ee+=Ye,H.push(new p(!0,j,Ye,0)),Se=We}var Oe=H.length;if(!Oe)return;var tt=H[H.length-1];this.nextAudioPts=oe=Se+F*tt.duration;var $e=P?new Uint8Array(0):R.default.moof(c.sequenceNumber++,ge/F,S({},c,{samples:H}));c.samples=[];var Pe=ge/E,Fe=oe/E,ve="audio",de={data1:$e,data2:Le,startPTS:Pe,endPTS:Fe,startDTS:Pe,endDTS:Fe,type:ve,hasAudio:!0,hasVideo:!1,nb:Oe};return this.isAudioContiguous=!0,console.assert(Le.length,"MDAT length must not be zero"),de},b.remuxEmptyAudio=function(c,s,a,g){var m=c.inputTimeScale,E=c.samplerate?c.samplerate:m,M=m/E,F=this.nextAudioPts,j=(F!==null?F:g.startDTS*m)+this._initDTS,W=g.endDTS*m+this._initDTS,D=M*_,P=Math.ceil((W-j)/D),H=I.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(k.logger.warn("[mp4-remuxer]: remux empty Audio"),!H){k.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Y=[],ee=0;ee<P;ee++){var oe=j+ee*D;Y.push({unit:H,pts:oe,dts:oe})}return c.samples=Y,this.remuxAudio(c,s,a,!1)},b.remuxID3=function(c,s){var a=c.samples.length;if(!a)return;for(var g=c.inputTimeScale,m=this._initPTS,E=this._initDTS,M=0;M<a;M++){var F=c.samples[M];F.pts=l(F.pts-m,s*g)/g,F.dts=l(F.dts-E,s*g)/g}var j=c.samples;return c.samples=[],{samples:j}},b.remuxText=function(c,s){var a=c.samples.length;if(!a)return;for(var g=c.inputTimeScale,m=this._initPTS,E=0;E<a;E++){var M=c.samples[E];M.pts=l(M.pts-m,s*g)/g}c.samples.sort(function(j,W){return j.pts-W.pts});var F=c.samples;return c.samples=[],{samples:F}},C}();function l(C,b){var h;if(b===null)return C;for(b<C?h=-8589934592:h=8589934592;Math.abs(C-b)>4294967296;)C+=h;return C}function w(C){for(var b=0;b<C.length;b++)if(C[b].key)return b;return-1}var p=function(b,h,c,s){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=h,this.size=c,this.cts=s,this.flags=new f(b)},f=function(b){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=b?2:1,this.isNonSync=b?0:1}},"./src/remux/passthrough-remuxer.ts":function(re,G,L){"use strict";L.r(G);var z=L("./src/polyfills/number.ts"),I=L("./src/utils/mp4-tools.ts"),R=L("./src/loader/fragment.ts"),B=L("./src/utils/logger.ts"),U=function(){function y(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var S=y.prototype;return S.destroy=function(){},S.resetTimeStamp=function(_){this.initPTS=_,this.lastEndDTS=null},S.resetNextTimestamp=function(){this.lastEndDTS=null},S.resetInitSegment=function(_,x,v){this.audioCodec=x,this.videoCodec=v,this.generateInitSegment(_),this.emitInitSegment=!0},S.generateInitSegment=function(_){var x=this.audioCodec,v=this.videoCodec;if(!_||!_.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(I.parseInitSegment)(_);x||(x=A(d.audio,R.ElementaryStreamTypes.AUDIO)),v||(v=A(d.video,R.ElementaryStreamTypes.VIDEO));var o={};d.audio&&d.video?o.audiovideo={container:"video/mp4",codec:x+","+v,initSegment:_,id:"main"}:d.audio?o.audio={container:"audio/mp4",codec:x,initSegment:_,id:"audio"}:d.video?o.video={container:"video/mp4",codec:v,initSegment:_,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},S.remux=function(_,x,v,d,o){var u=this.initPTS,l=this.lastEndDTS,w={audio:void 0,video:void 0,text:d,id3:v,initSegment:void 0};Object(z.isFiniteNumber)(l)||(l=this.lastEndDTS=o||0);var p=x.samples;if(!p||!p.length)return w;var f={initPTS:void 0,timescale:1},C=this.initData;if((!C||!C.length)&&(this.generateInitSegment(p),C=this.initData),!C||!C.length)return B.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),w;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1),Object(z.isFiniteNumber)(u)||(this.initPTS=f.initPTS=u=k(C,p,l));var b=Object(I.getDuration)(p,C),h=l,c=b+h;Object(I.offsetStartDTS)(C,p,u),b>0?this.lastEndDTS=c:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var s=!!C.audio,a=!!C.video,g="";s&&(g+="audio"),a&&(g+="video");var m={data1:p,startPTS:h,startDTS:h,endPTS:c,endDTS:c,type:g,hasAudio:s,hasVideo:a,nb:1,dropped:0};return w.audio=m.type==="audio"?m:void 0,w.video=m.type!=="audio"?m:void 0,w.text=d,w.id3=v,w.initSegment=f,w},y}(),k=function(S,O,_){return Object(I.getStartDTS)(S,O)-_};function A(y,S){var O=y==null?void 0:y.codec;return O&&O.length>4?O:O==="hvc1"?"hvc1.1.c.L120.90":O==="av01"?"av01.0.04M.08":O==="avc1"||S===R.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}G.default=U},"./src/task-loop.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"default",function(){return z});var z=function(){function I(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var R=I.prototype;return R.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},R.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},R.onHandlerDestroyed=function(){},R.hasInterval=function(){return!!this._tickInterval},R.hasNextTick=function(){return!!this._tickTimer},R.setInterval=function(U){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,U),!0)},R.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},R.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},R.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},R.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},R.doTick=function(){},I}()},"./src/types/cmcd.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"CMCDVersion",function(){return z}),L.d(G,"CMCDObjectType",function(){return I}),L.d(G,"CMCDStreamingFormat",function(){return R}),L.d(G,"CMCDStreamType",function(){return B});var z=1,I;(function(U){U.MANIFEST="m",U.AUDIO="a",U.VIDEO="v",U.MUXED="av",U.INIT="i",U.CAPTION="c",U.TIMED_TEXT="tt",U.KEY="k",U.OTHER="o"})(I||(I={}));var R;(function(U){U.DASH="d",U.HLS="h",U.SMOOTH="s",U.OTHER="o"})(R||(R={}));var B;(function(U){U.VOD="v",U.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"HlsSkip",function(){return R}),L.d(G,"getSkipValue",function(){return B}),L.d(G,"HlsUrlParameters",function(){return U}),L.d(G,"Level",function(){return k});function z(A,y){for(var S=0;S<y.length;S++){var O=y[S];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(A,O.key,O)}}function I(A,y,S){return y&&z(A.prototype,y),S&&z(A,S),A}var R;(function(A){A.No="",A.Yes="YES",A.v2="v2"})(R||(R={}));function B(A,y){var S=A.canSkipUntil,O=A.canSkipDateRanges,_=A.endSN,x=y!==void 0?y-_:0;return S&&x<S?O?R.v2:R.Yes:R.No}var U=function(){function A(S,O,_){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=S,this.part=O,this.skip=_}var y=A.prototype;return y.addDirectives=function(O){var _=new self.URL(O);return this.msn!==void 0&&_.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&_.searchParams.set("_HLS_part",this.part.toString()),this.skip&&_.searchParams.set("_HLS_skip",this.skip),_.toString()},A}(),k=function(){function A(y){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=[y.url],this.attrs=y.attrs,this.bitrate=y.bitrate,y.details&&(this.details=y.details),this.id=y.id||0,this.name=y.name,this.width=y.width||0,this.height=y.height||0,this.audioCodec=y.audioCodec,this.videoCodec=y.videoCodec,this.unknownCodecs=y.unknownCodecs,this.codecSet=[y.videoCodec,y.audioCodec].filter(function(S){return S}).join(",").replace(/\.[^.,]+/g,"")}return I(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(S){var O=S%this.url.length;this._urlId!==O&&(this.details=void 0,this._urlId=O)}}]),A}()},"./src/types/loader.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"PlaylistContextType",function(){return z}),L.d(G,"PlaylistLevelType",function(){return I});var z;(function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"})(z||(z={}));var I;(function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"})(I||(I={}))},"./src/types/transmuxer.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"ChunkMetadata",function(){return z});var z=function(B,U,k,A,y,S){A===void 0&&(A=0),y===void 0&&(y=-1),S===void 0&&(S=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=I(),this.buffering={audio:I(),video:I(),audiovideo:I()},this.level=B,this.sn=U,this.id=k,this.size=A,this.part=y,this.partial=S};function I(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"AttrList",function(){return R});var z=/^(\d+)x(\d+)$/,I=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,R=function(){function B(k){typeof k=="string"&&(k=B.parseAttrList(k));for(var A in k)k.hasOwnProperty(A)&&(this[A]=k[A])}var U=B.prototype;return U.decimalInteger=function(A){var y=parseInt(this[A],10);return y>Number.MAX_SAFE_INTEGER?Infinity:y},U.hexadecimalInteger=function(A){if(this[A]){var y=(this[A]||"0x").slice(2);y=(y.length&1?"0":"")+y;for(var S=new Uint8Array(y.length/2),O=0;O<y.length/2;O++)S[O]=parseInt(y.slice(O*2,O*2+2),16);return S}else return null},U.hexadecimalIntegerAsNumber=function(A){var y=parseInt(this[A],16);return y>Number.MAX_SAFE_INTEGER?Infinity:y},U.decimalFloatingPoint=function(A){return parseFloat(this[A])},U.optionalFloat=function(A,y){var S=this[A];return S?parseFloat(S):y},U.enumeratedString=function(A){return this[A]},U.bool=function(A){return this[A]==="YES"},U.decimalResolution=function(A){var y=z.exec(this[A]);return y===null?void 0:{width:parseInt(y[1],10),height:parseInt(y[2],10)}},B.parseAttrList=function(A){var y,S={},O='"';for(I.lastIndex=0;(y=I.exec(A))!==null;){var _=y[2];_.indexOf(O)===0&&_.lastIndexOf(O)===_.length-1&&(_=_.slice(1,-1)),S[y[1]]=_}return S},B}()},"./src/utils/binary-search.ts":function(re,G,L){"use strict";L.r(G);var z={search:function(R,B){for(var U=0,k=R.length-1,A=null,y=null;U<=k;){A=(U+k)/2|0,y=R[A];var S=B(y);if(S>0)U=A+1;else if(S<0)k=A-1;else return y}return null}};G.default=z},"./src/utils/buffer-helper.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"BufferHelper",function(){return R});var z=L("./src/utils/logger.ts"),I={length:0,start:function(){return 0},end:function(){return 0}},R=function(){function B(){}return B.isBuffered=function(k,A){try{if(k){for(var y=B.getBuffered(k),S=0;S<y.length;S++)if(A>=y.start(S)&&A<=y.end(S))return!0}}catch(O){}return!1},B.bufferInfo=function(k,A,y){try{if(k){var S=B.getBuffered(k),O=[],_;for(_=0;_<S.length;_++)O.push({start:S.start(_),end:S.end(_)});return this.bufferedInfo(O,A,y)}}catch(x){}return{len:0,start:A,end:A,nextStart:void 0}},B.bufferedInfo=function(k,A,y){A=Math.max(0,A),k.sort(function(f,C){var b=f.start-C.start;return b||C.end-f.end});var S=[];if(y)for(var O=0;O<k.length;O++){var _=S.length;if(_){var x=S[_-1].end;k[O].start-x<y?k[O].end>x&&(S[_-1].end=k[O].end):S.push(k[O])}else S.push(k[O])}else S=k;for(var v=0,d,o=A,u=A,l=0;l<S.length;l++){var w=S[l].start,p=S[l].end;if(A+y>=w&&A<p)o=w,u=p,v=u-A;else if(A+y<w){d=w;break}}return{len:v,start:o||0,end:u||0,nextStart:d}},B.getBuffered=function(k){try{return k.buffered}catch(A){return z.logger.log("failed to get media.buffered",A),I}},B}()},"./src/utils/cea-608-parser.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"Row",function(){return u}),L.d(G,"CaptionScreen",function(){return l});var z=L("./src/utils/logger.ts"),I={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},R=function(c){var s=c;return I.hasOwnProperty(c)&&(s=I[c]),String.fromCharCode(s)},B=15,U=100,k={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},y={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},S={25:2,26:4,29:6,30:8,31:10,27:13,28:15},O=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],_;(function(h){h[h.ERROR=0]="ERROR",h[h.TEXT=1]="TEXT",h[h.WARNING=2]="WARNING",h[h.INFO=2]="INFO",h[h.DEBUG=3]="DEBUG",h[h.DATA=3]="DATA"})(_||(_={}));var x=function(){function h(){this.time=null,this.verboseLevel=_.ERROR}var c=h.prototype;return c.log=function(a,g){this.verboseLevel>=a&&z.logger.log(this.time+" ["+a+"] "+g)},h}(),v=function(c){for(var s=[],a=0;a<c.length;a++)s.push(c[a].toString(16));return s},d=function(){function h(s,a,g,m,E){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=s||"white",this.underline=a||!1,this.italics=g||!1,this.background=m||"black",this.flash=E||!1}var c=h.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(a){for(var g=["foreground","underline","italics","background","flash"],m=0;m<g.length;m++){var E=g[m];a.hasOwnProperty(E)&&(this[E]=a[E])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},c.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},h}(),o=function(){function h(s,a,g,m,E,M){this.uchar=void 0,this.penState=void 0,this.uchar=s||" ",this.penState=new d(a,g,m,E,M)}var c=h.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,g){this.uchar=a,this.penState.copy(g)},c.setPenState=function(a){this.penState.copy(a)},c.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},c.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},h}(),u=function(){function h(s){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<U;a++)this.chars.push(new o);this.logger=s,this.pos=0,this.currPenState=new d}var c=h.prototype;return c.equals=function(a){for(var g=!0,m=0;m<U;m++)if(!this.chars[m].equals(a.chars[m])){g=!1;break}return g},c.copy=function(a){for(var g=0;g<U;g++)this.chars[g].copy(a.chars[g])},c.isEmpty=function(){for(var a=!0,g=0;g<U;g++)if(!this.chars[g].isEmpty()){a=!1;break}return a},c.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(_.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>U&&(this.logger.log(_.DEBUG,"Too large cursor position "+this.pos),this.pos=U)},c.moveCursor=function(a){var g=this.pos+a;if(a>1)for(var m=this.pos+1;m<g+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(g)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var g=R(a);if(this.pos>=U){this.logger.log(_.ERROR,"Cannot insert "+a.toString(16)+" ("+g+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(g,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var g;for(g=a;g<U;g++)this.chars[g].reset()},c.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},c.clearToEndOfRow=function(){this.clearFromPos(this.pos)},c.getTextString=function(){for(var a=[],g=!0,m=0;m<U;m++){var E=this.chars[m].uchar;E!==" "&&(g=!1),a.push(E)}return g?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var g=this.chars[this.pos];g.setPenState(this.currPenState)},h}(),l=function(){function h(s){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<B;a++)this.rows.push(new u(s));this.logger=s,this.currRow=B-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=h.prototype;return c.reset=function(){for(var a=0;a<B;a++)this.rows[a].clear();this.currRow=B-1},c.equals=function(a){for(var g=!0,m=0;m<B;m++)if(!this.rows[m].equals(a.rows[m])){g=!1;break}return g},c.copy=function(a){for(var g=0;g<B;g++)this.rows[g].copy(a.rows[g])},c.isEmpty=function(){for(var a=!0,g=0;g<B;g++)if(!this.rows[g].isEmpty()){a=!1;break}return a},c.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},c.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},c.insertChar=function(a){var g=this.rows[this.currRow];g.insertChar(a)},c.setPen=function(a){var g=this.rows[this.currRow];g.setPenStyles(a)},c.moveCursor=function(a){var g=this.rows[this.currRow];g.moveCursor(a)},c.setCursor=function(a){this.logger.log(_.INFO,"setCursor: "+a);var g=this.rows[this.currRow];g.setCursor(a)},c.setPAC=function(a){this.logger.log(_.INFO,"pacData = "+JSON.stringify(a));var g=a.row-1;if(this.nrRollUpRows&&g<this.nrRollUpRows-1&&(g=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==g){for(var m=0;m<B;m++)this.rows[m].clear();var E=this.currRow+1-this.nrRollUpRows,M=this.lastOutputScreen;if(M){var F=M.rows[E].cueStartTime,j=this.logger.time;if(F&&j!==null&&F<j)for(var W=0;W<this.nrRollUpRows;W++)this.rows[g-this.nrRollUpRows+W+1].copy(M.rows[E+W])}}this.currRow=g;var D=this.rows[this.currRow];if(a.indent!==null){var P=a.indent,H=Math.max(P-1,0);D.setCursor(a.indent),a.color=D.chars[H].penState.foreground}var Y={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(Y)},c.setBkgData=function(a){this.logger.log(_.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},c.setRollUpRows=function(a){this.nrRollUpRows=a},c.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(_.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(_.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,g=this.rows.splice(a,1)[0];g.clear(),this.rows.splice(this.currRow,0,g),this.logger.log(_.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var g=[],m="",E=-1,M=0;M<B;M++){var F=this.rows[M].getTextString();F&&(E=M+1,a?g.push("Row "+E+": '"+F+"'"):g.push(F.trim()))}return g.length>0&&(a?m="["+g.join(" | ")+"]":m=g.join(`
|
|
`)),m},c.getTextAndFormat=function(){return this.rows},h}(),w=function(){function h(s,a,g){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=s,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new l(g),this.nonDisplayedMemory=new l(g),this.lastOutputScreen=new l(g),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=g}var c=h.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(a){this.outputFilter=a},c.setPAC=function(a){this.writeScreen.setPAC(a)},c.setBkgData=function(a){this.writeScreen.setBkgData(a)},c.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(_.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},c.insertChars=function(a){for(var g=0;g<a.length;g++)this.writeScreen.insertChar(a[g]);var m=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(_.INFO,m+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(_.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(_.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(_.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},c.ccAOF=function(){},c.ccAON=function(){},c.ccDER=function(){this.logger.log(_.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(_.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(_.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(_.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(_.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(_.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(_.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(_.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(_.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(_.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(_.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(_.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var g={flash:!1};if(g.underline=a%2===1,g.italics=a>=46,g.italics)g.foreground="white";else{var m=Math.floor(a/2)-16,E=["white","green","blue","cyan","red","yellow","magenta"];g.foreground=E[m]}this.logger.log(_.INFO,"MIDROW: "+JSON.stringify(g)),this.writeScreen.setPen(g)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var g=this.logger.time;if(g===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=g:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,g,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:g),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},h}(),p=function(){function h(s,a,g){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new x;this.channels=[null,new w(s,a,m),new w(s+1,g,m)],this.cmdHistory=b(),this.logger=m}var c=h.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,g){this.channels[a].setHandler(g)},c.addData=function(a,g){var m,E,M,F=!1;this.logger.time=a;for(var j=0;j<g.length;j+=2){if(E=g[j]&127,M=g[j+1]&127,E===0&&M===0)continue;if(this.logger.log(_.DATA,"["+v([g[j],g[j+1]])+"] -> ("+v([E,M])+")"),m=this.parseCmd(E,M),m||(m=this.parseMidrow(E,M)),m||(m=this.parsePAC(E,M)),m||(m=this.parseBackgroundAttributes(E,M)),!m&&(F=this.parseChars(E,M),F)){var W=this.currentChannel;if(W&&W>0){var D=this.channels[W];D.insertChars(F)}else this.logger.log(_.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!F&&this.logger.log(_.WARNING,"Couldn't parse cleaned data "+v([E,M])+" orig: "+v([g[j],g[j+1]]))}},c.parseCmd=function(a,g){var m=this.cmdHistory,E=(a===20||a===28||a===21||a===29)&&g>=32&&g<=47,M=(a===23||a===31)&&g>=33&&g<=35;if(!(E||M))return!1;if(C(a,g,m))return f(null,null,m),this.logger.log(_.DEBUG,"Repeated command ("+v([a,g])+") is dropped"),!0;var F=a===20||a===21||a===23?1:2,j=this.channels[F];return a===20||a===21||a===28||a===29?g===32?j.ccRCL():g===33?j.ccBS():g===34?j.ccAOF():g===35?j.ccAON():g===36?j.ccDER():g===37?j.ccRU(2):g===38?j.ccRU(3):g===39?j.ccRU(4):g===40?j.ccFON():g===41?j.ccRDC():g===42?j.ccTR():g===43?j.ccRTD():g===44?j.ccEDM():g===45?j.ccCR():g===46?j.ccENM():g===47&&j.ccEOC():j.ccTO(g-32),f(a,g,m),this.currentChannel=F,!0},c.parseMidrow=function(a,g){var m=0;if((a===17||a===25)&&g>=32&&g<=47){if(a===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(_.ERROR,"Mismatch channel in midrow parsing"),!1;var E=this.channels[m];return E?(E.ccMIDROW(g),this.logger.log(_.DEBUG,"MIDROW ("+v([a,g])+")"),!0):!1}return!1},c.parsePAC=function(a,g){var m,E=this.cmdHistory,M=(a>=17&&a<=23||a>=25&&a<=31)&&g>=64&&g<=127,F=(a===16||a===24)&&g>=64&&g<=95;if(!(M||F))return!1;if(C(a,g,E))return f(null,null,E),!0;var j=a<=23?1:2;g>=64&&g<=95?m=j===1?k[a]:y[a]:m=j===1?A[a]:S[a];var W=this.channels[j];return W?(W.setPAC(this.interpretPAC(m,g)),f(a,g,E),this.currentChannel=j,!0):!1},c.interpretPAC=function(a,g){var m,E={color:null,italics:!1,indent:null,underline:!1,row:a};return g>95?m=g-96:m=g-64,E.underline=(m&1)===1,m<=13?E.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(E.italics=!0,E.color="white"):E.indent=Math.floor((m-16)/2)*4,E},c.parseChars=function(a,g){var m,E=null,M=null;if(a>=25?(m=2,M=a-8):(m=1,M=a),M>=17&&M<=19){var F;M===17?F=g+80:M===18?F=g+112:F=g+144,this.logger.log(_.INFO,"Special char '"+R(F)+"' in channel "+m),E=[F]}else a>=32&&a<=127&&(E=g===0?[a]:[a,g]);if(E){var j=v(E);this.logger.log(_.DEBUG,"Char codes = "+j.join(",")),f(a,g,this.cmdHistory)}return E},c.parseBackgroundAttributes=function(a,g){var m=(a===16||a===24)&&g>=32&&g<=47,E=(a===23||a===31)&&g>=45&&g<=47;if(!(m||E))return!1;var M,F={};a===16||a===24?(M=Math.floor((g-32)/2),F.background=O[M],g%2===1&&(F.background=F.background+"_semi")):g===45?F.background="transparent":(F.foreground="black",g===47&&(F.underline=!0));var j=a<=23?1:2,W=this.channels[j];return W.setBkgData(F),f(a,g,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var g=this.channels[a];g&&g.reset()}this.cmdHistory=b()},c.cueSplitAtTime=function(a){for(var g=0;g<this.channels.length;g++){var m=this.channels[g];m&&m.cueSplitAtTime(a)}},h}();function f(h,c,s){s.a=h,s.b=c}function C(h,c,s){return s.a===h&&s.b===c}function b(){return{a:null,b:null}}G.default=p},"./src/utils/codecs.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"isCodecType",function(){return I}),L.d(G,"isCodecSupportedInMp4",function(){return R});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 I(B,U){var k=z[U];return!!k&&k[B.slice(0,4)]===!0}function R(B,U){return MediaSource.isTypeSupported((U||"video")+'/mp4;codecs="'+B+'"')}},"./src/utils/cues.ts":function(re,G,L){"use strict";L.r(G);var z=L("./src/utils/vttparser.ts"),I=L("./src/utils/webvtt-parser.ts"),R=L("./src/utils/texttrack-utils.ts"),B=/\s/,U={newCue:function(A,y,S,O){for(var _=[],x,v,d,o,u,l=self.VTTCue||self.TextTrackCue,w=0;w<O.rows.length;w++)if(x=O.rows[w],d=!0,o=0,u="",!x.isEmpty()){for(var p=0;p<x.chars.length;p++)B.test(x.chars[p].uchar)&&d?o++:(u+=x.chars[p].uchar,d=!1);x.cueStartTime=y,y===S&&(S+=1e-4),o>=16?o--:o++;var f=Object(z.fixLineBreaks)(u.trim()),C=Object(I.generateCueId)(y,S,f);(!A||!A.cues||!A.cues.getCueById(C))&&(v=new l(y,S,f),v.id=C,v.line=w+1,v.align="left",v.position=10+Math.min(80,Math.floor(o*8/32)*10),_.push(v))}return A&&_.length&&(_.sort(function(b,h){return b.line==="auto"||h.line==="auto"?0:b.line>8&&h.line>8?h.line-b.line:b.line-h.line}),_.forEach(function(b){return Object(R.addCueToTrack)(A,b)})),_}};G.default=U},"./src/utils/discontinuities.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"findFirstFragWithCC",function(){return B}),L.d(G,"shouldAlignOnDiscontinuities",function(){return U}),L.d(G,"findDiscontinuousReferenceFrag",function(){return k}),L.d(G,"adjustSlidingStart",function(){return y}),L.d(G,"alignStream",function(){return S}),L.d(G,"alignPDT",function(){return _}),L.d(G,"alignFragmentByPDTDelta",function(){return x}),L.d(G,"alignMediaPlaylistByPDT",function(){return v});var z=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts"),R=L("./src/controller/level-helper.ts");function B(d,o){for(var u=null,l=0,w=d.length;l<w;l++){var p=d[l];if(p&&p.cc===o){u=p;break}}return u}function U(d,o,u){return!!(o.details&&(u.endCC>u.startCC||d&&d.cc<u.startCC))}function k(d,o){var u=d.fragments,l=o.fragments;if(!l.length||!u.length){I.logger.log("No fragments to align");return}var w=B(u,l[0].cc);if(!w||w&&!w.startPTS){I.logger.log("No frag in previous level to align on");return}return w}function A(d,o){if(d){var u=d.start+o;d.start=d.startPTS=u,d.endPTS=u+d.duration}}function y(d,o){for(var u=o.fragments,l=0,w=u.length;l<w;l++)A(u[l],d);o.fragmentHint&&A(o.fragmentHint,d),o.alignedSliding=!0}function S(d,o,u){if(!o)return;O(d,u,o),!u.alignedSliding&&o.details&&_(u,o.details),!u.alignedSliding&&o.details&&!u.skippedSegments&&Object(R.adjustSliding)(o.details,u)}function O(d,o,u){if(U(d,u,o)){var l=k(u.details,o);l&&Object(z.isFiniteNumber)(l.start)&&(I.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),y(l.start,o))}}function _(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var u=o.fragments[0].programDateTime,l=d.fragments[0].programDateTime,w=(l-u)/1e3+o.fragments[0].start;w&&Object(z.isFiniteNumber)(w)&&(I.logger.log("Adjusting PTS using programDateTime delta "+(l-u)+"ms, sliding:"+w.toFixed(3)+" "+d.url+" "),y(w,d))}function x(d,o){var u=d.programDateTime;if(!u)return;var l=(u-o)/1e3;d.start=d.startPTS=l,d.endPTS=l+d.duration}function v(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var u=o.fragments[0].programDateTime,l=o.fragments[0].start,w=u-l*1e3;d.fragments.forEach(function(p){x(p,w)}),d.fragmentHint&&x(d.fragmentHint,w),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(re,G,L){"use strict";L.r(G);var z=L("./src/utils/ewma.ts"),I=function(){function R(U,k,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(U),this.fast_=new z.default(k)}var B=R.prototype;return B.update=function(k,A){var y=this.slow_,S=this.fast_;this.slow_.halfLife!==k&&(this.slow_=new z.default(k,y.getEstimate(),y.getTotalWeight())),this.fast_.halfLife!==A&&(this.fast_=new z.default(A,S.getEstimate(),S.getTotalWeight()))},B.sample=function(k,A){k=Math.max(k,this.minDelayMs_);var y=8*A,S=k/1e3,O=y/S;this.fast_.sample(S,O),this.slow_.sample(S,O)},B.canEstimate=function(){var k=this.fast_;return k&&k.getTotalWeight()>=this.minWeight_},B.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},B.destroy=function(){},R}();G.default=I},"./src/utils/ewma.ts":function(re,G,L){"use strict";L.r(G);var z=function(){function I(B,U,k){U===void 0&&(U=0),k===void 0&&(k=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=B,this.alpha_=B?Math.exp(Math.log(.5)/B):0,this.estimate_=U,this.totalWeight_=k}var R=I.prototype;return R.sample=function(U,k){var A=Math.pow(this.alpha_,U);this.estimate_=k*(1-A)+A*this.estimate_,this.totalWeight_+=U},R.getTotalWeight=function(){return this.totalWeight_},R.getEstimate=function(){if(this.alpha_){var U=1-Math.pow(this.alpha_,this.totalWeight_);if(U)return this.estimate_/U}return this.estimate_},I}();G.default=z},"./src/utils/fetch-loader.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"fetchSupported",function(){return x});var z=L("./src/polyfills/number.ts"),I=L("./src/loader/load-stats.ts"),R=L("./src/demux/chunk-cache.ts");function B(l,w){l.prototype=Object.create(w.prototype),l.prototype.constructor=l,S(l,w)}function U(l){var w=typeof Map=="function"?new Map:void 0;return U=function(f){if(f===null||!y(f))return f;if(typeof f!="function")throw new TypeError("Super expression must either be null or a function");if(typeof w!="undefined"){if(w.has(f))return w.get(f);w.set(f,C)}function C(){return k(f,arguments,O(this).constructor)}return C.prototype=Object.create(f.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),S(C,f)},U(l)}function k(l,w,p){return A()?k=Reflect.construct:k=function(C,b,h){var c=[null];c.push.apply(c,b);var s=Function.bind.apply(C,c),a=new s;return h&&S(a,h.prototype),a},k.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(l){return!1}}function y(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function S(l,w){return S=Object.setPrototypeOf||function(f,C){return f.__proto__=C,f},S(l,w)}function O(l){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(p){return p.__proto__||Object.getPrototypeOf(p)},O(l)}function _(){return _=Object.assign||function(l){for(var w=1;w<arguments.length;w++){var p=arguments[w];for(var f in p)Object.prototype.hasOwnProperty.call(p,f)&&(l[f]=p[f])}return l},_.apply(this,arguments)}function x(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(l){}return!1}var v=function(){function l(p){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=p.fetchSetup||o,this.controller=new self.AbortController,this.stats=new I.LoadStats}var w=l.prototype;return w.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},w.abortInternal=function(){var f=this.response;(!f||!f.ok)&&(this.stats.aborted=!0,this.controller.abort())},w.abort=function(){var f;this.abortInternal(),(f=this.callbacks)!==null&&f!==void 0&&f.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},w.load=function(f,C,b){var h=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var s=d(f,this.controller.signal),a=b.onProgress,g=f.responseType==="arraybuffer",m=g?"byteLength":"length";this.context=f,this.config=C,this.callbacks=b,this.request=this.fetchSetup(f,s),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){h.abortInternal(),b.onTimeout(c,f,h.response)},C.timeout),self.fetch(this.request).then(function(E){if(h.response=h.loader=E,!E.ok){var M=E.status,F=E.statusText;throw new u(F||"fetch, bad network response",M,E)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(E.headers.get("Content-Length")||"0"),a&&Object(z.isFiniteNumber)(C.highWaterMark)?h.loadProgressively(E,c,f,C.highWaterMark,a):g?E.arrayBuffer():E.text()}).then(function(E){var M=h.response;self.clearTimeout(h.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=E[m];var F={url:M.url,data:E};a&&!Object(z.isFiniteNumber)(C.highWaterMark)&&a(c,f,E,M),b.onSuccess(F,c,f,M)}).catch(function(E){if(self.clearTimeout(h.requestTimeout),c.aborted)return;var M=E.code||0;b.onError({code:M,text:E.message},f,E.details)})},w.getCacheAge=function(){var f=null;if(this.response){var C=this.response.headers.get("age");f=C?parseFloat(C):null}return f},w.loadProgressively=function(f,C,b,h,c){h===void 0&&(h=0);var s=new R.default,a=f.body.getReader(),g=function m(){return a.read().then(function(E){if(E.done)return s.dataLength&&c(C,b,s.flush(),f),Promise.resolve(new ArrayBuffer(0));var M=E.value,F=M.length;return C.loaded+=F,F<h||s.dataLength?(s.push(M),s.dataLength>=h&&c(C,b,s.flush(),f)):c(C,b,M,f),m()}).catch(function(){return Promise.reject()})};return g()},l}();function d(l,w){var p={method:"GET",mode:"cors",credentials:"same-origin",signal:w,headers:new self.Headers(_({},l.headers))};return l.rangeEnd&&p.headers.set("Range","bytes="+l.rangeStart+"-"+String(l.rangeEnd-1)),p}function o(l,w){return new self.Request(l.url,w)}var u=function(l){B(w,l);function w(p,f,C){var b;return b=l.call(this,p)||this,b.code=void 0,b.details=void 0,b.code=f,b.details=C,b}return w}(U(Error));G.default=v},"./src/utils/imsc1-ttml-parser.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"IMSC1_CODEC",function(){return y}),L.d(G,"parseIMSC1",function(){return x});var z=L("./src/utils/mp4-tools.ts"),I=L("./src/utils/vttparser.ts"),R=L("./src/utils/vttcue.ts"),B=L("./src/demux/id3.ts"),U=L("./src/utils/timescale-conversion.ts"),k=L("./src/utils/webvtt-parser.ts");function A(){return A=Object.assign||function(h){for(var c=1;c<arguments.length;c++){var s=arguments[c];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(h[a]=s[a])}return h},A.apply(this,arguments)}var y="stpp.ttml.im1t",S=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,O=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,_={left:"start",center:"center",right:"end",start:"start",end:"end"};function x(h,c,s,a,g){var m=Object(z.findBox)(new Uint8Array(h),["mdat"]);if(m.length===0){g(new Error("Could not parse IMSC1 mdat"));return}var E=m[0],M=Object(B.utf8ArrayToStr)(new Uint8Array(h,E.start,E.end-E.start)),F=Object(U.toTimescaleFromScale)(c,1,s);try{a(v(M,F))}catch(j){g(j)}}function v(h,c){var s=new DOMParser,a=s.parseFromString(h,"text/xml"),g=a.getElementsByTagName("tt")[0];if(!g)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},E=Object.keys(m).reduce(function(D,P){return D[P]=g.getAttribute("ttp:"+P)||m[P],D},{}),M=g.getAttribute("xml:space")!=="preserve",F=o(d(g,"styling","style")),j=o(d(g,"layout","region")),W=d(g,"body","[begin]");return[].map.call(W,function(D){var P=u(D,M);if(!P||!D.hasAttribute("begin"))return null;var H=f(D.getAttribute("begin"),E),Y=f(D.getAttribute("dur"),E),ee=f(D.getAttribute("end"),E);if(H===null)throw p(D);if(ee===null){if(Y===null)throw p(D);ee=H+Y}var oe=new R.default(H-c,ee-c,P);oe.id=Object(k.generateCueId)(oe.startTime,oe.endTime,oe.text);var Te=j[D.getAttribute("region")],ye=F[D.getAttribute("style")];oe.position=10,oe.size=80;var he=l(Te,ye),le=he.textAlign;if(le){var me=_[le];me&&(oe.lineAlign=me),oe.align=le}return A(oe,he),oe}).filter(function(D){return D!==null})}function d(h,c,s){var a=h.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(s)):[]}function o(h){return h.reduce(function(c,s){var a=s.getAttribute("xml:id");return a&&(c[a]=s),c},{})}function u(h,c){return[].slice.call(h.childNodes).reduce(function(s,a,g){var m;return a.nodeName==="br"&&g?s+`
|
|
`:(m=a.childNodes)!==null&&m!==void 0&&m.length?u(a,c):c?s+a.textContent.trim().replace(/\s+/g," "):s+a.textContent},"")}function l(h,c){var s="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(g,m){var E=w(c,s,m)||w(h,s,m);return E&&(g[m]=E),g},{})}function w(h,c,s){return h.hasAttributeNS(c,s)?h.getAttributeNS(c,s):null}function p(h){return new Error("Could not parse ttml timestamp "+h)}function f(h,c){if(!h)return null;var s=Object(I.parseTimeStamp)(h);return s===null&&(S.test(h)?s=C(h,c):O.test(h)&&(s=b(h,c))),s}function C(h,c){var s=S.exec(h),a=(s[4]|0)+(s[5]|0)/c.subFrameRate;return(s[1]|0)*3600+(s[2]|0)*60+(s[3]|0)+a/c.frameRate}function b(h,c){var s=O.exec(h),a=Number(s[1]),g=s[2];switch(g){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/c.frameRate;case"t":return a/c.tickRate}return a}},"./src/utils/logger.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"enableLogs",function(){return k}),L.d(G,"logger",function(){return A});var z=function(){},I={trace:z,debug:z,log:z,warn:z,info:z,error:z},R=I;function B(y){var S=self.console[y];return S?S.bind(self.console,"["+y+"] >"):z}function U(y){for(var S=arguments.length,O=new Array(S>1?S-1:0),_=1;_<S;_++)O[_-1]=arguments[_];O.forEach(function(x){R[x]=y[x]?y[x].bind(y):B(x)})}function k(y){if(self.console&&y===!0||typeof y=="object"){U(y,"debug","log","info","warn","error");try{R.log()}catch(S){R=I}}else R=I}var A=R},"./src/utils/mediakeys-helper.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"KeySystems",function(){return z}),L.d(G,"requestMediaKeySystemAccess",function(){return I});var z;(function(R){R.WIDEVINE="com.widevine.alpha",R.PLAYREADY="com.microsoft.playready"})(z||(z={}));var I=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"getMediaSource",function(){return z});function z(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"bin2str",function(){return U}),L.d(G,"readUint16",function(){return k}),L.d(G,"readUint32",function(){return A}),L.d(G,"writeUint32",function(){return y}),L.d(G,"findBox",function(){return S}),L.d(G,"parseSegmentIndex",function(){return O}),L.d(G,"parseInitSegment",function(){return _}),L.d(G,"getStartDTS",function(){return x}),L.d(G,"getDuration",function(){return v}),L.d(G,"computeRawDurationFromSamples",function(){return d}),L.d(G,"offsetStartDTS",function(){return o}),L.d(G,"segmentValidRange",function(){return u}),L.d(G,"appendUint8Array",function(){return l});var z=L("./src/utils/typed-array.ts"),I=L("./src/loader/fragment.ts"),R=Math.pow(2,32)-1,B=[].push;function U(w){return String.fromCharCode.apply(null,w)}function k(w,p){"data"in w&&(p+=w.start,w=w.data);var f=w[p]<<8|w[p+1];return f<0?65536+f:f}function A(w,p){"data"in w&&(p+=w.start,w=w.data);var f=w[p]<<24|w[p+1]<<16|w[p+2]<<8|w[p+3];return f<0?4294967296+f:f}function y(w,p,f){"data"in w&&(p+=w.start,w=w.data),w[p]=f>>24,w[p+1]=f>>16&255,w[p+2]=f>>8&255,w[p+3]=f&255}function S(w,p){var f=[];if(!p.length)return f;var C,b,h;"data"in w?(C=w.data,b=w.start,h=w.end):(C=w,b=0,h=C.byteLength);for(var c=b;c<h;){var s=A(C,c),a=U(C.subarray(c+4,c+8)),g=s>1?c+s:h;if(a===p[0])if(p.length===1)f.push({data:C,start:c+8,end:g});else{var m=S({data:C,start:c+8,end:g},p.slice(1));m.length&&B.apply(f,m)}c=g}return f}function O(w){var p=S(w,["moov"]),f=p[0],C=f?f.end:null,b=S(w,["sidx"]);if(!b||!b[0])return null;var h=[],c=b[0],s=c.data[0],a=s===0?8:16,g=A(c,a);a+=4;var m=0,E=0;s===0?a+=8:a+=16,a+=2;var M=c.end+E,F=k(c,a);a+=2;for(var j=0;j<F;j++){var W=a,D=A(c,W);W+=4;var P=D&2147483647,H=(D&2147483648)>>>31;if(H===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Y=A(c,W);W+=4,h.push({referenceSize:P,subsegmentDuration:Y,info:{duration:Y/g,start:M,end:M+P-1}}),M+=P,W+=4,a=W}return{earliestPresentationTime:m,timescale:g,version:s,referencesCount:F,references:h,moovEndOffset:C}}function _(w){for(var p=[],f=S(w,["moov","trak"]),C=0;C<f.length;C++){var b=f[C],h=S(b,["tkhd"])[0];if(h){var c=h.data[h.start],s=c===0?12:20,a=A(h,s),g=S(b,["mdia","mdhd"])[0];if(g){c=g.data[g.start],s=c===0?12:20;var m=A(g,s),E=S(b,["mdia","hdlr"])[0];if(E){var M=U(E.data.subarray(E.start+8,E.start+12)),F={soun:I.ElementaryStreamTypes.AUDIO,vide:I.ElementaryStreamTypes.VIDEO}[M];if(F){var j=S(b,["mdia","minf","stbl","stsd"])[0],W=void 0;j&&(W=U(j.data.subarray(j.start+12,j.start+16))),p[a]={timescale:m,type:F},p[F]={timescale:m,id:a,codec:W}}}}}}var D=S(w,["moov","mvex","trex"]);return D.forEach(function(P){var H=A(P,4),Y=p[H];Y&&(Y.default={duration:A(P,12),flags:A(P,20)})}),p}function x(w,p){return S(p,["moof","traf"]).reduce(function(f,C){var b=S(C,["tfdt"])[0],h=b.data[b.start],c=S(C,["tfhd"]).reduce(function(s,a){var g=A(a,4),m=w[g];if(m){var E=A(b,4);h===1&&(E*=Math.pow(2,32),E+=A(b,8));var M=m.timescale||9e4,F=E/M;if(isFinite(F)&&(s===null||F<s))return F}return s},null);return c!==null&&isFinite(c)&&(f===null||c<f)?c:f},null)||0}function v(w,p){for(var f=0,C=0,b=0,h=S(w,["moof","traf"]),c=0;c<h.length;c++){var s=h[c],a=S(s,["tfhd"])[0],g=A(a,4),m=p[g];if(!m)continue;var E=m.default,M=A(a,0)|(E==null?void 0:E.flags),F=E==null?void 0:E.duration;M&8&&(M&2?F=A(a,12):F=A(a,8));for(var j=m.timescale||9e4,W=S(s,["trun"]),D=0;D<W.length;D++){if(F){var P=A(W[D],4);f=F*P}else f=d(W[D]);m.type===I.ElementaryStreamTypes.VIDEO?C+=f/j:m.type===I.ElementaryStreamTypes.AUDIO&&(b+=f/j)}}if(C===0&&b===0){var H=O(w);if(H!=null&&H.references)return H.references.reduce(function(Y,ee){return Y+ee.info.duration||0},0)}return C||b}function d(w){var p=A(w,0),f=8;p&1&&(f+=4),p&4&&(f+=4);for(var C=0,b=A(w,4),h=0;h<b;h++){if(p&256){var c=A(w,f);C+=c,f+=4}p&512&&(f+=4),p&1024&&(f+=4),p&2048&&(f+=4)}return C}function o(w,p,f){S(p,["moof","traf"]).forEach(function(C){S(C,["tfhd"]).forEach(function(b){var h=A(b,4),c=w[h];if(!c)return;var s=c.timescale||9e4;S(C,["tfdt"]).forEach(function(a){var g=a.data[a.start],m=A(a,4);if(g===0)y(a,4,m-f*s);else{m*=Math.pow(2,32),m+=A(a,8),m-=f*s,m=Math.max(m,0);var E=Math.floor(m/(R+1)),M=Math.floor(m%(R+1));y(a,4,E),y(a,8,M)}})})})}function u(w){var p={valid:null,remainder:null},f=S(w,["moof"]);if(f){if(f.length<2)return p.remainder=w,p}else return p;var C=f[f.length-1];return p.valid=Object(z.sliceUint8)(w,0,C.start-8),p.remainder=Object(z.sliceUint8)(w,C.start-8),p}function l(w,p){var f=new Uint8Array(w.length+p.length);return f.set(w),f.set(p,w.length),f}},"./src/utils/output-filter.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"default",function(){return z});var z=function(){function I(B,U){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=B,this.trackName=U}var R=I.prototype;return R.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},R.newCue=function(U,k,A){(this.startTime===null||this.startTime>U)&&(this.startTime=U),this.endTime=k,this.screen=A,this.timelineController.createCaptionsTrack(this.trackName)},R.reset=function(){this.cueRanges=[]},I}()},"./src/utils/texttrack-utils.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"sendAddTrackEvent",function(){return I}),L.d(G,"addCueToTrack",function(){return R}),L.d(G,"clearCurrentCues",function(){return B}),L.d(G,"removeCuesInRange",function(){return U}),L.d(G,"getCuesInRange",function(){return A});var z=L("./src/utils/logger.ts");function I(y,S){var O;try{O=new Event("addtrack")}catch(_){O=document.createEvent("Event"),O.initEvent("addtrack",!1,!1)}O.track=y,S.dispatchEvent(O)}function R(y,S){var O=y.mode;if(O==="disabled"&&(y.mode="hidden"),y.cues&&!y.cues.getCueById(S.id))try{if(y.addCue(S),!y.cues.getCueById(S.id))throw new Error("addCue is failed for: "+S)}catch(x){z.logger.debug("[texttrack-utils]: "+x);var _=new self.TextTrackCue(S.startTime,S.endTime,S.text);_.id=S.id,y.addCue(_)}O==="disabled"&&(y.mode=O)}function B(y){var S=y.mode;if(S==="disabled"&&(y.mode="hidden"),y.cues)for(var O=y.cues.length;O--;)y.removeCue(y.cues[O]);S==="disabled"&&(y.mode=S)}function U(y,S,O){var _=y.mode;if(_==="disabled"&&(y.mode="hidden"),y.cues&&y.cues.length>0)for(var x=A(y.cues,S,O),v=0;v<x.length;v++)y.removeCue(x[v]);_==="disabled"&&(y.mode=_)}function k(y,S){if(S<y[0].startTime)return 0;var O=y.length-1;if(S>y[O].endTime)return-1;for(var _=0,x=O;_<=x;){var v=Math.floor((x+_)/2);if(S<y[v].startTime)x=v-1;else if(S>y[v].startTime&&_<O)_=v+1;else return v}return y[_].startTime-S<S-y[x].startTime?_:x}function A(y,S,O){var _=[],x=k(y,S);if(x>-1)for(var v=x,d=y.length;v<d;v++){var o=y[v];if(o.startTime>=S&&o.endTime<=O)_.push(o);else if(o.startTime>O)return _}return _}},"./src/utils/time-ranges.ts":function(re,G,L){"use strict";L.r(G);var z={toString:function(R){for(var B="",U=R.length,k=0;k<U;k++)B+="["+R.start(k).toFixed(3)+","+R.end(k).toFixed(3)+"]";return B}};G.default=z},"./src/utils/timescale-conversion.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"toTimescaleFromBase",function(){return I}),L.d(G,"toTimescaleFromScale",function(){return R}),L.d(G,"toMsFromMpegTsClock",function(){return B}),L.d(G,"toMpegTsClockFromTimescale",function(){return U});var z=9e4;function I(k,A,y,S){y===void 0&&(y=1),S===void 0&&(S=!1);var O=k*A*y;return S?Math.round(O):O}function R(k,A,y,S){return y===void 0&&(y=1),S===void 0&&(S=!1),I(k,A,1/y,S)}function B(k,A){return A===void 0&&(A=!1),I(k,1e3,1/z,A)}function U(k,A){return A===void 0&&(A=1),I(k,z,1/A)}},"./src/utils/typed-array.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"sliceUint8",function(){return z});function z(I,R,B){return Uint8Array.prototype.slice?I.slice(R,B):new Uint8Array(Array.prototype.slice.call(I,R,B))}},"./src/utils/vttcue.ts":function(re,G,L){"use strict";L.r(G),G.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var z=["","lr","rl"],I=["start","middle","end","left","right"];function R(y,S){if(typeof S!="string")return!1;if(!Array.isArray(y))return!1;var O=S.toLowerCase();return~y.indexOf(O)?O:!1}function B(y){return R(z,y)}function U(y){return R(I,y)}function k(y){for(var S=arguments.length,O=new Array(S>1?S-1:0),_=1;_<S;_++)O[_-1]=arguments[_];for(var x=1;x<arguments.length;x++){var v=arguments[x];for(var d in v)y[d]=v[d]}return y}function A(y,S,O){var _=this,x={enumerable:!0};_.hasBeenReset=!1;var v="",d=!1,o=y,u=S,l=O,w=null,p="",f=!0,C="auto",b="start",h=50,c="middle",s=50,a="middle";Object.defineProperty(_,"id",k({},x,{get:function(){return v},set:function(m){v=""+m}})),Object.defineProperty(_,"pauseOnExit",k({},x,{get:function(){return d},set:function(m){d=!!m}})),Object.defineProperty(_,"startTime",k({},x,{get:function(){return o},set:function(m){if(typeof m!="number")throw new TypeError("Start time must be set to a number.");o=m,this.hasBeenReset=!0}})),Object.defineProperty(_,"endTime",k({},x,{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(_,"text",k({},x,{get:function(){return l},set:function(m){l=""+m,this.hasBeenReset=!0}})),Object.defineProperty(_,"region",k({},x,{get:function(){return w},set:function(m){w=m,this.hasBeenReset=!0}})),Object.defineProperty(_,"vertical",k({},x,{get:function(){return p},set:function(m){var E=B(m);if(E===!1)throw new SyntaxError("An invalid or illegal string was specified.");p=E,this.hasBeenReset=!0}})),Object.defineProperty(_,"snapToLines",k({},x,{get:function(){return f},set:function(m){f=!!m,this.hasBeenReset=!0}})),Object.defineProperty(_,"line",k({},x,{get:function(){return C},set:function(m){if(typeof m!="number"&&m!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");C=m,this.hasBeenReset=!0}})),Object.defineProperty(_,"lineAlign",k({},x,{get:function(){return b},set:function(m){var E=U(m);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");b=E,this.hasBeenReset=!0}})),Object.defineProperty(_,"position",k({},x,{get:function(){return h},set:function(m){if(m<0||m>100)throw new Error("Position must be between 0 and 100.");h=m,this.hasBeenReset=!0}})),Object.defineProperty(_,"positionAlign",k({},x,{get:function(){return c},set:function(m){var E=U(m);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");c=E,this.hasBeenReset=!0}})),Object.defineProperty(_,"size",k({},x,{get:function(){return s},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");s=m,this.hasBeenReset=!0}})),Object.defineProperty(_,"align",k({},x,{get:function(){return a},set:function(m){var E=U(m);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");a=E,this.hasBeenReset=!0}})),_.displayState=void 0}return A.prototype.getCueAsHTML=function(){var y=self.WebVTT;return y.convertCueToDOMTree(self,this.text)},A}()},"./src/utils/vttparser.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"parseTimeStamp",function(){return R}),L.d(G,"fixLineBreaks",function(){return S}),L.d(G,"VTTParser",function(){return O});var z=L("./src/utils/vttcue.ts"),I=function(){function _(){}var x=_.prototype;return x.decode=function(d,o){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},_}();function R(_){function x(d,o,u,l){return(d|0)*3600+(o|0)*60+(u|0)+parseFloat(l||0)}var v=_.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return v?parseFloat(v[2])>59?x(v[2],v[3],0,v[4]):x(v[1],v[2],v[3],v[4]):null}var B=function(){function _(){this.values=Object.create(null)}var x=_.prototype;return x.set=function(d,o){!this.get(d)&&o!==""&&(this.values[d]=o)},x.get=function(d,o,u){return u?this.has(d)?this.values[d]:o[u]:this.has(d)?this.values[d]:o},x.has=function(d){return d in this.values},x.alt=function(d,o,u){for(var l=0;l<u.length;++l)if(o===u[l]){this.set(d,o);break}},x.integer=function(d,o){/^-?\d+$/.test(o)&&this.set(d,parseInt(o,10))},x.percent=function(d,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var u=parseFloat(o);if(u>=0&&u<=100)return this.set(d,u),!0}return!1},_}();function U(_,x,v,d){var o=d?_.split(d):[_];for(var u in o){if(typeof o[u]!="string")continue;var l=o[u].split(v);if(l.length!==2)continue;var w=l[0],p=l[1];x(w,p)}}var k=new z.default(0,0,""),A=k.align==="middle"?"middle":"center";function y(_,x,v){var d=_;function o(){var w=R(_);if(w===null)throw new Error("Malformed timestamp: "+d);return _=_.replace(/^[^\sa-zA-Z-]+/,""),w}function u(w,p){var f=new B;U(w,function(h,c){var s;switch(h){case"region":for(var a=v.length-1;a>=0;a--)if(v[a].id===c){f.set(h,v[a].region);break}break;case"vertical":f.alt(h,c,["rl","lr"]);break;case"line":s=c.split(","),f.integer(h,s[0]),f.percent(h,s[0])&&f.set("snapToLines",!1),f.alt(h,s[0],["auto"]),s.length===2&&f.alt("lineAlign",s[1],["start",A,"end"]);break;case"position":s=c.split(","),f.percent(h,s[0]),s.length===2&&f.alt("positionAlign",s[1],["start",A,"end","line-left","line-right","auto"]);break;case"size":f.percent(h,c);break;case"align":f.alt(h,c,["start",A,"end","left","right"]);break}},/:/,/\s/),p.region=f.get("region",null),p.vertical=f.get("vertical","");var C=f.get("line","auto");C==="auto"&&k.line===-1&&(C=-1),p.line=C,p.lineAlign=f.get("lineAlign","start"),p.snapToLines=f.get("snapToLines",!0),p.size=f.get("size",100),p.align=f.get("align",A);var b=f.get("position","auto");b==="auto"&&k.position===50&&(b=p.align==="start"||p.align==="left"?0:p.align==="end"||p.align==="right"?100:50),p.position=b}function l(){_=_.replace(/^\s+/,"")}if(l(),x.startTime=o(),l(),_.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);_=_.substr(3),l(),x.endTime=o(),l(),u(_,x)}function S(_){return _.replace(/<br(?: \/)?>/gi,`
|
|
`)}var O=function(){function _(){this.state="INITIAL",this.buffer="",this.decoder=new I,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var x=_.prototype;return x.parse=function(d){var o=this;d&&(o.buffer+=o.decoder.decode(d,{stream:!0}));function u(){var b=o.buffer,h=0;for(b=S(b);h<b.length&&b[h]!=="\r"&&b[h]!==`
|
|
`;)++h;var c=b.substr(0,h);return b[h]==="\r"&&++h,b[h]===`
|
|
`&&++h,o.buffer=b.substr(h),c}function l(b){U(b,function(h,c){},/:/)}try{var w="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;w=u();var p=w.match(/^()?WEBVTT([ \t].*)?$/);if(!p||!p[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var f=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;f?f=!1:w=u();switch(o.state){case"HEADER":/:/.test(w)?l(w):w||(o.state="ID");continue;case"NOTE":w||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(w)){o.state="NOTE";break}if(!w)continue;if(o.cue=new z.default(0,0,""),o.state="CUE",w.indexOf("-->")===-1){o.cue.id=w;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{y(w,o.cue,o.regionList)}catch(b){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var C=w.indexOf("-->")!==-1;if(!w||C&&(f=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
|
|
`),o.cue.text+=w}continue;case"BADCUE":w||(o.state="ID")}}}catch(b){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},x.flush=function(){var d=this;try{if((d.cue||d.state==="HEADER")&&(d.buffer+=`
|
|
|
|
`,d.parse()),d.state==="INITIAL"||d.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){d.onparsingerror&&d.onparsingerror(o)}return d.onflush&&d.onflush(),this},_}()},"./src/utils/webvtt-parser.ts":function(re,G,L){"use strict";L.r(G),L.d(G,"generateCueId",function(){return O}),L.d(G,"parseWebVTT",function(){return x});var z=L("./src/polyfills/number.ts"),I=L("./src/utils/vttparser.ts"),R=L("./src/demux/id3.ts"),B=L("./src/utils/timescale-conversion.ts"),U=L("./src/remux/mp4-remuxer.ts"),k=/\r\n|\n\r|\n|\r/g,A=function(d,o,u){return u===void 0&&(u=0),d.substr(u,o.length)===o},y=function(d){var o=parseInt(d.substr(-3)),u=parseInt(d.substr(-6,2)),l=parseInt(d.substr(-9,2)),w=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(z.isFiniteNumber)(o)||!Object(z.isFiniteNumber)(u)||!Object(z.isFiniteNumber)(l)||!Object(z.isFiniteNumber)(w))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return o+=1e3*u,o+=60*1e3*l,o+=60*60*1e3*w,o},S=function(d){for(var o=5381,u=d.length;u;)o=o*33^d.charCodeAt(--u);return(o>>>0).toString()};function O(v,d,o){return S(v.toString())+S(d.toString())+S(o)}var _=function(d,o,u){var l=d[o],w=d[l.prevCC];if(!w||!w.new&&l.new){d.ccOffset=d.presentationOffset=l.start,l.new=!1;return}for(;(p=w)!==null&&p!==void 0&&p.new;){var p;d.ccOffset+=l.start-w.start,l.new=!1,l=w,w=d[l.prevCC]}d.presentationOffset=u};function x(v,d,o,u,l,w,p,f){var C=new I.VTTParser,b=Object(R.utf8ArrayToStr)(new Uint8Array(v)).trim().replace(k,`
|
|
`).split(`
|
|
`),h=[],c=Object(B.toMpegTsClockFromTimescale)(d,o),s="00:00.000",a=0,g=0,m,E=!0,M=!1;C.oncue=function(F){var j=u[l],W=u.ccOffset,D=(a-c)/9e4;if(j!=null&&j.new&&(g!==void 0?W=u.ccOffset=j.start:_(u,l,D)),D&&(W=D-u.presentationOffset),M){var P=F.endTime-F.startTime,H=Object(U.normalizePts)((F.startTime+W-g)*9e4,w*9e4)/9e4;F.startTime=H,F.endTime=H+P}var Y=F.text.trim();F.text=decodeURIComponent(encodeURIComponent(Y)),F.id||(F.id=O(F.startTime,F.endTime,Y)),F.endTime>0&&h.push(F)},C.onparsingerror=function(F){m=F},C.onflush=function(){if(m){f(m);return}p(h)},b.forEach(function(F){if(E)if(A(F,"X-TIMESTAMP-MAP=")){E=!1,M=!0,F.substr(16).split(",").forEach(function(j){A(j,"LOCAL:")?s=j.substr(6):A(j,"MPEGTS:")&&(a=parseInt(j.substr(7)))});try{g=y(s)/1e3}catch(j){M=!1,m=j}return}else F===""&&(E=!1);C.parse(F+`
|
|
`)}),C.flush()}},"./src/utils/xhr-loader.ts":function(re,G,L){"use strict";L.r(G);var z=L("./src/utils/logger.ts"),I=L("./src/loader/load-stats.ts"),R=/^age:\s*[\d.]+\s*$/m,B=function(){function U(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 I.LoadStats,this.retryDelay=0}var k=U.prototype;return k.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},k.abortInternal=function(){var y=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),y&&(y.onreadystatechange=null,y.onprogress=null,y.readyState!==4&&(this.stats.aborted=!0,y.abort()))},k.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},k.load=function(y,S,O){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=y,this.config=S,this.callbacks=O,this.retryDelay=S.retryDelay,this.loadInternal()},k.loadInternal=function(){var y=this.config,S=this.context;if(!y)return;var O=this.loader=new self.XMLHttpRequest,_=this.stats;_.loading.first=0,_.loaded=0;var x=this.xhrSetup;try{if(x)try{x(O,S.url)}catch(o){O.open("GET",S.url,!0),x(O,S.url)}O.readyState||O.open("GET",S.url,!0);var v=this.context.headers;if(v)for(var d in v)O.setRequestHeader(d,v[d])}catch(o){this.callbacks.onError({code:O.status,text:o.message},S,O);return}S.rangeEnd&&O.setRequestHeader("Range","bytes="+S.rangeStart+"-"+(S.rangeEnd-1)),O.onreadystatechange=this.readystatechange.bind(this),O.onprogress=this.loadprogress.bind(this),O.responseType=S.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout),O.send()},k.readystatechange=function(){var y=this.context,S=this.loader,O=this.stats;if(!y||!S)return;var _=S.readyState,x=this.config;if(O.aborted)return;if(_>=2)if(self.clearTimeout(this.requestTimeout),O.loading.first===0&&(O.loading.first=Math.max(self.performance.now(),O.loading.start)),_===4){S.onreadystatechange=null,S.onprogress=null;var v=S.status;if(v>=200&&v<300){O.loading.end=Math.max(self.performance.now(),O.loading.first);var d,o;if(y.responseType==="arraybuffer"?(d=S.response,o=d.byteLength):(d=S.responseText,o=d.length),O.loaded=O.total=o,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(O,y,d,S),!this.callbacks)return;var l={url:S.responseURL,data:d};this.callbacks.onSuccess(l,O,y,S)}else O.retry>=x.maxRetry||v>=400&&v<499?(z.logger.error(v+" while loading "+y.url),this.callbacks.onError({code:v,text:S.statusText},y,S)):(z.logger.warn(v+" while loading "+y.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,x.maxRetryDelay),O.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),x.timeout)},k.loadtimeout=function(){z.logger.warn("timeout while loading "+this.context.url);var y=this.callbacks;y&&(this.abortInternal(),y.onTimeout(this.stats,this.context,this.loader))},k.loadprogress=function(y){var S=this.stats;S.loaded=y.loaded,y.lengthComputable&&(S.total=y.total)},k.getCacheAge=function(){var y=null;if(this.loader&&R.test(this.loader.getAllResponseHeaders())){var S=this.loader.getResponseHeader("age");y=S?parseFloat(S):null}return y},U}();G.default=B}}).default})},vHTk:function(ot,Ge,Z){ot.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},we55:function(ot,Ge,Z){ot.exports={bg:"bg___3PaSA",flexRow:"flexRow___1k1iY",flexJustifyCenter:"flexJustifyCenter___MzzvD",flexAlignEnd:"flexAlignEnd___1KYBf",flexAlignCenter:"flexAlignCenter___3XoYY",flexColumn:"flexColumn___28jeJ",formWrap:"formWrap___2IoYS",titleWrap:"titleWrap___2LenH",fieldWrap:"fieldWrap___3zhLT",mdWrap:"mdWrap___3fVSN",backgroundFa:"backgroundFa___21qxJ",button:"button___3eTeL"}},wzkS:function(ot,Ge,Z){"use strict";Z.d(Ge,"c",function(){return I}),Z.d(Ge,"b",function(){return R}),Z.d(Ge,"d",function(){return B}),Z.d(Ge,"a",function(){return k}),Z.d(Ge,"e",function(){return A});var re=Z("9og8"),G=Z("WmNS"),L=Z.n(G),z=Z("ErOA");function I(y){return Object(z.c)("libraries/".concat(y,".json"))}function R(){return Object(z.c)("library_tags.json")}function B(y){return U.apply(this,arguments)}function U(){return U=Object(re.a)(L.a.mark(function y(S){var O;return L.a.wrap(function(x){for(;;)switch(x.prev=x.next){case 0:return x.next=2,Object(z.b)("attachments/".concat(S,".json"));case 2:return O=x.sent,x.abrupt("return",O.status===0);case 4:case"end":return x.stop()}},y)})),U.apply(this,arguments)}function k(y){return Object(z.f)("libraries.json",y)}function A(y,S){return Object(z.g)("libraries/".concat(y,".json"),S)}},y5JW:function(ot,Ge,Z){"use strict";Z.d(Ge,"c",function(){return v}),Z.d(Ge,"a",function(){return d});var re=Z("DZo9"),G=Z("8z0m"),L=Z("+L6B"),z=Z("2/Rp"),I=Z("9og8"),R=Z("miYZ"),B=Z("tsqr"),U=Z("k1fw"),k=Z("oBTY"),A=Z("WmNS"),y=Z.n(A),S=Z("cDcd"),O=Z.n(S),_=Z("m3rI"),x=Z("wzkS"),v="\u3000\u3000";function d(o){var u=["Bytes","KB","MB","GB","TB"];if(o==0)return"0 Byte";var l=parseInt(""+Math.floor(Math.log(o)/Math.log(1024)),10);return(o/Math.pow(1024,l)).toFixed(1)+" "+u[l]}Ge.b=function(o){var u=o.value,l=u===void 0?[]:u,w=o.action,p=o.onChange,f=o.className,C=o.maxSize,b=C===void 0?150:C,h=o.title,c=h===void 0?"\u6587\u4EF6\u4E0A\u4F20":h,s=o.accept,a=s===void 0?null:s,g={multiple:!1,fileList:l,accept:a,withCredentials:!0,beforeUpload:function(M){var F=M.size/1024/1024;return!0},action:"".concat(_.a.API_SERVER,"/api/attachments.json"),onChange:function(M){var F,j,W=Object(k.a)(M.fileList);if(W=W.map(function(H){return H.name.indexOf(v)===-1&&(H.name="".concat(H.name).concat(v).concat(d(H.size))),Object(U.a)({},H)}),M.file.status==="done"&&((F=M.file)===null||F===void 0||((j=F.response)===null||j===void 0)?void 0:j.status)===-1){var D,P;B.b.error((D=M.file)===null||D===void 0||((P=D.response)===null||P===void 0)?void 0:P.message),p([]);return}p(W)},onRemove:function(){var E=Object(I.a)(y.a.mark(function F(j){var W,D,P;return y.a.wrap(function(Y){for(;;)switch(Y.prev=Y.next){case 0:if(W=j.size/1024/1024,!(j.status==="uploading")){Y.next=3;break}return Y.abrupt("return",!0);case 3:if(W<b){Y.next=7;break}return Y.abrupt("return",!0);case 7:if(D=j.response?j.response.id:j.uid,!D){Y.next=15;break}return Y.next=11,Object(x.d)(j.response?j.response.id:j.id);case 11:return P=Y.sent,Y.abrupt("return",P);case 15:return Y.abrupt("return",!0);case 16:case"end":return Y.stop()}},F)}));function M(F){return E.apply(this,arguments)}return M}()};function m(E){E.preventDefault(),E.stopPropagation()}return O.a.createElement("div",{className:"single-upload ".concat(f||"")},O.a.createElement(G.a,g,O.a.createElement(z.a,{type:"primary",title:l.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:l.length>0,ghost:!0},c),O.a.createElement("span",{onClick:m,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",b,"M)"," ")))}},yQHh:function(ot,Ge,Z){}}]);
|