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.
138 lines
761 KiB
138 lines
761 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[303,6,7,14],{"+NIl":function(et,We,Q){(function(te){te(Q("VrN/"))})(function(te){"use strict";te.defineMode("stex",function(G,A){"use strict";function z(T,E){T.cmdState.push(E)}function I(T){return T.cmdState.length>0?T.cmdState[T.cmdState.length-1]:null}function R(T){var E=T.cmdState.pop();E&&E.closeBracket()}function j(T){for(var E=T.cmdState,g=E.length-1;g>=0;g--){var u=E[g];if(u.name=="DEFAULT")continue;return u}return{styleIdentifier:function(){return null}}}function F(T,E,g){return function(){this.name=T,this.bracketNo=0,this.style=E,this.styles=g,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=F("importmodule","tag",["string","builtin"]),k.documentclass=F("documentclass","tag",["","atom"]),k.usepackage=F("usepackage","tag",["atom"]),k.begin=F("begin","tag",["atom"]),k.end=F("end","tag",["atom"]),k.label=F("label","tag",["atom"]),k.ref=F("ref","tag",["atom"]),k.eqref=F("eqref","tag",["atom"]),k.cite=F("cite","tag",["atom"]),k.bibitem=F("bibitem","tag",["atom"]),k.Bibitem=F("Bibitem","tag",["atom"]),k.RBibitem=F("RBibitem","tag",["atom"]),k.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function L(T,E){T.f=E}function v(T,E){var g;if(T.match(/^\\[a-zA-Z@]+/)){var u=T.current().slice(1);return g=k.hasOwnProperty(u)?k[u]:k.DEFAULT,g=new g,z(E,g),L(E,D),g.style}if(T.match(/^\\[$&%#{}_]/))return"tag";if(T.match(/^\\[,;!\/\\]/))return"tag";if(T.match("\\["))return L(E,function(s,l){return S(s,l,"\\]")}),"keyword";if(T.match("\\("))return L(E,function(s,l){return S(s,l,"\\)")}),"keyword";if(T.match("$$"))return L(E,function(s,l){return S(s,l,"$$")}),"keyword";if(T.match("$"))return L(E,function(s,l){return S(s,l,"$")}),"keyword";var a=T.next();if(a=="%")return T.skipToEnd(),"comment";if(a=="}"||a=="]"){if(g=I(E),g)g.closeBracket(a),L(E,D);else return"error";return"bracket"}else return a=="{"||a=="["?(g=k.DEFAULT,g=new g,z(E,g),"bracket"):/\d/.test(a)?(T.eatWhile(/[\w.%]/),"atom"):(T.eatWhile(/[\w\-_]/),g=j(E),g.name=="begin"&&(g.argument=T.current()),g.styleIdentifier())}function S(T,E,g){if(T.eatSpace())return null;if(g&&T.match(g))return L(E,v),"keyword";if(T.match(/^\\[a-zA-Z@]+/))return"tag";if(T.match(/^[a-zA-Z]+/))return"variable-2";if(T.match(/^\\[$&%#{}_]/))return"tag";if(T.match(/^\\[,;!\/]/))return"tag";if(T.match(/^[\^_&]/))return"tag";if(T.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(T.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var u=T.next();return u=="{"||u=="}"||u=="["||u=="]"||u=="("||u==")"?"bracket":u=="%"?(T.skipToEnd(),"comment"):"error"}function D(T,E){var g=T.peek(),u;return g=="{"||g=="["?(u=I(E),u.openBracket(g),T.eat(g),L(E,v),"bracket"):/[ \t\r]/.test(g)?(T.eat(g),null):(L(E,v),R(E),v(T,E))}return{startState:function(){var T=A.inMathMode?function(E,g){return S(E,g)}:v;return{cmdState:[],f:T}},copyState:function(T){return{cmdState:T.cmdState.slice(),f:T.f}},token:function(T,E){return E.f(T,E)},blankLine:function(T){T.f=v,T.cmdState.length=0},lineComment:"%"}}),te.defineMIME("text/x-stex","stex"),te.defineMIME("text/x-latex","stex")})},"19Vz":function(et,We,Q){(function(te){te(Q("VrN/"))})(function(te){te.defineOption("placeholder","",function(F,k,L){var v=L&&L!=te.Init;if(k&&!v)F.on("blur",I),F.on("change",R),F.on("swapDoc",R),te.on(F.getInputField(),"compositionupdate",F.state.placeholderCompose=function(){z(F)}),R(F);else if(!k&&v){F.off("blur",I),F.off("change",R),F.off("swapDoc",R),te.off(F.getInputField(),"compositionupdate",F.state.placeholderCompose),G(F);var S=F.getWrapperElement();S.className=S.className.replace(" CodeMirror-empty","")}k&&!F.hasFocus()&&I(F)});function G(F){F.state.placeholder&&(F.state.placeholder.parentNode.removeChild(F.state.placeholder),F.state.placeholder=null)}function A(F){G(F);var k=F.state.placeholder=document.createElement("pre");k.style.cssText="height: 0; overflow: visible",k.style.direction=F.getOption("direction"),k.className="CodeMirror-placeholder CodeMirror-line-like";var L=F.getOption("placeholder");typeof L=="string"&&(L=document.createTextNode(L)),k.appendChild(L),F.display.lineSpace.insertBefore(k,F.display.lineSpace.firstChild)}function z(F){setTimeout(function(){var k=!1,L=F.getInputField();L.nodeName=="TEXTAREA"?k=!L.value:F.lineCount()==1&&(k=!/[^\u200b]/.test(L.querySelector(".CodeMirror-line").textContent)),k?A(F):G(F)},20)}function I(F){j(F)&&A(F)}function R(F){var k=F.getWrapperElement(),L=j(F);k.className=k.className.replace(" CodeMirror-empty","")+(L?" CodeMirror-empty":""),L?A(F):G(F)}function j(F){return F.lineCount()===1&&F.getLine(0)===""}})},"1ZF9":function(et,We,Q){et.exports=Q.p+"static/Authorize.cc9c212f.png"},"1eCo":function(et,We,Q){(function(te){te(Q("VrN/"))})(function(te){"use strict";var G={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},A={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};te.defineMode("xml",function(z,I){var R=z.indentUnit,j={},F=I.htmlMode?G:A;for(var k in F)j[k]=F[k];for(var k in I)j[k]=I[k];var L,v;function S(o,y){function m(U){return y.tokenize=U,U(o,y)}var x=o.next();if(x=="<")return o.eat("!")?o.eat("[")?o.match("CDATA[")?m(E("atom","]]>")):null:o.match("--")?m(E("comment","-->")):o.match("DOCTYPE",!0,!0)?(o.eatWhile(/[\w\._\-]/),m(g(1))):null:o.eat("?")?(o.eatWhile(/[\w\._\-]/),y.tokenize=E("meta","?>"),"meta"):(L=o.eat("/")?"closeTag":"openTag",y.tokenize=D,"tag bracket");if(x=="&"){var P;return o.eat("#")?o.eat("x")?P=o.eatWhile(/[a-fA-F\d]/)&&o.eat(";"):P=o.eatWhile(/[\d]/)&&o.eat(";"):P=o.eatWhile(/[\w\.\-:]/)&&o.eat(";"),P?"atom":"error"}else return o.eatWhile(/[^&<]/),null}S.isInText=!0;function D(o,y){var m=o.next();if(m==">"||m=="/"&&o.eat(">"))return y.tokenize=S,L=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return L="equals",null;if(m=="<"){y.tokenize=S,y.state=l,y.tagName=y.tagStart=null;var x=y.tokenize(o,y);return x?x+" tag error":"tag error"}else return/[\'\"]/.test(m)?(y.tokenize=T(m),y.stringStartCol=o.column(),y.tokenize(o,y)):(o.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function T(o){var y=function(m,x){for(;!m.eol();)if(m.next()==o){x.tokenize=D;break}return"string"};return y.isInAttribute=!0,y}function E(o,y){return function(m,x){for(;!m.eol();){if(m.match(y)){x.tokenize=S;break}m.next()}return o}}function g(o){return function(y,m){for(var x;(x=y.next())!=null;){if(x=="<")return m.tokenize=g(o+1),m.tokenize(y,m);if(x==">")if(o==1){m.tokenize=S;break}else return m.tokenize=g(o-1),m.tokenize(y,m)}return"meta"}}function u(o,y,m){this.prev=o.context,this.tagName=y,this.indent=o.indented,this.startOfLine=m,(j.doNotIndent.hasOwnProperty(y)||o.context&&o.context.noIndent)&&(this.noIndent=!0)}function a(o){o.context&&(o.context=o.context.prev)}function s(o,y){for(var m;;){if(!o.context)return;if(m=o.context.tagName,!j.contextGrabbers.hasOwnProperty(m)||!j.contextGrabbers[m].hasOwnProperty(y))return;a(o)}}function l(o,y,m){return o=="openTag"?(m.tagStart=y.column(),w):o=="closeTag"?p:l}function w(o,y,m){return o=="word"?(m.tagName=y.current(),v="tag",b):j.allowMissingTagName&&o=="endTag"?(v="tag bracket",b(o,y,m)):(v="error",w)}function p(o,y,m){if(o=="word"){var x=y.current();return m.context&&m.context.tagName!=x&&j.implicitlyClosed.hasOwnProperty(m.context.tagName)&&a(m),m.context&&m.context.tagName==x||j.matchClosing===!1?(v="tag",h):(v="tag error",C)}else return j.allowMissingTagName&&o=="endTag"?(v="tag bracket",h(o,y,m)):(v="error",C)}function h(o,y,m){return o!="endTag"?(v="error",h):(a(m),l)}function C(o,y,m){return v="error",h(o,y,m)}function b(o,y,m){if(o=="word")return v="attribute",c;if(o=="endTag"||o=="selfcloseTag"){var x=m.tagName,P=m.tagStart;return m.tagName=m.tagStart=null,o=="selfcloseTag"||j.autoSelfClosers.hasOwnProperty(x)?s(m,x):(s(m,x),m.context=new u(m,x,P==m.indented)),l}return v="error",b}function c(o,y,m){return o=="equals"?f:(j.allowMissing||(v="error"),b(o,y,m))}function f(o,y,m){return o=="string"?d:o=="word"&&j.allowUnquoted?(v="string",b):(v="error",b(o,y,m))}function d(o,y,m){return o=="string"?d:b(o,y,m)}return{startState:function(o){var y={tokenize:S,state:l,indented:o||0,tagName:null,tagStart:null,context:null};return o!=null&&(y.baseIndent=o),y},token:function(o,y){if(!y.tagName&&o.sol()&&(y.indented=o.indentation()),o.eatSpace())return null;L=null;var m=y.tokenize(o,y);return(m||L)&&m!="comment"&&(v=null,y.state=y.state(L||m,o,y),v&&(m=v=="error"?m+" error":v)),m},indent:function(o,y,m){var x=o.context;if(o.tokenize.isInAttribute)return o.tagStart==o.indented?o.stringStartCol+1:o.indented+R;if(x&&x.noIndent)return te.Pass;if(o.tokenize!=D&&o.tokenize!=S)return m?m.match(/^(\s*)/)[0].length:0;if(o.tagName)return j.multilineTagIndentPastTag!==!1?o.tagStart+o.tagName.length+2:o.tagStart+R*(j.multilineTagIndentFactor||1);if(j.alignCDATA&&/<!\[CDATA\[/.test(y))return 0;var P=y&&/^<(\/)?([\w_:\.-]*)/.exec(y);if(P&&P[1])for(;x;)if(x.tagName==P[2]){x=x.prev;break}else if(j.implicitlyClosed.hasOwnProperty(x.tagName))x=x.prev;else break;else if(P)for(;x;){var U=j.contextGrabbers[x.tagName];if(U&&U.hasOwnProperty(P[2]))x=x.prev;else break}for(;x&&x.prev&&!x.startOfLine;)x=x.prev;return x?x.indent+R:o.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:j.htmlMode?"html":"xml",helperType:j.htmlMode?"html":"xml",skipAttribute:function(o){o.state==f&&(o.state=b)},xmlCurrentTag:function(o){return o.tagName?{name:o.tagName,close:o.type=="closeTag"}:null},xmlCurrentContext:function(o){for(var y=[],m=o.context;m;m=m.prev)m.tagName&&y.push(m.tagName);return y.reverse()}}}),te.defineMIME("text/xml","xml"),te.defineMIME("application/xml","xml"),te.mimeModes.hasOwnProperty("text/html")||te.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"3vs6":function(et,We,Q){"use strict";var te=Q("+L6B"),G=Q("2/Rp"),A=Q("5Dmo"),z=Q("3S7+"),I=Q("k1fw"),R=Q("miYZ"),j=Q("tsqr"),F=Q("9og8"),k=Q("2qtc"),L=Q("kLXV"),v=Q("tJVT"),S=Q("WmNS"),D=Q.n(S),T=Q("cDcd"),E=Q.n(T),g=Q("ttuQ"),u=Q.n(g),a=Q("ErOA"),s=Q("m3rI"),l=Q("IE1O"),w=Q("xKgJ"),p=Q("NLgs"),h=Q("Ty5D"),C=Q("9kvl"),b=function(f){var d=f.virtualSpaces,o=f.user,y=f.dispatch,m=Object(T.useState)(!1),x=Object(v.a)(m,2),P=x[0],U=x[1],B=Object(h.i)(),W=d.virtualSpacesDetails;Object(T.useEffect)(function(){O()},[]);var O=function(){y({type:"virtualSpaces/getVirtualSpacesDetails",payload:{id:B==null?void 0:B.virtual_spacesId}})},M=function(){if(!Object(p.f)(y))return;L.a.confirm({centered:!0,width:424,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u7533\u8BF7\u52A0\u5165",icon:null,className:"custom-modal-divider",content:E.a.createElement("div",{className:"font14"},"\u786E\u8BA4\u5411\u7BA1\u7406\u5458\u7533\u8BF7\u52A0\u5165\u8BE5\u865A\u62DF\u793E\u533A\u5417\uFF1F"),onOk:function(){var me=Object(F.a)(D.a.mark(function de(){var se;return D.a.wrap(function(he){for(;;)switch(he.prev=he.next){case 0:return he.next=2,Object(a.a)("/api/virtual_classrooms/".concat(B==null?void 0:B.virtual_spacesId,"/apply_become_member.json"),{method:"post"});case 2:se=he.sent,(se==null?void 0:se.status)!==-1&&(j.b.success(se==null?void 0:se.message),O());case 4:case"end":return he.stop()}},de)}));function ge(){return me.apply(this,arguments)}return ge}()})},K=function(){L.a.confirm({centered:!0,width:424,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u7533\u8BF7\u516C\u5F00",icon:null,className:"custom-modal-divider",content:E.a.createElement("div",{className:"font14"},E.a.createElement("p",null,"\u786E\u8BA4\u5411\u5E73\u53F0\u7533\u8BF7\u516C\u5F00\u865A\u62DF\u793E\u533A\u5417\uFF1F"),E.a.createElement("p",null,"\u516C\u5F00\u865A\u62DF\u793E\u533A\u9700\u7ECF\u8FC7\u5E73\u53F0\u6807\u51C6\u5316\u5BA1\u6838\uFF0C\u5BA1\u6838\u5468\u671F\u4E3A1-2\u5929\uFF0C"),E.a.createElement("div",null,"\u516C\u5F00\u7684\u865A\u62DF\u793E\u533A\u5C06\u5BF9\u5E73\u53F0\u6240\u6709\u4EBA\u53EF\u89C1\u3002")),onOk:function(){var me=Object(F.a)(D.a.mark(function de(){var se;return D.a.wrap(function(he){for(;;)switch(he.prev=he.next){case 0:return he.next=2,Object(a.a)("/api/virtual_classrooms/".concat(B==null?void 0:B.virtual_spacesId,"/apply_public.json"),{method:"post"});case 2:se=he.sent,(se==null?void 0:se.status)!==-1&&(j.b.success(se==null?void 0:se.message),O());case 4:case"end":return he.stop()}},de)}));function ge(){return me.apply(this,arguments)}return ge}()})},X=function(){var xe=Object(F.a)(D.a.mark(function me(ge){var de;return D.a.wrap(function(ne){for(;;)switch(ne.prev=ne.next){case 0:return ne.next=2,Object(a.a)("/api/virtual_classrooms/".concat(B==null?void 0:B.virtual_spacesId,".json"),{method:"put",body:ge});case 2:de=ne.sent,(de==null?void 0:de.status)===0&&(O(),U(!1));case 4:case"end":return ne.stop()}},me)}));return function(ge){return xe.apply(this,arguments)}}(),ee=function(){var xe=Object(F.a)(D.a.mark(function me(ge){return D.a.wrap(function(se){for(;;)switch(se.prev=se.next){case 0:U(Object(I.a)({},W));case 1:case"end":return se.stop()}},me)}));return function(ge){return xe.apply(this,arguments)}}(),oe=(W==null?void 0:W.is_member)||Object(w.v)();return E.a.createElement("div",{className:u.a.bg,style:{background:"url('".concat(s.a.IMG_SERVER+(W==null?void 0:W.backbground_image_url),"') no-repeat center center")}},E.a.createElement("aside",null,E.a.createElement("div",null,E.a.createElement("div",{className:u.a.member},E.a.createElement("div",null,E.a.createElement(z.a,{title:"\u6210\u5458\u603B\u6570"},E.a.createElement("i",{style:{color:"#FF8B58",fontSize:24},className:"iconfont icon-a-chengyuan1"})),E.a.createElement(z.a,{title:"\u6210\u5458\u603B\u6570"},E.a.createElement("span",null,W==null?void 0:W.members_count))),E.a.createElement("div",null,E.a.createElement(z.a,{title:"\u8D44\u6E90\u603B\u6570"},E.a.createElement("i",{style:{color:"#07C160",marginLeft:100},className:"iconfont icon-a-ziyuanku1"})),E.a.createElement(z.a,{title:"\u8D44\u6E90\u603B\u6570"},E.a.createElement("span",null,W==null?void 0:W.resources_count)))),oe&&E.a.createElement(G.a,{disabled:(W==null?void 0:W.status)!==2,onClick:K,type:"primary"},E.a.createElement("i",{className:"iconfont icon-sheweigongkai2 mr5 font14"}),(W==null?void 0:W.status)===2?"\u7533\u8BF7\u516C\u5F00":(W==null?void 0:W.status)===0?"\u7533\u8BF7\u4E2D":"\u5DF2\u516C\u5F00"),!oe&&E.a.createElement(G.a,{onClick:M,type:"primary"},E.a.createElement("i",{className:"iconfont icon-shenqingjiaru2 mr5 font14"}),"\u7533\u8BF7\u52A0\u5165"))),E.a.createElement(l.b,{visible:P,title:"\u7F16\u8F91\u865A\u62DF\u793E\u533A",onCancel:function(){return U(!1)},onOk:X}))};We.a=Object(C.a)(function(c){var f=c.virtualSpaces,d=c.user;return{virtualSpaces:f,user:d}})(b)},"500L":function(et,We,Q){"use strict";Q.d(We,"a",function(){return p});var te=Q("+L6B"),G=Q("2/Rp"),A=Q("2qtc"),z=Q("kLXV"),I=Q("9og8"),R=Q("k1fw"),j=Q("miYZ"),F=Q("tsqr"),k=Q("oBTY"),L=Q("tJVT"),v=Q("DZo9"),S=Q("8z0m"),D=Q("WmNS"),T=Q.n(D),E=Q("cDcd"),g=Q.n(E),u=Q("m3rI"),a=Q("wzkS"),s=Q("y5JW"),l=Q("LtfV"),w=S.a.Dragger;function p(h){var C=[];return h&&h.length>0&&(C=h.map(function(b){return{uid:b.id,id:b.id,name:b.title+s.c+b.filesize,url:b.url,filesize:b.filesize,status:"done",response:{id:b.id}}})),C}We.b=function(h){var C=h.value,b=h.onChange,c=h.action,f=h.className,d=h.maxSize,o=d===void 0?150:d,y=h.title,m=y===void 0?"\u4E0A\u4F20\u9644\u4EF6":y,x=h.showRemoveModal,P=x===void 0?!1:x,U=h.accept,B=U===void 0?"":U,W=h.additionalText,O=h.isDragger,M=h.number,K=M===void 0?1e3:M,X=h.aloneClear,ee=X===void 0?!1:X,oe=Object(E.useState)(!1),xe=Object(L.a)(oe,2),me=xe[0],ge=xe[1],de=Object(E.useState)(C||[]),se=Object(L.a)(de,2),ne=se[0],he=se[1];Object(E.useEffect)(function(){C&&(he(Object(k.a)(C)),K===(C==null?void 0:C.length)&&ge(!0))},[C]);var $=function(){setTimeout(function(){ne.pop(),he(Object(k.a)(ne))},500)},ie={multiple:!0,disabled:me,accept:B,withCredentials:!0,fileList:ne,beforeUpload:function(Se,ye){var _e=Se.size/1024/1024;return ne.concat(ye).length>K?(ne.pop(),he(Object(k.a)(ne)),F.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(K,"\u4E2A\u6587\u4EF6")),ee?Promise.reject():($(),!1)):!0},action:c||"".concat(u.a.API_SERVER,"/api/attachments.json"),onChange:function(Se){var ye,_e,Le=Object(k.a)(Se.fileList);if(Se.file.status==="done"&&((ye=Se.file)===null||ye===void 0||((_e=ye.response)===null||_e===void 0)?void 0:_e.status)===-1){var Ie,Me;F.b.error((Ie=Se.file)===null||Ie===void 0||((Me=Ie.response)===null||Me===void 0)?void 0:Me.message);return}Le.length>=K?ge(!0):ge(!1),he(Object(k.a)(Le)),Le=Le.map(function(Ce){var we;if(Ce!=null&&(we=Ce.response)!==null&&we!==void 0&&we.id){var Be;Ce.url="/api/attachments/".concat(Ce==null||((Be=Ce.response)===null||Be===void 0)?void 0:Be.id)}return Ce.name.indexOf(s.c)===-1&&(Ce.name="".concat(Ce.name).concat(s.c).concat(Object(s.a)(Ce.size))),Object(R.a)({},Ce)}),console.log("info:",Se),b(Le)},onRemove:function(){var Ee=Object(I.a)(T.a.mark(function ye(_e){var Le;return T.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:if(Le=function(){var Ce=Object(I.a)(T.a.mark(function we(){var Be,Ke;return T.a.wrap(function(Pe){for(;;)switch(Pe.prev=Pe.next){case 0:if(Be=_e.response?_e.response.id:_e.id,!Be){Pe.next=8;break}return Pe.next=4,Object(a.d)(_e.response?_e.response.id:_e.uid);case 4:return Ke=Pe.sent,Pe.abrupt("return",Ke);case 8:return Pe.abrupt("return",!0);case 9:case"end":return Pe.stop()}},we)}));return function(){return Ce.apply(this,arguments)}}(),!P){Me.next=5;break}return Me.abrupt("return",new Promise(function(Ce,we){z.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:g.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var Be=Object(I.a)(T.a.mark(function Ue(){var Pe;return T.a.wrap(function(He){for(;;)switch(He.prev=He.next){case 0:return He.next=2,Le();case 2:Pe=He.sent,F.b.success("\u5220\u9664\u6210\u529F"),Ce(!0);case 5:case"end":return He.stop()}},Ue)}));function Ke(){return Be.apply(this,arguments)}return Ke}(),onCancel:function(){return Ce(!1)}})}));case 5:return Me.next=7,Le();case 7:return Me.abrupt("return",Me.sent);case 8:case"end":return Me.stop()}},ye)}));function Se(ye){return Ee.apply(this,arguments)}return Se}()};function Z(Ee){Ee.preventDefault(),Ee.stopPropagation()}return g.a.createElement("div",{className:"multi-upload ".concat(f||"")},O&&g.a.createElement(w,ie,g.a.createElement("p",{className:"ant-upload-drag-icon"},g.a.createElement(l.a,null)),g.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",g.a.createElement("br",null),"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",o,"MB)"," "),W),!O&&g.a.createElement(S.a,ie,g.a.createElement(G.a,{disabled:me},m),g.a.createElement("span",{onClick:Z,style:{marginLeft:10,color:"#FA6400"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",o,"MB)"," ")))}},"7Cbv":function(et,We,Q){"use strict";var te=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),G=new Uint8Array(16);function A(){if(!te)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return te(G)}var z=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function I(D){return typeof D=="string"&&z.test(D)}for(var R=I,j=[],F=0;F<256;++F)j.push((F+256).toString(16).substr(1));function k(D){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,E=(j[D[T+0]]+j[D[T+1]]+j[D[T+2]]+j[D[T+3]]+"-"+j[D[T+4]]+j[D[T+5]]+"-"+j[D[T+6]]+j[D[T+7]]+"-"+j[D[T+8]]+j[D[T+9]]+"-"+j[D[T+10]]+j[D[T+11]]+j[D[T+12]]+j[D[T+13]]+j[D[T+14]]+j[D[T+15]]).toLowerCase();if(!R(E))throw TypeError("Stringified UUID is invalid");return E}var L=k;function v(D,T,E){D=D||{};var g=D.random||(D.rng||A)();if(g[6]=g[6]&15|64,g[8]=g[8]&63|128,T){E=E||0;for(var u=0;u<16;++u)T[E+u]=g[u];return T}return L(g)}var S=We.a=v},"7ahc":function(et,We,Q){"use strict";Q.d(We,"a",function(){return w});var te=Q("k1fw"),G=Q("0Owb"),A=Q("+L6B"),z=Q("2/Rp"),I=Q("y8nQ"),R=Q("Vl3Y"),j=Q("tJVT"),F=Q("OaEy"),k=Q("2fM7"),L=Q("cDcd"),v=Q.n(L),S=Q("VrN/"),D=Q.n(S),T=Q("p77/"),E=Q.n(T),g=Q("c5Ni"),u=Q.n(g),a=k.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},l={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};We.b=function(p){var h=p.callback,C=p.onCancel,b=Object(L.useState)("python"),c=Object(j.a)(b,2),f=c[0],d=c[1];function o(m){d(l[m][1])}function y(m){h(m)}return v.a.createElement(R.a,Object(G.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:y}),v.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},v.a.createElement(k.a,{onChange:o},Object.keys(l).map(function(m){return v.a.createElement(a,{key:m,value:m},l[m][0])}))),v.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},v.a.createElement(w,{mode:f})),v.a.createElement("div",{className:"flex-container flex-end"},v.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(z.a,{type:"ghost",onClick:C},"\u53D6\u6D88")))};function w(p){var h=p.value,C=p.onChange,b=p.mode,c=p.options,f=c===void 0?{}:c,d=Object(L.useRef)(),o=Object(L.useState)(),y=Object(j.a)(o,2),m=y[0],x=y[1];return Object(L.useEffect)(function(){if(m){function P(U){var B=U.getValue();C&&C(B)}return m.on("change",P),function(){m.off("change",P)}}},[m,C]),Object(L.useEffect)(function(){m&&m.setOption("mode",b)},[m,b]),Object(L.useEffect)(function(){m&&((h!==m.getValue()||h==="")&&setTimeout(function(){m.setValue(h||" ")},300))},[m,h]),Object(L.useEffect)(function(){if(d.current&&!m){var P=D.a.fromTextArea(d.current,Object(te.a)({mode:b,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},f));x(P)}},[d.current,m]),v.a.createElement("div",{className:"my-codemirror-container"},v.a.createElement("textarea",{ref:d}))}},"7ixt":function(et,We,Q){"use strict";Q.d(We,"a",function(){return A});var te={adjustX:1,adjustY:1},G=[0,0],A={left:{points:["cr","cl"],overflow:te,offset:[-4,0],targetOffset:G},right:{points:["cl","cr"],overflow:te,offset:[4,0],targetOffset:G},top:{points:["bc","tc"],overflow:te,offset:[0,-4],targetOffset:G},bottom:{points:["tc","bc"],overflow:te,offset:[0,4],targetOffset:G},topLeft:{points:["bl","tl"],overflow:te,offset:[0,-4],targetOffset:G},leftTop:{points:["tr","tl"],overflow:te,offset:[-4,0],targetOffset:G},topRight:{points:["br","tr"],overflow:te,offset:[0,-4],targetOffset:G},rightTop:{points:["tl","tr"],overflow:te,offset:[4,0],targetOffset:G},bottomRight:{points:["tr","br"],overflow:te,offset:[0,4],targetOffset:G},rightBottom:{points:["bl","br"],overflow:te,offset:[4,0],targetOffset:G},bottomLeft:{points:["tl","bl"],overflow:te,offset:[0,4],targetOffset:G},leftBottom:{points:["br","bl"],overflow:te,offset:[-4,0],targetOffset:G}},z=A},"8EBN":function(et,We,Q){(function(te){te(Q("VrN/"))})(function(te){"use strict";te.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var G=0;G<te.modeInfo.length;G++){var A=te.modeInfo[G];A.mimes&&(A.mime=A.mimes[0])}te.findModeByMIME=function(z){z=z.toLowerCase();for(var I=0;I<te.modeInfo.length;I++){var R=te.modeInfo[I];if(R.mime==z)return R;if(R.mimes){for(var j=0;j<R.mimes.length;j++)if(R.mimes[j]==z)return R}}if(/\+xml$/.test(z))return te.findModeByMIME("application/xml");if(/\+json$/.test(z))return te.findModeByMIME("application/json")},te.findModeByExtension=function(z){z=z.toLowerCase();for(var I=0;I<te.modeInfo.length;I++){var R=te.modeInfo[I];if(R.ext){for(var j=0;j<R.ext.length;j++)if(R.ext[j]==z)return R}}},te.findModeByFileName=function(z){for(var I=0;I<te.modeInfo.length;I++){var R=te.modeInfo[I];if(R.file&&R.file.test(z))return R}var j=z.lastIndexOf("."),F=j>-1&&z.substring(j+1,z.length);if(F)return te.findModeByExtension(F)},te.findModeByName=function(z){z=z.toLowerCase();for(var I=0;I<te.modeInfo.length;I++){var R=te.modeInfo[I];if(R.name.toLowerCase()==z)return R;if(R.alias){for(var j=0;j<R.alias.length;j++)if(R.alias[j].toLowerCase()==z)return R}}}})},"8hTe":function(et,We,Q){et.exports={button:"button___1wy9m"}},"9Bee":function(et,We,Q){"use strict";var te=Q("DYRE"),G=Q("zeV3"),A=Q("+L6B"),z=Q("2/Rp"),I=Q("k1fw"),R=Q("tJVT"),j=Q("cDcd"),F=Q.n(j),k=Q("vg9a"),L=Q("DlQD"),v=Q.n(L),S=Q("rUJ1");function D(ge,de){var se=ge.match(/^(\s+)(?:```)/);if(se===null)return de;var ne=se[1];return de.split(`
|
|
`).map(function(he){var $=he.match(/^\s+/);if($===null)return he;var ie=Object(R.a)($,1),Z=ie[0];return Z.length>=ne.length?he.slice(ne.length):he}).join(`
|
|
`)}var T=[],E=["<ul>"],g=new v.a.Renderer,u=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function a(){T.length=0,E=["<ul>"]}var s={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function l(ge,de,se,ne){if(de>=ge.length||ge[de].level<=se)return de;var he=ge[de];ne.push("<li><a href='#"+he.anchor+"'>"+he.text+"</a>"),de++;var $=[];return de=l(ge,de,he.level,$),$.length>0&&(ne.push("<ul>"),$.forEach(function(ie){ne.push(ie)}),ne.push("</ul>")),ne.push("</li>"),de=l(ge,de,se,ne),de}function w(){return l(T,0,0,E),E.push("</ul>"),E.join("")}var p={heading:function(de){var se=u.exec(de);if(se)return{type:"heading",raw:se[0],depth:se[1].length,text:se[2]}},fences:function(de){var se=this.rules.block.fences.exec(de);if(se){var ne=se[0],he=D(ne,se[3]||""),$=se[2]?se[2].trim():se[2];if(["latex","katex","math"].indexOf($)>=0){var ie=b(),Z=he;he=ie,c[ie]={type:"block",expression:Z}}return{type:"code",raw:ne,lang:$,text:he}}}},h=/(?:\${2})([^\n`]+?)(?:\${2})/gi,C=0,b=function(){return"__special_katext_id_".concat(C++,"__")},c={};function f(){return c}function d(){C=0,c={}}function o(ge){return ge=ge.replace(h,function(de,se){var ne=b();return c[ne]={type:"inline",expression:se},ne}),ge}var y=g.listitem;g.listitem=function(ge){return y(o(ge))};var m=g.paragraph;g.paragraph=function(ge){return m(o(ge))};var x=g.tablecell;g.tablecell=function(ge,de){return x(o(ge),de)},g.code=function(ge,de,se){var ne=(de||"").match(/\S*/)[0];return ne?["latex","katex","math"].indexOf(ne)>=0?"<p class='editormd-tex'>".concat(ge,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(de,'">').concat(se?ge:Object(S.escape)(ge,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(se?ge:Object(S.escape)(ge,!0))+"</code></pre>"},g.heading=function(ge,de,se){var ne=this.options.headerPrefix+se.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return T.push({anchor:ne,level:de,text:ge}),"<h"+de+' id="'+ne+'">'+ge+"</h"+de+">"},v.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),v.a.use({tokenizer:p,renderer:g});var P=v.a,U=Q("SJMd"),B=Q("ulZh"),W=Q.n(B),O=Q("m3rI"),M=Q("Oy/b"),K=Q("p5ED"),X=Q("8hTe"),ee=Q.n(X),oe=/<pre[^>]*>/g;function xe(ge){var de=document.createElement("div");return de.innerHTML=ge,de.childNodes.length===0?"":de.childNodes[0].nodeValue}var me=We.a=function(ge){var de=ge.value,se=de===void 0?"":de,ne=ge.edit,he=ne===void 0?!1:ne,$=ge.className,ie=ge.showTextOnly,Z=ge.showLines,Ee=ge.replaces,Se=ge.zoomImg,ye=ge.hasMask,_e=ge.style,Le=_e===void 0?{}:_e,Ie=ge.stylesPrev,Me=Ie===void 0?{}:Ie,Ce=String(se),we=Object(j.useRef)(),Be=Object(j.useRef)(),Ke=Object(j.useState)(""),Ue=Object(R.a)(Ke,2),Pe=Ue[0],Ve=Ue[1],He=Object(j.useState)("office"),Xe=Object(R.a)(He,2),Ae=Xe[0],qe=Xe[1],Je=Object(j.useMemo)(function(){try{var fe=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,J=/\"\/api\/attachments\/|\"\/attachments\/download\//g,q=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Ce=Ce.replace(fe,"("+O.a.API_SERVER+"/api/attachments/").replace(J,'"'+O.a.API_SERVER+"/api/attachments/").replace(q,'"'+O.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`)}catch(De){}var re=P(Ce),le=f();if(Ce.match(/\[TOC\]/)&&(re=re.replace("<p>[TOC]</p>",w()),a()),re=re.replace(/(__special_katext_id_\d+__)/g,function(De,ke){var Qe=le[ke],at=Qe.type,rt=Qe.expression;return Object(M.renderToString)(xe(rt)||"",{displayMode:at==="block",throwOnError:!1,output:"html"})}),re=re.replace(/▁/g,"\u2581\u2581\u2581"),d(),ie){var pe=document.createElement("div");return pe.innerHTML=re,pe.innerText}return setTimeout(function(){return ve()},500),re},[Ce]),Oe=Object(j.useRef)();s.WebkitLineClamp=Z,Z&&(Le=Object(I.a)(Object(I.a)({},Le),s));function Ne(fe){var J=fe.target;if(J.tagName.toUpperCase()==="IMG"){if(Se){var q=J.getAttribute("src");Ve(q),qe("image")}}else if(J.tagName.toUpperCase()==="A"){var re=J.getAttribute("href");if(re.indexOf("office")>-1)fe.preventDefault(),Ve(re),qe("office");else if(re.indexOf("application/pdf")>-1)fe.preventDefault(),Ve(re),qe("pdf");else if(re.indexOf("text/html")>-1)fe.preventDefault(),Ve(re),qe("html");else if(re.startsWith("#")){fe.preventDefault();var le=document.getElementById(re.replace("#",""));le&&le.scrollIntoView(!0)}}}var ve=function(){var J,q=(J=Oe.current)===null||J===void 0?void 0:J.querySelectorAll("video");q==null||q.forEach(function(re){if(re.oncontextmenu=function(){return!1},re.src.indexOf(".m3u8")>-1&&!re.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var le=new W.a;le.loadSource(re.src),le.attachMedia(re)}}})};Object(j.useEffect)(function(){if(Oe.current&&Je&&(Je.match(oe)&&window.PR.prettyPrint()),Oe.current)return Oe.current.addEventListener("click",Ne),function(){Oe.current.removeEventListener("click",Ne),d(),a()}},[Je,Oe.current,Ne]);var ce=function(J){if(!he)return;J.target.nodeName==="IMG"?(we.current.style.display="flex",we.current.style.width=J.target.clientWidth+"px",we.current.style.height=J.target.clientHeight+"px",we.current.style.top=J.target.offsetTop+"px",we.current.style.left=J.target.offsetLeft+"px",Be.current.src=J.target.getAttribute("src")):we.current.style.display="none"};return F.a.createElement("div",{style:{position:"relative"}},F.a.createElement("div",{ref:Oe,style:Object(I.a)({},Le),className:"".concat($||""," markdown-body ").concat(ee.a.mdBody),onMouseOver:ce,dangerouslySetInnerHTML:{__html:Je}}),F.a.createElement("div",{ref:we,className:ee.a.button},F.a.createElement(G.a,null,F.a.createElement(z.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),F.a.createElement(z.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),F.a.createElement("img",{ref:Be,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),F.a.createElement(K.a,{close:!0,data:Pe,type:Pe!=null&&Pe.length?Ae:"",style:Object(I.a)({},Me),onClose:function(){return Ve("")}}))}},"9VGf":function(et,We,Q){"use strict";Q.d(We,"a",function(){return A});var te=Q("cDcd"),G=Q.n(te);function A(z,I){var R=Object(te.useRef)();Object(te.useEffect)(function(){R.current=z}),Object(te.useEffect)(function(){function j(){R.current()}if(I!==null){var F=setInterval(j,I);return function(){return clearInterval(F)}}},[I])}},Bd2K:function(et,We,Q){(function(te){te(Q("VrN/"),Q("osHv"))})(function(te){te.defineOption("autoCloseTags",!1,function(k,L,v){if(v!=te.Init&&v&&k.removeKeyMap("autoCloseTags"),!L)return;var S={name:"autoCloseTags"};(typeof L!="object"||L.whenClosing!==!1)&&(S["'/'"]=function(D){return R(D)}),(typeof L!="object"||L.whenOpening!==!1)&&(S["'>'"]=function(D){return z(D)}),k.addKeyMap(S)});var G=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],A=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function z(k){if(k.getOption("disableInput"))return te.Pass;for(var L=k.listSelections(),v=[],S=k.getOption("autoCloseTags"),D=0;D<L.length;D++){if(!L[D].empty())return te.Pass;var T=L[D].head,E=k.getTokenAt(T),g=te.innerMode(k.getMode(),E.state),u=g.state,a=g.mode.xmlCurrentTag&&g.mode.xmlCurrentTag(u),s=a&&a.name;if(!s)return te.Pass;var l=g.mode.configuration=="html",w=typeof S=="object"&&S.dontCloseTags||l&&G,p=typeof S=="object"&&S.indentTags||l&&A;E.end>T.ch&&(s=s.slice(0,s.length-E.end+T.ch));var h=s.toLowerCase();if(!s||E.type=="string"&&(E.end!=T.ch||!/[\"\']/.test(E.string.charAt(E.string.length-1))||E.string.length==1)||E.type=="tag"&&a.close||E.string.indexOf("/")==T.ch-E.start-1||w&&j(w,h)>-1||F(k,g.mode.xmlCurrentContext&&g.mode.xmlCurrentContext(u)||[],s,T,!0))return te.Pass;var C=typeof S=="object"&&S.emptyTags;if(C&&j(C,s)>-1){v[D]={text:"/>",newPos:te.Pos(T.line,T.ch+2)};continue}var b=p&&j(p,h)>-1;v[D]={indent:b,text:">"+(b?`
|
|
|
|
`:"")+"</"+s+">",newPos:b?te.Pos(T.line+1,0):te.Pos(T.line,T.ch+1)}}for(var c=typeof S=="object"&&S.dontIndentOnAutoClose,D=L.length-1;D>=0;D--){var f=v[D];k.replaceRange(f.text,L[D].head,L[D].anchor,"+insert");var d=k.listSelections().slice(0);d[D]={head:f.newPos,anchor:f.newPos},k.setSelections(d),!c&&f.indent&&(k.indentLine(f.newPos.line,null,!0),k.indentLine(f.newPos.line+1,null,!0))}}function I(k,L){for(var v=k.listSelections(),S=[],D=L?"/":"</",T=k.getOption("autoCloseTags"),E=typeof T=="object"&&T.dontIndentOnSlash,g=0;g<v.length;g++){if(!v[g].empty())return te.Pass;var u=v[g].head,a=k.getTokenAt(u),s=te.innerMode(k.getMode(),a.state),l=s.state;if(L&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=u.ch-1))return te.Pass;var w,p=s.mode.name!="xml"&&k.getMode().name=="htmlmixed";if(p&&s.mode.name=="javascript")w=D+"script";else if(p&&s.mode.name=="css")w=D+"style";else{var h=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(l);if(!h||h.length&&F(k,h,h[h.length-1],u))return te.Pass;w=D+h[h.length-1]}k.getLine(u.line).charAt(a.end)!=">"&&(w+=">"),S[g]=w}if(k.replaceSelections(S),v=k.listSelections(),!E)for(var g=0;g<v.length;g++)(g==v.length-1||v[g].head.line<v[g+1].head.line)&&k.indentLine(v[g].head.line)}function R(k){return k.getOption("disableInput")?te.Pass:I(k,!0)}te.commands.closeTag=function(k){return I(k)};function j(k,L){if(k.indexOf)return k.indexOf(L);for(var v=0,S=k.length;v<S;++v)if(k[v]==L)return v;return-1}function F(k,L,v,S,D){if(!te.scanForClosingTag)return!1;var T=Math.min(k.lastLine()+1,S.line+500),E=te.scanForClosingTag(k,S,null,T);if(!E||E.tag!=v)return!1;for(var g=D?1:0,u=L.length-1;u>=0&&L[u]==v;u--)++g;S=E.to;for(var u=1;u<g;u++){var a=te.scanForClosingTag(k,S,null,T);if(!a||a.tag!=v)return!1;S=a.to}return!0}})},BjJ7:function(et,We,Q){"use strict";Q.d(We,"d",function(){return G}),Q.d(We,"c",function(){return A}),Q.d(We,"e",function(){return z}),Q.d(We,"b",function(){return I}),Q.d(We,"a",function(){return j});var te=Q("m3rI");function G(F){var k=!0;if(F.length>0){for(var L=0;L<F.length;L++)if(F[L].compile_success==0||!F[L].compile_success){k=!1;break}}else k=!1;return k}function A(F){for(var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",L=[],v=0;v<F.length;v++){var S=F[v],D=k?"".concat(k,"/").concat(S.name):"".concat(S.name);L.push({title:S.name,isLeaf:!(S.type==="tree"),key:D})}return L}function z(F,k,L){for(var v=0;v<F.length;v++){var S=F[v];if(S.key===k){S.children=L;break}S.children&&z(S.children,k,L)}return F}function I(F,k,L){var v;return function(){var S=this,D=arguments,T=function(){v=null,L||F.apply(S,D)},E=L&&!v;clearTimeout(v),v=setTimeout(T,k),E&&F.apply(S,D)}}var R=!0,j=te.a.API_SERVER},"C+DQ":function(et,We,Q){},DlQD:function(et,We,Q){(function(te,G){et.exports=G()})(this,function(){"use strict";function te(ve,ce){for(var fe=0;fe<ce.length;fe++){var J=ce[fe];J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J&&(J.writable=!0),Object.defineProperty(ve,J.key,J)}}function G(ve,ce,fe){return ce&&te(ve.prototype,ce),fe&&te(ve,fe),ve}function A(ve,ce){if(!ve)return;if(typeof ve=="string")return z(ve,ce);var fe=Object.prototype.toString.call(ve).slice(8,-1);if(fe==="Object"&&ve.constructor&&(fe=ve.constructor.name),fe==="Map"||fe==="Set")return Array.from(ve);if(fe==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(fe))return z(ve,ce)}function z(ve,ce){(ce==null||ce>ve.length)&&(ce=ve.length);for(var fe=0,J=new Array(ce);fe<ce;fe++)J[fe]=ve[fe];return J}function I(ve,ce){var fe;if(typeof Symbol=="undefined"||ve[Symbol.iterator]==null){if(Array.isArray(ve)||(fe=A(ve))||ce&&ve&&typeof ve.length=="number"){fe&&(ve=fe);var J=0;return function(){return J>=ve.length?{done:!0}:{done:!1,value:ve[J++]}}}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 fe=ve[Symbol.iterator](),fe.next.bind(fe)}function R(ve,ce){return ce={exports:{}},ve(ce,ce.exports),ce.exports}var j=R(function(ve){function ce(){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 fe(J){ve.exports.defaults=J}ve.exports={defaults:ce(),getDefaults:ce,changeDefaults:fe}}),F=j.defaults,k=j.getDefaults,L=j.changeDefaults,v=/[&<>"']/,S=/[&<>"']/g,D=/[<>"']|&(?!#?\w+;)/,T=/[<>"']|&(?!#?\w+;)/g,E={"&":"&","<":"<",">":">",'"':""","'":"'"},g=function(ce){return E[ce]};function u(ve,ce){if(ce){if(v.test(ve))return ve.replace(S,g)}else if(D.test(ve))return ve.replace(T,g);return ve}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(ve){return ve.replace(a,function(ce,fe){return fe=fe.toLowerCase(),fe==="colon"?":":fe.charAt(0)==="#"?fe.charAt(1)==="x"?String.fromCharCode(parseInt(fe.substring(2),16)):String.fromCharCode(+fe.substring(1)):""})}var l=/(^|[^\[])\^/g;function w(ve,ce){ve=ve.source||ve,ce=ce||"";var fe={replace:function(q,re){return re=re.source||re,re=re.replace(l,"$1"),ve=ve.replace(q,re),fe},getRegex:function(){return new RegExp(ve,ce)}};return fe}var p=/[^\w:]/g,h=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function C(ve,ce,fe){if(ve){var J;try{J=decodeURIComponent(s(fe)).replace(p,"").toLowerCase()}catch(q){return null}if(J.indexOf("javascript:")===0||J.indexOf("vbscript:")===0||J.indexOf("data:")===0)return null}ce&&!h.test(fe)&&(fe=o(ce,fe));try{fe=encodeURI(fe).replace(/%25/g,"%")}catch(q){return null}return fe}var b={},c=/^[^:]+:\/*[^/]*$/,f=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(ve,ce){b[" "+ve]||(c.test(ve)?b[" "+ve]=ve+"/":b[" "+ve]=P(ve,"/",!0)),ve=b[" "+ve];var fe=ve.indexOf(":")===-1;return ce.substring(0,2)==="//"?fe?ce:ve.replace(f,"$1")+ce:ce.charAt(0)==="/"?fe?ce:ve.replace(d,"$1")+ce:ve+ce}var y={exec:function(){}};function m(ve){for(var ce=1,fe,J;ce<arguments.length;ce++){fe=arguments[ce];for(J in fe)Object.prototype.hasOwnProperty.call(fe,J)&&(ve[J]=fe[J])}return ve}function x(ve,ce){var fe=ve.replace(/\|/g,function(re,le,pe){for(var De=!1,ke=le;--ke>=0&&pe[ke]==="\\";)De=!De;return De?"|":" |"}),J=fe.split(/ \|/),q=0;if(J.length>ce)J.splice(ce);else for(;J.length<ce;)J.push("");for(;q<J.length;q++)J[q]=J[q].trim().replace(/\\\|/g,"|");return J}function P(ve,ce,fe){var J=ve.length;if(J===0)return"";for(var q=0;q<J;){var re=ve.charAt(J-q-1);if(re===ce&&!fe)q++;else if(re!==ce&&fe)q++;else break}return ve.substr(0,J-q)}function U(ve,ce){if(ve.indexOf(ce[1])===-1)return-1;for(var fe=ve.length,J=0,q=0;q<fe;q++)if(ve[q]==="\\")q++;else if(ve[q]===ce[0])J++;else if(ve[q]===ce[1]&&(J--,J<0))return q;return-1}function B(ve){ve&&ve.sanitize&&!ve.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var W={escape:u,unescape:s,edit:w,cleanUrl:C,resolveUrl:o,noopTest:y,merge:m,splitCells:x,rtrim:P,findClosingBracket:U,checkSanitizeDeprecation:B},O=j.defaults,M=W.rtrim,K=W.splitCells,X=W.escape,ee=W.findClosingBracket;function oe(ve,ce,fe){var J=ce.href,q=ce.title?X(ce.title):null,re=ve[1].replace(/\\([\[\]])/g,"$1");return ve[0].charAt(0)!=="!"?{type:"link",raw:fe,href:J,title:q,text:re}:{type:"image",raw:fe,href:J,title:q,text:X(re)}}function xe(ve,ce){var fe=ve.match(/^(\s+)(?:```)/);if(fe===null)return ce;var J=fe[1];return ce.split(`
|
|
`).map(function(q){var re=q.match(/^\s+/);if(re===null)return q;var le=re[0];return le.length>=J.length?q.slice(J.length):q}).join(`
|
|
`)}var me=function(){function ve(fe){this.options=fe||O}var ce=ve.prototype;return ce.space=function(J){var q=this.rules.block.newline.exec(J);if(q)return q[0].length>1?{type:"space",raw:q[0]}:{raw:`
|
|
`}},ce.code=function(J,q){var re=this.rules.block.code.exec(J);if(re){var le=q[q.length-1];if(le&&le.type==="paragraph")return{raw:re[0],text:re[0].trimRight()};var pe=re[0].replace(/^ {4}/gm,"");return{type:"code",raw:re[0],codeBlockStyle:"indented",text:this.options.pedantic?pe:M(pe,`
|
|
`)}}},ce.fences=function(J){var q=this.rules.block.fences.exec(J);if(q){var re=q[0],le=xe(re,q[3]||"");return{type:"code",raw:re,lang:q[2]?q[2].trim():q[2],text:le}}},ce.heading=function(J){var q=this.rules.block.heading.exec(J);if(q)return{type:"heading",raw:q[0],depth:q[1].length,text:q[2]}},ce.nptable=function(J){var q=this.rules.block.nptable.exec(J);if(q){var re={type:"table",header:K(q[1].replace(/^ *| *\| *$/g,"")),align:q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:q[3]?q[3].replace(/\n$/,"").split(`
|
|
`):[],raw:q[0]};if(re.header.length===re.align.length){var le=re.align.length,pe;for(pe=0;pe<le;pe++)/^ *-+: *$/.test(re.align[pe])?re.align[pe]="right":/^ *:-+: *$/.test(re.align[pe])?re.align[pe]="center":/^ *:-+ *$/.test(re.align[pe])?re.align[pe]="left":re.align[pe]=null;for(le=re.cells.length,pe=0;pe<le;pe++)re.cells[pe]=K(re.cells[pe],re.header.length);return re}}},ce.hr=function(J){var q=this.rules.block.hr.exec(J);if(q)return{type:"hr",raw:q[0]}},ce.blockquote=function(J){var q=this.rules.block.blockquote.exec(J);if(q){var re=q[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:q[0],text:re}}},ce.list=function(J){var q=this.rules.block.list.exec(J);if(q){for(var re=q[0],le=q[2],pe=le.length>1,De=le[le.length-1]===")",ke={type:"list",raw:re,ordered:pe,start:pe?+le.slice(0,-1):"",loose:!1,items:[]},Qe=q[0].match(this.rules.block.item),at=!1,rt,xt,ht,st,wt,yt,Bt,Ft=Qe.length,bt=0;bt<Ft;bt++)rt=Qe[bt],re=rt,xt=rt.length,rt=rt.replace(/^ *([*+-]|\d+[.)]) */,""),~rt.indexOf(`
|
|
`)&&(xt-=rt.length,rt=this.options.pedantic?rt.replace(/^ {1,4}/gm,""):rt.replace(new RegExp("^ {1,"+xt+"}","gm"),"")),bt!==Ft-1&&(ht=this.rules.block.bullet.exec(Qe[bt+1])[0],(pe?ht.length===1||!De&&ht[ht.length-1]===")":ht.length>1||this.options.smartLists&&ht!==le)&&(st=Qe.slice(bt+1).join(`
|
|
`),ke.raw=ke.raw.substring(0,ke.raw.length-st.length),bt=Ft-1)),wt=at||/\n\n(?!\s*$)/.test(rt),bt!==Ft-1&&(at=rt.charAt(rt.length-1)===`
|
|
`,wt||(wt=at)),wt&&(ke.loose=!0),yt=/^\[[ xX]\] /.test(rt),Bt=void 0,yt&&(Bt=rt[1]!==" ",rt=rt.replace(/^\[[ xX]\] +/,"")),ke.items.push({type:"list_item",raw:re,task:yt,checked:Bt,loose:wt,text:rt});return ke}},ce.html=function(J){var q=this.rules.block.html.exec(J);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]):X(q[0]):q[0]}},ce.def=function(J){var q=this.rules.block.def.exec(J);if(q){q[3]&&(q[3]=q[3].substring(1,q[3].length-1));var re=q[1].toLowerCase().replace(/\s+/g," ");return{tag:re,raw:q[0],href:q[2],title:q[3]}}},ce.table=function(J){var q=this.rules.block.table.exec(J);if(q){var re={type:"table",header:K(q[1].replace(/^ *| *\| *$/g,"")),align:q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:q[3]?q[3].replace(/\n$/,"").split(`
|
|
`):[]};if(re.header.length===re.align.length){re.raw=q[0];var le=re.align.length,pe;for(pe=0;pe<le;pe++)/^ *-+: *$/.test(re.align[pe])?re.align[pe]="right":/^ *:-+: *$/.test(re.align[pe])?re.align[pe]="center":/^ *:-+ *$/.test(re.align[pe])?re.align[pe]="left":re.align[pe]=null;for(le=re.cells.length,pe=0;pe<le;pe++)re.cells[pe]=K(re.cells[pe].replace(/^ *\| *| *\| *$/g,""),re.header.length);return re}}},ce.lheading=function(J){var q=this.rules.block.lheading.exec(J);if(q)return{type:"heading",raw:q[0],depth:q[2].charAt(0)==="="?1:2,text:q[1]}},ce.paragraph=function(J){var q=this.rules.block.paragraph.exec(J);if(q)return{type:"paragraph",raw:q[0],text:q[1].charAt(q[1].length-1)===`
|
|
`?q[1].slice(0,-1):q[1]}},ce.text=function(J,q){var re=this.rules.block.text.exec(J);if(re){var le=q[q.length-1];return le&&le.type==="text"?{raw:re[0],text:re[0]}:{type:"text",raw:re[0],text:re[0]}}},ce.escape=function(J){var q=this.rules.inline.escape.exec(J);if(q)return{type:"escape",raw:q[0],text:X(q[1])}},ce.tag=function(J,q,re){var le=this.rules.inline.tag.exec(J);if(le)return!q&&/^<a /i.test(le[0])?q=!0:q&&/^<\/a>/i.test(le[0])&&(q=!1),!re&&/^<(pre|code|kbd|script)(\s|>)/i.test(le[0])?re=!0:re&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(le[0])&&(re=!1),{type:this.options.sanitize?"text":"html",raw:le[0],inLink:q,inRawBlock:re,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):X(le[0]):le[0]}},ce.link=function(J){var q=this.rules.inline.link.exec(J);if(q){var re=ee(q[2],"()");if(re>-1){var le=q[0].indexOf("!")===0?5:4,pe=le+q[1].length+re;q[2]=q[2].substring(0,re),q[0]=q[0].substring(0,pe).trim(),q[3]=""}var De=q[2],ke="";if(this.options.pedantic){var Qe=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(De);Qe?(De=Qe[1],ke=Qe[3]):ke=""}else ke=q[3]?q[3].slice(1,-1):"";De=De.trim().replace(/^<([\s\S]*)>$/,"$1");var at=oe(q,{href:De&&De.replace(this.rules.inline._escapes,"$1"),title:ke&&ke.replace(this.rules.inline._escapes,"$1")},q[0]);return at}},ce.reflink=function(J,q){var re;if((re=this.rules.inline.reflink.exec(J))||(re=this.rules.inline.nolink.exec(J))){var le=(re[2]||re[1]).replace(/\s+/g," ");if(le=q[le.toLowerCase()],!le||!le.href){var pe=re[0].charAt(0);return{type:"text",raw:pe,text:pe}}var De=oe(re,le,re[0]);return De}},ce.strong=function(J,q,re){re===void 0&&(re="");var le=this.rules.inline.strong.start.exec(J);if(le&&(!le[1]||le[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){q=q.slice(-1*J.length);var pe=le[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;pe.lastIndex=0;for(var De;(le=pe.exec(q))!=null;)if(De=this.rules.inline.strong.middle.exec(q.slice(0,le.index+3)),De)return{type:"strong",raw:J.slice(0,De[0].length),text:J.slice(2,De[0].length-2)}}},ce.em=function(J,q,re){re===void 0&&(re="");var le=this.rules.inline.em.start.exec(J);if(le&&(!le[1]||le[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){q=q.slice(-1*J.length);var pe=le[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;pe.lastIndex=0;for(var De;(le=pe.exec(q))!=null;)if(De=this.rules.inline.em.middle.exec(q.slice(0,le.index+2)),De)return{type:"em",raw:J.slice(0,De[0].length),text:J.slice(1,De[0].length-1)}}},ce.codespan=function(J){var q=this.rules.inline.code.exec(J);if(q){var re=q[2].replace(/\n/g," "),le=/[^ ]/.test(re),pe=re.startsWith(" ")&&re.endsWith(" ");return le&&pe&&(re=re.substring(1,re.length-1)),re=X(re,!0),{type:"codespan",raw:q[0],text:re}}},ce.br=function(J){var q=this.rules.inline.br.exec(J);if(q)return{type:"br",raw:q[0]}},ce.del=function(J){var q=this.rules.inline.del.exec(J);if(q)return{type:"del",raw:q[0],text:q[1]}},ce.autolink=function(J,q){var re=this.rules.inline.autolink.exec(J);if(re){var le,pe;return re[2]==="@"?(le=X(this.options.mangle?q(re[1]):re[1]),pe="mailto:"+le):(le=X(re[1]),pe=le),{type:"link",raw:re[0],text:le,href:pe,tokens:[{type:"text",raw:le,text:le}]}}},ce.url=function(J,q){var re;if(re=this.rules.inline.url.exec(J)){var le,pe;if(re[2]==="@")le=X(this.options.mangle?q(re[0]):re[0]),pe="mailto:"+le;else{var De;do De=re[0],re[0]=this.rules.inline._backpedal.exec(re[0])[0];while(De!==re[0]);le=X(re[0]),re[1]==="www."?pe="http://"+le:pe=le}return{type:"link",raw:re[0],text:le,href:pe,tokens:[{type:"text",raw:le,text:le}]}}},ce.inlineText=function(J,q,re){var le=this.rules.inline.text.exec(J);if(le){var pe;return q?pe=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):X(le[0]):le[0]:pe=X(this.options.smartypants?re(le[0]):le[0]),{type:"text",raw:le[0],text:pe}}},ve}(),ge=W.noopTest,de=W.edit,se=W.merge,ne={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:ge,table:ge,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ne._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ne._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ne.def=de(ne.def).replace("label",ne._label).replace("title",ne._title).getRegex(),ne.bullet=/(?:[*+-]|\d{1,9}[.)])/,ne.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ne.item=de(ne.item,"gm").replace(/bull/g,ne.bullet).getRegex(),ne.list=de(ne.list).replace(/bull/g,ne.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ne.def.source+")").getRegex(),ne._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",ne._comment=/<!--(?!-?>)[\s\S]*?-->/,ne.html=de(ne.html,"i").replace("comment",ne._comment).replace("tag",ne._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ne.paragraph=de(ne._paragraph).replace("hr",ne.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",ne._tag).getRegex(),ne.blockquote=de(ne.blockquote).replace("paragraph",ne.paragraph).getRegex(),ne.normal=se({},ne),ne.gfm=se({},ne.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*|$)"}),ne.gfm.nptable=de(ne.gfm.nptable).replace("hr",ne.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",ne._tag).getRegex(),ne.gfm.table=de(ne.gfm.table).replace("hr",ne.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",ne._tag).getRegex(),ne.pedantic=se({},ne.normal,{html:de(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ne._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:ge,paragraph:de(ne.normal._paragraph).replace("hr",ne.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ne.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var he={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ge,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:ge,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};he._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",he.punctuation=de(he.punctuation).replace(/punctuation/g,he._punctuation).getRegex(),he._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",he._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",he.em.start=de(he.em.start).replace(/punctuation/g,he._punctuation).getRegex(),he.em.middle=de(he.em.middle).replace(/punctuation/g,he._punctuation).replace(/overlapSkip/g,he._overlapSkip).getRegex(),he.em.endAst=de(he.em.endAst,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.em.endUnd=de(he.em.endUnd,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.strong.start=de(he.strong.start).replace(/punctuation/g,he._punctuation).getRegex(),he.strong.middle=de(he.strong.middle).replace(/punctuation/g,he._punctuation).replace(/blockSkip/g,he._blockSkip).getRegex(),he.strong.endAst=de(he.strong.endAst,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.strong.endUnd=de(he.strong.endUnd,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.blockSkip=de(he._blockSkip,"g").getRegex(),he.overlapSkip=de(he._overlapSkip,"g").getRegex(),he._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,he._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,he._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])?)+(?![-_])/,he.autolink=de(he.autolink).replace("scheme",he._scheme).replace("email",he._email).getRegex(),he._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,he.tag=de(he.tag).replace("comment",ne._comment).replace("attribute",he._attribute).getRegex(),he._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,he._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,he._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,he.link=de(he.link).replace("label",he._label).replace("href",he._href).replace("title",he._title).getRegex(),he.reflink=de(he.reflink).replace("label",he._label).getRegex(),he.reflinkSearch=de(he.reflinkSearch,"g").replace("reflink",he.reflink).replace("nolink",he.nolink).getRegex(),he.normal=se({},he),he.pedantic=se({},he.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:de(/^!?\[(label)\]\((.*?)\)/).replace("label",he._label).getRegex(),reflink:de(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",he._label).getRegex()}),he.gfm=se({},he.normal,{escape:de(he.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),he.gfm.url=de(he.gfm.url,"i").replace("email",he.gfm._extended_email).getRegex(),he.breaks=se({},he.gfm,{br:de(he.br).replace("{2,}","*").getRegex(),text:de(he.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var $={block:ne,inline:he},ie=j.defaults,Z=$.block,Ee=$.inline;function Se(ve){return ve.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function ye(ve){var ce="",fe,J,q=ve.length;for(fe=0;fe<q;fe++)J=ve.charCodeAt(fe),Math.random()>.5&&(J="x"+J.toString(16)),ce+="&#"+J+";";return ce}var _e=function(){function ve(fe){this.tokens=[],this.tokens.links=Object.create(null),this.options=fe||ie,this.options.tokenizer=this.options.tokenizer||new me,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var J={block:Z.normal,inline:Ee.normal};this.options.pedantic?(J.block=Z.pedantic,J.inline=Ee.pedantic):this.options.gfm&&(J.block=Z.gfm,this.options.breaks?J.inline=Ee.breaks:J.inline=Ee.gfm),this.tokenizer.rules=J}ve.lex=function(J,q){var re=new ve(q);return re.lex(J)};var ce=ve.prototype;return ce.lex=function(J){return J=J.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(J,this.tokens,!0),this.inline(this.tokens),this.tokens},ce.blockTokens=function(J,q,re){q===void 0&&(q=[]),re===void 0&&(re=!0),J=J.replace(/^ +$/gm,"");for(var le,pe,De,ke;J;){if(le=this.tokenizer.space(J)){J=J.substring(le.raw.length),le.type&&q.push(le);continue}if(le=this.tokenizer.code(J,q)){J=J.substring(le.raw.length),le.type?q.push(le):(ke=q[q.length-1],ke.raw+=`
|
|
`+le.raw,ke.text+=`
|
|
`+le.text);continue}if(le=this.tokenizer.fences(J)){J=J.substring(le.raw.length),q.push(le);continue}if(le=this.tokenizer.heading(J)){J=J.substring(le.raw.length),q.push(le);continue}if(le=this.tokenizer.nptable(J)){J=J.substring(le.raw.length),q.push(le);continue}if(le=this.tokenizer.hr(J)){J=J.substring(le.raw.length),q.push(le);continue}if(le=this.tokenizer.blockquote(J)){J=J.substring(le.raw.length),le.tokens=this.blockTokens(le.text,[],re),q.push(le);continue}if(le=this.tokenizer.list(J)){for(J=J.substring(le.raw.length),De=le.items.length,pe=0;pe<De;pe++)le.items[pe].tokens=this.blockTokens(le.items[pe].text,[],!1);q.push(le);continue}if(le=this.tokenizer.html(J)){J=J.substring(le.raw.length),q.push(le);continue}if(re&&(le=this.tokenizer.def(J))){J=J.substring(le.raw.length),this.tokens.links[le.tag]||(this.tokens.links[le.tag]={href:le.href,title:le.title});continue}if(le=this.tokenizer.table(J)){J=J.substring(le.raw.length),q.push(le);continue}if(le=this.tokenizer.lheading(J)){J=J.substring(le.raw.length),q.push(le);continue}if(re&&(le=this.tokenizer.paragraph(J))){J=J.substring(le.raw.length),q.push(le);continue}if(le=this.tokenizer.text(J,q)){J=J.substring(le.raw.length),le.type?q.push(le):(ke=q[q.length-1],ke.raw+=`
|
|
`+le.raw,ke.text+=`
|
|
`+le.text);continue}if(J){var Qe="Infinite loop on byte: "+J.charCodeAt(0);if(this.options.silent){console.error(Qe);break}else throw new Error(Qe)}}return q},ce.inline=function(J){var q,re,le,pe,De,ke,Qe=J.length;for(q=0;q<Qe;q++){ke=J[q];switch(ke.type){case"paragraph":case"text":case"heading":{ke.tokens=[],this.inlineTokens(ke.text,ke.tokens);break}case"table":{for(ke.tokens={header:[],cells:[]},pe=ke.header.length,re=0;re<pe;re++)ke.tokens.header[re]=[],this.inlineTokens(ke.header[re],ke.tokens.header[re]);for(pe=ke.cells.length,re=0;re<pe;re++)for(De=ke.cells[re],ke.tokens.cells[re]=[],le=0;le<De.length;le++)ke.tokens.cells[re][le]=[],this.inlineTokens(De[le],ke.tokens.cells[re][le]);break}case"blockquote":{this.inline(ke.tokens);break}case"list":{for(pe=ke.items.length,re=0;re<pe;re++)this.inline(ke.items[re].tokens);break}}}return J},ce.inlineTokens=function(J,q,re,le,pe){q===void 0&&(q=[]),re===void 0&&(re=!1),le===void 0&&(le=!1),pe===void 0&&(pe="");var De,ke=J,Qe;if(this.tokens.links){var at=Object.keys(this.tokens.links);if(at.length>0)for(;(Qe=this.tokenizer.rules.inline.reflinkSearch.exec(ke))!=null;)at.includes(Qe[0].slice(Qe[0].lastIndexOf("[")+1,-1))&&(ke=ke.slice(0,Qe.index)+"["+"a".repeat(Qe[0].length-2)+"]"+ke.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Qe=this.tokenizer.rules.inline.blockSkip.exec(ke))!=null;)ke=ke.slice(0,Qe.index)+"["+"a".repeat(Qe[0].length-2)+"]"+ke.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;J;){if(De=this.tokenizer.escape(J)){J=J.substring(De.raw.length),q.push(De);continue}if(De=this.tokenizer.tag(J,re,le)){J=J.substring(De.raw.length),re=De.inLink,le=De.inRawBlock,q.push(De);continue}if(De=this.tokenizer.link(J)){J=J.substring(De.raw.length),De.type==="link"&&(De.tokens=this.inlineTokens(De.text,[],!0,le)),q.push(De);continue}if(De=this.tokenizer.reflink(J,this.tokens.links)){J=J.substring(De.raw.length),De.type==="link"&&(De.tokens=this.inlineTokens(De.text,[],!0,le)),q.push(De);continue}if(De=this.tokenizer.strong(J,ke,pe)){J=J.substring(De.raw.length),De.tokens=this.inlineTokens(De.text,[],re,le),q.push(De);continue}if(De=this.tokenizer.em(J,ke,pe)){J=J.substring(De.raw.length),De.tokens=this.inlineTokens(De.text,[],re,le),q.push(De);continue}if(De=this.tokenizer.codespan(J)){J=J.substring(De.raw.length),q.push(De);continue}if(De=this.tokenizer.br(J)){J=J.substring(De.raw.length),q.push(De);continue}if(De=this.tokenizer.del(J)){J=J.substring(De.raw.length),De.tokens=this.inlineTokens(De.text,[],re,le),q.push(De);continue}if(De=this.tokenizer.autolink(J,ye)){J=J.substring(De.raw.length),q.push(De);continue}if(!re&&(De=this.tokenizer.url(J,ye))){J=J.substring(De.raw.length),q.push(De);continue}if(De=this.tokenizer.inlineText(J,le,Se)){J=J.substring(De.raw.length),pe=De.raw.slice(-1),q.push(De);continue}if(J){var rt="Infinite loop on byte: "+J.charCodeAt(0);if(this.options.silent){console.error(rt);break}else throw new Error(rt)}}return q},G(ve,null,[{key:"rules",get:function(){return{block:Z,inline:Ee}}}]),ve}(),Le=j.defaults,Ie=W.cleanUrl,Me=W.escape,Ce=function(){function ve(fe){this.options=fe||Le}var ce=ve.prototype;return ce.code=function(J,q,re){var le=(q||"").match(/\S*/)[0];if(this.options.highlight){var pe=this.options.highlight(J,le);pe!=null&&pe!==J&&(re=!0,J=pe)}return le?'<pre><code class="'+this.options.langPrefix+Me(le,!0)+'">'+(re?J:Me(J,!0))+`</code></pre>
|
|
`:"<pre><code>"+(re?J:Me(J,!0))+`</code></pre>
|
|
`},ce.blockquote=function(J){return`<blockquote>
|
|
`+J+`</blockquote>
|
|
`},ce.html=function(J){return J},ce.heading=function(J,q,re,le){return this.options.headerIds?"<h"+q+' id="'+this.options.headerPrefix+le.slug(re)+'">'+J+"</h"+q+`>
|
|
`:"<h"+q+">"+J+"</h"+q+`>
|
|
`},ce.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ce.list=function(J,q,re){var le=q?"ol":"ul",pe=q&&re!==1?' start="'+re+'"':"";return"<"+le+pe+`>
|
|
`+J+"</"+le+`>
|
|
`},ce.listitem=function(J){return"<li>"+J+`</li>
|
|
`},ce.checkbox=function(J){return"<input "+(J?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ce.paragraph=function(J){return"<p>"+J+`</p>
|
|
`},ce.table=function(J,q){return q&&(q="<tbody>"+q+"</tbody>"),`<table>
|
|
<thead>
|
|
`+J+`</thead>
|
|
`+q+`</table>
|
|
`},ce.tablerow=function(J){return`<tr>
|
|
`+J+`</tr>
|
|
`},ce.tablecell=function(J,q){var re=q.header?"th":"td",le=q.align?"<"+re+' align="'+q.align+'">':"<"+re+">";return le+J+"</"+re+`>
|
|
`},ce.strong=function(J){return"<strong>"+J+"</strong>"},ce.em=function(J){return"<em>"+J+"</em>"},ce.codespan=function(J){return"<code>"+J+"</code>"},ce.br=function(){return this.options.xhtml?"<br/>":"<br>"},ce.del=function(J){return"<del>"+J+"</del>"},ce.link=function(J,q,re){if(J=Ie(this.options.sanitize,this.options.baseUrl,J),J===null)return re;var le='<a href="'+Me(J)+'"';return q&&(le+=' title="'+q+'"'),le+=">"+re+"</a>",le},ce.image=function(J,q,re){if(J=Ie(this.options.sanitize,this.options.baseUrl,J),J===null)return re;var le='<img src="'+J+'" alt="'+re+'"';return q&&(le+=' title="'+q+'"'),le+=this.options.xhtml?"/>":">",le},ce.text=function(J){return J},ve}(),we=function(){function ve(){}var ce=ve.prototype;return ce.strong=function(J){return J},ce.em=function(J){return J},ce.codespan=function(J){return J},ce.del=function(J){return J},ce.html=function(J){return J},ce.text=function(J){return J},ce.link=function(J,q,re){return""+re},ce.image=function(J,q,re){return""+re},ce.br=function(){return""},ve}(),Be=function(){function ve(){this.seen={}}var ce=ve.prototype;return ce.slug=function(J){var q=J.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(q)){var re=q;do this.seen[re]++,q=re+"-"+this.seen[re];while(this.seen.hasOwnProperty(q))}return this.seen[q]=0,q},ve}(),Ke=j.defaults,Ue=W.unescape,Pe=function(){function ve(fe){this.options=fe||Ke,this.options.renderer=this.options.renderer||new Ce,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new we,this.slugger=new Be}ve.parse=function(J,q){var re=new ve(q);return re.parse(J)};var ce=ve.prototype;return ce.parse=function(J,q){q===void 0&&(q=!0);var re="",le,pe,De,ke,Qe,at,rt,xt,ht,st,wt,yt,Bt,Ft,bt,wr,Rr,lr,pr=J.length;for(le=0;le<pr;le++){st=J[le];switch(st.type){case"space":continue;case"hr":{re+=this.renderer.hr();continue}case"heading":{re+=this.renderer.heading(this.parseInline(st.tokens),st.depth,Ue(this.parseInline(st.tokens,this.textRenderer)),this.slugger);continue}case"code":{re+=this.renderer.code(st.text,st.lang,st.escaped);continue}case"table":{for(xt="",rt="",ke=st.header.length,pe=0;pe<ke;pe++)rt+=this.renderer.tablecell(this.parseInline(st.tokens.header[pe]),{header:!0,align:st.align[pe]});for(xt+=this.renderer.tablerow(rt),ht="",ke=st.cells.length,pe=0;pe<ke;pe++){for(at=st.tokens.cells[pe],rt="",Qe=at.length,De=0;De<Qe;De++)rt+=this.renderer.tablecell(this.parseInline(at[De]),{header:!1,align:st.align[De]});ht+=this.renderer.tablerow(rt)}re+=this.renderer.table(xt,ht);continue}case"blockquote":{ht=this.parse(st.tokens),re+=this.renderer.blockquote(ht);continue}case"list":{for(wt=st.ordered,yt=st.start,Bt=st.loose,ke=st.items.length,ht="",pe=0;pe<ke;pe++)bt=st.items[pe],wr=bt.checked,Rr=bt.task,Ft="",bt.task&&(lr=this.renderer.checkbox(wr),Bt?bt.tokens.length>0&&bt.tokens[0].type==="text"?(bt.tokens[0].text=lr+" "+bt.tokens[0].text,bt.tokens[0].tokens&&bt.tokens[0].tokens.length>0&&bt.tokens[0].tokens[0].type==="text"&&(bt.tokens[0].tokens[0].text=lr+" "+bt.tokens[0].tokens[0].text)):bt.tokens.unshift({type:"text",text:lr}):Ft+=lr),Ft+=this.parse(bt.tokens,Bt),ht+=this.renderer.listitem(Ft,Rr,wr);re+=this.renderer.list(ht,wt,yt);continue}case"html":{re+=this.renderer.html(st.text);continue}case"paragraph":{re+=this.renderer.paragraph(this.parseInline(st.tokens));continue}case"text":{for(ht=st.tokens?this.parseInline(st.tokens):st.text;le+1<pr&&J[le+1].type==="text";)st=J[++le],ht+=`
|
|
`+(st.tokens?this.parseInline(st.tokens):st.text);re+=q?this.renderer.paragraph(ht):ht;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 re},ce.parseInline=function(J,q){q=q||this.renderer;var re="",le,pe,De=J.length;for(le=0;le<De;le++){pe=J[le];switch(pe.type){case"escape":{re+=q.text(pe.text);break}case"html":{re+=q.html(pe.text);break}case"link":{re+=q.link(pe.href,pe.title,this.parseInline(pe.tokens,q));break}case"image":{re+=q.image(pe.href,pe.title,pe.text);break}case"strong":{re+=q.strong(this.parseInline(pe.tokens,q));break}case"em":{re+=q.em(this.parseInline(pe.tokens,q));break}case"codespan":{re+=q.codespan(pe.text);break}case"br":{re+=q.br();break}case"del":{re+=q.del(this.parseInline(pe.tokens,q));break}case"text":{re+=q.text(pe.text);break}default:{var ke='Token with "'+pe.type+'" type was not found.';if(this.options.silent){console.error(ke);return}else throw new Error(ke)}}}return re},ve}(),Ve=W.merge,He=W.checkSanitizeDeprecation,Xe=W.escape,Ae=j.getDefaults,qe=j.changeDefaults,Je=j.defaults;function Oe(ve,ce,fe){if(typeof ve=="undefined"||ve===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ve!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ve)+", string expected");if(typeof ce=="function"&&(fe=ce,ce=null),ce=Ve({},Oe.defaults,ce||{}),He(ce),fe){var J=ce.highlight,q;try{q=_e.lex(ve,ce)}catch(De){return fe(De)}var re=function(ke){var Qe;if(!ke)try{Qe=Pe.parse(q,ce)}catch(at){ke=at}return ce.highlight=J,ke?fe(ke):fe(null,Qe)};if(!J||J.length<3)return re();if(delete ce.highlight,!q.length)return re();var le=0;Oe.walkTokens(q,function(De){De.type==="code"&&(le++,setTimeout(function(){J(De.text,De.lang,function(ke,Qe){if(ke)return re(ke);Qe!=null&&Qe!==De.text&&(De.text=Qe,De.escaped=!0),le--,le===0&&re()})},0))}),le===0&&re();return}try{var pe=_e.lex(ve,ce);return ce.walkTokens&&Oe.walkTokens(pe,ce.walkTokens),Pe.parse(pe,ce)}catch(De){if(De.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ce.silent)return"<p>An error occurred:</p><pre>"+Xe(De.message+"",!0)+"</pre>";throw De}}Oe.options=Oe.setOptions=function(ve){return Ve(Oe.defaults,ve),qe(Oe.defaults),Oe},Oe.getDefaults=Ae,Oe.defaults=Je,Oe.use=function(ve){var ce=Ve({},ve);if(ve.renderer&&function(){var J=Oe.defaults.renderer||new Ce,q=function(pe){var De=J[pe];J[pe]=function(){for(var ke=arguments.length,Qe=new Array(ke),at=0;at<ke;at++)Qe[at]=arguments[at];var rt=ve.renderer[pe].apply(J,Qe);return rt===!1&&(rt=De.apply(J,Qe)),rt}};for(var re in ve.renderer)q(re);ce.renderer=J}(),ve.tokenizer&&function(){var J=Oe.defaults.tokenizer||new me,q=function(pe){var De=J[pe];J[pe]=function(){for(var ke=arguments.length,Qe=new Array(ke),at=0;at<ke;at++)Qe[at]=arguments[at];var rt=ve.tokenizer[pe].apply(J,Qe);return rt===!1&&(rt=De.apply(J,Qe)),rt}};for(var re in ve.tokenizer)q(re);ce.tokenizer=J}(),ve.walkTokens){var fe=Oe.defaults.walkTokens;ce.walkTokens=function(J){ve.walkTokens(J),fe&&fe(J)}}Oe.setOptions(ce)},Oe.walkTokens=function(ve,ce){for(var fe=I(ve),J;!(J=fe()).done;){var q=J.value;ce(q);switch(q.type){case"table":{for(var re=I(q.tokens.header),le;!(le=re()).done;){var pe=le.value;Oe.walkTokens(pe,ce)}for(var De=I(q.tokens.cells),ke;!(ke=De()).done;)for(var Qe=ke.value,at=I(Qe),rt;!(rt=at()).done;){var xt=rt.value;Oe.walkTokens(xt,ce)}break}case"list":{Oe.walkTokens(q.items,ce);break}default:q.tokens&&Oe.walkTokens(q.tokens,ce)}}},Oe.Parser=Pe,Oe.parser=Pe.parse,Oe.Renderer=Ce,Oe.TextRenderer=we,Oe.Lexer=_e,Oe.lexer=_e.lex,Oe.Tokenizer=me,Oe.Slugger=Be,Oe.parse=Oe;var Ne=Oe;return Ne})},ELLl:function(et,We,Q){(function(te){te(Q("VrN/"))})(function(te){var G={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},A=te.Pos;te.defineOption("autoCloseBrackets",!1,function(E,g,u){u&&u!=te.Init&&(E.removeKeyMap(I),E.state.closeBrackets=null),g&&(R(z(g,"pairs")),E.state.closeBrackets=g,E.addKeyMap(I))});function z(E,g){return g=="pairs"&&typeof E=="string"?E:typeof E=="object"&&E[g]!=null?E[g]:G[g]}var I={Backspace:k,Enter:L};function R(E){for(var g=0;g<E.length;g++){var u=E.charAt(g),a="'"+u+"'";I[a]||(I[a]=j(u))}}R(G.pairs+"`");function j(E){return function(g){return S(g,E)}}function F(E){var g=E.state.closeBrackets;if(!g||g.override)return g;var u=E.getModeAt(E.getCursor());return u.closeBrackets||g}function k(E){var g=F(E);if(!g||E.getOption("disableInput"))return te.Pass;for(var u=z(g,"pairs"),a=E.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return te.Pass;var l=D(E,a[s].head);if(!l||u.indexOf(l)%2!=0)return te.Pass}for(var s=a.length-1;s>=0;s--){var w=a[s].head;E.replaceRange("",A(w.line,w.ch-1),A(w.line,w.ch+1),"+delete")}}function L(E){var g=F(E),u=g&&z(g,"explode");if(!u||E.getOption("disableInput"))return te.Pass;for(var a=E.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return te.Pass;var l=D(E,a[s].head);if(!l||u.indexOf(l)%2!=0)return te.Pass}E.operation(function(){var w=E.lineSeparator()||`
|
|
`;E.replaceSelection(w+w,null),E.execCommand("goCharLeft"),a=E.listSelections();for(var p=0;p<a.length;p++){var h=a[p].head.line;E.indentLine(h,null,!0),E.indentLine(h+1,null,!0)}})}function v(E){var g=te.cmpPos(E.anchor,E.head)>0;return{anchor:new A(E.anchor.line,E.anchor.ch+(g?-1:1)),head:new A(E.head.line,E.head.ch+(g?1:-1))}}function S(E,g){var u=F(E);if(!u||E.getOption("disableInput"))return te.Pass;var a=z(u,"pairs"),s=a.indexOf(g);if(s==-1)return te.Pass;for(var l=z(u,"closeBefore"),w=z(u,"triples"),p=a.charAt(s+1)==g,h=E.listSelections(),C=s%2==0,b,c=0;c<h.length;c++){var f=h[c],d=f.head,o,y=E.getRange(d,A(d.line,d.ch+1));if(C&&!f.empty())o="surround";else if((p||!C)&&y==g)p&&T(E,d)?o="both":w.indexOf(g)>=0&&E.getRange(d,A(d.line,d.ch+3))==g+g+g?o="skipThree":o="skip";else if(p&&d.ch>1&&w.indexOf(g)>=0&&E.getRange(A(d.line,d.ch-2),d)==g+g){if(d.ch>2&&/\bstring/.test(E.getTokenTypeAt(A(d.line,d.ch-2))))return te.Pass;o="addFour"}else if(p){var m=d.ch==0?" ":E.getRange(A(d.line,d.ch-1),d);if(!te.isWordChar(y)&&m!=g&&!te.isWordChar(m))o="both";else return te.Pass}else if(C&&(y.length===0||/\s/.test(y)||l.indexOf(y)>-1))o="both";else return te.Pass;if(!b)b=o;else if(b!=o)return te.Pass}var x=s%2?a.charAt(s-1):g,P=s%2?g:a.charAt(s+1);E.operation(function(){if(b=="skip")E.execCommand("goCharRight");else if(b=="skipThree")for(var U=0;U<3;U++)E.execCommand("goCharRight");else if(b=="surround"){for(var B=E.getSelections(),U=0;U<B.length;U++)B[U]=x+B[U]+P;E.replaceSelections(B,"around"),B=E.listSelections().slice();for(var U=0;U<B.length;U++)B[U]=v(B[U]);E.setSelections(B)}else b=="both"?(E.replaceSelection(x+P,null),E.triggerElectric(x+P),E.execCommand("goCharLeft")):b=="addFour"&&(E.replaceSelection(x+x+x+x,"before"),E.execCommand("goCharRight"))})}function D(E,g){var u=E.getRange(A(g.line,g.ch-1),A(g.line,g.ch+1));return u.length==2?u:null}function T(E,g){var u=E.getTokenAt(A(g.line,g.ch+1));return/\bstring/.test(u.type)&&u.start==g.ch&&(g.ch==0||!/\bstring/.test(E.getTokenTypeAt(g)))}})},Fhpe:function(et,We,Q){et.exports={flex_box_center:"flex_box_center___1W7Bl",flex_space_between:"flex_space_between___3S4Sp",flex_box_vertical_center:"flex_box_vertical_center___5mGEA",flex_box_center_end:"flex_box_center_end___1blqp",flex_box_column:"flex_box_column___4i1E0",CustomCss:"CustomCss___3thFA",CustomTipsModalCss:"CustomTipsModalCss___2aNwC",dropdownmenus:"dropdownmenus___19dGk",popupClassNames:"popupClassNames___3LOFQ",selectdown:"selectdown___1_utH"}},GfqC:function(et,We,Q){"use strict";var te=Q("cDcd"),G=Q.n(te),A=Q("TSYQ"),z=Q.n(A);function I(W,O){var M="cannot "+W.method+" "+W.action+" "+O.status+"'",K=new Error(M);return K.status=O.status,K.method=W.method,K.url=W.action,K}function R(W){var O=W.responseText||W.response;if(!O)return O;try{return JSON.parse(O)}catch(M){return O}}function j(W){var O=new XMLHttpRequest;W.onProgress&&O.upload&&(O.upload.onprogress=function(ee){ee.total>0&&(ee.percent=ee.loaded/ee.total*100),W.onProgress(ee)});var M=new FormData;W.data&&Object.keys(W.data).forEach(function(X){var ee=W.data[X];if(Array.isArray(ee)){ee.forEach(function(oe){M.append(X+"[]",oe)});return}M.append(X,W.data[X])}),W.file instanceof Blob?M.append(W.filename,W.file,W.file.name):M.append(W.filename,W.file),O.onerror=function(ee){W.onError(ee)},O.onload=function(){return O.status<200||O.status>=300?W.onError(I(W,O),R(O)):W.onSuccess(R(O),O)},O.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in O&&(O.withCredentials=!0);var K=W.headers||{};return K["X-Requested-With"]!==null&&O.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(K).forEach(function(X){K[X]!==null&&O.setRequestHeader(X,K[X])}),O.send(M),{abort:function(){O.abort()}}}var F=+new Date,k=0;function L(){return"rc-upload-"+F+"-"+ ++k}function v(W,O){return W.indexOf(O,W.length-O.length)!==-1}var S=function(W,O){if(W&&O){var M=Array.isArray(O)?O:O.split(","),K=W.name||"",X=W.type||"",ee=X.replace(/\/.*$/,"");return M.some(function(oe){var xe=oe.trim();return xe.charAt(0)==="."?v(K.toLowerCase(),xe.toLowerCase()):/\/\*$/.test(xe)?ee===xe.replace(/\/.*$/,""):X===xe})}return!0};function D(W,O){var M=W.createReader(),K=[];function X(){M.readEntries(function(ee){var oe=Array.prototype.slice.apply(ee);K=K.concat(oe);var xe=!oe.length;xe?O(K):X()})}X()}var T=function(O,M,K){var X=function ee(oe,xe){xe=xe||"",oe.isFile?oe.file(function(me){K(me)&&(oe.fullPath&&!me.webkitRelativePath&&(Object.defineProperties(me,{webkitRelativePath:{writable:!0}}),me.webkitRelativePath=oe.fullPath.replace(/^\//,""),Object.defineProperties(me,{webkitRelativePath:{writable:!1}})),M([me]))}):oe.isDirectory&&D(oe,function(me){me.forEach(function(ge){ee(ge,""+xe+oe.name+"/")})})};O.forEach(function(ee){X(ee.webkitGetAsEntry())})},E=T,g=Object.assign||function(W){for(var O=1;O<arguments.length;O++){var M=arguments[O];for(var K in M)Object.prototype.hasOwnProperty.call(M,K)&&(W[K]=M[K])}return W},u=function(){function W(O,M){var K=[],X=!0,ee=!1,oe=void 0;try{for(var xe=O[Symbol.iterator](),me;!(X=(me=xe.next()).done)&&!(K.push(me.value),M&&K.length===M);X=!0);}catch(ge){ee=!0,oe=ge}finally{try{!X&&xe.return&&xe.return()}finally{if(ee)throw oe}}return K}return function(O,M){if(Array.isArray(O))return O;if(Symbol.iterator in Object(O))return W(O,M);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function W(O,M){for(var K=0;K<M.length;K++){var X=M[K];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(O,X.key,X)}}return function(O,M,K){return M&&W(O.prototype,M),K&&W(O,K),O}}();function s(W,O,M){return O in W?Object.defineProperty(W,O,{value:M,enumerable:!0,configurable:!0,writable:!0}):W[O]=M,W}function l(W,O){var M={};for(var K in W){if(O.indexOf(K)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,K))continue;M[K]=W[K]}return M}function w(W,O){if(!(W instanceof O))throw new TypeError("Cannot call a class as a function")}function p(W,O){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return O&&(typeof O=="object"||typeof O=="function")?O:W}function h(W,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof O);W.prototype=Object.create(O&&O.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),O&&(Object.setPrototypeOf?Object.setPrototypeOf(W,O):W.__proto__=O)}var C=function(O){return Object.keys(O).reduce(function(M,K){return(K.substr(0,5)==="data-"||K.substr(0,5)==="aria-"||K==="role")&&(M[K]=O[K]),M},{})},b=function(W){h(O,W);function O(){var M,K,X,ee;w(this,O);for(var oe=arguments.length,xe=Array(oe),me=0;me<oe;me++)xe[me]=arguments[me];return ee=(K=(X=p(this,(M=O.__proto__||Object.getPrototypeOf(O)).call.apply(M,[this].concat(xe))),X),X.state={uid:L()},X.reqs={},X.onChange=function(ge){var de=ge.target.files;X.uploadFiles(de),X.reset()},X.onClick=function(ge){var de=X.fileInput;if(!de)return;var se=X.props,ne=se.children,he=se.onClick;ne&&ne.type==="button"&&(de.parentNode.focus(),de.parentNode.querySelector("button").blur()),de.click(),he&&he(ge)},X.onKeyDown=function(ge){ge.key==="Enter"&&X.onClick()},X.onFileDrop=function(ge){var de=X.props.multiple;if(ge.preventDefault(),ge.type==="dragover")return;if(X.props.directory)E(Array.prototype.slice.call(ge.dataTransfer.items),X.uploadFiles,function(ne){return S(ne,X.props.accept)});else{var se=Array.prototype.slice.call(ge.dataTransfer.files).filter(function(ne){return S(ne,X.props.accept)});de===!1&&(se=se.slice(0,1)),X.uploadFiles(se)}},X.uploadFiles=function(ge){var de=Array.prototype.slice.call(ge);de.map(function(se){return se.uid=L(),se}).forEach(function(se){X.upload(se,de)})},X.saveFileInput=function(ge){X.fileInput=ge},K),p(X,ee)}return a(O,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(K,X){var ee=this,oe=this.props;if(!oe.beforeUpload)return setTimeout(function(){return ee.post(K)},0);var xe=oe.beforeUpload(K,X);xe&&xe.then?xe.then(function(me){var ge=Object.prototype.toString.call(me);return ge==="[object File]"||ge==="[object Blob]"?ee.post(me):ee.post(K)}).catch(function(me){console.log(me)}):xe!==!1&&setTimeout(function(){return ee.post(K)},0);return}},{key:"post",value:function(K){var X=this;if(!this._isMounted)return;var ee=this.props,oe=ee.onStart,xe=ee.onProgress,me=ee.transformFile,ge=me===void 0?function(de){return de}:me;new Promise(function(de){var se=ee.action;return typeof se=="function"&&(se=se(K)),de(se)}).then(function(de){var se=K.uid,ne=ee.customRequest||j,he=Promise.resolve(ge(K)).then(function($){var ie=ee.data;return typeof ie=="function"&&(ie=ie($)),Promise.all([$,ie])}).catch(function($){console.error($)});he.then(function($){var ie=u($,2),Z=ie[0],Ee=ie[1],Se={action:de,filename:ee.name,data:Ee,file:Z,headers:ee.headers,withCredentials:ee.withCredentials,method:ee.method||"post",onProgress:xe?function(ye){xe(ye,K)}:null,onSuccess:function(_e,Le){delete X.reqs[se],ee.onSuccess(_e,K,Le)},onError:function(_e,Le){delete X.reqs[se],ee.onError(_e,Le,K)}};oe(K),X.reqs[se]=ne(Se)})})}},{key:"reset",value:function(){this.setState({uid:L()})}},{key:"abort",value:function(K){var X=this.reqs;if(K){var ee=K;K&&K.uid&&(ee=K.uid),X[ee]&&X[ee].abort&&X[ee].abort(),delete X[ee]}else Object.keys(X).forEach(function(oe){X[oe]&&X[oe].abort&&X[oe].abort(),delete X[oe]})}},{key:"render",value:function(){var K,X=this.props,ee=X.component,oe=X.prefixCls,xe=X.className,me=X.disabled,ge=X.id,de=X.style,se=X.multiple,ne=X.accept,he=X.children,$=X.directory,ie=X.openFileDialogOnClick,Z=X.onMouseEnter,Ee=X.onMouseLeave,Se=l(X,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ye=z()((K={},s(K,oe,!0),s(K,oe+"-disabled",me),s(K,xe,xe),K)),_e=me?{}:{onClick:ie?this.onClick:function(){},onKeyDown:ie?this.onKeyDown:function(){},onMouseEnter:Z,onMouseLeave:Ee,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return G.a.createElement(ee,g({},_e,{className:ye,role:"button",style:de}),G.a.createElement("input",g({},C(Se),{id:ge,type:"file",ref:this.saveFileInput,onClick:function(Ie){return Ie.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ne,directory:$?"directory":null,webkitdirectory:$?"webkitdirectory":null,multiple:se,onChange:this.onChange})),he)}}]),O}(te.Component),c=b,f=Object.assign||function(W){for(var O=1;O<arguments.length;O++){var M=arguments[O];for(var K in M)Object.prototype.hasOwnProperty.call(M,K)&&(W[K]=M[K])}return W},d=function(){function W(O,M){for(var K=0;K<M.length;K++){var X=M[K];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(O,X.key,X)}}return function(O,M,K){return M&&W(O.prototype,M),K&&W(O,K),O}}();function o(W,O){if(!(W instanceof O))throw new TypeError("Cannot call a class as a function")}function y(W,O){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return O&&(typeof O=="object"||typeof O=="function")?O:W}function m(W,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof O);W.prototype=Object.create(O&&O.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),O&&(Object.setPrototypeOf?Object.setPrototypeOf(W,O):W.__proto__=O)}function x(){}var P=function(W){m(O,W);function O(){var M,K,X,ee;o(this,O);for(var oe=arguments.length,xe=Array(oe),me=0;me<oe;me++)xe[me]=arguments[me];return ee=(K=(X=y(this,(M=O.__proto__||Object.getPrototypeOf(O)).call.apply(M,[this].concat(xe))),X),X.saveUploader=function(ge){X.uploader=ge},K),y(X,ee)}return d(O,[{key:"abort",value:function(K){this.uploader.abort(K)}},{key:"render",value:function(){return G.a.createElement(c,f({},this.props,{ref:this.saveUploader}))}}]),O}(te.Component);P.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:x,onError:x,onSuccess:x,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var U=P,B=We.a=U},Gytx:function(et,We){et.exports=function(te,G,A,z){var I=A?A.call(z,te,G):void 0;if(I!==void 0)return!!I;if(te===G)return!0;if(typeof te!="object"||!te||typeof G!="object"||!G)return!1;var R=Object.keys(te),j=Object.keys(G);if(R.length!==j.length)return!1;for(var F=Object.prototype.hasOwnProperty.bind(G),k=0;k<R.length;k++){var L=R[k];if(!F(L))return!1;var v=te[L],S=G[L];if(I=A?A.call(z,v,S,L):void 0,I===!1||I===void 0&&v!==S)return!1}return!0}},HmJG:function(et,We,Q){},IE1O:function(et,We,Q){"use strict";Q.d(We,"a",function(){return c});var te=Q("+L6B"),G=Q("2/Rp"),A=Q("2qtc"),z=Q("kLXV"),I=Q("DZo9"),R=Q("8z0m"),j=Q("5NDa"),F=Q("5rEg"),k=Q("miYZ"),L=Q("tsqr"),v=Q("9og8"),S=Q("y8nQ"),D=Q("Vl3Y"),T=Q("tJVT"),E=Q("WmNS"),g=Q.n(E),u=Q("cDcd"),a=Q.n(u),s=Q("KeLC"),l=Q.n(s),w=Q("Fhpe"),p=Q.n(w),h=Q("m3rI"),C=Q("jN4g"),b=function(d){var o,y,m,x,P=d.visible,U=d.onOk,B=d.onCancel,W=d.title,O=W===void 0?"\u9009\u62E9\u8BA4\u8BC1\u56E2\u961F\u6559\u5E08":W,M=D.a.useForm(),K=Object(T.a)(M,1),X=K[0],ee=Object(u.useState)(!1),oe=Object(T.a)(ee,2),xe=oe[0],me=oe[1],ge=Object(u.useState)([]),de=Object(T.a)(ge,2),se=de[0],ne=de[1],he=Object(u.useState)([]),$=Object(T.a)(he,2),ie=$[0],Z=$[1],Ee=Object(u.useState)(!1),Se=Object(T.a)(Ee,2),ye=Se[0],_e=Se[1];Object(u.useEffect)(function(){if(P!=null&&P.name){var Ue,Pe,Ve,He;X.setFieldsValue({name:P==null?void 0:P.name});var Xe=P!=null&&(Ue=P.cover_url)!==null&&Ue!==void 0&&Ue.includes("attachments")?[{response:{id:P==null||((Pe=P.cover_url)===null||Pe===void 0)?void 0:Pe.split("/")[3]}}]:[],Ae=P!=null&&(Ve=P.backbground_image_url)!==null&&Ve!==void 0&&Ve.includes("attachments")?[{response:{id:P==null||((He=P.backbground_image_url)===null||He===void 0)?void 0:He.split("/")[3]}}]:[];ne(Xe),Z(Ae)}},[P]);var Le=function(){X.submit()},Ie=function(){B()},Me=function(){var Ue=Object(v.a)(g.a.mark(function Pe(Ve){var He,Xe,Ae,qe,Je;return g.a.wrap(function(Ne){for(;;)switch(Ne.prev=Ne.next){case 0:me(!0),console.log(se,ie,3333),Je={name:Ve==null?void 0:Ve.name,cover_id:(se==null||((He=se[0])===null||He===void 0||((Xe=He.response)===null||Xe===void 0))?void 0:Xe.id)||"",backbground_image_id:(ie==null||((Ae=ie[0])===null||Ae===void 0||((qe=Ae.response)===null||qe===void 0))?void 0:qe.id)||""},U(Je);case 4:case"end":return Ne.stop()}},Pe)}));return function(Ve){return Ue.apply(this,arguments)}}(),Ce=function(Pe,Ve){var He=["uploading","done","removed"];He.includes(Pe.file.status)&&(Pe.file.status==="uploading"&&_e(!0),Pe.file.status==="done"&&_e(!1),Ve===1?ne(Pe.fileList):Z(Pe.fileList))},we=function(Pe,Ve){Ve===1?ne([]):Z([])},Be=function(Pe,Ve){var He=Pe.type==="image/jpeg"||Pe.type==="image/png";if(!He)return L.b.error("\u8BF7\u4E0A\u4F20jpg\u6216png\u7684\u56FE\u7247!"),!1;var Xe=Pe.size/1024/1024>2;return Xe?(L.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E2MB"),!1):(Ve===1?ne([]):Z([]),!0)},Ke=function(Pe){var Ve,He,Xe,Ae;return a.a.createElement("div",{className:l.a.img},a.a.createElement("img",{src:h.a.API_SERVER+"/api/attachments/"+(Pe===1?se==null||((Ve=se[0])===null||Ve===void 0||((He=Ve.response)===null||He===void 0))?void 0:He.id:ie==null||((Xe=ie[0])===null||Xe===void 0||((Ae=Xe.response)===null||Ae===void 0))?void 0:Ae.id),alt:"avatar",style:{width:"100%"}}),a.a.createElement("div",null,a.a.createElement(C.a,{onClick:function(){Pe===1?ne([]):Z([])},style:{fontSize:"16px",color:"red"}})))};return a.a.createElement(z.a,{title:O,visible:P,onOk:Le,centered:!0,onCancel:Ie,confirmLoading:xe,okButtonProps:{disabled:ye},width:686,afterClose:function(){me(!1),ne([]),Z([]),X.resetFields()},okText:P!=null&&P.name?"\u786E\u8BA4":"\u786E\u8BA4\u65B0\u5EFA",cancelText:"\u53D6\u6D88",wrapClassName:p.a.CustomCss},a.a.createElement(D.a,{form:X,colon:!1,onFinish:Me,className:l.a.form},a.a.createElement(D.a.Item,{label:"\u793E\u533A\u540D\u79F0",name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u793E\u533A\u540D\u79F0"},{whitespace:!0,message:"\u8BF7\u8F93\u5165\u793E\u533A\u540D\u79F0"},{max:60,message:"\u53EA\u80FD\u8F93\u516560\u4E2A\u5B57\u7B26"}]},a.a.createElement(F.a,{maxLength:60,placeholder:"\u8BF7\u8F93\u5165\u793E\u533A\u540D\u79F0"})),a.a.createElement(D.a.Item,{name:"cover_id",label:"\u4E0A\u4F20\u5C01\u9762\u56FE",valuePropName:"fileList",className:"mt30"},a.a.createElement("div",{className:l.a.upload},se!=null&&(o=se[0])!==null&&o!==void 0&&(y=o.response)!==null&&y!==void 0&&y.id?Ke(1):a.a.createElement(R.a,{fileList:se,action:"".concat(h.a.API_SERVER,"/api/attachments.json"),onChange:function(Pe){return Ce(Pe,1)},onRemove:function(Pe){return we(Pe,1)},beforeUpload:function(Pe){return Be(Pe,1)},withCredentials:!0,accept:"image/*"},a.a.createElement("div",{className:l.a.btn},a.a.createElement("i",{className:"iconfont icon-shangchuantupian2"}),"\u4E0A\u4F20\u56FE\u7247")))),a.a.createElement("aside",null,"\u4EC5\u652F\u6301\u4E0A\u4F20jpg/png\u7B49\u683C\u5F0F\u6587\u4EF6\uFF0C\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC72M,\u5EFA\u8BAE\u4F7F\u7528278*225\u50CF\u7D20\uFF1B\u5982\u4E0D\u4E0A\u4F20\uFF0C\u9ED8\u8BA4\u4F7F\u7528\u7CFB\u7EDF\u56FE\u7247\u3002"),a.a.createElement(D.a.Item,{name:"backbground_image_id",label:"\u8BE6\u60C5\u9876\u90E8\u80CC\u666F",valuePropName:"fileList",className:"mt30"},a.a.createElement("div",{className:l.a.upload},ie!=null&&(m=ie[0])!==null&&m!==void 0&&(x=m.response)!==null&&x!==void 0&&x.id?Ke(2):a.a.createElement(R.a,{fileList:ie,action:"".concat(h.a.API_SERVER,"/api/attachments.json"),onChange:function(Pe){return Ce(Pe,2)},onRemove:function(Pe){return we(Pe,2)},beforeUpload:function(Pe){return Be(Pe,2)},withCredentials:!0,accept:"image/*"},a.a.createElement("div",{className:l.a.btn},a.a.createElement("i",{className:"iconfont icon-shangchuantupian2"}),"\u4E0A\u4F20\u56FE\u7247")))),a.a.createElement("aside",null,"\u4EC5\u652F\u6301\u4E0A\u4F20jpg/png\u7B49\u683C\u5F0F\u6587\u4EF6\uFF0C\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC72M,\u5EFA\u8BAE\u4F7F\u75281920*220\u50CF\u7D20\uFF1B\u5982\u4E0D\u4E0A\u4F20\uFF0C\u9ED8\u8BA4\u4F7F\u7528\u7CFB\u7EDF\u56FE\u7247\u3002")))},c=function(d){var o,y,m,x,P=d.data,U=d.onOk,B=D.a.useForm(),W=Object(T.a)(B,1),O=W[0],M=Object(u.useState)(!1),K=Object(T.a)(M,2),X=K[0],ee=K[1],oe=Object(u.useState)([]),xe=Object(T.a)(oe,2),me=xe[0],ge=xe[1],de=Object(u.useState)([]),se=Object(T.a)(de,2),ne=se[0],he=se[1],$=Object(u.useState)(!1),ie=Object(T.a)($,2),Z=ie[0],Ee=ie[1];Object(u.useEffect)(function(){if(P!=null&&P.name){var Ce,we,Be,Ke;O.setFieldsValue({name:P==null?void 0:P.name});var Ue=P!=null&&(Ce=P.cover_url)!==null&&Ce!==void 0&&Ce.includes("attachments")?[{response:{id:P==null||((we=P.cover_url)===null||we===void 0)?void 0:we.split("/")[3]}}]:[],Pe=P!=null&&(Be=P.backbground_image_url)!==null&&Be!==void 0&&Be.includes("attachments")?[{response:{id:P==null||((Ke=P.backbground_image_url)===null||Ke===void 0)?void 0:Ke.split("/")[3]}}]:[];ge(Ue),he(Pe)}},[P]);var Se=function(){O.submit()},ye=function(){var Ce=Object(v.a)(g.a.mark(function we(Be){var Ke,Ue,Pe,Ve,He;return g.a.wrap(function(Ae){for(;;)switch(Ae.prev=Ae.next){case 0:ee(!0),He={name:Be==null?void 0:Be.name,cover_id:(me==null||((Ke=me[0])===null||Ke===void 0||((Ue=Ke.response)===null||Ue===void 0))?void 0:Ue.id)||"",backbground_image_id:(ne==null||((Pe=ne[0])===null||Pe===void 0||((Ve=Pe.response)===null||Ve===void 0))?void 0:Ve.id)||""},U(He,function(){ee(!1)});case 3:case"end":return Ae.stop()}},we)}));return function(Be){return Ce.apply(this,arguments)}}(),_e=function(we,Be){var Ke=["uploading","done","removed"];Ke.includes(we.file.status)&&(we.file.status==="uploading"&&Ee(!0),we.file.status==="done"&&Ee(!1),Be===1?ge(we.fileList):he(we.fileList))},Le=function(we,Be){Be===1?ge([]):he([])},Ie=function(we,Be){var Ke=we.type==="image/jpeg"||we.type==="image/png";if(!Ke)return L.b.error("\u8BF7\u4E0A\u4F20jpg\u6216png\u7684\u56FE\u7247!"),!1;var Ue=we.size/1024/1024>2;return Ue?(L.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E2MB"),!1):(Be===1?ge([]):he([]),!0)},Me=function(we){var Be,Ke,Ue,Pe;return a.a.createElement("div",{className:l.a.img},a.a.createElement("img",{src:h.a.API_SERVER+"/api/attachments/"+(we===1?me==null||((Be=me[0])===null||Be===void 0||((Ke=Be.response)===null||Ke===void 0))?void 0:Ke.id:ne==null||((Ue=ne[0])===null||Ue===void 0||((Pe=Ue.response)===null||Pe===void 0))?void 0:Pe.id),alt:"avatar",style:{width:"100%"}}),a.a.createElement("div",null,a.a.createElement(C.a,{onClick:function(){we===1?ge([]):he([])},style:{fontSize:"16px",color:"red"}})))};return a.a.createElement(D.a,{form:O,colon:!1,onFinish:ye,labelCol:{span:3},wrapperCol:{span:19},className:l.a.form},a.a.createElement(D.a.Item,{label:"\u793E\u533A\u540D\u79F0",name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u793E\u533A\u540D\u79F0"},{whitespace:!0,message:"\u8BF7\u8F93\u5165\u793E\u533A\u540D\u79F0"},{max:60,message:"\u53EA\u80FD\u8F93\u516560\u4E2A\u5B57\u7B26"}]},a.a.createElement(F.a,{maxLength:60,placeholder:"\u8BF7\u8F93\u5165\u793E\u533A\u540D\u79F0"})),a.a.createElement(D.a.Item,{name:"cover_id",label:"\u5C01\u9762\u56FE",valuePropName:"fileList"},a.a.createElement("div",{className:l.a.upload},me!=null&&(o=me[0])!==null&&o!==void 0&&(y=o.response)!==null&&y!==void 0&&y.id?Me(1):a.a.createElement(R.a,{fileList:me,action:"".concat(h.a.API_SERVER,"/api/attachments.json"),onChange:function(we){return _e(we,1)},onRemove:function(we){return Le(we,1)},beforeUpload:function(we){return Ie(we,1)},withCredentials:!0,accept:"image/*"},a.a.createElement(G.a,null,a.a.createElement("i",{className:"iconfont icon-shangchuantupian2 mr10"}),"\u4E0A\u4F20\u56FE\u7247")),a.a.createElement("aside",null,"\u4EC5\u652F\u6301\u4E0A\u4F20jpg/png\u7B49\u683C\u5F0F\u6587\u4EF6\uFF0C\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC72M,\u5EFA\u8BAE\u4F7F\u7528278*225\u50CF\u7D20\uFF1B\u5982\u4E0D\u4E0A\u4F20\uFF0C\u9ED8\u8BA4\u4F7F\u7528\u7CFB\u7EDF\u56FE\u7247\u3002"))),a.a.createElement(D.a.Item,{name:"backbground_image_id",label:"\u8BE6\u60C5\u9876\u90E8\u80CC\u666F",valuePropName:"fileList"},a.a.createElement("div",{className:l.a.upload},ne!=null&&(m=ne[0])!==null&&m!==void 0&&(x=m.response)!==null&&x!==void 0&&x.id?Me(2):a.a.createElement(R.a,{fileList:ne,action:"".concat(h.a.API_SERVER,"/api/attachments.json"),onChange:function(we){return _e(we,2)},onRemove:function(we){return Le(we,2)},beforeUpload:function(we){return Ie(we,2)},withCredentials:!0,accept:"image/*"},a.a.createElement(G.a,null,a.a.createElement("i",{className:"iconfont icon-shangchuantupian2 mr10"}),"\u4E0A\u4F20\u56FE\u7247")),a.a.createElement("aside",null,"\u4EC5\u652F\u6301\u4E0A\u4F20jpg/png\u7B49\u683C\u5F0F\u6587\u4EF6\uFF0C\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC72M,\u5EFA\u8BAE\u4F7F\u75281920*220\u50CF\u7D20\uFF1B\u5982\u4E0D\u4E0A\u4F20\uFF0C\u9ED8\u8BA4\u4F7F\u7528\u7CFB\u7EDF\u56FE\u7247\u3002"))),a.a.createElement(G.a,{disabled:Z,loading:X,type:"primary",onClick:Se,style:{marginLeft:120}},"\u786E\u8BA4"))};We.b=b},KeLC:function(et,We,Q){et.exports={flex_box_center:"flex_box_center___WC8D3",flex_space_between:"flex_space_between___1oJuS",flex_box_vertical_center:"flex_box_vertical_center___wHVAB",flex_box_center_end:"flex_box_center_end___2rX0l",flex_box_column:"flex_box_column___Iu_rf",form:"form___RRVwq",btn:"btn___144Et",img:"img___qC8f0"}},LdHM:function(et,We,Q){"use strict";Q.d(We,"b",function(){return l}),Q.d(We,"a",function(){return p});var te=Q("1OyB"),G=Q("vuIU"),A=Q("Ji7U"),z=Q("LK+K"),I=Q("cDcd"),R=Q("rePB"),j=Q("Ff2n"),F=Q("ODXe"),k=Q("4IlW"),L=Q("bX4T"),v=Q("YrtM"),S=Q("TSYQ"),D=Q.n(S),T=Q("+nKL"),E=Q("8OUc"),g=function(K,X){var ee=K.prefixCls,oe=K.id,xe=K.flattenOptions,me=K.childrenAsData,ge=K.values,de=K.searchValue,se=K.multiple,ne=K.defaultActiveFirstOption,he=K.height,$=K.itemHeight,ie=K.notFoundContent,Z=K.open,Ee=K.menuItemSelectedIcon,Se=K.virtual,ye=K.onSelect,_e=K.onToggleOpen,Le=K.onActiveValue,Ie=K.onScroll,Me=K.onMouseEnter,Ce="".concat(ee,"-item"),we=Object(v.a)(function(){return xe},[Z,xe],function(Ne,ve){return ve[0]&&Ne[1]!==ve[1]}),Be=I.useRef(null),Ke=function(ve){ve.preventDefault()},Ue=function(ve){Be.current&&Be.current.scrollTo({index:ve})},Pe=function(ve){for(var ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,fe=we.length,J=0;J<fe;J+=1){var q=(ve+J*ce+fe)%fe,re=we[q],le=re.group,pe=re.data;if(!le&&!pe.disabled)return q}return-1},Ve=I.useState(function(){return Pe(0)}),He=Object(F.a)(Ve,2),Xe=He[0],Ae=He[1],qe=function(ve){Ae(ve);var ce=we[ve];if(!ce){Le(null,-1);return}Le(ce.data.value,ve)};I.useEffect(function(){qe(ne!==!1?Pe(0):-1)},[we.length,de]),I.useEffect(function(){var Ne=setTimeout(function(){if(!se&&Z&&ge.size===1){var ve=Array.from(ge)[0],ce=we.findIndex(function(fe){var J=fe.data;return J.value===ve});qe(ce),Ue(ce)}});return function(){return clearTimeout(Ne)}},[Z]);var Je=function(ve){ve!==void 0&&ye(ve,{selected:!ge.has(ve)}),se||_e(!1)};if(I.useImperativeHandle(X,function(){return{onKeyDown:function(ve){var ce=ve.which;switch(ce){case k.a.UP:case k.a.DOWN:{var fe=0;if(ce===k.a.UP?fe=-1:ce===k.a.DOWN&&(fe=1),fe!==0){var J=Pe(Xe+fe,fe);Ue(J),qe(J)}break}case k.a.ENTER:{var q=we[Xe];q&&!q.data.disabled?Je(q.data.value):Je(void 0),Z&&ve.preventDefault();break}case k.a.ESC:_e(!1)}},onKeyUp:function(){},scrollTo:function(ve){Ue(ve)}}}),we.length===0)return I.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),className:"".concat(Ce,"-empty"),onMouseDown:Ke},ie);function Oe(Ne){var ve=we[Ne];if(!ve)return null;var ce=ve.data||{},fe=ce.value,J=ce.label,q=ce.children,re=Object(L.a)(ce,!0),le=me?q:J;return ve?I.createElement("div",Object.assign({"aria-label":typeof le=="string"?le:null},re,{key:Ne,role:"option",id:"".concat(oe,"_list_").concat(Ne),"aria-selected":ge.has(fe)}),fe):null}return I.createElement(I.Fragment,null,I.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),style:{height:0,width:0,overflow:"hidden"}},Oe(Xe-1),Oe(Xe),Oe(Xe+1)),I.createElement(T.a,{itemKey:"key",ref:Be,data:we,height:he,itemHeight:$,fullHeight:!1,onMouseDown:Ke,onScroll:Ie,virtual:Se,onMouseEnter:Me},function(Ne,ve){var ce,fe=Ne.group,J=Ne.groupOption,q=Ne.data,re=q.label,le=q.key;if(fe)return I.createElement("div",{className:D()(Ce,"".concat(Ce,"-group"))},re!==void 0?re:le);var pe=q.disabled,De=q.value,ke=q.title,Qe=q.children,at=q.style,rt=q.className,xt=Object(j.a)(q,["disabled","value","title","children","style","className"]),ht=ge.has(De),st="".concat(Ce,"-option"),wt=D()(Ce,st,rt,(ce={},Object(R.a)(ce,"".concat(st,"-grouped"),J),Object(R.a)(ce,"".concat(st,"-active"),Xe===ve&&!pe),Object(R.a)(ce,"".concat(st,"-disabled"),pe),Object(R.a)(ce,"".concat(st,"-selected"),ht),ce)),yt=me?Qe:re,Bt=!Ee||typeof Ee=="function"||ht;return I.createElement("div",Object.assign({},xt,{"aria-selected":ht,className:wt,title:ke,onMouseMove:function(){if(Xe===ve||pe)return;qe(ve)},onClick:function(){pe||Je(De)},style:at}),I.createElement("div",{className:"".concat(st,"-content")},yt||De),I.isValidElement(Ee)||ht,Bt&&I.createElement(E.a,{className:"".concat(Ce,"-option-state"),customizeIcon:Ee,customizeIconProps:{isSelected:ht}},ht?"\u2713":null))}))},u=I.forwardRef(g);u.displayName="OptionList";var a=u,s=function(){return null};s.isSelectOption=!0;var l=s,w=function(){return null};w.isSelectOptGroup=!0;var p=w,h=Q("VTBJ"),C=Q("Zm9Q");function b(M){var K=M.key,X=M.props,ee=X.children,oe=X.value,xe=Object(j.a)(X,["children","value"]);return Object(h.a)({key:K,value:oe!==void 0?oe:K,children:ee},xe)}function c(M){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(C.a)(M).map(function(X,ee){if(!I.isValidElement(X)||!X.type)return null;var oe=X.type.isSelectOptGroup,xe=X.key,me=X.props,ge=me.children,de=Object(j.a)(me,["children"]);return K||!oe?b(X):Object(h.a)(Object(h.a)({key:"__RC_SELECT_GRP__".concat(xe===null?ee:xe,"__"),label:xe},de),{},{options:c(ge)})}).filter(function(X){return X})}var f=Q("2Qr1"),d=Q("qNPg"),o=Q("U8pU"),y=Q("Kwbf"),m=Q("WKfj");function x(M){var K=M.mode,X=M.options,ee=M.children,oe=M.backfill,xe=M.allowClear,me=M.placeholder,ge=M.getInputElement,de=M.showSearch,se=M.onSearch,ne=M.defaultOpen,he=M.autoFocus,$=M.labelInValue,ie=M.value,Z=M.inputValue,Ee=M.optionLabelProp,Se=K==="multiple"||K==="tags",ye=de!==void 0?de:Se||K==="combobox",_e=X||c(ee);if(Object(y.a)(K!=="tags"||_e.every(function(Ce){return!Ce.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),K==="tags"||K==="combobox"){var Le=_e.some(function(Ce){return Ce.options?Ce.options.some(function(we){return typeof("value"in we?we.value:we.key)=="number"}):typeof("value"in Ce?Ce.value:Ce.key)=="number"});Object(y.a)(!Le,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(y.a)(K!=="combobox"||!Ee,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(y.a)(K==="combobox"||!oe,"`backfill` only works with `combobox` mode."),Object(y.a)(K==="combobox"||!ge,"`getInputElement` only work with `combobox` mode."),Object(y.b)(K!=="combobox"||!ge||!xe||!me,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),se&&!ye&&K!=="combobox"&&K!=="tags"&&Object(y.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(y.b)(!ne||he,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ie!=null){var Ie=Object(m.d)(ie);Object(y.a)(!$||Ie.every(function(Ce){return Object(o.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(y.a)(!Se||Array.isArray(ie),"`value` should be array when `mode` is `multiple` or `tags`")}if(ee){var Me=null;Object(C.a)(ee).some(function(Ce){if(!I.isValidElement(Ce)||!Ce.type)return!1;var we=Ce.type;if(we.isSelectOption)return!1;if(we.isSelectOptGroup){var Be=Object(C.a)(Ce.props.children).every(function(Ke){return!I.isValidElement(Ke)||!Ce.type||Ke.type.isSelectOption?!0:(Me=Ke.type,!1)});return!Be}return Me=we,!0}),Me&&Object(y.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Me.displayName||Me.name||Me,"`.")),Object(y.a)(Z===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var P=x,U=Object(d.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:c,flattenOptions:f.d,getLabeledValue:f.e,filterOptions:f.b,isValueDisabled:f.g,findValueOption:f.c,warningProps:P,fillOptionsWithMissingValue:f.a}),B=function(M){Object(A.a)(X,M);var K=Object(z.a)(X);function X(){var ee;return Object(te.a)(this,X),ee=K.apply(this,arguments),ee.selectRef=I.createRef(),ee.focus=function(){ee.selectRef.current.focus()},ee.blur=function(){ee.selectRef.current.blur()},ee}return Object(G.a)(X,[{key:"render",value:function(){return I.createElement(U,Object.assign({ref:this.selectRef},this.props))}}]),X}(I.Component);B.Option=l,B.OptGroup=p;var W=B,O=We.c=W},M8RZ:function(et,We,Q){"use strict";Q.d(We,"a",function(){return k});var te=Q("fWQN"),G=Q("mtLc"),A=Q("yKVA"),z=Q("879j"),I=Q("cDcd"),R=Q.n(I),j=Q("faye"),F=Q.n(j),k=function(L){Object(A.a)(S,L);var v=Object(z.a)(S);function S(D){var T;Object(te.a)(this,S),T=v.call(this,D);var E=window.document;return T.node=E.createElement("div"),E.body.appendChild(T.node),T}return Object(G.a)(S,[{key:"render",value:function(){var T=this.props.children;return Object(j.createPortal)(T,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),S}(R.a.Component)},NLgs:function(et,We,Q){"use strict";Q.d(We,"e",function(){return l}),Q.d(We,"f",function(){return w}),Q.d(We,"d",function(){return h}),Q.d(We,"c",function(){return C}),Q.d(We,"a",function(){return b}),Q.d(We,"b",function(){return c});var te=Q("miYZ"),G=Q("tsqr"),A=Q("9og8"),z=Q("2qtc"),I=Q("kLXV"),R=Q("WmNS"),j=Q.n(R),F=Q("cDcd"),k=Q.n(F),L=Q("9kvl"),v=Q("xKgJ"),S=Q("1vsH"),D=Q("RCxd"),T=Q("mOS8"),E=Q.n(T),g=Q("1ZF9"),u=Q.n(g),a=Q("NoGO"),s=Q.n(a),l=function(d){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!!(w(d)&&p(o))},w=function(d){return Object(v.p)()?!0:(d({type:"user/showPopLogin",payload:{showPopLogin:!0,showClosable:!0}}),!1)},p=function(){var d,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,y=Object(L.c)()._store.getState(),m=y.user;return(d=m.userInfo)!==null&&d!==void 0&&d.profile_completed?!0:(I.a.confirm({title:"\u63D0\u793A",width:530,centered:!0,content:o?"\u6309\u7167\u6709\u5173\u653F\u7B56\u89C4\u5B9A\uFF0C\u7279\u6B8A\u5B9E\u9A8C\u9700\u8981\u5148\u7ED1\u5B9A\u624B\u673A\u53F7\u624D\u80FD\u4F7F\u7528\uFF0C\u8BF7\u5148\u7ED1\u5B9A\u624B\u673A\u53F7\u7801":"\u60A8\u9700\u8981\u53BB\u5B8C\u5584\u60A8\u7684\u4E2A\u4EBA\u8D44\u6599\uFF0C\u624D\u80FD\u4F7F\u7528\u6B64\u529F\u80FD",okText:"\u7ACB\u5373\u5B8C\u5584",cancelText:"\u7A0D\u540E\u5B8C\u5584",onOk:function(){L.d.push("/account/profile/edit")}}),!1)},h=function(){var d,o=Object(L.c)()._store.getState(),y=o.user;return(d=y.userInfo)!==null&&d!==void 0&&d.professional_certification?!0:(I.a.confirm({title:"\u63D0\u793A",centered:!0,content:k.a.createElement("div",{className:"tc"},"\u60A8\u9700\u8981\u53BB\u5B8C\u6210\u60A8\u7684\u804C\u4E1A\u8BA4\u8BC1\uFF0C\u624D\u80FD\u4F7F\u7528\u6B64\u529F\u80FD"),okText:"\u7ACB\u5373\u5B8C\u5584",cancelText:"\u7A0D\u540E\u5B8C\u5584",onOk:function(){Object(S.U)("/account/certification")}}),!1)},C=function(){return Object(v.a)()?!0:(I.a.warning({centered:!0,width:530,title:"\u63D0\u793A",content:k.a.createElement("div",{className:"tc",style:{marginLeft:-38}},k.a.createElement("p",null,"\u626B\u7801\u52A0\u5934\u6B4C\u52A9\u6559\uFF0C\u7533\u8BF7\u64CD\u4F5C\u6743\u9650"),k.a.createElement("img",{src:s.a,width:200})),okText:"\u6211\u77E5\u9053\u4E86",maskClosable:!0}),!1)},b=function(d,o){return d?!0:(I.a.confirm({centered:!0,zIndex:1e4,width:530,title:"\u63D0\u793A",content:k.a.createElement("div",null,k.a.createElement("p",null,o||"\u8BE5\u5B9E\u8DF5\u8D44\u6E90\u9700\u6388\u6743\u540E\u624D\u53EF\u4F7F\u7528\u3002 \u60A8\u53EF\u4EE5\u5728QQ\u670D\u52A1\u7FA4\u5411\u7BA1\u7406\u5458\u7533\u8BF7\uFF0C\u83B7\u5F97\u7EE7\u7EED\u64CD\u4F5C\u7684\u6743\u9650\u3002"),k.a.createElement("div",{style:{marginLeft:"110px"}},k.a.createElement("img",{src:u.a,width:200}),k.a.createElement("div",{style:{marginLeft:"35px"}},"\u7FA4\u53F7\uFF1A","714336072"))),okText:"\u7ACB\u5373\u8054\u7CFB",cancelText:"\u53D6\u6D88",onOk:function(){Object(S.U)("https://qm.qq.com/cgi-bin/qm/qr?k=tIyDPXUtE0yEk-MOJxhH55lTUJS-nYAM&jump_from=webapi")}}),!1)},c=function(d){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",y=Object(L.c)()._store.getState(),m=y.shixunsDetail.detail;return(m==null?void 0:m.public)===2||(m==null?void 0:m.public)===1||(m==null?void 0:m.shixun_status)===3?(I.a.info({centered:!0,icon:k.a.createElement(D.a,{style:{color:"#faad14"}}),width:460,title:"\u63D0\u793A",content:k.a.createElement("div",{className:"tc",style:{marginLeft:-38}},k.a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",paddingLeft:38,margin:"12px 0"}},k.a.createElement("span",null,"\u8BE5\u5B9E\u8DF5\u9879\u76EE\u7684\u72B6\u6001\u4E3A",(m==null?void 0:m.public)===2?"\u5DF2\u516C\u5F00":(m==null?void 0:m.public)===1?"\u5F85\u5BA1\u6838":"\u5DF2\u5173\u95ED","\uFF0C",o,"\u3002"),k.a.createElement("p",null,"\u5982\u6709\u9700\u8981\uFF0C\u8BF7\u8054\u7CFB\u5E73\u53F0\u7BA1\u7406\u5458\u8FDB\u884C\u6280\u672F\u652F\u6301\u3002")),k.a.createElement("img",{style:{border:"4px solid #0152d9",borderRadius:"4px"},src:E.a,alt:"\u4E8C\u7EF4\u7801",width:160})),okText:"\u6211\u77E5\u9053\u4E86"}),!0):(m==null?void 0:m.shixun_status)===2?(I.a.confirm({centered:!0,icon:k.a.createElement(D.a,null),title:"\u63D0\u793A",content:k.a.createElement("div",null,k.a.createElement("span",null,"\u8BE5\u5B9E\u8DF5\u9879\u76EE\u5DF2\u53D1\u5E03\uFF0C",o,"\u3002"),k.a.createElement("br",null),k.a.createElement("span",null,"\u5982\u6709\u9700\u8981\uFF0C\u60A8\u53EF\u4EE5\u64A4\u9500\u53D1\u5E03\u540E\uFF0C\u518D\u8FDB\u884C\u64CD\u4F5C\u3002")),okText:"\u64A4\u9500\u53D1\u5E03",cancelText:"\u53D6\u6D88",onOk:function(){I.a.confirm({width:440,centered:!0,icon:k.a.createElement(D.a,{style:{color:"#faad14"}}),title:"\u63D0\u793A",content:"\u64A4\u9500\u53D1\u5E03\u540E\uFF0C\u5B66\u5458\u5C06\u65E0\u6CD5\u8FDB\u884C\u7EC3\u4E60\u3002\u662F\u5426\u786E\u8BA4\u64A4\u9500\u53D1\u5E03\uFF1F",okText:"\u786E\u5B9A\u64A4\u9500\u53D1\u5E03",cancelText:"\u53D6\u6D88",onOk:function(){var P=Object(A.a)(j.a.mark(function B(){var W;return j.a.wrap(function(M){for(;;)switch(M.prev=M.next){case 0:return M.next=2,d({type:"shixunsDetail/cancelRelease",payload:{id:m==null?void 0:m.identifier}});case 2:W=M.sent,W.status!==401&&(G.b.success("\u64A4\u9500\u53D1\u5E03\u6210\u529F\u3002\u5B9E\u8BAD\u56DE\u5230\u672A\u53D1\u5E03\u7684\u72B6\u6001\u3002"),d({type:"shixunsDetail/getShixunsDetail",payload:{id:m==null?void 0:m.identifier}}),d({type:"practiceSetting/getCommonData",payload:{id:m==null?void 0:m.identifier}}));case 4:case"end":return M.stop()}},B)}));function U(){return P.apply(this,arguments)}return U}()})}}),!0):!1}},NoGO:function(et,We,Q){et.exports=Q.p+"static/newqrcode.9bae6615.png"},OLES:function(et,We,Q){"use strict";var te=Q("U8pU"),G=Q("VTBJ"),A=Q("Ff2n"),z=Q("cDcd"),I=Q("uciX"),R=Q("7ixt"),j=function(D){var T=D.overlay,E=D.prefixCls,g=D.id,u=D.overlayInnerStyle;return z.createElement("div",{className:"".concat(E,"-inner"),id:g,role:"tooltip",style:u},typeof T=="function"?T():T)},F=j,k=function(D,T){var E=D.overlayClassName,g=D.trigger,u=g===void 0?["hover"]:g,a=D.mouseEnterDelay,s=a===void 0?0:a,l=D.mouseLeaveDelay,w=l===void 0?.1:l,p=D.overlayStyle,h=D.prefixCls,C=h===void 0?"rc-tooltip":h,b=D.children,c=D.onVisibleChange,f=D.afterVisibleChange,d=D.transitionName,o=D.animation,y=D.placement,m=y===void 0?"right":y,x=D.align,P=x===void 0?{}:x,U=D.destroyTooltipOnHide,B=U===void 0?!1:U,W=D.defaultVisible,O=D.getTooltipContainer,M=D.overlayInnerStyle,K=Object(A.a)(D,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),X=Object(z.useRef)(null);Object(z.useImperativeHandle)(T,function(){return X.current});var ee=Object(G.a)({},K);"visible"in D&&(ee.popupVisible=D.visible);var oe=function(){var se=D.arrowContent,ne=se===void 0?null:se,he=D.overlay,$=D.id;return[z.createElement("div",{className:"".concat(C,"-arrow"),key:"arrow"},ne),z.createElement(F,{key:"content",prefixCls:C,id:$,overlay:he,overlayInnerStyle:M})]},xe=!1,me=!1;if(typeof B=="boolean")xe=B;else if(B&&Object(te.a)(B)==="object"){var ge=B.keepParent;xe=ge===!0,me=ge===!1}return z.createElement(I.a,Object.assign({popupClassName:E,prefixCls:C,popup:oe,action:u,builtinPlacements:R.a,popupPlacement:m,ref:X,popupAlign:P,getPopupContainer:O,onPopupVisibleChange:c,afterPopupVisibleChange:f,popupTransitionName:d,popupAnimation:o,defaultPopupVisible:W,destroyPopupOnHide:xe,autoDestroy:me,mouseLeaveDelay:w,popupStyle:p,mouseEnterDelay:s},ee),b)},L=Object(z.forwardRef)(k),v=We.a=L},Ot1p:function(et,We,Q){"use strict";var te=Q("2qtc"),G=Q("kLXV"),A=Q("rAM+"),z=Q("miYZ"),I=Q("tsqr"),R=Q("9og8"),j=Q("tJVT"),F=Q("jrin"),k=Q("WmNS"),L=Q.n(k),v=Q("cDcd"),S=Q.n(v),D=Q("VrN/"),T=Q.n(D),E=Q("bdgK"),g=Q("p77/"),u=Q("Bd2K"),a=Q("ELLl"),s=Q("19Vz"),l=Q("lZu9"),w=Q("+NIl"),p=Q("kSUc"),h=Q("9Bee"),C=function(pe){var De=pe.value,ke=De===void 0?"":De,Qe=pe.className,at=pe.showTextOnly,rt=pe.showLines,xt=pe.style,ht=xt===void 0?{}:xt,st=Object(v.useMemo)(function(){return""},[ke]);return S.a.createElement(S.a.Fragment,null,S.a.createElement("div",{dangerouslySetInnerHTML:{__html:st}}))},b=Q("0Owb"),c=Q("dejd"),f=Q("C+DQ"),d=Q("1vsH"),o=Q("m3rI"),y=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function m(pe){var De=pe.onActionCallback,ke=pe.title,Qe=pe.icon,at=pe.actionName,rt=pe.className,xt=rt===void 0?"":rt,ht=pe.children;function st(){De(at)}return S.a.createElement("a",{title:ke,className:xt,onClick:st},S.a.createElement("i",{className:"md-iconfont ".concat(Qe)}),ht)}var x=function(pe){var De=pe.watch,ke=pe.showNullButton,Qe=pe.onActionCallback,at=pe.fullScreen,rt=pe.insertTemp,xt=pe.hidetoolBar,ht=pe.uuid,st=pe.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(d.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(d.G)("_educoder_session"),"&key=").concat(ht,"&api=").concat(encodeURIComponent(o.a.PROXY_SERVER)));var wt=[].concat(y,[{title:"".concat(De?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(De?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return S.a.createElement("ul",{className:"markdown-toolbar-container"},!xt&&wt.map(function(yt,Bt){return S.a.createElement("li",{key:Bt},yt.actionName?S.a.createElement(m,Object(b.a)({},yt,{onActionCallback:Qe})):S.a.createElement("span",{className:"v-line"}))}),ke?S.a.createElement("li",null,S.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Qe},S.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,rt&&S.a.createElement("li",null,S.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(rt),onActionCallback:Qe},S.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),S.a.createElement("li",{className:"btn-full-screen"},S.a.createElement(m,{icon:"".concat(at?"icon-shrink":"icon-enlarge"),title:at?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Qe})))},P=Q("M8RZ"),U=Q("+L6B"),B=Q("2/Rp"),W=Q("y8nQ"),O=Q("Vl3Y"),M=Q("5NDa"),K=Q("5rEg"),X={labelCol:{span:4},wrapperCol:{span:20}},ee=function(pe){var De=pe.callback,ke=pe.onCancel;function Qe(at){De(at)}return S.a.createElement(O.a,Object(b.a)({},X,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Qe}),S.a.createElement(O.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},S.a.createElement(K.a,null)),S.a.createElement(O.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},S.a.createElement(K.a,null)),S.a.createElement("div",{className:"flex-container flex-end"},S.a.createElement(B.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement(B.a,{type:"ghost",onClick:ke},"\u53D6\u6D88")))},oe=Q("7ahc"),xe=Q("HmJG"),me=Q("BjJ7"),ge=O.a.useForm,de={width:280,marginRight:10},se={labelCol:{span:5},wrapperCol:{span:19}},ne=function(pe){var De=pe.callback,ke=pe.onCancel,Qe=ge(),at=Object(j.a)(Qe,1),rt=at[0];function xt(wt){De(wt)}function ht(wt,yt){if(wt.status===-1){I.b.error(wt.message);return}rt.setFieldsValue({src:"/api/attachments/".concat(wt.id),type:yt.type})}function st(wt){var yt=wt.target.files[0];$(yt,ht)}return S.a.createElement(O.a,Object(b.a)({form:rt},se,{className:"upload-image-panel",onFinish:xt}),S.a.createElement(O.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},S.a.createElement("div",{className:"flex-container"},S.a.createElement(O.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},S.a.createElement(K.a,{style:de})),S.a.createElement(he,{onFileChange:st}))),S.a.createElement(O.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},S.a.createElement(K.a,{style:{width:264}})),S.a.createElement(O.a.Item,{style:{textAlign:"right"}},S.a.createElement(B.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement(B.a,{type:"ghost",onClick:ke},"\u53D6\u6D88")))};function he(pe){var De=pe.onFileChange;return S.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",S.a.createElement("input",{type:"file",onChange:De}))}function $(pe,De){if(!pe)throw new String("\u6CA1\u6709\u6587\u4EF6");var ke=new FormData;ke.append("editormd-image-file",pe),ke.append("file_param_name","editormd-image-file"),ke.append("byxhr","true");var Qe=new window.XMLHttpRequest;Qe.withCredentials=!0,Qe.addEventListener("load",function(at){De(JSON.parse(at.target.responseText),pe)},!1),Qe.addEventListener("error",function(at){console.error(at)},!1),Qe.open("POST","".concat(me.a,"/api/attachments.json")),Qe.send(ke)}var ie=Q("giR+"),Z=Q("fyUT"),Ee=Q("7Kak"),Se=Q("9yH6"),ye=Se.a.Group,_e={margin:"0 8px"},Le=function(pe){var De=pe.callback,ke=pe.onCancel;function Qe(at){De(at)}return S.a.createElement(O.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Qe},S.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},S.a.createElement("span",{style:_e},"\u5355\u5143\u683C\u6570\uFF1A"),S.a.createElement("span",{style:_e},"\u884C\u6570"),S.a.createElement(O.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},S.a.createElement(Z.a,null)),S.a.createElement("span",{style:_e},"\u5217\u6570"),S.a.createElement(O.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},S.a.createElement(Z.a,null))),S.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},S.a.createElement("span",{style:_e},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),S.a.createElement(O.a.Item,{name:"align"},S.a.createElement(ye,null,S.a.createElement(Se.a,{value:"default"},S.a.createElement("i",{className:"fa fa-align-justify"})),S.a.createElement(Se.a,{value:"left"},S.a.createElement("i",{className:"fa fa-align-left"})),S.a.createElement(Se.a,{value:"center"},S.a.createElement("i",{className:"fa fa-align-center"})),S.a.createElement(Se.a,{value:"right"},S.a.createElement("i",{className:"fa fa-align-right"}))))),S.a.createElement("div",{className:"flex-container flex-end"},S.a.createElement(B.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement(B.a,{type:"ghost",onClick:ke},"\u53D6\u6D88")))},Ie=Q("ErOA"),Me=Q("7Cbv"),Ce="link",we="upload-image",Be="code-block",Ke="add-table",Ue="------------",Pe={default:Ue,left:":".concat(Ue),center:":".concat(Ue,":"),right:"".concat(Ue,":")},Ve=Q("9VGf"),He,Xe;function Ae(){}var qe=0,Je=1e4,Oe="\u2581",Ne=`
|
|
**\u6A21\u677F\u6807\u9898**
|
|
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function ve(pe){return/^\d+$/.test(pe)?"".concat(pe,"px"):pe}var ce=navigator.platform.toUpperCase().indexOf("MAC")>=0,fe=ce?"Cmd":"Ctrl",J=["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=(He={},Object(F.a)(He,fe+"-B","bold"),Object(F.a)(He,fe+"-I","italic"),He),re=(Xe={},Object(F.a)(Xe,Ce,"\u6DFB\u52A0\u94FE\u63A5"),Object(F.a)(Xe,Be,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(F.a)(Xe,we,"\u6DFB\u52A0\u6587\u4EF6"),Object(F.a)(Xe,Ke,"\u6DFB\u52A0\u8868\u683C"),Xe),le=We.a=function(pe){var De=pe.defaultValue,ke=De===void 0?"":De,Qe=pe.onChange,at=pe.width,rt=at===void 0?"100%":at,xt=pe.height,ht=xt===void 0?400:xt,st=pe.miniToolbar,wt=st===void 0?!1:st,yt=pe.isFocus,Bt=yt===void 0?!1:yt,Ft=pe.watch,bt=pe.insertTemp,wr=pe.mode,Rr=wr===void 0?"markdown":wr,lr=pe.id,pr=lr===void 0?"markdown-editor-id":lr,fr=pe.showResizeBar,ia=fr===void 0?!1:fr,Cr=pe.noStorage,Kn=Cr===void 0?!1:Cr,Hn=pe.showNullButton,Rt=Hn===void 0?!1:Hn,nt=pe.hidetoolBar,Pr=nt===void 0?!1:nt,mn=pe.fullScreen,Zt=mn===void 0?!1:mn,Tt=pe.onBlur,gr=pe.onCMBeforeChange,Mr=pe.onFullScreen,pn=pe.className,je=pn===void 0?"":pn,dt=pe.disablePaste,Gn=dt===void 0?!1:dt,gn=pe.placeholder,vn=gn===void 0?"":gn,Qr=pe.values,yn=Qr===void 0?"":Qr,ft=Object(v.useState)(null),Ci=Object(j.a)(ft,2),Ge=Ci[0],bn=Ci[1],hr=Object(v.useState)(ke),zn=Object(j.a)(hr,2),Zr=zn[0],vr=zn[1],Vn=Object(v.useState)(Ft),Xn=Object(j.a)(Vn,2),yr=Xn[0],Yn=Xn[1],Ai=Object(v.useState)(Zt),$n=Object(j.a)(Ai,2),br=$n[0],Di=$n[1],aa=Object(v.useState)(""),Jn=Object(j.a)(aa,2),$t=Jn[0],Wr=Jn[1],oa=Object(v.useState)(0),qr=Object(j.a)(oa,2),Er=qr[0],Qn=qr[1],sa=Object(v.useState)(ht),Li=Object(j.a)(sa,2),Oi=Li[0],En=Li[1],Ri=Object(v.useState)(!1),Pi=Object(j.a)(Ri,2),la=Pi[0],xn=Pi[1],en=Object(v.useRef)(Object(Me.a)()),tn=Object(v.useRef)(!1),Tn=Object(v.useRef)(),kr=Object(v.useRef)(),Ir=Object(v.useRef)(),Fr=Object(v.useRef)(),_n=Object(v.useRef)(),Mi=function(){var it=Object(R.a)(L.a.mark(function ct(){var lt,pt;return L.a.wrap(function(At){for(;;)switch(At.prev=At.next){case 0:return At.next=2,Object(Ie.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:en.current}});case 2:pt=At.sent,pt!=null&&(lt=pt.attachments)!==null&<!==void 0&<.length&&(console.log("cm:",Ge,kr),pt.attachments.map(function(vt){vt.content_type.indexOf("image")>-1?Ge.replaceSelection(".concat(vt.content_type,")")):vt.content_type.indexOf("video")>-1?Ge.replaceSelection('<video width="100%" controls src="'.concat(o.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):vt.content_type.indexOf("pdf")>-1?Ge.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(vt.id,"?type=").concat(vt.content_type,'&disposition=inline" target="_blank">').concat(vt.name,"</a>")):Ge.replaceSelection("[".concat(vt.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(vt.id,"?type=").concat(vt.content_type,")"))}));case 4:case"end":return At.stop()}},ct)}));return function(){return it.apply(this,arguments)}}();Object(v.useEffect)(function(){vr(yn),Ge==null||Ge.setValue(yn)},[yn]),Object(v.useEffect)(function(){Mr==null||Mr(br)},[br]),Object(v.useEffect)(function(){if(kr.current){var it=T.a.fromTextArea(kr.current,{mode:Rr,lineNumbers:!wt,lineWrapping:!0,value:ke,autoCloseTags:!0,autoCloseBrackets:!0});Bt&&it.focus();function ct(lt,pt){if(Gn){pt.preventDefault();return}var Et=pt.clipboardData;if(Et){var At=Et.types.toString(),vt=Et.items;if(At==="Files"||Et.types.indexOf("Files")>-1){if(pt.preventDefault(),Rr=="stex")return;try{var Ut,qt=vt[1];((Ut=vt[0])===null||Ut===void 0?void 0:Ut.kind)==="file"&&(qt=vt[0]);var gt=qt.getAsFile(),Ur=gt.name.split(".").pop();$(gt,function(_t){if(_t.id){var er,Vt,mr;(gt==null||((er=gt.type)===null||er===void 0)?void 0:er.indexOf("image"))>-1?it.replaceSelection(".concat(_t.content_type,")")):(gt==null||((Vt=gt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?it.replaceSelection('<video width="100%" controls src="'.concat(o.a.API_SERVER,"/api/attachments/").concat(_t.id,'"></video>')):(gt==null||((mr=gt.type)===null||mr===void 0)?void 0:mr.indexOf("pdf"))>-1?it.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(_t.id,"?type=").concat(gt.type,'&disposition=inline" target="_blank">').concat(gt.name,"</a>")):J.includes(Ur)?it.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(_t.id,'?type=office&disposition=inline" target="_blank">').concat(gt.name,"</a>")):it.replaceSelection("[".concat(gt.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(_t.id,"?type=").concat(_t.content_type,")"))}else(_t==null?void 0:_t.status)===401&&(document.location.href="/user/login")})}catch(_t){I.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return it.on("paste",ct),it.on("dragleave",function(lt,pt){Ir.current.classList.remove("mouse-hover-md")}),it.on("dragover",function(lt,pt){Ir.current.classList.add("mouse-hover-md")}),it.on("drop",function(lt,pt){Ir.current.classList.add("mouse-hover-md");var Et;if(Et=pt.dataTransfer.files,Et.length>0){pt.preventDefault(),pt.stopPropagation();for(var At=function(qt){var gt=Et[qt],Ur=gt.name.split(".").pop();$(gt,function(_t){if(_t.id){var er,Vt,mr;(gt==null||((er=gt.type)===null||er===void 0)?void 0:er.indexOf("image"))>-1?it.replaceSelection(".concat(_t.content_type,")")):(gt==null||((Vt=gt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?it.replaceSelection('<video width="100%" controls src="'.concat(o.a.API_SERVER,"/api/attachments/").concat(_t.id,'"></video>')):(gt==null||((mr=gt.type)===null||mr===void 0)?void 0:mr.indexOf("pdf"))>-1?it.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(_t.id,"?type=").concat(gt.type,'&disposition=inline" target="_blank">').concat(gt.name,"</a>")):J.includes(Ur)?it.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(_t.id,'?type=office&disposition=inline" target="_blank">').concat(gt.name,"</a>")):it.replaceSelection("[".concat(gt.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(_t.id,"?type=").concat(_t.content_type,")"))}else(_t==null?void 0:_t.status)===401&&(document.location.href="/user/login")})},vt=0;vt<Et.length;vt++)At(vt)}}),bn(it),function(){it.off("paste",ct)}}},[]);var ur=Object(v.useCallback)(function(){if(Ir.current)try{}catch(it){console.log(it,"---- to set md editor body height")}},[Oi,Ir,br]);Object(v.useEffect)(function(){function it(){var lt=new E.default(function(pt){var Et=Object(A.a)(pt),At;try{for(Et.s();!(At=Et.n()).done;){var vt=At.value;(vt.target.offsetHeight>0||vt.target.offsetWidth>0)&&(ur(),Ge.setSize("100%","100%"),Ge.refresh())}}catch(Ut){Et.e(Ut)}finally{Et.f()}});return lt.observe(kr.current.parentElement),lt}if(Ge){var ct=it();return function(){ct.unobserve(kr.current.parentElement)}}},[Ge,ur]),Object(v.useEffect)(function(){if(Ge){for(var it=[],ct=function(){var vt=pt[lt];Et=Object(j.a)(vt,2);var Ut=Et[0],qt=Et[1],gt=Object(F.a)({},Ut,function(){ki(qt)});it.push(gt),Ge.addKeyMap(gt)},lt=0,pt=Object.entries(q);lt<pt.length;lt++){var Et;ct()}return Tn.current=setInterval(function(){tn.current&&Mi()},4e3),function(){clearInterval(Tn.current);var At=Object(A.a)(it),vt;try{for(At.s();!(vt=At.n()).done;){var Ut=vt.value;Ge.removeKeyMap(Ut)}}catch(qt){At.e(qt)}finally{At.f()}}}},[Ge]),Object(v.useEffect)(function(){Zt!==br&&Di(Zt)},[Zt]),Object(Ve.a)(function(){if(!Kn&&Er>0){var it=new Date().getTime(),ct=window.sessionStorage.getItem(pr);it>=Er+Je&&(!ct||ct!==Zr)&&(window.sessionStorage.setItem(pr,Zr),xn(!0))}},Je),Object(v.useEffect)(function(){Yn(Ft)},[Ge,Ft]),Object(v.useEffect)(function(){Ge&&(Bt&&Ge.focus())},[Ge,Bt]),Object(v.useEffect)(function(){if(yr&&Ge){var it=Ge.getScrollerElement();function ct(lt){var pt=lt.target;if(_n.current){var Et=pt.scrollTop/pt.scrollHeight;_n.current.scrollTop=_n.current.scrollHeight*Et}}return it.addEventListener("scroll",ct),function(){it.removeEventListener("scroll",ct)}}},[Ge,yr]),Object(v.useEffect)(function(){if(Ge&&gr){function it(ct,lt){gr(ct,lt)}return Ge.on("beforeChange",it),function(){Ge.off("beforeChange",it)}}},[Ge,gr]),Object(v.useEffect)(function(){if(Ge&&Tt){function it(){Tt(Ge.getValue())}return Ge.on("blur",it),function(){Ge.off("blur",it)}}},[Ge,Tt]),Object(v.useEffect)(function(){if(Ge){function it(ct){var lt=ct.getValue();vr(lt),Qn(new Date().getTime()),ct.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Qe&&Qe(lt)}return Ge.on("change",it),function(){Ge.off("change",it)}}},[Ge,Qe]),Object(v.useEffect)(function(){Ge&&(ke==null?(Ge.setValue(""),vr("")):ke!==Ge.getValue()&&(Ge.setValue(ke),vr(ke),Ge.setCursor(Ge.lineCount(),0)))},[Ge,ke]);var ki=Object(v.useCallback)(function(it){var ct=Ge.getCursor(),lt=Ge.getSelection(),pt=lt.split(`
|
|
`);switch(it){case"bold":return Ge.replaceSelection("**"+lt+"**"),lt===""&&Ge.setCursor(ct.line,ct.ch+2),Ge.focus();case"italic":return Ge.replaceSelection("*"+lt+"*"),lt===""&&Ge.setCursor(ct.line,ct.ch+1),Ge.focus();case"code":return Ge.replaceSelection("`"+lt+"`"),lt===""&&Ge.setCursor(ct.line,ct.ch+1),Ge.focus();case"inline-latex":return Ge.replaceSelection("`$$"+lt+"$$`"),lt===""&&Ge.setCursor(ct.line,ct.ch+3),Ge.focus();case"latex":return Ge.replaceSelection("```latex\n"+lt+"\n```"),Ge.setCursor(ct.line+1,lt.length+1),Ge.focus();case"line-break":return Ge.replaceSelection(`<br/>
|
|
`),Ge.focus();case"list-ul":return lt===""?Ge.replaceSelection("- "+lt):Ge.replaceSelection(pt.map(function(Et){return Et===""?"":"- ".concat(Et)}).join(`
|
|
`)),Ge.focus();case"list-ol":return lt===""?Ge.replaceSelection("1. "+lt):Ge.replaceSelection(pt.map(function(Et,At){return Et===""?"":"".concat(At+1,". ").concat(Et)}).join(`
|
|
`)),Ge.focus();case"add-null-ch":return lt===""&&Ge.setCursor(ct.line,ct.ch+1),Ge.replaceSelection(Oe),Ge.focus();case"inster-template-1":return lt===""&&Ge.setCursor(ct.line,ct.ch),Ge.replaceSelection(Ne),Ge.focus();case"eraser":return Ge.setValue(""),Ge.focus();case"trigger-watch":return Yn(!yr),Ge.focus();case"trigger-full-screen":return Di(!br),Ge.focus();case Ce:Wr(Ce);return;case Be:Wr(Be);return;case we:Wr(we);return;case Ke:Wr(Ke);return;default:throw new Error}},[Ge,yr,br]),Sn=Object(v.useCallback)(function(it){Wr("");switch($t){case Ce:var ct=it.title,lt=it.link;return Ge.replaceSelection("[".concat(ct,"](").concat(lt,")")),Ge.focus();case Be:var pt=it.language,Et=it.content;return Ge.replaceSelection(["```"+pt,Et,"```"].join(`
|
|
`)),Ge.focus();case we:var At=it.src,vt=it.alt;return vt?Ge.replaceSelection(".concat(At,' "').concat(vt,'" )')):Ge.replaceSelection("")),Ge.focus();case Ke:for(var Ut=it.row,qt=it.col,gt=it.align,Ur=`
|
|
`,_t=0;_t<Ut;_t++){for(var er=[],Vt=[],mr=0;mr<qt;mr++)_t===1&&Vt.push(Pe[gt]),er.push(" ");_t===1&&(Ur+="| ".concat(Vt.join(" | "),` |
|
|
`)),Ur+="| ".concat(er.join(qt===1?"":" | "),` |
|
|
`)}return Ge.replaceSelection(Ur+`
|
|
`),Ge.focus();default:throw new Error}},[Ge,$t]),Zn=Object(v.useMemo)(function(){switch($t){case Ce:return S.a.createElement(ee,{callback:Sn,onCancel:Kr});case Be:return S.a.createElement(oe.b,{callback:Sn,onCancel:Kr});case we:return S.a.createElement(ne,{callback:Sn,onCancel:Kr});case Ke:return S.a.createElement(Le,{callback:Sn,onCancel:Kr});default:return null}},[$t]);function Kr(){Wr("")}Object(v.useEffect)(function(){if(Fr.current){var it=Fr.current,ct=!1,lt=0;function pt(vt){ct=!0,lt=vt.pageY}function Et(){ct=!1}function At(vt){if(ct){var Ut=vt.pageY-lt;Ut<0&&(Ut=0),Ut>300&&(Ut=300);var qt=ht+Ut+"px";En(qt)}}return it.addEventListener("mousedown",pt),document.addEventListener("mousemove",At),document.addEventListener("mouseup",Et),function(){it.removeEventListener("mousedown",pt),document.removeEventListener("mousemove",At),document.removeEventListener("mouseup",Et)}}},[Ge,Fr]),Object(v.useEffect)(function(){En(ht)},[ht]);var Ar=ve(rt),qn=ve(Oi),xr={width:Ar,height:qn},ei=Object(v.useMemo)(function(){if(Er){var it=new Date(Er),ct=it.getHours(),lt=it.getMinutes(),pt=it.getSeconds();return ct=ct<10?"0"+ct:ct,lt=lt<10?"0"+lt:lt,pt=pt<10?"0"+pt:pt,"".concat(ct,":").concat(lt,":").concat(pt)}return 0},[Er]);function Ii(){window.sessionStorage.removeItem(pr),xn(!1),Qn(0)}function rn(){xn(!1),Qn(0),Ge.setValue(window.sessionStorage.getItem(pr))}function ua(it,ct){var lt=Ge.getValue();lt=lt.replace(it,ct),vr(lt),Ge==null||Ge.setValue(lt)}return S.a.createElement(v.Fragment,null,S.a.createElement("div",{className:"markdown-editor-wrapper",ref:Ir},S.a.createElement("div",{className:"markdown-editor-container ".concat(je," ").concat(yr?"on-preview":""," ").concat(wt?"mini":""," ").concat(br?"full-screen":""),style:xr},S.a.createElement(x,{insertTemp:bt,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:_n,className:"preview-container"},Rr==="stex"&&S.a.createElement(C,{value:Zr}),Rr!=="stex"&&S.a.createElement(h.a,{edit:!0,value:Zr,replaces:ua})):null))),ia?S.a.createElement("a",{ref:Fr,className:"editor-resize"}):null,S.a.createElement(P.a,null,re[$t]?S.a.createElement(G.a,{centered:!0,title:re[$t],visible:!0,onCancel:Kr,footer:null,className:"markdown-popup-form"},Zn):null))}},SJMd:function(et,We){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var Q,te,G,A=!1,z,I;window.PR_SHOULD_USE_CONTINUATION=!0;var R,j;(function(){var F=window,k=["break,continue,do,else,for,if,return,while"],L=[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"],v=[L,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],S=[v,"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"],D=[v,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],T=[v,"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"],E="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",g=[v,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],u="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",a=[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"],s=[k,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],l=[k,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],w=[S,T,D,g,u,a,s,l],p=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,h="str",C="kwd",b="com",c="typ",f="lit",d="pun",o="pln",y="tag",m="dec",x="src",P="atn",U="atv",B="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function O(ye){for(var _e=0,Le=!1,Ie=!1,Me=0,Ce=ye.length;Me<Ce;++Me){var we=ye[Me];if(we.ignoreCase)Ie=!0;else if(/[a-z]/i.test(we.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Le=!0,Ie=!1;break}}var Be={b:8,t:9,n:10,v:11,f:12,r:13};function Ke(Xe){var Ae=Xe.charCodeAt(0);if(Ae!==92)return Ae;var qe=Xe.charAt(1);return Ae=Be[qe],Ae||("0"<=qe&&qe<="7"?parseInt(Xe.substring(1),8):qe==="u"||qe==="x"?parseInt(Xe.substring(2),16):Xe.charCodeAt(1))}function Ue(Xe){if(Xe<32)return(Xe<16?"\\x0":"\\x")+Xe.toString(16);var Ae=String.fromCharCode(Xe);return Ae==="\\"||Ae==="-"||Ae==="]"||Ae==="^"?"\\"+Ae:Ae}function Pe(Xe){var Ae=Xe.substring(1,Xe.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),qe=[],Je=Ae[0]==="^",Oe=["["];Je&&Oe.push("^");for(var Ne=Je?1:0,ve=Ae.length;Ne<ve;++Ne){var ce=Ae[Ne];if(/\\[bdsw]/i.test(ce))Oe.push(ce);else{var fe=Ke(ce),J;Ne+2<ve&&Ae[Ne+1]==="-"?(J=Ke(Ae[Ne+2]),Ne+=2):J=fe,qe.push([fe,J]),J<65||fe>122||(J<65||fe>90||qe.push([Math.max(65,fe)|32,Math.min(J,90)|32]),J<97||fe>122||qe.push([Math.max(97,fe)&~32,Math.min(J,122)&~32]))}}qe.sort(function(pe,De){return pe[0]-De[0]||De[1]-pe[1]});for(var q=[],re=[],Ne=0;Ne<qe.length;++Ne){var le=qe[Ne];le[0]<=re[1]+1?re[1]=Math.max(re[1],le[1]):q.push(re=le)}for(var Ne=0;Ne<q.length;++Ne){var le=q[Ne];Oe.push(Ue(le[0])),le[1]>le[0]&&(le[1]+1>le[0]&&Oe.push("-"),Oe.push(Ue(le[1])))}return Oe.push("]"),Oe.join("")}function Ve(Xe){for(var Ae=Xe.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),qe=Ae.length,Je=[],Oe=0,Ne=0;Oe<qe;++Oe){var ve=Ae[Oe];if(ve==="(")++Ne;else if(ve.charAt(0)==="\\"){var ce=+ve.substring(1);ce&&(ce<=Ne?Je[ce]=-1:Ae[Oe]=Ue(ce))}}for(var Oe=1;Oe<Je.length;++Oe)Je[Oe]===-1&&(Je[Oe]=++_e);for(var Oe=0,Ne=0;Oe<qe;++Oe){var ve=Ae[Oe];if(ve==="(")++Ne,Je[Ne]||(Ae[Oe]="(?:");else if(ve.charAt(0)==="\\"){var ce=+ve.substring(1);ce&&ce<=Ne&&(Ae[Oe]="\\"+Je[ce])}}for(var Oe=0;Oe<qe;++Oe)Ae[Oe]==="^"&&Ae[Oe+1]!=="^"&&(Ae[Oe]="");if(Xe.ignoreCase&&Le)for(var Oe=0;Oe<qe;++Oe){var ve=Ae[Oe],fe=ve.charAt(0);ve.length>=2&&fe==="["?Ae[Oe]=Pe(ve):fe!=="\\"&&(Ae[Oe]=ve.replace(/[a-zA-Z]/g,function(re){var le=re.charCodeAt(0);return"["+String.fromCharCode(le&~32,le|32)+"]"}))}return Ae.join("")}for(var He=[],Me=0,Ce=ye.length;Me<Ce;++Me){var we=ye[Me];if(we.global||we.multiline)throw new Error(""+we);He.push("(?:"+Ve(we)+")")}return new RegExp(He.join("|"),Ie?"gi":"g")}function M(ye,_e){var Le=/(?:^|\s)nocode(?:\s|$)/,Ie=[],Me=0,Ce=[],we=0;function Be(Ke){var Ue=Ke.nodeType;if(Ue==1){if(Le.test(Ke.className))return;for(var Pe=Ke.firstChild;Pe;Pe=Pe.nextSibling)Be(Pe);var Ve=Ke.nodeName.toLowerCase();(Ve==="br"||Ve==="li")&&(Ie[we]=`
|
|
`,Ce[we<<1]=Me++,Ce[we++<<1|1]=Ke)}else if(Ue==3||Ue==4){var He=Ke.nodeValue;He.length&&(_e?He=He.replace(/\r\n?/g,`
|
|
`):He=He.replace(/[ \t\r\n]+/g," "),Ie[we]=He,Ce[we<<1]=Me,Me+=He.length,Ce[we++<<1|1]=Ke)}}return Be(ye),{sourceCode:Ie.join("").replace(/\n$/,""),spans:Ce}}function K(ye,_e,Le,Ie,Me){if(!Le)return;var Ce={sourceNode:ye,pre:1,langExtension:null,numberLines:null,sourceCode:Le,spans:null,basePos:_e,decorations:null};Ie(Ce),Me.push.apply(Me,Ce.decorations)}var X=/\S/;function ee(ye){for(var _e=void 0,Le=ye.firstChild;Le;Le=Le.nextSibling){var Ie=Le.nodeType;_e=Ie===1?_e?ye:Le:Ie===3&&X.test(Le.nodeValue)?ye:_e}return _e===ye?void 0:_e}function oe(ye,_e){var Le={},Ie;(function(){for(var we=ye.concat(_e),Be=[],Ke={},Ue=0,Pe=we.length;Ue<Pe;++Ue){var Ve=we[Ue],He=Ve[3];if(He)for(var Xe=He.length;--Xe>=0;)Le[He.charAt(Xe)]=Ve;var Ae=Ve[1],qe=""+Ae;Ke.hasOwnProperty(qe)||(Be.push(Ae),Ke[qe]=null)}Be.push(/[\0-\uffff]/),Ie=O(Be)})();var Me=_e.length,Ce=function(we){for(var Be=we.sourceCode,Ke=we.basePos,Ue=we.sourceNode,Pe=[Ke,o],Ve=0,He=Be.match(Ie)||[],Xe={},Ae=0,qe=He.length;Ae<qe;++Ae){var Je=He[Ae],Oe=Xe[Je],Ne=void 0,ve;if(typeof Oe=="string")ve=!1;else{var ce=Le[Je.charAt(0)];if(ce)Ne=Je.match(ce[1]),Oe=ce[0];else{for(var fe=0;fe<Me;++fe)if(ce=_e[fe],Ne=Je.match(ce[1]),Ne){Oe=ce[0];break}Ne||(Oe=o)}ve=Oe.length>=5&&Oe.substring(0,5)==="lang-",ve&&!(Ne&&typeof Ne[1]=="string")&&(ve=!1,Oe=x),ve||(Xe[Je]=Oe)}var J=Ve;if(Ve+=Je.length,!ve)Pe.push(Ke+J,Oe);else{var q=Ne[1],re=Je.indexOf(q),le=re+q.length;Ne[2]&&(le=Je.length-Ne[2].length,re=le-q.length);var pe=Oe.substring(5);K(Ue,Ke+J,Je.substring(0,re),Ce,Pe),K(Ue,Ke+J+re,q,he(pe,q),Pe),K(Ue,Ke+J+le,Je.substring(le),Ce,Pe)}}we.decorations=Pe};return Ce}function xe(ye){var _e=[],Le=[];ye.tripleQuotedStrings?_e.push([h,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ye.multiLineStrings?_e.push([h,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):_e.push([h,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ye.verbatimStrings&&Le.push([h,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ie=ye.hashComments;Ie&&(ye.cStyleComments?(Ie>1?_e.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):_e.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Le.push([h,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):_e.push([b,/^#[^\r\n]*/,null,"#"])),ye.cStyleComments&&(Le.push([b,/^\/\/[^\r\n]*/,null]),Le.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Me=ye.regexLiterals;if(Me){var Ce=Me>1?"":`
|
|
\r`,we=Ce?".":"[\\S\\s]",Be="/(?=[^/*"+Ce+"])(?:[^/\\x5B\\x5C"+Ce+"]|\\x5C"+we+"|\\x5B(?:[^\\x5C\\x5D"+Ce+"]|\\x5C"+we+")*(?:\\x5D|$))+/";Le.push(["lang-regex",RegExp("^"+W+"("+Be+")")])}var Ke=ye.types;Ke&&Le.push([c,Ke]);var Ue=(""+ye.keywords).replace(/^ | $/g,"");Ue.length&&Le.push([C,new RegExp("^(?:"+Ue.replace(/[\s,]+/g,"|")+")\\b"),null]),_e.push([o,/^\s+/,null,` \r
|
|
\xA0`]);var Pe="^.[^\\s\\w.$@'\"`/\\\\]*";return ye.regexLiterals&&(Pe+="(?!s*/)"),Le.push([f,/^@[a-z_$][a-z_$@0-9]*/i,null],[c,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[o,/^[a-z_$][a-z_$@0-9]*/i,null],[f,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[o,/^\\[\s\S]?/,null],[d,new RegExp(Pe),null]),oe(_e,Le)}var me=xe({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function ge(ye,_e,Le){for(var Ie=/(?:^|\s)nocode(?:\s|$)/,Me=/\r\n?|\n/,Ce=ye.ownerDocument,we=Ce.createElement("li");ye.firstChild;)we.appendChild(ye.firstChild);var Be=[we];function Ke(Ae){var qe=Ae.nodeType;if(qe==1&&!Ie.test(Ae.className))if(Ae.nodeName==="br")Ue(Ae),Ae.parentNode&&Ae.parentNode.removeChild(Ae);else for(var Je=Ae.firstChild;Je;Je=Je.nextSibling)Ke(Je);else if((qe==3||qe==4)&&Le){var Oe=Ae.nodeValue,Ne=Oe.match(Me);if(Ne){var ve=Oe.substring(0,Ne.index);Ae.nodeValue=ve;var ce=Oe.substring(Ne.index+Ne[0].length);if(ce){var fe=Ae.parentNode;fe.insertBefore(Ce.createTextNode(ce),Ae.nextSibling)}Ue(Ae),ve||Ae.parentNode.removeChild(Ae)}}}function Ue(Ae){for(;!Ae.nextSibling;)if(Ae=Ae.parentNode,!Ae)return;function qe(Ne,ve){var ce=ve?Ne.cloneNode(!1):Ne,fe=Ne.parentNode;if(fe){var J=qe(fe,1),q=Ne.nextSibling;J.appendChild(ce);for(var re=q;re;re=q)q=re.nextSibling,J.appendChild(re)}return ce}for(var Je=qe(Ae.nextSibling,0),Oe;(Oe=Je.parentNode)&&Oe.nodeType===1;)Je=Oe;Be.push(Je)}for(var Pe=0;Pe<Be.length;++Pe)Ke(Be[Pe]);_e===(_e|0)&&Be[0].setAttribute("value",_e);var Ve=Ce.createElement("ol");Ve.className="linenums";for(var He=Math.max(0,_e-1|0)||0,Pe=0,Xe=Be.length;Pe<Xe;++Pe)we=Be[Pe],we.className="L"+(Pe+He)%10,we.firstChild||we.appendChild(Ce.createTextNode("\xA0")),Ve.appendChild(we);ye.appendChild(Ve)}function de(ye){var _e=/\bMSIE\s(\d+)/.exec(navigator.userAgent);_e=_e&&+_e[1]<=8;var Le=/\n/g,Ie=ye.sourceCode,Me=Ie.length,Ce=0,we=ye.spans,Be=we.length,Ke=0,Ue=ye.decorations,Pe=Ue.length,Ve=0;Ue[Pe]=Me;var He,Xe;for(Xe=He=0;Xe<Pe;)Ue[Xe]!==Ue[Xe+2]?(Ue[He++]=Ue[Xe++],Ue[He++]=Ue[Xe++]):Xe+=2;for(Pe=He,Xe=He=0;Xe<Pe;){for(var Ae=Ue[Xe],qe=Ue[Xe+1],Je=Xe+2;Je+2<=Pe&&Ue[Je+1]===qe;)Je+=2;Ue[He++]=Ae,Ue[He++]=qe,Xe=Je}Pe=Ue.length=He;var Oe=ye.sourceNode,Ne="";Oe&&(Ne=Oe.style.display,Oe.style.display="none");try{for(var ve=null;Ke<Be;){var ce=we[Ke],fe=we[Ke+2]||Me,J=Ue[Ve+2]||Me,Je=Math.min(fe,J),q=we[Ke+1],re;if(q.nodeType!==1&&(re=Ie.substring(Ce,Je))){_e&&(re=re.replace(Le,"\r")),q.nodeValue=re;var le=q.ownerDocument,pe=le.createElement("span");pe.className=Ue[Ve+1];var De=q.parentNode;De.replaceChild(pe,q),pe.appendChild(q),Ce<fe&&(we[Ke+1]=q=le.createTextNode(Ie.substring(Je,fe)),De.insertBefore(q,pe.nextSibling))}Ce=Je,Ce>=fe&&(Ke+=2),Ce>=J&&(Ve+=2)}}finally{Oe&&(Oe.style.display=Ne)}}var se={};function ne(ye,_e){for(var Le=_e.length;--Le>=0;){var Ie=_e[Le];se.hasOwnProperty(Ie)?F.console&&console.warn("cannot override language handler %s",Ie):se[Ie]=ye}}function he(ye,_e){return ye&&se.hasOwnProperty(ye)||(ye=/^\s*</.test(_e)?"default-markup":"default-code"),se[ye]}ne(me,["default-code"]),ne(oe([],[[o,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[b,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[d,/^(?:<[%?]|[%?]>)/],["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"]),ne(oe([[o,/^[\s]+/,null,` \r
|
|
`],[U,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[y,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[d,/^[=<>\/]+/],["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"]),ne(oe([],[[U,/^[\s\S]+/]]),["uq.val"]),ne(xe({keywords:S,hashComments:!0,cStyleComments:!0,types:p}),["c","cc","cpp","cxx","cyc","m"]),ne(xe({keywords:"null,true,false"}),["json"]),ne(xe({keywords:T,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:p}),["cs"]),ne(xe({keywords:D,cStyleComments:!0}),["java"]),ne(xe({keywords:l,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ne(xe({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ne(xe({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ne(xe({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ne(xe({keywords:g,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ne(xe({keywords:E,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ne(oe([],[[h,/^[\s\S]+/]]),["regex"]);function $(ye){var _e=ye.langExtension;try{var Le=M(ye.sourceNode,ye.pre),Ie=Le.sourceCode;ye.sourceCode=Ie,ye.spans=Le.spans,ye.basePos=0,he(_e,Ie)(ye),de(ye)}catch(Me){F.console&&console.log(Me&&Me.stack||Me)}}function ie(ye,_e,Le){var Ie=Le||!1,Me=_e||null,Ce=document.createElement("div");Ce.innerHTML="<pre>"+ye+"</pre>",Ce=Ce.firstChild,Ie&&ge(Ce,Ie,!0);var we={langExtension:Me,numberLines:Ie,sourceNode:Ce,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return $(we),Ce.innerHTML}function Z(ye,_e){var Le=_e||document.body,Ie=Le.ownerDocument||document;function Me(ce){return Le.getElementsByTagName(ce)}for(var Ce=[Me("pre"),Me("code"),Me("xmp")],we=[],Be=0;Be<Ce.length;++Be)for(var Ke=0,Ue=Ce[Be].length;Ke<Ue;++Ke)we.push(Ce[Be][Ke]);Ce=null;var Pe=Date;Pe.now||(Pe={now:function(){return+new Date}});var Ve=0,He=/\blang(?:uage)?-([\w.]+)(?!\S)/,Xe=/\bprettyprint\b/,Ae=/\bprettyprinted\b/,qe=/pre|xmp/i,Je=/^code$/i,Oe=/^(?:pre|code|xmp)$/i,Ne={};function ve(){for(var ce=F.PR_SHOULD_USE_CONTINUATION?Pe.now()+250:Infinity;Ve<we.length&&Pe.now()<ce;Ve++){for(var fe=we[Ve],J=Ne,q=fe;q=q.previousSibling;){var re=q.nodeType,le=(re===7||re===8)&&q.nodeValue;if(le?!/^\??prettify\b/.test(le):re!==3||/\S/.test(q.nodeValue))break;if(le){J={},le.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ft,bt,wr){J[bt]=wr});break}}var pe=fe.className;if((J!==Ne||Xe.test(pe))&&!Ae.test(pe)){for(var De=!1,ke=fe.parentNode;ke;ke=ke.parentNode){var Qe=ke.tagName;if(Oe.test(Qe)&&ke.className&&Xe.test(ke.className)){De=!0;break}}if(!De){fe.className+=" prettyprinted";var at=J.lang;if(!at){at=pe.match(He);var rt;!at&&(rt=ee(fe))&&Je.test(rt.tagName)&&(at=rt.className.match(He)),at&&(at=at[1])}var xt;if(qe.test(fe.tagName))xt=1;else{var ht=fe.currentStyle,st=Ie.defaultView,wt=ht?ht.whiteSpace:st&&st.getComputedStyle?st.getComputedStyle(fe,null).getPropertyValue("white-space"):0;xt=wt&&wt.substring(0,3)==="pre"}var yt=J.linenums;(yt=yt==="true"||+yt)||(yt=pe.match(/\blinenums\b(?::(\d+))?/),yt=yt?yt[1]&&yt[1].length?+yt[1]:!0:!1),yt&&ge(fe,yt,xt);var Bt={langExtension:at,sourceNode:fe,numberLines:yt,pre:xt,sourceCode:null,basePos:null,spans:null,decorations:null};$(Bt)}}}Ve<we.length?F.setTimeout(ve,250):typeof ye=="function"&&ye()}ve()}var Ee=F.PR={createSimpleLexer:oe,registerLangHandler:ne,sourceDecorator:xe,PR_ATTRIB_NAME:P,PR_ATTRIB_VALUE:U,PR_COMMENT:b,PR_DECLARATION:m,PR_KEYWORD:C,PR_LITERAL:f,PR_NOCODE:B,PR_PLAIN:o,PR_PUNCTUATION:d,PR_SOURCE:x,PR_STRING:h,PR_TAG:y,PR_TYPE:c,prettyPrintOne:A?F.prettyPrintOne=ie:R=ie,prettyPrint:j=A?F.prettyPrint=Z:j=Z},Se=F.define;typeof Se=="function"&&Se.amd&&Se("google-code-prettify",[],function(){return Ee})})()},"VrN/":function(et,We,Q){(function(te,G){et.exports=G()})(this,function(){"use strict";var te=navigator.userAgent,G=navigator.platform,A=/gecko\/\d/i.test(te),z=/MSIE \d/.test(te),I=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(te),R=/Edge\/(\d+)/.exec(te),j=z||I||R,F=j&&(z?document.documentMode||6:+(R||I)[1]),k=!R&&/WebKit\//.test(te),L=k&&/Qt\/\d+\.\d+/.test(te),v=!R&&/Chrome\//.test(te),S=/Opera\//.test(te),D=/Apple Computer/.test(navigator.vendor),T=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(te),E=/PhantomJS/.test(te),g=!R&&/AppleWebKit/.test(te)&&/Mobile\/\w+/.test(te),u=/Android/.test(te),a=g||u||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(te),s=g||/Mac/.test(G),l=/\bCrOS\b/.test(te),w=/win/i.test(G),p=S&&te.match(/Version\/(\d*\.\d*)/);p&&(p=Number(p[1])),p&&p>=15&&(S=!1,k=!0);var h=s&&(L||S&&(p==null||p<12.11)),C=A||j&&F>=9;function b(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var c=function(e,t){var n=e.className,r=b(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function f(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function d(e,t){return f(e).appendChild(t)}function o(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 _=0;_<t.length;++_)i.appendChild(t[_]);return i}function y(e,t,n,r){var i=o(e,t,n,r);return i.setAttribute("role","presentation"),i}var m;document.createRange?m=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:m=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function x(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 P(){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 U(e,t){var n=e.className;b(t).test(n)||(e.className+=(n?" ":"")+t)}function B(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!b(n[r]).test(t)&&(t+=" "+n[r]);return t}var W=function(e){e.select()};g?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:j&&(W=function(e){try{e.select()}catch(t){}});function O(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function M(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 K(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var _=r||0,N=i||0;;){var H=e.indexOf(" ",_);if(H<0||H>=t)return N+(t-_);N+=H-_,N+=n-N%n,_=H+1}}var X=function(){this.id=null,this.f=null,this.time=0,this.handler=O(this.onTimeout,this)};X.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},X.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,xe={toString:function(){return"CodeMirror.Pass"}},me={scroll:!1},ge={origin:"*mouse"},de={origin:"+move"};function se(e,t,n){for(var r=0,i=0;;){var _=e.indexOf(" ",r);_==-1&&(_=e.length);var N=_-r;if(_==e.length||i+N>=t)return r+Math.min(N,t-i);if(i+=_-r,i+=n-i%n,r=_+1,i>=t)return r}}var ne=[""];function he(e){for(;ne.length<=e;)ne.push($(ne)+" ");return ne[e]}function $(e){return e[e.length-1]}function ie(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Z(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function Ee(){}function Se(e,t){var n;return Object.create?n=Object.create(e):(Ee.prototype=e,n=new Ee),t&&M(t,n),n}var ye=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function _e(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ye.test(e))}function Le(e,t){return t?t.source.indexOf("\\w")>-1&&_e(e)?!0:t.test(e):_e(e)}function Ie(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Me=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Ce(e){return e.charCodeAt(0)>=768&&Me.test(e)}function we(e,t,n){for(;(n<0?t>0:t<e.length)&&Ce(e.charAt(t));)t+=n;return t}function Be(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,_=r<0?Math.ceil(i):Math.floor(i);if(_==t)return e(_)?t:n;e(_)?n=_:t=_+r}}function Ke(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,_=0;_<e.length;++_){var N=e[_];(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",_),i=!0)}i||r(t,n,"ltr")}var Ue=null;function Pe(e,t,n){var r;Ue=null;for(var i=0;i<e.length;++i){var _=e[i];if(_.from<t&&_.to>t)return i;_.to==t&&(_.from!=_.to&&n=="before"?r=i:Ue=i),_.from==t&&(_.from!=_.to&&n!="before"?r=i:Ue=i)}return r!=null?r:Ue}var Ve=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(Y){return Y<=247?e.charAt(Y):1424<=Y&&Y<=1524?"R":1536<=Y&&Y<=1785?t.charAt(Y-1536):1774<=Y&&Y<=2220?"r":8192<=Y&&Y<=8203?"w":Y==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,_=/[LRr]/,N=/[Lb1n]/,H=/[1n]/;function V(Y,ae,ue){this.level=Y,this.from=ae,this.to=ue}return function(Y,ae){var ue=ae=="ltr"?"L":"R";if(Y.length==0||ae=="ltr"&&!r.test(Y))return!1;for(var Te=Y.length,be=[],Re=0;Re<Te;++Re)be.push(n(Y.charCodeAt(Re)));for(var Fe=0,ze=ue;Fe<Te;++Fe){var Ye=be[Fe];Ye=="m"?be[Fe]=ze:ze=Ye}for(var Ze=0,$e=ue;Ze<Te;++Ze){var tt=be[Ze];tt=="1"&&$e=="r"?be[Ze]="n":_.test(tt)&&($e=tt,tt=="r"&&(be[Ze]="R"))}for(var ut=1,ot=be[0];ut<Te-1;++ut){var mt=be[ut];mt=="+"&&ot=="1"&&be[ut+1]=="1"?be[ut]="1":mt==","&&ot==be[ut+1]&&(ot=="1"||ot=="n")&&(be[ut]=ot),ot=mt}for(var Dt=0;Dt<Te;++Dt){var Kt=be[Dt];if(Kt==",")be[Dt]="N";else if(Kt=="%"){var Ot=void 0;for(Ot=Dt+1;Ot<Te&&be[Ot]=="%";++Ot);for(var sr=Dt&&be[Dt-1]=="!"||Ot<Te&&be[Ot]=="1"?"1":"N",nr=Dt;nr<Ot;++nr)be[nr]=sr;Dt=Ot-1}}for(var kt=0,ir=ue;kt<Te;++kt){var zt=be[kt];ir=="L"&&zt=="1"?be[kt]="L":_.test(zt)&&(ir=zt)}for(var Nt=0;Nt<Te;++Nt)if(i.test(be[Nt])){var It=void 0;for(It=Nt+1;It<Te&&i.test(be[It]);++It);for(var Pt=(Nt?be[Nt-1]:ue)=="L",ar=(It<Te?be[It]:ue)=="L",jn=Pt==ar?Pt?"L":"R":ue,Jr=Nt;Jr<It;++Jr)be[Jr]=jn;Nt=It-1}for(var Yt=[],Or,Ht=0;Ht<Te;)if(N.test(be[Ht])){var Va=Ht;for(++Ht;Ht<Te&&N.test(be[Ht]);++Ht);Yt.push(new V(0,Va,Ht))}else{var jr=Ht,fn=Yt.length,hn=ae=="rtl"?1:0;for(++Ht;Ht<Te&&be[Ht]!="L";++Ht);for(var Qt=jr;Qt<Ht;)if(H.test(be[Qt])){jr<Qt&&(Yt.splice(fn,0,new V(1,jr,Qt)),fn+=hn);var Wn=Qt;for(++Qt;Qt<Ht&&H.test(be[Qt]);++Qt);Yt.splice(fn,0,new V(2,Wn,Qt)),fn+=hn,jr=Qt}else++Qt;jr<Ht&&Yt.splice(fn,0,new V(1,jr,Ht))}return ae=="ltr"&&(Yt[0].level==1&&(Or=Y.match(/^\s+/))&&(Yt[0].from=Or[0].length,Yt.unshift(new V(0,0,Or[0].length))),$(Yt).level==1&&(Or=Y.match(/\s+$/))&&($(Yt).to-=Or[0].length,Yt.push(new V(0,Te-Or[0].length,Te)))),ae=="rtl"?Yt.reverse():Yt}}();function He(e,t){var n=e.order;return n==null&&(n=e.order=Ve(e.text,t)),n}var Xe=[],Ae=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]||Xe).concat(n)}};function qe(e,t){return e._handlers&&e._handlers[t]||Xe}function Je(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 _=ee(i,n);_>-1&&(r[t]=i.slice(0,_).concat(i.slice(_+1)))}}}function Oe(e,t){var n=qe(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 Ne(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Oe(e,n||t.type,e,t),re(t)||t.codemirrorIgnore}function ve(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)ee(n,t[r])==-1&&n.push(t[r])}function ce(e,t){return qe(e,t).length>0}function fe(e){e.prototype.on=function(t,n){Ae(this,t,n)},e.prototype.off=function(t,n){Je(this,t,n)}}function J(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function q(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function re(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function le(e){J(e),q(e)}function pe(e){return e.target||e.srcElement}function De(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var ke=function(){if(j&&F<9)return!1;var e=o("div");return"draggable"in e||"dragDrop"in e}(),Qe;function at(e){if(Qe==null){var t=o("span","\u200B");d(e,o("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Qe=t.offsetWidth<=1&&t.offsetHeight>2&&!(j&&F<8))}var n=Qe?o("span","\u200B"):o("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var rt;function xt(e){if(rt!=null)return rt;var t=d(e,document.createTextNode("A\u062EA")),n=m(t,0,1).getBoundingClientRect(),r=m(t,1,2).getBoundingClientRect();return f(e),!n||n.left==n.right?!1:rt=r.right-n.right<3}var ht=`
|
|
|
|
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 _=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),N=_.indexOf("\r");N!=-1?(n.push(_.slice(0,N)),t+=N+1):(n.push(_),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},wt=function(){var e=o("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),yt=null;function Bt(e){if(yt!=null)return yt;var t=d(e,o("span","x")),n=t.getBoundingClientRect(),r=m(t,0,1).getBoundingClientRect();return yt=Math.abs(n.left-r.left)>1}var Ft={},bt={};function wr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ft[e]=t}function Rr(e,t){bt[e]=t}function lr(e){if(typeof e=="string"&&bt.hasOwnProperty(e))e=bt[e];else if(e&&typeof e.name=="string"&&bt.hasOwnProperty(e.name)){var t=bt[e.name];typeof t=="string"&&(t={name:t}),e=Se(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return 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=Ft[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 _ in i){if(!i.hasOwnProperty(_))continue;r.hasOwnProperty(_)&&(r["_"+_]=r[_]),r[_]=i[_]}}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]={};M(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 Kn(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 Hn(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=K(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?K(this.string,this.lineStart,this.tabSize):0)},Rt.prototype.indentation=function(){return K(this.string,null,this.tabSize)-(this.lineStart?K(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 _=this.string.slice(this.pos).match(e);return _&&_.index>0?null:(_&&t!==!1&&(this.pos+=_[0].length),_)}},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],_=i.chunkSize();if(t<_){n=i;break}t-=_}return n.lines[t]}function Pr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(_){var N=_.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],_=i.height;if(t<_){e=i;continue e}t-=_,n+=i.chunkSize()}return n}while(!e.lines);for(var N=0;N<e.lines.length;++N){var H=e.lines[N],V=H.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 je(e,t,n){if(n===void 0&&(n=null),!(this instanceof je))return new je(e,t,n);this.line=e,this.ch=t,this.sticky=n}function dt(e,t){return e.line-t.line||e.ch-t.ch}function Gn(e,t){return e.sticky==t.sticky&&dt(e,t)==0}function gn(e){return je(e.line,e.ch)}function vn(e,t){return dt(e,t)<0?t:e}function Qr(e,t){return dt(e,t)<0?e:t}function yn(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ft(e,t){if(t.line<e.first)return je(e.first,0);var n=e.first+e.size-1;return t.line>n?je(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?je(e.line,t):n<0?je(e.line,0):e}function Ge(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ft(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],_={};br(e,t.text,e.doc.mode,n,function(Y,ae){return i.push(Y,ae)},_,r);for(var N=n.state,H=function(Y){n.baseTokens=i;var ae=e.state.overlays[Y],ue=1,Te=0;n.state=!0,br(e,t.text,ae.mode,n,function(be,Re){for(var Fe=ue;Te<be;){var ze=i[ue];ze>be&&i.splice(ue,1,be,i[ue+1],ze),ue+=2,Te=Math.min(be,ze)}if(!Re)return;if(ae.opaque)i.splice(Fe,ue-Fe,be,"overlay "+Re),ue=Fe+2;else for(;Fe<ue;Fe+=2){var Ye=i[Fe+1];i[Fe+1]=(Ye?Ye+" ":"")+"overlay "+Re}},_),n.state=N,n.baseTokens=null,n.baseTokenPos=1},V=0;V<e.state.overlays.length;++V)H(V);return{styles:i,classes:_.bgClass||_.textClass?_: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),_=zn(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=_.styles,_.classes?t.styleClasses=_.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 _=Di(e,t,n),N=_>r.first&&nt(r,_-1).stateAfter,H=N?hr.fromSaved(r,N,_):new hr(r,Hn(r.mode),_);return r.iter(_,t,function(V){Vn(e,V.text,H);var Y=H.line;V.stateAfter=Y==t-1||Y%5==0||Y>=i.viewFrom&&Y<i.viewTo?H.save():null,H.nextLine()}),n&&(r.modeFrontier=H.line),H}function Vn(e,t,n,r){var i=e.doc.mode,_=new Rt(t,e.options.tabSize,n);for(_.start=_.pos=r||0,t==""&&Xn(i,n.state);!_.eol();)yr(i,_,n.state),_.start=_.pos}function Xn(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Kn(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]=Kn(e,n).mode);var _=e.token(t,n);if(t.pos>t.start)return _}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,_=i.mode,N;t=ft(i,t);var H=nt(i,t.line),V=vr(e,t.line,n),Y=new Rt(H.text,e.options.tabSize,V),ae;for(r&&(ae=[]);(r||Y.pos<t.ch)&&!Y.eol();)Y.start=Y.pos,N=yr(_,Y,V.state),r&&ae.push(new Yn(Y,N,Cr(i.mode,V.state)));return r?ae:new Yn(Y,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,_,N){var H=n.flattenSpans;H==null&&(H=e.options.flattenSpans);var V=0,Y=null,ae=new Rt(t,e.options.tabSize,r),ue,Te=e.options.addModeClass&&[null];for(t==""&&$n(Xn(n,r.state),_);!ae.eol();){if(ae.pos>e.options.maxHighlightLength?(H=!1,N&&Vn(e,t,r,ae.pos),ae.pos=t.length,ue=null):ue=$n(yr(n,ae,r.state,Te),_),Te){var be=Te[0].name;be&&(ue="m-"+(ue?be+" "+ue:be))}if(!H||Y!=ue){for(;V<ae.start;)V=Math.min(ae.start,V+5e3),i(V,Y);Y=ue}ae.start=ae.pos}for(;V<ae.pos;){var Re=Math.min(ae.pos,V+5e3);i(Re,Y),V=Re}}function Di(e,t,n){for(var r,i,_=e.doc,N=n?-1:t-(e.doc.mode.innerMode?1e3:100),H=t;H>N;--H){if(H<=_.first)return _.first;var V=nt(_,H-1),Y=V.stateAfter;if(Y&&(!n||H+(Y instanceof bn?Y.lookAhead:0)<=_.modeFrontier))return H;var ae=K(V.text,null,e.options.tabSize);(i==null||r>ae)&&(i=H-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 Li(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var _=e[i],N=_.marker,H=_.from==null||(N.inclusiveLeft?_.from<=t:_.from<t);if(H||_.from==t&&N.type=="bookmark"&&(!n||!_.marker.insertLeft)){var V=_.to==null||(N.inclusiveRight?_.to>=t:_.to>t);(r||(r=[])).push(new qr(N,_.from,V?null:_.to))}}return r}function Oi(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var _=e[i],N=_.marker,H=_.to==null||(N.inclusiveRight?_.to>=t:_.to>t);if(H||_.from==t&&N.type=="bookmark"&&(!n||_.marker.insertLeft)){var V=_.from==null||(N.inclusiveLeft?_.from<=t:_.from<t);(r||(r=[])).push(new qr(N,V?null:_.from-t,_.to==null?null:_.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.to.ch,N=dt(t.from,t.to)==0,H=Li(n,i,N),V=Oi(r,_,N),Y=t.text.length==1,ae=$(t.text).length+(Y?i:0);if(H)for(var ue=0;ue<H.length;++ue){var Te=H[ue];if(Te.to==null){var be=Er(V,Te.marker);be?Y&&(Te.to=be.to==null?null:be.to+ae):Te.to=i}}if(V)for(var Re=0;Re<V.length;++Re){var Fe=V[Re];if(Fe.to!=null&&(Fe.to+=ae),Fe.from==null){var ze=Er(H,Fe.marker);ze||(Fe.from=ae,Y&&(H||(H=[])).push(Fe))}else Fe.from+=ae,Y&&(H||(H=[])).push(Fe)}H&&(H=Ri(H)),V&&V!=H&&(V=Ri(V));var Ye=[H];if(!Y){var Ze=t.text.length-2,$e;if(Ze>0&&H)for(var tt=0;tt<H.length;++tt)H[tt].to==null&&($e||($e=[])).push(new qr(H[tt].marker,null,null));for(var ut=0;ut<Ze;++ut)Ye.push($e);Ye.push(V)}return Ye}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(be){if(be.markedSpans)for(var Re=0;Re<be.markedSpans.length;++Re){var Fe=be.markedSpans[Re].marker;Fe.readOnly&&(!r||ee(r,Fe)==-1)&&(r||(r=[])).push(Fe)}}),!r)return null;for(var i=[{from:t,to:n}],_=0;_<r.length;++_)for(var N=r[_],H=N.find(0),V=0;V<i.length;++V){var Y=i[V];if(dt(Y.to,H.from)<0||dt(Y.from,H.to)>0)continue;var ae=[V,1],ue=dt(Y.from,H.from),Te=dt(Y.to,H.to);(ue<0||!N.inclusiveLeft&&!ue)&&ae.push({from:Y.from,to:H.from}),(Te>0||!N.inclusiveRight&&!Te)&&ae.push({from:H.to,to:Y.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(),_=dt(r.from,i.from)||en(e)-en(t);if(_)return-_;var N=dt(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,_=0;_<n.length;++_)i=n[_],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 Fr(e){return kr(e,!1)}function _n(e,t){var n=$t&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var _=n[i];_.marker.collapsed&&(_.from==null||_.from<t)&&(_.to==null||_.to>t)&&(!r||Tn(r,_.marker)<0)&&(r=_.marker)}return r}function Mi(e,t,n,r,i){var _=nt(e,t),N=$t&&_.markedSpans;if(N)for(var H=0;H<N.length;++H){var V=N[H];if(!V.marker.collapsed)continue;var Y=V.marker.find(0),ae=dt(Y.from,n)||en(V.marker)-en(i),ue=dt(Y.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?dt(Y.to,n)>=0:dt(Y.to,n)>0)||ae>=0&&(V.marker.inclusiveRight&&i.inclusiveLeft?dt(Y.from,r)<=0:dt(Y.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=Fr(e);)e=t.find(1,!0).line;return e}function Sn(e){for(var t,n;t=Fr(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 Kr(e,t){if(t>e.lastLine())return t;var n=nt(e,t),r;if(!Ar(e,n))return t;for(;r=Fr(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,_=0;_<t.markedSpans.length;++_)if(i=t.markedSpans[_],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 _=n.parent;_;n=_,_=n.parent)for(var N=0;N<_.children.length;++N){var H=_.children[N];if(H==n)break;t+=H.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=Fr(r);){var _=n.find(0,!0);t-=r.text.length-_.from.ch,r=_.to.line,t+=r.text.length-_.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)},fe(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 ct={},lt={};function pt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?lt:ct;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Et(e,t){var n=y("span",null,null,k?"padding-right: .1px":null),r={pre:y("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 _=i?t.rest[i-1]:t.line,N=void 0;r.pos=0,r.addToken=vt,xt(e.display.measure)&&(N=He(_,e.doc.direction))&&(r.addToken=qt(r.addToken,N)),r.map=[];var H=t!=e.display.externalMeasured&&Tt(_);Ur(_,r,Zr(e,_,H)),_.styleClasses&&(_.styleClasses.bgClass&&(r.bgClass=B(_.styleClasses.bgClass,r.bgClass||"")),_.styleClasses.textClass&&(r.textClass=B(_.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(at(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 Oe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=B(r.pre.className,r.textClass||"")),r}function At(e){var t=o("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function vt(e,t,n,r,i,_,N){if(!t)return;var H=e.splitSpaces?Ut(t,e.trailingSpace):t,V=e.cm.state.specialChars,Y=!1,ae;if(!V.test(t))e.col+=t.length,ae=document.createTextNode(H),e.map.push(e.pos,e.pos+t.length,ae),j&&F<9&&(Y=!0),e.pos+=t.length;else{ae=document.createDocumentFragment();for(var ue=0;;){V.lastIndex=ue;var Te=V.exec(t),be=Te?Te.index-ue:t.length-ue;if(be){var Re=document.createTextNode(H.slice(ue,ue+be));j&&F<9?ae.appendChild(o("span",[Re])):ae.appendChild(Re),e.map.push(e.pos,e.pos+be,Re),e.col+=be,e.pos+=be}if(!Te)break;ue+=be+1;var Fe=void 0;if(Te[0]==" "){var ze=e.cm.options.tabSize,Ye=ze-e.col%ze;Fe=ae.appendChild(o("span",he(Ye),"cm-tab")),Fe.setAttribute("role","presentation"),Fe.setAttribute("cm-text"," "),e.col+=Ye}else Te[0]=="\r"||Te[0]==`
|
|
`?(Fe=ae.appendChild(o("span",Te[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Fe.setAttribute("cm-text",Te[0]),e.col+=1):(Fe=e.cm.options.specialCharPlaceholder(Te[0]),Fe.setAttribute("cm-text",Te[0]),j&&F<9?ae.appendChild(o("span",[Fe])):ae.appendChild(Fe),e.col+=1);e.map.push(e.pos,e.pos+1,Fe),e.pos++}}if(e.trailingSpace=H.charCodeAt(t.length-1)==32,n||r||i||Y||_||N){var Ze=n||"";r&&(Ze+=r),i&&(Ze+=i);var $e=o("span",[ae],Ze,_);if(N)for(var tt in N)N.hasOwnProperty(tt)&&tt!="style"&&tt!="class"&&$e.setAttribute(tt,N[tt]);return e.content.appendChild($e)}e.content.appendChild(ae)}function Ut(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var _=e.charAt(i);_==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(_="\xA0"),r+=_,n=_==" "}return r}function qt(e,t){return function(n,r,i,_,N,H,V){i=i?i+" cm-force-border":"cm-force-border";for(var Y=n.pos,ae=Y+r.length;;){for(var ue=void 0,Te=0;Te<t.length&&!(ue=t[Te],ue.to>Y&&ue.from<=Y);Te++);if(ue.to>=ae)return e(n,r,i,_,N,H,V);e(n,r.slice(0,ue.to-Y),i,_,null,H,V),_=null,r=r.slice(ue.to-Y),Y=ue.to}}}function gt(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 Ur(e,t,n){var r=e.markedSpans,i=e.text,_=0;if(!r){for(var N=1;N<n.length;N+=2)t.addToken(t,i.slice(_,_=n[N]),pt(n[N+1],t.cm.options));return}for(var H=i.length,V=0,Y=1,ae="",ue,Te,be=0,Re,Fe,ze,Ye,Ze;;){if(be==V){Re=Fe=ze=Te="",Ze=null,Ye=null,be=Infinity;for(var $e=[],tt=void 0,ut=0;ut<r.length;++ut){var ot=r[ut],mt=ot.marker;if(mt.type=="bookmark"&&ot.from==V&&mt.widgetNode)$e.push(mt);else if(ot.from<=V&&(ot.to==null||ot.to>V||mt.collapsed&&ot.to==V&&ot.from==V)){if(ot.to!=null&&ot.to!=V&&be>ot.to&&(be=ot.to,Fe=""),mt.className&&(Re+=" "+mt.className),mt.css&&(Te=(Te?Te+";":"")+mt.css),mt.startStyle&&ot.from==V&&(ze+=" "+mt.startStyle),mt.endStyle&&ot.to==be&&(tt||(tt=[])).push(mt.endStyle,ot.to),mt.title&&((Ze||(Ze={})).title=mt.title),mt.attributes)for(var Dt in mt.attributes)(Ze||(Ze={}))[Dt]=mt.attributes[Dt];mt.collapsed&&(!Ye||Tn(Ye.marker,mt)<0)&&(Ye=ot)}else ot.from>V&&be>ot.from&&(be=ot.from)}if(tt)for(var Kt=0;Kt<tt.length;Kt+=2)tt[Kt+1]==be&&(Fe+=" "+tt[Kt]);if(!Ye||Ye.from==V)for(var Ot=0;Ot<$e.length;++Ot)gt(t,0,$e[Ot]);if(Ye&&(Ye.from||0)==V){if(gt(t,(Ye.to==null?H+1:Ye.to)-V,Ye.marker,Ye.from==null),Ye.to==null)return;Ye.to==V&&(Ye=!1)}}if(V>=H)break;for(var sr=Math.min(H,be);;){if(ae){var nr=V+ae.length;if(!Ye){var kt=nr>sr?ae.slice(0,sr-V):ae;t.addToken(t,kt,ue?ue+Re:Re,ze,V+kt.length==be?Fe:"",Te,Ze)}if(nr>=sr){ae=ae.slice(sr-V),V=sr;break}V=nr,ze=""}ae=i.slice(_,_=n[Y++]),ue=pt(n[Y++],t.cm.options)}}}function _t(e,t,n){this.line=t,this.rest=Sn(t),this.size=this.rest?Tt($(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;_<n;_=i){var N=new _t(e.doc,nt(e.doc,_),_);i=_+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=qe(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 _=function(H){i.push(function(){return n[H].apply(null,r)})},N=0;N<n.length;++N)_(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.changes[i];_=="text"?ks(e,t):_=="gutter"?Ja(e,t,n,r):_=="class"?da(e,t):_=="widget"&&Is(e,t,r)}t.changes=null}function ri(e){return e.node==e.text&&(e.node=o("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),j&&F<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(o("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):Et(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=o("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.line.gutterMarkers;if(e.options.lineNumbers||_){var N=ri(t),H=t.gutter=o("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(H),N.insertBefore(H,t.text),t.line.gutterClass&&(H.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!_||!_["CodeMirror-linenumbers"])&&(t.lineNumber=H.appendChild(o("div",pn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),_)for(var V=0;V<e.display.gutterSpecs.length;++V){var Y=e.display.gutterSpecs[V].className,ae=_.hasOwnProperty(Y)&&_[Y];ae&&H.appendChild(o("div",[ae],"CodeMirror-gutter-elt","left: "+r.gutterLeft[Y]+"px; width: "+r.gutterWidth[Y]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=b("CodeMirror-linewidget"),i=t.node.firstChild,_=void 0;i;i=_)_=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Qa(e,t,n)}function Fs(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 _=ri(n),N=0,H=t.widgets;N<H.length;++N){var V=H[N],Y=o("div",[V.node],"CodeMirror-linewidget"+(V.className?" "+V.className:""));V.handleMouseEvents||Y.setAttribute("cm-ignore-events","true"),Us(V,Y,n,r),e.display.input.setUneditable(Y),i&&V.above?_.insertBefore(Y,n.gutter||n.text):_.appendChild(Y),Gt(V,"redraw")}}function Us(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(!x(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;"),d(t.display.measure,o("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Nr(e,t){for(var n=pe(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 Fi(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=d(e.measure,o("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 Dr(e){return oe-e.display.nativeBarWidth}function nn(e){return e.display.scroller.clientWidth-Dr(e)-e.display.barWidth}function fa(e){return e.display.scroller.clientHeight-Dr(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.measure.heights=[];if(r){t.measure.width=i;for(var N=t.text.firstChild.getClientRects(),H=0;H<N.length-1;H++){var V=N[H],Y=N[H+1];Math.abs(V.bottom-Y.bottom)>2&&_.push((V.bottom+Y.top)/2-n.top)}}_.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 _t(e.doc,t,n);r.lineN=n;var i=r.built=Et(e,r);return r.text=i.pre,d(e.display.lineMeasure,i.pre),r}function to(e,t,n,r){return Lr(e,wn(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 wn(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 Lr(e,t,n,r,i){t.before&&(n=-1);var _=n+(r||""),N;return t.cache.hasOwnProperty(_)?N=t.cache[_]:(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[_]=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,_,N,H,V,Y=0;Y<e.length;Y+=3)if(H=e[Y],V=e[Y+1],t<H?(i=0,_=1,N="left"):t<V?(i=t-H,_=i+1):(Y==e.length-3||t==V&&e[Y+3]>t)&&(_=V-H,i=_-1,t>=V&&(N="right")),i!=null){if(r=e[Y+2],H==V&&n==(r.insertLeft?"left":"right")&&(N=n),n=="left"&&i==0)for(;Y&&e[Y-2]==e[Y-3]&&e[Y-1].insertLeft;)r=e[(Y-=3)+2],N="left";if(n=="right"&&i==V-H)for(;Y<e.length-3&&e[Y+3]==e[Y+4]&&!e[Y+5].insertLeft;)r=e[(Y+=3)+2],N="right";break}return{node:r,start:i,end:_,collapse:N,coverStart:H,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),_=i.node,N=i.start,H=i.end,V=i.collapse,Y;if(_.nodeType==3){for(var ae=0;ae<4;ae++){for(;N&&Ce(t.line.text.charAt(i.coverStart+N));)--N;for(;i.coverStart+H<i.coverEnd&&Ce(t.line.text.charAt(i.coverStart+H));)++H;if(j&&F<9&&N==0&&H==i.coverEnd-i.coverStart?Y=_.parentNode.getBoundingClientRect():Y=js(m(_,N,H).getClientRects(),r),Y.left||Y.right||N==0)break;H=N,N=N-1,V="right"}j&&F<11&&(Y=Ks(e.display.measure,Y))}else{N>0&&(V=r="right");var ue;e.options.lineWrapping&&(ue=_.getClientRects()).length>1?Y=ue[r=="right"?ue.length-1:0]:Y=_.getBoundingClientRect()}if(j&&F<9&&!N&&(!Y||!Y.left&&!Y.right)){var Te=_.parentNode.getClientRects()[0];Te?Y={left:Te.left,right:Te.left+An(e.display),top:Te.top,bottom:Te.bottom}:Y=ro}for(var be=Y.top-t.rect.top,Re=Y.bottom-t.rect.top,Fe=(be+Re)/2,ze=t.view.measure.heights,Ye=0;Ye<ze.length-1&&!(Fe<ze[Ye]);Ye++);var Ze=Ye?ze[Ye-1]:0,$e=ze[Ye],tt={left:(V=="right"?Y.right:Y.left)-t.rect.left,right:(V=="left"?Y.left:Y.right)-t.rect.left,top:Ze,bottom:$e};return!Y.left&&!Y.right&&(tt.bogus=!0),e.options.singleCursorHeightPerLine||(tt.rtop=be,tt.rbottom=Re),tt}function Ks(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,f(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 v&&u?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return v&&u?-(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 Ui(e,t,n,r,i){if(!i){var _=ma(t);n.top+=_,n.bottom+=_}if(r=="line")return n;r||(r="local");var N=xr(t);if(r=="local"?N+=Fi(e.display):N-=e.display.viewOffset,r=="page"||r=="window"){var H=e.display.lineSpace.getBoundingClientRect();N+=H.top+(r=="window"?0:so());var V=H.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 _=e.display.sizer.getBoundingClientRect();r+=_.left,i+=_.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)),Ui(e,r,to(e,r,t.ch,i),n)}function Tr(e,t,n,r,i,_){r=r||nt(e.doc,t.line),i||(i=wn(e,r));function N(Re,Fe){var ze=Lr(e,i,Re,Fe?"right":"left",_);return Fe?ze.left=ze.right:ze.right=ze.left,Ui(e,r,ze,n)}var H=He(r,e.doc.direction),V=t.ch,Y=t.sticky;if(V>=r.text.length?(V=r.text.length,Y="before"):V<=0&&(V=0,Y="after"),!H)return N(Y=="before"?V-1:V,Y=="before");function ae(Re,Fe,ze){var Ye=H[Fe],Ze=Ye.level==1;return N(ze?Re-1:Re,Ze!=ze)}var ue=Pe(H,V,Y),Te=Ue,be=ae(V,ue,Y=="before");return Te!=null&&(be.other=ae(V,Te,Y!="before")),be}function uo(e,t){var n=0;t=ft(e.doc,t),e.options.lineWrapping||(n=An(e.display)*t.ch);var r=nt(e.doc,t.line),i=xr(r)+Fi(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function ga(e,t,n,r,i){var _=je(e,t,n);return _.xRel=i,r&&(_.outside=r),_}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),_=r.first+r.size-1;if(i>_)return ga(r.first+r.size-1,nt(r,_).text.length,null,1,1);t<0&&(t=0);for(var N=nt(r,i);;){var H=Hs(e,N,i,t,n),V=_n(N,H.ch+(H.xRel>0||H.outside>0?1:0));if(!V)return H;var Y=V.find(1);if(Y.line==i)return Y;N=nt(r,i=Y.line)}}function co(e,t,n,r){r-=ma(t);var i=t.text.length,_=Be(function(N){return Lr(e,n,N-1).bottom<=r},i,0);return i=Be(function(N){return Lr(e,n,N).top>r},_,i),{begin:_,end:i}}function fo(e,t,n,r){n||(n=wn(e,t));var i=Ui(e,t,Lr(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 Hs(e,t,n,r,i){i-=xr(t);var _=wn(e,t),N=ma(t),H=0,V=t.text.length,Y=!0,ae=He(t,e.doc.direction);if(ae){var ue=(e.options.lineWrapping?zs:Gs)(e,t,n,_,ae,r,i);Y=ue.level!=1,H=Y?ue.from:ue.to-1,V=Y?ue.to:ue.from-1}var Te=null,be=null,Re=Be(function(ut){var ot=Lr(e,_,ut);return ot.top+=N,ot.bottom+=N,ya(ot,r,i,!1)?(ot.top<=i&&ot.left<=r&&(Te=ut,be=ot),!0):!1},H,V),Fe,ze,Ye=!1;if(be){var Ze=r-be.left<be.right-r,$e=Ze==Y;Re=Te+($e?0:1),ze=$e?"after":"before",Fe=Ze?be.left:be.right}else{!Y&&(Re==V||Re==H)&&Re++,ze=Re==0?"after":Re==t.text.length?"before":Lr(e,_,Re-(Y?1:0)).bottom+N<=i==Y?"after":"before";var tt=Tr(e,je(n,Re,ze),"line",t,_);Fe=tt.left,Ye=i<tt.top?-1:i>=tt.bottom?1:0}return Re=we(t.text,Re,1),ga(n,Re,ze,Ye,r-Fe)}function Gs(e,t,n,r,i,_,N){var H=Be(function(ue){var Te=i[ue],be=Te.level!=1;return ya(Tr(e,je(n,be?Te.to:Te.from,be?"before":"after"),"line",t,r),_,N,!0)},0,i.length-1),V=i[H];if(H>0){var Y=V.level!=1,ae=Tr(e,je(n,Y?V.from:V.to,Y?"after":"before"),"line",t,r);ya(ae,_,N,!0)&&ae.top>N&&(V=i[H-1])}return V}function zs(e,t,n,r,i,_,N){var H=co(e,t,r,N),V=H.begin,Y=H.end;/\s/.test(t.text.charAt(Y-1))&&Y--;for(var ae=null,ue=null,Te=0;Te<i.length;Te++){var be=i[Te];if(be.from>=Y||be.to<=V)continue;var Re=be.level!=1,Fe=Lr(e,r,Re?Math.min(Y,be.to)-1:Math.max(V,be.from)).right,ze=Fe<_?_-Fe+1e9:Fe-_;(!ae||ue>ze)&&(ae=be,ue=ze)}return ae||(ae=i[i.length-1]),ae.from<V&&(ae={from:V,to:ae.to,level:ae.level}),ae.to>Y&&(ae={from:ae.from,to:Y,level:ae.level}),ae}var an;function Cn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(an==null){an=o("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)an.appendChild(document.createTextNode("x")),an.appendChild(o("br"));an.appendChild(document.createTextNode("x"))}d(e.measure,an);var n=an.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),f(e.measure),n||1}function An(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=o("span","xxxxxxxxxx"),n=o("pre",[t],"CodeMirror-line-like");d(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.gutters.firstChild,N=0;_;_=_.nextSibling,++N){var H=e.display.gutterSpecs[N].className;n[H]=_.offsetLeft+_.clientLeft+i,r[H]=_.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 _=0;if(i.widgets)for(var N=0;N<i.widgets.length;N++)i.widgets[N].height&&(_+=i.widgets[N].height);return n?_+(Math.ceil(i.text.length/r)||1)*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&&pe(t).getAttribute("cm-not-content")=="true")return null;var _,N,H=i.lineSpace.getBoundingClientRect();try{_=t.clientX-H.left,N=t.clientY-H.top}catch(ue){return null}var V=va(e,_,N),Y;if(r&&V.xRel>0&&(Y=nt(e.doc,V.line).text).length==V.ch){var ae=K(Y,Y.length,e.options.tabSize)-Y.length;V=je(V.line,Math.max(0,Math.round((_-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&&Kr(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 _=Ni(e,n,n+r,1);_?(i.view=i.view.slice(_.index),i.viewFrom=_.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 H=Ni(e,t,t,-1),V=Ni(e,n,n+r,1);H&&V?(i.view=i.view.slice(0,H.index).concat(er(e,H.lineN,V.lineN)).concat(i.view.slice(V.index)),i.viewTo+=r):Gr(e)}var Y=i.externalMeasured;Y&&(n<Y.lineN?Y.lineN+=r:t<Y.lineN+Y.size&&(i.externalMeasured=null))}function Hr(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 _=r.view[sn(e,t)];if(_.node==null)return;var N=_.changes||(_.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),_,N=e.display.view;if(!$t||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var H=e.display.viewFrom,V=0;V<i;V++)H+=N[V].size;if(H!=t){if(r>0){if(i==N.length-1)return null;_=H+N[i].size-t,i++}else _=H-t;t+=_,n+=_}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(),_=r.selection=document.createDocumentFragment(),N=0;N<n.sel.ranges.length;N++){if(!t&&N==n.sel.primIndex)continue;var H=n.sel.ranges[N];if(H.from().line>=e.display.viewTo||H.to().line<e.display.viewFrom)continue;var V=H.empty();(V||e.options.showCursorWhenSelecting)&&go(e,H.head,i),V||Xs(e,H,_)}return r}function go(e,t,n){var r=Tr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(o("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 _=n.appendChild(o("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));_.style.display="",_.style.left=r.other.left+"px",_.style.top=r.other.top+"px",_.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,_=document.createDocumentFragment(),N=qa(e.display),H=N.left,V=Math.max(r.sizerWidth,nn(e)-r.sizer.offsetLeft)-N.right,Y=i.direction=="ltr";function ae($e,tt,ut,ot){tt<0&&(tt=0),tt=Math.round(tt),ot=Math.round(ot),_.appendChild(o("div",null,"CodeMirror-selected","position: absolute; left: "+$e+`px;
|
|
top: `+tt+"px; width: "+(ut==null?V-$e:ut)+`px;
|
|
height: `+(ot-tt)+"px"))}function ue($e,tt,ut){var ot=nt(i,$e),mt=ot.text.length,Dt,Kt;function Ot(kt,ir){return pa(e,je($e,kt),"div",ot,ir)}function sr(kt,ir,zt){var Nt=fo(e,ot,null,kt),It=ir=="ltr"==(zt=="after")?"left":"right",Pt=zt=="after"?Nt.begin:Nt.end-(/\s/.test(ot.text.charAt(Nt.end-1))?2:1);return Ot(Pt,It)[It]}var nr=He(ot,i.direction);return Ke(nr,tt||0,ut==null?mt:ut,function(kt,ir,zt,Nt){var It=zt=="ltr",Pt=Ot(kt,It?"left":"right"),ar=Ot(ir-1,It?"right":"left"),jn=tt==null&&kt==0,Jr=ut==null&&ir==mt,Yt=Nt==0,Or=!nr||Nt==nr.length-1;if(ar.top-Pt.top<=3){var Ht=(Y?jn:Jr)&&Yt,Va=(Y?Jr:jn)&&Or,jr=Ht?H:(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=Y&&jn&&Yt?H:Pt.left,Qt=Y?V:sr(kt,zt,"before"),Wn=Y?H:sr(ir,zt,"after"),Xa=Y&&Jr&&Or?V:ar.right):(hn=Y?sr(kt,zt,"before"):H,Qt=!Y&&jn&&Yt?V:Pt.right,Wn=!Y&&Jr&&Or?H:ar.left,Xa=Y?sr(ir,zt,"after"):V),ae(hn,Pt.top,Qt-hn,Pt.bottom),Pt.bottom<ar.top&&ae(H,Pt.bottom,null,ar.top),ae(Wn,ar.top,Xa-Wn,ar.bottom)}(!Dt||Bi(Pt,Dt)<0)&&(Dt=Pt),Bi(ar,Dt)<0&&(Dt=ar),(!Kt||Bi(Pt,Kt)<0)&&(Kt=Pt),Bi(ar,Kt)<0&&(Kt=ar)}),{start:Dt,end:Kt}}var Te=t.from(),be=t.to();if(Te.line==be.line)ue(Te.line,Te.ch,be.ch);else{var Re=nt(i,Te.line),Fe=nt(i,be.line),ze=ur(Re)==ur(Fe),Ye=ue(Te.line,Te.ch,ze?Re.text.length+1:null).end,Ze=ue(be.line,ze?0:null,be.ch).start;ze&&(Ye.top<Ze.top-2?(ae(Ye.right,Ye.top,null,Ye.bottom),ae(H,Ze.top,Ze.left,Ze.bottom)):ae(Ye.right,Ye.top,Ze.left-Ye.right,Ye.bottom)),Ye.bottom<Ze.top&&ae(H,Ye.bottom,null,Ze.top)}n.appendChild(_)}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()||Dn(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(),_a(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Dn(e))},100)}function _a(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Oe(e,"focus",e,t),e.state.focused=!0,U(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 Dn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Oe(e,"blur",e,t),e.state.focused=!1,c(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],_=e.options.lineWrapping,N=void 0,H=0;if(i.hidden)continue;if(j&&F<8){var V=i.node.offsetTop+i.node.offsetHeight;N=V-n,n=V}else{var Y=i.node.getBoundingClientRect();N=Y.bottom-Y.top,!_&&i.text.firstChild&&(H=i.text.firstChild.getBoundingClientRect().right-Y.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(H>e.display.sizerWidth){var Te=Math.ceil(H/An(e.display));Te>e.display.maxLineLength&&(e.display.maxLineLength=Te,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-Fi(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,_=gr(t,r),N=gr(t,i);if(n&&n.ensure){var H=n.ensure.from.line,V=n.ensure.to.line;H<_?(_=H,N=gr(t,xr(nt(t,H))+e.wrapper.clientHeight)):Math.min(V,t.lastLine())>=N&&(_=gr(t,xr(nt(t,V))-e.wrapper.clientHeight),N=V)}return{from:_,to:Math.max(N,_+1)}}function Ys(e,t){if(Ne(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&&!E){var _=o("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Fi(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Dr(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(_),_.scrollIntoView(i),e.display.lineSpace.removeChild(_)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?je(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?je(t.line,t.ch+1,"before"):t);for(var _=0;_<5;_++){var N=!1,H=Tr(e,t),V=!n||n==t?H:Tr(e,n);i={left:Math.min(H.left,V.left),top:Math.min(H.top,V.top)-r,right:Math.max(H.left,V.left),bottom:Math.max(H.bottom,V.bottom)+r};var Y=Sa(e,i),ae=e.doc.scrollTop,ue=e.doc.scrollLeft;if(Y.scrollTop!=null&&(si(e,Y.scrollTop),Math.abs(e.doc.scrollTop-ae)>1&&(N=!0)),Y.scrollLeft!=null&&(ln(e,Y.scrollLeft),Math.abs(e.doc.scrollLeft-ue)>1&&(N=!0)),!N)break}return i}function Js(e,t){var n=Sa(e,t);n.scrollTop!=null&&si(e,n.scrollTop),n.scrollLeft!=null&&ln(e,n.scrollLeft)}function Sa(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,_=fa(e),N={};t.bottom-t.top>_&&(t.bottom=t.top+_);var H=e.doc.height+ca(n),V=t.top<r,Y=t.bottom>H-r;if(t.top<i)N.scrollTop=V?0:t.top;else if(t.bottom>i+_){var ae=Math.min(t.top,(Y?H:t.bottom)-_);ae!=i&&(N.scrollTop=ae)}var ue=e.options.fixedGutter?0:n.gutters.offsetWidth,Te=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ue,be=nn(e)-n.gutters.offsetWidth,Re=t.right-t.left>be;return Re&&(t.right=t.left+be),t.left<10?N.scrollLeft=0:t.left<Te?N.scrollLeft=Math.max(0,t.left+ue-(Re?0:10)):t.right>be+Te-3&&(N.scrollLeft=t.right+(Re?0:10)-be),N}function wa(e,t){if(t==null)return;Ki(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Ln(e){Ki(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)&&Ki(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Qs(e,t){Ki(e),e.curOp.scrollToPos=t}function Ki(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=Sa(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;A||Aa(e,{top:t}),xo(e,t,!0),A&&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+Dr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var un=function(e,t,n){this.cm=n;var r=this.vert=o("div",[o("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=o("div",[o("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Ae(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Ae(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,j&&F<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 _=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+_)+"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=s&&!T?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new X,this.disableVert=new X},un.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),_=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);_!=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 _o={native:un,null:ui};function So(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&c(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new _o[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ae(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?ln(e,t):si(e,t)},e),e.display.scrollbars.addClass&&U(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 _=0;_<t.length;_++)nl(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 Hi(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+Dr(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==P();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&On(t,e.barMeasure),e.updatedDisplay&&La(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&&wo(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,ft(r,e.scrollToPos.from),ft(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var _=e.maybeHiddenMarkers,N=e.maybeUnhiddenMarkers;if(_)for(var H=0;H<_.length;++H)_[H].lines.length||Oe(_[H],"hide");if(N)for(var V=0;V<N.length;++V)N[V].lines.length&&Oe(N[V],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Oe(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,O(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(_){if(r.line>=e.display.viewFrom){var N=_.styles,H=_.text.length>e.options.maxHighlightLength?Cr(t.mode,r.state):null,V=zn(e,_,r,!0);H&&(r.state=H),_.styles=V.styles;var Y=_.styleClasses,ae=V.classes;ae?_.styleClasses=ae:Y&&(_.styleClasses=null);for(var ue=!N||N.length!=_.styles.length||Y!=ae&&(!Y||!ae||Y.bgClass!=ae.bgClass||Y.textClass!=ae.textClass),Te=0;!ue&&Te<N.length;++Te)ue=N[Te]!=_.styles[Te];ue&&i.push(r.line),_.stateAfter=r.save(),r.nextLine()}else _.text.length<=e.options.maxHighlightLength&&Vn(e,_.text,r),_.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 _=0;_<i.length;_++)Hr(e,i[_],"text")})}var Hi=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=[]};Hi.prototype.signal=function(e,t){ce(e,t)&&this.events.push(arguments)},Hi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Oe.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=Dr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Dr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=P();if(!t||!x(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&x(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==P())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&x(document.body,e.anchorNode)&&x(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,_=Math.max(t.visible.from-e.options.viewportMargin,r.first),N=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<_&&_-n.viewFrom<20&&(_=Math.max(r.first,n.viewFrom)),n.viewTo>N&&n.viewTo-N<20&&(N=Math.min(i,n.viewTo)),$t&&(_=Zn(e.doc,_),N=Kr(e.doc,N));var H=_!=n.viewFrom||N!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,_,N),n.viewOffset=xr(nt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var V=mo(e);if(!H&&V==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var Y=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(Y),f(n.cursorDiv),f(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,H&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,di(e,400)),n.updateLineNumbers=null,!0}function wo(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),La(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 Hi(e,t);if(Ca(e,n)){ji(e),wo(e,n);var r=li(e);ai(e),On(e,r),La(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,_=r.lineDiv,N=_.firstChild;function H(Re){var Fe=Re.nextSibling;return k&&s&&e.display.currentWheelTarget==Re?Re.style.display="none":Re.parentNode.removeChild(Re),Fe}for(var V=r.view,Y=r.viewFrom,ae=0;ae<V.length;ae++){var ue=V[ae];if(!ue.hidden)if(!ue.node||ue.node.parentNode!=_){var Te=Fs(e,ue,Y,n);_.insertBefore(Te,N)}else{for(;N!=ue.node;)N=H(N);var be=i&&t!=null&&t<=Y&&ue.lineNumber;ue.changes&&(ee(ue.changes,"gutter")>-1&&(be=!1),Ya(e,ue,Y,n)),be&&(f(ue.lineNumber),ue.lineNumber.appendChild(document.createTextNode(pn(e.options,Y)))),N=ue.node.nextSibling}Y+=ue.size}for(;N;)N=H(N)}function Da(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function La(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+Dr(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,_=r+"px",N=0;N<n.length;N++)if(!n[N].hidden){e.options.fixedGutter&&(n[N].gutter&&(n[N].gutter.style.left=_),n[N].gutterBackground&&(n[N].gutterBackground.style.left=_));var H=n[N].alignable;if(H)for(var V=0;V<H.length;V++)H[V].style.left=_}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(o("div",[o("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),_=i.firstChild.offsetWidth,N=i.offsetWidth-_;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(_,r.lineGutter.offsetWidth-N)+1,r.lineNumWidth=r.lineNumInnerWidth+N,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Da(e.display),!0}return!1}function Oa(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var _=e[i],N=null;if(typeof _!="string"&&(N=_.style,_=_.className),_=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:_,style:N})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Do(e){var t=e.gutters,n=e.gutterSpecs;f(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],_=i.className,N=i.style,H=t.appendChild(o("div",null,"CodeMirror-gutter "+_));N&&(H.style.cssText=N),_=="CodeMirror-linenumbers"&&(e.lineGutter=H,H.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Da(e)}function ci(e){Do(e.display),tr(e),Co(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=o("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=o("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=y("div",null,"CodeMirror-code"),i.selectionDiv=o("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=o("div",null,"CodeMirror-cursors"),i.measure=o("div",null,"CodeMirror-measure"),i.lineMeasure=o("div",null,"CodeMirror-measure"),i.lineSpace=y("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var _=y("div",[i.lineSpace],"CodeMirror-lines");i.mover=o("div",[_],null,"position: relative"),i.sizer=o("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=o("div",null,null,"position: absolute; height: "+oe+"px; width: 1px;"),i.gutters=o("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=o("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=o("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),j&&F<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!k&&!(A&&a)&&(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),Do(i),n.init(i)}var Gi=0,dr=null;j?dr=-.53:A?dr=15:v?dr=-.7:D&&(dr=-1/3);function Lo(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=Lo(e);return t.x*=dr,t.y*=dr,t}function Oo(e,t){var n=Lo(t),r=n.x,i=n.y,_=e.display,N=_.scroller,H=N.scrollWidth>N.clientWidth,V=N.scrollHeight>N.clientHeight;if(!(r&&H||i&&V))return;if(i&&s&&k){e:for(var Y=t.target,ae=_.view;Y!=N;Y=Y.parentNode)for(var ue=0;ue<ae.length;ue++)if(ae[ue].node==Y){e.display.currentWheelTarget=Y;break e}}if(r&&!A&&!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)&&J(t),_.wheelStartX=null;return}if(i&&dr!=null){var Te=i*dr,be=e.doc.scrollTop,Re=be+_.wrapper.clientHeight;Te<0?be=Math.max(0,be+Te-50):Re=Math.min(e.doc.height,Re+Te+50),Aa(e,{top:be,bottom:Re})}Gi<20&&(_.wheelStartX==null?(_.wheelStartX=N.scrollLeft,_.wheelStartY=N.scrollTop,_.wheelDX=r,_.wheelDY=i,setTimeout(function(){if(_.wheelStartX==null)return;var Fe=N.scrollLeft-_.wheelStartX,ze=N.scrollTop-_.wheelStartY,Ye=ze&&_.wheelDY&&ze/_.wheelDY||Fe&&_.wheelDX&&Fe/_.wheelDX;if(_.wheelStartX=_.wheelStartY=null,!Ye)return;dr=(dr*Gi+Ye)/(Gi+1),++Gi},200)):(_.wheelDX+=r,_.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 St(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(dt(t,r.from())>=0&&dt(e,r.to())<=0)return n}return-1};var St=function(e,t){this.anchor=e,this.head=t};St.prototype.from=function(){return Qr(this.anchor,this.head)},St.prototype.to=function(){return vn(this.anchor,this.head)},St.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function _r(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(Te,be){return dt(Te.from(),be.from())}),n=ee(t,i);for(var _=1;_<t.length;_++){var N=t[_],H=t[_-1],V=dt(H.to(),N.from());if(r&&!N.empty()?V>0:V>=0){var Y=Qr(H.from(),N.from()),ae=vn(H.to(),N.to()),ue=H.empty()?N.from()==N.head:H.from()==H.head;_<=n&&--n,t.splice(--_,2,new St(ue?ae:Y,ue?Y:ae))}}return new cr(t,n)}function zr(e,t){return new cr([new St(e,t||e)],0)}function Vr(e){return e.text?je(e.from.line+e.text.length-1,$(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ro(e,t){if(dt(e,t.from)<0)return e;if(dt(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),je(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 St(Ro(i.anchor,t),Ro(i.head,t)))}return _r(e.cm,n,e.sel.primIndex)}function Po(e,t,n){return e.line==t.line?je(n.line,e.ch-t.ch+n.ch):je(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=je(e.first,0),_=i,N=0;N<t.length;N++){var H=t[N],V=Po(H.from,i,_),Y=Po(Vr(H),i,_);if(i=H.to,_=Y,n=="around"){var ae=e.sel.ranges[N],ue=dt(ae.head,ae.anchor)<0;r[N]=new St(ue?Y:V,ue?V:Y)}else r[N]=new St(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&&$(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ma(e,t,n,r){function i(Ze){return n?n[Ze]:null}function _(Ze,$e,tt){ua(Ze,$e,tt,r),Gt(Ze,"change",Ze,t)}function N(Ze,$e){for(var tt=[],ut=Ze;ut<$e;++ut)tt.push(new rn(Y[ut],i(ut),r));return tt}var H=t.from,V=t.to,Y=t.text,ae=nt(e,H.line),ue=nt(e,V.line),Te=$(Y),be=i(Y.length-1),Re=V.line-H.line;if(t.full)e.insert(0,N(0,Y.length)),e.remove(Y.length,e.size-Y.length);else if(Mo(e,t)){var Fe=N(0,Y.length-1);_(ue,ue.text,be),Re&&e.remove(H.line,Re),Fe.length&&e.insert(H.line,Fe)}else if(ae==ue)if(Y.length==1)_(ae,ae.text.slice(0,H.ch)+Te+ae.text.slice(V.ch),be);else{var ze=N(1,Y.length-1);ze.push(new rn(Te+ae.text.slice(V.ch),be,r)),_(ae,ae.text.slice(0,H.ch)+Y[0],i(0)),e.insert(H.line+1,ze)}else if(Y.length==1)_(ae,ae.text.slice(0,H.ch)+Y[0]+ue.text.slice(V.ch),i(0)),e.remove(H.line+1,Re);else{_(ae,ae.text.slice(0,H.ch)+Y[0],i(0)),_(ue,Te+ue.text.slice(V.ch),be);var Ye=N(1,Y.length-1);Re>1&&e.remove(H.line+1,Re-1),e.insert(H.line+1,Ye)}Gt(e,"change",e,t)}function Xr(e,t,n){function r(i,_,N){if(i.linked)for(var H=0;H<i.linked.length;++H){var V=i.linked[H];if(V.doc==_)continue;var Y=N&&V.sharedHist;if(n&&!Y)continue;t(V.doc,Y),r(V.doc,i,Y)}}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"?U:c)(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 Fo(e){for(;e.length;){var t=$(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Fo(e.done),$(e.done);if(e.done.length&&!$(e.done).ranges)return $(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),$(e.done)}function Uo(e,t,n,r){var i=e.history;i.undone.length=0;var _=+new Date,N,H;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>_-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(N=ml(i,i.lastOp==r)))H=$(N.changes),dt(t.from,t.to)==0&&dt(t.from,H.to)==0?H.to=Vr(t):N.changes.push(ka(e,t));else{var V=$(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=_,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,H||Oe(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,_=r&&r.origin;n==i.lastSelOp||_&&i.lastSelOrigin==_&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==_||pl(e,_,$(i.done),t))?i.done[i.done.length-1]=t:Vi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=_,i.lastSelOp=n,r&&r.clearRedo!==!1&&Fo(i.undone)}function Vi(e,t){var n=$(t);n&&n.ranges&&n.equals(e)||t.push(e)}function No(e,t,n,r){var i=t["spans_"+e.id],_=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]={}))[_]=N.markedSpans),++_})}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 _=n[i],N=r[i];if(_&&N){e:for(var H=0;H<N.length;++H){for(var V=N[H],Y=0;Y<_.length;++Y)if(_[Y].marker==V.marker)continue e;_.push(V)}}else N&&(n[i]=N)}return n}function Rn(e,t,n){for(var r=[],i=0;i<e.length;++i){var _=e[i];if(_.ranges){r.push(n?cr.prototype.deepCopy.call(_):_);continue}var N=_.changes,H=[];r.push({changes:H});for(var V=0;V<N.length;++V){var Y=N[V],ae=void 0;if(H.push({from:Y.from,to:Y.to,text:Y.text}),t)for(var ue in Y)(ae=ue.match(/^spans_(\d+)$/))&&(ee(t,Number(ae[1]))>-1&&($(H)[ue]=Y[ue],delete Y[ue]))}}return r}function Ia(e,t,n,r){if(r){var i=e.anchor;if(n){var _=dt(t,i)<0;_!=dt(n,i)<0?(i=t,t=n):_!=dt(t,n)<0&&(t=n)}return new St(i,t)}else return new St(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),_=0;_<e.sel.ranges.length;_++)r[_]=Ia(e.sel.ranges[_],t[_],null,i);var N=_r(e.cm,r,e.sel.primIndex);Xt(e,N,n)}function Fa(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Xt(e,_r(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 _=0;_<i.length;_++)this.ranges[_]=new St(ft(e,i[_].anchor),ft(e,i[_].head))},origin:n&&n.origin};return Oe(e,"beforeSelectionChange",e,r),e.cm&&Oe(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?_r(e.cm,r.ranges,r.ranges.length-1):t}function Ko(e,t,n){var r=e.history.done,i=$(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){(ce(e,"beforeSelectionChange")||e.cm&&ce(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(dt(t.primary().head,e.sel.primary().head)<0?-1:1);Ho(e,zo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Ln(e.cm)}function Ho(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ve(e.cm)),Gt(e,"cursorActivity",e)}function Go(e){Ho(e,zo(e,e.sel,null,!1))}function zo(e,t,n,r){for(var i,_=0;_<t.ranges.length;_++){var N=t.ranges[_],H=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[_],V=$i(e,N.anchor,H&&H.anchor,n,r),Y=$i(e,N.head,H&&H.head,n,r);(i||V!=N.anchor||Y!=N.head)&&(i||(i=t.ranges.slice(0,_)),i[_]=new St(V,Y))}return i?_r(e.cm,i,t.primIndex):t}function Pn(e,t,n,r,i){var _=nt(e,t.line);if(_.markedSpans)for(var N=0;N<_.markedSpans.length;++N){var H=_.markedSpans[N],V=H.marker,Y="selectLeft"in V?!V.selectLeft:V.inclusiveLeft,ae="selectRight"in V?!V.selectRight:V.inclusiveRight;if((H.from==null||(Y?H.from<=t.ch:H.from<t.ch))&&(H.to==null||(ae?H.to>=t.ch:H.to>t.ch))){if(i&&(Oe(V,"beforeCursorEnter"),V.explicitlyCleared))if(_.markedSpans){--N;continue}else break;if(!V.atomic)continue;if(n){var ue=V.find(r<0?1:-1),Te=void 0;if((r<0?ae:Y)&&(ue=Vo(e,ue,-r,ue&&ue.line==t.line?_:null)),ue&&ue.line==t.line&&(Te=dt(ue,n))&&(r<0?Te<0:Te>0))return Pn(e,ue,t,r,i)}var be=V.find(r<0?-1:1);return(r<0?Y:ae)&&(be=Vo(e,be,r,be.line==t.line?_:null)),be?Pn(e,be,t,r,i):null}}return t}function $i(e,t,n,r,i){var _=r||1,N=Pn(e,t,n,_,i)||!i&&Pn(e,t,n,_,!0)||Pn(e,t,n,-_,i)||!i&&Pn(e,t,n,-_,!0);return N||(e.cantEdit=!0,je(e.first,0))}function Vo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ft(e,je(t.line-1)):null:n>0&&t.ch==(r||nt(e,t.line)).text.length?t.line<e.first+e.size-1?je(t.line+1,0):null:new je(t.line,t.ch+n)}function Xo(e){e.setSelection(je(e.firstLine(),0),je(e.lastLine()),me)}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,_,N,H){i&&(r.from=ft(e,i)),_&&(r.to=ft(e,_)),N&&(r.text=N),H!==void 0&&(r.origin=H)}),Oe(e,"beforeChange",e,r),e.cm&&Oe(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((ce(e,"beforeChange")||e.cm&&ce(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]==""&&dt(t.from,t.to)==0)return;var n=Ra(e,t);Uo(e,t,n,e.cm?e.cm.curOp.id:NaN),hi(e,t,n,En(e,t));var r=[];Xr(e,function(i,_){!_&&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,_,N=e.sel,H=t=="undo"?i.done:i.undone,V=t=="undo"?i.undone:i.done,Y=0;Y<H.length&&!(_=H[Y],n?_.ranges&&!_.equals(e.sel):!_.ranges);Y++);if(Y==H.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(_=H.pop(),_.ranges){if(Vi(_,V),n&&!_.equals(e.sel)){Xt(e,_,{clearRedo:!1});return}N=_}else if(r){H.push(_);return}else break;var ae=[];Vi(N,V),V.push({changes:ae,generation:i.generation}),i.generation=_.generation||++i.maxGeneration;for(var ue=ce(e,"beforeChange")||e.cm&&ce(e.cm,"beforeChange"),Te=function(Fe){var ze=_.changes[Fe];if(ze.origin=t,ue&&!Yo(e,ze,!1))return H.length=0,{};ae.push(ka(e,ze));var Ye=Fe?Ra(e,ze):$(H);hi(e,ze,Ye,Bo(e,ze)),!Fe&&e.cm&&e.cm.scrollIntoView({from:ze.from,to:Vr(ze)});var Ze=[];Xr(e,function($e,tt){!tt&&ee(Ze,$e.history)==-1&&(qo($e.history,ze),Ze.push($e.history)),hi($e,ze,null,Bo($e,ze))})},be=_.changes.length-1;be>=0;--be){var Re=Te(be);if(Re)return Re.v}}function Jo(e,t){if(t==0)return;if(e.first+=t,e.sel=new cr(ie(e.sel.ranges,function(i){return new St(je(i.anchor.line+t,i.anchor.ch),je(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++)Hr(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:je(e.first,0),to:je(t.to.line+i,t.to.ch),text:[$(t.text)],origin:t.origin}}var _=e.lastLine();t.to.line>_&&(t={from:t.from,to:je(_,nt(e,_).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,me),e.cantEdit&&$i(e,je(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,_=t.from,N=t.to,H=!1,V=_.line;e.options.lineWrapping||(V=Tt(ur(nt(r,_.line))),r.iter(V,N.line+1,function(be){if(be==i.maxLine)return H=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ve(e),Ma(r,t,n,ho(e)),e.options.lineWrapping||(r.iter(V,_.line+t.text.length,function(be){var Re=ei(be);Re>i.maxLineLength&&(i.maxLine=be,i.maxLineLength=Re,i.maxLineChanged=!0,H=!1)}),H&&(e.curOp.updateMaxLine=!0)),aa(r,_.line),di(e,400);var Y=t.text.length-(N.line-_.line)-1;t.full?tr(e):_.line==N.line&&t.text.length==1&&!Mo(e.doc,t)?Hr(e,_.line,"text"):tr(e,_.line,N.line+1,Y);var ae=ce(e,"changes"),ue=ce(e,"change");if(ue||ae){var Te={from:_,to:N,text:t.text,removed:t.removed,origin:t.origin};ue&&Gt(e,"change",e,Te),ae&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Te)}e.display.selForContextMenu=null}function kn(e,t,n,r,i){var _;r||(r=n),dt(r,n)<0&&(_=[r,n],n=_[0],r=_[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 _=e[i],N=!0;if(_.ranges){_.copied||(_=e[i]=_.deepCopy(),_.copied=!0);for(var H=0;H<_.ranges.length;H++)Qo(_.ranges[H].anchor,t,n,r),Qo(_.ranges[H].head,t,n,r);continue}for(var V=0;V<_.changes.length;++V){var Y=_.changes[V];if(n<Y.from.line)Y.from=je(Y.from.line+r,Y.from.ch),Y.to=je(Y.to.line+r,Y.to.ch);else if(t<=Y.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;return typeof t=="number"?_=nt(e,yn(e,t)):i=Tt(t),i==null?null:(r(_,i)&&e.cm&&Hr(e.cm,i,n),_)}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 _=Math.min(t,i-e),N=r.height;if(r.removeInner(e,_),this.height-=N-r.height,i==_&&(this.children.splice(n--,1),r.parent=null),(t-=_)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof pi))){var H=[];this.collapse(H),this.children=[new pi(H)],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],_=i.chunkSize();if(e<=_){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var N=i.lines.length%25+25,H=N;H<i.lines.length;){var V=new pi(i.lines.slice(H,H+=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-=_}},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],_=i.chunkSize();if(e<_){var N=Math.min(t,_-e);if(i.iterN(e,N,n))return!0;if((t-=N)==0)break;e=0}else e-=_}}};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 _=ni(this);Zt(n,Math.max(0,n.height-_)),e&&(or(e,function(){es(e,n,-_),Hr(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))})},fe(vi);function es(e,t,n){xr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&wa(e,n)}function xl(e,t,n,r){var i=new vi(e,n,r),_=e.cm;return _&&i.noHScroll&&(_.display.alignWidgets=!0),mi(e,t,"widget",function(N){var H=N.widgets||(N.widgets=[]);if(i.insertAt==null?H.push(i):H.splice(Math.min(H.length-1,Math.max(0,i.insertAt)),0,i),i.line=N,_&&!Ar(e,N)){var V=xr(N)<e.scrollTop;Zt(N,N.height+ni(i)),V&&wa(_,i.height),_.curOp.forceUpdate=!0}return!0}),_&&Gt(_,"lineWidgetAdded",_,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),ce(this,"clear")){var n=this.find();n&&Gt(this,"clear",n.from,n.to)}for(var r=null,i=null,_=0;_<this.lines.length;++_){var N=this.lines[_],H=Er(N.markedSpans,this);e&&!this.collapsed?Hr(e,Tt(N),"text"):e&&(H.to!=null&&(i=Tt(N)),H.from!=null&&(r=Tt(N))),N.markedSpans=Qn(N.markedSpans,H),H.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 Y=ur(this.lines[V]),ae=ei(Y);ae>e.display.maxLineLength&&(e.display.maxLine=Y,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 _=this.lines[i],N=Er(_.markedSpans,this);if(N.from!=null&&(n=je(t?_:Tt(_),N.from),e==-1))return n;if(N.to!=null&&(r=je(t?_:Tt(_),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,_=Tt(t.line),N=ha(r,_);if(N&&(io(N),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Ar(n.doc,i)&&n.height!=null){var H=n.height;n.height=null;var V=ni(n)-H;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)}},fe(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 _=new Yr(e,i),N=dt(t,n);if(r&&M(r,_,!1),N>0||N==0&&_.clearWhenEmpty!==!1)return _;if(_.replacedWith&&(_.collapsed=!0,_.widgetNode=y("span",[_.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||_.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(_.widgetNode.insertLeft=!0)),_.collapsed){if(Mi(e,t.line,t,n,_)||t.line!=n.line&&Mi(e,n.line,t,n,_))throw new Error("Inserting collapsed marker partially overlapping an existing one");oa()}_.addToHistory&&Uo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var H=t.line,V=e.cm,Y;if(e.iter(H,n.line+1,function(ue){V&&_.collapsed&&!V.options.lineWrapping&&ur(ue)==V.display.maxLine&&(Y=!0),_.collapsed&&H!=t.line&&Zt(ue,0),sa(ue,new qr(_,H==t.line?t.ch:null,H==n.line?n.ch:null)),++H}),_.collapsed&&e.iter(t.line,n.line+1,function(ue){Ar(e,ue)&&Zt(ue,0)}),_.clearOnEnter&&Ae(_,"beforeCursorEnter",function(){return _.clear()}),_.readOnly&&(Wr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),_.collapsed&&(_.id=++ts,_.atomic=!0),V){if(Y&&(V.curOp.updateMaxLine=!0),_.collapsed)tr(V,t.line,n.line+1);else if(_.className||_.startStyle||_.endStyle||_.css||_.attributes||_.title)for(var ae=t.line;ae<=n.line;ae++)Hr(V,ae,"text");_.atomic&&Go(V.doc),Gt(V,"markerAdded",V,_)}return _}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)},fe(yi);function Tl(e,t,n,r,i){r=M(r),r.shared=!1;var _=[In(e,t,n,r,i)],N=_[0],H=r.widgetNode;return Xr(e,function(V){H&&(r.widgetNode=H.cloneNode(!0)),_.push(In(V,ft(V,t),ft(V,n),r,i));for(var Y=0;Y<V.linked.length;++Y)if(V.linked[Y].isParent)return;N=$(_)}),new yi(_,N)}function rs(e){return e.findMarks(je(e.first,0),e.clipPos(je(e.lastLine())),function(t){return t.parent})}function _l(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),_=e.clipPos(i.from),N=e.clipPos(i.to);if(dt(_,N)){var H=In(e,_,N,r.primary,r.primary.type);r.markers.push(H),H.parent=r}}}function Sl(e){for(var t=function(r){var i=e[r],_=[i.primary.doc];Xr(i.primary.doc,function(V){return _.push(V)});for(var N=0;N<i.markers.length;N++){var H=i.markers[N];ee(_,H.doc)==-1&&(H.parent=null,i.markers.splice(N--,1))}},n=0;n<e.length;n++)t(n)}var wl=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 _=je(n,0);this.sel=zr(_),this.history=new zi(null),this.id=++wl,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:_,to:_,text:e}),Xt(this,zr(_),me)};rr.prototype=Se(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=je(this.first,0),n=this.first+this.size-1;Mn(this,{from:t,to:je(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),me)}),replaceRange:function(e,t,n,r){t=ft(this,t),n=n?ft(this,n):t,kn(this,e,t,n,r)},getRange:function(e,t,n){var r=Pr(this,ft(this,e),ft(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 ft(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,ft(this,typeof e=="number"?je(e,t||0):e),null,n)}),setSelection:Wt(function(e,t,n){Wo(this,ft(this,e),ft(this,t||e),n)}),extendSelection:Wt(function(e,t,n){Xi(this,ft(this,e),t&&ft(this,t),n)}),extendSelections:Wt(function(e,t){jo(this,Ge(this,e),t)}),extendSelectionsBy:Wt(function(e,t){var n=ie(this.sel.ranges,e);jo(this,Ge(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 St(ft(this,e[i].anchor),ft(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Xt(this,_r(this.cm,r,t),n)}),addSelection:Wt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new St(ft(this,e),ft(this,t||e))),Xt(this,_r(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,_=0;_<i.ranges.length;_++){var N=i.ranges[_];r[_]={from:N.from(),to:N.to(),text:this.splitLines(e[_]),origin:n}}for(var H=t&&t!="end"&&fl(this,r,t),V=r.length-1;V>=0;V--)Mn(this,r[V]);H?Ko(this,H):this.cm&&Ln(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&&Ie(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,Ie(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Mr(this,e))return null;if(t=e,e=nt(this,e),!e)return null}else if(t=Tt(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Wt(function(e,t,n){return mi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(b(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Wt(function(e,t,n){return mi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",_=r[i];if(_)if(n==null)r[i]=null;else{var N=_.match(b(n));if(!N)return!1;var H=N.index+N[0].length;r[i]=_.slice(0,N.index)+(!N.index||H==_.length?"":" ")+_.slice(H)||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,ft(this,e),ft(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=ft(this,e),In(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ft(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=ft(this,e),t=ft(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(_){var N=_.markedSpans;if(N)for(var H=0;H<N.length;H++){var V=N[H];!(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 _=i.text.length+r;if(_>e)return t=e,!0;e-=_,++n}),ft(this,je(n,t))},indexFromPos:function(e){e=ft(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}],_l(r,rs(this)),r},unlinkDoc:function(e){if(e instanceof Lt&&(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),Sl(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):ht(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),Ne(t,e)||Nr(t.display,e))return;J(e),j&&(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,_=Array(i),N=0,H=function(){++N==i&&jt(t,function(){n=ft(t.doc,n);var be={from:n,to:n,text:t.doc.splitLines(_.filter(function(Re){return Re!=null}).join(t.doc.lineSeparator())),origin:"paste"};Mn(t.doc,be),Ko(t.doc,zr(ft(t.doc,n),ft(t.doc,Vr(be))))})()},V=function(be,Re){if(t.options.allowDropFileTypes&&ee(t.options.allowDropFileTypes,be.type)==-1){H();return}var Fe=new FileReader;Fe.onerror=function(){return H()},Fe.onload=function(){var ze=Fe.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(ze)){H();return}_[Re]=ze,H()},Fe.readAsText(be)},Y=0;Y<r.length;Y++)V(r[Y],Y);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 Te=0;Te<ue.length;++Te)kn(t.doc,"",ue[Te].anchor,ue[Te].head,"drag");t.replaceSelection(ae,"around","paste"),t.display.input.focus()}}catch(be){}}}function Al(e,t){if(j&&(!e.state.draggingText||+new Date-ns<100)){le(t);return}if(Ne(e,t)||Nr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!D){var n=o("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 Dl(e,t){var n=on(e,t);if(!n)return;var r=document.createDocumentFragment();go(e,n,r),e.display.dragCursor||(e.display.dragCursor=o("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),d(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 _=0;_<n.length;_++)e(n[_])})}var os=!1;function Ll(){if(os)return;Ol(),os=!0}function Ol(){var e;Ae(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(Rl)},100))}),Ae(window,"blur",function(){return as(Dn)})}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=s?Br.macDefault:Br.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,_,N=0;N<t.length-1;N++){var H=t[N];if(/^(cmd|meta|m)$/i.test(H))_=!0;else if(/^a(lt)?$/i.test(H))n=!0;else if(/^(c|ctrl|control)$/i.test(H))r=!0;else if(/^s(hift)?$/i.test(H))i=!0;else throw new Error("Unrecognized modifier name: "+H)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),_&&(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=ie(n.split(" "),Pl),_=0;_<i.length;_++){var N=void 0,H=void 0;_==i.length-1?(H=i.join(" "),N=r):(H=i.slice(0,_+1).join(" "),N="...");var V=t[H];if(!V)t[H]=N;else if(V!=N)throw new Error("Inconsistent bindings for "+H)}delete e[n]}for(var Y in t)e[Y]=t[Y];return e}function Fn(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 Fn(e,t.fallthrough,n,r);for(var _=0;_<t.fallthrough.length;_++){var N=Fn(e,t.fallthrough[_],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),(h?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(h?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 Un(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var _=t(n[i]);r.length&&dt(_.from,$(r).to)<=0;){var N=r.pop();if(dt(N.from,_.from)<0){_.from=N.from;break}}r.push(_)}or(e,function(){for(var H=r.length-1;H>=0;H--)kn(e.doc,"",r[H].from,r[H].to,"+delete");Ln(e)})}function Ua(e,t,n){var r=we(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Na(e,t,n){var r=Ua(e,t.ch,n);return r==null?null:new je(t.line,r,n<0?"after":"before")}function Ba(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var _=He(n,t.doc.direction);if(_){var N=i<0?$(_):_[0],H=i<0==(N.level==1),V=H?"after":"before",Y;if(N.level>0||t.doc.direction=="rtl"){var ae=wn(t,n);Y=i<0?n.text.length-1:0;var ue=Lr(t,ae,Y).top;Y=Be(function(Te){return Lr(t,ae,Te).top==ue},i<0==(N.level==1)?N.from:N.to-1,Y),V=="before"&&(Y=Ua(n,Y,1))}else Y=i<0?N.to:N.from;return new je(r,Y,V)}}return new je(r,i<0?n.text.length:0,i<0?"before":"after")}function kl(e,t,n,r){var i=He(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 _=Pe(i,n.ch,n.sticky),N=i[_];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 H=function(Ye,Ze){return Ua(t,Ye instanceof je?Ye.ch:Ye,Ze)},V,Y=function(Ye){return e.options.lineWrapping?(V=V||wn(e,t),fo(e,t,V,Ye)):{begin:0,end:t.text.length}},ae=Y(n.sticky=="before"?H(n,-1):n.ch);if(e.doc.direction=="rtl"||N.level==1){var ue=N.level==1==r<0,Te=H(n,ue?1:-1);if(Te!=null&&(ue?Te<=N.to&&Te<=ae.end:Te>=N.from&&Te>=ae.begin)){var be=ue?"before":"after";return new je(n.line,Te,be)}}var Re=function(Ye,Ze,$e){for(var tt=function(Dt,Kt){return Kt?new je(n.line,H(Dt,1),"before"):new je(n.line,Dt,"after")};Ye>=0&&Ye<i.length;Ye+=Ze){var ut=i[Ye],ot=Ze>0==(ut.level!=1),mt=ot?$e.begin:H($e.end,-1);if(ut.from<=mt&&mt<ut.to)return tt(mt,ot);if(mt=ot?ut.from:H(ut.to,-1),$e.begin<=mt&&mt<$e.end)return tt(mt,ot)}},Fe=Re(_+r,r,ae);if(Fe)return Fe;var ze=r>0?ae.end:H(ae.begin,-1);return ze!=null&&!(r>0&&ze==t.text.length)&&(Fe=Re(r>0?0:i.length-1,r,Y(ze)),Fe)?Fe:null}var xi={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),me)},killLine:function(e){return Un(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:je(t.head.line+1,0)}:{from:t.head,to:je(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Un(e,function(t){return{from:je(t.from().line,0),to:ft(e.doc,je(t.to().line+1,0))}})},delLineLeft:function(e){return Un(e,function(t){return{from:je(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Un(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 Un(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(je(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(je(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")},de)},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")},de)},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},de)},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 _=n[i].from(),N=K(e.getLine(_.line),_.ch,r);t.push(he(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,_=nt(e.doc,i.line).text;if(_){if(i.ch==_.length&&(i=new je(i.line,i.ch-1)),i.ch>0)i=new je(i.line,i.ch+1),e.replaceRange(_.charAt(i.ch-1)+_.charAt(i.ch-2),je(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 je(i.line,1),e.replaceRange(_.charAt(0)+e.doc.lineSeparator()+N.charAt(N.length-1),je(i.line-1,N.length-1),i,"+transpose"))}}n.push(new St(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);Ln(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=He(r,e.doc.direction);if(!i||i[0].level==0){var _=Math.max(n.ch,r.text.search(/\S/)),N=t.line==n.line&&t.ch<=_&&t.ch;return je(n.line,N?0:_,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)!=xe}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Fl(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Fn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Fn(t,e.options.extraKeys,n,e)||Fn(t,e.options.keyMap,n,e)}var Ul=new X;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:Ul.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=Fl(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Gt(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(J(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=P(),Ne(t,e))return;j&&F<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&&!wt&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),A&&!s&&!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;U(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(c(t,"CodeMirror-crosshair"),Je(document,"keyup",n),Je(document,"mouseover",n))}Ae(document,"keyup",n),Ae(document,"mouseover",n)}function ps(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ne(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Nr(t.display,e)||Ne(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(S&&n==ja){ja=null,J(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&&dt(t,this.pos)==0&&n==this.button};var _i,Si;function Wl(e,t){var n=+new Date;return Si&&Si.compare(n,e,t)?(_i=Si=null,"triple"):_i&&_i.compare(n,e,t)?(Si=new Wa(n,e,t),_i=null,"double"):(_i=new Wa(n,e,t),Si=null,"single")}function vs(e){var t=this,n=t.display;if(Ne(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Nr(n,e)){k||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ka(t,e))return;var r=on(t,e),i=De(e),_=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Kl(t,i,r,_,e))return;i==1?r?Gl(t,r,_,e):pe(e)==n.scroller&&J(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 Kl(e,t,n,r,i){var _="Click";return r=="double"?_="Double"+_:r=="triple"&&(_="Triple"+_),_=(t==1?"Left":t==2?"Middle":"Right")+_,Ti(e,ls(_,i),i,function(N){if(typeof N=="string"&&(N=xi[N]),!N)return!1;var H=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),H=N(e,n)!=xe}finally{e.state.suppressEdits=!1}return H})}function Hl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var _=l?n.shiftKey&&n.metaKey:n.altKey;i.unit=_?"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=s?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(s?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){j?setTimeout(O(vo,e),0):e.curOp.focus=P();var i=Hl(e,n,r),_=e.doc.sel,N;e.options.dragDrop&&ke&&!e.isReadOnly()&&n=="single"&&(N=_.contains(t))>-1&&(dt((N=_.ranges[N]).from(),t)<0||t.xRel>0)&&(dt(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,_=!1,N=jt(e,function(Y){k&&(i.scroller.draggable=!1),e.state.draggingText=!1,Je(i.wrapper.ownerDocument,"mouseup",N),Je(i.wrapper.ownerDocument,"mousemove",H),Je(i.scroller,"dragstart",V),Je(i.scroller,"drop",N),_||(J(Y),r.addNew||Xi(e.doc,n,null,null,r.extend),k&&!D||j&&F==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),H=function(Y){_=_||Math.abs(t.clientX-Y.clientX)+Math.abs(t.clientY-Y.clientY)>=10},V=function(){return _=!0};k&&(i.scroller.draggable=!0),e.state.draggingText=N,N.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Ae(i.wrapper.ownerDocument,"mouseup",N),Ae(i.wrapper.ownerDocument,"mousemove",H),Ae(i.scroller,"dragstart",V),Ae(i.scroller,"drop",N),yo(e),setTimeout(function(){return i.input.focus()},20)}function ys(e,t,n){if(n=="char")return new St(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new St(je(t.line,0),ft(e.doc,je(t.line+1,0)));var r=n(e,t);return new St(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,_=e.doc;J(t);var N,H,V=_.sel,Y=V.ranges;if(r.addNew&&!r.extend?(H=_.sel.contains(n),H>-1?N=Y[H]:N=new St(n,n)):(N=_.sel.primary(),H=_.sel.primIndex),r.unit=="rectangle")r.addNew||(N=new St(n,n)),n=on(e,t,!0,!0),H=-1;else{var ae=ys(e,n,r.unit);r.extend?N=Ia(N,ae.anchor,ae.head,r.extend):N=ae}r.addNew?H==-1?(H=Y.length,Xt(_,_r(e,Y.concat([N]),H),{scroll:!1,origin:"*mouse"})):Y.length>1&&Y[H].empty()&&r.unit=="char"&&!r.extend?(Xt(_,_r(e,Y.slice(0,H).concat(Y.slice(H+1)),0),{scroll:!1,origin:"*mouse"}),V=_.sel):Fa(_,H,N,ge):(H=0,Xt(_,new cr([N],0),ge),V=_.sel);var ue=n;function Te($e){if(dt(ue,$e)==0)return;if(ue=$e,r.unit=="rectangle"){for(var tt=[],ut=e.options.tabSize,ot=K(nt(_,n.line).text,n.ch,ut),mt=K(nt(_,$e.line).text,$e.ch,ut),Dt=Math.min(ot,mt),Kt=Math.max(ot,mt),Ot=Math.min(n.line,$e.line),sr=Math.min(e.lastLine(),Math.max(n.line,$e.line));Ot<=sr;Ot++){var nr=nt(_,Ot).text,kt=se(nr,Dt,ut);Dt==Kt?tt.push(new St(je(Ot,kt),je(Ot,kt))):nr.length>kt&&tt.push(new St(je(Ot,kt),je(Ot,se(nr,Kt,ut))))}tt.length||tt.push(new St(n,n)),Xt(_,_r(e,V.ranges.slice(0,H).concat(tt),H),{origin:"*mouse",scroll:!1}),e.scrollIntoView($e)}else{var ir=N,zt=ys(e,$e,r.unit),Nt=ir.anchor,It;dt(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[H]=Xl(e,new St(ft(_,Nt),It)),Xt(_,_r(e,Pt,H),ge)}}var be=i.wrapper.getBoundingClientRect(),Re=0;function Fe($e){var tt=++Re,ut=on(e,$e,!0,r.unit=="rectangle");if(!ut)return;if(dt(ut,ue)!=0){e.curOp.focus=P(),Te(ut);var ot=Wi(i,_);(ut.line>=ot.to||ut.line<ot.from)&&setTimeout(jt(e,function(){Re==tt&&Fe($e)}),150)}else{var mt=$e.clientY<be.top?-20:$e.clientY>be.bottom?20:0;mt&&setTimeout(jt(e,function(){if(Re!=tt)return;i.scroller.scrollTop+=mt,Fe($e)}),50)}}function ze($e){e.state.selectingText=!1,Re=Infinity,$e&&(J($e),i.input.focus()),Je(i.wrapper.ownerDocument,"mousemove",Ye),Je(i.wrapper.ownerDocument,"mouseup",Ze),_.history.lastSelOrigin=null}var Ye=jt(e,function($e){$e.buttons===0||!De($e)?ze($e):Fe($e)}),Ze=jt(e,ze);e.state.selectingText=Ze,Ae(i.wrapper.ownerDocument,"mousemove",Ye),Ae(i.wrapper.ownerDocument,"mouseup",Ze)}function Xl(e,t){var n=t.anchor,r=t.head,i=nt(e.doc,n.line);if(dt(n,r)==0&&n.sticky==r.sticky)return t;var _=He(i);if(!_)return t;var N=Pe(_,n.ch,n.sticky),H=_[N];if(H.from!=n.ch&&H.to!=n.ch)return t;var V=N+(H.from==n.ch==(H.level!=1)?0:1);if(V==0||V==_.length)return t;var Y;if(r.line!=n.line)Y=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ae=Pe(_,r.ch,r.sticky),ue=ae-N||(r.ch-n.ch)*(H.level==1?-1:1);ae==V-1||ae==V?Y=ue<0:Y=ue>0}var Te=_[V+(Y?-1:0)],be=Y==(Te.level==1),Re=be?Te.from:Te.to,Fe=be?"after":"before";return n.ch==Re&&n.sticky==Fe?t:new St(new je(n.line,Re,Fe),r)}function bs(e,t,n,r){var i,_;if(t.touches)i=t.touches[0].clientX,_=t.touches[0].clientY;else try{i=t.clientX,_=t.clientY}catch(Te){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&J(t);var N=e.display,H=N.lineDiv.getBoundingClientRect();if(_>H.bottom||!ce(e,n))return re(t);_-=H.top-N.viewOffset;for(var V=0;V<e.display.gutterSpecs.length;++V){var Y=N.gutters.childNodes[V];if(Y&&Y.getBoundingClientRect().right>=i){var ae=gr(e.doc,_),ue=e.display.gutterSpecs[V];return Oe(e,n,e,ae,ue.className,t),re(t)}}}function Ka(e,t){return bs(e,t,"gutterClick",!0)}function Es(e,t){if(Nr(e.display,t)||Yl(e,t))return;if(Ne(e,t,"contextmenu"))return;C||e.display.input.onContextMenu(t)}function Yl(e,t){return ce(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,_,N){e.defaults[r]=i,_&&(t[r]=N?function(H,V,Y){Y!=Nn&&_(H,V,Y)}:_)}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 _=[],N=r.doc.first;r.doc.iter(function(V){for(var Y=0;;){var ae=V.text.indexOf(i,Y);if(ae==-1)break;Y=ae+i.length,_.push(je(N,ae))}N++});for(var H=_.length-1;H>=0;H--)kn(r.doc,i,_[H],je(_[H].line,_[H].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,_){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),_!=Nn&&r.refresh()}),n("specialCharPlaceholder",At,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",a?"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,_){var N=Zi(i),H=_!=Nn&&Zi(_);H&&H.detach&&H.detach(r,N),N.attach&&N.attach(r,H||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){So(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"&&(Dn(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?Ae:Je;_(e.display.scroller,"dragstart",i.start),_(e.display.scroller,"dragenter",i.enter),_(e.display.scroller,"dragover",i.over),_(e.display.scroller,"dragleave",i.leave),_(e.display.scroller,"drop",i.drop)}}function Ql(e){e.options.lineWrapping?(U(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(c(e.display.wrapper,"CodeMirror-wrap"),Ii(e)),xa(e),tr(e),ii(e),setTimeout(function(){return On(e)},100)}function Lt(e,t){var n=this;if(!(this instanceof Lt))return new Lt(e,t);this.options=t=t?M(t):{},M(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 Lt.inputStyles[t.inputStyle](this),_=this.display=new dl(e,r,i,t);_.wrapper.CodeMirror=this,xs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),So(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 X,keySeq:null,specialChars:null},t.autofocus&&!a&&_.input.focus(),j&&F<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Ll(),dn(this),this.curOp.forceUpdate=!0,ko(this,r),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&_a(n)},20):Dn(this);for(var N in ea)ea.hasOwnProperty(N)&&ea[N](this,t[N],Nn);Ao(this),t.finishInit&&t.finishInit(this);for(var H=0;H<Ha.length;++H)Ha[H](this);cn(this),k&&t.lineWrapping&&getComputedStyle(_.lineDiv).textRendering=="optimizelegibility"&&(_.lineDiv.style.textRendering="auto")}Lt.defaults=Ts,Lt.optionHandlers=ea;function Zl(e){var t=e.display;Ae(t.scroller,"mousedown",jt(e,vs)),j&&F<11?Ae(t.scroller,"dblclick",jt(e,function(V){if(Ne(e,V))return;var Y=on(e,V);if(!Y||Ka(e,V)||Nr(e.display,V))return;J(V);var ae=e.findWordAt(Y);Xi(e.doc,ae.anchor,ae.head)})):Ae(t.scroller,"dblclick",function(V){return Ne(e,V)||J(V)}),Ae(t.scroller,"contextmenu",function(V){return Es(e,V)}),Ae(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 _(V){if(V.touches.length!=1)return!1;var Y=V.touches[0];return Y.radiusX<=1&&Y.radiusY<=1}function N(V,Y){if(Y.left==null)return!0;var ae=Y.left-V.left,ue=Y.top-V.top;return ae*ae+ue*ue>20*20}Ae(t.scroller,"touchstart",function(V){if(!Ne(e,V)&&!_(V)&&!Ka(e,V)){t.input.ensurePolled(),clearTimeout(n);var Y=+new Date;t.activeTouch={start:Y,moved:!1,prev:Y-r.end<=300?r:null},V.touches.length==1&&(t.activeTouch.left=V.touches[0].pageX,t.activeTouch.top=V.touches[0].pageY)}}),Ae(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ae(t.scroller,"touchend",function(V){var Y=t.activeTouch;if(Y&&!Nr(t,V)&&Y.left!=null&&!Y.moved&&new Date-Y.start<300){var ae=e.coordsChar(t.activeTouch,"page"),ue;!Y.prev||N(Y,Y.prev)?ue=new St(ae,ae):!Y.prev.prev||N(Y,Y.prev.prev)?ue=e.findWordAt(ae):ue=new St(je(ae.line,0),ft(e.doc,je(ae.line+1,0))),e.setSelection(ue.anchor,ue.head),e.focus(),J(V)}i()}),Ae(t.scroller,"touchcancel",i),Ae(t.scroller,"scroll",function(){t.scroller.clientHeight&&(si(e,t.scroller.scrollTop),ln(e,t.scroller.scrollLeft,!0),Oe(e,"scroll",e))}),Ae(t.scroller,"mousewheel",function(V){return Oo(e,V)}),Ae(t.scroller,"DOMMouseScroll",function(V){return Oo(e,V)}),Ae(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(V){Ne(e,V)||le(V)},over:function(V){Ne(e,V)||(Dl(e,V),le(V))},start:function(V){return Al(e,V)},drop:jt(e,Cl),leave:function(V){Ne(e,V)||is(e)}};var H=t.input.getField();Ae(H,"keyup",function(V){return ps.call(e,V)}),Ae(H,"keydown",jt(e,ms)),Ae(H,"keypress",jt(e,gs)),Ae(H,"focus",function(V){return _a(e,V)}),Ae(H,"blur",function(V){return Dn(e,V)})}var Ha=[];Lt.defineInitHook=function(e){return Ha.push(e)};function wi(e,t,n,r){var i=e.doc,_;n==null&&(n="add"),n=="smart"&&(i.mode.indent?_=vr(e,t).state:n="prev");var N=e.options.tabSize,H=nt(i,t),V=K(H.text,null,N);H.stateAfter&&(H.stateAfter=null);var Y=H.text.match(/^\s*/)[0],ae;if(!r&&!/\S/.test(H.text))ae=0,n="not";else if(n=="smart"&&(ae=i.mode.indent(_,H.text.slice(Y.length),H.text),ae==xe||ae>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?ae=K(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="",Te=0;if(e.options.indentWithTabs)for(var be=Math.floor(ae/N);be;--be)Te+=N,ue+=" ";if(Te<ae&&(ue+=he(ae-Te)),ue!=Y)return kn(i,ue,je(t,0),je(t,Y.length),"+input"),H.stateAfter=null,!0;for(var Re=0;Re<i.sel.ranges.length;Re++){var Fe=i.sel.ranges[Re];if(Fe.head.line==t&&Fe.head.ch<Y.length){var ze=je(t,Y.length);Fa(i,Re,new St(ze,ze));break}}}var Sr=null;function ta(e){Sr=e}function Ga(e,t,n,r,i){var _=e.doc;e.display.shift=!1,r||(r=_.sel);var N=+new Date-200,H=i=="paste"||e.state.pasteIncoming>N,V=ht(t),Y=null;if(H&&r.ranges.length>1)if(Sr&&Sr.text.join(`
|
|
`)==t){if(r.ranges.length%Sr.text.length==0){Y=[];for(var ae=0;ae<Sr.text.length;ae++)Y.push(_.splitLines(Sr.text[ae]))}}else V.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(Y=ie(V,function(Ye){return[Ye]}));for(var ue=e.curOp.updateInput,Te=r.ranges.length-1;Te>=0;Te--){var be=r.ranges[Te],Re=be.from(),Fe=be.to();be.empty()&&(n&&n>0?Re=je(Re.line,Re.ch-n):e.state.overwrite&&!H?Fe=je(Fe.line,Math.min(nt(_,Fe.line).text.length,Fe.ch+$(V).length)):H&&Sr&&Sr.lineWise&&Sr.text.join(`
|
|
`)==V.join(`
|
|
`)&&(Re=Fe=je(Re.line,0)));var ze={from:Re,to:Fe,text:Y?Y[Te%Y.length]:V,origin:i||(H?"paste":e.state.cutIncoming>N?"cut":"+input")};Mn(e.doc,ze),Gt(e,"inputRead",e,ze)}t&&!H&&Ss(e,t),Ln(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ue),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function _s(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 Ss(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 _=e.getModeAt(i.head),N=!1;if(_.electricChars){for(var H=0;H<_.electricChars.length;H++)if(t.indexOf(_.electricChars.charAt(H))>-1){N=wi(e,i.head.line,"smart");break}}else _.electricInput&&(_.electricInput.test(nt(e.doc,i.head.line).text.slice(0,i.head.ch))&&(N=wi(e,i.head.line,"smart")));N&&Gt(e,"electricInput",e,i.head.line)}}function ws(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,_={anchor:je(i,0),head:je(i+1,0)};n.push(_),t.push(e.getRange(_.anchor,_.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=o("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=o("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return k?e.style.width="1000px":e.setAttribute("wrap","off"),g&&(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 _=this.options,N=_[r];if(_[r]==i&&r!="mode")return;_[r]=i,t.hasOwnProperty(r)&&jt(this,t[r])(this,i,N),Oe(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,_=0;_<i.length;++_)if(i[_]==r||i[_].name==r)return i.splice(_,1),!0},addOverlay:Jt(function(r,i){var _=r.token?r:e.getMode(this.options,r);if(_.startState)throw new Error("Overlays may not be stateful.");Z(this.state.overlays,{mode:_,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,_=0;_<i.length;++_){var N=i[_].modeSpec;if(N==r||typeof r=="string"&&N.name==r){i.splice(_,1),this.state.modeGen++,tr(this);return}}}),indentLine:Jt(function(r,i,_){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Mr(this.doc,r)&&wi(this,r,i,_)}),indentSelection:Jt(function(r){for(var i=this.doc.sel.ranges,_=-1,N=0;N<i.length;N++){var H=i[N];if(H.empty())H.head.line>_&&(wi(this,H.head.line,r,!0),_=H.head.line,N==this.doc.sel.primIndex&&Ln(this));else{var V=H.from(),Y=H.to(),ae=Math.max(_,V.line);_=Math.min(this.lastLine(),Y.line-(Y.ch?0:1))+1;for(var ue=ae;ue<_;++ue)wi(this,ue,r);var Te=this.doc.sel.ranges;V.ch==0&&i.length==Te.length&&Te[N].from().ch>0&&Fa(this.doc,N,new St(V,Te[N].to()),me)}}}),getTokenAt:function(r,i){return Ai(this,r,i)},getLineTokens:function(r,i){return Ai(this,je(r),i,!0)},getTokenTypeAt:function(r){r=ft(this.doc,r);var i=Zr(this,nt(this.doc,r.line)),_=0,N=(i.length-1)/2,H=r.ch,V;if(H==0)V=i[2];else for(;;){var Y=_+N>>1;if((Y?i[Y*2-1]:0)>=H)N=Y;else if(i[Y*2+1]<H)_=Y+1;else{V=i[Y*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 _=[];if(!n.hasOwnProperty(i))return _;var N=n[i],H=this.getModeAt(r);if(typeof H[i]=="string")N[H[i]]&&_.push(N[H[i]]);else if(H[i])for(var V=0;V<H[i].length;V++){var Y=N[H[i][V]];Y&&_.push(Y)}else H.helperType&&N[H.helperType]?_.push(N[H.helperType]):N[H.name]&&_.push(N[H.name]);for(var ae=0;ae<N._global.length;ae++){var ue=N._global[ae];ue.pred(H,this)&&ee(_,ue.val)==-1&&_.push(ue.val)}return _},getStateAfter:function(r,i){var _=this.doc;return r=yn(_,r==null?_.first+_.size-1:r),vr(this,r+1,i).state},cursorCoords:function(r,i){var _,N=this.doc.sel.primary();return r==null?_=N.head:typeof r=="object"?_=ft(this.doc,r):_=r?N.from():N.to(),Tr(this,_,i||"page")},charCoords:function(r,i){return pa(this,ft(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,_){var N=!1,H;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),H=nt(this.doc,r)}else H=r;return Ui(this,H,{top:0,left:0},i||"page",_||N).top+(N?this.doc.height-xr(H):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,_,N,H){var V=this.display;r=Tr(this,ft(this.doc,r));var Y=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")Y=r.top;else if(N=="above"||N=="near"){var ue=Math.max(V.wrapper.clientHeight,this.doc.height),Te=Math.max(V.sizer.clientWidth,V.lineSpace.clientWidth);(N=="above"||r.bottom+i.offsetHeight>ue)&&r.top>i.offsetHeight?Y=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=ue&&(Y=r.bottom),ae+i.offsetWidth>Te&&(ae=Te-i.offsetWidth)}i.style.top=Y+"px",i.style.left=i.style.right="",H=="right"?(ae=V.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(H=="left"?ae=0:H=="middle"&&(ae=(V.sizer.clientWidth-i.offsetWidth)/2),i.style.left=ae+"px"),_&&Js(this,{left:ae,top:Y,right:ae+i.offsetWidth,bottom:Y+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){Ss(this,r)}),findPosH:function(r,i,_,N){var H=1;i<0&&(H=-1,i=-i);for(var V=ft(this.doc,r),Y=0;Y<i&&!(V=za(this.doc,V,H,_,N),V.hitSide);++Y);return V},moveH:Jt(function(r,i){var _=this;this.extendSelectionsBy(function(N){return _.display.shift||_.doc.extend||N.empty()?za(_.doc,N.head,r,i,_.options.rtlMoveVisually):r<0?N.from():N.to()},de)}),deleteH:Jt(function(r,i){var _=this.doc.sel,N=this.doc;_.somethingSelected()?N.replaceSelection("",null,"+delete"):Un(this,function(H){var V=za(N,H.head,r,i,!1);return r<0?{from:V,to:H.head}:{from:H.head,to:V}})}),findPosV:function(r,i,_,N){var H=1,V=N;i<0&&(H=-1,i=-i);for(var Y=ft(this.doc,r),ae=0;ae<i;++ae){var ue=Tr(this,Y,"div");if(V==null?V=ue.left:ue.left=V,Y=Ds(this,ue,H,_),Y.hitSide)break}return Y},moveV:Jt(function(r,i){var _=this,N=this.doc,H=[],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(_,ae.head,"div");ae.goalColumn!=null&&(ue.left=ae.goalColumn),H.push(ue.left);var Te=Ds(_,ue,r,i);return i=="page"&&ae==N.sel.primary()&&wa(_,pa(_,Te,"div").top-ue.top),Te},de),H.length)for(var Y=0;Y<N.sel.ranges.length;Y++)N.sel.ranges[Y].goalColumn=H[Y]}),findWordAt:function(r){var i=this.doc,_=nt(i,r.line).text,N=r.ch,H=r.ch;if(_){var V=this.getHelper(r,"wordChars");(r.sticky=="before"||H==_.length)&&N?--N:++H;for(var Y=_.charAt(N),ae=Le(Y,V)?function(ue){return Le(ue,V)}:/\s/.test(Y)?function(ue){return/\s/.test(ue)}:function(ue){return!/\s/.test(ue)&&!Le(ue)};N>0&&ae(_.charAt(N-1));)--N;for(;H<_.length&&ae(_.charAt(H));)++H}return new St(je(r.line,N),je(r.line,H))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?U(this.display.cursorDiv,"CodeMirror-overwrite"):c(this.display.cursorDiv,"CodeMirror-overwrite"),Oe(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==P()},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-Dr(this)-this.display.barHeight,width:r.scrollWidth-Dr(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:je(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 _=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 H=this.display.viewFrom;this.doc.iter(H,this.display.viewTo,function(V){if(V.widgets){for(var Y=0;Y<V.widgets.length;Y++)if(V.widgets[Y].noHScroll){Hr(_,H,"widget");break}}++H}),this.curOp.forceUpdate=!0,Oe(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),Da(this.display),(r==null||Math.abs(r-Cn(this.display))>.5||this.options.lineWrapping)&&xa(this),Oe(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}},fe(e),e.registerHelper=function(r,i,_){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=_},e.registerGlobalHelper=function(r,i,_,N){e.registerHelper(r,i,N),n[r]._global.push({pred:_,val:N})}}function za(e,t,n,r,i){var _=t,N=n,H=nt(e,t.line),V=i&&e.direction=="rtl"?-n:n;function Y(){var Ze=t.line+V;return Ze<e.first||Ze>=e.first+e.size?!1:(t=new je(Ze,t.ch,t.sticky),H=nt(e,Ze))}function ae(Ze){var $e;if(r=="codepoint"){var tt=H.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(tt)?$e=null:$e=new je(t.line,Math.max(0,Math.min(H.text.length,t.ch+n*(tt>=55296&&tt<56320?2:1))),-n)}else i?$e=kl(e.cm,H,t,n):$e=Na(H,t,n);if($e==null)if(!Ze&&Y())t=Ba(i,e.cm,H,t.line,V);else return!1;else t=$e;return!0}if(r=="char"||r=="codepoint")ae();else if(r=="column")ae(!0);else if(r=="word"||r=="group")for(var ue=null,Te=r=="group",be=e.cm&&e.cm.getHelper(t,"wordChars"),Re=!0;!(n<0&&!ae(!Re));Re=!1){var Fe=H.text.charAt(t.ch)||`
|
|
`,ze=Le(Fe,be)?"w":Te&&Fe==`
|
|
`?"n":!Te||/\s/.test(Fe)?null:"p";if(Te&&!Re&&!ze&&(ze="s"),ue&&ue!=ze){n<0&&(n=1,ae(),t.sticky="after");break}if(ze&&(ue=ze),n>0&&!ae(!Re))break}var Ye=$i(e,t,_,N,!0);return Gn(_,Ye)&&(Ye.hitSide=!0),Ye}function Ds(e,t,n,r){var i=e.doc,_=t.left,N;if(r=="page"){var H=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),V=Math.max(H-.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 Y;!(Y=va(e,_,N),!Y.outside);){if(n<0?N<=0:N>=i.height){Y.hitSide=!0;break}N+=n*5}return Y}var Ct=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new X,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 _(H){for(var V=H.target;V;V=V.parentNode){if(V==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(V.className))break}return!1}Ae(i,"paste",function(H){if(!_(H)||Ne(r,H)||_s(H,r))return;F<=11&&setTimeout(jt(r,function(){return t.updateFromDOM()}),20)}),Ae(i,"compositionstart",function(H){t.composing={data:H.data,done:!1}}),Ae(i,"compositionupdate",function(H){t.composing||(t.composing={data:H.data,done:!1})}),Ae(i,"compositionend",function(H){t.composing&&(H.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ae(i,"touchstart",function(){return n.forceCompositionEnd()}),Ae(i,"input",function(){t.composing||t.readFromDOMSoon()});function N(H){if(!_(H)||Ne(r,H))return;if(r.somethingSelected())ta({lineWise:!1,text:r.getSelections()}),H.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var V=ws(r);ta({lineWise:!0,text:V.text}),H.type=="cut"&&r.operation(function(){r.setSelections(V.ranges,0,me),r.replaceSelection("",null,"cut")})}else return;if(H.clipboardData){H.clipboardData.clearData();var Y=Sr.text.join(`
|
|
`);if(H.clipboardData.setData("Text",Y),H.clipboardData.getData("Text")==Y){H.preventDefault();return}}var ae=As(),ue=ae.firstChild;r.display.lineSpace.insertBefore(ae,r.display.lineSpace.firstChild),ue.value=Sr.text.join(`
|
|
`);var Te=document.activeElement;W(ue),setTimeout(function(){r.display.lineSpace.removeChild(ae),Te.focus(),Te==i&&n.showPrimarySelection()},50)}Ae(i,"copy",N),Ae(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 _=ra(t,e.anchorNode,e.anchorOffset),N=ra(t,e.focusNode,e.focusOffset);if(_&&!_.bad&&N&&!N.bad&&dt(Qr(_,N),r)==0&&dt(vn(_,N),i)==0)return;var H=t.display.view,V=r.line>=t.display.viewFrom&&Ls(t,r)||{node:H[0].measure.map[2],offset:0},Y=i.line<t.display.viewTo&&Ls(t,i);if(!Y){var ae=H[H.length-1].measure,ue=ae.maps?ae.maps[ae.maps.length-1]:ae.map;Y={node:ue[ue.length-1],offset:ue[ue.length-2]-ue[ue.length-3]}}if(!V||!Y){e.removeAllRanges();return}var Te=e.rangeCount&&e.getRangeAt(0),be;try{be=m(V.node,V.offset,Y.offset,Y.node)}catch(Re){}be&&(!A&&t.state.focused?(e.collapse(V.node,V.offset),be.collapsed||(e.removeAllRanges(),e.addRange(be))):(e.removeAllRanges(),e.addRange(be)),Te&&e.anchorNode==null?e.addRange(Te):A&&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){d(this.cm.display.cursorDiv,e.cursors),d(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 x(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(u&&v&&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),me),(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=je(r.line-1,nt(e.doc,r.line-1).length)),i.ch==nt(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=je(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var _,N,H;r.line==t.viewFrom||(_=sn(e,r.line))==0?(N=Tt(t.view[0].line),H=t.view[0].node):(N=Tt(t.view[_].line),H=t.view[_-1].node.nextSibling);var V=sn(e,i.line),Y,ae;if(V==t.view.length-1?(Y=t.viewTo-1,ae=t.lineDiv.lastChild):(Y=Tt(t.view[V+1].line)-1,ae=t.view[V+1].node.previousSibling),!H)return!1;for(var ue=e.doc.splitLines(tu(e,H,ae,N,Y)),Te=Pr(e.doc,je(N,0),je(Y,nt(e.doc,Y).text.length));ue.length>1&&Te.length>1;)if($(ue)==$(Te))ue.pop(),Te.pop(),Y--;else if(ue[0]==Te[0])ue.shift(),Te.shift(),N++;else break;for(var be=0,Re=0,Fe=ue[0],ze=Te[0],Ye=Math.min(Fe.length,ze.length);be<Ye&&Fe.charCodeAt(be)==ze.charCodeAt(be);)++be;for(var Ze=$(ue),$e=$(Te),tt=Math.min(Ze.length-(ue.length==1?be:0),$e.length-(Te.length==1?be:0));Re<tt&&Ze.charCodeAt(Ze.length-Re-1)==$e.charCodeAt($e.length-Re-1);)++Re;if(ue.length==1&&Te.length==1&&N==r.line)for(;be&&be>r.ch&&Ze.charCodeAt(Ze.length-Re-1)==$e.charCodeAt($e.length-Re-1);)be--,Re++;ue[ue.length-1]=Ze.slice(0,Ze.length-Re).replace(/^\u200b+/,""),ue[0]=ue[0].slice(be).replace(/\u200b+$/,"");var ut=je(N,be),ot=je(Y,Te.length?$(Te).length-Re:0);if(ue.length>1||ue[0]||dt(ut,ot))return kn(e.doc,ue,ut,ot,"+input"),!0},Ct.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ct.prototype.reset=function(){this.forceCompositionEnd()},Ct.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Ct.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},Ct.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&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 Ls(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),_=He(r,e.doc.direction),N="left";if(_){var H=Pe(_,t.ch);N=H%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 _="",N=!1,H=e.doc.lineSeparator(),V=!1;function Y(be){return function(Re){return Re.id==be}}function ae(){N&&(_+=H,V&&(_+=H),N=V=!1)}function ue(be){be&&(ae(),_+=be)}function Te(be){if(be.nodeType==1){var Re=be.getAttribute("cm-text");if(Re){ue(Re);return}var Fe=be.getAttribute("cm-marker"),ze;if(Fe){var Ye=e.findMarks(je(r,0),je(i+1,0),Y(+Fe));Ye.length&&(ze=Ye[0].find(0))&&ue(Pr(e.doc,ze.from,ze.to).join(H));return}if(be.getAttribute("contenteditable")=="false")return;var Ze=/^(pre|div|p|li|table|br)$/i.test(be.nodeName);if(!/^br$/i.test(be.nodeName)&&be.textContent.length==0)return;Ze&&ae();for(var $e=0;$e<be.childNodes.length;$e++)Te(be.childNodes[$e]);/^(pre|p)$/i.test(be.nodeName)&&(V=!0),Ze&&(N=!0)}else be.nodeType==3&&ue(be.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Te(t),t==n);)t=t.nextSibling,V=!1;return _}function ra(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Bn(e.clipPos(je(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 _=e.display.view[i];if(_.node==r)return ru(_,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!x(r,t))return Bn(je(Tt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var _=e.rest?$(e.rest):e.line;return Bn(je(Tt(_),_.text.length),i)}var N=t.nodeType==3?t:null,H=t;for(!N&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(N=t.firstChild,n&&(n=N.nodeValue.length));H.parentNode!=r;)H=H.parentNode;var V=e.measure,Y=V.maps;function ae(ze,Ye,Ze){for(var $e=-1;$e<(Y?Y.length:0);$e++)for(var tt=$e<0?V.map:Y[$e],ut=0;ut<tt.length;ut+=3){var ot=tt[ut+2];if(ot==ze||ot==Ye){var mt=Tt($e<0?e.line:e.rest[$e]),Dt=tt[ut]+Ze;return(Ze<0||ot!=ze)&&(Dt=tt[ut+(Ze?1:0)]),je(mt,Dt)}}}var ue=ae(N,H,n);if(ue)return Bn(ue,i);for(var Te=H.nextSibling,be=N?N.nodeValue.length-n:0;Te;Te=Te.nextSibling){if(ue=ae(Te,Te.firstChild,0),ue)return Bn(je(ue.line,ue.ch-be),i);be+=Te.textContent.length}for(var Re=H.previousSibling,Fe=n;Re;Re=Re.previousSibling){if(ue=ae(Re,Re.firstChild,-1),ue)return Bn(je(ue.line,ue.ch+Fe),i);Fe+=Re.textContent.length}}var Mt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new X,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),g&&(i.style.width="0px"),Ae(i,"input",function(){j&&F>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Ae(i,"paste",function(N){if(Ne(r,N)||_s(N,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function _(N){if(Ne(r,N))return;if(r.somethingSelected())ta({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var H=ws(r);ta({lineWise:!0,text:H.text}),N.type=="cut"?r.setSelections(H.ranges,null,me):(n.prevInput="",i.value=H.text.join(`
|
|
`),W(i))}else return;N.type=="cut"&&(r.state.cutIncoming=+new Date)}Ae(i,"cut",_),Ae(i,"copy",_),Ae(e.scroller,"paste",function(N){if(Nr(e,N)||Ne(r,N))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var H=new Event("paste");H.clipboardData=N.clipboardData,i.dispatchEvent(H)}),Ae(e.lineSpace,"selectstart",function(N){Nr(e,N)||J(N)}),Ae(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"})}}),Ae(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.wrapper.getBoundingClientRect(),N=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+N.top-_.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+N.left-_.left))}return r},Mt.prototype.showSelection=function(e){var t=this.cm,n=t.display;d(n.cursorDiv,e.cursors),d(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),j&&F>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",j&&F>=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"&&(!a||P()!=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(j&&F>=9&&this.hasSelection===i||s&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var _=i.charCodeAt(0);if(_==8203&&!r&&(r="\u200B"),_==8666)return this.reset(),this.cm.execCommand("undo")}for(var N=0,H=Math.min(r.length,i.length);N<H&&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(){j&&F>=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 _=on(n,e),N=r.scroller.scrollTop;if(!_||S)return;var H=n.options.resetSelectionOnContextMenu;H&&n.doc.sel.contains(_)==-1&&jt(n,Xt)(n.doc,zr(_),me);var V=i.style.cssText,Y=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: `+(j?"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=be,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function Te(){if(i.selectionStart!=null){var Fe=n.somethingSelected(),ze="\u200B"+(Fe?i.value:"");i.value="\u21DA",i.value=ze,t.prevInput=Fe?"":"\u200B",i.selectionStart=1,i.selectionEnd=ze.length,r.selForContextMenu=n.doc.sel}}function be(){if(t.contextMenuPending!=be)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=Y,i.style.cssText=V,j&&F<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=N),i.selectionStart!=null){(!j||j&&F<9)&&Te();var Fe=0,ze=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?jt(n,Xo)(n):Fe++<10?r.detectingSelectAll=setTimeout(ze,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(ze,200)}}if(j&&F>=9&&Te(),C){le(e);var Re=function(){Je(window,"mouseup",Re),setTimeout(be,20)};Ae(window,"mouseup",Re)}else setTimeout(be,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?M(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=P();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=H.getValue()}var i;if(e.form&&(Ae(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var _=e.form;i=_.submit;try{var N=_.submit=function(){r(),_.submit=i,_.submit(),_.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&&(Je(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var H=Lt(function(V){return e.parentNode.insertBefore(V,e.nextSibling)},t);return H}function iu(e){e.off=Je,e.on=Ae,e.wheelEventPixels=cl,e.Doc=rr,e.splitLines=ht,e.countColumn=K,e.findColumn=se,e.isWordChar=_e,e.Pass=xe,e.signal=Oe,e.Line=rn,e.changeEnd=Vr,e.scrollbarModel=_o,e.Pos=je,e.cmpPos=dt,e.modes=Ft,e.mimeModes=bt,e.resolveMode=lr,e.getMode=pr,e.modeExtensions=fr,e.extendMode=ia,e.copyState=Cr,e.startState=Hn,e.innerMode=Kn,e.commands=xi,e.keyMap=Br,e.keyName=us,e.isModifierKey=ss,e.lookupKey=Fn,e.normalizeKeyMap=Ml,e.StringStream=Rt,e.SharedTextMarker=yi,e.TextMarker=Yr,e.LineWidget=vi,e.e_preventDefault=J,e.e_stopPropagation=q,e.e_stop=le,e.addClass=U,e.contains=x,e.rmClass=c,e.keyNames=$r}$l(Lt),ql(Lt);var au="iter insert remove copy getEditor constructor".split(" ");for(var na in rr.prototype)rr.prototype.hasOwnProperty(na)&&ee(au,na)<0&&(Lt.prototype[na]=function(e){return function(){return e.apply(this.doc,arguments)}}(rr.prototype[na]));return fe(rr),Lt.inputStyles={textarea:Mt,contenteditable:Ct},Lt.defineMode=function(e){!Lt.defaults.mode&&e!="null"&&(Lt.defaults.mode=e),wr.apply(this,arguments)},Lt.defineMIME=Rr,Lt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Lt.defineMIME("text/plain","null"),Lt.defineExtension=function(e,t){Lt.prototype[e]=t},Lt.defineDocExtension=function(e,t){rr.prototype[e]=t},Lt.fromTextArea=nu,iu(Lt),Lt.version="5.58.2",Lt})},Y1PL:function(et,We,Q){"use strict";Q.r(We),Q.d(We,"ResizableTextArea",function(){return ee});var te=Q("wx14"),G=Q("1OyB"),A=Q("vuIU"),z=Q("Ji7U"),I=Q("LK+K"),R=Q("cDcd"),j=Q("VTBJ"),F=Q("rePB"),k=Q("Zm9Q"),L=Q("Kwbf"),v=Q("c+Xe"),S=Q("m+aA"),D=Q("bdgK"),T=new Map;function E(me){me.forEach(function(ge){var de,se=ge.target;(de=T.get(se))===null||de===void 0||de.forEach(function(ne){return ne(se)})})}var g=new D.default(E),u=null,a=null;function s(me,ge){T.has(me)||(T.set(me,new Set),g.observe(me)),T.get(me).add(ge)}function l(me,ge){T.has(me)&&(T.get(me).delete(ge),T.get(me).size||(g.unobserve(me),T.delete(me)))}var w=function(me){Object(z.a)(de,me);var ge=Object(I.a)(de);function de(){return Object(G.a)(this,de),ge.apply(this,arguments)}return Object(A.a)(de,[{key:"render",value:function(){return this.props.children}}]),de}(R.Component),p=R.createContext(null);function h(me){var ge=me.children,de=me.onBatchResize,se=R.useRef(0),ne=R.useRef([]),he=R.useContext(p),$=R.useCallback(function(ie,Z,Ee){se.current+=1;var Se=se.current;ne.current.push({size:ie,element:Z,data:Ee}),Promise.resolve().then(function(){Se===se.current&&(de==null||de(ne.current),ne.current=[])}),he==null||he(ie,Z,Ee)},[de,he]);return R.createElement(p.Provider,{value:$},ge)}function C(me){var ge=me.children,de=me.disabled,se=R.useRef(null),ne=R.useRef(null),he=R.useContext(p),$=R.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ie=R.isValidElement(ge)&&Object(v.c)(ge),Z=ie?ge.ref:null,Ee=R.useMemo(function(){return Object(v.a)(Z,se)},[Z,se]),Se=R.useRef(me);Se.current=me;var ye=R.useCallback(function(_e){var Le=Se.current,Ie=Le.onResize,Me=Le.data,Ce=_e.getBoundingClientRect(),we=Ce.width,Be=Ce.height,Ke=_e.offsetWidth,Ue=_e.offsetHeight,Pe=Math.floor(we),Ve=Math.floor(Be);if($.current.width!==Pe||$.current.height!==Ve||$.current.offsetWidth!==Ke||$.current.offsetHeight!==Ue){var He={width:Pe,height:Ve,offsetWidth:Ke,offsetHeight:Ue};$.current=He;var Xe=Ke===Math.round(we)?we:Ke,Ae=Ue===Math.round(Be)?Be:Ue,qe=Object(j.a)(Object(j.a)({},He),{},{offsetWidth:Xe,offsetHeight:Ae});he==null||he(qe,_e,Me),Ie&&Promise.resolve().then(function(){Ie(qe,_e)})}},[]);return R.useEffect(function(){var _e=Object(S.a)(se.current)||Object(S.a)(ne.current);return _e&&!de&&s(_e,ye),function(){return l(_e,ye)}},[se.current,de]),R.createElement(w,{ref:ne},ie?R.cloneElement(ge,{ref:Ee}):ge)}var b="rc-observer-key";function c(me){var ge=me.children,de=Object(k.a)(ge);return de.map(function(se,ne){var he=(se==null?void 0:se.key)||"".concat(b,"-").concat(ne);return R.createElement(C,Object(te.a)({},me,{key:he}),se)})}c.Collection=h;var f=c,d=Q("bT9E"),o=Q("TSYQ"),y=Q.n(o),m=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,x=["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"],P={},U;function B(me){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,de=me.getAttribute("id")||me.getAttribute("data-reactid")||me.getAttribute("name");if(ge&&P[de])return P[de];var se=window.getComputedStyle(me),ne=se.getPropertyValue("box-sizing")||se.getPropertyValue("-moz-box-sizing")||se.getPropertyValue("-webkit-box-sizing"),he=parseFloat(se.getPropertyValue("padding-bottom"))+parseFloat(se.getPropertyValue("padding-top")),$=parseFloat(se.getPropertyValue("border-bottom-width"))+parseFloat(se.getPropertyValue("border-top-width")),ie=x.map(function(Ee){return"".concat(Ee,":").concat(se.getPropertyValue(Ee))}).join(";"),Z={sizingStyle:ie,paddingSize:he,borderSize:$,boxSizing:ne};return ge&&de&&(P[de]=Z),Z}function W(me){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,de=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,se=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;U||(U=document.createElement("textarea"),U.setAttribute("tab-index","-1"),U.setAttribute("aria-hidden","true"),document.body.appendChild(U)),me.getAttribute("wrap")?U.setAttribute("wrap",me.getAttribute("wrap")):U.removeAttribute("wrap");var ne=B(me,ge),he=ne.paddingSize,$=ne.borderSize,ie=ne.boxSizing,Z=ne.sizingStyle;U.setAttribute("style","".concat(Z,";").concat(m)),U.value=me.value||me.placeholder||"";var Ee=Number.MIN_SAFE_INTEGER,Se=Number.MAX_SAFE_INTEGER,ye=U.scrollHeight,_e;if(ie==="border-box"?ye+=$:ie==="content-box"&&(ye-=he),de!==null||se!==null){U.value=" ";var Le=U.scrollHeight-he;de!==null&&(Ee=Le*de,ie==="border-box"&&(Ee=Ee+he+$),ye=Math.max(Ee,ye)),se!==null&&(Se=Le*se,ie==="border-box"&&(Se=Se+he+$),_e=ye>Se?"":"hidden",ye=Math.min(Se,ye))}return{height:ye,minHeight:Ee,maxHeight:Se,overflowY:_e,resize:"none"}}var O=Q("Gytx"),M=Q.n(O),K;(function(me){me[me.NONE=0]="NONE",me[me.RESIZING=1]="RESIZING",me[me.RESIZED=2]="RESIZED"})(K||(K={}));var X=function(me){Object(z.a)(de,me);var ge=Object(I.a)(de);function de(se){var ne;return Object(G.a)(this,de),ne=ge.call(this,se),ne.nextFrameActionId=void 0,ne.resizeFrameId=void 0,ne.textArea=void 0,ne.saveTextArea=function(he){ne.textArea=he},ne.handleResize=function(he){var $=ne.state.resizeStatus,ie=ne.props,Z=ie.autoSize,Ee=ie.onResize;if($!==K.NONE)return;typeof Ee=="function"&&Ee(he),Z&&ne.resizeOnNextFrame()},ne.resizeOnNextFrame=function(){cancelAnimationFrame(ne.nextFrameActionId),ne.nextFrameActionId=requestAnimationFrame(ne.resizeTextarea)},ne.resizeTextarea=function(){var he=ne.props.autoSize;if(!he||!ne.textArea)return;var $=he.minRows,ie=he.maxRows,Z=W(ne.textArea,!1,$,ie);ne.setState({textareaStyles:Z,resizeStatus:K.RESIZING},function(){cancelAnimationFrame(ne.resizeFrameId),ne.resizeFrameId=requestAnimationFrame(function(){ne.setState({resizeStatus:K.RESIZED},function(){ne.resizeFrameId=requestAnimationFrame(function(){ne.setState({resizeStatus:K.NONE}),ne.fixFirefoxAutoScroll()})})})})},ne.renderTextArea=function(){var he=ne.props,$=he.prefixCls,ie=$===void 0?"rc-textarea":$,Z=he.autoSize,Ee=he.onResize,Se=he.className,ye=he.disabled,_e=ne.state,Le=_e.textareaStyles,Ie=_e.resizeStatus,Me=Object(d.a)(ne.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ce=y()(ie,Se,Object(F.a)({},"".concat(ie,"-disabled"),ye));"value"in Me&&(Me.value=Me.value||"");var we=Object(j.a)(Object(j.a)(Object(j.a)({},ne.props.style),Le),Ie===K.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return R.createElement(f,{onResize:ne.handleResize,disabled:!(Z||Ee)},R.createElement("textarea",Object(te.a)({},Me,{className:Ce,style:we,ref:ne.saveTextArea})))},ne.state={textareaStyles:{},resizeStatus:K.NONE},ne}return Object(A.a)(de,[{key:"componentDidUpdate",value:function(ne){(ne.value!==this.props.value||!M()(ne.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 ne=this.textArea.selectionStart,he=this.textArea.selectionEnd;this.textArea.setSelectionRange(ne,he)}}catch($){}}},{key:"render",value:function(){return this.renderTextArea()}}]),de}(R.Component),ee=X,oe=function(me){Object(z.a)(de,me);var ge=Object(I.a)(de);function de(se){var ne;Object(G.a)(this,de),ne=ge.call(this,se),ne.resizableTextArea=void 0,ne.focus=function(){ne.resizableTextArea.textArea.focus()},ne.saveTextArea=function($){ne.resizableTextArea=$},ne.handleChange=function($){var ie=ne.props.onChange;ne.setValue($.target.value,function(){ne.resizableTextArea.resizeTextarea()}),ie&&ie($)},ne.handleKeyDown=function($){var ie=ne.props,Z=ie.onPressEnter,Ee=ie.onKeyDown;$.keyCode===13&&Z&&Z($),Ee&&Ee($)};var he=typeof se.value=="undefined"||se.value===null?se.defaultValue:se.value;return ne.state={value:he},ne}return Object(A.a)(de,[{key:"setValue",value:function(ne,he){"value"in this.props||this.setState({value:ne},he)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return R.createElement(ee,Object(te.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ne){return"value"in ne?{value:ne.value}:null}}]),de}(R.Component),xe=We.default=oe},ZpRC:function(et,We,Q){"use strict";function te(v){return typeof v=="object"&&v!=null&&v.nodeType===1}function G(v,S){return(!S||v!=="hidden")&&v!=="visible"&&v!=="clip"}function A(v,S){if(v.clientHeight<v.scrollHeight||v.clientWidth<v.scrollWidth){var D=getComputedStyle(v,null);return G(D.overflowY,S)||G(D.overflowX,S)||function(T){var E=function(g){if(!g.ownerDocument||!g.ownerDocument.defaultView)return null;try{return g.ownerDocument.defaultView.frameElement}catch(u){return null}}(T);return!!E&&(E.clientHeight<T.scrollHeight||E.clientWidth<T.scrollWidth)}(v)}return!1}function z(v,S,D,T,E,g,u,a){return g<v&&u>S||g>v&&u<S?0:g<=v&&a<=D||u>=S&&a>=D?g-v-T:u>S&&a<D||g<v&&a>D?u-S+E:0}var I=function(v,S){var D=window,T=S.scrollMode,E=S.block,g=S.inline,u=S.boundary,a=S.skipOverflowHiddenElements,s=typeof u=="function"?u:function(Le){return Le!==u};if(!te(v))throw new TypeError("Invalid target");for(var l=document.scrollingElement||document.documentElement,w=[],p=v;te(p)&&s(p);){if((p=p.parentElement)===l){w.push(p);break}p!=null&&p===document.body&&A(p)&&!A(document.documentElement)||p!=null&&A(p,a)&&w.push(p)}for(var h=D.visualViewport?D.visualViewport.width:innerWidth,C=D.visualViewport?D.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,c=window.scrollY||pageYOffset,f=v.getBoundingClientRect(),d=f.height,o=f.width,y=f.top,m=f.right,x=f.bottom,P=f.left,U=E==="start"||E==="nearest"?y:E==="end"?x:y+d/2,B=g==="center"?P+o/2:g==="end"?m:P,W=[],O=0;O<w.length;O++){var M=w[O],K=M.getBoundingClientRect(),X=K.height,ee=K.width,oe=K.top,xe=K.right,me=K.bottom,ge=K.left;if(T==="if-needed"&&y>=0&&P>=0&&x<=C&&m<=h&&y>=oe&&x<=me&&P>=ge&&m<=xe)return W;var de=getComputedStyle(M),se=parseInt(de.borderLeftWidth,10),ne=parseInt(de.borderTopWidth,10),he=parseInt(de.borderRightWidth,10),$=parseInt(de.borderBottomWidth,10),ie=0,Z=0,Ee="offsetWidth"in M?M.offsetWidth-M.clientWidth-se-he:0,Se="offsetHeight"in M?M.offsetHeight-M.clientHeight-ne-$:0;if(l===M)ie=E==="start"?U:E==="end"?U-C:E==="nearest"?z(c,c+C,C,ne,$,c+U,c+U+d,d):U-C/2,Z=g==="start"?B:g==="center"?B-h/2:g==="end"?B-h:z(b,b+h,h,se,he,b+B,b+B+o,o),ie=Math.max(0,ie+c),Z=Math.max(0,Z+b);else{ie=E==="start"?U-oe-ne:E==="end"?U-me+$+Se:E==="nearest"?z(oe,me,X,ne,$+Se,U,U+d,d):U-(oe+X/2)+Se/2,Z=g==="start"?B-ge-se:g==="center"?B-(ge+ee/2)+Ee/2:g==="end"?B-xe+he+Ee:z(ge,xe,ee,se,he+Ee,B,B+o,o);var ye=M.scrollLeft,_e=M.scrollTop;U+=_e-(ie=Math.max(0,Math.min(_e+ie,M.scrollHeight-X+Se))),B+=ye-(Z=Math.max(0,Math.min(ye+Z,M.scrollWidth-ee+Ee)))}W.push({el:M,top:ie,left:Z})}return W};function R(v){return v===Object(v)&&Object.keys(v).length!==0}function j(v,S){S===void 0&&(S="auto");var D="scrollBehavior"in document.body.style;v.forEach(function(T){var E=T.el,g=T.top,u=T.left;E.scroll&&D?E.scroll({top:g,left:u,behavior:S}):(E.scrollTop=g,E.scrollLeft=u)})}function F(v){return v===!1?{block:"end",inline:"nearest"}:R(v)?v:{block:"start",inline:"nearest"}}function k(v,S){var D=!v.ownerDocument.documentElement.contains(v);if(R(S)&&typeof S.behavior=="function")return S.behavior(D?[]:I(v,S));if(D)return;var T=F(S);return j(I(v,T),T.behavior)}var L=We.a=k},Zss7:function(et,We,Q){var te;(function(G){var A=/^\s+/,z=/\s+$/,I=0,R=G.round,j=G.min,F=G.max,k=G.random;function L($,ie){if($=$||"",ie=ie||{},$ instanceof L)return $;if(!(this instanceof L))return new L($,ie);var Z=v($);this._originalInput=$,this._r=Z.r,this._g=Z.g,this._b=Z.b,this._a=Z.a,this._roundA=R(100*this._a)/100,this._format=ie.format||Z.format,this._gradientType=ie.gradientType,this._r<1&&(this._r=R(this._r)),this._g<1&&(this._g=R(this._g)),this._b<1&&(this._b=R(this._b)),this._ok=Z.ok,this._tc_id=I++}L.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 $=this.toRgb();return($.r*299+$.g*587+$.b*114)/1e3},getLuminance:function(){var $=this.toRgb(),ie,Z,Ee,Se,ye,_e;return ie=$.r/255,Z=$.g/255,Ee=$.b/255,ie<=.03928?Se=ie/12.92:Se=G.pow((ie+.055)/1.055,2.4),Z<=.03928?ye=Z/12.92:ye=G.pow((Z+.055)/1.055,2.4),Ee<=.03928?_e=Ee/12.92:_e=G.pow((Ee+.055)/1.055,2.4),.2126*Se+.7152*ye+.0722*_e},setAlpha:function($){return this._a=W($),this._roundA=R(100*this._a)/100,this},toHsv:function(){var $=E(this._r,this._g,this._b);return{h:$.h*360,s:$.s,v:$.v,a:this._a}},toHsvString:function(){var $=E(this._r,this._g,this._b),ie=R($.h*360),Z=R($.s*100),Ee=R($.v*100);return this._a==1?"hsv("+ie+", "+Z+"%, "+Ee+"%)":"hsva("+ie+", "+Z+"%, "+Ee+"%, "+this._roundA+")"},toHsl:function(){var $=D(this._r,this._g,this._b);return{h:$.h*360,s:$.s,l:$.l,a:this._a}},toHslString:function(){var $=D(this._r,this._g,this._b),ie=R($.h*360),Z=R($.s*100),Ee=R($.l*100);return this._a==1?"hsl("+ie+", "+Z+"%, "+Ee+"%)":"hsla("+ie+", "+Z+"%, "+Ee+"%, "+this._roundA+")"},toHex:function($){return u(this._r,this._g,this._b,$)},toHexString:function($){return"#"+this.toHex($)},toHex8:function($){return a(this._r,this._g,this._b,this._a,$)},toHex8String:function($){return"#"+this.toHex8($)},toRgb:function(){return{r:R(this._r),g:R(this._g),b:R(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+R(this._r)+", "+R(this._g)+", "+R(this._b)+")":"rgba("+R(this._r)+", "+R(this._g)+", "+R(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:R(O(this._r,255)*100)+"%",g:R(O(this._g,255)*100)+"%",b:R(O(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+R(O(this._r,255)*100)+"%, "+R(O(this._g,255)*100)+"%, "+R(O(this._b,255)*100)+"%)":"rgba("+R(O(this._r,255)*100)+"%, "+R(O(this._g,255)*100)+"%, "+R(O(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:U[u(this._r,this._g,this._b,!0)]||!1},toFilter:function($){var ie="#"+s(this._r,this._g,this._b,this._a),Z=ie,Ee=this._gradientType?"GradientType = 1, ":"";if($){var Se=L($);Z="#"+s(Se._r,Se._g,Se._b,Se._a)}return"progid:DXImageTransform.Microsoft.gradient("+Ee+"startColorstr="+ie+",endColorstr="+Z+")"},toString:function($){var ie=!!$;$=$||this._format;var Z=!1,Ee=this._a<1&&this._a>=0,Se=!ie&&Ee&&($==="hex"||$==="hex6"||$==="hex3"||$==="hex4"||$==="hex8"||$==="name");return Se?$==="name"&&this._a===0?this.toName():this.toRgbString():($==="rgb"&&(Z=this.toRgbString()),$==="prgb"&&(Z=this.toPercentageRgbString()),($==="hex"||$==="hex6")&&(Z=this.toHexString()),$==="hex3"&&(Z=this.toHexString(!0)),$==="hex4"&&(Z=this.toHex8String(!0)),$==="hex8"&&(Z=this.toHex8String()),$==="name"&&(Z=this.toName()),$==="hsl"&&(Z=this.toHslString()),$==="hsv"&&(Z=this.toHsvString()),Z||this.toHexString())},clone:function(){return L(this.toString())},_applyModification:function($,ie){var Z=$.apply(null,[this].concat([].slice.call(ie)));return this._r=Z._r,this._g=Z._g,this._b=Z._b,this.setAlpha(Z._a),this},lighten:function(){return this._applyModification(h,arguments)},brighten:function(){return this._applyModification(C,arguments)},darken:function(){return this._applyModification(b,arguments)},desaturate:function(){return this._applyModification(l,arguments)},saturate:function(){return this._applyModification(w,arguments)},greyscale:function(){return this._applyModification(p,arguments)},spin:function(){return this._applyModification(c,arguments)},_applyCombination:function($,ie){return $.apply(null,[this].concat([].slice.call(ie)))},analogous:function(){return this._applyCombination(m,arguments)},complement:function(){return this._applyCombination(f,arguments)},monochromatic:function(){return this._applyCombination(x,arguments)},splitcomplement:function(){return this._applyCombination(y,arguments)},triad:function(){return this._applyCombination(d,arguments)},tetrad:function(){return this._applyCombination(o,arguments)}},L.fromRatio=function($,ie){if(typeof $=="object"){var Z={};for(var Ee in $)$.hasOwnProperty(Ee)&&(Ee==="a"?Z[Ee]=$[Ee]:Z[Ee]=xe($[Ee]));$=Z}return L($,ie)};function v($){var ie={r:0,g:0,b:0},Z=1,Ee=null,Se=null,ye=null,_e=!1,Le=!1;return typeof $=="string"&&($=ne($)),typeof $=="object"&&(se($.r)&&se($.g)&&se($.b)?(ie=S($.r,$.g,$.b),_e=!0,Le=String($.r).substr(-1)==="%"?"prgb":"rgb"):se($.h)&&se($.s)&&se($.v)?(Ee=xe($.s),Se=xe($.v),ie=g($.h,Ee,Se),_e=!0,Le="hsv"):se($.h)&&se($.s)&&se($.l)&&(Ee=xe($.s),ye=xe($.l),ie=T($.h,Ee,ye),_e=!0,Le="hsl"),$.hasOwnProperty("a")&&(Z=$.a)),Z=W(Z),{ok:_e,format:$.format||Le,r:j(255,F(ie.r,0)),g:j(255,F(ie.g,0)),b:j(255,F(ie.b,0)),a:Z}}function S($,ie,Z){return{r:O($,255)*255,g:O(ie,255)*255,b:O(Z,255)*255}}function D($,ie,Z){$=O($,255),ie=O(ie,255),Z=O(Z,255);var Ee=F($,ie,Z),Se=j($,ie,Z),ye,_e,Le=(Ee+Se)/2;if(Ee==Se)ye=_e=0;else{var Ie=Ee-Se;_e=Le>.5?Ie/(2-Ee-Se):Ie/(Ee+Se);switch(Ee){case $:ye=(ie-Z)/Ie+(ie<Z?6:0);break;case ie:ye=(Z-$)/Ie+2;break;case Z:ye=($-ie)/Ie+4;break}ye/=6}return{h:ye,s:_e,l:Le}}function T($,ie,Z){var Ee,Se,ye;$=O($,360),ie=O(ie,100),Z=O(Z,100);function _e(Me,Ce,we){return we<0&&(we+=1),we>1&&(we-=1),we<1/6?Me+(Ce-Me)*6*we:we<1/2?Ce:we<2/3?Me+(Ce-Me)*(2/3-we)*6:Me}if(ie===0)Ee=Se=ye=Z;else{var Le=Z<.5?Z*(1+ie):Z+ie-Z*ie,Ie=2*Z-Le;Ee=_e(Ie,Le,$+1/3),Se=_e(Ie,Le,$),ye=_e(Ie,Le,$-1/3)}return{r:Ee*255,g:Se*255,b:ye*255}}function E($,ie,Z){$=O($,255),ie=O(ie,255),Z=O(Z,255);var Ee=F($,ie,Z),Se=j($,ie,Z),ye,_e,Le=Ee,Ie=Ee-Se;if(_e=Ee===0?0:Ie/Ee,Ee==Se)ye=0;else{switch(Ee){case $:ye=(ie-Z)/Ie+(ie<Z?6:0);break;case ie:ye=(Z-$)/Ie+2;break;case Z:ye=($-ie)/Ie+4;break}ye/=6}return{h:ye,s:_e,v:Le}}function g($,ie,Z){$=O($,360)*6,ie=O(ie,100),Z=O(Z,100);var Ee=G.floor($),Se=$-Ee,ye=Z*(1-ie),_e=Z*(1-Se*ie),Le=Z*(1-(1-Se)*ie),Ie=Ee%6,Me=[Z,_e,ye,ye,Le,Z][Ie],Ce=[Le,Z,Z,_e,ye,ye][Ie],we=[ye,ye,Le,Z,Z,_e][Ie];return{r:Me*255,g:Ce*255,b:we*255}}function u($,ie,Z,Ee){var Se=[oe(R($).toString(16)),oe(R(ie).toString(16)),oe(R(Z).toString(16))];return Ee&&Se[0].charAt(0)==Se[0].charAt(1)&&Se[1].charAt(0)==Se[1].charAt(1)&&Se[2].charAt(0)==Se[2].charAt(1)?Se[0].charAt(0)+Se[1].charAt(0)+Se[2].charAt(0):Se.join("")}function a($,ie,Z,Ee,Se){var ye=[oe(R($).toString(16)),oe(R(ie).toString(16)),oe(R(Z).toString(16)),oe(me(Ee))];return Se&&ye[0].charAt(0)==ye[0].charAt(1)&&ye[1].charAt(0)==ye[1].charAt(1)&&ye[2].charAt(0)==ye[2].charAt(1)&&ye[3].charAt(0)==ye[3].charAt(1)?ye[0].charAt(0)+ye[1].charAt(0)+ye[2].charAt(0)+ye[3].charAt(0):ye.join("")}function s($,ie,Z,Ee){var Se=[oe(me(Ee)),oe(R($).toString(16)),oe(R(ie).toString(16)),oe(R(Z).toString(16))];return Se.join("")}L.equals=function($,ie){return!$||!ie?!1:L($).toRgbString()==L(ie).toRgbString()},L.random=function(){return L.fromRatio({r:k(),g:k(),b:k()})};function l($,ie){ie=ie===0?0:ie||10;var Z=L($).toHsl();return Z.s-=ie/100,Z.s=M(Z.s),L(Z)}function w($,ie){ie=ie===0?0:ie||10;var Z=L($).toHsl();return Z.s+=ie/100,Z.s=M(Z.s),L(Z)}function p($){return L($).desaturate(100)}function h($,ie){ie=ie===0?0:ie||10;var Z=L($).toHsl();return Z.l+=ie/100,Z.l=M(Z.l),L(Z)}function C($,ie){ie=ie===0?0:ie||10;var Z=L($).toRgb();return Z.r=F(0,j(255,Z.r-R(255*-(ie/100)))),Z.g=F(0,j(255,Z.g-R(255*-(ie/100)))),Z.b=F(0,j(255,Z.b-R(255*-(ie/100)))),L(Z)}function b($,ie){ie=ie===0?0:ie||10;var Z=L($).toHsl();return Z.l-=ie/100,Z.l=M(Z.l),L(Z)}function c($,ie){var Z=L($).toHsl(),Ee=(Z.h+ie)%360;return Z.h=Ee<0?360+Ee:Ee,L(Z)}function f($){var ie=L($).toHsl();return ie.h=(ie.h+180)%360,L(ie)}function d($){var ie=L($).toHsl(),Z=ie.h;return[L($),L({h:(Z+120)%360,s:ie.s,l:ie.l}),L({h:(Z+240)%360,s:ie.s,l:ie.l})]}function o($){var ie=L($).toHsl(),Z=ie.h;return[L($),L({h:(Z+90)%360,s:ie.s,l:ie.l}),L({h:(Z+180)%360,s:ie.s,l:ie.l}),L({h:(Z+270)%360,s:ie.s,l:ie.l})]}function y($){var ie=L($).toHsl(),Z=ie.h;return[L($),L({h:(Z+72)%360,s:ie.s,l:ie.l}),L({h:(Z+216)%360,s:ie.s,l:ie.l})]}function m($,ie,Z){ie=ie||6,Z=Z||30;var Ee=L($).toHsl(),Se=360/Z,ye=[L($)];for(Ee.h=(Ee.h-(Se*ie>>1)+720)%360;--ie;)Ee.h=(Ee.h+Se)%360,ye.push(L(Ee));return ye}function x($,ie){ie=ie||6;for(var Z=L($).toHsv(),Ee=Z.h,Se=Z.s,ye=Z.v,_e=[],Le=1/ie;ie--;)_e.push(L({h:Ee,s:Se,v:ye})),ye=(ye+Le)%1;return _e}L.mix=function($,ie,Z){Z=Z===0?0:Z||50;var Ee=L($).toRgb(),Se=L(ie).toRgb(),ye=Z/100,_e={r:(Se.r-Ee.r)*ye+Ee.r,g:(Se.g-Ee.g)*ye+Ee.g,b:(Se.b-Ee.b)*ye+Ee.b,a:(Se.a-Ee.a)*ye+Ee.a};return L(_e)},L.readability=function($,ie){var Z=L($),Ee=L(ie);return(G.max(Z.getLuminance(),Ee.getLuminance())+.05)/(G.min(Z.getLuminance(),Ee.getLuminance())+.05)},L.isReadable=function($,ie,Z){var Ee=L.readability($,ie),Se,ye;ye=!1,Se=he(Z);switch(Se.level+Se.size){case"AAsmall":case"AAAlarge":ye=Ee>=4.5;break;case"AAlarge":ye=Ee>=3;break;case"AAAsmall":ye=Ee>=7;break}return ye},L.mostReadable=function($,ie,Z){var Ee=null,Se=0,ye,_e,Le,Ie;Z=Z||{},_e=Z.includeFallbackColors,Le=Z.level,Ie=Z.size;for(var Me=0;Me<ie.length;Me++)ye=L.readability($,ie[Me]),ye>Se&&(Se=ye,Ee=L(ie[Me]));return L.isReadable($,Ee,{level:Le,size:Ie})||!_e?Ee:(Z.includeFallbackColors=!1,L.mostReadable($,["#fff","#000"],Z))};var P=L.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"},U=L.hexNames=B(P);function B($){var ie={};for(var Z in $)$.hasOwnProperty(Z)&&(ie[$[Z]]=Z);return ie}function W($){return $=parseFloat($),(isNaN($)||$<0||$>1)&&($=1),$}function O($,ie){X($)&&($="100%");var Z=ee($);return $=j(ie,F(0,parseFloat($))),Z&&($=parseInt($*ie,10)/100),G.abs($-ie)<1e-6?1:$%ie/parseFloat(ie)}function M($){return j(1,F(0,$))}function K($){return parseInt($,16)}function X($){return typeof $=="string"&&$.indexOf(".")!=-1&&parseFloat($)===1}function ee($){return typeof $=="string"&&$.indexOf("%")!=-1}function oe($){return $.length==1?"0"+$:""+$}function xe($){return $<=1&&($=$*100+"%"),$}function me($){return G.round(parseFloat($)*255).toString(16)}function ge($){return K($)/255}var de=function(){var $="[-\\+]?\\d+%?",ie="[-\\+]?\\d*\\.\\d+%?",Z="(?:"+ie+")|(?:"+$+")",Ee="[\\s|\\(]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")\\s*\\)?",Se="[\\s|\\(]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")\\s*\\)?";return{CSS_UNIT:new RegExp(Z),rgb:new RegExp("rgb"+Ee),rgba:new RegExp("rgba"+Se),hsl:new RegExp("hsl"+Ee),hsla:new RegExp("hsla"+Se),hsv:new RegExp("hsv"+Ee),hsva:new RegExp("hsva"+Se),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function se($){return!!de.CSS_UNIT.exec($)}function ne($){$=$.replace(A,"").replace(z,"").toLowerCase();var ie=!1;if(P[$])$=P[$],ie=!0;else if($=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var Z;return(Z=de.rgb.exec($))?{r:Z[1],g:Z[2],b:Z[3]}:(Z=de.rgba.exec($))?{r:Z[1],g:Z[2],b:Z[3],a:Z[4]}:(Z=de.hsl.exec($))?{h:Z[1],s:Z[2],l:Z[3]}:(Z=de.hsla.exec($))?{h:Z[1],s:Z[2],l:Z[3],a:Z[4]}:(Z=de.hsv.exec($))?{h:Z[1],s:Z[2],v:Z[3]}:(Z=de.hsva.exec($))?{h:Z[1],s:Z[2],v:Z[3],a:Z[4]}:(Z=de.hex8.exec($))?{r:K(Z[1]),g:K(Z[2]),b:K(Z[3]),a:ge(Z[4]),format:ie?"name":"hex8"}:(Z=de.hex6.exec($))?{r:K(Z[1]),g:K(Z[2]),b:K(Z[3]),format:ie?"name":"hex"}:(Z=de.hex4.exec($))?{r:K(Z[1]+""+Z[1]),g:K(Z[2]+""+Z[2]),b:K(Z[3]+""+Z[3]),a:ge(Z[4]+""+Z[4]),format:ie?"name":"hex8"}:(Z=de.hex3.exec($))?{r:K(Z[1]+""+Z[1]),g:K(Z[2]+""+Z[2]),b:K(Z[3]+""+Z[3]),format:ie?"name":"hex"}:!1}function he($){var ie,Z;return $=$||{level:"AA",size:"small"},ie=($.level||"AA").toUpperCase(),Z=($.size||"small").toLowerCase(),ie!=="AA"&&ie!=="AAA"&&(ie="AA"),Z!=="small"&&Z!=="large"&&(Z="small"),{level:ie,size:Z}}et.exports?et.exports=L:!(te=function(){return L}.call(We,Q,We,et),te!==void 0&&(et.exports=te))})(Math)},bT9E:function(et,We,Q){"use strict";Q.d(We,"a",function(){return G});var te=Q("VTBJ");function G(A,z){var I=Object(te.a)({},A);return Array.isArray(z)&&z.forEach(function(R){delete I[R]}),I}},c5Ni:function(et,We,Q){},dejd:function(et,We,Q){},dmUQ:function(et,We,Q){"use strict";var te=Q("Ff2n"),G=Q("rePB"),A=Q("1OyB"),z=Q("vuIU"),I=Q("Ji7U"),R=Q("md7G"),j=Q("foSv"),F=Q("cDcd"),k=Q.n(F),L=Q("TSYQ"),v=Q.n(L),S=Q("4IlW");function D(d,o){var y=Object.keys(d);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(d);o&&(m=m.filter(function(x){return Object.getOwnPropertyDescriptor(d,x).enumerable})),y.push.apply(y,m)}return y}function T(d){for(var o=1;o<arguments.length;o++){var y=arguments[o]!=null?arguments[o]:{};o%2?D(Object(y),!0).forEach(function(m){Object(G.a)(d,m,y[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(y)):D(Object(y)).forEach(function(m){Object.defineProperty(d,m,Object.getOwnPropertyDescriptor(y,m))})}return d}function E(d){var o=g();return function(){var m=Object(j.a)(d),x;if(o){var P=Object(j.a)(this).constructor;x=Reflect.construct(m,arguments,P)}else x=m.apply(this,arguments);return Object(R.a)(this,x)}}function g(){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(d){return!1}}function u(){}function a(d){d.preventDefault()}var s=function(o){return o.replace(/[^\w.-]+/g,"")},l=200,w=600,p=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,h=function(o){return o!=null},C=function(o,y){return y===o||typeof y=="number"&&typeof o=="number"&&isNaN(y)&&isNaN(o)},b=function(d){Object(I.a)(y,d);var o=E(y);function y(m){var x;Object(A.a)(this,y),x=o.call(this,m),x.onKeyDown=function(B){var W=x.props,O=W.onKeyDown,M=W.onPressEnter;if(B.keyCode===S.a.UP){var K=x.getRatio(B);x.up(B,K,null),x.stop()}else if(B.keyCode===S.a.DOWN){var X=x.getRatio(B);x.down(B,X,null),x.stop()}else B.keyCode===S.a.ENTER&&M&&M(B);if(x.recordCursorPosition(),x.lastKeyCode=B.keyCode,O){for(var ee=arguments.length,oe=new Array(ee>1?ee-1:0),xe=1;xe<ee;xe++)oe[xe-1]=arguments[xe];O.apply(void 0,[B].concat(oe))}},x.onKeyUp=function(B){var W=x.props.onKeyUp;if(x.stop(),x.recordCursorPosition(),W){for(var O=arguments.length,M=new Array(O>1?O-1:0),K=1;K<O;K++)M[K-1]=arguments[K];W.apply(void 0,[B].concat(M))}},x.onChange=function(B){var W=x.props.onChange;x.state.focused&&(x.inputting=!0),x.rawInput=x.props.parser(x.getValueFromEvent(B)),x.setState({inputValue:x.rawInput}),W(x.toNumber(x.rawInput))},x.onMouseUp=function(){var B=x.props.onMouseUp;x.recordCursorPosition(),B&&B.apply(void 0,arguments)},x.onFocus=function(){var B;x.setState({focused:!0}),(B=x.props).onFocus.apply(B,arguments)},x.onBlur=function(){var B=x.props.onBlur;x.inputting=!1,x.setState({focused:!1});var W=x.getCurrentValidValue(x.state.inputValue),O=x.setValue(W,u);if(B){var M=x.input.value,K=x.getInputDisplayValue({focus:!1,value:O});x.input.value=K&&Number(K),B.apply(void 0,arguments),x.input.value=M}},x.getRatio=function(B){var W=1;return B.metaKey||B.ctrlKey?W=.1:B.shiftKey&&(W=10),W},x.getFullNum=function(B){return isNaN(B)?B:/e/i.test(String(B))?Number(B).toFixed(18).replace(/\.?0+$/,""):B},x.getPrecision=function(B){if(h(x.props.precision))return x.props.precision;var W=String(B);if(W.indexOf("e-")>=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var O=0;return W.indexOf(".")>=0&&(O=W.length-W.indexOf(".")-1),O},x.getInputDisplayValue=function(B){var W=B||x.state,O=W.focused,M=W.inputValue,K=W.value,X;O?X=M:X=x.toPrecisionAsStep(K),X==null&&(X="");var ee=x.formatWrapper(X);return h(x.props.decimalSeparator)&&(ee=ee.toString().replace(".",x.props.decimalSeparator)),ee},x.recordCursorPosition=function(){try{x.cursorStart=x.input.selectionStart,x.cursorEnd=x.input.selectionEnd,x.currentValue=x.input.value,x.cursorBefore=x.input.value.substring(0,x.cursorStart),x.cursorAfter=x.input.value.substring(x.cursorEnd)}catch(B){}},x.restoreByAfter=function(B){if(B===void 0)return!1;var W=x.input.value,O=W.lastIndexOf(B);if(O===-1)return!1;var M=x.cursorBefore.length;return x.lastKeyCode===S.a.DELETE&&x.cursorBefore.charAt(M-1)===B[0]?(x.fixCaret(M,M),!0):O+B.length===W.length?(x.fixCaret(O,O),!0):!1},x.partRestoreByAfter=function(B){return B===void 0?!1:Array.prototype.some.call(B,function(W,O){var M=B.substring(O);return x.restoreByAfter(M)})},x.isNotCompleteNumber=function(B){return isNaN(B)||B===""||B===null||B&&B.toString().indexOf(".")===B.toString().length-1},x.stop=function(){x.autoStepTimer&&clearTimeout(x.autoStepTimer)},x.down=function(B,W,O){x.pressingUpOrDown=!0,x.step("down",B,W,O)},x.up=function(B,W,O){x.pressingUpOrDown=!0,x.step("up",B,W,O)},x.saveInput=function(B){x.input=B};var P=m.value;P===void 0&&(P=m.defaultValue),x.state={focused:m.autoFocus};var U=x.getValidValue(x.toNumber(P));return x.state=T(T({},x.state),{},{inputValue:x.toPrecisionAsStep(U),value:U}),x}return Object(z.a)(y,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(x){var P=this.props,U=P.value,B=P.onChange,W=P.max,O=P.min,M=this.state.focused;if(x){if(!C(x.value,U)||!C(x.max,W)||!C(x.min,O)){var K=M?U:this.getValidValue(U),X;this.pressingUpOrDown?X=K:this.inputting?X=this.rawInput:X=this.toPrecisionAsStep(K),this.setState({value:K,inputValue:X})}var ee="value"in this.props?U:this.state.value;"max"in this.props&&x.max!==W&&typeof ee=="number"&&ee>W&&B&&B(W),"min"in this.props&&x.min!==O&&typeof ee=="number"&&ee<O&&B&&B(O)}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(xe){}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(x){var P=x;return P===""?P="":this.isNotCompleteNumber(parseFloat(P))?P=this.state.value:P=this.getValidValue(P),this.toNumber(P)}},{key:"getValueFromEvent",value:function(x){var P=x.target.value.trim().replace(/。/g,".");return h(this.props.decimalSeparator)&&(P=P.replace(this.props.decimalSeparator,".")),P}},{key:"getValidValue",value:function(x){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,B=parseFloat(x);return isNaN(B)?x:(B<P&&(B=P),B>U&&(B=U),B)}},{key:"setValue",value:function(x,P){var U=this.props.precision,B=this.isNotCompleteNumber(parseFloat(x))?null:parseFloat(x),W=this.state.value,O=W===void 0?null:W,M=this.state.inputValue,K=M===void 0?null:M,X=typeof B=="number"?B.toFixed(U):"".concat(B),ee=B!==O||X!=="".concat(K);return"value"in this.props?(K=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:K},P)):this.setState({value:B,inputValue:this.toPrecisionAsStep(x)},P),ee&&this.props.onChange(B),B}},{key:"getMaxPrecision",value:function(x){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.props,B=U.precision,W=U.step;if(h(B))return B;var O=this.getPrecision(P),M=this.getPrecision(W),K=this.getPrecision(x);return x?Math.max(K,O+M):O+M}},{key:"getPrecisionFactor",value:function(x){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.getMaxPrecision(x,P);return Math.pow(10,U)}},{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(x){return this.props.formatter?this.props.formatter(x):x}},{key:"toPrecisionAsStep",value:function(x){if(this.isNotCompleteNumber(x)||x==="")return x;var P=Math.abs(this.getMaxPrecision(x));return isNaN(P)?x.toString():Number(x).toFixed(P)}},{key:"toNumber",value:function(x){var P=this.props.precision,U=this.state.focused,B=x&&x.length>16&&U;return this.isNotCompleteNumber(x)||B?x:h(P)?Math.round(x*Math.pow(10,P))/Math.pow(10,P):Number(x)}},{key:"upStep",value:function(x,P){var U=this.props.step,B=this.getPrecisionFactor(x,P),W=Math.abs(this.getMaxPrecision(x,P)),O=((B*x+B*U*P)/B).toFixed(W);return this.toNumber(O)}},{key:"downStep",value:function(x,P){var U=this.props.step,B=this.getPrecisionFactor(x,P),W=Math.abs(this.getMaxPrecision(x,P)),O=((B*x-B*U*P)/B).toFixed(W);return this.toNumber(O)}},{key:"step",value:function(x,P){var U=this,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),P&&(P.persist(),P.preventDefault());var O=this.props;if(O.disabled)return;var M=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(M))return;var K=this["".concat(x,"Step")](M,B),X=K>O.max||K<O.min;if(K>O.max?K=O.max:K<O.min&&(K=O.min),this.setValue(K,null),this.setState({focused:!0},function(){U.pressingUpOrDown=!1}),X)return;this.autoStepTimer=setTimeout(function(){U[x](P,B,!0)},W?l:w)}},{key:"fixCaret",value:function(x,P){if(x===void 0||P===void 0||!this.input||!this.input.value)return;try{var U=this.input.selectionStart,B=this.input.selectionEnd;(x!==U||P!==B)&&this.input.setSelectionRange(x,P)}catch(W){}}},{key:"render",value:function(){var x,P=this.props,U=P.prefixCls,B=P.disabled,W=P.readOnly,O=P.useTouch,M=P.autoComplete,K=P.upHandler,X=P.downHandler,ee=P.className,oe=P.max,xe=P.min,me=P.style,ge=P.title,de=P.onMouseEnter,se=P.onMouseLeave,ne=P.onMouseOver,he=P.onMouseOut,$=P.required,ie=P.onClick,Z=P.tabIndex,Ee=P.type,Se=P.placeholder,ye=P.id,_e=P.inputMode,Le=P.pattern,Ie=P.step,Me=P.maxLength,Ce=P.autoFocus,we=P.name,Be=P.onPaste,Ke=P.onInput,Ue=Object(te.a)(P,["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"]),Pe=this.state,Ve=Pe.value,He=Pe.focused,Xe=v()(U,(x={},Object(G.a)(x,ee,!!ee),Object(G.a)(x,"".concat(U,"-disabled"),B),Object(G.a)(x,"".concat(U,"-focused"),He),x)),Ae={};Object.keys(Ue).forEach(function(le){(le.substr(0,5)==="data-"||le.substr(0,5)==="aria-"||le==="role")&&(Ae[le]=Ue[le])});var qe=!W&&!B,Je=this.getInputDisplayValue(null),Oe=(Ve||Ve===0)&&(isNaN(Ve)||Number(Ve)>=oe),Ne=(Ve||Ve===0)&&(isNaN(Ve)||Number(Ve)<=xe),ve=Oe||B||W,ce=Ne||B||W,fe=v()("".concat(U,"-handler"),"".concat(U,"-handler-up"),Object(G.a)({},"".concat(U,"-handler-up-disabled"),ve)),J=v()("".concat(U,"-handler"),"".concat(U,"-handler-down"),Object(G.a)({},"".concat(U,"-handler-down-disabled"),ce)),q=O?{onTouchStart:ve?u:this.up,onTouchEnd:this.stop}:{onMouseDown:ve?u:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},re=O?{onTouchStart:ce?u:this.down,onTouchEnd:this.stop}:{onMouseDown:ce?u:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return k.a.createElement("div",{className:Xe,style:me,title:ge,onMouseEnter:de,onMouseLeave:se,onMouseOver:ne,onMouseOut:he,onFocus:function(){return null},onBlur:function(){return null}},k.a.createElement("div",{className:"".concat(U,"-handler-wrap")},k.a.createElement("span",Object.assign({unselectable:"on"},q,{role:"button","aria-label":"Increase Value","aria-disabled":ve,className:fe}),K||k.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-up-inner"),onClick:a})),k.a.createElement("span",Object.assign({unselectable:"on"},re,{role:"button","aria-label":"Decrease Value","aria-disabled":ce,className:J}),X||k.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-down-inner"),onClick:a}))),k.a.createElement("div",{className:"".concat(U,"-input-wrap")},k.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":xe,"aria-valuemax":oe,"aria-valuenow":Ve,required:$,type:Ee,placeholder:Se,onPaste:Be,onClick:ie,onMouseUp:this.onMouseUp,className:"".concat(U,"-input"),tabIndex:Z,autoComplete:M,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:qe?this.onKeyDown:u,onKeyUp:qe?this.onKeyUp:u,autoFocus:Ce,maxLength:Me,readOnly:W,disabled:B,max:oe,min:xe,step:Ie,name:we,title:ge,id:ye,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Je),pattern:Le,inputMode:_e,onInput:Ke},Ae))))}}]),y}(k.a.Component);b.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:p,min:-p,step:1,style:{},onChange:u,onKeyDown:u,onPressEnter:u,onFocus:u,onBlur:u,parser:s,required:!1,autoComplete:"off"};var c=b,f=We.a=c},gHQ5:function(et,We,Q){"use strict";Q.r(We);var te=Q("+L6B"),G=Q("2/Rp"),A=Q("5NDa"),z=Q("5rEg"),I=Q("k1fw"),R=Q("9og8"),j=Q("y8nQ"),F=Q("Vl3Y"),k=Q("tJVT"),L=Q("CiB2"),v=Q("WmNS"),S=Q.n(v),D=Q("cDcd"),T=Q.n(D),E=Q("3vs6"),g=Q("l3Yi"),u=Q.n(g),a=Q("Ot1p"),s=Q("500L"),l=Q("ErOA"),w=Q("Ty5D"),p=Q("9kvl"),h=function(b){var c;Object(L.a)(b);var f=Object(D.useState)({}),d=Object(k.a)(f,2),o=d[0],y=d[1],m=F.a.useForm(),x=Object(k.a)(m,1),P=x[0],U=Object(D.useState)(!0),B=Object(k.a)(U,2),W=B[0],O=B[1],M=Object(D.useState)(!1),K=Object(k.a)(M,2),X=K[0],ee=K[1],oe=Object(D.useState)(!1),xe=Object(k.a)(oe,2),me=xe[0],ge=xe[1],de=Object(w.i)(),se=de==null?void 0:de.virtual_spacesId;Object(D.useEffect)(function(){de!=null&&de.id?ne():ge(!0)},[]);var ne=function(){var $=Object(R.a)(S.a.mark(function ie(){var Z,Ee;return S.a.wrap(function(ye){for(;;)switch(ye.prev=ye.next){case 0:return ye.next=2,Object(l.a)("/api/virtual_classrooms/".concat(se,"/syllabuses/").concat(de==null?void 0:de.id,"/edit.json"),{method:"get"});case 2:Z=ye.sent,Z&&(Ee={title:Z.title,description:Z.description,attachment_ids:Object(s.a)(Z.attachments)},console.log(Ee,"formData"),P.setFieldsValue(Object(I.a)({},Ee)),y(Object(I.a)({},Ee)),ge(!0));case 4:case"end":return ye.stop()}},ie)}));return function(){return $.apply(this,arguments)}}(),he=function(){var $=Object(R.a)(S.a.mark(function ie(Z){var Ee,Se,ye,_e,Le;return S.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:if(Se=Object(I.a)({},o),Se.attachment_ids&&(Se.attachment_ids=Se==null||((ye=Se.attachment_ids)===null||ye===void 0)?void 0:ye.map(function(Ce){return Ce.response.id})),ee(!0),!(de!=null&&de.id)){Me.next=9;break}return Me.next=6,Object(l.a)("/api/virtual_classrooms/".concat(se,"/syllabuses/").concat(de==null?void 0:de.id,".json"),{method:"put",body:Object(I.a)({},Se)});case 6:_e=Me.sent,Me.next=12;break;case 9:return Me.next=11,Object(l.a)("/api/virtual_classrooms/".concat(se,"/syllabuses.json"),{method:"post",body:Object(I.a)({},Se)});case 11:_e=Me.sent;case 12:(Ee=_e)!==null&&Ee!==void 0&&Ee.virtual_classroom_id&&p.d.push("/vspaces/".concat(se,"/syllabuses/").concat((Le=_e)===null||Le===void 0?void 0:Le.id,"/detail")),ee(!1);case 14:case"end":return Me.stop()}},ie)}));return function(Z){return $.apply(this,arguments)}}();return T.a.createElement("div",{className:u.a.wrap},T.a.createElement(E.a,null),T.a.createElement("div",{className:u.a.form},T.a.createElement("div",{className:u.a.title},T.a.createElement("span",{onClick:function(){return p.d.push("/vspaces/".concat(se,"/syllabuses"))}},T.a.createElement("i",{className:"iconfont icon-zuoshangjiaofanhui"}),"\u8FD4\u56DE"),T.a.createElement("span",null,"\u65B0\u5EFA\u6559\u5B66\u5927\u7EB2")),T.a.createElement(F.a,{colon:!1,form:P,scrollToFirstError:!0,onValuesChange:function(){y(Object(I.a)({},P.getFieldsValue()))},onFinish:he},T.a.createElement(F.a.Item,{name:"title",label:"\u5927\u7EB2\u6807\u9898",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5927\u7EB2\u6807\u9898"}]},T.a.createElement(z.a,{maxLength:60,suffix:"".concat(((c=o.title)===null||c===void 0?void 0:c.length)||0,"/60"),placeholder:"\u8BF7\u8F93\u5165\u5927\u7EB2\u6807\u9898"})),T.a.createElement("div",{style:{margin:"20px 0 12px 10px"}},"\u5927\u7EB2\u5185\u5BB9"),T.a.createElement(F.a.Item,{className:"ml10",name:"description",rules:[{max:5e4,message:"\u4F5C\u4E1A\u7B80\u4ECB\u6700\u5927\u9650\u523650000\u4E2A\u5B57\u7B26"}]},T.a.createElement(a.a,{watch:!0,defaultValue:o.description})),T.a.createElement(F.a.Item,{className:"ml10",name:"attachment_ids",label:"\u9644\u4EF6"},me&&T.a.createElement(s.b,{className:u.a.file,title:T.a.createElement("span",null,T.a.createElement("i",{className:"iconfont icon-shangchuan1 font14 mr5"}),"\u4E0A\u4F20\u9644\u4EF6")})),T.a.createElement("div",{style:{textAlign:"right"}},T.a.createElement(F.a.Item,null,T.a.createElement(G.a,{onClick:function(){return p.d.push("/vspaces/".concat(se,"/syllabuses"))},className:"mr10"},"\u53D6\u6D88"),T.a.createElement(G.a,{type:"primary",htmlType:"submit",loading:X},"\u786E\u8BA4"))))))};We.default=h},h78n:function(et,We,Q){"use strict";Q.d(We,"a",function(){return x});var te=Q("cDcd"),G=Q.n(te),A=Q("TSYQ"),z=Q.n(A),I={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},R=function(B){var W=B.map(function(){return Object(te.useRef)()}),O=Object(te.useRef)();return Object(te.useEffect)(function(){var M=Date.now(),K=!1;Object.keys(W).forEach(function(X){var ee=W[X].current;if(!ee)return;K=!0;var oe=ee.style;oe.transitionDuration=".3s, .3s, .3s, .06s",O.current&&M-O.current<100&&(oe.transitionDuration="0s, 0s")}),K&&(O.current=Date.now())}),[W]};function j(){return j=Object.assign||function(U){for(var B=1;B<arguments.length;B++){var W=arguments[B];for(var O in W)Object.prototype.hasOwnProperty.call(W,O)&&(U[O]=W[O])}return U},j.apply(this,arguments)}function F(U,B){return D(U)||S(U,B)||L(U,B)||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 L(U,B){if(!U)return;if(typeof U=="string")return v(U,B);var W=Object.prototype.toString.call(U).slice(8,-1);if(W==="Object"&&U.constructor&&(W=U.constructor.name),W==="Map"||W==="Set")return Array.from(U);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return v(U,B)}function v(U,B){(B==null||B>U.length)&&(B=U.length);for(var W=0,O=new Array(B);W<B;W++)O[W]=U[W];return O}function S(U,B){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var W=[],O=!0,M=!1,K=void 0;try{for(var X=U[Symbol.iterator](),ee;!(O=(ee=X.next()).done)&&!(W.push(ee.value),B&&W.length===B);O=!0);}catch(oe){M=!0,K=oe}finally{try{!O&&X.return!=null&&X.return()}finally{if(M)throw K}}return W}function D(U){if(Array.isArray(U))return U}function T(U,B){if(U==null)return{};var W=E(U,B),O,M;if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(U);for(M=0;M<K.length;M++){if(O=K[M],B.indexOf(O)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,O))continue;W[O]=U[O]}}return W}function E(U,B){if(U==null)return{};var W={},O=Object.keys(U),M,K;for(K=0;K<O.length;K++){if(M=O[K],B.indexOf(M)>=0)continue;W[M]=U[M]}return W}var g=function(B){var W=B.className,O=B.percent,M=B.prefixCls,K=B.strokeColor,X=B.strokeLinecap,ee=B.strokeWidth,oe=B.style,xe=B.trailColor,me=B.trailWidth,ge=B.transition,de=T(B,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete de.gapPosition;var se=Array.isArray(O)?O:[O],ne=Array.isArray(K)?K:[K],he=R(se),$=F(he,1),ie=$[0],Z=ee/2,Ee=100-ee/2,Se="M ".concat(X==="round"?Z:0,",").concat(Z,`
|
|
L `).concat(X==="round"?Ee:100,",").concat(Z),ye="0 0 100 ".concat(ee),_e=0;return G.a.createElement("svg",j({className:z()("".concat(M,"-line"),W),viewBox:ye,preserveAspectRatio:"none",style:oe},de),G.a.createElement("path",{className:"".concat(M,"-line-trail"),d:Se,strokeLinecap:X,stroke:xe,strokeWidth:me||ee,fillOpacity:"0"}),se.map(function(Le,Ie){var Me={strokeDasharray:"".concat(Le,"px, 100px"),strokeDashoffset:"-".concat(_e,"px"),transition:ge||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Ce=ne[Ie]||ne[ne.length-1];return _e+=Le,G.a.createElement("path",{key:Ie,className:"".concat(M,"-line-path"),d:Se,strokeLinecap:X,stroke:Ce,strokeWidth:ee,fillOpacity:"0",ref:ie[Ie],style:Me})}))};g.defaultProps=I;var u=g;function a(){return a=Object.assign||function(U){for(var B=1;B<arguments.length;B++){var W=arguments[B];for(var O in W)Object.prototype.hasOwnProperty.call(W,O)&&(U[O]=W[O])}return U},a.apply(this,arguments)}function s(U,B){return C(U)||h(U,B)||w(U,B)||l()}function l(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w(U,B){if(!U)return;if(typeof U=="string")return p(U,B);var W=Object.prototype.toString.call(U).slice(8,-1);if(W==="Object"&&U.constructor&&(W=U.constructor.name),W==="Map"||W==="Set")return Array.from(U);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return p(U,B)}function p(U,B){(B==null||B>U.length)&&(B=U.length);for(var W=0,O=new Array(B);W<B;W++)O[W]=U[W];return O}function h(U,B){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var W=[],O=!0,M=!1,K=void 0;try{for(var X=U[Symbol.iterator](),ee;!(O=(ee=X.next()).done)&&!(W.push(ee.value),B&&W.length===B);O=!0);}catch(oe){M=!0,K=oe}finally{try{!O&&X.return!=null&&X.return()}finally{if(M)throw K}}return W}function C(U){if(Array.isArray(U))return U}function b(U,B){if(U==null)return{};var W=c(U,B),O,M;if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(U);for(M=0;M<K.length;M++){if(O=K[M],B.indexOf(O)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,O))continue;W[O]=U[O]}}return W}function c(U,B){if(U==null)return{};var W={},O=Object.keys(U),M,K;for(K=0;K<O.length;K++){if(M=O[K],B.indexOf(M)>=0)continue;W[M]=U[M]}return W}var f=0;function d(U){return+U.replace("%","")}function o(U){return Array.isArray(U)?U:[U]}function y(U,B,W,O){var M=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,K=arguments.length>5?arguments[5]:void 0,X=50-O/2,ee=0,oe=-X,xe=0,me=-2*X;switch(K){case"left":ee=-X,oe=0,xe=2*X,me=0;break;case"right":ee=X,oe=0,xe=-2*X,me=0;break;case"bottom":oe=X,me=2*X;break;default:}var ge="M 50,50 m ".concat(ee,",").concat(oe,`
|
|
a `).concat(X,",").concat(X," 0 1 1 ").concat(xe,",").concat(-me,`
|
|
a `).concat(X,",").concat(X," 0 1 1 ").concat(-xe,",").concat(me),de=Math.PI*2*X,se={stroke:W,strokeDasharray:"".concat(B/100*(de-M),"px ").concat(de,"px"),strokeDashoffset:"-".concat(M/2+U/100*(de-M),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:ge,pathStyle:se}}var m=function(B){var W=B.prefixCls,O=B.strokeWidth,M=B.trailWidth,K=B.gapDegree,X=B.gapPosition,ee=B.trailColor,oe=B.strokeLinecap,xe=B.style,me=B.className,ge=B.strokeColor,de=B.percent,se=b(B,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ne=Object(te.useMemo)(function(){return f+=1,f},[]),he=y(0,100,ee,O,K,X),$=he.pathString,ie=he.pathStyle,Z=o(de),Ee=o(ge),Se=Ee.find(function(Me){return Object.prototype.toString.call(Me)==="[object Object]"}),ye=R(Z),_e=s(ye,1),Le=_e[0],Ie=function(){var Ce=0;return Z.map(function(we,Be){var Ke=Ee[Be]||Ee[Ee.length-1],Ue=Object.prototype.toString.call(Ke)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ne,")"):"",Pe=y(Ce,we,Ke,O,K,X);return Ce+=we,G.a.createElement("path",{key:Be,className:"".concat(W,"-circle-path"),d:Pe.pathString,stroke:Ue,strokeLinecap:oe,strokeWidth:O,opacity:we===0?0:1,fillOpacity:"0",style:Pe.pathStyle,ref:Le[Be]})})};return G.a.createElement("svg",a({className:z()("".concat(W,"-circle"),me),viewBox:"0 0 100 100",style:xe},se),Se&&G.a.createElement("defs",null,G.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(ne),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Se).sort(function(Me,Ce){return d(Me)-d(Ce)}).map(function(Me,Ce){return G.a.createElement("stop",{key:Ce,offset:Me,stopColor:Se[Me]})}))),G.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:$,stroke:ee,strokeLinecap:oe,strokeWidth:M||O,fillOpacity:"0",style:ie}),Ie().reverse())};m.defaultProps=I;var x=m,P={Line:u,Circle:x}},kSUc:function(et,We,Q){},l3Yi:function(et,We,Q){et.exports={flex_box_center:"flex_box_center___354pw",flex_space_between:"flex_space_between___10PE2",flex_box_vertical_center:"flex_box_vertical_center___YT9_A",flex_box_center_end:"flex_box_center_end___1qNoU",flex_box_column:"flex_box_column___2E4_8",wrap:"wrap___1umYZ",form:"form___2x_Sk",title:"title___idVlc",file:"file___1g_02"}},lZu9:function(et,We,Q){(function(te){te(Q("VrN/"),Q("1eCo"),Q("8EBN"))})(function(te){"use strict";te.defineMode("markdown",function(G,A){var z=te.getMode(G,"text/html"),I=z.name=="null";function R(O){if(te.findModeByName){var M=te.findModeByName(O);M&&(O=M.mime||M.mimes[0])}var K=te.getMode(G,O);return K.name=="null"?null:K}A.highlightFormatting===void 0&&(A.highlightFormatting=!1),A.maxBlockquoteDepth===void 0&&(A.maxBlockquoteDepth=0),A.taskLists===void 0&&(A.taskLists=!1),A.strikethrough===void 0&&(A.strikethrough=!1),A.emoji===void 0&&(A.emoji=!1),A.fencedCodeBlockHighlighting===void 0&&(A.fencedCodeBlockHighlighting=!0),A.fencedCodeBlockDefaultMode===void 0&&(A.fencedCodeBlockDefaultMode="text/plain"),A.xml===void 0&&(A.xml=!0),A.tokenTypeOverrides===void 0&&(A.tokenTypeOverrides={});var j={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 F in j)j.hasOwnProperty(F)&&A.tokenTypeOverrides[F]&&(j[F]=A.tokenTypeOverrides[F]);var k=/^([*\-_])(?:\s*\1){2,}\s*$/,L=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,v=/^\[(x| )\](?=\s)/i,S=A.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,D=/^ {0,3}(?:\={1,}|-{2,})\s*$/,T=/^[^#!\[\]*_\\<>` "'(~:]+/,E=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,g=/^\s*\[[^\]]+?\]:.*$/,u=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,a=" ";function s(O,M,K){return M.f=M.inline=K,K(O,M)}function l(O,M,K){return M.f=M.block=K,K(O,M)}function w(O){return!O||!/\S/.test(O.string)}function p(O){if(O.linkTitle=!1,O.linkHref=!1,O.linkText=!1,O.em=!1,O.strong=!1,O.strikethrough=!1,O.quote=0,O.indentedCode=!1,O.f==C){var M=I;if(!M){var K=te.innerMode(z,O.htmlState);M=K.mode.name=="xml"&&K.state.tagStart===null&&!K.state.context&&K.state.tokenize.isInText}M&&(O.f=d,O.block=h,O.htmlState=null)}return O.trailingSpace=0,O.trailingSpaceNewLine=!1,O.prevLine=O.thisLine,O.thisLine={stream:null},null}function h(O,M){var K=O.column()===M.indentation,X=w(M.prevLine.stream),ee=M.indentedCode,oe=M.prevLine.hr,xe=M.list!==!1,me=(M.listStack[M.listStack.length-1]||0)+3;M.indentedCode=!1;var ge=M.indentation;if(M.indentationDiff===null&&(M.indentationDiff=M.indentation,xe)){for(M.list=null;ge<M.listStack[M.listStack.length-1];)M.listStack.pop(),M.listStack.length?M.indentation=M.listStack[M.listStack.length-1]:M.list=!1;M.list!==!1&&(M.indentationDiff=ge-M.listStack[M.listStack.length-1])}var de=!X&&!oe&&!M.prevLine.header&&(!xe||!ee)&&!M.prevLine.fencedCodeEnd,se=(M.list===!1||oe||X)&&M.indentation<=me&&O.match(k),ne=null;if(M.indentationDiff>=4&&(ee||M.prevLine.fencedCodeEnd||M.prevLine.header||X))return O.skipToEnd(),M.indentedCode=!0,j.code;if(O.eatSpace())return null;if(K&&M.indentation<=me&&(ne=O.match(S))&&ne[1].length<=6)return M.quote=0,M.header=ne[1].length,M.thisLine.header=!0,A.highlightFormatting&&(M.formatting="header"),M.f=M.inline,c(M);if(M.indentation<=me&&O.eat(">"))return M.quote=K?1:M.quote+1,A.highlightFormatting&&(M.formatting="quote"),O.eatSpace(),c(M);if(!se&&!M.setext&&K&&M.indentation<=me&&(ne=O.match(L))){var he=ne[1]?"ol":"ul";return M.indentation=ge+O.current().length,M.list=!0,M.quote=0,M.listStack.push(M.indentation),M.em=!1,M.strong=!1,M.code=!1,M.strikethrough=!1,A.taskLists&&O.match(v,!1)&&(M.taskList=!0),M.f=M.inline,A.highlightFormatting&&(M.formatting=["list","list-"+he]),c(M)}else{if(K&&M.indentation<=me&&(ne=O.match(E,!0)))return M.quote=0,M.fencedEndRE=new RegExp(ne[1]+"+ *$"),M.localMode=A.fencedCodeBlockHighlighting&&R(ne[2]||A.fencedCodeBlockDefaultMode),M.localMode&&(M.localState=te.startState(M.localMode)),M.f=M.block=b,A.highlightFormatting&&(M.formatting="code-block"),M.code=-1,c(M);if(M.setext||(!de||!xe)&&!M.quote&&M.list===!1&&!M.code&&!se&&!g.test(O.string)&&(ne=O.lookAhead(1))&&(ne=ne.match(D)))return M.setext?(M.header=M.setext,M.setext=0,O.skipToEnd(),A.highlightFormatting&&(M.formatting="header")):(M.header=ne[0].charAt(0)=="="?1:2,M.setext=M.header),M.thisLine.header=!0,M.f=M.inline,c(M);if(se)return O.skipToEnd(),M.hr=!0,M.thisLine.hr=!0,j.hr;if(O.peek()==="[")return s(O,M,P)}return s(O,M,M.inline)}function C(O,M){var K=z.token(O,M.htmlState);if(!I){var X=te.innerMode(z,M.htmlState);(X.mode.name=="xml"&&X.state.tagStart===null&&!X.state.context&&X.state.tokenize.isInText||M.md_inside&&O.current().indexOf(">")>-1)&&(M.f=d,M.block=h,M.htmlState=null)}return K}function b(O,M){var K=M.listStack[M.listStack.length-1]||0,X=M.indentation<K,ee=K+3;if(M.fencedEndRE&&M.indentation<=ee&&(X||O.match(M.fencedEndRE))){A.highlightFormatting&&(M.formatting="code-block");var oe;return X||(oe=c(M)),M.localMode=M.localState=null,M.block=h,M.f=d,M.fencedEndRE=null,M.code=0,M.thisLine.fencedCodeEnd=!0,X?l(O,M,M.block):oe}else return M.localMode?M.localMode.token(O,M.localState):(O.skipToEnd(),j.code)}function c(O){var M=[];if(O.formatting){M.push(j.formatting),typeof O.formatting=="string"&&(O.formatting=[O.formatting]);for(var K=0;K<O.formatting.length;K++)M.push(j.formatting+"-"+O.formatting[K]),O.formatting[K]==="header"&&M.push(j.formatting+"-"+O.formatting[K]+"-"+O.header),O.formatting[K]==="quote"&&(!A.maxBlockquoteDepth||A.maxBlockquoteDepth>=O.quote?M.push(j.formatting+"-"+O.formatting[K]+"-"+O.quote):M.push("error"))}if(O.taskOpen)return M.push("meta"),M.length?M.join(" "):null;if(O.taskClosed)return M.push("property"),M.length?M.join(" "):null;if(O.linkHref?M.push(j.linkHref,"url"):(O.strong&&M.push(j.strong),O.em&&M.push(j.em),O.strikethrough&&M.push(j.strikethrough),O.emoji&&M.push(j.emoji),O.linkText&&M.push(j.linkText),O.code&&M.push(j.code),O.image&&M.push(j.image),O.imageAltText&&M.push(j.imageAltText,"link"),O.imageMarker&&M.push(j.imageMarker)),O.header&&M.push(j.header,j.header+"-"+O.header),O.quote&&(M.push(j.quote),!A.maxBlockquoteDepth||A.maxBlockquoteDepth>=O.quote?M.push(j.quote+"-"+O.quote):M.push(j.quote+"-"+A.maxBlockquoteDepth)),O.list!==!1){var X=(O.listStack.length-1)%3;X?X===1?M.push(j.list2):M.push(j.list3):M.push(j.list1)}return O.trailingSpaceNewLine?M.push("trailing-space-new-line"):O.trailingSpace&&M.push("trailing-space-"+(O.trailingSpace%2?"a":"b")),M.length?M.join(" "):null}function f(O,M){return O.match(T,!0)?c(M):void 0}function d(O,M){var K=M.text(O,M);if(typeof K!="undefined")return K;if(M.list)return M.list=null,c(M);if(M.taskList){var X=O.match(v,!0)[1]===" ";return X?M.taskOpen=!0:M.taskClosed=!0,A.highlightFormatting&&(M.formatting="task"),M.taskList=!1,c(M)}if(M.taskOpen=!1,M.taskClosed=!1,M.header&&O.match(/^#+$/,!0))return A.highlightFormatting&&(M.formatting="header"),c(M);var ee=O.next();if(M.linkTitle){M.linkTitle=!1;var oe=ee;ee==="("&&(oe=")"),oe=(oe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var xe="^\\s*(?:[^"+oe+"\\\\]+|\\\\\\\\|\\\\.)"+oe;if(O.match(new RegExp(xe),!0))return j.linkHref}if(ee==="`"){var me=M.formatting;A.highlightFormatting&&(M.formatting="code"),O.eatWhile("`");var ge=O.current().length;if(M.code==0&&(!M.quote||ge==1))return M.code=ge,c(M);if(ge==M.code){var de=c(M);return M.code=0,de}else return M.formatting=me,c(M)}else if(M.code)return c(M);if(ee==="\\"&&(O.next(),A.highlightFormatting)){var se=c(M),ne=j.formatting+"-escape";return se?se+" "+ne:ne}if(ee==="!"&&O.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return M.imageMarker=!0,M.image=!0,A.highlightFormatting&&(M.formatting="image"),c(M);if(ee==="["&&M.imageMarker&&O.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return M.imageMarker=!1,M.imageAltText=!0,A.highlightFormatting&&(M.formatting="image"),c(M);if(ee==="]"&&M.imageAltText){A.highlightFormatting&&(M.formatting="image");var se=c(M);return M.imageAltText=!1,M.image=!1,M.inline=M.f=y,se}if(ee==="["&&!M.image)return M.linkText&&O.match(/^.*?\]/)||(M.linkText=!0,A.highlightFormatting&&(M.formatting="link")),c(M);if(ee==="]"&&M.linkText){A.highlightFormatting&&(M.formatting="link");var se=c(M);return M.linkText=!1,M.inline=M.f=O.match(/\(.*?\)| ?\[.*?\]/,!1)?y:d,se}if(ee==="<"&&O.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){M.f=M.inline=o,A.highlightFormatting&&(M.formatting="link");var se=c(M);return se?se+=" ":se="",se+j.linkInline}if(ee==="<"&&O.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){M.f=M.inline=o,A.highlightFormatting&&(M.formatting="link");var se=c(M);return se?se+=" ":se="",se+j.linkEmail}if(A.xml&&ee==="<"&&O.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var he=O.string.indexOf(">",O.pos);if(he!=-1){var $=O.string.substring(O.start,he);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test($)&&(M.md_inside=!0)}return O.backUp(1),M.htmlState=te.startState(z),l(O,M,C)}if(A.xml&&ee==="<"&&O.match(/^\/\w*?>/))return M.md_inside=!1,"tag";if(ee==="*"||ee==="_"){for(var ie=1,Z=O.pos==1?" ":O.string.charAt(O.pos-2);ie<3&&O.eat(ee);)ie++;var Ee=O.peek()||" ",Se=!/\s/.test(Ee)&&(!u.test(Ee)||/\s/.test(Z)||u.test(Z)),ye=!/\s/.test(Z)&&(!u.test(Z)||/\s/.test(Ee)||u.test(Ee)),_e=null,Le=null;if(ie%2&&(!M.em&&Se&&(ee==="*"||!ye||u.test(Z))?_e=!0:M.em==ee&&ye&&(ee==="*"||!Se||u.test(Ee))&&(_e=!1)),ie>1&&(!M.strong&&Se&&(ee==="*"||!ye||u.test(Z))?Le=!0:M.strong==ee&&ye&&(ee==="*"||!Se||u.test(Ee))&&(Le=!1)),Le!=null||_e!=null){A.highlightFormatting&&(M.formatting=_e==null?"strong":Le==null?"em":"strong em"),_e===!0&&(M.em=ee),Le===!0&&(M.strong=ee);var de=c(M);return _e===!1&&(M.em=!1),Le===!1&&(M.strong=!1),de}}else if(ee===" "&&(O.eat("*")||O.eat("_"))){if(O.peek()===" ")return c(M);O.backUp(1)}if(A.strikethrough){if(ee==="~"&&O.eatWhile(ee)){if(M.strikethrough){A.highlightFormatting&&(M.formatting="strikethrough");var de=c(M);return M.strikethrough=!1,de}else if(O.match(/^[^\s]/,!1))return M.strikethrough=!0,A.highlightFormatting&&(M.formatting="strikethrough"),c(M)}else if(ee===" "&&O.match(/^~~/,!0)){if(O.peek()===" ")return c(M);O.backUp(2)}}if(A.emoji&&ee===":"&&O.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){M.emoji=!0,A.highlightFormatting&&(M.formatting="emoji");var Ie=c(M);return M.emoji=!1,Ie}return ee===" "&&(O.match(/^ +$/,!1)?M.trailingSpace++:M.trailingSpace&&(M.trailingSpaceNewLine=!0)),c(M)}function o(O,M){var K=O.next();if(K===">"){M.f=M.inline=d,A.highlightFormatting&&(M.formatting="link");var X=c(M);return X?X+=" ":X="",X+j.linkInline}return O.match(/^[^>]+/,!0),j.linkInline}function y(O,M){if(O.eatSpace())return null;var K=O.next();return K==="("||K==="["?(M.f=M.inline=x(K==="("?")":"]"),A.highlightFormatting&&(M.formatting="link-string"),M.linkHref=!0,c(M)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function x(O){return function(M,K){var X=M.next();if(X===O){K.f=K.inline=d,A.highlightFormatting&&(K.formatting="link-string");var ee=c(K);return K.linkHref=!1,ee}return M.match(m[O]),K.linkHref=!0,c(K)}}function P(O,M){return O.match(/^([^\]\\]|\\.)*\]:/,!1)?(M.f=U,O.next(),A.highlightFormatting&&(M.formatting="link"),M.linkText=!0,c(M)):s(O,M,d)}function U(O,M){if(O.match(/^\]:/,!0)){M.f=M.inline=B,A.highlightFormatting&&(M.formatting="link");var K=c(M);return M.linkText=!1,K}return O.match(/^([^\]\\]|\\.)+/,!0),j.linkText}function B(O,M){return O.eatSpace()?null:(O.match(/^[^\s]+/,!0),O.peek()===void 0?M.linkTitle=!0:O.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),M.f=M.inline=d,j.linkHref+" url")}var W={startState:function(){return{f:h,prevLine:{stream:null},thisLine:{stream:null},block:h,htmlState:null,indentation:0,inline:d,text:f,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(O){return{f:O.f,prevLine:O.prevLine,thisLine:O.thisLine,block:O.block,htmlState:O.htmlState&&te.copyState(z,O.htmlState),indentation:O.indentation,localMode:O.localMode,localState:O.localMode?te.copyState(O.localMode,O.localState):null,inline:O.inline,text:O.text,formatting:!1,linkText:O.linkText,linkTitle:O.linkTitle,linkHref:O.linkHref,code:O.code,em:O.em,strong:O.strong,strikethrough:O.strikethrough,emoji:O.emoji,header:O.header,setext:O.setext,hr:O.hr,taskList:O.taskList,list:O.list,listStack:O.listStack.slice(0),quote:O.quote,indentedCode:O.indentedCode,trailingSpace:O.trailingSpace,trailingSpaceNewLine:O.trailingSpaceNewLine,md_inside:O.md_inside,fencedEndRE:O.fencedEndRE}},token:function(O,M){if(M.formatting=!1,O!=M.thisLine.stream){if(M.header=0,M.hr=!1,O.match(/^\s*$/,!0))return p(M),null;if(M.prevLine=M.thisLine,M.thisLine={stream:O},M.taskList=!1,M.trailingSpace=0,M.trailingSpaceNewLine=!1,!M.localState&&(M.f=M.block,M.f!=C)){var K=O.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(M.indentation=K,M.indentationDiff=null,K>0)return null}}return M.f(O,M)},innerMode:function(O){return O.block==C?{state:O.htmlState,mode:z}:O.localState?{state:O.localState,mode:O.localMode}:{state:O,mode:W}},indent:function(O,M,K){return O.block==C&&z.indent?z.indent(O.htmlState,M,K):O.localState&&O.localMode.indent?O.localMode.indent(O.localState,M,K):te.Pass},blankLine:p,getType:c,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),te.defineMIME("text/markdown","markdown"),te.defineMIME("text/x-markdown","markdown")})},mOS8:function(et,We,Q){et.exports=Q.p+"static/403Qrcode.6c17b6f4.png"},osHv:function(et,We,Q){(function(te){te(Q("VrN/"))})(function(te){"use strict";var G=te.Pos;function A(u,a){return u.line-a.line||u.ch-a.ch}var z="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",I=z+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",R=new RegExp("<(/?)(["+z+"]["+I+"]*)","g");function j(u,a,s,l){this.line=a,this.ch=s,this.cm=u,this.text=u.getLine(a),this.min=l?Math.max(l.from,u.firstLine()):u.firstLine(),this.max=l?Math.min(l.to-1,u.lastLine()):u.lastLine()}function F(u,a){var s=u.cm.getTokenTypeAt(G(u.line,a));return s&&/\btag\b/.test(s)}function k(u){return u.line>=u.max?void 0:(u.ch=0,u.text=u.cm.getLine(++u.line),!0)}function L(u){return u.line<=u.min?void 0:(u.text=u.cm.getLine(--u.line),u.ch=u.text.length,!0)}function v(u){for(;;){var a=u.text.indexOf(">",u.ch);if(a==-1){if(k(u))continue;return}if(!F(u,a+1)){u.ch=a+1;continue}var s=u.text.lastIndexOf("/",a),l=s>-1&&!/\S/.test(u.text.slice(s+1,a));return u.ch=a+1,l?"selfClose":"regular"}}function S(u){for(;;){var a=u.ch?u.text.lastIndexOf("<",u.ch-1):-1;if(a==-1){if(L(u))continue;return}if(!F(u,a+1)){u.ch=a;continue}R.lastIndex=a,u.ch=a;var s=R.exec(u.text);if(s&&s.index==a)return s}}function D(u){for(;;){R.lastIndex=u.ch;var a=R.exec(u.text);if(!a){if(k(u))continue;return}if(!F(u,a.index+1)){u.ch=a.index+1;continue}return u.ch=a.index+a[0].length,a}}function T(u){for(;;){var a=u.ch?u.text.lastIndexOf(">",u.ch-1):-1;if(a==-1){if(L(u))continue;return}if(!F(u,a+1)){u.ch=a;continue}var s=u.text.lastIndexOf("/",a),l=s>-1&&!/\S/.test(u.text.slice(s+1,a));return u.ch=a+1,l?"selfClose":"regular"}}function E(u,a){for(var s=[];;){var l=D(u),w,p=u.line,h=u.ch-(l?l[0].length:0);if(!l||!(w=v(u)))return;if(w=="selfClose")continue;if(l[1]){for(var C=s.length-1;C>=0;--C)if(s[C]==l[2]){s.length=C;break}if(C<0&&(!a||a==l[2]))return{tag:l[2],from:G(p,h),to:G(u.line,u.ch)}}else s.push(l[2])}}function g(u,a){for(var s=[];;){var l=T(u);if(!l)return;if(l=="selfClose"){S(u);continue}var w=u.line,p=u.ch,h=S(u);if(!h)return;if(h[1])s.push(h[2]);else{for(var C=s.length-1;C>=0;--C)if(s[C]==h[2]){s.length=C;break}if(C<0&&(!a||a==h[2]))return{tag:h[2],from:G(u.line,u.ch),to:G(w,p)}}}}te.registerHelper("fold","xml",function(u,a){for(var s=new j(u,a.line,0);;){var l=D(s);if(!l||s.line!=a.line)return;var w=v(s);if(!w)return;if(!l[1]&&w!="selfClose"){var p=G(s.line,s.ch),h=E(s,l[2]);return h&&A(h.from,p)>0?{from:p,to:h.from}:null}}}),te.findMatchingTag=function(u,a,s){var l=new j(u,a.line,a.ch,s);if(l.text.indexOf(">")==-1&&l.text.indexOf("<")==-1)return;var w=v(l),p=w&&G(l.line,l.ch),h=w&&S(l);if(!w||!h||A(l,a)>0)return;var C={from:G(l.line,l.ch),to:p,tag:h[2]};return w=="selfClose"?{open:C,close:null,at:"open"}:h[1]?{open:g(l,h[2]),close:C,at:"close"}:(l=new j(u,p.line,p.ch,s),{open:C,close:E(l,h[2]),at:"open"})},te.findEnclosingTag=function(u,a,s,l){for(var w=new j(u,a.line,a.ch,s);;){var p=g(w,l);if(!p)break;var h=new j(u,a.line,a.ch,s),C=E(h,p.tag);if(C)return{open:p,close:C}}},te.scanForClosingTag=function(u,a,s,l){var w=new j(u,a.line,a.ch,l?{from:0,to:l}:null);return E(w,s)}})},p5ED:function(et,We,Q){"use strict";var te=Q("+L6B"),G=Q("2/Rp"),A=Q("5Dmo"),z=Q("3S7+"),I=Q("k1fw"),R=Q("tJVT"),j=Q("cDcd"),F=Q.n(j),k=Q("vHTk"),L=Q.n(k),v=Q("yEEn"),S=Q("ZW9T"),D=Q("1vsH");We.a=function(T){var E=T.name,g=T.data,u=T.theme,a=T.type,s=T.filename,l=T.monacoEditor,w=T.className,p=T.style,h=T.close,C=T.onClose,b=T.hasMask,c=Object(j.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),f=Object(R.a)(c,2),d=f[0],o=f[1],y=Object(j.useState)(""),m=Object(R.a)(y,2),x=m[0],P=m[1],U,B=1024*1024,W=10*B,O=Object(j.useRef)();a==="office"&&(U=Object(D.V)(g).filesize,U>W&&(a="other")),s&&(l.filename=s),Object(j.useEffect)(function(){var X,ee,oe=(X=document.cookie)===null||X===void 0||((ee=X.replace(/\s/g,""))===null||ee===void 0)?void 0:ee.split(";");oe==null||oe.map(function(xe){var me=xe.split("=");me[0]==="_educoder_session"&&P(me[1])})},[]);var M=function(){if(g.startsWith("http")||g.startsWith("/")){K();return}Object(D.z)(s||"educoder",g,s)},K=function(){Object(D.x)(s||E,g)};return console.log("data:",g,"fileanme:",s," name:",E),F.a.createElement("div",{style:Object(I.a)({},p||{}),className:"".concat(b&&L.a.bgBlack," ").concat(a?L.a.wrp:"hide")},h&&F.a.createElement("div",{className:L.a.close,ref:O},F.a.createElement(z.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return O.current}},F.a.createElement("span",{onClick:K},F.a.createElement("i",{className:"icon-quxiaozhiding"}))),F.a.createElement(z.a,{title:"\u5173\u95ED",getPopupContainer:function(){return O.current}},F.a.createElement("span",{className:"",onClick:C},F.a.createElement("i",{className:"icon-guanbi1"})))),F.a.createElement("div",{className:"".concat(L.a[w]," ").concat(w," ").concat(L.a.monaco," ").concat(a==="txt"?"show":"hide")},a==="txt"&&F.a.createElement(S.b,l)),a==="audio"&&F.a.createElement("audio",{src:"".concat(g!=null&&g.startsWith("/")||(g==null?void 0:g.indexOf("https://"))>-1?g:"data:audio/mp3;base64,").concat(g),autoPlay:!0}),a==="video"&&F.a.createElement(F.a.Fragment,null,g!=null&&g.startsWith("/")?F.a.createElement("video",{controls:!0,src:"".concat(g),autoPlay:!0}):F.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(g),autoPlay:!0})),a==="html"&&F.a.createElement("iframe",{src:g+"&disposition=inline"}),a==="pdf"&&F.a.createElement("embed",{className:L.a.embed,src:g}),a==="image"&&F.a.createElement(F.a.Fragment,null,F.a.createElement("img",{src:"".concat(g!=null&&g.startsWith("/")||(g==null?void 0:g.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(g)})),a==="other"&&F.a.createElement("div",null,F.a.createElement(G.a,{type:"primary",size:"large",onClick:M},F.a.createElement(v.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(a==="download"||a==="office")&&F.a.createElement(G.a,{type:"primary",size:"large",onClick:M},F.a.createElement(v.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(et,We,Q){},rUJ1:function(et,We){const Q=/[&<>"']/,te=/[&<>"']/g,G=/[<>"']|&(?!#?\w+;)/,A=/[<>"']|&(?!#?\w+;)/g,z={"&":"&","<":"<",">":">",'"':""","'":"'"},I=b=>z[b];function R(b,c){if(c){if(Q.test(b))return b.replace(te,I)}else if(G.test(b))return b.replace(A,I);return b}const j=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function F(b){return b.replace(j,(c,f)=>(f=f.toLowerCase(),f==="colon"?":":f.charAt(0)==="#"?f.charAt(1)==="x"?String.fromCharCode(parseInt(f.substring(2),16)):String.fromCharCode(+f.substring(1)):""))}const k=/(^|[^\[])\^/g;function L(b,c){b=b.source||b,c=c||"";const f={replace:(d,o)=>(o=o.source||o,o=o.replace(k,"$1"),b=b.replace(d,o),f),getRegex:()=>new RegExp(b,c)};return f}const v=/[^\w:]/g,S=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function D(b,c,f){if(b){let d;try{d=decodeURIComponent(F(f)).replace(v,"").toLowerCase()}catch(o){return null}if(d.indexOf("javascript:")===0||d.indexOf("vbscript:")===0||d.indexOf("data:")===0)return null}c&&!S.test(f)&&(f=a(c,f));try{f=encodeURI(f).replace(/%25/g,"%")}catch(d){return null}return f}const T={},E=/^[^:]+:\/*[^/]*$/,g=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(b,c){T[" "+b]||(E.test(b)?T[" "+b]=b+"/":T[" "+b]=p(b,"/",!0)),b=T[" "+b];const f=b.indexOf(":")===-1;return c.substring(0,2)==="//"?f?c:b.replace(g,"$1")+c:c.charAt(0)==="/"?f?c:b.replace(u,"$1")+c:b+c}const s={exec:function(){}};function l(b){let c=1,f,d;for(;c<arguments.length;c++){f=arguments[c];for(d in f)Object.prototype.hasOwnProperty.call(f,d)&&(b[d]=f[d])}return b}function w(b,c){const f=b.replace(/\|/g,(y,m,x)=>{let P=!1,U=m;for(;--U>=0&&x[U]==="\\";)P=!P;return P?"|":" |"}),d=f.split(/ \|/);let o=0;if(d.length>c)d.splice(c);else for(;d.length<c;)d.push("");for(;o<d.length;o++)d[o]=d[o].trim().replace(/\\\|/g,"|");return d}function p(b,c,f){const d=b.length;if(d===0)return"";let o=0;for(;o<d;){const y=b.charAt(d-o-1);if(y===c&&!f)o++;else if(y!==c&&f)o++;else break}return b.substr(0,d-o)}function h(b,c){if(b.indexOf(c[1])===-1)return-1;const f=b.length;let d=0,o=0;for(;o<f;o++)if(b[o]==="\\")o++;else if(b[o]===c[0])d++;else if(b[o]===c[1]&&(d--,d<0))return o;return-1}function C(b){b&&b.sanitize&&!b.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}et.exports={escape:R,unescape:F,edit:L,cleanUrl:D,resolveUrl:a,noopTest:s,merge:l,splitCells:w,rtrim:p,findClosingBracket:h,checkSanitizeDeprecation:C}},ttuQ:function(et,We,Q){et.exports={bg:"bg___3F6Km",name:"name___1NsJT",member:"member___2pzzt"}},ulZh:function(et,We,Q){typeof window!="undefined"&&function(G,A){et.exports=A()}(this,function(){return function(te){var G={};function A(z){if(G[z])return G[z].exports;var I=G[z]={i:z,l:!1,exports:{}};return te[z].call(I.exports,I,I.exports,A),I.l=!0,I.exports}return A.m=te,A.c=G,A.d=function(z,I,R){A.o(z,I)||Object.defineProperty(z,I,{enumerable:!0,get:R})},A.r=function(z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(z,"__esModule",{value:!0})},A.t=function(z,I){if(I&1&&(z=A(z)),I&8)return z;if(I&4&&typeof z=="object"&&z&&z.__esModule)return z;var R=Object.create(null);if(A.r(R),Object.defineProperty(R,"default",{enumerable:!0,value:z}),I&2&&typeof z!="string")for(var j in z)A.d(R,j,function(F){return z[F]}.bind(null,j));return R},A.n=function(z){var I=z&&z.__esModule?function(){return z.default}:function(){return z};return A.d(I,"a",I),I},A.o=function(z,I){return Object.prototype.hasOwnProperty.call(z,I)},A.p="/dist/",A(A.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(te,G,A){"use strict";var z=Object.prototype.hasOwnProperty,I="~";function R(){}Object.create&&(R.prototype=Object.create(null),new R().__proto__||(I=!1));function j(v,S,D){this.fn=v,this.context=S,this.once=D||!1}function F(v,S,D,T,E){if(typeof D!="function")throw new TypeError("The listener must be a function");var g=new j(D,T||v,E),u=I?I+S:S;return v._events[u]?v._events[u].fn?v._events[u]=[v._events[u],g]:v._events[u].push(g):(v._events[u]=g,v._eventsCount++),v}function k(v,S){--v._eventsCount===0?v._events=new R:delete v._events[S]}function L(){this._events=new R,this._eventsCount=0}L.prototype.eventNames=function(){var S=[],D,T;if(this._eventsCount===0)return S;for(T in D=this._events)z.call(D,T)&&S.push(I?T.slice(1):T);return Object.getOwnPropertySymbols?S.concat(Object.getOwnPropertySymbols(D)):S},L.prototype.listeners=function(S){var D=I?I+S:S,T=this._events[D];if(!T)return[];if(T.fn)return[T.fn];for(var E=0,g=T.length,u=new Array(g);E<g;E++)u[E]=T[E].fn;return u},L.prototype.listenerCount=function(S){var D=I?I+S:S,T=this._events[D];return T?T.fn?1:T.length:0},L.prototype.emit=function(S,D,T,E,g,u){var a=I?I+S:S;if(!this._events[a])return!1;var s=this._events[a],l=arguments.length,w,p;if(s.fn){s.once&&this.removeListener(S,s.fn,void 0,!0);switch(l){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,D),!0;case 3:return s.fn.call(s.context,D,T),!0;case 4:return s.fn.call(s.context,D,T,E),!0;case 5:return s.fn.call(s.context,D,T,E,g),!0;case 6:return s.fn.call(s.context,D,T,E,g,u),!0}for(p=1,w=new Array(l-1);p<l;p++)w[p-1]=arguments[p];s.fn.apply(s.context,w)}else{var h=s.length,C;for(p=0;p<h;p++){s[p].once&&this.removeListener(S,s[p].fn,void 0,!0);switch(l){case 1:s[p].fn.call(s[p].context);break;case 2:s[p].fn.call(s[p].context,D);break;case 3:s[p].fn.call(s[p].context,D,T);break;case 4:s[p].fn.call(s[p].context,D,T,E);break;default:if(!w)for(C=1,w=new Array(l-1);C<l;C++)w[C-1]=arguments[C];s[p].fn.apply(s[p].context,w)}}}return!0},L.prototype.on=function(S,D,T){return F(this,S,D,T,!1)},L.prototype.once=function(S,D,T){return F(this,S,D,T,!0)},L.prototype.removeListener=function(S,D,T,E){var g=I?I+S:S;if(!this._events[g])return this;if(!D)return k(this,g),this;var u=this._events[g];if(u.fn)u.fn===D&&(!E||u.once)&&(!T||u.context===T)&&k(this,g);else{for(var a=0,s=[],l=u.length;a<l;a++)(u[a].fn!==D||E&&!u[a].once||T&&u[a].context!==T)&&s.push(u[a]);s.length?this._events[g]=s.length===1?s[0]:s:k(this,g)}return this},L.prototype.removeAllListeners=function(S){var D;return S?(D=I?I+S:S,this._events[D]&&k(this,D)):(this._events=new R,this._eventsCount=0),this},L.prototype.off=L.prototype.removeListener,L.prototype.addListener=L.prototype.on,L.prefixed=I,L.EventEmitter=L,te.exports=L},"./node_modules/url-toolkit/src/url-toolkit.js":function(te,G,A){(function(z){var I=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,R=/^([^\/?#]*)([^]*)$/,j=/(?:\/|^)\.(?=\/)/g,F=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,k={buildAbsoluteURL:function(L,v,S){if(S=S||{},L=L.trim(),v=v.trim(),!v){if(!S.alwaysNormalize)return L;var D=k.parseURL(L);if(!D)throw new Error("Error trying to parse base URL.");return D.path=k.normalizePath(D.path),k.buildURLFromParts(D)}var T=k.parseURL(v);if(!T)throw new Error("Error trying to parse relative URL.");if(T.scheme)return S.alwaysNormalize?(T.path=k.normalizePath(T.path),k.buildURLFromParts(T)):v;var E=k.parseURL(L);if(!E)throw new Error("Error trying to parse base URL.");if(!E.netLoc&&E.path&&E.path[0]!=="/"){var g=R.exec(E.path);E.netLoc=g[1],E.path=g[2]}E.netLoc&&!E.path&&(E.path="/");var u={scheme:E.scheme,netLoc:T.netLoc,path:null,params:T.params,query:T.query,fragment:T.fragment};if(!T.netLoc&&(u.netLoc=E.netLoc,T.path[0]!=="/"))if(!T.path)u.path=E.path,T.params||(u.params=E.params,T.query||(u.query=E.query));else{var a=E.path,s=a.substring(0,a.lastIndexOf("/")+1)+T.path;u.path=k.normalizePath(s)}return u.path===null&&(u.path=S.alwaysNormalize?k.normalizePath(T.path):T.path),k.buildURLFromParts(u)},parseURL:function(L){var v=I.exec(L);return v?{scheme:v[1]||"",netLoc:v[2]||"",path:v[3]||"",params:v[4]||"",query:v[5]||"",fragment:v[6]||""}:null},normalizePath:function(L){for(L=L.split("").reverse().join("").replace(j,"");L.length!==(L=L.replace(F,"")).length;);return L.split("").reverse().join("")},buildURLFromParts:function(L){return L.scheme+L.netLoc+L.path+L.params+L.query+L.fragment}};te.exports=k})(this)},"./node_modules/webworkify-webpack/index.js":function(te,G,A){function z(S){var D={};function T(g){if(D[g])return D[g].exports;var u=D[g]={i:g,l:!1,exports:{}};return S[g].call(u.exports,u,u.exports,T),u.l=!0,u.exports}T.m=S,T.c=D,T.i=function(g){return g},T.d=function(g,u,a){T.o(g,u)||Object.defineProperty(g,u,{configurable:!1,enumerable:!0,get:a})},T.r=function(g){Object.defineProperty(g,"__esModule",{value:!0})},T.n=function(g){var u=g&&g.__esModule?function(){return g.default}:function(){return g};return T.d(u,"a",u),u},T.o=function(g,u){return Object.prototype.hasOwnProperty.call(g,u)},T.p="/",T.oe=function(g){throw console.error(g),g};var E=T(T.s=ENTRY_MODULE);return E.default||E}var I="[\\.|\\-|\\+|\\w|/|@]+",R="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+I+").*?\\)";function j(S){return(S+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function F(S){return!isNaN(1*S)}function k(S,D,T){var E={};E[T]=[];var g=D.toString(),u=g.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return E;for(var a=u[1],s=new RegExp("(\\\\n|\\W)"+j(a)+R,"g"),l;l=s.exec(g);){if(l[3]==="dll-reference")continue;E[T].push(l[3])}for(s=new RegExp("\\("+j(a)+'\\("(dll-reference\\s('+I+'))"\\)\\)'+R,"g");l=s.exec(g);)S[l[2]]||(E[T].push(l[1]),S[l[2]]=A(l[1]).m),E[l[2]]=E[l[2]]||[],E[l[2]].push(l[4]);for(var w=Object.keys(E),p=0;p<w.length;p++)for(var h=0;h<E[w[p]].length;h++)F(E[w[p]][h])&&(E[w[p]][h]=1*E[w[p]][h]);return E}function L(S){var D=Object.keys(S);return D.reduce(function(T,E){return T||S[E].length>0},!1)}function v(S,D){for(var T={main:[D]},E={main:[]},g={main:{}};L(T);)for(var u=Object.keys(T),a=0;a<u.length;a++){var s=u[a],l=T[s],w=l.pop();if(g[s]=g[s]||{},g[s][w]||!S[s][w])continue;g[s][w]=!0,E[s]=E[s]||[],E[s].push(w);for(var p=k(S,S[s][w],s),h=Object.keys(p),C=0;C<h.length;C++)T[h[C]]=T[h[C]]||[],T[h[C]]=T[h[C]].concat(p[h[C]])}return E}te.exports=function(S,D){D=D||{};var T={main:A.m},E=D.all?{main:Object.keys(T.main)}:v(T,S),g="";Object.keys(E).filter(function(w){return w!=="main"}).forEach(function(w){for(var p=0;E[w][p];)p++;E[w].push(p),T[w][p]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",g=g+"var "+w+" = ("+z.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+E[w].map(function(h){return""+JSON.stringify(h)+": "+T[w][h].toString()}).join(",")+`});
|
|
`}),g=g+"new (("+z.toString().replace("ENTRY_MODULE",JSON.stringify(S))+")({"+E.main.map(function(w){return""+JSON.stringify(w)+": "+T.main[w].toString()}).join(",")+"}))(self);";var u=new window.Blob([g],{type:"text/javascript"});if(D.bare)return u;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,s=a.createObjectURL(u),l=new window.Worker(s);return l.objectURL=s,l}},"./src/config.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"hlsDefaultConfig",function(){return C}),A.d(G,"mergeConfig",function(){return c}),A.d(G,"enableStreamingMode",function(){return f});var z=A("./src/controller/abr-controller.ts"),I=A("./src/controller/audio-stream-controller.ts"),R=A("./src/controller/audio-track-controller.ts"),j=A("./src/controller/subtitle-stream-controller.ts"),F=A("./src/controller/subtitle-track-controller.ts"),k=A("./src/controller/buffer-controller.ts"),L=A("./src/controller/timeline-controller.ts"),v=A("./src/controller/cap-level-controller.ts"),S=A("./src/controller/fps-controller.ts"),D=A("./src/controller/eme-controller.ts"),T=A("./src/controller/cmcd-controller.ts"),E=A("./src/utils/xhr-loader.ts"),g=A("./src/utils/fetch-loader.ts"),u=A("./src/utils/cues.ts"),a=A("./src/utils/mediakeys-helper.ts"),s=A("./src/utils/logger.ts");function l(){return l=Object.assign||function(d){for(var o=1;o<arguments.length;o++){var y=arguments[o];for(var m in y)Object.prototype.hasOwnProperty.call(y,m)&&(d[m]=y[m])}return d},l.apply(this,arguments)}function w(d,o){var y=Object.keys(d);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(d);o&&(m=m.filter(function(x){return Object.getOwnPropertyDescriptor(d,x).enumerable})),y.push.apply(y,m)}return y}function p(d){for(var o=1;o<arguments.length;o++){var y=arguments[o]!=null?arguments[o]:{};o%2?w(Object(y),!0).forEach(function(m){h(d,m,y[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(y)):w(Object(y)).forEach(function(m){Object.defineProperty(d,m,Object.getOwnPropertyDescriptor(y,m))})}return d}function h(d,o,y){return o in d?Object.defineProperty(d,o,{value:y,enumerable:!0,configurable:!0,writable:!0}):d[o]=y,d}var C=p(p({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:E.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:z.default,bufferController:k.default,capLevelController:v.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:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},b()),{},{subtitleStreamController:j.SubtitleStreamController,subtitleTrackController:F.default,timelineController:L.TimelineController,audioStreamController:I.default,audioTrackController:R.default,emeController:D.default,cmcdController:T.default});function b(){return{cueHandler:u.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 c(d,o){if((o.liveSyncDurationCount||o.liveMaxLatencyDurationCount)&&(o.liveSyncDuration||o.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(o.liveMaxLatencyDurationCount!==void 0&&(o.liveSyncDurationCount===void 0||o.liveMaxLatencyDurationCount<=o.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(o.liveMaxLatencyDuration!==void 0&&(o.liveSyncDuration===void 0||o.liveMaxLatencyDuration<=o.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return l({},d,o)}function f(d){var o=d.loader;if(o!==g.default&&o!==E.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1;else{var y=Object(g.fetchSupported)();y&&(d.loader=g.default,d.progressive=!0,d.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(te,G,A){"use strict";A.r(G);var z=A("./src/polyfills/number.ts"),I=A("./src/utils/ewma-bandwidth-estimator.ts"),R=A("./src/events.ts"),j=A("./src/utils/buffer-helper.ts"),F=A("./src/errors.ts"),k=A("./src/types/loader.ts"),L=A("./src/utils/logger.ts");function v(T,E){for(var g=0;g<E.length;g++){var u=E[g];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(T,u.key,u)}}function S(T,E,g){return E&&v(T.prototype,E),g&&v(T,g),T}var D=function(){function T(g){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=g;var u=g.config;this.bwEstimator=new I.default(u.abrEwmaSlowVoD,u.abrEwmaFastVoD,u.abrEwmaDefaultEstimate),this.registerListeners()}var E=T.prototype;return E.registerListeners=function(){var u=this.hls;u.on(R.Events.FRAG_LOADING,this.onFragLoading,this),u.on(R.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(R.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){var u=this.hls;u.off(R.Events.FRAG_LOADING,this.onFragLoading,this),u.off(R.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(R.Events.ERROR,this.onError,this)},E.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},E.onFragLoading=function(u,a){var s=a.frag;if(s.type===k.PlaylistLevelType.MAIN&&!this.timer){var l;this.fragCurrent=s,this.partCurrent=(l=a.part)!=null?l:null,this.timer=self.setInterval(this.onCheck,100)}},E.onLevelLoaded=function(u,a){var s=this.hls.config;a.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},E._abandonRulesCheck=function(){var u=this.fragCurrent,a=this.partCurrent,s=this.hls,l=s.autoLevelEnabled,w=s.config,p=s.media;if(!u||!p)return;var h=a?a.stats:u.stats,C=a?a.duration:u.duration;if(h.aborted){L.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!l||p.paused||!p.playbackRate||!p.readyState)return;var b=performance.now()-h.loading.start,c=Math.abs(p.playbackRate);if(b<=500*C/c)return;var f=s.levels,d=s.minAutoLevel,o=f[u.level],y=h.total||Math.max(h.loaded,Math.round(C*o.maxBitrate/8)),m=Math.max(1,h.bwEstimate?h.bwEstimate/8:h.loaded*1e3/b),x=(y-h.loaded)/m,P=p.currentTime,U=(j.BufferHelper.bufferInfo(p,P,w.maxBufferHole).end-P)/c;if(U>=2*C/c||x<=U)return;var B=Number.POSITIVE_INFINITY,W;for(W=u.level-1;W>d;W--){var O=f[W].maxBitrate;if(B=C*O/(8*.8*m),B<U)break}if(B>=x)return;var M=this.bwEstimator.getEstimate();L.logger.warn("Fragment "+u.sn+(a?" part "+a.index:"")+" of level "+u.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+W+`
|
|
Current BW estimate: `+(Object(z.isFiniteNumber)(M)?(M/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+x.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+B.toFixed(3)+` s
|
|
Time to underbuffer: `+U.toFixed(3)+" s"),s.nextLoadLevel=W,this.bwEstimator.sample(b,h.loaded),this.clearTimer(),u.loader&&(this.fragCurrent=this.partCurrent=null,u.loader.abort()),s.trigger(R.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:u,part:a,stats:h})},E.onFragLoaded=function(u,a){var s=a.frag,l=a.part;if(s.type===k.PlaylistLevelType.MAIN&&Object(z.isFiniteNumber)(s.sn)){var w=l?l.stats:s.stats,p=l?l.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var h=this.hls.levels[s.level],C=(h.loaded?h.loaded.bytes:0)+w.loaded,b=(h.loaded?h.loaded.duration:0)+p;h.loaded={bytes:C,duration:b},h.realBitrate=Math.round(8*C/b)}if(s.bitrateTest){var c={stats:w,frag:s,part:l,id:s.type};this.onFragBuffered(R.Events.FRAG_BUFFERED,c),s.bitrateTest=!1}}},E.onFragBuffered=function(u,a){var s=a.frag,l=a.part,w=l?l.stats:s.stats;if(w.aborted)return;if(s.type!==k.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var p=w.parsing.end-w.loading.start;this.bwEstimator.sample(p,w.loaded),w.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=p/1e3:this.bitrateTestDelay=0},E.onError=function(u,a){switch(a.details){case F.ErrorDetails.FRAG_LOAD_ERROR:case F.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},E.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},E.getNextABRAutoLevel=function(){var u=this.fragCurrent,a=this.partCurrent,s=this.hls,l=s.maxAutoLevel,w=s.config,p=s.minAutoLevel,h=s.media,C=a?a.duration:u?u.duration:0,b=h?h.currentTime:0,c=h&&h.playbackRate!==0?Math.abs(h.playbackRate):1,f=this.bwEstimator?this.bwEstimator.getEstimate():w.abrEwmaDefaultEstimate,d=(j.BufferHelper.bufferInfo(h,b,w.maxBufferHole).end-b)/c,o=this.findBestLevel(f,p,l,d,w.abrBandWidthFactor,w.abrBandWidthUpFactor);if(o>=0)return o;L.logger.trace((d?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var y=C?Math.min(C,w.maxStarvationDelay):w.maxStarvationDelay,m=w.abrBandWidthFactor,x=w.abrBandWidthUpFactor;if(!d){var P=this.bitrateTestDelay;if(P){var U=C?Math.min(C,w.maxLoadingDelay):w.maxLoadingDelay;y=U-P,L.logger.trace("bitrate test took "+Math.round(1e3*P)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*y)+" ms"),m=x=1}}return o=this.findBestLevel(f,p,l,d+y,m,x),Math.max(o,0)},E.findBestLevel=function(u,a,s,l,w,p){for(var h,C=this.fragCurrent,b=this.partCurrent,c=this.lastLoadedFragLevel,f=this.hls.levels,d=f[c],o=!!(d!=null&&(h=d.details)!==null&&h!==void 0&&h.live),y=d==null?void 0:d.codecSet,m=b?b.duration:C?C.duration:0,x=s;x>=a;x--){var P=f[x];if(!P||y&&P.codecSet!==y)continue;var U=P.details,B=(b?U==null?void 0:U.partTarget:U==null?void 0:U.averagetargetduration)||m,W=void 0;x<=c?W=w*u:W=p*u;var O=f[x].maxBitrate,M=O*B/W;if(L.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+x+"/"+Math.round(W)+"/"+O+"/"+B+"/"+l+"/"+M),W>O&&(!M||o&&!this.bitrateTestDelay||M<l))return x}return-1},S(T,[{key:"nextAutoLevel",get:function(){var u=this._nextAutoLevel,a=this.bwEstimator;if(u!==-1&&(!a||!a.canEstimate()))return u;var s=this.getNextABRAutoLevel();return u!==-1&&(s=Math.min(u,s)),s},set:function(u){this._nextAutoLevel=u}}]),T}();G.default=D},"./src/controller/audio-stream-controller.ts":function(te,G,A){"use strict";A.r(G);var z=A("./src/polyfills/number.ts"),I=A("./src/controller/base-stream-controller.ts"),R=A("./src/events.ts"),j=A("./src/utils/buffer-helper.ts"),F=A("./src/controller/fragment-tracker.ts"),k=A("./src/types/level.ts"),L=A("./src/types/loader.ts"),v=A("./src/loader/fragment.ts"),S=A("./src/demux/chunk-cache.ts"),D=A("./src/demux/transmuxer-interface.ts"),T=A("./src/types/transmuxer.ts"),E=A("./src/controller/fragment-finders.ts"),g=A("./src/utils/discontinuities.ts"),u=A("./src/errors.ts"),a=A("./src/utils/logger.ts");function s(){return s=Object.assign||function(C){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(C[f]=c[f])}return C},s.apply(this,arguments)}function l(C,b){C.prototype=Object.create(b.prototype),C.prototype.constructor=C,w(C,b)}function w(C,b){return w=Object.setPrototypeOf||function(f,d){return f.__proto__=d,f},w(C,b)}var p=100,h=function(C){l(b,C);function b(f,d){var o;return o=C.call(this,f,d,"[audio-stream-controller]")||this,o.videoBuffer=null,o.videoTrackCC=-1,o.waitingVideoCC=-1,o.audioSwitch=!1,o.trackId=-1,o.waitingData=null,o.mainDetails=null,o.bufferFlushed=!1,o._registerListeners(),o}var c=b.prototype;return c.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},c._registerListeners=function(){var d=this.hls;d.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.on(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(R.Events.ERROR,this.onError,this),d.on(R.Events.BUFFER_RESET,this.onBufferReset,this),d.on(R.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c._unregisterListeners=function(){var d=this.hls;d.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.off(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(R.Events.ERROR,this.onError,this),d.off(R.Events.BUFFER_RESET,this.onBufferReset,this),d.off(R.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c.onInitPtsFound=function(d,o){var y=o.frag,m=o.id,x=o.initPTS;if(m==="main"){var P=y.cc;this.initPTS[y.cc]=x,this.log("InitPTS for cc: "+P+" found from main: "+x),this.videoTrackCC=P,this.state===I.State.WAITING_INIT_PTS&&this.tick()}},c.startLoad=function(d){if(!this.levels){this.startPosition=d,this.state=I.State.STOPPED;return}var o=this.lastCurrentTime;this.stopLoad(),this.setInterval(p),this.fragLoadError=0,o>0&&d===-1?(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),this.state=I.State.IDLE):(this.loadedmetadata=!1,this.state=I.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=d,this.tick()},c.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_TRACK:{var d,o=this.levels,y=this.trackId,m=o==null||((d=o[y])===null||d===void 0)?void 0:d.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=I.State.WAITING_INIT_PTS}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var x,P=performance.now(),U=this.retryDate;(!U||P>=U||(x=this.media)!==null&&x!==void 0&&x.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=I.State.IDLE);break}case I.State.WAITING_INIT_PTS:{var B=this.waitingData;if(B){var W=B.frag,O=B.part,M=B.cache,K=B.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.FRAG_LOADING;var X=M.flush(),ee={frag:W,part:O,payload:X,networkDetails:null};this._handleFragmentLoadProgress(ee),K&&C.prototype._handleFragmentLoadComplete.call(this,ee)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+W.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var oe=this.getLoadPosition(),xe=j.BufferHelper.bufferInfo(this.mediaBuffer,oe,this.config.maxBufferHole),me=Object(E.fragmentWithinToleranceTest)(xe.end,this.config.maxFragLookUpTolerance,W);me<0&&(a.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+xe.end+" is needed"),this.clearWaitingFragment())}}else this.state=I.State.IDLE}}this.onTickEnd()},c.clearWaitingFragment=function(){var d=this.waitingData;d&&(this.fragmentTracker.removeFragment(d.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.IDLE)},c.onTickEnd=function(){var d=this.media;if(!d||!d.readyState)return;var o=this.mediaBuffer?this.mediaBuffer:d,y=o.buffered;!this.loadedmetadata&&y.length&&(this.loadedmetadata=!0),this.lastCurrentTime=d.currentTime},c.doTickIdle=function(){var d,o,y=this.hls,m=this.levels,x=this.media,P=this.trackId,U=y.config;if(!m||!m[P])return;if(!x&&(this.startFragRequested||!U.startFragPrefetch))return;var B=m[P],W=B.details;if(!W||W.live&&this.levelLastLoaded!==P||this.waitForCdnTuneIn(W)){this.state=I.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,v.ElementaryStreamTypes.AUDIO,L.PlaylistLevelType.AUDIO));var O=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,L.PlaylistLevelType.AUDIO);if(O===null)return;var M=O.len,K=this.getMaxBufferLength(),X=this.audioSwitch;if(M>=K&&!X)return;if(!X&&this._streamEnded(O,W)){y.trigger(R.Events.BUFFER_EOS,{type:"audio"}),this.state=I.State.ENDED;return}var ee=W.fragments,oe=ee[0].start,xe=O.end;if(X){var me=this.getLoadPosition();xe=me,W.PTSKnown&&me<oe&&((O.end>oe||O.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),x.currentTime=oe+.05))}var ge=this.getNextFragment(xe,W);if(!ge){this.bufferFlushed=!0;return}((d=ge.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((o=ge.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(ge,W):this.loadFragment(ge,W,xe)},c.getMaxBufferLength=function(){var d=C.prototype.getMaxBufferLength.call(this),o=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,L.PlaylistLevelType.MAIN);return o===null?d:Math.max(d,o.len)},c.onMediaDetaching=function(){this.videoBuffer=null,C.prototype.onMediaDetaching.call(this)},c.onAudioTracksUpdated=function(d,o){var y=o.audioTracks;this.resetTransmuxer(),this.levels=y.map(function(m){return new k.Level(m)})},c.onAudioTrackSwitching=function(d,o){var y=!!o.url;this.trackId=o.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),y?this.setInterval(p):this.resetTransmuxer(),y?(this.audioSwitch=!0,this.state=I.State.IDLE):this.state=I.State.STOPPED,this.tick()},c.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},c.onLevelLoaded=function(d,o){this.mainDetails=o.details},c.onAudioTrackLoaded=function(d,o){var y,m=this.levels,x=o.details,P=o.id;if(!m){this.warn("Audio tracks were reset while loading level "+P);return}this.log("Track "+P+" loaded ["+x.startSN+","+x.endSN+"],duration:"+x.totalduration);var U=m[P],B=0;if(x.live||(y=U.details)!==null&&y!==void 0&&y.live){var W=this.mainDetails;if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed||!W)return;!U.details&&x.hasProgramDateTime&&W.hasProgramDateTime?(Object(g.alignMediaPlaylistByPDT)(x,W),B=x.fragments[0].start):B=this.alignPlaylists(x,U.details)}U.details=x,this.levelLastLoaded=P,!this.startFragRequested&&(this.mainDetails||!x.live)&&this.setStartPosition(U.details,B),this.state===I.State.WAITING_TRACK&&!this.waitForCdnTuneIn(x)&&(this.state=I.State.IDLE),this.tick()},c._handleFragmentLoadProgress=function(d){var o,y=d.frag,m=d.part,x=d.payload,P=this.config,U=this.trackId,B=this.levels;if(!B){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+y.sn+" of level "+y.level+" will not be buffered");return}var W=B[U];console.assert(W,"Audio track is defined on fragment load progress");var O=W.details;console.assert(O,"Audio track details are defined on fragment load progress");var M=P.defaultAudioCodec||W.audioCodec||"mp4a.40.2",K=this.transmuxer;K||(K=this.transmuxer=new D.default(this.hls,L.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var X=this.initPTS[y.cc],ee=(o=y.initSegment)===null||o===void 0?void 0:o.data;if(X!==void 0){var oe=!1,xe=m?m.index:-1,me=xe!==-1,ge=new T.ChunkMetadata(y.level,y.sn,y.stats.chunkCount,x.byteLength,xe,me);K.push(x,ee,M,"",y,m,O.totalduration,oe,ge,X)}else{a.logger.log("Unknown video PTS for cc "+y.cc+", waiting for video PTS before demuxing audio frag "+y.sn+" of ["+O.startSN+" ,"+O.endSN+"],track "+U);var de=this.waitingData=this.waitingData||{frag:y,part:m,cache:new S.default,complete:!1},se=de.cache;se.push(new Uint8Array(x)),this.waitingVideoCC=this.videoTrackCC,this.state=I.State.WAITING_INIT_PTS}},c._handleFragmentLoadComplete=function(d){if(this.waitingData){this.waitingData.complete=!0;return}C.prototype._handleFragmentLoadComplete.call(this,d)},c.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},c.onBufferCreated=function(d,o){var y=o.tracks.audio;y&&(this.mediaBuffer=y.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},c.onFragBuffered=function(d,o){var y=o.frag,m=o.part;if(y.type!==L.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(y)){this.warn("Fragment "+y.sn+(m?" p: "+m.index:"")+" of level "+y.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}y.sn!=="initSegment"&&(this.fragPrevious=y,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(y,m)},c.onError=function(d,o){switch(o.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:case u.ErrorDetails.KEY_LOAD_ERROR:case u.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.AUDIO,o);break;case u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case u.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==I.State.ERROR&&this.state!==I.State.STOPPED&&(this.state=o.fatal?I.State.ERROR:I.State.IDLE,this.warn(o.details+" while loading frag, switching to "+this.state+" state"));break;case u.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="audio"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var y=!0,m=this.getFwdBufferInfo(this.mediaBuffer,L.PlaylistLevelType.AUDIO);m&&m.len>.5&&(y=!this.reduceMaxBufferLength(m.len)),y&&(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}},c.onBufferFlushed=function(d,o){var y=o.type;y===v.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},c._handleTransmuxComplete=function(d){var o,y="audio",m=this.hls,x=d.remuxResult,P=d.chunkMeta,U=this.getCurrentContext(P);if(!U){this.warn("The loading context changed while buffering fragment "+P.sn+" of level "+P.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(P.level);return}var B=U.frag,W=U.part,O=x.audio,M=x.text,K=x.id3,X=x.initSegment;if(this.fragContextChanged(B))return;if(this.state=I.State.PARSING,this.audioSwitch&&O&&this.completeAudioSwitch(),X!=null&&X.tracks&&(this._bufferInitSegment(X.tracks,B,P),m.trigger(R.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:y,tracks:X.tracks})),O){var ee=O.startPTS,oe=O.endPTS,xe=O.startDTS,me=O.endDTS;W&&(W.elementaryStreams[v.ElementaryStreamTypes.AUDIO]={startPTS:ee,endPTS:oe,startDTS:xe,endDTS:me}),B.setElementaryStreamInfo(v.ElementaryStreamTypes.AUDIO,ee,oe,xe,me),this.bufferFragmentData(O,B,W,P)}if(K!=null&&(o=K.samples)!==null&&o!==void 0&&o.length){var ge=s({frag:B,id:y},K);m.trigger(R.Events.FRAG_PARSING_METADATA,ge)}if(M){var de=s({frag:B,id:y},M);m.trigger(R.Events.FRAG_PARSING_USERDATA,de)}},c._bufferInitSegment=function(d,o,y){if(this.state!==I.State.PARSING)return;d.video&&delete d.video;var m=d.audio;if(!m)return;m.levelCodec=m.codec,m.id="audio",this.log("Init audio buffer, container:"+m.container+", codecs[parsed]=["+m.codec+"]"),this.hls.trigger(R.Events.BUFFER_CODECS,d);var x=m.initSegment;if(x!=null&&x.byteLength){var P={type:"audio",frag:o,part:null,chunkMeta:y,parent:o.type,data:x};this.hls.trigger(R.Events.BUFFER_APPENDING,P)}this.tick()},c.loadFragment=function(d,o,y){var m=this.fragmentTracker.getState(d);this.fragCurrent=d,(this.audioSwitch||m===F.FragmentState.NOT_LOADED||m===F.FragmentState.PARTIAL)&&(d.sn==="initSegment"?this._loadInitSegment(d):o.live&&!Object(z.isFiniteNumber)(this.initPTS[d.cc])?(this.log("Waiting for video PTS in continuity counter "+d.cc+" of live stream before loading audio fragment "+d.sn+" of level "+this.trackId),this.state=I.State.WAITING_INIT_PTS):(this.startFragRequested=!0,C.prototype.loadFragment.call(this,d,o,y)))},c.completeAudioSwitch=function(){var d=this.hls,o=this.media,y=this.trackId;o&&(this.log("Switching audio track : flushing all audio"),C.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,d.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:y})},b}(I.default);G.default=h},"./src/controller/audio-track-controller.ts":function(te,G,A){"use strict";A.r(G);var z=A("./src/events.ts"),I=A("./src/errors.ts"),R=A("./src/controller/base-playlist-controller.ts"),j=A("./src/types/loader.ts");function F(D,T){for(var E=0;E<T.length;E++){var g=T[E];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(D,g.key,g)}}function k(D,T,E){return T&&F(D.prototype,T),E&&F(D,E),D}function L(D,T){D.prototype=Object.create(T.prototype),D.prototype.constructor=D,v(D,T)}function v(D,T){return v=Object.setPrototypeOf||function(g,u){return g.__proto__=u,g},v(D,T)}var S=function(D){L(T,D);function T(g){var u;return u=D.call(this,g,"[audio-track-controller]")||this,u.tracks=[],u.groupId=null,u.tracksInGroup=[],u.trackId=-1,u.trackName="",u.selectDefaultTrack=!0,u.registerListeners(),u}var E=T.prototype;return E.registerListeners=function(){var u=this.hls;u.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),u.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.on(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(z.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){var u=this.hls;u.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),u.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.off(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(z.Events.ERROR,this.onError,this)},E.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,D.prototype.destroy.call(this)},E.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},E.onManifestParsed=function(u,a){this.tracks=a.audioTracks||[]},E.onAudioTrackLoaded=function(u,a){var s=a.id,l=a.details,w=this.tracksInGroup[s];if(!w){this.warn("Invalid audio track id "+s);return}var p=w.details;w.details=a.details,this.log("audioTrack "+s+" loaded ["+l.startSN+"-"+l.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,a,p))},E.onLevelLoading=function(u,a){this.switchLevel(a.level)},E.onLevelSwitching=function(u,a){this.switchLevel(a.level)},E.switchLevel=function(u){var a=this.hls.levels[u];if(!(a!=null&&a.audioGroupIds))return;var s=a.audioGroupIds[a.urlId];if(this.groupId!==s){this.groupId=s;var l=this.tracks.filter(function(p){return!s||p.groupId===s});this.selectDefaultTrack&&!l.some(function(p){return p.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=l;var w={audioTracks:l};this.log("Updating audio tracks, "+l.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(z.Events.AUDIO_TRACKS_UPDATED,w),this.selectInitialTrack()}},E.onError=function(u,a){if(D.prototype.onError.call(this,u,a),a.fatal||!a.context)return;a.context.type===j.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},E.setAudioTrack=function(u){var a=this.tracksInGroup;if(u<0||u>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=a[this.trackId];this.log("Now switching to audio-track index "+u);var l=a[u],w=l.id,p=l.groupId,h=p===void 0?"":p,C=l.name,b=l.type,c=l.url;if(this.trackId=u,this.trackName=C,this.selectDefaultTrack=!1,this.hls.trigger(z.Events.AUDIO_TRACK_SWITCHING,{id:w,groupId:h,name:C,type:b,url:c}),l.details&&!l.details.live)return;var f=this.switchParams(l.url,s==null?void 0:s.details);this.loadPlaylist(f)},E.selectInitialTrack=function(){var u=this.tracksInGroup;console.assert(u.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,s=this.findTrackId(a)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},E.findTrackId=function(u){for(var a=this.tracksInGroup,s=0;s<a.length;s++){var l=a[s];if((!this.selectDefaultTrack||l.default)&&(!u||u===l.name))return l.id}return-1},E.loadPlaylist=function(u){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var s=a.id,l=a.groupId,w=a.url;if(u)try{w=u.addDirectives(w)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(z.Events.AUDIO_TRACK_LOADING,{url:w,id:s,groupId:l,deliveryDirectives:u||null})}},k(T,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(u){this.selectDefaultTrack=!1,this.setAudioTrack(u)}}]),T}(R.default);G.default=S},"./src/controller/base-playlist-controller.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return k});var z=A("./src/polyfills/number.ts"),I=A("./src/types/level.ts"),R=A("./src/controller/level-helper.ts"),j=A("./src/utils/logger.ts"),F=A("./src/errors.ts"),k=function(){function L(S,D){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=j.logger.log.bind(j.logger,D+":"),this.warn=j.logger.warn.bind(j.logger,D+":"),this.hls=S}var v=L.prototype;return v.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},v.onError=function(D,T){T.fatal&&T.type===F.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},v.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},v.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},v.stopLoad=function(){this.canLoad=!1,this.clearTimer()},v.switchParams=function(D,T){var E=T==null?void 0:T.renditionReports;if(E)for(var g=0;g<E.length;g++){var u=E[g],a=""+u.URI;if(a===D.substr(-a.length)){var s=parseInt(u["LAST-MSN"]),l=parseInt(u["LAST-PART"]);if(T&&this.hls.config.lowLatencyMode){var w=Math.min(T.age-T.partTarget,T.targetduration);l!==void 0&&w>T.partTarget&&(l+=1)}if(Object(z.isFiniteNumber)(s))return new I.HlsUrlParameters(s,Object(z.isFiniteNumber)(l)?l:void 0,I.HlsSkip.No)}}},v.loadPlaylist=function(D){},v.shouldLoadTrack=function(D){return this.canLoad&&D&&!!D.url&&(!D.details||D.details.live)},v.playlistLoaded=function(D,T,E){var g=this,u=T.details,a=T.stats,s=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(u.advancedDateTime=Date.now()-s,u.live||E!=null&&E.live){if(u.reloaded(E),E&&this.log("live playlist "+D+" "+(u.advanced?"REFRESHED "+u.lastPartSn+"-"+u.lastPartIndex:"MISSED")),E&&u.fragments.length>0&&Object(R.mergeDetails)(E,u),!this.canLoad||!u.live)return;var l,w=void 0,p=void 0;if(u.canBlockReload&&u.endSN&&u.advanced){var h=this.hls.config.lowLatencyMode,C=u.lastPartSn,b=u.endSN,c=u.lastPartIndex,f=c!==-1,d=C===b,o=h?0:c;f?(w=d?b+1:C,p=d?o:c+1):w=b+1;var y=u.age,m=y+u.ageHeader,x=Math.min(m-u.partTarget,u.targetduration*1.5);if(x>0){if(E&&x>E.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+E.tuneInGoal+" to: "+x+" with playlist age: "+u.age),x=0;else{var P=Math.floor(x/u.targetduration);if(w+=P,p!==void 0){var U=Math.round(x%u.targetduration/u.partTarget);p+=U}this.log("CDN Tune-in age: "+u.ageHeader+"s last advanced "+y.toFixed(2)+"s goal: "+x+" skip sn "+P+" to part "+p)}u.tuneInGoal=x}if(l=this.getDeliveryDirectives(u,T.deliveryDirectives,w,p),h||!d){this.loadPlaylist(l);return}}else l=this.getDeliveryDirectives(u,T.deliveryDirectives,w,p);var B=Object(R.computeReloadInterval)(u,a);w!==void 0&&u.canBlockReload&&(B-=u.partTarget||1),this.log("reload live playlist "+D+" in "+Math.round(B)+" ms"),this.timer=self.setTimeout(function(){return g.loadPlaylist(l)},B)}else this.clearTimer()},v.getDeliveryDirectives=function(D,T,E,g){var u=Object(I.getSkipValue)(D,E);return T!=null&&T.skip&&D.deltaUpdateFailed&&(E=T.msn,g=T.part,u=I.HlsSkip.No),new I.HlsUrlParameters(E,g,u)},v.retryLoadingOrFail=function(D){var T=this,E=this.hls.config,g=this.retryCount<E.levelLoadingMaxRetry;if(g){var u;if(this.retryCount++,D.details.indexOf("LoadTimeOut")>-1&&(u=D.context)!==null&&u!==void 0&&u.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+D.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*E.levelLoadingRetryDelay,E.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return T.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+D.details+'"')}}else this.warn('cannot recover from error "'+D.details+'"'),this.clearTimer(),D.fatal=!0;return g},L}()},"./src/controller/base-stream-controller.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"State",function(){return b}),A.d(G,"default",function(){return c});var z=A("./src/polyfills/number.ts"),I=A("./src/task-loop.ts"),R=A("./src/controller/fragment-tracker.ts"),j=A("./src/utils/buffer-helper.ts"),F=A("./src/utils/logger.ts"),k=A("./src/events.ts"),L=A("./src/errors.ts"),v=A("./src/types/transmuxer.ts"),S=A("./src/utils/mp4-tools.ts"),D=A("./src/utils/discontinuities.ts"),T=A("./src/controller/fragment-finders.ts"),E=A("./src/controller/level-helper.ts"),g=A("./src/loader/fragment-loader.ts"),u=A("./src/crypt/decrypter.ts"),a=A("./src/utils/time-ranges.ts"),s=A("./src/types/loader.ts");function l(f,d){for(var o=0;o<d.length;o++){var y=d[o];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(f,y.key,y)}}function w(f,d,o){return d&&l(f.prototype,d),o&&l(f,o),f}function p(f){if(f===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f}function h(f,d){f.prototype=Object.create(d.prototype),f.prototype.constructor=f,C(f,d)}function C(f,d){return C=Object.setPrototypeOf||function(y,m){return y.__proto__=m,y},C(f,d)}var b={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},c=function(f){h(d,f);function d(y,m,x){var P;return P=f.call(this)||this,P.hls=void 0,P.fragPrevious=null,P.fragCurrent=null,P.fragmentTracker=void 0,P.transmuxer=null,P._state=b.STOPPED,P.media=void 0,P.mediaBuffer=void 0,P.config=void 0,P.bitrateTest=!1,P.lastCurrentTime=0,P.nextLoadPosition=0,P.startPosition=0,P.loadedmetadata=!1,P.fragLoadError=0,P.retryDate=0,P.levels=null,P.fragmentLoader=void 0,P.levelLastLoaded=null,P.startFragRequested=!1,P.decrypter=void 0,P.initPTS=[],P.onvseeking=null,P.onvended=null,P.logPrefix="",P.log=void 0,P.warn=void 0,P.logPrefix=x,P.log=F.logger.log.bind(F.logger,x+":"),P.warn=F.logger.warn.bind(F.logger,x+":"),P.hls=y,P.fragmentLoader=new g.default(y.config),P.fragmentTracker=m,P.config=y.config,P.decrypter=new u.default(y,y.config),y.on(k.Events.KEY_LOADED,P.onKeyLoaded,p(P)),P}var o=d.prototype;return o.doTick=function(){this.onTickEnd()},o.onTickEnd=function(){},o.startLoad=function(m){},o.stopLoad=function(){this.fragmentLoader.abort();var m=this.fragCurrent;m&&this.fragmentTracker.removeFragment(m),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=b.STOPPED},o._streamEnded=function(m,x){var P=this.fragCurrent,U=this.fragmentTracker;if(!x.live&&P&&P.sn===x.endSN&&!m.nextStart){var B=U.getState(P);return B===R.FragmentState.PARTIAL||B===R.FragmentState.OK}return!1},o.onMediaAttached=function(m,x){var P=this.media=this.mediaBuffer=x.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),P.addEventListener("seeking",this.onvseeking),P.addEventListener("ended",this.onvended);var U=this.config;this.levels&&U.autoStartLoad&&this.state===b.STOPPED&&this.startLoad(U.startPosition)},o.onMediaDetaching=function(){var m=this.media;m!=null&&m.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),m&&(m.removeEventListener("seeking",this.onvseeking),m.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},o.onMediaSeeking=function(){var m=this.config,x=this.fragCurrent,P=this.media,U=this.mediaBuffer,B=this.state,W=P?P.currentTime:0,O=j.BufferHelper.bufferInfo(U||P,W,m.maxBufferHole);if(this.log("media seeking to "+(Object(z.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+B),B===b.ENDED)this.resetLoadingState();else if(x&&!O.len){var M=m.maxFragLookUpTolerance,K=x.start-M,X=x.start+x.duration+M,ee=W>X;(W<K||ee)&&(ee&&x.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),x.loader.abort()),this.resetLoadingState())}P&&(this.lastCurrentTime=W),!this.loadedmetadata&&!O.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},o.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},o.onKeyLoaded=function(m,x){if(this.state!==b.KEY_LOADING||x.frag!==this.fragCurrent||!this.levels)return;this.state=b.IDLE;var P=this.levels[x.frag.level].details;P&&this.loadFragment(x.frag,P,x.frag.start)},o.onHandlerDestroying=function(){this.stopLoad(),f.prototype.onHandlerDestroying.call(this)},o.onHandlerDestroyed=function(){this.state=b.STOPPED,this.hls.off(k.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,f.prototype.onHandlerDestroyed.call(this)},o.loadKey=function(m,x){this.log("Loading key for "+m.sn+" of ["+x.startSN+"-"+x.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=b.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(k.Events.KEY_LOADING,{frag:m})},o.loadFragment=function(m,x,P){this._loadFragForPlayback(m,x,P)},o._loadFragForPlayback=function(m,x,P){var U=this,B=function(O){if(U.fragContextChanged(m)){U.warn("Fragment "+m.sn+(O.part?" p: "+O.part.index:"")+" of level "+m.level+" was dropped during download."),U.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,U._handleFragmentLoadProgress(O)};this._doFragLoad(m,x,P,B).then(function(W){if(!W)return;U.fragLoadError=0;var O=U.state;if(U.fragContextChanged(m)){(O===b.FRAG_LOADING||O===b.BACKTRACKING||!U.fragCurrent&&O===b.PARSING)&&(U.fragmentTracker.removeFragment(m),U.state=b.IDLE);return}if("payload"in W&&(U.log("Loaded fragment "+m.sn+" of level "+m.level),U.hls.trigger(k.Events.FRAG_LOADED,W),U.state===b.BACKTRACKING)){U.fragmentTracker.backtrack(m,W),U.resetFragmentLoading(m);return}U._handleFragmentLoadComplete(W)}).catch(function(W){U.warn(W),U.resetFragmentLoading(m)})},o.flushMainBuffer=function(m,x,P){if(P===void 0&&(P=null),!(m-x))return;var U={startOffset:m,endOffset:x,type:P};this.fragLoadError=0,this.hls.trigger(k.Events.BUFFER_FLUSHING,U)},o._loadInitSegment=function(m){var x=this;this._doFragLoad(m).then(function(P){if(!P||x.fragContextChanged(m)||!x.levels)throw new Error("init load aborted");return P}).then(function(P){var U=x.hls,B=P.payload,W=m.decryptdata;if(B&&B.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var O=self.performance.now();return x.decrypter.webCryptoDecrypt(new Uint8Array(B),W.key.buffer,W.iv.buffer).then(function(M){var K=self.performance.now();return U.trigger(k.Events.FRAG_DECRYPTED,{frag:m,payload:M,stats:{tstart:O,tdecrypt:K}}),P.payload=M,P})}return P}).then(function(P){var U=x.fragCurrent,B=x.hls,W=x.levels;if(!W)throw new Error("init load aborted, missing levels");var O=W[m.level].details;console.assert(O,"Level details are defined when init segment is loaded");var M=m.stats;x.state=b.IDLE,x.fragLoadError=0,m.data=new Uint8Array(P.payload),M.parsing.start=M.buffering.start=self.performance.now(),M.parsing.end=M.buffering.end=self.performance.now(),P.frag===U&&B.trigger(k.Events.FRAG_BUFFERED,{stats:M,frag:U,part:null,id:m.type}),x.tick()}).catch(function(P){x.warn(P),x.resetFragmentLoading(m)})},o.fragContextChanged=function(m){var x=this.fragCurrent;return!m||!x||m.level!==x.level||m.sn!==x.sn||m.urlId!==x.urlId},o.fragBufferedComplete=function(m,x){var P=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(x?" part: "+x.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+a.default.toString(j.BufferHelper.getBuffered(P))),this.state=b.IDLE,this.tick()},o._handleFragmentLoadComplete=function(m){var x=this.transmuxer;if(!x)return;var P=m.frag,U=m.part,B=m.partsLoaded,W=!B||B.length===0||B.some(function(M){return!M}),O=new v.ChunkMetadata(P.level,P.sn,P.stats.chunkCount+1,0,U?U.index:-1,!W);x.flush(O)},o._handleFragmentLoadProgress=function(m){},o._doFragLoad=function(m,x,P,U){var B=this;if(P===void 0&&(P=null),!this.levels)throw new Error("frag load aborted, missing levels");if(P=Math.max(m.start,P||0),this.config.lowLatencyMode&&x){var W=x.partList;if(W&&U){P>m.end&&x.fragmentHint&&(m=x.fragmentHint);var O=this.getNextPart(W,m,P);if(O>-1){var M=W[O];return this.log("Loading part sn: "+m.sn+" p: "+M.index+" cc: "+m.cc+" of playlist ["+x.startSN+"-"+x.endSN+"] parts [0-"+O+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(P.toFixed(3))),this.nextLoadPosition=M.start+M.duration,this.state=b.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:m,part:W[O],targetBufferTime:P}),this.doFragPartsLoad(m,W,O,U).catch(function(K){return B.handleFragLoadError(K)})}else if(!m.url||this.loadedEndOfParts(W,P))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(x?"of ["+x.startSN+"-"+x.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(P.toFixed(3))),Object(z.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=b.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:m,targetBufferTime:P}),this.fragmentLoader.load(m,U).catch(function(K){return B.handleFragLoadError(K)})},o.doFragPartsLoad=function(m,x,P,U){var B=this;return new Promise(function(W,O){var M=[],K=function X(ee){var oe=x[ee];B.fragmentLoader.loadPart(m,oe,U).then(function(xe){M[oe.index]=xe;var me=xe.part;B.hls.trigger(k.Events.FRAG_LOADED,xe);var ge=x[ee+1];if(ge&&ge.fragment===m)X(ee+1);else return W({frag:m,part:me,partsLoaded:M})}).catch(O)};K(P)})},o.handleFragLoadError=function(m){var x=m.data;return x&&x.details===L.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(x.frag,x.part):this.hls.trigger(k.Events.ERROR,x),null},o._handleTransmuxerFlush=function(m){var x=this.getCurrentContext(m);if(!x||this.state!==b.PARSING){this.fragCurrent||(this.state=b.IDLE);return}var P=x.frag,U=x.part,B=x.level,W=self.performance.now();P.stats.parsing.end=W,U&&(U.stats.parsing.end=W),this.updateLevelTiming(P,U,B,m.partial)},o.getCurrentContext=function(m){var x=this.levels,P=m.level,U=m.sn,B=m.part;if(!x||!x[P])return this.warn("Levels object was unset while buffering fragment "+U+" of level "+P+". The current chunk will not be buffered."),null;var W=x[P],O=B>-1?Object(E.getPartWith)(W,U,B):null,M=O?O.fragment:Object(E.getFragmentWithSN)(W,U,this.fragCurrent);return M?{frag:M,part:O,level:W}:null},o.bufferFragmentData=function(m,x,P,U){if(!m||this.state!==b.PARSING)return;var B=m.data1,W=m.data2,O=B;if(B&&W&&(O=Object(S.appendUint8Array)(B,W)),!O||!O.length)return;var M={type:m.type,frag:x,part:P,chunkMeta:U,parent:x.type,data:O};this.hls.trigger(k.Events.BUFFER_APPENDING,M),m.dropped&&m.independent&&!P&&this.flushBufferGap(x)},o.flushBufferGap=function(m){var x=this.media;if(!x)return;if(!j.BufferHelper.isBuffered(x,x.currentTime)){this.flushMainBuffer(0,m.start);return}var P=x.currentTime,U=j.BufferHelper.bufferInfo(x,P,0),B=m.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,B*.25),O=Math.max(Math.min(m.start-W,U.end-W),P+W);m.start-O>W&&this.flushMainBuffer(O,m.start)},o.getFwdBufferInfo=function(m,x){var P=this.config,U=this.getLoadPosition();if(!Object(z.isFiniteNumber)(U))return null;var B=j.BufferHelper.bufferInfo(m,U,P.maxBufferHole);if(B.len===0&&B.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(U,x);if(W&&B.nextStart<W.end)return j.BufferHelper.bufferInfo(m,U,Math.max(B.nextStart,P.maxBufferHole))}return B},o.getMaxBufferLength=function(m){var x=this.config,P;return m?P=Math.max(8*x.maxBufferSize/m,x.maxBufferLength):P=x.maxBufferLength,Math.min(P,x.maxMaxBufferLength)},o.reduceMaxBufferLength=function(m){var x=this.config,P=m||x.maxBufferLength;return x.maxMaxBufferLength>=P?(x.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+x.maxMaxBufferLength+"s"),!0):!1},o.getNextFragment=function(m,x){var P,U,B=x.fragments,W=B.length;if(!W)return null;var O=this.config,M=B[0].start,K;if(x.live){var X=O.initialLiveManifestSize;if(W<X)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+X+")"),null;!x.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(K=this.getInitialLiveFragment(x,B),this.startPosition=K?this.hls.liveSyncPosition||K.start:m)}else m<=M&&(K=B[0]);if(!K){var ee=O.lowLatencyMode?x.partEnd:x.fragmentEnd;K=this.getFragmentAtPosition(m,ee,x)}return(P=K)!==null&&P!==void 0&&P.initSegment&&!((U=K)!==null&&U!==void 0&&U.initSegment.data)&&!this.bitrateTest&&(K=K.initSegment),K},o.getNextPart=function(m,x,P){for(var U=-1,B=!1,W=!0,O=0,M=m.length;O<M;O++){var K=m[O];if(W=W&&!K.independent,U>-1&&P<K.start)break;var X=K.loaded;!X&&(B||K.independent||W)&&K.fragment===x&&(U=O),B=X}return U},o.loadedEndOfParts=function(m,x){var P=m[m.length-1];return P&&x>P.start&&P.loaded},o.getInitialLiveFragment=function(m,x){var P=this.fragPrevious,U=null;if(P){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+P.programDateTime),U=Object(T.findFragmentByPDT)(x,P.endProgramDateTime,this.config.maxFragLookUpTolerance)),!U){var B=P.sn+1;if(B>=m.startSN&&B<=m.endSN){var W=x[B-m.startSN];P.cc===W.cc&&(U=W,this.log("Live playlist, switching playlist, load frag with next SN: "+U.sn))}U||(U=Object(T.findFragWithCC)(x,P.cc),U&&this.log("Live playlist, switching playlist, load frag with same CC: "+U.sn))}}else{var O=this.hls.liveSyncPosition;O!==null&&(U=this.getFragmentAtPosition(O,this.bitrateTest?m.fragmentEnd:m.edge,m))}return U},o.getFragmentAtPosition=function(m,x,P){var U=this.config,B=this.fragPrevious,W=P.fragments,O=P.endSN,M=P.fragmentHint,K=U.maxFragLookUpTolerance,X=!!(U.lowLatencyMode&&P.partList&&M);X&&M&&!this.bitrateTest&&(W=W.concat(M),O=M.sn);var ee;if(m<x){var oe=m>x-K?0:K;ee=Object(T.findFragmentByPTS)(B,W,m,oe)}else ee=W[W.length-1];if(ee){var xe=ee.sn-P.startSN,me=B&&ee.level===B.level,ge=W[xe+1],de=this.fragmentTracker.getState(ee);if(de===R.FragmentState.BACKTRACKED){ee=null;for(var se=xe;W[se]&&this.fragmentTracker.getState(W[se])===R.FragmentState.BACKTRACKED;)B?ee=W[se--]:ee=W[--se];ee||(ee=ge)}else B&&ee.sn===B.sn&&!X&&(me&&(ee.sn<O&&this.fragmentTracker.getState(ge)!==R.FragmentState.OK?(this.log("SN "+ee.sn+" just loaded, load next one: "+ge.sn),ee=ge):ee=null))}return ee},o.synchronizeToLiveEdge=function(m){var x=this.config,P=this.media;if(!P)return;var U=this.hls.liveSyncPosition,B=P.currentTime,W=m.fragments[0].start,O=m.edge,M=B>=W-x.maxFragLookUpTolerance&&B<=O;if(U!==null&&P.duration>U&&(B<U||!M)){var K=x.liveMaxLatencyDuration!==void 0?x.liveMaxLatencyDuration:x.liveMaxLatencyDurationCount*m.targetduration;(!M&&P.readyState<4||B<O-K)&&(this.loadedmetadata||(this.nextLoadPosition=U),P.readyState&&(this.warn("Playback: "+B.toFixed(3)+" is located too far from the end of live sliding playlist: "+O+", reset currentTime to : "+U.toFixed(3)),P.currentTime=U))}},o.alignPlaylists=function(m,x){var P=this.levels,U=this.levelLastLoaded,B=this.fragPrevious,W=U!==null?P[U]:null,O=m.fragments.length;if(!O)return this.warn("No fragments in live playlist"),0;var M=m.fragments[0].start,K=!x,X=m.alignedSliding&&Object(z.isFiniteNumber)(M);if(K||!X&&!M){Object(D.alignStream)(B,W,m);var ee=m.fragments[0].start;return this.log("Live playlist sliding: "+ee.toFixed(2)+" start-sn: "+(x?x.startSN:"na")+"->"+m.startSN+" prev-sn: "+(B?B.sn:"na")+" fragments: "+O),ee}return M},o.waitForCdnTuneIn=function(m){var x=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*x)},o.setStartPosition=function(m,x){var P=this.startPosition;if(P<x&&(P=-1),P===-1||this.lastCurrentTime===-1){var U=m.startTimeOffset;Object(z.isFiniteNumber)(U)?(P=x+U,U<0&&(P+=m.totalduration),P=Math.min(Math.max(x,P),x+m.totalduration),this.log("Start time offset "+U+" found in playlist, adjust startPosition to "+P),this.startPosition=P):m.live?P=this.hls.liveSyncPosition||x:this.startPosition=P=0,this.lastCurrentTime=P}this.nextLoadPosition=P},o.getLoadPosition=function(){var m=this.media,x=0;return this.loadedmetadata&&m?x=m.currentTime:this.nextLoadPosition&&(x=this.nextLoadPosition),x},o.handleFragLoadAborted=function(m,x){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(x?" part"+x.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},o.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=b.IDLE)},o.onFragmentOrKeyLoadError=function(m,x){if(x.fatal)return;var P=x.frag;if(!P||P.type!==m)return;var U=this.fragCurrent;console.assert(U&&P.sn===U.sn&&P.level===U.level&&P.urlId===U.urlId,"Frag load error must match current frag to retry");var B=this.config;if(this.fragLoadError+1<=B.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(P.level))return;var W=Math.min(Math.pow(2,this.fragLoadError)*B.fragLoadingRetryDelay,B.fragLoadingMaxRetryTimeout);this.warn("Fragment "+P.sn+" of "+m+" "+P.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=b.FRAG_LOADING_WAITING_RETRY}else x.levelRetry?(m===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=b.IDLE):(F.logger.error(x.details+" reaches max retry, redispatch as fatal ..."),x.fatal=!0,this.hls.stopLoad(),this.state=b.ERROR)},o.afterBufferFlushed=function(m,x,P){if(!m)return;var U=j.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(x,U,P),this.state===b.ENDED&&this.resetLoadingState()},o.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=b.IDLE},o.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var x=this.levels?this.levels[m].details:null;if(x!=null&&x.live)return this.startPosition=-1,this.setStartPosition(x,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},o.updateLevelTiming=function(m,x,P,U){var B=this,W=P.details;console.assert(!!W,"level.details must be defined");var O=Object.keys(m.elementaryStreams).reduce(function(M,K){var X=m.elementaryStreams[K];if(X){var ee=X.endPTS-X.startPTS;if(ee<=0)return B.warn("Could not parse fragment "+m.sn+" "+K+" duration reliably ("+ee+") resetting transmuxer to fallback to playlist timing"),B.resetTransmuxer(),M||!1;var oe=U?0:Object(E.updateFragPTSDTS)(W,m,X.startPTS,X.endPTS,X.startDTS,X.endDTS);return B.hls.trigger(k.Events.LEVEL_PTS_UPDATED,{details:W,level:P,drift:oe,type:K,frag:m,start:X.startPTS,end:X.endPTS}),!0}return M},!1);O?(this.state=b.PARSED,this.hls.trigger(k.Events.FRAG_PARSED,{frag:m,part:x})):this.resetLoadingState()},o.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},w(d,[{key:"state",get:function(){return this._state},set:function(m){var x=this._state;x!==m&&(this._state=m,this.log(x+"->"+m))}}]),d}(I.default)},"./src/controller/buffer-controller.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return T});var z=A("./src/polyfills/number.ts"),I=A("./src/events.ts"),R=A("./src/utils/logger.ts"),j=A("./src/errors.ts"),F=A("./src/utils/buffer-helper.ts"),k=A("./src/utils/mediasource-helper.ts"),L=A("./src/loader/fragment.ts"),v=A("./src/controller/buffer-operation-queue.ts"),S=Object(k.getMediaSource)(),D=/([ha]vc.)(?:\.[^.,]+)+/,T=function(){function E(u){var a=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 s=a.hls,l=a.media,w=a.mediaSource;R.logger.log("[buffer-controller]: Media source opened"),l&&(a.updateMediaElementDuration(),s.trigger(I.Events.MEDIA_ATTACHED,{media:l})),w&&w.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){R.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){R.logger.log("[buffer-controller]: Media source ended")},this.hls=u,this._initSourceBuffer(),this.registerListeners()}var g=E.prototype;return g.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},g.destroy=function(){this.unregisterListeners(),this.details=null},g.registerListeners=function(){var a=this.hls;a.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(I.Events.BUFFER_RESET,this.onBufferReset,this),a.on(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(I.Events.BUFFER_EOS,this.onBufferEos,this),a.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(I.Events.FRAG_PARSED,this.onFragParsed,this),a.on(I.Events.FRAG_CHANGED,this.onFragChanged,this)},g.unregisterListeners=function(){var a=this.hls;a.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(I.Events.BUFFER_RESET,this.onBufferReset,this),a.off(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(I.Events.BUFFER_EOS,this.onBufferEos,this),a.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(I.Events.FRAG_PARSED,this.onFragParsed,this),a.off(I.Events.FRAG_CHANGED,this.onFragChanged,this)},g._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new v.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},g.onManifestParsed=function(a,s){var l=2;(s.audio&&!s.video||!s.altAudio)&&(l=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=l,this.details=null,R.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},g.onMediaAttaching=function(a,s){var l=this.media=s.media;if(l&&S){var w=this.mediaSource=new S;w.addEventListener("sourceopen",this._onMediaSourceOpen),w.addEventListener("sourceended",this._onMediaSourceEnded),w.addEventListener("sourceclose",this._onMediaSourceClose),l.src=self.URL.createObjectURL(w),this._objectUrl=l.src}},g.onMediaDetaching=function(){var a=this.media,s=this.mediaSource,l=this._objectUrl;if(s){if(R.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(w){R.logger.warn("[buffer-controller]: onMediaDetaching: "+w.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(l&&self.URL.revokeObjectURL(l),a.src===l?(a.removeAttribute("src"),a.load()):R.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(I.Events.MEDIA_DETACHED,void 0)},g.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(s){var l=a.sourceBuffer[s];try{l&&(a.removeBufferListeners(s),a.mediaSource&&a.mediaSource.removeSourceBuffer(l),a.sourceBuffer[s]=void 0)}catch(w){R.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",w)}}),this._initSourceBuffer()},g.onBufferCodecs=function(a,s){var l=this,w=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(p){if(w){var h=l.tracks[p];if(h&&typeof h.buffer.changeType=="function"){var C=s[p],b=C.codec,c=C.levelCodec,f=C.container,d=(h.levelCodec||h.codec).replace(D,"$1"),o=(c||b).replace(D,"$1");if(d!==o){var y=f+";codecs="+(c||b);l.appendChangeType(p,y)}}}else l.pendingTracks[p]=s[p]}),w)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},g.appendChangeType=function(a,s){var l=this,w=this.operationQueue,p={execute:function(){var C=l.sourceBuffer[a];C&&(R.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+s),C.changeType(s)),w.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(C){R.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",C)}};w.append(p,a)},g.onBufferAppending=function(a,s){var l=this,w=this.hls,p=this.operationQueue,h=this.tracks,C=s.data,b=s.type,c=s.frag,f=s.part,d=s.chunkMeta,o=d.buffering[b],y=self.performance.now();o.start=y;var m=c.stats.buffering,x=f?f.stats.buffering:null;m.start===0&&(m.start=y),x&&x.start===0&&(x.start=y);var P=h.audio,U=b==="audio"&&d.id===1&&(P==null?void 0:P.container)==="audio/mpeg",B={execute:function(){if(o.executeStart=self.performance.now(),U){var O=l.sourceBuffer[b];if(O){var M=c.start-O.timestampOffset;Math.abs(M)>=.1&&(R.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+c.start+" (delta: "+M+") sn: "+c.sn+")"),O.timestampOffset=c.start)}}l.appendExecutor(C,b)},onStart:function(){},onComplete:function(){var O=self.performance.now();o.executeEnd=o.end=O,m.first===0&&(m.first=O),x&&x.first===0&&(x.first=O);var M=l.sourceBuffer,K={};for(var X in M)K[X]=F.BufferHelper.getBuffered(M[X]);l.appendError=0,l.hls.trigger(I.Events.BUFFER_APPENDED,{type:b,frag:c,part:f,chunkMeta:d,parent:c.type,timeRanges:K})},onError:function(O){R.logger.error("[buffer-controller]: Error encountered while trying to append to the "+b+" SourceBuffer",O);var M={type:j.ErrorTypes.MEDIA_ERROR,parent:c.type,details:j.ErrorDetails.BUFFER_APPEND_ERROR,err:O,fatal:!1};O.code===DOMException.QUOTA_EXCEEDED_ERR?M.details=j.ErrorDetails.BUFFER_FULL_ERROR:(l.appendError++,M.details=j.ErrorDetails.BUFFER_APPEND_ERROR,l.appendError>w.config.appendErrorMaxRetry&&(R.logger.error("[buffer-controller]: Failed "+w.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),M.fatal=!0)),w.trigger(I.Events.ERROR,M)}};p.append(B,b)},g.onBufferFlushing=function(a,s){var l=this,w=this.operationQueue,p=function(C){return{execute:l.removeExecutor.bind(l,C,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){l.hls.trigger(I.Events.BUFFER_FLUSHED,{type:C})},onError:function(c){R.logger.warn("[buffer-controller]: Failed to remove from "+C+" SourceBuffer",c)}}};s.type?w.append(p(s.type),s.type):this.getSourceBufferTypes().forEach(function(h){w.append(p(h),h)})},g.onFragParsed=function(a,s){var l=this,w=s.frag,p=s.part,h=[],C=p?p.elementaryStreams:w.elementaryStreams;C[L.ElementaryStreamTypes.AUDIOVIDEO]?h.push("audiovideo"):(C[L.ElementaryStreamTypes.AUDIO]&&h.push("audio"),C[L.ElementaryStreamTypes.VIDEO]&&h.push("video"));var b=function(){var f=self.performance.now();w.stats.buffering.end=f,p&&(p.stats.buffering.end=f);var d=p?p.stats:w.stats;l.hls.trigger(I.Events.FRAG_BUFFERED,{frag:w,part:p,stats:d,id:w.type})};h.length===0&&R.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+w.type+" level: "+w.level+" sn: "+w.sn),this.blockBuffers(b,h)},g.onFragChanged=function(a,s){this.flushBackBuffer()},g.onBufferEos=function(a,s){var l=this,w=this.getSourceBufferTypes().reduce(function(p,h){var C=l.sourceBuffer[h];return(!s.type||s.type===h)&&(C&&!C.ended&&(C.ended=!0,R.logger.log("[buffer-controller]: "+h+" sourceBuffer now EOS"))),p&&!!(!C||C.ended)},!0);w&&this.blockBuffers(function(){var p=l.mediaSource;if(!p||p.readyState!=="open")return;p.endOfStream()})},g.onLevelUpdated=function(a,s){var l=s.details;if(!l.fragments.length)return;this.details=l,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},g.flushBackBuffer=function(){var a=this.hls,s=this.details,l=this.media,w=this.sourceBuffer;if(!l||s===null)return;var p=this.getSourceBufferTypes();if(!p.length)return;var h=s.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(z.isFiniteNumber)(h)||h<0)return;var C=l.currentTime,b=s.levelTargetDuration,c=Math.max(h,b),f=Math.floor(C/b)*b-c;p.forEach(function(d){var o=w[d];if(o){var y=F.BufferHelper.getBuffered(o);y.length>0&&f>y.start(0)&&(a.trigger(I.Events.BACK_BUFFER_REACHED,{bufferEnd:f}),s.live&&a.trigger(I.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:f}),a.trigger(I.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:f,type:d}))}})},g.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,s=this.hls,l=this.media,w=this.mediaSource,p=a.fragments[0].start+a.totalduration,h=l.duration,C=Object(z.isFiniteNumber)(w.duration)?w.duration:0;a.live&&s.config.liveDurationInfinity?(R.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),w.duration=Infinity,this.updateSeekableRange(a)):(p>C&&p>h||!Object(z.isFiniteNumber)(h))&&(R.logger.log("[buffer-controller]: Updating Media Source duration to "+p.toFixed(3)),w.duration=p)},g.updateSeekableRange=function(a){var s=this.mediaSource,l=a.fragments,w=l.length;if(w&&a.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var p=Math.max(0,l[0].start),h=Math.max(p,p+a.totalduration);s.setLiveSeekableRange(p,h)}},g.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,s=this.operationQueue,l=this.pendingTracks,w=Object.keys(l).length;if(w&&!a||w===2){this.createSourceBuffers(l),this.pendingTracks={};var p=this.getSourceBufferTypes();if(p.length===0){this.hls.trigger(I.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}p.forEach(function(h){s.executeNext(h)})}},g.createSourceBuffers=function(a){var s=this.sourceBuffer,l=this.mediaSource;if(!l)throw Error("createSourceBuffers called when mediaSource was null");var w=0;for(var p in a)if(!s[p]){var h=a[p];if(!h)throw Error("source buffer exists for track "+p+", however track does not");var C=h.levelCodec||h.codec,b=h.container+";codecs="+C;R.logger.log("[buffer-controller]: creating sourceBuffer("+b+")");try{var c=s[p]=l.addSourceBuffer(b),f=p;this.addBufferListener(f,"updatestart",this._onSBUpdateStart),this.addBufferListener(f,"updateend",this._onSBUpdateEnd),this.addBufferListener(f,"error",this._onSBUpdateError),this.tracks[p]={buffer:c,codec:C,container:h.container,levelCodec:h.levelCodec,id:h.id},w++}catch(d){R.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+d.message),this.hls.trigger(I.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,mimeType:b})}}w&&this.hls.trigger(I.Events.BUFFER_CREATED,{tracks:this.tracks})},g._onSBUpdateStart=function(a){var s=this.operationQueue,l=s.current(a);l.onStart()},g._onSBUpdateEnd=function(a){var s=this.operationQueue,l=s.current(a);l.onComplete(),s.shiftAndExecuteNext(a)},g._onSBUpdateError=function(a,s){R.logger.error("[buffer-controller]: "+a+" SourceBuffer error",s),this.hls.trigger(I.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var l=this.operationQueue.current(a);l&&l.onError(s)},g.removeExecutor=function(a,s,l){var w=this.media,p=this.mediaSource,h=this.operationQueue,C=this.sourceBuffer,b=C[a];if(!w||!p||!b){R.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(a);return}var c=Object(z.isFiniteNumber)(w.duration)?w.duration:Infinity,f=Object(z.isFiniteNumber)(p.duration)?p.duration:Infinity,d=Math.max(0,s),o=Math.min(l,c,f);o>d?(R.logger.log("[buffer-controller]: Removing ["+d+","+o+"] from the "+a+" SourceBuffer"),console.assert(!b.updating,a+" sourceBuffer must not be updating"),b.remove(d,o)):h.shiftAndExecuteNext(a)},g.appendExecutor=function(a,s){var l=this.operationQueue,w=this.sourceBuffer,p=w[s];if(!p){R.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),l.shiftAndExecuteNext(s);return}p.ended=!1,console.assert(!p.updating,s+" sourceBuffer must not be updating"),p.appendBuffer(a)},g.blockBuffers=function(a,s){var l=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){R.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var w=this.operationQueue,p=s.map(function(h){return w.appendBlocker(h)});Promise.all(p).then(function(){a(),s.forEach(function(h){var C=l.sourceBuffer[h];(!C||!C.updating)&&w.shiftAndExecuteNext(h)})})},g.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},g.addBufferListener=function(a,s,l){var w=this.sourceBuffer[a];if(!w)return;var p=l.bind(this,a);this.listeners[a].push({event:s,listener:p}),w.addEventListener(s,p)},g.removeBufferListeners=function(a){var s=this.sourceBuffer[a];if(!s)return;this.listeners[a].forEach(function(l){s.removeEventListener(l.event,l.listener)})},E}()},"./src/controller/buffer-operation-queue.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return I});var z=A("./src/utils/logger.ts"),I=function(){function R(F){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=F}var j=R.prototype;return j.append=function(k,L){var v=this.queues[L];v.push(k),v.length===1&&this.buffers[L]&&this.executeNext(L)},j.insertAbort=function(k,L){var v=this.queues[L];v.unshift(k),this.executeNext(L)},j.appendBlocker=function(k){var L,v=new Promise(function(D){L=D}),S={execute:L,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(S,k),v},j.executeNext=function(k){var L=this.buffers,v=this.queues,S=L[k],D=v[k];if(D.length){var T=D[0];try{T.execute()}catch(E){z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),T.onError(E),(!S||!S.updating)&&(D.shift(),this.executeNext(k))}}},j.shiftAndExecuteNext=function(k){this.queues[k].shift(),this.executeNext(k)},j.current=function(k){return this.queues[k][0]},R}()},"./src/controller/cap-level-controller.ts":function(te,G,A){"use strict";A.r(G);var z=A("./src/events.ts");function I(F,k){for(var L=0;L<k.length;L++){var v=k[L];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(F,v.key,v)}}function R(F,k,L){return k&&I(F.prototype,k),L&&I(F,L),F}var j=function(){function F(L){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=L,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var k=F.prototype;return k.setStreamController=function(v){this.streamController=v},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 v=this.hls;v.on(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),v.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),v.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.on(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),v.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.unregisterListener=function(){var v=this.hls;v.off(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),v.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),v.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.off(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),v.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.onFpsDropLevelCapping=function(v,S){F.isLevelAllowed(S.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(S.droppedLevel)},k.onMediaAttaching=function(v,S){this.media=S.media instanceof HTMLVideoElement?S.media:null},k.onManifestParsed=function(v,S){var D=this.hls;this.restrictedLevels=[],this.firstLevel=S.firstLevel,D.config.capLevelToPlayerSize&&S.video&&this.startCapping()},k.onBufferCodecs=function(v,S){var D=this.hls;D.config.capLevelToPlayerSize&&S.video&&this.startCapping()},k.onMediaDetaching=function(){this.stopCapping()},k.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var v=this.hls.levels;if(v.length){var S=this.hls;S.autoLevelCapping=this.getMaxLevel(v.length-1),S.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=S.autoLevelCapping}}},k.getMaxLevel=function(v){var S=this,D=this.hls.levels;if(!D.length)return-1;var T=D.filter(function(E,g){return F.isLevelAllowed(g,S.restrictedLevels)&&g<=v});return this.clientRect=null,F.getMaxLevelByMediaSize(T,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 v=this.media,S={width:0,height:0};if(v){var D=v.getBoundingClientRect();S.width=D.width,S.height=D.height,!S.width&&!S.height&&(S.width=D.right-D.left||v.width||0,S.height=D.bottom-D.top||v.height||0)}return this.clientRect=S,S},F.isLevelAllowed=function(v,S){return S===void 0&&(S=[]),S.indexOf(v)===-1},F.getMaxLevelByMediaSize=function(v,S,D){if(!v||!v.length)return-1;for(var T=function(s,l){return l?s.width!==l.width||s.height!==l.height:!0},E=v.length-1,g=0;g<v.length;g+=1){var u=v[g];if((u.width>=S||u.height>=D)&&T(u,v[g+1])){E=g;break}}return E},R(F,[{key:"mediaWidth",get:function(){return this.getDimensions().width*F.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*F.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var v=1;try{v=self.devicePixelRatio}catch(S){}return v}}]),F}();G.default=j},"./src/controller/cmcd-controller.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return T});var z=A("./src/events.ts"),I=A("./src/types/cmcd.ts"),R=A("./src/utils/buffer-helper.ts"),j=A("./src/utils/logger.ts");function F(E,g){for(var u=0;u<g.length;u++){var a=g[u];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(E,a.key,a)}}function k(E,g,u){return g&&F(E.prototype,g),u&&F(E,u),E}function L(E,g){var u=typeof Symbol!="undefined"&&E[Symbol.iterator]||E["@@iterator"];if(u)return(u=u.call(E)).next.bind(u);if(Array.isArray(E)||(u=v(E))||g&&E&&typeof E.length=="number"){u&&(E=u);var a=0;return function(){return a>=E.length?{done:!0}:{done:!1,value:E[a++]}}}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 v(E,g){if(!E)return;if(typeof E=="string")return S(E,g);var u=Object.prototype.toString.call(E).slice(8,-1);if(u==="Object"&&E.constructor&&(u=E.constructor.name),u==="Map"||u==="Set")return Array.from(E);if(u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return S(E,g)}function S(E,g){(g==null||g>E.length)&&(g=E.length);for(var u=0,a=new Array(g);u<g;u++)a[u]=E[u];return a}function D(){return D=Object.assign||function(E){for(var g=1;g<arguments.length;g++){var u=arguments[g];for(var a in u)Object.prototype.hasOwnProperty.call(u,a)&&(E[a]=u[a])}return E},D.apply(this,arguments)}var T=function(){function E(u){var a=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(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(w){try{a.apply(w,{ot:I.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(p){j.logger.warn("Could not generate manifest CMCD data.",p)}},this.applyFragmentData=function(w){try{var p=w.frag,h=a.hls.levels[p.level],C=a.getObjectType(p),b={d:p.duration*1e3,ot:C};(C===I.CMCDObjectType.VIDEO||C===I.CMCDObjectType.AUDIO||C==I.CMCDObjectType.MUXED)&&(b.br=h.bitrate/1e3,b.tb=a.getTopBandwidth(C),b.bl=a.getBufferLength(C)),a.apply(w,b)}catch(c){j.logger.warn("Could not generate segment CMCD data.",c)}},this.hls=u;var s=this.config=u.config,l=s.cmcd;l!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=l.sessionId||E.uuid(),this.cid=l.contentId,this.useHeaders=l.useHeaders===!0,this.registerListeners())}var g=E.prototype;return g.registerListeners=function(){var a=this.hls;a.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(z.Events.BUFFER_CREATED,this.onBufferCreated,this)},g.unregisterListeners=function(){var a=this.hls;a.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(z.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},g.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},g.onMediaAttached=function(a,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},g.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},g.onBufferCreated=function(a,s){var l,w;this.audioBuffer=(l=s.tracks.audio)===null||l===void 0?void 0:l.buffer,this.videoBuffer=(w=s.tracks.video)===null||w===void 0?void 0:w.buffer},g.createData=function(){var a;return{v:I.CMCDVersion,sf:I.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)===null||a===void 0?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},g.apply=function(a,s){s===void 0&&(s={}),D(s,this.createData());var l=s.ot===I.CMCDObjectType.INIT||s.ot===I.CMCDObjectType.VIDEO||s.ot===I.CMCDObjectType.MUXED;if(this.starved&&l&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var w=E.toHeaders(s);if(!Object.keys(w).length)return;a.headers||(a.headers={}),D(a.headers,w)}else{var p=E.toQuery(s);if(!p)return;a.url=E.appendQueryToUri(a.url,p)}},g.getObjectType=function(a){var s=a.type;return s==="subtitle"?I.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?I.CMCDObjectType.INIT:s==="audio"?I.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?I.CMCDObjectType.VIDEO:I.CMCDObjectType.MUXED:void 0},g.getTopBandwidth=function(a){for(var s=0,l=a===I.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,w=L(l),p;!(p=w()).done;){var h=p.value;h.bitrate>s&&(s=h.bitrate)}return s>0?s:NaN},g.getBufferLength=function(a){var s=this.hls.media,l=a===I.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!l||!s)return NaN;var w=R.BufferHelper.bufferInfo(l,s.currentTime,this.config.maxBufferHole);return w.len*1e3},g.createPlaylistLoader=function(){var a=this.config.pLoader,s=this.applyPlaylistData,l=a||this.config.loader;return function(){function w(h){this.loader=void 0,this.loader=new l(h)}var p=w.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(C,b,c){s(C),this.loader.load(C,b,c)},k(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},g.createFragmentLoader=function(){var a=this.config.fLoader,s=this.applyFragmentData,l=a||this.config.loader;return function(){function w(h){this.loader=void 0,this.loader=new l(h)}var p=w.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(C,b,c){s(C),this.loader.load(C,b,c)},k(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},E.uuid=function(){var a=URL.createObjectURL(new Blob),s=a.toString();return URL.revokeObjectURL(a),s.substr(s.lastIndexOf("/")+1)},E.serialize=function(a){for(var s=[],l=function(U){return!Number.isNaN(U)&&U!=null&&U!==""&&U!==!1},w=function(U){return Math.round(U)},p=function(U){return w(U/100)*100},h=function(U){return encodeURIComponent(U)},C={br:w,d:w,bl:p,dl:p,mtp:p,nor:h,rtp:p,tb:w},b=Object.keys(a||{}).sort(),c=L(b),f;!(f=c()).done;){var d=f.value,o=a[d];if(!l(o))continue;if(d==="v"&&o===1)continue;if(d=="pr"&&o===1)continue;var y=C[d];y&&(o=y(o));var m=typeof o,x=void 0;d==="ot"||d==="sf"||d==="st"?x=d+"="+o:m==="boolean"?x=d:m==="number"?x=d+"="+o:x=d+"="+JSON.stringify(o),s.push(x)}return s.join(",")},E.toHeaders=function(a){for(var s=Object.keys(a),l={},w=["Object","Request","Session","Status"],p=[{},{},{},{}],h={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},C=0,b=s;C<b.length;C++){var c=b[C],f=h[c]!=null?h[c]:1;p[f][c]=a[c]}for(var d=0;d<p.length;d++){var o=E.serialize(p[d]);o&&(l["CMCD-"+w[d]]=o)}return l},E.toQuery=function(a){return"CMCD="+encodeURIComponent(E.serialize(a))},E.appendQueryToUri=function(a,s){if(!s)return a;var l=a.includes("?")?"&":"?";return""+a+l+s},E}()},"./src/controller/eme-controller.ts":function(te,G,A){"use strict";A.r(G);var z=A("./src/events.ts"),I=A("./src/errors.ts"),R=A("./src/utils/logger.ts"),j=A("./src/utils/mediakeys-helper.ts");function F(T,E){for(var g=0;g<E.length;g++){var u=E[g];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(T,u.key,u)}}function k(T,E,g){return E&&F(T.prototype,E),g&&F(T,g),T}var L=3,v=function(E,g,u){var a={audioCapabilities:[],videoCapabilities:[]};return E.forEach(function(s){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:u.audioRobustness||""})}),g.forEach(function(s){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:u.videoRobustness||""})}),[a]},S=function(E,g,u,a){switch(E){case j.KeySystems.WIDEVINE:return v(g,u,a);default:throw new Error("Unknown key-system: "+E)}},D=function(){function T(g){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=g,this._config=g.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 E=T.prototype;return E.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},E._registerListeners=function(){this.hls.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},E._unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},E.getLicenseServerUrl=function(u){switch(u){case j.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+u+'"')},E._attemptKeySystemAccess=function(u,a,s){var l=this,w=S(u,a,s,this._drmSystemOptions);R.logger.log("Requesting encrypted media key-system access");var p=this.requestMediaKeySystemAccess(u,w);this.mediaKeysPromise=p.then(function(h){return l._onMediaKeySystemAccessObtained(u,h)}),p.catch(function(h){R.logger.error('Failed to obtain key-system "'+u+'" access:',h)})},E._onMediaKeySystemAccessObtained=function(u,a){var s=this;R.logger.log('Access for key-system "'+u+'" obtained');var l={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:u};this._mediaKeysList.push(l);var w=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(p){return l.mediaKeys=p,R.logger.log('Media-keys created for key-system "'+u+'"'),s._onMediaKeysCreated(),p});return w.catch(function(p){R.logger.error("Failed to create media-keys:",p)}),w},E._onMediaKeysCreated=function(){var u=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),u._onNewMediaKeySession(a.mediaKeysSession))})},E._onNewMediaKeySession=function(u){var a=this;R.logger.log("New key-system session "+u.sessionId),u.addEventListener("message",function(s){a._onKeySessionMessage(u,s.message)},!1)},E._onKeySessionMessage=function(u,a){R.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(s){R.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),u.update(s)})},E.onMediaEncrypted=function(u){var a=this;if(R.logger.log('Media is encrypted using "'+u.initDataType+'" init data type'),!this.mediaKeysPromise){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(w){if(!a._media)return;a._attemptSetMediaKeys(w),a._generateRequestWithPreferredKeySession(u.initDataType,u.initData)};this.mediaKeysPromise.then(s).catch(s)},E._attemptSetMediaKeys=function(u){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}R.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},E._generateRequestWithPreferredKeySession=function(u,a){var s=this,l=this._mediaKeysList[0];if(!l){R.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(l.mediaKeysSessionInitialized){R.logger.warn("Key-Session already initialized but requested again");return}var w=l.mediaKeysSession;if(!w){R.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){R.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}R.logger.log('Generating key-session request for "'+u+'" init data type'),l.mediaKeysSessionInitialized=!0,w.generateRequest(u,a).then(function(){R.logger.debug("Key-session generation succeeded")}).catch(function(p){R.logger.error("Error generating key-session request:",p),s.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},E._createLicenseXhr=function(u,a,s){var l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,l,u,a,s);var w=this._licenseXhrSetup;if(w)try{w.call(this.hls,l,u),w=void 0}catch(p){R.logger.error(p)}try{l.readyState||l.open("POST",u,!0),w&&w.call(this.hls,l,u)}catch(p){throw new Error("issue setting up KeySystem license XHR "+p)}return l},E._onLicenseRequestReadyStageChange=function(u,a,s,l){switch(u.readyState){case 4:if(u.status===200){this._requestLicenseFailureCount=0,R.logger.log("License request succeeded");var w=u.response,p=this._licenseResponseCallback;if(p)try{w=p.call(this.hls,u,a)}catch(C){R.logger.error(C)}l(w)}else{if(R.logger.error("License Request XHR failed ("+a+"). Status: "+u.status+" ("+u.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>L){this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var h=L-this._requestLicenseFailureCount+1;R.logger.warn("Retrying license request, "+h+" attempts left"),this._requestLicense(s,l)}break}},E._generateLicenseRequestChallenge=function(u,a){switch(u.mediaKeySystemDomain){case j.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+u.mediaKeySystemDomain)},E._requestLicense=function(u,a){R.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){R.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var l=this.getLicenseServerUrl(s.mediaKeySystemDomain),w=this._createLicenseXhr(l,u,a);R.logger.log("Sending license request to URL: "+l);var p=this._generateLicenseRequestChallenge(s,u);w.send(p)}catch(h){R.logger.error("Failure requesting DRM license: "+h),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},E.onMediaAttached=function(u,a){if(!this._emeEnabled)return;var s=a.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},E.onMediaDetached=function(){var u=this._media,a=this._mediaKeysList;if(!u)return;u.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return u.setMediaKeys(null)}).catch(function(){})},E.onManifestParsed=function(u,a){if(!this._emeEnabled)return;var s=a.levels.map(function(w){return w.audioCodec}).filter(function(w){return!!w}),l=a.levels.map(function(w){return w.videoCodec}).filter(function(w){return!!w});this._attemptKeySystemAccess(j.KeySystems.WIDEVINE,s,l)},k(T,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),T}();G.default=D},"./src/controller/fps-controller.ts":function(te,G,A){"use strict";A.r(G);var z=A("./src/events.ts"),I=A("./src/utils/logger.ts"),R=function(){function j(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 F=j.prototype;return F.setStreamController=function(L){this.streamController=L},F.registerListeners=function(){this.hls.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},F.unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},F.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},F.onMediaAttaching=function(L,v){var S=this.hls.config;if(S.capLevelOnFPSDrop){var D=v.media instanceof self.HTMLVideoElement?v.media:null;this.media=D,D&&typeof D.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),S.fpsDroppedMonitoringPeriod)}},F.checkFPS=function(L,v,S){var D=performance.now();if(v){if(this.lastTime){var T=D-this.lastTime,E=S-this.lastDroppedFrames,g=v-this.lastDecodedFrames,u=1e3*E/T,a=this.hls;if(a.trigger(z.Events.FPS_DROP,{currentDropped:E,currentDecoded:g,totalDroppedFrames:S}),u>0&&E>a.config.fpsDroppedMonitoringThreshold*g){var s=a.currentLevel;I.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=s)&&(s=s-1,a.trigger(z.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:a.currentLevel}),a.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=D,this.lastDroppedFrames=S,this.lastDecodedFrames=v}},F.checkFPSInterval=function(){var L=this.media;if(L)if(this.isVideoPlaybackQualityAvailable){var v=L.getVideoPlaybackQuality();this.checkFPS(L,v.totalVideoFrames,v.droppedVideoFrames)}else this.checkFPS(L,L.webkitDecodedFrameCount,L.webkitDroppedFrameCount)},j}();G.default=R},"./src/controller/fragment-finders.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"findFragmentByPDT",function(){return R}),A.d(G,"findFragmentByPTS",function(){return j}),A.d(G,"fragmentWithinToleranceTest",function(){return F}),A.d(G,"pdtWithinToleranceTest",function(){return k}),A.d(G,"findFragWithCC",function(){return L});var z=A("./src/polyfills/number.ts"),I=A("./src/utils/binary-search.ts");function R(v,S,D){if(S===null||!Array.isArray(v)||!v.length||!Object(z.isFiniteNumber)(S))return null;var T=v[0].programDateTime;if(S<(T||0))return null;var E=v[v.length-1].endProgramDateTime;if(S>=(E||0))return null;D=D||0;for(var g=0;g<v.length;++g){var u=v[g];if(k(S,D,u))return u}return null}function j(v,S,D,T){D===void 0&&(D=0),T===void 0&&(T=0);var E=null;if(v?E=S[v.sn-S[0].sn+1]||null:D===0&&S[0].start===0&&(E=S[0]),E&&F(D,T,E)===0)return E;var g=I.default.search(S,F.bind(null,D,T));return g||E}function F(v,S,D){v===void 0&&(v=0),S===void 0&&(S=0);var T=Math.min(S,D.duration+(D.deltaPTS?D.deltaPTS:0));return D.start+D.duration-T<=v?1:D.start-T>v&&D.start?-1:0}function k(v,S,D){var T=Math.min(S,D.duration+(D.deltaPTS?D.deltaPTS:0))*1e3,E=D.endProgramDateTime||0;return E-T>v}function L(v,S){return I.default.search(v,function(D){return D.cc<S?1:D.cc>S?-1:0})}},"./src/controller/fragment-tracker.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"FragmentState",function(){return R}),A.d(G,"FragmentTracker",function(){return j});var z=A("./src/events.ts"),I=A("./src/types/loader.ts"),R;(function(L){L.NOT_LOADED="NOT_LOADED",L.BACKTRACKED="BACKTRACKED",L.APPENDING="APPENDING",L.PARTIAL="PARTIAL",L.OK="OK"})(R||(R={}));var j=function(){function L(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 v=L.prototype;return v._registerListeners=function(){var D=this.hls;D.on(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),D.on(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),D.on(z.Events.FRAG_LOADED,this.onFragLoaded,this)},v._unregisterListeners=function(){var D=this.hls;D.off(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),D.off(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),D.off(z.Events.FRAG_LOADED,this.onFragLoaded,this)},v.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},v.getAppendedFrag=function(D,T){if(T===I.PlaylistLevelType.MAIN){var E=this.activeFragment,g=this.activeParts;if(!E)return null;if(g)for(var u=g.length;u--;){var a=g[u],s=a?a.end:E.appendedPTS;if(a.start<=D&&s!==void 0&&D<=s)return u>9&&(this.activeParts=g.slice(u-9)),a}else if(E.start<=D&&E.appendedPTS!==void 0&&D<=E.appendedPTS)return E}return this.getBufferedFrag(D,T)},v.getBufferedFrag=function(D,T){for(var E=this.fragments,g=Object.keys(E),u=g.length;u--;){var a=E[g[u]];if((a==null?void 0:a.body.type)===T&&a.buffered){var s=a.body;if(s.start<=D&&D<=s.end)return s}}return null},v.detectEvictedFragments=function(D,T,E){var g=this;Object.keys(this.fragments).forEach(function(u){var a=g.fragments[u];if(!a)return;if(!a.buffered){a.body.type===E&&g.removeFragment(a.body);return}var s=a.range[D];if(!s)return;s.time.some(function(l){var w=!g.isTimeBuffered(l.startPTS,l.endPTS,T);return w&&g.removeFragment(a.body),w})})},v.detectPartialFragments=function(D){var T=this,E=this.timeRanges,g=D.frag,u=D.part;if(!E||g.sn==="initSegment")return;var a=k(g),s=this.fragments[a];if(!s)return;Object.keys(E).forEach(function(l){var w=g.elementaryStreams[l];if(!w)return;var p=E[l],h=u!==null||w.partial===!0;s.range[l]=T.getBufferedTimes(g,u,h,p)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},v.fragBuffered=function(D){var T=k(D),E=this.fragments[T];E&&(E.backtrack=E.loaded=null,E.buffered=!0)},v.getBufferedTimes=function(D,T,E,g){for(var u={time:[],partial:E},a=T?T.start:D.start,s=T?T.end:D.end,l=D.minEndPTS||s,w=D.maxStartPTS||a,p=0;p<g.length;p++){var h=g.start(p)-this.bufferPadding,C=g.end(p)+this.bufferPadding;if(w>=h&&l<=C){u.time.push({startPTS:Math.max(a,g.start(p)),endPTS:Math.min(s,g.end(p))});break}else if(a<C&&s>h)u.partial=!0,u.time.push({startPTS:Math.max(a,g.start(p)),endPTS:Math.min(s,g.end(p))});else if(s<=h)break}return u},v.getPartialFragment=function(D){var T=null,E,g,u,a=0,s=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach(function(w){var p=l[w];if(!p)return;F(p)&&(g=p.body.start-s,u=p.body.end+s,D>=g&&D<=u&&(E=Math.min(D-g,u-D),a<=E&&(T=p.body,a=E)))}),T},v.getState=function(D){var T=k(D),E=this.fragments[T];return E?E.buffered?F(E)?R.PARTIAL:R.OK:E.backtrack?R.BACKTRACKED:R.APPENDING:R.NOT_LOADED},v.backtrack=function(D,T){var E=k(D),g=this.fragments[E];if(!g||g.backtrack)return null;var u=g.backtrack=T||g.loaded;return g.loaded=null,u},v.getBacktrackData=function(D){var T=k(D),E=this.fragments[T];if(E){var g,u=E.backtrack;if(u!=null&&(g=u.payload)!==null&&g!==void 0&&g.byteLength)return u;this.removeFragment(D)}return null},v.isTimeBuffered=function(D,T,E){for(var g,u,a=0;a<E.length;a++){if(g=E.start(a)-this.bufferPadding,u=E.end(a)+this.bufferPadding,D>=g&&T<=u)return!0;if(T<=g)return!1}return!1},v.onFragLoaded=function(D,T){var E=T.frag,g=T.part;if(E.sn==="initSegment"||E.bitrateTest||g)return;var u=k(E);this.fragments[u]={body:E,loaded:T,backtrack:null,buffered:!1,range:Object.create(null)}},v.onBufferAppended=function(D,T){var E=this,g=T.frag,u=T.part,a=T.timeRanges;if(g.type===I.PlaylistLevelType.MAIN)if(this.activeFragment=g,u){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(u)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(l){var w=a[l];if(E.detectEvictedFragments(l,w),!u)for(var p=0;p<w.length;p++)g.appendedPTS=Math.max(w.end(p),g.appendedPTS||0)})},v.onFragBuffered=function(D,T){this.detectPartialFragments(T)},v.hasFragment=function(D){var T=k(D);return!!this.fragments[T]},v.removeFragmentsInRange=function(D,T,E){var g=this;Object.keys(this.fragments).forEach(function(u){var a=g.fragments[u];if(!a)return;if(a.buffered){var s=a.body;s.type===E&&s.start<T&&s.end>D&&g.removeFragment(s)}})},v.removeFragment=function(D){var T=k(D);D.stats.loaded=0,D.clearElementaryStreamInfo(),delete this.fragments[T]},v.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},L}();function F(L){var v,S;return L.buffered&&(((v=L.range.video)===null||v===void 0?void 0:v.partial)||((S=L.range.audio)===null||S===void 0?void 0:S.partial))}function k(L){return L.type+"_"+L.level+"_"+L.urlId+"_"+L.sn}},"./src/controller/gap-controller.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"STALL_MINIMUM_DURATION_MS",function(){return F}),A.d(G,"MAX_START_GAP_JUMP",function(){return k}),A.d(G,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return L}),A.d(G,"SKIP_BUFFER_RANGE_START",function(){return v}),A.d(G,"default",function(){return S});var z=A("./src/utils/buffer-helper.ts"),I=A("./src/errors.ts"),R=A("./src/events.ts"),j=A("./src/utils/logger.ts"),F=250,k=2,L=.1,v=.05,S=function(){function D(E,g,u,a){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=E,this.media=g,this.fragmentTracker=u,this.hls=a}var T=D.prototype;return T.destroy=function(){this.hls=this.fragmentTracker=this.media=null},T.poll=function(g){var u=this.config,a=this.media,s=this.stalled,l=a.currentTime,w=a.seeking,p=this.seeking&&!w,h=!this.seeking&&w;if(this.seeking=w,l!==g){if(this.moved=!0,s!==null){if(this.stallReported){var C=self.performance.now()-s;j.logger.warn("playback not stuck anymore @"+l+", after "+Math.round(C)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((h||p)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!z.BufferHelper.getBuffered(a).length)return;var b=z.BufferHelper.bufferInfo(a,l,0),c=b.len>0,f=b.nextStart||0;if(!c&&!f)return;if(w){var d=b.len>k,o=!f||f-l>k&&!this.fragmentTracker.getPartialFragment(l);if(d||o)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var y,m=Math.max(f,b.start||0)-l,x=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,P=x==null||((y=x.details)===null||y===void 0)?void 0:y.live,U=P?x.details.targetduration*2:k;if(m>0&&m<=U){this._trySkipBufferHole(null);return}}var B=self.performance.now();if(s===null){this.stalled=B;return}var W=B-s;!w&&W>=F&&this._reportStall(b.len);var O=z.BufferHelper.bufferInfo(a,l,u.maxBufferHole);this._tryFixBufferStall(O,W)},T._tryFixBufferStall=function(g,u){var a=this.config,s=this.fragmentTracker,l=this.media,w=l.currentTime,p=s.getPartialFragment(w);if(p){var h=this._trySkipBufferHole(p);if(h)return}g.len>a.maxBufferHole&&u>a.highBufferWatchdogPeriod*1e3&&(j.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},T._reportStall=function(g){var u=this.hls,a=this.media,s=this.stallReported;s||(this.stallReported=!0,j.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+g+")"),u.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:g}))},T._trySkipBufferHole=function(g){for(var u=this.config,a=this.hls,s=this.media,l=s.currentTime,w=0,p=z.BufferHelper.getBuffered(s),h=0;h<p.length;h++){var C=p.start(h);if(l+u.maxBufferHole>=w&&l<C){var b=Math.max(C+v,s.currentTime+L);return j.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+b),this.moved=!0,this.stalled=null,s.currentTime=b,g&&a.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+l+" to "+b,frag:g}),b}w=p.end(h)}return 0},T._tryNudgeBuffer=function(){var g=this.config,u=this.hls,a=this.media,s=a.currentTime,l=(this.nudgeRetry||0)+1;if(this.nudgeRetry=l,l<g.nudgeMaxRetry){var w=s+l*g.nudgeOffset;j.logger.warn("Nudging 'currentTime' from "+s+" to "+w),a.currentTime=w,u.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else j.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+g.nudgeMaxRetry+" nudges"),u.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},D}()},"./src/controller/id3-track-controller.ts":function(te,G,A){"use strict";A.r(G);var z=A("./src/events.ts"),I=A("./src/utils/texttrack-utils.ts"),R=A("./src/demux/id3.ts"),j=.25,F=function(){function k(v){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=v,this._registerListeners()}var L=k.prototype;return L.destroy=function(){this._unregisterListeners()},L._registerListeners=function(){var S=this.hls;S.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.on(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),S.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L._unregisterListeners=function(){var S=this.hls;S.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.off(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),S.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L.onMediaAttached=function(S,D){this.media=D.media},L.onMediaDetaching=function(){if(!this.id3Track)return;Object(I.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},L.getID3Track=function(S){if(!this.media)return;for(var D=0;D<S.length;D++){var T=S[D];if(T.kind==="metadata"&&T.label==="id3")return Object(I.sendAddTrackEvent)(T,this.media),T}return this.media.addTextTrack("metadata","id3")},L.onFragParsingMetadata=function(S,D){if(!this.media)return;var T=D.frag,E=D.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var g=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,u=0;u<E.length;u++){var a=R.getID3Frames(E[u].data);if(a){var s=E[u].pts,l=u<E.length-1?E[u+1].pts:T.end,w=l-s;w<=0&&(l=s+j);for(var p=0;p<a.length;p++){var h=a[p];if(!R.isTimeStampFrame(h)){var C=new g(s,l,"");C.value=h,this.id3Track.addCue(C)}}}}},L.onBufferFlushing=function(S,D){var T=D.startOffset,E=D.endOffset,g=D.type;if(!g||g==="audio"){var u=this.id3Track;u&&Object(I.removeCuesInRange)(u,T,E)}},k}();G.default=F},"./src/controller/latency-controller.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return k});var z=A("./src/errors.ts"),I=A("./src/events.ts"),R=A("./src/utils/logger.ts");function j(L,v){for(var S=0;S<v.length;S++){var D=v[S];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(L,D.key,D)}}function F(L,v,S){return v&&j(L.prototype,v),S&&j(L,S),L}var k=function(){function L(S){var D=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 D.timeupdate()},this.hls=S,this.config=S.config,this.registerListeners()}var v=L.prototype;return v.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},v.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)},v.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)},v.onMediaAttached=function(D,T){this.media=T.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},v.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},v.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},v.onLevelUpdated=function(D,T){var E=T.details;this.levelDetails=E,E.advanced&&this.timeupdate(),!E.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},v.onError=function(D,T){if(T.details!==z.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,R.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},v.timeupdate=function(){var D=this.media,T=this.levelDetails;if(!D||!T)return;this.currentTime=D.currentTime;var E=this.computeLatency();if(E===null)return;this._latency=E;var g=this.config,u=g.lowLatencyMode,a=g.maxLiveSyncPlaybackRate;if(!u||a===1)return;var s=this.targetLatency;if(s===null)return;var l=E-s,w=Math.min(this.maxLatency,s+T.targetduration),p=l<w;if(T.live&&p&&l>.05&&this.forwardBufferLength>1){var h=Math.min(2,Math.max(1,a)),C=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20;D.playbackRate=Math.min(h,Math.max(1,C))}else D.playbackRate!==1&&D.playbackRate!==0&&(D.playbackRate=1)},v.estimateLiveEdge=function(){var D=this.levelDetails;return D===null?null:D.edge+D.age},v.computeLatency=function(){var D=this.estimateLiveEdge();return D===null?null:D-this.currentTime},F(L,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var D=this.config,T=this.levelDetails;return D.liveMaxLatencyDuration!==void 0?D.liveMaxLatencyDuration:T?D.liveMaxLatencyDurationCount*T.targetduration:0}},{key:"targetLatency",get:function(){var D=this.levelDetails;if(D===null)return null;var T=D.holdBack,E=D.partHoldBack,g=D.targetduration,u=this.config,a=u.liveSyncDuration,s=u.liveSyncDurationCount,l=u.lowLatencyMode,w=this.hls.userConfig,p=l&&E||T;(w.liveSyncDuration||w.liveSyncDurationCount||p===0)&&(p=a!==void 0?a:s*g);var h=g,C=1;return p+Math.min(this.stallCount*C,h)}},{key:"liveSyncPosition",get:function(){var D=this.estimateLiveEdge(),T=this.targetLatency,E=this.levelDetails;if(D===null||T===null||E===null)return null;var g=E.edge,u=D-T-this.edgeStalled,a=g-E.totalduration,s=g-(this.config.lowLatencyMode&&E.partTarget||E.targetduration);return Math.min(Math.max(a,u),s)}},{key:"drift",get:function(){var D=this.levelDetails;return D===null?1:D.drift}},{key:"edgeStalled",get:function(){var D=this.levelDetails;if(D===null)return 0;var T=(this.config.lowLatencyMode&&D.partTarget||D.targetduration)*3;return Math.max(D.age-T,0)}},{key:"forwardBufferLength",get:function(){var D=this.media,T=this.levelDetails;if(!D||!T)return 0;var E=D.buffered.length;return E?D.buffered.end(E-1):T.edge-this.currentTime}}]),L}()},"./src/controller/level-controller.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return u});var z=A("./src/types/level.ts"),I=A("./src/events.ts"),R=A("./src/errors.ts"),j=A("./src/utils/codecs.ts"),F=A("./src/controller/level-helper.ts"),k=A("./src/controller/base-playlist-controller.ts"),L=A("./src/types/loader.ts");function v(){return v=Object.assign||function(a){for(var s=1;s<arguments.length;s++){var l=arguments[s];for(var w in l)Object.prototype.hasOwnProperty.call(l,w)&&(a[w]=l[w])}return a},v.apply(this,arguments)}function S(a,s){for(var l=0;l<s.length;l++){var w=s[l];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(a,w.key,w)}}function D(a,s,l){return s&&S(a.prototype,s),l&&S(a,l),a}function T(a,s){a.prototype=Object.create(s.prototype),a.prototype.constructor=a,E(a,s)}function E(a,s){return E=Object.setPrototypeOf||function(w,p){return w.__proto__=p,w},E(a,s)}var g=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),u=function(a){T(s,a);function s(w){var p;return p=a.call(this,w,"[level-controller]")||this,p._levels=[],p._firstLevel=-1,p._startLevel=void 0,p.currentLevelIndex=-1,p.manualLevelIndex=-1,p.onParsedComplete=void 0,p._registerListeners(),p}var l=s.prototype;return l._registerListeners=function(){var p=this.hls;p.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),p.on(I.Events.ERROR,this.onError,this)},l._unregisterListeners=function(){var p=this.hls;p.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),p.off(I.Events.ERROR,this.onError,this)},l.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},l.startLoad=function(){var p=this._levels;p.forEach(function(h){h.loadError=0}),a.prototype.startLoad.call(this)},l.onManifestLoaded=function(p,h){var C=[],b=[],c=[],f,d={},o,y=!1,m=!1,x=!1;if(h.levels.forEach(function(W){var O=W.attrs;y=y||!!(W.width&&W.height),m=m||!!W.videoCodec,x=x||!!W.audioCodec,g&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var M=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;o=d[M],o?o.url.push(W.url):(o=new z.Level(W),d[M]=o,C.push(o)),O&&(O.AUDIO&&Object(F.addGroupId)(o,"audio",O.AUDIO),O.SUBTITLES&&Object(F.addGroupId)(o,"text",O.SUBTITLES))}),(y||m)&&x&&(C=C.filter(function(W){var O=W.videoCodec,M=W.width,K=W.height;return!!O||!!(M&&K)})),C=C.filter(function(W){var O=W.audioCodec,M=W.videoCodec;return(!O||Object(j.isCodecSupportedInMp4)(O,"audio"))&&(!M||Object(j.isCodecSupportedInMp4)(M,"video"))}),h.audioTracks&&(b=h.audioTracks.filter(function(W){return!W.audioCodec||Object(j.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(F.assignTrackIdsByGroup)(b)),h.subtitles&&(c=h.subtitles,Object(F.assignTrackIdsByGroup)(c)),C.length>0){f=C[0].bitrate,C.sort(function(W,O){return W.bitrate-O.bitrate}),this._levels=C;for(var P=0;P<C.length;P++)if(C[P].bitrate===f){this._firstLevel=P,this.log("manifest loaded, "+C.length+" level(s) found, first bitrate: "+f);break}var U=x&&!m,B={levels:C,audioTracks:b,subtitleTracks:c,firstLevel:this._firstLevel,stats:h.stats,audio:x,video:m,altAudio:!U&&b.some(function(W){return!!W.url})};this.hls.trigger(I.Events.MANIFEST_PARSED,B),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:h.url,reason:"no level with compatible codecs found in manifest"})},l.onError=function(p,h){if(a.prototype.onError.call(this,p,h),h.fatal)return;var C=h.context,b=this._levels[this.currentLevelIndex];if(C&&(C.type===L.PlaylistContextType.AUDIO_TRACK&&b.audioGroupIds&&C.groupId===b.audioGroupIds[b.urlId]||C.type===L.PlaylistContextType.SUBTITLE_TRACK&&b.textGroupIds&&C.groupId===b.textGroupIds[b.urlId])){this.redundantFailover(this.currentLevelIndex);return}var c=!1,f=!0,d;switch(h.details){case R.ErrorDetails.FRAG_LOAD_ERROR:case R.ErrorDetails.FRAG_LOAD_TIMEOUT:case R.ErrorDetails.KEY_LOAD_ERROR:case R.ErrorDetails.KEY_LOAD_TIMEOUT:if(h.frag){var o=this._levels[h.frag.level];o?(o.fragmentError++,o.fragmentError>this.hls.config.fragLoadingMaxRetry&&(d=h.frag.level)):d=h.frag.level}break;case R.ErrorDetails.LEVEL_LOAD_ERROR:case R.ErrorDetails.LEVEL_LOAD_TIMEOUT:C&&(C.deliveryDirectives&&(f=!1),d=C.level),c=!0;break;case R.ErrorDetails.REMUX_ALLOC_ERROR:d=h.level,c=!0;break}d!==void 0&&this.recoverLevel(h,d,c,f)},l.recoverLevel=function(p,h,C,b){var c=p.details,f=this._levels[h];if(f.loadError++,C){var d=this.retryLoadingOrFail(p);if(d)p.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(b){var o=f.url.length;if(o>1&&f.loadError<o)p.levelRetry=!0,this.redundantFailover(h);else if(this.manualLevelIndex===-1){var y=h===0?this._levels.length-1:h-1;this.currentLevelIndex!==y&&this._levels[y].loadError===0&&(this.warn(c+": switch to "+y),p.levelRetry=!0,this.hls.nextAutoLevel=y)}}},l.redundantFailover=function(p){var h=this._levels[p],C=h.url.length;if(C>1){var b=(h.urlId+1)%C;this.warn("Switching to redundant URL-id "+b),this._levels.forEach(function(c){c.urlId=b}),this.level=p}},l.onFragLoaded=function(p,h){var C=h.frag;if(C!==void 0&&C.type===L.PlaylistLevelType.MAIN){var b=this._levels[C.level];b!==void 0&&(b.fragmentError=0,b.loadError=0)}},l.onLevelLoaded=function(p,h){var C,b=h.level,c=h.details,f=this._levels[b];if(!f){var d;this.warn("Invalid level index "+b),(d=h.deliveryDirectives)!==null&&d!==void 0&&d.skip&&(c.deltaUpdateFailed=!0);return}b===this.currentLevelIndex?(f.fragmentError===0&&(f.loadError=0,this.retryCount=0),this.playlistLoaded(b,h,f.details)):(C=h.deliveryDirectives)!==null&&C!==void 0&&C.skip&&(c.deltaUpdateFailed=!0)},l.onAudioTrackSwitched=function(p,h){var C=this.hls.levels[this.currentLevelIndex];if(!C)return;if(C.audioGroupIds){for(var b=-1,c=this.hls.audioTracks[h.id].groupId,f=0;f<C.audioGroupIds.length;f++)if(C.audioGroupIds[f]===c){b=f;break}b!==C.urlId&&(C.urlId=b,this.startLoad())}},l.loadPlaylist=function(p){var h=this.currentLevelIndex,C=this._levels[h];if(this.canLoad&&C&&C.url.length>0){var b=C.urlId,c=C.url[b];if(p)try{c=p.addDirectives(c)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Attempt loading level index "+h+(p?" at sn "+p.msn+" part "+p.part:"")+" with URL-id "+b+" "+c),this.clearTimer(),this.hls.trigger(I.Events.LEVEL_LOADING,{url:c,level:h,id:b,deliveryDirectives:p||null})}},l.removeLevel=function(p,h){var C=function(f,d){return d!==h},b=this._levels.filter(function(c,f){return f!==p?!0:c.url.length>1&&h!==void 0?(c.url=c.url.filter(C),c.audioGroupIds&&(c.audioGroupIds=c.audioGroupIds.filter(C)),c.textGroupIds&&(c.textGroupIds=c.textGroupIds.filter(C)),c.urlId=0,!0):!1}).map(function(c,f){var d=c.details;return d!=null&&d.fragments&&d.fragments.forEach(function(o){o.level=f}),c});this._levels=b,this.hls.trigger(I.Events.LEVELS_UPDATED,{levels:b})},D(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(p){var h,C=this._levels;if(C.length===0)return;if(this.currentLevelIndex===p&&(h=C[p])!==null&&h!==void 0&&h.details)return;if(p<0||p>=C.length){var b=p<0;if(this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.LEVEL_SWITCH_ERROR,level:p,fatal:b,reason:"invalid level idx"}),b)return;p=Math.min(p,C.length-1)}this.clearTimer();var c=this.currentLevelIndex,f=C[c],d=C[p];this.log("switching to level "+p+" from "+c),this.currentLevelIndex=p;var o=v({},d,{level:p,maxBitrate:d.maxBitrate,uri:d.uri,urlId:d.urlId});delete o._urlId,this.hls.trigger(I.Events.LEVEL_SWITCHING,o);var y=d.details;if(!y||y.live){var m=this.switchParams(d.uri,f==null?void 0:f.details);this.loadPlaylist(m)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(p){this.manualLevelIndex=p,this._startLevel===void 0&&(this._startLevel=p),p!==-1&&(this.level=p)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(p){this._firstLevel=p}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var p=this.hls.config.startLevel;return p!==void 0?p:this._firstLevel}else return this._startLevel},set:function(p){this._startLevel=p}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(p){this.level=p,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=p)}}]),s}(k.default)},"./src/controller/level-helper.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"addGroupId",function(){return R}),A.d(G,"assignTrackIdsByGroup",function(){return j}),A.d(G,"updatePTS",function(){return F}),A.d(G,"updateFragPTSDTS",function(){return L}),A.d(G,"mergeDetails",function(){return v}),A.d(G,"mapPartIntersection",function(){return S}),A.d(G,"mapFragmentIntersection",function(){return D}),A.d(G,"adjustSliding",function(){return T}),A.d(G,"addSliding",function(){return E}),A.d(G,"computeReloadInterval",function(){return g}),A.d(G,"getFragmentWithSN",function(){return u}),A.d(G,"getPartWith",function(){return a});var z=A("./src/polyfills/number.ts"),I=A("./src/utils/logger.ts");function R(s,l,w){switch(l){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(w);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(w);break}}function j(s){var l={};s.forEach(function(w){var p=w.groupId||"";w.id=l[p]=l[p]||0,l[p]++})}function F(s,l,w){var p=s[l],h=s[w];k(p,h)}function k(s,l){var w=l.startPTS;if(Object(z.isFiniteNumber)(w)){var p=0,h;l.sn>s.sn?(p=w-s.start,h=s):(p=s.start-w,h=l),h.duration!==p&&(h.duration=p)}else if(l.sn>s.sn){var C=s.cc===l.cc;C&&s.minEndPTS?l.start=s.start+(s.minEndPTS-s.start):l.start=s.start+s.duration}else l.start=Math.max(s.start-l.duration,0)}function L(s,l,w,p,h,C){var b=p-w;b<=0&&(I.logger.warn("Fragment should have a positive duration",l),p=w+l.duration,C=h+l.duration);var c=w,f=p,d=l.startPTS,o=l.endPTS;if(Object(z.isFiniteNumber)(d)){var y=Math.abs(d-w);Object(z.isFiniteNumber)(l.deltaPTS)?l.deltaPTS=Math.max(y,l.deltaPTS):l.deltaPTS=y,c=Math.max(w,d),w=Math.min(w,d),h=Math.min(h,l.startDTS),f=Math.min(p,o),p=Math.max(p,o),C=Math.max(C,l.endDTS)}l.duration=p-w;var m=w-l.start;l.appendedPTS=p,l.start=l.startPTS=w,l.maxStartPTS=c,l.startDTS=h,l.endPTS=p,l.minEndPTS=f,l.endDTS=C;var x=l.sn;if(!s||x<s.startSN||x>s.endSN)return 0;var P,U=x-s.startSN,B=s.fragments;for(B[U]=l,P=U;P>0;P--)k(B[P],B[P-1]);for(P=U;P<B.length-1;P++)k(B[P],B[P+1]);return s.fragmentHint&&k(B[B.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,m}function v(s,l){for(var w=null,p=s.fragments,h=p.length-1;h>=0;h--){var C=p[h].initSegment;if(C){w=C;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var b=0,c;if(D(s,l,function(P,U){P.relurl&&(b=P.cc-U.cc),Object(z.isFiniteNumber)(P.startPTS)&&Object(z.isFiniteNumber)(P.endPTS)&&(U.start=U.startPTS=P.startPTS,U.startDTS=P.startDTS,U.appendedPTS=P.appendedPTS,U.maxStartPTS=P.maxStartPTS,U.endPTS=P.endPTS,U.endDTS=P.endDTS,U.minEndPTS=P.minEndPTS,U.duration=P.endPTS-P.startPTS,U.duration&&(c=U),l.PTSKnown=l.alignedSliding=!0),U.elementaryStreams=P.elementaryStreams,U.loader=P.loader,U.stats=P.stats,U.urlId=P.urlId,P.initSegment&&(U.initSegment=P.initSegment,w=P.initSegment)}),w){var f=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments;f.forEach(function(P){var U;(!P.initSegment||P.initSegment.relurl===((U=w)===null||U===void 0?void 0:U.relurl))&&(P.initSegment=w)})}if(l.skippedSegments&&(l.deltaUpdateFailed=l.fragments.some(function(P){return!P}),l.deltaUpdateFailed)){I.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var d=l.skippedSegments;d--;)l.fragments.shift();l.startSN=l.fragments[0].sn,l.startCC=l.fragments[0].cc}var o=l.fragments;if(b){I.logger.warn("discontinuity sliding from playlist, take drift into account");for(var y=0;y<o.length;y++)o[y].cc+=b}l.skippedSegments&&(l.startCC=l.fragments[0].cc),S(s.partList,l.partList,function(P,U){U.elementaryStreams=P.elementaryStreams,U.stats=P.stats}),c?L(l,c,c.startPTS,c.endPTS,c.startDTS,c.endDTS):T(s,l),o.length&&(l.totalduration=l.edge-o[0].start),l.driftStartTime=s.driftStartTime,l.driftStart=s.driftStart;var m=l.advancedDateTime;if(l.advanced&&m){var x=l.edge;l.driftStart||(l.driftStartTime=m,l.driftStart=x),l.driftEndTime=m,l.driftEnd=x}else l.driftEndTime=s.driftEndTime,l.driftEnd=s.driftEnd,l.advancedDateTime=s.advancedDateTime}function S(s,l,w){if(s&&l)for(var p=0,h=0,C=s.length;h<=C;h++){var b=s[h],c=l[h+p];b&&c&&b.index===c.index&&b.fragment.sn===c.fragment.sn?w(b,c):p--}}function D(s,l,w){for(var p=l.skippedSegments,h=Math.max(s.startSN,l.startSN)-l.startSN,C=(s.fragmentHint?1:0)+(p?l.endSN:Math.min(s.endSN,l.endSN))-l.startSN,b=l.startSN-s.startSN,c=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,f=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,d=h;d<=C;d++){var o=f[b+d],y=c[d];p&&!y&&d<p&&(y=l.fragments[d]=o),o&&y&&w(o,y)}}function T(s,l){var w=l.startSN+l.skippedSegments-s.startSN,p=s.fragments;if(w<0||w>=p.length)return;E(l,p[w].start)}function E(s,l){if(l){for(var w=s.fragments,p=s.skippedSegments;p<w.length;p++)w[p].start+=l;s.fragmentHint&&(s.fragmentHint.start+=l)}}function g(s,l){var w=1e3*s.levelTargetDuration,p=w/2,h=s.age,C=h>0&&h<w*3,b=l.loading.end-l.loading.start,c,f=s.availabilityDelay;if(s.updated===!1)if(C){var d=333*s.misses;c=Math.max(Math.min(p,b*2),d),s.availabilityDelay=(s.availabilityDelay||0)+c}else c=p;else C?(f=Math.min(f||w/2,h),s.availabilityDelay=f,c=f+w-h):c=w-b;return Math.round(c)}function u(s,l,w){if(!s||!s.details)return null;var p=s.details,h=p.fragments[l-p.startSN];return h||(h=p.fragmentHint,h&&h.sn===l?h:l<p.startSN&&w&&w.sn===l?w:null)}function a(s,l,w){if(!s||!s.details)return null;var p=s.details.partList;if(p)for(var h=p.length;h--;){var C=p[h];if(C.index===w&&C.fragment.sn===l)return C}return null}},"./src/controller/stream-controller.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return p});var z=A("./src/polyfills/number.ts"),I=A("./src/controller/base-stream-controller.ts"),R=A("./src/is-supported.ts"),j=A("./src/events.ts"),F=A("./src/utils/buffer-helper.ts"),k=A("./src/controller/fragment-tracker.ts"),L=A("./src/types/loader.ts"),v=A("./src/loader/fragment.ts"),S=A("./src/demux/transmuxer-interface.ts"),D=A("./src/types/transmuxer.ts"),T=A("./src/controller/gap-controller.ts"),E=A("./src/errors.ts"),g=A("./src/utils/logger.ts");function u(h,C){for(var b=0;b<C.length;b++){var c=C[b];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(h,c.key,c)}}function a(h,C,b){return C&&u(h.prototype,C),b&&u(h,b),h}function s(h,C){h.prototype=Object.create(C.prototype),h.prototype.constructor=h,l(h,C)}function l(h,C){return l=Object.setPrototypeOf||function(c,f){return c.__proto__=f,c},l(h,C)}var w=100,p=function(h){s(C,h);function C(c,f){var d;return d=h.call(this,c,f,"[stream-controller]")||this,d.audioCodecSwap=!1,d.gapController=null,d.level=-1,d._forceStartLoad=!1,d.altAudio=!1,d.audioOnly=!1,d.fragPlaying=null,d.onvplaying=null,d.onvseeked=null,d.fragLastKbps=0,d.stalled=!1,d.couldBacktrack=!1,d.audioCodecSwitch=!1,d.videoBuffer=null,d._registerListeners(),d}var b=C.prototype;return b._registerListeners=function(){var f=this.hls;f.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.on(j.Events.LEVEL_LOADING,this.onLevelLoading,this),f.on(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(j.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.on(j.Events.ERROR,this.onError,this),f.on(j.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.on(j.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(j.Events.BUFFER_CREATED,this.onBufferCreated,this),f.on(j.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.on(j.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.on(j.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var f=this.hls;f.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.off(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(j.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.off(j.Events.ERROR,this.onError,this),f.off(j.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.off(j.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(j.Events.BUFFER_CREATED,this.onBufferCreated,this),f.off(j.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.off(j.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.off(j.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(f){if(this.levels){var d=this.lastCurrentTime,o=this.hls;if(this.stopLoad(),this.setInterval(w),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var y=o.startLevel;y===-1&&(o.config.testBandwidth?(y=0,this.bitrateTest=!0):y=o.nextAutoLevel),this.level=o.nextLoadLevel=y,this.loadedmetadata=!1}d>0&&f===-1&&(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),f=d),this.state=I.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=f,this.tick()}else this._forceStartLoad=!0,this.state=I.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,h.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_LEVEL:{var f,d=this.levels,o=this.level,y=d==null||((f=d[o])===null||f===void 0)?void 0:f.details;if(y&&(!y.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(y))break;this.state=I.State.IDLE;break}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var m,x=self.performance.now(),P=this.retryDate;(!P||x>=P||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=I.State.IDLE)}break;default:break}this.onTickEnd()},b.onTickEnd=function(){h.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var f,d,o=this.hls,y=this.levelLastLoaded,m=this.levels,x=this.media,P=o.config,U=o.nextLoadLevel;if(y===null||!x&&(this.startFragRequested||!P.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[U])return;var B=m[U];this.level=o.nextLoadLevel=U;var W=B.details;if(!W||this.state===I.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==U){this.state=I.State.WAITING_LEVEL;return}var O=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:x,L.PlaylistLevelType.MAIN);if(O===null)return;var M=O.len,K=this.getMaxBufferLength(B.maxBitrate);if(M>=K)return;if(this._streamEnded(O,W)){var X={};this.altAudio&&(X.type="video"),this.hls.trigger(j.Events.BUFFER_EOS,X),this.state=I.State.ENDED;return}var ee=O.end,oe=this.getNextFragment(ee,W);if(this.couldBacktrack&&!this.fragPrevious&&oe&&oe.sn!=="initSegment"){var xe=oe.sn-W.startSN;xe>1&&(oe=W.fragments[xe-1],this.fragmentTracker.removeFragment(oe))}if(oe&&this.fragmentTracker.getState(oe)===k.FragmentState.OK&&this.nextLoadPosition>ee){var me=this.audioOnly&&!this.altAudio?v.ElementaryStreamTypes.AUDIO:v.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(x,me,L.PlaylistLevelType.MAIN),oe=this.getNextFragment(this.nextLoadPosition,W)}if(!oe)return;oe.initSegment&&!oe.initSegment.data&&!this.bitrateTest&&(oe=oe.initSegment),((f=oe.decryptdata)===null||f===void 0?void 0:f.keyFormat)==="identity"&&!((d=oe.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(oe,W):this.loadFragment(oe,W,ee)},b.loadFragment=function(f,d,o){var y,m=this.fragmentTracker.getState(f);if(this.fragCurrent=f,m===k.FragmentState.BACKTRACKED){var x=this.fragmentTracker.getBacktrackData(f);if(x){this._handleFragmentLoadProgress(x),this._handleFragmentLoadComplete(x);return}else m=k.FragmentState.NOT_LOADED}m===k.FragmentState.NOT_LOADED||m===k.FragmentState.PARTIAL?f.sn==="initSegment"?this._loadInitSegment(f):this.bitrateTest?(f.bitrateTest=!0,this.log("Fragment "+f.sn+" of level "+f.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(f)):(this.startFragRequested=!0,h.prototype.loadFragment.call(this,f,d,o)):m===k.FragmentState.APPENDING?this.reduceMaxBufferLength(f.duration)&&this.fragmentTracker.removeFragment(f):((y=this.media)===null||y===void 0?void 0:y.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(f){var d=this.fragmentTracker.getAppendedFrag(f,L.PlaylistLevelType.MAIN);return d&&"fragment"in d?d.fragment:d},b.getBufferedFrag=function(f){return this.fragmentTracker.getBufferedFrag(f,L.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(f){return f?this.getBufferedFrag(f.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var f=this.levels,d=this.media;if(d!=null&&d.readyState){var o,y=this.getAppendedFrag(d.currentTime);if(y&&y.start>1&&this.flushMainBuffer(0,y.start-1),!d.paused&&f){var m=this.hls.nextLoadLevel,x=f[m],P=this.fragLastKbps;P&&this.fragCurrent?o=this.fragCurrent.duration*x.maxBitrate/(1e3*P)+1:o=0}else o=0;var U=this.getBufferedFrag(d.currentTime+o);if(U){var B=this.followingBufferedFrag(U);if(B){this.abortCurrentFrag();var W=B.maxStartPTS?B.maxStartPTS:B.start,O=B.duration,M=Math.max(U.end,W+Math.min(Math.max(O-this.config.maxFragLookUpTolerance,O*.5),O*.75));this.flushMainBuffer(M,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var f=this.fragCurrent;this.fragCurrent=null,f!=null&&f.loader&&f.loader.abort(),this.state===I.State.KEY_LOADING&&(this.state=I.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(f,d){h.prototype.flushMainBuffer.call(this,f,d,this.altAudio?"video":null)},b.onMediaAttached=function(f,d){h.prototype.onMediaAttached.call(this,f,d);var o=d.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),o.addEventListener("playing",this.onvplaying),o.addEventListener("seeked",this.onvseeked),this.gapController=new T.default(this.config,o,this.fragmentTracker,this.hls)},b.onMediaDetaching=function(){var f=this.media;f&&(f.removeEventListener("playing",this.onvplaying),f.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),h.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var f=this.media,d=f?f.currentTime:null;Object(z.isFiniteNumber)(d)&&this.log("Media seeked to "+d.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(j.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},b.onManifestParsed=function(f,d){var o=!1,y=!1,m;d.levels.forEach(function(x){m=x.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(o=!0),m.indexOf("mp4a.40.5")!==-1&&(y=!0))}),this.audioCodecSwitch=o&&y&&!Object(R.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=d.levels,this.startFragRequested=!1},b.onLevelLoading=function(f,d){var o=this.levels;if(!o||this.state!==I.State.IDLE)return;var y=o[d.level];(!y.details||y.details.live&&this.levelLastLoaded!==d.level||this.waitForCdnTuneIn(y.details))&&(this.state=I.State.WAITING_LEVEL)},b.onLevelLoaded=function(f,d){var o,y=this.levels,m=d.level,x=d.details,P=x.totalduration;if(!y){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+x.startSN+","+x.endSN+"], cc ["+x.startCC+", "+x.endCC+"] duration:"+P);var U=this.fragCurrent;U&&(this.state===I.State.FRAG_LOADING||this.state===I.State.FRAG_LOADING_WAITING_RETRY)&&(U.level!==d.level&&U.loader&&(this.state=I.State.IDLE,U.loader.abort()));var B=y[m],W=0;if(x.live||(o=B.details)!==null&&o!==void 0&&o.live){if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed)return;W=this.alignPlaylists(x,B.details)}if(B.details=x,this.levelLastLoaded=m,this.hls.trigger(j.Events.LEVEL_UPDATED,{details:x,level:m}),this.state===I.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(x))return;this.state=I.State.IDLE}this.startFragRequested?x.live&&this.synchronizeToLiveEdge(x):this.setStartPosition(x,W),this.tick()},b._handleFragmentLoadProgress=function(f){var d,o=f.frag,y=f.part,m=f.payload,x=this.levels;if(!x){this.warn("Levels were reset while fragment load was in progress. Fragment "+o.sn+" of level "+o.level+" will not be buffered");return}var P=x[o.level],U=P.details;if(!U){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var B=P.videoCodec,W=U.PTSKnown||!U.live,O=(d=o.initSegment)===null||d===void 0?void 0:d.data,M=this._getAudioCodec(P),K=this.transmuxer=this.transmuxer||new S.default(this.hls,L.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),X=y?y.index:-1,ee=X!==-1,oe=new D.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,m.byteLength,X,ee),xe=this.initPTS[o.cc];K.push(m,O,M,B,o,y,U.totalduration,W,oe,xe)},b.onAudioTrackSwitching=function(f,d){var o=this.altAudio,y=!!d.url,m=d.id;if(!y){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var x=this.fragCurrent;x!=null&&x.loader&&(this.log("Switching to main audio track, cancel main fragment load"),x.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var P=this.hls;o&&P.trigger(j.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),P.trigger(j.Events.AUDIO_TRACK_SWITCHED,{id:m})}},b.onAudioTrackSwitched=function(f,d){var o=d.id,y=!!this.hls.audioTracks[o].url;if(y){var m=this.videoBuffer;m&&this.mediaBuffer!==m&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=m)}this.altAudio=y,this.tick()},b.onBufferCreated=function(f,d){var o=d.tracks,y,m,x=!1;for(var P in o){var U=o[P];if(U.id==="main"){if(m=P,y=U,P==="video"){var B=o[P];B&&(this.videoBuffer=B.buffer)}}else x=!0}x&&y?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=y.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(f,d){var o=d.frag,y=d.part;if(o&&o.type!==L.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(o)){this.warn("Fragment "+o.sn+(y?" p: "+y.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state),this.state===I.State.PARSED&&(this.state=I.State.IDLE);return}var m=y?y.stats:o.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),o.sn!=="initSegment"&&(this.fragPrevious=o),this.fragBufferedComplete(o,y)},b.onError=function(f,d){switch(d.details){case E.ErrorDetails.FRAG_LOAD_ERROR:case E.ErrorDetails.FRAG_LOAD_TIMEOUT:case E.ErrorDetails.KEY_LOAD_ERROR:case E.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.MAIN,d);break;case E.ErrorDetails.LEVEL_LOAD_ERROR:case E.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==I.State.ERROR&&(d.fatal?(this.warn(""+d.details),this.state=I.State.ERROR):!d.levelRetry&&this.state===I.State.WAITING_LEVEL&&(this.state=I.State.IDLE));break;case E.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="main"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var o=!0,y=this.getFwdBufferInfo(this.media,L.PlaylistLevelType.MAIN);y&&y.len>.5&&(o=!this.reduceMaxBufferLength(y.len)),o&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},b.checkBuffer=function(){var f=this.media,d=this.gapController;if(!f||!d||!f.readyState)return;var o=F.BufferHelper.getBuffered(f);!this.loadedmetadata&&o.length?(this.loadedmetadata=!0,this.seekToStartPos()):d.poll(this.lastCurrentTime),this.lastCurrentTime=f.currentTime},b.onFragLoadEmergencyAborted=function(){this.state=I.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(f,d){var o=d.type;if(o!==v.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var y=(o===v.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(y,o,L.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(f,d){this.levels=d.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var f=this.media,d=f.currentTime,o=this.startPosition;if(o>=0&&d<o){if(f.seeking){g.logger.log("could not seek to "+o+", already seeking at "+d);return}var y=F.BufferHelper.getBuffered(f),m=y.length?y.start(0):0,x=m-o;x>0&&(x<this.config.maxBufferHole||x<this.config.maxFragLookUpTolerance)&&(g.logger.log("adjusting start position by "+x+" to match buffer start"),o+=x,this.startPosition=o),this.log("seek to target start position "+o+" from current time "+d),f.currentTime=o}},b._getAudioCodec=function(f){var d=this.config.defaultAudioCodec||f.audioCodec;return this.audioCodecSwap&&d&&(this.log("Swapping audio codec"),d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5"),d},b._loadBitrateTestFrag=function(f){var d=this;this._doFragLoad(f).then(function(o){var y=d.hls;if(!o||y.nextLoadLevel||d.fragContextChanged(f))return;d.fragLoadError=0,d.state=I.State.IDLE,d.startFragRequested=!1,d.bitrateTest=!1;var m=f.stats;m.parsing.start=m.parsing.end=m.buffering.start=m.buffering.end=self.performance.now(),y.trigger(j.Events.FRAG_LOADED,o)})},b._handleTransmuxComplete=function(f){var d,o="main",y=this.hls,m=f.remuxResult,x=f.chunkMeta,P=this.getCurrentContext(x);if(!P){this.warn("The loading context changed while buffering fragment "+x.sn+" of level "+x.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(x.level);return}var U=P.frag,B=P.part,W=P.level,O=m.video,M=m.text,K=m.id3,X=m.initSegment,ee=this.altAudio?void 0:m.audio;if(this.fragContextChanged(U))return;if(this.state=I.State.PARSING,X){X.tracks&&(this._bufferInitSegment(W,X.tracks,U,x),y.trigger(j.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:o,tracks:X.tracks}));var oe=X.initPTS,xe=X.timescale;Object(z.isFiniteNumber)(oe)&&(this.initPTS[U.cc]=oe,y.trigger(j.Events.INIT_PTS_FOUND,{frag:U,id:o,initPTS:oe,timescale:xe}))}if(O&&m.independent!==!1){if(W.details){var me=O.startPTS,ge=O.endPTS,de=O.startDTS,se=O.endDTS;if(B)B.elementaryStreams[O.type]={startPTS:me,endPTS:ge,startDTS:de,endDTS:se};else if(O.firstKeyFrame&&O.independent&&(this.couldBacktrack=!0),O.dropped&&O.independent){var ne=this.getLoadPosition()+this.config.maxBufferHole;if(ne<me){this.backtrack(U);return}U.setElementaryStreamInfo(O.type,U.start,ge,U.start,se,!0)}U.setElementaryStreamInfo(O.type,me,ge,de,se),this.bufferFragmentData(O,U,B,x)}}else if(m.independent===!1){this.backtrack(U);return}if(ee){var he=ee.startPTS,$=ee.endPTS,ie=ee.startDTS,Z=ee.endDTS;B&&(B.elementaryStreams[v.ElementaryStreamTypes.AUDIO]={startPTS:he,endPTS:$,startDTS:ie,endDTS:Z}),U.setElementaryStreamInfo(v.ElementaryStreamTypes.AUDIO,he,$,ie,Z),this.bufferFragmentData(ee,U,B,x)}if(K!=null&&(d=K.samples)!==null&&d!==void 0&&d.length){var Ee={frag:U,id:o,samples:K.samples};y.trigger(j.Events.FRAG_PARSING_METADATA,Ee)}if(M){var Se={frag:U,id:o,samples:M.samples};y.trigger(j.Events.FRAG_PARSING_USERDATA,Se)}},b._bufferInitSegment=function(f,d,o,y){var m=this;if(this.state!==I.State.PARSING)return;this.audioOnly=!!d.audio&&!d.video,this.altAudio&&!this.audioOnly&&delete d.audio;var x=d.audio,P=d.video,U=d.audiovideo;if(x){var B=f.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(B&&(B.indexOf("mp4a.40.5")!==-1?B="mp4a.40.2":B="mp4a.40.5"),x.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(B="mp4a.40.5")),W.indexOf("android")!==-1&&x.container!=="audio/mpeg"&&(B="mp4a.40.2",this.log("Android: force audio codec to "+B)),f.audioCodec&&f.audioCodec!==B&&this.log('Swapping manifest audio codec "'+f.audioCodec+'" for "'+B+'"'),x.levelCodec=B,x.id="main",this.log("Init audio buffer, container:"+x.container+", codecs[selected/level/parsed]=["+(B||"")+"/"+(f.audioCodec||"")+"/"+x.codec+"]")}P&&(P.levelCodec=f.videoCodec,P.id="main",this.log("Init video buffer, container:"+P.container+", codecs[level/parsed]=["+(f.videoCodec||"")+"/"+P.codec+"]")),U&&this.log("Init audiovideo buffer, container:"+U.container+", codecs[level/parsed]=["+(f.attrs.CODECS||"")+"/"+U.codec+"]"),this.hls.trigger(j.Events.BUFFER_CODECS,d),Object.keys(d).forEach(function(O){var M=d[O],K=M.initSegment;K!=null&&K.byteLength&&m.hls.trigger(j.Events.BUFFER_APPENDING,{type:O,data:K,frag:o,part:null,chunkMeta:y,parent:o.type})}),this.tick()},b.backtrack=function(f){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(f);var d=this.fragmentTracker.backtrack(f);this.fragPrevious=null,this.nextLoadPosition=f.start,d?this.resetFragmentLoading(f):this.state=I.State.BACKTRACKING},b.checkFragmentChanged=function(){var f=this.media,d=null;if(f&&f.readyState>1&&f.seeking===!1){var o=f.currentTime;if(F.BufferHelper.isBuffered(f,o)?d=this.getAppendedFrag(o):F.BufferHelper.isBuffered(f,o+.1)&&(d=this.getAppendedFrag(o+.1)),d){var y=this.fragPlaying,m=d.level;(!y||d.sn!==y.sn||y.level!==m||d.urlId!==y.urlId)&&(this.hls.trigger(j.Events.FRAG_CHANGED,{frag:d}),(!y||y.level!==m)&&this.hls.trigger(j.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=d)}}},a(C,[{key:"nextLevel",get:function(){var f=this.nextBufferedFrag;return f?f.level:-1}},{key:"currentLevel",get:function(){var f=this.media;if(f){var d=this.getAppendedFrag(f.currentTime);if(d)return d.level}return-1}},{key:"nextBufferedFrag",get:function(){var f=this.media;if(f){var d=this.getAppendedFrag(f.currentTime);return this.followingBufferedFrag(d)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),C}(I.default)},"./src/controller/subtitle-stream-controller.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"SubtitleStreamController",function(){return s});var z=A("./src/events.ts"),I=A("./src/utils/logger.ts"),R=A("./src/utils/buffer-helper.ts"),j=A("./src/controller/fragment-finders.ts"),F=A("./src/utils/discontinuities.ts"),k=A("./src/controller/level-helper.ts"),L=A("./src/controller/fragment-tracker.ts"),v=A("./src/controller/base-stream-controller.ts"),S=A("./src/types/loader.ts"),D=A("./src/types/level.ts");function T(l,w){for(var p=0;p<w.length;p++){var h=w[p];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(l,h.key,h)}}function E(l,w,p){return w&&T(l.prototype,w),p&&T(l,p),l}function g(l,w){l.prototype=Object.create(w.prototype),l.prototype.constructor=l,u(l,w)}function u(l,w){return u=Object.setPrototypeOf||function(h,C){return h.__proto__=C,h},u(l,w)}var a=500,s=function(l){g(w,l);function w(h,C){var b;return b=l.call(this,h,C,"[subtitle-stream-controller]")||this,b.levels=[],b.currentTrackId=-1,b.tracksBuffered=[],b.mainDetails=null,b._registerListeners(),b}var p=w.prototype;return p.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},p._registerListeners=function(){var C=this.hls;C.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),C.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),C.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),C.on(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),C.on(z.Events.ERROR,this.onError,this),C.on(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),C.on(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),C.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),C.on(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),C.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p._unregisterListeners=function(){var C=this.hls;C.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),C.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),C.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),C.off(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),C.off(z.Events.ERROR,this.onError,this),C.off(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),C.off(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),C.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),C.off(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),C.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p.startLoad=function(){this.stopLoad(),this.state=v.State.IDLE,this.setInterval(a),this.tick()},p.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},p.onLevelLoaded=function(C,b){this.mainDetails=b.details},p.onSubtitleFragProcessed=function(C,b){var c=b.frag,f=b.success;if(this.fragPrevious=c,this.state=v.State.IDLE,!f)return;var d=this.tracksBuffered[this.currentTrackId];if(!d)return;for(var o,y=c.start,m=0;m<d.length;m++)if(y>=d[m].start&&y<=d[m].end){o=d[m];break}var x=c.start+c.duration;o?o.end=x:(o={start:y,end:x},d.push(o)),this.fragmentTracker.fragBuffered(c)},p.onBufferFlushing=function(C,b){var c=b.startOffset,f=b.endOffset;if(c===0&&f!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,o=this.levels;if(!o.length||!o[d]||!o[d].details)return;var y=o[d].details,m=y.targetduration,x=f-m;if(x<=0)return;b.endOffsetSubtitles=Math.max(0,x),this.tracksBuffered.forEach(function(P){for(var U=0;U<P.length;){if(P[U].end<=x){P.shift();continue}else if(P[U].start<x)P[U].start=x;else break;U++}}),this.fragmentTracker.removeFragmentsInRange(c,x,S.PlaylistLevelType.SUBTITLE)}},p.onError=function(C,b){var c,f=b.frag;if(!f||f.type!==S.PlaylistLevelType.SUBTITLE)return;(c=this.fragCurrent)!==null&&c!==void 0&&c.loader&&this.fragCurrent.loader.abort(),this.state=v.State.IDLE},p.onSubtitleTracksUpdated=function(C,b){var c=this,f=b.subtitleTracks;this.tracksBuffered=[],this.levels=f.map(function(d){return new D.Level(d)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(d){c.tracksBuffered[d.id]=[]}),this.mediaBuffer=null},p.onSubtitleTrackSwitch=function(C,b){if(this.currentTrackId=b.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var c=this.levels[this.currentTrackId];c!=null&&c.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,c&&this.setInterval(a)},p.onSubtitleTrackLoaded=function(C,b){var c,f=b.details,d=b.id,o=this.currentTrackId,y=this.levels;if(!y.length)return;var m=y[o];if(d>=y.length||d!==o||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,f.live||(c=m.details)!==null&&c!==void 0&&c.live){var x=this.mainDetails;if(f.deltaUpdateFailed||!x)return;var P=x.fragments[0];if(!m.details)f.hasProgramDateTime&&x.hasProgramDateTime?Object(F.alignMediaPlaylistByPDT)(f,x):P&&Object(k.addSliding)(f,P.start);else{var U=this.alignPlaylists(f,m.details);U===0&&P&&Object(k.addSliding)(f,P.start)}}if(m.details=f,this.levelLastLoaded=d,this.tick(),f.live&&!this.fragCurrent&&this.media&&this.state===v.State.IDLE){var B=Object(j.findFragmentByPTS)(null,f.fragments,this.media.currentTime,0);B||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},p._handleFragmentLoadComplete=function(C){var b=C.frag,c=C.payload,f=b.decryptdata,d=this.hls;if(this.fragContextChanged(b))return;if(c&&c.byteLength>0&&f&&f.key&&f.iv&&f.method==="AES-128"){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(c),f.key.buffer,f.iv.buffer).then(function(y){var m=performance.now();d.trigger(z.Events.FRAG_DECRYPTED,{frag:b,payload:y,stats:{tstart:o,tdecrypt:m}})})}},p.doTick=function(){if(!this.media){this.state=v.State.IDLE;return}if(this.state===v.State.IDLE){var C,b=this.currentTrackId,c=this.levels;if(!c.length||!c[b]||!c[b].details)return;var f=c[b].details,d=f.targetduration,o=this.config,y=this.media,m=R.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,y.currentTime-d,o.maxBufferHole),x=m.end,P=m.len,U=this.getMaxBufferLength()+d;if(P>U)return;console.assert(f,"Subtitle track details are defined on idle subtitle stream controller tick");var B=f.fragments,W=B.length,O=f.edge,M,K=this.fragPrevious;if(x<O){var X=o.maxFragLookUpTolerance;K&&f.hasProgramDateTime&&(M=Object(j.findFragmentByPDT)(B,K.endProgramDateTime,X)),M||(M=Object(j.findFragmentByPTS)(K,B,x,X),!M&&K&&K.start<B[0].start&&(M=B[0]))}else M=B[W-1];(C=M)!==null&&C!==void 0&&C.encrypted?(I.logger.log("Loading key for "+M.sn),this.state=v.State.KEY_LOADING,this.hls.trigger(z.Events.KEY_LOADING,{frag:M})):M&&this.fragmentTracker.getState(M)===L.FragmentState.NOT_LOADED&&this.loadFragment(M,f,x)}},p.loadFragment=function(C,b,c){this.fragCurrent=C,l.prototype.loadFragment.call(this,C,b,c)},E(w,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),w}(v.default)},"./src/controller/subtitle-track-controller.ts":function(te,G,A){"use strict";A.r(G);var z=A("./src/events.ts"),I=A("./src/utils/texttrack-utils.ts"),R=A("./src/controller/base-playlist-controller.ts"),j=A("./src/types/loader.ts");function F(T,E){for(var g=0;g<E.length;g++){var u=E[g];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(T,u.key,u)}}function k(T,E,g){return E&&F(T.prototype,E),g&&F(T,g),T}function L(T,E){T.prototype=Object.create(E.prototype),T.prototype.constructor=T,v(T,E)}function v(T,E){return v=Object.setPrototypeOf||function(u,a){return u.__proto__=a,u},v(T,E)}var S=function(T){L(E,T);function E(u){var a;return a=T.call(this,u,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var g=E.prototype;return g.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,T.prototype.destroy.call(this)},g.registerListeners=function(){var a=this.hls;a.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(z.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){var a=this.hls;a.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(z.Events.ERROR,this.onError,this)},g.onMediaAttached=function(a,s){if(this.media=s.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)},g.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},g.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 a=D(this.media.textTracks);a.forEach(function(s){Object(I.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},g.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},g.onManifestParsed=function(a,s){this.tracks=s.subtitleTracks},g.onSubtitleTrackLoaded=function(a,s){var l=s.id,w=s.details,p=this.trackId,h=this.tracksInGroup[p];if(!h){this.warn("Invalid subtitle track id "+l);return}var C=h.details;h.details=s.details,this.log("subtitle track "+l+" loaded ["+w.startSN+"-"+w.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,s,C))},g.onLevelLoading=function(a,s){this.switchLevel(s.level)},g.onLevelSwitching=function(a,s){this.switchLevel(s.level)},g.switchLevel=function(a){var s=this.hls.levels[a];if(!(s!=null&&s.textGroupIds))return;var l=s.textGroupIds[s.urlId];if(this.groupId!==l){var w=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,p=this.tracks.filter(function(b){return!l||b.groupId===l});this.tracksInGroup=p;var h=this.findTrackId(w==null?void 0:w.name)||this.findTrackId();this.groupId=l;var C={subtitleTracks:p};this.log("Updating subtitle tracks, "+p.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(z.Events.SUBTITLE_TRACKS_UPDATED,C),h!==-1&&this.setSubtitleTrack(h,w)}},g.findTrackId=function(a){for(var s=this.tracksInGroup,l=0;l<s.length;l++){var w=s[l];if((!this.selectDefaultTrack||w.default)&&(!a||a===w.name))return w.id}return-1},g.onError=function(a,s){if(T.prototype.onError.call(this,a,s),s.fatal||!s.context)return;s.context.type===j.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},g.loadPlaylist=function(a){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var l=s.id,w=s.groupId,p=s.url;if(a)try{p=a.addDirectives(p)}catch(h){this.warn("Could not construct new URL with HLS Delivery Directives: "+h)}this.log("Loading subtitle playlist for id "+l),this.hls.trigger(z.Events.SUBTITLE_TRACK_LOADING,{url:p,id:l,groupId:w,deliveryDirectives:a||null})}},g.toggleTrackModes=function(a){var s=this,l=this.media,w=this.subtitleDisplay,p=this.trackId;if(!l)return;var h=D(l.textTracks),C=h.filter(function(f){return f.groupId===s.groupId});if(a===-1)[].slice.call(h).forEach(function(f){f.mode="disabled"});else{var b=C[p];b&&(b.mode="disabled")}var c=C[a];c&&(c.mode=w?"showing":"hidden")},g.setSubtitleTrack=function(a,s){var l,w=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(l=w[a])!==null&&l!==void 0&&l.details)||a<-1||a>=w.length)return;this.clearTimer();var p=w[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,p){var h=p.id,C=p.groupId,b=C===void 0?"":C,c=p.name,f=p.type,d=p.url;this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:h,groupId:b,name:c,type:f,url:d});var o=this.switchParams(p.url,s==null?void 0:s.details);this.loadPlaylist(o)}else this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:a})},g.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,s=D(this.media.textTracks),l=0;l<s.length;l++)if(s[l].mode==="hidden")a=l;else if(s[l].mode==="showing"){a=l;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},k(E,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,s)}}]),E}(R.default);function D(T){for(var E=[],g=0;g<T.length;g++){var u=T[g];u.kind==="subtitles"&&u.label&&E.push(T[g])}return E}G.default=S},"./src/controller/timeline-controller.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"TimelineController",function(){return D});var z=A("./src/polyfills/number.ts"),I=A("./src/events.ts"),R=A("./src/utils/cea-608-parser.ts"),j=A("./src/utils/output-filter.ts"),F=A("./src/utils/webvtt-parser.ts"),k=A("./src/utils/texttrack-utils.ts"),L=A("./src/utils/imsc1-ttml-parser.ts"),v=A("./src/types/loader.ts"),S=A("./src/utils/logger.ts"),D=function(){function u(s){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=g(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var l=new j.default(this,"textTrack1"),w=new j.default(this,"textTrack2"),p=new j.default(this,"textTrack3"),h=new j.default(this,"textTrack4");this.cea608Parser1=new R.default(1,l,w),this.cea608Parser2=new R.default(3,p,h)}s.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(I.Events.FRAG_LOADING,this.onFragLoading,this),s.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=u.prototype;return a.destroy=function(){var l=this.hls;l.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.off(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.off(I.Events.FRAG_LOADING,this.onFragLoading,this),l.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.off(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.off(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(l,w,p,h,C){for(var b=!1,c=C.length;c--;){var f=C[c],d=E(f[0],f[1],w,p);if(d>=0&&(f[0]=Math.min(f[0],w),f[1]=Math.max(f[1],p),b=!0,d/(p-w)>.5))return}if(b||C.push([w,p]),this.config.renderTextTracksNatively){var o=this.captionsTracks[l];this.Cues.newCue(o,w,p,h)}else{var y=this.Cues.newCue(null,w,p,h);this.hls.trigger(I.Events.CUES_PARSED,{type:"captions",cues:y,track:l})}},a.onInitPtsFound=function(l,w){var p=this,h=w.frag,C=w.id,b=w.initPTS,c=w.timescale,f=this.unparsedVttFrags;C==="main"&&(this.initPTS[h.cc]=b,this.timescale[h.cc]=c),f.length&&(this.unparsedVttFrags=[],f.forEach(function(d){p.onFragLoaded(I.Events.FRAG_LOADED,d)}))},a.getExistingTrack=function(l){var w=this.media;if(w)for(var p=0;p<w.textTracks.length;p++){var h=w.textTracks[p];if(h[l])return h}return null},a.createCaptionsTrack=function(l){this.config.renderTextTracksNatively?this.createNativeTrack(l):this.createNonNativeTrack(l)},a.createNativeTrack=function(l){if(this.captionsTracks[l])return;var w=this.captionsProperties,p=this.captionsTracks,h=this.media,C=w[l],b=C.label,c=C.languageCode,f=this.getExistingTrack(l);if(f)p[l]=f,Object(k.clearCurrentCues)(p[l]),Object(k.sendAddTrackEvent)(p[l],h);else{var d=this.createTextTrack("captions",b,c);d&&(d[l]=!0,p[l]=d)}},a.createNonNativeTrack=function(l){if(this.nonNativeCaptionsTracks[l])return;var w=this.captionsProperties[l];if(!w)return;var p=w.label,h={_id:l,label:p,kind:"captions",default:w.media?!!w.media.default:!1,closedCaptions:w.media};this.nonNativeCaptionsTracks[l]=h,this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[h]})},a.createTextTrack=function(l,w,p){var h=this.media;return h?h.addTextTrack(l,w,p):void 0},a.onMediaAttaching=function(l,w){this.media=w.media,this._cleanTracks()},a.onMediaDetaching=function(){var l=this.captionsTracks;Object.keys(l).forEach(function(w){Object(k.clearCurrentCues)(l[w]),delete l[w]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=g(),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())},a._cleanTracks=function(){var l=this.media;if(!l)return;var w=l.textTracks;if(w)for(var p=0;p<w.length;p++)Object(k.clearCurrentCues)(w[p])},a.onSubtitleTracksUpdated=function(l,w){var p=this;this.textTracks=[];var h=w.subtitleTracks||[],C=h.some(function(d){return d.textCodec===L.IMSC1_CODEC});if(this.config.enableWebVTT||C&&this.config.enableIMSC1){var b=this.tracks&&h&&this.tracks.length===h.length;if(this.tracks=h||[],this.config.renderTextTracksNatively){var c=this.media?this.media.textTracks:[];this.tracks.forEach(function(d,o){var y;if(o<c.length){for(var m=null,x=0;x<c.length;x++)if(T(c[x],d)){m=c[x];break}m&&(y=m)}y?Object(k.clearCurrentCues)(y):(y=p.createTextTrack("subtitles",d.name,d.lang),y&&(y.mode="disabled")),y&&(y.groupId=d.groupId,p.textTracks.push(y))})}else if(!b&&this.tracks&&this.tracks.length){var f=this.tracks.map(function(d){return{label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}});this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:f})}}},a.onManifestLoaded=function(l,w){var p=this;this.config.enableCEA708Captions&&w.captions&&w.captions.forEach(function(h){var C=/(?:CC|SERVICE)([1-4])/.exec(h.instreamId);if(!C)return;var b="textTrack"+C[1],c=p.captionsProperties[b];if(!c)return;c.label=h.name,h.lang&&(c.languageCode=h.lang),c.media=h})},a.onFragLoading=function(l,w){var p=this.cea608Parser1,h=this.cea608Parser2,C=this.lastSn,b=this.lastPartIndex;if(!this.enabled||!(p&&h))return;if(w.frag.type===v.PlaylistLevelType.MAIN){var c,f,d=w.frag.sn,o=(c=w==null||((f=w.part)===null||f===void 0)?void 0:f.index)!=null?c:-1;d===C+1||d===C&&o===b+1||(p.reset(),h.reset()),this.lastSn=d,this.lastPartIndex=o}},a.onFragLoaded=function(l,w){var p=w.frag,h=w.payload,C=this.initPTS,b=this.unparsedVttFrags;if(p.type===v.PlaylistLevelType.SUBTITLE)if(h.byteLength){if(!Object(z.isFiniteNumber)(C[p.cc])){b.push(w),C.length&&this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Missing initial subtitle PTS")});return}var c=p.decryptdata;if(c==null||c.key==null||c.method!=="AES-128"){var f=this.tracks[p.level],d=this.vttCCs;d[p.cc]||(d[p.cc]={start:p.start,prevCC:this.prevCC,new:!0},this.prevCC=p.cc),f&&f.textCodec===L.IMSC1_CODEC?this._parseIMSC1(p,h):this._parseVTTs(p,h,d)}}else this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(l,w){var p=this,h=this.hls;Object(L.parseIMSC1)(w,this.initPTS[l.cc],this.timescale[l.cc],function(C){p._appendCues(C,l.level),h.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(C){S.logger.log("Failed to parse IMSC1: "+C),h.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:C})})},a._parseVTTs=function(l,w,p){var h=this,C=this.hls;Object(F.parseWebVTT)(w,this.initPTS[l.cc],this.timescale[l.cc],p,l.cc,l.start,function(b){h._appendCues(b,l.level),C.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(b){h._fallbackToIMSC1(l,w),S.logger.log("Failed to parse VTT cue: "+b),C.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:b})})},a._fallbackToIMSC1=function(l,w){var p=this,h=this.tracks[l.level];h.textCodec||Object(L.parseIMSC1)(w,this.initPTS[l.cc],this.timescale[l.cc],function(){h.textCodec=L.IMSC1_CODEC,p._parseIMSC1(l,w)},function(){h.textCodec="wvtt"})},a._appendCues=function(l,w){var p=this.hls;if(this.config.renderTextTracksNatively){var h=this.textTracks[w];if(h.mode==="disabled")return;l.forEach(function(c){return Object(k.addCueToTrack)(h,c)})}else{var C=this.tracks[w],b=C.default?"default":"subtitles"+w;p.trigger(I.Events.CUES_PARSED,{type:"subtitles",cues:l,track:b})}},a.onFragDecrypted=function(l,w){var p=w.frag;if(p.type===v.PlaylistLevelType.SUBTITLE){if(!Object(z.isFiniteNumber)(this.initPTS[p.cc])){this.unparsedVttFrags.push(w);return}this.onFragLoaded(I.Events.FRAG_LOADED,w)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(l,w){var p=this.cea608Parser1,h=this.cea608Parser2;if(!this.enabled||!(p&&h))return;for(var C=0;C<w.samples.length;C++){var b=w.samples[C].bytes;if(b){var c=this.extractCea608Data(b);p.addData(w.samples[C].pts,c[0]),h.addData(w.samples[C].pts,c[1])}}},a.onBufferFlushing=function(l,w){var p=w.startOffset,h=w.endOffset,C=w.endOffsetSubtitles,b=w.type,c=this.media;if(!c||c.currentTime<h)return;if(!b||b==="video"){var f=this.captionsTracks;Object.keys(f).forEach(function(o){return Object(k.removeCuesInRange)(f[o],p,h)})}if(this.config.renderTextTracksNatively&&(p===0&&C!==void 0)){var d=this.textTracks;Object.keys(d).forEach(function(o){return Object(k.removeCuesInRange)(d[o],p,C)})}},a.extractCea608Data=function(l){for(var w=l[0]&31,p=2,h=[[],[]],C=0;C<w;C++){var b=l[p++],c=127&l[p++],f=127&l[p++],d=(4&b)!==0,o=3&b;if(c===0&&f===0)continue;d&&((o===0||o===1)&&(h[o].push(c),h[o].push(f)))}return h},u}();function T(u,a){return u&&u.label===a.name&&!(u.textTrack1||u.textTrack2)}function E(u,a,s,l){return Math.min(a,l)-Math.max(u,s)}function g(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return z});var z=function(){function I(j,F){this.subtle=void 0,this.aesIV=void 0,this.subtle=j,this.aesIV=F}var R=I.prototype;return R.decrypt=function(F,k){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},k,F)},I}()},"./src/crypt/aes-decryptor.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"removePadding",function(){return I}),A.d(G,"default",function(){return R});var z=A("./src/utils/typed-array.ts");function I(j){var F=j.byteLength,k=F&&new DataView(j.buffer).getUint8(F-1);return k?Object(z.sliceUint8)(j,0,F-k):j}var R=function(){function j(){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 F=j.prototype;return F.uint8ArrayToUint32Array_=function(L){for(var v=new DataView(L),S=new Uint32Array(4),D=0;D<4;D++)S[D]=v.getUint32(D*4);return S},F.initTable=function(){var L=this.sBox,v=this.invSBox,S=this.subMix,D=S[0],T=S[1],E=S[2],g=S[3],u=this.invSubMix,a=u[0],s=u[1],l=u[2],w=u[3],p=new Uint32Array(256),h=0,C=0,b=0;for(b=0;b<256;b++)b<128?p[b]=b<<1:p[b]=b<<1^283;for(b=0;b<256;b++){var c=C^C<<1^C<<2^C<<3^C<<4;c=c>>>8^c&255^99,L[h]=c,v[c]=h;var f=p[h],d=p[f],o=p[d],y=p[c]*257^c*16843008;D[h]=y<<24|y>>>8,T[h]=y<<16|y>>>16,E[h]=y<<8|y>>>24,g[h]=y,y=o*16843009^d*65537^f*257^h*16843008,a[c]=y<<24|y>>>8,s[c]=y<<16|y>>>16,l[c]=y<<8|y>>>24,w[c]=y,h?(h=f^p[p[p[o^f]]],C^=p[p[C]]):h=C=1}},F.expandKey=function(L){for(var v=this.uint8ArrayToUint32Array_(L),S=!0,D=0;D<v.length&&S;)S=v[D]===this.key[D],D++;if(S)return;this.key=v;var T=this.keySize=v.length;if(T!==4&&T!==6&&T!==8)throw new Error("Invalid aes key size="+T);var E=this.ksRows=(T+6+1)*4,g,u,a=this.keySchedule=new Uint32Array(E),s=this.invKeySchedule=new Uint32Array(E),l=this.sBox,w=this.rcon,p=this.invSubMix,h=p[0],C=p[1],b=p[2],c=p[3],f,d;for(g=0;g<E;g++){if(g<T){f=a[g]=v[g];continue}d=f,g%T===0?(d=d<<8|d>>>24,d=l[d>>>24]<<24|l[d>>>16&255]<<16|l[d>>>8&255]<<8|l[d&255],d^=w[g/T|0]<<24):T>6&&g%T===4&&(d=l[d>>>24]<<24|l[d>>>16&255]<<16|l[d>>>8&255]<<8|l[d&255]),a[g]=f=(a[g-T]^d)>>>0}for(u=0;u<E;u++)g=E-u,u&3?d=a[g]:d=a[g-4],u<4||g<=4?s[u]=d:s[u]=h[l[d>>>24]]^C[l[d>>>16&255]]^b[l[d>>>8&255]]^c[l[d&255]],s[u]=s[u]>>>0},F.networkToHostOrderSwap=function(L){return L<<24|(L&65280)<<8|(L&16711680)>>8|L>>>24},F.decrypt=function(L,v,S){for(var D=this.keySize+6,T=this.invKeySchedule,E=this.invSBox,g=this.invSubMix,u=g[0],a=g[1],s=g[2],l=g[3],w=this.uint8ArrayToUint32Array_(S),p=w[0],h=w[1],C=w[2],b=w[3],c=new Int32Array(L),f=new Int32Array(c.length),d,o,y,m,x,P,U,B,W,O,M,K,X,ee,oe=this.networkToHostOrderSwap;v<c.length;){for(W=oe(c[v]),O=oe(c[v+1]),M=oe(c[v+2]),K=oe(c[v+3]),x=W^T[0],P=K^T[1],U=M^T[2],B=O^T[3],X=4,ee=1;ee<D;ee++)d=u[x>>>24]^a[P>>16&255]^s[U>>8&255]^l[B&255]^T[X],o=u[P>>>24]^a[U>>16&255]^s[B>>8&255]^l[x&255]^T[X+1],y=u[U>>>24]^a[B>>16&255]^s[x>>8&255]^l[P&255]^T[X+2],m=u[B>>>24]^a[x>>16&255]^s[P>>8&255]^l[U&255]^T[X+3],x=d,P=o,U=y,B=m,X=X+4;d=E[x>>>24]<<24^E[P>>16&255]<<16^E[U>>8&255]<<8^E[B&255]^T[X],o=E[P>>>24]<<24^E[U>>16&255]<<16^E[B>>8&255]<<8^E[x&255]^T[X+1],y=E[U>>>24]<<24^E[B>>16&255]<<16^E[x>>8&255]<<8^E[P&255]^T[X+2],m=E[B>>>24]<<24^E[x>>16&255]<<16^E[P>>8&255]<<8^E[U&255]^T[X+3],f[v]=oe(d^p),f[v+1]=oe(m^h),f[v+2]=oe(y^C),f[v+3]=oe(o^b),p=W,h=O,C=M,b=K,v=v+4}return f.buffer},j}()},"./src/crypt/decrypter.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return v});var z=A("./src/crypt/aes-crypto.ts"),I=A("./src/crypt/fast-aes-key.ts"),R=A("./src/crypt/aes-decryptor.ts"),j=A("./src/utils/logger.ts"),F=A("./src/utils/mp4-tools.ts"),k=A("./src/utils/typed-array.ts"),L=16,v=function(){function S(T,E,g){var u=g===void 0?{}:g,a=u.removePKCS7Padding,s=a===void 0?!0:a;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=T,this.config=E,this.removePKCS7Padding=s,s)try{var l=self.crypto;l&&(this.subtle=l.subtle||l.webkitSubtle)}catch(w){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var D=S.prototype;return D.destroy=function(){this.observer=null},D.isSync=function(){return this.config.enableSoftwareAES},D.flush=function(){var E=this.currentResult;if(!E){this.reset();return}var g=new Uint8Array(E);return this.reset(),this.removePKCS7Padding?Object(R.removePadding)(g):g},D.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},D.decrypt=function(E,g,u,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(E),g,u);var s=this.flush();s&&a(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(E),g,u).then(a)},D.softwareDecrypt=function(E,g,u){var a=this.currentIV,s=this.currentResult,l=this.remainderData;this.logOnce("JS AES decrypt"),l&&(E=Object(F.appendUint8Array)(l,E),this.remainderData=null);var w=this.getValidChunk(E);if(!w.length)return null;a&&(u=a);var p=this.softwareDecrypter;p||(p=this.softwareDecrypter=new R.default),p.expandKey(g);var h=s;return this.currentResult=p.decrypt(w.buffer,0,u),this.currentIV=Object(k.sliceUint8)(w,-16).buffer,h||null},D.webCryptoDecrypt=function(E,g,u){var a=this,s=this.subtle;return(this.key!==g||!this.fastAesKey)&&(this.key=g,this.fastAesKey=new I.default(s,g)),this.fastAesKey.expandKey().then(function(l){if(!s)return Promise.reject(new Error("web crypto not initialized"));var w=new z.default(s,u);return w.decrypt(E.buffer,l)}).catch(function(l){return a.onWebCryptoError(l,E,g,u)})},D.onWebCryptoError=function(E,g,u,a){return j.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",E),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(g,u,a)},D.getValidChunk=function(E){var g=E,u=E.length-E.length%L;return u!==E.length&&(g=Object(k.sliceUint8)(E,0,u),this.remainderData=Object(k.sliceUint8)(E,u)),g},D.logOnce=function(E){if(!this.logEnabled)return;j.logger.log("[decrypter.ts]: "+E),this.logEnabled=!1},S}()},"./src/crypt/fast-aes-key.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return z});var z=function(){function I(j,F){this.subtle=void 0,this.key=void 0,this.subtle=j,this.key=F}var R=I.prototype;return R.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},I}()},"./src/demux/aacdemuxer.ts":function(te,G,A){"use strict";A.r(G);var z=A("./src/demux/base-audio-demuxer.ts"),I=A("./src/demux/adts.ts"),R=A("./src/utils/logger.ts"),j=A("./src/demux/id3.ts");function F(v,S){v.prototype=Object.create(S.prototype),v.prototype.constructor=v,k(v,S)}function k(v,S){return k=Object.setPrototypeOf||function(T,E){return T.__proto__=E,T},k(v,S)}var L=function(v){F(S,v);function S(T,E){var g;return g=v.call(this)||this,g.observer=void 0,g.config=void 0,g.observer=T,g.config=E,g}var D=S.prototype;return D.resetInitSegment=function(E,g,u){v.prototype.resetInitSegment.call(this,E,g,u),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:E,duration:u,inputTimeScale:9e4,dropped:0}},S.probe=function(E){if(!E)return!1;for(var g=j.getID3Data(E,0)||[],u=g.length,a=E.length;u<a;u++)if(I.probe(E,u))return R.logger.log("ADTS sync word found !"),!0;return!1},D.canParse=function(E,g){return I.canParse(E,g)},D.appendFrame=function(E,g,u){I.initTrackConfig(E,this.observer,g,u,E.manifestCodec);var a=I.appendFrame(E,g,u,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},S}(z.default);L.minProbeByteLength=9,G.default=L},"./src/demux/adts.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"getAudioConfig",function(){return j}),A.d(G,"isHeaderPattern",function(){return F}),A.d(G,"getHeaderLength",function(){return k}),A.d(G,"getFullFrameLength",function(){return L}),A.d(G,"canGetFrameLength",function(){return v}),A.d(G,"isHeader",function(){return S}),A.d(G,"canParse",function(){return D}),A.d(G,"probe",function(){return T}),A.d(G,"initTrackConfig",function(){return E}),A.d(G,"getFrameDuration",function(){return g}),A.d(G,"parseFrameHeader",function(){return u}),A.d(G,"appendFrame",function(){return a});var z=A("./src/utils/logger.ts"),I=A("./src/errors.ts"),R=A("./src/events.ts");function j(s,l,w,p){var h,C,b,c,f=navigator.userAgent.toLowerCase(),d=p,o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];h=((l[w+2]&192)>>>6)+1;var y=(l[w+2]&60)>>>2;if(y>o.length-1){s.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+y});return}return b=(l[w+2]&1)<<2,b|=(l[w+3]&192)>>>6,z.logger.log("manifest codec:"+p+", ADTS type:"+h+", samplingIndex:"+y),/firefox/i.test(f)?y>=6?(h=5,c=new Array(4),C=y-3):(h=2,c=new Array(2),C=y):f.indexOf("android")!==-1?(h=2,c=new Array(2),C=y):(h=5,c=new Array(4),p&&(p.indexOf("mp4a.40.29")!==-1||p.indexOf("mp4a.40.5")!==-1)||!p&&y>=6?C=y-3:((p&&p.indexOf("mp4a.40.2")!==-1&&(y>=6&&b===1||/vivaldi/i.test(f))||!p&&b===1)&&(h=2,c=new Array(2)),C=y)),c[0]=h<<3,c[0]|=(y&14)>>1,c[1]|=(y&1)<<7,c[1]|=b<<3,h===5&&(c[1]|=(C&14)>>1,c[2]=(C&1)<<7,c[2]|=2<<2,c[3]=0),{config:c,samplerate:o[y],channelCount:b,codec:"mp4a.40."+h,manifestCodec:d}}function F(s,l){return s[l]===255&&(s[l+1]&246)===240}function k(s,l){return s[l+1]&1?7:9}function L(s,l){return(s[l+3]&3)<<11|s[l+4]<<3|(s[l+5]&224)>>>5}function v(s,l){return l+5<s.length}function S(s,l){return l+1<s.length&&F(s,l)}function D(s,l){return v(s,l)&&F(s,l)&&L(s,l)<=s.length-l}function T(s,l){if(S(s,l)){var w=k(s,l);if(l+w>=s.length)return!1;var p=L(s,l);if(p<=w)return!1;var h=l+p;return h===s.length||S(s,h)}return!1}function E(s,l,w,p,h){if(!s.samplerate){var C=j(l,w,p,h);if(!C)return;s.config=C.config,s.samplerate=C.samplerate,s.channelCount=C.channelCount,s.codec=C.codec,s.manifestCodec=C.manifestCodec,z.logger.log("parsed codec:"+s.codec+", rate:"+C.samplerate+", channels:"+C.channelCount)}}function g(s){return 1024*9e4/s}function u(s,l,w,p,h){var C=k(s,l),b=L(s,l);if(b-=C,b>0){var c=w+p*h;return{headerLength:C,frameLength:b,stamp:c}}}function a(s,l,w,p,h){var C=g(s.samplerate),b=u(l,w,p,h,C);if(b){var c=b.frameLength,f=b.headerLength,d=b.stamp,o=f+c,y=Math.max(0,w+o-l.length),m;y?(m=new Uint8Array(o-f),m.set(l.subarray(w+f,l.length),0)):m=l.subarray(w+f,w+o);var x={unit:m,pts:d};return y||s.samples.push(x),{sample:x,length:o,missing:y}}}},"./src/demux/base-audio-demuxer.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"initPTSFn",function(){return L});var z=A("./src/polyfills/number.ts"),I=A("./src/demux/id3.ts"),R=A("./src/demux/dummy-demuxed-track.ts"),j=A("./src/utils/mp4-tools.ts"),F=A("./src/utils/typed-array.ts"),k=function(){function v(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var S=v.prototype;return S.resetInitSegment=function(T,E,g){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},S.resetTimeStamp=function(){},S.resetContiguity=function(){},S.canParse=function(T,E){return!1},S.appendFrame=function(T,E,g){},S.demux=function(T,E){this.cachedData&&(T=Object(j.appendUint8Array)(this.cachedData,T),this.cachedData=null);var g=I.getID3Data(T,0),u=g?g.length:0,a,s,l=this._audioTrack,w=this._id3Track,p=g?I.getTimeStamp(g):void 0,h=T.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=L(p,E)),g&&g.length>0&&w.samples.push({pts:this.initPTS,dts:this.initPTS,data:g}),s=this.initPTS;u<h;){if(this.canParse(T,u)){var C=this.appendFrame(l,T,u);C?(this.frameIndex++,s=C.sample.pts,u+=C.length,a=u):u=h}else I.canParse(T,u)?(g=I.getID3Data(T,u),w.samples.push({pts:s,dts:s,data:g}),u+=g.length,a=u):u++;if(u===h&&a!==h){var b=Object(F.sliceUint8)(T,a);this.cachedData?this.cachedData=Object(j.appendUint8Array)(this.cachedData,b):this.cachedData=b}}return{audioTrack:l,avcTrack:Object(R.dummyTrack)(),id3Track:w,textTrack:Object(R.dummyTrack)()}},S.demuxSampleAes=function(T,E,g){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},S.flush=function(T){var E=this.cachedData;return E&&(this.cachedData=null,this.demux(E,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(R.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(R.dummyTrack)()}},S.destroy=function(){},v}(),L=function(S,D){return Object(z.isFiniteNumber)(S)?S*90:D*9e4};G.default=k},"./src/demux/chunk-cache.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return z});var z=function(){function R(){this.chunks=[],this.dataLength=0}var j=R.prototype;return j.push=function(k){this.chunks.push(k),this.dataLength+=k.length},j.flush=function(){var k=this.chunks,L=this.dataLength,v;if(k.length)k.length===1?v=k[0]:v=I(k,L);else return new Uint8Array(0);return this.reset(),v},j.reset=function(){this.chunks.length=0,this.dataLength=0},R}();function I(R,j){for(var F=new Uint8Array(j),k=0,L=0;L<R.length;L++){var v=R[L];F.set(v,k),k+=v.length}return F}},"./src/demux/dummy-demuxed-track.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"dummyTrack",function(){return z});function z(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(te,G,A){"use strict";A.r(G);var z=A("./src/utils/logger.ts"),I=function(){function R(F){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=F,this.bytesAvailable=F.byteLength,this.word=0,this.bitsAvailable=0}var j=R.prototype;return j.loadWord=function(){var k=this.data,L=this.bytesAvailable,v=k.byteLength-L,S=new Uint8Array(4),D=Math.min(4,L);if(D===0)throw new Error("no bytes available");S.set(k.subarray(v,v+D)),this.word=new DataView(S.buffer).getUint32(0),this.bitsAvailable=D*8,this.bytesAvailable-=D},j.skipBits=function(k){var L;this.bitsAvailable>k?(this.word<<=k,this.bitsAvailable-=k):(k-=this.bitsAvailable,L=k>>3,k-=L>>3,this.bytesAvailable-=L,this.loadWord(),this.word<<=k,this.bitsAvailable-=k)},j.readBits=function(k){var L=Math.min(this.bitsAvailable,k),v=this.word>>>32-L;return k>32&&z.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=L,this.bitsAvailable>0?this.word<<=L:this.bytesAvailable>0&&this.loadWord(),L=k-L,L>0&&this.bitsAvailable?v<<L|this.readBits(L):v},j.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()},j.skipUEG=function(){this.skipBits(1+this.skipLZ())},j.skipEG=function(){this.skipBits(1+this.skipLZ())},j.readUEG=function(){var k=this.skipLZ();return this.readBits(k+1)-1},j.readEG=function(){var k=this.readUEG();return 1&k?1+k>>>1:-1*(k>>>1)},j.readBoolean=function(){return this.readBits(1)===1},j.readUByte=function(){return this.readBits(8)},j.readUShort=function(){return this.readBits(16)},j.readUInt=function(){return this.readBits(32)},j.skipScalingList=function(k){for(var L=8,v=8,S,D=0;D<k;D++)v!==0&&(S=this.readEG(),v=(L+S+256)%256),L=v===0?L:v},j.readSPS=function(){var k=0,L=0,v=0,S=0,D,T,E,g=this.readUByte.bind(this),u=this.readBits.bind(this),a=this.readUEG.bind(this),s=this.readBoolean.bind(this),l=this.skipBits.bind(this),w=this.skipEG.bind(this),p=this.skipUEG.bind(this),h=this.skipScalingList.bind(this);g();var C=g();if(u(5),l(3),g(),p(),C===100||C===110||C===122||C===244||C===44||C===83||C===86||C===118||C===128){var b=a();if(b===3&&l(1),p(),p(),l(1),s())for(T=b!==3?8:12,E=0;E<T;E++)s()&&(E<6?h(16):h(64))}p();var c=a();if(c===0)a();else if(c===1)for(l(1),w(),w(),D=a(),E=0;E<D;E++)w();p(),l(1);var f=a(),d=a(),o=u(1);o===0&&l(1),l(1),s()&&(k=a(),L=a(),v=a(),S=a());var y=[1,1];if(s()&&s()){var m=g();switch(m){case 1:y=[1,1];break;case 2:y=[12,11];break;case 3:y=[10,11];break;case 4:y=[16,11];break;case 5:y=[40,33];break;case 6:y=[24,11];break;case 7:y=[20,11];break;case 8:y=[32,11];break;case 9:y=[80,33];break;case 10:y=[18,11];break;case 11:y=[15,11];break;case 12:y=[64,33];break;case 13:y=[160,99];break;case 14:y=[4,3];break;case 15:y=[3,2];break;case 16:y=[2,1];break;case 255:{y=[g()<<8|g(),g()<<8|g()];break}}}return{width:Math.ceil((f+1)*16-k*2-L*2),height:(2-o)*(d+1)*16-(o?2:4)*(v+S),pixelRatio:y}},j.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},R}();G.default=I},"./src/demux/id3.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"isHeader",function(){return z}),A.d(G,"isFooter",function(){return I}),A.d(G,"getID3Data",function(){return R}),A.d(G,"canParse",function(){return F}),A.d(G,"getTimeStamp",function(){return k}),A.d(G,"isTimeStampFrame",function(){return L}),A.d(G,"getID3Frames",function(){return S}),A.d(G,"decodeFrame",function(){return D}),A.d(G,"utf8ArrayToStr",function(){return a}),A.d(G,"testables",function(){return s});var z=function(h,C){return C+10<=h.length&&(h[C]===73&&h[C+1]===68&&h[C+2]===51&&(h[C+3]<255&&h[C+4]<255&&(h[C+6]<128&&h[C+7]<128&&h[C+8]<128&&h[C+9]<128)))},I=function(h,C){return C+10<=h.length&&(h[C]===51&&h[C+1]===68&&h[C+2]===73&&(h[C+3]<255&&h[C+4]<255&&(h[C+6]<128&&h[C+7]<128&&h[C+8]<128&&h[C+9]<128)))},R=function(h,C){for(var b=C,c=0;z(h,C);){c+=10;var f=j(h,C+6);c+=f,I(h,C+10)&&(c+=10),C+=c}return c>0?h.subarray(b,b+c):void 0},j=function(h,C){var b=0;return b=(h[C]&127)<<21,b|=(h[C+1]&127)<<14,b|=(h[C+2]&127)<<7,b|=h[C+3]&127,b},F=function(h,C){return z(h,C)&&j(h,C+6)+10<=h.length-C},k=function(h){for(var C=S(h),b=0;b<C.length;b++){var c=C[b];if(L(c))return u(c)}return},L=function(h){return h&&h.key==="PRIV"&&h.info==="com.apple.streaming.transportStreamTimestamp"},v=function(h){var C=String.fromCharCode(h[0],h[1],h[2],h[3]),b=j(h,4),c=10;return{type:C,size:b,data:h.subarray(c,c+b)}},S=function(h){for(var C=0,b=[];z(h,C);){var c=j(h,C+6);C+=10;for(var f=C+c;C+8<f;){var d=v(h.subarray(C)),o=D(d);o&&b.push(o),C+=d.size+10}I(h,C)&&(C+=10)}return b},D=function(h){return h.type==="PRIV"?T(h):h.type[0]==="W"?g(h):E(h)},T=function(h){if(h.size<2)return;var C=a(h.data,!0),b=new Uint8Array(h.data.subarray(C.length+1));return{key:h.type,info:C,data:b.buffer}},E=function(h){if(h.size<2)return;if(h.type==="TXXX"){var C=1,b=a(h.data.subarray(C),!0);C+=b.length+1;var c=a(h.data.subarray(C));return{key:h.type,info:b,data:c}}var f=a(h.data.subarray(1));return{key:h.type,data:f}},g=function(h){if(h.type==="WXXX"){if(h.size<2)return;var C=1,b=a(h.data.subarray(C),!0);C+=b.length+1;var c=a(h.data.subarray(C));return{key:h.type,info:b,data:c}}var f=a(h.data);return{key:h.type,data:f}},u=function(h){if(h.data.byteLength===8){var C=new Uint8Array(h.data),b=C[3]&1,c=(C[4]<<23)+(C[5]<<15)+(C[6]<<7)+C[7];return c/=45,b&&(c+=4772185884e-2),Math.round(c)}return},a=function(h,C){C===void 0&&(C=!1);var b=w();if(b){var c=b.decode(h);if(C){var f=c.indexOf("\0");return f!==-1?c.substring(0,f):c}return c.replace(/\0/g,"")}for(var d=h.length,o,y,m,x="",P=0;P<d;){if(o=h[P++],o===0&&C)return x;if(o===0||o===3)continue;switch(o>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:x+=String.fromCharCode(o);break;case 12:case 13:y=h[P++],x+=String.fromCharCode((o&31)<<6|y&63);break;case 14:y=h[P++],m=h[P++],x+=String.fromCharCode((o&15)<<12|(y&63)<<6|(m&63)<<0);break;default:}}return x},s={decodeTextFrame:E},l;function w(){return!l&&typeof self.TextDecoder!="undefined"&&(l=new self.TextDecoder("utf-8")),l}},"./src/demux/mp3demuxer.ts":function(te,G,A){"use strict";A.r(G);var z=A("./src/demux/base-audio-demuxer.ts"),I=A("./src/demux/id3.ts"),R=A("./src/utils/logger.ts"),j=A("./src/demux/mpegaudio.ts");function F(v,S){v.prototype=Object.create(S.prototype),v.prototype.constructor=v,k(v,S)}function k(v,S){return k=Object.setPrototypeOf||function(T,E){return T.__proto__=E,T},k(v,S)}var L=function(v){F(S,v);function S(){return v.apply(this,arguments)||this}var D=S.prototype;return D.resetInitSegment=function(E,g,u){v.prototype.resetInitSegment.call(this,E,g,u),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:E,duration:u,inputTimeScale:9e4,dropped:0}},S.probe=function(E){if(!E)return!1;for(var g=I.getID3Data(E,0)||[],u=g.length,a=E.length;u<a;u++)if(j.probe(E,u))return R.logger.log("MPEG Audio sync word found !"),!0;return!1},D.canParse=function(E,g){return j.canParse(E,g)},D.appendFrame=function(E,g,u){return this.initPTS===null?void 0:j.appendFrame(E,g,u,this.initPTS,this.frameIndex)},S}(z.default);L.minProbeByteLength=4,G.default=L},"./src/demux/mp4demuxer.ts":function(te,G,A){"use strict";A.r(G);var z=A("./src/utils/mp4-tools.ts"),I=A("./src/demux/dummy-demuxed-track.ts"),R=function(){function j(k,L){this.remainderData=null,this.config=void 0,this.config=L}var F=j.prototype;return F.resetTimeStamp=function(){},F.resetInitSegment=function(){},F.resetContiguity=function(){},j.probe=function(L){return Object(z.findBox)({data:L,start:0,end:Math.min(L.length,16384)},["moof"]).length>0},F.demux=function(L){var v=L,S=Object(I.dummyTrack)();if(this.config.progressive){this.remainderData&&(v=Object(z.appendUint8Array)(this.remainderData,L));var D=Object(z.segmentValidRange)(v);this.remainderData=D.remainder,S.samples=D.valid||new Uint8Array}else S.samples=v;return{audioTrack:Object(I.dummyTrack)(),avcTrack:S,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},F.flush=function(){var L=Object(I.dummyTrack)();return L.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(I.dummyTrack)(),avcTrack:L,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},F.demuxSampleAes=function(L,v,S){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},F.destroy=function(){},j}();R.minProbeByteLength=1024,G.default=R},"./src/demux/mpegaudio.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"appendFrame",function(){return k}),A.d(G,"parseHeader",function(){return L}),A.d(G,"isHeaderPattern",function(){return v}),A.d(G,"isHeader",function(){return S}),A.d(G,"canParse",function(){return D}),A.d(G,"probe",function(){return T});var z=null,I=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],R=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],j=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],F=[0,1,1,4];function k(E,g,u,a,s){if(u+24>g.length)return;var l=L(g,u);if(l&&u+l.frameLength<=g.length){var w=l.samplesPerFrame*9e4/l.sampleRate,p=a+s*w,h={unit:g.subarray(u,u+l.frameLength),pts:p,dts:p};return E.config=[],E.channelCount=l.channelCount,E.samplerate=l.sampleRate,E.samples.push(h),{sample:h,length:l.frameLength,missing:0}}}function L(E,g){var u=E[g+1]>>3&3,a=E[g+1]>>1&3,s=E[g+2]>>4&15,l=E[g+2]>>2&3;if(u!==1&&s!==0&&s!==15&&l!==3){var w=E[g+2]>>1&1,p=E[g+3]>>6,h=u===3?3-a:a===3?3:4,C=I[h*14+s-1]*1e3,b=u===3?0:u===2?1:2,c=R[b*3+l],f=p===3?1:2,d=j[u][a],o=F[a],y=d*8*o,m=Math.floor(d*C/c+w)*o;if(z===null){var x=navigator.userAgent||"",P=x.match(/Chrome\/(\d+)/i);z=P?parseInt(P[1]):0}var U=!!z&&z<=87;return U&&a===2&&C>=224e3&&p===0&&(E[g+3]=E[g+3]|128),{sampleRate:c,channelCount:f,frameLength:m,samplesPerFrame:y}}}function v(E,g){return E[g]===255&&(E[g+1]&224)===224&&(E[g+1]&6)!==0}function S(E,g){return g+1<E.length&&v(E,g)}function D(E,g){var u=4;return v(E,g)&&u<=E.length-g}function T(E,g){if(g+1<E.length&&v(E,g)){var u=4,a=L(E,g),s=u;a!=null&&a.frameLength&&(s=a.frameLength);var l=g+s;return l===E.length||S(E,l)}return!1}},"./src/demux/sample-aes.ts":function(te,G,A){"use strict";A.r(G);var z=A("./src/crypt/decrypter.ts"),I=A("./src/demux/tsdemuxer.ts"),R=function(){function j(k,L,v){this.keyData=void 0,this.decrypter=void 0,this.keyData=v,this.decrypter=new z.default(k,L,{removePKCS7Padding:!1})}var F=j.prototype;return F.decryptBuffer=function(L,v){this.decrypter.decrypt(L,this.keyData.key.buffer,this.keyData.iv.buffer,v)},F.decryptAacSample=function(L,v,S,D){var T=L[v].unit,E=T.subarray(16,T.length-T.length%16),g=E.buffer.slice(E.byteOffset,E.byteOffset+E.length),u=this;this.decryptBuffer(g,function(a){var s=new Uint8Array(a);T.set(s,16),D||u.decryptAacSamples(L,v+1,S)})},F.decryptAacSamples=function(L,v,S){for(;;v++){if(v>=L.length){S();return}if(L[v].unit.length<32)continue;var D=this.decrypter.isSync();if(this.decryptAacSample(L,v,S,D),!D)return}},F.getAvcEncryptedData=function(L){for(var v=Math.floor((L.length-48)/160)*16+16,S=new Int8Array(v),D=0,T=32;T<=L.length-16;T+=160,D+=16)S.set(L.subarray(T,T+16),D);return S},F.getAvcDecryptedUnit=function(L,v){for(var S=new Uint8Array(v),D=0,T=32;T<=L.length-16;T+=160,D+=16)L.set(S.subarray(D,D+16),T);return L},F.decryptAvcSample=function(L,v,S,D,T,E){var g=Object(I.discardEPB)(T.data),u=this.getAvcEncryptedData(g),a=this;this.decryptBuffer(u.buffer,function(s){T.data=a.getAvcDecryptedUnit(g,s),E||a.decryptAvcSamples(L,v,S+1,D)})},F.decryptAvcSamples=function(L,v,S,D){if(L instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;v++,S=0){if(v>=L.length){D();return}for(var T=L[v].units;!(S>=T.length);S++){var E=T[S];if(E.data.length<=48||E.type!==1&&E.type!==5)continue;var g=this.decrypter.isSync();if(this.decryptAvcSample(L,v,S,D,E,g),!g)return}}},j}();G.default=R},"./src/demux/transmuxer-interface.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return T});var z=A("./node_modules/webworkify-webpack/index.js"),I=A.n(z),R=A("./src/events.ts"),j=A("./src/demux/transmuxer.ts"),F=A("./src/utils/logger.ts"),k=A("./src/errors.ts"),L=A("./src/utils/mediasource-helper.ts"),v=A("./node_modules/eventemitter3/index.js"),S=A.n(v),D=Object(L.getMediaSource)()||{isTypeSupported:function(){return!1}},T=function(){function E(u,a,s,l){var w=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=u,this.id=a,this.onTransmuxComplete=s,this.onFlush=l;var p=u.config,h=function(d,o){o=o||{},o.frag=w.frag,o.id=w.id,u.trigger(d,o)};this.observer=new v.EventEmitter,this.observer.on(R.Events.FRAG_DECRYPTED,h),this.observer.on(R.Events.ERROR,h);var C={mp4:D.isTypeSupported("video/mp4"),mpeg:D.isTypeSupported("audio/mpeg"),mp3:D.isTypeSupported('audio/mp4; codecs="mp3"')},b=navigator.vendor;if(p.enableWorker&&typeof Worker!="undefined"){F.logger.log("demuxing in webworker");var c;try{c=this.worker=z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),c.addEventListener("message",this.onwmsg),c.onerror=function(f){u.trigger(R.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(f.message+" ("+f.filename+":"+f.lineno+")")})},c.postMessage({cmd:"init",typeSupported:C,vendor:b,id:a,config:JSON.stringify(p)})}catch(f){F.logger.warn("Error in worker:",f),F.logger.error("Error while initializing DemuxerWorker, fallback to inline"),c&&self.URL.revokeObjectURL(c.objectURL),this.transmuxer=new j.default(this.observer,C,p,b,a),this.worker=null}}else this.transmuxer=new j.default(this.observer,C,p,b,a)}var g=E.prototype;return g.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var l=this.observer;l&&l.removeAllListeners(),this.observer=null},g.push=function(a,s,l,w,p,h,C,b,c,f){var d=this;c.transmuxing.start=self.performance.now();var o=this.transmuxer,y=this.worker,m=h?h.start:p.start,x=p.decryptdata,P=this.frag,U=!(P&&p.cc===P.cc),B=!(P&&c.level===P.level),W=P?c.sn-P.sn:-1,O=this.part?c.part-this.part.index:1,M=!B&&(W===1||W===0&&O===1),K=self.performance.now();(B||W||p.stats.parsing.start===0)&&(p.stats.parsing.start=K),h&&(O||!M)&&(h.stats.parsing.start=K);var X=new j.TransmuxState(U,M,b,B,m);if(!M||U){F.logger.log("[transmuxer-interface, "+p.type+"]: Starting new transmux session for sn: "+c.sn+" p: "+c.part+" level: "+c.level+" id: "+c.id+`
|
|
discontinuity: `+U+`
|
|
trackSwitch: `+B+`
|
|
contiguous: `+M+`
|
|
accurateTimeOffset: `+b+`
|
|
timeOffset: `+m);var ee=new j.TransmuxConfig(l,w,s,C,f);this.configureTransmuxer(ee)}if(this.frag=p,this.part=h,y)y.postMessage({cmd:"demux",data:a,decryptdata:x,chunkMeta:c,state:X},a instanceof ArrayBuffer?[a]:[]);else if(o){var oe=o.push(a,x,c,X);Object(j.isPromise)(oe)?oe.then(function(xe){d.handleTransmuxComplete(xe)}):this.handleTransmuxComplete(oe)}},g.flush=function(a){var s=this;a.transmuxing.start=self.performance.now();var l=this.transmuxer,w=this.worker;if(w)w.postMessage({cmd:"flush",chunkMeta:a});else if(l){var p=l.flush(a);Object(j.isPromise)(p)?p.then(function(h){s.handleFlushResult(h,a)}):this.handleFlushResult(p,a)}},g.handleFlushResult=function(a,s){var l=this;a.forEach(function(w){l.handleTransmuxComplete(w)}),this.onFlush(s)},g.onWorkerMessage=function(a){var s=a.data,l=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,l.trigger(s.event,s.data);break}}},g.configureTransmuxer=function(a){var s=this.worker,l=this.transmuxer;s?s.postMessage({cmd:"configure",config:a}):l&&l.configure(a)},g.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},E}()},"./src/demux/transmuxer-worker.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return k});var z=A("./src/demux/transmuxer.ts"),I=A("./src/events.ts"),R=A("./src/utils/logger.ts"),j=A("./node_modules/eventemitter3/index.js"),F=A.n(j);function k(T){var E=new j.EventEmitter,g=function(a,s){T.postMessage({event:a,data:s})};E.on(I.Events.FRAG_DECRYPTED,g),E.on(I.Events.ERROR,g),T.addEventListener("message",function(u){var a=u.data;switch(a.cmd){case"init":{var s=JSON.parse(a.config);T.transmuxer=new z.default(E,a.typeSupported,s,a.vendor,a.id),Object(R.enableLogs)(s.debug),g("init",null);break}case"configure":{T.transmuxer.configure(a.config);break}case"demux":{var l=T.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(z.isPromise)(l)?l.then(function(h){L(T,h)}):L(T,l);break}case"flush":{var w=a.chunkMeta,p=T.transmuxer.flush(w);Object(z.isPromise)(p)?p.then(function(h){S(T,h,w)}):S(T,p,w);break}default:break}})}function L(T,E){if(D(E.remuxResult))return;var g=[],u=E.remuxResult,a=u.audio,s=u.video;a&&v(g,a),s&&v(g,s),T.postMessage({event:"transmuxComplete",data:E},g)}function v(T,E){E.data1&&T.push(E.data1.buffer),E.data2&&T.push(E.data2.buffer)}function S(T,E,g){E.forEach(function(u){L(T,u)}),T.postMessage({event:"flush",data:g})}function D(T){return!T.audio&&!T.video&&!T.text&&!T.id3&&!T.initSegment}},"./src/demux/transmuxer.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return s}),A.d(G,"isPromise",function(){return p}),A.d(G,"TransmuxConfig",function(){return h}),A.d(G,"TransmuxState",function(){return C});var z=A("./src/events.ts"),I=A("./src/errors.ts"),R=A("./src/crypt/decrypter.ts"),j=A("./src/demux/aacdemuxer.ts"),F=A("./src/demux/mp4demuxer.ts"),k=A("./src/demux/tsdemuxer.ts"),L=A("./src/demux/mp3demuxer.ts"),v=A("./src/remux/mp4-remuxer.ts"),S=A("./src/remux/passthrough-remuxer.ts"),D=A("./src/demux/chunk-cache.ts"),T=A("./src/utils/mp4-tools.ts"),E=A("./src/utils/logger.ts"),g;try{g=self.performance.now.bind(self.performance)}catch(b){E.logger.debug("Unable to use Performance API on this environment"),g=self.Date.now}var u=[{demux:k.default,remux:v.default},{demux:F.default,remux:S.default},{demux:j.default,remux:v.default},{demux:L.default,remux:v.default}],a=1024;u.forEach(function(b){var c=b.demux;a=Math.max(a,c.minProbeByteLength)});var s=function(){function b(f,d,o,y,m){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new D.default,this.observer=f,this.typeSupported=d,this.config=o,this.vendor=y,this.id=m}var c=b.prototype;return c.configure=function(d){this.transmuxConfig=d,this.decrypter&&this.decrypter.reset()},c.push=function(d,o,y,m){var x=this,P=y.transmuxing;P.executeStart=g();var U=new Uint8Array(d),B=this.cache,W=this.config,O=this.currentTransmuxState,M=this.transmuxConfig;m&&(this.currentTransmuxState=m);var K=l(U,o);if(K&&K.method==="AES-128"){var X=this.getDecrypter();if(W.enableSoftwareAES){var ee=X.softwareDecrypt(U,K.key.buffer,K.iv.buffer);if(!ee)return P.executeEnd=g(),w(y);U=new Uint8Array(ee)}else return this.decryptionPromise=X.webCryptoDecrypt(U,K.key.buffer,K.iv.buffer).then(function(_e){var Le=x.push(_e,null,y);return x.decryptionPromise=null,Le}),this.decryptionPromise}var oe=m||O,xe=oe.contiguous,me=oe.discontinuity,ge=oe.trackSwitch,de=oe.accurateTimeOffset,se=oe.timeOffset,ne=M.audioCodec,he=M.videoCodec,$=M.defaultInitPts,ie=M.duration,Z=M.initSegmentData;if((me||ge)&&this.resetInitSegment(Z,ne,he,ie),me&&this.resetInitialTimestamp($),xe||this.resetContiguity(),this.needsProbing(U,me,ge)){if(B.dataLength){var Ee=B.flush();U=Object(T.appendUint8Array)(Ee,U)}this.configureTransmuxer(U,M)}var Se=this.transmux(U,K,se,de,y),ye=this.currentTransmuxState;return ye.contiguous=!0,ye.discontinuity=!1,ye.trackSwitch=!1,P.executeEnd=g(),Se},c.flush=function(d){var o=this,y=d.transmuxing;y.executeStart=g();var m=this.decrypter,x=this.cache,P=this.currentTransmuxState,U=this.decryptionPromise;if(U)return U.then(function(){return o.flush(d)});var B=[],W=P.timeOffset;if(m){var O=m.flush();O&&B.push(this.push(O,null,d))}var M=x.dataLength;x.reset();var K=this.demuxer,X=this.remuxer;if(!K||!X)return M>=a&&this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),y.executeEnd=g(),[w(d)];var ee=K.flush(W);return p(ee)?ee.then(function(oe){return o.flushRemux(B,oe,d),B}):(this.flushRemux(B,ee,d),B)},c.flushRemux=function(d,o,y){var m=o.audioTrack,x=o.avcTrack,P=o.id3Track,U=o.textTrack,B=this.currentTransmuxState,W=B.accurateTimeOffset,O=B.timeOffset;E.logger.log("[transmuxer.ts]: Flushed fragment "+y.sn+(y.part>-1?" p: "+y.part:"")+" of level "+y.level);var M=this.remuxer.remux(m,x,P,U,O,W,!0,this.id);d.push({remuxResult:M,chunkMeta:y}),y.transmuxing.executeEnd=g()},c.resetInitialTimestamp=function(d){var o=this.demuxer,y=this.remuxer;if(!o||!y)return;o.resetTimeStamp(d),y.resetTimeStamp(d)},c.resetContiguity=function(){var d=this.demuxer,o=this.remuxer;if(!d||!o)return;d.resetContiguity(),o.resetNextTimestamp()},c.resetInitSegment=function(d,o,y,m){var x=this.demuxer,P=this.remuxer;if(!x||!P)return;x.resetInitSegment(o,y,m),P.resetInitSegment(d,o,y)},c.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},c.transmux=function(d,o,y,m,x){var P;return o&&o.method==="SAMPLE-AES"?P=this.transmuxSampleAes(d,o,y,m,x):P=this.transmuxUnencrypted(d,y,m,x),P},c.transmuxUnencrypted=function(d,o,y,m){var x=this.demuxer.demux(d,o,!1,!this.config.progressive),P=x.audioTrack,U=x.avcTrack,B=x.id3Track,W=x.textTrack,O=this.remuxer.remux(P,U,B,W,o,y,!1,this.id);return{remuxResult:O,chunkMeta:m}},c.transmuxSampleAes=function(d,o,y,m,x){var P=this;return this.demuxer.demuxSampleAes(d,o,y).then(function(U){var B=P.remuxer.remux(U.audioTrack,U.avcTrack,U.id3Track,U.textTrack,y,m,!1,P.id);return{remuxResult:B,chunkMeta:x}})},c.configureTransmuxer=function(d,o){for(var y=this.config,m=this.observer,x=this.typeSupported,P=this.vendor,U=o.audioCodec,B=o.defaultInitPts,W=o.duration,O=o.initSegmentData,M=o.videoCodec,K,X=0,ee=u.length;X<ee;X++)if(u[X].demux.probe(d)){K=u[X];break}K||(E.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),K={demux:F.default,remux:S.default});var oe=this.demuxer,xe=this.remuxer,me=K.remux,ge=K.demux;(!xe||!(xe instanceof me))&&(this.remuxer=new me(m,y,x,P)),(!oe||!(oe instanceof ge))&&(this.demuxer=new ge(m,y,x),this.probe=ge.probe),this.resetInitSegment(O,U,M,W),this.resetInitialTimestamp(B)},c.needsProbing=function(d,o,y){return!this.demuxer||!this.remuxer||o||y},c.getDecrypter=function(){var d=this.decrypter;return d||(d=this.decrypter=new R.default(this.observer,this.config)),d},b}();function l(b,c){var f=null;return b.byteLength>0&&c!=null&&c.key!=null&&c.iv!==null&&c.method!=null&&(f=c),f}var w=function(c){return{remuxResult:{},chunkMeta:c}};function p(b){return"then"in b&&b.then instanceof Function}var h=function(c,f,d,o,y){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=c,this.videoCodec=f,this.initSegmentData=d,this.duration=o,this.defaultInitPts=y},C=function(c,f,d,o,y){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=c,this.contiguous=f,this.accurateTimeOffset=d,this.trackSwitch=o,this.timeOffset=y}},"./src/demux/tsdemuxer.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"discardEPB",function(){return w});var z=A("./src/demux/adts.ts"),I=A("./src/demux/mpegaudio.ts"),R=A("./src/demux/exp-golomb.ts"),j=A("./src/demux/id3.ts"),F=A("./src/demux/sample-aes.ts"),k=A("./src/events.ts"),L=A("./src/utils/mp4-tools.ts"),v=A("./src/utils/logger.ts"),S=A("./src/errors.ts"),D={video:1,audio:2,id3:3,text:4},T=function(){function p(C,b,c){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=C,this.config=b,this.typeSupported=c}p.probe=function(b){var c=p.syncOffset(b);return c<0?!1:(c&&v.logger.warn("MPEG2-TS detected but first sync word found @ offset "+c+", junk ahead ?"),!0)},p.syncOffset=function(b){for(var c=Math.min(1e3,b.length-3*188),f=0;f<c;){if(b[f]===71&&b[f+188]===71&&b[f+2*188]===71)return f;f++}return-1},p.createTrack=function(b,c){return{container:b==="video"||b==="audio"?"video/mp2t":void 0,type:b,id:D[b],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:b==="audio"?c:void 0}};var h=p.prototype;return h.resetInitSegment=function(b,c,f){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=p.createTrack("video",f),this._audioTrack=p.createTrack("audio",f),this._id3Track=p.createTrack("id3",f),this._txtTrack=p.createTrack("text",f),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=b,this.videoCodec=c,this._duration=f},h.resetTimeStamp=function(){},h.resetContiguity=function(){var b=this._audioTrack,c=this._avcTrack,f=this._id3Track;b&&(b.pesData=null),c&&(c.pesData=null),f&&(f.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},h.demux=function(b,c,f,d){f===void 0&&(f=!1),d===void 0&&(d=!1),f||(this.sampleAes=null);var o,y=this._avcTrack,m=this._audioTrack,x=this._id3Track,P=y.pid,U=y.pesData,B=m.pid,W=x.pid,O=m.pesData,M=x.pesData,K=!1,X=this.pmtParsed,ee=this._pmtId,oe=b.length;if(this.remainderData&&(b=Object(L.appendUint8Array)(this.remainderData,b),oe=b.length,this.remainderData=null),oe<188&&!d)return this.remainderData=b,{audioTrack:m,avcTrack:y,id3Track:x,textTrack:this._txtTrack};var xe=Math.max(0,p.syncOffset(b));oe-=(oe+xe)%188,oe<b.byteLength&&!d&&(this.remainderData=new Uint8Array(b.buffer,oe,b.buffer.byteLength-oe));for(var me=xe;me<oe;me+=188)if(b[me]===71){var ge=!!(b[me+1]&64),de=((b[me+1]&31)<<8)+b[me+2],se=(b[me+3]&48)>>4,ne=void 0;if(se>1){if(ne=me+5+b[me+4],ne===me+188)continue}else ne=me+4;switch(de){case P:ge&&(U&&(o=a(U))&&this.parseAVCPES(o,!1),U={data:[],size:0}),U&&(U.data.push(b.subarray(ne,me+188)),U.size+=me+188-ne);break;case B:ge&&(O&&(o=a(O))&&(m.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),O={data:[],size:0}),O&&(O.data.push(b.subarray(ne,me+188)),O.size+=me+188-ne);break;case W:ge&&(M&&(o=a(M))&&this.parseID3PES(o),M={data:[],size:0}),M&&(M.data.push(b.subarray(ne,me+188)),M.size+=me+188-ne);break;case 0:ge&&(ne+=b[ne]+1),ee=this._pmtId=g(b,ne);break;case ee:{ge&&(ne+=b[ne]+1);var he=u(b,ne,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,f);P=he.avc,P>0&&(y.pid=P),B=he.audio,B>0&&(m.pid=B,m.isAAC=he.isAAC),W=he.id3,W>0&&(x.pid=W),K&&!X&&(v.logger.log("reparse from beginning"),K=!1,me=xe-188),X=this.pmtParsed=!0;break}case 17:case 8191:break;default:K=!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"});y.pesData=U,m.pesData=O,x.pesData=M;var $={audioTrack:m,avcTrack:y,id3Track:x,textTrack:this._txtTrack};return d&&this.extractRemainingSamples($),$},h.flush=function(){var b=this.remainderData;this.remainderData=null;var c;return b?c=this.demux(b,-1,!1,!0):c={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(c),this.sampleAes?this.decrypt(c,this.sampleAes):c},h.extractRemainingSamples=function(b){var c=b.audioTrack,f=b.avcTrack,d=b.id3Track,o=f.pesData,y=c.pesData,m=d.pesData,x;o&&(x=a(o))?(this.parseAVCPES(x,!0),f.pesData=null):f.pesData=o,y&&(x=a(y))?(c.isAAC?this.parseAACPES(x):this.parseMPEGPES(x),c.pesData=null):(y!=null&&y.size&&v.logger.log("last AAC PES packet truncated,might overlap between fragments"),c.pesData=y),m&&(x=a(m))?(this.parseID3PES(x),d.pesData=null):d.pesData=m},h.demuxSampleAes=function(b,c,f){var d=this.demux(b,f,!0,!this.config.progressive),o=this.sampleAes=new F.default(this.observer,this.config,c);return this.decrypt(d,o)},h.decrypt=function(b,c){return new Promise(function(f){var d=b.audioTrack,o=b.avcTrack;d.samples&&d.isAAC?c.decryptAacSamples(d.samples,0,function(){o.samples?c.decryptAvcSamples(o.samples,0,0,function(){f(b)}):f(b)}):o.samples&&c.decryptAvcSamples(o.samples,0,0,function(){f(b)})})},h.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},h.parseAVCPES=function(b,c){var f=this,d=this._avcTrack,o=this.parseAVCNALu(b.data),y=!1,m=this.avcSample,x,P=!1;b.data=null,m&&o.length&&!d.audFound&&(s(m,d),m=this.avcSample=E(!1,b.pts,b.dts,"")),o.forEach(function(U){switch(U.type){case 1:{x=!0,m||(m=f.avcSample=E(!0,b.pts,b.dts,"")),y&&(m.debug+="NDR "),m.frame=!0;var B=U.data;if(P&&B.length>4){var W=new R.default(B).readSliceType();(W===2||W===4||W===7||W===9)&&(m.key=!0)}break}case 5:x=!0,m||(m=f.avcSample=E(!0,b.pts,b.dts,"")),y&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{x=!0,y&&m&&(m.debug+="SEI ");var O=new R.default(w(U.data));O.readUByte();for(var M=0,K=0,X=!1,ee=0;!X&&O.bytesAvailable>1;){M=0;do ee=O.readUByte(),M+=ee;while(ee===255);K=0;do ee=O.readUByte(),K+=ee;while(ee===255);if(M===4&&O.bytesAvailable!==0){X=!0;var oe=O.readUByte();if(oe===181){var xe=O.readUShort();if(xe===49){var me=O.readUInt();if(me===1195456820){var ge=O.readUByte();if(ge===3){for(var de=O.readUByte(),se=O.readUByte(),ne=31&de,he=[de,se],$=0;$<ne;$++)he.push(O.readUByte()),he.push(O.readUByte()),he.push(O.readUByte());l(f._txtTrack.samples,{type:3,pts:b.pts,bytes:he})}}}}}else if(M===5&&O.bytesAvailable!==0){if(X=!0,K>16){for(var ie=[],Z=0;Z<16;Z++)ie.push(O.readUByte().toString(16)),(Z===3||Z===5||Z===7||Z===9)&&ie.push("-");for(var Ee=K-16,Se=new Uint8Array(Ee),ye=0;ye<Ee;ye++)Se[ye]=O.readUByte();l(f._txtTrack.samples,{pts:b.pts,payloadType:M,uuid:ie.join(""),userData:Object(j.utf8ArrayToStr)(Se),userDataBytes:Se})}}else if(K<O.bytesAvailable)for(var _e=0;_e<K;_e++)O.readUByte()}break}case 7:if(x=!0,P=!0,y&&m&&(m.debug+="SPS "),!d.sps){var Le=new R.default(U.data),Ie=Le.readSPS();d.width=Ie.width,d.height=Ie.height,d.pixelRatio=Ie.pixelRatio,d.sps=[U.data],d.duration=f._duration;for(var Me=U.data.subarray(1,4),Ce="avc1.",we=0;we<3;we++){var Be=Me[we].toString(16);Be.length<2&&(Be="0"+Be),Ce+=Be}d.codec=Ce}break;case 8:x=!0,y&&m&&(m.debug+="PPS "),d.pps||(d.pps=[U.data]);break;case 9:x=!1,d.audFound=!0,m&&s(m,d),m=f.avcSample=E(!1,b.pts,b.dts,y?"AUD ":"");break;case 12:x=!1;break;default:x=!1,m&&(m.debug+="unknown NAL "+U.type+" ");break}if(m&&x){var Ke=m.units;Ke.push(U)}}),c&&m&&(s(m,d),this.avcSample=null)},h.getLastNalUnit=function(){var b,c=this.avcSample,f;if(!c||c.units.length===0){var d=this._avcTrack.samples;c=d[d.length-1]}if((b=c)!==null&&b!==void 0&&b.units){var o=c.units;f=o[o.length-1]}return f},h.parseAVCNALu=function(b){var c=b.byteLength,f=this._avcTrack,d=f.naluState||0,o=d,y=[],m=0,x,P,U,B=-1,W=0;for(d===-1&&(B=0,W=b[0]&31,d=0,m=1);m<c;){if(x=b[m++],!d){d=x?0:1;continue}if(d===1){d=x?0:2;continue}if(!x)d=3;else if(x===1){if(B>=0){var O={data:b.subarray(B,m-d-1),type:W};y.push(O)}else{var M=this.getLastNalUnit();if(M&&(o&&m<=4-o&&(M.state&&(M.data=M.data.subarray(0,M.data.byteLength-o))),P=m-d-1,P>0)){var K=new Uint8Array(M.data.byteLength+P);K.set(M.data,0),K.set(b.subarray(0,P),M.data.byteLength),M.data=K,M.state=0}}m<c?(U=b[m]&31,B=m,W=U,d=0):d=-1}else d=0}if(B>=0&&d>=0){var X={data:b.subarray(B,c),type:W,state:d};y.push(X)}if(y.length===0){var ee=this.getLastNalUnit();if(ee){var oe=new Uint8Array(ee.data.byteLength+b.byteLength);oe.set(ee.data,0),oe.set(b,ee.data.byteLength),ee.data=oe}}return f.naluState=d,y},h.parseAACPES=function(b){var c=0,f=this._audioTrack,d=this.aacOverFlow,o=b.data;if(d){this.aacOverFlow=null;var y=d.sample.unit.byteLength,m=Math.min(d.missing,y),x=y-m;d.sample.unit.set(o.subarray(0,m),x),f.samples.push(d.sample),c=d.missing}var P,U;for(P=c,U=o.length;P<U-1&&!z.isHeader(o,P);P++);if(P!==c){var B,W;if(P<U-1?(B="AAC PES did not start with ADTS header,offset:"+P,W=!1):(B="no ADTS header found in AAC PES",W=!0),v.logger.warn("parsing error:"+B),this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:B}),W)return}z.initTrackConfig(f,this.observer,o,P,this.audioCodec);var O;if(b.pts!==void 0)O=b.pts;else if(d){var M=z.getFrameDuration(f.samplerate);O=d.sample.pts+M}else{v.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var K=0;P<U;)if(z.isHeader(o,P)){if(P+5<U){var X=z.appendFrame(f,o,P,O,K);if(X)if(X.missing)this.aacOverFlow=X;else{P+=X.length,K++;continue}}break}else P++},h.parseMPEGPES=function(b){var c=b.data,f=c.length,d=0,o=0,y=b.pts;if(y===void 0){v.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<f;)if(I.isHeader(c,o)){var m=I.appendFrame(this._audioTrack,c,o,y,d);if(m)o+=m.length,d++;else break}else o++},h.parseID3PES=function(b){if(b.pts===void 0){v.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(b)},p}();T.minProbeByteLength=188;function E(p,h,C,b){return{key:p,frame:!1,pts:h,dts:C,units:[],debug:b,length:0}}function g(p,h){return(p[h+10]&31)<<8|p[h+11]}function u(p,h,C,b){var c={audio:-1,avc:-1,id3:-1,isAAC:!0},f=(p[h+1]&15)<<8|p[h+2],d=h+3+f-4,o=(p[h+10]&15)<<8|p[h+11];for(h+=12+o;h<d;){var y=(p[h+1]&31)<<8|p[h+2];switch(p[h]){case 207:if(!b){v.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:c.audio===-1&&(c.audio=y);break;case 21:c.id3===-1&&(c.id3=y);break;case 219:if(!b){v.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:c.avc===-1&&(c.avc=y);break;case 3:case 4:C?c.audio===-1&&(c.audio=y,c.isAAC=!1):v.logger.log("MPEG audio found, not supported in this browser");break;case 36:v.logger.warn("Unsupported HEVC stream type found");break;default:break}h+=((p[h+3]&15)<<8|p[h+4])+5}return c}function a(p){var h=0,C,b,c,f,d,o=p.data;if(!p||p.size===0)return null;for(;o[0].length<19&&o.length>1;){var y=new Uint8Array(o[0].length+o[1].length);y.set(o[0]),y.set(o[1],o[0].length),o[0]=y,o.splice(1,1)}C=o[0];var m=(C[0]<<16)+(C[1]<<8)+C[2];if(m===1){if(b=(C[4]<<8)+C[5],b&&b>p.size-6)return null;var x=C[7];x&192&&(f=(C[9]&14)*536870912+(C[10]&255)*4194304+(C[11]&254)*16384+(C[12]&255)*128+(C[13]&254)/2,x&64?(d=(C[14]&14)*536870912+(C[15]&255)*4194304+(C[16]&254)*16384+(C[17]&255)*128+(C[18]&254)/2,f-d>60*9e4&&(v.logger.warn(Math.round((f-d)/9e4)+"s delta between PTS and DTS, align them"),f=d)):d=f),c=C[8];var P=c+9;if(p.size<=P)return null;p.size-=P;for(var U=new Uint8Array(p.size),B=0,W=o.length;B<W;B++){C=o[B];var O=C.byteLength;if(P)if(P>O){P-=O;continue}else C=C.subarray(P),O-=P,P=0;U.set(C,h),h+=O}return b&&(b-=c+3),{data:U,pts:f,dts:d,len:b}}return null}function s(p,h){if(p.units.length&&p.frame){if(p.pts===void 0){var C=h.samples,b=C.length;if(b){var c=C[b-1];p.pts=c.pts,p.dts=c.dts}else{h.dropped++;return}}h.samples.push(p)}p.debug.length&&v.logger.log(p.pts+"/"+p.dts+":"+p.debug)}function l(p,h){var C=p.length;if(C>0){if(h.pts>=p[C-1].pts)p.push(h);else for(var b=C-1;b>=0;b--)if(h.pts<p[b].pts){p.splice(b,0,h);break}}else p.push(h)}function w(p){for(var h=p.byteLength,C=[],b=1;b<h-2;)p[b]===0&&p[b+1]===0&&p[b+2]===3?(C.push(b+2),b+=2):b++;if(C.length===0)return p;var c=h-C.length,f=new Uint8Array(c),d=0;for(b=0;b<c;d++,b++)d===C[0]&&(d++,C.shift()),f[b]=p[d];return f}G.default=T},"./src/errors.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"ErrorTypes",function(){return z}),A.d(G,"ErrorDetails",function(){return I});var z;(function(R){R.NETWORK_ERROR="networkError",R.MEDIA_ERROR="mediaError",R.KEY_SYSTEM_ERROR="keySystemError",R.MUX_ERROR="muxError",R.OTHER_ERROR="otherError"})(z||(z={}));var I;(function(R){R.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",R.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",R.KEY_SYSTEM_NO_SESSION="keySystemNoSession",R.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",R.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",R.MANIFEST_LOAD_ERROR="manifestLoadError",R.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",R.MANIFEST_PARSING_ERROR="manifestParsingError",R.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",R.LEVEL_EMPTY_ERROR="levelEmptyError",R.LEVEL_LOAD_ERROR="levelLoadError",R.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",R.LEVEL_SWITCH_ERROR="levelSwitchError",R.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",R.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",R.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",R.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",R.FRAG_LOAD_ERROR="fragLoadError",R.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",R.FRAG_DECRYPT_ERROR="fragDecryptError",R.FRAG_PARSING_ERROR="fragParsingError",R.REMUX_ALLOC_ERROR="remuxAllocError",R.KEY_LOAD_ERROR="keyLoadError",R.KEY_LOAD_TIMEOUT="keyLoadTimeOut",R.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",R.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",R.BUFFER_APPEND_ERROR="bufferAppendError",R.BUFFER_APPENDING_ERROR="bufferAppendingError",R.BUFFER_STALLED_ERROR="bufferStalledError",R.BUFFER_FULL_ERROR="bufferFullError",R.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",R.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",R.INTERNAL_EXCEPTION="internalException",R.INTERNAL_ABORTED="aborted",R.UNKNOWN="unknown"})(I||(I={}))},"./src/events.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"Events",function(){return z});var z;(function(I){I.MEDIA_ATTACHING="hlsMediaAttaching",I.MEDIA_ATTACHED="hlsMediaAttached",I.MEDIA_DETACHING="hlsMediaDetaching",I.MEDIA_DETACHED="hlsMediaDetached",I.BUFFER_RESET="hlsBufferReset",I.BUFFER_CODECS="hlsBufferCodecs",I.BUFFER_CREATED="hlsBufferCreated",I.BUFFER_APPENDING="hlsBufferAppending",I.BUFFER_APPENDED="hlsBufferAppended",I.BUFFER_EOS="hlsBufferEos",I.BUFFER_FLUSHING="hlsBufferFlushing",I.BUFFER_FLUSHED="hlsBufferFlushed",I.MANIFEST_LOADING="hlsManifestLoading",I.MANIFEST_LOADED="hlsManifestLoaded",I.MANIFEST_PARSED="hlsManifestParsed",I.LEVEL_SWITCHING="hlsLevelSwitching",I.LEVEL_SWITCHED="hlsLevelSwitched",I.LEVEL_LOADING="hlsLevelLoading",I.LEVEL_LOADED="hlsLevelLoaded",I.LEVEL_UPDATED="hlsLevelUpdated",I.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",I.LEVELS_UPDATED="hlsLevelsUpdated",I.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",I.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",I.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",I.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",I.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",I.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",I.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",I.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",I.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",I.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",I.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",I.CUES_PARSED="hlsCuesParsed",I.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",I.INIT_PTS_FOUND="hlsInitPtsFound",I.FRAG_LOADING="hlsFragLoading",I.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",I.FRAG_LOADED="hlsFragLoaded",I.FRAG_DECRYPTED="hlsFragDecrypted",I.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",I.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",I.FRAG_PARSING_METADATA="hlsFragParsingMetadata",I.FRAG_PARSED="hlsFragParsed",I.FRAG_BUFFERED="hlsFragBuffered",I.FRAG_CHANGED="hlsFragChanged",I.FPS_DROP="hlsFpsDrop",I.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",I.ERROR="hlsError",I.DESTROYING="hlsDestroying",I.KEY_LOADING="hlsKeyLoading",I.KEY_LOADED="hlsKeyLoaded",I.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",I.BACK_BUFFER_REACHED="hlsBackBufferReached"})(z||(z={}))},"./src/hls.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return p});var z=A("./node_modules/url-toolkit/src/url-toolkit.js"),I=A.n(z),R=A("./src/loader/playlist-loader.ts"),j=A("./src/loader/key-loader.ts"),F=A("./src/controller/id3-track-controller.ts"),k=A("./src/controller/latency-controller.ts"),L=A("./src/controller/level-controller.ts"),v=A("./src/controller/fragment-tracker.ts"),S=A("./src/controller/stream-controller.ts"),D=A("./src/is-supported.ts"),T=A("./src/utils/logger.ts"),E=A("./src/config.ts"),g=A("./node_modules/eventemitter3/index.js"),u=A.n(g),a=A("./src/events.ts"),s=A("./src/errors.ts");function l(h,C){for(var b=0;b<C.length;b++){var c=C[b];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(h,c.key,c)}}function w(h,C,b){return C&&l(h.prototype,C),b&&l(h,b),h}var p=function(){h.isSupported=function(){return Object(D.isSupported)()};function h(b){b===void 0&&(b={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new g.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 c=this.config=Object(E.mergeConfig)(h.DefaultConfig,b);this.userConfig=b,Object(T.enableLogs)(c.debug),this._autoLevelCapping=-1,c.progressive&&Object(E.enableStreamingMode)(c);var f=c.abrController,d=c.bufferController,o=c.capLevelController,y=c.fpsController,m=this.abrController=new f(this),x=this.bufferController=new d(this),P=this.capLevelController=new o(this),U=new y(this),B=new R.default(this),W=new j.default(this),O=new F.default(this),M=this.levelController=new L.default(this),K=new v.FragmentTracker(this),X=this.streamController=new S.default(this,K);P.setStreamController(X),U.setStreamController(X);var ee=[M,X];this.networkControllers=ee;var oe=[B,W,m,x,P,U,O,K];this.audioTrackController=this.createController(c.audioTrackController,null,ee),this.createController(c.audioStreamController,K,ee),this.subtitleTrackController=this.createController(c.subtitleTrackController,null,ee),this.createController(c.subtitleStreamController,K,ee),this.createController(c.timelineController,null,oe),this.emeController=this.createController(c.emeController,null,oe),this.cmcdController=this.createController(c.cmcdController,null,oe),this.latencyController=this.createController(k.default,null,oe),this.coreComponents=oe}var C=h.prototype;return C.createController=function(c,f,d){if(c){var o=f?new c(this,f):new c(this);return d&&d.push(o),o}return null},C.on=function(c,f,d){d===void 0&&(d=this),this._emitter.on(c,f,d)},C.once=function(c,f,d){d===void 0&&(d=this),this._emitter.once(c,f,d)},C.removeAllListeners=function(c){this._emitter.removeAllListeners(c)},C.off=function(c,f,d,o){d===void 0&&(d=this),this._emitter.off(c,f,d,o)},C.listeners=function(c){return this._emitter.listeners(c)},C.emit=function(c,f,d){return this._emitter.emit(c,f,d)},C.trigger=function(c,f){if(this.config.debug)return this.emit(c,c,f);try{return this.emit(c,c,f)}catch(d){T.logger.error("An internal error happened while handling event "+c+'. Error message: "'+d.message+'". Here is a stacktrace:',d),this.trigger(a.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:c,error:d})}return!1},C.listenerCount=function(c){return this._emitter.listenerCount(c)},C.destroy=function(){T.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(c){return c.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(c){return c.destroy()}),this.coreComponents.length=0},C.attachMedia=function(c){T.logger.log("attachMedia"),this._media=c,this.trigger(a.Events.MEDIA_ATTACHING,{media:c})},C.detachMedia=function(){T.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},C.loadSource=function(c){this.stopLoad();var f=this.media,d=this.url,o=this.url=z.buildAbsoluteURL(self.location.href,c,{alwaysNormalize:!0});T.logger.log("loadSource:"+o),f&&d&&d!==o&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(f)),this.trigger(a.Events.MANIFEST_LOADING,{url:c})},C.startLoad=function(c){c===void 0&&(c=-1),T.logger.log("startLoad("+c+")"),this.networkControllers.forEach(function(f){f.startLoad(c)})},C.stopLoad=function(){T.logger.log("stopLoad"),this.networkControllers.forEach(function(c){c.stopLoad()})},C.swapAudioCodec=function(){T.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},C.recoverMediaError=function(){T.logger.log("recoverMediaError");var c=this._media;this.detachMedia(),c&&this.attachMedia(c)},C.removeLevel=function(c,f){f===void 0&&(f=0),this.levelController.removeLevel(c,f)},w(h,[{key:"levels",get:function(){var c=this.levelController.levels;return c||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(c){T.logger.log("set currentLevel:"+c),this.loadLevel=c,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(c){T.logger.log("set nextLevel:"+c),this.levelController.manualLevel=c,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(c){T.logger.log("set loadLevel:"+c),this.levelController.manualLevel=c}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(c){this.levelController.nextLoadLevel=c}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(c){T.logger.log("set firstLevel:"+c),this.levelController.firstLevel=c}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(c){T.logger.log("set startLevel:"+c),c!==-1&&(c=Math.max(c,this.minAutoLevel)),this.levelController.startLevel=c}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(c){var f=!!c;f!==this.config.capLevelToPlayerSize&&(f?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=f)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(c){this._autoLevelCapping!==c&&(T.logger.log("set autoLevelCapping:"+c),this._autoLevelCapping=c)}},{key:"bandwidthEstimate",get:function(){var c=this.abrController.bwEstimator;return c?c.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var c=this.levels,f=this.config.minAutoBitrate;if(!c)return 0;for(var d=c.length,o=0;o<d;o++)if(c[o].maxBitrate>f)return o;return 0}},{key:"maxAutoLevel",get:function(){var c=this.levels,f=this.autoLevelCapping,d;return f===-1&&c&&c.length?d=c.length-1:d=f,d}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(c){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,c)}},{key:"audioTracks",get:function(){var c=this.audioTrackController;return c?c.audioTracks:[]}},{key:"audioTrack",get:function(){var c=this.audioTrackController;return c?c.audioTrack:-1},set:function(c){var f=this.audioTrackController;f&&(f.audioTrack=c)}},{key:"subtitleTracks",get:function(){var c=this.subtitleTrackController;return c?c.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var c=this.subtitleTrackController;return c?c.subtitleTrack:-1},set:function(c){var f=this.subtitleTrackController;f&&(f.subtitleTrack=c)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var c=this.subtitleTrackController;return c?c.subtitleDisplay:!1},set:function(c){var f=this.subtitleTrackController;f&&(f.subtitleDisplay=c)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(c){this.config.lowLatencyMode=c}},{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 a.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return h.defaultConfig?h.defaultConfig:E.hlsDefaultConfig},set:function(c){h.defaultConfig=c}}]),h}();p.defaultConfig=void 0},"./src/is-supported.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"isSupported",function(){return R}),A.d(G,"changeTypeSupported",function(){return j});var z=A("./src/utils/mediasource-helper.ts");function I(){return self.SourceBuffer||self.WebKitSourceBuffer}function R(){var F=Object(z.getMediaSource)();if(!F)return!1;var k=I(),L=F&&typeof F.isTypeSupported=="function"&&F.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),v=!k||k.prototype&&typeof k.prototype.appendBuffer=="function"&&typeof k.prototype.remove=="function";return!!L&&!!v}function j(){var F,k=I();return typeof(k==null||((F=k.prototype)===null||F===void 0)?void 0:F.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return T}),A.d(G,"LoadError",function(){return g});var z=A("./src/polyfills/number.ts"),I=A("./src/errors.ts");function R(u,a){u.prototype=Object.create(a.prototype),u.prototype.constructor=u,v(u,a)}function j(u){var a=typeof Map=="function"?new Map:void 0;return j=function(l){if(l===null||!L(l))return l;if(typeof l!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(l))return a.get(l);a.set(l,w)}function w(){return F(l,arguments,S(this).constructor)}return w.prototype=Object.create(l.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),v(w,l)},j(u)}function F(u,a,s){return k()?F=Reflect.construct:F=function(w,p,h){var C=[null];C.push.apply(C,p);var b=Function.bind.apply(w,C),c=new b;return h&&v(c,h.prototype),c},F.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(u){return!1}}function L(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function v(u,a){return v=Object.setPrototypeOf||function(l,w){return l.__proto__=w,l},v(u,a)}function S(u){return S=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},S(u)}var D=Math.pow(2,17),T=function(){function u(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var a=u.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(l,w){var p=this,h=l.url;if(!h)return Promise.reject(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,networkDetails:null},"Fragment does not have a "+(h?"part list":"url")));this.abort();var C=this.config,b=C.fLoader,c=C.loader;return new Promise(function(f,d){p.loader&&p.loader.destroy();var o=p.loader=l.loader=b?new b(C):new c(C),y=E(l),m={timeout:C.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:C.fragLoadingMaxRetryTimeout,highWaterMark:D};l.stats=o.stats,o.load(y,m,{onSuccess:function(P,U,B,W){p.resetLoader(l,o),f({frag:l,part:null,payload:P.data,networkDetails:W})},onError:function(P,U,B){p.resetLoader(l,o),d(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,response:P,networkDetails:B}))},onAbort:function(P,U,B){p.resetLoader(l,o),d(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,networkDetails:B}))},onTimeout:function(P,U,B){p.resetLoader(l,o),d(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,networkDetails:B}))},onProgress:function(P,U,B,W){w&&w({frag:l,part:null,payload:B,networkDetails:W})}})})},a.loadPart=function(l,w,p){var h=this;this.abort();var C=this.config,b=C.fLoader,c=C.loader;return new Promise(function(f,d){h.loader&&h.loader.destroy();var o=h.loader=l.loader=b?new b(C):new c(C),y=E(l,w),m={timeout:C.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:C.fragLoadingMaxRetryTimeout,highWaterMark:D};w.stats=o.stats,o.load(y,m,{onSuccess:function(P,U,B,W){h.resetLoader(l,o),h.updateStatsFromPart(l,w);var O={frag:l,part:w,payload:P.data,networkDetails:W};p(O),f(O)},onError:function(P,U,B){h.resetLoader(l,o),d(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,part:w,response:P,networkDetails:B}))},onAbort:function(P,U,B){l.stats.aborted=w.stats.aborted,h.resetLoader(l,o),d(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,part:w,networkDetails:B}))},onTimeout:function(P,U,B){h.resetLoader(l,o),d(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,part:w,networkDetails:B}))}})})},a.updateStatsFromPart=function(l,w){var p=l.stats,h=w.stats,C=h.total;if(p.loaded+=h.loaded,C){var b=Math.round(l.duration/w.duration),c=Math.min(Math.round(p.loaded/C),b),f=b-c,d=f*Math.round(p.loaded/c);p.total=p.loaded+d}else p.total=Math.max(p.loaded,p.total);var o=p.loading,y=h.loading;o.start?o.first+=y.first-y.start:(o.start=y.start,o.first=y.first),o.end=y.end},a.resetLoader=function(l,w){l.loader=null,this.loader===w&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),w.destroy()},u}();function E(u,a){a===void 0&&(a=null);var s=a||u,l={frag:u,part:a,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},w=s.byteRangeStartOffset,p=s.byteRangeEndOffset;return Object(z.isFiniteNumber)(w)&&Object(z.isFiniteNumber)(p)&&(l.rangeStart=w,l.rangeEnd=p),l}var g=function(u){R(a,u);function a(s){for(var l,w=arguments.length,p=new Array(w>1?w-1:0),h=1;h<w;h++)p[h-1]=arguments[h];return l=u.call.apply(u,[this].concat(p))||this,l.data=void 0,l.data=s,l}return a}(j(Error))},"./src/loader/fragment.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"ElementaryStreamTypes",function(){return T}),A.d(G,"BaseSegment",function(){return E}),A.d(G,"Fragment",function(){return g}),A.d(G,"Part",function(){return u});var z=A("./src/polyfills/number.ts"),I=A("./node_modules/url-toolkit/src/url-toolkit.js"),R=A.n(I),j=A("./src/utils/logger.ts"),F=A("./src/loader/level-key.ts"),k=A("./src/loader/load-stats.ts");function L(a,s){a.prototype=Object.create(s.prototype),a.prototype.constructor=a,v(a,s)}function v(a,s){return v=Object.setPrototypeOf||function(w,p){return w.__proto__=p,w},v(a,s)}function S(a,s){for(var l=0;l<s.length;l++){var w=s[l];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(a,w.key,w)}}function D(a,s,l){return s&&S(a.prototype,s),l&&S(a,l),a}var T;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(T||(T={}));var E=function(){function a(l){var w;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(w={},w[T.AUDIO]=null,w[T.VIDEO]=null,w[T.AUDIOVIDEO]=null,w),this.baseurl=l}var s=a.prototype;return s.setByteRange=function(w,p){var h=w.split("@",2),C=[];h.length===1?C[0]=p?p.byteRangeEndOffset:0:C[0]=parseInt(h[1]),C[1]=parseInt(h[0])+C[0],this._byteRange=C},D(a,[{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}}]),a}(),g=function(a){L(s,a);function s(w,p){var h;return h=a.call(this,p)||this,h._decryptdata=null,h.rawProgramDateTime=null,h.programDateTime=null,h.tagList=[],h.duration=0,h.sn=0,h.levelkey=void 0,h.type=void 0,h.loader=null,h.level=-1,h.cc=0,h.startPTS=void 0,h.endPTS=void 0,h.appendedPTS=void 0,h.startDTS=void 0,h.endDTS=void 0,h.start=0,h.deltaPTS=void 0,h.maxStartPTS=void 0,h.minEndPTS=void 0,h.stats=new k.LoadStats,h.urlId=0,h.data=void 0,h.bitrateTest=!1,h.title=null,h.initSegment=null,h.type=w,h}var l=s.prototype;return l.createInitializationVector=function(p){for(var h=new Uint8Array(16),C=12;C<16;C++)h[C]=p>>8*(15-C)&255;return h},l.setDecryptDataFromLevelKey=function(p,h){var C=p;return(p==null?void 0:p.method)==="AES-128"&&p.uri&&!p.iv&&(C=F.LevelKey.fromURI(p.uri),C.method=p.method,C.iv=this.createInitializationVector(h),C.keyFormat="identity"),C},l.setElementaryStreamInfo=function(p,h,C,b,c,f){f===void 0&&(f=!1);var d=this.elementaryStreams,o=d[p];if(!o){d[p]={startPTS:h,endPTS:C,startDTS:b,endDTS:c,partial:f};return}o.startPTS=Math.min(o.startPTS,h),o.endPTS=Math.max(o.endPTS,C),o.startDTS=Math.min(o.startDTS,b),o.endDTS=Math.max(o.endDTS,c)},l.clearElementaryStreamInfo=function(){var p=this.elementaryStreams;p[T.AUDIO]=null,p[T.VIDEO]=null,p[T.AUDIOVIDEO]=null},D(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var p=this.sn;typeof p!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&j.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),p=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,p)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(z.isFiniteNumber)(this.programDateTime))return null;var p=Object(z.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+p*1e3}},{key:"encrypted",get:function(){var p;return!!((p=this.decryptdata)!==null&&p!==void 0&&p.keyFormat&&this.decryptdata.uri)}}]),s}(E),u=function(a){L(s,a);function s(l,w,p,h,C){var b;b=a.call(this,p)||this,b.fragOffset=0,b.duration=0,b.gap=!1,b.independent=!1,b.relurl=void 0,b.fragment=void 0,b.index=void 0,b.stats=new k.LoadStats,b.duration=l.decimalFloatingPoint("DURATION"),b.gap=l.bool("GAP"),b.independent=l.bool("INDEPENDENT"),b.relurl=l.enumeratedString("URI"),b.fragment=w,b.index=h;var c=l.enumeratedString("BYTERANGE");return c&&b.setByteRange(c,C),C&&(b.fragOffset=C.fragOffset+C.duration),b}return D(s,[{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)}}]),s}(E)},"./src/loader/key-loader.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return j});var z=A("./src/events.ts"),I=A("./src/errors.ts"),R=A("./src/utils/logger.ts"),j=function(){function F(L){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=L,this._registerListeners()}var k=F.prototype;return k._registerListeners=function(){this.hls.on(z.Events.KEY_LOADING,this.onKeyLoading,this)},k._unregisterListeners=function(){this.hls.off(z.Events.KEY_LOADING,this.onKeyLoading)},k.destroy=function(){this._unregisterListeners();for(var v in this.loaders){var S=this.loaders[v];S&&S.destroy()}this.loaders={}},k.onKeyLoading=function(v,S){var D=S.frag,T=D.type,E=this.loaders[T];if(!D.decryptdata){R.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var g=D.decryptdata.uri;if(g!==this.decrypturl||this.decryptkey===null){var u=this.hls.config;if(E&&(R.logger.warn("abort previous key loader for type:"+T),E.abort()),!g){R.logger.warn("key uri is falsy");return}var a=u.loader,s=D.loader=this.loaders[T]=new a(u);this.decrypturl=g,this.decryptkey=null;var l={url:g,frag:D,responseType:"arraybuffer"},w={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:u.fragLoadingRetryDelay,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(l,w,p)}else this.decryptkey&&(D.decryptdata.key=this.decryptkey,this.hls.trigger(z.Events.KEY_LOADED,{frag:D}))},k.loadsuccess=function(v,S,D){var T=D.frag;if(!T.decryptdata){R.logger.error("after key load, decryptdata unset");return}this.decryptkey=T.decryptdata.key=new Uint8Array(v.data),T.loader=null,delete this.loaders[T.type],this.hls.trigger(z.Events.KEY_LOADED,{frag:T})},k.loaderror=function(v,S){var D=S.frag,T=D.loader;T&&T.abort(),delete this.loaders[D.type],this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:D,response:v})},k.loadtimeout=function(v,S){var D=S.frag,T=D.loader;T&&T.abort(),delete this.loaders[D.type],this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:D})},F}()},"./src/loader/level-details.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"LevelDetails",function(){return F});var z=A("./src/polyfills/number.ts");function I(k,L){for(var v=0;v<L.length;v++){var S=L[v];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(k,S.key,S)}}function R(k,L,v){return L&&I(k.prototype,L),v&&I(k,v),k}var j=10,F=function(){function k(v){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=v}var L=k.prototype;return L.reloaded=function(S){if(!S){this.advanced=!0,this.updated=!0;return}var D=this.lastPartSn-S.lastPartSn,T=this.lastPartIndex-S.lastPartIndex;this.updated=this.endSN!==S.endSN||!!T||!!D,this.advanced=this.endSN>S.endSN||D>0||D===0&&T>0,this.updated||this.advanced?this.misses=Math.floor(S.misses*.6):this.misses=S.misses+1,this.availabilityDelay=S.availabilityDelay},R(k,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(z.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||j}},{key:"drift",get:function(){var S=this.driftEndTime-this.driftStartTime;if(S>0){var D=this.driftEnd-this.driftStart;return D*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(te,G,A){"use strict";A.r(G),A.d(G,"LevelKey",function(){return F});var z=A("./node_modules/url-toolkit/src/url-toolkit.js"),I=A.n(z);function R(k,L){for(var v=0;v<L.length;v++){var S=L[v];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(k,S.key,S)}}function j(k,L,v){return L&&R(k.prototype,L),v&&R(k,v),k}var F=function(){k.fromURL=function(v,S){return new k(v,S)},k.fromURI=function(v){return new k(v)};function k(L,v){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,v?this._uri=Object(z.buildAbsoluteURL)(L,v,{alwaysNormalize:!0}):this._uri=L}return j(k,[{key:"uri",get:function(){return this._uri}}]),k}()},"./src/loader/load-stats.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"LoadStats",function(){return z});var z=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return s});var z=A("./src/polyfills/number.ts"),I=A("./node_modules/url-toolkit/src/url-toolkit.js"),R=A.n(I),j=A("./src/loader/fragment.ts"),F=A("./src/loader/level-details.ts"),k=A("./src/loader/level-key.ts"),L=A("./src/utils/attr-list.ts"),v=A("./src/utils/logger.ts"),S=A("./src/utils/codecs.ts"),D=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,T=/#EXT-X-MEDIA:(.*)/g,E=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),g=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("|")),u=/\.(mp4|m4s|m4v|m4a)$/i;function a(C){var b,c;return u.test((b=(c=I.parseURL(C))===null||c===void 0?void 0:c.path)!=null?b:"")}var s=function(){function C(){}return C.findGroup=function(c,f){for(var d=0;d<c.length;d++){var o=c[d];if(o.id===f)return o}},C.convertAVC1ToAVCOTI=function(c){var f=c.split(".");if(f.length>2){var d=f.shift()+".";return d+=parseInt(f.shift()).toString(16),d+=("000"+parseInt(f.shift()).toString(16)).substr(-4),d}return c},C.resolve=function(c,f){return I.buildAbsoluteURL(f,c,{alwaysNormalize:!0})},C.parseMasterPlaylist=function(c,f){var d=[],o={},y=!1;D.lastIndex=0;for(var m;(m=D.exec(c))!=null;)if(m[1]){var x=new L.AttrList(m[1]),P={attrs:x,bitrate:x.decimalInteger("AVERAGE-BANDWIDTH")||x.decimalInteger("BANDWIDTH"),name:x.NAME,url:C.resolve(m[2],f)},U=x.decimalResolution("RESOLUTION");U&&(P.width=U.width,P.height=U.height),l((x.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),P),P.videoCodec&&P.videoCodec.indexOf("avc1")!==-1&&(P.videoCodec=C.convertAVC1ToAVCOTI(P.videoCodec)),d.push(P)}else if(m[3]){var B=new L.AttrList(m[3]);B["DATA-ID"]&&(y=!0,o[B["DATA-ID"]]=B)}return{levels:d,sessionData:y?o:null}},C.parseMasterPlaylistMedia=function(c,f,d,o){o===void 0&&(o=[]);var y,m=[],x=0;for(T.lastIndex=0;(y=T.exec(c))!==null;){var P=new L.AttrList(y[1]);if(P.TYPE===d){var U={attrs:P,bitrate:0,id:x++,groupId:P["GROUP-ID"],instreamId:P["INSTREAM-ID"],name:P.NAME||P.LANGUAGE||"",type:d,default:P.bool("DEFAULT"),autoselect:P.bool("AUTOSELECT"),forced:P.bool("FORCED"),lang:P.LANGUAGE,url:P.URI?C.resolve(P.URI,f):""};if(o.length){var B=C.findGroup(o,U.groupId)||o[0];w(U,B,"audioCodec"),w(U,B,"textCodec")}m.push(U)}}return m},C.parseLevelPlaylist=function(c,f,d,o,y){var m=new F.LevelDetails(f),x=m.fragments,P=null,U=0,B=0,W=0,O=0,M=null,K=new j.Fragment(o,f),X,ee,oe,xe=-1,me=!1;for(E.lastIndex=0,m.m3u8=c;(X=E.exec(c))!==null;){me&&(me=!1,K=new j.Fragment(o,f),K.start=W,K.sn=U,K.cc=O,K.level=d,P&&(K.initSegment=P,K.rawProgramDateTime=P.rawProgramDateTime));var ge=X[1];if(ge){K.duration=parseFloat(ge);var de=(" "+X[2]).slice(1);K.title=de||null,K.tagList.push(de?["INF",ge,de]:["INF",ge])}else if(X[3])Object(z.isFiniteNumber)(K.duration)&&(K.start=W,oe&&(K.levelkey=oe),K.sn=U,K.level=d,K.cc=O,K.urlId=y,x.push(K),K.relurl=(" "+X[3]).slice(1),h(K,M),M=K,W+=K.duration,U++,B=0,me=!0);else if(X[4]){var se=(" "+X[4]).slice(1);M?K.setByteRange(se,M):K.setByteRange(se)}else if(X[5])K.rawProgramDateTime=(" "+X[5]).slice(1),K.tagList.push(["PROGRAM-DATE-TIME",K.rawProgramDateTime]),xe===-1&&(xe=x.length);else{if(X=X[0].match(g),!X){v.logger.warn("No matches on slow regex match for level playlist!");continue}for(ee=1;ee<X.length&&!(typeof X[ee]!="undefined");ee++);var ne=(" "+X[ee]).slice(1),he=(" "+X[ee+1]).slice(1),$=X[ee+2]?(" "+X[ee+2]).slice(1):"";switch(ne){case"PLAYLIST-TYPE":m.type=he.toUpperCase();break;case"MEDIA-SEQUENCE":U=m.startSN=parseInt(he);break;case"SKIP":{var ie=new L.AttrList(he),Z=ie.decimalInteger("SKIPPED-SEGMENTS");if(Object(z.isFiniteNumber)(Z)){m.skippedSegments=Z;for(var Ee=Z;Ee--;)x.unshift(null);U+=Z}var Se=ie.enumeratedString("RECENTLY-REMOVED-DATERANGES");Se&&(m.recentlyRemovedDateranges=Se.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(he);break;case"VERSION":m.version=parseInt(he);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(he||$)&&K.tagList.push($?[he,$]:[he]);break;case"DIS":O++;case"GAP":K.tagList.push([ne]);break;case"BITRATE":K.tagList.push([ne,he]);break;case"DISCONTINUITY-SEQ":O=parseInt(he);break;case"KEY":{var ye,_e=new L.AttrList(he),Le=_e.enumeratedString("METHOD"),Ie=_e.URI,Me=_e.hexadecimalInteger("IV"),Ce=_e.enumeratedString("KEYFORMATVERSIONS"),we=_e.enumeratedString("KEYID"),Be=(ye=_e.enumeratedString("KEYFORMAT"))!=null?ye:"identity",Ke=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ke.indexOf(Be)>-1){v.logger.warn("Keyformat "+Be+" is not supported from the manifest");continue}else if(Be!=="identity")continue;Le&&(oe=k.LevelKey.fromURL(f,Ie),Ie&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Le)>=0&&(oe.method=Le,oe.keyFormat=Be,we&&(oe.keyID=we),Ce&&(oe.keyFormatVersions=Ce),oe.iv=Me));break}case"START":{var Ue=new L.AttrList(he),Pe=Ue.decimalFloatingPoint("TIME-OFFSET");Object(z.isFiniteNumber)(Pe)&&(m.startTimeOffset=Pe);break}case"MAP":{var Ve=new L.AttrList(he);K.relurl=Ve.URI,Ve.BYTERANGE&&K.setByteRange(Ve.BYTERANGE),K.level=d,K.sn="initSegment",oe&&(K.levelkey=oe),K.initSegment=null,P=K,me=!0;break}case"SERVER-CONTROL":{var He=new L.AttrList(he);m.canBlockReload=He.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=He.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&He.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=He.optionalFloat("PART-HOLD-BACK",0),m.holdBack=He.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Xe=new L.AttrList(he);m.partTarget=Xe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ae=m.partList;Ae||(Ae=m.partList=[]);var qe=B>0?Ae[Ae.length-1]:void 0,Je=B++,Oe=new j.Part(new L.AttrList(he),K,f,Je,qe);Ae.push(Oe),K.duration+=Oe.duration;break}case"PRELOAD-HINT":{var Ne=new L.AttrList(he);m.preloadHint=Ne;break}case"RENDITION-REPORT":{var ve=new L.AttrList(he);m.renditionReports=m.renditionReports||[],m.renditionReports.push(ve);break}default:v.logger.warn("line parsed but not handled: "+X);break}}}M&&!M.relurl?(x.pop(),W-=M.duration,m.partList&&(m.fragmentHint=M)):m.partList&&(h(K,M),K.cc=O,m.fragmentHint=K);var ce=x.length,fe=x[0],J=x[ce-1];if(W+=m.skippedSegments*m.targetduration,W>0&&ce&&J){m.averagetargetduration=W/ce;var q=J.sn;m.endSN=q!=="initSegment"?q:0,fe&&(m.startCC=fe.cc,fe.initSegment||m.fragments.every(function(re){return re.relurl&&a(re.relurl)})&&(v.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),K=new j.Fragment(o,f),K.relurl=J.relurl,K.level=d,K.sn="initSegment",fe.initSegment=K,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(W+=m.fragmentHint.duration),m.totalduration=W,m.endCC=O,xe>0&&p(x,xe),m},C}();function l(C,b){["video","audio","text"].forEach(function(c){var f=C.filter(function(o){return Object(S.isCodecType)(o,c)});if(f.length){var d=f.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});b[c+"Codec"]=d.length>0?d[0]:f[0],C=C.filter(function(o){return f.indexOf(o)===-1})}}),b.unknownCodecs=C}function w(C,b,c){var f=b[c];f&&(C[c]=f)}function p(C,b){for(var c=C[b],f=b;f--;){var d=C[f];if(!d)return;d.programDateTime=c.programDateTime-d.duration*1e3,c=d}}function h(C,b){C.rawProgramDateTime?C.programDateTime=Date.parse(C.rawProgramDateTime):b!=null&&b.programDateTime&&(C.programDateTime=b.endProgramDateTime),Object(z.isFiniteNumber)(C.programDateTime)||(C.programDateTime=null,C.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(te,G,A){"use strict";A.r(G);var z=A("./src/polyfills/number.ts"),I=A("./src/events.ts"),R=A("./src/errors.ts"),j=A("./src/utils/logger.ts"),F=A("./src/utils/mp4-tools.ts"),k=A("./src/loader/m3u8-parser.ts"),L=A("./src/types/loader.ts"),v=A("./src/utils/attr-list.ts");function S(E){var g=E.type;switch(g){case L.PlaylistContextType.AUDIO_TRACK:return L.PlaylistLevelType.AUDIO;case L.PlaylistContextType.SUBTITLE_TRACK:return L.PlaylistLevelType.SUBTITLE;default:return L.PlaylistLevelType.MAIN}}function D(E,g){var u=E.url;return(u===void 0||u.indexOf("data:")===0)&&(u=g.url),u}var T=function(){function E(u){this.hls=void 0,this.loaders=Object.create(null),this.hls=u,this.registerListeners()}var g=E.prototype;return g.registerListeners=function(){var a=this.hls;a.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},g.unregisterListeners=function(){var a=this.hls;a.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(I.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},g.createInternalLoader=function(a){var s=this.hls.config,l=s.pLoader,w=s.loader,p=l||w,h=new p(s);return a.loader=h,this.loaders[a.type]=h,h},g.getInternalLoader=function(a){return this.loaders[a.type]},g.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},g.destroyInternalLoaders=function(){for(var a in this.loaders){var s=this.loaders[a];s&&s.destroy(),this.resetInternalLoader(a)}},g.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},g.onManifestLoading=function(a,s){var l=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:L.PlaylistContextType.MANIFEST,url:l,deliveryDirectives:null})},g.onLevelLoading=function(a,s){var l=s.id,w=s.level,p=s.url,h=s.deliveryDirectives;this.load({id:l,groupId:null,level:w,responseType:"text",type:L.PlaylistContextType.LEVEL,url:p,deliveryDirectives:h})},g.onAudioTrackLoading=function(a,s){var l=s.id,w=s.groupId,p=s.url,h=s.deliveryDirectives;this.load({id:l,groupId:w,level:null,responseType:"text",type:L.PlaylistContextType.AUDIO_TRACK,url:p,deliveryDirectives:h})},g.onSubtitleTrackLoading=function(a,s){var l=s.id,w=s.groupId,p=s.url,h=s.deliveryDirectives;this.load({id:l,groupId:w,level:null,responseType:"text",type:L.PlaylistContextType.SUBTITLE_TRACK,url:p,deliveryDirectives:h})},g.load=function(a){var s,l=this.hls.config,w=this.getInternalLoader(a);if(w){var p=w.context;if(p&&p.url===a.url){j.logger.trace("[playlist-loader]: playlist request ongoing");return}j.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),w.abort()}var h,C,b,c;switch(a.type){case L.PlaylistContextType.MANIFEST:h=l.manifestLoadingMaxRetry,C=l.manifestLoadingTimeOut,b=l.manifestLoadingRetryDelay,c=l.manifestLoadingMaxRetryTimeout;break;case L.PlaylistContextType.LEVEL:case L.PlaylistContextType.AUDIO_TRACK:case L.PlaylistContextType.SUBTITLE_TRACK:h=0,C=l.levelLoadingTimeOut;break;default:h=l.levelLoadingMaxRetry,C=l.levelLoadingTimeOut,b=l.levelLoadingRetryDelay,c=l.levelLoadingMaxRetryTimeout;break}if(w=this.createInternalLoader(a),(s=a.deliveryDirectives)!==null&&s!==void 0&&s.part){var f;if(a.type===L.PlaylistContextType.LEVEL&&a.level!==null?f=this.hls.levels[a.level].details:a.type===L.PlaylistContextType.AUDIO_TRACK&&a.id!==null?f=this.hls.audioTracks[a.id].details:a.type===L.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(f=this.hls.subtitleTracks[a.id].details),f){var d=f.partTarget,o=f.targetduration;d&&o&&(C=Math.min(Math.max(d*3,o*.8)*1e3,C))}}var y={timeout:C,maxRetry:h,retryDelay:b,maxRetryDelay:c,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};w.load(a,y,m)},g.loadsuccess=function(a,s,l,w){if(w===void 0&&(w=null),l.isSidxRequest){this.handleSidxRequest(a,l),this.handlePlaylistLoaded(a,s,l,w);return}this.resetInternalLoader(l.type);var p=a.data;if(p.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,l,"no EXTM3U delimiter",w);return}s.parsing.start=performance.now(),p.indexOf("#EXTINF:")>0||p.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,s,l,w):this.handleMasterPlaylist(a,s,l,w)},g.loaderror=function(a,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!1,a)},g.loadtimeout=function(a,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!0)},g.handleMasterPlaylist=function(a,s,l,w){var p=this.hls,h=a.data,C=D(a,l),b=k.default.parseMasterPlaylist(h,C),c=b.levels,f=b.sessionData;if(!c.length){this.handleManifestParsingError(a,l,"no level found in manifest",w);return}var d=c.map(function(U){return{id:U.attrs.AUDIO,audioCodec:U.audioCodec}}),o=c.map(function(U){return{id:U.attrs.SUBTITLES,textCodec:U.textCodec}}),y=k.default.parseMasterPlaylistMedia(h,C,"AUDIO",d),m=k.default.parseMasterPlaylistMedia(h,C,"SUBTITLES",o),x=k.default.parseMasterPlaylistMedia(h,C,"CLOSED-CAPTIONS");if(y.length){var P=y.some(function(U){return!U.url});!P&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(j.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),y.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new v.AttrList({}),bitrate:0,url:""}))}p.trigger(I.Events.MANIFEST_LOADED,{levels:c,audioTracks:y,subtitles:m,captions:x,url:C,stats:s,networkDetails:w,sessionData:f})},g.handleTrackOrLevelPlaylist=function(a,s,l,w){var p=this.hls,h=l.id,C=l.level,b=l.type,c=D(a,l),f=Object(z.isFiniteNumber)(h)?h:0,d=Object(z.isFiniteNumber)(C)?C:f,o=S(l),y=k.default.parseLevelPlaylist(a.data,c,d,o,f);if(!y.fragments.length){p.trigger(I.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:c,reason:"no fragments found in level",level:typeof l.level=="number"?l.level:void 0});return}if(b===L.PlaylistContextType.MANIFEST){var m={attrs:new v.AttrList({}),bitrate:0,details:y,name:"",url:c};p.trigger(I.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:c,stats:s,networkDetails:w,sessionData:null})}if(s.parsing.end=performance.now(),y.needSidxRanges){var x,P=(x=y.fragments[0].initSegment)===null||x===void 0?void 0:x.url;this.load({url:P,isSidxRequest:!0,type:b,level:C,levelDetails:y,id:h,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}l.levelDetails=y,this.handlePlaylistLoaded(a,s,l,w)},g.handleSidxRequest=function(a,s){var l=Object(F.parseSegmentIndex)(new Uint8Array(a.data));if(!l)return;var w=l.references,p=s.levelDetails;w.forEach(function(h,C){var b=h.info,c=p.fragments[C];c.byteRange.length===0&&c.setByteRange(String(1+b.end-b.start)+"@"+String(b.start)),c.initSegment&&c.initSegment.setByteRange(String(l.moovEndOffset)+"@0")})},g.handleManifestParsingError=function(a,s,l,w){this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===L.PlaylistContextType.MANIFEST,url:a.url,reason:l,response:a,context:s,networkDetails:w})},g.handleNetworkError=function(a,s,l,w){l===void 0&&(l=!1),j.logger.warn("[playlist-loader]: A network "+(l?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var p=R.ErrorDetails.UNKNOWN,h=!1,C=this.getInternalLoader(a);switch(a.type){case L.PlaylistContextType.MANIFEST:p=l?R.ErrorDetails.MANIFEST_LOAD_TIMEOUT:R.ErrorDetails.MANIFEST_LOAD_ERROR,h=!0;break;case L.PlaylistContextType.LEVEL:p=l?R.ErrorDetails.LEVEL_LOAD_TIMEOUT:R.ErrorDetails.LEVEL_LOAD_ERROR,h=!1;break;case L.PlaylistContextType.AUDIO_TRACK:p=l?R.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:R.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,h=!1;break;case L.PlaylistContextType.SUBTITLE_TRACK:p=l?R.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:R.ErrorDetails.SUBTITLE_LOAD_ERROR,h=!1;break}C&&this.resetInternalLoader(a.type);var b={type:R.ErrorTypes.NETWORK_ERROR,details:p,fatal:h,url:a.url,loader:C,context:a,networkDetails:s};w&&(b.response=w),this.hls.trigger(I.Events.ERROR,b)},g.handlePlaylistLoaded=function(a,s,l,w){var p=l.type,h=l.level,C=l.id,b=l.groupId,c=l.loader,f=l.levelDetails,d=l.deliveryDirectives;if(!(f!=null&&f.targetduration)){this.handleManifestParsingError(a,l,"invalid target duration",w);return}if(!c)return;f.live&&(c.getCacheAge&&(f.ageHeader=c.getCacheAge()||0),(!c.getCacheAge||isNaN(f.ageHeader))&&(f.ageHeader=0));switch(p){case L.PlaylistContextType.MANIFEST:case L.PlaylistContextType.LEVEL:this.hls.trigger(I.Events.LEVEL_LOADED,{details:f,level:h||0,id:C||0,stats:s,networkDetails:w,deliveryDirectives:d});break;case L.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(I.Events.AUDIO_TRACK_LOADED,{details:f,id:C||0,groupId:b||"",stats:s,networkDetails:w,deliveryDirectives:d});break;case L.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADED,{details:f,id:C||0,groupId:b||"",stats:s,networkDetails:w,deliveryDirectives:d});break}},E}();G.default=T},"./src/polyfills/number.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"isFiniteNumber",function(){return z}),A.d(G,"MAX_SAFE_INTEGER",function(){return I});var z=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},I=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(te,G,A){"use strict";A.r(G);var z=function(){function I(){}return I.getSilentFrame=function(j,F){switch(j){case"mp4a.40.2":if(F===1)return new Uint8Array([0,200,0,128,35,128]);if(F===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(F===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(F===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(F===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(F===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(F===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(F===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(F===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},I}();G.default=z},"./src/remux/mp4-generator.ts":function(te,G,A){"use strict";A.r(G);var z=Math.pow(2,32)-1,I=function(){function R(){}return R.init=function(){R.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var F;for(F in R.types)R.types.hasOwnProperty(F)&&(R.types[F]=[F.charCodeAt(0),F.charCodeAt(1),F.charCodeAt(2),F.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]),L=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);R.HDLR_TYPES={video:k,audio:L};var v=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),S=new Uint8Array([0,0,0,0,0,0,0,0]);R.STTS=R.STSC=R.STCO=S,R.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),R.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),R.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),R.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var D=new Uint8Array([105,115,111,109]),T=new Uint8Array([97,118,99,49]),E=new Uint8Array([0,0,0,1]);R.FTYP=R.box(R.types.ftyp,D,E,D,T),R.DINF=R.box(R.types.dinf,R.box(R.types.dref,v))},R.box=function(F){for(var k=8,L=arguments.length,v=new Array(L>1?L-1:0),S=1;S<L;S++)v[S-1]=arguments[S];for(var D=v.length,T=D;D--;)k+=v[D].byteLength;var E=new Uint8Array(k);for(E[0]=k>>24&255,E[1]=k>>16&255,E[2]=k>>8&255,E[3]=k&255,E.set(F,4),D=0,k=8;D<T;D++)E.set(v[D],k),k+=v[D].byteLength;return E},R.hdlr=function(F){return R.box(R.types.hdlr,R.HDLR_TYPES[F])},R.mdat=function(F){return R.box(R.types.mdat,F)},R.mdhd=function(F,k){k*=F;var L=Math.floor(k/(z+1)),v=Math.floor(k%(z+1));return R.box(R.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,F>>24&255,F>>16&255,F>>8&255,F&255,L>>24,L>>16&255,L>>8&255,L&255,v>>24,v>>16&255,v>>8&255,v&255,85,196,0,0]))},R.mdia=function(F){return R.box(R.types.mdia,R.mdhd(F.timescale,F.duration),R.hdlr(F.type),R.minf(F))},R.mfhd=function(F){return R.box(R.types.mfhd,new Uint8Array([0,0,0,0,F>>24,F>>16&255,F>>8&255,F&255]))},R.minf=function(F){return F.type==="audio"?R.box(R.types.minf,R.box(R.types.smhd,R.SMHD),R.DINF,R.stbl(F)):R.box(R.types.minf,R.box(R.types.vmhd,R.VMHD),R.DINF,R.stbl(F))},R.moof=function(F,k,L){return R.box(R.types.moof,R.mfhd(F),R.traf(L,k))},R.moov=function(F){for(var k=F.length,L=[];k--;)L[k]=R.trak(F[k]);return R.box.apply(null,[R.types.moov,R.mvhd(F[0].timescale,F[0].duration)].concat(L).concat(R.mvex(F)))},R.mvex=function(F){for(var k=F.length,L=[];k--;)L[k]=R.trex(F[k]);return R.box.apply(null,[R.types.mvex].concat(L))},R.mvhd=function(F,k){k*=F;var L=Math.floor(k/(z+1)),v=Math.floor(k%(z+1)),S=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,F>>24&255,F>>16&255,F>>8&255,F&255,L>>24,L>>16&255,L>>8&255,L&255,v>>24,v>>16&255,v>>8&255,v&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return R.box(R.types.mvhd,S)},R.sdtp=function(F){var k=F.samples||[],L=new Uint8Array(4+k.length),v,S;for(v=0;v<k.length;v++)S=k[v].flags,L[v+4]=S.dependsOn<<4|S.isDependedOn<<2|S.hasRedundancy;return R.box(R.types.sdtp,L)},R.stbl=function(F){return R.box(R.types.stbl,R.stsd(F),R.box(R.types.stts,R.STTS),R.box(R.types.stsc,R.STSC),R.box(R.types.stsz,R.STSZ),R.box(R.types.stco,R.STCO))},R.avc1=function(F){var k=[],L=[],v,S,D;for(v=0;v<F.sps.length;v++)S=F.sps[v],D=S.byteLength,k.push(D>>>8&255),k.push(D&255),k=k.concat(Array.prototype.slice.call(S));for(v=0;v<F.pps.length;v++)S=F.pps[v],D=S.byteLength,L.push(D>>>8&255),L.push(D&255),L=L.concat(Array.prototype.slice.call(S));var T=R.box(R.types.avcC,new Uint8Array([1,k[3],k[4],k[5],252|3,224|F.sps.length].concat(k).concat([F.pps.length]).concat(L))),E=F.width,g=F.height,u=F.pixelRatio[0],a=F.pixelRatio[1];return R.box(R.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,E>>8&255,E&255,g>>8&255,g&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]),T,R.box(R.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),R.box(R.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,a>>24,a>>16&255,a>>8&255,a&255])))},R.esds=function(F){var k=F.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(F.config).concat([6,1,2]))},R.mp4a=function(F){var k=F.samplerate;return R.box(R.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,F.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]),R.box(R.types.esds,R.esds(F)))},R.mp3=function(F){var k=F.samplerate;return R.box(R.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,F.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]))},R.stsd=function(F){return F.type==="audio"?!F.isAAC&&F.codec==="mp3"?R.box(R.types.stsd,R.STSD,R.mp3(F)):R.box(R.types.stsd,R.STSD,R.mp4a(F)):R.box(R.types.stsd,R.STSD,R.avc1(F))},R.tkhd=function(F){var k=F.id,L=F.duration*F.timescale,v=F.width,S=F.height,D=Math.floor(L/(z+1)),T=Math.floor(L%(z+1));return R.box(R.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,0,0,0,0,D>>24,D>>16&255,D>>8&255,D&255,T>>24,T>>16&255,T>>8&255,T&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,v>>8&255,v&255,0,0,S>>8&255,S&255,0,0]))},R.traf=function(F,k){var L=R.sdtp(F),v=F.id,S=Math.floor(k/(z+1)),D=Math.floor(k%(z+1));return R.box(R.types.traf,R.box(R.types.tfhd,new Uint8Array([0,0,0,0,v>>24,v>>16&255,v>>8&255,v&255])),R.box(R.types.tfdt,new Uint8Array([1,0,0,0,S>>24,S>>16&255,S>>8&255,S&255,D>>24,D>>16&255,D>>8&255,D&255])),R.trun(F,L.length+16+20+8+16+8+8),L)},R.trak=function(F){return F.duration=F.duration||4294967295,R.box(R.types.trak,R.tkhd(F),R.mdia(F))},R.trex=function(F){var k=F.id;return R.box(R.types.trex,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},R.trun=function(F,k){var L=F.samples||[],v=L.length,S=12+16*v,D=new Uint8Array(S),T,E,g,u,a,s;for(k+=8+S,D.set([0,0,15,1,v>>>24&255,v>>>16&255,v>>>8&255,v&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255],0),T=0;T<v;T++)E=L[T],g=E.duration,u=E.size,a=E.flags,s=E.cts,D.set([g>>>24&255,g>>>16&255,g>>>8&255,g&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*T);return R.box(R.types.trun,D)},R.initSegment=function(F){R.types||R.init();var k=R.moov(F),L=new Uint8Array(R.FTYP.byteLength+k.byteLength);return L.set(R.FTYP),L.set(k,R.FTYP.byteLength),L},R}();I.types=void 0,I.HDLR_TYPES=void 0,I.STTS=void 0,I.STSC=void 0,I.STCO=void 0,I.STSZ=void 0,I.VMHD=void 0,I.SMHD=void 0,I.STSD=void 0,I.FTYP=void 0,I.DINF=void 0,G.default=I},"./src/remux/mp4-remuxer.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return s}),A.d(G,"normalizePts",function(){return l});var z=A("./src/polyfills/number.ts"),I=A("./src/remux/aac-helper.ts"),R=A("./src/remux/mp4-generator.ts"),j=A("./src/events.ts"),F=A("./src/errors.ts"),k=A("./src/utils/logger.ts"),L=A("./src/types/loader.ts"),v=A("./src/utils/timescale-conversion.ts");function S(){return S=Object.assign||function(C){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(C[f]=c[f])}return C},S.apply(this,arguments)}var D=10*1e3,T=1024,E=1152,g=null,u=null,a=!1,s=function(){function C(c,f,d,o){if(o===void 0&&(o=""),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=c,this.config=f,this.typeSupported=d,this.ISGenerated=!1,g===null){var y=navigator.userAgent||"",m=y.match(/Chrome\/(\d+)/i);g=m?parseInt(m[1]):0}if(u===null){var x=navigator.userAgent.match(/Safari\/(\d+)/i);u=x?parseInt(x[1]):0}a=!!g&&g<75||!!u&&u<600}var b=C.prototype;return b.destroy=function(){},b.resetTimeStamp=function(f){k.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=f},b.resetNextTimestamp=function(){k.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},b.resetInitSegment=function(){k.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},b.getVideoStartPts=function(f){var d=!1,o=f.reduce(function(y,m){var x=m.pts-y;return x<-4294967296?(d=!0,l(y,m.pts)):x>0?y:m.pts},f[0].pts);return d&&k.logger.debug("PTS rollover detected"),o},b.remux=function(f,d,o,y,m,x,P,U){var B,W,O,M,K,X,ee=m,oe=m,xe=f.pid>-1,me=d.pid>-1,ge=d.samples.length,de=f.samples.length>0,se=ge>1,ne=(!xe||de)&&(!me||se)||this.ISGenerated||P;if(ne){this.ISGenerated||(O=this.generateIS(f,d,m));var he=this.isVideoContiguous,$=-1;if(se&&($=w(d.samples),!he&&this.config.forceKeyFrameOnDiscontinuity))if(X=!0,$>0){k.logger.warn("[mp4-remuxer]: Dropped "+$+" out of "+ge+" video samples due to a missing keyframe");var ie=this.getVideoStartPts(d.samples);d.samples=d.samples.slice($),d.dropped+=$,oe+=(d.samples[0].pts-ie)/(d.timescale||9e4)}else $===-1&&(k.logger.warn("[mp4-remuxer]: No keyframe found out of "+ge+" video samples"),X=!1);if(this.ISGenerated){if(de&&se){var Z=this.getVideoStartPts(d.samples),Ee=l(f.samples[0].pts,Z)-Z,Se=Ee/d.inputTimeScale;ee+=Math.max(0,Se),oe+=Math.max(0,-Se)}if(de){if(f.samplerate||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),O=this.generateIS(f,d,m)),W=this.remuxAudio(f,ee,this.isAudioContiguous,x,me||se||U===L.PlaylistLevelType.AUDIO?oe:void 0),se){var ye=W?W.endPTS-W.startPTS:0;d.inputTimeScale||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),O=this.generateIS(f,d,m)),B=this.remuxVideo(d,oe,he,ye)}}else se&&(B=this.remuxVideo(d,oe,he,0));B&&(B.firstKeyFrame=$,B.independent=$!==-1)}}return this.ISGenerated&&(o.samples.length&&(K=this.remuxID3(o,m)),y.samples.length&&(M=this.remuxText(y,m))),{audio:W,video:B,initSegment:O,independent:X,text:M,id3:K}},b.generateIS=function(f,d,o){var y=f.samples,m=d.samples,x=this.typeSupported,P={},U=!Object(z.isFiniteNumber)(this._initPTS),B="audio/mp4",W,O,M;if(U&&(W=O=Infinity),f.config&&y.length&&(f.timescale=f.samplerate,f.isAAC||(x.mpeg?(B="audio/mpeg",f.codec=""):x.mp3&&(f.codec="mp3")),P.audio={id:"audio",container:B,codec:f.codec,initSegment:!f.isAAC&&x.mpeg?new Uint8Array(0):R.default.initSegment([f]),metadata:{channelCount:f.channelCount}},U&&(M=f.inputTimeScale,W=O=y[0].pts-Math.round(M*o))),d.sps&&d.pps&&m.length&&(d.timescale=d.inputTimeScale,P.video={id:"main",container:"video/mp4",codec:d.codec,initSegment:R.default.initSegment([d]),metadata:{width:d.width,height:d.height}},U)){M=d.inputTimeScale;var K=this.getVideoStartPts(m),X=Math.round(M*o);O=Math.min(O,l(m[0].dts,K)-X),W=Math.min(W,K-X)}if(Object.keys(P).length)return this.ISGenerated=!0,U&&(this._initPTS=W,this._initDTS=O),{tracks:P,initPTS:W,timescale:M}},b.remuxVideo=function(f,d,o,y){var m=f.inputTimeScale,x=f.samples,P=[],U=x.length,B=this._initPTS,W=this.nextAvcDts,O=8,M,K,X,ee=Number.POSITIVE_INFINITY,oe=Number.NEGATIVE_INFINITY,xe=0,me=!1;if(!o||W===null){var ge=d*m,de=x[0].pts-l(x[0].dts,x[0].pts);W=ge-de}for(var se=0;se<U;se++){var ne=x[se];if(ne.pts=l(ne.pts-B,W),ne.dts=l(ne.dts-B,W),ne.dts>ne.pts){var he=9e4*.2;xe=Math.max(Math.min(xe,ne.pts-ne.dts),-1*he)}ne.dts<x[se>0?se-1:se].dts&&(me=!0)}me&&x.sort(function(xt,ht){var st=xt.dts-ht.dts,wt=xt.pts-ht.pts;return st||wt}),K=x[0].dts,X=x[x.length-1].dts;var $=Math.round((X-K)/(U-1));if(xe<0){if(xe<$*-2){k.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(v.toMsFromMpegTsClock)(-$,!0)+" ms");for(var ie=xe,Z=0;Z<U;Z++)x[Z].dts=ie=Math.max(ie,x[Z].pts-$),x[Z].pts=Math.max(ie,x[Z].pts)}else{k.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(v.toMsFromMpegTsClock)(xe,!0)+" ms to overcome this issue");for(var Ee=0;Ee<U;Ee++)x[Ee].dts=x[Ee].dts+xe}K=x[0].dts}if(o){var Se=K-W,ye=Se>$,_e=Se<-1;if(ye||_e){ye?k.logger.warn("AVC: "+Object(v.toMsFromMpegTsClock)(Se,!0)+" ms ("+Se+"dts) hole between fragments detected, filling it"):k.logger.warn("AVC: "+Object(v.toMsFromMpegTsClock)(-Se,!0)+" ms ("+Se+"dts) overlapping between fragments detected"),K=W;var Le=x[0].pts-Se;x[0].dts=K,x[0].pts=Le,k.logger.log("Video: First PTS/DTS adjusted: "+Object(v.toMsFromMpegTsClock)(Le,!0)+"/"+Object(v.toMsFromMpegTsClock)(K,!0)+", delta: "+Object(v.toMsFromMpegTsClock)(Se,!0)+" ms")}}a&&(K=Math.max(0,K));for(var Ie=0,Me=0,Ce=0;Ce<U;Ce++){for(var we=x[Ce],Be=we.units,Ke=Be.length,Ue=0,Pe=0;Pe<Ke;Pe++)Ue+=Be[Pe].data.length;Me+=Ue,Ie+=Ke,we.length=Ue,we.dts=Math.max(we.dts,K),we.pts=Math.max(we.pts,we.dts,0),ee=Math.min(we.pts,ee),oe=Math.max(we.pts,oe)}X=x[U-1].dts;var Ve=Me+4*Ie+8,He;try{He=new Uint8Array(Ve)}catch(xt){this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:F.ErrorTypes.MUX_ERROR,details:F.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ve,reason:"fail allocating video mdat "+Ve});return}var Xe=new DataView(He.buffer);Xe.setUint32(0,Ve),He.set(R.default.types.mdat,4);for(var Ae=0;Ae<U;Ae++){for(var qe=x[Ae],Je=qe.units,Oe=0,Ne=0,ve=Je.length;Ne<ve;Ne++){var ce=Je[Ne],fe=ce.data,J=ce.data.byteLength;Xe.setUint32(O,J),O+=4,He.set(fe,O),O+=J,Oe+=4+J}if(Ae<U-1)M=x[Ae+1].dts-qe.dts;else{var q=this.config,re=qe.dts-x[Ae>0?Ae-1:Ae].dts;if(q.stretchShortVideoTrack&&this.nextAudioPts!==null){var le=Math.floor(q.maxBufferHole*m),pe=(y?ee+y*m:this.nextAudioPts)-qe.pts;pe>le?(M=pe-re,M<0&&(M=re),k.logger.log("[mp4-remuxer]: It is approximately "+pe/90+" ms to the next segment; using duration "+M/90+" ms for the last video frame.")):M=re}else M=re}var De=Math.round(qe.pts-qe.dts);P.push(new p(qe.key,M,Oe,De))}if(P.length&&g&&g<70){var ke=P[0].flags;ke.dependsOn=2,ke.isNonSync=0}console.assert(M!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=X+M,this.isVideoContiguous=!0;var Qe=R.default.moof(f.sequenceNumber++,K,S({},f,{samples:P})),at="video",rt={data1:Qe,data2:He,startPTS:ee/m,endPTS:(oe+M)/m,startDTS:K/m,endDTS:W/m,type:at,hasAudio:!1,hasVideo:!0,nb:P.length,dropped:f.dropped};return f.samples=[],f.dropped=0,console.assert(He.length,"MDAT length must not be zero"),rt},b.remuxAudio=function(f,d,o,y,m){var x=f.inputTimeScale,P=f.samplerate?f.samplerate:x,U=x/P,B=f.isAAC?T:E,W=B*U,O=this._initPTS,M=!f.isAAC&&this.typeSupported.mpeg,K=[],X=f.samples,ee=M?0:8,oe=this.nextAudioPts||-1,xe=d*x;if(this.isAudioContiguous=o=o||X.length&&oe>0&&(y&&Math.abs(xe-oe)<9e3||Math.abs(l(X[0].pts-O,xe)-oe)<20*W),X.forEach(function(fe){fe.pts=l(fe.pts-O,xe)}),!o||oe<0){if(X=X.filter(function(fe){return fe.pts>=0}),!X.length)return;m===0?oe=0:y?oe=Math.max(0,xe):oe=X[0].pts}if(f.isAAC)for(var me=m!==void 0,ge=this.config.maxAudioFramesDrift,de=0,se=oe;de<X.length;de++){var ne=X[de],he=ne.pts,$=he-se,ie=Math.abs(1e3*$/x);if($<=-ge*W&&me)de===0&&(k.logger.warn("Audio frame @ "+(he/x).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*$/x)+" ms."),this.nextAudioPts=oe=se=he);else if($>=ge*W&&ie<D&&me){var Z=Math.round($/W);se=he-Z*W,se<0&&(Z--,se+=W),de===0&&(this.nextAudioPts=oe=se),k.logger.warn("[mp4-remuxer]: Injecting "+Z+" audio frame @ "+(se/x).toFixed(3)+"s due to "+Math.round(1e3*$/x)+" ms gap.");for(var Ee=0;Ee<Z;Ee++){var Se=Math.max(se,0),ye=I.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);ye||(k.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ye=ne.unit.subarray()),X.splice(de,0,{unit:ye,pts:Se}),se+=W,de++}}ne.pts=se,se+=W}for(var _e=null,Le=null,Ie,Me=0,Ce=X.length;Ce--;)Me+=X[Ce].unit.byteLength;for(var we=0,Be=X.length;we<Be;we++){var Ke=X[we],Ue=Ke.unit,Pe=Ke.pts;if(Le!==null){var Ve=K[we-1];Ve.duration=Math.round((Pe-Le)/U)}else if(o&&f.isAAC&&(Pe=oe),_e=Pe,Me>0){Me+=ee;try{Ie=new Uint8Array(Me)}catch(fe){this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:F.ErrorTypes.MUX_ERROR,details:F.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Me,reason:"fail allocating audio mdat "+Me});return}if(!M){var He=new DataView(Ie.buffer);He.setUint32(0,Me),Ie.set(R.default.types.mdat,4)}}else return;Ie.set(Ue,ee);var Xe=Ue.byteLength;ee+=Xe,K.push(new p(!0,B,Xe,0)),Le=Pe}var Ae=K.length;if(!Ae)return;var qe=K[K.length-1];this.nextAudioPts=oe=Le+U*qe.duration;var Je=M?new Uint8Array(0):R.default.moof(f.sequenceNumber++,_e/U,S({},f,{samples:K}));f.samples=[];var Oe=_e/x,Ne=oe/x,ve="audio",ce={data1:Je,data2:Ie,startPTS:Oe,endPTS:Ne,startDTS:Oe,endDTS:Ne,type:ve,hasAudio:!0,hasVideo:!1,nb:Ae};return this.isAudioContiguous=!0,console.assert(Ie.length,"MDAT length must not be zero"),ce},b.remuxEmptyAudio=function(f,d,o,y){var m=f.inputTimeScale,x=f.samplerate?f.samplerate:m,P=m/x,U=this.nextAudioPts,B=(U!==null?U:y.startDTS*m)+this._initDTS,W=y.endDTS*m+this._initDTS,O=P*T,M=Math.ceil((W-B)/O),K=I.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);if(k.logger.warn("[mp4-remuxer]: remux empty Audio"),!K){k.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var X=[],ee=0;ee<M;ee++){var oe=B+ee*O;X.push({unit:K,pts:oe,dts:oe})}return f.samples=X,this.remuxAudio(f,d,o,!1)},b.remuxID3=function(f,d){var o=f.samples.length;if(!o)return;for(var y=f.inputTimeScale,m=this._initPTS,x=this._initDTS,P=0;P<o;P++){var U=f.samples[P];U.pts=l(U.pts-m,d*y)/y,U.dts=l(U.dts-x,d*y)/y}var B=f.samples;return f.samples=[],{samples:B}},b.remuxText=function(f,d){var o=f.samples.length;if(!o)return;for(var y=f.inputTimeScale,m=this._initPTS,x=0;x<o;x++){var P=f.samples[x];P.pts=l(P.pts-m,d*y)/y}f.samples.sort(function(B,W){return B.pts-W.pts});var U=f.samples;return f.samples=[],{samples:U}},C}();function l(C,b){var c;if(b===null)return C;for(b<C?c=-8589934592:c=8589934592;Math.abs(C-b)>4294967296;)C+=c;return C}function w(C){for(var b=0;b<C.length;b++)if(C[b].key)return b;return-1}var p=function(b,c,f,d){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=c,this.size=f,this.cts=d,this.flags=new h(b)},h=function(b){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=b?2:1,this.isNonSync=b?0:1}},"./src/remux/passthrough-remuxer.ts":function(te,G,A){"use strict";A.r(G);var z=A("./src/polyfills/number.ts"),I=A("./src/utils/mp4-tools.ts"),R=A("./src/loader/fragment.ts"),j=A("./src/utils/logger.ts"),F=function(){function v(){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=v.prototype;return S.destroy=function(){},S.resetTimeStamp=function(T){this.initPTS=T,this.lastEndDTS=null},S.resetNextTimestamp=function(){this.lastEndDTS=null},S.resetInitSegment=function(T,E,g){this.audioCodec=E,this.videoCodec=g,this.generateInitSegment(T),this.emitInitSegment=!0},S.generateInitSegment=function(T){var E=this.audioCodec,g=this.videoCodec;if(!T||!T.byteLength){this.initTracks=void 0,this.initData=void 0;return}var u=this.initData=Object(I.parseInitSegment)(T);E||(E=L(u.audio,R.ElementaryStreamTypes.AUDIO)),g||(g=L(u.video,R.ElementaryStreamTypes.VIDEO));var a={};u.audio&&u.video?a.audiovideo={container:"video/mp4",codec:E+","+g,initSegment:T,id:"main"}:u.audio?a.audio={container:"audio/mp4",codec:E,initSegment:T,id:"audio"}:u.video?a.video={container:"video/mp4",codec:g,initSegment:T,id:"main"}:j.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},S.remux=function(T,E,g,u,a){var s=this.initPTS,l=this.lastEndDTS,w={audio:void 0,video:void 0,text:u,id3:g,initSegment:void 0};Object(z.isFiniteNumber)(l)||(l=this.lastEndDTS=a||0);var p=E.samples;if(!p||!p.length)return w;var h={initPTS:void 0,timescale:1},C=this.initData;if((!C||!C.length)&&(this.generateInitSegment(p),C=this.initData),!C||!C.length)return j.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),w;this.emitInitSegment&&(h.tracks=this.initTracks,this.emitInitSegment=!1),Object(z.isFiniteNumber)(s)||(this.initPTS=h.initPTS=s=k(C,p,l));var b=Object(I.getDuration)(p,C),c=l,f=b+c;Object(I.offsetStartDTS)(C,p,s),b>0?this.lastEndDTS=f:(j.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!C.audio,o=!!C.video,y="";d&&(y+="audio"),o&&(y+="video");var m={data1:p,startPTS:c,startDTS:c,endPTS:f,endDTS:f,type:y,hasAudio:d,hasVideo:o,nb:1,dropped:0};return w.audio=m.type==="audio"?m:void 0,w.video=m.type!=="audio"?m:void 0,w.text=u,w.id3=g,w.initSegment=h,w},v}(),k=function(S,D,T){return Object(I.getStartDTS)(S,D)-T};function L(v,S){var D=v==null?void 0:v.codec;return D&&D.length>4?D:D==="hvc1"?"hvc1.1.c.L120.90":D==="av01"?"av01.0.04M.08":D==="avc1"||S===R.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}G.default=F},"./src/task-loop.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return z});var z=function(){function I(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var R=I.prototype;return R.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},R.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},R.onHandlerDestroyed=function(){},R.hasInterval=function(){return!!this._tickInterval},R.hasNextTick=function(){return!!this._tickTimer},R.setInterval=function(F){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,F),!0)},R.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},R.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},R.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},R.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},R.doTick=function(){},I}()},"./src/types/cmcd.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"CMCDVersion",function(){return z}),A.d(G,"CMCDObjectType",function(){return I}),A.d(G,"CMCDStreamingFormat",function(){return R}),A.d(G,"CMCDStreamType",function(){return j});var z=1,I;(function(F){F.MANIFEST="m",F.AUDIO="a",F.VIDEO="v",F.MUXED="av",F.INIT="i",F.CAPTION="c",F.TIMED_TEXT="tt",F.KEY="k",F.OTHER="o"})(I||(I={}));var R;(function(F){F.DASH="d",F.HLS="h",F.SMOOTH="s",F.OTHER="o"})(R||(R={}));var j;(function(F){F.VOD="v",F.LIVE="l"})(j||(j={}))},"./src/types/level.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"HlsSkip",function(){return R}),A.d(G,"getSkipValue",function(){return j}),A.d(G,"HlsUrlParameters",function(){return F}),A.d(G,"Level",function(){return k});function z(L,v){for(var S=0;S<v.length;S++){var D=v[S];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(L,D.key,D)}}function I(L,v,S){return v&&z(L.prototype,v),S&&z(L,S),L}var R;(function(L){L.No="",L.Yes="YES",L.v2="v2"})(R||(R={}));function j(L,v){var S=L.canSkipUntil,D=L.canSkipDateRanges,T=L.endSN,E=v!==void 0?v-T:0;return S&&E<S?D?R.v2:R.Yes:R.No}var F=function(){function L(S,D,T){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=S,this.part=D,this.skip=T}var v=L.prototype;return v.addDirectives=function(D){var T=new self.URL(D);return this.msn!==void 0&&T.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&T.searchParams.set("_HLS_part",this.part.toString()),this.skip&&T.searchParams.set("_HLS_skip",this.skip),T.toString()},L}(),k=function(){function L(v){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=[v.url],this.attrs=v.attrs,this.bitrate=v.bitrate,v.details&&(this.details=v.details),this.id=v.id||0,this.name=v.name,this.width=v.width||0,this.height=v.height||0,this.audioCodec=v.audioCodec,this.videoCodec=v.videoCodec,this.unknownCodecs=v.unknownCodecs,this.codecSet=[v.videoCodec,v.audioCodec].filter(function(S){return S}).join(",").replace(/\.[^.,]+/g,"")}return I(L,[{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 D=S%this.url.length;this._urlId!==D&&(this.details=void 0,this._urlId=D)}}]),L}()},"./src/types/loader.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"PlaylistContextType",function(){return z}),A.d(G,"PlaylistLevelType",function(){return I});var z;(function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"})(z||(z={}));var I;(function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"})(I||(I={}))},"./src/types/transmuxer.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"ChunkMetadata",function(){return z});var z=function(j,F,k,L,v,S){L===void 0&&(L=0),v===void 0&&(v=-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=j,this.sn=F,this.id=k,this.size=L,this.part=v,this.partial=S};function I(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"AttrList",function(){return R});var z=/^(\d+)x(\d+)$/,I=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,R=function(){function j(k){typeof k=="string"&&(k=j.parseAttrList(k));for(var L in k)k.hasOwnProperty(L)&&(this[L]=k[L])}var F=j.prototype;return F.decimalInteger=function(L){var v=parseInt(this[L],10);return v>Number.MAX_SAFE_INTEGER?Infinity:v},F.hexadecimalInteger=function(L){if(this[L]){var v=(this[L]||"0x").slice(2);v=(v.length&1?"0":"")+v;for(var S=new Uint8Array(v.length/2),D=0;D<v.length/2;D++)S[D]=parseInt(v.slice(D*2,D*2+2),16);return S}else return null},F.hexadecimalIntegerAsNumber=function(L){var v=parseInt(this[L],16);return v>Number.MAX_SAFE_INTEGER?Infinity:v},F.decimalFloatingPoint=function(L){return parseFloat(this[L])},F.optionalFloat=function(L,v){var S=this[L];return S?parseFloat(S):v},F.enumeratedString=function(L){return this[L]},F.bool=function(L){return this[L]==="YES"},F.decimalResolution=function(L){var v=z.exec(this[L]);return v===null?void 0:{width:parseInt(v[1],10),height:parseInt(v[2],10)}},j.parseAttrList=function(L){var v,S={},D='"';for(I.lastIndex=0;(v=I.exec(L))!==null;){var T=v[2];T.indexOf(D)===0&&T.lastIndexOf(D)===T.length-1&&(T=T.slice(1,-1)),S[v[1]]=T}return S},j}()},"./src/utils/binary-search.ts":function(te,G,A){"use strict";A.r(G);var z={search:function(R,j){for(var F=0,k=R.length-1,L=null,v=null;F<=k;){L=(F+k)/2|0,v=R[L];var S=j(v);if(S>0)F=L+1;else if(S<0)k=L-1;else return v}return null}};G.default=z},"./src/utils/buffer-helper.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"BufferHelper",function(){return R});var z=A("./src/utils/logger.ts"),I={length:0,start:function(){return 0},end:function(){return 0}},R=function(){function j(){}return j.isBuffered=function(k,L){try{if(k){for(var v=j.getBuffered(k),S=0;S<v.length;S++)if(L>=v.start(S)&&L<=v.end(S))return!0}}catch(D){}return!1},j.bufferInfo=function(k,L,v){try{if(k){var S=j.getBuffered(k),D=[],T;for(T=0;T<S.length;T++)D.push({start:S.start(T),end:S.end(T)});return this.bufferedInfo(D,L,v)}}catch(E){}return{len:0,start:L,end:L,nextStart:void 0}},j.bufferedInfo=function(k,L,v){L=Math.max(0,L),k.sort(function(h,C){var b=h.start-C.start;return b||C.end-h.end});var S=[];if(v)for(var D=0;D<k.length;D++){var T=S.length;if(T){var E=S[T-1].end;k[D].start-E<v?k[D].end>E&&(S[T-1].end=k[D].end):S.push(k[D])}else S.push(k[D])}else S=k;for(var g=0,u,a=L,s=L,l=0;l<S.length;l++){var w=S[l].start,p=S[l].end;if(L+v>=w&&L<p)a=w,s=p,g=s-L;else if(L+v<w){u=w;break}}return{len:g,start:a||0,end:s||0,nextStart:u}},j.getBuffered=function(k){try{return k.buffered}catch(L){return z.logger.log("failed to get media.buffered",L),I}},j}()},"./src/utils/cea-608-parser.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"Row",function(){return s}),A.d(G,"CaptionScreen",function(){return l});var z=A("./src/utils/logger.ts"),I={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},R=function(f){var d=f;return I.hasOwnProperty(f)&&(d=I[f]),String.fromCharCode(d)},j=15,F=100,k={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},L={17:2,18:4,21:6,22:8,23:10,19:13,20:15},v={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},D=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],T;(function(c){c[c.ERROR=0]="ERROR",c[c.TEXT=1]="TEXT",c[c.WARNING=2]="WARNING",c[c.INFO=2]="INFO",c[c.DEBUG=3]="DEBUG",c[c.DATA=3]="DATA"})(T||(T={}));var E=function(){function c(){this.time=null,this.verboseLevel=T.ERROR}var f=c.prototype;return f.log=function(o,y){this.verboseLevel>=o&&z.logger.log(this.time+" ["+o+"] "+y)},c}(),g=function(f){for(var d=[],o=0;o<f.length;o++)d.push(f[o].toString(16));return d},u=function(){function c(d,o,y,m,x){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=d||"white",this.underline=o||!1,this.italics=y||!1,this.background=m||"black",this.flash=x||!1}var f=c.prototype;return f.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},f.setStyles=function(o){for(var y=["foreground","underline","italics","background","flash"],m=0;m<y.length;m++){var x=y[m];o.hasOwnProperty(x)&&(this[x]=o[x])}},f.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},f.equals=function(o){return this.foreground===o.foreground&&this.underline===o.underline&&this.italics===o.italics&&this.background===o.background&&this.flash===o.flash},f.copy=function(o){this.foreground=o.foreground,this.underline=o.underline,this.italics=o.italics,this.background=o.background,this.flash=o.flash},f.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},c}(),a=function(){function c(d,o,y,m,x,P){this.uchar=void 0,this.penState=void 0,this.uchar=d||" ",this.penState=new u(o,y,m,x,P)}var f=c.prototype;return f.reset=function(){this.uchar=" ",this.penState.reset()},f.setChar=function(o,y){this.uchar=o,this.penState.copy(y)},f.setPenState=function(o){this.penState.copy(o)},f.equals=function(o){return this.uchar===o.uchar&&this.penState.equals(o.penState)},f.copy=function(o){this.uchar=o.uchar,this.penState.copy(o.penState)},f.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},c}(),s=function(){function c(d){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var o=0;o<F;o++)this.chars.push(new a);this.logger=d,this.pos=0,this.currPenState=new u}var f=c.prototype;return f.equals=function(o){for(var y=!0,m=0;m<F;m++)if(!this.chars[m].equals(o.chars[m])){y=!1;break}return y},f.copy=function(o){for(var y=0;y<F;y++)this.chars[y].copy(o.chars[y])},f.isEmpty=function(){for(var o=!0,y=0;y<F;y++)if(!this.chars[y].isEmpty()){o=!1;break}return o},f.setCursor=function(o){this.pos!==o&&(this.pos=o),this.pos<0?(this.logger.log(T.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>F&&(this.logger.log(T.DEBUG,"Too large cursor position "+this.pos),this.pos=F)},f.moveCursor=function(o){var y=this.pos+o;if(o>1)for(var m=this.pos+1;m<y+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(y)},f.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},f.insertChar=function(o){o>=144&&this.backSpace();var y=R(o);if(this.pos>=F){this.logger.log(T.ERROR,"Cannot insert "+o.toString(16)+" ("+y+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(y,this.currPenState),this.moveCursor(1)},f.clearFromPos=function(o){var y;for(y=o;y<F;y++)this.chars[y].reset()},f.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},f.clearToEndOfRow=function(){this.clearFromPos(this.pos)},f.getTextString=function(){for(var o=[],y=!0,m=0;m<F;m++){var x=this.chars[m].uchar;x!==" "&&(y=!1),o.push(x)}return y?"":o.join("")},f.setPenStyles=function(o){this.currPenState.setStyles(o);var y=this.chars[this.pos];y.setPenState(this.currPenState)},c}(),l=function(){function c(d){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var o=0;o<j;o++)this.rows.push(new s(d));this.logger=d,this.currRow=j-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var f=c.prototype;return f.reset=function(){for(var o=0;o<j;o++)this.rows[o].clear();this.currRow=j-1},f.equals=function(o){for(var y=!0,m=0;m<j;m++)if(!this.rows[m].equals(o.rows[m])){y=!1;break}return y},f.copy=function(o){for(var y=0;y<j;y++)this.rows[y].copy(o.rows[y])},f.isEmpty=function(){for(var o=!0,y=0;y<j;y++)if(!this.rows[y].isEmpty()){o=!1;break}return o},f.backSpace=function(){var o=this.rows[this.currRow];o.backSpace()},f.clearToEndOfRow=function(){var o=this.rows[this.currRow];o.clearToEndOfRow()},f.insertChar=function(o){var y=this.rows[this.currRow];y.insertChar(o)},f.setPen=function(o){var y=this.rows[this.currRow];y.setPenStyles(o)},f.moveCursor=function(o){var y=this.rows[this.currRow];y.moveCursor(o)},f.setCursor=function(o){this.logger.log(T.INFO,"setCursor: "+o);var y=this.rows[this.currRow];y.setCursor(o)},f.setPAC=function(o){this.logger.log(T.INFO,"pacData = "+JSON.stringify(o));var y=o.row-1;if(this.nrRollUpRows&&y<this.nrRollUpRows-1&&(y=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==y){for(var m=0;m<j;m++)this.rows[m].clear();var x=this.currRow+1-this.nrRollUpRows,P=this.lastOutputScreen;if(P){var U=P.rows[x].cueStartTime,B=this.logger.time;if(U&&B!==null&&U<B)for(var W=0;W<this.nrRollUpRows;W++)this.rows[y-this.nrRollUpRows+W+1].copy(P.rows[x+W])}}this.currRow=y;var O=this.rows[this.currRow];if(o.indent!==null){var M=o.indent,K=Math.max(M-1,0);O.setCursor(o.indent),o.color=O.chars[K].penState.foreground}var X={foreground:o.color,underline:o.underline,italics:o.italics,background:"black",flash:!1};this.setPen(X)},f.setBkgData=function(o){this.logger.log(T.INFO,"bkgData = "+JSON.stringify(o)),this.backSpace(),this.setPen(o),this.insertChar(32)},f.setRollUpRows=function(o){this.nrRollUpRows=o},f.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(T.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(T.TEXT,this.getDisplayText());var o=this.currRow+1-this.nrRollUpRows,y=this.rows.splice(o,1)[0];y.clear(),this.rows.splice(this.currRow,0,y),this.logger.log(T.INFO,"Rolling up")},f.getDisplayText=function(o){o=o||!1;for(var y=[],m="",x=-1,P=0;P<j;P++){var U=this.rows[P].getTextString();U&&(x=P+1,o?y.push("Row "+x+": '"+U+"'"):y.push(U.trim()))}return y.length>0&&(o?m="["+y.join(" | ")+"]":m=y.join(`
|
|
`)),m},f.getTextAndFormat=function(){return this.rows},c}(),w=function(){function c(d,o,y){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=d,this.outputFilter=o,this.mode=null,this.verbose=0,this.displayedMemory=new l(y),this.nonDisplayedMemory=new l(y),this.lastOutputScreen=new l(y),this.currRollUpRow=this.displayedMemory.rows[j-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=y}var f=c.prototype;return f.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[j-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},f.getHandler=function(){return this.outputFilter},f.setHandler=function(o){this.outputFilter=o},f.setPAC=function(o){this.writeScreen.setPAC(o)},f.setBkgData=function(o){this.writeScreen.setBkgData(o)},f.setMode=function(o){if(o===this.mode)return;this.mode=o,this.logger.log(T.INFO,"MODE="+o),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=o},f.insertChars=function(o){for(var y=0;y<o.length;y++)this.writeScreen.insertChar(o[y]);var m=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(T.INFO,m+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(T.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},f.ccRCL=function(){this.logger.log(T.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},f.ccBS=function(){if(this.logger.log(T.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},f.ccAOF=function(){},f.ccAON=function(){},f.ccDER=function(){this.logger.log(T.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},f.ccRU=function(o){this.logger.log(T.INFO,"RU("+o+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(o)},f.ccFON=function(){this.logger.log(T.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},f.ccRDC=function(){this.logger.log(T.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},f.ccTR=function(){this.logger.log(T.INFO,"TR"),this.setMode("MODE_TEXT")},f.ccRTD=function(){this.logger.log(T.INFO,"RTD"),this.setMode("MODE_TEXT")},f.ccEDM=function(){this.logger.log(T.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},f.ccCR=function(){this.logger.log(T.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},f.ccENM=function(){this.logger.log(T.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},f.ccEOC=function(){if(this.logger.log(T.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var o=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=o,this.writeScreen=this.nonDisplayedMemory,this.logger.log(T.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},f.ccTO=function(o){this.logger.log(T.INFO,"TO("+o+") - Tab Offset"),this.writeScreen.moveCursor(o)},f.ccMIDROW=function(o){var y={flash:!1};if(y.underline=o%2===1,y.italics=o>=46,y.italics)y.foreground="white";else{var m=Math.floor(o/2)-16,x=["white","green","blue","cyan","red","yellow","magenta"];y.foreground=x[m]}this.logger.log(T.INFO,"MIDROW: "+JSON.stringify(y)),this.writeScreen.setPen(y)},f.outputDataUpdate=function(o){o===void 0&&(o=!1);var y=this.logger.time;if(y===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=y:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,y,this.lastOutputScreen),o&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:y),this.lastOutputScreen.copy(this.displayedMemory))},f.cueSplitAtTime=function(o){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,o,this.displayedMemory),this.cueStartTime=o))},c}(),p=function(){function c(d,o,y){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new E;this.channels=[null,new w(d,o,m),new w(d+1,y,m)],this.cmdHistory=b(),this.logger=m}var f=c.prototype;return f.getHandler=function(o){return this.channels[o].getHandler()},f.setHandler=function(o,y){this.channels[o].setHandler(y)},f.addData=function(o,y){var m,x,P,U=!1;this.logger.time=o;for(var B=0;B<y.length;B+=2){if(x=y[B]&127,P=y[B+1]&127,x===0&&P===0)continue;if(this.logger.log(T.DATA,"["+g([y[B],y[B+1]])+"] -> ("+g([x,P])+")"),m=this.parseCmd(x,P),m||(m=this.parseMidrow(x,P)),m||(m=this.parsePAC(x,P)),m||(m=this.parseBackgroundAttributes(x,P)),!m&&(U=this.parseChars(x,P),U)){var W=this.currentChannel;if(W&&W>0){var O=this.channels[W];O.insertChars(U)}else this.logger.log(T.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!U&&this.logger.log(T.WARNING,"Couldn't parse cleaned data "+g([x,P])+" orig: "+g([y[B],y[B+1]]))}},f.parseCmd=function(o,y){var m=this.cmdHistory,x=(o===20||o===28||o===21||o===29)&&y>=32&&y<=47,P=(o===23||o===31)&&y>=33&&y<=35;if(!(x||P))return!1;if(C(o,y,m))return h(null,null,m),this.logger.log(T.DEBUG,"Repeated command ("+g([o,y])+") is dropped"),!0;var U=o===20||o===21||o===23?1:2,B=this.channels[U];return o===20||o===21||o===28||o===29?y===32?B.ccRCL():y===33?B.ccBS():y===34?B.ccAOF():y===35?B.ccAON():y===36?B.ccDER():y===37?B.ccRU(2):y===38?B.ccRU(3):y===39?B.ccRU(4):y===40?B.ccFON():y===41?B.ccRDC():y===42?B.ccTR():y===43?B.ccRTD():y===44?B.ccEDM():y===45?B.ccCR():y===46?B.ccENM():y===47&&B.ccEOC():B.ccTO(y-32),h(o,y,m),this.currentChannel=U,!0},f.parseMidrow=function(o,y){var m=0;if((o===17||o===25)&&y>=32&&y<=47){if(o===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(T.ERROR,"Mismatch channel in midrow parsing"),!1;var x=this.channels[m];return x?(x.ccMIDROW(y),this.logger.log(T.DEBUG,"MIDROW ("+g([o,y])+")"),!0):!1}return!1},f.parsePAC=function(o,y){var m,x=this.cmdHistory,P=(o>=17&&o<=23||o>=25&&o<=31)&&y>=64&&y<=127,U=(o===16||o===24)&&y>=64&&y<=95;if(!(P||U))return!1;if(C(o,y,x))return h(null,null,x),!0;var B=o<=23?1:2;y>=64&&y<=95?m=B===1?k[o]:v[o]:m=B===1?L[o]:S[o];var W=this.channels[B];return W?(W.setPAC(this.interpretPAC(m,y)),h(o,y,x),this.currentChannel=B,!0):!1},f.interpretPAC=function(o,y){var m,x={color:null,italics:!1,indent:null,underline:!1,row:o};return y>95?m=y-96:m=y-64,x.underline=(m&1)===1,m<=13?x.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(x.italics=!0,x.color="white"):x.indent=Math.floor((m-16)/2)*4,x},f.parseChars=function(o,y){var m,x=null,P=null;if(o>=25?(m=2,P=o-8):(m=1,P=o),P>=17&&P<=19){var U;P===17?U=y+80:P===18?U=y+112:U=y+144,this.logger.log(T.INFO,"Special char '"+R(U)+"' in channel "+m),x=[U]}else o>=32&&o<=127&&(x=y===0?[o]:[o,y]);if(x){var B=g(x);this.logger.log(T.DEBUG,"Char codes = "+B.join(",")),h(o,y,this.cmdHistory)}return x},f.parseBackgroundAttributes=function(o,y){var m=(o===16||o===24)&&y>=32&&y<=47,x=(o===23||o===31)&&y>=45&&y<=47;if(!(m||x))return!1;var P,U={};o===16||o===24?(P=Math.floor((y-32)/2),U.background=D[P],y%2===1&&(U.background=U.background+"_semi")):y===45?U.background="transparent":(U.foreground="black",y===47&&(U.underline=!0));var B=o<=23?1:2,W=this.channels[B];return W.setBkgData(U),h(o,y,this.cmdHistory),!0},f.reset=function(){for(var o=0;o<Object.keys(this.channels).length;o++){var y=this.channels[o];y&&y.reset()}this.cmdHistory=b()},f.cueSplitAtTime=function(o){for(var y=0;y<this.channels.length;y++){var m=this.channels[y];m&&m.cueSplitAtTime(o)}},c}();function h(c,f,d){d.a=c,d.b=f}function C(c,f,d){return d.a===c&&d.b===f}function b(){return{a:null,b:null}}G.default=p},"./src/utils/codecs.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"isCodecType",function(){return I}),A.d(G,"isCodecSupportedInMp4",function(){return R});var z={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function I(j,F){var k=z[F];return!!k&&k[j.slice(0,4)]===!0}function R(j,F){return MediaSource.isTypeSupported((F||"video")+'/mp4;codecs="'+j+'"')}},"./src/utils/cues.ts":function(te,G,A){"use strict";A.r(G);var z=A("./src/utils/vttparser.ts"),I=A("./src/utils/webvtt-parser.ts"),R=A("./src/utils/texttrack-utils.ts"),j=/\s/,F={newCue:function(L,v,S,D){for(var T=[],E,g,u,a,s,l=self.VTTCue||self.TextTrackCue,w=0;w<D.rows.length;w++)if(E=D.rows[w],u=!0,a=0,s="",!E.isEmpty()){for(var p=0;p<E.chars.length;p++)j.test(E.chars[p].uchar)&&u?a++:(s+=E.chars[p].uchar,u=!1);E.cueStartTime=v,v===S&&(S+=1e-4),a>=16?a--:a++;var h=Object(z.fixLineBreaks)(s.trim()),C=Object(I.generateCueId)(v,S,h);(!L||!L.cues||!L.cues.getCueById(C))&&(g=new l(v,S,h),g.id=C,g.line=w+1,g.align="left",g.position=10+Math.min(80,Math.floor(a*8/32)*10),T.push(g))}return L&&T.length&&(T.sort(function(b,c){return b.line==="auto"||c.line==="auto"?0:b.line>8&&c.line>8?c.line-b.line:b.line-c.line}),T.forEach(function(b){return Object(R.addCueToTrack)(L,b)})),T}};G.default=F},"./src/utils/discontinuities.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"findFirstFragWithCC",function(){return j}),A.d(G,"shouldAlignOnDiscontinuities",function(){return F}),A.d(G,"findDiscontinuousReferenceFrag",function(){return k}),A.d(G,"adjustSlidingStart",function(){return v}),A.d(G,"alignStream",function(){return S}),A.d(G,"alignPDT",function(){return T}),A.d(G,"alignFragmentByPDTDelta",function(){return E}),A.d(G,"alignMediaPlaylistByPDT",function(){return g});var z=A("./src/polyfills/number.ts"),I=A("./src/utils/logger.ts"),R=A("./src/controller/level-helper.ts");function j(u,a){for(var s=null,l=0,w=u.length;l<w;l++){var p=u[l];if(p&&p.cc===a){s=p;break}}return s}function F(u,a,s){return!!(a.details&&(s.endCC>s.startCC||u&&u.cc<s.startCC))}function k(u,a){var s=u.fragments,l=a.fragments;if(!l.length||!s.length){I.logger.log("No fragments to align");return}var w=j(s,l[0].cc);if(!w||w&&!w.startPTS){I.logger.log("No frag in previous level to align on");return}return w}function L(u,a){if(u){var s=u.start+a;u.start=u.startPTS=s,u.endPTS=s+u.duration}}function v(u,a){for(var s=a.fragments,l=0,w=s.length;l<w;l++)L(s[l],u);a.fragmentHint&&L(a.fragmentHint,u),a.alignedSliding=!0}function S(u,a,s){if(!a)return;D(u,s,a),!s.alignedSliding&&a.details&&T(s,a.details),!s.alignedSliding&&a.details&&!s.skippedSegments&&Object(R.adjustSliding)(a.details,s)}function D(u,a,s){if(F(u,s,a)){var l=k(s.details,a);l&&Object(z.isFiniteNumber)(l.start)&&(I.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),v(l.start,a))}}function T(u,a){if(!a.fragments.length||!u.hasProgramDateTime||!a.hasProgramDateTime)return;var s=a.fragments[0].programDateTime,l=u.fragments[0].programDateTime,w=(l-s)/1e3+a.fragments[0].start;w&&Object(z.isFiniteNumber)(w)&&(I.logger.log("Adjusting PTS using programDateTime delta "+(l-s)+"ms, sliding:"+w.toFixed(3)+" "+u.url+" "),v(w,u))}function E(u,a){var s=u.programDateTime;if(!s)return;var l=(s-a)/1e3;u.start=u.startPTS=l,u.endPTS=l+u.duration}function g(u,a){if(!a.fragments.length||!u.hasProgramDateTime||!a.hasProgramDateTime)return;var s=a.fragments[0].programDateTime,l=a.fragments[0].start,w=s-l*1e3;u.fragments.forEach(function(p){E(p,w)}),u.fragmentHint&&E(u.fragmentHint,w),u.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(te,G,A){"use strict";A.r(G);var z=A("./src/utils/ewma.ts"),I=function(){function R(F,k,L){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=L,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new z.default(F),this.fast_=new z.default(k)}var j=R.prototype;return j.update=function(k,L){var v=this.slow_,S=this.fast_;this.slow_.halfLife!==k&&(this.slow_=new z.default(k,v.getEstimate(),v.getTotalWeight())),this.fast_.halfLife!==L&&(this.fast_=new z.default(L,S.getEstimate(),S.getTotalWeight()))},j.sample=function(k,L){k=Math.max(k,this.minDelayMs_);var v=8*L,S=k/1e3,D=v/S;this.fast_.sample(S,D),this.slow_.sample(S,D)},j.canEstimate=function(){var k=this.fast_;return k&&k.getTotalWeight()>=this.minWeight_},j.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},j.destroy=function(){},R}();G.default=I},"./src/utils/ewma.ts":function(te,G,A){"use strict";A.r(G);var z=function(){function I(j,F,k){F===void 0&&(F=0),k===void 0&&(k=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=j,this.alpha_=j?Math.exp(Math.log(.5)/j):0,this.estimate_=F,this.totalWeight_=k}var R=I.prototype;return R.sample=function(F,k){var L=Math.pow(this.alpha_,F);this.estimate_=k*(1-L)+L*this.estimate_,this.totalWeight_+=F},R.getTotalWeight=function(){return this.totalWeight_},R.getEstimate=function(){if(this.alpha_){var F=1-Math.pow(this.alpha_,this.totalWeight_);if(F)return this.estimate_/F}return this.estimate_},I}();G.default=z},"./src/utils/fetch-loader.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"fetchSupported",function(){return E});var z=A("./src/polyfills/number.ts"),I=A("./src/loader/load-stats.ts"),R=A("./src/demux/chunk-cache.ts");function j(l,w){l.prototype=Object.create(w.prototype),l.prototype.constructor=l,S(l,w)}function F(l){var w=typeof Map=="function"?new Map:void 0;return F=function(h){if(h===null||!v(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof w!="undefined"){if(w.has(h))return w.get(h);w.set(h,C)}function C(){return k(h,arguments,D(this).constructor)}return C.prototype=Object.create(h.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),S(C,h)},F(l)}function k(l,w,p){return L()?k=Reflect.construct:k=function(C,b,c){var f=[null];f.push.apply(f,b);var d=Function.bind.apply(C,f),o=new d;return c&&S(o,c.prototype),o},k.apply(null,arguments)}function L(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(l){return!1}}function v(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function S(l,w){return S=Object.setPrototypeOf||function(h,C){return h.__proto__=C,h},S(l,w)}function D(l){return D=Object.setPrototypeOf?Object.getPrototypeOf:function(p){return p.__proto__||Object.getPrototypeOf(p)},D(l)}function T(){return T=Object.assign||function(l){for(var w=1;w<arguments.length;w++){var p=arguments[w];for(var h in p)Object.prototype.hasOwnProperty.call(p,h)&&(l[h]=p[h])}return l},T.apply(this,arguments)}function E(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(l){}return!1}var g=function(){function l(p){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=p.fetchSetup||a,this.controller=new self.AbortController,this.stats=new I.LoadStats}var w=l.prototype;return w.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},w.abortInternal=function(){var h=this.response;(!h||!h.ok)&&(this.stats.aborted=!0,this.controller.abort())},w.abort=function(){var h;this.abortInternal(),(h=this.callbacks)!==null&&h!==void 0&&h.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},w.load=function(h,C,b){var c=this,f=this.stats;if(f.loading.start)throw new Error("Loader can only be used once.");f.loading.start=self.performance.now();var d=u(h,this.controller.signal),o=b.onProgress,y=h.responseType==="arraybuffer",m=y?"byteLength":"length";this.context=h,this.config=C,this.callbacks=b,this.request=this.fetchSetup(h,d),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){c.abortInternal(),b.onTimeout(f,h,c.response)},C.timeout),self.fetch(this.request).then(function(x){if(c.response=c.loader=x,!x.ok){var P=x.status,U=x.statusText;throw new s(U||"fetch, bad network response",P,x)}return f.loading.first=Math.max(self.performance.now(),f.loading.start),f.total=parseInt(x.headers.get("Content-Length")||"0"),o&&Object(z.isFiniteNumber)(C.highWaterMark)?c.loadProgressively(x,f,h,C.highWaterMark,o):y?x.arrayBuffer():x.text()}).then(function(x){var P=c.response;self.clearTimeout(c.requestTimeout),f.loading.end=Math.max(self.performance.now(),f.loading.first),f.loaded=f.total=x[m];var U={url:P.url,data:x};o&&!Object(z.isFiniteNumber)(C.highWaterMark)&&o(f,h,x,P),b.onSuccess(U,f,h,P)}).catch(function(x){if(self.clearTimeout(c.requestTimeout),f.aborted)return;var P=x.code||0;b.onError({code:P,text:x.message},h,x.details)})},w.getCacheAge=function(){var h=null;if(this.response){var C=this.response.headers.get("age");h=C?parseFloat(C):null}return h},w.loadProgressively=function(h,C,b,c,f){c===void 0&&(c=0);var d=new R.default,o=h.body.getReader(),y=function m(){return o.read().then(function(x){if(x.done)return d.dataLength&&f(C,b,d.flush(),h),Promise.resolve(new ArrayBuffer(0));var P=x.value,U=P.length;return C.loaded+=U,U<c||d.dataLength?(d.push(P),d.dataLength>=c&&f(C,b,d.flush(),h)):f(C,b,P,h),m()}).catch(function(){return Promise.reject()})};return y()},l}();function u(l,w){var p={method:"GET",mode:"cors",credentials:"same-origin",signal:w,headers:new self.Headers(T({},l.headers))};return l.rangeEnd&&p.headers.set("Range","bytes="+l.rangeStart+"-"+String(l.rangeEnd-1)),p}function a(l,w){return new self.Request(l.url,w)}var s=function(l){j(w,l);function w(p,h,C){var b;return b=l.call(this,p)||this,b.code=void 0,b.details=void 0,b.code=h,b.details=C,b}return w}(F(Error));G.default=g},"./src/utils/imsc1-ttml-parser.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"IMSC1_CODEC",function(){return v}),A.d(G,"parseIMSC1",function(){return E});var z=A("./src/utils/mp4-tools.ts"),I=A("./src/utils/vttparser.ts"),R=A("./src/utils/vttcue.ts"),j=A("./src/demux/id3.ts"),F=A("./src/utils/timescale-conversion.ts"),k=A("./src/utils/webvtt-parser.ts");function L(){return L=Object.assign||function(c){for(var f=1;f<arguments.length;f++){var d=arguments[f];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(c[o]=d[o])}return c},L.apply(this,arguments)}var v="stpp.ttml.im1t",S=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,D=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,T={left:"start",center:"center",right:"end",start:"start",end:"end"};function E(c,f,d,o,y){var m=Object(z.findBox)(new Uint8Array(c),["mdat"]);if(m.length===0){y(new Error("Could not parse IMSC1 mdat"));return}var x=m[0],P=Object(j.utf8ArrayToStr)(new Uint8Array(c,x.start,x.end-x.start)),U=Object(F.toTimescaleFromScale)(f,1,d);try{o(g(P,U))}catch(B){y(B)}}function g(c,f){var d=new DOMParser,o=d.parseFromString(c,"text/xml"),y=o.getElementsByTagName("tt")[0];if(!y)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},x=Object.keys(m).reduce(function(O,M){return O[M]=y.getAttribute("ttp:"+M)||m[M],O},{}),P=y.getAttribute("xml:space")!=="preserve",U=a(u(y,"styling","style")),B=a(u(y,"layout","region")),W=u(y,"body","[begin]");return[].map.call(W,function(O){var M=s(O,P);if(!M||!O.hasAttribute("begin"))return null;var K=h(O.getAttribute("begin"),x),X=h(O.getAttribute("dur"),x),ee=h(O.getAttribute("end"),x);if(K===null)throw p(O);if(ee===null){if(X===null)throw p(O);ee=K+X}var oe=new R.default(K-f,ee-f,M);oe.id=Object(k.generateCueId)(oe.startTime,oe.endTime,oe.text);var xe=B[O.getAttribute("region")],me=U[O.getAttribute("style")];oe.position=10,oe.size=80;var ge=l(xe,me),de=ge.textAlign;if(de){var se=T[de];se&&(oe.lineAlign=se),oe.align=de}return L(oe,ge),oe}).filter(function(O){return O!==null})}function u(c,f,d){var o=c.getElementsByTagName(f)[0];return o?[].slice.call(o.querySelectorAll(d)):[]}function a(c){return c.reduce(function(f,d){var o=d.getAttribute("xml:id");return o&&(f[o]=d),f},{})}function s(c,f){return[].slice.call(c.childNodes).reduce(function(d,o,y){var m;return o.nodeName==="br"&&y?d+`
|
|
`:(m=o.childNodes)!==null&&m!==void 0&&m.length?s(o,f):f?d+o.textContent.trim().replace(/\s+/g," "):d+o.textContent},"")}function l(c,f){var d="http://www.w3.org/ns/ttml#styling",o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return o.reduce(function(y,m){var x=w(f,d,m)||w(c,d,m);return x&&(y[m]=x),y},{})}function w(c,f,d){return c.hasAttributeNS(f,d)?c.getAttributeNS(f,d):null}function p(c){return new Error("Could not parse ttml timestamp "+c)}function h(c,f){if(!c)return null;var d=Object(I.parseTimeStamp)(c);return d===null&&(S.test(c)?d=C(c,f):D.test(c)&&(d=b(c,f))),d}function C(c,f){var d=S.exec(c),o=(d[4]|0)+(d[5]|0)/f.subFrameRate;return(d[1]|0)*3600+(d[2]|0)*60+(d[3]|0)+o/f.frameRate}function b(c,f){var d=D.exec(c),o=Number(d[1]),y=d[2];switch(y){case"h":return o*3600;case"m":return o*60;case"ms":return o*1e3;case"f":return o/f.frameRate;case"t":return o/f.tickRate}return o}},"./src/utils/logger.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"enableLogs",function(){return k}),A.d(G,"logger",function(){return L});var z=function(){},I={trace:z,debug:z,log:z,warn:z,info:z,error:z},R=I;function j(v){var S=self.console[v];return S?S.bind(self.console,"["+v+"] >"):z}function F(v){for(var S=arguments.length,D=new Array(S>1?S-1:0),T=1;T<S;T++)D[T-1]=arguments[T];D.forEach(function(E){R[E]=v[E]?v[E].bind(v):j(E)})}function k(v){if(self.console&&v===!0||typeof v=="object"){F(v,"debug","log","info","warn","error");try{R.log()}catch(S){R=I}}else R=I}var L=R},"./src/utils/mediakeys-helper.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"KeySystems",function(){return z}),A.d(G,"requestMediaKeySystemAccess",function(){return I});var z;(function(R){R.WIDEVINE="com.widevine.alpha",R.PLAYREADY="com.microsoft.playready"})(z||(z={}));var I=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"getMediaSource",function(){return z});function z(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"bin2str",function(){return F}),A.d(G,"readUint16",function(){return k}),A.d(G,"readUint32",function(){return L}),A.d(G,"writeUint32",function(){return v}),A.d(G,"findBox",function(){return S}),A.d(G,"parseSegmentIndex",function(){return D}),A.d(G,"parseInitSegment",function(){return T}),A.d(G,"getStartDTS",function(){return E}),A.d(G,"getDuration",function(){return g}),A.d(G,"computeRawDurationFromSamples",function(){return u}),A.d(G,"offsetStartDTS",function(){return a}),A.d(G,"segmentValidRange",function(){return s}),A.d(G,"appendUint8Array",function(){return l});var z=A("./src/utils/typed-array.ts"),I=A("./src/loader/fragment.ts"),R=Math.pow(2,32)-1,j=[].push;function F(w){return String.fromCharCode.apply(null,w)}function k(w,p){"data"in w&&(p+=w.start,w=w.data);var h=w[p]<<8|w[p+1];return h<0?65536+h:h}function L(w,p){"data"in w&&(p+=w.start,w=w.data);var h=w[p]<<24|w[p+1]<<16|w[p+2]<<8|w[p+3];return h<0?4294967296+h:h}function v(w,p,h){"data"in w&&(p+=w.start,w=w.data),w[p]=h>>24,w[p+1]=h>>16&255,w[p+2]=h>>8&255,w[p+3]=h&255}function S(w,p){var h=[];if(!p.length)return h;var C,b,c;"data"in w?(C=w.data,b=w.start,c=w.end):(C=w,b=0,c=C.byteLength);for(var f=b;f<c;){var d=L(C,f),o=F(C.subarray(f+4,f+8)),y=d>1?f+d:c;if(o===p[0])if(p.length===1)h.push({data:C,start:f+8,end:y});else{var m=S({data:C,start:f+8,end:y},p.slice(1));m.length&&j.apply(h,m)}f=y}return h}function D(w){var p=S(w,["moov"]),h=p[0],C=h?h.end:null,b=S(w,["sidx"]);if(!b||!b[0])return null;var c=[],f=b[0],d=f.data[0],o=d===0?8:16,y=L(f,o);o+=4;var m=0,x=0;d===0?o+=8:o+=16,o+=2;var P=f.end+x,U=k(f,o);o+=2;for(var B=0;B<U;B++){var W=o,O=L(f,W);W+=4;var M=O&2147483647,K=(O&2147483648)>>>31;if(K===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var X=L(f,W);W+=4,c.push({referenceSize:M,subsegmentDuration:X,info:{duration:X/y,start:P,end:P+M-1}}),P+=M,W+=4,o=W}return{earliestPresentationTime:m,timescale:y,version:d,referencesCount:U,references:c,moovEndOffset:C}}function T(w){for(var p=[],h=S(w,["moov","trak"]),C=0;C<h.length;C++){var b=h[C],c=S(b,["tkhd"])[0];if(c){var f=c.data[c.start],d=f===0?12:20,o=L(c,d),y=S(b,["mdia","mdhd"])[0];if(y){f=y.data[y.start],d=f===0?12:20;var m=L(y,d),x=S(b,["mdia","hdlr"])[0];if(x){var P=F(x.data.subarray(x.start+8,x.start+12)),U={soun:I.ElementaryStreamTypes.AUDIO,vide:I.ElementaryStreamTypes.VIDEO}[P];if(U){var B=S(b,["mdia","minf","stbl","stsd"])[0],W=void 0;B&&(W=F(B.data.subarray(B.start+12,B.start+16))),p[o]={timescale:m,type:U},p[U]={timescale:m,id:o,codec:W}}}}}}var O=S(w,["moov","mvex","trex"]);return O.forEach(function(M){var K=L(M,4),X=p[K];X&&(X.default={duration:L(M,12),flags:L(M,20)})}),p}function E(w,p){return S(p,["moof","traf"]).reduce(function(h,C){var b=S(C,["tfdt"])[0],c=b.data[b.start],f=S(C,["tfhd"]).reduce(function(d,o){var y=L(o,4),m=w[y];if(m){var x=L(b,4);c===1&&(x*=Math.pow(2,32),x+=L(b,8));var P=m.timescale||9e4,U=x/P;if(isFinite(U)&&(d===null||U<d))return U}return d},null);return f!==null&&isFinite(f)&&(h===null||f<h)?f:h},null)||0}function g(w,p){for(var h=0,C=0,b=0,c=S(w,["moof","traf"]),f=0;f<c.length;f++){var d=c[f],o=S(d,["tfhd"])[0],y=L(o,4),m=p[y];if(!m)continue;var x=m.default,P=L(o,0)|(x==null?void 0:x.flags),U=x==null?void 0:x.duration;P&8&&(P&2?U=L(o,12):U=L(o,8));for(var B=m.timescale||9e4,W=S(d,["trun"]),O=0;O<W.length;O++){if(U){var M=L(W[O],4);h=U*M}else h=u(W[O]);m.type===I.ElementaryStreamTypes.VIDEO?C+=h/B:m.type===I.ElementaryStreamTypes.AUDIO&&(b+=h/B)}}if(C===0&&b===0){var K=D(w);if(K!=null&&K.references)return K.references.reduce(function(X,ee){return X+ee.info.duration||0},0)}return C||b}function u(w){var p=L(w,0),h=8;p&1&&(h+=4),p&4&&(h+=4);for(var C=0,b=L(w,4),c=0;c<b;c++){if(p&256){var f=L(w,h);C+=f,h+=4}p&512&&(h+=4),p&1024&&(h+=4),p&2048&&(h+=4)}return C}function a(w,p,h){S(p,["moof","traf"]).forEach(function(C){S(C,["tfhd"]).forEach(function(b){var c=L(b,4),f=w[c];if(!f)return;var d=f.timescale||9e4;S(C,["tfdt"]).forEach(function(o){var y=o.data[o.start],m=L(o,4);if(y===0)v(o,4,m-h*d);else{m*=Math.pow(2,32),m+=L(o,8),m-=h*d,m=Math.max(m,0);var x=Math.floor(m/(R+1)),P=Math.floor(m%(R+1));v(o,4,x),v(o,8,P)}})})})}function s(w){var p={valid:null,remainder:null},h=S(w,["moof"]);if(h){if(h.length<2)return p.remainder=w,p}else return p;var C=h[h.length-1];return p.valid=Object(z.sliceUint8)(w,0,C.start-8),p.remainder=Object(z.sliceUint8)(w,C.start-8),p}function l(w,p){var h=new Uint8Array(w.length+p.length);return h.set(w),h.set(p,w.length),h}},"./src/utils/output-filter.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return z});var z=function(){function I(j,F){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=j,this.trackName=F}var R=I.prototype;return R.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},R.newCue=function(F,k,L){(this.startTime===null||this.startTime>F)&&(this.startTime=F),this.endTime=k,this.screen=L,this.timelineController.createCaptionsTrack(this.trackName)},R.reset=function(){this.cueRanges=[]},I}()},"./src/utils/texttrack-utils.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"sendAddTrackEvent",function(){return I}),A.d(G,"addCueToTrack",function(){return R}),A.d(G,"clearCurrentCues",function(){return j}),A.d(G,"removeCuesInRange",function(){return F}),A.d(G,"getCuesInRange",function(){return L});var z=A("./src/utils/logger.ts");function I(v,S){var D;try{D=new Event("addtrack")}catch(T){D=document.createEvent("Event"),D.initEvent("addtrack",!1,!1)}D.track=v,S.dispatchEvent(D)}function R(v,S){var D=v.mode;if(D==="disabled"&&(v.mode="hidden"),v.cues&&!v.cues.getCueById(S.id))try{if(v.addCue(S),!v.cues.getCueById(S.id))throw new Error("addCue is failed for: "+S)}catch(E){z.logger.debug("[texttrack-utils]: "+E);var T=new self.TextTrackCue(S.startTime,S.endTime,S.text);T.id=S.id,v.addCue(T)}D==="disabled"&&(v.mode=D)}function j(v){var S=v.mode;if(S==="disabled"&&(v.mode="hidden"),v.cues)for(var D=v.cues.length;D--;)v.removeCue(v.cues[D]);S==="disabled"&&(v.mode=S)}function F(v,S,D){var T=v.mode;if(T==="disabled"&&(v.mode="hidden"),v.cues&&v.cues.length>0)for(var E=L(v.cues,S,D),g=0;g<E.length;g++)v.removeCue(E[g]);T==="disabled"&&(v.mode=T)}function k(v,S){if(S<v[0].startTime)return 0;var D=v.length-1;if(S>v[D].endTime)return-1;for(var T=0,E=D;T<=E;){var g=Math.floor((E+T)/2);if(S<v[g].startTime)E=g-1;else if(S>v[g].startTime&&T<D)T=g+1;else return g}return v[T].startTime-S<S-v[E].startTime?T:E}function L(v,S,D){var T=[],E=k(v,S);if(E>-1)for(var g=E,u=v.length;g<u;g++){var a=v[g];if(a.startTime>=S&&a.endTime<=D)T.push(a);else if(a.startTime>D)return T}return T}},"./src/utils/time-ranges.ts":function(te,G,A){"use strict";A.r(G);var z={toString:function(R){for(var j="",F=R.length,k=0;k<F;k++)j+="["+R.start(k).toFixed(3)+","+R.end(k).toFixed(3)+"]";return j}};G.default=z},"./src/utils/timescale-conversion.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"toTimescaleFromBase",function(){return I}),A.d(G,"toTimescaleFromScale",function(){return R}),A.d(G,"toMsFromMpegTsClock",function(){return j}),A.d(G,"toMpegTsClockFromTimescale",function(){return F});var z=9e4;function I(k,L,v,S){v===void 0&&(v=1),S===void 0&&(S=!1);var D=k*L*v;return S?Math.round(D):D}function R(k,L,v,S){return v===void 0&&(v=1),S===void 0&&(S=!1),I(k,L,1/v,S)}function j(k,L){return L===void 0&&(L=!1),I(k,1e3,1/z,L)}function F(k,L){return L===void 0&&(L=1),I(k,z,1/L)}},"./src/utils/typed-array.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"sliceUint8",function(){return z});function z(I,R,j){return Uint8Array.prototype.slice?I.slice(R,j):new Uint8Array(Array.prototype.slice.call(I,R,j))}},"./src/utils/vttcue.ts":function(te,G,A){"use strict";A.r(G),G.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var z=["","lr","rl"],I=["start","middle","end","left","right"];function R(v,S){if(typeof S!="string")return!1;if(!Array.isArray(v))return!1;var D=S.toLowerCase();return~v.indexOf(D)?D:!1}function j(v){return R(z,v)}function F(v){return R(I,v)}function k(v){for(var S=arguments.length,D=new Array(S>1?S-1:0),T=1;T<S;T++)D[T-1]=arguments[T];for(var E=1;E<arguments.length;E++){var g=arguments[E];for(var u in g)v[u]=g[u]}return v}function L(v,S,D){var T=this,E={enumerable:!0};T.hasBeenReset=!1;var g="",u=!1,a=v,s=S,l=D,w=null,p="",h=!0,C="auto",b="start",c=50,f="middle",d=50,o="middle";Object.defineProperty(T,"id",k({},E,{get:function(){return g},set:function(m){g=""+m}})),Object.defineProperty(T,"pauseOnExit",k({},E,{get:function(){return u},set:function(m){u=!!m}})),Object.defineProperty(T,"startTime",k({},E,{get:function(){return a},set:function(m){if(typeof m!="number")throw new TypeError("Start time must be set to a number.");a=m,this.hasBeenReset=!0}})),Object.defineProperty(T,"endTime",k({},E,{get:function(){return s},set:function(m){if(typeof m!="number")throw new TypeError("End time must be set to a number.");s=m,this.hasBeenReset=!0}})),Object.defineProperty(T,"text",k({},E,{get:function(){return l},set:function(m){l=""+m,this.hasBeenReset=!0}})),Object.defineProperty(T,"region",k({},E,{get:function(){return w},set:function(m){w=m,this.hasBeenReset=!0}})),Object.defineProperty(T,"vertical",k({},E,{get:function(){return p},set:function(m){var x=j(m);if(x===!1)throw new SyntaxError("An invalid or illegal string was specified.");p=x,this.hasBeenReset=!0}})),Object.defineProperty(T,"snapToLines",k({},E,{get:function(){return h},set:function(m){h=!!m,this.hasBeenReset=!0}})),Object.defineProperty(T,"line",k({},E,{get:function(){return C},set:function(m){if(typeof m!="number"&&m!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");C=m,this.hasBeenReset=!0}})),Object.defineProperty(T,"lineAlign",k({},E,{get:function(){return b},set:function(m){var x=F(m);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");b=x,this.hasBeenReset=!0}})),Object.defineProperty(T,"position",k({},E,{get:function(){return c},set:function(m){if(m<0||m>100)throw new Error("Position must be between 0 and 100.");c=m,this.hasBeenReset=!0}})),Object.defineProperty(T,"positionAlign",k({},E,{get:function(){return f},set:function(m){var x=F(m);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");f=x,this.hasBeenReset=!0}})),Object.defineProperty(T,"size",k({},E,{get:function(){return d},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");d=m,this.hasBeenReset=!0}})),Object.defineProperty(T,"align",k({},E,{get:function(){return o},set:function(m){var x=F(m);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");o=x,this.hasBeenReset=!0}})),T.displayState=void 0}return L.prototype.getCueAsHTML=function(){var v=self.WebVTT;return v.convertCueToDOMTree(self,this.text)},L}()},"./src/utils/vttparser.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"parseTimeStamp",function(){return R}),A.d(G,"fixLineBreaks",function(){return S}),A.d(G,"VTTParser",function(){return D});var z=A("./src/utils/vttcue.ts"),I=function(){function T(){}var E=T.prototype;return E.decode=function(u,a){if(!u)return"";if(typeof u!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(u))},T}();function R(T){function E(u,a,s,l){return(u|0)*3600+(a|0)*60+(s|0)+parseFloat(l||0)}var g=T.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return g?parseFloat(g[2])>59?E(g[2],g[3],0,g[4]):E(g[1],g[2],g[3],g[4]):null}var j=function(){function T(){this.values=Object.create(null)}var E=T.prototype;return E.set=function(u,a){!this.get(u)&&a!==""&&(this.values[u]=a)},E.get=function(u,a,s){return s?this.has(u)?this.values[u]:a[s]:this.has(u)?this.values[u]:a},E.has=function(u){return u in this.values},E.alt=function(u,a,s){for(var l=0;l<s.length;++l)if(a===s[l]){this.set(u,a);break}},E.integer=function(u,a){/^-?\d+$/.test(a)&&this.set(u,parseInt(a,10))},E.percent=function(u,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var s=parseFloat(a);if(s>=0&&s<=100)return this.set(u,s),!0}return!1},T}();function F(T,E,g,u){var a=u?T.split(u):[T];for(var s in a){if(typeof a[s]!="string")continue;var l=a[s].split(g);if(l.length!==2)continue;var w=l[0],p=l[1];E(w,p)}}var k=new z.default(0,0,""),L=k.align==="middle"?"middle":"center";function v(T,E,g){var u=T;function a(){var w=R(T);if(w===null)throw new Error("Malformed timestamp: "+u);return T=T.replace(/^[^\sa-zA-Z-]+/,""),w}function s(w,p){var h=new j;F(w,function(c,f){var d;switch(c){case"region":for(var o=g.length-1;o>=0;o--)if(g[o].id===f){h.set(c,g[o].region);break}break;case"vertical":h.alt(c,f,["rl","lr"]);break;case"line":d=f.split(","),h.integer(c,d[0]),h.percent(c,d[0])&&h.set("snapToLines",!1),h.alt(c,d[0],["auto"]),d.length===2&&h.alt("lineAlign",d[1],["start",L,"end"]);break;case"position":d=f.split(","),h.percent(c,d[0]),d.length===2&&h.alt("positionAlign",d[1],["start",L,"end","line-left","line-right","auto"]);break;case"size":h.percent(c,f);break;case"align":h.alt(c,f,["start",L,"end","left","right"]);break}},/:/,/\s/),p.region=h.get("region",null),p.vertical=h.get("vertical","");var C=h.get("line","auto");C==="auto"&&k.line===-1&&(C=-1),p.line=C,p.lineAlign=h.get("lineAlign","start"),p.snapToLines=h.get("snapToLines",!0),p.size=h.get("size",100),p.align=h.get("align",L);var b=h.get("position","auto");b==="auto"&&k.position===50&&(b=p.align==="start"||p.align==="left"?0:p.align==="end"||p.align==="right"?100:50),p.position=b}function l(){T=T.replace(/^\s+/,"")}if(l(),E.startTime=a(),l(),T.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+u);T=T.substr(3),l(),E.endTime=a(),l(),s(T,E)}function S(T){return T.replace(/<br(?: \/)?>/gi,`
|
|
`)}var D=function(){function T(){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 E=T.prototype;return E.parse=function(u){var a=this;u&&(a.buffer+=a.decoder.decode(u,{stream:!0}));function s(){var b=a.buffer,c=0;for(b=S(b);c<b.length&&b[c]!=="\r"&&b[c]!==`
|
|
`;)++c;var f=b.substr(0,c);return b[c]==="\r"&&++c,b[c]===`
|
|
`&&++c,a.buffer=b.substr(c),f}function l(b){F(b,function(c,f){},/:/)}try{var w="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;w=s();var p=w.match(/^()?WEBVTT([ \t].*)?$/);if(!p||!p[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var h=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;h?h=!1:w=s();switch(a.state){case"HEADER":/:/.test(w)?l(w):w||(a.state="ID");continue;case"NOTE":w||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(w)){a.state="NOTE";break}if(!w)continue;if(a.cue=new z.default(0,0,""),a.state="CUE",w.indexOf("-->")===-1){a.cue.id=w;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{v(w,a.cue,a.regionList)}catch(b){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var C=w.indexOf("-->")!==-1;if(!w||C&&(h=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=`
|
|
`),a.cue.text+=w}continue;case"BADCUE":w||(a.state="ID")}}}catch(b){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},E.flush=function(){var u=this;try{if((u.cue||u.state==="HEADER")&&(u.buffer+=`
|
|
|
|
`,u.parse()),u.state==="INITIAL"||u.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(a){u.onparsingerror&&u.onparsingerror(a)}return u.onflush&&u.onflush(),this},T}()},"./src/utils/webvtt-parser.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"generateCueId",function(){return D}),A.d(G,"parseWebVTT",function(){return E});var z=A("./src/polyfills/number.ts"),I=A("./src/utils/vttparser.ts"),R=A("./src/demux/id3.ts"),j=A("./src/utils/timescale-conversion.ts"),F=A("./src/remux/mp4-remuxer.ts"),k=/\r\n|\n\r|\n|\r/g,L=function(u,a,s){return s===void 0&&(s=0),u.substr(s,a.length)===a},v=function(u){var a=parseInt(u.substr(-3)),s=parseInt(u.substr(-6,2)),l=parseInt(u.substr(-9,2)),w=u.length>9?parseInt(u.substr(0,u.indexOf(":"))):0;if(!Object(z.isFiniteNumber)(a)||!Object(z.isFiniteNumber)(s)||!Object(z.isFiniteNumber)(l)||!Object(z.isFiniteNumber)(w))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+u);return a+=1e3*s,a+=60*1e3*l,a+=60*60*1e3*w,a},S=function(u){for(var a=5381,s=u.length;s;)a=a*33^u.charCodeAt(--s);return(a>>>0).toString()};function D(g,u,a){return S(g.toString())+S(u.toString())+S(a)}var T=function(u,a,s){var l=u[a],w=u[l.prevCC];if(!w||!w.new&&l.new){u.ccOffset=u.presentationOffset=l.start,l.new=!1;return}for(;(p=w)!==null&&p!==void 0&&p.new;){var p;u.ccOffset+=l.start-w.start,l.new=!1,l=w,w=u[l.prevCC]}u.presentationOffset=s};function E(g,u,a,s,l,w,p,h){var C=new I.VTTParser,b=Object(R.utf8ArrayToStr)(new Uint8Array(g)).trim().replace(k,`
|
|
`).split(`
|
|
`),c=[],f=Object(j.toMpegTsClockFromTimescale)(u,a),d="00:00.000",o=0,y=0,m,x=!0,P=!1;C.oncue=function(U){var B=s[l],W=s.ccOffset,O=(o-f)/9e4;if(B!=null&&B.new&&(y!==void 0?W=s.ccOffset=B.start:T(s,l,O)),O&&(W=O-s.presentationOffset),P){var M=U.endTime-U.startTime,K=Object(F.normalizePts)((U.startTime+W-y)*9e4,w*9e4)/9e4;U.startTime=K,U.endTime=K+M}var X=U.text.trim();U.text=decodeURIComponent(encodeURIComponent(X)),U.id||(U.id=D(U.startTime,U.endTime,X)),U.endTime>0&&c.push(U)},C.onparsingerror=function(U){m=U},C.onflush=function(){if(m){h(m);return}p(c)},b.forEach(function(U){if(x)if(L(U,"X-TIMESTAMP-MAP=")){x=!1,P=!0,U.substr(16).split(",").forEach(function(B){L(B,"LOCAL:")?d=B.substr(6):L(B,"MPEGTS:")&&(o=parseInt(B.substr(7)))});try{y=v(d)/1e3}catch(B){P=!1,m=B}return}else U===""&&(x=!1);C.parse(U+`
|
|
`)}),C.flush()}},"./src/utils/xhr-loader.ts":function(te,G,A){"use strict";A.r(G);var z=A("./src/utils/logger.ts"),I=A("./src/loader/load-stats.ts"),R=/^age:\s*[\d.]+\s*$/m,j=function(){function F(L){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=L?L.xhrSetup:null,this.stats=new I.LoadStats,this.retryDelay=0}var k=F.prototype;return k.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},k.abortInternal=function(){var v=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),v&&(v.onreadystatechange=null,v.onprogress=null,v.readyState!==4&&(this.stats.aborted=!0,v.abort()))},k.abort=function(){var v;this.abortInternal(),(v=this.callbacks)!==null&&v!==void 0&&v.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},k.load=function(v,S,D){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=v,this.config=S,this.callbacks=D,this.retryDelay=S.retryDelay,this.loadInternal()},k.loadInternal=function(){var v=this.config,S=this.context;if(!v)return;var D=this.loader=new self.XMLHttpRequest,T=this.stats;T.loading.first=0,T.loaded=0;var E=this.xhrSetup;try{if(E)try{E(D,S.url)}catch(a){D.open("GET",S.url,!0),E(D,S.url)}D.readyState||D.open("GET",S.url,!0);var g=this.context.headers;if(g)for(var u in g)D.setRequestHeader(u,g[u])}catch(a){this.callbacks.onError({code:D.status,text:a.message},S,D);return}S.rangeEnd&&D.setRequestHeader("Range","bytes="+S.rangeStart+"-"+(S.rangeEnd-1)),D.onreadystatechange=this.readystatechange.bind(this),D.onprogress=this.loadprogress.bind(this),D.responseType=S.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),v.timeout),D.send()},k.readystatechange=function(){var v=this.context,S=this.loader,D=this.stats;if(!v||!S)return;var T=S.readyState,E=this.config;if(D.aborted)return;if(T>=2)if(self.clearTimeout(this.requestTimeout),D.loading.first===0&&(D.loading.first=Math.max(self.performance.now(),D.loading.start)),T===4){S.onreadystatechange=null,S.onprogress=null;var g=S.status;if(g>=200&&g<300){D.loading.end=Math.max(self.performance.now(),D.loading.first);var u,a;if(v.responseType==="arraybuffer"?(u=S.response,a=u.byteLength):(u=S.responseText,a=u.length),D.loaded=D.total=a,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(D,v,u,S),!this.callbacks)return;var l={url:S.responseURL,data:u};this.callbacks.onSuccess(l,D,v,S)}else D.retry>=E.maxRetry||g>=400&&g<499?(z.logger.error(g+" while loading "+v.url),this.callbacks.onError({code:g,text:S.statusText},v,S)):(z.logger.warn(g+" while loading "+v.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,E.maxRetryDelay),D.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),E.timeout)},k.loadtimeout=function(){z.logger.warn("timeout while loading "+this.context.url);var v=this.callbacks;v&&(this.abortInternal(),v.onTimeout(this.stats,this.context,this.loader))},k.loadprogress=function(v){var S=this.stats;S.loaded=v.loaded,v.lengthComputable&&(S.total=v.total)},k.getCacheAge=function(){var v=null;if(this.loader&&R.test(this.loader.getAllResponseHeaders())){var S=this.loader.getResponseHeader("age");v=S?parseFloat(S):null}return v},F}();G.default=j}}).default})},vHTk:function(et,We,Q){et.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wzkS:function(et,We,Q){"use strict";Q.d(We,"c",function(){return I}),Q.d(We,"b",function(){return R}),Q.d(We,"d",function(){return j}),Q.d(We,"a",function(){return k}),Q.d(We,"e",function(){return L});var te=Q("9og8"),G=Q("WmNS"),A=Q.n(G),z=Q("ErOA");function I(v){return Object(z.c)("libraries/".concat(v,".json"))}function R(){return Object(z.c)("library_tags.json")}function j(v){return F.apply(this,arguments)}function F(){return F=Object(te.a)(A.a.mark(function v(S){var D;return A.a.wrap(function(E){for(;;)switch(E.prev=E.next){case 0:return E.next=2,Object(z.b)("attachments/".concat(S,".json"));case 2:return D=E.sent,E.abrupt("return",D.status===0);case 4:case"end":return E.stop()}},v)})),F.apply(this,arguments)}function k(v){return Object(z.f)("libraries.json",v)}function L(v,S){return Object(z.g)("libraries/".concat(v,".json"),S)}},y5JW:function(et,We,Q){"use strict";Q.d(We,"c",function(){return g}),Q.d(We,"a",function(){return u});var te=Q("DZo9"),G=Q("8z0m"),A=Q("+L6B"),z=Q("2/Rp"),I=Q("9og8"),R=Q("miYZ"),j=Q("tsqr"),F=Q("k1fw"),k=Q("oBTY"),L=Q("WmNS"),v=Q.n(L),S=Q("cDcd"),D=Q.n(S),T=Q("m3rI"),E=Q("wzkS"),g="\u3000\u3000";function u(a){var s=["Bytes","KB","MB","GB","TB"];if(a==0)return"0 Byte";var l=parseInt(""+Math.floor(Math.log(a)/Math.log(1024)),10);return(a/Math.pow(1024,l)).toFixed(1)+" "+s[l]}We.b=function(a){var s=a.value,l=s===void 0?[]:s,w=a.action,p=a.onChange,h=a.className,C=a.maxSize,b=C===void 0?150:C,c=a.title,f=c===void 0?"\u6587\u4EF6\u4E0A\u4F20":c,d=a.accept,o=d===void 0?null:d,y={multiple:!1,fileList:l,accept:o,withCredentials:!0,beforeUpload:function(P){var U=P.size/1024/1024;return!0},action:"".concat(T.a.API_SERVER,"/api/attachments.json"),onChange:function(P){var U,B,W=Object(k.a)(P.fileList);if(W=W.map(function(K){return K.name.indexOf(g)===-1&&(K.name="".concat(K.name).concat(g).concat(u(K.size))),Object(F.a)({},K)}),P.file.status==="done"&&((U=P.file)===null||U===void 0||((B=U.response)===null||B===void 0)?void 0:B.status)===-1){var O,M;j.b.error((O=P.file)===null||O===void 0||((M=O.response)===null||M===void 0)?void 0:M.message),p([]);return}p(W)},onRemove:function(){var x=Object(I.a)(v.a.mark(function U(B){var W,O,M;return v.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:if(W=B.size/1024/1024,!(B.status==="uploading")){X.next=3;break}return X.abrupt("return",!0);case 3:if(W<b){X.next=7;break}return X.abrupt("return",!0);case 7:if(O=B.response?B.response.id:B.uid,!O){X.next=15;break}return X.next=11,Object(E.d)(B.response?B.response.id:B.id);case 11:return M=X.sent,X.abrupt("return",M);case 15:return X.abrupt("return",!0);case 16:case"end":return X.stop()}},U)}));function P(U){return x.apply(this,arguments)}return P}()};function m(x){x.preventDefault(),x.stopPropagation()}return D.a.createElement("div",{className:"single-upload ".concat(h||"")},D.a.createElement(G.a,y,D.a.createElement(z.a,{type:"primary",title:l.length>0?"\u6BCF\u6B21\u53EA\u80FD\u4E0A\u4F20\u4E00\u4E2A\u8D44\u6E90\uFF0C \u5220\u9664\u4E0B\u9762\u8D44\u6E90\u53EF\u91CD\u65B0\u4E0A\u4F20 ":"",disabled:l.length>0,ghost:!0},f),D.a.createElement("span",{onClick:m,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",b,"M)"," ")))}}}]);
|