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
764 KiB
143 lines
764 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[82,5,6,7],{"+NIl":function(ot,ze,Z){(function(re){re(Z("VrN/"))})(function(re){"use strict";re.defineMode("stex",function(z,L){"use strict";function G(_,x){_.cmdState.push(x)}function I(_){return _.cmdState.length>0?_.cmdState[_.cmdState.length-1]:null}function P(_){var x=_.cmdState.pop();x&&x.closeBracket()}function B(_){for(var x=_.cmdState,y=x.length-1;y>=0;y--){var d=x[y];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function U(_,x,y){return function(){this.name=_,this.bracketNo=0,this.style=x,this.styles=y,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 b(_,x){var y;if(_.match(/^\\[a-zA-Z@]+/)){var d=_.current().slice(1);return y=k.hasOwnProperty(d)?k[d]:k.DEFAULT,y=new y,G(x,y),A(x,O),y.style}if(_.match(/^\\[$&%#{}_]/))return"tag";if(_.match(/^\\[,;!\/\\]/))return"tag";if(_.match("\\["))return A(x,function(u,s){return S(u,s,"\\]")}),"keyword";if(_.match("\\("))return A(x,function(u,s){return S(u,s,"\\)")}),"keyword";if(_.match("$$"))return A(x,function(u,s){return S(u,s,"$$")}),"keyword";if(_.match("$"))return A(x,function(u,s){return S(u,s,"$")}),"keyword";var o=_.next();if(o=="%")return _.skipToEnd(),"comment";if(o=="}"||o=="]"){if(y=I(x),y)y.closeBracket(o),A(x,O);else return"error";return"bracket"}else return o=="{"||o=="["?(y=k.DEFAULT,y=new y,G(x,y),"bracket"):/\d/.test(o)?(_.eatWhile(/[\w.%]/),"atom"):(_.eatWhile(/[\w\-_]/),y=B(x),y.name=="begin"&&(y.argument=_.current()),y.styleIdentifier())}function S(_,x,y){if(_.eatSpace())return null;if(y&&_.match(y))return A(x,b),"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 y=_.peek(),d;return y=="{"||y=="["?(d=I(x),d.openBracket(y),_.eat(y),A(x,b),"bracket"):/[ \t\r]/.test(y)?(_.eat(y),null):(A(x,b),P(x),b(_,x))}return{startState:function(){var _=L.inMathMode?function(x,y){return S(x,y)}:b;return{cmdState:[],f:_}},copyState:function(_){return{cmdState:_.cmdState.slice(),f:_.f}},token:function(_,x){return x.f(_,x)},blankLine:function(_){_.f=b,_.cmdState.length=0},lineComment:"%"}}),re.defineMIME("text/x-stex","stex"),re.defineMIME("text/x-latex","stex")})},"+ua5":function(ot,ze,Z){},"19Vz":function(ot,ze,Z){(function(re){re(Z("VrN/"))})(function(re){re.defineOption("placeholder","",function(U,k,A){var b=A&&A!=re.Init;if(k&&!b)U.on("blur",I),U.on("change",P),U.on("swapDoc",P),re.on(U.getInputField(),"compositionupdate",U.state.placeholderCompose=function(){G(U)}),P(U);else if(!k&&b){U.off("blur",I),U.off("change",P),U.off("swapDoc",P),re.off(U.getInputField(),"compositionupdate",U.state.placeholderCompose),z(U);var S=U.getWrapperElement();S.className=S.className.replace(" CodeMirror-empty","")}k&&!U.hasFocus()&&I(U)});function z(U){U.state.placeholder&&(U.state.placeholder.parentNode.removeChild(U.state.placeholder),U.state.placeholder=null)}function L(U){z(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 G(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):z(U)},20)}function I(U){B(U)&&L(U)}function P(U){var k=U.getWrapperElement(),A=B(U);k.className=k.className.replace(" CodeMirror-empty","")+(A?" CodeMirror-empty":""),A?L(U):z(U)}function B(U){return U.lineCount()===1&&U.getLine(0)===""}})},"1eCo":function(ot,ze,Z){(function(re){re(Z("VrN/"))})(function(re){"use strict";var z={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},L={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};re.defineMode("xml",function(G,I){var P=G.indentUnit,B={},U=I.htmlMode?z:L;for(var k in U)B[k]=U[k];for(var k in I)B[k]=I[k];var A,b;function S(a,v){function p(F){return v.tokenize=F,F(a,v)}var E=a.next();if(E=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?p(x("atom","]]>")):null:a.match("--")?p(x("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),p(y(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),v.tokenize=x("meta","?>"),"meta"):(A=a.eat("/")?"closeTag":"openTag",v.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,v){var p=a.next();if(p==">"||p=="/"&&a.eat(">"))return v.tokenize=S,A=p==">"?"endTag":"selfcloseTag","tag bracket";if(p=="=")return A="equals",null;if(p=="<"){v.tokenize=S,v.state=s,v.tagName=v.tagStart=null;var E=v.tokenize(a,v);return E?E+" tag error":"tag error"}else return/[\'\"]/.test(p)?(v.tokenize=_(p),v.stringStartCol=a.column(),v.tokenize(a,v)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function _(a){var v=function(p,E){for(;!p.eol();)if(p.next()==a){E.tokenize=O;break}return"string"};return v.isInAttribute=!0,v}function x(a,v){return function(p,E){for(;!p.eol();){if(p.match(v)){E.tokenize=S;break}p.next()}return a}}function y(a){return function(v,p){for(var E;(E=v.next())!=null;){if(E=="<")return p.tokenize=y(a+1),p.tokenize(v,p);if(E==">")if(a==1){p.tokenize=S;break}else return p.tokenize=y(a-1),p.tokenize(v,p)}return"meta"}}function d(a,v,p){this.prev=a.context,this.tagName=v,this.indent=a.indented,this.startOfLine=p,(B.doNotIndent.hasOwnProperty(v)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function u(a,v){for(var p;;){if(!a.context)return;if(p=a.context.tagName,!B.contextGrabbers.hasOwnProperty(p)||!B.contextGrabbers[p].hasOwnProperty(v))return;o(a)}}function s(a,v,p){return a=="openTag"?(p.tagStart=v.column(),w):a=="closeTag"?g:s}function w(a,v,p){return a=="word"?(p.tagName=v.current(),b="tag",m):B.allowMissingTagName&&a=="endTag"?(b="tag bracket",m(a,v,p)):(b="error",w)}function g(a,v,p){if(a=="word"){var E=v.current();return p.context&&p.context.tagName!=E&&B.implicitlyClosed.hasOwnProperty(p.context.tagName)&&o(p),p.context&&p.context.tagName==E||B.matchClosing===!1?(b="tag",f):(b="tag error",C)}else return B.allowMissingTagName&&a=="endTag"?(b="tag bracket",f(a,v,p)):(b="error",C)}function f(a,v,p){return a!="endTag"?(b="error",f):(o(p),s)}function C(a,v,p){return b="error",f(a,v,p)}function m(a,v,p){if(a=="word")return b="attribute",h;if(a=="endTag"||a=="selfcloseTag"){var E=p.tagName,M=p.tagStart;return p.tagName=p.tagStart=null,a=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(E)?u(p,E):(u(p,E),p.context=new d(p,E,M==p.indented)),s}return b="error",m}function h(a,v,p){return a=="equals"?c:(B.allowMissing||(b="error"),m(a,v,p))}function c(a,v,p){return a=="string"?l:a=="word"&&B.allowUnquoted?(b="string",m):(b="error",m(a,v,p))}function l(a,v,p){return a=="string"?l:m(a,v,p)}return{startState:function(a){var v={tokenize:S,state:s,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(v.baseIndent=a),v},token:function(a,v){if(!v.tagName&&a.sol()&&(v.indented=a.indentation()),a.eatSpace())return null;A=null;var p=v.tokenize(a,v);return(p||A)&&p!="comment"&&(b=null,v.state=v.state(A||p,a,v),b&&(p=b=="error"?p+" error":b)),p},indent:function(a,v,p){var E=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+P;if(E&&E.noIndent)return re.Pass;if(a.tokenize!=O&&a.tokenize!=S)return p?p.match(/^(\s*)/)[0].length:0;if(a.tagName)return B.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+P*(B.multilineTagIndentFactor||1);if(B.alignCDATA&&/<!\[CDATA\[/.test(v))return 0;var M=v&&/^<(\/)?([\w_:\.-]*)/.exec(v);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+P: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=m)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var v=[],p=a.context;p;p=p.prev)p.tagName&&v.push(p.tagName);return v.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,ze,Z){"use strict";Z.d(ze,"a",function(){return g});var re=Z("+L6B"),z=Z("2/Rp"),L=Z("2qtc"),G=Z("kLXV"),I=Z("9og8"),P=Z("k1fw"),B=Z("miYZ"),U=Z("tsqr"),k=Z("oBTY"),A=Z("tJVT"),b=Z("DZo9"),S=Z("8z0m"),O=Z("WmNS"),_=Z.n(O),x=Z("cDcd"),y=Z.n(x),d=Z("m3rI"),o=Z("wzkS"),u=Z("y5JW"),s=Z("LtfV"),w=S.a.Dragger;function g(f){var C=[];return f&&f.length>0&&(C=f.map(function(m){return{uid:m.id,id:m.id,name:m.title+u.c+m.filesize,url:m.url,filesize:m.filesize,status:"done",response:{id:m.id}}})),C}ze.b=function(f){var C=f.value,m=f.onChange,h=f.action,c=f.className,l=f.maxSize,a=l===void 0?150:l,v=f.title,p=v===void 0?"\u4E0A\u4F20\u9644\u4EF6":v,E=f.showRemoveModal,M=E===void 0?!1:E,F=f.accept,j=F===void 0?"":F,W=f.additionalText,D=f.isDragger,R=f.number,H=R===void 0?1e3:R,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||[]),pe=Object(A.a)(le,2),ie=pe[0],me=pe[1];Object(x.useEffect)(function(){C&&(me(Object(k.a)(C)),H===(C==null?void 0:C.length)&&he(!0))},[C]);var J=function(){setTimeout(function(){ie.pop(),me(Object(k.a)(ie))},500)},ne={multiple:!0,disabled:ye,accept:j,withCredentials:!0,fileList:ie,beforeUpload:function(_e,be){var ve=_e.size/1024/1024;return ie.concat(be).length>H?(ie.pop(),me(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(_e){var be,ve,we=Object(k.a)(_e.fileList);if(_e.file.status==="done"&&((be=_e.file)===null||be===void 0||((ve=be.response)===null||ve===void 0)?void 0:ve.status)===-1){var Oe,ke;U.b.error((Oe=_e.file)===null||Oe===void 0||((ke=Oe.response)===null||ke===void 0)?void 0:ke.message);return}we.length>=H?he(!0):he(!1),me(Object(k.a)(we)),we=we.map(function(Ce){var Re;if(Ce!=null&&(Re=Ce.response)!==null&&Re!==void 0&&Re.id){var je;Ce.url="/api/attachments/".concat(Ce==null||((je=Ce.response)===null||je===void 0)?void 0:je.id)}return Ce.name.indexOf(u.c)===-1&&(Ce.name="".concat(Ce.name).concat(u.c).concat(Object(u.a)(Ce.size))),Object(P.a)({},Ce)}),console.log("info:",_e),m(we)},onRemove:function(){var xe=Object(I.a)(_.a.mark(function be(ve){var we;return _.a.wrap(function(ke){for(;;)switch(ke.prev=ke.next){case 0:if(we=function(){var Ce=Object(I.a)(_.a.mark(function Re(){var je,He;return _.a.wrap(function(Ne){for(;;)switch(Ne.prev=Ne.next){case 0:if(je=ve.response?ve.response.id:ve.id,!je){Ne.next=8;break}return Ne.next=4,Object(o.d)(ve.response?ve.response.id:ve.uid);case 4:return He=Ne.sent,Ne.abrupt("return",He);case 8:return Ne.abrupt("return",!0);case 9:case"end":return Ne.stop()}},Re)}));return function(){return Ce.apply(this,arguments)}}(),!M){ke.next=5;break}return ke.abrupt("return",new Promise(function(Ce,Re){G.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:y.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var je=Object(I.a)(_.a.mark(function Be(){var Ne;return _.a.wrap(function(Xe){for(;;)switch(Xe.prev=Xe.next){case 0:return Xe.next=2,we();case 2:Ne=Xe.sent,U.b.success("\u5220\u9664\u6210\u529F"),Ce(!0);case 5:case"end":return Xe.stop()}},Be)}));function He(){return je.apply(this,arguments)}return He}(),onCancel:function(){return Ce(!1)}})}));case 5:return ke.next=7,we();case 7:return ke.abrupt("return",ke.sent);case 8:case"end":return ke.stop()}},be)}));function _e(be){return xe.apply(this,arguments)}return _e}()};function q(xe){xe.preventDefault(),xe.stopPropagation()}return y.a.createElement("div",{className:"multi-upload ".concat(c||"")},D&&y.a.createElement(w,ne,y.a.createElement("p",{className:"ant-upload-drag-icon"},y.a.createElement(s.a,null)),y.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",y.a.createElement("br",null),"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",a,"MB)"," "),W),!D&&y.a.createElement(S.a,ne,y.a.createElement(z.a,{disabled:ye},p),y.a.createElement("span",{onClick:q,style:{marginLeft:10,color:"#FA6400"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",a,"MB)"," ")))}},"55Ip":function(ot,ze,Z){"use strict";Z.d(ze,"a",function(){return u});var re=Z("Ty5D"),z=Z("dI71"),L=Z("cDcd"),G=Z.n(L),I=Z("YS25"),P=Z("17x9"),B=Z.n(P),U=Z("wx14"),k=Z("zLVn"),A=Z("9R94"),b=function(c){Object(z.a)(l,c);function l(){for(var v,p=arguments.length,E=new Array(p),M=0;M<p;M++)E[M]=arguments[M];return v=c.call.apply(c,[this].concat(E))||this,v.history=Object(I.a)(v.props),v}var a=l.prototype;return a.render=function(){return G.a.createElement(re.c,{history:this.history,children:this.props.children})},l}(G.a.Component),S=function(c){Object(z.a)(l,c);function l(){for(var v,p=arguments.length,E=new Array(p),M=0;M<p;M++)E[M]=arguments[M];return v=c.call.apply(c,[this].concat(E))||this,v.history=Object(I.b)(v.props),v}var a=l.prototype;return a.render=function(){return G.a.createElement(re.c,{history:this.history,children:this.props.children})},l}(G.a.Component),O=function(l,a){return typeof l=="function"?l(a):l},_=function(l,a){return typeof l=="string"?Object(I.c)(l,null,null,a):l},x=function(l){return l},y=G.a.forwardRef;typeof y=="undefined"&&(y=x);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=y(function(c,l){var a=c.innerRef,v=c.navigate,p=c.onClick,E=Object(k.a)(c,["innerRef","navigate","onClick"]),M=E.target,F=Object(U.a)({},E,{onClick:function(W){try{p&&p(W)}catch(D){throw W.preventDefault(),D}!W.defaultPrevented&&W.button===0&&(!M||M==="_self")&&!d(W)&&(W.preventDefault(),v())}});return x!==y?F.ref=l||a:F.ref=a,G.a.createElement("a",F)}),u=y(function(c,l){var a=c.component,v=a===void 0?o:a,p=c.replace,E=c.to,M=c.innerRef,F=Object(k.a)(c,["component","replace","to","innerRef"]);return G.a.createElement(re.e.Consumer,null,function(j){j||Object(A.a)(!1);var W=j.history,D=_(O(E,j.location),j.location),R=D?W.createHref(D):"",H=Object(U.a)({},F,{href:R,navigate:function(){var ee=O(E,j.location),oe=p?W.replace:W.push;oe(ee)}});return x!==y?H.ref=l||M:H.innerRef=M,G.a.createElement(v,H)})});if(!1)var s,w;var g=function(l){return l},f=G.a.forwardRef;typeof f=="undefined"&&(f=g);function C(){for(var c=arguments.length,l=new Array(c),a=0;a<c;a++)l[a]=arguments[a];return l.filter(function(v){return v}).join(" ")}var m=f(function(c,l){var a=c["aria-current"],v=a===void 0?"page":a,p=c.activeClassName,E=p===void 0?"active":p,M=c.activeStyle,F=c.className,j=c.exact,W=c.isActive,D=c.location,R=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 G.a.createElement(re.e.Consumer,null,function(ye){ye||Object(A.a)(!1);var he=D||ye.location,le=_(O(ee,he),he),pe=le.pathname,ie=pe&&pe.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),me=ie?Object(re.f)(he.pathname,{path:ie,exact:j,sensitive:R,strict:H}):null,J=!!(W?W(me,he):me),ne=J?C(F,E):F,q=J?Object(U.a)({},Y,{},M):Y,xe=Object(U.a)({"aria-current":J&&v||null,className:ne,style:q,to:le},Te);return g!==f?xe.ref=l||oe:xe.innerRef=oe,G.a.createElement(u,xe)})});if(!1)var h},"7Cbv":function(ot,ze,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),z=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(z)}var G=/^(?:[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"&&G.test(O)}for(var P=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(!P(x))throw TypeError("Stringified UUID is invalid");return x}var A=k;function b(O,_,x){O=O||{};var y=O.random||(O.rng||L)();if(y[6]=y[6]&15|64,y[8]=y[8]&63|128,_){x=x||0;for(var d=0;d<16;++d)_[x+d]=y[d];return _}return A(y)}var S=ze.a=b},"7ahc":function(ot,ze,Z){"use strict";Z.d(ze,"a",function(){return w});var re=Z("k1fw"),z=Z("0Owb"),L=Z("+L6B"),G=Z("2/Rp"),I=Z("y8nQ"),P=Z("Vl3Y"),B=Z("tJVT"),U=Z("OaEy"),k=Z("2fM7"),A=Z("cDcd"),b=Z.n(A),S=Z("VrN/"),O=Z.n(S),_=Z("p77/"),x=Z.n(_),y=Z("c5Ni"),d=Z.n(y),o=k.a.Option,u={labelCol:{span:4},wrapperCol:{span:20}},s={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"]};ze.b=function(g){var f=g.callback,C=g.onCancel,m=Object(A.useState)("python"),h=Object(B.a)(m,2),c=h[0],l=h[1];function a(p){l(s[p][1])}function v(p){f(p)}return b.a.createElement(P.a,Object(z.a)({},u,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:v}),b.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},b.a.createElement(k.a,{onChange:a},Object.keys(s).map(function(p){return b.a.createElement(o,{key:p,value:p},s[p][0])}))),b.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},b.a.createElement(w,{mode:c})),b.a.createElement("div",{className:"flex-container flex-end"},b.a.createElement(G.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(G.a,{type:"ghost",onClick:C},"\u53D6\u6D88")))};function w(g){var f=g.value,C=g.onChange,m=g.mode,h=g.options,c=h===void 0?{}:h,l=Object(A.useRef)(),a=Object(A.useState)(),v=Object(B.a)(a,2),p=v[0],E=v[1];return Object(A.useEffect)(function(){if(p){function M(F){var j=F.getValue();C&&C(j)}return p.on("change",M),function(){p.off("change",M)}}},[p,C]),Object(A.useEffect)(function(){p&&p.setOption("mode",m)},[p,m]),Object(A.useEffect)(function(){p&&((f!==p.getValue()||f==="")&&setTimeout(function(){p.setValue(f||" ")},300))},[p,f]),Object(A.useEffect)(function(){if(l.current&&!p){var M=O.a.fromTextArea(l.current,Object(re.a)({mode:m,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));E(M)}},[l.current,p]),b.a.createElement("div",{className:"my-codemirror-container"},b.a.createElement("textarea",{ref:l}))}},"8EBN":function(ot,ze,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 z=0;z<re.modeInfo.length;z++){var L=re.modeInfo[z];L.mimes&&(L.mime=L.mimes[0])}re.findModeByMIME=function(G){G=G.toLowerCase();for(var I=0;I<re.modeInfo.length;I++){var P=re.modeInfo[I];if(P.mime==G)return P;if(P.mimes){for(var B=0;B<P.mimes.length;B++)if(P.mimes[B]==G)return P}}if(/\+xml$/.test(G))return re.findModeByMIME("application/xml");if(/\+json$/.test(G))return re.findModeByMIME("application/json")},re.findModeByExtension=function(G){G=G.toLowerCase();for(var I=0;I<re.modeInfo.length;I++){var P=re.modeInfo[I];if(P.ext){for(var B=0;B<P.ext.length;B++)if(P.ext[B]==G)return P}}},re.findModeByFileName=function(G){for(var I=0;I<re.modeInfo.length;I++){var P=re.modeInfo[I];if(P.file&&P.file.test(G))return P}var B=G.lastIndexOf("."),U=B>-1&&G.substring(B+1,G.length);if(U)return re.findModeByExtension(U)},re.findModeByName=function(G){G=G.toLowerCase();for(var I=0;I<re.modeInfo.length;I++){var P=re.modeInfo[I];if(P.name.toLowerCase()==G)return P;if(P.alias){for(var B=0;B<P.alias.length;B++)if(P.alias[B].toLowerCase()==G)return P}}}})},"8hTe":function(ot,ze,Z){ot.exports={button:"button___1wy9m"}},"9Bee":function(ot,ze,Z){"use strict";var re=Z("DYRE"),z=Z("zeV3"),L=Z("+L6B"),G=Z("2/Rp"),I=Z("k1fw"),P=Z("tJVT"),B=Z("cDcd"),U=Z.n(B),k=Z("vg9a"),A=Z("DlQD"),b=Z.n(A),S=Z("rUJ1");function O(he,le){var pe=he.match(/^(\s+)(?:```)/);if(pe===null)return le;var ie=pe[1];return le.split(`
|
|
`).map(function(me){var J=me.match(/^\s+/);if(J===null)return me;var ne=Object(P.a)(J,1),q=ne[0];return q.length>=ie.length?me.slice(ie.length):me}).join(`
|
|
`)}var _=[],x=["<ul>"],y=new b.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 s(he,le,pe,ie){if(le>=he.length||he[le].level<=pe)return le;var me=he[le];ie.push("<li><a href='#"+me.anchor+"'>"+me.text+"</a>"),le++;var J=[];return le=s(he,le,me.level,J),J.length>0&&(ie.push("<ul>"),J.forEach(function(ne){ie.push(ne)}),ie.push("</ul>")),ie.push("</li>"),le=s(he,le,pe,ie),le}function w(){return s(_,0,0,x),x.push("</ul>"),x.join("")}var g={heading:function(le){var pe=d.exec(le);if(pe)return{type:"heading",raw:pe[0],depth:pe[1].length,text:pe[2]}},fences:function(le){var pe=this.rules.block.fences.exec(le);if(pe){var ie=pe[0],me=O(ie,pe[3]||""),J=pe[2]?pe[2].trim():pe[2];if(["latex","katex","math"].indexOf(J)>=0){var ne=m(),q=me;me=ne,h[ne]={type:"block",expression:q}}return{type:"code",raw:ie,lang:J,text:me}}}},f=/(?:\${2})([^\n`]+?)(?:\${2})/gi,C=0,m=function(){return"__special_katext_id_".concat(C++,"__")},h={};function c(){return h}function l(){C=0,h={}}function a(he){return he=he.replace(f,function(le,pe){var ie=m();return h[ie]={type:"inline",expression:pe},ie}),he}var v=y.listitem;y.listitem=function(he){return v(a(he))};var p=y.paragraph;y.paragraph=function(he){return p(a(he))};var E=y.tablecell;y.tablecell=function(he,le){return E(a(he),le)},y.code=function(he,le,pe){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(pe?he:Object(S.escape)(he,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(pe?he:Object(S.escape)(he,!0))+"</code></pre>"},y.heading=function(he,le,pe){var ie=this.options.headerPrefix+pe.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return _.push({anchor:ie,level:le,text:he}),"<h"+le+' id="'+ie+'">'+he+"</h"+le+">"},b.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),b.a.use({tokenizer:g,renderer:y});var M=b.a,F=Z("SJMd"),j=Z("ulZh"),W=Z.n(j),D=Z("m3rI"),R=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=ze.a=function(he){var le=he.value,pe=le===void 0?"":le,ie=he.edit,me=ie===void 0?!1:ie,J=he.className,ne=he.showTextOnly,q=he.showLines,xe=he.replaces,_e=he.zoomImg,be=he.hasMask,ve=he.style,we=ve===void 0?{}:ve,Oe=he.stylesPrev,ke=Oe===void 0?{}:Oe,Ce=String(pe),Re=Object(B.useRef)(),je=Object(B.useRef)(),He=Object(B.useState)(""),Be=Object(P.a)(He,2),Ne=Be[0],qe=Be[1],Xe=Object(B.useState)("office"),Ze=Object(P.a)(Xe,2),Le=Ze[0],et=Ze[1],Ve=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;Ce=Ce.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(Ae){}var te=M(Ce),se=c();if(Ce.match(/\[TOC\]/)&&(te=te.replace("<p>[TOC]</p>",w()),o()),te=te.replace(/(__special_katext_id_\d+__)/g,function(Ae,De){var Ue=se[De],Qe=Ue.type,Ye=Ue.expression;return Object(R.renderToString)(Te(Ye)||"",{displayMode:Qe==="block",throwOnError:!1,output:"html"})}),te=te.replace(/▁/g,"\u2581\u2581\u2581"),l(),ne){var fe=document.createElement("div");return fe.innerHTML=te,fe.innerText}return setTimeout(function(){return ge()},500),te},[Ce]),Pe=Object(B.useRef)();u.WebkitLineClamp=q,q&&(we=Object(I.a)(Object(I.a)({},we),u));function Ie(ce){var X=ce.target;if(X.tagName.toUpperCase()==="IMG"){if(_e){var Q=X.getAttribute("src");qe(Q),et("image")}}else if(X.tagName.toUpperCase()==="A"){var te=X.getAttribute("href");if(te.indexOf("office")>-1)ce.preventDefault(),qe(te),et("office");else if(te.indexOf("application/pdf")>-1)ce.preventDefault(),qe(te),et("pdf");else if(te.indexOf("text/html")>-1)ce.preventDefault(),qe(te),et("html");else if(te.startsWith("#")){ce.preventDefault();var se=document.getElementById(te.replace("#",""));se&&se.scrollIntoView(!0)}}}var ge=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&&Ve&&(Ve.match(oe)&&window.PR.prettyPrint()),Pe.current)return Pe.current.addEventListener("click",Ie),function(){Pe.current.removeEventListener("click",Ie),l(),o()}},[Ve,Pe.current,Ie]);var de=function(X){if(!me)return;X.target.nodeName==="IMG"?(Re.current.style.display="flex",Re.current.style.width=X.target.clientWidth+"px",Re.current.style.height=X.target.clientHeight+"px",Re.current.style.top=X.target.offsetTop+"px",Re.current.style.left=X.target.offsetLeft+"px",je.current.src=X.target.getAttribute("src")):Re.current.style.display="none"};return U.a.createElement("div",{style:{position:"relative"}},U.a.createElement("div",{ref:Pe,style:Object(I.a)({},we),className:"".concat(J||""," markdown-body ").concat(ee.a.mdBody),onMouseOver:de,dangerouslySetInnerHTML:{__html:Ve}}),U.a.createElement("div",{ref:Re,className:ee.a.button},U.a.createElement(z.a,null,U.a.createElement(G.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),U.a.createElement(G.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:Ne,type:Ne!=null&&Ne.length?Le:"",style:Object(I.a)({},ke),onClose:function(){return qe("")}}))}},"9VGf":function(ot,ze,Z){"use strict";Z.d(ze,"a",function(){return L});var re=Z("cDcd"),z=Z.n(re);function L(G,I){var P=Object(re.useRef)();Object(re.useEffect)(function(){P.current=G}),Object(re.useEffect)(function(){function B(){P.current()}if(I!==null){var U=setInterval(B,I);return function(){return clearInterval(U)}}},[I])}},BU3w:function(ot,ze,Z){"use strict";Z.d(ze,"a",function(){return P});var re=Z("MNnm"),z="rc-util-key";function L(B){if(B.attachTo)return B.attachTo;var U=document.querySelector("head");return U||document.body}function G(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 b;A.nonce=(b=k.csp)===null||b===void 0?void 0:b.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 P(B,U){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},A=L(k);if(!I.has(A)){var b=G("",k),S=b.parentNode;I.set(A,S),S.removeChild(b)}var O=Array.from(I.get(A).children).find(function(o){return o.tagName==="STYLE"&&o[z]===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 y;O.nonce=(y=k.csp)===null||y===void 0?void 0:y.nonce}return O.innerHTML!==B&&(O.innerHTML=B),O}var d=G(B,k);return d[z]=U,d}},Bd2K:function(ot,ze,Z){(function(re){re(Z("VrN/"),Z("osHv"))})(function(re){re.defineOption("autoCloseTags",!1,function(k,A,b){if(b!=re.Init&&b&&k.removeKeyMap("autoCloseTags"),!A)return;var S={name:"autoCloseTags"};(typeof A!="object"||A.whenClosing!==!1)&&(S["'/'"]=function(O){return P(O)}),(typeof A!="object"||A.whenOpening!==!1)&&(S["'>'"]=function(O){return G(O)}),k.addKeyMap(S)});var z=["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 G(k){if(k.getOption("disableInput"))return re.Pass;for(var A=k.listSelections(),b=[],S=k.getOption("autoCloseTags"),O=0;O<A.length;O++){if(!A[O].empty())return re.Pass;var _=A[O].head,x=k.getTokenAt(_),y=re.innerMode(k.getMode(),x.state),d=y.state,o=y.mode.xmlCurrentTag&&y.mode.xmlCurrentTag(d),u=o&&o.name;if(!u)return re.Pass;var s=y.mode.configuration=="html",w=typeof S=="object"&&S.dontCloseTags||s&&z,g=typeof S=="object"&&S.indentTags||s&&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,y.mode.xmlCurrentContext&&y.mode.xmlCurrentContext(d)||[],u,_,!0))return re.Pass;var C=typeof S=="object"&&S.emptyTags;if(C&&B(C,u)>-1){b[O]={text:"/>",newPos:re.Pos(_.line,_.ch+2)};continue}var m=g&&B(g,f)>-1;b[O]={indent:m,text:">"+(m?`
|
|
|
|
`:"")+"</"+u+">",newPos:m?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=b[O];k.replaceRange(c.text,A[O].head,A[O].anchor,"+insert");var l=k.listSelections().slice(0);l[O]={head:c.newPos,anchor:c.newPos},k.setSelections(l),!h&&c.indent&&(k.indentLine(c.newPos.line,null,!0),k.indentLine(c.newPos.line+1,null,!0))}}function I(k,A){for(var b=k.listSelections(),S=[],O=A?"/":"</",_=k.getOption("autoCloseTags"),x=typeof _=="object"&&_.dontIndentOnSlash,y=0;y<b.length;y++){if(!b[y].empty())return re.Pass;var d=b[y].head,o=k.getTokenAt(d),u=re.innerMode(k.getMode(),o.state),s=u.state;if(A&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=d.ch-1))return re.Pass;var w,g=u.mode.name!="xml"&&k.getMode().name=="htmlmixed";if(g&&u.mode.name=="javascript")w=O+"script";else if(g&&u.mode.name=="css")w=O+"style";else{var f=u.mode.xmlCurrentContext&&u.mode.xmlCurrentContext(s);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[y]=w}if(k.replaceSelections(S),b=k.listSelections(),!x)for(var y=0;y<b.length;y++)(y==b.length-1||b[y].head.line<b[y+1].head.line)&&k.indentLine(b[y].head.line)}function P(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 b=0,S=k.length;b<S;++b)if(k[b]==A)return b;return-1}function U(k,A,b,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!=b)return!1;for(var y=O?1:0,d=A.length-1;d>=0&&A[d]==b;d--)++y;S=x.to;for(var d=1;d<y;d++){var o=re.scanForClosingTag(k,S,null,_);if(!o||o.tag!=b)return!1;S=o.to}return!0}})},BjJ7:function(ot,ze,Z){"use strict";Z.d(ze,"d",function(){return z}),Z.d(ze,"c",function(){return L}),Z.d(ze,"e",function(){return G}),Z.d(ze,"b",function(){return I}),Z.d(ze,"a",function(){return B});var re=Z("m3rI");function z(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=[],b=0;b<U.length;b++){var S=U[b],O=k?"".concat(k,"/").concat(S.name):"".concat(S.name);A.push({title:S.name,isLeaf:!(S.type==="tree"),key:O})}return A}function G(U,k,A){for(var b=0;b<U.length;b++){var S=U[b];if(S.key===k){S.children=A;break}S.children&&G(S.children,k,A)}return U}function I(U,k,A){var b;return function(){var S=this,O=arguments,_=function(){b=null,A||U.apply(S,O)},x=A&&!b;clearTimeout(b),b=setTimeout(_,k),x&&U.apply(S,O)}}var P=!0,B=re.a.API_SERVER},"C+DQ":function(ot,ze,Z){},DlQD:function(ot,ze,Z){(function(re,z){ot.exports=z()})(this,function(){"use strict";function re(ge,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(ge,X.key,X)}}function z(ge,de,ce){return de&&re(ge.prototype,de),ce&&re(ge,ce),ge}function L(ge,de){if(!ge)return;if(typeof ge=="string")return G(ge,de);var ce=Object.prototype.toString.call(ge).slice(8,-1);if(ce==="Object"&&ge.constructor&&(ce=ge.constructor.name),ce==="Map"||ce==="Set")return Array.from(ge);if(ce==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ce))return G(ge,de)}function G(ge,de){(de==null||de>ge.length)&&(de=ge.length);for(var ce=0,X=new Array(de);ce<de;ce++)X[ce]=ge[ce];return X}function I(ge,de){var ce;if(typeof Symbol=="undefined"||ge[Symbol.iterator]==null){if(Array.isArray(ge)||(ce=L(ge))||de&&ge&&typeof ge.length=="number"){ce&&(ge=ce);var X=0;return function(){return X>=ge.length?{done:!0}:{done:!1,value:ge[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=ge[Symbol.iterator](),ce.next.bind(ce)}function P(ge,de){return de={exports:{}},ge(de,de.exports),de.exports}var B=P(function(ge){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){ge.exports.defaults=X}ge.exports={defaults:de(),getDefaults:de,changeDefaults:ce}}),U=B.defaults,k=B.getDefaults,A=B.changeDefaults,b=/[&<>"']/,S=/[&<>"']/g,O=/[<>"']|&(?!#?\w+;)/,_=/[<>"']|&(?!#?\w+;)/g,x={"&":"&","<":"<",">":">",'"':""","'":"'"},y=function(de){return x[de]};function d(ge,de){if(de){if(b.test(ge))return ge.replace(S,y)}else if(O.test(ge))return ge.replace(_,y);return ge}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function u(ge){return ge.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 s=/(^|[^\[])\^/g;function w(ge,de){ge=ge.source||ge,de=de||"";var ce={replace:function(Q,te){return te=te.source||te,te=te.replace(s,"$1"),ge=ge.replace(Q,te),ce},getRegex:function(){return new RegExp(ge,de)}};return ce}var g=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function C(ge,de,ce){if(ge){var X;try{X=decodeURIComponent(u(ce)).replace(g,"").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 m={},h=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ge,de){m[" "+ge]||(h.test(ge)?m[" "+ge]=ge+"/":m[" "+ge]=M(ge,"/",!0)),ge=m[" "+ge];var ce=ge.indexOf(":")===-1;return de.substring(0,2)==="//"?ce?de:ge.replace(c,"$1")+de:de.charAt(0)==="/"?ce?de:ge.replace(l,"$1")+de:ge+de}var v={exec:function(){}};function p(ge){for(var de=1,ce,X;de<arguments.length;de++){ce=arguments[de];for(X in ce)Object.prototype.hasOwnProperty.call(ce,X)&&(ge[X]=ce[X])}return ge}function E(ge,de){var ce=ge.replace(/\|/g,function(te,se,fe){for(var Ae=!1,De=se;--De>=0&&fe[De]==="\\";)Ae=!Ae;return Ae?"|":" |"}),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(ge,de,ce){var X=ge.length;if(X===0)return"";for(var Q=0;Q<X;){var te=ge.charAt(X-Q-1);if(te===de&&!ce)Q++;else if(te!==de&&ce)Q++;else break}return ge.substr(0,X-Q)}function F(ge,de){if(ge.indexOf(de[1])===-1)return-1;for(var ce=ge.length,X=0,Q=0;Q<ce;Q++)if(ge[Q]==="\\")Q++;else if(ge[Q]===de[0])X++;else if(ge[Q]===de[1]&&(X--,X<0))return Q;return-1}function j(ge){ge&&ge.sanitize&&!ge.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:v,merge:p,splitCells:E,rtrim:M,findClosingBracket:F,checkSanitizeDeprecation:j},D=B.defaults,R=W.rtrim,H=W.splitCells,Y=W.escape,ee=W.findClosingBracket;function oe(ge,de,ce){var X=de.href,Q=de.title?Y(de.title):null,te=ge[1].replace(/\\([\[\]])/g,"$1");return ge[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(ge,de){var ce=ge.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 ge(ce){this.options=ce||D}var de=ge.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:R(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,Ae=se[se.length-1]===")",De={type:"list",raw:te,ordered:fe,start:fe?+se.slice(0,-1):"",loose:!1,items:[]},Ue=Q[0].match(this.rules.block.item),Qe=!1,Ye,mt,dt,st,_t,bt,Bt,Ut=Ue.length,Et=0;Et<Ut;Et++)Ye=Ue[Et],te=Ye,mt=Ye.length,Ye=Ye.replace(/^ *([*+-]|\d+[.)]) */,""),~Ye.indexOf(`
|
|
`)&&(mt-=Ye.length,Ye=this.options.pedantic?Ye.replace(/^ {1,4}/gm,""):Ye.replace(new RegExp("^ {1,"+mt+"}","gm"),"")),Et!==Ut-1&&(dt=this.rules.block.bullet.exec(Ue[Et+1])[0],(fe?dt.length===1||!Ae&&dt[dt.length-1]===")":dt.length>1||this.options.smartLists&&dt!==se)&&(st=Ue.slice(Et+1).join(`
|
|
`),De.raw=De.raw.substring(0,De.raw.length-st.length),Et=Ut-1)),_t=Qe||/\n\n(?!\s*$)/.test(Ye),Et!==Ut-1&&(Qe=Ye.charAt(Ye.length-1)===`
|
|
`,_t||(_t=Qe)),_t&&(De.loose=!0),bt=/^\[[ xX]\] /.test(Ye),Bt=void 0,bt&&(Bt=Ye[1]!==" ",Ye=Ye.replace(/^\[[ xX]\] +/,"")),De.items.push({type:"list_item",raw:te,task:bt,checked:Bt,loose:_t,text:Ye});return De}},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 Ae=Q[2],De="";if(this.options.pedantic){var Ue=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ae);Ue?(Ae=Ue[1],De=Ue[3]):De=""}else De=Q[3]?Q[3].slice(1,-1):"";Ae=Ae.trim().replace(/^<([\s\S]*)>$/,"$1");var Qe=oe(Q,{href:Ae&&Ae.replace(this.rules.inline._escapes,"$1"),title:De&&De.replace(this.rules.inline._escapes,"$1")},Q[0]);return Qe}},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 Ae=oe(te,se,te[0]);return Ae}},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 Ae;(se=fe.exec(Q))!=null;)if(Ae=this.rules.inline.strong.middle.exec(Q.slice(0,se.index+3)),Ae)return{type:"strong",raw:X.slice(0,Ae[0].length),text:X.slice(2,Ae[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 Ae;(se=fe.exec(Q))!=null;)if(Ae=this.rules.inline.em.middle.exec(Q.slice(0,se.index+2)),Ae)return{type:"em",raw:X.slice(0,Ae[0].length),text:X.slice(1,Ae[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 Ae;do Ae=te[0],te[0]=this.rules.inline._backpedal.exec(te[0])[0];while(Ae!==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}}},ge}(),he=W.noopTest,le=W.edit,pe=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=pe({},ie),ie.gfm=pe({},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=pe({},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 me={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])/};me._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",me.punctuation=le(me.punctuation).replace(/punctuation/g,me._punctuation).getRegex(),me._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",me._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",me.em.start=le(me.em.start).replace(/punctuation/g,me._punctuation).getRegex(),me.em.middle=le(me.em.middle).replace(/punctuation/g,me._punctuation).replace(/overlapSkip/g,me._overlapSkip).getRegex(),me.em.endAst=le(me.em.endAst,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.em.endUnd=le(me.em.endUnd,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.strong.start=le(me.strong.start).replace(/punctuation/g,me._punctuation).getRegex(),me.strong.middle=le(me.strong.middle).replace(/punctuation/g,me._punctuation).replace(/blockSkip/g,me._blockSkip).getRegex(),me.strong.endAst=le(me.strong.endAst,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.strong.endUnd=le(me.strong.endUnd,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.blockSkip=le(me._blockSkip,"g").getRegex(),me.overlapSkip=le(me._overlapSkip,"g").getRegex(),me._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,me._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,me._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])?)+(?![-_])/,me.autolink=le(me.autolink).replace("scheme",me._scheme).replace("email",me._email).getRegex(),me._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,me.tag=le(me.tag).replace("comment",ie._comment).replace("attribute",me._attribute).getRegex(),me._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,me._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,me._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,me.link=le(me.link).replace("label",me._label).replace("href",me._href).replace("title",me._title).getRegex(),me.reflink=le(me.reflink).replace("label",me._label).getRegex(),me.reflinkSearch=le(me.reflinkSearch,"g").replace("reflink",me.reflink).replace("nolink",me.nolink).getRegex(),me.normal=pe({},me),me.pedantic=pe({},me.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",me._label).getRegex(),reflink:le(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",me._label).getRegex()}),me.gfm=pe({},me.normal,{escape:le(me.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),me.gfm.url=le(me.gfm.url,"i").replace("email",me.gfm._extended_email).getRegex(),me.breaks=pe({},me.gfm,{br:le(me.br).replace("{2,}","*").getRegex(),text:le(me.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var J={block:ie,inline:me},ne=B.defaults,q=J.block,xe=J.inline;function _e(ge){return ge.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(ge){var de="",ce,X,Q=ge.length;for(ce=0;ce<Q;ce++)X=ge.charCodeAt(ce),Math.random()>.5&&(X="x"+X.toString(16)),de+="&#"+X+";";return de}var ve=function(){function ge(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}ge.lex=function(X,Q){var te=new ge(Q);return te.lex(X)};var de=ge.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,Ae,De;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):(De=Q[Q.length-1],De.raw+=`
|
|
`+se.raw,De.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),Ae=se.items.length,fe=0;fe<Ae;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):(De=Q[Q.length-1],De.raw+=`
|
|
`+se.raw,De.text+=`
|
|
`+se.text);continue}if(X){var Ue="Infinite loop on byte: "+X.charCodeAt(0);if(this.options.silent){console.error(Ue);break}else throw new Error(Ue)}}return Q},de.inline=function(X){var Q,te,se,fe,Ae,De,Ue=X.length;for(Q=0;Q<Ue;Q++){De=X[Q];switch(De.type){case"paragraph":case"text":case"heading":{De.tokens=[],this.inlineTokens(De.text,De.tokens);break}case"table":{for(De.tokens={header:[],cells:[]},fe=De.header.length,te=0;te<fe;te++)De.tokens.header[te]=[],this.inlineTokens(De.header[te],De.tokens.header[te]);for(fe=De.cells.length,te=0;te<fe;te++)for(Ae=De.cells[te],De.tokens.cells[te]=[],se=0;se<Ae.length;se++)De.tokens.cells[te][se]=[],this.inlineTokens(Ae[se],De.tokens.cells[te][se]);break}case"blockquote":{this.inline(De.tokens);break}case"list":{for(fe=De.items.length,te=0;te<fe;te++)this.inline(De.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 Ae,De=X,Ue;if(this.tokens.links){var Qe=Object.keys(this.tokens.links);if(Qe.length>0)for(;(Ue=this.tokenizer.rules.inline.reflinkSearch.exec(De))!=null;)Qe.includes(Ue[0].slice(Ue[0].lastIndexOf("[")+1,-1))&&(De=De.slice(0,Ue.index)+"["+"a".repeat(Ue[0].length-2)+"]"+De.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ue=this.tokenizer.rules.inline.blockSkip.exec(De))!=null;)De=De.slice(0,Ue.index)+"["+"a".repeat(Ue[0].length-2)+"]"+De.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;X;){if(Ae=this.tokenizer.escape(X)){X=X.substring(Ae.raw.length),Q.push(Ae);continue}if(Ae=this.tokenizer.tag(X,te,se)){X=X.substring(Ae.raw.length),te=Ae.inLink,se=Ae.inRawBlock,Q.push(Ae);continue}if(Ae=this.tokenizer.link(X)){X=X.substring(Ae.raw.length),Ae.type==="link"&&(Ae.tokens=this.inlineTokens(Ae.text,[],!0,se)),Q.push(Ae);continue}if(Ae=this.tokenizer.reflink(X,this.tokens.links)){X=X.substring(Ae.raw.length),Ae.type==="link"&&(Ae.tokens=this.inlineTokens(Ae.text,[],!0,se)),Q.push(Ae);continue}if(Ae=this.tokenizer.strong(X,De,fe)){X=X.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],te,se),Q.push(Ae);continue}if(Ae=this.tokenizer.em(X,De,fe)){X=X.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],te,se),Q.push(Ae);continue}if(Ae=this.tokenizer.codespan(X)){X=X.substring(Ae.raw.length),Q.push(Ae);continue}if(Ae=this.tokenizer.br(X)){X=X.substring(Ae.raw.length),Q.push(Ae);continue}if(Ae=this.tokenizer.del(X)){X=X.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],te,se),Q.push(Ae);continue}if(Ae=this.tokenizer.autolink(X,be)){X=X.substring(Ae.raw.length),Q.push(Ae);continue}if(!te&&(Ae=this.tokenizer.url(X,be))){X=X.substring(Ae.raw.length),Q.push(Ae);continue}if(Ae=this.tokenizer.inlineText(X,se,_e)){X=X.substring(Ae.raw.length),fe=Ae.raw.slice(-1),Q.push(Ae);continue}if(X){var Ye="Infinite loop on byte: "+X.charCodeAt(0);if(this.options.silent){console.error(Ye);break}else throw new Error(Ye)}}return Q},z(ge,null,[{key:"rules",get:function(){return{block:q,inline:xe}}}]),ge}(),we=B.defaults,Oe=W.cleanUrl,ke=W.escape,Ce=function(){function ge(ce){this.options=ce||we}var de=ge.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+ke(se,!0)+'">'+(te?X:ke(X,!0))+`</code></pre>
|
|
`:"<pre><code>"+(te?X:ke(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=Oe(this.options.sanitize,this.options.baseUrl,X),X===null)return te;var se='<a href="'+ke(X)+'"';return Q&&(se+=' title="'+Q+'"'),se+=">"+te+"</a>",se},de.image=function(X,Q,te){if(X=Oe(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},ge}(),Re=function(){function ge(){}var de=ge.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""},ge}(),je=function(){function ge(){this.seen={}}var de=ge.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},ge}(),He=B.defaults,Be=W.unescape,Ne=function(){function ge(ce){this.options=ce||He,this.options.renderer=this.options.renderer||new Ce,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Re,this.slugger=new je}ge.parse=function(X,Q){var te=new ge(Q);return te.parse(X)};var de=ge.prototype;return de.parse=function(X,Q){Q===void 0&&(Q=!0);var te="",se,fe,Ae,De,Ue,Qe,Ye,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,Be(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="",Ye="",De=st.header.length,fe=0;fe<De;fe++)Ye+=this.renderer.tablecell(this.parseInline(st.tokens.header[fe]),{header:!0,align:st.align[fe]});for(mt+=this.renderer.tablerow(Ye),dt="",De=st.cells.length,fe=0;fe<De;fe++){for(Qe=st.tokens.cells[fe],Ye="",Ue=Qe.length,Ae=0;Ae<Ue;Ae++)Ye+=this.renderer.tablecell(this.parseInline(Qe[Ae]),{header:!1,align:st.align[Ae]});dt+=this.renderer.tablerow(Ye)}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,De=st.items.length,dt="",fe=0;fe<De;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,Ae=X.length;for(se=0;se<Ae;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 De='Token with "'+fe.type+'" type was not found.';if(this.options.silent){console.error(De);return}else throw new Error(De)}}}return te},ge}(),qe=W.merge,Xe=W.checkSanitizeDeprecation,Ze=W.escape,Le=B.getDefaults,et=B.changeDefaults,Ve=B.defaults;function Pe(ge,de,ce){if(typeof ge=="undefined"||ge===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ge!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ge)+", string expected");if(typeof de=="function"&&(ce=de,de=null),de=qe({},Pe.defaults,de||{}),Xe(de),ce){var X=de.highlight,Q;try{Q=ve.lex(ge,de)}catch(Ae){return ce(Ae)}var te=function(De){var Ue;if(!De)try{Ue=Ne.parse(Q,de)}catch(Qe){De=Qe}return de.highlight=X,De?ce(De):ce(null,Ue)};if(!X||X.length<3)return te();if(delete de.highlight,!Q.length)return te();var se=0;Pe.walkTokens(Q,function(Ae){Ae.type==="code"&&(se++,setTimeout(function(){X(Ae.text,Ae.lang,function(De,Ue){if(De)return te(De);Ue!=null&&Ue!==Ae.text&&(Ae.text=Ue,Ae.escaped=!0),se--,se===0&&te()})},0))}),se===0&&te();return}try{var fe=ve.lex(ge,de);return de.walkTokens&&Pe.walkTokens(fe,de.walkTokens),Ne.parse(fe,de)}catch(Ae){if(Ae.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,de.silent)return"<p>An error occurred:</p><pre>"+Ze(Ae.message+"",!0)+"</pre>";throw Ae}}Pe.options=Pe.setOptions=function(ge){return qe(Pe.defaults,ge),et(Pe.defaults),Pe},Pe.getDefaults=Le,Pe.defaults=Ve,Pe.use=function(ge){var de=qe({},ge);if(ge.renderer&&function(){var X=Pe.defaults.renderer||new Ce,Q=function(fe){var Ae=X[fe];X[fe]=function(){for(var De=arguments.length,Ue=new Array(De),Qe=0;Qe<De;Qe++)Ue[Qe]=arguments[Qe];var Ye=ge.renderer[fe].apply(X,Ue);return Ye===!1&&(Ye=Ae.apply(X,Ue)),Ye}};for(var te in ge.renderer)Q(te);de.renderer=X}(),ge.tokenizer&&function(){var X=Pe.defaults.tokenizer||new ye,Q=function(fe){var Ae=X[fe];X[fe]=function(){for(var De=arguments.length,Ue=new Array(De),Qe=0;Qe<De;Qe++)Ue[Qe]=arguments[Qe];var Ye=ge.tokenizer[fe].apply(X,Ue);return Ye===!1&&(Ye=Ae.apply(X,Ue)),Ye}};for(var te in ge.tokenizer)Q(te);de.tokenizer=X}(),ge.walkTokens){var ce=Pe.defaults.walkTokens;de.walkTokens=function(X){ge.walkTokens(X),ce&&ce(X)}}Pe.setOptions(de)},Pe.walkTokens=function(ge,de){for(var ce=I(ge),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 Ae=I(Q.tokens.cells),De;!(De=Ae()).done;)for(var Ue=De.value,Qe=I(Ue),Ye;!(Ye=Qe()).done;){var mt=Ye.value;Pe.walkTokens(mt,de)}break}case"list":{Pe.walkTokens(Q.items,de);break}default:Q.tokens&&Pe.walkTokens(Q.tokens,de)}}},Pe.Parser=Ne,Pe.parser=Ne.parse,Pe.Renderer=Ce,Pe.TextRenderer=Re,Pe.Lexer=ve,Pe.lexer=ve.lex,Pe.Tokenizer=ye,Pe.Slugger=je,Pe.parse=Pe;var Ie=Pe;return Ie})},ELLl:function(ot,ze,Z){(function(re){re(Z("VrN/"))})(function(re){var z={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},L=re.Pos;re.defineOption("autoCloseBrackets",!1,function(x,y,d){d&&d!=re.Init&&(x.removeKeyMap(I),x.state.closeBrackets=null),y&&(P(G(y,"pairs")),x.state.closeBrackets=y,x.addKeyMap(I))});function G(x,y){return y=="pairs"&&typeof x=="string"?x:typeof x=="object"&&x[y]!=null?x[y]:z[y]}var I={Backspace:k,Enter:A};function P(x){for(var y=0;y<x.length;y++){var d=x.charAt(y),o="'"+d+"'";I[o]||(I[o]=B(d))}}P(z.pairs+"`");function B(x){return function(y){return S(y,x)}}function U(x){var y=x.state.closeBrackets;if(!y||y.override)return y;var d=x.getModeAt(x.getCursor());return d.closeBrackets||y}function k(x){var y=U(x);if(!y||x.getOption("disableInput"))return re.Pass;for(var d=G(y,"pairs"),o=x.listSelections(),u=0;u<o.length;u++){if(!o[u].empty())return re.Pass;var s=O(x,o[u].head);if(!s||d.indexOf(s)%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 y=U(x),d=y&&G(y,"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 s=O(x,o[u].head);if(!s||d.indexOf(s)%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 g=0;g<o.length;g++){var f=o[g].head.line;x.indentLine(f,null,!0),x.indentLine(f+1,null,!0)}})}function b(x){var y=re.cmpPos(x.anchor,x.head)>0;return{anchor:new L(x.anchor.line,x.anchor.ch+(y?-1:1)),head:new L(x.head.line,x.head.ch+(y?1:-1))}}function S(x,y){var d=U(x);if(!d||x.getOption("disableInput"))return re.Pass;var o=G(d,"pairs"),u=o.indexOf(y);if(u==-1)return re.Pass;for(var s=G(d,"closeBefore"),w=G(d,"triples"),g=o.charAt(u+1)==y,f=x.listSelections(),C=u%2==0,m,h=0;h<f.length;h++){var c=f[h],l=c.head,a,v=x.getRange(l,L(l.line,l.ch+1));if(C&&!c.empty())a="surround";else if((g||!C)&&v==y)g&&_(x,l)?a="both":w.indexOf(y)>=0&&x.getRange(l,L(l.line,l.ch+3))==y+y+y?a="skipThree":a="skip";else if(g&&l.ch>1&&w.indexOf(y)>=0&&x.getRange(L(l.line,l.ch-2),l)==y+y){if(l.ch>2&&/\bstring/.test(x.getTokenTypeAt(L(l.line,l.ch-2))))return re.Pass;a="addFour"}else if(g){var p=l.ch==0?" ":x.getRange(L(l.line,l.ch-1),l);if(!re.isWordChar(v)&&p!=y&&!re.isWordChar(p))a="both";else return re.Pass}else if(C&&(v.length===0||/\s/.test(v)||s.indexOf(v)>-1))a="both";else return re.Pass;if(!m)m=a;else if(m!=a)return re.Pass}var E=u%2?o.charAt(u-1):y,M=u%2?y:o.charAt(u+1);x.operation(function(){if(m=="skip")x.execCommand("goCharRight");else if(m=="skipThree")for(var F=0;F<3;F++)x.execCommand("goCharRight");else if(m=="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]=b(j[F]);x.setSelections(j)}else m=="both"?(x.replaceSelection(E+M,null),x.triggerElectric(E+M),x.execCommand("goCharLeft")):m=="addFour"&&(x.replaceSelection(E+E+E+E,"before"),x.execCommand("goCharRight"))})}function O(x,y){var d=x.getRange(L(y.line,y.ch-1),L(y.line,y.ch+1));return d.length==2?d:null}function _(x,y){var d=x.getTokenAt(L(y.line,y.ch+1));return/\bstring/.test(d.type)&&d.start==y.ch&&(y.ch==0||!/\bstring/.test(x.getTokenTypeAt(y)))}})},GfqC:function(ot,ze,Z){"use strict";var re=Z("cDcd"),z=Z.n(re),L=Z("TSYQ"),G=Z.n(L);function I(W,D){var R="cannot "+W.method+" "+W.action+" "+D.status+"'",H=new Error(R);return H.status=D.status,H.method=W.method,H.url=W.action,H}function P(W){var D=W.responseText||W.response;if(!D)return D;try{return JSON.parse(D)}catch(R){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 R=new FormData;W.data&&Object.keys(W.data).forEach(function(Y){var ee=W.data[Y];if(Array.isArray(ee)){ee.forEach(function(oe){R.append(Y+"[]",oe)});return}R.append(Y,W.data[Y])}),W.file instanceof Blob?R.append(W.filename,W.file,W.file.name):R.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),P(D)):W.onSuccess(P(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(R),{abort:function(){D.abort()}}}var U=+new Date,k=0;function A(){return"rc-upload-"+U+"-"+ ++k}function b(W,D){return W.indexOf(D,W.length-D.length)!==-1}var S=function(W,D){if(W&&D){var R=Array.isArray(D)?D:D.split(","),H=W.name||"",Y=W.type||"",ee=Y.replace(/\/.*$/,"");return R.some(function(oe){var Te=oe.trim();return Te.charAt(0)==="."?b(H.toLowerCase(),Te.toLowerCase()):/\/\*$/.test(Te)?ee===Te.replace(/\/.*$/,""):Y===Te})}return!0};function O(W,D){var R=W.createReader(),H=[];function Y(){R.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,R,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}})),R([ye]))}):oe.isDirectory&&O(oe,function(ye){ye.forEach(function(he){ee(he,""+Te+oe.name+"/")})})};D.forEach(function(ee){Y(ee.webkitGetAsEntry())})},x=_,y=Object.assign||function(W){for(var D=1;D<arguments.length;D++){var R=arguments[D];for(var H in R)Object.prototype.hasOwnProperty.call(R,H)&&(W[H]=R[H])}return W},d=function(){function W(D,R){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),R&&H.length===R);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,R){if(Array.isArray(D))return D;if(Symbol.iterator in Object(D))return W(D,R);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function W(D,R){for(var H=0;H<R.length;H++){var Y=R[H];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(D,Y.key,Y)}}return function(D,R,H){return R&&W(D.prototype,R),H&&W(D,H),D}}();function u(W,D,R){return D in W?Object.defineProperty(W,D,{value:R,enumerable:!0,configurable:!0,writable:!0}):W[D]=R,W}function s(W,D){var R={};for(var H in W){if(D.indexOf(H)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,H))continue;R[H]=W[H]}return R}function w(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 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(R,H){return(H.substr(0,5)==="data-"||H.substr(0,5)==="aria-"||H==="role")&&(R[H]=D[H]),R},{})},m=function(W){f(D,W);function D(){var R,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=g(this,(R=D.__proto__||Object.getPrototypeOf(D)).call.apply(R,[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 pe=Y.props,ie=pe.children,me=pe.onClick;ie&&ie.type==="button"&&(le.parentNode.focus(),le.parentNode.querySelector("button").blur()),le.click(),me&&me(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 pe=Array.prototype.slice.call(he.dataTransfer.files).filter(function(ie){return S(ie,Y.props.accept)});le===!1&&(pe=pe.slice(0,1)),Y.uploadFiles(pe)}},Y.uploadFiles=function(he){var le=Array.prototype.slice.call(he);le.map(function(pe){return pe.uid=A(),pe}).forEach(function(pe){Y.upload(pe,le)})},Y.saveFileInput=function(he){Y.fileInput=he},H),g(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 pe=ee.action;return typeof pe=="function"&&(pe=pe(H)),le(pe)}).then(function(le){var pe=H.uid,ie=ee.customRequest||B,me=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)});me.then(function(J){var ne=d(J,2),q=ne[0],xe=ne[1],_e={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(ve,we){delete Y.reqs[pe],ee.onSuccess(ve,H,we)},onError:function(ve,we){delete Y.reqs[pe],ee.onError(ve,we,H)}};oe(H),Y.reqs[pe]=ie(_e)})})}},{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,pe=Y.multiple,ie=Y.accept,me=Y.children,J=Y.directory,ne=Y.openFileDialogOnClick,q=Y.onMouseEnter,xe=Y.onMouseLeave,_e=s(Y,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),be=G()((H={},u(H,oe,!0),u(H,oe+"-disabled",ye),u(H,Te,Te),H)),ve=ye?{}:{onClick:ne?this.onClick:function(){},onKeyDown:ne?this.onKeyDown:function(){},onMouseEnter:q,onMouseLeave:xe,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return z.a.createElement(ee,y({},ve,{className:be,role:"button",style:le}),z.a.createElement("input",y({},C(_e),{id:he,type:"file",ref:this.saveFileInput,onClick:function(Oe){return Oe.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ie,directory:J?"directory":null,webkitdirectory:J?"webkitdirectory":null,multiple:pe,onChange:this.onChange})),me)}}]),D}(re.Component),h=m,c=Object.assign||function(W){for(var D=1;D<arguments.length;D++){var R=arguments[D];for(var H in R)Object.prototype.hasOwnProperty.call(R,H)&&(W[H]=R[H])}return W},l=function(){function W(D,R){for(var H=0;H<R.length;H++){var Y=R[H];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(D,Y.key,Y)}}return function(D,R,H){return R&&W(D.prototype,R),H&&W(D,H),D}}();function a(W,D){if(!(W instanceof D))throw new TypeError("Cannot call a class as a function")}function v(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 p(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){p(D,W);function D(){var R,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=v(this,(R=D.__proto__||Object.getPrototypeOf(D)).call.apply(R,[this].concat(Te))),Y),Y.saveUploader=function(he){Y.uploader=he},H),v(Y,ee)}return l(D,[{key:"abort",value:function(H){this.uploader.abort(H)}},{key:"render",value:function(){return z.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=ze.a=F},HmJG:function(ot,ze,Z){},LdHM:function(ot,ze,Z){"use strict";Z.d(ze,"b",function(){return s}),Z.d(ze,"a",function(){return g});var re=Z("1OyB"),z=Z("vuIU"),L=Z("Ji7U"),G=Z("LK+K"),I=Z("cDcd"),P=Z("rePB"),B=Z("Ff2n"),U=Z("ODXe"),k=Z("4IlW"),A=Z("bX4T"),b=Z("YrtM"),S=Z("TSYQ"),O=Z.n(S),_=Z("+nKL"),x=Z("8OUc"),y=function(H,Y){var ee=H.prefixCls,oe=H.id,Te=H.flattenOptions,ye=H.childrenAsData,he=H.values,le=H.searchValue,pe=H.multiple,ie=H.defaultActiveFirstOption,me=H.height,J=H.itemHeight,ne=H.notFoundContent,q=H.open,xe=H.menuItemSelectedIcon,_e=H.virtual,be=H.onSelect,ve=H.onToggleOpen,we=H.onActiveValue,Oe=H.onScroll,ke=H.onMouseEnter,Ce="".concat(ee,"-item"),Re=Object(b.a)(function(){return Te},[q,Te],function(Ie,ge){return ge[0]&&Ie[1]!==ge[1]}),je=I.useRef(null),He=function(ge){ge.preventDefault()},Be=function(ge){je.current&&je.current.scrollTo({index:ge})},Ne=function(ge){for(var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ce=Re.length,X=0;X<ce;X+=1){var Q=(ge+X*de+ce)%ce,te=Re[Q],se=te.group,fe=te.data;if(!se&&!fe.disabled)return Q}return-1},qe=I.useState(function(){return Ne(0)}),Xe=Object(U.a)(qe,2),Ze=Xe[0],Le=Xe[1],et=function(ge){Le(ge);var de=Re[ge];if(!de){we(null,-1);return}we(de.data.value,ge)};I.useEffect(function(){et(ie!==!1?Ne(0):-1)},[Re.length,le]),I.useEffect(function(){var Ie=setTimeout(function(){if(!pe&&q&&he.size===1){var ge=Array.from(he)[0],de=Re.findIndex(function(ce){var X=ce.data;return X.value===ge});et(de),Be(de)}});return function(){return clearTimeout(Ie)}},[q]);var Ve=function(ge){ge!==void 0&&be(ge,{selected:!he.has(ge)}),pe||ve(!1)};if(I.useImperativeHandle(Y,function(){return{onKeyDown:function(ge){var de=ge.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=Ne(Ze+ce,ce);Be(X),et(X)}break}case k.a.ENTER:{var Q=Re[Ze];Q&&!Q.data.disabled?Ve(Q.data.value):Ve(void 0),q&&ge.preventDefault();break}case k.a.ESC:ve(!1)}},onKeyUp:function(){},scrollTo:function(ge){Be(ge)}}}),Re.length===0)return I.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),className:"".concat(Ce,"-empty"),onMouseDown:He},ne);function Pe(Ie){var ge=Re[Ie];if(!ge)return null;var de=ge.data||{},ce=de.value,X=de.label,Q=de.children,te=Object(A.a)(de,!0),se=ye?Q:X;return ge?I.createElement("div",Object.assign({"aria-label":typeof se=="string"?se:null},te,{key:Ie,role:"option",id:"".concat(oe,"_list_").concat(Ie),"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(Ze-1),Pe(Ze),Pe(Ze+1)),I.createElement(_.a,{itemKey:"key",ref:je,data:Re,height:me,itemHeight:J,fullHeight:!1,onMouseDown:He,onScroll:Oe,virtual:_e,onMouseEnter:ke},function(Ie,ge){var de,ce=Ie.group,X=Ie.groupOption,Q=Ie.data,te=Q.label,se=Q.key;if(ce)return I.createElement("div",{className:O()(Ce,"".concat(Ce,"-group"))},te!==void 0?te:se);var fe=Q.disabled,Ae=Q.value,De=Q.title,Ue=Q.children,Qe=Q.style,Ye=Q.className,mt=Object(B.a)(Q,["disabled","value","title","children","style","className"]),dt=he.has(Ae),st="".concat(Ce,"-option"),_t=O()(Ce,st,Ye,(de={},Object(P.a)(de,"".concat(st,"-grouped"),X),Object(P.a)(de,"".concat(st,"-active"),Ze===ge&&!fe),Object(P.a)(de,"".concat(st,"-disabled"),fe),Object(P.a)(de,"".concat(st,"-selected"),dt),de)),bt=ye?Ue:te,Bt=!xe||typeof xe=="function"||dt;return I.createElement("div",Object.assign({},mt,{"aria-selected":dt,className:_t,title:De,onMouseMove:function(){if(Ze===ge||fe)return;et(ge)},onClick:function(){fe||Ve(Ae)},style:Qe}),I.createElement("div",{className:"".concat(st,"-content")},bt||Ae),I.isValidElement(xe)||dt,Bt&&I.createElement(x.a,{className:"".concat(Ce,"-option-state"),customizeIcon:xe,customizeIconProps:{isSelected:dt}},dt?"\u2713":null))}))},d=I.forwardRef(y);d.displayName="OptionList";var o=d,u=function(){return null};u.isSelectOption=!0;var s=u,w=function(){return null};w.isSelectOptGroup=!0;var g=w,f=Z("VTBJ"),C=Z("Zm9Q");function m(R){var H=R.key,Y=R.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(R){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(C.a)(R).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?m(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"),l=Z("qNPg"),a=Z("U8pU"),v=Z("Kwbf"),p=Z("WKfj");function E(R){var H=R.mode,Y=R.options,ee=R.children,oe=R.backfill,Te=R.allowClear,ye=R.placeholder,he=R.getInputElement,le=R.showSearch,pe=R.onSearch,ie=R.defaultOpen,me=R.autoFocus,J=R.labelInValue,ne=R.value,q=R.inputValue,xe=R.optionLabelProp,_e=H==="multiple"||H==="tags",be=le!==void 0?le:_e||H==="combobox",ve=Y||h(ee);if(Object(v.a)(H!=="tags"||ve.every(function(Ce){return!Ce.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),H==="tags"||H==="combobox"){var we=ve.some(function(Ce){return Ce.options?Ce.options.some(function(Re){return typeof("value"in Re?Re.value:Re.key)=="number"}):typeof("value"in Ce?Ce.value:Ce.key)=="number"});Object(v.a)(!we,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(v.a)(H!=="combobox"||!xe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(v.a)(H==="combobox"||!oe,"`backfill` only works with `combobox` mode."),Object(v.a)(H==="combobox"||!he,"`getInputElement` only work with `combobox` mode."),Object(v.b)(H!=="combobox"||!he||!Te||!ye,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),pe&&!be&&H!=="combobox"&&H!=="tags"&&Object(v.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(v.b)(!ie||me,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ne!=null){var Oe=Object(p.d)(ne);Object(v.a)(!J||Oe.every(function(Ce){return Object(a.a)(Ce)==="object"&&("key"in Ce||"value"in Ce)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(v.a)(!_e||Array.isArray(ne),"`value` should be array when `mode` is `multiple` or `tags`")}if(ee){var ke=null;Object(C.a)(ee).some(function(Ce){if(!I.isValidElement(Ce)||!Ce.type)return!1;var Re=Ce.type;if(Re.isSelectOption)return!1;if(Re.isSelectOptGroup){var je=Object(C.a)(Ce.props.children).every(function(He){return!I.isValidElement(He)||!Ce.type||He.type.isSelectOption?!0:(ke=He.type,!1)});return!je}return ke=Re,!0}),ke&&Object(v.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(ke.displayName||ke.name||ke,"`.")),Object(v.a)(q===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var M=E,F=Object(l.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(R){Object(L.a)(Y,R);var H=Object(G.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(z.a)(Y,[{key:"render",value:function(){return I.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),Y}(I.Component);j.Option=s,j.OptGroup=g;var W=j,D=ze.c=W},M8RZ:function(ot,ze,Z){"use strict";Z.d(ze,"a",function(){return k});var re=Z("fWQN"),z=Z("mtLc"),L=Z("yKVA"),G=Z("879j"),I=Z("cDcd"),P=Z.n(I),B=Z("faye"),U=Z.n(B),k=function(A){Object(L.a)(S,A);var b=Object(G.a)(S);function S(O){var _;Object(re.a)(this,S),_=b.call(this,O);var x=window.document;return _.node=x.createElement("div"),x.body.appendChild(_.node),_}return Object(z.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}(P.a.Component)},Ot1p:function(ot,ze,Z){"use strict";var re=Z("2qtc"),z=Z("kLXV"),L=Z("rAM+"),G=Z("miYZ"),I=Z("tsqr"),P=Z("9og8"),B=Z("tJVT"),U=Z("jrin"),k=Z("WmNS"),A=Z.n(k),b=Z("cDcd"),S=Z.n(b),O=Z("VrN/"),_=Z.n(O),x=Z("bdgK"),y=Z("p77/"),d=Z("Bd2K"),o=Z("ELLl"),u=Z("19Vz"),s=Z("lZu9"),w=Z("+NIl"),g=Z("kSUc"),f=Z("9Bee"),C=function(fe){var Ae=fe.value,De=Ae===void 0?"":Ae,Ue=fe.className,Qe=fe.showTextOnly,Ye=fe.showLines,mt=fe.style,dt=mt===void 0?{}:mt,st=Object(b.useMemo)(function(){return""},[De]);return S.a.createElement(S.a.Fragment,null,S.a.createElement("div",{dangerouslySetInnerHTML:{__html:st}}))},m=Z("0Owb"),h=Z("dejd"),c=Z("C+DQ"),l=Z("1vsH"),a=Z("m3rI"),v=[{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 p(fe){var Ae=fe.onActionCallback,De=fe.title,Ue=fe.icon,Qe=fe.actionName,Ye=fe.className,mt=Ye===void 0?"":Ye,dt=fe.children;function st(){Ae(Qe)}return S.a.createElement("a",{title:De,className:mt,onClick:st},S.a.createElement("i",{className:"md-iconfont ".concat(Ue)}),dt)}var E=function(fe){var Ae=fe.watch,De=fe.showNullButton,Ue=fe.onActionCallback,Qe=fe.fullScreen,Ye=fe.insertTemp,mt=fe.hidetoolBar,dt=fe.uuid,st=fe.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(l.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(l.G)("_educoder_session"),"&key=").concat(dt,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var _t=[].concat(v,[{title:"".concat(Ae?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ae?"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(p,Object(m.a)({},bt,{onActionCallback:Ue})):S.a.createElement("span",{className:"v-line"}))}),De?S.a.createElement("li",null,S.a.createElement(p,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Ue},S.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Ye&&S.a.createElement("li",null,S.a.createElement(p,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Ye),onActionCallback:Ue},S.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),S.a.createElement("li",{className:"btn-full-screen"},S.a.createElement(p,{icon:"".concat(Qe?"icon-shrink":"icon-enlarge"),title:Qe?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Ue})))},M=Z("M8RZ"),F=Z("+L6B"),j=Z("2/Rp"),W=Z("y8nQ"),D=Z("Vl3Y"),R=Z("5NDa"),H=Z("5rEg"),Y={labelCol:{span:4},wrapperCol:{span:20}},ee=function(fe){var Ae=fe.callback,De=fe.onCancel;function Ue(Qe){Ae(Qe)}return S.a.createElement(D.a,Object(m.a)({},Y,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Ue}),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:De},"\u53D6\u6D88")))},oe=Z("7ahc"),Te=Z("HmJG"),ye=Z("BjJ7"),he=D.a.useForm,le={width:280,marginRight:10},pe={labelCol:{span:5},wrapperCol:{span:19}},ie=function(fe){var Ae=fe.callback,De=fe.onCancel,Ue=he(),Qe=Object(B.a)(Ue,1),Ye=Qe[0];function mt(_t){Ae(_t)}function dt(_t,bt){if(_t.status===-1){I.b.error(_t.message);return}Ye.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(m.a)({form:Ye},pe,{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(me,{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:De},"\u53D6\u6D88")))};function me(fe){var Ae=fe.onFileChange;return S.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",S.a.createElement("input",{type:"file",onChange:Ae}))}function J(fe,Ae){if(!fe)throw new String("\u6CA1\u6709\u6587\u4EF6");var De=new FormData;De.append("editormd-image-file",fe),De.append("file_param_name","editormd-image-file"),De.append("byxhr","true");var Ue=new window.XMLHttpRequest;Ue.withCredentials=!0,Ue.addEventListener("load",function(Qe){Ae(JSON.parse(Qe.target.responseText),fe)},!1),Ue.addEventListener("error",function(Qe){console.error(Qe)},!1),Ue.open("POST","".concat(ye.a,"/api/attachments.json")),Ue.send(De)}var ne=Z("giR+"),q=Z("fyUT"),xe=Z("7Kak"),_e=Z("9yH6"),be=_e.a.Group,ve={margin:"0 8px"},we=function(fe){var Ae=fe.callback,De=fe.onCancel;function Ue(Qe){Ae(Qe)}return S.a.createElement(D.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Ue},S.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},S.a.createElement("span",{style:ve},"\u5355\u5143\u683C\u6570\uFF1A"),S.a.createElement("span",{style:ve},"\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:ve},"\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:ve},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),S.a.createElement(D.a.Item,{name:"align"},S.a.createElement(be,null,S.a.createElement(_e.a,{value:"default"},S.a.createElement("i",{className:"fa fa-align-justify"})),S.a.createElement(_e.a,{value:"left"},S.a.createElement("i",{className:"fa fa-align-left"})),S.a.createElement(_e.a,{value:"center"},S.a.createElement("i",{className:"fa fa-align-center"})),S.a.createElement(_e.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:De},"\u53D6\u6D88")))},Oe=Z("ErOA"),ke=Z("7Cbv"),Ce="link",Re="upload-image",je="code-block",He="add-table",Be="------------",Ne={default:Be,left:":".concat(Be),center:":".concat(Be,":"),right:"".concat(Be,":")},qe=Z("9VGf"),Xe,Ze;function Le(){}var et=0,Ve=1e4,Pe="\u2581",Ie=`
|
|
**\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 ge(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=(Ze={},Object(U.a)(Ze,Ce,"\u6DFB\u52A0\u94FE\u63A5"),Object(U.a)(Ze,je,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(U.a)(Ze,Re,"\u6DFB\u52A0\u6587\u4EF6"),Object(U.a)(Ze,He,"\u6DFB\u52A0\u8868\u683C"),Ze),se=ze.a=function(fe){var Ae=fe.defaultValue,De=Ae===void 0?"":Ae,Ue=fe.onChange,Qe=fe.width,Ye=Qe===void 0?"100%":Qe,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,We=pn===void 0?"":pn,ct=fe.disablePaste,Gn=ct===void 0?!1:ct,gn=fe.placeholder,vn=gn===void 0?"":gn,Qr=fe.values,yn=Qr===void 0?"":Qr,ht=Object(b.useState)(null),Ci=Object(B.a)(ht,2),Ke=Ci[0],bn=Ci[1],hr=Object(b.useState)(De),zn=Object(B.a)(hr,2),Zr=zn[0],vr=zn[1],Vn=Object(b.useState)(Ut),Xn=Object(B.a)(Vn,2),yr=Xn[0],Yn=Xn[1],Ai=Object(b.useState)(Zt),$n=Object(B.a)(Ai,2),br=$n[0],Li=$n[1],aa=Object(b.useState)(""),Jn=Object(B.a)(aa,2),$t=Jn[0],Wr=Jn[1],oa=Object(b.useState)(0),qr=Object(B.a)(oa,2),Er=qr[0],Qn=qr[1],sa=Object(b.useState)(dt),Di=Object(B.a)(sa,2),Oi=Di[0],En=Di[1],Ri=Object(b.useState)(!1),Pi=Object(B.a)(Ri,2),la=Pi[0],xn=Pi[1],en=Object(b.useRef)(Object(ke.a)()),tn=Object(b.useRef)(!1),Tn=Object(b.useRef)(),kr=Object(b.useRef)(),Ir=Object(b.useRef)(),Ur=Object(b.useRef)(),Sn=Object(b.useRef)(),Mi=function(){var it=Object(P.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(Oe.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:",Ke,kr),gt.attachments.map(function(yt){yt.content_type.indexOf("image")>-1?Ke.replaceSelection(".concat(yt.content_type,")")):yt.content_type.indexOf("video")>-1?Ke.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):yt.content_type.indexOf("pdf")>-1?Ke.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>")):Ke.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(b.useEffect)(function(){vr(yn),Ke==null||Ke.setValue(yn)},[yn]),Object(b.useEffect)(function(){Mr==null||Mr(br)},[br]),Object(b.useEffect)(function(){if(kr.current){var it=_.a.fromTextArea(kr.current,{mode:Rr,lineNumbers:!_t,lineWrapping:!0,value:De,autoCloseTags:!0,autoCloseBrackets:!0});Bt&&it.focus();function ft(lt,gt){if(Gn){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(b.useCallback)(function(){if(Ir.current)try{}catch(it){console.log(it,"---- to set md editor body height")}},[Oi,Ir,br]);Object(b.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(),Ke.setSize("100%","100%"),Ke.refresh())}}catch(Ft){xt.e(Ft)}finally{xt.f()}});return lt.observe(kr.current.parentElement),lt}if(Ke){var ft=it();return function(){ft.unobserve(kr.current.parentElement)}}},[Ke,ur]),Object(b.useEffect)(function(){if(Ke){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),Ke.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;Ke.removeKeyMap(Ft)}}catch(qt){At.e(qt)}finally{At.f()}}}},[Ke]),Object(b.useEffect)(function(){Zt!==br&&Li(Zt)},[Zt]),Object(qe.a)(function(){if(!Hn&&Er>0){var it=new Date().getTime(),ft=window.sessionStorage.getItem(pr);it>=Er+Ve&&(!ft||ft!==Zr)&&(window.sessionStorage.setItem(pr,Zr),xn(!0))}},Ve),Object(b.useEffect)(function(){Yn(Ut)},[Ke,Ut]),Object(b.useEffect)(function(){Ke&&(Bt&&Ke.focus())},[Ke,Bt]),Object(b.useEffect)(function(){if(yr&&Ke){var it=Ke.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)}}},[Ke,yr]),Object(b.useEffect)(function(){if(Ke&&gr){function it(ft,lt){gr(ft,lt)}return Ke.on("beforeChange",it),function(){Ke.off("beforeChange",it)}}},[Ke,gr]),Object(b.useEffect)(function(){if(Ke&&Tt){function it(){Tt(Ke.getValue())}return Ke.on("blur",it),function(){Ke.off("blur",it)}}},[Ke,Tt]),Object(b.useEffect)(function(){if(Ke){function it(ft){var lt=ft.getValue();vr(lt),Qn(new Date().getTime()),ft.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Ue&&Ue(lt)}return Ke.on("change",it),function(){Ke.off("change",it)}}},[Ke,Ue]),Object(b.useEffect)(function(){Ke&&(De==null?(Ke.setValue(""),vr("")):De!==Ke.getValue()&&(Ke.setValue(De),vr(De),Ke.setCursor(Ke.lineCount(),0)))},[Ke,De]);var ki=Object(b.useCallback)(function(it){var ft=Ke.getCursor(),lt=Ke.getSelection(),gt=lt.split(`
|
|
`);switch(it){case"bold":return Ke.replaceSelection("**"+lt+"**"),lt===""&&Ke.setCursor(ft.line,ft.ch+2),Ke.focus();case"italic":return Ke.replaceSelection("*"+lt+"*"),lt===""&&Ke.setCursor(ft.line,ft.ch+1),Ke.focus();case"code":return Ke.replaceSelection("`"+lt+"`"),lt===""&&Ke.setCursor(ft.line,ft.ch+1),Ke.focus();case"inline-latex":return Ke.replaceSelection("`$$"+lt+"$$`"),lt===""&&Ke.setCursor(ft.line,ft.ch+3),Ke.focus();case"latex":return Ke.replaceSelection("```latex\n"+lt+"\n```"),Ke.setCursor(ft.line+1,lt.length+1),Ke.focus();case"line-break":return Ke.replaceSelection(`<br/>
|
|
`),Ke.focus();case"list-ul":return lt===""?Ke.replaceSelection("- "+lt):Ke.replaceSelection(gt.map(function(xt){return xt===""?"":"- ".concat(xt)}).join(`
|
|
`)),Ke.focus();case"list-ol":return lt===""?Ke.replaceSelection("1. "+lt):Ke.replaceSelection(gt.map(function(xt,At){return xt===""?"":"".concat(At+1,". ").concat(xt)}).join(`
|
|
`)),Ke.focus();case"add-null-ch":return lt===""&&Ke.setCursor(ft.line,ft.ch+1),Ke.replaceSelection(Pe),Ke.focus();case"inster-template-1":return lt===""&&Ke.setCursor(ft.line,ft.ch),Ke.replaceSelection(Ie),Ke.focus();case"eraser":return Ke.setValue(""),Ke.focus();case"trigger-watch":return Yn(!yr),Ke.focus();case"trigger-full-screen":return Li(!br),Ke.focus();case Ce:Wr(Ce);return;case je:Wr(je);return;case Re:Wr(Re);return;case He:Wr(He);return;default:throw new Error}},[Ke,yr,br]),wn=Object(b.useCallback)(function(it){Wr("");switch($t){case Ce:var ft=it.title,lt=it.link;return Ke.replaceSelection("[".concat(ft,"](").concat(lt,")")),Ke.focus();case je:var gt=it.language,xt=it.content;return Ke.replaceSelection(["```"+gt,xt,"```"].join(`
|
|
`)),Ke.focus();case Re:var At=it.src,yt=it.alt;return yt?Ke.replaceSelection(".concat(At,' "').concat(yt,'" )')):Ke.replaceSelection("")),Ke.focus();case He: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(Ne[vt]),er.push(" ");St===1&&(Fr+="| ".concat(Vt.join(" | "),` |
|
|
`)),Fr+="| ".concat(er.join(qt===1?"":" | "),` |
|
|
`)}return Ke.replaceSelection(Fr+`
|
|
`),Ke.focus();default:throw new Error}},[Ke,$t]),Zn=Object(b.useMemo)(function(){switch($t){case Ce:return S.a.createElement(ee,{callback:wn,onCancel:Hr});case je:return S.a.createElement(oe.b,{callback:wn,onCancel:Hr});case Re:return S.a.createElement(ie,{callback:wn,onCancel:Hr});case He:return S.a.createElement(we,{callback:wn,onCancel:Hr});default:return null}},[$t]);function Hr(){Wr("")}Object(b.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)}}},[Ke,Ur]),Object(b.useEffect)(function(){En(dt)},[dt]);var Ar=ge(Ye),qn=ge(Oi),xr={width:Ar,height:qn},ei=Object(b.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),Ke.setValue(window.sessionStorage.getItem(pr))}function ua(it,ft){var lt=Ke.getValue();lt=lt.replace(it,ft),vr(lt),Ke==null||Ke.setValue(lt)}return S.a.createElement(b.Fragment,null,S.a.createElement("div",{className:"markdown-editor-wrapper",ref:Ir},S.a.createElement("div",{className:"markdown-editor-container ".concat(We," ").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(z.a,{centered:!0,title:te[$t],visible:!0,onCancel:Hr,footer:null,className:"markdown-popup-form"},Zn):null))}},SJMd:function(ot,ze){/**
|
|
* @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,z,L=!1,G,I;window.PR_SHOULD_USE_CONTINUATION=!0;var P,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"],b=[A,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],S=[b,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],O=[b,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],_=[b,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],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",y=[b,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[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"],s=[k,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],w=[S,_,O,y,d,o,u,s],g=/^(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",m="com",h="typ",c="lit",l="pun",a="pln",v="tag",p="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 ve=0,we=!1,Oe=!1,ke=0,Ce=be.length;ke<Ce;++ke){var Re=be[ke];if(Re.ignoreCase)Oe=!0;else if(/[a-z]/i.test(Re.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){we=!0,Oe=!1;break}}var je={b:8,t:9,n:10,v:11,f:12,r:13};function He(Ze){var Le=Ze.charCodeAt(0);if(Le!==92)return Le;var et=Ze.charAt(1);return Le=je[et],Le||("0"<=et&&et<="7"?parseInt(Ze.substring(1),8):et==="u"||et==="x"?parseInt(Ze.substring(2),16):Ze.charCodeAt(1))}function Be(Ze){if(Ze<32)return(Ze<16?"\\x0":"\\x")+Ze.toString(16);var Le=String.fromCharCode(Ze);return Le==="\\"||Le==="-"||Le==="]"||Le==="^"?"\\"+Le:Le}function Ne(Ze){var Le=Ze.substring(1,Ze.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")),et=[],Ve=Le[0]==="^",Pe=["["];Ve&&Pe.push("^");for(var Ie=Ve?1:0,ge=Le.length;Ie<ge;++Ie){var de=Le[Ie];if(/\\[bdsw]/i.test(de))Pe.push(de);else{var ce=He(de),X;Ie+2<ge&&Le[Ie+1]==="-"?(X=He(Le[Ie+2]),Ie+=2):X=ce,et.push([ce,X]),X<65||ce>122||(X<65||ce>90||et.push([Math.max(65,ce)|32,Math.min(X,90)|32]),X<97||ce>122||et.push([Math.max(97,ce)&~32,Math.min(X,122)&~32]))}}et.sort(function(fe,Ae){return fe[0]-Ae[0]||Ae[1]-fe[1]});for(var Q=[],te=[],Ie=0;Ie<et.length;++Ie){var se=et[Ie];se[0]<=te[1]+1?te[1]=Math.max(te[1],se[1]):Q.push(te=se)}for(var Ie=0;Ie<Q.length;++Ie){var se=Q[Ie];Pe.push(Be(se[0])),se[1]>se[0]&&(se[1]+1>se[0]&&Pe.push("-"),Pe.push(Be(se[1])))}return Pe.push("]"),Pe.join("")}function qe(Ze){for(var Le=Ze.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")),et=Le.length,Ve=[],Pe=0,Ie=0;Pe<et;++Pe){var ge=Le[Pe];if(ge==="(")++Ie;else if(ge.charAt(0)==="\\"){var de=+ge.substring(1);de&&(de<=Ie?Ve[de]=-1:Le[Pe]=Be(de))}}for(var Pe=1;Pe<Ve.length;++Pe)Ve[Pe]===-1&&(Ve[Pe]=++ve);for(var Pe=0,Ie=0;Pe<et;++Pe){var ge=Le[Pe];if(ge==="(")++Ie,Ve[Ie]||(Le[Pe]="(?:");else if(ge.charAt(0)==="\\"){var de=+ge.substring(1);de&&de<=Ie&&(Le[Pe]="\\"+Ve[de])}}for(var Pe=0;Pe<et;++Pe)Le[Pe]==="^"&&Le[Pe+1]!=="^"&&(Le[Pe]="");if(Ze.ignoreCase&&we)for(var Pe=0;Pe<et;++Pe){var ge=Le[Pe],ce=ge.charAt(0);ge.length>=2&&ce==="["?Le[Pe]=Ne(ge):ce!=="\\"&&(Le[Pe]=ge.replace(/[a-zA-Z]/g,function(te){var se=te.charCodeAt(0);return"["+String.fromCharCode(se&~32,se|32)+"]"}))}return Le.join("")}for(var Xe=[],ke=0,Ce=be.length;ke<Ce;++ke){var Re=be[ke];if(Re.global||Re.multiline)throw new Error(""+Re);Xe.push("(?:"+qe(Re)+")")}return new RegExp(Xe.join("|"),Oe?"gi":"g")}function R(be,ve){var we=/(?:^|\s)nocode(?:\s|$)/,Oe=[],ke=0,Ce=[],Re=0;function je(He){var Be=He.nodeType;if(Be==1){if(we.test(He.className))return;for(var Ne=He.firstChild;Ne;Ne=Ne.nextSibling)je(Ne);var qe=He.nodeName.toLowerCase();(qe==="br"||qe==="li")&&(Oe[Re]=`
|
|
`,Ce[Re<<1]=ke++,Ce[Re++<<1|1]=He)}else if(Be==3||Be==4){var Xe=He.nodeValue;Xe.length&&(ve?Xe=Xe.replace(/\r\n?/g,`
|
|
`):Xe=Xe.replace(/[ \t\r\n]+/g," "),Oe[Re]=Xe,Ce[Re<<1]=ke,ke+=Xe.length,Ce[Re++<<1|1]=He)}}return je(be),{sourceCode:Oe.join("").replace(/\n$/,""),spans:Ce}}function H(be,ve,we,Oe,ke){if(!we)return;var Ce={sourceNode:be,pre:1,langExtension:null,numberLines:null,sourceCode:we,spans:null,basePos:ve,decorations:null};Oe(Ce),ke.push.apply(ke,Ce.decorations)}var Y=/\S/;function ee(be){for(var ve=void 0,we=be.firstChild;we;we=we.nextSibling){var Oe=we.nodeType;ve=Oe===1?ve?be:we:Oe===3&&Y.test(we.nodeValue)?be:ve}return ve===be?void 0:ve}function oe(be,ve){var we={},Oe;(function(){for(var Re=be.concat(ve),je=[],He={},Be=0,Ne=Re.length;Be<Ne;++Be){var qe=Re[Be],Xe=qe[3];if(Xe)for(var Ze=Xe.length;--Ze>=0;)we[Xe.charAt(Ze)]=qe;var Le=qe[1],et=""+Le;He.hasOwnProperty(et)||(je.push(Le),He[et]=null)}je.push(/[\0-\uffff]/),Oe=D(je)})();var ke=ve.length,Ce=function(Re){for(var je=Re.sourceCode,He=Re.basePos,Be=Re.sourceNode,Ne=[He,a],qe=0,Xe=je.match(Oe)||[],Ze={},Le=0,et=Xe.length;Le<et;++Le){var Ve=Xe[Le],Pe=Ze[Ve],Ie=void 0,ge;if(typeof Pe=="string")ge=!1;else{var de=we[Ve.charAt(0)];if(de)Ie=Ve.match(de[1]),Pe=de[0];else{for(var ce=0;ce<ke;++ce)if(de=ve[ce],Ie=Ve.match(de[1]),Ie){Pe=de[0];break}Ie||(Pe=a)}ge=Pe.length>=5&&Pe.substring(0,5)==="lang-",ge&&!(Ie&&typeof Ie[1]=="string")&&(ge=!1,Pe=E),ge||(Ze[Ve]=Pe)}var X=qe;if(qe+=Ve.length,!ge)Ne.push(He+X,Pe);else{var Q=Ie[1],te=Ve.indexOf(Q),se=te+Q.length;Ie[2]&&(se=Ve.length-Ie[2].length,te=se-Q.length);var fe=Pe.substring(5);H(Be,He+X,Ve.substring(0,te),Ce,Ne),H(Be,He+X+te,Q,me(fe,Q),Ne),H(Be,He+X+se,Ve.substring(se),Ce,Ne)}}Re.decorations=Ne};return Ce}function Te(be){var ve=[],we=[];be.tripleQuotedStrings?ve.push([f,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):be.multiLineStrings?ve.push([f,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):ve.push([f,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),be.verbatimStrings&&we.push([f,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Oe=be.hashComments;Oe&&(be.cStyleComments?(Oe>1?ve.push([m,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):ve.push([m,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),we.push([f,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):ve.push([m,/^#[^\r\n]*/,null,"#"])),be.cStyleComments&&(we.push([m,/^\/\/[^\r\n]*/,null]),we.push([m,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var ke=be.regexLiterals;if(ke){var Ce=ke>1?"":`
|
|
\r`,Re=Ce?".":"[\\S\\s]",je="/(?=[^/*"+Ce+"])(?:[^/\\x5B\\x5C"+Ce+"]|\\x5C"+Re+"|\\x5B(?:[^\\x5C\\x5D"+Ce+"]|\\x5C"+Re+")*(?:\\x5D|$))+/";we.push(["lang-regex",RegExp("^"+W+"("+je+")")])}var He=be.types;He&&we.push([h,He]);var Be=(""+be.keywords).replace(/^ | $/g,"");Be.length&&we.push([C,new RegExp("^(?:"+Be.replace(/[\s,]+/g,"|")+")\\b"),null]),ve.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var Ne="^.[^\\s\\w.$@'\"`/\\\\]*";return be.regexLiterals&&(Ne+="(?!s*/)"),we.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],[l,new RegExp(Ne),null]),oe(ve,we)}var ye=Te({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function he(be,ve,we){for(var Oe=/(?:^|\s)nocode(?:\s|$)/,ke=/\r\n?|\n/,Ce=be.ownerDocument,Re=Ce.createElement("li");be.firstChild;)Re.appendChild(be.firstChild);var je=[Re];function He(Le){var et=Le.nodeType;if(et==1&&!Oe.test(Le.className))if(Le.nodeName==="br")Be(Le),Le.parentNode&&Le.parentNode.removeChild(Le);else for(var Ve=Le.firstChild;Ve;Ve=Ve.nextSibling)He(Ve);else if((et==3||et==4)&&we){var Pe=Le.nodeValue,Ie=Pe.match(ke);if(Ie){var ge=Pe.substring(0,Ie.index);Le.nodeValue=ge;var de=Pe.substring(Ie.index+Ie[0].length);if(de){var ce=Le.parentNode;ce.insertBefore(Ce.createTextNode(de),Le.nextSibling)}Be(Le),ge||Le.parentNode.removeChild(Le)}}}function Be(Le){for(;!Le.nextSibling;)if(Le=Le.parentNode,!Le)return;function et(Ie,ge){var de=ge?Ie.cloneNode(!1):Ie,ce=Ie.parentNode;if(ce){var X=et(ce,1),Q=Ie.nextSibling;X.appendChild(de);for(var te=Q;te;te=Q)Q=te.nextSibling,X.appendChild(te)}return de}for(var Ve=et(Le.nextSibling,0),Pe;(Pe=Ve.parentNode)&&Pe.nodeType===1;)Ve=Pe;je.push(Ve)}for(var Ne=0;Ne<je.length;++Ne)He(je[Ne]);ve===(ve|0)&&je[0].setAttribute("value",ve);var qe=Ce.createElement("ol");qe.className="linenums";for(var Xe=Math.max(0,ve-1|0)||0,Ne=0,Ze=je.length;Ne<Ze;++Ne)Re=je[Ne],Re.className="L"+(Ne+Xe)%10,Re.firstChild||Re.appendChild(Ce.createTextNode("\xA0")),qe.appendChild(Re);be.appendChild(qe)}function le(be){var ve=/\bMSIE\s(\d+)/.exec(navigator.userAgent);ve=ve&&+ve[1]<=8;var we=/\n/g,Oe=be.sourceCode,ke=Oe.length,Ce=0,Re=be.spans,je=Re.length,He=0,Be=be.decorations,Ne=Be.length,qe=0;Be[Ne]=ke;var Xe,Ze;for(Ze=Xe=0;Ze<Ne;)Be[Ze]!==Be[Ze+2]?(Be[Xe++]=Be[Ze++],Be[Xe++]=Be[Ze++]):Ze+=2;for(Ne=Xe,Ze=Xe=0;Ze<Ne;){for(var Le=Be[Ze],et=Be[Ze+1],Ve=Ze+2;Ve+2<=Ne&&Be[Ve+1]===et;)Ve+=2;Be[Xe++]=Le,Be[Xe++]=et,Ze=Ve}Ne=Be.length=Xe;var Pe=be.sourceNode,Ie="";Pe&&(Ie=Pe.style.display,Pe.style.display="none");try{for(var ge=null;He<je;){var de=Re[He],ce=Re[He+2]||ke,X=Be[qe+2]||ke,Ve=Math.min(ce,X),Q=Re[He+1],te;if(Q.nodeType!==1&&(te=Oe.substring(Ce,Ve))){ve&&(te=te.replace(we,"\r")),Q.nodeValue=te;var se=Q.ownerDocument,fe=se.createElement("span");fe.className=Be[qe+1];var Ae=Q.parentNode;Ae.replaceChild(fe,Q),fe.appendChild(Q),Ce<ce&&(Re[He+1]=Q=se.createTextNode(Oe.substring(Ve,ce)),Ae.insertBefore(Q,fe.nextSibling))}Ce=Ve,Ce>=ce&&(He+=2),Ce>=X&&(qe+=2)}}finally{Pe&&(Pe.style.display=Ie)}}var pe={};function ie(be,ve){for(var we=ve.length;--we>=0;){var Oe=ve[we];pe.hasOwnProperty(Oe)?U.console&&console.warn("cannot override language handler %s",Oe):pe[Oe]=be}}function me(be,ve){return be&&pe.hasOwnProperty(be)||(be=/^\s*</.test(ve)?"default-markup":"default-code"),pe[be]}ie(ye,["default-code"]),ie(oe([],[[a,/^[^<?]+/],[p,/^<!\w[^>]*(?:>|$)/],[m,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[l,/^(?:<[%?]|[%?]>)/],["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,`"'`]],[[v,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[M,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[l,/^[=<>\/]+/],["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:g}),["c","cc","cpp","cxx","cyc","m"]),ie(Te({keywords:"null,true,false"}),["json"]),ie(Te({keywords:_,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:g}),["cs"]),ie(Te({keywords:O,cStyleComments:!0}),["java"]),ie(Te({keywords:s,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:y,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 ve=be.langExtension;try{var we=R(be.sourceNode,be.pre),Oe=we.sourceCode;be.sourceCode=Oe,be.spans=we.spans,be.basePos=0,me(ve,Oe)(be),le(be)}catch(ke){U.console&&console.log(ke&&ke.stack||ke)}}function ne(be,ve,we){var Oe=we||!1,ke=ve||null,Ce=document.createElement("div");Ce.innerHTML="<pre>"+be+"</pre>",Ce=Ce.firstChild,Oe&&he(Ce,Oe,!0);var Re={langExtension:ke,numberLines:Oe,sourceNode:Ce,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return J(Re),Ce.innerHTML}function q(be,ve){var we=ve||document.body,Oe=we.ownerDocument||document;function ke(de){return we.getElementsByTagName(de)}for(var Ce=[ke("pre"),ke("code"),ke("xmp")],Re=[],je=0;je<Ce.length;++je)for(var He=0,Be=Ce[je].length;He<Be;++He)Re.push(Ce[je][He]);Ce=null;var Ne=Date;Ne.now||(Ne={now:function(){return+new Date}});var qe=0,Xe=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ze=/\bprettyprint\b/,Le=/\bprettyprinted\b/,et=/pre|xmp/i,Ve=/^code$/i,Pe=/^(?:pre|code|xmp)$/i,Ie={};function ge(){for(var de=U.PR_SHOULD_USE_CONTINUATION?Ne.now()+250:Infinity;qe<Re.length&&Ne.now()<de;qe++){for(var ce=Re[qe],X=Ie,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!==Ie||Ze.test(fe))&&!Le.test(fe)){for(var Ae=!1,De=ce.parentNode;De;De=De.parentNode){var Ue=De.tagName;if(Pe.test(Ue)&&De.className&&Ze.test(De.className)){Ae=!0;break}}if(!Ae){ce.className+=" prettyprinted";var Qe=X.lang;if(!Qe){Qe=fe.match(Xe);var Ye;!Qe&&(Ye=ee(ce))&&Ve.test(Ye.tagName)&&(Qe=Ye.className.match(Xe)),Qe&&(Qe=Qe[1])}var mt;if(et.test(ce.tagName))mt=1;else{var dt=ce.currentStyle,st=Oe.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:Qe,sourceNode:ce,numberLines:bt,pre:mt,sourceCode:null,basePos:null,spans:null,decorations:null};J(Bt)}}}qe<Re.length?U.setTimeout(ge,250):typeof be=="function"&&be()}ge()}var xe=U.PR={createSimpleLexer:oe,registerLangHandler:ie,sourceDecorator:Te,PR_ATTRIB_NAME:M,PR_ATTRIB_VALUE:F,PR_COMMENT:m,PR_DECLARATION:p,PR_KEYWORD:C,PR_LITERAL:c,PR_NOCODE:j,PR_PLAIN:a,PR_PUNCTUATION:l,PR_SOURCE:E,PR_STRING:f,PR_TAG:v,PR_TYPE:h,prettyPrintOne:L?U.prettyPrintOne=ne:P=ne,prettyPrint:B=L?U.prettyPrint=q:B=q},_e=U.define;typeof _e=="function"&&_e.amd&&_e("google-code-prettify",[],function(){return xe})})()},"VrN/":function(ot,ze,Z){(function(re,z){ot.exports=z()})(this,function(){"use strict";var re=navigator.userAgent,z=navigator.platform,L=/gecko\/\d/i.test(re),G=/MSIE \d/.test(re),I=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(re),P=/Edge\/(\d+)/.exec(re),B=G||I||P,U=B&&(G?document.documentMode||6:+(P||I)[1]),k=!P&&/WebKit\//.test(re),A=k&&/Qt\/\d+\.\d+/.test(re),b=!P&&/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),y=!P&&/AppleWebKit/.test(re)&&/Mobile\/\w+/.test(re),d=/Android/.test(re),o=y||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(re),u=y||/Mac/.test(z),s=/\bCrOS\b/.test(re),w=/win/i.test(z),g=S&&re.match(/Version\/(\d*\.\d*)/);g&&(g=Number(g[1])),g&&g>=15&&(S=!1,k=!0);var f=u&&(A||S&&(g==null||g<12.11)),C=L||B&&U>=9;function m(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var h=function(e,t){var n=e.className,r=m(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 l(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 v(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var p;document.createRange?p=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:p=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;m(t).test(n)||(e.className+=(n?" ":"")+t)}function j(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!m(n[r]).test(t)&&(t+=" "+n[r]);return t}var W=function(e){e.select()};y?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 R(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 pe(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 me(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 _e(e,t){var n;return Object.create?n=Object.create(e):(xe.prototype=e,n=new xe),t&&R(t,n),n}var be=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ve(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||be.test(e))}function we(e,t){return t?t.source.indexOf("\\w")>-1&&ve(e)?!0:t.test(e):ve(e)}function Oe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ke=/[\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 Ce(e){return e.charCodeAt(0)>=768&&ke.test(e)}function Re(e,t,n){for(;(n<0?t>0:t<e.length)&&Ce(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 He(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 Be=null;function Ne(e,t,n){var r;Be=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:Be=i),T.from==t&&(T.from!=T.to&&n!="before"?r=i:Be=i)}return r!=null?r:Be}var qe=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 Se=$.length,Ee=[],Me=0;Me<Se;++Me)Ee.push(n($.charCodeAt(Me)));for(var Fe=0,Ge=ue;Fe<Se;++Fe){var $e=Ee[Fe];$e=="m"?Ee[Fe]=Ge:Ge=$e}for(var tt=0,Je=ue;tt<Se;++tt){var rt=Ee[tt];rt=="1"&&Je=="r"?Ee[tt]="n":T.test(rt)&&(Je=rt,rt=="r"&&(Ee[tt]="R"))}for(var ut=1,at=Ee[0];ut<Se-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<Se;++Lt){var Ht=Ee[Lt];if(Ht==",")Ee[Lt]="N";else if(Ht=="%"){var Ot=void 0;for(Ot=Lt+1;Ot<Se&&Ee[Ot]=="%";++Ot);for(var sr=Lt&&Ee[Lt-1]=="!"||Ot<Se&&Ee[Ot]=="1"?"1":"N",nr=Lt;nr<Ot;++nr)Ee[nr]=sr;Lt=Ot-1}}for(var kt=0,ir=ue;kt<Se;++kt){var zt=Ee[kt];ir=="L"&&zt=="1"?Ee[kt]="L":T.test(zt)&&(ir=zt)}for(var Nt=0;Nt<Se;++Nt)if(i.test(Ee[Nt])){var It=void 0;for(It=Nt+1;It<Se&&i.test(Ee[It]);++It);for(var Pt=(Nt?Ee[Nt-1]:ue)=="L",ar=(It<Se?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<Se;)if(N.test(Ee[Kt])){var Va=Kt;for(++Kt;Kt<Se&&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<Se&&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,Se-Or[0].length,Se)))),ae=="rtl"?Yt.reverse():Yt}}();function Xe(e,t){var n=e.order;return n==null&&(n=e.order=qe(e.text,t)),n}var Ze=[],Le=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]||Ze).concat(n)}};function et(e,t){return e._handlers&&e._handlers[t]||Ze}function Ve(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=et(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 Ie(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 ge(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 et(e,t).length>0}function ce(e){e.prototype.on=function(t,n){Le(this,t,n)},e.prototype.off=function(t,n){Ve(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 Ae(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 De=function(){if(B&&U<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),Ue;function Qe(e){if(Ue==null){var t=a("span","\u200B");l(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ue=t.offsetWidth<=1&&t.offsetHeight>2&&!(B&&U<8))}var n=Ue?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var Ye;function mt(e){if(Ye!=null)return Ye;var t=l(e,document.createTextNode("A\u062EA")),n=p(t,0,1).getBoundingClientRect(),r=p(t,1,2).getBoundingClientRect();return c(e),!n||n.left==n.right?!1:Ye=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=l(e,a("span","x")),n=t.getBoundingClientRect(),r=p(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=_e(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]={};R(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 We(e,t,n){if(n===void 0&&(n=null),!(this instanceof We))return new We(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ct(e,t){return e.line-t.line||e.ch-t.ch}function Gn(e,t){return e.sticky==t.sticky&&ct(e,t)==0}function gn(e){return We(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 We(e.first,0);var n=e.first+e.size-1;return t.line>n?We(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?We(e.line,t):n<0?We(e.line,0):e}function Ke(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 zn(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,Se=0;n.state=!0,br(e,t.text,ae.mode,n,function(Ee,Me){for(var Fe=ue;Se<Ee;){var Ge=i[ue];Ge>Ee&&i.splice(ue,1,Ee,i[ue+1],Ge),ue+=2,Se=Math.min(Ee,Ge)}if(!Me)return;if(ae.opaque)i.splice(Fe,ue-Fe,Ee,"overlay "+Me),ue=Fe+2;else for(;Fe<ue;Fe+=2){var $e=i[Fe+1];i[Fe+1]=($e?$e+" ":"")+"overlay "+Me}},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=zn(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,Se=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,Se),T),Se){var Ee=Se[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 Me=Math.min(ae.pos,V+5e3);i(Me,$),V=Me}}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 Se=K[ue];if(Se.to==null){var Ee=Er(V,Se.marker);Ee?$&&(Se.to=Ee.to==null?null:Ee.to+ae):Se.to=i}}if(V)for(var Me=0;Me<V.length;++Me){var Fe=V[Me];if(Fe.to!=null&&(Fe.to+=ae),Fe.from==null){var Ge=Er(K,Fe.marker);Ge||(Fe.from=ae,$&&(K||(K=[])).push(Fe))}else Fe.from+=ae,$&&(K||(K=[])).push(Fe)}K&&(K=Ri(K)),V&&V!=K&&(V=Ri(V));var $e=[K];if(!$){var tt=t.text.length-2,Je;if(tt>0&&K)for(var rt=0;rt<K.length;++rt)K[rt].to==null&&(Je||(Je=[])).push(new qr(K[rt].marker,null,null));for(var ut=0;ut<tt;++ut)$e.push(Je);$e.push(V)}return $e}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 Me=0;Me<Ee.markedSpans.length;++Me){var Fe=Ee.markedSpans[Me].marker;Fe.readOnly&&(!r||ee(r,Fe)==-1)&&(r||(r=[])).push(Fe)}}),!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),Se=ct($.to,K.to);(ue<0||!N.inclusiveLeft&&!ue)&&ae.push({from:$.from,to:K.from}),(Se>0||!N.inclusiveRight&&!Se)&&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=v("span",null,null,k?"padding-right: .1px":null),r={pre:v("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(Qe(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 Se=V.exec(t),Ee=Se?Se.index-ue:t.length-ue;if(Ee){var Me=document.createTextNode(K.slice(ue,ue+Ee));B&&U<9?ae.appendChild(a("span",[Me])):ae.appendChild(Me),e.map.push(e.pos,e.pos+Ee,Me),e.col+=Ee,e.pos+=Ee}if(!Se)break;ue+=Ee+1;var Fe=void 0;if(Se[0]==" "){var Ge=e.cm.options.tabSize,$e=Ge-e.col%Ge;Fe=ae.appendChild(a("span",me($e),"cm-tab")),Fe.setAttribute("role","presentation"),Fe.setAttribute("cm-text"," "),e.col+=$e}else Se[0]=="\r"||Se[0]==`
|
|
`?(Fe=ae.appendChild(a("span",Se[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Fe.setAttribute("cm-text",Se[0]),e.col+=1):(Fe=e.cm.options.specialCharPlaceholder(Se[0]),Fe.setAttribute("cm-text",Se[0]),B&&U<9?ae.appendChild(a("span",[Fe])):ae.appendChild(Fe),e.col+=1);e.map.push(e.pos,e.pos+1,Fe),e.pos++}}if(e.trailingSpace=K.charCodeAt(t.length-1)==32,n||r||i||$||T||N){var tt=n||"";r&&(tt+=r),i&&(tt+=i);var Je=a("span",[ae],tt,T);if(N)for(var rt in N)N.hasOwnProperty(rt)&&rt!="style"&&rt!="class"&&Je.setAttribute(rt,N[rt]);return e.content.appendChild(Je)}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,Se=0;Se<t.length&&!(ue=t[Se],ue.to>$&&ue.from<=$);Se++);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,Se,Ee=0,Me,Fe,Ge,$e,tt;;){if(Ee==V){Me=Fe=Ge=Se="",tt=null,$e=null,Ee=Infinity;for(var Je=[],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)Je.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,Fe=""),pt.className&&(Me+=" "+pt.className),pt.css&&(Se=(Se?Se+";":"")+pt.css),pt.startStyle&&at.from==V&&(Ge+=" "+pt.startStyle),pt.endStyle&&at.to==Ee&&(rt||(rt=[])).push(pt.endStyle,at.to),pt.title&&((tt||(tt={})).title=pt.title),pt.attributes)for(var Lt in pt.attributes)(tt||(tt={}))[Lt]=pt.attributes[Lt];pt.collapsed&&(!$e||Tn($e.marker,pt)<0)&&($e=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&&(Fe+=" "+rt[Ht]);if(!$e||$e.from==V)for(var Ot=0;Ot<Je.length;++Ot)vt(t,0,Je[Ot]);if($e&&($e.from||0)==V){if(vt(t,($e.to==null?K+1:$e.to)-V,$e.marker,$e.from==null),$e.to==null)return;$e.to==V&&($e=!1)}}if(V>=K)break;for(var sr=Math.min(K,Ee);;){if(ae){var nr=V+ae.length;if(!$e){var kt=nr>sr?ae.slice(0,sr-V):ae;t.addToken(t,kt,ue?ue+Me:Me,Ge,V+kt.length==Ee?Fe:"",Se,tt)}if(nr>=sr){ae=ae.slice(sr-V),V=sr;break}V=nr,Ge=""}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 Gt(e,t){var n=et(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=m("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($),Gt(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;"),l(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=l(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,l(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&&Ce(t.line.text.charAt(i.coverStart+N));)--N;for(;i.coverStart+K<i.coverEnd&&Ce(t.line.text.charAt(i.coverStart+K));)++K;if(B&&U<9&&N==0&&K==i.coverEnd-i.coverStart?$=T.parentNode.getBoundingClientRect():$=js(p(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 Se=T.parentNode.getClientRects()[0];Se?$={left:Se.left,right:Se.left+An(e.display),top:Se.top,bottom:Se.bottom}:$=ro}for(var Ee=$.top-t.rect.top,Me=$.bottom-t.rect.top,Fe=(Ee+Me)/2,Ge=t.view.measure.heights,$e=0;$e<Ge.length-1&&!(Fe<Ge[$e]);$e++);var tt=$e?Ge[$e-1]:0,Je=Ge[$e],rt={left:(V=="right"?$.right:$.left)-t.rect.left,right:(V=="left"?$.left:$.right)-t.rect.left,top:tt,bottom:Je};return!$.left&&!$.right&&(rt.bogus=!0),e.options.singleCursorHeightPerLine||(rt.rtop=Ee,rt.rbottom=Me),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 b&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return b&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function 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(Me,Fe){var Ge=Dr(e,i,Me,Fe?"right":"left",T);return Fe?Ge.left=Ge.right:Ge.right=Ge.left,Fi(e,r,Ge,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(Me,Fe,Ge){var $e=K[Fe],tt=$e.level==1;return N(Ge?Me-1:Me,tt!=Ge)}var ue=Ne(K,V,$),Se=Be,Ee=ae(V,ue,$=="before");return Se!=null&&(Ee.other=ae(V,Se,$!="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=We(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?zs:Gs)(e,t,n,T,ae,r,i);$=ue.level!=1,K=$?ue.from:ue.to-1,V=$?ue.to:ue.from-1}var Se=null,Ee=null,Me=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&&(Se=ut,Ee=at),!0):!1},K,V),Fe,Ge,$e=!1;if(Ee){var tt=r-Ee.left<Ee.right-r,Je=tt==$;Me=Se+(Je?0:1),Ge=Je?"after":"before",Fe=tt?Ee.left:Ee.right}else{!$&&(Me==V||Me==K)&&Me++,Ge=Me==0?"after":Me==t.text.length?"before":Dr(e,T,Me-($?1:0)).bottom+N<=i==$?"after":"before";var rt=Tr(e,We(n,Me,Ge),"line",t,T);Fe=rt.left,$e=i<rt.top?-1:i>=rt.bottom?1:0}return Me=Re(t.text,Me,1),ga(n,Me,Ge,$e,r-Fe)}function Gs(e,t,n,r,i,T,N){var K=je(function(ue){var Se=i[ue],Ee=Se.level!=1;return ya(Tr(e,We(n,Ee?Se.to:Se.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,We(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 zs(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,Se=0;Se<i.length;Se++){var Ee=i[Se];if(Ee.from>=$||Ee.to<=V)continue;var Me=Ee.level!=1,Fe=Dr(e,r,Me?Math.min($,Ee.to)-1:Math.max(V,Ee.from)).right,Ge=Fe<T?T-Fe+1e9:Fe-T;(!ae||ue>Ge)&&(ae=Ee,ue=Ge)}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"))}l(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");l(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=We(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&&Gr(e);else if(n<=i.viewFrom)$t&&Hr(e.doc,n+r)>i.viewFrom?Gr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Gr(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):Gr(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):Gr(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):Gr(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 Gr(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(Je,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: "+Je+`px;
|
|
top: `+rt+"px; width: "+(ut==null?V-Je:ut)+`px;
|
|
height: `+(at-rt)+"px"))}function ue(Je,rt,ut){var at=nt(i,Je),pt=at.text.length,Lt,Ht;function Ot(kt,ir){return pa(e,We(Je,kt),"div",at,ir)}function sr(kt,ir,zt){var Nt=fo(e,at,null,kt),It=ir=="ltr"==(zt=="after")?"left":"right",Pt=zt=="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 He(nr,rt||0,ut==null?pt:ut,function(kt,ir,zt,Nt){var It=zt=="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,zt,"before"),Wn=$?K:sr(ir,zt,"after"),Xa=$&&Jr&&Or?V:ar.right):(hn=$?sr(kt,zt,"before"):K,Qt=!$&&jn&&Yt?V:Pt.right,Wn=!$&&Jr&&Or?K:ar.left,Xa=$?sr(ir,zt,"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 Se=t.from(),Ee=t.to();if(Se.line==Ee.line)ue(Se.line,Se.ch,Ee.ch);else{var Me=nt(i,Se.line),Fe=nt(i,Ee.line),Ge=ur(Me)==ur(Fe),$e=ue(Se.line,Se.ch,Ge?Me.text.length+1:null).end,tt=ue(Ee.line,Ge?0:null,Ee.ch).start;Ge&&($e.top<tt.top-2?(ae($e.right,$e.top,null,$e.bottom),ae(K,tt.top,tt.left,tt.bottom)):ae($e.right,$e.top,tt.left-$e.right,$e.bottom)),$e.bottom<tt.top&&ae(K,$e.bottom,null,tt.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 Se=Math.ceil(K/An(e.display));Se>e.display.maxLineLength&&(e.display.maxLineLength=Se,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(Ie(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?We(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?We(t.line,t.ch+1,"before"):t);for(var 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,Se=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ue,Ee=nn(e)-n.gutters.offsetWidth,Me=t.right-t.left>Ee;return Me&&(t.right=t.left+Ee),t.left<10?N.scrollLeft=0:t.left<Se?N.scrollLeft=Math.max(0,t.left+ue-(Me?0:10)):t.right>Ee+Se-3&&(N.scrollLeft=t.right+(Me?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),Le(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Le(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),Le(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=zn(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),Se=0;!ue&&Se<N.length;++Se)ue=N[Se]!=T.styles[Se];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 Gr(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)&&(Gr(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(Me){var Fe=Me.nextSibling;return k&&u&&e.display.currentWheelTarget==Me?Me.style.display="none":Me.parentNode.removeChild(Me),Fe}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 Se=Us(e,ue,$,n);T.insertBefore(Se,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=v("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=v("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var T=v("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 Gi=0,dr=null;B?dr=-.53:L?dr=15:b?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 Se=i*dr,Ee=e.doc.scrollTop,Me=Ee+T.wrapper.clientHeight;Se<0?Ee=Math.max(0,Ee+Se-50):Me=Math.min(e.doc.height,Me+Se+50),Aa(e,{top:Ee,bottom:Me})}Gi<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 Fe=N.scrollLeft-T.wheelStartX,Ge=N.scrollTop-T.wheelStartY,$e=Ge&&T.wheelDY&&Ge/T.wheelDY||Fe&&T.wheelDX&&Fe/T.wheelDX;if(T.wheelStartX=T.wheelStartY=null,!$e)return;dr=(dr*Gi+$e)/(Gi+1),++Gi},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(!Gn(n.anchor,r.anchor)||!Gn(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(Se,Ee){return ct(Se.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 zr(e,t){return new cr([new wt(e,t||e)],0)}function Vr(e){return e.text?We(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),We(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?We(n.line,e.ch-t.ch+n.ch):We(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=We(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(tt){return n?n[tt]:null}function T(tt,Je,rt){ua(tt,Je,rt,r),Gt(tt,"change",tt,t)}function N(tt,Je){for(var rt=[],ut=tt;ut<Je;++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),Se=J($),Ee=i($.length-1),Me=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 Fe=N(0,$.length-1);T(ue,ue.text,Ee),Me&&e.remove(K.line,Me),Fe.length&&e.insert(K.line,Fe)}else if(ae==ue)if($.length==1)T(ae,ae.text.slice(0,K.ch)+Se+ae.text.slice(V.ch),Ee);else{var Ge=N(1,$.length-1);Ge.push(new rn(Se+ae.text.slice(V.ch),Ee,r)),T(ae,ae.text.slice(0,K.ch)+$[0],i(0)),e.insert(K.line+1,Ge)}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,Me);else{T(ae,ae.text.slice(0,K.ch)+$[0],i(0)),T(ue,Se+ue.text.slice(V.ch),Ee);var $e=N(1,$.length-1);Me>1&&e.remove(K.line+1,Me-1),e.insert(K.line+1,$e)}Gt(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 zi(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,zr(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,zo(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,ge(e.cm)),Gt(e,"cursorActivity",e)}function Go(e){Ko(e,zo(e,e.sel,null,!1))}function zo(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),Se=void 0;if((r<0?ae:$)&&(ue=Vo(e,ue,-r,ue&&ue.line==t.line?T:null)),ue&&ue.line==t.line&&(Se=ct(ue,n))&&(r<0?Se<0:Se>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,We(e.first,0))}function Vo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ht(e,We(t.line-1)):null:n>0&&t.ch==(r||nt(e,t.line)).text.length?t.line<e.first+e.size-1?We(t.line+1,0):null:new We(t.line,t.ch+n)}function Xo(e){e.setSelection(We(e.firstLine(),0),We(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"),Se=function(Fe){var Ge=T.changes[Fe];if(Ge.origin=t,ue&&!Yo(e,Ge,!1))return K.length=0,{};ae.push(ka(e,Ge));var $e=Fe?Ra(e,Ge):J(K);hi(e,Ge,$e,Bo(e,Ge)),!Fe&&e.cm&&e.cm.scrollIntoView({from:Ge.from,to:Vr(Ge)});var tt=[];Xr(e,function(Je,rt){!rt&&ee(tt,Je.history)==-1&&(qo(Je.history,Ge),tt.push(Je.history)),hi(Je,Ge,null,Bo(Je,Ge))})},Ee=T.changes.length-1;Ee>=0;--Ee){var Me=Se(Ee);if(Me)return Me.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(We(i.anchor.line+t,i.anchor.ch),We(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:We(e.first,0),to:We(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:We(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,We(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&&ge(e),Ma(r,t,n,ho(e)),e.options.lineWrapping||(r.iter(V,T.line+t.text.length,function(Ee){var Me=ei(Ee);Me>i.maxLineLength&&(i.maxLine=Ee,i.maxLineLength=Me,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 Se={from:T,to:N,text:t.text,removed:t.removed,origin:t.origin};ue&&Gt(e,"change",e,Se),ae&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Se)}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=We($.from.line+r,$.from.ch),$.to=We($.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),Gt(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")}),Gt(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),Gt(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&&Gt(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&&Gt(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&&Go(e.doc)),e&&Gt(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=We(t?T:Tt(T),N.from),e==-1))return n;if(N.to!=null&&(r=We(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)}Gt(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&&R(r,T,!1),N>0||N==0&&T.clearWhenEmpty!==!1)return T;if(T.replacedWith&&(T.collapsed=!0,T.widgetNode=v("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&&Le(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&&Go(V.doc),Gt(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();Gt(this,"clear")},yi.prototype.find=function(e,t){return this.primary.find(e,t)},ce(yi);function Tl(e,t,n,r,i){r=R(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(We(e.first,0),e.clipPos(We(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=We(n,0);this.sel=zr(T),this.history=new zi(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,zr(T),ye)};rr.prototype=_e(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=We(this.first,0),n=this.first+this.size-1;Mn(this,{from:t,to:We(n,nt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&oi(this.cm,0,0),Xt(this,zr(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"?We(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,Ke(this,e),t)}),extendSelectionsBy:Wt(function(e,t){var n=ne(this.sel.ranges,e);jo(this,Ke(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 zi(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 zi(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&&Oe(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,Oe(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(m(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(m(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,We(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 zi(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),Ie(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(Me){return Me!=null}).join(t.doc.lineSeparator())),origin:"paste"};Mn(t.doc,Ee),Ho(t.doc,zr(ht(t.doc,n),ht(t.doc,Vr(Ee))))})()},V=function(Ee,Me){if(t.options.allowDropFileTypes&&ee(t.options.allowDropFileTypes,Ee.type)==-1){K();return}var Fe=new FileReader;Fe.onerror=function(){return K()},Fe.onload=function(){var Ge=Fe.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ge)){K();return}T[Me]=Ge,K()},Fe.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,zr(n,n)),ue)for(var Se=0;Se<ue.length;++Se)kn(t.doc,"",ue[Se].anchor,ue[Se].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(Ie(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)),l(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;Le(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(Rl)},100))}),Le(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=Re(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 We(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(Se){return Dr(t,ae,Se).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 We(r,$,V)}}return new We(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=Ne(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($e,tt){return Fa(t,$e instanceof We?$e.ch:$e,tt)},V,$=function($e){return e.options.lineWrapping?(V=V||_n(e,t),fo(e,t,V,$e)):{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,Se=K(n,ue?1:-1);if(Se!=null&&(ue?Se<=N.to&&Se<=ae.end:Se>=N.from&&Se>=ae.begin)){var Ee=ue?"before":"after";return new We(n.line,Se,Ee)}}var Me=function($e,tt,Je){for(var rt=function(Lt,Ht){return Ht?new We(n.line,K(Lt,1),"before"):new We(n.line,Lt,"after")};$e>=0&&$e<i.length;$e+=tt){var ut=i[$e],at=tt>0==(ut.level!=1),pt=at?Je.begin:K(Je.end,-1);if(ut.from<=pt&&pt<ut.to)return rt(pt,at);if(pt=at?ut.from:K(ut.to,-1),Je.begin<=pt&&pt<Je.end)return rt(pt,at)}},Fe=Me(T+r,r,ae);if(Fe)return Fe;var Ge=r>0?ae.end:K(ae.begin,-1);return Ge!=null&&!(r>0&&Ge==t.text.length)&&(Fe=Me(r>0?0:i.length-1,r,$(Ge)),Fe)?Fe: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:We(t.head.line+1,0)}:{from:t.head,to:We(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Fn(e,function(t){return{from:We(t.from().line,0),to:ht(e.doc,We(t.to().line+1,0))}})},delLineLeft:function(e){return Fn(e,function(t){return{from:We(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(We(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(We(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(me(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 We(i.line,i.ch-1)),i.ch>0)i=new We(i.line,i.ch+1),e.replaceRange(T.charAt(i.ch-1)+T.charAt(i.ch-2),We(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 We(i.line,1),e.replaceRange(T.charAt(0)+e.doc.lineSeparator()+N.charAt(N.length-1),We(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 We(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"&&Gt(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(),Ie(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"),Ve(document,"keyup",n),Ve(document,"mouseover",n))}Le(document,"keyup",n),Le(document,"mouseover",n)}function ps(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ie(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Nr(t.display,e)||Ie(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(Ie(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=Ae(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?Gl(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=s?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 Gl(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&&De&&!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)?zl(e,r,t,i):Vl(e,r,t,i)}function zl(e,t,n,r){var i=e.display,T=!1,N=jt(e,function($){k&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ve(i.wrapper.ownerDocument,"mouseup",N),Ve(i.wrapper.ownerDocument,"mousemove",K),Ve(i.scroller,"dragstart",V),Ve(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(),Le(i.wrapper.ownerDocument,"mouseup",N),Le(i.wrapper.ownerDocument,"mousemove",K),Le(i.scroller,"dragstart",V),Le(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(We(t.line,0),ht(e.doc,We(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 Se(Je){if(ct(ue,Je)==0)return;if(ue=Je,r.unit=="rectangle"){for(var rt=[],ut=e.options.tabSize,at=H(nt(T,n.line).text,n.ch,ut),pt=H(nt(T,Je.line).text,Je.ch,ut),Lt=Math.min(at,pt),Ht=Math.max(at,pt),Ot=Math.min(n.line,Je.line),sr=Math.min(e.lastLine(),Math.max(n.line,Je.line));Ot<=sr;Ot++){var nr=nt(T,Ot).text,kt=pe(nr,Lt,ut);Lt==Ht?rt.push(new wt(We(Ot,kt),We(Ot,kt))):nr.length>kt&&rt.push(new wt(We(Ot,kt),We(Ot,pe(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(Je)}else{var ir=N,zt=ys(e,Je,r.unit),Nt=ir.anchor,It;ct(zt.anchor,Nt)>0?(It=zt.head,Nt=Qr(ir.from(),zt.anchor)):(It=zt.anchor,Nt=vn(ir.to(),zt.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(),Me=0;function Fe(Je){var rt=++Me,ut=on(e,Je,!0,r.unit=="rectangle");if(!ut)return;if(ct(ut,ue)!=0){e.curOp.focus=M(),Se(ut);var at=Wi(i,T);(ut.line>=at.to||ut.line<at.from)&&setTimeout(jt(e,function(){Me==rt&&Fe(Je)}),150)}else{var pt=Je.clientY<Ee.top?-20:Je.clientY>Ee.bottom?20:0;pt&&setTimeout(jt(e,function(){if(Me!=rt)return;i.scroller.scrollTop+=pt,Fe(Je)}),50)}}function Ge(Je){e.state.selectingText=!1,Me=Infinity,Je&&(X(Je),i.input.focus()),Ve(i.wrapper.ownerDocument,"mousemove",$e),Ve(i.wrapper.ownerDocument,"mouseup",tt),T.history.lastSelOrigin=null}var $e=jt(e,function(Je){Je.buttons===0||!Ae(Je)?Ge(Je):Fe(Je)}),tt=jt(e,Ge);e.state.selectingText=tt,Le(i.wrapper.ownerDocument,"mousemove",$e),Le(i.wrapper.ownerDocument,"mouseup",tt)}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=Ne(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=Ne(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 Se=T[V+($?-1:0)],Ee=$==(Se.level==1),Me=Ee?Se.from:Se.to,Fe=Ee?"after":"before";return n.ch==Me&&n.sticky==Fe?t:new wt(new We(n.line,Me,Fe),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(Se){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(Ie(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(We(N,ae))}N++});for(var K=T.length-1;K>=0;K--)kn(r.doc,i,T[K],We(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?Le:Ve;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?R(t):{},R(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;Le(t.scroller,"mousedown",jt(e,vs)),B&&U<11?Le(t.scroller,"dblclick",jt(e,function(V){if(Ie(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)})):Le(t.scroller,"dblclick",function(V){return Ie(e,V)||X(V)}),Le(t.scroller,"contextmenu",function(V){return Es(e,V)}),Le(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}Le(t.scroller,"touchstart",function(V){if(!Ie(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)}}),Le(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Le(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(We(ae.line,0),ht(e.doc,We(ae.line+1,0))),e.setSelection(ue.anchor,ue.head),e.focus(),X(V)}i()}),Le(t.scroller,"touchcancel",i),Le(t.scroller,"scroll",function(){t.scroller.clientHeight&&(si(e,t.scroller.scrollTop),ln(e,t.scroller.scrollLeft,!0),Pe(e,"scroll",e))}),Le(t.scroller,"mousewheel",function(V){return Oo(e,V)}),Le(t.scroller,"DOMMouseScroll",function(V){return Oo(e,V)}),Le(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(V){Ie(e,V)||se(V)},over:function(V){Ie(e,V)||(Ll(e,V),se(V))},start:function(V){return Al(e,V)},drop:jt(e,Cl),leave:function(V){Ie(e,V)||is(e)}};var K=t.input.getField();Le(K,"keyup",function(V){return ps.call(e,V)}),Le(K,"keydown",jt(e,ms)),Le(K,"keypress",jt(e,gs)),Le(K,"focus",function(V){return Sa(e,V)}),Le(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="",Se=0;if(e.options.indentWithTabs)for(var Ee=Math.floor(ae/N);Ee;--Ee)Se+=N,ue+=" ";if(Se<ae&&(ue+=me(ae-Se)),ue!=$)return kn(i,ue,We(t,0),We(t,$.length),"+input"),K.stateAfter=null,!0;for(var Me=0;Me<i.sel.ranges.length;Me++){var Fe=i.sel.ranges[Me];if(Fe.head.line==t&&Fe.head.ch<$.length){var Ge=We(t,$.length);Ua(i,Me,new wt(Ge,Ge));break}}}var wr=null;function ta(e){wr=e}function Ga(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($e){return[$e]}));for(var ue=e.curOp.updateInput,Se=r.ranges.length-1;Se>=0;Se--){var Ee=r.ranges[Se],Me=Ee.from(),Fe=Ee.to();Ee.empty()&&(n&&n>0?Me=We(Me.line,Me.ch-n):e.state.overwrite&&!K?Fe=We(Fe.line,Math.min(nt(T,Fe.line).text.length,Fe.ch+J(V).length)):K&&wr&&wr.lineWise&&wr.text.join(`
|
|
`)==V.join(`
|
|
`)&&(Me=Fe=We(Me.line,0)));var Ge={from:Me,to:Fe,text:$?$[Se%$.length]:V,origin:i||(K?"paste":e.state.cutIncoming>N?"cut":"+input")};Mn(e.doc,Ge),Gt(e,"inputRead",e,Ge)}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 Ga(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&&Gt(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:We(i,0),head:We(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"),y&&(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 Se=this.doc.sel.ranges;V.ch==0&&i.length==Se.length&&Se[N].from().ch>0&&Ua(this.doc,N,new wt(V,Se[N].to()),ye)}}}),getTokenAt:function(r,i){return Ai(this,r,i)},getLineTokens:function(r,i){return Ai(this,We(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),Se=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>Se&&(ae=Se-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=za(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()?za(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=za(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 Se=Ls(T,ue,r,i);return i=="page"&&ae==N.sel.primary()&&_a(T,pa(T,Se,"div").top-ue.top),Se},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=we($,V)?function(ue){return we(ue,V)}:/\s/.test($)?function(ue){return/\s/.test(ue)}:function(ue){return!/\s/.test(ue)&&!we(ue)};N>0&&ae(T.charAt(N-1));)--N;for(;K<T.length&&ae(T.charAt(K));)++K}return new wt(We(r.line,N),We(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:We(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,Gt(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 za(e,t,n,r,i){var T=t,N=n,K=nt(e,t.line),V=i&&e.direction=="rtl"?-n:n;function $(){var tt=t.line+V;return tt<e.first||tt>=e.first+e.size?!1:(t=new We(tt,t.ch,t.sticky),K=nt(e,tt))}function ae(tt){var Je;if(r=="codepoint"){var rt=K.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(rt)?Je=null:Je=new We(t.line,Math.max(0,Math.min(K.text.length,t.ch+n*(rt>=55296&&rt<56320?2:1))),-n)}else i?Je=kl(e.cm,K,t,n):Je=Na(K,t,n);if(Je==null)if(!tt&&$())t=Ba(i,e.cm,K,t.line,V);else return!1;else t=Je;return!0}if(r=="char"||r=="codepoint")ae();else if(r=="column")ae(!0);else if(r=="word"||r=="group")for(var ue=null,Se=r=="group",Ee=e.cm&&e.cm.getHelper(t,"wordChars"),Me=!0;!(n<0&&!ae(!Me));Me=!1){var Fe=K.text.charAt(t.ch)||`
|
|
`,Ge=we(Fe,Ee)?"w":Se&&Fe==`
|
|
`?"n":!Se||/\s/.test(Fe)?null:"p";if(Se&&!Me&&!Ge&&(Ge="s"),ue&&ue!=Ge){n<0&&(n=1,ae(),t.sticky="after");break}if(Ge&&(ue=Ge),n>0&&!ae(!Me))break}var $e=$i(e,t,T,N,!0);return Gn(T,$e)&&($e.hitSide=!0),$e}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}Le(i,"paste",function(K){if(!T(K)||Ie(r,K)||Ss(K,r))return;U<=11&&setTimeout(jt(r,function(){return t.updateFromDOM()}),20)}),Le(i,"compositionstart",function(K){t.composing={data:K.data,done:!1}}),Le(i,"compositionupdate",function(K){t.composing||(t.composing={data:K.data,done:!1})}),Le(i,"compositionend",function(K){t.composing&&(K.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Le(i,"touchstart",function(){return n.forceCompositionEnd()}),Le(i,"input",function(){t.composing||t.readFromDOMSoon()});function N(K){if(!T(K)||Ie(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 Se=document.activeElement;W(ue),setTimeout(function(){r.display.lineSpace.removeChild(ae),Se.focus(),Se==i&&n.showPrimarySelection()},50)}Le(i,"copy",N),Le(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 Se=e.rangeCount&&e.getRangeAt(0),Ee;try{Ee=p(V.node,V.offset,$.offset,$.node)}catch(Me){}Ee&&(!L&&t.state.focused?(e.collapse(V.node,V.offset),Ee.collapsed||(e.removeAllRanges(),e.addRange(Ee))):(e.removeAllRanges(),e.addRange(Ee)),Se&&e.anchorNode==null?e.addRange(Se):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){l(this.cm.display.cursorDiv,e.cursors),l(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&&b&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=ra(t,e.anchorNode,e.anchorOffset),r=ra(t,e.focusNode,e.focusOffset);n&&r&&or(t,function(){Xt(t.doc,zr(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=We(r.line-1,nt(e.doc,r.line-1).length)),i.ch==nt(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=We(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,$)),Se=Pr(e.doc,We(N,0),We($,nt(e.doc,$).text.length));ue.length>1&&Se.length>1;)if(J(ue)==J(Se))ue.pop(),Se.pop(),$--;else if(ue[0]==Se[0])ue.shift(),Se.shift(),N++;else break;for(var Ee=0,Me=0,Fe=ue[0],Ge=Se[0],$e=Math.min(Fe.length,Ge.length);Ee<$e&&Fe.charCodeAt(Ee)==Ge.charCodeAt(Ee);)++Ee;for(var tt=J(ue),Je=J(Se),rt=Math.min(tt.length-(ue.length==1?Ee:0),Je.length-(Se.length==1?Ee:0));Me<rt&&tt.charCodeAt(tt.length-Me-1)==Je.charCodeAt(Je.length-Me-1);)++Me;if(ue.length==1&&Se.length==1&&N==r.line)for(;Ee&&Ee>r.ch&&tt.charCodeAt(tt.length-Me-1)==Je.charCodeAt(Je.length-Me-1);)Ee--,Me++;ue[ue.length-1]=tt.slice(0,tt.length-Me).replace(/^\u200b+/,""),ue[0]=ue[0].slice(Ee).replace(/\u200b+$/,"");var ut=We(N,Ee),at=We($,Se.length?J(Se).length-Me: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,Ga)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Ct.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Ct.prototype.onContextMenu=function(){},Ct.prototype.resetPosition=function(){},Ct.prototype.needsContentAttribute=!0;function 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=Ne(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(Me){return Me.id==Ee}}function ae(){N&&(T+=K,V&&(T+=K),N=V=!1)}function ue(Ee){Ee&&(ae(),T+=Ee)}function Se(Ee){if(Ee.nodeType==1){var Me=Ee.getAttribute("cm-text");if(Me){ue(Me);return}var Fe=Ee.getAttribute("cm-marker"),Ge;if(Fe){var $e=e.findMarks(We(r,0),We(i+1,0),$(+Fe));$e.length&&(Ge=$e[0].find(0))&&ue(Pr(e.doc,Ge.from,Ge.to).join(K));return}if(Ee.getAttribute("contenteditable")=="false")return;var tt=/^(pre|div|p|li|table|br)$/i.test(Ee.nodeName);if(!/^br$/i.test(Ee.nodeName)&&Ee.textContent.length==0)return;tt&&ae();for(var Je=0;Je<Ee.childNodes.length;Je++)Se(Ee.childNodes[Je]);/^(pre|p)$/i.test(Ee.nodeName)&&(V=!0),tt&&(N=!0)}else Ee.nodeType==3&&ue(Ee.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Se(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(We(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(We(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(We(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(Ge,$e,tt){for(var Je=-1;Je<($?$.length:0);Je++)for(var rt=Je<0?V.map:$[Je],ut=0;ut<rt.length;ut+=3){var at=rt[ut+2];if(at==Ge||at==$e){var pt=Tt(Je<0?e.line:e.rest[Je]),Lt=rt[ut]+tt;return(tt<0||at!=Ge)&&(Lt=rt[ut+(tt?1:0)]),We(pt,Lt)}}}var ue=ae(N,K,n);if(ue)return Bn(ue,i);for(var Se=K.nextSibling,Ee=N?N.nodeValue.length-n:0;Se;Se=Se.nextSibling){if(ue=ae(Se,Se.firstChild,0),ue)return Bn(We(ue.line,ue.ch-Ee),i);Ee+=Se.textContent.length}for(var Me=K.previousSibling,Fe=n;Me;Me=Me.previousSibling){if(ue=ae(Me,Me.firstChild,-1),ue)return Bn(We(ue.line,ue.ch+Fe),i);Fe+=Me.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),y&&(i.style.width="0px"),Le(i,"input",function(){B&&U>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Le(i,"paste",function(N){if(Ie(r,N)||Ss(N,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function T(N){if(Ie(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)}Le(i,"cut",T),Le(i,"copy",T),Le(e.scroller,"paste",function(N){if(Nr(e,N)||Ie(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)}),Le(e.lineSpace,"selectstart",function(N){Nr(e,N)||X(N)}),Le(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"})}}),Le(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;l(n.cursorDiv,e.cursors),l(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(){Ga(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,zr(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 Se(){if(i.selectionStart!=null){var Fe=n.somethingSelected(),Ge="\u200B"+(Fe?i.value:"");i.value="\u21DA",i.value=Ge,t.prevInput=Fe?"":"\u200B",i.selectionStart=1,i.selectionEnd=Ge.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)&&Se();var Fe=0,Ge=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?jt(n,Xo)(n):Fe++<10?r.detectingSelectAll=setTimeout(Ge,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Ge,200)}}if(B&&U>=9&&Se(),C){se(e);var Me=function(){Ve(window,"mouseup",Me),setTimeout(Ee,20)};Le(window,"mouseup",Me)}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?R(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&&(Le(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&&(Ve(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=Ve,e.on=Le,e.wheelEventPixels=cl,e.Doc=rr,e.splitLines=dt,e.countColumn=H,e.findColumn=pe,e.isWordChar=ve,e.Pass=Te,e.signal=Pe,e.Line=rn,e.changeEnd=Vr,e.scrollbarModel=So,e.Pos=We,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,ze,Z){"use strict";Z.r(ze),Z.d(ze,"ResizableTextArea",function(){return ee});var re=Z("wx14"),z=Z("1OyB"),L=Z("vuIU"),G=Z("Ji7U"),I=Z("LK+K"),P=Z("cDcd"),B=Z("VTBJ"),U=Z("rePB"),k=Z("Zm9Q"),A=Z("Kwbf"),b=Z("c+Xe"),S=Z("m+aA"),O=Z("bdgK"),_=new Map;function x(ye){ye.forEach(function(he){var le,pe=he.target;(le=_.get(pe))===null||le===void 0||le.forEach(function(ie){return ie(pe)})})}var y=new O.default(x),d=null,o=null;function u(ye,he){_.has(ye)||(_.set(ye,new Set),y.observe(ye)),_.get(ye).add(he)}function s(ye,he){_.has(ye)&&(_.get(ye).delete(he),_.get(ye).size||(y.unobserve(ye),_.delete(ye)))}var w=function(ye){Object(G.a)(le,ye);var he=Object(I.a)(le);function le(){return Object(z.a)(this,le),he.apply(this,arguments)}return Object(L.a)(le,[{key:"render",value:function(){return this.props.children}}]),le}(P.Component),g=P.createContext(null);function f(ye){var he=ye.children,le=ye.onBatchResize,pe=P.useRef(0),ie=P.useRef([]),me=P.useContext(g),J=P.useCallback(function(ne,q,xe){pe.current+=1;var _e=pe.current;ie.current.push({size:ne,element:q,data:xe}),Promise.resolve().then(function(){_e===pe.current&&(le==null||le(ie.current),ie.current=[])}),me==null||me(ne,q,xe)},[le,me]);return P.createElement(g.Provider,{value:J},he)}function C(ye){var he=ye.children,le=ye.disabled,pe=P.useRef(null),ie=P.useRef(null),me=P.useContext(g),J=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ne=P.isValidElement(he)&&Object(b.c)(he),q=ne?he.ref:null,xe=P.useMemo(function(){return Object(b.a)(q,pe)},[q,pe]),_e=P.useRef(ye);_e.current=ye;var be=P.useCallback(function(ve){var we=_e.current,Oe=we.onResize,ke=we.data,Ce=ve.getBoundingClientRect(),Re=Ce.width,je=Ce.height,He=ve.offsetWidth,Be=ve.offsetHeight,Ne=Math.floor(Re),qe=Math.floor(je);if(J.current.width!==Ne||J.current.height!==qe||J.current.offsetWidth!==He||J.current.offsetHeight!==Be){var Xe={width:Ne,height:qe,offsetWidth:He,offsetHeight:Be};J.current=Xe;var Ze=He===Math.round(Re)?Re:He,Le=Be===Math.round(je)?je:Be,et=Object(B.a)(Object(B.a)({},Xe),{},{offsetWidth:Ze,offsetHeight:Le});me==null||me(et,ve,ke),Oe&&Promise.resolve().then(function(){Oe(et,ve)})}},[]);return P.useEffect(function(){var ve=Object(S.a)(pe.current)||Object(S.a)(ie.current);return ve&&!le&&u(ve,be),function(){return s(ve,be)}},[pe.current,le]),P.createElement(w,{ref:ie},ne?P.cloneElement(he,{ref:xe}):he)}var m="rc-observer-key";function h(ye){var he=ye.children,le=Object(k.a)(he);return le.map(function(pe,ie){var me=(pe==null?void 0:pe.key)||"".concat(m,"-").concat(ie);return P.createElement(C,Object(re.a)({},ye,{key:me}),pe)})}h.Collection=f;var c=h,l=Z("bT9E"),a=Z("TSYQ"),v=Z.n(a),p=`
|
|
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 pe=window.getComputedStyle(ye),ie=pe.getPropertyValue("box-sizing")||pe.getPropertyValue("-moz-box-sizing")||pe.getPropertyValue("-webkit-box-sizing"),me=parseFloat(pe.getPropertyValue("padding-bottom"))+parseFloat(pe.getPropertyValue("padding-top")),J=parseFloat(pe.getPropertyValue("border-bottom-width"))+parseFloat(pe.getPropertyValue("border-top-width")),ne=E.map(function(xe){return"".concat(xe,":").concat(pe.getPropertyValue(xe))}).join(";"),q={sizingStyle:ne,paddingSize:me,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,pe=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),me=ie.paddingSize,J=ie.borderSize,ne=ie.boxSizing,q=ie.sizingStyle;F.setAttribute("style","".concat(q,";").concat(p)),F.value=ye.value||ye.placeholder||"";var xe=Number.MIN_SAFE_INTEGER,_e=Number.MAX_SAFE_INTEGER,be=F.scrollHeight,ve;if(ne==="border-box"?be+=J:ne==="content-box"&&(be-=me),le!==null||pe!==null){F.value=" ";var we=F.scrollHeight-me;le!==null&&(xe=we*le,ne==="border-box"&&(xe=xe+me+J),be=Math.max(xe,be)),pe!==null&&(_e=we*pe,ne==="border-box"&&(_e=_e+me+J),ve=be>_e?"":"hidden",be=Math.min(_e,be))}return{height:be,minHeight:xe,maxHeight:_e,overflowY:ve,resize:"none"}}var D=Z("Gytx"),R=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(G.a)(le,ye);var he=Object(I.a)(le);function le(pe){var ie;return Object(z.a)(this,le),ie=he.call(this,pe),ie.nextFrameActionId=void 0,ie.resizeFrameId=void 0,ie.textArea=void 0,ie.saveTextArea=function(me){ie.textArea=me},ie.handleResize=function(me){var J=ie.state.resizeStatus,ne=ie.props,q=ne.autoSize,xe=ne.onResize;if(J!==H.NONE)return;typeof xe=="function"&&xe(me),q&&ie.resizeOnNextFrame()},ie.resizeOnNextFrame=function(){cancelAnimationFrame(ie.nextFrameActionId),ie.nextFrameActionId=requestAnimationFrame(ie.resizeTextarea)},ie.resizeTextarea=function(){var me=ie.props.autoSize;if(!me||!ie.textArea)return;var J=me.minRows,ne=me.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 me=ie.props,J=me.prefixCls,ne=J===void 0?"rc-textarea":J,q=me.autoSize,xe=me.onResize,_e=me.className,be=me.disabled,ve=ie.state,we=ve.textareaStyles,Oe=ve.resizeStatus,ke=Object(l.a)(ie.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ce=v()(ne,_e,Object(U.a)({},"".concat(ne,"-disabled"),be));"value"in ke&&(ke.value=ke.value||"");var Re=Object(B.a)(Object(B.a)(Object(B.a)({},ie.props.style),we),Oe===H.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(c,{onResize:ie.handleResize,disabled:!(q||xe)},P.createElement("textarea",Object(re.a)({},ke,{className:Ce,style:Re,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||!R()(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,me=this.textArea.selectionEnd;this.textArea.setSelectionRange(ie,me)}}catch(J){}}},{key:"render",value:function(){return this.renderTextArea()}}]),le}(P.Component),ee=Y,oe=function(ye){Object(G.a)(le,ye);var he=Object(I.a)(le);function le(pe){var ie;Object(z.a)(this,le),ie=he.call(this,pe),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 me=typeof pe.value=="undefined"||pe.value===null?pe.defaultValue:pe.value;return ie.state={value:me},ie}return Object(L.a)(le,[{key:"setValue",value:function(ie,me){"value"in this.props||this.setState({value:ie},me)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.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}(P.Component),Te=ze.default=oe},ZW9T:function(ot,ze,Z){"use strict";Z.d(ze,"a",function(){return g});var re=Z("k1fw"),z=Z("miYZ"),L=Z("tsqr"),G=Z("rAM+"),I=Z("tJVT"),P=Z("PpiC"),B=Z("cDcd"),U=Z.n(B),k=Z("bdgK");function A(f,C,m,h,c){var l=C.getWordUntilPosition(m),a={startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:l.startColumn,endColumn:l.endColumn},v=h.map(function(p){return{label:p,kind:f.languages.CompletionItemKind.Keyword,insertText:p,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:a}});return c.map(function(p){v.push(Object(re.a)(Object(re.a)({},p),{},{range:a}))}),v}var b=function(f){var C={label:"ifelse",kind:f.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},m=["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,v){var p=A(f,a,v,m,[C]);return{suggestions:p}}});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,v){var p=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],E=A(f,a,v,h,p);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,v){var p=[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,v,c,p);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 y(){}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 m=0;m<f.length;m++){var h=o[f[m]];if(h)return h}return C[0]}return o[C]||C}var s=null,w=ze.b=function(f){var C=f.width,m=C===void 0?"100%":C,h=f.height,c=h===void 0?"100%":h,l=f.value,a=f.language,v=a===void 0?"javascript":a,p=f.style,E=p===void 0?{}:p,M=f.options,F=M===void 0?{}:M,j=f.overrideServices,W=j===void 0?{}:j,D=f.theme,R=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?y:he,pe=f.editorDidMount,ie=pe===void 0?y:pe,me=f.onFocus,J=me===void 0?y:me,ne=f.filename,q=ne===void 0?"educoder.txt":ne,xe=f.errorLine,_e=f.errorContent,be=_e===void 0?"":_e,ve=Object(P.a)(f,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),we=Object(B.useRef)(),Oe=Object(B.useRef)({}),ke=Object(B.useRef)(),Ce=Object(B.useRef)(!1),Re=Object(B.useRef)(),je=Object(B.useState)(!1),He=Object(I.a)(je,2),Be=He[0],Ne=He[1];function qe(){var De;return we.current&&(De=new k.default(function(Ue){var Qe=Object(G.a)(Ue),Ye;try{for(Qe.s();!(Ye=Qe.n()).done;){var mt=Ye.value;(mt.target.offsetHeight>0||mt.target.offsetWidth>0)&&Oe.current.instance.layout()}}catch(dt){Qe.e(dt)}finally{Qe.f()}}),De.observe(we.current)),De}function Xe(){L.b.warn(decodeURIComponent(S))}var Ze=function(){var Ue=Oe.current.instance;if(l!=null&&Ue&&Be){var Qe=Ue.getModel();Qe&&l!==Qe.getValue()&&(d=!0,Qe.setValue(l),Ue.layout(),d=!1)}};Object(B.useEffect)(function(){ke.current&&clearTimeout(ke.current),ke.current=setTimeout(function(){Ze()},500)},[l,Be,Oe.current]),Object(B.useEffect)(function(){if(xe&&Oe.current&&Oe.current.instance){var De=Oe.current.instance;De.changeViewZones(function(Qe){var Ye=document.createElement("div");Ye.style.padding="10px 20px",Ye.style.width="calc(100% - 20px)",Ye.className="my-error-line-wrp",Ye.innerHTML=be,Qe.addZone({afterLineNumber:xe||11,heightInLines:3,domNode:Ye})});var Ue={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}};De.addOverlayWidget(Ue),De.revealPositionInCenter({lineNumber:20,column:1})}},[xe,Oe.current,Be]);function Le(){var De=Oe.current.instance;if(De){var Ue=De.getSelection(),Qe=Oe.current.pastePos||{},Ye=new s.Range(Qe.startLineNumber||Ue.endLineNumber,Qe.startColumn||Ue.endColumn,Qe.endLineNumber||Ue.endLineNumber,Qe.endColumn||Ue.endColumn);setTimeout(function(){De.executeEdits("",[{range:Ye,text:""}])},300)}}function et(De){(window.navigator.platform.match("Mac")?De.metaKey:De.ctrlKey)&&De.keyCode==83&&(De.preventDefault(),Y())}var Ve=function(){if(oe&&Oe.current.instance){var Ue=Oe.current.instance.getContentHeight();fe(Ue<c?c:Ue)}else fe(c)};function Pe(De){var Ue=document.createEvent("MouseEvents");Ue.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),De.dispatchEvent(Ue)}function Ie(De,Ue){var Qe=window.URL||window.webkitURL||window,Ye=new Blob([Ue]),mt=document.createElementNS("http://www.w3.org/1999/xhtml","a");mt.href=Qe.createObjectURL(Ye),mt.download=De,Pe(mt)}Object(B.useEffect)(function(){Ve()},[Ve]),Object(B.useEffect)(function(){we.current&&!Be&&Z.e(27).then(Z.t.bind(null,"M/lh",7)).then(function(De){try{s=De,Oe.current.instance=s.editor.create(we.current,{value:l,language:u(v),theme:R,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},W);var Ue=Oe.current.instance;if(ie(Ue,s),setTimeout(function(){Ve(),Oe.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Ie(q||"educoder.txt",Ue.getValue())}})},500),Oe.current.subscription=Ue.onDidChangeModelContent(function(Ye){Ce.current?clearTimeout(Re.current):(Ve(),le(Ue.getValue(),Ye)),Re.current=setTimeout(function(){Ce.current=!1},500)}),window.Monaco||b(s),ye&&(Ue.addCommand(s.KeyMod.CtrlCmd|s.KeyMod.Shift|s.KeyCode.KEY_V,function(){return Xe(),null}),Ue.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_C,function(){return Xe(),null})),window.Monaco=s,H&&Ue.onDidBlurEditorWidget(function(){H(Ue.getValue())}),J&&Ue.onDidFocusEditorText(function(){J(Ue.getValue())}),ye){Ue.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_V,function(){return Xe(),null}),Ue.onDidPaste(function(Ye){Oe.current.pastePos=Ye});try{window.addEventListener("paste",Le)}catch(Ye){}}var Qe=qe();return Ne(!0),function(){var Ye=Oe.current.instance;Ye.dispose();var mt=Ye.getModel();mt&&mt.dispose(),Oe.current.subscription&&Oe.current.subscription.dispose(),ye&&window.removeEventListener("paste",Le),Qe.unobserve(we.current)}}catch(Ye){}})},[]),Object(B.useEffect)(function(){var De=Oe.current.instance;if(De&&Be)return document.addEventListener("keydown",et,!1),function(){document.removeEventListener("keydown",et)}},[Y,Be]),Object(B.useEffect)(function(){var De=Oe.current.instance;if(De&&Be){var Ue=u(v);s.editor.setModelLanguage(De.getModel(),Ue),console.log("language:",v,De.getModel(),Ue)}},[v,Be]),Object(B.useEffect)(function(){var De=Oe.current.instance;De&&Be&&s.editor.setTheme(R)},[R,Be]),Object(B.useEffect)(function(){var De=Oe.current.instance;De&&Be&&(De.updateOptions(Object(re.a)({},F)),setTimeout(function(){De.getModel().updateOptions(Object(re.a)({},F))},200))},[JSON.stringify(F),Be]),Object(B.useEffect)(function(){var De=Oe.current.instance;De&&Be&&De.layout()},[m,c,Be]);var ge=Object(B.useState)(x(m)),de=Object(I.a)(ge,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],Ae=Object(re.a)(Object(re.a)({},E),{},{width:ce,height:se});return U.a.createElement("div",{className:"my-monaco-editor",ref:we,style:Ae})};function g(f){var C=f.width,m=C===void 0?"100%":C,h=f.height,c=h===void 0?"100%":h,l=f.original,a=f.modified,v=f.language,p=f.options,E=p===void 0?{}:p,M=Object(B.useRef)(),F=Object(B.useState)(null),j=Object(I.a)(F,2),W=j[0],D=j[1];function R(oe){var Te;return M.current&&(Te=new k.default(function(ye){var he=Object(G.a)(ye),le;try{for(he.s();!(le=he.n()).done;){var pe=le.value;(pe.target.offsetHeight>0||pe.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){s=oe;var Te=s.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=R(Te);return function(){Te.dispose();var he=Te.getModel();he&&he.dispose(),ye.unobserve(M.current)}})},[]),Object(B.useEffect)(function(){W&&W.setModel({original:s.editor.createModel(l,v),modified:s.editor.createModel(a,v)})},[l,a,v,W]);var H=x(m),Y=x(c),ee={width:H,height:Y};return U.a.createElement("div",{className:"my-diff-editor",ref:M,style:ee})}},ZpRC:function(ot,ze,Z){"use strict";function re(b){return typeof b=="object"&&b!=null&&b.nodeType===1}function z(b,S){return(!S||b!=="hidden")&&b!=="visible"&&b!=="clip"}function L(b,S){if(b.clientHeight<b.scrollHeight||b.clientWidth<b.scrollWidth){var O=getComputedStyle(b,null);return z(O.overflowY,S)||z(O.overflowX,S)||function(_){var x=function(y){if(!y.ownerDocument||!y.ownerDocument.defaultView)return null;try{return y.ownerDocument.defaultView.frameElement}catch(d){return null}}(_);return!!x&&(x.clientHeight<_.scrollHeight||x.clientWidth<_.scrollWidth)}(b)}return!1}function G(b,S,O,_,x,y,d,o){return y<b&&d>S||y>b&&d<S?0:y<=b&&o<=O||d>=S&&o>=O?y-b-_:d>S&&o<O||y<b&&o>O?d-S+x:0}var I=function(b,S){var O=window,_=S.scrollMode,x=S.block,y=S.inline,d=S.boundary,o=S.skipOverflowHiddenElements,u=typeof d=="function"?d:function(we){return we!==d};if(!re(b))throw new TypeError("Invalid target");for(var s=document.scrollingElement||document.documentElement,w=[],g=b;re(g)&&u(g);){if((g=g.parentElement)===s){w.push(g);break}g!=null&&g===document.body&&L(g)&&!L(document.documentElement)||g!=null&&L(g,o)&&w.push(g)}for(var f=O.visualViewport?O.visualViewport.width:innerWidth,C=O.visualViewport?O.visualViewport.height:innerHeight,m=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,c=b.getBoundingClientRect(),l=c.height,a=c.width,v=c.top,p=c.right,E=c.bottom,M=c.left,F=x==="start"||x==="nearest"?v:x==="end"?E:v+l/2,j=y==="center"?M+a/2:y==="end"?p:M,W=[],D=0;D<w.length;D++){var R=w[D],H=R.getBoundingClientRect(),Y=H.height,ee=H.width,oe=H.top,Te=H.right,ye=H.bottom,he=H.left;if(_==="if-needed"&&v>=0&&M>=0&&E<=C&&p<=f&&v>=oe&&E<=ye&&M>=he&&p<=Te)return W;var le=getComputedStyle(R),pe=parseInt(le.borderLeftWidth,10),ie=parseInt(le.borderTopWidth,10),me=parseInt(le.borderRightWidth,10),J=parseInt(le.borderBottomWidth,10),ne=0,q=0,xe="offsetWidth"in R?R.offsetWidth-R.clientWidth-pe-me:0,_e="offsetHeight"in R?R.offsetHeight-R.clientHeight-ie-J:0;if(s===R)ne=x==="start"?F:x==="end"?F-C:x==="nearest"?G(h,h+C,C,ie,J,h+F,h+F+l,l):F-C/2,q=y==="start"?j:y==="center"?j-f/2:y==="end"?j-f:G(m,m+f,f,pe,me,m+j,m+j+a,a),ne=Math.max(0,ne+h),q=Math.max(0,q+m);else{ne=x==="start"?F-oe-ie:x==="end"?F-ye+J+_e:x==="nearest"?G(oe,ye,Y,ie,J+_e,F,F+l,l):F-(oe+Y/2)+_e/2,q=y==="start"?j-he-pe:y==="center"?j-(he+ee/2)+xe/2:y==="end"?j-Te+me+xe:G(he,Te,ee,pe,me+xe,j,j+a,a);var be=R.scrollLeft,ve=R.scrollTop;F+=ve-(ne=Math.max(0,Math.min(ve+ne,R.scrollHeight-Y+_e))),j+=be-(q=Math.max(0,Math.min(be+q,R.scrollWidth-ee+xe)))}W.push({el:R,top:ne,left:q})}return W};function P(b){return b===Object(b)&&Object.keys(b).length!==0}function B(b,S){S===void 0&&(S="auto");var O="scrollBehavior"in document.body.style;b.forEach(function(_){var x=_.el,y=_.top,d=_.left;x.scroll&&O?x.scroll({top:y,left:d,behavior:S}):(x.scrollTop=y,x.scrollLeft=d)})}function U(b){return b===!1?{block:"end",inline:"nearest"}:P(b)?b:{block:"start",inline:"nearest"}}function k(b,S){var O=!b.ownerDocument.documentElement.contains(b);if(P(S)&&typeof S.behavior=="function")return S.behavior(O?[]:I(b,S));if(O)return;var _=U(S);return B(I(b,_),_.behavior)}var A=ze.a=k},Zss7:function(ot,ze,Z){var re;(function(z){var L=/^\s+/,G=/\s+$/,I=0,P=z.round,B=z.min,U=z.max,k=z.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=b(J);this._originalInput=J,this._r=q.r,this._g=q.g,this._b=q.b,this._a=q.a,this._roundA=P(100*this._a)/100,this._format=ne.format||q.format,this._gradientType=ne.gradientType,this._r<1&&(this._r=P(this._r)),this._g<1&&(this._g=P(this._g)),this._b<1&&(this._b=P(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,_e,be,ve;return ne=J.r/255,q=J.g/255,xe=J.b/255,ne<=.03928?_e=ne/12.92:_e=z.pow((ne+.055)/1.055,2.4),q<=.03928?be=q/12.92:be=z.pow((q+.055)/1.055,2.4),xe<=.03928?ve=xe/12.92:ve=z.pow((xe+.055)/1.055,2.4),.2126*_e+.7152*be+.0722*ve},setAlpha:function(J){return this._a=W(J),this._roundA=P(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=P(J.h*360),q=P(J.s*100),xe=P(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=P(J.h*360),q=P(J.s*100),xe=P(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:P(this._r),g:P(this._g),b:P(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+P(this._r)+", "+P(this._g)+", "+P(this._b)+")":"rgba("+P(this._r)+", "+P(this._g)+", "+P(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:P(D(this._r,255)*100)+"%",g:P(D(this._g,255)*100)+"%",b:P(D(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+P(D(this._r,255)*100)+"%, "+P(D(this._g,255)*100)+"%, "+P(D(this._b,255)*100)+"%)":"rgba("+P(D(this._r,255)*100)+"%, "+P(D(this._g,255)*100)+"%, "+P(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 _e=A(J);q="#"+u(_e._r,_e._g,_e._b,_e._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,_e=!ne&&xe&&(J==="hex"||J==="hex6"||J==="hex3"||J==="hex4"||J==="hex8"||J==="name");return _e?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(m,arguments)},desaturate:function(){return this._applyModification(s,arguments)},saturate:function(){return this._applyModification(w,arguments)},greyscale:function(){return this._applyModification(g,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(p,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(E,arguments)},splitcomplement:function(){return this._applyCombination(v,arguments)},triad:function(){return this._applyCombination(l,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 b(J){var ne={r:0,g:0,b:0},q=1,xe=null,_e=null,be=null,ve=!1,we=!1;return typeof J=="string"&&(J=ie(J)),typeof J=="object"&&(pe(J.r)&&pe(J.g)&&pe(J.b)?(ne=S(J.r,J.g,J.b),ve=!0,we=String(J.r).substr(-1)==="%"?"prgb":"rgb"):pe(J.h)&&pe(J.s)&&pe(J.v)?(xe=Te(J.s),_e=Te(J.v),ne=y(J.h,xe,_e),ve=!0,we="hsv"):pe(J.h)&&pe(J.s)&&pe(J.l)&&(xe=Te(J.s),be=Te(J.l),ne=_(J.h,xe,be),ve=!0,we="hsl"),J.hasOwnProperty("a")&&(q=J.a)),q=W(q),{ok:ve,format:J.format||we,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),_e=B(J,ne,q),be,ve,we=(xe+_e)/2;if(xe==_e)be=ve=0;else{var Oe=xe-_e;ve=we>.5?Oe/(2-xe-_e):Oe/(xe+_e);switch(xe){case J:be=(ne-q)/Oe+(ne<q?6:0);break;case ne:be=(q-J)/Oe+2;break;case q:be=(J-ne)/Oe+4;break}be/=6}return{h:be,s:ve,l:we}}function _(J,ne,q){var xe,_e,be;J=D(J,360),ne=D(ne,100),q=D(q,100);function ve(ke,Ce,Re){return Re<0&&(Re+=1),Re>1&&(Re-=1),Re<1/6?ke+(Ce-ke)*6*Re:Re<1/2?Ce:Re<2/3?ke+(Ce-ke)*(2/3-Re)*6:ke}if(ne===0)xe=_e=be=q;else{var we=q<.5?q*(1+ne):q+ne-q*ne,Oe=2*q-we;xe=ve(Oe,we,J+1/3),_e=ve(Oe,we,J),be=ve(Oe,we,J-1/3)}return{r:xe*255,g:_e*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),_e=B(J,ne,q),be,ve,we=xe,Oe=xe-_e;if(ve=xe===0?0:Oe/xe,xe==_e)be=0;else{switch(xe){case J:be=(ne-q)/Oe+(ne<q?6:0);break;case ne:be=(q-J)/Oe+2;break;case q:be=(J-ne)/Oe+4;break}be/=6}return{h:be,s:ve,v:we}}function y(J,ne,q){J=D(J,360)*6,ne=D(ne,100),q=D(q,100);var xe=z.floor(J),_e=J-xe,be=q*(1-ne),ve=q*(1-_e*ne),we=q*(1-(1-_e)*ne),Oe=xe%6,ke=[q,ve,be,be,we,q][Oe],Ce=[we,q,q,ve,be,be][Oe],Re=[be,be,we,q,q,ve][Oe];return{r:ke*255,g:Ce*255,b:Re*255}}function d(J,ne,q,xe){var _e=[oe(P(J).toString(16)),oe(P(ne).toString(16)),oe(P(q).toString(16))];return xe&&_e[0].charAt(0)==_e[0].charAt(1)&&_e[1].charAt(0)==_e[1].charAt(1)&&_e[2].charAt(0)==_e[2].charAt(1)?_e[0].charAt(0)+_e[1].charAt(0)+_e[2].charAt(0):_e.join("")}function o(J,ne,q,xe,_e){var be=[oe(P(J).toString(16)),oe(P(ne).toString(16)),oe(P(q).toString(16)),oe(ye(xe))];return _e&&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 _e=[oe(ye(xe)),oe(P(J).toString(16)),oe(P(ne).toString(16)),oe(P(q).toString(16))];return _e.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 s(J,ne){ne=ne===0?0:ne||10;var q=A(J).toHsl();return q.s-=ne/100,q.s=R(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=R(q.s),A(q)}function g(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=R(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-P(255*-(ne/100)))),q.g=U(0,B(255,q.g-P(255*-(ne/100)))),q.b=U(0,B(255,q.b-P(255*-(ne/100)))),A(q)}function m(J,ne){ne=ne===0?0:ne||10;var q=A(J).toHsl();return q.l-=ne/100,q.l=R(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 l(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 v(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 p(J,ne,q){ne=ne||6,q=q||30;var xe=A(J).toHsl(),_e=360/q,be=[A(J)];for(xe.h=(xe.h-(_e*ne>>1)+720)%360;--ne;)xe.h=(xe.h+_e)%360,be.push(A(xe));return be}function E(J,ne){ne=ne||6;for(var q=A(J).toHsv(),xe=q.h,_e=q.s,be=q.v,ve=[],we=1/ne;ne--;)ve.push(A({h:xe,s:_e,v:be})),be=(be+we)%1;return ve}A.mix=function(J,ne,q){q=q===0?0:q||50;var xe=A(J).toRgb(),_e=A(ne).toRgb(),be=q/100,ve={r:(_e.r-xe.r)*be+xe.r,g:(_e.g-xe.g)*be+xe.g,b:(_e.b-xe.b)*be+xe.b,a:(_e.a-xe.a)*be+xe.a};return A(ve)},A.readability=function(J,ne){var q=A(J),xe=A(ne);return(z.max(q.getLuminance(),xe.getLuminance())+.05)/(z.min(q.getLuminance(),xe.getLuminance())+.05)},A.isReadable=function(J,ne,q){var xe=A.readability(J,ne),_e,be;be=!1,_e=me(q);switch(_e.level+_e.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,_e=0,be,ve,we,Oe;q=q||{},ve=q.includeFallbackColors,we=q.level,Oe=q.size;for(var ke=0;ke<ne.length;ke++)be=A.readability(J,ne[ke]),be>_e&&(_e=be,xe=A(ne[ke]));return A.isReadable(J,xe,{level:we,size:Oe})||!ve?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),z.abs(J-ne)<1e-6?1:J%ne/parseFloat(ne)}function R(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 z.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*\\)?",_e="[\\s|\\(]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")\\s*\\)?";return{CSS_UNIT:new RegExp(q),rgb:new RegExp("rgb"+xe),rgba:new RegExp("rgba"+_e),hsl:new RegExp("hsl"+xe),hsla:new RegExp("hsla"+_e),hsv:new RegExp("hsv"+xe),hsva:new RegExp("hsva"+_e),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 pe(J){return!!le.CSS_UNIT.exec(J)}function ie(J){J=J.replace(L,"").replace(G,"").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 me(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(ze,Z,ze,ot),re!==void 0&&(ot.exports=re))})(Math)},bT9E:function(ot,ze,Z){"use strict";Z.d(ze,"a",function(){return z});var re=Z("VTBJ");function z(L,G){var I=Object(re.a)({},L);return Array.isArray(G)&&G.forEach(function(P){delete I[P]}),I}},c5Ni:function(ot,ze,Z){},dejd:function(ot,ze,Z){},dmUQ:function(ot,ze,Z){"use strict";var re=Z("Ff2n"),z=Z("rePB"),L=Z("1OyB"),G=Z("vuIU"),I=Z("Ji7U"),P=Z("md7G"),B=Z("foSv"),U=Z("cDcd"),k=Z.n(U),A=Z("TSYQ"),b=Z.n(A),S=Z("4IlW");function O(l,a){var v=Object.keys(l);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(l);a&&(p=p.filter(function(E){return Object.getOwnPropertyDescriptor(l,E).enumerable})),v.push.apply(v,p)}return v}function _(l){for(var a=1;a<arguments.length;a++){var v=arguments[a]!=null?arguments[a]:{};a%2?O(Object(v),!0).forEach(function(p){Object(z.a)(l,p,v[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(v)):O(Object(v)).forEach(function(p){Object.defineProperty(l,p,Object.getOwnPropertyDescriptor(v,p))})}return l}function x(l){var a=y();return function(){var p=Object(B.a)(l),E;if(a){var M=Object(B.a)(this).constructor;E=Reflect.construct(p,arguments,M)}else E=p.apply(this,arguments);return Object(P.a)(this,E)}}function y(){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(l){return!1}}function d(){}function o(l){l.preventDefault()}var u=function(a){return a.replace(/[^\w.-]+/g,"")},s=200,w=600,g=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,f=function(a){return a!=null},C=function(a,v){return v===a||typeof v=="number"&&typeof a=="number"&&isNaN(v)&&isNaN(a)},m=function(l){Object(I.a)(v,l);var a=x(v);function v(p){var E;Object(L.a)(this,v),E=a.call(this,p),E.onKeyDown=function(j){var W=E.props,D=W.onKeyDown,R=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&&R&&R(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,R=new Array(D>1?D-1:0),H=1;H<D;H++)R[H-1]=arguments[H];W.apply(void 0,[j].concat(R))}},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 R=E.input.value,H=E.getInputDisplayValue({focus:!1,value:D});E.input.value=H&&Number(H),j.apply(void 0,arguments),E.input.value=R}},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,R=W.inputValue,H=W.value,Y;D?Y=R: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 R=E.cursorBefore.length;return E.lastKeyCode===S.a.DELETE&&E.cursorBefore.charAt(R-1)===j[0]?(E.fixCaret(R,R),!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 R=j.substring(D);return E.restoreByAfter(R)})},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=p.value;M===void 0&&(M=p.defaultValue),E.state={focused:p.autoFocus};var F=E.getValidValue(E.toNumber(M));return E.state=_(_({},E.state),{},{inputValue:E.toPrecisionAsStep(F),value:F}),E}return Object(G.a)(v,[{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,R=this.state.focused;if(E){if(!C(E.value,F)||!C(E.max,W)||!C(E.min,D)){var H=R?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,R=this.state.inputValue,H=R===void 0?null:R,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),R=this.getPrecision(W),H=this.getPrecision(E);return E?Math.max(H,D+R):D+R}},{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 R=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(R))return;var H=this["".concat(E,"Step")](R,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?s: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,R=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,pe=M.onMouseLeave,ie=M.onMouseOver,me=M.onMouseOut,J=M.required,ne=M.onClick,q=M.tabIndex,xe=M.type,_e=M.placeholder,be=M.id,ve=M.inputMode,we=M.pattern,Oe=M.step,ke=M.maxLength,Ce=M.autoFocus,Re=M.name,je=M.onPaste,He=M.onInput,Be=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"]),Ne=this.state,qe=Ne.value,Xe=Ne.focused,Ze=b()(F,(E={},Object(z.a)(E,ee,!!ee),Object(z.a)(E,"".concat(F,"-disabled"),j),Object(z.a)(E,"".concat(F,"-focused"),Xe),E)),Le={};Object.keys(Be).forEach(function(se){(se.substr(0,5)==="data-"||se.substr(0,5)==="aria-"||se==="role")&&(Le[se]=Be[se])});var et=!W&&!j,Ve=this.getInputDisplayValue(null),Pe=(qe||qe===0)&&(isNaN(qe)||Number(qe)>=oe),Ie=(qe||qe===0)&&(isNaN(qe)||Number(qe)<=Te),ge=Pe||j||W,de=Ie||j||W,ce=b()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object(z.a)({},"".concat(F,"-handler-up-disabled"),ge)),X=b()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object(z.a)({},"".concat(F,"-handler-down-disabled"),de)),Q=D?{onTouchStart:ge?d:this.up,onTouchEnd:this.stop}:{onMouseDown:ge?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:Ze,style:ye,title:he,onMouseEnter:le,onMouseLeave:pe,onMouseOver:ie,onMouseOut:me,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":ge,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":qe,required:J,type:xe,placeholder:_e,onPaste:je,onClick:ne,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:q,autoComplete:R,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:et?this.onKeyDown:d,onKeyUp:et?this.onKeyUp:d,autoFocus:Ce,maxLength:ke,readOnly:W,disabled:j,max:oe,min:Te,step:Oe,name:Re,title:he,id:be,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ve),pattern:we,inputMode:ve,onInput:He},Le))))}}]),v}(k.a.Component);m.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:g,min:-g,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:u,required:!1,autoComplete:"off"};var h=m,c=ze.a=h},gMzb:function(ot,ze,Z){"use strict";var re=Z("k1fw"),z=Z("oBTY"),L=Z("9og8"),G=Z("tJVT"),I=Z("sRBo"),P=Z("kaz8"),B=Z("WmNS"),U=Z.n(B),k=Z("cDcd"),A=Z.n(k),b=Z("9kvl"),S=Z("wlus"),O=Z("w5pM"),_=Z("ErOA"),x=Z("OaEy"),y=Z("2fM7"),d=Z("y8nQ"),o=Z("Vl3Y"),u=Z("Ty5D"),s=Z("yQHh"),w=Z.n(s),g=P.a.Group,f=function(a){var v,p,E,M,F,j,W,D,R=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,pe=a.type,ie=a.rz,me=a.dispatch,J=Object(k.useState)([]),ne=Object(G.a)(J,2),q=ne[0],xe=ne[1],_e=Object(k.useState)({zydatas:[],jbdatas:[],kcdatas:[],zsdatas:[],page:1,per_page:20}),be=Object(G.a)(_e,2),ve=be[0],we=be[1],Oe=Object(u.i)(),ke=Object(k.useState)(!1),Ce=Object(G.a)(ke,2),Re=Ce[0],je=Ce[1],He=Object(k.useState)(!1),Be=Object(G.a)(He,2),Ne=Be[0],qe=Be[1],Xe=o.a.useForm(),Ze=Object(G.a)(Xe,1),Le=Ze[0];Object(k.useEffect)(function(){ie&&(ve.zydatas=ie,we(Object(re.a)({},ve)),le!=null&&le.ec_course_id&&et())},[le,ie]);function et(){return Ve.apply(this,arguments)}function Ve(){return Ve=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,ge(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:Le.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)})),Ve.apply(this,arguments)}function Pe(X){return Ie.apply(this,arguments)}function Ie(){return Ie=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,ve.jbdatas=te==null?void 0:te.data,we(Object(re.a)({},ve)),Le.setFieldsValue({ec_year_id:"",ec_course_id:"",ec_point_ids:[]});case 6:case"end":return fe.stop()}},X)})),Ie.apply(this,arguments)}function ge(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,ve.kcdatas=te==null?void 0:te.data,we(Object(re.a)({},ve)),Le.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(Ae){for(;;)switch(Ae.prev=Ae.next){case 0:return Ae.next=2,Object(_.a)("/api/ec_courses/".concat(te,"/ec_points.json"),{method:"get",params:{ec_course_id:te}});case 2:se=Ae.sent,ve.zsdatas=se==null?void 0:se.data,we(Object(re.a)({},ve));case 5:case"end":return Ae.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:Le,layout:"inline",onValuesChange:function(Q){console.log("----",Q),Q.ec_major_school_id&&(ve.jbdatas=[],ve.kcdatas=[],ve.zsdatas=[],we(Object(re.a)({},ve)),Pe(Q.ec_major_school_id)),Q.ec_year_id&&(ve.kcdatas=[],ve.zsdatas=[],we(Object(re.a)({},ve)),ge(Q.ec_year_id)),Q.ec_course_id&&(ve.zsdatas=[],we(Object(re.a)({},ve)),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(y.a,{style:{width:150},disabled:((v=ve.zydatas)===null||v===void 0?void 0:v.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BA4\u8BC1\u4E13\u4E1A"},ve==null||((p=ve.zydatas)===null||p===void 0)?void 0:p.map(function(X,Q){return A.a.createElement(y.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(y.a,{style:{width:150},disabled:((E=ve.jbdatas)===null||E===void 0?void 0:E.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BA4\u8BC1\u5C4A\u522B"},ve==null||((M=ve.jbdatas)===null||M===void 0)?void 0:M.map(function(X,Q){return A.a.createElement(y.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(y.a,{style:{width:150},disabled:((F=ve.kcdatas)===null||F===void 0?void 0:F.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BFE\u7A0B"},ve==null||((j=ve.kcdatas)===null||j===void 0)?void 0:j.map(function(X,Q){return A.a.createElement(y.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(y.a,{onChange:function(){Le.submit()},style:{width:150},mode:"multiple",disabled:((W=ve.zsdatas)===null||W===void 0?void 0:W.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u77E5\u8BC6\u70B9"},ve==null||((D=ve.zsdatas)===null||D===void 0)?void 0:D.map(function(X,Q){return A.a.createElement(y.a.Option,{key:Q,value:X==null?void 0:X.id},X==null?void 0:X.name)})))))},C=Object(b.a)(function(l){var a=l.classroomList,v=l.loading,p=l.globalSetting,E=l.user;return{classroomList:a,globalSetting:p,loading:v.effects,user:E}})(f),m=P.a.Group,h=function(a){var v,p,E,M=a.classroomList,F=a.loading,j=a.user,W=a.exercise_id,D=W===void 0?null:W,R=a.homework_common_id,H=R===void 0?null:R,Y=a.setitem,ee=a.type,oe=a.dispatch,Te=Object(k.useState)([{}]),ye=Object(G.a)(Te,2),he=ye[0],le=ye[1],pe=Object(k.useState)([]),ie=Object(G.a)(pe,2),me=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 ve,we,Oe,ke,Ce;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:we=je.sent,(we==null||((ve=we.data)===null||ve===void 0)?void 0:ve.length)>0&&(Ce=[],we==null||((Oe=we.data)===null||Oe===void 0)||Oe.map(function(He){var Be;He==null||((Be=He.ec_point_ids)===null||Be===void 0)||Be.map(function(Ne){Ce.push(Ne)})}),Y(Object(re.a)(Object(re.a)({},we==null||((ke=we.data)===null||ke===void 0)?void 0:ke[0]),{},{ec_point_ids:Ce})),le(we==null?void 0:we.data));case 4:case"end":return je.stop()}},be)})),q.apply(this,arguments)}Object(k.useEffect)(function(){var be,ve;j!=null&&(be=j.userInfo)!==null&&be!==void 0&&(ve=be.course)!==null&&ve!==void 0&&ve.course_school_id&&xe()},[j==null||((v=j.userInfo)===null||v===void 0||((p=v.course)===null||p===void 0))?void 0:p.course_school_id]);function xe(){return _e.apply(this,arguments)}function _e(){return _e=Object(L.a)(U.a.mark(function be(){var ve,we,Oe;return U.a.wrap(function(Ce){for(;;)switch(Ce.prev=Ce.next){case 0:return Ce.next=2,Object(_.a)("/api/schools/".concat(j==null||((ve=j.userInfo)===null||ve===void 0||((we=ve.course)===null||we===void 0))?void 0:we.course_school_id,"/ec_majors/get_major_list.json"),{method:"get"});case 2:Oe=Ce.sent,J(Oe==null?void 0:Oe.data),(H||D)&&ne();case 5:case"end":return Ce.stop()}},be)})),_e.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,ve){return A.a.createElement("div",{style:{display:"flex",alignItems:"center",marginBottom:"10px"}},A.a.createElement(C,{rz:me,item:be,type:ve,setitem:function(Oe){he.splice(ve,1,Oe),le(Object(z.a)(he));var ke=[];he==null||he.map(function(Ce){var Re;Ce==null||((Re=Ce.ec_point_ids)===null||Re===void 0)||Re.map(function(je){ke.push(je)})}),Y(Object(re.a)(Object(re.a)({},Oe),{},{ec_point_ids:ke}))}}),ve!=0&&A.a.createElement(S.a,{onClick:function(){he.splice(ve,1),le(Object(z.a)(he))},style:{marginLeft:10,fontSize:"20px"}}),A.a.createElement(O.a,{onClick:function(){he.push({}),le(Object(z.a)(he))},style:{marginLeft:10,fontSize:"20px"}}))}))},c=ze.a=Object(b.a)(function(l){var a=l.classroomList,v=l.loading,p=l.globalSetting,E=l.user;return{classroomList:a,globalSetting:p,loading:v.effects,user:E}})(h)},h78n:function(ot,ze,Z){"use strict";Z.d(ze,"a",function(){return E});var re=Z("cDcd"),z=Z.n(re),L=Z("TSYQ"),G=Z.n(L),I={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},P=function(j){var W=j.map(function(){return Object(re.useRef)()}),D=Object(re.useRef)();return Object(re.useEffect)(function(){var R=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&&R-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 b(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 b(F,j)}function b(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,R=!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){R=!0,H=oe}finally{try{!D&&Y.return!=null&&Y.return()}finally{if(R)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,R;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(F);for(R=0;R<H.length;R++){if(D=H[R],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),R,H;for(H=0;H<D.length;H++){if(R=D[H],j.indexOf(R)>=0)continue;W[R]=F[R]}return W}var y=function(j){var W=j.className,D=j.percent,R=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 pe=Array.isArray(D)?D:[D],ie=Array.isArray(H)?H:[H],me=P(pe),J=U(me,1),ne=J[0],q=ee/2,xe=100-ee/2,_e="M ".concat(Y==="round"?q:0,",").concat(q,`
|
|
L `).concat(Y==="round"?xe:100,",").concat(q),be="0 0 100 ".concat(ee),ve=0;return z.a.createElement("svg",B({className:G()("".concat(R,"-line"),W),viewBox:be,preserveAspectRatio:"none",style:oe},le),z.a.createElement("path",{className:"".concat(R,"-line-trail"),d:_e,strokeLinecap:Y,stroke:Te,strokeWidth:ye||ee,fillOpacity:"0"}),pe.map(function(we,Oe){var ke={strokeDasharray:"".concat(we,"px, 100px"),strokeDashoffset:"-".concat(ve,"px"),transition:he||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Ce=ie[Oe]||ie[ie.length-1];return ve+=we,z.a.createElement("path",{key:Oe,className:"".concat(R,"-line-path"),d:_e,strokeLinecap:Y,stroke:Ce,strokeWidth:ee,fillOpacity:"0",ref:ne[Oe],style:ke})}))};y.defaultProps=I;var d=y;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)||s()}function s(){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 g(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 g(F,j)}function g(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,R=!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){R=!0,H=oe}finally{try{!D&&Y.return!=null&&Y.return()}finally{if(R)throw H}}return W}function C(F){if(Array.isArray(F))return F}function m(F,j){if(F==null)return{};var W=h(F,j),D,R;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(F);for(R=0;R<H.length;R++){if(D=H[R],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),R,H;for(H=0;H<D.length;H++){if(R=D[H],j.indexOf(R)>=0)continue;W[R]=F[R]}return W}var c=0;function l(F){return+F.replace("%","")}function a(F){return Array.isArray(F)?F:[F]}function v(F,j,W,D){var R=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,pe={stroke:W,strokeDasharray:"".concat(j/100*(le-R),"px ").concat(le,"px"),strokeDashoffset:"-".concat(R/2+F/100*(le-R),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:he,pathStyle:pe}}var p=function(j){var W=j.prefixCls,D=j.strokeWidth,R=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,pe=m(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ie=Object(re.useMemo)(function(){return c+=1,c},[]),me=v(0,100,ee,D,H,Y),J=me.pathString,ne=me.pathStyle,q=a(le),xe=a(he),_e=xe.find(function(ke){return Object.prototype.toString.call(ke)==="[object Object]"}),be=P(q),ve=u(be,1),we=ve[0],Oe=function(){var Ce=0;return q.map(function(Re,je){var He=xe[je]||xe[xe.length-1],Be=Object.prototype.toString.call(He)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ie,")"):"",Ne=v(Ce,Re,He,D,H,Y);return Ce+=Re,z.a.createElement("path",{key:je,className:"".concat(W,"-circle-path"),d:Ne.pathString,stroke:Be,strokeLinecap:oe,strokeWidth:D,opacity:Re===0?0:1,fillOpacity:"0",style:Ne.pathStyle,ref:we[je]})})};return z.a.createElement("svg",o({className:G()("".concat(W,"-circle"),ye),viewBox:"0 0 100 100",style:Te},pe),_e&&z.a.createElement("defs",null,z.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(ie),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(_e).sort(function(ke,Ce){return l(ke)-l(Ce)}).map(function(ke,Ce){return z.a.createElement("stop",{key:Ce,offset:ke,stopColor:_e[ke]})}))),z.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:J,stroke:ee,strokeLinecap:oe,strokeWidth:R||D,fillOpacity:"0",style:ne}),Oe().reverse())};p.defaultProps=I;var E=p,M={Line:d,Circle:E}},kSUc:function(ot,ze,Z){},lLeG:function(ot,ze,Z){ot.exports={bg:"bg___f0e4_",flexRow:"flexRow___1-S6r",flexJustifyCenter:"flexJustifyCenter___3KkrV",flexAlignEnd:"flexAlignEnd___146T7",flexAlignCenter:"flexAlignCenter___2UVve",flexColumn:"flexColumn___nj9sg",formWrap:"formWrap___2eqbH",titleWrap:"titleWrap___1gkN2",fieldWrap:"fieldWrap___2l5q8",mdWrap:"mdWrap___38Ffu",backgroundFa:"backgroundFa___2gBUv",button:"button___3jgMh"}},lZu9:function(ot,ze,Z){(function(re){re(Z("VrN/"),Z("1eCo"),Z("8EBN"))})(function(re){"use strict";re.defineMode("markdown",function(z,L){var G=re.getMode(z,"text/html"),I=G.name=="null";function P(D){if(re.findModeByName){var R=re.findModeByName(D);R&&(D=R.mime||R.mimes[0])}var H=re.getMode(z,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+/,b=/^\[(x| )\](?=\s)/i,S=L.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,O=/^ {0,3}(?:\={1,}|-{2,})\s*$/,_=/^[^#!\[\]*_\\<>` "'(~:]+/,x=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,y=/^\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,R,H){return R.f=R.inline=H,H(D,R)}function s(D,R,H){return R.f=R.block=H,H(D,R)}function w(D){return!D||!/\S/.test(D.string)}function g(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 R=I;if(!R){var H=re.innerMode(G,D.htmlState);R=H.mode.name=="xml"&&H.state.tagStart===null&&!H.state.context&&H.state.tokenize.isInText}R&&(D.f=l,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,R){var H=D.column()===R.indentation,Y=w(R.prevLine.stream),ee=R.indentedCode,oe=R.prevLine.hr,Te=R.list!==!1,ye=(R.listStack[R.listStack.length-1]||0)+3;R.indentedCode=!1;var he=R.indentation;if(R.indentationDiff===null&&(R.indentationDiff=R.indentation,Te)){for(R.list=null;he<R.listStack[R.listStack.length-1];)R.listStack.pop(),R.listStack.length?R.indentation=R.listStack[R.listStack.length-1]:R.list=!1;R.list!==!1&&(R.indentationDiff=he-R.listStack[R.listStack.length-1])}var le=!Y&&!oe&&!R.prevLine.header&&(!Te||!ee)&&!R.prevLine.fencedCodeEnd,pe=(R.list===!1||oe||Y)&&R.indentation<=ye&&D.match(k),ie=null;if(R.indentationDiff>=4&&(ee||R.prevLine.fencedCodeEnd||R.prevLine.header||Y))return D.skipToEnd(),R.indentedCode=!0,B.code;if(D.eatSpace())return null;if(H&&R.indentation<=ye&&(ie=D.match(S))&&ie[1].length<=6)return R.quote=0,R.header=ie[1].length,R.thisLine.header=!0,L.highlightFormatting&&(R.formatting="header"),R.f=R.inline,h(R);if(R.indentation<=ye&&D.eat(">"))return R.quote=H?1:R.quote+1,L.highlightFormatting&&(R.formatting="quote"),D.eatSpace(),h(R);if(!pe&&!R.setext&&H&&R.indentation<=ye&&(ie=D.match(A))){var me=ie[1]?"ol":"ul";return R.indentation=he+D.current().length,R.list=!0,R.quote=0,R.listStack.push(R.indentation),R.em=!1,R.strong=!1,R.code=!1,R.strikethrough=!1,L.taskLists&&D.match(b,!1)&&(R.taskList=!0),R.f=R.inline,L.highlightFormatting&&(R.formatting=["list","list-"+me]),h(R)}else{if(H&&R.indentation<=ye&&(ie=D.match(x,!0)))return R.quote=0,R.fencedEndRE=new RegExp(ie[1]+"+ *$"),R.localMode=L.fencedCodeBlockHighlighting&&P(ie[2]||L.fencedCodeBlockDefaultMode),R.localMode&&(R.localState=re.startState(R.localMode)),R.f=R.block=m,L.highlightFormatting&&(R.formatting="code-block"),R.code=-1,h(R);if(R.setext||(!le||!Te)&&!R.quote&&R.list===!1&&!R.code&&!pe&&!y.test(D.string)&&(ie=D.lookAhead(1))&&(ie=ie.match(O)))return R.setext?(R.header=R.setext,R.setext=0,D.skipToEnd(),L.highlightFormatting&&(R.formatting="header")):(R.header=ie[0].charAt(0)=="="?1:2,R.setext=R.header),R.thisLine.header=!0,R.f=R.inline,h(R);if(pe)return D.skipToEnd(),R.hr=!0,R.thisLine.hr=!0,B.hr;if(D.peek()==="[")return u(D,R,M)}return u(D,R,R.inline)}function C(D,R){var H=G.token(D,R.htmlState);if(!I){var Y=re.innerMode(G,R.htmlState);(Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText||R.md_inside&&D.current().indexOf(">")>-1)&&(R.f=l,R.block=f,R.htmlState=null)}return H}function m(D,R){var H=R.listStack[R.listStack.length-1]||0,Y=R.indentation<H,ee=H+3;if(R.fencedEndRE&&R.indentation<=ee&&(Y||D.match(R.fencedEndRE))){L.highlightFormatting&&(R.formatting="code-block");var oe;return Y||(oe=h(R)),R.localMode=R.localState=null,R.block=f,R.f=l,R.fencedEndRE=null,R.code=0,R.thisLine.fencedCodeEnd=!0,Y?s(D,R,R.block):oe}else return R.localMode?R.localMode.token(D,R.localState):(D.skipToEnd(),B.code)}function h(D){var R=[];if(D.formatting){R.push(B.formatting),typeof D.formatting=="string"&&(D.formatting=[D.formatting]);for(var H=0;H<D.formatting.length;H++)R.push(B.formatting+"-"+D.formatting[H]),D.formatting[H]==="header"&&R.push(B.formatting+"-"+D.formatting[H]+"-"+D.header),D.formatting[H]==="quote"&&(!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=D.quote?R.push(B.formatting+"-"+D.formatting[H]+"-"+D.quote):R.push("error"))}if(D.taskOpen)return R.push("meta"),R.length?R.join(" "):null;if(D.taskClosed)return R.push("property"),R.length?R.join(" "):null;if(D.linkHref?R.push(B.linkHref,"url"):(D.strong&&R.push(B.strong),D.em&&R.push(B.em),D.strikethrough&&R.push(B.strikethrough),D.emoji&&R.push(B.emoji),D.linkText&&R.push(B.linkText),D.code&&R.push(B.code),D.image&&R.push(B.image),D.imageAltText&&R.push(B.imageAltText,"link"),D.imageMarker&&R.push(B.imageMarker)),D.header&&R.push(B.header,B.header+"-"+D.header),D.quote&&(R.push(B.quote),!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=D.quote?R.push(B.quote+"-"+D.quote):R.push(B.quote+"-"+L.maxBlockquoteDepth)),D.list!==!1){var Y=(D.listStack.length-1)%3;Y?Y===1?R.push(B.list2):R.push(B.list3):R.push(B.list1)}return D.trailingSpaceNewLine?R.push("trailing-space-new-line"):D.trailingSpace&&R.push("trailing-space-"+(D.trailingSpace%2?"a":"b")),R.length?R.join(" "):null}function c(D,R){return D.match(_,!0)?h(R):void 0}function l(D,R){var H=R.text(D,R);if(typeof H!="undefined")return H;if(R.list)return R.list=null,h(R);if(R.taskList){var Y=D.match(b,!0)[1]===" ";return Y?R.taskOpen=!0:R.taskClosed=!0,L.highlightFormatting&&(R.formatting="task"),R.taskList=!1,h(R)}if(R.taskOpen=!1,R.taskClosed=!1,R.header&&D.match(/^#+$/,!0))return L.highlightFormatting&&(R.formatting="header"),h(R);var ee=D.next();if(R.linkTitle){R.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=R.formatting;L.highlightFormatting&&(R.formatting="code"),D.eatWhile("`");var he=D.current().length;if(R.code==0&&(!R.quote||he==1))return R.code=he,h(R);if(he==R.code){var le=h(R);return R.code=0,le}else return R.formatting=ye,h(R)}else if(R.code)return h(R);if(ee==="\\"&&(D.next(),L.highlightFormatting)){var pe=h(R),ie=B.formatting+"-escape";return pe?pe+" "+ie:ie}if(ee==="!"&&D.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return R.imageMarker=!0,R.image=!0,L.highlightFormatting&&(R.formatting="image"),h(R);if(ee==="["&&R.imageMarker&&D.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return R.imageMarker=!1,R.imageAltText=!0,L.highlightFormatting&&(R.formatting="image"),h(R);if(ee==="]"&&R.imageAltText){L.highlightFormatting&&(R.formatting="image");var pe=h(R);return R.imageAltText=!1,R.image=!1,R.inline=R.f=v,pe}if(ee==="["&&!R.image)return R.linkText&&D.match(/^.*?\]/)||(R.linkText=!0,L.highlightFormatting&&(R.formatting="link")),h(R);if(ee==="]"&&R.linkText){L.highlightFormatting&&(R.formatting="link");var pe=h(R);return R.linkText=!1,R.inline=R.f=D.match(/\(.*?\)| ?\[.*?\]/,!1)?v:l,pe}if(ee==="<"&&D.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){R.f=R.inline=a,L.highlightFormatting&&(R.formatting="link");var pe=h(R);return pe?pe+=" ":pe="",pe+B.linkInline}if(ee==="<"&&D.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){R.f=R.inline=a,L.highlightFormatting&&(R.formatting="link");var pe=h(R);return pe?pe+=" ":pe="",pe+B.linkEmail}if(L.xml&&ee==="<"&&D.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var me=D.string.indexOf(">",D.pos);if(me!=-1){var J=D.string.substring(D.start,me);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(J)&&(R.md_inside=!0)}return D.backUp(1),R.htmlState=re.startState(G),s(D,R,C)}if(L.xml&&ee==="<"&&D.match(/^\/\w*?>/))return R.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()||" ",_e=!/\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)),ve=null,we=null;if(ne%2&&(!R.em&&_e&&(ee==="*"||!be||d.test(q))?ve=!0:R.em==ee&&be&&(ee==="*"||!_e||d.test(xe))&&(ve=!1)),ne>1&&(!R.strong&&_e&&(ee==="*"||!be||d.test(q))?we=!0:R.strong==ee&&be&&(ee==="*"||!_e||d.test(xe))&&(we=!1)),we!=null||ve!=null){L.highlightFormatting&&(R.formatting=ve==null?"strong":we==null?"em":"strong em"),ve===!0&&(R.em=ee),we===!0&&(R.strong=ee);var le=h(R);return ve===!1&&(R.em=!1),we===!1&&(R.strong=!1),le}}else if(ee===" "&&(D.eat("*")||D.eat("_"))){if(D.peek()===" ")return h(R);D.backUp(1)}if(L.strikethrough){if(ee==="~"&&D.eatWhile(ee)){if(R.strikethrough){L.highlightFormatting&&(R.formatting="strikethrough");var le=h(R);return R.strikethrough=!1,le}else if(D.match(/^[^\s]/,!1))return R.strikethrough=!0,L.highlightFormatting&&(R.formatting="strikethrough"),h(R)}else if(ee===" "&&D.match(/^~~/,!0)){if(D.peek()===" ")return h(R);D.backUp(2)}}if(L.emoji&&ee===":"&&D.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){R.emoji=!0,L.highlightFormatting&&(R.formatting="emoji");var Oe=h(R);return R.emoji=!1,Oe}return ee===" "&&(D.match(/^ +$/,!1)?R.trailingSpace++:R.trailingSpace&&(R.trailingSpaceNewLine=!0)),h(R)}function a(D,R){var H=D.next();if(H===">"){R.f=R.inline=l,L.highlightFormatting&&(R.formatting="link");var Y=h(R);return Y?Y+=" ":Y="",Y+B.linkInline}return D.match(/^[^>]+/,!0),B.linkInline}function v(D,R){if(D.eatSpace())return null;var H=D.next();return H==="("||H==="["?(R.f=R.inline=E(H==="("?")":"]"),L.highlightFormatting&&(R.formatting="link-string"),R.linkHref=!0,h(R)):"error"}var p={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function E(D){return function(R,H){var Y=R.next();if(Y===D){H.f=H.inline=l,L.highlightFormatting&&(H.formatting="link-string");var ee=h(H);return H.linkHref=!1,ee}return R.match(p[D]),H.linkHref=!0,h(H)}}function M(D,R){return D.match(/^([^\]\\]|\\.)*\]:/,!1)?(R.f=F,D.next(),L.highlightFormatting&&(R.formatting="link"),R.linkText=!0,h(R)):u(D,R,l)}function F(D,R){if(D.match(/^\]:/,!0)){R.f=R.inline=j,L.highlightFormatting&&(R.formatting="link");var H=h(R);return R.linkText=!1,H}return D.match(/^([^\]\\]|\\.)+/,!0),B.linkText}function j(D,R){return D.eatSpace()?null:(D.match(/^[^\s]+/,!0),D.peek()===void 0?R.linkTitle=!0:D.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),R.f=R.inline=l,B.linkHref+" url")}var W={startState:function(){return{f,prevLine:{stream:null},thisLine:{stream:null},block:f,htmlState:null,indentation:0,inline:l,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(G,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,R){if(R.formatting=!1,D!=R.thisLine.stream){if(R.header=0,R.hr=!1,D.match(/^\s*$/,!0))return g(R),null;if(R.prevLine=R.thisLine,R.thisLine={stream:D},R.taskList=!1,R.trailingSpace=0,R.trailingSpaceNewLine=!1,!R.localState&&(R.f=R.block,R.f!=C)){var H=D.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(R.indentation=H,R.indentationDiff=null,H>0)return null}}return R.f(D,R)},innerMode:function(D){return D.block==C?{state:D.htmlState,mode:G}:D.localState?{state:D.localState,mode:D.localMode}:{state:D,mode:W}},indent:function(D,R,H){return D.block==C&&G.indent?G.indent(D.htmlState,R,H):D.localState&&D.localMode.indent?D.localMode.indent(D.localState,R,H):re.Pass},blankLine:g,getType:h,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),re.defineMIME("text/markdown","markdown"),re.defineMIME("text/x-markdown","markdown")})},osHv:function(ot,ze,Z){(function(re){re(Z("VrN/"))})(function(re){"use strict";var z=re.Pos;function L(d,o){return d.line-o.line||d.ch-o.ch}var G="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=G+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",P=new RegExp("<(/?)(["+G+"]["+I+"]*)","g");function B(d,o,u,s){this.line=o,this.ch=u,this.cm=d,this.text=d.getLine(o),this.min=s?Math.max(s.from,d.firstLine()):d.firstLine(),this.max=s?Math.min(s.to-1,d.lastLine()):d.lastLine()}function U(d,o){var u=d.cm.getTokenTypeAt(z(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 b(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),s=u>-1&&!/\S/.test(d.text.slice(u+1,o));return d.ch=o+1,s?"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}P.lastIndex=o,d.ch=o;var u=P.exec(d.text);if(u&&u.index==o)return u}}function O(d){for(;;){P.lastIndex=d.ch;var o=P.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),s=u>-1&&!/\S/.test(d.text.slice(u+1,o));return d.ch=o+1,s?"selfClose":"regular"}}function x(d,o){for(var u=[];;){var s=O(d),w,g=d.line,f=d.ch-(s?s[0].length:0);if(!s||!(w=b(d)))return;if(w=="selfClose")continue;if(s[1]){for(var C=u.length-1;C>=0;--C)if(u[C]==s[2]){u.length=C;break}if(C<0&&(!o||o==s[2]))return{tag:s[2],from:z(g,f),to:z(d.line,d.ch)}}else u.push(s[2])}}function y(d,o){for(var u=[];;){var s=_(d);if(!s)return;if(s=="selfClose"){S(d);continue}var w=d.line,g=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:z(d.line,d.ch),to:z(w,g)}}}}re.registerHelper("fold","xml",function(d,o){for(var u=new B(d,o.line,0);;){var s=O(u);if(!s||u.line!=o.line)return;var w=b(u);if(!w)return;if(!s[1]&&w!="selfClose"){var g=z(u.line,u.ch),f=x(u,s[2]);return f&&L(f.from,g)>0?{from:g,to:f.from}:null}}}),re.findMatchingTag=function(d,o,u){var s=new B(d,o.line,o.ch,u);if(s.text.indexOf(">")==-1&&s.text.indexOf("<")==-1)return;var w=b(s),g=w&&z(s.line,s.ch),f=w&&S(s);if(!w||!f||L(s,o)>0)return;var C={from:z(s.line,s.ch),to:g,tag:f[2]};return w=="selfClose"?{open:C,close:null,at:"open"}:f[1]?{open:y(s,f[2]),close:C,at:"close"}:(s=new B(d,g.line,g.ch,u),{open:C,close:x(s,f[2]),at:"open"})},re.findEnclosingTag=function(d,o,u,s){for(var w=new B(d,o.line,o.ch,u);;){var g=y(w,s);if(!g)break;var f=new B(d,o.line,o.ch,u),C=x(f,g.tag);if(C)return{open:g,close:C}}},re.scanForClosingTag=function(d,o,u,s){var w=new B(d,o.line,o.ch,s?{from:0,to:s}:null);return x(w,u)}})},p5ED:function(ot,ze,Z){"use strict";var re=Z("+L6B"),z=Z("2/Rp"),L=Z("5Dmo"),G=Z("3S7+"),I=Z("k1fw"),P=Z("tJVT"),B=Z("cDcd"),U=Z.n(B),k=Z("vHTk"),A=Z.n(k),b=Z("yEEn"),S=Z("ZW9T"),O=Z("1vsH");ze.a=function(_){var x=_.name,y=_.data,d=_.theme,o=_.type,u=_.filename,s=_.monacoEditor,w=_.className,g=_.style,f=_.close,C=_.onClose,m=_.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(P.a)(h,2),l=c[0],a=c[1],v=Object(B.useState)(""),p=Object(P.a)(v,2),E=p[0],M=p[1],F,j=1024*1024,W=10*j,D=Object(B.useRef)();o==="office"&&(F=Object(O.V)(y).filesize,F>W&&(o="other")),u&&(s.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 R=function(){if(y.startsWith("http")||y.startsWith("blob:")){H();return}Object(O.z)(u||"educoder",y,u)},H=function(){Object(O.x)(u||"educoder",decodeURIComponent(y))};return console.log("data:",y,"fileanme:",u," name:",x),U.a.createElement("div",{style:Object(I.a)({},g||{}),className:"".concat(m&&A.a.bgBlack," ").concat(o?A.a.wrp:"hide")},f&&U.a.createElement("div",{className:A.a.close,ref:D},U.a.createElement(G.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(G.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,s)),o==="audio"&&U.a.createElement("audio",{src:"".concat(y!=null&&y.startsWith("/")||(y==null?void 0:y.indexOf("https://"))>-1?y:"data:audio/mp3;base64,").concat(y),autoPlay:!0}),o==="video"&&U.a.createElement(U.a.Fragment,null,y!=null&&y.startsWith("/")?U.a.createElement("video",{controls:!0,src:"".concat(y),autoPlay:!0}):U.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(y),autoPlay:!0})),o==="html"&&U.a.createElement("iframe",{src:y+"&disposition=inline"}),o==="html"&&U.a.createElement("iframe",{src:y+"&disposition=inline"}),o==="pdf"&&U.a.createElement("embed",{className:A.a.embed,src:y}),o==="image"&&U.a.createElement(U.a.Fragment,null,U.a.createElement("img",{src:"".concat(y!=null&&y.startsWith("/")||(y==null?void 0:y.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(y)})),o==="other"&&U.a.createElement("div",null,U.a.createElement(z.a,{type:"primary",size:"large",onClick:R},U.a.createElement(b.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&U.a.createElement(z.a,{type:"primary",size:"large",onClick:R},U.a.createElement(b.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(ot,ze,Z){},"rAM+":function(ot,ze,Z){"use strict";Z.d(ze,"a",function(){return z});var re=Z("Qw5x");function z(L,G){var I;if(typeof Symbol=="undefined"||L[Symbol.iterator]==null){if(Array.isArray(L)||(I=Object(re.a)(L))||G&&L&&typeof L.length=="number"){I&&(L=I);var P=0,B=function(){};return{s:B,n:function(){return P>=L.length?{done:!0}:{done:!1,value:L[P++]}},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,ze){const Z=/[&<>"']/,re=/[&<>"']/g,z=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,G={"&":"&","<":"<",">":">",'"':""","'":"'"},I=m=>G[m];function P(m,h){if(h){if(Z.test(m))return m.replace(re,I)}else if(z.test(m))return m.replace(L,I);return m}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function U(m){return m.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(m,h){m=m.source||m,h=h||"";const c={replace:(l,a)=>(a=a.source||a,a=a.replace(k,"$1"),m=m.replace(l,a),c),getRegex:()=>new RegExp(m,h)};return c}const b=/[^\w:]/g,S=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(m,h,c){if(m){let l;try{l=decodeURIComponent(U(c)).replace(b,"").toLowerCase()}catch(a){return null}if(l.indexOf("javascript:")===0||l.indexOf("vbscript:")===0||l.indexOf("data:")===0)return null}h&&!S.test(c)&&(c=o(h,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(l){return null}return c}const _={},x=/^[^:]+:\/*[^/]*$/,y=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(m,h){_[" "+m]||(x.test(m)?_[" "+m]=m+"/":_[" "+m]=g(m,"/",!0)),m=_[" "+m];const c=m.indexOf(":")===-1;return h.substring(0,2)==="//"?c?h:m.replace(y,"$1")+h:h.charAt(0)==="/"?c?h:m.replace(d,"$1")+h:m+h}const u={exec:function(){}};function s(m){let h=1,c,l;for(;h<arguments.length;h++){c=arguments[h];for(l in c)Object.prototype.hasOwnProperty.call(c,l)&&(m[l]=c[l])}return m}function w(m,h){const c=m.replace(/\|/g,(v,p,E)=>{let M=!1,F=p;for(;--F>=0&&E[F]==="\\";)M=!M;return M?"|":" |"}),l=c.split(/ \|/);let a=0;if(l.length>h)l.splice(h);else for(;l.length<h;)l.push("");for(;a<l.length;a++)l[a]=l[a].trim().replace(/\\\|/g,"|");return l}function g(m,h,c){const l=m.length;if(l===0)return"";let a=0;for(;a<l;){const v=m.charAt(l-a-1);if(v===h&&!c)a++;else if(v!==h&&c)a++;else break}return m.substr(0,l-a)}function f(m,h){if(m.indexOf(h[1])===-1)return-1;const c=m.length;let l=0,a=0;for(;a<c;a++)if(m[a]==="\\")a++;else if(m[a]===h[0])l++;else if(m[a]===h[1]&&(l--,l<0))return a;return-1}function C(m){m&&m.sanitize&&!m.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:P,unescape:U,edit:A,cleanUrl:O,resolveUrl:o,noopTest:u,merge:s,splitCells:w,rtrim:g,findClosingBracket:f,checkSanitizeDeprecation:C}},tt94:function(ot,ze,Z){"use strict";Z.r(ze);var re=Z("+L6B"),z=Z("2/Rp"),L=Z("sRBo"),G=Z("kaz8"),I=Z("14J3"),P=Z("BMrR"),B=Z("jCWc"),U=Z("kPKH"),k=Z("giR+"),A=Z("fyUT"),b=Z("5NDa"),S=Z("5rEg"),O=Z("sPJy"),_=Z("bE4q"),x=Z("k1fw"),y=Z("miYZ"),d=Z("tsqr"),o=Z("9og8"),u=Z("y8nQ"),s=Z("Vl3Y"),w=Z("tJVT"),g=Z("WmNS"),f=Z.n(g),C=Z("cDcd"),m=Z.n(C),h=Z("9kvl"),c=Z("55Ip"),l=Z("1vsH"),a=Z("Ot1p"),v=Z("XYT7"),p=Z("lLeG"),E=Z.n(p),M=Z("500L"),F=Z("gMzb"),j=Z("ErOA"),W=function(R){var H,Y=R.shixunHomeworks,ee=R.newCourse,oe=R.globalSetting,Te=R.loading,ye=R.dispatch,he=R.match,le=s.a.useForm(),pe=Object(w.a)(le,1),ie=pe[0],me=Object(C.useState)({}),J=Object(w.a)(me,2),ne=J[0],q=J[1],xe=Object(C.useRef)(),_e=Y.commonHomeWorkAddDefaultData,be=Object(C.useState)({}),ve=Object(w.a)(be,2),we=ve[0],Oe=ve[1];Object(C.useEffect)(function(){setTimeout(function(){document.body.scrollIntoView()},300);var je=he.params,He=je.coursesId,Be=je.categoryId;ye({type:"shixunHomeworks/addCommonHomeWorkDefaultData",payload:{category:Be,coursesId:He,type:3}})},[]);var ke=function(){var je=Object(o.a)(f.a.mark(function He(Be){var Ne,qe,Xe,Ze,Le,et,Ve;return f.a.wrap(function(Ie){for(;;)switch(Ie.prev=Ie.next){case 0:if(!(ne.min_num>ne.max_num)){Ie.next=3;break}return d.b.info("\u6700\u5927\u4EBA\u6570\u4E0D\u80FD\u5C0F\u4E8E\u6700\u5C0F\u4EBA\u6570"),Ie.abrupt("return");case 3:return Ne=Object(x.a)({},ne),Ne.attachment_ids&&(Ne.attachment_ids=Ne==null||((qe=Ne.attachment_ids)===null||qe===void 0)?void 0:qe.map(function(ge){return ge.response.id})),Ne.reference_attachment_ids&&(Ne.reference_attachment_ids=Ne==null||((Xe=Ne.reference_attachment_ids)===null||Xe===void 0)?void 0:Xe.map(function(ge){return ge.response.id})),Ze=he.params,Le=Ze.coursesId,et=Ze.categoryId,Ie.next=9,Object(v.a)(Object(x.a)(Object(x.a)({coursesId:Le,category:et},Ne),{},{type:3}));case 9:Ve=Ie.sent,Ve.status===0&&(Ce(Ve.homework_id),Object(l.eb)(["\u6559\u5B66\u8BFE\u5802","\u5206\u7EC4\u4F5C\u4E1A","\u65B0\u5EFA\u5206\u7EC4\u4F5C\u4E1A"]),h.d.push("/classrooms/".concat(Le,"/group_homework/").concat(Ve.homework_id,"/detail")));case 11:case"end":return Ie.stop()}},He)}));return function(Be){return je.apply(this,arguments)}}();function Ce(je){return Re.apply(this,arguments)}function Re(){return Re=Object(o.a)(f.a.mark(function je(He){var Be;return f.a.wrap(function(qe){for(;;)switch(qe.prev=qe.next){case 0:if(we!=null&&we.ec_point_ids){qe.next=2;break}return qe.abrupt("return");case 2:return qe.next=4,Object(j.a)("/api/ec_courses/".concat(we==null?void 0:we.ec_course_id,"/ec_points/set_work_points.json"),{method:"post",body:Object(x.a)({homework_common_id:He},we)});case 4:Be=qe.sent;case 5:case"end":return qe.stop()}},je)})),Re.apply(this,arguments)}return m.a.createElement("section",{className:E.a.bg},_e.course_name&&m.a.createElement("section",{className:"animated fadeIn"},m.a.createElement("aside",{className:"mt10"},_e.category&&m.a.createElement(_.a,{separator:">"},m.a.createElement(_.a.Item,null,m.a.createElement(c.a,{to:"/classrooms/".concat(_e.course_id,"/group_homework")},_e.course_name)),m.a.createElement(_.a.Item,null,m.a.createElement(c.a,{to:"/classrooms/".concat(_e.course_id,"/group_homework")},_e.category.category_name)),m.a.createElement(_.a.Item,null,"\u65B0\u5EFA\u8BE6\u60C5")))),m.a.createElement("aside",{className:"font24 bold mt20 mb20"},"\u65B0\u5EFA\u5206\u7EC4\u4F5C\u4E1A"),m.a.createElement(s.a,{form:ie,className:E.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){q(Object(x.a)({},ie.getFieldsValue()))},initialValues:{base_on_project:!1},onFinish:ke},m.a.createElement("div",{className:E.a.fieldWrap},m.a.createElement(s.a.Item,{name:"name",label:"\u6807\u9898:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},m.a.createElement(S.a,{maxLength:60,suffix:"".concat(((H=ne.name)===null||H===void 0?void 0:H.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),m.a.createElement("div",{className:E.a.mdWrap},m.a.createElement(s.a.Item,{name:"description",label:"\u5185\u5BB9:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u4E1A\u7684\u7B80\u4ECB"},{max:5e3,message:"\u4F5C\u4E1A\u7B80\u4ECB\u6700\u5927\u9650\u52365000\u4E2A\u5B57\u7B26"}]},m.a.createElement(a.a,{watch:!0,defaultValue:ne.intro})),m.a.createElement("div",null,m.a.createElement(s.a.Item,{name:"attachment_ids"},m.a.createElement(M.b,null))),m.a.createElement(P.a,{gutter:[20,20]},m.a.createElement(U.a,{flex:"230px"},m.a.createElement(s.a.Item,{name:"min_num",label:"\u5206\u7EC4\u8BBE\u7F6E",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5C0F\u4EBA\u6570"}]},m.a.createElement(A.a,{style:{width:200},min:1,placeholder:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5C0F\u4EBA\u6570"}))),m.a.createElement(U.a,{flex:"230px"},m.a.createElement(s.a.Item,{name:"max_num",label:m.a.createElement("div",null,"\xA0"),rules:[{required:!0,message:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5927\u4EBA\u6570"}]},m.a.createElement(A.a,{style:{width:200},max:100,placeholder:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5927\u4EBA\u6570"}))),m.a.createElement(U.a,null,m.a.createElement("div",{className:"mt30"},"\uFF08\u5B66\u751F\u63D0\u4EA4\u4F5C\u54C1\u65F6\u9700\u8981\u5173\u8054\u540C\u7EC4\u6210\u5458\uFF0C\u7EC4\u5185\u6210\u5458\u4F5C\u54C1\u5171\u4EAB\uFF09"))),m.a.createElement(P.a,null,m.a.createElement(U.a,null,m.a.createElement(s.a.Item,{name:"base_on_project",valuePropName:"checked"},m.a.createElement(G.a,{value:!0},"\u57FA\u4E8E\u9879\u76EE\u5B9E\u65BD")),m.a.createElement("span",{className:"c-light-black"},"\uFF08\u9009\u4E2D\uFF0C\u5219\u5FC5\u987B\u5728\u672C\u5E73\u53F0\u521B\u5EFA\u9879\u76EE\uFF0C\u9879\u76EE\u7BA1\u7406\u5458\u53EF\u4EE5\u63D0\u4EA4\u4F5C\u54C1\uFF1B\u4E0D\u9009\u4E2D\uFF0C\u65E0\u9700\u5728\u5E73\u53F0\u521B\u5EFA\u9879\u76EE\uFF0C\u4EFB\u610F\u5C0F\u7EC4\u6210\u5458\u5747\u53EF\u4EE5\u63D0\u4EA4\u4F5C\u54C1\uFF09")))),m.a.createElement("div",{className:E.a.mdWrap},m.a.createElement(s.a.Item,{name:"reference_answer",label:"\u53C2\u8003\u7B54\u6848:"},m.a.createElement(a.a,{watch:!0,defaultValue:ne.notice})),m.a.createElement("div",null,m.a.createElement(s.a.Item,{name:"reference_attachment_ids"},m.a.createElement(M.b,null))))),m.a.createElement("div",{className:E.a.mdWrap},m.a.createElement(F.a,{setitem:function(He){return Oe(Object(x.a)({},He))}})),m.a.createElement("div",{className:E.a.backgroundFa},m.a.createElement("div",{className:"pt40 mb30"},m.a.createElement(s.a.Item,null,m.a.createElement(z.a,{size:"large",type:"primary",onClick:function(){ie.submit()},className:"".concat(E.a.button," mr20"),htmlType:"submit",loading:Te["newCourse/editCourse"]||Te["newCourse/submitCourse"]},"\u63D0\u4EA4"),m.a.createElement(z.a,{size:"large",type:"primary",ghost:!0,className:E.a.button,onClick:function(){return h.d.push("/classrooms/".concat(he.params.coursesId,"/group_homework"))}},"\u53D6\u6D88")))))};ze.default=Object(h.a)(function(D){var R=D.shixunHomeworks,H=D.newCourse,Y=D.loading,ee=D.globalSetting;return{shixunHomeworks:R,newCourse:H,globalSetting:ee,loading:Y.effects}})(W)},ulZh:function(ot,ze,Z){typeof window!="undefined"&&function(z,L){ot.exports=L()}(this,function(){return function(re){var z={};function L(G){if(z[G])return z[G].exports;var I=z[G]={i:G,l:!1,exports:{}};return re[G].call(I.exports,I,I.exports,L),I.l=!0,I.exports}return L.m=re,L.c=z,L.d=function(G,I,P){L.o(G,I)||Object.defineProperty(G,I,{enumerable:!0,get:P})},L.r=function(G){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(G,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(G,"__esModule",{value:!0})},L.t=function(G,I){if(I&1&&(G=L(G)),I&8)return G;if(I&4&&typeof G=="object"&&G&&G.__esModule)return G;var P=Object.create(null);if(L.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:G}),I&2&&typeof G!="string")for(var B in G)L.d(P,B,function(U){return G[U]}.bind(null,B));return P},L.n=function(G){var I=G&&G.__esModule?function(){return G.default}:function(){return G};return L.d(I,"a",I),I},L.o=function(G,I){return Object.prototype.hasOwnProperty.call(G,I)},L.p="/dist/",L(L.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(re,z,L){"use strict";var G=Object.prototype.hasOwnProperty,I="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(I=!1));function B(b,S,O){this.fn=b,this.context=S,this.once=O||!1}function U(b,S,O,_,x){if(typeof O!="function")throw new TypeError("The listener must be a function");var y=new B(O,_||b,x),d=I?I+S:S;return b._events[d]?b._events[d].fn?b._events[d]=[b._events[d],y]:b._events[d].push(y):(b._events[d]=y,b._eventsCount++),b}function k(b,S){--b._eventsCount===0?b._events=new P:delete b._events[S]}function A(){this._events=new P,this._eventsCount=0}A.prototype.eventNames=function(){var S=[],O,_;if(this._eventsCount===0)return S;for(_ in O=this._events)G.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,y=_.length,d=new Array(y);x<y;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,y,d){var o=I?I+S:S;if(!this._events[o])return!1;var u=this._events[o],s=arguments.length,w,g;if(u.fn){u.once&&this.removeListener(S,u.fn,void 0,!0);switch(s){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,y),!0;case 6:return u.fn.call(u.context,O,_,x,y,d),!0}for(g=1,w=new Array(s-1);g<s;g++)w[g-1]=arguments[g];u.fn.apply(u.context,w)}else{var f=u.length,C;for(g=0;g<f;g++){u[g].once&&this.removeListener(S,u[g].fn,void 0,!0);switch(s){case 1:u[g].fn.call(u[g].context);break;case 2:u[g].fn.call(u[g].context,O);break;case 3:u[g].fn.call(u[g].context,O,_);break;case 4:u[g].fn.call(u[g].context,O,_,x);break;default:if(!w)for(C=1,w=new Array(s-1);C<s;C++)w[C-1]=arguments[C];u[g].fn.apply(u[g].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 y=I?I+S:S;if(!this._events[y])return this;if(!O)return k(this,y),this;var d=this._events[y];if(d.fn)d.fn===O&&(!x||d.once)&&(!_||d.context===_)&&k(this,y);else{for(var o=0,u=[],s=d.length;o<s;o++)(d[o].fn!==O||x&&!d[o].once||_&&d[o].context!==_)&&u.push(d[o]);u.length?this._events[y]=u.length===1?u[0]:u:k(this,y)}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 P,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,z,L){(function(G){var I=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,P=/^([^\/?#]*)([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,U=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,k={buildAbsoluteURL:function(A,b,S){if(S=S||{},A=A.trim(),b=b.trim(),!b){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(b);if(!_)throw new Error("Error trying to parse relative URL.");if(_.scheme)return S.alwaysNormalize?(_.path=k.normalizePath(_.path),k.buildURLFromParts(_)):b;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 y=P.exec(x.path);x.netLoc=y[1],x.path=y[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 b=I.exec(A);return b?{scheme:b[1]||"",netLoc:b[2]||"",path:b[3]||"",params:b[4]||"",query:b[5]||"",fragment:b[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,z,L){function G(S){var O={};function _(y){if(O[y])return O[y].exports;var d=O[y]={i:y,l:!1,exports:{}};return S[y].call(d.exports,d,d.exports,_),d.l=!0,d.exports}_.m=S,_.c=O,_.i=function(y){return y},_.d=function(y,d,o){_.o(y,d)||Object.defineProperty(y,d,{configurable:!1,enumerable:!0,get:o})},_.r=function(y){Object.defineProperty(y,"__esModule",{value:!0})},_.n=function(y){var d=y&&y.__esModule?function(){return y.default}:function(){return y};return _.d(d,"a",d),d},_.o=function(y,d){return Object.prototype.hasOwnProperty.call(y,d)},_.p="/",_.oe=function(y){throw console.error(y),y};var x=_(_.s=ENTRY_MODULE);return x.default||x}var I="[\\.|\\-|\\+|\\w|/|@]+",P="\\(\\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 y=O.toString(),d=y.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)+P,"g"),s;s=u.exec(y);){if(s[3]==="dll-reference")continue;x[_].push(s[3])}for(u=new RegExp("\\("+B(o)+'\\("(dll-reference\\s('+I+'))"\\)\\)'+P,"g");s=u.exec(y);)S[s[2]]||(x[_].push(s[1]),S[s[2]]=L(s[1]).m),x[s[2]]=x[s[2]]||[],x[s[2]].push(s[4]);for(var w=Object.keys(x),g=0;g<w.length;g++)for(var f=0;f<x[w[g]].length;f++)U(x[w[g]][f])&&(x[w[g]][f]=1*x[w[g]][f]);return x}function A(S){var O=Object.keys(S);return O.reduce(function(_,x){return _||S[x].length>0},!1)}function b(S,O){for(var _={main:[O]},x={main:[]},y={main:{}};A(_);)for(var d=Object.keys(_),o=0;o<d.length;o++){var u=d[o],s=_[u],w=s.pop();if(y[u]=y[u]||{},y[u][w]||!S[u][w])continue;y[u][w]=!0,x[u]=x[u]||[],x[u].push(w);for(var g=k(S,S[u][w],u),f=Object.keys(g),C=0;C<f.length;C++)_[f[C]]=_[f[C]]||[],_[f[C]]=_[f[C]].concat(g[f[C]])}return x}re.exports=function(S,O){O=O||{};var _={main:L.m},x=O.all?{main:Object.keys(_.main)}:b(_,S),y="";Object.keys(x).filter(function(w){return w!=="main"}).forEach(function(w){for(var g=0;x[w][g];)g++;x[w].push(g),_[w][g]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",y=y+"var "+w+" = ("+G.toString().replace("ENTRY_MODULE",JSON.stringify(g))+")({"+x[w].map(function(f){return""+JSON.stringify(f)+": "+_[w][f].toString()}).join(",")+`});
|
|
`}),y=y+"new (("+G.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([y],{type:"text/javascript"});if(O.bare)return d;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,u=o.createObjectURL(d),s=new window.Worker(u);return s.objectURL=u,s}},"./src/config.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"hlsDefaultConfig",function(){return C}),L.d(z,"mergeConfig",function(){return h}),L.d(z,"enableStreamingMode",function(){return c});var G=L("./src/controller/abr-controller.ts"),I=L("./src/controller/audio-stream-controller.ts"),P=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"),b=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"),y=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 s(){return s=Object.assign||function(l){for(var a=1;a<arguments.length;a++){var v=arguments[a];for(var p in v)Object.prototype.hasOwnProperty.call(v,p)&&(l[p]=v[p])}return l},s.apply(this,arguments)}function w(l,a){var v=Object.keys(l);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(l);a&&(p=p.filter(function(E){return Object.getOwnPropertyDescriptor(l,E).enumerable})),v.push.apply(v,p)}return v}function g(l){for(var a=1;a<arguments.length;a++){var v=arguments[a]!=null?arguments[a]:{};a%2?w(Object(v),!0).forEach(function(p){f(l,p,v[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(v)):w(Object(v)).forEach(function(p){Object.defineProperty(l,p,Object.getOwnPropertyDescriptor(v,p))})}return l}function f(l,a,v){return a in l?Object.defineProperty(l,a,{value:v,enumerable:!0,configurable:!0,writable:!0}):l[a]=v,l}var C=g(g({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:G.default,bufferController:k.default,capLevelController:b.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},m()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:U.default,timelineController:A.TimelineController,audioStreamController:I.default,audioTrackController:P.default,emeController:O.default,cmcdController:_.default});function m(){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(l,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 s({},l,a)}function c(l){var a=l.loader;if(a!==y.default&&a!==x.default)u.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),l.progressive=!1;else{var v=Object(y.fetchSupported)();v&&(l.loader=y.default,l.progressive=!0,l.enableSoftwareAES=!0,u.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(re,z,L){"use strict";L.r(z);var G=L("./src/polyfills/number.ts"),I=L("./src/utils/ewma-bandwidth-estimator.ts"),P=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 b(_,x){for(var y=0;y<x.length;y++){var d=x[y];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(_,d.key,d)}}function S(_,x,y){return x&&b(_.prototype,x),y&&b(_,y),_}var O=function(){function _(y){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=y;var d=y.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(P.Events.FRAG_LOADING,this.onFragLoading,this),d.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(P.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var d=this.hls;d.off(P.Events.FRAG_LOADING,this.onFragLoading,this),d.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(P.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 s;this.fragCurrent=u,this.partCurrent=(s=o.part)!=null?s: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,s=u.autoLevelEnabled,w=u.config,g=u.media;if(!d||!g)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(!s||g.paused||!g.playbackRate||!g.readyState)return;var m=performance.now()-f.loading.start,h=Math.abs(g.playbackRate);if(m<=500*C/h)return;var c=u.levels,l=u.minAutoLevel,a=c[d.level],v=f.total||Math.max(f.loaded,Math.round(C*a.maxBitrate/8)),p=Math.max(1,f.bwEstimate?f.bwEstimate/8:f.loaded*1e3/m),E=(v-f.loaded)/p,M=g.currentTime,F=(B.BufferHelper.bufferInfo(g,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>l;W--){var D=c[W].maxBitrate;if(j=C*D/(8*.8*p),j<F)break}if(j>=E)return;var R=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(G.isFiniteNumber)(R)?(R/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(m,f.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),u.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:o,stats:f})},x.onFragLoaded=function(d,o){var u=o.frag,s=o.part;if(u.type===k.PlaylistLevelType.MAIN&&Object(G.isFiniteNumber)(u.sn)){var w=s?s.stats:u.stats,g=s?s.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,m=(f.loaded?f.loaded.duration:0)+g;f.loaded={bytes:C,duration:m},f.realBitrate=Math.round(8*C/m)}if(u.bitrateTest){var h={stats:w,frag:u,part:s,id:u.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,h),u.bitrateTest=!1}}},x.onFragBuffered=function(d,o){var u=o.frag,s=o.part,w=s?s.stats:u.stats;if(w.aborted)return;if(u.type!==k.PlaylistLevelType.MAIN||u.sn==="initSegment")return;var g=w.parsing.end-w.loading.start;this.bwEstimator.sample(g,w.loaded),w.bwEstimate=this.bwEstimator.getEstimate(),u.bitrateTest?this.bitrateTestDelay=g/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,s=u.maxAutoLevel,w=u.config,g=u.minAutoLevel,f=u.media,C=o?o.duration:d?d.duration:0,m=f?f.currentTime:0,h=f&&f.playbackRate!==0?Math.abs(f.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():w.abrEwmaDefaultEstimate,l=(B.BufferHelper.bufferInfo(f,m,w.maxBufferHole).end-m)/h,a=this.findBestLevel(c,g,s,l,w.abrBandWidthFactor,w.abrBandWidthUpFactor);if(a>=0)return a;A.logger.trace((l?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var v=C?Math.min(C,w.maxStarvationDelay):w.maxStarvationDelay,p=w.abrBandWidthFactor,E=w.abrBandWidthUpFactor;if(!l){var M=this.bitrateTestDelay;if(M){var F=C?Math.min(C,w.maxLoadingDelay):w.maxLoadingDelay;v=F-M,A.logger.trace("bitrate test took "+Math.round(1e3*M)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*v)+" ms"),p=E=1}}return a=this.findBestLevel(c,g,s,l+v,p,E),Math.max(a,0)},x.findBestLevel=function(d,o,u,s,w,g){for(var f,C=this.fragCurrent,m=this.partCurrent,h=this.lastLoadedFragLevel,c=this.hls.levels,l=c[h],a=!!(l!=null&&(f=l.details)!==null&&f!==void 0&&f.live),v=l==null?void 0:l.codecSet,p=m?m.duration:C?C.duration:0,E=u;E>=o;E--){var M=c[E];if(!M||v&&M.codecSet!==v)continue;var F=M.details,j=(m?F==null?void 0:F.partTarget:F==null?void 0:F.averagetargetduration)||p,W=void 0;E<=h?W=w*d:W=g*d;var D=c[E].maxBitrate,R=D*j/W;if(A.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+E+"/"+Math.round(W)+"/"+D+"/"+j+"/"+s+"/"+R),W>D&&(!R||a&&!this.bitrateTestDelay||R<s))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}}]),_}();z.default=O},"./src/controller/audio-stream-controller.ts":function(re,z,L){"use strict";L.r(z);var G=L("./src/polyfills/number.ts"),I=L("./src/controller/base-stream-controller.ts"),P=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"),b=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"),y=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 m=1;m<arguments.length;m++){var h=arguments[m];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(C[c]=h[c])}return C},u.apply(this,arguments)}function s(C,m){C.prototype=Object.create(m.prototype),C.prototype.constructor=C,w(C,m)}function w(C,m){return w=Object.setPrototypeOf||function(c,l){return c.__proto__=l,c},w(C,m)}var g=100,f=function(C){s(m,C);function m(c,l){var a;return a=C.call(this,c,l,"[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=m.prototype;return h.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},h._registerListeners=function(){var l=this.hls;l.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.on(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.on(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(P.Events.ERROR,this.onError,this),l.on(P.Events.BUFFER_RESET,this.onBufferReset,this),l.on(P.Events.BUFFER_CREATED,this.onBufferCreated,this),l.on(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h._unregisterListeners=function(){var l=this.hls;l.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.off(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.off(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(P.Events.ERROR,this.onError,this),l.off(P.Events.BUFFER_RESET,this.onBufferReset,this),l.off(P.Events.BUFFER_CREATED,this.onBufferCreated,this),l.off(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h.onInitPtsFound=function(l,a){var v=a.frag,p=a.id,E=a.initPTS;if(p==="main"){var M=v.cc;this.initPTS[v.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(l){if(!this.levels){this.startPosition=l,this.state=I.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(g),this.fragLoadError=0,a>0&&l===-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=l,this.tick()},h.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_TRACK:{var l,a=this.levels,v=this.trackId,p=a==null||((l=a[v])===null||l===void 0)?void 0:l.details;if(p){if(this.waitForCdnTuneIn(p))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,R=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=R.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 l=this.waitingData;l&&(this.fragmentTracker.removeFragment(l.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.IDLE)},h.onTickEnd=function(){var l=this.media;if(!l||!l.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:l,v=a.buffered;!this.loadedmetadata&&v.length&&(this.loadedmetadata=!0),this.lastCurrentTime=l.currentTime},h.doTickIdle=function(){var l,a,v=this.hls,p=this.levels,E=this.media,M=this.trackId,F=v.config;if(!p||!p[M])return;if(!E&&(this.startFragRequested||!F.startFragPrefetch))return;var j=p[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,b.ElementaryStreamTypes.AUDIO,A.PlaylistLevelType.AUDIO));var D=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,A.PlaylistLevelType.AUDIO);if(D===null)return;var R=D.len,H=this.getMaxBufferLength(),Y=this.audioSwitch;if(R>=H&&!Y)return;if(!Y&&this._streamEnded(D,W)){v.trigger(P.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}((l=he.decryptdata)===null||l===void 0?void 0:l.keyFormat)==="identity"&&!((a=he.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(he,W):this.loadFragment(he,W,Te)},h.getMaxBufferLength=function(){var l=C.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,A.PlaylistLevelType.MAIN);return a===null?l:Math.max(l,a.len)},h.onMediaDetaching=function(){this.videoBuffer=null,C.prototype.onMediaDetaching.call(this)},h.onAudioTracksUpdated=function(l,a){var v=a.audioTracks;this.resetTransmuxer(),this.levels=v.map(function(p){return new k.Level(p)})},h.onAudioTrackSwitching=function(l,a){var v=!!a.url;this.trackId=a.id;var p=this.fragCurrent;p!=null&&p.loader&&p.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),v?this.setInterval(g):this.resetTransmuxer(),v?(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(l,a){this.mainDetails=a.details},h.onAudioTrackLoaded=function(l,a){var v,p=this.levels,E=a.details,M=a.id;if(!p){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=p[M],j=0;if(E.live||(v=F.details)!==null&&v!==void 0&&v.live){var W=this.mainDetails;if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed||!W)return;!F.details&&E.hasProgramDateTime&&W.hasProgramDateTime?(Object(y.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(l){var a,v=l.frag,p=l.part,E=l.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 "+v.sn+" of level "+v.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 R=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[v.cc],ee=(a=v.initSegment)===null||a===void 0?void 0:a.data;if(Y!==void 0){var oe=!1,Te=p?p.index:-1,ye=Te!==-1,he=new _.ChunkMetadata(v.level,v.sn,v.stats.chunkCount,E.byteLength,Te,ye);H.push(E,ee,R,"",v,p,D.totalduration,oe,he,Y)}else{o.logger.log("Unknown video PTS for cc "+v.cc+", waiting for video PTS before demuxing audio frag "+v.sn+" of ["+D.startSN+" ,"+D.endSN+"],track "+F);var le=this.waitingData=this.waitingData||{frag:v,part:p,cache:new S.default,complete:!1},pe=le.cache;pe.push(new Uint8Array(E)),this.waitingVideoCC=this.videoTrackCC,this.state=I.State.WAITING_INIT_PTS}},h._handleFragmentLoadComplete=function(l){if(this.waitingData){this.waitingData.complete=!0;return}C.prototype._handleFragmentLoadComplete.call(this,l)},h.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},h.onBufferCreated=function(l,a){var v=a.tracks.audio;v&&(this.mediaBuffer=v.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},h.onFragBuffered=function(l,a){var v=a.frag,p=a.part;if(v.type!==A.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(v)){this.warn("Fragment "+v.sn+(p?" p: "+p.index:"")+" of level "+v.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}v.sn!=="initSegment"&&(this.fragPrevious=v,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(v,p)},h.onError=function(l,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 v=!0,p=this.getFwdBufferInfo(this.mediaBuffer,A.PlaylistLevelType.AUDIO);p&&p.len>.5&&(v=!this.reduceMaxBufferLength(p.len)),v&&(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(l,a){var v=a.type;v===b.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},h._handleTransmuxComplete=function(l){var a,v="audio",p=this.hls,E=l.remuxResult,M=l.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,R=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),p.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:v,tracks:Y.tracks})),D){var ee=D.startPTS,oe=D.endPTS,Te=D.startDTS,ye=D.endDTS;W&&(W.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:ee,endPTS:oe,startDTS:Te,endDTS:ye}),j.setElementaryStreamInfo(b.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:v},H);p.trigger(P.Events.FRAG_PARSING_METADATA,he)}if(R){var le=u({frag:j,id:v},R);p.trigger(P.Events.FRAG_PARSING_USERDATA,le)}},h._bufferInitSegment=function(l,a,v){if(this.state!==I.State.PARSING)return;l.video&&delete l.video;var p=l.audio;if(!p)return;p.levelCodec=p.codec,p.id="audio",this.log("Init audio buffer, container:"+p.container+", codecs[parsed]=["+p.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,l);var E=p.initSegment;if(E!=null&&E.byteLength){var M={type:"audio",frag:a,part:null,chunkMeta:v,parent:a.type,data:E};this.hls.trigger(P.Events.BUFFER_APPENDING,M)}this.tick()},h.loadFragment=function(l,a,v){var p=this.fragmentTracker.getState(l);this.fragCurrent=l,(this.audioSwitch||p===U.FragmentState.NOT_LOADED||p===U.FragmentState.PARTIAL)&&(l.sn==="initSegment"?this._loadInitSegment(l):a.live&&!Object(G.isFiniteNumber)(this.initPTS[l.cc])?(this.log("Waiting for video PTS in continuity counter "+l.cc+" of live stream before loading audio fragment "+l.sn+" of level "+this.trackId),this.state=I.State.WAITING_INIT_PTS):(this.startFragRequested=!0,C.prototype.loadFragment.call(this,l,a,v)))},h.completeAudioSwitch=function(){var l=this.hls,a=this.media,v=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),C.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,l.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:v})},m}(I.default);z.default=f},"./src/controller/audio-track-controller.ts":function(re,z,L){"use strict";L.r(z);var G=L("./src/events.ts"),I=L("./src/errors.ts"),P=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function U(O,_){for(var x=0;x<_.length;x++){var y=_[x];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(O,y.key,y)}}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,b(O,_)}function b(O,_){return b=Object.setPrototypeOf||function(y,d){return y.__proto__=d,y},b(O,_)}var S=function(O){A(_,O);function _(y){var d;return d=O.call(this,y,"[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(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(G.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(G.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var d=this.hls;d.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(G.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(G.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(G.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,s=o.details,w=this.tracksInGroup[u];if(!w){this.warn("Invalid audio track id "+u);return}var g=w.details;w.details=o.details,this.log("audioTrack "+u+" loaded ["+s.startSN+"-"+s.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,o,g))},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 s=this.tracks.filter(function(g){return!u||g.groupId===u});this.selectDefaultTrack&&!s.some(function(g){return g.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=s;var w={audioTracks:s};this.log("Updating audio tracks, "+s.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(G.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 s=o[d],w=s.id,g=s.groupId,f=g===void 0?"":g,C=s.name,m=s.type,h=s.url;if(this.trackId=d,this.trackName=C,this.selectDefaultTrack=!1,this.hls.trigger(G.Events.AUDIO_TRACK_SWITCHING,{id:w,groupId:f,name:C,type:m,url:h}),s.details&&!s.details.live)return;var c=this.switchParams(s.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(G.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 s=o[u];if((!this.selectDefaultTrack||s.default)&&(!d||d===s.name))return s.id}return-1},x.loadPlaylist=function(d){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var u=o.id,s=o.groupId,w=o.url;if(d)try{w=d.addDirectives(w)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("loading audio-track playlist for id: "+u),this.clearTimer(),this.hls.trigger(G.Events.AUDIO_TRACK_LOADING,{url:w,id:u,groupId:s,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)}}]),_}(P.default);z.default=S},"./src/controller/base-playlist-controller.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return k});var G=L("./src/polyfills/number.ts"),I=L("./src/types/level.ts"),P=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 b=A.prototype;return b.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},b.onError=function(O,_){_.fatal&&_.type===U.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},b.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},b.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},b.stopLoad=function(){this.canLoad=!1,this.clearTimer()},b.switchParams=function(O,_){var x=_==null?void 0:_.renditionReports;if(x)for(var y=0;y<x.length;y++){var d=x[y],o=""+d.URI;if(o===O.substr(-o.length)){var u=parseInt(d["LAST-MSN"]),s=parseInt(d["LAST-PART"]);if(_&&this.hls.config.lowLatencyMode){var w=Math.min(_.age-_.partTarget,_.targetduration);s!==void 0&&w>_.partTarget&&(s+=1)}if(Object(G.isFiniteNumber)(u))return new I.HlsUrlParameters(u,Object(G.isFiniteNumber)(s)?s:void 0,I.HlsSkip.No)}}},b.loadPlaylist=function(O){},b.shouldLoadTrack=function(O){return this.canLoad&&O&&!!O.url&&(!O.details||O.details.live)},b.playlistLoaded=function(O,_,x){var y=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(P.mergeDetails)(x,d),!this.canLoad||!d.live)return;var s,w=void 0,g=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var f=this.hls.config.lowLatencyMode,C=d.lastPartSn,m=d.endSN,h=d.lastPartIndex,c=h!==-1,l=C===m,a=f?0:h;c?(w=l?m+1:C,g=l?a:h+1):w=m+1;var v=d.age,p=v+d.ageHeader,E=Math.min(p-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,g!==void 0){var F=Math.round(E%d.targetduration/d.partTarget);g+=F}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+v.toFixed(2)+"s goal: "+E+" skip sn "+M+" to part "+g)}d.tuneInGoal=E}if(s=this.getDeliveryDirectives(d,_.deliveryDirectives,w,g),f||!l){this.loadPlaylist(s);return}}else s=this.getDeliveryDirectives(d,_.deliveryDirectives,w,g);var j=Object(P.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 y.loadPlaylist(s)},j)}else this.clearTimer()},b.getDeliveryDirectives=function(O,_,x,y){var d=Object(I.getSkipValue)(O,x);return _!=null&&_.skip&&O.deltaUpdateFailed&&(x=_.msn,y=_.part,d=I.HlsSkip.No),new I.HlsUrlParameters(x,y,d)},b.retryLoadingOrFail=function(O){var _=this,x=this.hls.config,y=this.retryCount<x.levelLoadingMaxRetry;if(y){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 y},A}()},"./src/controller/base-stream-controller.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"State",function(){return m}),L.d(z,"default",function(){return h});var G=L("./src/polyfills/number.ts"),I=L("./src/task-loop.ts"),P=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"),b=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"),y=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 s(c,l){for(var a=0;a<l.length;a++){var v=l[a];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(c,v.key,v)}}function w(c,l,a){return l&&s(c.prototype,l),a&&s(c,a),c}function g(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function f(c,l){c.prototype=Object.create(l.prototype),c.prototype.constructor=c,C(c,l)}function C(c,l){return C=Object.setPrototypeOf||function(v,p){return v.__proto__=p,v},C(c,l)}var m={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(l,c);function l(v,p,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=m.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=v,M.fragmentLoader=new y.default(v.config),M.fragmentTracker=p,M.config=v.config,M.decrypter=new d.default(v,v.config),v.on(k.Events.KEY_LOADED,M.onKeyLoaded,g(M)),M}var a=l.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(p){},a.stopLoad=function(){this.fragmentLoader.abort();var p=this.fragCurrent;p&&this.fragmentTracker.removeFragment(p),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=m.STOPPED},a._streamEnded=function(p,E){var M=this.fragCurrent,F=this.fragmentTracker;if(!E.live&&M&&M.sn===E.endSN&&!p.nextStart){var j=F.getState(M);return j===P.FragmentState.PARTIAL||j===P.FragmentState.OK}return!1},a.onMediaAttached=function(p,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===m.STOPPED&&this.startLoad(F.startPosition)},a.onMediaDetaching=function(){var p=this.media;p!=null&&p.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),p&&(p.removeEventListener("seeking",this.onvseeking),p.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 p=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,p.maxBufferHole);if(this.log("media seeking to "+(Object(G.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+j),j===m.ENDED)this.resetLoadingState();else if(E&&!D.len){var R=p.maxFragLookUpTolerance,H=E.start-R,Y=E.start+E.duration+R,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(p,E){if(this.state!==m.KEY_LOADING||E.frag!==this.fragCurrent||!this.levels)return;this.state=m.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=m.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(p,E){this.log("Loading key for "+p.sn+" of ["+E.startSN+"-"+E.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level),this.state=m.KEY_LOADING,this.fragCurrent=p,this.hls.trigger(k.Events.KEY_LOADING,{frag:p})},a.loadFragment=function(p,E,M){this._loadFragForPlayback(p,E,M)},a._loadFragForPlayback=function(p,E,M){var F=this,j=function(D){if(F.fragContextChanged(p)){F.warn("Fragment "+p.sn+(D.part?" p: "+D.part.index:"")+" of level "+p.level+" was dropped during download."),F.fragmentTracker.removeFragment(p);return}p.stats.chunkCount++,F._handleFragmentLoadProgress(D)};this._doFragLoad(p,E,M,j).then(function(W){if(!W)return;F.fragLoadError=0;var D=F.state;if(F.fragContextChanged(p)){(D===m.FRAG_LOADING||D===m.BACKTRACKING||!F.fragCurrent&&D===m.PARSING)&&(F.fragmentTracker.removeFragment(p),F.state=m.IDLE);return}if("payload"in W&&(F.log("Loaded fragment "+p.sn+" of level "+p.level),F.hls.trigger(k.Events.FRAG_LOADED,W),F.state===m.BACKTRACKING)){F.fragmentTracker.backtrack(p,W),F.resetFragmentLoading(p);return}F._handleFragmentLoadComplete(W)}).catch(function(W){F.warn(W),F.resetFragmentLoading(p)})},a.flushMainBuffer=function(p,E,M){if(M===void 0&&(M=null),!(p-E))return;var F={startOffset:p,endOffset:E,type:M};this.fragLoadError=0,this.hls.trigger(k.Events.BUFFER_FLUSHING,F)},a._loadInitSegment=function(p){var E=this;this._doFragLoad(p).then(function(M){if(!M||E.fragContextChanged(p)||!E.levels)throw new Error("init load aborted");return M}).then(function(M){var F=E.hls,j=M.payload,W=p.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(R){var H=self.performance.now();return F.trigger(k.Events.FRAG_DECRYPTED,{frag:p,payload:R,stats:{tstart:D,tdecrypt:H}}),M.payload=R,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[p.level].details;console.assert(D,"Level details are defined when init segment is loaded");var R=p.stats;E.state=m.IDLE,E.fragLoadError=0,p.data=new Uint8Array(M.payload),R.parsing.start=R.buffering.start=self.performance.now(),R.parsing.end=R.buffering.end=self.performance.now(),M.frag===F&&j.trigger(k.Events.FRAG_BUFFERED,{stats:R,frag:F,part:null,id:p.type}),E.tick()}).catch(function(M){E.warn(M),E.resetFragmentLoading(p)})},a.fragContextChanged=function(p){var E=this.fragCurrent;return!p||!E||p.level!==E.level||p.sn!==E.sn||p.urlId!==E.urlId},a.fragBufferedComplete=function(p,E){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+p.type+" sn: "+p.sn+(E?" part: "+E.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level+" "+o.default.toString(B.BufferHelper.getBuffered(M))),this.state=m.IDLE,this.tick()},a._handleFragmentLoadComplete=function(p){var E=this.transmuxer;if(!E)return;var M=p.frag,F=p.part,j=p.partsLoaded,W=!j||j.length===0||j.some(function(R){return!R}),D=new b.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,F?F.index:-1,!W);E.flush(D)},a._handleFragmentLoadProgress=function(p){},a._doFragLoad=function(p,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(p.start,M||0),this.config.lowLatencyMode&&E){var W=E.partList;if(W&&F){M>p.end&&E.fragmentHint&&(p=E.fragmentHint);var D=this.getNextPart(W,p,M);if(D>-1){var R=W[D];return this.log("Loading part sn: "+p.sn+" p: "+R.index+" cc: "+p.cc+" of playlist ["+E.startSN+"-"+E.endSN+"] parts [0-"+D+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=R.start+R.duration,this.state=m.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:p,part:W[D],targetBufferTime:M}),this.doFragPartsLoad(p,W,D,F).catch(function(H){return j.handleFragLoadError(H)})}else if(!p.url||this.loadedEndOfParts(W,M))return Promise.resolve(null)}}return this.log("Loading fragment "+p.sn+" cc: "+p.cc+" "+(E?"of ["+E.startSN+"-"+E.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(M.toFixed(3))),Object(G.isFiniteNumber)(p.sn)&&!this.bitrateTest&&(this.nextLoadPosition=p.start+p.duration),this.state=m.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:p,targetBufferTime:M}),this.fragmentLoader.load(p,F).catch(function(H){return j.handleFragLoadError(H)})},a.doFragPartsLoad=function(p,E,M,F){var j=this;return new Promise(function(W,D){var R=[],H=function Y(ee){var oe=E[ee];j.fragmentLoader.loadPart(p,oe,F).then(function(Te){R[oe.index]=Te;var ye=Te.part;j.hls.trigger(k.Events.FRAG_LOADED,Te);var he=E[ee+1];if(he&&he.fragment===p)Y(ee+1);else return W({frag:p,part:ye,partsLoaded:R})}).catch(D)};H(M)})},a.handleFragLoadError=function(p){var E=p.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(p){var E=this.getCurrentContext(p);if(!E||this.state!==m.PARSING){this.fragCurrent||(this.state=m.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,p.partial)},a.getCurrentContext=function(p){var E=this.levels,M=p.level,F=p.sn,j=p.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,R=D?D.fragment:Object(x.getFragmentWithSN)(W,F,this.fragCurrent);return R?{frag:R,part:D,level:W}:null},a.bufferFragmentData=function(p,E,M,F){if(!p||this.state!==m.PARSING)return;var j=p.data1,W=p.data2,D=j;if(j&&W&&(D=Object(S.appendUint8Array)(j,W)),!D||!D.length)return;var R={type:p.type,frag:E,part:M,chunkMeta:F,parent:E.type,data:D};this.hls.trigger(k.Events.BUFFER_APPENDING,R),p.dropped&&p.independent&&!M&&this.flushBufferGap(E)},a.flushBufferGap=function(p){var E=this.media;if(!E)return;if(!B.BufferHelper.isBuffered(E,E.currentTime)){this.flushMainBuffer(0,p.start);return}var M=E.currentTime,F=B.BufferHelper.bufferInfo(E,M,0),j=p.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),D=Math.max(Math.min(p.start-W,F.end-W),M+W);p.start-D>W&&this.flushMainBuffer(D,p.start)},a.getFwdBufferInfo=function(p,E){var M=this.config,F=this.getLoadPosition();if(!Object(G.isFiniteNumber)(F))return null;var j=B.BufferHelper.bufferInfo(p,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(p,F,Math.max(j.nextStart,M.maxBufferHole))}return j},a.getMaxBufferLength=function(p){var E=this.config,M;return p?M=Math.max(8*E.maxBufferSize/p,E.maxBufferLength):M=E.maxBufferLength,Math.min(M,E.maxMaxBufferLength)},a.reduceMaxBufferLength=function(p){var E=this.config,M=p||E.maxBufferLength;return E.maxMaxBufferLength>=M?(E.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+E.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(p,E){var M,F,j=E.fragments,W=j.length;if(!W)return null;var D=this.config,R=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:p)}else p<=R&&(H=j[0]);if(!H){var ee=D.lowLatencyMode?E.partEnd:E.fragmentEnd;H=this.getFragmentAtPosition(p,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(p,E,M){for(var F=-1,j=!1,W=!0,D=0,R=p.length;D<R;D++){var H=p[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(p,E){var M=p[p.length-1];return M&&E>M.start&&M.loaded},a.getInitialLiveFragment=function(p,E){var M=this.fragPrevious,F=null;if(M){if(p.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>=p.startSN&&j<=p.endSN){var W=E[j-p.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?p.fragmentEnd:p.edge,p))}return F},a.getFragmentAtPosition=function(p,E,M){var F=this.config,j=this.fragPrevious,W=M.fragments,D=M.endSN,R=M.fragmentHint,H=F.maxFragLookUpTolerance,Y=!!(F.lowLatencyMode&&M.partList&&R);Y&&R&&!this.bitrateTest&&(W=W.concat(R),D=R.sn);var ee;if(p<E){var oe=p>E-H?0:H;ee=Object(_.findFragmentByPTS)(j,W,p,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===P.FragmentState.BACKTRACKED){ee=null;for(var pe=Te;W[pe]&&this.fragmentTracker.getState(W[pe])===P.FragmentState.BACKTRACKED;)j?ee=W[pe--]:ee=W[--pe];ee||(ee=he)}else j&&ee.sn===j.sn&&!Y&&(ye&&(ee.sn<D&&this.fragmentTracker.getState(he)!==P.FragmentState.OK?(this.log("SN "+ee.sn+" just loaded, load next one: "+he.sn),ee=he):ee=null))}return ee},a.synchronizeToLiveEdge=function(p){var E=this.config,M=this.media;if(!M)return;var F=this.hls.liveSyncPosition,j=M.currentTime,W=p.fragments[0].start,D=p.edge,R=j>=W-E.maxFragLookUpTolerance&&j<=D;if(F!==null&&M.duration>F&&(j<F||!R)){var H=E.liveMaxLatencyDuration!==void 0?E.liveMaxLatencyDuration:E.liveMaxLatencyDurationCount*p.targetduration;(!R&&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(p,E){var M=this.levels,F=this.levelLastLoaded,j=this.fragPrevious,W=F!==null?M[F]:null,D=p.fragments.length;if(!D)return this.warn("No fragments in live playlist"),0;var R=p.fragments[0].start,H=!E,Y=p.alignedSliding&&Object(G.isFiniteNumber)(R);if(H||!Y&&!R){Object(O.alignStream)(j,W,p);var ee=p.fragments[0].start;return this.log("Live playlist sliding: "+ee.toFixed(2)+" start-sn: "+(E?E.startSN:"na")+"->"+p.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+D),ee}return R},a.waitForCdnTuneIn=function(p){var E=3;return p.live&&p.canBlockReload&&p.tuneInGoal>Math.max(p.partHoldBack,p.partTarget*E)},a.setStartPosition=function(p,E){var M=this.startPosition;if(M<E&&(M=-1),M===-1||this.lastCurrentTime===-1){var F=p.startTimeOffset;Object(G.isFiniteNumber)(F)?(M=E+F,F<0&&(M+=p.totalduration),M=Math.min(Math.max(E,M),E+p.totalduration),this.log("Start time offset "+F+" found in playlist, adjust startPosition to "+M),this.startPosition=M):p.live?M=this.hls.liveSyncPosition||E:this.startPosition=M=0,this.lastCurrentTime=M}this.nextLoadPosition=M},a.getLoadPosition=function(){var p=this.media,E=0;return this.loadedmetadata&&p?E=p.currentTime:this.nextLoadPosition&&(E=this.nextLoadPosition),E},a.handleFragLoadAborted=function(p,E){this.transmuxer&&p.sn!=="initSegment"&&p.stats.aborted&&(this.warn("Fragment "+p.sn+(E?" part"+E.index:"")+" of level "+p.level+" was aborted"),this.resetFragmentLoading(p))},a.resetFragmentLoading=function(p){(!this.fragCurrent||!this.fragContextChanged(p))&&(this.state=m.IDLE)},a.onFragmentOrKeyLoadError=function(p,E){if(E.fatal)return;var M=E.frag;if(!M||M.type!==p)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 "+p+" "+M.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=m.FRAG_LOADING_WAITING_RETRY}else E.levelRetry?(p===u.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=m.IDLE):(U.logger.error(E.details+" reaches max retry, redispatch as fatal ..."),E.fatal=!0,this.hls.stopLoad(),this.state=m.ERROR)},a.afterBufferFlushed=function(p,E,M){if(!p)return;var F=B.BufferHelper.getBuffered(p);this.fragmentTracker.detectEvictedFragments(E,F,M),this.state===m.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=m.IDLE},a.resetLiveStartWhenNotLoaded=function(p){if(!this.loadedmetadata){this.startFragRequested=!1;var E=this.levels?this.levels[p].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(p,E,M,F){var j=this,W=M.details;console.assert(!!W,"level.details must be defined");var D=Object.keys(p.elementaryStreams).reduce(function(R,H){var Y=p.elementaryStreams[H];if(Y){var ee=Y.endPTS-Y.startPTS;if(ee<=0)return j.warn("Could not parse fragment "+p.sn+" "+H+" duration reliably ("+ee+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),R||!1;var oe=F?0:Object(x.updateFragPTSDTS)(W,p,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:p,start:Y.startPTS,end:Y.endPTS}),!0}return R},!1);D?(this.state=m.PARSED,this.hls.trigger(k.Events.FRAG_PARSED,{frag:p,part:E})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},w(l,[{key:"state",get:function(){return this._state},set:function(p){var E=this._state;E!==p&&(this._state=p,this.log(E+"->"+p))}}]),l}(I.default)},"./src/controller/buffer-controller.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return _});var G=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),P=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"),b=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,s=o.media,w=o.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),s&&(o.updateMediaElementDuration(),u.trigger(I.Events.MEDIA_ATTACHED,{media:s})),w&&w.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){P.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){P.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var y=x.prototype;return y.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},y.destroy=function(){this.unregisterListeners(),this.details=null},y.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)},y.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)},y._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new b.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},y.onManifestParsed=function(o,u){var s=2;(u.audio&&!u.video||!u.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},y.onMediaAttaching=function(o,u){var s=this.media=u.media;if(s&&S){var w=this.mediaSource=new S;w.addEventListener("sourceopen",this._onMediaSourceOpen),w.addEventListener("sourceended",this._onMediaSourceEnded),w.addEventListener("sourceclose",this._onMediaSourceClose),s.src=self.URL.createObjectURL(w),this._objectUrl=s.src}},y.onMediaDetaching=function(){var o=this.media,u=this.mediaSource,s=this._objectUrl;if(u){if(P.logger.log("[buffer-controller]: media source detaching"),u.readyState==="open")try{u.endOfStream()}catch(w){P.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&&(s&&self.URL.revokeObjectURL(s),o.src===s?(o.removeAttribute("src"),o.load()):P.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)},y.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(u){var s=o.sourceBuffer[u];try{s&&(o.removeBufferListeners(u),o.mediaSource&&o.mediaSource.removeSourceBuffer(s),o.sourceBuffer[u]=void 0)}catch(w){P.logger.warn("[buffer-controller]: Failed to reset the "+u+" buffer",w)}}),this._initSourceBuffer()},y.onBufferCodecs=function(o,u){var s=this,w=this.getSourceBufferTypes().length;if(Object.keys(u).forEach(function(g){if(w){var f=s.tracks[g];if(f&&typeof f.buffer.changeType=="function"){var C=u[g],m=C.codec,h=C.levelCodec,c=C.container,l=(f.levelCodec||f.codec).replace(O,"$1"),a=(h||m).replace(O,"$1");if(l!==a){var v=c+";codecs="+(h||m);s.appendChangeType(g,v)}}}else s.pendingTracks[g]=u[g]}),w)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},y.appendChangeType=function(o,u){var s=this,w=this.operationQueue,g={execute:function(){var C=s.sourceBuffer[o];C&&(P.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+u),C.changeType(u)),w.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(C){P.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",C)}};w.append(g,o)},y.onBufferAppending=function(o,u){var s=this,w=this.hls,g=this.operationQueue,f=this.tracks,C=u.data,m=u.type,h=u.frag,c=u.part,l=u.chunkMeta,a=l.buffering[m],v=self.performance.now();a.start=v;var p=h.stats.buffering,E=c?c.stats.buffering:null;p.start===0&&(p.start=v),E&&E.start===0&&(E.start=v);var M=f.audio,F=m==="audio"&&l.id===1&&(M==null?void 0:M.container)==="audio/mpeg",j={execute:function(){if(a.executeStart=self.performance.now(),F){var D=s.sourceBuffer[m];if(D){var R=h.start-D.timestampOffset;Math.abs(R)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+R+") sn: "+h.sn+")"),D.timestampOffset=h.start)}}s.appendExecutor(C,m)},onStart:function(){},onComplete:function(){var D=self.performance.now();a.executeEnd=a.end=D,p.first===0&&(p.first=D),E&&E.first===0&&(E.first=D);var R=s.sourceBuffer,H={};for(var Y in R)H[Y]=U.BufferHelper.getBuffered(R[Y]);s.appendError=0,s.hls.trigger(I.Events.BUFFER_APPENDED,{type:m,frag:h,part:c,chunkMeta:l,parent:h.type,timeRanges:H})},onError:function(D){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+m+" SourceBuffer",D);var R={type:B.ErrorTypes.MEDIA_ERROR,parent:h.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:D,fatal:!1};D.code===DOMException.QUOTA_EXCEEDED_ERR?R.details=B.ErrorDetails.BUFFER_FULL_ERROR:(s.appendError++,R.details=B.ErrorDetails.BUFFER_APPEND_ERROR,s.appendError>w.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+w.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),R.fatal=!0)),w.trigger(I.Events.ERROR,R)}};g.append(j,m)},y.onBufferFlushing=function(o,u){var s=this,w=this.operationQueue,g=function(C){return{execute:s.removeExecutor.bind(s,C,u.startOffset,u.endOffset),onStart:function(){},onComplete:function(){s.hls.trigger(I.Events.BUFFER_FLUSHED,{type:C})},onError:function(h){P.logger.warn("[buffer-controller]: Failed to remove from "+C+" SourceBuffer",h)}}};u.type?w.append(g(u.type),u.type):this.getSourceBufferTypes().forEach(function(f){w.append(g(f),f)})},y.onFragParsed=function(o,u){var s=this,w=u.frag,g=u.part,f=[],C=g?g.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 m=function(){var c=self.performance.now();w.stats.buffering.end=c,g&&(g.stats.buffering.end=c);var l=g?g.stats:w.stats;s.hls.trigger(I.Events.FRAG_BUFFERED,{frag:w,part:g,stats:l,id:w.type})};f.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+w.type+" level: "+w.level+" sn: "+w.sn),this.blockBuffers(m,f)},y.onFragChanged=function(o,u){this.flushBackBuffer()},y.onBufferEos=function(o,u){var s=this,w=this.getSourceBufferTypes().reduce(function(g,f){var C=s.sourceBuffer[f];return(!u.type||u.type===f)&&(C&&!C.ended&&(C.ended=!0,P.logger.log("[buffer-controller]: "+f+" sourceBuffer now EOS"))),g&&!!(!C||C.ended)},!0);w&&this.blockBuffers(function(){var g=s.mediaSource;if(!g||g.readyState!=="open")return;g.endOfStream()})},y.onLevelUpdated=function(o,u){var s=u.details;if(!s.fragments.length)return;this.details=s,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},y.flushBackBuffer=function(){var o=this.hls,u=this.details,s=this.media,w=this.sourceBuffer;if(!s||u===null)return;var g=this.getSourceBufferTypes();if(!g.length)return;var f=u.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(G.isFiniteNumber)(f)||f<0)return;var C=s.currentTime,m=u.levelTargetDuration,h=Math.max(f,m),c=Math.floor(C/m)*m-h;g.forEach(function(l){var a=w[l];if(a){var v=U.BufferHelper.getBuffered(a);v.length>0&&c>v.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:l}))}})},y.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,u=this.hls,s=this.media,w=this.mediaSource,g=o.fragments[0].start+o.totalduration,f=s.duration,C=Object(G.isFiniteNumber)(w.duration)?w.duration:0;o.live&&u.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),w.duration=Infinity,this.updateSeekableRange(o)):(g>C&&g>f||!Object(G.isFiniteNumber)(f))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+g.toFixed(3)),w.duration=g)},y.updateSeekableRange=function(o){var u=this.mediaSource,s=o.fragments,w=s.length;if(w&&o.live&&u!==null&&u!==void 0&&u.setLiveSeekableRange){var g=Math.max(0,s[0].start),f=Math.max(g,g+o.totalduration);u.setLiveSeekableRange(g,f)}},y.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,u=this.operationQueue,s=this.pendingTracks,w=Object.keys(s).length;if(w&&!o||w===2){this.createSourceBuffers(s),this.pendingTracks={};var g=this.getSourceBufferTypes();if(g.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}g.forEach(function(f){u.executeNext(f)})}},y.createSourceBuffers=function(o){var u=this.sourceBuffer,s=this.mediaSource;if(!s)throw Error("createSourceBuffers called when mediaSource was null");var w=0;for(var g in o)if(!u[g]){var f=o[g];if(!f)throw Error("source buffer exists for track "+g+", however track does not");var C=f.levelCodec||f.codec,m=f.container+";codecs="+C;P.logger.log("[buffer-controller]: creating sourceBuffer("+m+")");try{var h=u[g]=s.addSourceBuffer(m),c=g;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[g]={buffer:h,codec:C,container:f.container,levelCodec:f.levelCodec,id:f.id},w++}catch(l){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+l.message),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:l,mimeType:m})}}w&&this.hls.trigger(I.Events.BUFFER_CREATED,{tracks:this.tracks})},y._onSBUpdateStart=function(o){var u=this.operationQueue,s=u.current(o);s.onStart()},y._onSBUpdateEnd=function(o){var u=this.operationQueue,s=u.current(o);s.onComplete(),u.shiftAndExecuteNext(o)},y._onSBUpdateError=function(o,u){P.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 s=this.operationQueue.current(o);s&&s.onError(u)},y.removeExecutor=function(o,u,s){var w=this.media,g=this.mediaSource,f=this.operationQueue,C=this.sourceBuffer,m=C[o];if(!w||!g||!m){P.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),f.shiftAndExecuteNext(o);return}var h=Object(G.isFiniteNumber)(w.duration)?w.duration:Infinity,c=Object(G.isFiniteNumber)(g.duration)?g.duration:Infinity,l=Math.max(0,u),a=Math.min(s,h,c);a>l?(P.logger.log("[buffer-controller]: Removing ["+l+","+a+"] from the "+o+" SourceBuffer"),console.assert(!m.updating,o+" sourceBuffer must not be updating"),m.remove(l,a)):f.shiftAndExecuteNext(o)},y.appendExecutor=function(o,u){var s=this.operationQueue,w=this.sourceBuffer,g=w[u];if(!g){P.logger.warn("[buffer-controller]: Attempting to append to the "+u+" SourceBuffer, but it does not exist"),s.shiftAndExecuteNext(u);return}g.ended=!1,console.assert(!g.updating,u+" sourceBuffer must not be updating"),g.appendBuffer(o)},y.blockBuffers=function(o,u){var s=this;if(u===void 0&&(u=this.getSourceBufferTypes()),!u.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var w=this.operationQueue,g=u.map(function(f){return w.appendBlocker(f)});Promise.all(g).then(function(){o(),u.forEach(function(f){var C=s.sourceBuffer[f];(!C||!C.updating)&&w.shiftAndExecuteNext(f)})})},y.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},y.addBufferListener=function(o,u,s){var w=this.sourceBuffer[o];if(!w)return;var g=s.bind(this,o);this.listeners[o].push({event:u,listener:g}),w.addEventListener(u,g)},y.removeBufferListeners=function(o){var u=this.sourceBuffer[o];if(!u)return;this.listeners[o].forEach(function(s){u.removeEventListener(s.event,s.listener)})},x}()},"./src/controller/buffer-operation-queue.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return I});var G=L("./src/utils/logger.ts"),I=function(){function P(U){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=U}var B=P.prototype;return B.append=function(k,A){var b=this.queues[A];b.push(k),b.length===1&&this.buffers[A]&&this.executeNext(A)},B.insertAbort=function(k,A){var b=this.queues[A];b.unshift(k),this.executeNext(A)},B.appendBlocker=function(k){var A,b=new Promise(function(O){A=O}),S={execute:A,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(S,k),b},B.executeNext=function(k){var A=this.buffers,b=this.queues,S=A[k],O=b[k];if(O.length){var _=O[0];try{_.execute()}catch(x){G.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]},P}()},"./src/controller/cap-level-controller.ts":function(re,z,L){"use strict";L.r(z);var G=L("./src/events.ts");function I(U,k){for(var A=0;A<k.length;A++){var b=k[A];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(U,b.key,b)}}function P(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(b){this.streamController=b},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 b=this.hls;b.on(G.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),b.on(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),b.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.on(G.Events.BUFFER_CODECS,this.onBufferCodecs,this),b.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.unregisterListener=function(){var b=this.hls;b.off(G.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),b.off(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),b.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.off(G.Events.BUFFER_CODECS,this.onBufferCodecs,this),b.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.onFpsDropLevelCapping=function(b,S){U.isLevelAllowed(S.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(S.droppedLevel)},k.onMediaAttaching=function(b,S){this.media=S.media instanceof HTMLVideoElement?S.media:null},k.onManifestParsed=function(b,S){var O=this.hls;this.restrictedLevels=[],this.firstLevel=S.firstLevel,O.config.capLevelToPlayerSize&&S.video&&this.startCapping()},k.onBufferCodecs=function(b,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 b=this.hls.levels;if(b.length){var S=this.hls;S.autoLevelCapping=this.getMaxLevel(b.length-1),S.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=S.autoLevelCapping}}},k.getMaxLevel=function(b){var S=this,O=this.hls.levels;if(!O.length)return-1;var _=O.filter(function(x,y){return U.isLevelAllowed(y,S.restrictedLevels)&&y<=b});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 b=this.media,S={width:0,height:0};if(b){var O=b.getBoundingClientRect();S.width=O.width,S.height=O.height,!S.width&&!S.height&&(S.width=O.right-O.left||b.width||0,S.height=O.bottom-O.top||b.height||0)}return this.clientRect=S,S},U.isLevelAllowed=function(b,S){return S===void 0&&(S=[]),S.indexOf(b)===-1},U.getMaxLevelByMediaSize=function(b,S,O){if(!b||!b.length)return-1;for(var _=function(u,s){return s?u.width!==s.width||u.height!==s.height:!0},x=b.length-1,y=0;y<b.length;y+=1){var d=b[y];if((d.width>=S||d.height>=O)&&_(d,b[y+1])){x=y;break}}return x},P(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 b=1;try{b=self.devicePixelRatio}catch(S){}return b}}]),U}();z.default=B},"./src/controller/cmcd-controller.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return _});var G=L("./src/events.ts"),I=L("./src/types/cmcd.ts"),P=L("./src/utils/buffer-helper.ts"),B=L("./src/utils/logger.ts");function U(x,y){for(var d=0;d<y.length;d++){var o=y[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(x,o.key,o)}}function k(x,y,d){return y&&U(x.prototype,y),d&&U(x,d),x}function A(x,y){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=b(x))||y&&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 b(x,y){if(!x)return;if(typeof x=="string")return S(x,y);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,y)}function S(x,y){(y==null||y>x.length)&&(y=x.length);for(var d=0,o=new Array(y);d<y;d++)o[d]=x[d];return o}function O(){return O=Object.assign||function(x){for(var y=1;y<arguments.length;y++){var d=arguments[y];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(g){B.logger.warn("Could not generate manifest CMCD data.",g)}},this.applyFragmentData=function(w){try{var g=w.frag,f=o.hls.levels[g.level],C=o.getObjectType(g),m={d:g.duration*1e3,ot:C};(C===I.CMCDObjectType.VIDEO||C===I.CMCDObjectType.AUDIO||C==I.CMCDObjectType.MUXED)&&(m.br=f.bitrate/1e3,m.tb=o.getTopBandwidth(C),m.bl=o.getBufferLength(C)),o.apply(w,m)}catch(h){B.logger.warn("Could not generate segment CMCD data.",h)}},this.hls=d;var u=this.config=d.config,s=u.cmcd;s!=null&&(u.pLoader=this.createPlaylistLoader(),u.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||x.uuid(),this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.registerListeners())}var y=x.prototype;return y.registerListeners=function(){var o=this.hls;o.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(G.Events.BUFFER_CREATED,this.onBufferCreated,this)},y.unregisterListeners=function(){var o=this.hls;o.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(G.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},y.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},y.onMediaAttached=function(o,u){this.media=u.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},y.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},y.onBufferCreated=function(o,u){var s,w;this.audioBuffer=(s=u.tracks.audio)===null||s===void 0?void 0:s.buffer,this.videoBuffer=(w=u.tracks.video)===null||w===void 0?void 0:w.buffer},y.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}},y.apply=function(o,u){u===void 0&&(u={}),O(u,this.createData());var s=u.ot===I.CMCDObjectType.INIT||u.ot===I.CMCDObjectType.VIDEO||u.ot===I.CMCDObjectType.MUXED;if(this.starved&&s&&(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 g=x.toQuery(u);if(!g)return;o.url=x.appendQueryToUri(o.url,g)}},y.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},y.getTopBandwidth=function(o){for(var u=0,s=o===I.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,w=A(s),g;!(g=w()).done;){var f=g.value;f.bitrate>u&&(u=f.bitrate)}return u>0?u:NaN},y.getBufferLength=function(o){var u=this.hls.media,s=o===I.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!s||!u)return NaN;var w=P.BufferHelper.bufferInfo(s,u.currentTime,this.config.maxBufferHole);return w.len*1e3},y.createPlaylistLoader=function(){var o=this.config.pLoader,u=this.applyPlaylistData,s=o||this.config.loader;return function(){function w(f){this.loader=void 0,this.loader=new s(f)}var g=w.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(C,m,h){u(C),this.loader.load(C,m,h)},k(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},y.createFragmentLoader=function(){var o=this.config.fLoader,u=this.applyFragmentData,s=o||this.config.loader;return function(){function w(f){this.loader=void 0,this.loader=new s(f)}var g=w.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(C,m,h){u(C),this.loader.load(C,m,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=[],s=function(F){return!Number.isNaN(F)&&F!=null&&F!==""&&F!==!1},w=function(F){return Math.round(F)},g=function(F){return w(F/100)*100},f=function(F){return encodeURIComponent(F)},C={br:w,d:w,bl:g,dl:g,mtp:g,nor:f,rtp:g,tb:w},m=Object.keys(o||{}).sort(),h=A(m),c;!(c=h()).done;){var l=c.value,a=o[l];if(!s(a))continue;if(l==="v"&&a===1)continue;if(l=="pr"&&a===1)continue;var v=C[l];v&&(a=v(a));var p=typeof a,E=void 0;l==="ot"||l==="sf"||l==="st"?E=l+"="+a:p==="boolean"?E=l:p==="number"?E=l+"="+a:E=l+"="+JSON.stringify(a),u.push(E)}return u.join(",")},x.toHeaders=function(o){for(var u=Object.keys(o),s={},w=["Object","Request","Session","Status"],g=[{},{},{},{}],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,m=u;C<m.length;C++){var h=m[C],c=f[h]!=null?f[h]:1;g[c][h]=o[h]}for(var l=0;l<g.length;l++){var a=x.serialize(g[l]);a&&(s["CMCD-"+w[l]]=a)}return s},x.toQuery=function(o){return"CMCD="+encodeURIComponent(x.serialize(o))},x.appendQueryToUri=function(o,u){if(!u)return o;var s=o.includes("?")?"&":"?";return""+o+s+u},x}()},"./src/controller/eme-controller.ts":function(re,z,L){"use strict";L.r(z);var G=L("./src/events.ts"),I=L("./src/errors.ts"),P=L("./src/utils/logger.ts"),B=L("./src/utils/mediakeys-helper.ts");function U(_,x){for(var y=0;y<x.length;y++){var d=x[y];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(_,d.key,d)}}function k(_,x,y){return x&&U(_.prototype,x),y&&U(_,y),_}var A=3,b=function(x,y,d){var o={audioCapabilities:[],videoCapabilities:[]};return x.forEach(function(u){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+u+'"',robustness:d.audioRobustness||""})}),y.forEach(function(u){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+u+'"',robustness:d.videoRobustness||""})}),[o]},S=function(x,y,d,o){switch(x){case B.KeySystems.WIDEVINE:return b(y,d,o);default:throw new Error("Unknown key-system: "+x)}},O=function(){function _(y){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=y,this._config=y.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(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this)},x._unregisterListeners=function(){this.hls.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(G.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 s=this,w=S(d,o,u,this._drmSystemOptions);P.logger.log("Requesting encrypted media key-system access");var g=this.requestMediaKeySystemAccess(d,w);this.mediaKeysPromise=g.then(function(f){return s._onMediaKeySystemAccessObtained(d,f)}),g.catch(function(f){P.logger.error('Failed to obtain key-system "'+d+'" access:',f)})},x._onMediaKeySystemAccessObtained=function(d,o){var u=this;P.logger.log('Access for key-system "'+d+'" obtained');var s={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:d};this._mediaKeysList.push(s);var w=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(g){return s.mediaKeys=g,P.logger.log('Media-keys created for key-system "'+d+'"'),u._onMediaKeysCreated(),g});return w.catch(function(g){P.logger.error("Failed to create media-keys:",g)}),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;P.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(u){o._onKeySessionMessage(d,u.message)},!1)},x._onKeySessionMessage=function(d,o){P.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(u){P.logger.log("Received license data (length: "+(u&&u.byteLength)+"), updating key-session"),d.update(u)})},x.onMediaEncrypted=function(d){var o=this;if(P.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(G.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){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}P.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},x._generateRequestWithPreferredKeySession=function(d,o){var u=this,s=this._mediaKeysList[0];if(!s){P.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(s.mediaKeysSessionInitialized){P.logger.warn("Key-Session already initialized but requested again");return}var w=s.mediaKeysSession;if(!w){P.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){P.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}P.logger.log('Generating key-session request for "'+d+'" init data type'),s.mediaKeysSessionInitialized=!0,w.generateRequest(d,o).then(function(){P.logger.debug("Key-session generation succeeded")}).catch(function(g){P.logger.error("Error generating key-session request:",g),u.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},x._createLicenseXhr=function(d,o,u){var s=new XMLHttpRequest;s.responseType="arraybuffer",s.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,s,d,o,u);var w=this._licenseXhrSetup;if(w)try{w.call(this.hls,s,d),w=void 0}catch(g){P.logger.error(g)}try{s.readyState||s.open("POST",d,!0),w&&w.call(this.hls,s,d)}catch(g){throw new Error("issue setting up KeySystem license XHR "+g)}return s},x._onLicenseRequestReadyStageChange=function(d,o,u,s){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,P.logger.log("License request succeeded");var w=d.response,g=this._licenseResponseCallback;if(g)try{w=g.call(this.hls,d,o)}catch(C){P.logger.error(C)}s(w)}else{if(P.logger.error("License Request XHR failed ("+o+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>A){this.hls.trigger(G.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;P.logger.warn("Retrying license request, "+f+" attempts left"),this._requestLicense(u,s)}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){P.logger.log("Requesting content license for key-system");var u=this._mediaKeysList[0];if(!u){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var s=this.getLicenseServerUrl(u.mediaKeySystemDomain),w=this._createLicenseXhr(s,d,o);P.logger.log("Sending license request to URL: "+s);var g=this._generateLicenseRequestChallenge(u,d);w.send(g)}catch(f){P.logger.error("Failure requesting DRM license: "+f),this.hls.trigger(G.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}),s=o.levels.map(function(w){return w.videoCodec}).filter(function(w){return!!w});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,u,s)},k(_,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),_}();z.default=O},"./src/controller/fps-controller.ts":function(re,z,L){"use strict";L.r(z);var G=L("./src/events.ts"),I=L("./src/utils/logger.ts"),P=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(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},U.unregisterListeners=function(){this.hls.off(G.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,b){var S=this.hls.config;if(S.capLevelOnFPSDrop){var O=b.media instanceof self.HTMLVideoElement?b.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,b,S){var O=performance.now();if(b){if(this.lastTime){var _=O-this.lastTime,x=S-this.lastDroppedFrames,y=b-this.lastDecodedFrames,d=1e3*x/_,o=this.hls;if(o.trigger(G.Events.FPS_DROP,{currentDropped:x,currentDecoded:y,totalDroppedFrames:S}),d>0&&x>o.config.fpsDroppedMonitoringThreshold*y){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(G.Events.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:o.currentLevel}),o.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=O,this.lastDroppedFrames=S,this.lastDecodedFrames=b}},U.checkFPSInterval=function(){var A=this.media;if(A)if(this.isVideoPlaybackQualityAvailable){var b=A.getVideoPlaybackQuality();this.checkFPS(A,b.totalVideoFrames,b.droppedVideoFrames)}else this.checkFPS(A,A.webkitDecodedFrameCount,A.webkitDroppedFrameCount)},B}();z.default=P},"./src/controller/fragment-finders.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"findFragmentByPDT",function(){return P}),L.d(z,"findFragmentByPTS",function(){return B}),L.d(z,"fragmentWithinToleranceTest",function(){return U}),L.d(z,"pdtWithinToleranceTest",function(){return k}),L.d(z,"findFragWithCC",function(){return A});var G=L("./src/polyfills/number.ts"),I=L("./src/utils/binary-search.ts");function P(b,S,O){if(S===null||!Array.isArray(b)||!b.length||!Object(G.isFiniteNumber)(S))return null;var _=b[0].programDateTime;if(S<(_||0))return null;var x=b[b.length-1].endProgramDateTime;if(S>=(x||0))return null;O=O||0;for(var y=0;y<b.length;++y){var d=b[y];if(k(S,O,d))return d}return null}function B(b,S,O,_){O===void 0&&(O=0),_===void 0&&(_=0);var x=null;if(b?x=S[b.sn-S[0].sn+1]||null:O===0&&S[0].start===0&&(x=S[0]),x&&U(O,_,x)===0)return x;var y=I.default.search(S,U.bind(null,O,_));return y||x}function U(b,S,O){b===void 0&&(b=0),S===void 0&&(S=0);var _=Math.min(S,O.duration+(O.deltaPTS?O.deltaPTS:0));return O.start+O.duration-_<=b?1:O.start-_>b&&O.start?-1:0}function k(b,S,O){var _=Math.min(S,O.duration+(O.deltaPTS?O.deltaPTS:0))*1e3,x=O.endProgramDateTime||0;return x-_>b}function A(b,S){return I.default.search(b,function(O){return O.cc<S?1:O.cc>S?-1:0})}},"./src/controller/fragment-tracker.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"FragmentState",function(){return P}),L.d(z,"FragmentTracker",function(){return B});var G=L("./src/events.ts"),I=L("./src/types/loader.ts"),P;(function(A){A.NOT_LOADED="NOT_LOADED",A.BACKTRACKED="BACKTRACKED",A.APPENDING="APPENDING",A.PARTIAL="PARTIAL",A.OK="OK"})(P||(P={}));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 b=A.prototype;return b._registerListeners=function(){var O=this.hls;O.on(G.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.on(G.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.on(G.Events.FRAG_LOADED,this.onFragLoaded,this)},b._unregisterListeners=function(){var O=this.hls;O.off(G.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.off(G.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.off(G.Events.FRAG_LOADED,this.onFragLoaded,this)},b.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},b.getAppendedFrag=function(O,_){if(_===I.PlaylistLevelType.MAIN){var x=this.activeFragment,y=this.activeParts;if(!x)return null;if(y)for(var d=y.length;d--;){var o=y[d],u=o?o.end:x.appendedPTS;if(o.start<=O&&u!==void 0&&O<=u)return d>9&&(this.activeParts=y.slice(d-9)),o}else if(x.start<=O&&x.appendedPTS!==void 0&&O<=x.appendedPTS)return x}return this.getBufferedFrag(O,_)},b.getBufferedFrag=function(O,_){for(var x=this.fragments,y=Object.keys(x),d=y.length;d--;){var o=x[y[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},b.detectEvictedFragments=function(O,_,x){var y=this;Object.keys(this.fragments).forEach(function(d){var o=y.fragments[d];if(!o)return;if(!o.buffered){o.body.type===x&&y.removeFragment(o.body);return}var u=o.range[O];if(!u)return;u.time.some(function(s){var w=!y.isTimeBuffered(s.startPTS,s.endPTS,_);return w&&y.removeFragment(o.body),w})})},b.detectPartialFragments=function(O){var _=this,x=this.timeRanges,y=O.frag,d=O.part;if(!x||y.sn==="initSegment")return;var o=k(y),u=this.fragments[o];if(!u)return;Object.keys(x).forEach(function(s){var w=y.elementaryStreams[s];if(!w)return;var g=x[s],f=d!==null||w.partial===!0;u.range[s]=_.getBufferedTimes(y,d,f,g)}),u.backtrack=u.loaded=null,Object.keys(u.range).length?u.buffered=!0:this.removeFragment(u.body)},b.fragBuffered=function(O){var _=k(O),x=this.fragments[_];x&&(x.backtrack=x.loaded=null,x.buffered=!0)},b.getBufferedTimes=function(O,_,x,y){for(var d={time:[],partial:x},o=_?_.start:O.start,u=_?_.end:O.end,s=O.minEndPTS||u,w=O.maxStartPTS||o,g=0;g<y.length;g++){var f=y.start(g)-this.bufferPadding,C=y.end(g)+this.bufferPadding;if(w>=f&&s<=C){d.time.push({startPTS:Math.max(o,y.start(g)),endPTS:Math.min(u,y.end(g))});break}else if(o<C&&u>f)d.partial=!0,d.time.push({startPTS:Math.max(o,y.start(g)),endPTS:Math.min(u,y.end(g))});else if(u<=f)break}return d},b.getPartialFragment=function(O){var _=null,x,y,d,o=0,u=this.bufferPadding,s=this.fragments;return Object.keys(s).forEach(function(w){var g=s[w];if(!g)return;U(g)&&(y=g.body.start-u,d=g.body.end+u,O>=y&&O<=d&&(x=Math.min(O-y,d-O),o<=x&&(_=g.body,o=x)))}),_},b.getState=function(O){var _=k(O),x=this.fragments[_];return x?x.buffered?U(x)?P.PARTIAL:P.OK:x.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},b.backtrack=function(O,_){var x=k(O),y=this.fragments[x];if(!y||y.backtrack)return null;var d=y.backtrack=_||y.loaded;return y.loaded=null,d},b.getBacktrackData=function(O){var _=k(O),x=this.fragments[_];if(x){var y,d=x.backtrack;if(d!=null&&(y=d.payload)!==null&&y!==void 0&&y.byteLength)return d;this.removeFragment(O)}return null},b.isTimeBuffered=function(O,_,x){for(var y,d,o=0;o<x.length;o++){if(y=x.start(o)-this.bufferPadding,d=x.end(o)+this.bufferPadding,O>=y&&_<=d)return!0;if(_<=y)return!1}return!1},b.onFragLoaded=function(O,_){var x=_.frag,y=_.part;if(x.sn==="initSegment"||x.bitrateTest||y)return;var d=k(x);this.fragments[d]={body:x,loaded:_,backtrack:null,buffered:!1,range:Object.create(null)}},b.onBufferAppended=function(O,_){var x=this,y=_.frag,d=_.part,o=_.timeRanges;if(y.type===I.PlaylistLevelType.MAIN)if(this.activeFragment=y,d){var u=this.activeParts;u||(this.activeParts=u=[]),u.push(d)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(s){var w=o[s];if(x.detectEvictedFragments(s,w),!d)for(var g=0;g<w.length;g++)y.appendedPTS=Math.max(w.end(g),y.appendedPTS||0)})},b.onFragBuffered=function(O,_){this.detectPartialFragments(_)},b.hasFragment=function(O){var _=k(O);return!!this.fragments[_]},b.removeFragmentsInRange=function(O,_,x){var y=this;Object.keys(this.fragments).forEach(function(d){var o=y.fragments[d];if(!o)return;if(o.buffered){var u=o.body;u.type===x&&u.start<_&&u.end>O&&y.removeFragment(u)}})},b.removeFragment=function(O){var _=k(O);O.stats.loaded=0,O.clearElementaryStreamInfo(),delete this.fragments[_]},b.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},A}();function U(A){var b,S;return A.buffered&&(((b=A.range.video)===null||b===void 0?void 0:b.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,z,L){"use strict";L.r(z),L.d(z,"STALL_MINIMUM_DURATION_MS",function(){return U}),L.d(z,"MAX_START_GAP_JUMP",function(){return k}),L.d(z,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return A}),L.d(z,"SKIP_BUFFER_RANGE_START",function(){return b}),L.d(z,"default",function(){return S});var G=L("./src/utils/buffer-helper.ts"),I=L("./src/errors.ts"),P=L("./src/events.ts"),B=L("./src/utils/logger.ts"),U=250,k=2,A=.1,b=.05,S=function(){function O(x,y,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=y,this.fragmentTracker=d,this.hls=o}var _=O.prototype;return _.destroy=function(){this.hls=this.fragmentTracker=this.media=null},_.poll=function(y){var d=this.config,o=this.media,u=this.stalled,s=o.currentTime,w=o.seeking,g=this.seeking&&!w,f=!this.seeking&&w;if(this.seeking=w,s!==y){if(this.moved=!0,u!==null){if(this.stallReported){var C=self.performance.now()-u;B.logger.warn("playback not stuck anymore @"+s+", after "+Math.round(C)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((f||g)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!G.BufferHelper.getBuffered(o).length)return;var m=G.BufferHelper.bufferInfo(o,s,0),h=m.len>0,c=m.nextStart||0;if(!h&&!c)return;if(w){var l=m.len>k,a=!c||c-s>k&&!this.fragmentTracker.getPartialFragment(s);if(l||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var v,p=Math.max(c,m.start||0)-s,E=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,M=E==null||((v=E.details)===null||v===void 0)?void 0:v.live,F=M?E.details.targetduration*2:k;if(p>0&&p<=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(m.len);var D=G.BufferHelper.bufferInfo(o,s,d.maxBufferHole);this._tryFixBufferStall(D,W)},_._tryFixBufferStall=function(y,d){var o=this.config,u=this.fragmentTracker,s=this.media,w=s.currentTime,g=u.getPartialFragment(w);if(g){var f=this._trySkipBufferHole(g);if(f)return}y.len>o.maxBufferHole&&d>o.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},_._reportStall=function(y){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="+y+")"),d.trigger(P.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:y}))},_._trySkipBufferHole=function(y){for(var d=this.config,o=this.hls,u=this.media,s=u.currentTime,w=0,g=G.BufferHelper.getBuffered(u),f=0;f<g.length;f++){var C=g.start(f);if(s+d.maxBufferHole>=w&&s<C){var m=Math.max(C+b,u.currentTime+A);return B.logger.warn("skipping hole, adjusting currentTime from "+s+" to "+m),this.moved=!0,this.stalled=null,u.currentTime=m,y&&o.trigger(P.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+s+" to "+m,frag:y}),m}w=g.end(f)}return 0},_._tryNudgeBuffer=function(){var y=this.config,d=this.hls,o=this.media,u=o.currentTime,s=(this.nudgeRetry||0)+1;if(this.nudgeRetry=s,s<y.nudgeMaxRetry){var w=u+s*y.nudgeOffset;B.logger.warn("Nudging 'currentTime' from "+u+" to "+w),o.currentTime=w,d.trigger(P.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 "+y.nudgeMaxRetry+" nudges"),d.trigger(P.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},O}()},"./src/controller/id3-track-controller.ts":function(re,z,L){"use strict";L.r(z);var G=L("./src/events.ts"),I=L("./src/utils/texttrack-utils.ts"),P=L("./src/demux/id3.ts"),B=.25,U=function(){function k(b){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=b,this._registerListeners()}var A=k.prototype;return A.destroy=function(){this._unregisterListeners()},A._registerListeners=function(){var S=this.hls;S.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.on(G.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),S.on(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},A._unregisterListeners=function(){var S=this.hls;S.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.off(G.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),S.off(G.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 y=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<x.length;d++){var o=P.getID3Frames(x[d].data);if(o){var u=x[d].pts,s=d<x.length-1?x[d+1].pts:_.end,w=s-u;w<=0&&(s=u+B);for(var g=0;g<o.length;g++){var f=o[g];if(!P.isTimeStampFrame(f)){var C=new y(u,s,"");C.value=f,this.id3Track.addCue(C)}}}}},A.onBufferFlushing=function(S,O){var _=O.startOffset,x=O.endOffset,y=O.type;if(!y||y==="audio"){var d=this.id3Track;d&&Object(I.removeCuesInRange)(d,_,x)}},k}();z.default=U},"./src/controller/latency-controller.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return k});var G=L("./src/errors.ts"),I=L("./src/events.ts"),P=L("./src/utils/logger.ts");function B(A,b){for(var S=0;S<b.length;S++){var O=b[S];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(A,O.key,O)}}function U(A,b,S){return b&&B(A.prototype,b),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 b=A.prototype;return b.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},b.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)},b.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)},b.onMediaAttached=function(O,_){this.media=_.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},b.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},b.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},b.onLevelUpdated=function(O,_){var x=_.details;this.levelDetails=x,x.advanced&&this.timeupdate(),!x.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},b.onError=function(O,_){if(_.details!==G.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,P.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},b.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 y=this.config,d=y.lowLatencyMode,o=y.maxLiveSyncPlaybackRate;if(!d||o===1)return;var u=this.targetLatency;if(u===null)return;var s=x-u,w=Math.min(this.maxLatency,u+_.targetduration),g=s<w;if(_.live&&g&&s>.05&&this.forwardBufferLength>1){var f=Math.min(2,Math.max(1,o)),C=Math.round(2/(1+Math.exp(-.75*s-this.edgeStalled))*20)/20;O.playbackRate=Math.min(f,Math.max(1,C))}else O.playbackRate!==1&&O.playbackRate!==0&&(O.playbackRate=1)},b.estimateLiveEdge=function(){var O=this.levelDetails;return O===null?null:O.edge+O.age},b.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,y=O.targetduration,d=this.config,o=d.liveSyncDuration,u=d.liveSyncDurationCount,s=d.lowLatencyMode,w=this.hls.userConfig,g=s&&x||_;(w.liveSyncDuration||w.liveSyncDurationCount||g===0)&&(g=o!==void 0?o:u*y);var f=y,C=1;return g+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 y=x.edge,d=O-_-this.edgeStalled,o=y-x.totalduration,u=y-(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,z,L){"use strict";L.r(z),L.d(z,"default",function(){return d});var G=L("./src/types/level.ts"),I=L("./src/events.ts"),P=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 b(){return b=Object.assign||function(o){for(var u=1;u<arguments.length;u++){var s=arguments[u];for(var w in s)Object.prototype.hasOwnProperty.call(s,w)&&(o[w]=s[w])}return o},b.apply(this,arguments)}function S(o,u){for(var s=0;s<u.length;s++){var w=u[s];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function O(o,u,s){return u&&S(o.prototype,u),s&&S(o,s),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,g){return w.__proto__=g,w},x(o,u)}var y=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(o){_(u,o);function u(w){var g;return g=o.call(this,w,"[level-controller]")||this,g._levels=[],g._firstLevel=-1,g._startLevel=void 0,g.currentLevelIndex=-1,g.manualLevelIndex=-1,g.onParsedComplete=void 0,g._registerListeners(),g}var s=u.prototype;return s._registerListeners=function(){var g=this.hls;g.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.on(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),g.on(I.Events.ERROR,this.onError,this)},s._unregisterListeners=function(){var g=this.hls;g.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.off(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),g.off(I.Events.ERROR,this.onError,this)},s.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},s.startLoad=function(){var g=this._levels;g.forEach(function(f){f.loadError=0}),o.prototype.startLoad.call(this)},s.onManifestLoaded=function(g,f){var C=[],m=[],h=[],c,l={},a,v=!1,p=!1,E=!1;if(f.levels.forEach(function(W){var D=W.attrs;v=v||!!(W.width&&W.height),p=p||!!W.videoCodec,E=E||!!W.audioCodec,y&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var R=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;a=l[R],a?a.url.push(W.url):(a=new G.Level(W),l[R]=a,C.push(a)),D&&(D.AUDIO&&Object(U.addGroupId)(a,"audio",D.AUDIO),D.SUBTITLES&&Object(U.addGroupId)(a,"text",D.SUBTITLES))}),(v||p)&&E&&(C=C.filter(function(W){var D=W.videoCodec,R=W.width,H=W.height;return!!D||!!(R&&H)})),C=C.filter(function(W){var D=W.audioCodec,R=W.videoCodec;return(!D||Object(B.isCodecSupportedInMp4)(D,"audio"))&&(!R||Object(B.isCodecSupportedInMp4)(R,"video"))}),f.audioTracks&&(m=f.audioTracks.filter(function(W){return!W.audioCodec||Object(B.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(U.assignTrackIdsByGroup)(m)),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&&!p,j={levels:C,audioTracks:m,subtitleTracks:h,firstLevel:this._firstLevel,stats:f.stats,audio:E,video:p,altAudio:!F&&m.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:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:f.url,reason:"no level with compatible codecs found in manifest"})},s.onError=function(g,f){if(o.prototype.onError.call(this,g,f),f.fatal)return;var C=f.context,m=this._levels[this.currentLevelIndex];if(C&&(C.type===A.PlaylistContextType.AUDIO_TRACK&&m.audioGroupIds&&C.groupId===m.audioGroupIds[m.urlId]||C.type===A.PlaylistContextType.SUBTITLE_TRACK&&m.textGroupIds&&C.groupId===m.textGroupIds[m.urlId])){this.redundantFailover(this.currentLevelIndex);return}var h=!1,c=!0,l;switch(f.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:if(f.frag){var a=this._levels[f.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(l=f.frag.level)):l=f.frag.level}break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:C&&(C.deliveryDirectives&&(c=!1),l=C.level),h=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:l=f.level,h=!0;break}l!==void 0&&this.recoverLevel(f,l,h,c)},s.recoverLevel=function(g,f,C,m){var h=g.details,c=this._levels[f];if(c.loadError++,C){var l=this.retryLoadingOrFail(g);if(l)g.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(m){var a=c.url.length;if(a>1&&c.loadError<a)g.levelRetry=!0,this.redundantFailover(f);else if(this.manualLevelIndex===-1){var v=f===0?this._levels.length-1:f-1;this.currentLevelIndex!==v&&this._levels[v].loadError===0&&(this.warn(h+": switch to "+v),g.levelRetry=!0,this.hls.nextAutoLevel=v)}}},s.redundantFailover=function(g){var f=this._levels[g],C=f.url.length;if(C>1){var m=(f.urlId+1)%C;this.warn("Switching to redundant URL-id "+m),this._levels.forEach(function(h){h.urlId=m}),this.level=g}},s.onFragLoaded=function(g,f){var C=f.frag;if(C!==void 0&&C.type===A.PlaylistLevelType.MAIN){var m=this._levels[C.level];m!==void 0&&(m.fragmentError=0,m.loadError=0)}},s.onLevelLoaded=function(g,f){var C,m=f.level,h=f.details,c=this._levels[m];if(!c){var l;this.warn("Invalid level index "+m),(l=f.deliveryDirectives)!==null&&l!==void 0&&l.skip&&(h.deltaUpdateFailed=!0);return}m===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(m,f,c.details)):(C=f.deliveryDirectives)!==null&&C!==void 0&&C.skip&&(h.deltaUpdateFailed=!0)},s.onAudioTrackSwitched=function(g,f){var C=this.hls.levels[this.currentLevelIndex];if(!C)return;if(C.audioGroupIds){for(var m=-1,h=this.hls.audioTracks[f.id].groupId,c=0;c<C.audioGroupIds.length;c++)if(C.audioGroupIds[c]===h){m=c;break}m!==C.urlId&&(C.urlId=m,this.startLoad())}},s.loadPlaylist=function(g){var f=this.currentLevelIndex,C=this._levels[f];if(this.canLoad&&C&&C.url.length>0){var m=C.urlId,h=C.url[m];if(g)try{h=g.addDirectives(h)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+f+(g?" at sn "+g.msn+" part "+g.part:"")+" with URL-id "+m+" "+h),this.clearTimer(),this.hls.trigger(I.Events.LEVEL_LOADING,{url:h,level:f,id:m,deliveryDirectives:g||null})}},s.removeLevel=function(g,f){var C=function(c,l){return l!==f},m=this._levels.filter(function(h,c){return c!==g?!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 l=h.details;return l!=null&&l.fragments&&l.fragments.forEach(function(a){a.level=c}),h});this._levels=m,this.hls.trigger(I.Events.LEVELS_UPDATED,{levels:m})},O(u,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(g){var f,C=this._levels;if(C.length===0)return;if(this.currentLevelIndex===g&&(f=C[g])!==null&&f!==void 0&&f.details)return;if(g<0||g>=C.length){var m=g<0;if(this.hls.trigger(I.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:g,fatal:m,reason:"invalid level idx"}),m)return;g=Math.min(g,C.length-1)}this.clearTimer();var h=this.currentLevelIndex,c=C[h],l=C[g];this.log("switching to level "+g+" from "+h),this.currentLevelIndex=g;var a=b({},l,{level:g,maxBitrate:l.maxBitrate,uri:l.uri,urlId:l.urlId});delete a._urlId,this.hls.trigger(I.Events.LEVEL_SWITCHING,a);var v=l.details;if(!v||v.live){var p=this.switchParams(l.uri,c==null?void 0:c.details);this.loadPlaylist(p)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(g){this.manualLevelIndex=g,this._startLevel===void 0&&(this._startLevel=g),g!==-1&&(this.level=g)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(g){this._firstLevel=g}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var g=this.hls.config.startLevel;return g!==void 0?g:this._firstLevel}else return this._startLevel},set:function(g){this._startLevel=g}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(g){this.level=g,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=g)}}]),u}(k.default)},"./src/controller/level-helper.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"addGroupId",function(){return P}),L.d(z,"assignTrackIdsByGroup",function(){return B}),L.d(z,"updatePTS",function(){return U}),L.d(z,"updateFragPTSDTS",function(){return A}),L.d(z,"mergeDetails",function(){return b}),L.d(z,"mapPartIntersection",function(){return S}),L.d(z,"mapFragmentIntersection",function(){return O}),L.d(z,"adjustSliding",function(){return _}),L.d(z,"addSliding",function(){return x}),L.d(z,"computeReloadInterval",function(){return y}),L.d(z,"getFragmentWithSN",function(){return d}),L.d(z,"getPartWith",function(){return o});var G=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts");function P(u,s,w){switch(s){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 s={};u.forEach(function(w){var g=w.groupId||"";w.id=s[g]=s[g]||0,s[g]++})}function U(u,s,w){var g=u[s],f=u[w];k(g,f)}function k(u,s){var w=s.startPTS;if(Object(G.isFiniteNumber)(w)){var g=0,f;s.sn>u.sn?(g=w-u.start,f=u):(g=u.start-w,f=s),f.duration!==g&&(f.duration=g)}else if(s.sn>u.sn){var C=u.cc===s.cc;C&&u.minEndPTS?s.start=u.start+(u.minEndPTS-u.start):s.start=u.start+u.duration}else s.start=Math.max(u.start-s.duration,0)}function A(u,s,w,g,f,C){var m=g-w;m<=0&&(I.logger.warn("Fragment should have a positive duration",s),g=w+s.duration,C=f+s.duration);var h=w,c=g,l=s.startPTS,a=s.endPTS;if(Object(G.isFiniteNumber)(l)){var v=Math.abs(l-w);Object(G.isFiniteNumber)(s.deltaPTS)?s.deltaPTS=Math.max(v,s.deltaPTS):s.deltaPTS=v,h=Math.max(w,l),w=Math.min(w,l),f=Math.min(f,s.startDTS),c=Math.min(g,a),g=Math.max(g,a),C=Math.max(C,s.endDTS)}s.duration=g-w;var p=w-s.start;s.appendedPTS=g,s.start=s.startPTS=w,s.maxStartPTS=h,s.startDTS=f,s.endPTS=g,s.minEndPTS=c,s.endDTS=C;var E=s.sn;if(!u||E<u.startSN||E>u.endSN)return 0;var M,F=E-u.startSN,j=u.fragments;for(j[F]=s,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,p}function b(u,s){for(var w=null,g=u.fragments,f=g.length-1;f>=0;f--){var C=g[f].initSegment;if(C){w=C;break}}u.fragmentHint&&delete u.fragmentHint.endPTS;var m=0,h;if(O(u,s,function(M,F){M.relurl&&(m=M.cc-F.cc),Object(G.isFiniteNumber)(M.startPTS)&&Object(G.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),s.PTSKnown=s.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=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.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(s.skippedSegments&&(s.deltaUpdateFailed=s.fragments.some(function(M){return!M}),s.deltaUpdateFailed)){I.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var l=s.skippedSegments;l--;)s.fragments.shift();s.startSN=s.fragments[0].sn,s.startCC=s.fragments[0].cc}var a=s.fragments;if(m){I.logger.warn("discontinuity sliding from playlist, take drift into account");for(var v=0;v<a.length;v++)a[v].cc+=m}s.skippedSegments&&(s.startCC=s.fragments[0].cc),S(u.partList,s.partList,function(M,F){F.elementaryStreams=M.elementaryStreams,F.stats=M.stats}),h?A(s,h,h.startPTS,h.endPTS,h.startDTS,h.endDTS):_(u,s),a.length&&(s.totalduration=s.edge-a[0].start),s.driftStartTime=u.driftStartTime,s.driftStart=u.driftStart;var p=s.advancedDateTime;if(s.advanced&&p){var E=s.edge;s.driftStart||(s.driftStartTime=p,s.driftStart=E),s.driftEndTime=p,s.driftEnd=E}else s.driftEndTime=u.driftEndTime,s.driftEnd=u.driftEnd,s.advancedDateTime=u.advancedDateTime}function S(u,s,w){if(u&&s)for(var g=0,f=0,C=u.length;f<=C;f++){var m=u[f],h=s[f+g];m&&h&&m.index===h.index&&m.fragment.sn===h.fragment.sn?w(m,h):g--}}function O(u,s,w){for(var g=s.skippedSegments,f=Math.max(u.startSN,s.startSN)-s.startSN,C=(u.fragmentHint?1:0)+(g?s.endSN:Math.min(u.endSN,s.endSN))-s.startSN,m=s.startSN-u.startSN,h=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,c=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,l=f;l<=C;l++){var a=c[m+l],v=h[l];g&&!v&&l<g&&(v=s.fragments[l]=a),a&&v&&w(a,v)}}function _(u,s){var w=s.startSN+s.skippedSegments-u.startSN,g=u.fragments;if(w<0||w>=g.length)return;x(s,g[w].start)}function x(u,s){if(s){for(var w=u.fragments,g=u.skippedSegments;g<w.length;g++)w[g].start+=s;u.fragmentHint&&(u.fragmentHint.start+=s)}}function y(u,s){var w=1e3*u.levelTargetDuration,g=w/2,f=u.age,C=f>0&&f<w*3,m=s.loading.end-s.loading.start,h,c=u.availabilityDelay;if(u.updated===!1)if(C){var l=333*u.misses;h=Math.max(Math.min(g,m*2),l),u.availabilityDelay=(u.availabilityDelay||0)+h}else h=g;else C?(c=Math.min(c||w/2,f),u.availabilityDelay=c,h=c+w-f):h=w-m;return Math.round(h)}function d(u,s,w){if(!u||!u.details)return null;var g=u.details,f=g.fragments[s-g.startSN];return f||(f=g.fragmentHint,f&&f.sn===s?f:s<g.startSN&&w&&w.sn===s?w:null)}function o(u,s,w){if(!u||!u.details)return null;var g=u.details.partList;if(g)for(var f=g.length;f--;){var C=g[f];if(C.index===w&&C.fragment.sn===s)return C}return null}},"./src/controller/stream-controller.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return g});var G=L("./src/polyfills/number.ts"),I=L("./src/controller/base-stream-controller.ts"),P=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"),b=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"),y=L("./src/utils/logger.ts");function d(f,C){for(var m=0;m<C.length;m++){var h=C[m];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(f,h.key,h)}}function o(f,C,m){return C&&d(f.prototype,C),m&&d(f,m),f}function u(f,C){f.prototype=Object.create(C.prototype),f.prototype.constructor=f,s(f,C)}function s(f,C){return s=Object.setPrototypeOf||function(h,c){return h.__proto__=c,h},s(f,C)}var w=100,g=function(f){u(C,f);function C(h,c){var l;return l=f.call(this,h,c,"[stream-controller]")||this,l.audioCodecSwap=!1,l.gapController=null,l.level=-1,l._forceStartLoad=!1,l.altAudio=!1,l.audioOnly=!1,l.fragPlaying=null,l.onvplaying=null,l.onvseeked=null,l.fragLastKbps=0,l.stalled=!1,l.couldBacktrack=!1,l.audioCodecSwitch=!1,l.videoBuffer=null,l._registerListeners(),l}var m=C.prototype;return m._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)},m._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)},m.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},m.startLoad=function(c){if(this.levels){var l=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(w),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var v=a.startLevel;v===-1&&(a.config.testBandwidth?(v=0,this.bitrateTest=!0):v=a.nextAutoLevel),this.level=a.nextLoadLevel=v,this.loadedmetadata=!1}l>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+l.toFixed(3)),c=l),this.state=I.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=I.State.STOPPED},m.stopLoad=function(){this._forceStartLoad=!1,f.prototype.stopLoad.call(this)},m.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_LEVEL:{var c,l=this.levels,a=this.level,v=l==null||((c=l[a])===null||c===void 0)?void 0:c.details;if(v&&(!v.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(v))break;this.state=I.State.IDLE;break}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var p,E=self.performance.now(),M=this.retryDate;(!M||E>=M||(p=this.media)!==null&&p!==void 0&&p.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=I.State.IDLE)}break;default:break}this.onTickEnd()},m.onTickEnd=function(){f.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},m.doTickIdle=function(){var c,l,a=this.hls,v=this.levelLastLoaded,p=this.levels,E=this.media,M=a.config,F=a.nextLoadLevel;if(v===null||!E&&(this.startFragRequested||!M.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!p||!p[F])return;var j=p[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 R=D.len,H=this.getMaxBufferLength(j.maxBitrate);if(R>=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?b.ElementaryStreamTypes.AUDIO:b.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"&&!((l=oe.decryptdata)!==null&&l!==void 0&&l.key)?this.loadKey(oe,W):this.loadFragment(oe,W,ee)},m.loadFragment=function(c,l,a){var v,p=this.fragmentTracker.getState(c);if(this.fragCurrent=c,p===k.FragmentState.BACKTRACKED){var E=this.fragmentTracker.getBacktrackData(c);if(E){this._handleFragmentLoadProgress(E),this._handleFragmentLoadComplete(E);return}else p=k.FragmentState.NOT_LOADED}p===k.FragmentState.NOT_LOADED||p===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,l,a)):p===k.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((v=this.media)===null||v===void 0?void 0:v.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},m.getAppendedFrag=function(c){var l=this.fragmentTracker.getAppendedFrag(c,A.PlaylistLevelType.MAIN);return l&&"fragment"in l?l.fragment:l},m.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,A.PlaylistLevelType.MAIN)},m.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},m.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},m.nextLevelSwitch=function(){var c=this.levels,l=this.media;if(l!=null&&l.readyState){var a,v=this.getAppendedFrag(l.currentTime);if(v&&v.start>1&&this.flushMainBuffer(0,v.start-1),!l.paused&&c){var p=this.hls.nextLoadLevel,E=c[p],M=this.fragLastKbps;M&&this.fragCurrent?a=this.fragCurrent.duration*E.maxBitrate/(1e3*M)+1:a=0}else a=0;var F=this.getBufferedFrag(l.currentTime+a);if(F){var j=this.followingBufferedFrag(F);if(j){this.abortCurrentFrag();var W=j.maxStartPTS?j.maxStartPTS:j.start,D=j.duration,R=Math.max(F.end,W+Math.min(Math.max(D-this.config.maxFragLookUpTolerance,D*.5),D*.75));this.flushMainBuffer(R,Number.POSITIVE_INFINITY)}}}},m.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()},m.flushMainBuffer=function(c,l){f.prototype.flushMainBuffer.call(this,c,l,this.altAudio?"video":null)},m.onMediaAttached=function(c,l){f.prototype.onMediaAttached.call(this,c,l);var a=l.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)},m.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)},m.onMediaPlaying=function(){this.tick()},m.onMediaSeeked=function(){var c=this.media,l=c?c.currentTime:null;Object(G.isFiniteNumber)(l)&&this.log("Media seeked to "+l.toFixed(3)),this.tick()},m.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},m.onManifestParsed=function(c,l){var a=!1,v=!1,p;l.levels.forEach(function(E){p=E.audioCodec,p&&(p.indexOf("mp4a.40.2")!==-1&&(a=!0),p.indexOf("mp4a.40.5")!==-1&&(v=!0))}),this.audioCodecSwitch=a&&v&&!Object(P.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=l.levels,this.startFragRequested=!1},m.onLevelLoading=function(c,l){var a=this.levels;if(!a||this.state!==I.State.IDLE)return;var v=a[l.level];(!v.details||v.details.live&&this.levelLastLoaded!==l.level||this.waitForCdnTuneIn(v.details))&&(this.state=I.State.WAITING_LEVEL)},m.onLevelLoaded=function(c,l){var a,v=this.levels,p=l.level,E=l.details,M=E.totalduration;if(!v){this.warn("Levels were reset while loading level "+p);return}this.log("Level "+p+" 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!==l.level&&F.loader&&(this.state=I.State.IDLE,F.loader.abort()));var j=v[p],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=p,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:E,level:p}),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()},m._handleFragmentLoadProgress=function(c){var l,a=c.frag,v=c.part,p=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=(l=a.initSegment)===null||l===void 0?void 0:l.data,R=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=v?v.index:-1,ee=Y!==-1,oe=new O.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,p.byteLength,Y,ee),Te=this.initPTS[a.cc];H.push(p,D,R,j,a,v,F.totalduration,W,oe,Te)},m.onAudioTrackSwitching=function(c,l){var a=this.altAudio,v=!!l.url,p=l.id;if(!v){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:p})}},m.onAudioTrackSwitched=function(c,l){var a=l.id,v=!!this.hls.audioTracks[a].url;if(v){var p=this.videoBuffer;p&&this.mediaBuffer!==p&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=p)}this.altAudio=v,this.tick()},m.onBufferCreated=function(c,l){var a=l.tracks,v,p,E=!1;for(var M in a){var F=a[M];if(F.id==="main"){if(p=M,v=F,M==="video"){var j=a[M];j&&(this.videoBuffer=j.buffer)}}else E=!0}E&&v?(this.log("Alternate track found, use "+p+".buffered to schedule main fragment loading"),this.mediaBuffer=v.buffer):this.mediaBuffer=this.media},m.onFragBuffered=function(c,l){var a=l.frag,v=l.part;if(a&&a.type!==A.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(v?" p: "+v.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 p=v?v.stats:a.stats;this.fragLastKbps=Math.round(8*p.total/(p.buffering.end-p.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,v)},m.onError=function(c,l){switch(l.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,l);break;case x.ErrorDetails.LEVEL_LOAD_ERROR:case x.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==I.State.ERROR&&(l.fatal?(this.warn(""+l.details),this.state=I.State.ERROR):!l.levelRetry&&this.state===I.State.WAITING_LEVEL&&(this.state=I.State.IDLE));break;case x.ErrorDetails.BUFFER_FULL_ERROR:if(l.parent==="main"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var a=!0,v=this.getFwdBufferInfo(this.media,A.PlaylistLevelType.MAIN);v&&v.len>.5&&(a=!this.reduceMaxBufferLength(v.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},m.checkBuffer=function(){var c=this.media,l=this.gapController;if(!c||!l||!c.readyState)return;var a=U.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):l.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},m.onFragLoadEmergencyAborted=function(){this.state=I.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},m.onBufferFlushed=function(c,l){var a=l.type;if(a!==b.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var v=(a===b.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(v,a,A.PlaylistLevelType.MAIN)}},m.onLevelsUpdated=function(c,l){this.levels=l.levels},m.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},m.seekToStartPos=function(){var c=this.media,l=c.currentTime,a=this.startPosition;if(a>=0&&l<a){if(c.seeking){y.logger.log("could not seek to "+a+", already seeking at "+l);return}var v=U.BufferHelper.getBuffered(c),p=v.length?v.start(0):0,E=p-a;E>0&&(E<this.config.maxBufferHole||E<this.config.maxFragLookUpTolerance)&&(y.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 "+l),c.currentTime=a}},m._getAudioCodec=function(c){var l=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&l&&(this.log("Swapping audio codec"),l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5"),l},m._loadBitrateTestFrag=function(c){var l=this;this._doFragLoad(c).then(function(a){var v=l.hls;if(!a||v.nextLoadLevel||l.fragContextChanged(c))return;l.fragLoadError=0,l.state=I.State.IDLE,l.startFragRequested=!1,l.bitrateTest=!1;var p=c.stats;p.parsing.start=p.parsing.end=p.buffering.start=p.buffering.end=self.performance.now(),v.trigger(B.Events.FRAG_LOADED,a)})},m._handleTransmuxComplete=function(c){var l,a="main",v=this.hls,p=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=p.video,R=p.text,H=p.id3,Y=p.initSegment,ee=this.altAudio?void 0:p.audio;if(this.fragContextChanged(F))return;if(this.state=I.State.PARSING,Y){Y.tracks&&(this._bufferInitSegment(W,Y.tracks,F,E),v.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:a,tracks:Y.tracks}));var oe=Y.initPTS,Te=Y.timescale;Object(G.isFiniteNumber)(oe)&&(this.initPTS[F.cc]=oe,v.trigger(B.Events.INIT_PTS_FOUND,{frag:F,id:a,initPTS:oe,timescale:Te}))}if(D&&p.independent!==!1){if(W.details){var ye=D.startPTS,he=D.endPTS,le=D.startDTS,pe=D.endDTS;if(j)j.elementaryStreams[D.type]={startPTS:ye,endPTS:he,startDTS:le,endDTS:pe};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,pe,!0)}F.setElementaryStreamInfo(D.type,ye,he,le,pe),this.bufferFragmentData(D,F,j,E)}}else if(p.independent===!1){this.backtrack(F);return}if(ee){var me=ee.startPTS,J=ee.endPTS,ne=ee.startDTS,q=ee.endDTS;j&&(j.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:me,endPTS:J,startDTS:ne,endDTS:q}),F.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,me,J,ne,q),this.bufferFragmentData(ee,F,j,E)}if(H!=null&&(l=H.samples)!==null&&l!==void 0&&l.length){var xe={frag:F,id:a,samples:H.samples};v.trigger(B.Events.FRAG_PARSING_METADATA,xe)}if(R){var _e={frag:F,id:a,samples:R.samples};v.trigger(B.Events.FRAG_PARSING_USERDATA,_e)}},m._bufferInitSegment=function(c,l,a,v){var p=this;if(this.state!==I.State.PARSING)return;this.audioOnly=!!l.audio&&!l.video,this.altAudio&&!this.audioOnly&&delete l.audio;var E=l.audio,M=l.video,F=l.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,l),Object.keys(l).forEach(function(D){var R=l[D],H=R.initSegment;H!=null&&H.byteLength&&p.hls.trigger(B.Events.BUFFER_APPENDING,{type:D,data:H,frag:a,part:null,chunkMeta:v,parent:a.type})}),this.tick()},m.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var l=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,l?this.resetFragmentLoading(c):this.state=I.State.BACKTRACKING},m.checkFragmentChanged=function(){var c=this.media,l=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(U.BufferHelper.isBuffered(c,a)?l=this.getAppendedFrag(a):U.BufferHelper.isBuffered(c,a+.1)&&(l=this.getAppendedFrag(a+.1)),l){var v=this.fragPlaying,p=l.level;(!v||l.sn!==v.sn||v.level!==p||l.urlId!==v.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:l}),(!v||v.level!==p)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:p}),this.fragPlaying=l)}}},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 l=this.getAppendedFrag(c.currentTime);if(l)return l.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(l)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),C}(I.default)},"./src/controller/subtitle-stream-controller.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"SubtitleStreamController",function(){return u});var G=L("./src/events.ts"),I=L("./src/utils/logger.ts"),P=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"),b=L("./src/controller/base-stream-controller.ts"),S=L("./src/types/loader.ts"),O=L("./src/types/level.ts");function _(s,w){for(var g=0;g<w.length;g++){var f=w[g];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(s,f.key,f)}}function x(s,w,g){return w&&_(s.prototype,w),g&&_(s,g),s}function y(s,w){s.prototype=Object.create(w.prototype),s.prototype.constructor=s,d(s,w)}function d(s,w){return d=Object.setPrototypeOf||function(f,C){return f.__proto__=C,f},d(s,w)}var o=500,u=function(s){y(w,s);function w(f,C){var m;return m=s.call(this,f,C,"[subtitle-stream-controller]")||this,m.levels=[],m.currentTrackId=-1,m.tracksBuffered=[],m.mainDetails=null,m._registerListeners(),m}var g=w.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var C=this.hls;C.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),C.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),C.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),C.on(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),C.on(G.Events.ERROR,this.onError,this),C.on(G.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),C.on(G.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),C.on(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),C.on(G.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),C.on(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g._unregisterListeners=function(){var C=this.hls;C.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),C.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),C.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),C.off(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),C.off(G.Events.ERROR,this.onError,this),C.off(G.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),C.off(G.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),C.off(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),C.off(G.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),C.off(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g.startLoad=function(){this.stopLoad(),this.state=b.State.IDLE,this.setInterval(o),this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},g.onLevelLoaded=function(C,m){this.mainDetails=m.details},g.onSubtitleFragProcessed=function(C,m){var h=m.frag,c=m.success;if(this.fragPrevious=h,this.state=b.State.IDLE,!c)return;var l=this.tracksBuffered[this.currentTrackId];if(!l)return;for(var a,v=h.start,p=0;p<l.length;p++)if(v>=l[p].start&&v<=l[p].end){a=l[p];break}var E=h.start+h.duration;a?a.end=E:(a={start:v,end:E},l.push(a)),this.fragmentTracker.fragBuffered(h)},g.onBufferFlushing=function(C,m){var h=m.startOffset,c=m.endOffset;if(h===0&&c!==Number.POSITIVE_INFINITY){var l=this.currentTrackId,a=this.levels;if(!a.length||!a[l]||!a[l].details)return;var v=a[l].details,p=v.targetduration,E=c-p;if(E<=0)return;m.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)}},g.onError=function(C,m){var h,c=m.frag;if(!c||c.type!==S.PlaylistLevelType.SUBTITLE)return;(h=this.fragCurrent)!==null&&h!==void 0&&h.loader&&this.fragCurrent.loader.abort(),this.state=b.State.IDLE},g.onSubtitleTracksUpdated=function(C,m){var h=this,c=m.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(l){return new O.Level(l)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(l){h.tracksBuffered[l.id]=[]}),this.mediaBuffer=null},g.onSubtitleTrackSwitch=function(C,m){if(this.currentTrackId=m.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)},g.onSubtitleTrackLoaded=function(C,m){var h,c=m.details,l=m.id,a=this.currentTrackId,v=this.levels;if(!v.length)return;var p=v[a];if(l>=v.length||l!==a||!p)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(h=p.details)!==null&&h!==void 0&&h.live){var E=this.mainDetails;if(c.deltaUpdateFailed||!E)return;var M=E.fragments[0];if(!p.details)c.hasProgramDateTime&&E.hasProgramDateTime?Object(U.alignMediaPlaylistByPDT)(c,E):M&&Object(k.addSliding)(c,M.start);else{var F=this.alignPlaylists(c,p.details);F===0&&M&&Object(k.addSliding)(c,M.start)}}if(p.details=c,this.levelLastLoaded=l,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===b.State.IDLE){var j=Object(B.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),p.details=void 0)}},g._handleFragmentLoadComplete=function(C){var m=C.frag,h=C.payload,c=m.decryptdata,l=this.hls;if(this.fragContextChanged(m))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(v){var p=performance.now();l.trigger(G.Events.FRAG_DECRYPTED,{frag:m,payload:v,stats:{tstart:a,tdecrypt:p}})})}},g.doTick=function(){if(!this.media){this.state=b.State.IDLE;return}if(this.state===b.State.IDLE){var C,m=this.currentTrackId,h=this.levels;if(!h.length||!h[m]||!h[m].details)return;var c=h[m].details,l=c.targetduration,a=this.config,v=this.media,p=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,v.currentTime-l,a.maxBufferHole),E=p.end,M=p.len,F=this.getMaxBufferLength()+l;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,R,H=this.fragPrevious;if(E<D){var Y=a.maxFragLookUpTolerance;H&&c.hasProgramDateTime&&(R=Object(B.findFragmentByPDT)(j,H.endProgramDateTime,Y)),R||(R=Object(B.findFragmentByPTS)(H,j,E,Y),!R&&H&&H.start<j[0].start&&(R=j[0]))}else R=j[W-1];(C=R)!==null&&C!==void 0&&C.encrypted?(I.logger.log("Loading key for "+R.sn),this.state=b.State.KEY_LOADING,this.hls.trigger(G.Events.KEY_LOADING,{frag:R})):R&&this.fragmentTracker.getState(R)===A.FragmentState.NOT_LOADED&&this.loadFragment(R,c,E)}},g.loadFragment=function(C,m,h){this.fragCurrent=C,s.prototype.loadFragment.call(this,C,m,h)},x(w,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),w}(b.default)},"./src/controller/subtitle-track-controller.ts":function(re,z,L){"use strict";L.r(z);var G=L("./src/events.ts"),I=L("./src/utils/texttrack-utils.ts"),P=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function U(_,x){for(var y=0;y<x.length;y++){var d=x[y];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(_,d.key,d)}}function k(_,x,y){return x&&U(_.prototype,x),y&&U(_,y),_}function A(_,x){_.prototype=Object.create(x.prototype),_.prototype.constructor=_,b(_,x)}function b(_,x){return b=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},b(_,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 y=x.prototype;return y.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,_.prototype.destroy.call(this)},y.registerListeners=function(){var o=this.hls;o.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(G.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){var o=this.hls;o.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(G.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(G.Events.ERROR,this.onError,this)},y.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)},y.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},y.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},y.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},y.onManifestParsed=function(o,u){this.tracks=u.subtitleTracks},y.onSubtitleTrackLoaded=function(o,u){var s=u.id,w=u.details,g=this.trackId,f=this.tracksInGroup[g];if(!f){this.warn("Invalid subtitle track id "+s);return}var C=f.details;f.details=u.details,this.log("subtitle track "+s+" loaded ["+w.startSN+"-"+w.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,u,C))},y.onLevelLoading=function(o,u){this.switchLevel(u.level)},y.onLevelSwitching=function(o,u){this.switchLevel(u.level)},y.switchLevel=function(o){var u=this.hls.levels[o];if(!(u!=null&&u.textGroupIds))return;var s=u.textGroupIds[u.urlId];if(this.groupId!==s){var w=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,g=this.tracks.filter(function(m){return!s||m.groupId===s});this.tracksInGroup=g;var f=this.findTrackId(w==null?void 0:w.name)||this.findTrackId();this.groupId=s;var C={subtitleTracks:g};this.log("Updating subtitle tracks, "+g.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(G.Events.SUBTITLE_TRACKS_UPDATED,C),f!==-1&&this.setSubtitleTrack(f,w)}},y.findTrackId=function(o){for(var u=this.tracksInGroup,s=0;s<u.length;s++){var w=u[s];if((!this.selectDefaultTrack||w.default)&&(!o||o===w.name))return w.id}return-1},y.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)},y.loadPlaylist=function(o){var u=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(u)){var s=u.id,w=u.groupId,g=u.url;if(o)try{g=o.addDirectives(g)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Loading subtitle playlist for id "+s),this.hls.trigger(G.Events.SUBTITLE_TRACK_LOADING,{url:g,id:s,groupId:w,deliveryDirectives:o||null})}},y.toggleTrackModes=function(o){var u=this,s=this.media,w=this.subtitleDisplay,g=this.trackId;if(!s)return;var f=O(s.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 m=C[g];m&&(m.mode="disabled")}var h=C[o];h&&(h.mode=w?"showing":"hidden")},y.setSubtitleTrack=function(o,u){var s,w=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(s=w[o])!==null&&s!==void 0&&s.details)||o<-1||o>=w.length)return;this.clearTimer();var g=w[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,g){var f=g.id,C=g.groupId,m=C===void 0?"":C,h=g.name,c=g.type,l=g.url;this.hls.trigger(G.Events.SUBTITLE_TRACK_SWITCH,{id:f,groupId:m,name:h,type:c,url:l});var a=this.switchParams(g.url,u==null?void 0:u.details);this.loadPlaylist(a)}else this.hls.trigger(G.Events.SUBTITLE_TRACK_SWITCH,{id:o})},y.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),s=0;s<u.length;s++)if(u[s].mode==="hidden")o=s;else if(u[s].mode==="showing"){o=s;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}(P.default);function O(_){for(var x=[],y=0;y<_.length;y++){var d=_[y];d.kind==="subtitles"&&d.label&&x.push(_[y])}return x}z.default=S},"./src/controller/timeline-controller.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"TimelineController",function(){return O});var G=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),P=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"),b=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=y(),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 s=new B.default(this,"textTrack1"),w=new B.default(this,"textTrack2"),g=new B.default(this,"textTrack3"),f=new B.default(this,"textTrack4");this.cea608Parser1=new P.default(1,s,w),this.cea608Parser2=new P.default(3,g,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 s=this.hls;s.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.off(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.off(I.Events.FRAG_LOADING,this.onFragLoading,this),s.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.off(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.off(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(s,w,g,f,C){for(var m=!1,h=C.length;h--;){var c=C[h],l=x(c[0],c[1],w,g);if(l>=0&&(c[0]=Math.min(c[0],w),c[1]=Math.max(c[1],g),m=!0,l/(g-w)>.5))return}if(m||C.push([w,g]),this.config.renderTextTracksNatively){var a=this.captionsTracks[s];this.Cues.newCue(a,w,g,f)}else{var v=this.Cues.newCue(null,w,g,f);this.hls.trigger(I.Events.CUES_PARSED,{type:"captions",cues:v,track:s})}},o.onInitPtsFound=function(s,w){var g=this,f=w.frag,C=w.id,m=w.initPTS,h=w.timescale,c=this.unparsedVttFrags;C==="main"&&(this.initPTS[f.cc]=m,this.timescale[f.cc]=h),c.length&&(this.unparsedVttFrags=[],c.forEach(function(l){g.onFragLoaded(I.Events.FRAG_LOADED,l)}))},o.getExistingTrack=function(s){var w=this.media;if(w)for(var g=0;g<w.textTracks.length;g++){var f=w.textTracks[g];if(f[s])return f}return null},o.createCaptionsTrack=function(s){this.config.renderTextTracksNatively?this.createNativeTrack(s):this.createNonNativeTrack(s)},o.createNativeTrack=function(s){if(this.captionsTracks[s])return;var w=this.captionsProperties,g=this.captionsTracks,f=this.media,C=w[s],m=C.label,h=C.languageCode,c=this.getExistingTrack(s);if(c)g[s]=c,Object(k.clearCurrentCues)(g[s]),Object(k.sendAddTrackEvent)(g[s],f);else{var l=this.createTextTrack("captions",m,h);l&&(l[s]=!0,g[s]=l)}},o.createNonNativeTrack=function(s){if(this.nonNativeCaptionsTracks[s])return;var w=this.captionsProperties[s];if(!w)return;var g=w.label,f={_id:s,label:g,kind:"captions",default:w.media?!!w.media.default:!1,closedCaptions:w.media};this.nonNativeCaptionsTracks[s]=f,this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[f]})},o.createTextTrack=function(s,w,g){var f=this.media;return f?f.addTextTrack(s,w,g):void 0},o.onMediaAttaching=function(s,w){this.media=w.media,this._cleanTracks()},o.onMediaDetaching=function(){var s=this.captionsTracks;Object.keys(s).forEach(function(w){Object(k.clearCurrentCues)(s[w]),delete s[w]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=y(),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 s=this.media;if(!s)return;var w=s.textTracks;if(w)for(var g=0;g<w.length;g++)Object(k.clearCurrentCues)(w[g])},o.onSubtitleTracksUpdated=function(s,w){var g=this;this.textTracks=[];var f=w.subtitleTracks||[],C=f.some(function(l){return l.textCodec===A.IMSC1_CODEC});if(this.config.enableWebVTT||C&&this.config.enableIMSC1){var m=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(l,a){var v;if(a<h.length){for(var p=null,E=0;E<h.length;E++)if(_(h[E],l)){p=h[E];break}p&&(v=p)}v?Object(k.clearCurrentCues)(v):(v=g.createTextTrack("subtitles",l.name,l.lang),v&&(v.mode="disabled")),v&&(v.groupId=l.groupId,g.textTracks.push(v))})}else if(!m&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(l){return{label:l.name,kind:l.type.toLowerCase(),default:l.default,subtitleTrack:l}});this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(s,w){var g=this;this.config.enableCEA708Captions&&w.captions&&w.captions.forEach(function(f){var C=/(?:CC|SERVICE)([1-4])/.exec(f.instreamId);if(!C)return;var m="textTrack"+C[1],h=g.captionsProperties[m];if(!h)return;h.label=f.name,f.lang&&(h.languageCode=f.lang),h.media=f})},o.onFragLoading=function(s,w){var g=this.cea608Parser1,f=this.cea608Parser2,C=this.lastSn,m=this.lastPartIndex;if(!this.enabled||!(g&&f))return;if(w.frag.type===b.PlaylistLevelType.MAIN){var h,c,l=w.frag.sn,a=(h=w==null||((c=w.part)===null||c===void 0)?void 0:c.index)!=null?h:-1;l===C+1||l===C&&a===m+1||(g.reset(),f.reset()),this.lastSn=l,this.lastPartIndex=a}},o.onFragLoaded=function(s,w){var g=w.frag,f=w.payload,C=this.initPTS,m=this.unparsedVttFrags;if(g.type===b.PlaylistLevelType.SUBTITLE)if(f.byteLength){if(!Object(G.isFiniteNumber)(C[g.cc])){m.push(w),C.length&&this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Missing initial subtitle PTS")});return}var h=g.decryptdata;if(h==null||h.key==null||h.method!=="AES-128"){var c=this.tracks[g.level],l=this.vttCCs;l[g.cc]||(l[g.cc]={start:g.start,prevCC:this.prevCC,new:!0},this.prevCC=g.cc),c&&c.textCodec===A.IMSC1_CODEC?this._parseIMSC1(g,f):this._parseVTTs(g,f,l)}}else this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(s,w){var g=this,f=this.hls;Object(A.parseIMSC1)(w,this.initPTS[s.cc],this.timescale[s.cc],function(C){g._appendCues(C,s.level),f.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(C){S.logger.log("Failed to parse IMSC1: "+C),f.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:C})})},o._parseVTTs=function(s,w,g){var f=this,C=this.hls;Object(U.parseWebVTT)(w,this.initPTS[s.cc],this.timescale[s.cc],g,s.cc,s.start,function(m){f._appendCues(m,s.level),C.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(m){f._fallbackToIMSC1(s,w),S.logger.log("Failed to parse VTT cue: "+m),C.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:m})})},o._fallbackToIMSC1=function(s,w){var g=this,f=this.tracks[s.level];f.textCodec||Object(A.parseIMSC1)(w,this.initPTS[s.cc],this.timescale[s.cc],function(){f.textCodec=A.IMSC1_CODEC,g._parseIMSC1(s,w)},function(){f.textCodec="wvtt"})},o._appendCues=function(s,w){var g=this.hls;if(this.config.renderTextTracksNatively){var f=this.textTracks[w];if(f.mode==="disabled")return;s.forEach(function(h){return Object(k.addCueToTrack)(f,h)})}else{var C=this.tracks[w],m=C.default?"default":"subtitles"+w;g.trigger(I.Events.CUES_PARSED,{type:"subtitles",cues:s,track:m})}},o.onFragDecrypted=function(s,w){var g=w.frag;if(g.type===b.PlaylistLevelType.SUBTITLE){if(!Object(G.isFiniteNumber)(this.initPTS[g.cc])){this.unparsedVttFrags.push(w);return}this.onFragLoaded(I.Events.FRAG_LOADED,w)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(s,w){var g=this.cea608Parser1,f=this.cea608Parser2;if(!this.enabled||!(g&&f))return;for(var C=0;C<w.samples.length;C++){var m=w.samples[C].bytes;if(m){var h=this.extractCea608Data(m);g.addData(w.samples[C].pts,h[0]),f.addData(w.samples[C].pts,h[1])}}},o.onBufferFlushing=function(s,w){var g=w.startOffset,f=w.endOffset,C=w.endOffsetSubtitles,m=w.type,h=this.media;if(!h||h.currentTime<f)return;if(!m||m==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(k.removeCuesInRange)(c[a],g,f)})}if(this.config.renderTextTracksNatively&&(g===0&&C!==void 0)){var l=this.textTracks;Object.keys(l).forEach(function(a){return Object(k.removeCuesInRange)(l[a],g,C)})}},o.extractCea608Data=function(s){for(var w=s[0]&31,g=2,f=[[],[]],C=0;C<w;C++){var m=s[g++],h=127&s[g++],c=127&s[g++],l=(4&m)!==0,a=3&m;if(h===0&&c===0)continue;l&&((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,s){return Math.min(o,s)-Math.max(d,u)}function y(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return G});var G=function(){function I(B,U){this.subtle=void 0,this.aesIV=void 0,this.subtle=B,this.aesIV=U}var P=I.prototype;return P.decrypt=function(U,k){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},k,U)},I}()},"./src/crypt/aes-decryptor.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"removePadding",function(){return I}),L.d(z,"default",function(){return P});var G=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(G.sliceUint8)(B,0,U-k):B}var P=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 b=new DataView(A),S=new Uint32Array(4),O=0;O<4;O++)S[O]=b.getUint32(O*4);return S},U.initTable=function(){var A=this.sBox,b=this.invSBox,S=this.subMix,O=S[0],_=S[1],x=S[2],y=S[3],d=this.invSubMix,o=d[0],u=d[1],s=d[2],w=d[3],g=new Uint32Array(256),f=0,C=0,m=0;for(m=0;m<256;m++)m<128?g[m]=m<<1:g[m]=m<<1^283;for(m=0;m<256;m++){var h=C^C<<1^C<<2^C<<3^C<<4;h=h>>>8^h&255^99,A[f]=h,b[h]=f;var c=g[f],l=g[c],a=g[l],v=g[h]*257^h*16843008;O[f]=v<<24|v>>>8,_[f]=v<<16|v>>>16,x[f]=v<<8|v>>>24,y[f]=v,v=a*16843009^l*65537^c*257^f*16843008,o[h]=v<<24|v>>>8,u[h]=v<<16|v>>>16,s[h]=v<<8|v>>>24,w[h]=v,f?(f=c^g[g[g[a^c]]],C^=g[g[C]]):f=C=1}},U.expandKey=function(A){for(var b=this.uint8ArrayToUint32Array_(A),S=!0,O=0;O<b.length&&S;)S=b[O]===this.key[O],O++;if(S)return;this.key=b;var _=this.keySize=b.length;if(_!==4&&_!==6&&_!==8)throw new Error("Invalid aes key size="+_);var x=this.ksRows=(_+6+1)*4,y,d,o=this.keySchedule=new Uint32Array(x),u=this.invKeySchedule=new Uint32Array(x),s=this.sBox,w=this.rcon,g=this.invSubMix,f=g[0],C=g[1],m=g[2],h=g[3],c,l;for(y=0;y<x;y++){if(y<_){c=o[y]=b[y];continue}l=c,y%_===0?(l=l<<8|l>>>24,l=s[l>>>24]<<24|s[l>>>16&255]<<16|s[l>>>8&255]<<8|s[l&255],l^=w[y/_|0]<<24):_>6&&y%_===4&&(l=s[l>>>24]<<24|s[l>>>16&255]<<16|s[l>>>8&255]<<8|s[l&255]),o[y]=c=(o[y-_]^l)>>>0}for(d=0;d<x;d++)y=x-d,d&3?l=o[y]:l=o[y-4],d<4||y<=4?u[d]=l:u[d]=f[s[l>>>24]]^C[s[l>>>16&255]]^m[s[l>>>8&255]]^h[s[l&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,b,S){for(var O=this.keySize+6,_=this.invKeySchedule,x=this.invSBox,y=this.invSubMix,d=y[0],o=y[1],u=y[2],s=y[3],w=this.uint8ArrayToUint32Array_(S),g=w[0],f=w[1],C=w[2],m=w[3],h=new Int32Array(A),c=new Int32Array(h.length),l,a,v,p,E,M,F,j,W,D,R,H,Y,ee,oe=this.networkToHostOrderSwap;b<h.length;){for(W=oe(h[b]),D=oe(h[b+1]),R=oe(h[b+2]),H=oe(h[b+3]),E=W^_[0],M=H^_[1],F=R^_[2],j=D^_[3],Y=4,ee=1;ee<O;ee++)l=d[E>>>24]^o[M>>16&255]^u[F>>8&255]^s[j&255]^_[Y],a=d[M>>>24]^o[F>>16&255]^u[j>>8&255]^s[E&255]^_[Y+1],v=d[F>>>24]^o[j>>16&255]^u[E>>8&255]^s[M&255]^_[Y+2],p=d[j>>>24]^o[E>>16&255]^u[M>>8&255]^s[F&255]^_[Y+3],E=l,M=a,F=v,j=p,Y=Y+4;l=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],v=x[F>>>24]<<24^x[j>>16&255]<<16^x[E>>8&255]<<8^x[M&255]^_[Y+2],p=x[j>>>24]<<24^x[E>>16&255]<<16^x[M>>8&255]<<8^x[F&255]^_[Y+3],c[b]=oe(l^g),c[b+1]=oe(p^f),c[b+2]=oe(v^C),c[b+3]=oe(a^m),g=W,f=D,C=R,m=H,b=b+4}return c.buffer},B}()},"./src/crypt/decrypter.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return b});var G=L("./src/crypt/aes-crypto.ts"),I=L("./src/crypt/fast-aes-key.ts"),P=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,b=function(){function S(_,x,y){var d=y===void 0?{}:y,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 s=self.crypto;s&&(this.subtle=s.subtle||s.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 y=new Uint8Array(x);return this.reset(),this.removePKCS7Padding?Object(P.removePadding)(y):y},O.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},O.decrypt=function(x,y,d,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(x),y,d);var u=this.flush();u&&o(u.buffer)}else this.webCryptoDecrypt(new Uint8Array(x),y,d).then(o)},O.softwareDecrypt=function(x,y,d){var o=this.currentIV,u=this.currentResult,s=this.remainderData;this.logOnce("JS AES decrypt"),s&&(x=Object(U.appendUint8Array)(s,x),this.remainderData=null);var w=this.getValidChunk(x);if(!w.length)return null;o&&(d=o);var g=this.softwareDecrypter;g||(g=this.softwareDecrypter=new P.default),g.expandKey(y);var f=u;return this.currentResult=g.decrypt(w.buffer,0,d),this.currentIV=Object(k.sliceUint8)(w,-16).buffer,f||null},O.webCryptoDecrypt=function(x,y,d){var o=this,u=this.subtle;return(this.key!==y||!this.fastAesKey)&&(this.key=y,this.fastAesKey=new I.default(u,y)),this.fastAesKey.expandKey().then(function(s){if(!u)return Promise.reject(new Error("web crypto not initialized"));var w=new G.default(u,d);return w.decrypt(x.buffer,s)}).catch(function(s){return o.onWebCryptoError(s,x,y,d)})},O.onWebCryptoError=function(x,y,d,o){return B.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",x),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(y,d,o)},O.getValidChunk=function(x){var y=x,d=x.length-x.length%A;return d!==x.length&&(y=Object(k.sliceUint8)(x,0,d),this.remainderData=Object(k.sliceUint8)(x,d)),y},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,z,L){"use strict";L.r(z),L.d(z,"default",function(){return G});var G=function(){function I(B,U){this.subtle=void 0,this.key=void 0,this.subtle=B,this.key=U}var P=I.prototype;return P.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},I}()},"./src/demux/aacdemuxer.ts":function(re,z,L){"use strict";L.r(z);var G=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/adts.ts"),P=L("./src/utils/logger.ts"),B=L("./src/demux/id3.ts");function U(b,S){b.prototype=Object.create(S.prototype),b.prototype.constructor=b,k(b,S)}function k(b,S){return k=Object.setPrototypeOf||function(_,x){return _.__proto__=x,_},k(b,S)}var A=function(b){U(S,b);function S(_,x){var y;return y=b.call(this)||this,y.observer=void 0,y.config=void 0,y.observer=_,y.config=x,y}var O=S.prototype;return O.resetInitSegment=function(x,y,d){b.prototype.resetInitSegment.call(this,x,y,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 y=B.getID3Data(x,0)||[],d=y.length,o=x.length;d<o;d++)if(I.probe(x,d))return P.logger.log("ADTS sync word found !"),!0;return!1},O.canParse=function(x,y){return I.canParse(x,y)},O.appendFrame=function(x,y,d){I.initTrackConfig(x,this.observer,y,d,x.manifestCodec);var o=I.appendFrame(x,y,d,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},S}(G.default);A.minProbeByteLength=9,z.default=A},"./src/demux/adts.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"getAudioConfig",function(){return B}),L.d(z,"isHeaderPattern",function(){return U}),L.d(z,"getHeaderLength",function(){return k}),L.d(z,"getFullFrameLength",function(){return A}),L.d(z,"canGetFrameLength",function(){return b}),L.d(z,"isHeader",function(){return S}),L.d(z,"canParse",function(){return O}),L.d(z,"probe",function(){return _}),L.d(z,"initTrackConfig",function(){return x}),L.d(z,"getFrameDuration",function(){return y}),L.d(z,"parseFrameHeader",function(){return d}),L.d(z,"appendFrame",function(){return o});var G=L("./src/utils/logger.ts"),I=L("./src/errors.ts"),P=L("./src/events.ts");function B(u,s,w,g){var f,C,m,h,c=navigator.userAgent.toLowerCase(),l=g,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];f=((s[w+2]&192)>>>6)+1;var v=(s[w+2]&60)>>>2;if(v>a.length-1){u.trigger(P.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+v});return}return m=(s[w+2]&1)<<2,m|=(s[w+3]&192)>>>6,G.logger.log("manifest codec:"+g+", ADTS type:"+f+", samplingIndex:"+v),/firefox/i.test(c)?v>=6?(f=5,h=new Array(4),C=v-3):(f=2,h=new Array(2),C=v):c.indexOf("android")!==-1?(f=2,h=new Array(2),C=v):(f=5,h=new Array(4),g&&(g.indexOf("mp4a.40.29")!==-1||g.indexOf("mp4a.40.5")!==-1)||!g&&v>=6?C=v-3:((g&&g.indexOf("mp4a.40.2")!==-1&&(v>=6&&m===1||/vivaldi/i.test(c))||!g&&m===1)&&(f=2,h=new Array(2)),C=v)),h[0]=f<<3,h[0]|=(v&14)>>1,h[1]|=(v&1)<<7,h[1]|=m<<3,f===5&&(h[1]|=(C&14)>>1,h[2]=(C&1)<<7,h[2]|=2<<2,h[3]=0),{config:h,samplerate:a[v],channelCount:m,codec:"mp4a.40."+f,manifestCodec:l}}function U(u,s){return u[s]===255&&(u[s+1]&246)===240}function k(u,s){return u[s+1]&1?7:9}function A(u,s){return(u[s+3]&3)<<11|u[s+4]<<3|(u[s+5]&224)>>>5}function b(u,s){return s+5<u.length}function S(u,s){return s+1<u.length&&U(u,s)}function O(u,s){return b(u,s)&&U(u,s)&&A(u,s)<=u.length-s}function _(u,s){if(S(u,s)){var w=k(u,s);if(s+w>=u.length)return!1;var g=A(u,s);if(g<=w)return!1;var f=s+g;return f===u.length||S(u,f)}return!1}function x(u,s,w,g,f){if(!u.samplerate){var C=B(s,w,g,f);if(!C)return;u.config=C.config,u.samplerate=C.samplerate,u.channelCount=C.channelCount,u.codec=C.codec,u.manifestCodec=C.manifestCodec,G.logger.log("parsed codec:"+u.codec+", rate:"+C.samplerate+", channels:"+C.channelCount)}}function y(u){return 1024*9e4/u}function d(u,s,w,g,f){var C=k(u,s),m=A(u,s);if(m-=C,m>0){var h=w+g*f;return{headerLength:C,frameLength:m,stamp:h}}}function o(u,s,w,g,f){var C=y(u.samplerate),m=d(s,w,g,f,C);if(m){var h=m.frameLength,c=m.headerLength,l=m.stamp,a=c+h,v=Math.max(0,w+a-s.length),p;v?(p=new Uint8Array(a-c),p.set(s.subarray(w+c,s.length),0)):p=s.subarray(w+c,w+a);var E={unit:p,pts:l};return v||u.samples.push(E),{sample:E,length:a,missing:v}}}},"./src/demux/base-audio-demuxer.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"initPTSFn",function(){return A});var G=L("./src/polyfills/number.ts"),I=L("./src/demux/id3.ts"),P=L("./src/demux/dummy-demuxed-track.ts"),B=L("./src/utils/mp4-tools.ts"),U=L("./src/utils/typed-array.ts"),k=function(){function b(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var S=b.prototype;return S.resetInitSegment=function(_,x,y){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,y){},S.demux=function(_,x){this.cachedData&&(_=Object(B.appendUint8Array)(this.cachedData,_),this.cachedData=null);var y=I.getID3Data(_,0),d=y?y.length:0,o,u,s=this._audioTrack,w=this._id3Track,g=y?I.getTimeStamp(y):void 0,f=_.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=A(g,x)),y&&y.length>0&&w.samples.push({pts:this.initPTS,dts:this.initPTS,data:y}),u=this.initPTS;d<f;){if(this.canParse(_,d)){var C=this.appendFrame(s,_,d);C?(this.frameIndex++,u=C.sample.pts,d+=C.length,o=d):d=f}else I.canParse(_,d)?(y=I.getID3Data(_,d),w.samples.push({pts:u,dts:u,data:y}),d+=y.length,o=d):d++;if(d===f&&o!==f){var m=Object(U.sliceUint8)(_,o);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,m):this.cachedData=m}}return{audioTrack:s,avcTrack:Object(P.dummyTrack)(),id3Track:w,textTrack:Object(P.dummyTrack)()}},S.demuxSampleAes=function(_,x,y){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(P.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(P.dummyTrack)()}},S.destroy=function(){},b}(),A=function(S,O){return Object(G.isFiniteNumber)(S)?S*90:O*9e4};z.default=k},"./src/demux/chunk-cache.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return G});var G=function(){function P(){this.chunks=[],this.dataLength=0}var B=P.prototype;return B.push=function(k){this.chunks.push(k),this.dataLength+=k.length},B.flush=function(){var k=this.chunks,A=this.dataLength,b;if(k.length)k.length===1?b=k[0]:b=I(k,A);else return new Uint8Array(0);return this.reset(),b},B.reset=function(){this.chunks.length=0,this.dataLength=0},P}();function I(P,B){for(var U=new Uint8Array(B),k=0,A=0;A<P.length;A++){var b=P[A];U.set(b,k),k+=b.length}return U}},"./src/demux/dummy-demuxed-track.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"dummyTrack",function(){return G});function G(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(re,z,L){"use strict";L.r(z);var G=L("./src/utils/logger.ts"),I=function(){function P(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=P.prototype;return B.loadWord=function(){var k=this.data,A=this.bytesAvailable,b=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(b,b+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),b=this.word>>>32-A;return k>32&&G.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?b<<A|this.readBits(A):b},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,b=8,S,O=0;O<k;O++)b!==0&&(S=this.readEG(),b=(A+S+256)%256),A=b===0?A:b},B.readSPS=function(){var k=0,A=0,b=0,S=0,O,_,x,y=this.readUByte.bind(this),d=this.readBits.bind(this),o=this.readUEG.bind(this),u=this.readBoolean.bind(this),s=this.skipBits.bind(this),w=this.skipEG.bind(this),g=this.skipUEG.bind(this),f=this.skipScalingList.bind(this);y();var C=y();if(d(5),s(3),y(),g(),C===100||C===110||C===122||C===244||C===44||C===83||C===86||C===118||C===128){var m=o();if(m===3&&s(1),g(),g(),s(1),u())for(_=m!==3?8:12,x=0;x<_;x++)u()&&(x<6?f(16):f(64))}g();var h=o();if(h===0)o();else if(h===1)for(s(1),w(),w(),O=o(),x=0;x<O;x++)w();g(),s(1);var c=o(),l=o(),a=d(1);a===0&&s(1),s(1),u()&&(k=o(),A=o(),b=o(),S=o());var v=[1,1];if(u()&&u()){var p=y();switch(p){case 1:v=[1,1];break;case 2:v=[12,11];break;case 3:v=[10,11];break;case 4:v=[16,11];break;case 5:v=[40,33];break;case 6:v=[24,11];break;case 7:v=[20,11];break;case 8:v=[32,11];break;case 9:v=[80,33];break;case 10:v=[18,11];break;case 11:v=[15,11];break;case 12:v=[64,33];break;case 13:v=[160,99];break;case 14:v=[4,3];break;case 15:v=[3,2];break;case 16:v=[2,1];break;case 255:{v=[y()<<8|y(),y()<<8|y()];break}}}return{width:Math.ceil((c+1)*16-k*2-A*2),height:(2-a)*(l+1)*16-(a?2:4)*(b+S),pixelRatio:v}},B.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},P}();z.default=I},"./src/demux/id3.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"isHeader",function(){return G}),L.d(z,"isFooter",function(){return I}),L.d(z,"getID3Data",function(){return P}),L.d(z,"canParse",function(){return U}),L.d(z,"getTimeStamp",function(){return k}),L.d(z,"isTimeStampFrame",function(){return A}),L.d(z,"getID3Frames",function(){return S}),L.d(z,"decodeFrame",function(){return O}),L.d(z,"utf8ArrayToStr",function(){return o}),L.d(z,"testables",function(){return u});var G=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)))},P=function(f,C){for(var m=C,h=0;G(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(m,m+h):void 0},B=function(f,C){var m=0;return m=(f[C]&127)<<21,m|=(f[C+1]&127)<<14,m|=(f[C+2]&127)<<7,m|=f[C+3]&127,m},U=function(f,C){return G(f,C)&&B(f,C+6)+10<=f.length-C},k=function(f){for(var C=S(f),m=0;m<C.length;m++){var h=C[m];if(A(h))return d(h)}return},A=function(f){return f&&f.key==="PRIV"&&f.info==="com.apple.streaming.transportStreamTimestamp"},b=function(f){var C=String.fromCharCode(f[0],f[1],f[2],f[3]),m=B(f,4),h=10;return{type:C,size:m,data:f.subarray(h,h+m)}},S=function(f){for(var C=0,m=[];G(f,C);){var h=B(f,C+6);C+=10;for(var c=C+h;C+8<c;){var l=b(f.subarray(C)),a=O(l);a&&m.push(a),C+=l.size+10}I(f,C)&&(C+=10)}return m},O=function(f){return f.type==="PRIV"?_(f):f.type[0]==="W"?y(f):x(f)},_=function(f){if(f.size<2)return;var C=o(f.data,!0),m=new Uint8Array(f.data.subarray(C.length+1));return{key:f.type,info:C,data:m.buffer}},x=function(f){if(f.size<2)return;if(f.type==="TXXX"){var C=1,m=o(f.data.subarray(C),!0);C+=m.length+1;var h=o(f.data.subarray(C));return{key:f.type,info:m,data:h}}var c=o(f.data.subarray(1));return{key:f.type,data:c}},y=function(f){if(f.type==="WXXX"){if(f.size<2)return;var C=1,m=o(f.data.subarray(C),!0);C+=m.length+1;var h=o(f.data.subarray(C));return{key:f.type,info:m,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),m=C[3]&1,h=(C[4]<<23)+(C[5]<<15)+(C[6]<<7)+C[7];return h/=45,m&&(h+=4772185884e-2),Math.round(h)}return},o=function(f,C){C===void 0&&(C=!1);var m=w();if(m){var h=m.decode(f);if(C){var c=h.indexOf("\0");return c!==-1?h.substring(0,c):h}return h.replace(/\0/g,"")}for(var l=f.length,a,v,p,E="",M=0;M<l;){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:v=f[M++],E+=String.fromCharCode((a&31)<<6|v&63);break;case 14:v=f[M++],p=f[M++],E+=String.fromCharCode((a&15)<<12|(v&63)<<6|(p&63)<<0);break;default:}}return E},u={decodeTextFrame:x},s;function w(){return!s&&typeof self.TextDecoder!="undefined"&&(s=new self.TextDecoder("utf-8")),s}},"./src/demux/mp3demuxer.ts":function(re,z,L){"use strict";L.r(z);var G=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/id3.ts"),P=L("./src/utils/logger.ts"),B=L("./src/demux/mpegaudio.ts");function U(b,S){b.prototype=Object.create(S.prototype),b.prototype.constructor=b,k(b,S)}function k(b,S){return k=Object.setPrototypeOf||function(_,x){return _.__proto__=x,_},k(b,S)}var A=function(b){U(S,b);function S(){return b.apply(this,arguments)||this}var O=S.prototype;return O.resetInitSegment=function(x,y,d){b.prototype.resetInitSegment.call(this,x,y,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 y=I.getID3Data(x,0)||[],d=y.length,o=x.length;d<o;d++)if(B.probe(x,d))return P.logger.log("MPEG Audio sync word found !"),!0;return!1},O.canParse=function(x,y){return B.canParse(x,y)},O.appendFrame=function(x,y,d){return this.initPTS===null?void 0:B.appendFrame(x,y,d,this.initPTS,this.frameIndex)},S}(G.default);A.minProbeByteLength=4,z.default=A},"./src/demux/mp4demuxer.ts":function(re,z,L){"use strict";L.r(z);var G=L("./src/utils/mp4-tools.ts"),I=L("./src/demux/dummy-demuxed-track.ts"),P=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(G.findBox)({data:A,start:0,end:Math.min(A.length,16384)},["moof"]).length>0},U.demux=function(A){var b=A,S=Object(I.dummyTrack)();if(this.config.progressive){this.remainderData&&(b=Object(G.appendUint8Array)(this.remainderData,A));var O=Object(G.segmentValidRange)(b);this.remainderData=O.remainder,S.samples=O.valid||new Uint8Array}else S.samples=b;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,b,S){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},U.destroy=function(){},B}();P.minProbeByteLength=1024,z.default=P},"./src/demux/mpegaudio.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"appendFrame",function(){return k}),L.d(z,"parseHeader",function(){return A}),L.d(z,"isHeaderPattern",function(){return b}),L.d(z,"isHeader",function(){return S}),L.d(z,"canParse",function(){return O}),L.d(z,"probe",function(){return _});var G=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],P=[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,y,d,o,u){if(d+24>y.length)return;var s=A(y,d);if(s&&d+s.frameLength<=y.length){var w=s.samplesPerFrame*9e4/s.sampleRate,g=o+u*w,f={unit:y.subarray(d,d+s.frameLength),pts:g,dts:g};return x.config=[],x.channelCount=s.channelCount,x.samplerate=s.sampleRate,x.samples.push(f),{sample:f,length:s.frameLength,missing:0}}}function A(x,y){var d=x[y+1]>>3&3,o=x[y+1]>>1&3,u=x[y+2]>>4&15,s=x[y+2]>>2&3;if(d!==1&&u!==0&&u!==15&&s!==3){var w=x[y+2]>>1&1,g=x[y+3]>>6,f=d===3?3-o:o===3?3:4,C=I[f*14+u-1]*1e3,m=d===3?0:d===2?1:2,h=P[m*3+s],c=g===3?1:2,l=B[d][o],a=U[o],v=l*8*a,p=Math.floor(l*C/h+w)*a;if(G===null){var E=navigator.userAgent||"",M=E.match(/Chrome\/(\d+)/i);G=M?parseInt(M[1]):0}var F=!!G&&G<=87;return F&&o===2&&C>=224e3&&g===0&&(x[y+3]=x[y+3]|128),{sampleRate:h,channelCount:c,frameLength:p,samplesPerFrame:v}}}function b(x,y){return x[y]===255&&(x[y+1]&224)===224&&(x[y+1]&6)!==0}function S(x,y){return y+1<x.length&&b(x,y)}function O(x,y){var d=4;return b(x,y)&&d<=x.length-y}function _(x,y){if(y+1<x.length&&b(x,y)){var d=4,o=A(x,y),u=d;o!=null&&o.frameLength&&(u=o.frameLength);var s=y+u;return s===x.length||S(x,s)}return!1}},"./src/demux/sample-aes.ts":function(re,z,L){"use strict";L.r(z);var G=L("./src/crypt/decrypter.ts"),I=L("./src/demux/tsdemuxer.ts"),P=function(){function B(k,A,b){this.keyData=void 0,this.decrypter=void 0,this.keyData=b,this.decrypter=new G.default(k,A,{removePKCS7Padding:!1})}var U=B.prototype;return U.decryptBuffer=function(A,b){this.decrypter.decrypt(A,this.keyData.key.buffer,this.keyData.iv.buffer,b)},U.decryptAacSample=function(A,b,S,O){var _=A[b].unit,x=_.subarray(16,_.length-_.length%16),y=x.buffer.slice(x.byteOffset,x.byteOffset+x.length),d=this;this.decryptBuffer(y,function(o){var u=new Uint8Array(o);_.set(u,16),O||d.decryptAacSamples(A,b+1,S)})},U.decryptAacSamples=function(A,b,S){for(;;b++){if(b>=A.length){S();return}if(A[b].unit.length<32)continue;var O=this.decrypter.isSync();if(this.decryptAacSample(A,b,S,O),!O)return}},U.getAvcEncryptedData=function(A){for(var b=Math.floor((A.length-48)/160)*16+16,S=new Int8Array(b),O=0,_=32;_<=A.length-16;_+=160,O+=16)S.set(A.subarray(_,_+16),O);return S},U.getAvcDecryptedUnit=function(A,b){for(var S=new Uint8Array(b),O=0,_=32;_<=A.length-16;_+=160,O+=16)A.set(S.subarray(O,O+16),_);return A},U.decryptAvcSample=function(A,b,S,O,_,x){var y=Object(I.discardEPB)(_.data),d=this.getAvcEncryptedData(y),o=this;this.decryptBuffer(d.buffer,function(u){_.data=o.getAvcDecryptedUnit(y,u),x||o.decryptAvcSamples(A,b,S+1,O)})},U.decryptAvcSamples=function(A,b,S,O){if(A instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;b++,S=0){if(b>=A.length){O();return}for(var _=A[b].units;!(S>=_.length);S++){var x=_[S];if(x.data.length<=48||x.type!==1&&x.type!==5)continue;var y=this.decrypter.isSync();if(this.decryptAvcSample(A,b,S,O,x,y),!y)return}}},B}();z.default=P},"./src/demux/transmuxer-interface.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return _});var G=L("./node_modules/webworkify-webpack/index.js"),I=L.n(G),P=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"),b=L("./node_modules/eventemitter3/index.js"),S=L.n(b),O=Object(A.getMediaSource)()||{isTypeSupported:function(){return!1}},_=function(){function x(d,o,u,s){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=s;var g=d.config,f=function(l,a){a=a||{},a.frag=w.frag,a.id=w.id,d.trigger(l,a)};this.observer=new b.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,f),this.observer.on(P.Events.ERROR,f);var C={mp4:O.isTypeSupported("video/mp4"),mpeg:O.isTypeSupported("audio/mpeg"),mp3:O.isTypeSupported('audio/mp4; codecs="mp3"')},m=navigator.vendor;if(g.enableWorker&&typeof Worker!="undefined"){U.logger.log("demuxing in webworker");var h;try{h=this.worker=G("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(c){d.trigger(P.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:m,id:o,config:JSON.stringify(g)})}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,g,m,o),this.worker=null}}else this.transmuxer=new B.default(this.observer,C,g,m,o)}var y=x.prototype;return y.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 s=this.observer;s&&s.removeAllListeners(),this.observer=null},y.push=function(o,u,s,w,g,f,C,m,h,c){var l=this;h.transmuxing.start=self.performance.now();var a=this.transmuxer,v=this.worker,p=f?f.start:g.start,E=g.decryptdata,M=this.frag,F=!(M&&g.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,R=!j&&(W===1||W===0&&D===1),H=self.performance.now();(j||W||g.stats.parsing.start===0)&&(g.stats.parsing.start=H),f&&(D||!R)&&(f.stats.parsing.start=H);var Y=new B.TransmuxState(F,R,m,j,p);if(!R||F){U.logger.log("[transmuxer-interface, "+g.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
|
|
discontinuity: `+F+`
|
|
trackSwitch: `+j+`
|
|
contiguous: `+R+`
|
|
accurateTimeOffset: `+m+`
|
|
timeOffset: `+p);var ee=new B.TransmuxConfig(s,w,u,C,c);this.configureTransmuxer(ee)}if(this.frag=g,this.part=f,v)v.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){l.handleTransmuxComplete(Te)}):this.handleTransmuxComplete(oe)}},y.flush=function(o){var u=this;o.transmuxing.start=self.performance.now();var s=this.transmuxer,w=this.worker;if(w)w.postMessage({cmd:"flush",chunkMeta:o});else if(s){var g=s.flush(o);Object(B.isPromise)(g)?g.then(function(f){u.handleFlushResult(f,o)}):this.handleFlushResult(g,o)}},y.handleFlushResult=function(o,u){var s=this;o.forEach(function(w){s.handleTransmuxComplete(w)}),this.onFlush(u)},y.onWorkerMessage=function(o){var u=o.data,s=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,s.trigger(u.event,u.data);break}}},y.configureTransmuxer=function(o){var u=this.worker,s=this.transmuxer;u?u.postMessage({cmd:"configure",config:o}):s&&s.configure(o)},y.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},x}()},"./src/demux/transmuxer-worker.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return k});var G=L("./src/demux/transmuxer.ts"),I=L("./src/events.ts"),P=L("./src/utils/logger.ts"),B=L("./node_modules/eventemitter3/index.js"),U=L.n(B);function k(_){var x=new B.EventEmitter,y=function(o,u){_.postMessage({event:o,data:u})};x.on(I.Events.FRAG_DECRYPTED,y),x.on(I.Events.ERROR,y),_.addEventListener("message",function(d){var o=d.data;switch(o.cmd){case"init":{var u=JSON.parse(o.config);_.transmuxer=new G.default(x,o.typeSupported,u,o.vendor,o.id),Object(P.enableLogs)(u.debug),y("init",null);break}case"configure":{_.transmuxer.configure(o.config);break}case"demux":{var s=_.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(G.isPromise)(s)?s.then(function(f){A(_,f)}):A(_,s);break}case"flush":{var w=o.chunkMeta,g=_.transmuxer.flush(w);Object(G.isPromise)(g)?g.then(function(f){S(_,f,w)}):S(_,g,w);break}default:break}})}function A(_,x){if(O(x.remuxResult))return;var y=[],d=x.remuxResult,o=d.audio,u=d.video;o&&b(y,o),u&&b(y,u),_.postMessage({event:"transmuxComplete",data:x},y)}function b(_,x){x.data1&&_.push(x.data1.buffer),x.data2&&_.push(x.data2.buffer)}function S(_,x,y){x.forEach(function(d){A(_,d)}),_.postMessage({event:"flush",data:y})}function O(_){return!_.audio&&!_.video&&!_.text&&!_.id3&&!_.initSegment}},"./src/demux/transmuxer.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return u}),L.d(z,"isPromise",function(){return g}),L.d(z,"TransmuxConfig",function(){return f}),L.d(z,"TransmuxState",function(){return C});var G=L("./src/events.ts"),I=L("./src/errors.ts"),P=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"),b=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"),y;try{y=self.performance.now.bind(self.performance)}catch(m){x.logger.debug("Unable to use Performance API on this environment"),y=self.Date.now}var d=[{demux:k.default,remux:b.default},{demux:U.default,remux:S.default},{demux:B.default,remux:b.default},{demux:A.default,remux:b.default}],o=1024;d.forEach(function(m){var h=m.demux;o=Math.max(o,h.minProbeByteLength)});var u=function(){function m(c,l,a,v,p){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=l,this.config=a,this.vendor=v,this.id=p}var h=m.prototype;return h.configure=function(l){this.transmuxConfig=l,this.decrypter&&this.decrypter.reset()},h.push=function(l,a,v,p){var E=this,M=v.transmuxing;M.executeStart=y();var F=new Uint8Array(l),j=this.cache,W=this.config,D=this.currentTransmuxState,R=this.transmuxConfig;p&&(this.currentTransmuxState=p);var H=s(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=y(),w(v);F=new Uint8Array(ee)}else return this.decryptionPromise=Y.webCryptoDecrypt(F,H.key.buffer,H.iv.buffer).then(function(ve){var we=E.push(ve,null,v);return E.decryptionPromise=null,we}),this.decryptionPromise}var oe=p||D,Te=oe.contiguous,ye=oe.discontinuity,he=oe.trackSwitch,le=oe.accurateTimeOffset,pe=oe.timeOffset,ie=R.audioCodec,me=R.videoCodec,J=R.defaultInitPts,ne=R.duration,q=R.initSegmentData;if((ye||he)&&this.resetInitSegment(q,ie,me,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,R)}var _e=this.transmux(F,H,pe,le,v),be=this.currentTransmuxState;return be.contiguous=!0,be.discontinuity=!1,be.trackSwitch=!1,M.executeEnd=y(),_e},h.flush=function(l){var a=this,v=l.transmuxing;v.executeStart=y();var p=this.decrypter,E=this.cache,M=this.currentTransmuxState,F=this.decryptionPromise;if(F)return F.then(function(){return a.flush(l)});var j=[],W=M.timeOffset;if(p){var D=p.flush();D&&j.push(this.push(D,null,l))}var R=E.dataLength;E.reset();var H=this.demuxer,Y=this.remuxer;if(!H||!Y)return R>=o&&this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),v.executeEnd=y(),[w(l)];var ee=H.flush(W);return g(ee)?ee.then(function(oe){return a.flushRemux(j,oe,l),j}):(this.flushRemux(j,ee,l),j)},h.flushRemux=function(l,a,v){var p=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 "+v.sn+(v.part>-1?" p: "+v.part:"")+" of level "+v.level);var R=this.remuxer.remux(p,E,M,F,D,W,!0,this.id);l.push({remuxResult:R,chunkMeta:v}),v.transmuxing.executeEnd=y()},h.resetInitialTimestamp=function(l){var a=this.demuxer,v=this.remuxer;if(!a||!v)return;a.resetTimeStamp(l),v.resetTimeStamp(l)},h.resetContiguity=function(){var l=this.demuxer,a=this.remuxer;if(!l||!a)return;l.resetContiguity(),a.resetNextTimestamp()},h.resetInitSegment=function(l,a,v,p){var E=this.demuxer,M=this.remuxer;if(!E||!M)return;E.resetInitSegment(a,v,p),M.resetInitSegment(l,a,v)},h.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},h.transmux=function(l,a,v,p,E){var M;return a&&a.method==="SAMPLE-AES"?M=this.transmuxSampleAes(l,a,v,p,E):M=this.transmuxUnencrypted(l,v,p,E),M},h.transmuxUnencrypted=function(l,a,v,p){var E=this.demuxer.demux(l,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,v,!1,this.id);return{remuxResult:D,chunkMeta:p}},h.transmuxSampleAes=function(l,a,v,p,E){var M=this;return this.demuxer.demuxSampleAes(l,a,v).then(function(F){var j=M.remuxer.remux(F.audioTrack,F.avcTrack,F.id3Track,F.textTrack,v,p,!1,M.id);return{remuxResult:j,chunkMeta:E}})},h.configureTransmuxer=function(l,a){for(var v=this.config,p=this.observer,E=this.typeSupported,M=this.vendor,F=a.audioCodec,j=a.defaultInitPts,W=a.duration,D=a.initSegmentData,R=a.videoCodec,H,Y=0,ee=d.length;Y<ee;Y++)if(d[Y].demux.probe(l)){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(p,v,E,M)),(!oe||!(oe instanceof he))&&(this.demuxer=new he(p,v,E),this.probe=he.probe),this.resetInitSegment(D,F,R,W),this.resetInitialTimestamp(j)},h.needsProbing=function(l,a,v){return!this.demuxer||!this.remuxer||a||v},h.getDecrypter=function(){var l=this.decrypter;return l||(l=this.decrypter=new P.default(this.observer,this.config)),l},m}();function s(m,h){var c=null;return m.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 g(m){return"then"in m&&m.then instanceof Function}var f=function(h,c,l,a,v){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=l,this.duration=a,this.defaultInitPts=v},C=function(h,c,l,a,v){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=l,this.trackSwitch=a,this.timeOffset=v}},"./src/demux/tsdemuxer.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"discardEPB",function(){return w});var G=L("./src/demux/adts.ts"),I=L("./src/demux/mpegaudio.ts"),P=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"),b=L("./src/utils/logger.ts"),S=L("./src/errors.ts"),O={video:1,audio:2,id3:3,text:4},_=function(){function g(C,m,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=m,this.typeSupported=h}g.probe=function(m){var h=g.syncOffset(m);return h<0?!1:(h&&b.logger.warn("MPEG2-TS detected but first sync word found @ offset "+h+", junk ahead ?"),!0)},g.syncOffset=function(m){for(var h=Math.min(1e3,m.length-3*188),c=0;c<h;){if(m[c]===71&&m[c+188]===71&&m[c+2*188]===71)return c;c++}return-1},g.createTrack=function(m,h){return{container:m==="video"||m==="audio"?"video/mp2t":void 0,type:m,id:O[m],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:m==="audio"?h:void 0}};var f=g.prototype;return f.resetInitSegment=function(m,h,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=g.createTrack("video",c),this._audioTrack=g.createTrack("audio",c),this._id3Track=g.createTrack("id3",c),this._txtTrack=g.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=m,this.videoCodec=h,this._duration=c},f.resetTimeStamp=function(){},f.resetContiguity=function(){var m=this._audioTrack,h=this._avcTrack,c=this._id3Track;m&&(m.pesData=null),h&&(h.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},f.demux=function(m,h,c,l){c===void 0&&(c=!1),l===void 0&&(l=!1),c||(this.sampleAes=null);var a,v=this._avcTrack,p=this._audioTrack,E=this._id3Track,M=v.pid,F=v.pesData,j=p.pid,W=E.pid,D=p.pesData,R=E.pesData,H=!1,Y=this.pmtParsed,ee=this._pmtId,oe=m.length;if(this.remainderData&&(m=Object(A.appendUint8Array)(this.remainderData,m),oe=m.length,this.remainderData=null),oe<188&&!l)return this.remainderData=m,{audioTrack:p,avcTrack:v,id3Track:E,textTrack:this._txtTrack};var Te=Math.max(0,g.syncOffset(m));oe-=(oe+Te)%188,oe<m.byteLength&&!l&&(this.remainderData=new Uint8Array(m.buffer,oe,m.buffer.byteLength-oe));for(var ye=Te;ye<oe;ye+=188)if(m[ye]===71){var he=!!(m[ye+1]&64),le=((m[ye+1]&31)<<8)+m[ye+2],pe=(m[ye+3]&48)>>4,ie=void 0;if(pe>1){if(ie=ye+5+m[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(m.subarray(ie,ye+188)),F.size+=ye+188-ie);break;case j:he&&(D&&(a=o(D))&&(p.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),D={data:[],size:0}),D&&(D.data.push(m.subarray(ie,ye+188)),D.size+=ye+188-ie);break;case W:he&&(R&&(a=o(R))&&this.parseID3PES(a),R={data:[],size:0}),R&&(R.data.push(m.subarray(ie,ye+188)),R.size+=ye+188-ie);break;case 0:he&&(ie+=m[ie]+1),ee=this._pmtId=y(m,ie);break;case ee:{he&&(ie+=m[ie]+1);var me=d(m,ie,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);M=me.avc,M>0&&(v.pid=M),j=me.audio,j>0&&(p.pid=j,p.isAAC=me.isAAC),W=me.id3,W>0&&(E.pid=W),H&&!Y&&(b.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"});v.pesData=F,p.pesData=D,E.pesData=R;var J={audioTrack:p,avcTrack:v,id3Track:E,textTrack:this._txtTrack};return l&&this.extractRemainingSamples(J),J},f.flush=function(){var m=this.remainderData;this.remainderData=null;var h;return m?h=this.demux(m,-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(m){var h=m.audioTrack,c=m.avcTrack,l=m.id3Track,a=c.pesData,v=h.pesData,p=l.pesData,E;a&&(E=o(a))?(this.parseAVCPES(E,!0),c.pesData=null):c.pesData=a,v&&(E=o(v))?(h.isAAC?this.parseAACPES(E):this.parseMPEGPES(E),h.pesData=null):(v!=null&&v.size&&b.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=v),p&&(E=o(p))?(this.parseID3PES(E),l.pesData=null):l.pesData=p},f.demuxSampleAes=function(m,h,c){var l=this.demux(m,c,!0,!this.config.progressive),a=this.sampleAes=new U.default(this.observer,this.config,h);return this.decrypt(l,a)},f.decrypt=function(m,h){return new Promise(function(c){var l=m.audioTrack,a=m.avcTrack;l.samples&&l.isAAC?h.decryptAacSamples(l.samples,0,function(){a.samples?h.decryptAvcSamples(a.samples,0,0,function(){c(m)}):c(m)}):a.samples&&h.decryptAvcSamples(a.samples,0,0,function(){c(m)})})},f.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},f.parseAVCPES=function(m,h){var c=this,l=this._avcTrack,a=this.parseAVCNALu(m.data),v=!1,p=this.avcSample,E,M=!1;m.data=null,p&&a.length&&!l.audFound&&(u(p,l),p=this.avcSample=x(!1,m.pts,m.dts,"")),a.forEach(function(F){switch(F.type){case 1:{E=!0,p||(p=c.avcSample=x(!0,m.pts,m.dts,"")),v&&(p.debug+="NDR "),p.frame=!0;var j=F.data;if(M&&j.length>4){var W=new P.default(j).readSliceType();(W===2||W===4||W===7||W===9)&&(p.key=!0)}break}case 5:E=!0,p||(p=c.avcSample=x(!0,m.pts,m.dts,"")),v&&(p.debug+="IDR "),p.key=!0,p.frame=!0;break;case 6:{E=!0,v&&p&&(p.debug+="SEI ");var D=new P.default(w(F.data));D.readUByte();for(var R=0,H=0,Y=!1,ee=0;!Y&&D.bytesAvailable>1;){R=0;do ee=D.readUByte(),R+=ee;while(ee===255);H=0;do ee=D.readUByte(),H+=ee;while(ee===255);if(R===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(),pe=D.readUByte(),ie=31&le,me=[le,pe],J=0;J<ie;J++)me.push(D.readUByte()),me.push(D.readUByte()),me.push(D.readUByte());s(c._txtTrack.samples,{type:3,pts:m.pts,bytes:me})}}}}}else if(R===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,_e=new Uint8Array(xe),be=0;be<xe;be++)_e[be]=D.readUByte();s(c._txtTrack.samples,{pts:m.pts,payloadType:R,uuid:ne.join(""),userData:Object(B.utf8ArrayToStr)(_e),userDataBytes:_e})}}else if(H<D.bytesAvailable)for(var ve=0;ve<H;ve++)D.readUByte()}break}case 7:if(E=!0,M=!0,v&&p&&(p.debug+="SPS "),!l.sps){var we=new P.default(F.data),Oe=we.readSPS();l.width=Oe.width,l.height=Oe.height,l.pixelRatio=Oe.pixelRatio,l.sps=[F.data],l.duration=c._duration;for(var ke=F.data.subarray(1,4),Ce="avc1.",Re=0;Re<3;Re++){var je=ke[Re].toString(16);je.length<2&&(je="0"+je),Ce+=je}l.codec=Ce}break;case 8:E=!0,v&&p&&(p.debug+="PPS "),l.pps||(l.pps=[F.data]);break;case 9:E=!1,l.audFound=!0,p&&u(p,l),p=c.avcSample=x(!1,m.pts,m.dts,v?"AUD ":"");break;case 12:E=!1;break;default:E=!1,p&&(p.debug+="unknown NAL "+F.type+" ");break}if(p&&E){var He=p.units;He.push(F)}}),h&&p&&(u(p,l),this.avcSample=null)},f.getLastNalUnit=function(){var m,h=this.avcSample,c;if(!h||h.units.length===0){var l=this._avcTrack.samples;h=l[l.length-1]}if((m=h)!==null&&m!==void 0&&m.units){var a=h.units;c=a[a.length-1]}return c},f.parseAVCNALu=function(m){var h=m.byteLength,c=this._avcTrack,l=c.naluState||0,a=l,v=[],p=0,E,M,F,j=-1,W=0;for(l===-1&&(j=0,W=m[0]&31,l=0,p=1);p<h;){if(E=m[p++],!l){l=E?0:1;continue}if(l===1){l=E?0:2;continue}if(!E)l=3;else if(E===1){if(j>=0){var D={data:m.subarray(j,p-l-1),type:W};v.push(D)}else{var R=this.getLastNalUnit();if(R&&(a&&p<=4-a&&(R.state&&(R.data=R.data.subarray(0,R.data.byteLength-a))),M=p-l-1,M>0)){var H=new Uint8Array(R.data.byteLength+M);H.set(R.data,0),H.set(m.subarray(0,M),R.data.byteLength),R.data=H,R.state=0}}p<h?(F=m[p]&31,j=p,W=F,l=0):l=-1}else l=0}if(j>=0&&l>=0){var Y={data:m.subarray(j,h),type:W,state:l};v.push(Y)}if(v.length===0){var ee=this.getLastNalUnit();if(ee){var oe=new Uint8Array(ee.data.byteLength+m.byteLength);oe.set(ee.data,0),oe.set(m,ee.data.byteLength),ee.data=oe}}return c.naluState=l,v},f.parseAACPES=function(m){var h=0,c=this._audioTrack,l=this.aacOverFlow,a=m.data;if(l){this.aacOverFlow=null;var v=l.sample.unit.byteLength,p=Math.min(l.missing,v),E=v-p;l.sample.unit.set(a.subarray(0,p),E),c.samples.push(l.sample),h=l.missing}var M,F;for(M=h,F=a.length;M<F-1&&!G.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),b.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}G.initTrackConfig(c,this.observer,a,M,this.audioCodec);var D;if(m.pts!==void 0)D=m.pts;else if(l){var R=G.getFrameDuration(c.samplerate);D=l.sample.pts+R}else{b.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var H=0;M<F;)if(G.isHeader(a,M)){if(M+5<F){var Y=G.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(m){var h=m.data,c=h.length,l=0,a=0,v=m.pts;if(v===void 0){b.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(I.isHeader(h,a)){var p=I.appendFrame(this._audioTrack,h,a,v,l);if(p)a+=p.length,l++;else break}else a++},f.parseID3PES=function(m){if(m.pts===void 0){b.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(m)},g}();_.minProbeByteLength=188;function x(g,f,C,m){return{key:g,frame:!1,pts:f,dts:C,units:[],debug:m,length:0}}function y(g,f){return(g[f+10]&31)<<8|g[f+11]}function d(g,f,C,m){var h={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(g[f+1]&15)<<8|g[f+2],l=f+3+c-4,a=(g[f+10]&15)<<8|g[f+11];for(f+=12+a;f<l;){var v=(g[f+1]&31)<<8|g[f+2];switch(g[f]){case 207:if(!m){b.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:h.audio===-1&&(h.audio=v);break;case 21:h.id3===-1&&(h.id3=v);break;case 219:if(!m){b.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:h.avc===-1&&(h.avc=v);break;case 3:case 4:C?h.audio===-1&&(h.audio=v,h.isAAC=!1):b.logger.log("MPEG audio found, not supported in this browser");break;case 36:b.logger.warn("Unsupported HEVC stream type found");break;default:break}f+=((g[f+3]&15)<<8|g[f+4])+5}return h}function o(g){var f=0,C,m,h,c,l,a=g.data;if(!g||g.size===0)return null;for(;a[0].length<19&&a.length>1;){var v=new Uint8Array(a[0].length+a[1].length);v.set(a[0]),v.set(a[1],a[0].length),a[0]=v,a.splice(1,1)}C=a[0];var p=(C[0]<<16)+(C[1]<<8)+C[2];if(p===1){if(m=(C[4]<<8)+C[5],m&&m>g.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?(l=(C[14]&14)*536870912+(C[15]&255)*4194304+(C[16]&254)*16384+(C[17]&255)*128+(C[18]&254)/2,c-l>60*9e4&&(b.logger.warn(Math.round((c-l)/9e4)+"s delta between PTS and DTS, align them"),c=l)):l=c),h=C[8];var M=h+9;if(g.size<=M)return null;g.size-=M;for(var F=new Uint8Array(g.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 m&&(m-=h+3),{data:F,pts:c,dts:l,len:m}}return null}function u(g,f){if(g.units.length&&g.frame){if(g.pts===void 0){var C=f.samples,m=C.length;if(m){var h=C[m-1];g.pts=h.pts,g.dts=h.dts}else{f.dropped++;return}}f.samples.push(g)}g.debug.length&&b.logger.log(g.pts+"/"+g.dts+":"+g.debug)}function s(g,f){var C=g.length;if(C>0){if(f.pts>=g[C-1].pts)g.push(f);else for(var m=C-1;m>=0;m--)if(f.pts<g[m].pts){g.splice(m,0,f);break}}else g.push(f)}function w(g){for(var f=g.byteLength,C=[],m=1;m<f-2;)g[m]===0&&g[m+1]===0&&g[m+2]===3?(C.push(m+2),m+=2):m++;if(C.length===0)return g;var h=f-C.length,c=new Uint8Array(h),l=0;for(m=0;m<h;l++,m++)l===C[0]&&(l++,C.shift()),c[m]=g[l];return c}z.default=_},"./src/errors.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"ErrorTypes",function(){return G}),L.d(z,"ErrorDetails",function(){return I});var G;(function(P){P.NETWORK_ERROR="networkError",P.MEDIA_ERROR="mediaError",P.KEY_SYSTEM_ERROR="keySystemError",P.MUX_ERROR="muxError",P.OTHER_ERROR="otherError"})(G||(G={}));var I;(function(P){P.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",P.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",P.KEY_SYSTEM_NO_SESSION="keySystemNoSession",P.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",P.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",P.MANIFEST_LOAD_ERROR="manifestLoadError",P.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",P.MANIFEST_PARSING_ERROR="manifestParsingError",P.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",P.LEVEL_EMPTY_ERROR="levelEmptyError",P.LEVEL_LOAD_ERROR="levelLoadError",P.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",P.LEVEL_SWITCH_ERROR="levelSwitchError",P.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",P.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",P.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",P.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",P.FRAG_LOAD_ERROR="fragLoadError",P.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",P.FRAG_DECRYPT_ERROR="fragDecryptError",P.FRAG_PARSING_ERROR="fragParsingError",P.REMUX_ALLOC_ERROR="remuxAllocError",P.KEY_LOAD_ERROR="keyLoadError",P.KEY_LOAD_TIMEOUT="keyLoadTimeOut",P.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",P.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",P.BUFFER_APPEND_ERROR="bufferAppendError",P.BUFFER_APPENDING_ERROR="bufferAppendingError",P.BUFFER_STALLED_ERROR="bufferStalledError",P.BUFFER_FULL_ERROR="bufferFullError",P.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",P.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",P.INTERNAL_EXCEPTION="internalException",P.INTERNAL_ABORTED="aborted",P.UNKNOWN="unknown"})(I||(I={}))},"./src/events.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"Events",function(){return G});var G;(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"})(G||(G={}))},"./src/hls.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return g});var G=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(G),P=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"),b=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"),y=L("./node_modules/eventemitter3/index.js"),d=L.n(y),o=L("./src/events.ts"),u=L("./src/errors.ts");function s(f,C){for(var m=0;m<C.length;m++){var h=C[m];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(f,h.key,h)}}function w(f,C,m){return C&&s(f.prototype,C),m&&s(f,m),f}var g=function(){f.isSupported=function(){return Object(O.isSupported)()};function f(m){m===void 0&&(m={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new y.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,m);this.userConfig=m,Object(_.enableLogs)(h.debug),this._autoLevelCapping=-1,h.progressive&&Object(x.enableStreamingMode)(h);var c=h.abrController,l=h.bufferController,a=h.capLevelController,v=h.fpsController,p=this.abrController=new c(this),E=this.bufferController=new l(this),M=this.capLevelController=new a(this),F=new v(this),j=new P.default(this),W=new B.default(this),D=new U.default(this),R=this.levelController=new A.default(this),H=new b.FragmentTracker(this),Y=this.streamController=new S.default(this,H);M.setStreamController(Y),F.setStreamController(Y);var ee=[R,Y];this.networkControllers=ee;var oe=[j,W,p,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,l){if(h){var a=c?new h(this,c):new h(this);return l&&l.push(a),a}return null},C.on=function(h,c,l){l===void 0&&(l=this),this._emitter.on(h,c,l)},C.once=function(h,c,l){l===void 0&&(l=this),this._emitter.once(h,c,l)},C.removeAllListeners=function(h){this._emitter.removeAllListeners(h)},C.off=function(h,c,l,a){l===void 0&&(l=this),this._emitter.off(h,c,l,a)},C.listeners=function(h){return this._emitter.listeners(h)},C.emit=function(h,c,l){return this._emitter.emit(h,c,l)},C.trigger=function(h,c){if(this.config.debug)return this.emit(h,h,c);try{return this.emit(h,h,c)}catch(l){_.logger.error("An internal error happened while handling event "+h+'. Error message: "'+l.message+'". Here is a stacktrace:',l),this.trigger(o.Events.ERROR,{type:u.ErrorTypes.OTHER_ERROR,details:u.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:h,error:l})}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,l=this.url,a=this.url=G.buildAbsoluteURL(self.location.href,h,{alwaysNormalize:!0});_.logger.log("loadSource:"+a),c&&l&&l!==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 l=h.length,a=0;a<l;a++)if(h[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var h=this.levels,c=this.autoLevelCapping,l;return c===-1&&h&&h.length?l=h.length-1:l=c,l}},{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}();g.defaultConfig=void 0},"./src/is-supported.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"isSupported",function(){return P}),L.d(z,"changeTypeSupported",function(){return B});var G=L("./src/utils/mediasource-helper.ts");function I(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var U=Object(G.getMediaSource)();if(!U)return!1;var k=I(),A=U&&typeof U.isTypeSupported=="function"&&U.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),b=!k||k.prototype&&typeof k.prototype.appendBuffer=="function"&&typeof k.prototype.remove=="function";return!!A&&!!b}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,z,L){"use strict";L.r(z),L.d(z,"default",function(){return _}),L.d(z,"LoadError",function(){return y});var G=L("./src/polyfills/number.ts"),I=L("./src/errors.ts");function P(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,b(d,o)}function B(d){var o=typeof Map=="function"?new Map:void 0;return B=function(s){if(s===null||!A(s))return s;if(typeof s!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(s))return o.get(s);o.set(s,w)}function w(){return U(s,arguments,S(this).constructor)}return w.prototype=Object.create(s.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),b(w,s)},B(d)}function U(d,o,u){return k()?U=Reflect.construct:U=function(w,g,f){var C=[null];C.push.apply(C,g);var m=Function.bind.apply(w,C),h=new m;return f&&b(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 b(d,o){return b=Object.setPrototypeOf||function(s,w){return s.__proto__=w,s},b(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(s,w){var g=this,f=s.url;if(!f)return Promise.reject(new y({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,networkDetails:null},"Fragment does not have a "+(f?"part list":"url")));this.abort();var C=this.config,m=C.fLoader,h=C.loader;return new Promise(function(c,l){g.loader&&g.loader.destroy();var a=g.loader=s.loader=m?new m(C):new h(C),v=x(s),p={timeout:C.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:C.fragLoadingMaxRetryTimeout,highWaterMark:O};s.stats=a.stats,a.load(v,p,{onSuccess:function(M,F,j,W){g.resetLoader(s,a),c({frag:s,part:null,payload:M.data,networkDetails:W})},onError:function(M,F,j){g.resetLoader(s,a),l(new y({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,response:M,networkDetails:j}))},onAbort:function(M,F,j){g.resetLoader(s,a),l(new y({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,networkDetails:j}))},onTimeout:function(M,F,j){g.resetLoader(s,a),l(new y({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,networkDetails:j}))},onProgress:function(M,F,j,W){w&&w({frag:s,part:null,payload:j,networkDetails:W})}})})},o.loadPart=function(s,w,g){var f=this;this.abort();var C=this.config,m=C.fLoader,h=C.loader;return new Promise(function(c,l){f.loader&&f.loader.destroy();var a=f.loader=s.loader=m?new m(C):new h(C),v=x(s,w),p={timeout:C.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:C.fragLoadingMaxRetryTimeout,highWaterMark:O};w.stats=a.stats,a.load(v,p,{onSuccess:function(M,F,j,W){f.resetLoader(s,a),f.updateStatsFromPart(s,w);var D={frag:s,part:w,payload:M.data,networkDetails:W};g(D),c(D)},onError:function(M,F,j){f.resetLoader(s,a),l(new y({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,part:w,response:M,networkDetails:j}))},onAbort:function(M,F,j){s.stats.aborted=w.stats.aborted,f.resetLoader(s,a),l(new y({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,part:w,networkDetails:j}))},onTimeout:function(M,F,j){f.resetLoader(s,a),l(new y({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,part:w,networkDetails:j}))}})})},o.updateStatsFromPart=function(s,w){var g=s.stats,f=w.stats,C=f.total;if(g.loaded+=f.loaded,C){var m=Math.round(s.duration/w.duration),h=Math.min(Math.round(g.loaded/C),m),c=m-h,l=c*Math.round(g.loaded/h);g.total=g.loaded+l}else g.total=Math.max(g.loaded,g.total);var a=g.loading,v=f.loading;a.start?a.first+=v.first-v.start:(a.start=v.start,a.first=v.first),a.end=v.end},o.resetLoader=function(s,w){s.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,s={frag:d,part:o,responseType:"arraybuffer",url:u.url,headers:{},rangeStart:0,rangeEnd:0},w=u.byteRangeStartOffset,g=u.byteRangeEndOffset;return Object(G.isFiniteNumber)(w)&&Object(G.isFiniteNumber)(g)&&(s.rangeStart=w,s.rangeEnd=g),s}var y=function(d){P(o,d);function o(u){for(var s,w=arguments.length,g=new Array(w>1?w-1:0),f=1;f<w;f++)g[f-1]=arguments[f];return s=d.call.apply(d,[this].concat(g))||this,s.data=void 0,s.data=u,s}return o}(B(Error))},"./src/loader/fragment.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"ElementaryStreamTypes",function(){return _}),L.d(z,"BaseSegment",function(){return x}),L.d(z,"Fragment",function(){return y}),L.d(z,"Part",function(){return d});var G=L("./src/polyfills/number.ts"),I=L("./node_modules/url-toolkit/src/url-toolkit.js"),P=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,b(o,u)}function b(o,u){return b=Object.setPrototypeOf||function(w,g){return w.__proto__=g,w},b(o,u)}function S(o,u){for(var s=0;s<u.length;s++){var w=u[s];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function O(o,u,s){return u&&S(o.prototype,u),s&&S(o,s),o}var _;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(_||(_={}));var x=function(){function o(s){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=s}var u=o.prototype;return u.setByteRange=function(w,g){var f=w.split("@",2),C=[];f.length===1?C[0]=g?g.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}(),y=function(o){A(u,o);function u(w,g){var f;return f=o.call(this,g)||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 s=u.prototype;return s.createInitializationVector=function(g){for(var f=new Uint8Array(16),C=12;C<16;C++)f[C]=g>>8*(15-C)&255;return f},s.setDecryptDataFromLevelKey=function(g,f){var C=g;return(g==null?void 0:g.method)==="AES-128"&&g.uri&&!g.iv&&(C=U.LevelKey.fromURI(g.uri),C.method=g.method,C.iv=this.createInitializationVector(f),C.keyFormat="identity"),C},s.setElementaryStreamInfo=function(g,f,C,m,h,c){c===void 0&&(c=!1);var l=this.elementaryStreams,a=l[g];if(!a){l[g]={startPTS:f,endPTS:C,startDTS:m,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,m),a.endDTS=Math.max(a.endDTS,h)},s.clearElementaryStreamInfo=function(){var g=this.elementaryStreams;g[_.AUDIO]=null,g[_.VIDEO]=null,g[_.AUDIOVIDEO]=null},O(u,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var g=this.sn;typeof g!="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'),g=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,g)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(G.isFiniteNumber)(this.programDateTime))return null;var g=Object(G.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+g*1e3}},{key:"encrypted",get:function(){var g;return!!((g=this.decryptdata)!==null&&g!==void 0&&g.keyFormat&&this.decryptdata.uri)}}]),u}(x),d=function(o){A(u,o);function u(s,w,g,f,C){var m;m=o.call(this,g)||this,m.fragOffset=0,m.duration=0,m.gap=!1,m.independent=!1,m.relurl=void 0,m.fragment=void 0,m.index=void 0,m.stats=new k.LoadStats,m.duration=s.decimalFloatingPoint("DURATION"),m.gap=s.bool("GAP"),m.independent=s.bool("INDEPENDENT"),m.relurl=s.enumeratedString("URI"),m.fragment=w,m.index=f;var h=s.enumeratedString("BYTERANGE");return h&&m.setByteRange(h,C),C&&(m.fragOffset=C.fragOffset+C.duration),m}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,z,L){"use strict";L.r(z),L.d(z,"default",function(){return B});var G=L("./src/events.ts"),I=L("./src/errors.ts"),P=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(G.Events.KEY_LOADING,this.onKeyLoading,this)},k._unregisterListeners=function(){this.hls.off(G.Events.KEY_LOADING,this.onKeyLoading)},k.destroy=function(){this._unregisterListeners();for(var b in this.loaders){var S=this.loaders[b];S&&S.destroy()}this.loaders={}},k.onKeyLoading=function(b,S){var O=S.frag,_=O.type,x=this.loaders[_];if(!O.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var y=O.decryptdata.uri;if(y!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(x&&(P.logger.warn("abort previous key loader for type:"+_),x.abort()),!y){P.logger.warn("key uri is falsy");return}var o=d.loader,u=O.loader=this.loaders[_]=new o(d);this.decrypturl=y,this.decryptkey=null;var s={url:y,frag:O,responseType:"arraybuffer"},w={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(s,w,g)}else this.decryptkey&&(O.decryptdata.key=this.decryptkey,this.hls.trigger(G.Events.KEY_LOADED,{frag:O}))},k.loadsuccess=function(b,S,O){var _=O.frag;if(!_.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=_.decryptdata.key=new Uint8Array(b.data),_.loader=null,delete this.loaders[_.type],this.hls.trigger(G.Events.KEY_LOADED,{frag:_})},k.loaderror=function(b,S){var O=S.frag,_=O.loader;_&&_.abort(),delete this.loaders[O.type],this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:O,response:b})},k.loadtimeout=function(b,S){var O=S.frag,_=O.loader;_&&_.abort(),delete this.loaders[O.type],this.hls.trigger(G.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,z,L){"use strict";L.r(z),L.d(z,"LevelDetails",function(){return U});var G=L("./src/polyfills/number.ts");function I(k,A){for(var b=0;b<A.length;b++){var S=A[b];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(k,S.key,S)}}function P(k,A,b){return A&&I(k.prototype,A),b&&I(k,b),k}var B=10,U=function(){function k(b){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=b}var 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},P(k,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(G.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,z,L){"use strict";L.r(z),L.d(z,"LevelKey",function(){return U});var G=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(G);function P(k,A){for(var b=0;b<A.length;b++){var S=A[b];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(k,S.key,S)}}function B(k,A,b){return A&&P(k.prototype,A),b&&P(k,b),k}var U=function(){k.fromURL=function(b,S){return new k(b,S)},k.fromURI=function(b){return new k(b)};function k(A,b){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,b?this._uri=Object(G.buildAbsoluteURL)(A,b,{alwaysNormalize:!0}):this._uri=A}return B(k,[{key:"uri",get:function(){return this._uri}}]),k}()},"./src/loader/load-stats.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"LoadStats",function(){return G});var G=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,z,L){"use strict";L.r(z),L.d(z,"default",function(){return u});var G=L("./src/polyfills/number.ts"),I=L("./node_modules/url-toolkit/src/url-toolkit.js"),P=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"),b=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"),y=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 m,h;return d.test((m=(h=I.parseURL(C))===null||h===void 0?void 0:h.path)!=null?m:"")}var u=function(){function C(){}return C.findGroup=function(h,c){for(var l=0;l<h.length;l++){var a=h[l];if(a.id===c)return a}},C.convertAVC1ToAVCOTI=function(h){var c=h.split(".");if(c.length>2){var l=c.shift()+".";return l+=parseInt(c.shift()).toString(16),l+=("000"+parseInt(c.shift()).toString(16)).substr(-4),l}return h},C.resolve=function(h,c){return I.buildAbsoluteURL(c,h,{alwaysNormalize:!0})},C.parseMasterPlaylist=function(h,c){var l=[],a={},v=!1;O.lastIndex=0;for(var p;(p=O.exec(h))!=null;)if(p[1]){var E=new A.AttrList(p[1]),M={attrs:E,bitrate:E.decimalInteger("AVERAGE-BANDWIDTH")||E.decimalInteger("BANDWIDTH"),name:E.NAME,url:C.resolve(p[2],c)},F=E.decimalResolution("RESOLUTION");F&&(M.width=F.width,M.height=F.height),s((E.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=C.convertAVC1ToAVCOTI(M.videoCodec)),l.push(M)}else if(p[3]){var j=new A.AttrList(p[3]);j["DATA-ID"]&&(v=!0,a[j["DATA-ID"]]=j)}return{levels:l,sessionData:v?a:null}},C.parseMasterPlaylistMedia=function(h,c,l,a){a===void 0&&(a=[]);var v,p=[],E=0;for(_.lastIndex=0;(v=_.exec(h))!==null;){var M=new A.AttrList(v[1]);if(M.TYPE===l){var F={attrs:M,bitrate:0,id:E++,groupId:M["GROUP-ID"],instreamId:M["INSTREAM-ID"],name:M.NAME||M.LANGUAGE||"",type:l,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")}p.push(F)}}return p},C.parseLevelPlaylist=function(h,c,l,a,v){var p=new U.LevelDetails(c),E=p.fragments,M=null,F=0,j=0,W=0,D=0,R=null,H=new B.Fragment(a,c),Y,ee,oe,Te=-1,ye=!1;for(x.lastIndex=0,p.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=l,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(G.isFiniteNumber)(H.duration)&&(H.start=W,oe&&(H.levelkey=oe),H.sn=F,H.level=l,H.cc=D,H.urlId=v,E.push(H),H.relurl=(" "+Y[3]).slice(1),f(H,R),R=H,W+=H.duration,F++,j=0,ye=!0);else if(Y[4]){var pe=(" "+Y[4]).slice(1);R?H.setByteRange(pe,R):H.setByteRange(pe)}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(y),!Y){b.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),me=(" "+Y[ee+1]).slice(1),J=Y[ee+2]?(" "+Y[ee+2]).slice(1):"";switch(ie){case"PLAYLIST-TYPE":p.type=me.toUpperCase();break;case"MEDIA-SEQUENCE":F=p.startSN=parseInt(me);break;case"SKIP":{var ne=new A.AttrList(me),q=ne.decimalInteger("SKIPPED-SEGMENTS");if(Object(G.isFiniteNumber)(q)){p.skippedSegments=q;for(var xe=q;xe--;)E.unshift(null);F+=q}var _e=ne.enumeratedString("RECENTLY-REMOVED-DATERANGES");_e&&(p.recentlyRemovedDateranges=_e.split(" "));break}case"TARGETDURATION":p.targetduration=parseFloat(me);break;case"VERSION":p.version=parseInt(me);break;case"EXTM3U":break;case"ENDLIST":p.live=!1;break;case"#":(me||J)&&H.tagList.push(J?[me,J]:[me]);break;case"DIS":D++;case"GAP":H.tagList.push([ie]);break;case"BITRATE":H.tagList.push([ie,me]);break;case"DISCONTINUITY-SEQ":D=parseInt(me);break;case"KEY":{var be,ve=new A.AttrList(me),we=ve.enumeratedString("METHOD"),Oe=ve.URI,ke=ve.hexadecimalInteger("IV"),Ce=ve.enumeratedString("KEYFORMATVERSIONS"),Re=ve.enumeratedString("KEYID"),je=(be=ve.enumeratedString("KEYFORMAT"))!=null?be:"identity",He=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(He.indexOf(je)>-1){b.logger.warn("Keyformat "+je+" is not supported from the manifest");continue}else if(je!=="identity")continue;we&&(oe=k.LevelKey.fromURL(c,Oe),Oe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(we)>=0&&(oe.method=we,oe.keyFormat=je,Re&&(oe.keyID=Re),Ce&&(oe.keyFormatVersions=Ce),oe.iv=ke));break}case"START":{var Be=new A.AttrList(me),Ne=Be.decimalFloatingPoint("TIME-OFFSET");Object(G.isFiniteNumber)(Ne)&&(p.startTimeOffset=Ne);break}case"MAP":{var qe=new A.AttrList(me);H.relurl=qe.URI,qe.BYTERANGE&&H.setByteRange(qe.BYTERANGE),H.level=l,H.sn="initSegment",oe&&(H.levelkey=oe),H.initSegment=null,M=H,ye=!0;break}case"SERVER-CONTROL":{var Xe=new A.AttrList(me);p.canBlockReload=Xe.bool("CAN-BLOCK-RELOAD"),p.canSkipUntil=Xe.optionalFloat("CAN-SKIP-UNTIL",0),p.canSkipDateRanges=p.canSkipUntil>0&&Xe.bool("CAN-SKIP-DATERANGES"),p.partHoldBack=Xe.optionalFloat("PART-HOLD-BACK",0),p.holdBack=Xe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ze=new A.AttrList(me);p.partTarget=Ze.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Le=p.partList;Le||(Le=p.partList=[]);var et=j>0?Le[Le.length-1]:void 0,Ve=j++,Pe=new B.Part(new A.AttrList(me),H,c,Ve,et);Le.push(Pe),H.duration+=Pe.duration;break}case"PRELOAD-HINT":{var Ie=new A.AttrList(me);p.preloadHint=Ie;break}case"RENDITION-REPORT":{var ge=new A.AttrList(me);p.renditionReports=p.renditionReports||[],p.renditionReports.push(ge);break}default:b.logger.warn("line parsed but not handled: "+Y);break}}}R&&!R.relurl?(E.pop(),W-=R.duration,p.partList&&(p.fragmentHint=R)):p.partList&&(f(H,R),H.cc=D,p.fragmentHint=H);var de=E.length,ce=E[0],X=E[de-1];if(W+=p.skippedSegments*p.targetduration,W>0&&de&&X){p.averagetargetduration=W/de;var Q=X.sn;p.endSN=Q!=="initSegment"?Q:0,ce&&(p.startCC=ce.cc,ce.initSegment||p.fragments.every(function(te){return te.relurl&&o(te.relurl)})&&(b.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=l,H.sn="initSegment",ce.initSegment=H,p.needSidxRanges=!0))}else p.endSN=0,p.startCC=0;return p.fragmentHint&&(W+=p.fragmentHint.duration),p.totalduration=W,p.endCC=D,Te>0&&g(E,Te),p},C}();function s(C,m){["video","audio","text"].forEach(function(h){var c=C.filter(function(a){return Object(S.isCodecType)(a,h)});if(c.length){var l=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});m[h+"Codec"]=l.length>0?l[0]:c[0],C=C.filter(function(a){return c.indexOf(a)===-1})}}),m.unknownCodecs=C}function w(C,m,h){var c=m[h];c&&(C[h]=c)}function g(C,m){for(var h=C[m],c=m;c--;){var l=C[c];if(!l)return;l.programDateTime=h.programDateTime-l.duration*1e3,h=l}}function f(C,m){C.rawProgramDateTime?C.programDateTime=Date.parse(C.rawProgramDateTime):m!=null&&m.programDateTime&&(C.programDateTime=m.endProgramDateTime),Object(G.isFiniteNumber)(C.programDateTime)||(C.programDateTime=null,C.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(re,z,L){"use strict";L.r(z);var G=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),P=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"),b=L("./src/utils/attr-list.ts");function S(x){var y=x.type;switch(y){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,y){var d=x.url;return(d===void 0||d.indexOf("data:")===0)&&(d=y.url),d}var _=function(){function x(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var y=x.prototype;return y.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)},y.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)},y.createInternalLoader=function(o){var u=this.hls.config,s=u.pLoader,w=u.loader,g=s||w,f=new g(u);return o.loader=f,this.loaders[o.type]=f,f},y.getInternalLoader=function(o){return this.loaders[o.type]},y.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},y.destroyInternalLoaders=function(){for(var o in this.loaders){var u=this.loaders[o];u&&u.destroy(),this.resetInternalLoader(o)}},y.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},y.onManifestLoading=function(o,u){var s=u.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:A.PlaylistContextType.MANIFEST,url:s,deliveryDirectives:null})},y.onLevelLoading=function(o,u){var s=u.id,w=u.level,g=u.url,f=u.deliveryDirectives;this.load({id:s,groupId:null,level:w,responseType:"text",type:A.PlaylistContextType.LEVEL,url:g,deliveryDirectives:f})},y.onAudioTrackLoading=function(o,u){var s=u.id,w=u.groupId,g=u.url,f=u.deliveryDirectives;this.load({id:s,groupId:w,level:null,responseType:"text",type:A.PlaylistContextType.AUDIO_TRACK,url:g,deliveryDirectives:f})},y.onSubtitleTrackLoading=function(o,u){var s=u.id,w=u.groupId,g=u.url,f=u.deliveryDirectives;this.load({id:s,groupId:w,level:null,responseType:"text",type:A.PlaylistContextType.SUBTITLE_TRACK,url:g,deliveryDirectives:f})},y.load=function(o){var u,s=this.hls.config,w=this.getInternalLoader(o);if(w){var g=w.context;if(g&&g.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,m,h;switch(o.type){case A.PlaylistContextType.MANIFEST:f=s.manifestLoadingMaxRetry,C=s.manifestLoadingTimeOut,m=s.manifestLoadingRetryDelay,h=s.manifestLoadingMaxRetryTimeout;break;case A.PlaylistContextType.LEVEL:case A.PlaylistContextType.AUDIO_TRACK:case A.PlaylistContextType.SUBTITLE_TRACK:f=0,C=s.levelLoadingTimeOut;break;default:f=s.levelLoadingMaxRetry,C=s.levelLoadingTimeOut,m=s.levelLoadingRetryDelay,h=s.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 l=c.partTarget,a=c.targetduration;l&&a&&(C=Math.min(Math.max(l*3,a*.8)*1e3,C))}}var v={timeout:C,maxRetry:f,retryDelay:m,maxRetryDelay:h,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};w.load(o,v,p)},y.loadsuccess=function(o,u,s,w){if(w===void 0&&(w=null),s.isSidxRequest){this.handleSidxRequest(o,s),this.handlePlaylistLoaded(o,u,s,w);return}this.resetInternalLoader(s.type);var g=o.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,s,"no EXTM3U delimiter",w);return}u.parsing.start=performance.now(),g.indexOf("#EXTINF:")>0||g.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,u,s,w):this.handleMasterPlaylist(o,u,s,w)},y.loaderror=function(o,u,s){s===void 0&&(s=null),this.handleNetworkError(u,s,!1,o)},y.loadtimeout=function(o,u,s){s===void 0&&(s=null),this.handleNetworkError(u,s,!0)},y.handleMasterPlaylist=function(o,u,s,w){var g=this.hls,f=o.data,C=O(o,s),m=k.default.parseMasterPlaylist(f,C),h=m.levels,c=m.sessionData;if(!h.length){this.handleManifestParsingError(o,s,"no level found in manifest",w);return}var l=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}}),v=k.default.parseMasterPlaylistMedia(f,C,"AUDIO",l),p=k.default.parseMasterPlaylistMedia(f,C,"SUBTITLES",a),E=k.default.parseMasterPlaylistMedia(f,C,"CLOSED-CAPTIONS");if(v.length){var M=v.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"),v.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new b.AttrList({}),bitrate:0,url:""}))}g.trigger(I.Events.MANIFEST_LOADED,{levels:h,audioTracks:v,subtitles:p,captions:E,url:C,stats:u,networkDetails:w,sessionData:c})},y.handleTrackOrLevelPlaylist=function(o,u,s,w){var g=this.hls,f=s.id,C=s.level,m=s.type,h=O(o,s),c=Object(G.isFiniteNumber)(f)?f:0,l=Object(G.isFiniteNumber)(C)?C:c,a=S(s),v=k.default.parseLevelPlaylist(o.data,h,l,a,c);if(!v.fragments.length){g.trigger(I.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:h,reason:"no fragments found in level",level:typeof s.level=="number"?s.level:void 0});return}if(m===A.PlaylistContextType.MANIFEST){var p={attrs:new b.AttrList({}),bitrate:0,details:v,name:"",url:h};g.trigger(I.Events.MANIFEST_LOADED,{levels:[p],audioTracks:[],url:h,stats:u,networkDetails:w,sessionData:null})}if(u.parsing.end=performance.now(),v.needSidxRanges){var E,M=(E=v.fragments[0].initSegment)===null||E===void 0?void 0:E.url;this.load({url:M,isSidxRequest:!0,type:m,level:C,levelDetails:v,id:f,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}s.levelDetails=v,this.handlePlaylistLoaded(o,u,s,w)},y.handleSidxRequest=function(o,u){var s=Object(U.parseSegmentIndex)(new Uint8Array(o.data));if(!s)return;var w=s.references,g=u.levelDetails;w.forEach(function(f,C){var m=f.info,h=g.fragments[C];h.byteRange.length===0&&h.setByteRange(String(1+m.end-m.start)+"@"+String(m.start)),h.initSegment&&h.initSegment.setByteRange(String(s.moovEndOffset)+"@0")})},y.handleManifestParsingError=function(o,u,s,w){this.hls.trigger(I.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:u.type===A.PlaylistContextType.MANIFEST,url:o.url,reason:s,response:o,context:u,networkDetails:w})},y.handleNetworkError=function(o,u,s,w){s===void 0&&(s=!1),B.logger.warn("[playlist-loader]: A network "+(s?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var g=P.ErrorDetails.UNKNOWN,f=!1,C=this.getInternalLoader(o);switch(o.type){case A.PlaylistContextType.MANIFEST:g=s?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,f=!0;break;case A.PlaylistContextType.LEVEL:g=s?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,f=!1;break;case A.PlaylistContextType.AUDIO_TRACK:g=s?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,f=!1;break;case A.PlaylistContextType.SUBTITLE_TRACK:g=s?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,f=!1;break}C&&this.resetInternalLoader(o.type);var m={type:P.ErrorTypes.NETWORK_ERROR,details:g,fatal:f,url:o.url,loader:C,context:o,networkDetails:u};w&&(m.response=w),this.hls.trigger(I.Events.ERROR,m)},y.handlePlaylistLoaded=function(o,u,s,w){var g=s.type,f=s.level,C=s.id,m=s.groupId,h=s.loader,c=s.levelDetails,l=s.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,s,"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(g){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:l});break;case A.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(I.Events.AUDIO_TRACK_LOADED,{details:c,id:C||0,groupId:m||"",stats:u,networkDetails:w,deliveryDirectives:l});break;case A.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADED,{details:c,id:C||0,groupId:m||"",stats:u,networkDetails:w,deliveryDirectives:l});break}},x}();z.default=_},"./src/polyfills/number.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"isFiniteNumber",function(){return G}),L.d(z,"MAX_SAFE_INTEGER",function(){return I});var G=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},I=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(re,z,L){"use strict";L.r(z);var G=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}();z.default=G},"./src/remux/mp4-generator.ts":function(re,z,L){"use strict";L.r(z);var G=Math.pow(2,32)-1,I=function(){function P(){}return P.init=function(){P.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 P.types)P.types.hasOwnProperty(U)&&(P.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]);P.HDLR_TYPES={video:k,audio:A};var b=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]);P.STTS=P.STSC=P.STCO=S,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.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]);P.FTYP=P.box(P.types.ftyp,O,x,O,_),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,b))},P.box=function(U){for(var k=8,A=arguments.length,b=new Array(A>1?A-1:0),S=1;S<A;S++)b[S-1]=arguments[S];for(var O=b.length,_=O;O--;)k+=b[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(b[O],k),k+=b[O].byteLength;return x},P.hdlr=function(U){return P.box(P.types.hdlr,P.HDLR_TYPES[U])},P.mdat=function(U){return P.box(P.types.mdat,U)},P.mdhd=function(U,k){k*=U;var A=Math.floor(k/(G+1)),b=Math.floor(k%(G+1));return P.box(P.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,b>>24,b>>16&255,b>>8&255,b&255,85,196,0,0]))},P.mdia=function(U){return P.box(P.types.mdia,P.mdhd(U.timescale,U.duration),P.hdlr(U.type),P.minf(U))},P.mfhd=function(U){return P.box(P.types.mfhd,new Uint8Array([0,0,0,0,U>>24,U>>16&255,U>>8&255,U&255]))},P.minf=function(U){return U.type==="audio"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(U)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(U))},P.moof=function(U,k,A){return P.box(P.types.moof,P.mfhd(U),P.traf(A,k))},P.moov=function(U){for(var k=U.length,A=[];k--;)A[k]=P.trak(U[k]);return P.box.apply(null,[P.types.moov,P.mvhd(U[0].timescale,U[0].duration)].concat(A).concat(P.mvex(U)))},P.mvex=function(U){for(var k=U.length,A=[];k--;)A[k]=P.trex(U[k]);return P.box.apply(null,[P.types.mvex].concat(A))},P.mvhd=function(U,k){k*=U;var A=Math.floor(k/(G+1)),b=Math.floor(k%(G+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,b>>24,b>>16&255,b>>8&255,b&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return P.box(P.types.mvhd,S)},P.sdtp=function(U){var k=U.samples||[],A=new Uint8Array(4+k.length),b,S;for(b=0;b<k.length;b++)S=k[b].flags,A[b+4]=S.dependsOn<<4|S.isDependedOn<<2|S.hasRedundancy;return P.box(P.types.sdtp,A)},P.stbl=function(U){return P.box(P.types.stbl,P.stsd(U),P.box(P.types.stts,P.STTS),P.box(P.types.stsc,P.STSC),P.box(P.types.stsz,P.STSZ),P.box(P.types.stco,P.STCO))},P.avc1=function(U){var k=[],A=[],b,S,O;for(b=0;b<U.sps.length;b++)S=U.sps[b],O=S.byteLength,k.push(O>>>8&255),k.push(O&255),k=k.concat(Array.prototype.slice.call(S));for(b=0;b<U.pps.length;b++)S=U.pps[b],O=S.byteLength,A.push(O>>>8&255),A.push(O&255),A=A.concat(Array.prototype.slice.call(S));var _=P.box(P.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,y=U.height,d=U.pixelRatio[0],o=U.pixelRatio[1];return P.box(P.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,y>>8&255,y&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]),_,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,o>>24,o>>16&255,o>>8&255,o&255])))},P.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]))},P.mp4a=function(U){var k=U.samplerate;return P.box(P.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]),P.box(P.types.esds,P.esds(U)))},P.mp3=function(U){var k=U.samplerate;return P.box(P.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]))},P.stsd=function(U){return U.type==="audio"?!U.isAAC&&U.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(U)):P.box(P.types.stsd,P.STSD,P.mp4a(U)):P.box(P.types.stsd,P.STSD,P.avc1(U))},P.tkhd=function(U){var k=U.id,A=U.duration*U.timescale,b=U.width,S=U.height,O=Math.floor(A/(G+1)),_=Math.floor(A%(G+1));return P.box(P.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,b>>8&255,b&255,0,0,S>>8&255,S&255,0,0]))},P.traf=function(U,k){var A=P.sdtp(U),b=U.id,S=Math.floor(k/(G+1)),O=Math.floor(k%(G+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,b>>24,b>>16&255,b>>8&255,b&255])),P.box(P.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])),P.trun(U,A.length+16+20+8+16+8+8),A)},P.trak=function(U){return U.duration=U.duration||4294967295,P.box(P.types.trak,P.tkhd(U),P.mdia(U))},P.trex=function(U){var k=U.id;return P.box(P.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]))},P.trun=function(U,k){var A=U.samples||[],b=A.length,S=12+16*b,O=new Uint8Array(S),_,x,y,d,o,u;for(k+=8+S,O.set([0,0,15,1,b>>>24&255,b>>>16&255,b>>>8&255,b&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255],0),_=0;_<b;_++)x=A[_],y=x.duration,d=x.size,o=x.flags,u=x.cts,O.set([y>>>24&255,y>>>16&255,y>>>8&255,y&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 P.box(P.types.trun,O)},P.initSegment=function(U){P.types||P.init();var k=P.moov(U),A=new Uint8Array(P.FTYP.byteLength+k.byteLength);return A.set(P.FTYP),A.set(k,P.FTYP.byteLength),A},P}();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,z.default=I},"./src/remux/mp4-remuxer.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return u}),L.d(z,"normalizePts",function(){return s});var G=L("./src/polyfills/number.ts"),I=L("./src/remux/aac-helper.ts"),P=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"),b=L("./src/utils/timescale-conversion.ts");function S(){return S=Object.assign||function(C){for(var m=1;m<arguments.length;m++){var h=arguments[m];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,y=null,d=null,o=!1,u=function(){function C(h,c,l,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=l,this.ISGenerated=!1,y===null){var v=navigator.userAgent||"",p=v.match(/Chrome\/(\d+)/i);y=p?parseInt(p[1]):0}if(d===null){var E=navigator.userAgent.match(/Safari\/(\d+)/i);d=E?parseInt(E[1]):0}o=!!y&&y<75||!!d&&d<600}var m=C.prototype;return m.destroy=function(){},m.resetTimeStamp=function(c){k.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},m.resetNextTimestamp=function(){k.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},m.resetInitSegment=function(){k.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},m.getVideoStartPts=function(c){var l=!1,a=c.reduce(function(v,p){var E=p.pts-v;return E<-4294967296?(l=!0,s(v,p.pts)):E>0?v:p.pts},c[0].pts);return l&&k.logger.debug("PTS rollover detected"),a},m.remux=function(c,l,a,v,p,E,M,F){var j,W,D,R,H,Y,ee=p,oe=p,Te=c.pid>-1,ye=l.pid>-1,he=l.samples.length,le=c.samples.length>0,pe=he>1,ie=(!Te||le)&&(!ye||pe)||this.ISGenerated||M;if(ie){this.ISGenerated||(D=this.generateIS(c,l,p));var me=this.isVideoContiguous,J=-1;if(pe&&(J=w(l.samples),!me&&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(l.samples);l.samples=l.samples.slice(J),l.dropped+=J,oe+=(l.samples[0].pts-ne)/(l.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&&pe){var q=this.getVideoStartPts(l.samples),xe=s(c.samples[0].pts,q)-q,_e=xe/l.inputTimeScale;ee+=Math.max(0,_e),oe+=Math.max(0,-_e)}if(le){if(c.samplerate||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),D=this.generateIS(c,l,p)),W=this.remuxAudio(c,ee,this.isAudioContiguous,E,ye||pe||F===A.PlaylistLevelType.AUDIO?oe:void 0),pe){var be=W?W.endPTS-W.startPTS:0;l.inputTimeScale||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),D=this.generateIS(c,l,p)),j=this.remuxVideo(l,oe,me,be)}}else pe&&(j=this.remuxVideo(l,oe,me,0));j&&(j.firstKeyFrame=J,j.independent=J!==-1)}}return this.ISGenerated&&(a.samples.length&&(H=this.remuxID3(a,p)),v.samples.length&&(R=this.remuxText(v,p))),{audio:W,video:j,initSegment:D,independent:Y,text:R,id3:H}},m.generateIS=function(c,l,a){var v=c.samples,p=l.samples,E=this.typeSupported,M={},F=!Object(G.isFiniteNumber)(this._initPTS),j="audio/mp4",W,D,R;if(F&&(W=D=Infinity),c.config&&v.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):P.default.initSegment([c]),metadata:{channelCount:c.channelCount}},F&&(R=c.inputTimeScale,W=D=v[0].pts-Math.round(R*a))),l.sps&&l.pps&&p.length&&(l.timescale=l.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:l.codec,initSegment:P.default.initSegment([l]),metadata:{width:l.width,height:l.height}},F)){R=l.inputTimeScale;var H=this.getVideoStartPts(p),Y=Math.round(R*a);D=Math.min(D,s(p[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:R}},m.remuxVideo=function(c,l,a,v){var p=c.inputTimeScale,E=c.samples,M=[],F=E.length,j=this._initPTS,W=this.nextAvcDts,D=8,R,H,Y,ee=Number.POSITIVE_INFINITY,oe=Number.NEGATIVE_INFINITY,Te=0,ye=!1;if(!a||W===null){var he=l*p,le=E[0].pts-s(E[0].dts,E[0].pts);W=he-le}for(var pe=0;pe<F;pe++){var ie=E[pe];if(ie.pts=s(ie.pts-j,W),ie.dts=s(ie.dts-j,W),ie.dts>ie.pts){var me=9e4*.2;Te=Math.max(Math.min(Te,ie.pts-ie.dts),-1*me)}ie.dts<E[pe>0?pe-1:pe].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(b.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(b.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 _e=H-W,be=_e>J,ve=_e<-1;if(be||ve){be?k.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(_e,!0)+" ms ("+_e+"dts) hole between fragments detected, filling it"):k.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(-_e,!0)+" ms ("+_e+"dts) overlapping between fragments detected"),H=W;var we=E[0].pts-_e;E[0].dts=H,E[0].pts=we,k.logger.log("Video: First PTS/DTS adjusted: "+Object(b.toMsFromMpegTsClock)(we,!0)+"/"+Object(b.toMsFromMpegTsClock)(H,!0)+", delta: "+Object(b.toMsFromMpegTsClock)(_e,!0)+" ms")}}o&&(H=Math.max(0,H));for(var Oe=0,ke=0,Ce=0;Ce<F;Ce++){for(var Re=E[Ce],je=Re.units,He=je.length,Be=0,Ne=0;Ne<He;Ne++)Be+=je[Ne].data.length;ke+=Be,Oe+=He,Re.length=Be,Re.dts=Math.max(Re.dts,H),Re.pts=Math.max(Re.pts,Re.dts,0),ee=Math.min(Re.pts,ee),oe=Math.max(Re.pts,oe)}Y=E[F-1].dts;var qe=ke+4*Oe+8,Xe;try{Xe=new Uint8Array(qe)}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:qe,reason:"fail allocating video mdat "+qe});return}var Ze=new DataView(Xe.buffer);Ze.setUint32(0,qe),Xe.set(P.default.types.mdat,4);for(var Le=0;Le<F;Le++){for(var et=E[Le],Ve=et.units,Pe=0,Ie=0,ge=Ve.length;Ie<ge;Ie++){var de=Ve[Ie],ce=de.data,X=de.data.byteLength;Ze.setUint32(D,X),D+=4,Xe.set(ce,D),D+=X,Pe+=4+X}if(Le<F-1)R=E[Le+1].dts-et.dts;else{var Q=this.config,te=et.dts-E[Le>0?Le-1:Le].dts;if(Q.stretchShortVideoTrack&&this.nextAudioPts!==null){var se=Math.floor(Q.maxBufferHole*p),fe=(v?ee+v*p:this.nextAudioPts)-et.pts;fe>se?(R=fe-te,R<0&&(R=te),k.logger.log("[mp4-remuxer]: It is approximately "+fe/90+" ms to the next segment; using duration "+R/90+" ms for the last video frame.")):R=te}else R=te}var Ae=Math.round(et.pts-et.dts);M.push(new g(et.key,R,Pe,Ae))}if(M.length&&y&&y<70){var De=M[0].flags;De.dependsOn=2,De.isNonSync=0}console.assert(R!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=Y+R,this.isVideoContiguous=!0;var Ue=P.default.moof(c.sequenceNumber++,H,S({},c,{samples:M})),Qe="video",Ye={data1:Ue,data2:Xe,startPTS:ee/p,endPTS:(oe+R)/p,startDTS:H/p,endDTS:W/p,type:Qe,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"),Ye},m.remuxAudio=function(c,l,a,v,p){var E=c.inputTimeScale,M=c.samplerate?c.samplerate:E,F=E/M,j=c.isAAC?_:x,W=j*F,D=this._initPTS,R=!c.isAAC&&this.typeSupported.mpeg,H=[],Y=c.samples,ee=R?0:8,oe=this.nextAudioPts||-1,Te=l*E;if(this.isAudioContiguous=a=a||Y.length&&oe>0&&(v&&Math.abs(Te-oe)<9e3||Math.abs(s(Y[0].pts-D,Te)-oe)<20*W),Y.forEach(function(ce){ce.pts=s(ce.pts-D,Te)}),!a||oe<0){if(Y=Y.filter(function(ce){return ce.pts>=0}),!Y.length)return;p===0?oe=0:v?oe=Math.max(0,Te):oe=Y[0].pts}if(c.isAAC)for(var ye=p!==void 0,he=this.config.maxAudioFramesDrift,le=0,pe=oe;le<Y.length;le++){var ie=Y[le],me=ie.pts,J=me-pe,ne=Math.abs(1e3*J/E);if(J<=-he*W&&ye)le===0&&(k.logger.warn("Audio frame @ "+(me/E).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*J/E)+" ms."),this.nextAudioPts=oe=pe=me);else if(J>=he*W&&ne<O&&ye){var q=Math.round(J/W);pe=me-q*W,pe<0&&(q--,pe+=W),le===0&&(this.nextAudioPts=oe=pe),k.logger.warn("[mp4-remuxer]: Injecting "+q+" audio frame @ "+(pe/E).toFixed(3)+"s due to "+Math.round(1e3*J/E)+" ms gap.");for(var xe=0;xe<q;xe++){var _e=Math.max(pe,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:_e}),pe+=W,le++}}ie.pts=pe,pe+=W}for(var ve=null,we=null,Oe,ke=0,Ce=Y.length;Ce--;)ke+=Y[Ce].unit.byteLength;for(var Re=0,je=Y.length;Re<je;Re++){var He=Y[Re],Be=He.unit,Ne=He.pts;if(we!==null){var qe=H[Re-1];qe.duration=Math.round((Ne-we)/F)}else if(a&&c.isAAC&&(Ne=oe),ve=Ne,ke>0){ke+=ee;try{Oe=new Uint8Array(ke)}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:ke,reason:"fail allocating audio mdat "+ke});return}if(!R){var Xe=new DataView(Oe.buffer);Xe.setUint32(0,ke),Oe.set(P.default.types.mdat,4)}}else return;Oe.set(Be,ee);var Ze=Be.byteLength;ee+=Ze,H.push(new g(!0,j,Ze,0)),we=Ne}var Le=H.length;if(!Le)return;var et=H[H.length-1];this.nextAudioPts=oe=we+F*et.duration;var Ve=R?new Uint8Array(0):P.default.moof(c.sequenceNumber++,ve/F,S({},c,{samples:H}));c.samples=[];var Pe=ve/E,Ie=oe/E,ge="audio",de={data1:Ve,data2:Oe,startPTS:Pe,endPTS:Ie,startDTS:Pe,endDTS:Ie,type:ge,hasAudio:!0,hasVideo:!1,nb:Le};return this.isAudioContiguous=!0,console.assert(Oe.length,"MDAT length must not be zero"),de},m.remuxEmptyAudio=function(c,l,a,v){var p=c.inputTimeScale,E=c.samplerate?c.samplerate:p,M=p/E,F=this.nextAudioPts,j=(F!==null?F:v.startDTS*p)+this._initDTS,W=v.endDTS*p+this._initDTS,D=M*_,R=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<R;ee++){var oe=j+ee*D;Y.push({unit:H,pts:oe,dts:oe})}return c.samples=Y,this.remuxAudio(c,l,a,!1)},m.remuxID3=function(c,l){var a=c.samples.length;if(!a)return;for(var v=c.inputTimeScale,p=this._initPTS,E=this._initDTS,M=0;M<a;M++){var F=c.samples[M];F.pts=s(F.pts-p,l*v)/v,F.dts=s(F.dts-E,l*v)/v}var j=c.samples;return c.samples=[],{samples:j}},m.remuxText=function(c,l){var a=c.samples.length;if(!a)return;for(var v=c.inputTimeScale,p=this._initPTS,E=0;E<a;E++){var M=c.samples[E];M.pts=s(M.pts-p,l*v)/v}c.samples.sort(function(j,W){return j.pts-W.pts});var F=c.samples;return c.samples=[],{samples:F}},C}();function s(C,m){var h;if(m===null)return C;for(m<C?h=-8589934592:h=8589934592;Math.abs(C-m)>4294967296;)C+=h;return C}function w(C){for(var m=0;m<C.length;m++)if(C[m].key)return m;return-1}var g=function(m,h,c,l){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=h,this.size=c,this.cts=l,this.flags=new f(m)},f=function(m){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=m?2:1,this.isNonSync=m?0:1}},"./src/remux/passthrough-remuxer.ts":function(re,z,L){"use strict";L.r(z);var G=L("./src/polyfills/number.ts"),I=L("./src/utils/mp4-tools.ts"),P=L("./src/loader/fragment.ts"),B=L("./src/utils/logger.ts"),U=function(){function b(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var S=b.prototype;return S.destroy=function(){},S.resetTimeStamp=function(_){this.initPTS=_,this.lastEndDTS=null},S.resetNextTimestamp=function(){this.lastEndDTS=null},S.resetInitSegment=function(_,x,y){this.audioCodec=x,this.videoCodec=y,this.generateInitSegment(_),this.emitInitSegment=!0},S.generateInitSegment=function(_){var x=this.audioCodec,y=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,P.ElementaryStreamTypes.AUDIO)),y||(y=A(d.video,P.ElementaryStreamTypes.VIDEO));var o={};d.audio&&d.video?o.audiovideo={container:"video/mp4",codec:x+","+y,initSegment:_,id:"main"}:d.audio?o.audio={container:"audio/mp4",codec:x,initSegment:_,id:"audio"}:d.video?o.video={container:"video/mp4",codec:y,initSegment:_,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},S.remux=function(_,x,y,d,o){var u=this.initPTS,s=this.lastEndDTS,w={audio:void 0,video:void 0,text:d,id3:y,initSegment:void 0};Object(G.isFiniteNumber)(s)||(s=this.lastEndDTS=o||0);var g=x.samples;if(!g||!g.length)return w;var f={initPTS:void 0,timescale:1},C=this.initData;if((!C||!C.length)&&(this.generateInitSegment(g),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(G.isFiniteNumber)(u)||(this.initPTS=f.initPTS=u=k(C,g,s));var m=Object(I.getDuration)(g,C),h=s,c=m+h;Object(I.offsetStartDTS)(C,g,u),m>0?this.lastEndDTS=c:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var l=!!C.audio,a=!!C.video,v="";l&&(v+="audio"),a&&(v+="video");var p={data1:g,startPTS:h,startDTS:h,endPTS:c,endDTS:c,type:v,hasAudio:l,hasVideo:a,nb:1,dropped:0};return w.audio=p.type==="audio"?p:void 0,w.video=p.type!=="audio"?p:void 0,w.text=d,w.id3=y,w.initSegment=f,w},b}(),k=function(S,O,_){return Object(I.getStartDTS)(S,O)-_};function A(b,S){var O=b==null?void 0:b.codec;return O&&O.length>4?O:O==="hvc1"?"hvc1.1.c.L120.90":O==="av01"?"av01.0.04M.08":O==="avc1"||S===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}z.default=U},"./src/task-loop.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return G});var G=function(){function I(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var P=I.prototype;return P.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},P.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},P.onHandlerDestroyed=function(){},P.hasInterval=function(){return!!this._tickInterval},P.hasNextTick=function(){return!!this._tickTimer},P.setInterval=function(U){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,U),!0)},P.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},P.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},P.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},P.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},P.doTick=function(){},I}()},"./src/types/cmcd.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"CMCDVersion",function(){return G}),L.d(z,"CMCDObjectType",function(){return I}),L.d(z,"CMCDStreamingFormat",function(){return P}),L.d(z,"CMCDStreamType",function(){return B});var G=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 P;(function(U){U.DASH="d",U.HLS="h",U.SMOOTH="s",U.OTHER="o"})(P||(P={}));var B;(function(U){U.VOD="v",U.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"HlsSkip",function(){return P}),L.d(z,"getSkipValue",function(){return B}),L.d(z,"HlsUrlParameters",function(){return U}),L.d(z,"Level",function(){return k});function G(A,b){for(var S=0;S<b.length;S++){var O=b[S];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(A,O.key,O)}}function I(A,b,S){return b&&G(A.prototype,b),S&&G(A,S),A}var P;(function(A){A.No="",A.Yes="YES",A.v2="v2"})(P||(P={}));function B(A,b){var S=A.canSkipUntil,O=A.canSkipDateRanges,_=A.endSN,x=b!==void 0?b-_:0;return S&&x<S?O?P.v2:P.Yes:P.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 b=A.prototype;return b.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(b){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[b.url],this.attrs=b.attrs,this.bitrate=b.bitrate,b.details&&(this.details=b.details),this.id=b.id||0,this.name=b.name,this.width=b.width||0,this.height=b.height||0,this.audioCodec=b.audioCodec,this.videoCodec=b.videoCodec,this.unknownCodecs=b.unknownCodecs,this.codecSet=[b.videoCodec,b.audioCodec].filter(function(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,z,L){"use strict";L.r(z),L.d(z,"PlaylistContextType",function(){return G}),L.d(z,"PlaylistLevelType",function(){return I});var G;(function(P){P.MANIFEST="manifest",P.LEVEL="level",P.AUDIO_TRACK="audioTrack",P.SUBTITLE_TRACK="subtitleTrack"})(G||(G={}));var I;(function(P){P.MAIN="main",P.AUDIO="audio",P.SUBTITLE="subtitle"})(I||(I={}))},"./src/types/transmuxer.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"ChunkMetadata",function(){return G});var G=function(B,U,k,A,b,S){A===void 0&&(A=0),b===void 0&&(b=-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=b,this.partial=S};function I(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"AttrList",function(){return P});var G=/^(\d+)x(\d+)$/,I=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,P=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 b=parseInt(this[A],10);return b>Number.MAX_SAFE_INTEGER?Infinity:b},U.hexadecimalInteger=function(A){if(this[A]){var b=(this[A]||"0x").slice(2);b=(b.length&1?"0":"")+b;for(var S=new Uint8Array(b.length/2),O=0;O<b.length/2;O++)S[O]=parseInt(b.slice(O*2,O*2+2),16);return S}else return null},U.hexadecimalIntegerAsNumber=function(A){var b=parseInt(this[A],16);return b>Number.MAX_SAFE_INTEGER?Infinity:b},U.decimalFloatingPoint=function(A){return parseFloat(this[A])},U.optionalFloat=function(A,b){var S=this[A];return S?parseFloat(S):b},U.enumeratedString=function(A){return this[A]},U.bool=function(A){return this[A]==="YES"},U.decimalResolution=function(A){var b=G.exec(this[A]);return b===null?void 0:{width:parseInt(b[1],10),height:parseInt(b[2],10)}},B.parseAttrList=function(A){var b,S={},O='"';for(I.lastIndex=0;(b=I.exec(A))!==null;){var _=b[2];_.indexOf(O)===0&&_.lastIndexOf(O)===_.length-1&&(_=_.slice(1,-1)),S[b[1]]=_}return S},B}()},"./src/utils/binary-search.ts":function(re,z,L){"use strict";L.r(z);var G={search:function(P,B){for(var U=0,k=P.length-1,A=null,b=null;U<=k;){A=(U+k)/2|0,b=P[A];var S=B(b);if(S>0)U=A+1;else if(S<0)k=A-1;else return b}return null}};z.default=G},"./src/utils/buffer-helper.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"BufferHelper",function(){return P});var G=L("./src/utils/logger.ts"),I={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function B(){}return B.isBuffered=function(k,A){try{if(k){for(var b=B.getBuffered(k),S=0;S<b.length;S++)if(A>=b.start(S)&&A<=b.end(S))return!0}}catch(O){}return!1},B.bufferInfo=function(k,A,b){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,b)}}catch(x){}return{len:0,start:A,end:A,nextStart:void 0}},B.bufferedInfo=function(k,A,b){A=Math.max(0,A),k.sort(function(f,C){var m=f.start-C.start;return m||C.end-f.end});var S=[];if(b)for(var O=0;O<k.length;O++){var _=S.length;if(_){var x=S[_-1].end;k[O].start-x<b?k[O].end>x&&(S[_-1].end=k[O].end):S.push(k[O])}else S.push(k[O])}else S=k;for(var y=0,d,o=A,u=A,s=0;s<S.length;s++){var w=S[s].start,g=S[s].end;if(A+b>=w&&A<g)o=w,u=g,y=u-A;else if(A+b<w){d=w;break}}return{len:y,start:o||0,end:u||0,nextStart:d}},B.getBuffered=function(k){try{return k.buffered}catch(A){return G.logger.log("failed to get media.buffered",A),I}},B}()},"./src/utils/cea-608-parser.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"Row",function(){return u}),L.d(z,"CaptionScreen",function(){return s});var G=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},P=function(c){var l=c;return I.hasOwnProperty(c)&&(l=I[c]),String.fromCharCode(l)},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},b={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,v){this.verboseLevel>=a&&G.logger.log(this.time+" ["+a+"] "+v)},h}(),y=function(c){for(var l=[],a=0;a<c.length;a++)l.push(c[a].toString(16));return l},d=function(){function h(l,a,v,p,E){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=l||"white",this.underline=a||!1,this.italics=v||!1,this.background=p||"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 v=["foreground","underline","italics","background","flash"],p=0;p<v.length;p++){var E=v[p];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(l,a,v,p,E,M){this.uchar=void 0,this.penState=void 0,this.uchar=l||" ",this.penState=new d(a,v,p,E,M)}var c=h.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,v){this.uchar=a,this.penState.copy(v)},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(l){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=l,this.pos=0,this.currPenState=new d}var c=h.prototype;return c.equals=function(a){for(var v=!0,p=0;p<U;p++)if(!this.chars[p].equals(a.chars[p])){v=!1;break}return v},c.copy=function(a){for(var v=0;v<U;v++)this.chars[v].copy(a.chars[v])},c.isEmpty=function(){for(var a=!0,v=0;v<U;v++)if(!this.chars[v].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 v=this.pos+a;if(a>1)for(var p=this.pos+1;p<v+1;p++)this.chars[p].setPenState(this.currPenState);this.setCursor(v)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var v=P(a);if(this.pos>=U){this.logger.log(_.ERROR,"Cannot insert "+a.toString(16)+" ("+v+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(v,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var v;for(v=a;v<U;v++)this.chars[v].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=[],v=!0,p=0;p<U;p++){var E=this.chars[p].uchar;E!==" "&&(v=!1),a.push(E)}return v?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var v=this.chars[this.pos];v.setPenState(this.currPenState)},h}(),s=function(){function h(l){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(l));this.logger=l,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 v=!0,p=0;p<B;p++)if(!this.rows[p].equals(a.rows[p])){v=!1;break}return v},c.copy=function(a){for(var v=0;v<B;v++)this.rows[v].copy(a.rows[v])},c.isEmpty=function(){for(var a=!0,v=0;v<B;v++)if(!this.rows[v].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 v=this.rows[this.currRow];v.insertChar(a)},c.setPen=function(a){var v=this.rows[this.currRow];v.setPenStyles(a)},c.moveCursor=function(a){var v=this.rows[this.currRow];v.moveCursor(a)},c.setCursor=function(a){this.logger.log(_.INFO,"setCursor: "+a);var v=this.rows[this.currRow];v.setCursor(a)},c.setPAC=function(a){this.logger.log(_.INFO,"pacData = "+JSON.stringify(a));var v=a.row-1;if(this.nrRollUpRows&&v<this.nrRollUpRows-1&&(v=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==v){for(var p=0;p<B;p++)this.rows[p].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[v-this.nrRollUpRows+W+1].copy(M.rows[E+W])}}this.currRow=v;var D=this.rows[this.currRow];if(a.indent!==null){var R=a.indent,H=Math.max(R-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,v=this.rows.splice(a,1)[0];v.clear(),this.rows.splice(this.currRow,0,v),this.logger.log(_.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var v=[],p="",E=-1,M=0;M<B;M++){var F=this.rows[M].getTextString();F&&(E=M+1,a?v.push("Row "+E+": '"+F+"'"):v.push(F.trim()))}return v.length>0&&(a?p="["+v.join(" | ")+"]":p=v.join(`
|
|
`)),p},c.getTextAndFormat=function(){return this.rows},h}(),w=function(){function h(l,a,v){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=l,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new s(v),this.nonDisplayedMemory=new s(v),this.lastOutputScreen=new s(v),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=v}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 v=0;v<a.length;v++)this.writeScreen.insertChar(a[v]);var p=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(_.INFO,p+": "+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 v={flash:!1};if(v.underline=a%2===1,v.italics=a>=46,v.italics)v.foreground="white";else{var p=Math.floor(a/2)-16,E=["white","green","blue","cyan","red","yellow","magenta"];v.foreground=E[p]}this.logger.log(_.INFO,"MIDROW: "+JSON.stringify(v)),this.writeScreen.setPen(v)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var v=this.logger.time;if(v===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=v:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,v,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:v),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}(),g=function(){function h(l,a,v){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var p=new x;this.channels=[null,new w(l,a,p),new w(l+1,v,p)],this.cmdHistory=m(),this.logger=p}var c=h.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,v){this.channels[a].setHandler(v)},c.addData=function(a,v){var p,E,M,F=!1;this.logger.time=a;for(var j=0;j<v.length;j+=2){if(E=v[j]&127,M=v[j+1]&127,E===0&&M===0)continue;if(this.logger.log(_.DATA,"["+y([v[j],v[j+1]])+"] -> ("+y([E,M])+")"),p=this.parseCmd(E,M),p||(p=this.parseMidrow(E,M)),p||(p=this.parsePAC(E,M)),p||(p=this.parseBackgroundAttributes(E,M)),!p&&(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?")}!p&&!F&&this.logger.log(_.WARNING,"Couldn't parse cleaned data "+y([E,M])+" orig: "+y([v[j],v[j+1]]))}},c.parseCmd=function(a,v){var p=this.cmdHistory,E=(a===20||a===28||a===21||a===29)&&v>=32&&v<=47,M=(a===23||a===31)&&v>=33&&v<=35;if(!(E||M))return!1;if(C(a,v,p))return f(null,null,p),this.logger.log(_.DEBUG,"Repeated command ("+y([a,v])+") 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?v===32?j.ccRCL():v===33?j.ccBS():v===34?j.ccAOF():v===35?j.ccAON():v===36?j.ccDER():v===37?j.ccRU(2):v===38?j.ccRU(3):v===39?j.ccRU(4):v===40?j.ccFON():v===41?j.ccRDC():v===42?j.ccTR():v===43?j.ccRTD():v===44?j.ccEDM():v===45?j.ccCR():v===46?j.ccENM():v===47&&j.ccEOC():j.ccTO(v-32),f(a,v,p),this.currentChannel=F,!0},c.parseMidrow=function(a,v){var p=0;if((a===17||a===25)&&v>=32&&v<=47){if(a===17?p=1:p=2,p!==this.currentChannel)return this.logger.log(_.ERROR,"Mismatch channel in midrow parsing"),!1;var E=this.channels[p];return E?(E.ccMIDROW(v),this.logger.log(_.DEBUG,"MIDROW ("+y([a,v])+")"),!0):!1}return!1},c.parsePAC=function(a,v){var p,E=this.cmdHistory,M=(a>=17&&a<=23||a>=25&&a<=31)&&v>=64&&v<=127,F=(a===16||a===24)&&v>=64&&v<=95;if(!(M||F))return!1;if(C(a,v,E))return f(null,null,E),!0;var j=a<=23?1:2;v>=64&&v<=95?p=j===1?k[a]:b[a]:p=j===1?A[a]:S[a];var W=this.channels[j];return W?(W.setPAC(this.interpretPAC(p,v)),f(a,v,E),this.currentChannel=j,!0):!1},c.interpretPAC=function(a,v){var p,E={color:null,italics:!1,indent:null,underline:!1,row:a};return v>95?p=v-96:p=v-64,E.underline=(p&1)===1,p<=13?E.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(p/2)]:p<=15?(E.italics=!0,E.color="white"):E.indent=Math.floor((p-16)/2)*4,E},c.parseChars=function(a,v){var p,E=null,M=null;if(a>=25?(p=2,M=a-8):(p=1,M=a),M>=17&&M<=19){var F;M===17?F=v+80:M===18?F=v+112:F=v+144,this.logger.log(_.INFO,"Special char '"+P(F)+"' in channel "+p),E=[F]}else a>=32&&a<=127&&(E=v===0?[a]:[a,v]);if(E){var j=y(E);this.logger.log(_.DEBUG,"Char codes = "+j.join(",")),f(a,v,this.cmdHistory)}return E},c.parseBackgroundAttributes=function(a,v){var p=(a===16||a===24)&&v>=32&&v<=47,E=(a===23||a===31)&&v>=45&&v<=47;if(!(p||E))return!1;var M,F={};a===16||a===24?(M=Math.floor((v-32)/2),F.background=O[M],v%2===1&&(F.background=F.background+"_semi")):v===45?F.background="transparent":(F.foreground="black",v===47&&(F.underline=!0));var j=a<=23?1:2,W=this.channels[j];return W.setBkgData(F),f(a,v,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var v=this.channels[a];v&&v.reset()}this.cmdHistory=m()},c.cueSplitAtTime=function(a){for(var v=0;v<this.channels.length;v++){var p=this.channels[v];p&&p.cueSplitAtTime(a)}},h}();function f(h,c,l){l.a=h,l.b=c}function C(h,c,l){return l.a===h&&l.b===c}function m(){return{a:null,b:null}}z.default=g},"./src/utils/codecs.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"isCodecType",function(){return I}),L.d(z,"isCodecSupportedInMp4",function(){return P});var G={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=G[U];return!!k&&k[B.slice(0,4)]===!0}function P(B,U){return MediaSource.isTypeSupported((U||"video")+'/mp4;codecs="'+B+'"')}},"./src/utils/cues.ts":function(re,z,L){"use strict";L.r(z);var G=L("./src/utils/vttparser.ts"),I=L("./src/utils/webvtt-parser.ts"),P=L("./src/utils/texttrack-utils.ts"),B=/\s/,U={newCue:function(A,b,S,O){for(var _=[],x,y,d,o,u,s=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 g=0;g<x.chars.length;g++)B.test(x.chars[g].uchar)&&d?o++:(u+=x.chars[g].uchar,d=!1);x.cueStartTime=b,b===S&&(S+=1e-4),o>=16?o--:o++;var f=Object(G.fixLineBreaks)(u.trim()),C=Object(I.generateCueId)(b,S,f);(!A||!A.cues||!A.cues.getCueById(C))&&(y=new s(b,S,f),y.id=C,y.line=w+1,y.align="left",y.position=10+Math.min(80,Math.floor(o*8/32)*10),_.push(y))}return A&&_.length&&(_.sort(function(m,h){return m.line==="auto"||h.line==="auto"?0:m.line>8&&h.line>8?h.line-m.line:m.line-h.line}),_.forEach(function(m){return Object(P.addCueToTrack)(A,m)})),_}};z.default=U},"./src/utils/discontinuities.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"findFirstFragWithCC",function(){return B}),L.d(z,"shouldAlignOnDiscontinuities",function(){return U}),L.d(z,"findDiscontinuousReferenceFrag",function(){return k}),L.d(z,"adjustSlidingStart",function(){return b}),L.d(z,"alignStream",function(){return S}),L.d(z,"alignPDT",function(){return _}),L.d(z,"alignFragmentByPDTDelta",function(){return x}),L.d(z,"alignMediaPlaylistByPDT",function(){return y});var G=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts"),P=L("./src/controller/level-helper.ts");function B(d,o){for(var u=null,s=0,w=d.length;s<w;s++){var g=d[s];if(g&&g.cc===o){u=g;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,s=o.fragments;if(!s.length||!u.length){I.logger.log("No fragments to align");return}var w=B(u,s[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 b(d,o){for(var u=o.fragments,s=0,w=u.length;s<w;s++)A(u[s],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(P.adjustSliding)(o.details,u)}function O(d,o,u){if(U(d,u,o)){var s=k(u.details,o);s&&Object(G.isFiniteNumber)(s.start)&&(I.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),b(s.start,o))}}function _(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var u=o.fragments[0].programDateTime,s=d.fragments[0].programDateTime,w=(s-u)/1e3+o.fragments[0].start;w&&Object(G.isFiniteNumber)(w)&&(I.logger.log("Adjusting PTS using programDateTime delta "+(s-u)+"ms, sliding:"+w.toFixed(3)+" "+d.url+" "),b(w,d))}function x(d,o){var u=d.programDateTime;if(!u)return;var s=(u-o)/1e3;d.start=d.startPTS=s,d.endPTS=s+d.duration}function y(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var u=o.fragments[0].programDateTime,s=o.fragments[0].start,w=u-s*1e3;d.fragments.forEach(function(g){x(g,w)}),d.fragmentHint&&x(d.fragmentHint,w),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(re,z,L){"use strict";L.r(z);var G=L("./src/utils/ewma.ts"),I=function(){function P(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 G.default(U),this.fast_=new G.default(k)}var B=P.prototype;return B.update=function(k,A){var b=this.slow_,S=this.fast_;this.slow_.halfLife!==k&&(this.slow_=new G.default(k,b.getEstimate(),b.getTotalWeight())),this.fast_.halfLife!==A&&(this.fast_=new G.default(A,S.getEstimate(),S.getTotalWeight()))},B.sample=function(k,A){k=Math.max(k,this.minDelayMs_);var b=8*A,S=k/1e3,O=b/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(){},P}();z.default=I},"./src/utils/ewma.ts":function(re,z,L){"use strict";L.r(z);var G=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 P=I.prototype;return P.sample=function(U,k){var A=Math.pow(this.alpha_,U);this.estimate_=k*(1-A)+A*this.estimate_,this.totalWeight_+=U},P.getTotalWeight=function(){return this.totalWeight_},P.getEstimate=function(){if(this.alpha_){var U=1-Math.pow(this.alpha_,this.totalWeight_);if(U)return this.estimate_/U}return this.estimate_},I}();z.default=G},"./src/utils/fetch-loader.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"fetchSupported",function(){return x});var G=L("./src/polyfills/number.ts"),I=L("./src/loader/load-stats.ts"),P=L("./src/demux/chunk-cache.ts");function B(s,w){s.prototype=Object.create(w.prototype),s.prototype.constructor=s,S(s,w)}function U(s){var w=typeof Map=="function"?new Map:void 0;return U=function(f){if(f===null||!b(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(s)}function k(s,w,g){return A()?k=Reflect.construct:k=function(C,m,h){var c=[null];c.push.apply(c,m);var l=Function.bind.apply(C,c),a=new l;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(s){return!1}}function b(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function S(s,w){return S=Object.setPrototypeOf||function(f,C){return f.__proto__=C,f},S(s,w)}function O(s){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(g){return g.__proto__||Object.getPrototypeOf(g)},O(s)}function _(){return _=Object.assign||function(s){for(var w=1;w<arguments.length;w++){var g=arguments[w];for(var f in g)Object.prototype.hasOwnProperty.call(g,f)&&(s[f]=g[f])}return s},_.apply(this,arguments)}function x(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(s){}return!1}var y=function(){function s(g){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=g.fetchSetup||o,this.controller=new self.AbortController,this.stats=new I.LoadStats}var w=s.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,m){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 l=d(f,this.controller.signal),a=m.onProgress,v=f.responseType==="arraybuffer",p=v?"byteLength":"length";this.context=f,this.config=C,this.callbacks=m,this.request=this.fetchSetup(f,l),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){h.abortInternal(),m.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(G.isFiniteNumber)(C.highWaterMark)?h.loadProgressively(E,c,f,C.highWaterMark,a):v?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[p];var F={url:M.url,data:E};a&&!Object(G.isFiniteNumber)(C.highWaterMark)&&a(c,f,E,M),m.onSuccess(F,c,f,M)}).catch(function(E){if(self.clearTimeout(h.requestTimeout),c.aborted)return;var M=E.code||0;m.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,m,h,c){h===void 0&&(h=0);var l=new P.default,a=f.body.getReader(),v=function p(){return a.read().then(function(E){if(E.done)return l.dataLength&&c(C,m,l.flush(),f),Promise.resolve(new ArrayBuffer(0));var M=E.value,F=M.length;return C.loaded+=F,F<h||l.dataLength?(l.push(M),l.dataLength>=h&&c(C,m,l.flush(),f)):c(C,m,M,f),p()}).catch(function(){return Promise.reject()})};return v()},s}();function d(s,w){var g={method:"GET",mode:"cors",credentials:"same-origin",signal:w,headers:new self.Headers(_({},s.headers))};return s.rangeEnd&&g.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),g}function o(s,w){return new self.Request(s.url,w)}var u=function(s){B(w,s);function w(g,f,C){var m;return m=s.call(this,g)||this,m.code=void 0,m.details=void 0,m.code=f,m.details=C,m}return w}(U(Error));z.default=y},"./src/utils/imsc1-ttml-parser.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"IMSC1_CODEC",function(){return b}),L.d(z,"parseIMSC1",function(){return x});var G=L("./src/utils/mp4-tools.ts"),I=L("./src/utils/vttparser.ts"),P=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 l=arguments[c];for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&(h[a]=l[a])}return h},A.apply(this,arguments)}var b="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,l,a,v){var p=Object(G.findBox)(new Uint8Array(h),["mdat"]);if(p.length===0){v(new Error("Could not parse IMSC1 mdat"));return}var E=p[0],M=Object(B.utf8ArrayToStr)(new Uint8Array(h,E.start,E.end-E.start)),F=Object(U.toTimescaleFromScale)(c,1,l);try{a(y(M,F))}catch(j){v(j)}}function y(h,c){var l=new DOMParser,a=l.parseFromString(h,"text/xml"),v=a.getElementsByTagName("tt")[0];if(!v)throw new Error("Invalid ttml");var p={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},E=Object.keys(p).reduce(function(D,R){return D[R]=v.getAttribute("ttp:"+R)||p[R],D},{}),M=v.getAttribute("xml:space")!=="preserve",F=o(d(v,"styling","style")),j=o(d(v,"layout","region")),W=d(v,"body","[begin]");return[].map.call(W,function(D){var R=u(D,M);if(!R||!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 g(D);if(ee===null){if(Y===null)throw g(D);ee=H+Y}var oe=new P.default(H-c,ee-c,R);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=s(Te,ye),le=he.textAlign;if(le){var pe=_[le];pe&&(oe.lineAlign=pe),oe.align=le}return A(oe,he),oe}).filter(function(D){return D!==null})}function d(h,c,l){var a=h.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(l)):[]}function o(h){return h.reduce(function(c,l){var a=l.getAttribute("xml:id");return a&&(c[a]=l),c},{})}function u(h,c){return[].slice.call(h.childNodes).reduce(function(l,a,v){var p;return a.nodeName==="br"&&v?l+`
|
|
`:(p=a.childNodes)!==null&&p!==void 0&&p.length?u(a,c):c?l+a.textContent.trim().replace(/\s+/g," "):l+a.textContent},"")}function s(h,c){var l="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(v,p){var E=w(c,l,p)||w(h,l,p);return E&&(v[p]=E),v},{})}function w(h,c,l){return h.hasAttributeNS(c,l)?h.getAttributeNS(c,l):null}function g(h){return new Error("Could not parse ttml timestamp "+h)}function f(h,c){if(!h)return null;var l=Object(I.parseTimeStamp)(h);return l===null&&(S.test(h)?l=C(h,c):O.test(h)&&(l=m(h,c))),l}function C(h,c){var l=S.exec(h),a=(l[4]|0)+(l[5]|0)/c.subFrameRate;return(l[1]|0)*3600+(l[2]|0)*60+(l[3]|0)+a/c.frameRate}function m(h,c){var l=O.exec(h),a=Number(l[1]),v=l[2];switch(v){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,z,L){"use strict";L.r(z),L.d(z,"enableLogs",function(){return k}),L.d(z,"logger",function(){return A});var G=function(){},I={trace:G,debug:G,log:G,warn:G,info:G,error:G},P=I;function B(b){var S=self.console[b];return S?S.bind(self.console,"["+b+"] >"):G}function U(b){for(var S=arguments.length,O=new Array(S>1?S-1:0),_=1;_<S;_++)O[_-1]=arguments[_];O.forEach(function(x){P[x]=b[x]?b[x].bind(b):B(x)})}function k(b){if(self.console&&b===!0||typeof b=="object"){U(b,"debug","log","info","warn","error");try{P.log()}catch(S){P=I}}else P=I}var A=P},"./src/utils/mediakeys-helper.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"KeySystems",function(){return G}),L.d(z,"requestMediaKeySystemAccess",function(){return I});var G;(function(P){P.WIDEVINE="com.widevine.alpha",P.PLAYREADY="com.microsoft.playready"})(G||(G={}));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,z,L){"use strict";L.r(z),L.d(z,"getMediaSource",function(){return G});function G(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"bin2str",function(){return U}),L.d(z,"readUint16",function(){return k}),L.d(z,"readUint32",function(){return A}),L.d(z,"writeUint32",function(){return b}),L.d(z,"findBox",function(){return S}),L.d(z,"parseSegmentIndex",function(){return O}),L.d(z,"parseInitSegment",function(){return _}),L.d(z,"getStartDTS",function(){return x}),L.d(z,"getDuration",function(){return y}),L.d(z,"computeRawDurationFromSamples",function(){return d}),L.d(z,"offsetStartDTS",function(){return o}),L.d(z,"segmentValidRange",function(){return u}),L.d(z,"appendUint8Array",function(){return s});var G=L("./src/utils/typed-array.ts"),I=L("./src/loader/fragment.ts"),P=Math.pow(2,32)-1,B=[].push;function U(w){return String.fromCharCode.apply(null,w)}function k(w,g){"data"in w&&(g+=w.start,w=w.data);var f=w[g]<<8|w[g+1];return f<0?65536+f:f}function A(w,g){"data"in w&&(g+=w.start,w=w.data);var f=w[g]<<24|w[g+1]<<16|w[g+2]<<8|w[g+3];return f<0?4294967296+f:f}function b(w,g,f){"data"in w&&(g+=w.start,w=w.data),w[g]=f>>24,w[g+1]=f>>16&255,w[g+2]=f>>8&255,w[g+3]=f&255}function S(w,g){var f=[];if(!g.length)return f;var C,m,h;"data"in w?(C=w.data,m=w.start,h=w.end):(C=w,m=0,h=C.byteLength);for(var c=m;c<h;){var l=A(C,c),a=U(C.subarray(c+4,c+8)),v=l>1?c+l:h;if(a===g[0])if(g.length===1)f.push({data:C,start:c+8,end:v});else{var p=S({data:C,start:c+8,end:v},g.slice(1));p.length&&B.apply(f,p)}c=v}return f}function O(w){var g=S(w,["moov"]),f=g[0],C=f?f.end:null,m=S(w,["sidx"]);if(!m||!m[0])return null;var h=[],c=m[0],l=c.data[0],a=l===0?8:16,v=A(c,a);a+=4;var p=0,E=0;l===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 R=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:R,subsegmentDuration:Y,info:{duration:Y/v,start:M,end:M+R-1}}),M+=R,W+=4,a=W}return{earliestPresentationTime:p,timescale:v,version:l,referencesCount:F,references:h,moovEndOffset:C}}function _(w){for(var g=[],f=S(w,["moov","trak"]),C=0;C<f.length;C++){var m=f[C],h=S(m,["tkhd"])[0];if(h){var c=h.data[h.start],l=c===0?12:20,a=A(h,l),v=S(m,["mdia","mdhd"])[0];if(v){c=v.data[v.start],l=c===0?12:20;var p=A(v,l),E=S(m,["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(m,["mdia","minf","stbl","stsd"])[0],W=void 0;j&&(W=U(j.data.subarray(j.start+12,j.start+16))),g[a]={timescale:p,type:F},g[F]={timescale:p,id:a,codec:W}}}}}}var D=S(w,["moov","mvex","trex"]);return D.forEach(function(R){var H=A(R,4),Y=g[H];Y&&(Y.default={duration:A(R,12),flags:A(R,20)})}),g}function x(w,g){return S(g,["moof","traf"]).reduce(function(f,C){var m=S(C,["tfdt"])[0],h=m.data[m.start],c=S(C,["tfhd"]).reduce(function(l,a){var v=A(a,4),p=w[v];if(p){var E=A(m,4);h===1&&(E*=Math.pow(2,32),E+=A(m,8));var M=p.timescale||9e4,F=E/M;if(isFinite(F)&&(l===null||F<l))return F}return l},null);return c!==null&&isFinite(c)&&(f===null||c<f)?c:f},null)||0}function y(w,g){for(var f=0,C=0,m=0,h=S(w,["moof","traf"]),c=0;c<h.length;c++){var l=h[c],a=S(l,["tfhd"])[0],v=A(a,4),p=g[v];if(!p)continue;var E=p.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=p.timescale||9e4,W=S(l,["trun"]),D=0;D<W.length;D++){if(F){var R=A(W[D],4);f=F*R}else f=d(W[D]);p.type===I.ElementaryStreamTypes.VIDEO?C+=f/j:p.type===I.ElementaryStreamTypes.AUDIO&&(m+=f/j)}}if(C===0&&m===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||m}function d(w){var g=A(w,0),f=8;g&1&&(f+=4),g&4&&(f+=4);for(var C=0,m=A(w,4),h=0;h<m;h++){if(g&256){var c=A(w,f);C+=c,f+=4}g&512&&(f+=4),g&1024&&(f+=4),g&2048&&(f+=4)}return C}function o(w,g,f){S(g,["moof","traf"]).forEach(function(C){S(C,["tfhd"]).forEach(function(m){var h=A(m,4),c=w[h];if(!c)return;var l=c.timescale||9e4;S(C,["tfdt"]).forEach(function(a){var v=a.data[a.start],p=A(a,4);if(v===0)b(a,4,p-f*l);else{p*=Math.pow(2,32),p+=A(a,8),p-=f*l,p=Math.max(p,0);var E=Math.floor(p/(P+1)),M=Math.floor(p%(P+1));b(a,4,E),b(a,8,M)}})})})}function u(w){var g={valid:null,remainder:null},f=S(w,["moof"]);if(f){if(f.length<2)return g.remainder=w,g}else return g;var C=f[f.length-1];return g.valid=Object(G.sliceUint8)(w,0,C.start-8),g.remainder=Object(G.sliceUint8)(w,C.start-8),g}function s(w,g){var f=new Uint8Array(w.length+g.length);return f.set(w),f.set(g,w.length),f}},"./src/utils/output-filter.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return G});var G=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 P=I.prototype;return P.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},P.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)},P.reset=function(){this.cueRanges=[]},I}()},"./src/utils/texttrack-utils.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"sendAddTrackEvent",function(){return I}),L.d(z,"addCueToTrack",function(){return P}),L.d(z,"clearCurrentCues",function(){return B}),L.d(z,"removeCuesInRange",function(){return U}),L.d(z,"getCuesInRange",function(){return A});var G=L("./src/utils/logger.ts");function I(b,S){var O;try{O=new Event("addtrack")}catch(_){O=document.createEvent("Event"),O.initEvent("addtrack",!1,!1)}O.track=b,S.dispatchEvent(O)}function P(b,S){var O=b.mode;if(O==="disabled"&&(b.mode="hidden"),b.cues&&!b.cues.getCueById(S.id))try{if(b.addCue(S),!b.cues.getCueById(S.id))throw new Error("addCue is failed for: "+S)}catch(x){G.logger.debug("[texttrack-utils]: "+x);var _=new self.TextTrackCue(S.startTime,S.endTime,S.text);_.id=S.id,b.addCue(_)}O==="disabled"&&(b.mode=O)}function B(b){var S=b.mode;if(S==="disabled"&&(b.mode="hidden"),b.cues)for(var O=b.cues.length;O--;)b.removeCue(b.cues[O]);S==="disabled"&&(b.mode=S)}function U(b,S,O){var _=b.mode;if(_==="disabled"&&(b.mode="hidden"),b.cues&&b.cues.length>0)for(var x=A(b.cues,S,O),y=0;y<x.length;y++)b.removeCue(x[y]);_==="disabled"&&(b.mode=_)}function k(b,S){if(S<b[0].startTime)return 0;var O=b.length-1;if(S>b[O].endTime)return-1;for(var _=0,x=O;_<=x;){var y=Math.floor((x+_)/2);if(S<b[y].startTime)x=y-1;else if(S>b[y].startTime&&_<O)_=y+1;else return y}return b[_].startTime-S<S-b[x].startTime?_:x}function A(b,S,O){var _=[],x=k(b,S);if(x>-1)for(var y=x,d=b.length;y<d;y++){var o=b[y];if(o.startTime>=S&&o.endTime<=O)_.push(o);else if(o.startTime>O)return _}return _}},"./src/utils/time-ranges.ts":function(re,z,L){"use strict";L.r(z);var G={toString:function(P){for(var B="",U=P.length,k=0;k<U;k++)B+="["+P.start(k).toFixed(3)+","+P.end(k).toFixed(3)+"]";return B}};z.default=G},"./src/utils/timescale-conversion.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"toTimescaleFromBase",function(){return I}),L.d(z,"toTimescaleFromScale",function(){return P}),L.d(z,"toMsFromMpegTsClock",function(){return B}),L.d(z,"toMpegTsClockFromTimescale",function(){return U});var G=9e4;function I(k,A,b,S){b===void 0&&(b=1),S===void 0&&(S=!1);var O=k*A*b;return S?Math.round(O):O}function P(k,A,b,S){return b===void 0&&(b=1),S===void 0&&(S=!1),I(k,A,1/b,S)}function B(k,A){return A===void 0&&(A=!1),I(k,1e3,1/G,A)}function U(k,A){return A===void 0&&(A=1),I(k,G,1/A)}},"./src/utils/typed-array.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"sliceUint8",function(){return G});function G(I,P,B){return Uint8Array.prototype.slice?I.slice(P,B):new Uint8Array(Array.prototype.slice.call(I,P,B))}},"./src/utils/vttcue.ts":function(re,z,L){"use strict";L.r(z),z.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var G=["","lr","rl"],I=["start","middle","end","left","right"];function P(b,S){if(typeof S!="string")return!1;if(!Array.isArray(b))return!1;var O=S.toLowerCase();return~b.indexOf(O)?O:!1}function B(b){return P(G,b)}function U(b){return P(I,b)}function k(b){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 y=arguments[x];for(var d in y)b[d]=y[d]}return b}function A(b,S,O){var _=this,x={enumerable:!0};_.hasBeenReset=!1;var y="",d=!1,o=b,u=S,s=O,w=null,g="",f=!0,C="auto",m="start",h=50,c="middle",l=50,a="middle";Object.defineProperty(_,"id",k({},x,{get:function(){return y},set:function(p){y=""+p}})),Object.defineProperty(_,"pauseOnExit",k({},x,{get:function(){return d},set:function(p){d=!!p}})),Object.defineProperty(_,"startTime",k({},x,{get:function(){return o},set:function(p){if(typeof p!="number")throw new TypeError("Start time must be set to a number.");o=p,this.hasBeenReset=!0}})),Object.defineProperty(_,"endTime",k({},x,{get:function(){return u},set:function(p){if(typeof p!="number")throw new TypeError("End time must be set to a number.");u=p,this.hasBeenReset=!0}})),Object.defineProperty(_,"text",k({},x,{get:function(){return s},set:function(p){s=""+p,this.hasBeenReset=!0}})),Object.defineProperty(_,"region",k({},x,{get:function(){return w},set:function(p){w=p,this.hasBeenReset=!0}})),Object.defineProperty(_,"vertical",k({},x,{get:function(){return g},set:function(p){var E=B(p);if(E===!1)throw new SyntaxError("An invalid or illegal string was specified.");g=E,this.hasBeenReset=!0}})),Object.defineProperty(_,"snapToLines",k({},x,{get:function(){return f},set:function(p){f=!!p,this.hasBeenReset=!0}})),Object.defineProperty(_,"line",k({},x,{get:function(){return C},set:function(p){if(typeof p!="number"&&p!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");C=p,this.hasBeenReset=!0}})),Object.defineProperty(_,"lineAlign",k({},x,{get:function(){return m},set:function(p){var E=U(p);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");m=E,this.hasBeenReset=!0}})),Object.defineProperty(_,"position",k({},x,{get:function(){return h},set:function(p){if(p<0||p>100)throw new Error("Position must be between 0 and 100.");h=p,this.hasBeenReset=!0}})),Object.defineProperty(_,"positionAlign",k({},x,{get:function(){return c},set:function(p){var E=U(p);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 l},set:function(p){if(p<0||p>100)throw new Error("Size must be between 0 and 100.");l=p,this.hasBeenReset=!0}})),Object.defineProperty(_,"align",k({},x,{get:function(){return a},set:function(p){var E=U(p);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 b=self.WebVTT;return b.convertCueToDOMTree(self,this.text)},A}()},"./src/utils/vttparser.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"parseTimeStamp",function(){return P}),L.d(z,"fixLineBreaks",function(){return S}),L.d(z,"VTTParser",function(){return O});var G=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 P(_){function x(d,o,u,s){return(d|0)*3600+(o|0)*60+(u|0)+parseFloat(s||0)}var y=_.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return y?parseFloat(y[2])>59?x(y[2],y[3],0,y[4]):x(y[1],y[2],y[3],y[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 s=0;s<u.length;++s)if(o===u[s]){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,y,d){var o=d?_.split(d):[_];for(var u in o){if(typeof o[u]!="string")continue;var s=o[u].split(y);if(s.length!==2)continue;var w=s[0],g=s[1];x(w,g)}}var k=new G.default(0,0,""),A=k.align==="middle"?"middle":"center";function b(_,x,y){var d=_;function o(){var w=P(_);if(w===null)throw new Error("Malformed timestamp: "+d);return _=_.replace(/^[^\sa-zA-Z-]+/,""),w}function u(w,g){var f=new B;U(w,function(h,c){var l;switch(h){case"region":for(var a=y.length-1;a>=0;a--)if(y[a].id===c){f.set(h,y[a].region);break}break;case"vertical":f.alt(h,c,["rl","lr"]);break;case"line":l=c.split(","),f.integer(h,l[0]),f.percent(h,l[0])&&f.set("snapToLines",!1),f.alt(h,l[0],["auto"]),l.length===2&&f.alt("lineAlign",l[1],["start",A,"end"]);break;case"position":l=c.split(","),f.percent(h,l[0]),l.length===2&&f.alt("positionAlign",l[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/),g.region=f.get("region",null),g.vertical=f.get("vertical","");var C=f.get("line","auto");C==="auto"&&k.line===-1&&(C=-1),g.line=C,g.lineAlign=f.get("lineAlign","start"),g.snapToLines=f.get("snapToLines",!0),g.size=f.get("size",100),g.align=f.get("align",A);var m=f.get("position","auto");m==="auto"&&k.position===50&&(m=g.align==="start"||g.align==="left"?0:g.align==="end"||g.align==="right"?100:50),g.position=m}function s(){_=_.replace(/^\s+/,"")}if(s(),x.startTime=o(),s(),_.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);_=_.substr(3),s(),x.endTime=o(),s(),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 m=o.buffer,h=0;for(m=S(m);h<m.length&&m[h]!=="\r"&&m[h]!==`
|
|
`;)++h;var c=m.substr(0,h);return m[h]==="\r"&&++h,m[h]===`
|
|
`&&++h,o.buffer=m.substr(h),c}function s(m){U(m,function(h,c){},/:/)}try{var w="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;w=u();var g=w.match(/^()?WEBVTT([ \t].*)?$/);if(!g||!g[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)?s(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 G.default(0,0,""),o.state="CUE",w.indexOf("-->")===-1){o.cue.id=w;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{b(w,o.cue,o.regionList)}catch(m){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(m){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,z,L){"use strict";L.r(z),L.d(z,"generateCueId",function(){return O}),L.d(z,"parseWebVTT",function(){return x});var G=L("./src/polyfills/number.ts"),I=L("./src/utils/vttparser.ts"),P=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},b=function(d){var o=parseInt(d.substr(-3)),u=parseInt(d.substr(-6,2)),s=parseInt(d.substr(-9,2)),w=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(G.isFiniteNumber)(o)||!Object(G.isFiniteNumber)(u)||!Object(G.isFiniteNumber)(s)||!Object(G.isFiniteNumber)(w))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return o+=1e3*u,o+=60*1e3*s,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(y,d,o){return S(y.toString())+S(d.toString())+S(o)}var _=function(d,o,u){var s=d[o],w=d[s.prevCC];if(!w||!w.new&&s.new){d.ccOffset=d.presentationOffset=s.start,s.new=!1;return}for(;(g=w)!==null&&g!==void 0&&g.new;){var g;d.ccOffset+=s.start-w.start,s.new=!1,s=w,w=d[s.prevCC]}d.presentationOffset=u};function x(y,d,o,u,s,w,g,f){var C=new I.VTTParser,m=Object(P.utf8ArrayToStr)(new Uint8Array(y)).trim().replace(k,`
|
|
`).split(`
|
|
`),h=[],c=Object(B.toMpegTsClockFromTimescale)(d,o),l="00:00.000",a=0,v=0,p,E=!0,M=!1;C.oncue=function(F){var j=u[s],W=u.ccOffset,D=(a-c)/9e4;if(j!=null&&j.new&&(v!==void 0?W=u.ccOffset=j.start:_(u,s,D)),D&&(W=D-u.presentationOffset),M){var R=F.endTime-F.startTime,H=Object(U.normalizePts)((F.startTime+W-v)*9e4,w*9e4)/9e4;F.startTime=H,F.endTime=H+R}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){p=F},C.onflush=function(){if(p){f(p);return}g(h)},m.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:")?l=j.substr(6):A(j,"MPEGTS:")&&(a=parseInt(j.substr(7)))});try{v=b(l)/1e3}catch(j){M=!1,p=j}return}else F===""&&(E=!1);C.parse(F+`
|
|
`)}),C.flush()}},"./src/utils/xhr-loader.ts":function(re,z,L){"use strict";L.r(z);var G=L("./src/utils/logger.ts"),I=L("./src/loader/load-stats.ts"),P=/^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 b=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),b&&(b.onreadystatechange=null,b.onprogress=null,b.readyState!==4&&(this.stats.aborted=!0,b.abort()))},k.abort=function(){var b;this.abortInternal(),(b=this.callbacks)!==null&&b!==void 0&&b.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},k.load=function(b,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=b,this.config=S,this.callbacks=O,this.retryDelay=S.retryDelay,this.loadInternal()},k.loadInternal=function(){var b=this.config,S=this.context;if(!b)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 y=this.context.headers;if(y)for(var d in y)O.setRequestHeader(d,y[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),b.timeout),O.send()},k.readystatechange=function(){var b=this.context,S=this.loader,O=this.stats;if(!b||!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 y=S.status;if(y>=200&&y<300){O.loading.end=Math.max(self.performance.now(),O.loading.first);var d,o;if(b.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,b,d,S),!this.callbacks)return;var s={url:S.responseURL,data:d};this.callbacks.onSuccess(s,O,b,S)}else O.retry>=x.maxRetry||y>=400&&y<499?(G.logger.error(y+" while loading "+b.url),this.callbacks.onError({code:y,text:S.statusText},b,S)):(G.logger.warn(y+" while loading "+b.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,x.maxRetryDelay),O.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),x.timeout)},k.loadtimeout=function(){G.logger.warn("timeout while loading "+this.context.url);var b=this.callbacks;b&&(this.abortInternal(),b.onTimeout(this.stats,this.context,this.loader))},k.loadprogress=function(b){var S=this.stats;S.loaded=b.loaded,b.lengthComputable&&(S.total=b.total)},k.getCacheAge=function(){var b=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var S=this.loader.getResponseHeader("age");b=S?parseFloat(S):null}return b},U}();z.default=B}}).default})},vHTk:function(ot,ze,Z){ot.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wzkS:function(ot,ze,Z){"use strict";Z.d(ze,"c",function(){return I}),Z.d(ze,"b",function(){return P}),Z.d(ze,"d",function(){return B}),Z.d(ze,"a",function(){return k}),Z.d(ze,"e",function(){return A});var re=Z("9og8"),z=Z("WmNS"),L=Z.n(z),G=Z("ErOA");function I(b){return Object(G.c)("libraries/".concat(b,".json"))}function P(){return Object(G.c)("library_tags.json")}function B(b){return U.apply(this,arguments)}function U(){return U=Object(re.a)(L.a.mark(function b(S){var O;return L.a.wrap(function(x){for(;;)switch(x.prev=x.next){case 0:return x.next=2,Object(G.b)("attachments/".concat(S,".json"));case 2:return O=x.sent,x.abrupt("return",O.status===0);case 4:case"end":return x.stop()}},b)})),U.apply(this,arguments)}function k(b){return Object(G.f)("libraries.json",b)}function A(b,S){return Object(G.g)("libraries/".concat(b,".json"),S)}},y5JW:function(ot,ze,Z){"use strict";Z.d(ze,"c",function(){return y}),Z.d(ze,"a",function(){return d});var re=Z("DZo9"),z=Z("8z0m"),L=Z("+L6B"),G=Z("2/Rp"),I=Z("9og8"),P=Z("miYZ"),B=Z("tsqr"),U=Z("k1fw"),k=Z("oBTY"),A=Z("WmNS"),b=Z.n(A),S=Z("cDcd"),O=Z.n(S),_=Z("m3rI"),x=Z("wzkS"),y="\u3000\u3000";function d(o){var u=["Bytes","KB","MB","GB","TB"];if(o==0)return"0 Byte";var s=parseInt(""+Math.floor(Math.log(o)/Math.log(1024)),10);return(o/Math.pow(1024,s)).toFixed(1)+" "+u[s]}ze.b=function(o){var u=o.value,s=u===void 0?[]:u,w=o.action,g=o.onChange,f=o.className,C=o.maxSize,m=C===void 0?150:C,h=o.title,c=h===void 0?"\u6587\u4EF6\u4E0A\u4F20":h,l=o.accept,a=l===void 0?null:l,v={multiple:!1,fileList:s,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(y)===-1&&(H.name="".concat(H.name).concat(y).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,R;B.b.error((D=M.file)===null||D===void 0||((R=D.response)===null||R===void 0)?void 0:R.message),g([]);return}g(W)},onRemove:function(){var E=Object(I.a)(b.a.mark(function F(j){var W,D,R;return b.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<m){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 R=Y.sent,Y.abrupt("return",R);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 p(E){E.preventDefault(),E.stopPropagation()}return O.a.createElement("div",{className:"single-upload ".concat(f||"")},O.a.createElement(z.a,v,O.a.createElement(G.a,{type:"primary",title:s.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:s.length>0,ghost:!0},c),O.a.createElement("span",{onClick:p,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",m,"M)"," ")))}},yQHh:function(ot,ze,Z){}}]);
|