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.
NewEduCoderBuild/p__Classrooms__Lists__Gradu...

143 lines
752 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[74,5,6,7],{"+NIl":function(st,Ke,q){(function(re){re(q("VrN/"))})(function(re){"use strict";re.defineMode("stex",function(V,A){"use strict";function G(C,x){C.cmdState.push(x)}function I(C){return C.cmdState.length>0?C.cmdState[C.cmdState.length-1]:null}function R(C){var x=C.cmdState.pop();x&&x.closeBracket()}function B(C){for(var x=C.cmdState,v=x.length-1;v>=0;v--){var d=x[v];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function U(C,x,v){return function(){this.name=C,this.bracketNo=0,this.style=x,this.styles=v,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var k={};k.importmodule=U("importmodule","tag",["string","builtin"]),k.documentclass=U("documentclass","tag",["","atom"]),k.usepackage=U("usepackage","tag",["atom"]),k.begin=U("begin","tag",["atom"]),k.end=U("end","tag",["atom"]),k.label=U("label","tag",["atom"]),k.ref=U("ref","tag",["atom"]),k.eqref=U("eqref","tag",["atom"]),k.cite=U("cite","tag",["atom"]),k.bibitem=U("bibitem","tag",["atom"]),k.Bibitem=U("Bibitem","tag",["atom"]),k.RBibitem=U("RBibitem","tag",["atom"]),k.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function L(C,x){C.f=x}function b(C,x){var v;if(C.match(/^\\[a-zA-Z@]+/)){var d=C.current().slice(1);return v=k.hasOwnProperty(d)?k[d]:k.DEFAULT,v=new v,G(x,v),L(x,O),v.style}if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/\\]/))return"tag";if(C.match("\\["))return L(x,function(u,s){return S(u,s,"\\]")}),"keyword";if(C.match("\\("))return L(x,function(u,s){return S(u,s,"\\)")}),"keyword";if(C.match("$$"))return L(x,function(u,s){return S(u,s,"$$")}),"keyword";if(C.match("$"))return L(x,function(u,s){return S(u,s,"$")}),"keyword";var o=C.next();if(o=="%")return C.skipToEnd(),"comment";if(o=="}"||o=="]"){if(v=I(x),v)v.closeBracket(o),L(x,O);else return"error";return"bracket"}else return o=="{"||o=="["?(v=k.DEFAULT,v=new v,G(x,v),"bracket"):/\d/.test(o)?(C.eatWhile(/[\w.%]/),"atom"):(C.eatWhile(/[\w\-_]/),v=B(x),v.name=="begin"&&(v.argument=C.current()),v.styleIdentifier())}function S(C,x,v){if(C.eatSpace())return null;if(v&&C.match(v))return L(x,b),"keyword";if(C.match(/^\\[a-zA-Z@]+/))return"tag";if(C.match(/^[a-zA-Z]+/))return"variable-2";if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/]/))return"tag";if(C.match(/^[\^_&]/))return"tag";if(C.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(C.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=C.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(C.skipToEnd(),"comment"):"error"}function O(C,x){var v=C.peek(),d;return v=="{"||v=="["?(d=I(x),d.openBracket(v),C.eat(v),L(x,b),"bracket"):/[ \t\r]/.test(v)?(C.eat(v),null):(L(x,b),R(x),b(C,x))}return{startState:function(){var C=A.inMathMode?function(x,v){return S(x,v)}:b;return{cmdState:[],f:C}},copyState:function(C){return{cmdState:C.cmdState.slice(),f:C.f}},token:function(C,x){return x.f(C,x)},blankLine:function(C){C.f=b,C.cmdState.length=0},lineComment:"%"}}),re.defineMIME("text/x-stex","stex"),re.defineMIME("text/x-latex","stex")})},"+ua5":function(st,Ke,q){},"/P1P":function(st,Ke,q){"use strict";q.r(Ke);var re=q("+L6B"),V=q("2/Rp"),A=q("/zsF"),G=q("PArb"),I=q("5NDa"),R=q("5rEg"),B=q("OaEy"),U=q("2fM7"),k=q("14J3"),L=q("BMrR"),b=q("jCWc"),S=q("kPKH"),O=q("sPJy"),C=q("bE4q"),x=q("miYZ"),v=q("tsqr"),d=q("k1fw"),o=q("9og8"),u=q("y8nQ"),s=q("Vl3Y"),w=q("tJVT"),g=q("WmNS"),f=q.n(g),_=q("cDcd"),p=q.n(_),h=q("Ot1p"),c=q("Ty5D"),l=q("9kvl"),a=q("55Ip"),y=q("lYpw"),m=q.n(y),E=q("B3m4"),M=q("500L"),F=function(W){var D,P=W.graduation,H=W.globalSetting,Y=W.loading,ee=W.user,oe=W.dispatch,xe=Object(c.i)(),ve=Object(c.h)(),he=ee.userInfo,fe=s.a.useForm(),me=Object(w.a)(fe,1),ae=me[0],pe=P.addTopicData,$=function(){var ne=Object(o.a)(f.a.mark(function Q(){var Ee,we,ye,Se;return f.a.wrap(function(Oe){for(;;)switch(Oe.prev=Oe.next){case 0:return Ee=ae.getFieldsValue(),we=Object(d.a)({},Ee),we!=null&&we.attachment_ids&&(we.attachment_ids=(ye=we.attachment_ids)===null||ye===void 0?void 0:ye.map(function(ke){return ke.id||ke.response.id})),Oe.next=5,Object(E.a)(Object(d.a)({coursesId:xe.coursesId,attachment_ids:[]},we));case 5:Se=Oe.sent,Se.status?v.b.error(Se.message):l.d.push("/classrooms/".concat(xe.coursesId,"/graduation_tasks/").concat(xe.categoryId));case 7:case"end":return Oe.stop()}},Q)}));return function(){return ne.apply(this,arguments)}}();return Object(_.useEffect)(function(){oe({type:"graduation/addTopicDefaultData",payload:Object(d.a)({},xe)})},[xe.coursesId]),p.a.createElement("section",{className:"edu-container"},p.a.createElement("section",{className:"animated fadeIn"},p.a.createElement("aside",{className:"mt10"},he&&p.a.createElement(C.a,{separator:">"},p.a.createElement(C.a.Item,null,p.a.createElement(a.a,{to:"".concat(he.first_category_url)},he==null||((D=he.course)===null||D===void 0)?void 0:D.course_name)),p.a.createElement(C.a.Item,null,p.a.createElement(a.a,{to:"/classrooms/".concat(xe.coursesId,"/graduation_tasks/").concat(xe.categoryId)},"\u6BD5\u8BBE\u4EFB\u52A1")),p.a.createElement(C.a.Item,null,"\u65B0\u5EFA"))),p.a.createElement("aside",{className:[m.a.title,"mt20"].join(" ")},p.a.createElement(L.a,{style:{width:"100%"}},p.a.createElement(S.a,{flex:"1"},p.a.createElement("strong",{className:"font20 ml5"},"\u65B0\u5EFA\u6BD5\u8BBE\u4EFB\u52A1")),p.a.createElement(S.a,null,p.a.createElement(a.a,{className:"font16 c-light-black",to:"/classrooms/".concat(xe.coursesId,"/exercise")},"\u8FD4\u56DE"))))),p.a.createElement("section",{className:[m.a.bg,"pt30","pl30","pr30","pb30","mt20"].join(" ")},p.a.createElement(s.a,{layout:"vertical",form:ae,scrollToFirstError:!0,onFinish:function(){var ne=Object(o.a)(f.a.mark(function Q(Ee){return f.a.wrap(function(ye){for(;;)switch(ye.prev=ye.next){case 0:$();case 1:case"end":return ye.stop()}},Q)}));return function(Q){return ne.apply(this,arguments)}}()},p.a.createElement(s.a.Item,{name:"task_type",label:"\u7C7B\u578B\uFF1A",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u4EFB\u52A1\u7C7B\u578B"}]},p.a.createElement(U.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u4EFB\u52A1\u7C7B\u578B",style:{width:200}},p.a.createElement(U.a.Option,{value:1},"\u666E\u901A"),p.a.createElement(U.a.Option,{value:2},"\u5206\u7EC4"))),p.a.createElement(s.a.Item,{name:"name",label:"\u9009\u9898\u540D\u79F0\uFF1A",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EFB\u52A1\u6807\u9898"}]},p.a.createElement(R.a,{maxLength:60,size:"large",suffix:"0/60",placeholder:"\u4EFB\u52A1\u6807\u9898\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26"})),p.a.createElement(G.a,null),p.a.createElement(s.a.Item,{label:"\u5185\u5BB9",name:"description",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5185\u5BB9"}]},p.a.createElement(h.a,{watch:!0,placeholder:"\u8BF7\u4EFB\u52A1\u5185\u5BB9\u8BF4\u660E\uFF0C\u6700\u5927\u9650\u52365000\u4E2A\u5B57\u7B26"})),p.a.createElement(L.a,null,p.a.createElement(S.a,null,p.a.createElement(s.a.Item,{name:"attachment_ids"},p.a.createElement(M.b,null)))))),p.a.createElement("aside",{className:m.a.btns},p.a.createElement(V.a,{type:"primary",onClick:function(){ae.submit()}},"\u4FDD\u5B58"),p.a.createElement(a.a,{to:"/classrooms/".concat(xe.coursesId,"/graduation_tasks/").concat(xe.categoryId)},"\u53D6\u6D88")))};Ke.default=Object(l.a)(function(j){var W=j.graduation,D=j.loading,P=j.user,H=j.globalSetting;return{graduation:W,globalSetting:H,user:P,loading:D.effects}})(F)},"19Vz":function(st,Ke,q){(function(re){re(q("VrN/"))})(function(re){re.defineOption("placeholder","",function(U,k,L){var b=L&&L!=re.Init;if(k&&!b)U.on("blur",I),U.on("change",R),U.on("swapDoc",R),re.on(U.getInputField(),"compositionupdate",U.state.placeholderCompose=function(){G(U)}),R(U);else if(!k&&b){U.off("blur",I),U.off("change",R),U.off("swapDoc",R),re.off(U.getInputField(),"compositionupdate",U.state.placeholderCompose),V(U);var S=U.getWrapperElement();S.className=S.className.replace(" CodeMirror-empty","")}k&&!U.hasFocus()&&I(U)});function V(U){U.state.placeholder&&(U.state.placeholder.parentNode.removeChild(U.state.placeholder),U.state.placeholder=null)}function A(U){V(U);var k=U.state.placeholder=document.createElement("pre");k.style.cssText="height: 0; overflow: visible",k.style.direction=U.getOption("direction"),k.className="CodeMirror-placeholder CodeMirror-line-like";var L=U.getOption("placeholder");typeof L=="string"&&(L=document.createTextNode(L)),k.appendChild(L),U.display.lineSpace.insertBefore(k,U.display.lineSpace.firstChild)}function G(U){setTimeout(function(){var k=!1,L=U.getInputField();L.nodeName=="TEXTAREA"?k=!L.value:U.lineCount()==1&&(k=!/[^\u200b]/.test(L.querySelector(".CodeMirror-line").textContent)),k?A(U):V(U)},20)}function I(U){B(U)&&A(U)}function R(U){var k=U.getWrapperElement(),L=B(U);k.className=k.className.replace(" CodeMirror-empty","")+(L?" CodeMirror-empty":""),L?A(U):V(U)}function B(U){return U.lineCount()===1&&U.getLine(0)===""}})},"1eCo":function(st,Ke,q){(function(re){re(q("VrN/"))})(function(re){"use strict";var V={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},A={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};re.defineMode("xml",function(G,I){var R=G.indentUnit,B={},U=I.htmlMode?V:A;for(var k in U)B[k]=U[k];for(var k in I)B[k]=I[k];var L,b;function S(a,y){function m(F){return y.tokenize=F,F(a,y)}var E=a.next();if(E=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?m(x("atom","]]>")):null:a.match("--")?m(x("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),m(v(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),y.tokenize=x("meta","?>"),"meta"):(L=a.eat("/")?"closeTag":"openTag",y.tokenize=O,"tag bracket");if(E=="&"){var M;return a.eat("#")?a.eat("x")?M=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):M=a.eatWhile(/[\d]/)&&a.eat(";"):M=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),M?"atom":"error"}else return a.eatWhile(/[^&<]/),null}S.isInText=!0;function O(a,y){var m=a.next();if(m==">"||m=="/"&&a.eat(">"))return y.tokenize=S,L=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return L="equals",null;if(m=="<"){y.tokenize=S,y.state=s,y.tagName=y.tagStart=null;var E=y.tokenize(a,y);return E?E+" tag error":"tag error"}else return/[\'\"]/.test(m)?(y.tokenize=C(m),y.stringStartCol=a.column(),y.tokenize(a,y)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function C(a){var y=function(m,E){for(;!m.eol();)if(m.next()==a){E.tokenize=O;break}return"string"};return y.isInAttribute=!0,y}function x(a,y){return function(m,E){for(;!m.eol();){if(m.match(y)){E.tokenize=S;break}m.next()}return a}}function v(a){return function(y,m){for(var E;(E=y.next())!=null;){if(E=="<")return m.tokenize=v(a+1),m.tokenize(y,m);if(E==">")if(a==1){m.tokenize=S;break}else return m.tokenize=v(a-1),m.tokenize(y,m)}return"meta"}}function d(a,y,m){this.prev=a.context,this.tagName=y,this.indent=a.indented,this.startOfLine=m,(B.doNotIndent.hasOwnProperty(y)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function u(a,y){for(var m;;){if(!a.context)return;if(m=a.context.tagName,!B.contextGrabbers.hasOwnProperty(m)||!B.contextGrabbers[m].hasOwnProperty(y))return;o(a)}}function s(a,y,m){return a=="openTag"?(m.tagStart=y.column(),w):a=="closeTag"?g:s}function w(a,y,m){return a=="word"?(m.tagName=y.current(),b="tag",p):B.allowMissingTagName&&a=="endTag"?(b="tag bracket",p(a,y,m)):(b="error",w)}function g(a,y,m){if(a=="word"){var E=y.current();return m.context&&m.context.tagName!=E&&B.implicitlyClosed.hasOwnProperty(m.context.tagName)&&o(m),m.context&&m.context.tagName==E||B.matchClosing===!1?(b="tag",f):(b="tag error",_)}else return B.allowMissingTagName&&a=="endTag"?(b="tag bracket",f(a,y,m)):(b="error",_)}function f(a,y,m){return a!="endTag"?(b="error",f):(o(m),s)}function _(a,y,m){return b="error",f(a,y,m)}function p(a,y,m){if(a=="word")return b="attribute",h;if(a=="endTag"||a=="selfcloseTag"){var E=m.tagName,M=m.tagStart;return m.tagName=m.tagStart=null,a=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(E)?u(m,E):(u(m,E),m.context=new d(m,E,M==m.indented)),s}return b="error",p}function h(a,y,m){return a=="equals"?c:(B.allowMissing||(b="error"),p(a,y,m))}function c(a,y,m){return a=="string"?l:a=="word"&&B.allowUnquoted?(b="string",p):(b="error",p(a,y,m))}function l(a,y,m){return a=="string"?l:p(a,y,m)}return{startState:function(a){var y={tokenize:S,state:s,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(y.baseIndent=a),y},token:function(a,y){if(!y.tagName&&a.sol()&&(y.indented=a.indentation()),a.eatSpace())return null;L=null;var m=y.tokenize(a,y);return(m||L)&&m!="comment"&&(b=null,y.state=y.state(L||m,a,y),b&&(m=b=="error"?m+" error":b)),m},indent:function(a,y,m){var E=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+R;if(E&&E.noIndent)return re.Pass;if(a.tokenize!=O&&a.tokenize!=S)return m?m.match(/^(\s*)/)[0].length:0;if(a.tagName)return B.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+R*(B.multilineTagIndentFactor||1);if(B.alignCDATA&&/<!\[CDATA\[/.test(y))return 0;var M=y&&/^<(\/)?([\w_:\.-]*)/.exec(y);if(M&&M[1])for(;E;)if(E.tagName==M[2]){E=E.prev;break}else if(B.implicitlyClosed.hasOwnProperty(E.tagName))E=E.prev;else break;else if(M)for(;E;){var F=B.contextGrabbers[E.tagName];if(F&&F.hasOwnProperty(M[2]))E=E.prev;else break}for(;E&&E.prev&&!E.startOfLine;)E=E.prev;return E?E.indent+R:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:B.htmlMode?"html":"xml",helperType:B.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=p)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var y=[],m=a.context;m;m=m.prev)m.tagName&&y.push(m.tagName);return y.reverse()}}}),re.defineMIME("text/xml","xml"),re.defineMIME("application/xml","xml"),re.mimeModes.hasOwnProperty("text/html")||re.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"500L":function(st,Ke,q){"use strict";q.d(Ke,"a",function(){return g});var re=q("+L6B"),V=q("2/Rp"),A=q("2qtc"),G=q("kLXV"),I=q("9og8"),R=q("k1fw"),B=q("miYZ"),U=q("tsqr"),k=q("oBTY"),L=q("tJVT"),b=q("DZo9"),S=q("8z0m"),O=q("WmNS"),C=q.n(O),x=q("cDcd"),v=q.n(x),d=q("m3rI"),o=q("wzkS"),u=q("y5JW"),s=q("LtfV"),w=S.a.Dragger;function g(f){var _=[];return f&&f.length>0&&(_=f.map(function(p){return{uid:p.id,id:p.id,name:p.title+u.c+p.filesize,url:p.url,filesize:p.filesize,status:"done",response:{id:p.id}}})),_}Ke.b=function(f){var _=f.value,p=f.onChange,h=f.action,c=f.className,l=f.maxSize,a=l===void 0?150:l,y=f.title,m=y===void 0?"\u4E0A\u4F20\u9644\u4EF6":y,E=f.showRemoveModal,M=E===void 0?!1:E,F=f.accept,j=F===void 0?"":F,W=f.additionalText,D=f.isDragger,P=f.number,H=P===void 0?1e3:P,Y=f.aloneClear,ee=Y===void 0?!1:Y,oe=Object(x.useState)(!1),xe=Object(L.a)(oe,2),ve=xe[0],he=xe[1],fe=Object(x.useState)(_||[]),me=Object(L.a)(fe,2),ae=me[0],pe=me[1];Object(x.useEffect)(function(){_&&(pe(Object(k.a)(_)),H===(_==null?void 0:_.length)&&he(!0))},[_]);var $=function(){setTimeout(function(){ae.pop(),pe(Object(k.a)(ae))},500)},ne={multiple:!0,disabled:ve,accept:j,withCredentials:!0,fileList:ae,beforeUpload:function(we,ye){var Se=we.size/1024/1024;return ae.concat(ye).length>H?(ae.pop(),pe(Object(k.a)(ae)),U.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(H,"\u4E2A\u6587\u4EF6")),ee?Promise.reject():($(),!1)):!0},action:h||"".concat(d.a.API_SERVER,"/api/attachments.json"),onChange:function(we){var ye,Se,Le=Object(k.a)(we.fileList);if(we.file.status==="done"&&((ye=we.file)===null||ye===void 0||((Se=ye.response)===null||Se===void 0)?void 0:Se.status)===-1){var Oe,ke;U.b.error((Oe=we.file)===null||Oe===void 0||((ke=Oe.response)===null||ke===void 0)?void 0:ke.message);return}Le.length>=H?he(!0):he(!1),pe(Object(k.a)(Le)),Le=Le.map(function(De){var Pe;if(De!=null&&(Pe=De.response)!==null&&Pe!==void 0&&Pe.id){var ze;De.url="/api/attachments/".concat(De==null||((ze=De.response)===null||ze===void 0)?void 0:ze.id)}return De.name.indexOf(u.c)===-1&&(De.name="".concat(De.name).concat(u.c).concat(Object(u.a)(De.size))),Object(R.a)({},De)}),console.log("info:",we),p(Le)},onRemove:function(){var Ee=Object(I.a)(C.a.mark(function ye(Se){var Le;return C.a.wrap(function(ke){for(;;)switch(ke.prev=ke.next){case 0:if(Le=function(){var De=Object(I.a)(C.a.mark(function Pe(){var ze,$e;return C.a.wrap(function(He){for(;;)switch(He.prev=He.next){case 0:if(ze=Se.response?Se.response.id:Se.id,!ze){He.next=8;break}return He.next=4,Object(o.d)(Se.response?Se.response.id:Se.uid);case 4:return $e=He.sent,He.abrupt("return",$e);case 8:return He.abrupt("return",!0);case 9:case"end":return He.stop()}},Pe)}));return function(){return De.apply(this,arguments)}}(),!M){ke.next=5;break}return ke.abrupt("return",new Promise(function(De,Pe){G.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:v.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var ze=Object(I.a)(C.a.mark(function We(){var He;return C.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:return Je.next=2,Le();case 2:He=Je.sent,U.b.success("\u5220\u9664\u6210\u529F"),De(!0);case 5:case"end":return Je.stop()}},We)}));function $e(){return ze.apply(this,arguments)}return $e}(),onCancel:function(){return De(!1)}})}));case 5:return ke.next=7,Le();case 7:return ke.abrupt("return",ke.sent);case 8:case"end":return ke.stop()}},ye)}));function we(ye){return Ee.apply(this,arguments)}return we}()};function Q(Ee){Ee.preventDefault(),Ee.stopPropagation()}return v.a.createElement("div",{className:"multi-upload ".concat(c||"")},D&&v.a.createElement(w,ne,v.a.createElement("p",{className:"ant-upload-drag-icon"},v.a.createElement(s.a,null)),v.a.createElement("p",{className:"ant-upload-text"},"\u70B9\u51FB\u4E0A\u4F20\u56FE\u6807\uFF0C\u9009\u62E9\u8981\u4E0A\u4F20\u7684\u6587\u4EF6\u6216\u5C06\u6587\u4EF6\u62D6\u62FD\u5230\u6B64",v.a.createElement("br",null),"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",a,"MB)"," "),W),!D&&v.a.createElement(S.a,ne,v.a.createElement(V.a,{disabled:ve},m),v.a.createElement("span",{onClick:Q,style:{marginLeft:10,color:"#FA6400"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",a,"MB)"," ")))}},"55Ip":function(st,Ke,q){"use strict";q.d(Ke,"a",function(){return u});var re=q("Ty5D"),V=q("dI71"),A=q("cDcd"),G=q.n(A),I=q("YS25"),R=q("17x9"),B=q.n(R),U=q("wx14"),k=q("zLVn"),L=q("9R94"),b=function(c){Object(V.a)(l,c);function l(){for(var y,m=arguments.length,E=new Array(m),M=0;M<m;M++)E[M]=arguments[M];return y=c.call.apply(c,[this].concat(E))||this,y.history=Object(I.a)(y.props),y}var a=l.prototype;return a.render=function(){return G.a.createElement(re.c,{history:this.history,children:this.props.children})},l}(G.a.Component),S=function(c){Object(V.a)(l,c);function l(){for(var y,m=arguments.length,E=new Array(m),M=0;M<m;M++)E[M]=arguments[M];return y=c.call.apply(c,[this].concat(E))||this,y.history=Object(I.b)(y.props),y}var a=l.prototype;return a.render=function(){return G.a.createElement(re.c,{history:this.history,children:this.props.children})},l}(G.a.Component),O=function(l,a){return typeof l=="function"?l(a):l},C=function(l,a){return typeof l=="string"?Object(I.c)(l,null,null,a):l},x=function(l){return l},v=G.a.forwardRef;typeof v=="undefined"&&(v=x);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=v(function(c,l){var a=c.innerRef,y=c.navigate,m=c.onClick,E=Object(k.a)(c,["innerRef","navigate","onClick"]),M=E.target,F=Object(U.a)({},E,{onClick:function(W){try{m&&m(W)}catch(D){throw W.preventDefault(),D}!W.defaultPrevented&&W.button===0&&(!M||M==="_self")&&!d(W)&&(W.preventDefault(),y())}});return x!==v?F.ref=l||a:F.ref=a,G.a.createElement("a",F)}),u=v(function(c,l){var a=c.component,y=a===void 0?o:a,m=c.replace,E=c.to,M=c.innerRef,F=Object(k.a)(c,["component","replace","to","innerRef"]);return G.a.createElement(re.e.Consumer,null,function(j){j||Object(L.a)(!1);var W=j.history,D=C(O(E,j.location),j.location),P=D?W.createHref(D):"",H=Object(U.a)({},F,{href:P,navigate:function(){var ee=O(E,j.location),oe=m?W.replace:W.push;oe(ee)}});return x!==v?H.ref=l||M:H.innerRef=M,G.a.createElement(y,H)})});if(!1)var s,w;var g=function(l){return l},f=G.a.forwardRef;typeof f=="undefined"&&(f=g);function _(){for(var c=arguments.length,l=new Array(c),a=0;a<c;a++)l[a]=arguments[a];return l.filter(function(y){return y}).join(" ")}var p=f(function(c,l){var a=c["aria-current"],y=a===void 0?"page":a,m=c.activeClassName,E=m===void 0?"active":m,M=c.activeStyle,F=c.className,j=c.exact,W=c.isActive,D=c.location,P=c.sensitive,H=c.strict,Y=c.style,ee=c.to,oe=c.innerRef,xe=Object(k.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return G.a.createElement(re.e.Consumer,null,function(ve){ve||Object(L.a)(!1);var he=D||ve.location,fe=C(O(ee,he),he),me=fe.pathname,ae=me&&me.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),pe=ae?Object(re.f)(he.pathname,{path:ae,exact:j,sensitive:P,strict:H}):null,$=!!(W?W(pe,he):pe),ne=$?_(F,E):F,Q=$?Object(U.a)({},Y,{},M):Y,Ee=Object(U.a)({"aria-current":$&&y||null,className:ne,style:Q,to:fe},xe);return g!==f?Ee.ref=l||oe:Ee.innerRef=oe,G.a.createElement(u,Ee)})});if(!1)var h},"7Cbv":function(st,Ke,q){"use strict";var re=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),V=new Uint8Array(16);function A(){if(!re)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return re(V)}var G=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function I(O){return typeof O=="string"&&G.test(O)}for(var R=I,B=[],U=0;U<256;++U)B.push((U+256).toString(16).substr(1));function k(O){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,x=(B[O[C+0]]+B[O[C+1]]+B[O[C+2]]+B[O[C+3]]+"-"+B[O[C+4]]+B[O[C+5]]+"-"+B[O[C+6]]+B[O[C+7]]+"-"+B[O[C+8]]+B[O[C+9]]+"-"+B[O[C+10]]+B[O[C+11]]+B[O[C+12]]+B[O[C+13]]+B[O[C+14]]+B[O[C+15]]).toLowerCase();if(!R(x))throw TypeError("Stringified UUID is invalid");return x}var L=k;function b(O,C,x){O=O||{};var v=O.random||(O.rng||A)();if(v[6]=v[6]&15|64,v[8]=v[8]&63|128,C){x=x||0;for(var d=0;d<16;++d)C[x+d]=v[d];return C}return L(v)}var S=Ke.a=b},"7ahc":function(st,Ke,q){"use strict";q.d(Ke,"a",function(){return w});var re=q("k1fw"),V=q("0Owb"),A=q("+L6B"),G=q("2/Rp"),I=q("y8nQ"),R=q("Vl3Y"),B=q("tJVT"),U=q("OaEy"),k=q("2fM7"),L=q("cDcd"),b=q.n(L),S=q("VrN/"),O=q.n(S),C=q("p77/"),x=q.n(C),v=q("c5Ni"),d=q.n(v),o=k.a.Option,u={labelCol:{span:4},wrapperCol:{span:20}},s={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};Ke.b=function(g){var f=g.callback,_=g.onCancel,p=Object(L.useState)("python"),h=Object(B.a)(p,2),c=h[0],l=h[1];function a(m){l(s[m][1])}function y(m){f(m)}return b.a.createElement(R.a,Object(V.a)({},u,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:y}),b.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},b.a.createElement(k.a,{onChange:a},Object.keys(s).map(function(m){return b.a.createElement(o,{key:m,value:m},s[m][0])}))),b.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},b.a.createElement(w,{mode:c})),b.a.createElement("div",{className:"flex-container flex-end"},b.a.createElement(G.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(G.a,{type:"ghost",onClick:_},"\u53D6\u6D88")))};function w(g){var f=g.value,_=g.onChange,p=g.mode,h=g.options,c=h===void 0?{}:h,l=Object(L.useRef)(),a=Object(L.useState)(),y=Object(B.a)(a,2),m=y[0],E=y[1];return Object(L.useEffect)(function(){if(m){function M(F){var j=F.getValue();_&&_(j)}return m.on("change",M),function(){m.off("change",M)}}},[m,_]),Object(L.useEffect)(function(){m&&m.setOption("mode",p)},[m,p]),Object(L.useEffect)(function(){m&&((f!==m.getValue()||f==="")&&setTimeout(function(){m.setValue(f||" ")},300))},[m,f]),Object(L.useEffect)(function(){if(l.current&&!m){var M=O.a.fromTextArea(l.current,Object(re.a)({mode:p,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));E(M)}},[l.current,m]),b.a.createElement("div",{className:"my-codemirror-container"},b.a.createElement("textarea",{ref:l}))}},"8EBN":function(st,Ke,q){(function(re){re(q("VrN/"))})(function(re){"use strict";re.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var V=0;V<re.modeInfo.length;V++){var A=re.modeInfo[V];A.mimes&&(A.mime=A.mimes[0])}re.findModeByMIME=function(G){G=G.toLowerCase();for(var I=0;I<re.modeInfo.length;I++){var R=re.modeInfo[I];if(R.mime==G)return R;if(R.mimes){for(var B=0;B<R.mimes.length;B++)if(R.mimes[B]==G)return R}}if(/\+xml$/.test(G))return re.findModeByMIME("application/xml");if(/\+json$/.test(G))return re.findModeByMIME("application/json")},re.findModeByExtension=function(G){G=G.toLowerCase();for(var I=0;I<re.modeInfo.length;I++){var R=re.modeInfo[I];if(R.ext){for(var B=0;B<R.ext.length;B++)if(R.ext[B]==G)return R}}},re.findModeByFileName=function(G){for(var I=0;I<re.modeInfo.length;I++){var R=re.modeInfo[I];if(R.file&&R.file.test(G))return R}var B=G.lastIndexOf("."),U=B>-1&&G.substring(B+1,G.length);if(U)return re.findModeByExtension(U)},re.findModeByName=function(G){G=G.toLowerCase();for(var I=0;I<re.modeInfo.length;I++){var R=re.modeInfo[I];if(R.name.toLowerCase()==G)return R;if(R.alias){for(var B=0;B<R.alias.length;B++)if(R.alias[B].toLowerCase()==G)return R}}}})},"8hTe":function(st,Ke,q){st.exports={button:"button___1wy9m"}},"9Bee":function(st,Ke,q){"use strict";var re=q("DYRE"),V=q("zeV3"),A=q("+L6B"),G=q("2/Rp"),I=q("k1fw"),R=q("tJVT"),B=q("cDcd"),U=q.n(B),k=q("vg9a"),L=q("DlQD"),b=q.n(L),S=q("rUJ1");function O(he,fe){var me=he.match(/^(\s+)(?:```)/);if(me===null)return fe;var ae=me[1];return fe.split(`
`).map(function(pe){var $=pe.match(/^\s+/);if($===null)return pe;var ne=Object(R.a)($,1),Q=ne[0];return Q.length>=ae.length?pe.slice(ae.length):pe}).join(`
`)}var C=[],x=["<ul>"],v=new b.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function o(){C.length=0,x=["<ul>"]}var u={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function s(he,fe,me,ae){if(fe>=he.length||he[fe].level<=me)return fe;var pe=he[fe];ae.push("<li><a href='#"+pe.anchor+"'>"+pe.text+"</a>"),fe++;var $=[];return fe=s(he,fe,pe.level,$),$.length>0&&(ae.push("<ul>"),$.forEach(function(ne){ae.push(ne)}),ae.push("</ul>")),ae.push("</li>"),fe=s(he,fe,me,ae),fe}function w(){return s(C,0,0,x),x.push("</ul>"),x.join("")}var g={heading:function(fe){var me=d.exec(fe);if(me)return{type:"heading",raw:me[0],depth:me[1].length,text:me[2]}},fences:function(fe){var me=this.rules.block.fences.exec(fe);if(me){var ae=me[0],pe=O(ae,me[3]||""),$=me[2]?me[2].trim():me[2];if(["latex","katex","math"].indexOf($)>=0){var ne=p(),Q=pe;pe=ne,h[ne]={type:"block",expression:Q}}return{type:"code",raw:ae,lang:$,text:pe}}}},f=/(?:\${2})([^\n`]+?)(?:\${2})/gi,_=0,p=function(){return"__special_katext_id_".concat(_++,"__")},h={};function c(){return h}function l(){_=0,h={}}function a(he){return he=he.replace(f,function(fe,me){var ae=p();return h[ae]={type:"inline",expression:me},ae}),he}var y=v.listitem;v.listitem=function(he){return y(a(he))};var m=v.paragraph;v.paragraph=function(he){return m(a(he))};var E=v.tablecell;v.tablecell=function(he,fe){return E(a(he),fe)},v.code=function(he,fe,me){var ae=(fe||"").match(/\S*/)[0];return ae?["latex","katex","math"].indexOf(ae)>=0?"<p class='editormd-tex'>".concat(he,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(fe,'">').concat(me?he:Object(S.escape)(he,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(me?he:Object(S.escape)(he,!0))+"</code></pre>"},v.heading=function(he,fe,me){var ae=this.options.headerPrefix+me.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return C.push({anchor:ae,level:fe,text:he}),"<h"+fe+' id="'+ae+'">'+he+"</h"+fe+">"},b.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),b.a.use({tokenizer:g,renderer:v});var M=b.a,F=q("SJMd"),j=q("ulZh"),W=q.n(j),D=q("m3rI"),P=q("Oy/b"),H=q("p5ED"),Y=q("8hTe"),ee=q.n(Y),oe=/<pre[^>]*>/g;function xe(he){var fe=document.createElement("div");return fe.innerHTML=he,fe.childNodes.length===0?"":fe.childNodes[0].nodeValue}var ve=Ke.a=function(he){var fe=he.value,me=fe===void 0?"":fe,ae=he.edit,pe=ae===void 0?!1:ae,$=he.className,ne=he.showTextOnly,Q=he.showLines,Ee=he.replaces,we=he.zoomImg,ye=he.hasMask,Se=he.style,Le=Se===void 0?{}:Se,Oe=he.stylesPrev,ke=Oe===void 0?{}:Oe,De=String(me),Pe=Object(B.useRef)(),ze=Object(B.useRef)(),$e=Object(B.useState)(""),We=Object(R.a)($e,2),He=We[0],rt=We[1],Je=Object(B.useState)("office"),Qe=Object(R.a)(Je,2),Ae=Qe[0],et=Qe[1],Ze=Object(B.useMemo)(function(){try{var de=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,J=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Z=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;De=De.replace(de,"("+D.a.API_SERVER+"/api/attachments/").replace(J,'"'+D.a.API_SERVER+"/api/attachments/").replace(Z,'"'+D.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`)}catch(_e){}var te=M(De),se=c();if(De.match(/\[TOC\]/)&&(te=te.replace("<p>[TOC]</p>",w()),o()),te=te.replace(/(__special_katext_id_\d+__)/g,function(_e,Ce){var Ie=se[Ce],Ye=Ie.type,Ge=Ie.expression;return Object(P.renderToString)(xe(Ge)||"",{displayMode:Ye==="block",throwOnError:!1,output:"html"})}),te=te.replace(/▁/g,"\u2581\u2581\u2581"),l(),ne){var ce=document.createElement("div");return ce.innerHTML=te,ce.innerText}return setTimeout(function(){return ge()},500),te},[De]),Re=Object(B.useRef)();u.WebkitLineClamp=Q,Q&&(Le=Object(I.a)(Object(I.a)({},Le),u));function Fe(de){var J=de.target;if(J.tagName.toUpperCase()==="IMG"){if(we){var Z=J.getAttribute("src");rt(Z),et("image")}}else if(J.tagName.toUpperCase()==="A"){var te=J.getAttribute("href");if(te.indexOf("office")>-1)de.preventDefault(),rt(te),et("office");else if(te.indexOf("application/pdf")>-1)de.preventDefault(),rt(te),et("pdf");else if(te.indexOf("text/html")>-1)de.preventDefault(),rt(te),et("html");else if(te.startsWith("#")){de.preventDefault();var se=document.getElementById(te.replace("#",""));se&&se.scrollIntoView(!0)}}}var ge=function(){var J,Z=(J=Re.current)===null||J===void 0?void 0:J.querySelectorAll("video");Z==null||Z.forEach(function(te){if(te.oncontextmenu=function(){return!1},te.src.indexOf(".m3u8")>-1&&!te.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var se=new W.a;se.loadSource(te.src),se.attachMedia(te)}}})};Object(B.useEffect)(function(){if(Re.current&&Ze&&(Ze.match(oe)&&window.PR.prettyPrint()),Re.current)return Re.current.addEventListener("click",Fe),function(){Re.current.removeEventListener("click",Fe),l(),o()}},[Ze,Re.current,Fe]);var ue=function(J){if(!pe)return;J.target.nodeName==="IMG"?(Pe.current.style.display="flex",Pe.current.style.width=J.target.clientWidth+"px",Pe.current.style.height=J.target.clientHeight+"px",Pe.current.style.top=J.target.offsetTop+"px",Pe.current.style.left=J.target.offsetLeft+"px",ze.current.src=J.target.getAttribute("src")):Pe.current.style.display="none"};return U.a.createElement("div",{style:{position:"relative"}},U.a.createElement("div",{ref:Re,style:Object(I.a)({},Le),className:"".concat($||""," markdown-body ").concat(ee.a.mdBody),onMouseOver:ue,dangerouslySetInnerHTML:{__html:Ze}}),U.a.createElement("div",{ref:Pe,className:ee.a.button},U.a.createElement(V.a,null,U.a.createElement(G.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),U.a.createElement(G.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),U.a.createElement("img",{ref:ze,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),U.a.createElement(H.a,{close:!0,data:He,type:He!=null&&He.length?Ae:"",style:Object(I.a)({},ke),onClose:function(){return rt("")}}))}},"9VGf":function(st,Ke,q){"use strict";q.d(Ke,"a",function(){return A});var re=q("cDcd"),V=q.n(re);function A(G,I){var R=Object(re.useRef)();Object(re.useEffect)(function(){R.current=G}),Object(re.useEffect)(function(){function B(){R.current()}if(I!==null){var U=setInterval(B,I);return function(){return clearInterval(U)}}},[I])}},BU3w:function(st,Ke,q){"use strict";q.d(Ke,"a",function(){return R});var re=q("MNnm"),V="rc-util-key";function A(B){if(B.attachTo)return B.attachTo;var U=document.querySelector("head");return U||document.body}function G(B){var U,k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(re.a)())return null;var L=document.createElement("style");if((U=k.csp)===null||U===void 0?void 0:U.nonce){var b;L.nonce=(b=k.csp)===null||b===void 0?void 0:b.nonce}L.innerHTML=B;var S=A(k),O=S.firstChild;return k.prepend&&S.prepend?S.prepend(L):k.prepend&&O?S.insertBefore(L,O):S.appendChild(L),L}var I=new Map;function R(B,U){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},L=A(k);if(!I.has(L)){var b=G("",k),S=b.parentNode;I.set(L,S),S.removeChild(b)}var O=Array.from(I.get(L).children).find(function(o){return o.tagName==="STYLE"&&o[V]===U});if(O){var C,x;if(((C=k.csp)===null||C===void 0?void 0:C.nonce)&&O.nonce!==((x=k.csp)===null||x===void 0?void 0:x.nonce)){var v;O.nonce=(v=k.csp)===null||v===void 0?void 0:v.nonce}return O.innerHTML!==B&&(O.innerHTML=B),O}var d=G(B,k);return d[V]=U,d}},Bd2K:function(st,Ke,q){(function(re){re(q("VrN/"),q("osHv"))})(function(re){re.defineOption("autoCloseTags",!1,function(k,L,b){if(b!=re.Init&&b&&k.removeKeyMap("autoCloseTags"),!L)return;var S={name:"autoCloseTags"};(typeof L!="object"||L.whenClosing!==!1)&&(S["'/'"]=function(O){return R(O)}),(typeof L!="object"||L.whenOpening!==!1)&&(S["'>'"]=function(O){return G(O)}),k.addKeyMap(S)});var V=["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 G(k){if(k.getOption("disableInput"))return re.Pass;for(var L=k.listSelections(),b=[],S=k.getOption("autoCloseTags"),O=0;O<L.length;O++){if(!L[O].empty())return re.Pass;var C=L[O].head,x=k.getTokenAt(C),v=re.innerMode(k.getMode(),x.state),d=v.state,o=v.mode.xmlCurrentTag&&v.mode.xmlCurrentTag(d),u=o&&o.name;if(!u)return re.Pass;var s=v.mode.configuration=="html",w=typeof S=="object"&&S.dontCloseTags||s&&V,g=typeof S=="object"&&S.indentTags||s&&A;x.end>C.ch&&(u=u.slice(0,u.length-x.end+C.ch));var f=u.toLowerCase();if(!u||x.type=="string"&&(x.end!=C.ch||!/[\"\']/.test(x.string.charAt(x.string.length-1))||x.string.length==1)||x.type=="tag"&&o.close||x.string.indexOf("/")==C.ch-x.start-1||w&&B(w,f)>-1||U(k,v.mode.xmlCurrentContext&&v.mode.xmlCurrentContext(d)||[],u,C,!0))return re.Pass;var _=typeof S=="object"&&S.emptyTags;if(_&&B(_,u)>-1){b[O]={text:"/>",newPos:re.Pos(C.line,C.ch+2)};continue}var p=g&&B(g,f)>-1;b[O]={indent:p,text:">"+(p?`
`:"")+"</"+u+">",newPos:p?re.Pos(C.line+1,0):re.Pos(C.line,C.ch+1)}}for(var h=typeof S=="object"&&S.dontIndentOnAutoClose,O=L.length-1;O>=0;O--){var c=b[O];k.replaceRange(c.text,L[O].head,L[O].anchor,"+insert");var l=k.listSelections().slice(0);l[O]={head:c.newPos,anchor:c.newPos},k.setSelections(l),!h&&c.indent&&(k.indentLine(c.newPos.line,null,!0),k.indentLine(c.newPos.line+1,null,!0))}}function I(k,L){for(var b=k.listSelections(),S=[],O=L?"/":"</",C=k.getOption("autoCloseTags"),x=typeof C=="object"&&C.dontIndentOnSlash,v=0;v<b.length;v++){if(!b[v].empty())return re.Pass;var d=b[v].head,o=k.getTokenAt(d),u=re.innerMode(k.getMode(),o.state),s=u.state;if(L&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=d.ch-1))return re.Pass;var w,g=u.mode.name!="xml"&&k.getMode().name=="htmlmixed";if(g&&u.mode.name=="javascript")w=O+"script";else if(g&&u.mode.name=="css")w=O+"style";else{var f=u.mode.xmlCurrentContext&&u.mode.xmlCurrentContext(s);if(!f||f.length&&U(k,f,f[f.length-1],d))return re.Pass;w=O+f[f.length-1]}k.getLine(d.line).charAt(o.end)!=">"&&(w+=">"),S[v]=w}if(k.replaceSelections(S),b=k.listSelections(),!x)for(var v=0;v<b.length;v++)(v==b.length-1||b[v].head.line<b[v+1].head.line)&&k.indentLine(b[v].head.line)}function R(k){return k.getOption("disableInput")?re.Pass:I(k,!0)}re.commands.closeTag=function(k){return I(k)};function B(k,L){if(k.indexOf)return k.indexOf(L);for(var b=0,S=k.length;b<S;++b)if(k[b]==L)return b;return-1}function U(k,L,b,S,O){if(!re.scanForClosingTag)return!1;var C=Math.min(k.lastLine()+1,S.line+500),x=re.scanForClosingTag(k,S,null,C);if(!x||x.tag!=b)return!1;for(var v=O?1:0,d=L.length-1;d>=0&&L[d]==b;d--)++v;S=x.to;for(var d=1;d<v;d++){var o=re.scanForClosingTag(k,S,null,C);if(!o||o.tag!=b)return!1;S=o.to}return!0}})},BjJ7:function(st,Ke,q){"use strict";q.d(Ke,"d",function(){return V}),q.d(Ke,"c",function(){return A}),q.d(Ke,"e",function(){return G}),q.d(Ke,"b",function(){return I}),q.d(Ke,"a",function(){return B});var re=q("m3rI");function V(U){var k=!0;if(U.length>0){for(var L=0;L<U.length;L++)if(U[L].compile_success==0||!U[L].compile_success){k=!1;break}}else k=!1;return k}function A(U){for(var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",L=[],b=0;b<U.length;b++){var S=U[b],O=k?"".concat(k,"/").concat(S.name):"".concat(S.name);L.push({title:S.name,isLeaf:!(S.type==="tree"),key:O})}return L}function G(U,k,L){for(var b=0;b<U.length;b++){var S=U[b];if(S.key===k){S.children=L;break}S.children&&G(S.children,k,L)}return U}function I(U,k,L){var b;return function(){var S=this,O=arguments,C=function(){b=null,L||U.apply(S,O)},x=L&&!b;clearTimeout(b),b=setTimeout(C,k),x&&U.apply(S,O)}}var R=!0,B=re.a.API_SERVER},"C+DQ":function(st,Ke,q){},DlQD:function(st,Ke,q){(function(re,V){st.exports=V()})(this,function(){"use strict";function re(ge,ue){for(var de=0;de<ue.length;de++){var J=ue[de];J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J&&(J.writable=!0),Object.defineProperty(ge,J.key,J)}}function V(ge,ue,de){return ue&&re(ge.prototype,ue),de&&re(ge,de),ge}function A(ge,ue){if(!ge)return;if(typeof ge=="string")return G(ge,ue);var de=Object.prototype.toString.call(ge).slice(8,-1);if(de==="Object"&&ge.constructor&&(de=ge.constructor.name),de==="Map"||de==="Set")return Array.from(ge);if(de==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(de))return G(ge,ue)}function G(ge,ue){(ue==null||ue>ge.length)&&(ue=ge.length);for(var de=0,J=new Array(ue);de<ue;de++)J[de]=ge[de];return J}function I(ge,ue){var de;if(typeof Symbol=="undefined"||ge[Symbol.iterator]==null){if(Array.isArray(ge)||(de=A(ge))||ue&&ge&&typeof ge.length=="number"){de&&(ge=de);var J=0;return function(){return J>=ge.length?{done:!0}:{done:!1,value:ge[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 de=ge[Symbol.iterator](),de.next.bind(de)}function R(ge,ue){return ue={exports:{}},ge(ue,ue.exports),ue.exports}var B=R(function(ge){function ue(){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 de(J){ge.exports.defaults=J}ge.exports={defaults:ue(),getDefaults:ue,changeDefaults:de}}),U=B.defaults,k=B.getDefaults,L=B.changeDefaults,b=/[&<>"']/,S=/[&<>"']/g,O=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,x={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},v=function(ue){return x[ue]};function d(ge,ue){if(ue){if(b.test(ge))return ge.replace(S,v)}else if(O.test(ge))return ge.replace(C,v);return ge}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function u(ge){return ge.replace(o,function(ue,de){return de=de.toLowerCase(),de==="colon"?":":de.charAt(0)==="#"?de.charAt(1)==="x"?String.fromCharCode(parseInt(de.substring(2),16)):String.fromCharCode(+de.substring(1)):""})}var s=/(^|[^\[])\^/g;function w(ge,ue){ge=ge.source||ge,ue=ue||"";var de={replace:function(Z,te){return te=te.source||te,te=te.replace(s,"$1"),ge=ge.replace(Z,te),de},getRegex:function(){return new RegExp(ge,ue)}};return de}var g=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function _(ge,ue,de){if(ge){var J;try{J=decodeURIComponent(u(de)).replace(g,"").toLowerCase()}catch(Z){return null}if(J.indexOf("javascript:")===0||J.indexOf("vbscript:")===0||J.indexOf("data:")===0)return null}ue&&!f.test(de)&&(de=a(ue,de));try{de=encodeURI(de).replace(/%25/g,"%")}catch(Z){return null}return de}var p={},h=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ge,ue){p[" "+ge]||(h.test(ge)?p[" "+ge]=ge+"/":p[" "+ge]=M(ge,"/",!0)),ge=p[" "+ge];var de=ge.indexOf(":")===-1;return ue.substring(0,2)==="//"?de?ue:ge.replace(c,"$1")+ue:ue.charAt(0)==="/"?de?ue:ge.replace(l,"$1")+ue:ge+ue}var y={exec:function(){}};function m(ge){for(var ue=1,de,J;ue<arguments.length;ue++){de=arguments[ue];for(J in de)Object.prototype.hasOwnProperty.call(de,J)&&(ge[J]=de[J])}return ge}function E(ge,ue){var de=ge.replace(/\|/g,function(te,se,ce){for(var _e=!1,Ce=se;--Ce>=0&&ce[Ce]==="\\";)_e=!_e;return _e?"|":" |"}),J=de.split(/ \|/),Z=0;if(J.length>ue)J.splice(ue);else for(;J.length<ue;)J.push("");for(;Z<J.length;Z++)J[Z]=J[Z].trim().replace(/\\\|/g,"|");return J}function M(ge,ue,de){var J=ge.length;if(J===0)return"";for(var Z=0;Z<J;){var te=ge.charAt(J-Z-1);if(te===ue&&!de)Z++;else if(te!==ue&&de)Z++;else break}return ge.substr(0,J-Z)}function F(ge,ue){if(ge.indexOf(ue[1])===-1)return-1;for(var de=ge.length,J=0,Z=0;Z<de;Z++)if(ge[Z]==="\\")Z++;else if(ge[Z]===ue[0])J++;else if(ge[Z]===ue[1]&&(J--,J<0))return Z;return-1}function j(ge){ge&&ge.sanitize&&!ge.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var W={escape:d,unescape:u,edit:w,cleanUrl:_,resolveUrl:a,noopTest:y,merge:m,splitCells:E,rtrim:M,findClosingBracket:F,checkSanitizeDeprecation:j},D=B.defaults,P=W.rtrim,H=W.splitCells,Y=W.escape,ee=W.findClosingBracket;function oe(ge,ue,de){var J=ue.href,Z=ue.title?Y(ue.title):null,te=ge[1].replace(/\\([\[\]])/g,"$1");return ge[0].charAt(0)!=="!"?{type:"link",raw:de,href:J,title:Z,text:te}:{type:"image",raw:de,href:J,title:Z,text:Y(te)}}function xe(ge,ue){var de=ge.match(/^(\s+)(?:```)/);if(de===null)return ue;var J=de[1];return ue.split(`
`).map(function(Z){var te=Z.match(/^\s+/);if(te===null)return Z;var se=te[0];return se.length>=J.length?Z.slice(J.length):Z}).join(`
`)}var ve=function(){function ge(de){this.options=de||D}var ue=ge.prototype;return ue.space=function(J){var Z=this.rules.block.newline.exec(J);if(Z)return Z[0].length>1?{type:"space",raw:Z[0]}:{raw:`
`}},ue.code=function(J,Z){var te=this.rules.block.code.exec(J);if(te){var se=Z[Z.length-1];if(se&&se.type==="paragraph")return{raw:te[0],text:te[0].trimRight()};var ce=te[0].replace(/^ {4}/gm,"");return{type:"code",raw:te[0],codeBlockStyle:"indented",text:this.options.pedantic?ce:P(ce,`
`)}}},ue.fences=function(J){var Z=this.rules.block.fences.exec(J);if(Z){var te=Z[0],se=xe(te,Z[3]||"");return{type:"code",raw:te,lang:Z[2]?Z[2].trim():Z[2],text:se}}},ue.heading=function(J){var Z=this.rules.block.heading.exec(J);if(Z)return{type:"heading",raw:Z[0],depth:Z[1].length,text:Z[2]}},ue.nptable=function(J){var Z=this.rules.block.nptable.exec(J);if(Z){var te={type:"table",header:H(Z[1].replace(/^ *| *\| *$/g,"")),align:Z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Z[3]?Z[3].replace(/\n$/,"").split(`
`):[],raw:Z[0]};if(te.header.length===te.align.length){var se=te.align.length,ce;for(ce=0;ce<se;ce++)/^ *-+: *$/.test(te.align[ce])?te.align[ce]="right":/^ *:-+: *$/.test(te.align[ce])?te.align[ce]="center":/^ *:-+ *$/.test(te.align[ce])?te.align[ce]="left":te.align[ce]=null;for(se=te.cells.length,ce=0;ce<se;ce++)te.cells[ce]=H(te.cells[ce],te.header.length);return te}}},ue.hr=function(J){var Z=this.rules.block.hr.exec(J);if(Z)return{type:"hr",raw:Z[0]}},ue.blockquote=function(J){var Z=this.rules.block.blockquote.exec(J);if(Z){var te=Z[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Z[0],text:te}}},ue.list=function(J){var Z=this.rules.block.list.exec(J);if(Z){for(var te=Z[0],se=Z[2],ce=se.length>1,_e=se[se.length-1]===")",Ce={type:"list",raw:te,ordered:ce,start:ce?+se.slice(0,-1):"",loose:!1,items:[]},Ie=Z[0].match(this.rules.block.item),Ye=!1,Ge,mt,dt,ot,Ct,bt,Bt,Ut=Ie.length,Et=0;Et<Ut;Et++)Ge=Ie[Et],te=Ge,mt=Ge.length,Ge=Ge.replace(/^ *([*+-]|\d+[.)]) */,""),~Ge.indexOf(`
`)&&(mt-=Ge.length,Ge=this.options.pedantic?Ge.replace(/^ {1,4}/gm,""):Ge.replace(new RegExp("^ {1,"+mt+"}","gm"),"")),Et!==Ut-1&&(dt=this.rules.block.bullet.exec(Ie[Et+1])[0],(ce?dt.length===1||!_e&&dt[dt.length-1]===")":dt.length>1||this.options.smartLists&&dt!==se)&&(ot=Ie.slice(Et+1).join(`
`),Ce.raw=Ce.raw.substring(0,Ce.raw.length-ot.length),Et=Ut-1)),Ct=Ye||/\n\n(?!\s*$)/.test(Ge),Et!==Ut-1&&(Ye=Ge.charAt(Ge.length-1)===`
`,Ct||(Ct=Ye)),Ct&&(Ce.loose=!0),bt=/^\[[ xX]\] /.test(Ge),Bt=void 0,bt&&(Bt=Ge[1]!==" ",Ge=Ge.replace(/^\[[ xX]\] +/,"")),Ce.items.push({type:"list_item",raw:te,task:bt,checked:Bt,loose:Ct,text:Ge});return Ce}},ue.html=function(J){var Z=this.rules.block.html.exec(J);if(Z)return{type:this.options.sanitize?"paragraph":"html",raw:Z[0],pre:!this.options.sanitizer&&(Z[1]==="pre"||Z[1]==="script"||Z[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Z[0]):Y(Z[0]):Z[0]}},ue.def=function(J){var Z=this.rules.block.def.exec(J);if(Z){Z[3]&&(Z[3]=Z[3].substring(1,Z[3].length-1));var te=Z[1].toLowerCase().replace(/\s+/g," ");return{tag:te,raw:Z[0],href:Z[2],title:Z[3]}}},ue.table=function(J){var Z=this.rules.block.table.exec(J);if(Z){var te={type:"table",header:H(Z[1].replace(/^ *| *\| *$/g,"")),align:Z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Z[3]?Z[3].replace(/\n$/,"").split(`
`):[]};if(te.header.length===te.align.length){te.raw=Z[0];var se=te.align.length,ce;for(ce=0;ce<se;ce++)/^ *-+: *$/.test(te.align[ce])?te.align[ce]="right":/^ *:-+: *$/.test(te.align[ce])?te.align[ce]="center":/^ *:-+ *$/.test(te.align[ce])?te.align[ce]="left":te.align[ce]=null;for(se=te.cells.length,ce=0;ce<se;ce++)te.cells[ce]=H(te.cells[ce].replace(/^ *\| *| *\| *$/g,""),te.header.length);return te}}},ue.lheading=function(J){var Z=this.rules.block.lheading.exec(J);if(Z)return{type:"heading",raw:Z[0],depth:Z[2].charAt(0)==="="?1:2,text:Z[1]}},ue.paragraph=function(J){var Z=this.rules.block.paragraph.exec(J);if(Z)return{type:"paragraph",raw:Z[0],text:Z[1].charAt(Z[1].length-1)===`
`?Z[1].slice(0,-1):Z[1]}},ue.text=function(J,Z){var te=this.rules.block.text.exec(J);if(te){var se=Z[Z.length-1];return se&&se.type==="text"?{raw:te[0],text:te[0]}:{type:"text",raw:te[0],text:te[0]}}},ue.escape=function(J){var Z=this.rules.inline.escape.exec(J);if(Z)return{type:"escape",raw:Z[0],text:Y(Z[1])}},ue.tag=function(J,Z,te){var se=this.rules.inline.tag.exec(J);if(se)return!Z&&/^<a /i.test(se[0])?Z=!0:Z&&/^<\/a>/i.test(se[0])&&(Z=!1),!te&&/^<(pre|code|kbd|script)(\s|>)/i.test(se[0])?te=!0:te&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(se[0])&&(te=!1),{type:this.options.sanitize?"text":"html",raw:se[0],inLink:Z,inRawBlock:te,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):Y(se[0]):se[0]}},ue.link=function(J){var Z=this.rules.inline.link.exec(J);if(Z){var te=ee(Z[2],"()");if(te>-1){var se=Z[0].indexOf("!")===0?5:4,ce=se+Z[1].length+te;Z[2]=Z[2].substring(0,te),Z[0]=Z[0].substring(0,ce).trim(),Z[3]=""}var _e=Z[2],Ce="";if(this.options.pedantic){var Ie=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(_e);Ie?(_e=Ie[1],Ce=Ie[3]):Ce=""}else Ce=Z[3]?Z[3].slice(1,-1):"";_e=_e.trim().replace(/^<([\s\S]*)>$/,"$1");var Ye=oe(Z,{href:_e&&_e.replace(this.rules.inline._escapes,"$1"),title:Ce&&Ce.replace(this.rules.inline._escapes,"$1")},Z[0]);return Ye}},ue.reflink=function(J,Z){var te;if((te=this.rules.inline.reflink.exec(J))||(te=this.rules.inline.nolink.exec(J))){var se=(te[2]||te[1]).replace(/\s+/g," ");if(se=Z[se.toLowerCase()],!se||!se.href){var ce=te[0].charAt(0);return{type:"text",raw:ce,text:ce}}var _e=oe(te,se,te[0]);return _e}},ue.strong=function(J,Z,te){te===void 0&&(te="");var se=this.rules.inline.strong.start.exec(J);if(se&&(!se[1]||se[1]&&(te===""||this.rules.inline.punctuation.exec(te)))){Z=Z.slice(-1*J.length);var ce=se[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ce.lastIndex=0;for(var _e;(se=ce.exec(Z))!=null;)if(_e=this.rules.inline.strong.middle.exec(Z.slice(0,se.index+3)),_e)return{type:"strong",raw:J.slice(0,_e[0].length),text:J.slice(2,_e[0].length-2)}}},ue.em=function(J,Z,te){te===void 0&&(te="");var se=this.rules.inline.em.start.exec(J);if(se&&(!se[1]||se[1]&&(te===""||this.rules.inline.punctuation.exec(te)))){Z=Z.slice(-1*J.length);var ce=se[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ce.lastIndex=0;for(var _e;(se=ce.exec(Z))!=null;)if(_e=this.rules.inline.em.middle.exec(Z.slice(0,se.index+2)),_e)return{type:"em",raw:J.slice(0,_e[0].length),text:J.slice(1,_e[0].length-1)}}},ue.codespan=function(J){var Z=this.rules.inline.code.exec(J);if(Z){var te=Z[2].replace(/\n/g," "),se=/[^ ]/.test(te),ce=te.startsWith(" ")&&te.endsWith(" ");return se&&ce&&(te=te.substring(1,te.length-1)),te=Y(te,!0),{type:"codespan",raw:Z[0],text:te}}},ue.br=function(J){var Z=this.rules.inline.br.exec(J);if(Z)return{type:"br",raw:Z[0]}},ue.del=function(J){var Z=this.rules.inline.del.exec(J);if(Z)return{type:"del",raw:Z[0],text:Z[1]}},ue.autolink=function(J,Z){var te=this.rules.inline.autolink.exec(J);if(te){var se,ce;return te[2]==="@"?(se=Y(this.options.mangle?Z(te[1]):te[1]),ce="mailto:"+se):(se=Y(te[1]),ce=se),{type:"link",raw:te[0],text:se,href:ce,tokens:[{type:"text",raw:se,text:se}]}}},ue.url=function(J,Z){var te;if(te=this.rules.inline.url.exec(J)){var se,ce;if(te[2]==="@")se=Y(this.options.mangle?Z(te[0]):te[0]),ce="mailto:"+se;else{var _e;do _e=te[0],te[0]=this.rules.inline._backpedal.exec(te[0])[0];while(_e!==te[0]);se=Y(te[0]),te[1]==="www."?ce="http://"+se:ce=se}return{type:"link",raw:te[0],text:se,href:ce,tokens:[{type:"text",raw:se,text:se}]}}},ue.inlineText=function(J,Z,te){var se=this.rules.inline.text.exec(J);if(se){var ce;return Z?ce=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):Y(se[0]):se[0]:ce=Y(this.options.smartypants?te(se[0]):se[0]),{type:"text",raw:se[0],text:ce}}},ge}(),he=W.noopTest,fe=W.edit,me=W.merge,ae={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:he,table:he,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ae._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ae._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ae.def=fe(ae.def).replace("label",ae._label).replace("title",ae._title).getRegex(),ae.bullet=/(?:[*+-]|\d{1,9}[.)])/,ae.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ae.item=fe(ae.item,"gm").replace(/bull/g,ae.bullet).getRegex(),ae.list=fe(ae.list).replace(/bull/g,ae.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ae.def.source+")").getRegex(),ae._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ae._comment=/<!--(?!-?>)[\s\S]*?-->/,ae.html=fe(ae.html,"i").replace("comment",ae._comment).replace("tag",ae._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ae.paragraph=fe(ae._paragraph).replace("hr",ae.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ae._tag).getRegex(),ae.blockquote=fe(ae.blockquote).replace("paragraph",ae.paragraph).getRegex(),ae.normal=me({},ae),ae.gfm=me({},ae.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),ae.gfm.nptable=fe(ae.gfm.nptable).replace("hr",ae.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ae._tag).getRegex(),ae.gfm.table=fe(ae.gfm.table).replace("hr",ae.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ae._tag).getRegex(),ae.pedantic=me({},ae.normal,{html:fe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ae._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:he,paragraph:fe(ae.normal._paragraph).replace("hr",ae.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ae.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var pe={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:he,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:he,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};pe._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",pe.punctuation=fe(pe.punctuation).replace(/punctuation/g,pe._punctuation).getRegex(),pe._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",pe._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",pe.em.start=fe(pe.em.start).replace(/punctuation/g,pe._punctuation).getRegex(),pe.em.middle=fe(pe.em.middle).replace(/punctuation/g,pe._punctuation).replace(/overlapSkip/g,pe._overlapSkip).getRegex(),pe.em.endAst=fe(pe.em.endAst,"g").replace(/punctuation/g,pe._punctuation).getRegex(),pe.em.endUnd=fe(pe.em.endUnd,"g").replace(/punctuation/g,pe._punctuation).getRegex(),pe.strong.start=fe(pe.strong.start).replace(/punctuation/g,pe._punctuation).getRegex(),pe.strong.middle=fe(pe.strong.middle).replace(/punctuation/g,pe._punctuation).replace(/blockSkip/g,pe._blockSkip).getRegex(),pe.strong.endAst=fe(pe.strong.endAst,"g").replace(/punctuation/g,pe._punctuation).getRegex(),pe.strong.endUnd=fe(pe.strong.endUnd,"g").replace(/punctuation/g,pe._punctuation).getRegex(),pe.blockSkip=fe(pe._blockSkip,"g").getRegex(),pe.overlapSkip=fe(pe._overlapSkip,"g").getRegex(),pe._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,pe._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,pe._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,pe.autolink=fe(pe.autolink).replace("scheme",pe._scheme).replace("email",pe._email).getRegex(),pe._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,pe.tag=fe(pe.tag).replace("comment",ae._comment).replace("attribute",pe._attribute).getRegex(),pe._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,pe._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,pe._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,pe.link=fe(pe.link).replace("label",pe._label).replace("href",pe._href).replace("title",pe._title).getRegex(),pe.reflink=fe(pe.reflink).replace("label",pe._label).getRegex(),pe.reflinkSearch=fe(pe.reflinkSearch,"g").replace("reflink",pe.reflink).replace("nolink",pe.nolink).getRegex(),pe.normal=me({},pe),pe.pedantic=me({},pe.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:fe(/^!?\[(label)\]\((.*?)\)/).replace("label",pe._label).getRegex(),reflink:fe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",pe._label).getRegex()}),pe.gfm=me({},pe.normal,{escape:fe(pe.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),pe.gfm.url=fe(pe.gfm.url,"i").replace("email",pe.gfm._extended_email).getRegex(),pe.breaks=me({},pe.gfm,{br:fe(pe.br).replace("{2,}","*").getRegex(),text:fe(pe.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var $={block:ae,inline:pe},ne=B.defaults,Q=$.block,Ee=$.inline;function we(ge){return ge.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function ye(ge){var ue="",de,J,Z=ge.length;for(de=0;de<Z;de++)J=ge.charCodeAt(de),Math.random()>.5&&(J="x"+J.toString(16)),ue+="&#"+J+";";return ue}var Se=function(){function ge(de){this.tokens=[],this.tokens.links=Object.create(null),this.options=de||ne,this.options.tokenizer=this.options.tokenizer||new ve,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var J={block:Q.normal,inline:Ee.normal};this.options.pedantic?(J.block=Q.pedantic,J.inline=Ee.pedantic):this.options.gfm&&(J.block=Q.gfm,this.options.breaks?J.inline=Ee.breaks:J.inline=Ee.gfm),this.tokenizer.rules=J}ge.lex=function(J,Z){var te=new ge(Z);return te.lex(J)};var ue=ge.prototype;return ue.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},ue.blockTokens=function(J,Z,te){Z===void 0&&(Z=[]),te===void 0&&(te=!0),J=J.replace(/^ +$/gm,"");for(var se,ce,_e,Ce;J;){if(se=this.tokenizer.space(J)){J=J.substring(se.raw.length),se.type&&Z.push(se);continue}if(se=this.tokenizer.code(J,Z)){J=J.substring(se.raw.length),se.type?Z.push(se):(Ce=Z[Z.length-1],Ce.raw+=`
`+se.raw,Ce.text+=`
`+se.text);continue}if(se=this.tokenizer.fences(J)){J=J.substring(se.raw.length),Z.push(se);continue}if(se=this.tokenizer.heading(J)){J=J.substring(se.raw.length),Z.push(se);continue}if(se=this.tokenizer.nptable(J)){J=J.substring(se.raw.length),Z.push(se);continue}if(se=this.tokenizer.hr(J)){J=J.substring(se.raw.length),Z.push(se);continue}if(se=this.tokenizer.blockquote(J)){J=J.substring(se.raw.length),se.tokens=this.blockTokens(se.text,[],te),Z.push(se);continue}if(se=this.tokenizer.list(J)){for(J=J.substring(se.raw.length),_e=se.items.length,ce=0;ce<_e;ce++)se.items[ce].tokens=this.blockTokens(se.items[ce].text,[],!1);Z.push(se);continue}if(se=this.tokenizer.html(J)){J=J.substring(se.raw.length),Z.push(se);continue}if(te&&(se=this.tokenizer.def(J))){J=J.substring(se.raw.length),this.tokens.links[se.tag]||(this.tokens.links[se.tag]={href:se.href,title:se.title});continue}if(se=this.tokenizer.table(J)){J=J.substring(se.raw.length),Z.push(se);continue}if(se=this.tokenizer.lheading(J)){J=J.substring(se.raw.length),Z.push(se);continue}if(te&&(se=this.tokenizer.paragraph(J))){J=J.substring(se.raw.length),Z.push(se);continue}if(se=this.tokenizer.text(J,Z)){J=J.substring(se.raw.length),se.type?Z.push(se):(Ce=Z[Z.length-1],Ce.raw+=`
`+se.raw,Ce.text+=`
`+se.text);continue}if(J){var Ie="Infinite loop on byte: "+J.charCodeAt(0);if(this.options.silent){console.error(Ie);break}else throw new Error(Ie)}}return Z},ue.inline=function(J){var Z,te,se,ce,_e,Ce,Ie=J.length;for(Z=0;Z<Ie;Z++){Ce=J[Z];switch(Ce.type){case"paragraph":case"text":case"heading":{Ce.tokens=[],this.inlineTokens(Ce.text,Ce.tokens);break}case"table":{for(Ce.tokens={header:[],cells:[]},ce=Ce.header.length,te=0;te<ce;te++)Ce.tokens.header[te]=[],this.inlineTokens(Ce.header[te],Ce.tokens.header[te]);for(ce=Ce.cells.length,te=0;te<ce;te++)for(_e=Ce.cells[te],Ce.tokens.cells[te]=[],se=0;se<_e.length;se++)Ce.tokens.cells[te][se]=[],this.inlineTokens(_e[se],Ce.tokens.cells[te][se]);break}case"blockquote":{this.inline(Ce.tokens);break}case"list":{for(ce=Ce.items.length,te=0;te<ce;te++)this.inline(Ce.items[te].tokens);break}}}return J},ue.inlineTokens=function(J,Z,te,se,ce){Z===void 0&&(Z=[]),te===void 0&&(te=!1),se===void 0&&(se=!1),ce===void 0&&(ce="");var _e,Ce=J,Ie;if(this.tokens.links){var Ye=Object.keys(this.tokens.links);if(Ye.length>0)for(;(Ie=this.tokenizer.rules.inline.reflinkSearch.exec(Ce))!=null;)Ye.includes(Ie[0].slice(Ie[0].lastIndexOf("[")+1,-1))&&(Ce=Ce.slice(0,Ie.index)+"["+"a".repeat(Ie[0].length-2)+"]"+Ce.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ie=this.tokenizer.rules.inline.blockSkip.exec(Ce))!=null;)Ce=Ce.slice(0,Ie.index)+"["+"a".repeat(Ie[0].length-2)+"]"+Ce.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;J;){if(_e=this.tokenizer.escape(J)){J=J.substring(_e.raw.length),Z.push(_e);continue}if(_e=this.tokenizer.tag(J,te,se)){J=J.substring(_e.raw.length),te=_e.inLink,se=_e.inRawBlock,Z.push(_e);continue}if(_e=this.tokenizer.link(J)){J=J.substring(_e.raw.length),_e.type==="link"&&(_e.tokens=this.inlineTokens(_e.text,[],!0,se)),Z.push(_e);continue}if(_e=this.tokenizer.reflink(J,this.tokens.links)){J=J.substring(_e.raw.length),_e.type==="link"&&(_e.tokens=this.inlineTokens(_e.text,[],!0,se)),Z.push(_e);continue}if(_e=this.tokenizer.strong(J,Ce,ce)){J=J.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],te,se),Z.push(_e);continue}if(_e=this.tokenizer.em(J,Ce,ce)){J=J.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],te,se),Z.push(_e);continue}if(_e=this.tokenizer.codespan(J)){J=J.substring(_e.raw.length),Z.push(_e);continue}if(_e=this.tokenizer.br(J)){J=J.substring(_e.raw.length),Z.push(_e);continue}if(_e=this.tokenizer.del(J)){J=J.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],te,se),Z.push(_e);continue}if(_e=this.tokenizer.autolink(J,ye)){J=J.substring(_e.raw.length),Z.push(_e);continue}if(!te&&(_e=this.tokenizer.url(J,ye))){J=J.substring(_e.raw.length),Z.push(_e);continue}if(_e=this.tokenizer.inlineText(J,se,we)){J=J.substring(_e.raw.length),ce=_e.raw.slice(-1),Z.push(_e);continue}if(J){var Ge="Infinite loop on byte: "+J.charCodeAt(0);if(this.options.silent){console.error(Ge);break}else throw new Error(Ge)}}return Z},V(ge,null,[{key:"rules",get:function(){return{block:Q,inline:Ee}}}]),ge}(),Le=B.defaults,Oe=W.cleanUrl,ke=W.escape,De=function(){function ge(de){this.options=de||Le}var ue=ge.prototype;return ue.code=function(J,Z,te){var se=(Z||"").match(/\S*/)[0];if(this.options.highlight){var ce=this.options.highlight(J,se);ce!=null&&ce!==J&&(te=!0,J=ce)}return se?'<pre><code class="'+this.options.langPrefix+ke(se,!0)+'">'+(te?J:ke(J,!0))+`</code></pre>
`:"<pre><code>"+(te?J:ke(J,!0))+`</code></pre>
`},ue.blockquote=function(J){return`<blockquote>
`+J+`</blockquote>
`},ue.html=function(J){return J},ue.heading=function(J,Z,te,se){return this.options.headerIds?"<h"+Z+' id="'+this.options.headerPrefix+se.slug(te)+'">'+J+"</h"+Z+`>
`:"<h"+Z+">"+J+"</h"+Z+`>
`},ue.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ue.list=function(J,Z,te){var se=Z?"ol":"ul",ce=Z&&te!==1?' start="'+te+'"':"";return"<"+se+ce+`>
`+J+"</"+se+`>
`},ue.listitem=function(J){return"<li>"+J+`</li>
`},ue.checkbox=function(J){return"<input "+(J?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ue.paragraph=function(J){return"<p>"+J+`</p>
`},ue.table=function(J,Z){return Z&&(Z="<tbody>"+Z+"</tbody>"),`<table>
<thead>
`+J+`</thead>
`+Z+`</table>
`},ue.tablerow=function(J){return`<tr>
`+J+`</tr>
`},ue.tablecell=function(J,Z){var te=Z.header?"th":"td",se=Z.align?"<"+te+' align="'+Z.align+'">':"<"+te+">";return se+J+"</"+te+`>
`},ue.strong=function(J){return"<strong>"+J+"</strong>"},ue.em=function(J){return"<em>"+J+"</em>"},ue.codespan=function(J){return"<code>"+J+"</code>"},ue.br=function(){return this.options.xhtml?"<br/>":"<br>"},ue.del=function(J){return"<del>"+J+"</del>"},ue.link=function(J,Z,te){if(J=Oe(this.options.sanitize,this.options.baseUrl,J),J===null)return te;var se='<a href="'+ke(J)+'"';return Z&&(se+=' title="'+Z+'"'),se+=">"+te+"</a>",se},ue.image=function(J,Z,te){if(J=Oe(this.options.sanitize,this.options.baseUrl,J),J===null)return te;var se='<img src="'+J+'" alt="'+te+'"';return Z&&(se+=' title="'+Z+'"'),se+=this.options.xhtml?"/>":">",se},ue.text=function(J){return J},ge}(),Pe=function(){function ge(){}var ue=ge.prototype;return ue.strong=function(J){return J},ue.em=function(J){return J},ue.codespan=function(J){return J},ue.del=function(J){return J},ue.html=function(J){return J},ue.text=function(J){return J},ue.link=function(J,Z,te){return""+te},ue.image=function(J,Z,te){return""+te},ue.br=function(){return""},ge}(),ze=function(){function ge(){this.seen={}}var ue=ge.prototype;return ue.slug=function(J){var Z=J.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Z)){var te=Z;do this.seen[te]++,Z=te+"-"+this.seen[te];while(this.seen.hasOwnProperty(Z))}return this.seen[Z]=0,Z},ge}(),$e=B.defaults,We=W.unescape,He=function(){function ge(de){this.options=de||$e,this.options.renderer=this.options.renderer||new De,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Pe,this.slugger=new ze}ge.parse=function(J,Z){var te=new ge(Z);return te.parse(J)};var ue=ge.prototype;return ue.parse=function(J,Z){Z===void 0&&(Z=!0);var te="",se,ce,_e,Ce,Ie,Ye,Ge,mt,dt,ot,Ct,bt,Bt,Ut,Et,Cr,Rr,lr,pr=J.length;for(se=0;se<pr;se++){ot=J[se];switch(ot.type){case"space":continue;case"hr":{te+=this.renderer.hr();continue}case"heading":{te+=this.renderer.heading(this.parseInline(ot.tokens),ot.depth,We(this.parseInline(ot.tokens,this.textRenderer)),this.slugger);continue}case"code":{te+=this.renderer.code(ot.text,ot.lang,ot.escaped);continue}case"table":{for(mt="",Ge="",Ce=ot.header.length,ce=0;ce<Ce;ce++)Ge+=this.renderer.tablecell(this.parseInline(ot.tokens.header[ce]),{header:!0,align:ot.align[ce]});for(mt+=this.renderer.tablerow(Ge),dt="",Ce=ot.cells.length,ce=0;ce<Ce;ce++){for(Ye=ot.tokens.cells[ce],Ge="",Ie=Ye.length,_e=0;_e<Ie;_e++)Ge+=this.renderer.tablecell(this.parseInline(Ye[_e]),{header:!1,align:ot.align[_e]});dt+=this.renderer.tablerow(Ge)}te+=this.renderer.table(mt,dt);continue}case"blockquote":{dt=this.parse(ot.tokens),te+=this.renderer.blockquote(dt);continue}case"list":{for(Ct=ot.ordered,bt=ot.start,Bt=ot.loose,Ce=ot.items.length,dt="",ce=0;ce<Ce;ce++)Et=ot.items[ce],Cr=Et.checked,Rr=Et.task,Ut="",Et.task&&(lr=this.renderer.checkbox(Cr),Bt?Et.tokens.length>0&&Et.tokens[0].type==="text"?(Et.tokens[0].text=lr+" "+Et.tokens[0].text,Et.tokens[0].tokens&&Et.tokens[0].tokens.length>0&&Et.tokens[0].tokens[0].type==="text"&&(Et.tokens[0].tokens[0].text=lr+" "+Et.tokens[0].tokens[0].text)):Et.tokens.unshift({type:"text",text:lr}):Ut+=lr),Ut+=this.parse(Et.tokens,Bt),dt+=this.renderer.listitem(Ut,Rr,Cr);te+=this.renderer.list(dt,Ct,bt);continue}case"html":{te+=this.renderer.html(ot.text);continue}case"paragraph":{te+=this.renderer.paragraph(this.parseInline(ot.tokens));continue}case"text":{for(dt=ot.tokens?this.parseInline(ot.tokens):ot.text;se+1<pr&&J[se+1].type==="text";)ot=J[++se],dt+=`
`+(ot.tokens?this.parseInline(ot.tokens):ot.text);te+=Z?this.renderer.paragraph(dt):dt;continue}default:{var fr='Token with "'+ot.type+'" type was not found.';if(this.options.silent){console.error(fr);return}else throw new Error(fr)}}}return te},ue.parseInline=function(J,Z){Z=Z||this.renderer;var te="",se,ce,_e=J.length;for(se=0;se<_e;se++){ce=J[se];switch(ce.type){case"escape":{te+=Z.text(ce.text);break}case"html":{te+=Z.html(ce.text);break}case"link":{te+=Z.link(ce.href,ce.title,this.parseInline(ce.tokens,Z));break}case"image":{te+=Z.image(ce.href,ce.title,ce.text);break}case"strong":{te+=Z.strong(this.parseInline(ce.tokens,Z));break}case"em":{te+=Z.em(this.parseInline(ce.tokens,Z));break}case"codespan":{te+=Z.codespan(ce.text);break}case"br":{te+=Z.br();break}case"del":{te+=Z.del(this.parseInline(ce.tokens,Z));break}case"text":{te+=Z.text(ce.text);break}default:{var Ce='Token with "'+ce.type+'" type was not found.';if(this.options.silent){console.error(Ce);return}else throw new Error(Ce)}}}return te},ge}(),rt=W.merge,Je=W.checkSanitizeDeprecation,Qe=W.escape,Ae=B.getDefaults,et=B.changeDefaults,Ze=B.defaults;function Re(ge,ue,de){if(typeof ge=="undefined"||ge===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ge!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ge)+", string expected");if(typeof ue=="function"&&(de=ue,ue=null),ue=rt({},Re.defaults,ue||{}),Je(ue),de){var J=ue.highlight,Z;try{Z=Se.lex(ge,ue)}catch(_e){return de(_e)}var te=function(Ce){var Ie;if(!Ce)try{Ie=He.parse(Z,ue)}catch(Ye){Ce=Ye}return ue.highlight=J,Ce?de(Ce):de(null,Ie)};if(!J||J.length<3)return te();if(delete ue.highlight,!Z.length)return te();var se=0;Re.walkTokens(Z,function(_e){_e.type==="code"&&(se++,setTimeout(function(){J(_e.text,_e.lang,function(Ce,Ie){if(Ce)return te(Ce);Ie!=null&&Ie!==_e.text&&(_e.text=Ie,_e.escaped=!0),se--,se===0&&te()})},0))}),se===0&&te();return}try{var ce=Se.lex(ge,ue);return ue.walkTokens&&Re.walkTokens(ce,ue.walkTokens),He.parse(ce,ue)}catch(_e){if(_e.message+=`
Please report this to https://github.com/markedjs/marked.`,ue.silent)return"<p>An error occurred:</p><pre>"+Qe(_e.message+"",!0)+"</pre>";throw _e}}Re.options=Re.setOptions=function(ge){return rt(Re.defaults,ge),et(Re.defaults),Re},Re.getDefaults=Ae,Re.defaults=Ze,Re.use=function(ge){var ue=rt({},ge);if(ge.renderer&&function(){var J=Re.defaults.renderer||new De,Z=function(ce){var _e=J[ce];J[ce]=function(){for(var Ce=arguments.length,Ie=new Array(Ce),Ye=0;Ye<Ce;Ye++)Ie[Ye]=arguments[Ye];var Ge=ge.renderer[ce].apply(J,Ie);return Ge===!1&&(Ge=_e.apply(J,Ie)),Ge}};for(var te in ge.renderer)Z(te);ue.renderer=J}(),ge.tokenizer&&function(){var J=Re.defaults.tokenizer||new ve,Z=function(ce){var _e=J[ce];J[ce]=function(){for(var Ce=arguments.length,Ie=new Array(Ce),Ye=0;Ye<Ce;Ye++)Ie[Ye]=arguments[Ye];var Ge=ge.tokenizer[ce].apply(J,Ie);return Ge===!1&&(Ge=_e.apply(J,Ie)),Ge}};for(var te in ge.tokenizer)Z(te);ue.tokenizer=J}(),ge.walkTokens){var de=Re.defaults.walkTokens;ue.walkTokens=function(J){ge.walkTokens(J),de&&de(J)}}Re.setOptions(ue)},Re.walkTokens=function(ge,ue){for(var de=I(ge),J;!(J=de()).done;){var Z=J.value;ue(Z);switch(Z.type){case"table":{for(var te=I(Z.tokens.header),se;!(se=te()).done;){var ce=se.value;Re.walkTokens(ce,ue)}for(var _e=I(Z.tokens.cells),Ce;!(Ce=_e()).done;)for(var Ie=Ce.value,Ye=I(Ie),Ge;!(Ge=Ye()).done;){var mt=Ge.value;Re.walkTokens(mt,ue)}break}case"list":{Re.walkTokens(Z.items,ue);break}default:Z.tokens&&Re.walkTokens(Z.tokens,ue)}}},Re.Parser=He,Re.parser=He.parse,Re.Renderer=De,Re.TextRenderer=Pe,Re.Lexer=Se,Re.lexer=Se.lex,Re.Tokenizer=ve,Re.Slugger=ze,Re.parse=Re;var Fe=Re;return Fe})},ELLl:function(st,Ke,q){(function(re){re(q("VrN/"))})(function(re){var V={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},A=re.Pos;re.defineOption("autoCloseBrackets",!1,function(x,v,d){d&&d!=re.Init&&(x.removeKeyMap(I),x.state.closeBrackets=null),v&&(R(G(v,"pairs")),x.state.closeBrackets=v,x.addKeyMap(I))});function G(x,v){return v=="pairs"&&typeof x=="string"?x:typeof x=="object"&&x[v]!=null?x[v]:V[v]}var I={Backspace:k,Enter:L};function R(x){for(var v=0;v<x.length;v++){var d=x.charAt(v),o="'"+d+"'";I[o]||(I[o]=B(d))}}R(V.pairs+"`");function B(x){return function(v){return S(v,x)}}function U(x){var v=x.state.closeBrackets;if(!v||v.override)return v;var d=x.getModeAt(x.getCursor());return d.closeBrackets||v}function k(x){var v=U(x);if(!v||x.getOption("disableInput"))return re.Pass;for(var d=G(v,"pairs"),o=x.listSelections(),u=0;u<o.length;u++){if(!o[u].empty())return re.Pass;var s=O(x,o[u].head);if(!s||d.indexOf(s)%2!=0)return re.Pass}for(var u=o.length-1;u>=0;u--){var w=o[u].head;x.replaceRange("",A(w.line,w.ch-1),A(w.line,w.ch+1),"+delete")}}function L(x){var v=U(x),d=v&&G(v,"explode");if(!d||x.getOption("disableInput"))return re.Pass;for(var o=x.listSelections(),u=0;u<o.length;u++){if(!o[u].empty())return re.Pass;var s=O(x,o[u].head);if(!s||d.indexOf(s)%2!=0)return re.Pass}x.operation(function(){var w=x.lineSeparator()||`
`;x.replaceSelection(w+w,null),x.execCommand("goCharLeft"),o=x.listSelections();for(var g=0;g<o.length;g++){var f=o[g].head.line;x.indentLine(f,null,!0),x.indentLine(f+1,null,!0)}})}function b(x){var v=re.cmpPos(x.anchor,x.head)>0;return{anchor:new A(x.anchor.line,x.anchor.ch+(v?-1:1)),head:new A(x.head.line,x.head.ch+(v?1:-1))}}function S(x,v){var d=U(x);if(!d||x.getOption("disableInput"))return re.Pass;var o=G(d,"pairs"),u=o.indexOf(v);if(u==-1)return re.Pass;for(var s=G(d,"closeBefore"),w=G(d,"triples"),g=o.charAt(u+1)==v,f=x.listSelections(),_=u%2==0,p,h=0;h<f.length;h++){var c=f[h],l=c.head,a,y=x.getRange(l,A(l.line,l.ch+1));if(_&&!c.empty())a="surround";else if((g||!_)&&y==v)g&&C(x,l)?a="both":w.indexOf(v)>=0&&x.getRange(l,A(l.line,l.ch+3))==v+v+v?a="skipThree":a="skip";else if(g&&l.ch>1&&w.indexOf(v)>=0&&x.getRange(A(l.line,l.ch-2),l)==v+v){if(l.ch>2&&/\bstring/.test(x.getTokenTypeAt(A(l.line,l.ch-2))))return re.Pass;a="addFour"}else if(g){var m=l.ch==0?" ":x.getRange(A(l.line,l.ch-1),l);if(!re.isWordChar(y)&&m!=v&&!re.isWordChar(m))a="both";else return re.Pass}else if(_&&(y.length===0||/\s/.test(y)||s.indexOf(y)>-1))a="both";else return re.Pass;if(!p)p=a;else if(p!=a)return re.Pass}var E=u%2?o.charAt(u-1):v,M=u%2?v:o.charAt(u+1);x.operation(function(){if(p=="skip")x.execCommand("goCharRight");else if(p=="skipThree")for(var F=0;F<3;F++)x.execCommand("goCharRight");else if(p=="surround"){for(var j=x.getSelections(),F=0;F<j.length;F++)j[F]=E+j[F]+M;x.replaceSelections(j,"around"),j=x.listSelections().slice();for(var F=0;F<j.length;F++)j[F]=b(j[F]);x.setSelections(j)}else p=="both"?(x.replaceSelection(E+M,null),x.triggerElectric(E+M),x.execCommand("goCharLeft")):p=="addFour"&&(x.replaceSelection(E+E+E+E,"before"),x.execCommand("goCharRight"))})}function O(x,v){var d=x.getRange(A(v.line,v.ch-1),A(v.line,v.ch+1));return d.length==2?d:null}function C(x,v){var d=x.getTokenAt(A(v.line,v.ch+1));return/\bstring/.test(d.type)&&d.start==v.ch&&(v.ch==0||!/\bstring/.test(x.getTokenTypeAt(v)))}})},GfqC:function(st,Ke,q){"use strict";var re=q("cDcd"),V=q.n(re),A=q("TSYQ"),G=q.n(A);function I(W,D){var P="cannot "+W.method+" "+W.action+" "+D.status+"'",H=new Error(P);return H.status=D.status,H.method=W.method,H.url=W.action,H}function R(W){var D=W.responseText||W.response;if(!D)return D;try{return JSON.parse(D)}catch(P){return D}}function B(W){var D=new XMLHttpRequest;W.onProgress&&D.upload&&(D.upload.onprogress=function(ee){ee.total>0&&(ee.percent=ee.loaded/ee.total*100),W.onProgress(ee)});var P=new FormData;W.data&&Object.keys(W.data).forEach(function(Y){var ee=W.data[Y];if(Array.isArray(ee)){ee.forEach(function(oe){P.append(Y+"[]",oe)});return}P.append(Y,W.data[Y])}),W.file instanceof Blob?P.append(W.filename,W.file,W.file.name):P.append(W.filename,W.file),D.onerror=function(ee){W.onError(ee)},D.onload=function(){return D.status<200||D.status>=300?W.onError(I(W,D),R(D)):W.onSuccess(R(D),D)},D.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in D&&(D.withCredentials=!0);var H=W.headers||{};return H["X-Requested-With"]!==null&&D.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(H).forEach(function(Y){H[Y]!==null&&D.setRequestHeader(Y,H[Y])}),D.send(P),{abort:function(){D.abort()}}}var U=+new Date,k=0;function L(){return"rc-upload-"+U+"-"+ ++k}function b(W,D){return W.indexOf(D,W.length-D.length)!==-1}var S=function(W,D){if(W&&D){var P=Array.isArray(D)?D:D.split(","),H=W.name||"",Y=W.type||"",ee=Y.replace(/\/.*$/,"");return P.some(function(oe){var xe=oe.trim();return xe.charAt(0)==="."?b(H.toLowerCase(),xe.toLowerCase()):/\/\*$/.test(xe)?ee===xe.replace(/\/.*$/,""):Y===xe})}return!0};function O(W,D){var P=W.createReader(),H=[];function Y(){P.readEntries(function(ee){var oe=Array.prototype.slice.apply(ee);H=H.concat(oe);var xe=!oe.length;xe?D(H):Y()})}Y()}var C=function(D,P,H){var Y=function ee(oe,xe){xe=xe||"",oe.isFile?oe.file(function(ve){H(ve)&&(oe.fullPath&&!ve.webkitRelativePath&&(Object.defineProperties(ve,{webkitRelativePath:{writable:!0}}),ve.webkitRelativePath=oe.fullPath.replace(/^\//,""),Object.defineProperties(ve,{webkitRelativePath:{writable:!1}})),P([ve]))}):oe.isDirectory&&O(oe,function(ve){ve.forEach(function(he){ee(he,""+xe+oe.name+"/")})})};D.forEach(function(ee){Y(ee.webkitGetAsEntry())})},x=C,v=Object.assign||function(W){for(var D=1;D<arguments.length;D++){var P=arguments[D];for(var H in P)Object.prototype.hasOwnProperty.call(P,H)&&(W[H]=P[H])}return W},d=function(){function W(D,P){var H=[],Y=!0,ee=!1,oe=void 0;try{for(var xe=D[Symbol.iterator](),ve;!(Y=(ve=xe.next()).done)&&!(H.push(ve.value),P&&H.length===P);Y=!0);}catch(he){ee=!0,oe=he}finally{try{!Y&&xe.return&&xe.return()}finally{if(ee)throw oe}}return H}return function(D,P){if(Array.isArray(D))return D;if(Symbol.iterator in Object(D))return W(D,P);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function W(D,P){for(var H=0;H<P.length;H++){var Y=P[H];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(D,Y.key,Y)}}return function(D,P,H){return P&&W(D.prototype,P),H&&W(D,H),D}}();function u(W,D,P){return D in W?Object.defineProperty(W,D,{value:P,enumerable:!0,configurable:!0,writable:!0}):W[D]=P,W}function s(W,D){var P={};for(var H in W){if(D.indexOf(H)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,H))continue;P[H]=W[H]}return P}function w(W,D){if(!(W instanceof D))throw new TypeError("Cannot call a class as a function")}function g(W,D){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return D&&(typeof D=="object"||typeof D=="function")?D:W}function f(W,D){if(typeof D!="function"&&D!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof D);W.prototype=Object.create(D&&D.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),D&&(Object.setPrototypeOf?Object.setPrototypeOf(W,D):W.__proto__=D)}var _=function(D){return Object.keys(D).reduce(function(P,H){return(H.substr(0,5)==="data-"||H.substr(0,5)==="aria-"||H==="role")&&(P[H]=D[H]),P},{})},p=function(W){f(D,W);function D(){var P,H,Y,ee;w(this,D);for(var oe=arguments.length,xe=Array(oe),ve=0;ve<oe;ve++)xe[ve]=arguments[ve];return ee=(H=(Y=g(this,(P=D.__proto__||Object.getPrototypeOf(D)).call.apply(P,[this].concat(xe))),Y),Y.state={uid:L()},Y.reqs={},Y.onChange=function(he){var fe=he.target.files;Y.uploadFiles(fe),Y.reset()},Y.onClick=function(he){var fe=Y.fileInput;if(!fe)return;var me=Y.props,ae=me.children,pe=me.onClick;ae&&ae.type==="button"&&(fe.parentNode.focus(),fe.parentNode.querySelector("button").blur()),fe.click(),pe&&pe(he)},Y.onKeyDown=function(he){he.key==="Enter"&&Y.onClick()},Y.onFileDrop=function(he){var fe=Y.props.multiple;if(he.preventDefault(),he.type==="dragover")return;if(Y.props.directory)x(Array.prototype.slice.call(he.dataTransfer.items),Y.uploadFiles,function(ae){return S(ae,Y.props.accept)});else{var me=Array.prototype.slice.call(he.dataTransfer.files).filter(function(ae){return S(ae,Y.props.accept)});fe===!1&&(me=me.slice(0,1)),Y.uploadFiles(me)}},Y.uploadFiles=function(he){var fe=Array.prototype.slice.call(he);fe.map(function(me){return me.uid=L(),me}).forEach(function(me){Y.upload(me,fe)})},Y.saveFileInput=function(he){Y.fileInput=he},H),g(Y,ee)}return o(D,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(H,Y){var ee=this,oe=this.props;if(!oe.beforeUpload)return setTimeout(function(){return ee.post(H)},0);var xe=oe.beforeUpload(H,Y);xe&&xe.then?xe.then(function(ve){var he=Object.prototype.toString.call(ve);return he==="[object File]"||he==="[object Blob]"?ee.post(ve):ee.post(H)}).catch(function(ve){console.log(ve)}):xe!==!1&&setTimeout(function(){return ee.post(H)},0);return}},{key:"post",value:function(H){var Y=this;if(!this._isMounted)return;var ee=this.props,oe=ee.onStart,xe=ee.onProgress,ve=ee.transformFile,he=ve===void 0?function(fe){return fe}:ve;new Promise(function(fe){var me=ee.action;return typeof me=="function"&&(me=me(H)),fe(me)}).then(function(fe){var me=H.uid,ae=ee.customRequest||B,pe=Promise.resolve(he(H)).then(function($){var ne=ee.data;return typeof ne=="function"&&(ne=ne($)),Promise.all([$,ne])}).catch(function($){console.error($)});pe.then(function($){var ne=d($,2),Q=ne[0],Ee=ne[1],we={action:fe,filename:ee.name,data:Ee,file:Q,headers:ee.headers,withCredentials:ee.withCredentials,method:ee.method||"post",onProgress:xe?function(ye){xe(ye,H)}:null,onSuccess:function(Se,Le){delete Y.reqs[me],ee.onSuccess(Se,H,Le)},onError:function(Se,Le){delete Y.reqs[me],ee.onError(Se,Le,H)}};oe(H),Y.reqs[me]=ae(we)})})}},{key:"reset",value:function(){this.setState({uid:L()})}},{key:"abort",value:function(H){var Y=this.reqs;if(H){var ee=H;H&&H.uid&&(ee=H.uid),Y[ee]&&Y[ee].abort&&Y[ee].abort(),delete Y[ee]}else Object.keys(Y).forEach(function(oe){Y[oe]&&Y[oe].abort&&Y[oe].abort(),delete Y[oe]})}},{key:"render",value:function(){var H,Y=this.props,ee=Y.component,oe=Y.prefixCls,xe=Y.className,ve=Y.disabled,he=Y.id,fe=Y.style,me=Y.multiple,ae=Y.accept,pe=Y.children,$=Y.directory,ne=Y.openFileDialogOnClick,Q=Y.onMouseEnter,Ee=Y.onMouseLeave,we=s(Y,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ye=G()((H={},u(H,oe,!0),u(H,oe+"-disabled",ve),u(H,xe,xe),H)),Se=ve?{}:{onClick:ne?this.onClick:function(){},onKeyDown:ne?this.onKeyDown:function(){},onMouseEnter:Q,onMouseLeave:Ee,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return V.a.createElement(ee,v({},Se,{className:ye,role:"button",style:fe}),V.a.createElement("input",v({},_(we),{id:he,type:"file",ref:this.saveFileInput,onClick:function(Oe){return Oe.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ae,directory:$?"directory":null,webkitdirectory:$?"webkitdirectory":null,multiple:me,onChange:this.onChange})),pe)}}]),D}(re.Component),h=p,c=Object.assign||function(W){for(var D=1;D<arguments.length;D++){var P=arguments[D];for(var H in P)Object.prototype.hasOwnProperty.call(P,H)&&(W[H]=P[H])}return W},l=function(){function W(D,P){for(var H=0;H<P.length;H++){var Y=P[H];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(D,Y.key,Y)}}return function(D,P,H){return P&&W(D.prototype,P),H&&W(D,H),D}}();function a(W,D){if(!(W instanceof D))throw new TypeError("Cannot call a class as a function")}function y(W,D){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return D&&(typeof D=="object"||typeof D=="function")?D:W}function m(W,D){if(typeof D!="function"&&D!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof D);W.prototype=Object.create(D&&D.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),D&&(Object.setPrototypeOf?Object.setPrototypeOf(W,D):W.__proto__=D)}function E(){}var M=function(W){m(D,W);function D(){var P,H,Y,ee;a(this,D);for(var oe=arguments.length,xe=Array(oe),ve=0;ve<oe;ve++)xe[ve]=arguments[ve];return ee=(H=(Y=y(this,(P=D.__proto__||Object.getPrototypeOf(D)).call.apply(P,[this].concat(xe))),Y),Y.saveUploader=function(he){Y.uploader=he},H),y(Y,ee)}return l(D,[{key:"abort",value:function(H){this.uploader.abort(H)}},{key:"render",value:function(){return V.a.createElement(h,c({},this.props,{ref:this.saveUploader}))}}]),D}(re.Component);M.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:E,onError:E,onSuccess:E,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var F=M,j=Ke.a=F},HmJG:function(st,Ke,q){},LdHM:function(st,Ke,q){"use strict";q.d(Ke,"b",function(){return s}),q.d(Ke,"a",function(){return g});var re=q("1OyB"),V=q("vuIU"),A=q("Ji7U"),G=q("LK+K"),I=q("cDcd"),R=q("rePB"),B=q("Ff2n"),U=q("ODXe"),k=q("4IlW"),L=q("bX4T"),b=q("YrtM"),S=q("TSYQ"),O=q.n(S),C=q("+nKL"),x=q("8OUc"),v=function(H,Y){var ee=H.prefixCls,oe=H.id,xe=H.flattenOptions,ve=H.childrenAsData,he=H.values,fe=H.searchValue,me=H.multiple,ae=H.defaultActiveFirstOption,pe=H.height,$=H.itemHeight,ne=H.notFoundContent,Q=H.open,Ee=H.menuItemSelectedIcon,we=H.virtual,ye=H.onSelect,Se=H.onToggleOpen,Le=H.onActiveValue,Oe=H.onScroll,ke=H.onMouseEnter,De="".concat(ee,"-item"),Pe=Object(b.a)(function(){return xe},[Q,xe],function(Fe,ge){return ge[0]&&Fe[1]!==ge[1]}),ze=I.useRef(null),$e=function(ge){ge.preventDefault()},We=function(ge){ze.current&&ze.current.scrollTo({index:ge})},He=function(ge){for(var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,de=Pe.length,J=0;J<de;J+=1){var Z=(ge+J*ue+de)%de,te=Pe[Z],se=te.group,ce=te.data;if(!se&&!ce.disabled)return Z}return-1},rt=I.useState(function(){return He(0)}),Je=Object(U.a)(rt,2),Qe=Je[0],Ae=Je[1],et=function(ge){Ae(ge);var ue=Pe[ge];if(!ue){Le(null,-1);return}Le(ue.data.value,ge)};I.useEffect(function(){et(ae!==!1?He(0):-1)},[Pe.length,fe]),I.useEffect(function(){var Fe=setTimeout(function(){if(!me&&Q&&he.size===1){var ge=Array.from(he)[0],ue=Pe.findIndex(function(de){var J=de.data;return J.value===ge});et(ue),We(ue)}});return function(){return clearTimeout(Fe)}},[Q]);var Ze=function(ge){ge!==void 0&&ye(ge,{selected:!he.has(ge)}),me||Se(!1)};if(I.useImperativeHandle(Y,function(){return{onKeyDown:function(ge){var ue=ge.which;switch(ue){case k.a.UP:case k.a.DOWN:{var de=0;if(ue===k.a.UP?de=-1:ue===k.a.DOWN&&(de=1),de!==0){var J=He(Qe+de,de);We(J),et(J)}break}case k.a.ENTER:{var Z=Pe[Qe];Z&&!Z.data.disabled?Ze(Z.data.value):Ze(void 0),Q&&ge.preventDefault();break}case k.a.ESC:Se(!1)}},onKeyUp:function(){},scrollTo:function(ge){We(ge)}}}),Pe.length===0)return I.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),className:"".concat(De,"-empty"),onMouseDown:$e},ne);function Re(Fe){var ge=Pe[Fe];if(!ge)return null;var ue=ge.data||{},de=ue.value,J=ue.label,Z=ue.children,te=Object(L.a)(ue,!0),se=ve?Z:J;return ge?I.createElement("div",Object.assign({"aria-label":typeof se=="string"?se:null},te,{key:Fe,role:"option",id:"".concat(oe,"_list_").concat(Fe),"aria-selected":he.has(de)}),de):null}return I.createElement(I.Fragment,null,I.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),style:{height:0,width:0,overflow:"hidden"}},Re(Qe-1),Re(Qe),Re(Qe+1)),I.createElement(C.a,{itemKey:"key",ref:ze,data:Pe,height:pe,itemHeight:$,fullHeight:!1,onMouseDown:$e,onScroll:Oe,virtual:we,onMouseEnter:ke},function(Fe,ge){var ue,de=Fe.group,J=Fe.groupOption,Z=Fe.data,te=Z.label,se=Z.key;if(de)return I.createElement("div",{className:O()(De,"".concat(De,"-group"))},te!==void 0?te:se);var ce=Z.disabled,_e=Z.value,Ce=Z.title,Ie=Z.children,Ye=Z.style,Ge=Z.className,mt=Object(B.a)(Z,["disabled","value","title","children","style","className"]),dt=he.has(_e),ot="".concat(De,"-option"),Ct=O()(De,ot,Ge,(ue={},Object(R.a)(ue,"".concat(ot,"-grouped"),J),Object(R.a)(ue,"".concat(ot,"-active"),Qe===ge&&!ce),Object(R.a)(ue,"".concat(ot,"-disabled"),ce),Object(R.a)(ue,"".concat(ot,"-selected"),dt),ue)),bt=ve?Ie:te,Bt=!Ee||typeof Ee=="function"||dt;return I.createElement("div",Object.assign({},mt,{"aria-selected":dt,className:Ct,title:Ce,onMouseMove:function(){if(Qe===ge||ce)return;et(ge)},onClick:function(){ce||Ze(_e)},style:Ye}),I.createElement("div",{className:"".concat(ot,"-content")},bt||_e),I.isValidElement(Ee)||dt,Bt&&I.createElement(x.a,{className:"".concat(De,"-option-state"),customizeIcon:Ee,customizeIconProps:{isSelected:dt}},dt?"\u2713":null))}))},d=I.forwardRef(v);d.displayName="OptionList";var o=d,u=function(){return null};u.isSelectOption=!0;var s=u,w=function(){return null};w.isSelectOptGroup=!0;var g=w,f=q("VTBJ"),_=q("Zm9Q");function p(P){var H=P.key,Y=P.props,ee=Y.children,oe=Y.value,xe=Object(B.a)(Y,["children","value"]);return Object(f.a)({key:H,value:oe!==void 0?oe:H,children:ee},xe)}function h(P){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(_.a)(P).map(function(Y,ee){if(!I.isValidElement(Y)||!Y.type)return null;var oe=Y.type.isSelectOptGroup,xe=Y.key,ve=Y.props,he=ve.children,fe=Object(B.a)(ve,["children"]);return H||!oe?p(Y):Object(f.a)(Object(f.a)({key:"__RC_SELECT_GRP__".concat(xe===null?ee:xe,"__"),label:xe},fe),{},{options:h(he)})}).filter(function(Y){return Y})}var c=q("2Qr1"),l=q("qNPg"),a=q("U8pU"),y=q("Kwbf"),m=q("WKfj");function E(P){var H=P.mode,Y=P.options,ee=P.children,oe=P.backfill,xe=P.allowClear,ve=P.placeholder,he=P.getInputElement,fe=P.showSearch,me=P.onSearch,ae=P.defaultOpen,pe=P.autoFocus,$=P.labelInValue,ne=P.value,Q=P.inputValue,Ee=P.optionLabelProp,we=H==="multiple"||H==="tags",ye=fe!==void 0?fe:we||H==="combobox",Se=Y||h(ee);if(Object(y.a)(H!=="tags"||Se.every(function(De){return!De.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),H==="tags"||H==="combobox"){var Le=Se.some(function(De){return De.options?De.options.some(function(Pe){return typeof("value"in Pe?Pe.value:Pe.key)=="number"}):typeof("value"in De?De.value:De.key)=="number"});Object(y.a)(!Le,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(y.a)(H!=="combobox"||!Ee,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(y.a)(H==="combobox"||!oe,"`backfill` only works with `combobox` mode."),Object(y.a)(H==="combobox"||!he,"`getInputElement` only work with `combobox` mode."),Object(y.b)(H!=="combobox"||!he||!xe||!ve,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),me&&!ye&&H!=="combobox"&&H!=="tags"&&Object(y.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(y.b)(!ae||pe,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ne!=null){var Oe=Object(m.d)(ne);Object(y.a)(!$||Oe.every(function(De){return Object(a.a)(De)==="object"&&("key"in De||"value"in De)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(y.a)(!we||Array.isArray(ne),"`value` should be array when `mode` is `multiple` or `tags`")}if(ee){var ke=null;Object(_.a)(ee).some(function(De){if(!I.isValidElement(De)||!De.type)return!1;var Pe=De.type;if(Pe.isSelectOption)return!1;if(Pe.isSelectOptGroup){var ze=Object(_.a)(De.props.children).every(function($e){return!I.isValidElement($e)||!De.type||$e.type.isSelectOption?!0:(ke=$e.type,!1)});return!ze}return ke=Pe,!0}),ke&&Object(y.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(ke.displayName||ke.name||ke,"`.")),Object(y.a)(Q===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var M=E,F=Object(l.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:h,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:M,fillOptionsWithMissingValue:c.a}),j=function(P){Object(A.a)(Y,P);var H=Object(G.a)(Y);function Y(){var ee;return Object(re.a)(this,Y),ee=H.apply(this,arguments),ee.selectRef=I.createRef(),ee.focus=function(){ee.selectRef.current.focus()},ee.blur=function(){ee.selectRef.current.blur()},ee}return Object(V.a)(Y,[{key:"render",value:function(){return I.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),Y}(I.Component);j.Option=s,j.OptGroup=g;var W=j,D=Ke.c=W},M8RZ:function(st,Ke,q){"use strict";q.d(Ke,"a",function(){return k});var re=q("fWQN"),V=q("mtLc"),A=q("yKVA"),G=q("879j"),I=q("cDcd"),R=q.n(I),B=q("faye"),U=q.n(B),k=function(L){Object(A.a)(S,L);var b=Object(G.a)(S);function S(O){var C;Object(re.a)(this,S),C=b.call(this,O);var x=window.document;return C.node=x.createElement("div"),x.body.appendChild(C.node),C}return Object(V.a)(S,[{key:"render",value:function(){var C=this.props.children;return Object(B.createPortal)(C,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),S}(R.a.Component)},Ot1p:function(st,Ke,q){"use strict";var re=q("2qtc"),V=q("kLXV"),A=q("rAM+"),G=q("miYZ"),I=q("tsqr"),R=q("9og8"),B=q("tJVT"),U=q("jrin"),k=q("WmNS"),L=q.n(k),b=q("cDcd"),S=q.n(b),O=q("VrN/"),C=q.n(O),x=q("bdgK"),v=q("p77/"),d=q("Bd2K"),o=q("ELLl"),u=q("19Vz"),s=q("lZu9"),w=q("+NIl"),g=q("kSUc"),f=q("9Bee"),_=function(ce){var _e=ce.value,Ce=_e===void 0?"":_e,Ie=ce.className,Ye=ce.showTextOnly,Ge=ce.showLines,mt=ce.style,dt=mt===void 0?{}:mt,ot=Object(b.useMemo)(function(){return""},[Ce]);return S.a.createElement(S.a.Fragment,null,S.a.createElement("div",{dangerouslySetInnerHTML:{__html:ot}}))},p=q("0Owb"),h=q("dejd"),c=q("C+DQ"),l=q("1vsH"),a=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(ce){var _e=ce.onActionCallback,Ce=ce.title,Ie=ce.icon,Ye=ce.actionName,Ge=ce.className,mt=Ge===void 0?"":Ge,dt=ce.children;function ot(){_e(Ye)}return S.a.createElement("a",{title:Ce,className:mt,onClick:ot},S.a.createElement("i",{className:"md-iconfont ".concat(Ie)}),dt)}var E=function(ce){var _e=ce.watch,Ce=ce.showNullButton,Ie=ce.onActionCallback,Ye=ce.fullScreen,Ge=ce.insertTemp,mt=ce.hidetoolBar,dt=ce.uuid,ot=ce.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(l.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(l.G)("_educoder_session"),"&key=").concat(dt,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Ct=[].concat(y,[{title:"".concat(_e?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(_e?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return S.a.createElement("ul",{className:"markdown-toolbar-container"},!mt&&Ct.map(function(bt,Bt){return S.a.createElement("li",{key:Bt},bt.actionName?S.a.createElement(m,Object(p.a)({},bt,{onActionCallback:Ie})):S.a.createElement("span",{className:"v-line"}))}),Ce?S.a.createElement("li",null,S.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Ie},S.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Ge&&S.a.createElement("li",null,S.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Ge),onActionCallback:Ie},S.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),S.a.createElement("li",{className:"btn-full-screen"},S.a.createElement(m,{icon:"".concat(Ye?"icon-shrink":"icon-enlarge"),title:Ye?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Ie})))},M=q("M8RZ"),F=q("+L6B"),j=q("2/Rp"),W=q("y8nQ"),D=q("Vl3Y"),P=q("5NDa"),H=q("5rEg"),Y={labelCol:{span:4},wrapperCol:{span:20}},ee=function(ce){var _e=ce.callback,Ce=ce.onCancel;function Ie(Ye){_e(Ye)}return S.a.createElement(D.a,Object(p.a)({},Y,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Ie}),S.a.createElement(D.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},S.a.createElement(H.a,null)),S.a.createElement(D.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},S.a.createElement(H.a,null)),S.a.createElement("div",{className:"flex-container flex-end"},S.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement(j.a,{type:"ghost",onClick:Ce},"\u53D6\u6D88")))},oe=q("7ahc"),xe=q("HmJG"),ve=q("BjJ7"),he=D.a.useForm,fe={width:280,marginRight:10},me={labelCol:{span:5},wrapperCol:{span:19}},ae=function(ce){var _e=ce.callback,Ce=ce.onCancel,Ie=he(),Ye=Object(B.a)(Ie,1),Ge=Ye[0];function mt(Ct){_e(Ct)}function dt(Ct,bt){if(Ct.status===-1){I.b.error(Ct.message);return}Ge.setFieldsValue({src:"/api/attachments/".concat(Ct.id),type:bt.type})}function ot(Ct){var bt=Ct.target.files[0];$(bt,dt)}return S.a.createElement(D.a,Object(p.a)({form:Ge},me,{className:"upload-image-panel",onFinish:mt}),S.a.createElement(D.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},S.a.createElement("div",{className:"flex-container"},S.a.createElement(D.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},S.a.createElement(H.a,{style:fe})),S.a.createElement(pe,{onFileChange:ot}))),S.a.createElement(D.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},S.a.createElement(H.a,{style:{width:264}})),S.a.createElement(D.a.Item,{style:{textAlign:"right"}},S.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement(j.a,{type:"ghost",onClick:Ce},"\u53D6\u6D88")))};function pe(ce){var _e=ce.onFileChange;return S.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",S.a.createElement("input",{type:"file",onChange:_e}))}function $(ce,_e){if(!ce)throw new String("\u6CA1\u6709\u6587\u4EF6");var Ce=new FormData;Ce.append("editormd-image-file",ce),Ce.append("file_param_name","editormd-image-file"),Ce.append("byxhr","true");var Ie=new window.XMLHttpRequest;Ie.withCredentials=!0,Ie.addEventListener("load",function(Ye){_e(JSON.parse(Ye.target.responseText),ce)},!1),Ie.addEventListener("error",function(Ye){console.error(Ye)},!1),Ie.open("POST","".concat(ve.a,"/api/attachments.json")),Ie.send(Ce)}var ne=q("giR+"),Q=q("fyUT"),Ee=q("7Kak"),we=q("9yH6"),ye=we.a.Group,Se={margin:"0 8px"},Le=function(ce){var _e=ce.callback,Ce=ce.onCancel;function Ie(Ye){_e(Ye)}return S.a.createElement(D.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Ie},S.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},S.a.createElement("span",{style:Se},"\u5355\u5143\u683C\u6570\uFF1A"),S.a.createElement("span",{style:Se},"\u884C\u6570"),S.a.createElement(D.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},S.a.createElement(Q.a,null)),S.a.createElement("span",{style:Se},"\u5217\u6570"),S.a.createElement(D.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},S.a.createElement(Q.a,null))),S.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},S.a.createElement("span",{style:Se},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),S.a.createElement(D.a.Item,{name:"align"},S.a.createElement(ye,null,S.a.createElement(we.a,{value:"default"},S.a.createElement("i",{className:"fa fa-align-justify"})),S.a.createElement(we.a,{value:"left"},S.a.createElement("i",{className:"fa fa-align-left"})),S.a.createElement(we.a,{value:"center"},S.a.createElement("i",{className:"fa fa-align-center"})),S.a.createElement(we.a,{value:"right"},S.a.createElement("i",{className:"fa fa-align-right"}))))),S.a.createElement("div",{className:"flex-container flex-end"},S.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement(j.a,{type:"ghost",onClick:Ce},"\u53D6\u6D88")))},Oe=q("ErOA"),ke=q("7Cbv"),De="link",Pe="upload-image",ze="code-block",$e="add-table",We="------------",He={default:We,left:":".concat(We),center:":".concat(We,":"),right:"".concat(We,":")},rt=q("9VGf"),Je,Qe;function Ae(){}var et=0,Ze=1e4,Re="\u2581",Fe=`
**\u6A21\u677F\u6807\u9898**
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function ge(ce){return/^\d+$/.test(ce)?"".concat(ce,"px"):ce}var ue=navigator.platform.toUpperCase().indexOf("MAC")>=0,de=ue?"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"],Z=(Je={},Object(U.a)(Je,de+"-B","bold"),Object(U.a)(Je,de+"-I","italic"),Je),te=(Qe={},Object(U.a)(Qe,De,"\u6DFB\u52A0\u94FE\u63A5"),Object(U.a)(Qe,ze,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(U.a)(Qe,Pe,"\u6DFB\u52A0\u6587\u4EF6"),Object(U.a)(Qe,$e,"\u6DFB\u52A0\u8868\u683C"),Qe),se=Ke.a=function(ce){var _e=ce.defaultValue,Ce=_e===void 0?"":_e,Ie=ce.onChange,Ye=ce.width,Ge=Ye===void 0?"100%":Ye,mt=ce.height,dt=mt===void 0?400:mt,ot=ce.miniToolbar,Ct=ot===void 0?!1:ot,bt=ce.isFocus,Bt=bt===void 0?!1:bt,Ut=ce.watch,Et=ce.insertTemp,Cr=ce.mode,Rr=Cr===void 0?"markdown":Cr,lr=ce.id,pr=lr===void 0?"markdown-editor-id":lr,fr=ce.showResizeBar,ia=fr===void 0?!1:fr,_r=ce.noStorage,Hn=_r===void 0?!1:_r,Kn=ce.showNullButton,Rt=Kn===void 0?!1:Kn,nt=ce.hidetoolBar,Pr=nt===void 0?!1:nt,mn=ce.fullScreen,Qt=mn===void 0?!1:mn,Tt=ce.onBlur,gr=ce.onCMBeforeChange,Mr=ce.onFullScreen,pn=ce.className,Ne=pn===void 0?"":pn,ct=ce.disablePaste,Gn=ct===void 0?!1:ct,gn=ce.placeholder,vn=gn===void 0?"":gn,Zr=ce.values,yn=Zr===void 0?"":Zr,ht=Object(b.useState)(null),_i=Object(B.a)(ht,2),Be=_i[0],bn=_i[1],hr=Object(b.useState)(Ce),zn=Object(B.a)(hr,2),Qr=zn[0],vr=zn[1],Vn=Object(b.useState)(Ut),Xn=Object(B.a)(Vn,2),yr=Xn[0],Yn=Xn[1],Ai=Object(b.useState)(Qt),$n=Object(B.a)(Ai,2),br=$n[0],Li=$n[1],aa=Object(b.useState)(""),Jn=Object(B.a)(aa,2),$t=Jn[0],Wr=Jn[1],oa=Object(b.useState)(0),qr=Object(B.a)(oa,2),Er=qr[0],Zn=qr[1],sa=Object(b.useState)(dt),Di=Object(B.a)(sa,2),Oi=Di[0],En=Di[1],Ri=Object(b.useState)(!1),Pi=Object(B.a)(Ri,2),la=Pi[0],xn=Pi[1],en=Object(b.useRef)(Object(ke.a)()),tn=Object(b.useRef)(!1),Tn=Object(b.useRef)(),kr=Object(b.useRef)(),Ir=Object(b.useRef)(),Ur=Object(b.useRef)(),Sn=Object(b.useRef)(),Mi=function(){var it=Object(R.a)(L.a.mark(function ft(){var lt,gt;return L.a.wrap(function(At){for(;;)switch(At.prev=At.next){case 0:return At.next=2,Object(Oe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:en.current}});case 2:gt=At.sent,gt!=null&&(lt=gt.attachments)!==null&&lt!==void 0&&lt.length&&(console.log("cm:",Be,kr),gt.attachments.map(function(yt){yt.content_type.indexOf("image")>-1?Be.replaceSelection("![,](/api/attachments/".concat(yt.id,"?type=").concat(yt.content_type,")")):yt.content_type.indexOf("video")>-1?Be.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):yt.content_type.indexOf("pdf")>-1?Be.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(yt.id,"?type=").concat(yt.content_type,'&disposition=inline" target="_blank">').concat(yt.name,"</a>")):Be.replaceSelection("[".concat(yt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(yt.id,"?type=").concat(yt.content_type,")"))}));case 4:case"end":return At.stop()}},ft)}));return function(){return it.apply(this,arguments)}}();Object(b.useEffect)(function(){vr(yn),Be==null||Be.setValue(yn)},[yn]),Object(b.useEffect)(function(){Mr==null||Mr(br)},[br]),Object(b.useEffect)(function(){if(kr.current){var it=C.a.fromTextArea(kr.current,{mode:Rr,lineNumbers:!Ct,lineWrapping:!0,value:Ce,autoCloseTags:!0,autoCloseBrackets:!0});Bt&&it.focus();function ft(lt,gt){if(Gn){gt.preventDefault();return}var xt=gt.clipboardData;if(xt){var At=xt.types.toString(),yt=xt.items;if(At==="Files"||xt.types.indexOf("Files")>-1){if(gt.preventDefault(),Rr=="stex")return;try{var Ft,qt=yt[1];((Ft=yt[0])===null||Ft===void 0?void 0:Ft.kind)==="file"&&(qt=yt[0]);var vt=qt.getAsFile(),Fr=vt.name.split(".").pop();$(vt,function(St){if(St.id){var er,Vt,mr;(vt==null||((er=vt.type)===null||er===void 0)?void 0:er.indexOf("image"))>-1?it.replaceSelection("![,](/api/attachments/".concat(St.id,"?type=").concat(St.content_type,")")):(vt==null||((Vt=vt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?it.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,'"></video>')):(vt==null||((mr=vt.type)===null||mr===void 0)?void 0:mr.indexOf("pdf"))>-1?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(vt.type,'&disposition=inline" target="_blank">').concat(vt.name,"</a>")):J.includes(Fr)?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,'?type=office&disposition=inline" target="_blank">').concat(vt.name,"</a>")):it.replaceSelection("[".concat(vt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(St.content_type,")"))}else(St==null?void 0:St.status)===401&&(document.location.href="/user/login")})}catch(St){I.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return it.on("paste",ft),it.on("dragleave",function(lt,gt){Ir.current.classList.remove("mouse-hover-md")}),it.on("dragover",function(lt,gt){Ir.current.classList.add("mouse-hover-md")}),it.on("drop",function(lt,gt){Ir.current.classList.add("mouse-hover-md");var xt;if(xt=gt.dataTransfer.files,xt.length>0){gt.preventDefault(),gt.stopPropagation();for(var At=function(qt){var vt=xt[qt],Fr=vt.name.split(".").pop();$(vt,function(St){if(St.id){var er,Vt,mr;(vt==null||((er=vt.type)===null||er===void 0)?void 0:er.indexOf("image"))>-1?it.replaceSelection("![,](/api/attachments/".concat(St.id,"?type=").concat(St.content_type,")")):(vt==null||((Vt=vt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?it.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,'"></video>')):(vt==null||((mr=vt.type)===null||mr===void 0)?void 0:mr.indexOf("pdf"))>-1?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(vt.type,'&disposition=inline" target="_blank">').concat(vt.name,"</a>")):J.includes(Fr)?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,'?type=office&disposition=inline" target="_blank">').concat(vt.name,"</a>")):it.replaceSelection("[".concat(vt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(St.content_type,")"))}else(St==null?void 0:St.status)===401&&(document.location.href="/user/login")})},yt=0;yt<xt.length;yt++)At(yt)}}),bn(it),function(){it.off("paste",ft)}}},[]);var ur=Object(b.useCallback)(function(){if(Ir.current)try{}catch(it){console.log(it,"---- to set md editor body height")}},[Oi,Ir,br]);Object(b.useEffect)(function(){function it(){var lt=new x.default(function(gt){var xt=Object(A.a)(gt),At;try{for(xt.s();!(At=xt.n()).done;){var yt=At.value;(yt.target.offsetHeight>0||yt.target.offsetWidth>0)&&(ur(),Be.setSize("100%","100%"),Be.refresh())}}catch(Ft){xt.e(Ft)}finally{xt.f()}});return lt.observe(kr.current.parentElement),lt}if(Be){var ft=it();return function(){ft.unobserve(kr.current.parentElement)}}},[Be,ur]),Object(b.useEffect)(function(){if(Be){for(var it=[],ft=function(){var yt=gt[lt];xt=Object(B.a)(yt,2);var Ft=xt[0],qt=xt[1],vt=Object(U.a)({},Ft,function(){ki(qt)});it.push(vt),Be.addKeyMap(vt)},lt=0,gt=Object.entries(Z);lt<gt.length;lt++){var xt;ft()}return Tn.current=setInterval(function(){tn.current&&Mi()},4e3),function(){clearInterval(Tn.current);var At=Object(A.a)(it),yt;try{for(At.s();!(yt=At.n()).done;){var Ft=yt.value;Be.removeKeyMap(Ft)}}catch(qt){At.e(qt)}finally{At.f()}}}},[Be]),Object(b.useEffect)(function(){Qt!==br&&Li(Qt)},[Qt]),Object(rt.a)(function(){if(!Hn&&Er>0){var it=new Date().getTime(),ft=window.sessionStorage.getItem(pr);it>=Er+Ze&&(!ft||ft!==Qr)&&(window.sessionStorage.setItem(pr,Qr),xn(!0))}},Ze),Object(b.useEffect)(function(){Yn(Ut)},[Be,Ut]),Object(b.useEffect)(function(){Be&&(Bt&&Be.focus())},[Be,Bt]),Object(b.useEffect)(function(){if(yr&&Be){var it=Be.getScrollerElement();function ft(lt){var gt=lt.target;if(Sn.current){var xt=gt.scrollTop/gt.scrollHeight;Sn.current.scrollTop=Sn.current.scrollHeight*xt}}return it.addEventListener("scroll",ft),function(){it.removeEventListener("scroll",ft)}}},[Be,yr]),Object(b.useEffect)(function(){if(Be&&gr){function it(ft,lt){gr(ft,lt)}return Be.on("beforeChange",it),function(){Be.off("beforeChange",it)}}},[Be,gr]),Object(b.useEffect)(function(){if(Be&&Tt){function it(){Tt(Be.getValue())}return Be.on("blur",it),function(){Be.off("blur",it)}}},[Be,Tt]),Object(b.useEffect)(function(){if(Be){function it(ft){var lt=ft.getValue();vr(lt),Zn(new Date().getTime()),ft.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Ie&&Ie(lt)}return Be.on("change",it),function(){Be.off("change",it)}}},[Be,Ie]),Object(b.useEffect)(function(){Be&&(Ce==null?(Be.setValue(""),vr("")):Ce!==Be.getValue()&&(Be.setValue(Ce),vr(Ce),Be.setCursor(Be.lineCount(),0)))},[Be,Ce]);var ki=Object(b.useCallback)(function(it){var ft=Be.getCursor(),lt=Be.getSelection(),gt=lt.split(`
`);switch(it){case"bold":return Be.replaceSelection("**"+lt+"**"),lt===""&&Be.setCursor(ft.line,ft.ch+2),Be.focus();case"italic":return Be.replaceSelection("*"+lt+"*"),lt===""&&Be.setCursor(ft.line,ft.ch+1),Be.focus();case"code":return Be.replaceSelection("`"+lt+"`"),lt===""&&Be.setCursor(ft.line,ft.ch+1),Be.focus();case"inline-latex":return Be.replaceSelection("`$$"+lt+"$$`"),lt===""&&Be.setCursor(ft.line,ft.ch+3),Be.focus();case"latex":return Be.replaceSelection("```latex\n"+lt+"\n```"),Be.setCursor(ft.line+1,lt.length+1),Be.focus();case"line-break":return Be.replaceSelection(`<br/>
`),Be.focus();case"list-ul":return lt===""?Be.replaceSelection("- "+lt):Be.replaceSelection(gt.map(function(xt){return xt===""?"":"- ".concat(xt)}).join(`
`)),Be.focus();case"list-ol":return lt===""?Be.replaceSelection("1. "+lt):Be.replaceSelection(gt.map(function(xt,At){return xt===""?"":"".concat(At+1,". ").concat(xt)}).join(`
`)),Be.focus();case"add-null-ch":return lt===""&&Be.setCursor(ft.line,ft.ch+1),Be.replaceSelection(Re),Be.focus();case"inster-template-1":return lt===""&&Be.setCursor(ft.line,ft.ch),Be.replaceSelection(Fe),Be.focus();case"eraser":return Be.setValue(""),Be.focus();case"trigger-watch":return Yn(!yr),Be.focus();case"trigger-full-screen":return Li(!br),Be.focus();case De:Wr(De);return;case ze:Wr(ze);return;case Pe:Wr(Pe);return;case $e:Wr($e);return;default:throw new Error}},[Be,yr,br]),wn=Object(b.useCallback)(function(it){Wr("");switch($t){case De:var ft=it.title,lt=it.link;return Be.replaceSelection("[".concat(ft,"](").concat(lt,")")),Be.focus();case ze:var gt=it.language,xt=it.content;return Be.replaceSelection(["```"+gt,xt,"```"].join(`
`)),Be.focus();case Pe:var At=it.src,yt=it.alt;return yt?Be.replaceSelection("![ ".concat(yt," ]( ").concat(At,' "').concat(yt,'" )')):Be.replaceSelection("![,](".concat(At,")")),Be.focus();case $e:for(var Ft=it.row,qt=it.col,vt=it.align,Fr=`
`,St=0;St<Ft;St++){for(var er=[],Vt=[],mr=0;mr<qt;mr++)St===1&&Vt.push(He[vt]),er.push(" ");St===1&&(Fr+="| ".concat(Vt.join(" | "),` |
`)),Fr+="| ".concat(er.join(qt===1?"":" | "),` |
`)}return Be.replaceSelection(Fr+`
`),Be.focus();default:throw new Error}},[Be,$t]),Qn=Object(b.useMemo)(function(){switch($t){case De:return S.a.createElement(ee,{callback:wn,onCancel:Hr});case ze:return S.a.createElement(oe.b,{callback:wn,onCancel:Hr});case Pe:return S.a.createElement(ae,{callback:wn,onCancel:Hr});case $e:return S.a.createElement(Le,{callback:wn,onCancel:Hr});default:return null}},[$t]);function Hr(){Wr("")}Object(b.useEffect)(function(){if(Ur.current){var it=Ur.current,ft=!1,lt=0;function gt(yt){ft=!0,lt=yt.pageY}function xt(){ft=!1}function At(yt){if(ft){var Ft=yt.pageY-lt;Ft<0&&(Ft=0),Ft>300&&(Ft=300);var qt=dt+Ft+"px";En(qt)}}return it.addEventListener("mousedown",gt),document.addEventListener("mousemove",At),document.addEventListener("mouseup",xt),function(){it.removeEventListener("mousedown",gt),document.removeEventListener("mousemove",At),document.removeEventListener("mouseup",xt)}}},[Be,Ur]),Object(b.useEffect)(function(){En(dt)},[dt]);var Ar=ge(Ge),qn=ge(Oi),xr={width:Ar,height:qn},ei=Object(b.useMemo)(function(){if(Er){var it=new Date(Er),ft=it.getHours(),lt=it.getMinutes(),gt=it.getSeconds();return ft=ft<10?"0"+ft:ft,lt=lt<10?"0"+lt:lt,gt=gt<10?"0"+gt:gt,"".concat(ft,":").concat(lt,":").concat(gt)}return 0},[Er]);function Ii(){window.sessionStorage.removeItem(pr),xn(!1),Zn(0)}function rn(){xn(!1),Zn(0),Be.setValue(window.sessionStorage.getItem(pr))}function ua(it,ft){var lt=Be.getValue();lt=lt.replace(it,ft),vr(lt),Be==null||Be.setValue(lt)}return S.a.createElement(b.Fragment,null,S.a.createElement("div",{className:"markdown-editor-wrapper",ref:Ir},S.a.createElement("div",{className:"markdown-editor-container ".concat(Ne," ").concat(yr?"on-preview":""," ").concat(Ct?"mini":""," ").concat(br?"full-screen":""),style:xr},S.a.createElement(E,{insertTemp:Et,watch:yr,fullScreen:br,showNullButton:Rt,onActionCallback:ki,hidetoolBar:Pr,uuid:en.current,setOpenPhones:function(){tn.current=!0}}),S.a.createElement("div",{className:"markdown-editor-body"},S.a.createElement("div",{className:"codemirror-container"},S.a.createElement("textarea",{ref:kr,placeholder:vn})),yr?S.a.createElement("div",{ref:Sn,className:"preview-container"},Rr==="stex"&&S.a.createElement(_,{value:Qr}),Rr!=="stex"&&S.a.createElement(f.a,{edit:!0,value:Qr,replaces:ua})):null))),ia?S.a.createElement("a",{ref:Ur,className:"editor-resize"}):null,S.a.createElement(M.a,null,te[$t]?S.a.createElement(V.a,{centered:!0,title:te[$t],visible:!0,onCancel:Hr,footer:null,className:"markdown-popup-form"},Qn):null))}},SJMd:function(st,Ke){/**
* @license
* Copyright (C) 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var q,re,V,A=!1,G,I;window.PR_SHOULD_USE_CONTINUATION=!0;var R,B;(function(){var U=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"],b=[L,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],S=[b,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],O=[b,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],C=[b,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],x="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",v=[b,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[k,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],u=[k,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],s=[k,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],w=[S,C,O,v,d,o,u,s],g=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,f="str",_="kwd",p="com",h="typ",c="lit",l="pun",a="pln",y="tag",m="dec",E="src",M="atn",F="atv",j="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function D(ye){for(var Se=0,Le=!1,Oe=!1,ke=0,De=ye.length;ke<De;++ke){var Pe=ye[ke];if(Pe.ignoreCase)Oe=!0;else if(/[a-z]/i.test(Pe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Le=!0,Oe=!1;break}}var ze={b:8,t:9,n:10,v:11,f:12,r:13};function $e(Qe){var Ae=Qe.charCodeAt(0);if(Ae!==92)return Ae;var et=Qe.charAt(1);return Ae=ze[et],Ae||("0"<=et&&et<="7"?parseInt(Qe.substring(1),8):et==="u"||et==="x"?parseInt(Qe.substring(2),16):Qe.charCodeAt(1))}function We(Qe){if(Qe<32)return(Qe<16?"\\x0":"\\x")+Qe.toString(16);var Ae=String.fromCharCode(Qe);return Ae==="\\"||Ae==="-"||Ae==="]"||Ae==="^"?"\\"+Ae:Ae}function He(Qe){var Ae=Qe.substring(1,Qe.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),et=[],Ze=Ae[0]==="^",Re=["["];Ze&&Re.push("^");for(var Fe=Ze?1:0,ge=Ae.length;Fe<ge;++Fe){var ue=Ae[Fe];if(/\\[bdsw]/i.test(ue))Re.push(ue);else{var de=$e(ue),J;Fe+2<ge&&Ae[Fe+1]==="-"?(J=$e(Ae[Fe+2]),Fe+=2):J=de,et.push([de,J]),J<65||de>122||(J<65||de>90||et.push([Math.max(65,de)|32,Math.min(J,90)|32]),J<97||de>122||et.push([Math.max(97,de)&~32,Math.min(J,122)&~32]))}}et.sort(function(ce,_e){return ce[0]-_e[0]||_e[1]-ce[1]});for(var Z=[],te=[],Fe=0;Fe<et.length;++Fe){var se=et[Fe];se[0]<=te[1]+1?te[1]=Math.max(te[1],se[1]):Z.push(te=se)}for(var Fe=0;Fe<Z.length;++Fe){var se=Z[Fe];Re.push(We(se[0])),se[1]>se[0]&&(se[1]+1>se[0]&&Re.push("-"),Re.push(We(se[1])))}return Re.push("]"),Re.join("")}function rt(Qe){for(var Ae=Qe.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),et=Ae.length,Ze=[],Re=0,Fe=0;Re<et;++Re){var ge=Ae[Re];if(ge==="(")++Fe;else if(ge.charAt(0)==="\\"){var ue=+ge.substring(1);ue&&(ue<=Fe?Ze[ue]=-1:Ae[Re]=We(ue))}}for(var Re=1;Re<Ze.length;++Re)Ze[Re]===-1&&(Ze[Re]=++Se);for(var Re=0,Fe=0;Re<et;++Re){var ge=Ae[Re];if(ge==="(")++Fe,Ze[Fe]||(Ae[Re]="(?:");else if(ge.charAt(0)==="\\"){var ue=+ge.substring(1);ue&&ue<=Fe&&(Ae[Re]="\\"+Ze[ue])}}for(var Re=0;Re<et;++Re)Ae[Re]==="^"&&Ae[Re+1]!=="^"&&(Ae[Re]="");if(Qe.ignoreCase&&Le)for(var Re=0;Re<et;++Re){var ge=Ae[Re],de=ge.charAt(0);ge.length>=2&&de==="["?Ae[Re]=He(ge):de!=="\\"&&(Ae[Re]=ge.replace(/[a-zA-Z]/g,function(te){var se=te.charCodeAt(0);return"["+String.fromCharCode(se&~32,se|32)+"]"}))}return Ae.join("")}for(var Je=[],ke=0,De=ye.length;ke<De;++ke){var Pe=ye[ke];if(Pe.global||Pe.multiline)throw new Error(""+Pe);Je.push("(?:"+rt(Pe)+")")}return new RegExp(Je.join("|"),Oe?"gi":"g")}function P(ye,Se){var Le=/(?:^|\s)nocode(?:\s|$)/,Oe=[],ke=0,De=[],Pe=0;function ze($e){var We=$e.nodeType;if(We==1){if(Le.test($e.className))return;for(var He=$e.firstChild;He;He=He.nextSibling)ze(He);var rt=$e.nodeName.toLowerCase();(rt==="br"||rt==="li")&&(Oe[Pe]=`
`,De[Pe<<1]=ke++,De[Pe++<<1|1]=$e)}else if(We==3||We==4){var Je=$e.nodeValue;Je.length&&(Se?Je=Je.replace(/\r\n?/g,`
`):Je=Je.replace(/[ \t\r\n]+/g," "),Oe[Pe]=Je,De[Pe<<1]=ke,ke+=Je.length,De[Pe++<<1|1]=$e)}}return ze(ye),{sourceCode:Oe.join("").replace(/\n$/,""),spans:De}}function H(ye,Se,Le,Oe,ke){if(!Le)return;var De={sourceNode:ye,pre:1,langExtension:null,numberLines:null,sourceCode:Le,spans:null,basePos:Se,decorations:null};Oe(De),ke.push.apply(ke,De.decorations)}var Y=/\S/;function ee(ye){for(var Se=void 0,Le=ye.firstChild;Le;Le=Le.nextSibling){var Oe=Le.nodeType;Se=Oe===1?Se?ye:Le:Oe===3&&Y.test(Le.nodeValue)?ye:Se}return Se===ye?void 0:Se}function oe(ye,Se){var Le={},Oe;(function(){for(var Pe=ye.concat(Se),ze=[],$e={},We=0,He=Pe.length;We<He;++We){var rt=Pe[We],Je=rt[3];if(Je)for(var Qe=Je.length;--Qe>=0;)Le[Je.charAt(Qe)]=rt;var Ae=rt[1],et=""+Ae;$e.hasOwnProperty(et)||(ze.push(Ae),$e[et]=null)}ze.push(/[\0-\uffff]/),Oe=D(ze)})();var ke=Se.length,De=function(Pe){for(var ze=Pe.sourceCode,$e=Pe.basePos,We=Pe.sourceNode,He=[$e,a],rt=0,Je=ze.match(Oe)||[],Qe={},Ae=0,et=Je.length;Ae<et;++Ae){var Ze=Je[Ae],Re=Qe[Ze],Fe=void 0,ge;if(typeof Re=="string")ge=!1;else{var ue=Le[Ze.charAt(0)];if(ue)Fe=Ze.match(ue[1]),Re=ue[0];else{for(var de=0;de<ke;++de)if(ue=Se[de],Fe=Ze.match(ue[1]),Fe){Re=ue[0];break}Fe||(Re=a)}ge=Re.length>=5&&Re.substring(0,5)==="lang-",ge&&!(Fe&&typeof Fe[1]=="string")&&(ge=!1,Re=E),ge||(Qe[Ze]=Re)}var J=rt;if(rt+=Ze.length,!ge)He.push($e+J,Re);else{var Z=Fe[1],te=Ze.indexOf(Z),se=te+Z.length;Fe[2]&&(se=Ze.length-Fe[2].length,te=se-Z.length);var ce=Re.substring(5);H(We,$e+J,Ze.substring(0,te),De,He),H(We,$e+J+te,Z,pe(ce,Z),He),H(We,$e+J+se,Ze.substring(se),De,He)}}Pe.decorations=He};return De}function xe(ye){var Se=[],Le=[];ye.tripleQuotedStrings?Se.push([f,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ye.multiLineStrings?Se.push([f,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Se.push([f,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ye.verbatimStrings&&Le.push([f,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Oe=ye.hashComments;Oe&&(ye.cStyleComments?(Oe>1?Se.push([p,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Se.push([p,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Le.push([f,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Se.push([p,/^#[^\r\n]*/,null,"#"])),ye.cStyleComments&&(Le.push([p,/^\/\/[^\r\n]*/,null]),Le.push([p,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var ke=ye.regexLiterals;if(ke){var De=ke>1?"":`
\r`,Pe=De?".":"[\\S\\s]",ze="/(?=[^/*"+De+"])(?:[^/\\x5B\\x5C"+De+"]|\\x5C"+Pe+"|\\x5B(?:[^\\x5C\\x5D"+De+"]|\\x5C"+Pe+")*(?:\\x5D|$))+/";Le.push(["lang-regex",RegExp("^"+W+"("+ze+")")])}var $e=ye.types;$e&&Le.push([h,$e]);var We=(""+ye.keywords).replace(/^ | $/g,"");We.length&&Le.push([_,new RegExp("^(?:"+We.replace(/[\s,]+/g,"|")+")\\b"),null]),Se.push([a,/^\s+/,null,` \r
\xA0`]);var He="^.[^\\s\\w.$@'\"`/\\\\]*";return ye.regexLiterals&&(He+="(?!s*/)"),Le.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[h,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[l,new RegExp(He),null]),oe(Se,Le)}var ve=xe({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function he(ye,Se,Le){for(var Oe=/(?:^|\s)nocode(?:\s|$)/,ke=/\r\n?|\n/,De=ye.ownerDocument,Pe=De.createElement("li");ye.firstChild;)Pe.appendChild(ye.firstChild);var ze=[Pe];function $e(Ae){var et=Ae.nodeType;if(et==1&&!Oe.test(Ae.className))if(Ae.nodeName==="br")We(Ae),Ae.parentNode&&Ae.parentNode.removeChild(Ae);else for(var Ze=Ae.firstChild;Ze;Ze=Ze.nextSibling)$e(Ze);else if((et==3||et==4)&&Le){var Re=Ae.nodeValue,Fe=Re.match(ke);if(Fe){var ge=Re.substring(0,Fe.index);Ae.nodeValue=ge;var ue=Re.substring(Fe.index+Fe[0].length);if(ue){var de=Ae.parentNode;de.insertBefore(De.createTextNode(ue),Ae.nextSibling)}We(Ae),ge||Ae.parentNode.removeChild(Ae)}}}function We(Ae){for(;!Ae.nextSibling;)if(Ae=Ae.parentNode,!Ae)return;function et(Fe,ge){var ue=ge?Fe.cloneNode(!1):Fe,de=Fe.parentNode;if(de){var J=et(de,1),Z=Fe.nextSibling;J.appendChild(ue);for(var te=Z;te;te=Z)Z=te.nextSibling,J.appendChild(te)}return ue}for(var Ze=et(Ae.nextSibling,0),Re;(Re=Ze.parentNode)&&Re.nodeType===1;)Ze=Re;ze.push(Ze)}for(var He=0;He<ze.length;++He)$e(ze[He]);Se===(Se|0)&&ze[0].setAttribute("value",Se);var rt=De.createElement("ol");rt.className="linenums";for(var Je=Math.max(0,Se-1|0)||0,He=0,Qe=ze.length;He<Qe;++He)Pe=ze[He],Pe.className="L"+(He+Je)%10,Pe.firstChild||Pe.appendChild(De.createTextNode("\xA0")),rt.appendChild(Pe);ye.appendChild(rt)}function fe(ye){var Se=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Se=Se&&+Se[1]<=8;var Le=/\n/g,Oe=ye.sourceCode,ke=Oe.length,De=0,Pe=ye.spans,ze=Pe.length,$e=0,We=ye.decorations,He=We.length,rt=0;We[He]=ke;var Je,Qe;for(Qe=Je=0;Qe<He;)We[Qe]!==We[Qe+2]?(We[Je++]=We[Qe++],We[Je++]=We[Qe++]):Qe+=2;for(He=Je,Qe=Je=0;Qe<He;){for(var Ae=We[Qe],et=We[Qe+1],Ze=Qe+2;Ze+2<=He&&We[Ze+1]===et;)Ze+=2;We[Je++]=Ae,We[Je++]=et,Qe=Ze}He=We.length=Je;var Re=ye.sourceNode,Fe="";Re&&(Fe=Re.style.display,Re.style.display="none");try{for(var ge=null;$e<ze;){var ue=Pe[$e],de=Pe[$e+2]||ke,J=We[rt+2]||ke,Ze=Math.min(de,J),Z=Pe[$e+1],te;if(Z.nodeType!==1&&(te=Oe.substring(De,Ze))){Se&&(te=te.replace(Le,"\r")),Z.nodeValue=te;var se=Z.ownerDocument,ce=se.createElement("span");ce.className=We[rt+1];var _e=Z.parentNode;_e.replaceChild(ce,Z),ce.appendChild(Z),De<de&&(Pe[$e+1]=Z=se.createTextNode(Oe.substring(Ze,de)),_e.insertBefore(Z,ce.nextSibling))}De=Ze,De>=de&&($e+=2),De>=J&&(rt+=2)}}finally{Re&&(Re.style.display=Fe)}}var me={};function ae(ye,Se){for(var Le=Se.length;--Le>=0;){var Oe=Se[Le];me.hasOwnProperty(Oe)?U.console&&console.warn("cannot override language handler %s",Oe):me[Oe]=ye}}function pe(ye,Se){return ye&&me.hasOwnProperty(ye)||(ye=/^\s*</.test(Se)?"default-markup":"default-code"),me[ye]}ae(ve,["default-code"]),ae(oe([],[[a,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[p,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[l,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ae(oe([[a,/^[\s]+/,null,` \r
`],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[y,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[M,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[l,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ae(oe([],[[F,/^[\s\S]+/]]),["uq.val"]),ae(xe({keywords:S,hashComments:!0,cStyleComments:!0,types:g}),["c","cc","cpp","cxx","cyc","m"]),ae(xe({keywords:"null,true,false"}),["json"]),ae(xe({keywords:C,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:g}),["cs"]),ae(xe({keywords:O,cStyleComments:!0}),["java"]),ae(xe({keywords:s,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ae(xe({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ae(xe({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ae(xe({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ae(xe({keywords:v,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ae(xe({keywords:x,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ae(oe([],[[f,/^[\s\S]+/]]),["regex"]);function $(ye){var Se=ye.langExtension;try{var Le=P(ye.sourceNode,ye.pre),Oe=Le.sourceCode;ye.sourceCode=Oe,ye.spans=Le.spans,ye.basePos=0,pe(Se,Oe)(ye),fe(ye)}catch(ke){U.console&&console.log(ke&&ke.stack||ke)}}function ne(ye,Se,Le){var Oe=Le||!1,ke=Se||null,De=document.createElement("div");De.innerHTML="<pre>"+ye+"</pre>",De=De.firstChild,Oe&&he(De,Oe,!0);var Pe={langExtension:ke,numberLines:Oe,sourceNode:De,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return $(Pe),De.innerHTML}function Q(ye,Se){var Le=Se||document.body,Oe=Le.ownerDocument||document;function ke(ue){return Le.getElementsByTagName(ue)}for(var De=[ke("pre"),ke("code"),ke("xmp")],Pe=[],ze=0;ze<De.length;++ze)for(var $e=0,We=De[ze].length;$e<We;++$e)Pe.push(De[ze][$e]);De=null;var He=Date;He.now||(He={now:function(){return+new Date}});var rt=0,Je=/\blang(?:uage)?-([\w.]+)(?!\S)/,Qe=/\bprettyprint\b/,Ae=/\bprettyprinted\b/,et=/pre|xmp/i,Ze=/^code$/i,Re=/^(?:pre|code|xmp)$/i,Fe={};function ge(){for(var ue=U.PR_SHOULD_USE_CONTINUATION?He.now()+250:Infinity;rt<Pe.length&&He.now()<ue;rt++){for(var de=Pe[rt],J=Fe,Z=de;Z=Z.previousSibling;){var te=Z.nodeType,se=(te===7||te===8)&&Z.nodeValue;if(se?!/^\??prettify\b/.test(se):te!==3||/\S/.test(Z.nodeValue))break;if(se){J={},se.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ut,Et,Cr){J[Et]=Cr});break}}var ce=de.className;if((J!==Fe||Qe.test(ce))&&!Ae.test(ce)){for(var _e=!1,Ce=de.parentNode;Ce;Ce=Ce.parentNode){var Ie=Ce.tagName;if(Re.test(Ie)&&Ce.className&&Qe.test(Ce.className)){_e=!0;break}}if(!_e){de.className+=" prettyprinted";var Ye=J.lang;if(!Ye){Ye=ce.match(Je);var Ge;!Ye&&(Ge=ee(de))&&Ze.test(Ge.tagName)&&(Ye=Ge.className.match(Je)),Ye&&(Ye=Ye[1])}var mt;if(et.test(de.tagName))mt=1;else{var dt=de.currentStyle,ot=Oe.defaultView,Ct=dt?dt.whiteSpace:ot&&ot.getComputedStyle?ot.getComputedStyle(de,null).getPropertyValue("white-space"):0;mt=Ct&&Ct.substring(0,3)==="pre"}var bt=J.linenums;(bt=bt==="true"||+bt)||(bt=ce.match(/\blinenums\b(?::(\d+))?/),bt=bt?bt[1]&&bt[1].length?+bt[1]:!0:!1),bt&&he(de,bt,mt);var Bt={langExtension:Ye,sourceNode:de,numberLines:bt,pre:mt,sourceCode:null,basePos:null,spans:null,decorations:null};$(Bt)}}}rt<Pe.length?U.setTimeout(ge,250):typeof ye=="function"&&ye()}ge()}var Ee=U.PR={createSimpleLexer:oe,registerLangHandler:ae,sourceDecorator:xe,PR_ATTRIB_NAME:M,PR_ATTRIB_VALUE:F,PR_COMMENT:p,PR_DECLARATION:m,PR_KEYWORD:_,PR_LITERAL:c,PR_NOCODE:j,PR_PLAIN:a,PR_PUNCTUATION:l,PR_SOURCE:E,PR_STRING:f,PR_TAG:y,PR_TYPE:h,prettyPrintOne:A?U.prettyPrintOne=ne:R=ne,prettyPrint:B=A?U.prettyPrint=Q:B=Q},we=U.define;typeof we=="function"&&we.amd&&we("google-code-prettify",[],function(){return Ee})})()},"VrN/":function(st,Ke,q){(function(re,V){st.exports=V()})(this,function(){"use strict";var re=navigator.userAgent,V=navigator.platform,A=/gecko\/\d/i.test(re),G=/MSIE \d/.test(re),I=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(re),R=/Edge\/(\d+)/.exec(re),B=G||I||R,U=B&&(G?document.documentMode||6:+(R||I)[1]),k=!R&&/WebKit\//.test(re),L=k&&/Qt\/\d+\.\d+/.test(re),b=!R&&/Chrome\//.test(re),S=/Opera\//.test(re),O=/Apple Computer/.test(navigator.vendor),C=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(re),x=/PhantomJS/.test(re),v=!R&&/AppleWebKit/.test(re)&&/Mobile\/\w+/.test(re),d=/Android/.test(re),o=v||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(re),u=v||/Mac/.test(V),s=/\bCrOS\b/.test(re),w=/win/i.test(V),g=S&&re.match(/Version\/(\d*\.\d*)/);g&&(g=Number(g[1])),g&&g>=15&&(S=!1,k=!0);var f=u&&(L||S&&(g==null||g<12.11)),_=A||B&&U>=9;function p(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var h=function(e,t){var n=e.className,r=p(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function c(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function l(e,t){return c(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var T=0;T<t.length;++T)i.appendChild(t[T]);return i}function y(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var m;document.createRange?m=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:m=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function E(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function M(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function F(e,t){var n=e.className;p(t).test(n)||(e.className+=(n?" ":"")+t)}function j(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!p(n[r]).test(t)&&(t+=" "+n[r]);return t}var W=function(e){e.select()};v?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:B&&(W=function(e){try{e.select()}catch(t){}});function D(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function P(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function H(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var T=r||0,N=i||0;;){var K=e.indexOf(" ",T);if(K<0||K>=t)return N+(t-T);N+=K-T,N+=n-N%n,T=K+1}}var Y=function(){this.id=null,this.f=null,this.time=0,this.handler=D(this.onTimeout,this)};Y.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Y.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function ee(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var oe=50,xe={toString:function(){return"CodeMirror.Pass"}},ve={scroll:!1},he={origin:"*mouse"},fe={origin:"+move"};function me(e,t,n){for(var r=0,i=0;;){var T=e.indexOf(" ",r);T==-1&&(T=e.length);var N=T-r;if(T==e.length||i+N>=t)return r+Math.min(N,t-i);if(i+=T-r,i+=n-i%n,r=T+1,i>=t)return r}}var ae=[""];function pe(e){for(;ae.length<=e;)ae.push($(ae)+" ");return ae[e]}function $(e){return e[e.length-1]}function ne(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Q(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function Ee(){}function we(e,t){var n;return Object.create?n=Object.create(e):(Ee.prototype=e,n=new Ee),t&&P(t,n),n}var ye=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Se(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&&Se(e)?!0:t.test(e):Se(e)}function Oe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ke=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function De(e){return e.charCodeAt(0)>=768&&ke.test(e)}function Pe(e,t,n){for(;(n<0?t>0:t<e.length)&&De(e.charAt(t));)t+=n;return t}function ze(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,T=r<0?Math.ceil(i):Math.floor(i);if(T==t)return e(T)?t:n;e(T)?n=T:t=T+r}}function $e(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,T=0;T<e.length;++T){var N=e[T];(N.from<n&&N.to>t||t==n&&N.to==t)&&(r(Math.max(N.from,t),Math.min(N.to,n),N.level==1?"rtl":"ltr",T),i=!0)}i||r(t,n,"ltr")}var We=null;function He(e,t,n){var r;We=null;for(var i=0;i<e.length;++i){var T=e[i];if(T.from<t&&T.to>t)return i;T.to==t&&(T.from!=T.to&&n=="before"?r=i:We=i),T.from==t&&(T.from!=T.to&&n!="before"?r=i:We=i)}return r!=null?r:We}var rt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(X){return X<=247?e.charAt(X):1424<=X&&X<=1524?"R":1536<=X&&X<=1785?t.charAt(X-1536):1774<=X&&X<=2220?"r":8192<=X&&X<=8203?"w":X==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,T=/[LRr]/,N=/[Lb1n]/,K=/[1n]/;function z(X,ie,le){this.level=X,this.from=ie,this.to=le}return function(X,ie){var le=ie=="ltr"?"L":"R";if(X.length==0||ie=="ltr"&&!r.test(X))return!1;for(var Te=X.length,be=[],Me=0;Me<Te;++Me)be.push(n(X.charCodeAt(Me)));for(var Ue=0,je=le;Ue<Te;++Ue){var Ve=be[Ue];Ve=="m"?be[Ue]=je:je=Ve}for(var qe=0,Xe=le;qe<Te;++qe){var tt=be[qe];tt=="1"&&Xe=="r"?be[qe]="n":T.test(tt)&&(Xe=tt,tt=="r"&&(be[qe]="R"))}for(var ut=1,at=be[0];ut<Te-1;++ut){var pt=be[ut];pt=="+"&&at=="1"&&be[ut+1]=="1"?be[ut]="1":pt==","&&at==be[ut+1]&&(at=="1"||at=="n")&&(be[ut]=at),at=pt}for(var Lt=0;Lt<Te;++Lt){var Ht=be[Lt];if(Ht==",")be[Lt]="N";else if(Ht=="%"){var Ot=void 0;for(Ot=Lt+1;Ot<Te&&be[Ot]=="%";++Ot);for(var sr=Lt&&be[Lt-1]=="!"||Ot<Te&&be[Ot]=="1"?"1":"N",nr=Lt;nr<Ot;++nr)be[nr]=sr;Lt=Ot-1}}for(var kt=0,ir=le;kt<Te;++kt){var zt=be[kt];ir=="L"&&zt=="1"?be[kt]="L":T.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]:le)=="L",ar=(It<Te?be[It]:le)=="L",jn=Pt==ar?Pt?"L":"R":le,Jr=Nt;Jr<It;++Jr)be[Jr]=jn;Nt=It-1}for(var Yt=[],Or,Kt=0;Kt<Te;)if(N.test(be[Kt])){var Va=Kt;for(++Kt;Kt<Te&&N.test(be[Kt]);++Kt);Yt.push(new z(0,Va,Kt))}else{var jr=Kt,fn=Yt.length,hn=ie=="rtl"?1:0;for(++Kt;Kt<Te&&be[Kt]!="L";++Kt);for(var Zt=jr;Zt<Kt;)if(K.test(be[Zt])){jr<Zt&&(Yt.splice(fn,0,new z(1,jr,Zt)),fn+=hn);var Wn=Zt;for(++Zt;Zt<Kt&&K.test(be[Zt]);++Zt);Yt.splice(fn,0,new z(2,Wn,Zt)),fn+=hn,jr=Zt}else++Zt;jr<Kt&&Yt.splice(fn,0,new z(1,jr,Kt))}return ie=="ltr"&&(Yt[0].level==1&&(Or=X.match(/^\s+/))&&(Yt[0].from=Or[0].length,Yt.unshift(new z(0,0,Or[0].length))),$(Yt).level==1&&(Or=X.match(/\s+$/))&&($(Yt).to-=Or[0].length,Yt.push(new z(0,Te-Or[0].length,Te)))),ie=="rtl"?Yt.reverse():Yt}}();function Je(e,t){var n=e.order;return n==null&&(n=e.order=rt(e.text,t)),n}var Qe=[],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]||Qe).concat(n)}};function et(e,t){return e._handlers&&e._handlers[t]||Qe}function Ze(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var T=ee(i,n);T>-1&&(r[t]=i.slice(0,T).concat(i.slice(T+1)))}}}function Re(e,t){var n=et(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Fe(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Re(e,n||t.type,e,t),te(t)||t.codemirrorIgnore}function ge(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)ee(n,t[r])==-1&&n.push(t[r])}function ue(e,t){return et(e,t).length>0}function de(e){e.prototype.on=function(t,n){Ae(this,t,n)},e.prototype.off=function(t,n){Ze(this,t,n)}}function J(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Z(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function te(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function se(e){J(e),Z(e)}function ce(e){return e.target||e.srcElement}function _e(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),u&&e.ctrlKey&&t==1&&(t=3),t}var Ce=function(){if(B&&U<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),Ie;function Ye(e){if(Ie==null){var t=a("span","\u200B");l(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ie=t.offsetWidth<=1&&t.offsetHeight>2&&!(B&&U<8))}var n=Ie?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var Ge;function mt(e){if(Ge!=null)return Ge;var t=l(e,document.createTextNode("A\u062EA")),n=m(t,0,1).getBoundingClientRect(),r=m(t,1,2).getBoundingClientRect();return c(e),!n||n.left==n.right?!1:Ge=r.right-n.right<3}var dt=`
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
`,t);i==-1&&(i=e.length);var T=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),N=T.indexOf("\r");N!=-1?(n.push(T.slice(0,N)),t+=N+1):(n.push(T),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},ot=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},Ct=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),bt=null;function Bt(e){if(bt!=null)return bt;var t=l(e,a("span","x")),n=t.getBoundingClientRect(),r=m(t,0,1).getBoundingClientRect();return bt=Math.abs(n.left-r.left)>1}var Ut={},Et={};function Cr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ut[e]=t}function Rr(e,t){Et[e]=t}function lr(e){if(typeof e=="string"&&Et.hasOwnProperty(e))e=Et[e];else if(e&&typeof e.name=="string"&&Et.hasOwnProperty(e.name)){var t=Et[e.name];typeof t=="string"&&(t={name:t}),e=we(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return lr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return lr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function pr(e,t){t=lr(t);var n=Ut[t.name];if(!n)return pr(e,"text/plain");var r=n(e,t);if(fr.hasOwnProperty(t.name)){var i=fr[t.name];for(var T in i){if(!i.hasOwnProperty(T))continue;r.hasOwnProperty(T)&&(r["_"+T]=r[T]),r[T]=i[T]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var N in t.modeProps)r[N]=t.modeProps[N];return r}var fr={};function ia(e,t){var n=fr.hasOwnProperty(e)?fr[e]:fr[e]={};P(t,n)}function _r(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Hn(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Kn(e,t,n){return e.startState?e.startState(t,n):!0}var Rt=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Rt.prototype.eol=function(){return this.pos>=this.string.length},Rt.prototype.sol=function(){return this.pos==this.lineStart},Rt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Rt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Rt.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},Rt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Rt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Rt.prototype.skipToEnd=function(){this.pos=this.string.length},Rt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Rt.prototype.backUp=function(e){this.pos-=e},Rt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=H(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Rt.prototype.indentation=function(){return H(this.string,null,this.tabSize)-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Rt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(N){return n?N.toLowerCase():N},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var T=this.string.slice(this.pos).match(e);return T&&T.index>0?null:(T&&t!==!1&&(this.pos+=T[0].length),T)}},Rt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Rt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Rt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Rt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function nt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],T=i.chunkSize();if(t<T){n=i;break}t-=T}return n.lines[t]}function Pr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(T){var N=T.text;i==n.line&&(N=N.slice(0,n.ch)),i==t.line&&(N=N.slice(t.ch)),r.push(N),++i}),r}function mn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function Qt(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Tt(e){if(e.parent==null)return null;for(var t=e.parent,n=ee(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;!(r.children[i]==t);++i)n+=r.children[i].chunkSize();return n+t.first}function gr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],T=i.height;if(t<T){e=i;continue e}t-=T,n+=i.chunkSize()}return n}while(!e.lines);for(var N=0;N<e.lines.length;++N){var K=e.lines[N],z=K.height;if(t<z)break;t-=z}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 Ne(e,t,n){if(n===void 0&&(n=null),!(this instanceof Ne))return new Ne(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ct(e,t){return e.line-t.line||e.ch-t.ch}function Gn(e,t){return e.sticky==t.sticky&&ct(e,t)==0}function gn(e){return Ne(e.line,e.ch)}function vn(e,t){return ct(e,t)<0?t:e}function Zr(e,t){return ct(e,t)<0?e:t}function yn(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ht(e,t){if(t.line<e.first)return Ne(e.first,0);var n=e.first+e.size-1;return t.line>n?Ne(n,nt(e,n).text.length):_i(t,nt(e,t.line).text.length)}function _i(e,t){var n=e.ch;return n==null||n>t?Ne(e.line,t):n<0?Ne(e.line,0):e}function Be(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ht(e,t[r]);return n}var bn=function(e,t){this.state=e,this.lookAhead=t},hr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};hr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},hr.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},hr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},hr.fromSaved=function(e,t,n){return t instanceof bn?new hr(e,_r(e.mode,t.state),n,t.lookAhead):new hr(e,_r(e.mode,t),n)},hr.prototype.save=function(e){var t=e!==!1?_r(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new bn(t,this.maxLookAhead):t};function zn(e,t,n,r){var i=[e.state.modeGen],T={};br(e,t.text,e.doc.mode,n,function(X,ie){return i.push(X,ie)},T,r);for(var N=n.state,K=function(X){n.baseTokens=i;var ie=e.state.overlays[X],le=1,Te=0;n.state=!0,br(e,t.text,ie.mode,n,function(be,Me){for(var Ue=le;Te<be;){var je=i[le];je>be&&i.splice(le,1,be,i[le+1],je),le+=2,Te=Math.min(be,je)}if(!Me)return;if(ie.opaque)i.splice(Ue,le-Ue,be,"overlay "+Me),le=Ue+2;else for(;Ue<le;Ue+=2){var Ve=i[Ue+1];i[Ue+1]=(Ve?Ve+" ":"")+"overlay "+Me}},T),n.state=N,n.baseTokens=null,n.baseTokenPos=1},z=0;z<e.state.overlays.length;++z)K(z);return{styles:i,classes:T.bgClass||T.textClass?T:null}}function Qr(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&&_r(e.doc.mode,r.state),T=zn(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=T.styles,T.classes?t.styleClasses=T.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function vr(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new hr(r,!0,t);var T=Li(e,t,n),N=T>r.first&&nt(r,T-1).stateAfter,K=N?hr.fromSaved(r,N,T):new hr(r,Kn(r.mode),T);return r.iter(T,t,function(z){Vn(e,z.text,K);var X=K.line;z.stateAfter=X==t-1||X%5==0||X>=i.viewFrom&&X<i.viewTo?K.save():null,K.nextLine()}),n&&(r.modeFrontier=K.line),K}function Vn(e,t,n,r){var i=e.doc.mode,T=new Rt(t,e.options.tabSize,n);for(T.start=T.pos=r||0,t==""&&Xn(i,n.state);!T.eol();)yr(i,T,n.state),T.start=T.pos}function Xn(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Hn(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function yr(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Hn(e,n).mode);var T=e.token(t,n);if(t.pos>t.start)return T}throw new Error("Mode "+e.name+" failed to advance stream.")}var Yn=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Ai(e,t,n,r){var i=e.doc,T=i.mode,N;t=ht(i,t);var K=nt(i,t.line),z=vr(e,t.line,n),X=new Rt(K.text,e.options.tabSize,z),ie;for(r&&(ie=[]);(r||X.pos<t.ch)&&!X.eol();)X.start=X.pos,N=yr(T,X,z.state),r&&ie.push(new Yn(X,N,_r(i.mode,z.state)));return r?ie:new Yn(X,N,z.state)}function $n(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function br(e,t,n,r,i,T,N){var K=n.flattenSpans;K==null&&(K=e.options.flattenSpans);var z=0,X=null,ie=new Rt(t,e.options.tabSize,r),le,Te=e.options.addModeClass&&[null];for(t==""&&$n(Xn(n,r.state),T);!ie.eol();){if(ie.pos>e.options.maxHighlightLength?(K=!1,N&&Vn(e,t,r,ie.pos),ie.pos=t.length,le=null):le=$n(yr(n,ie,r.state,Te),T),Te){var be=Te[0].name;be&&(le="m-"+(le?be+" "+le:be))}if(!K||X!=le){for(;z<ie.start;)z=Math.min(ie.start,z+5e3),i(z,X);X=le}ie.start=ie.pos}for(;z<ie.pos;){var Me=Math.min(ie.pos,z+5e3);i(Me,X),z=Me}}function Li(e,t,n){for(var r,i,T=e.doc,N=n?-1:t-(e.doc.mode.innerMode?1e3:100),K=t;K>N;--K){if(K<=T.first)return T.first;var z=nt(T,K-1),X=z.stateAfter;if(X&&(!n||K+(X instanceof bn?X.lookAhead:0)<=T.modeFrontier))return K;var ie=H(z.text,null,e.options.tabSize);(i==null||r>ie)&&(i=K-1,r=ie)}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 Zn(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function sa(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Di(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var T=e[i],N=T.marker,K=T.from==null||(N.inclusiveLeft?T.from<=t:T.from<t);if(K||T.from==t&&N.type=="bookmark"&&(!n||!T.marker.insertLeft)){var z=T.to==null||(N.inclusiveRight?T.to>=t:T.to>t);(r||(r=[])).push(new qr(N,T.from,z?null:T.to))}}return r}function Oi(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var T=e[i],N=T.marker,K=T.to==null||(N.inclusiveRight?T.to>=t:T.to>t);if(K||T.from==t&&N.type=="bookmark"&&(!n||T.marker.insertLeft)){var z=T.from==null||(N.inclusiveLeft?T.from<=t:T.from<t);(r||(r=[])).push(new qr(N,z?null:T.from-t,T.to==null?null:T.to-t))}}return r}function En(e,t){if(t.full)return null;var n=Mr(e,t.from.line)&&nt(e,t.from.line).markedSpans,r=Mr(e,t.to.line)&&nt(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,T=t.to.ch,N=ct(t.from,t.to)==0,K=Di(n,i,N),z=Oi(r,T,N),X=t.text.length==1,ie=$(t.text).length+(X?i:0);if(K)for(var le=0;le<K.length;++le){var Te=K[le];if(Te.to==null){var be=Er(z,Te.marker);be?X&&(Te.to=be.to==null?null:be.to+ie):Te.to=i}}if(z)for(var Me=0;Me<z.length;++Me){var Ue=z[Me];if(Ue.to!=null&&(Ue.to+=ie),Ue.from==null){var je=Er(K,Ue.marker);je||(Ue.from=ie,X&&(K||(K=[])).push(Ue))}else Ue.from+=ie,X&&(K||(K=[])).push(Ue)}K&&(K=Ri(K)),z&&z!=K&&(z=Ri(z));var Ve=[K];if(!X){var qe=t.text.length-2,Xe;if(qe>0&&K)for(var tt=0;tt<K.length;++tt)K[tt].to==null&&(Xe||(Xe=[])).push(new qr(K[tt].marker,null,null));for(var ut=0;ut<qe;++ut)Ve.push(Xe);Ve.push(z)}return Ve}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 Me=0;Me<be.markedSpans.length;++Me){var Ue=be.markedSpans[Me].marker;Ue.readOnly&&(!r||ee(r,Ue)==-1)&&(r||(r=[])).push(Ue)}}),!r)return null;for(var i=[{from:t,to:n}],T=0;T<r.length;++T)for(var N=r[T],K=N.find(0),z=0;z<i.length;++z){var X=i[z];if(ct(X.to,K.from)<0||ct(X.from,K.to)>0)continue;var ie=[z,1],le=ct(X.from,K.from),Te=ct(X.to,K.to);(le<0||!N.inclusiveLeft&&!le)&&ie.push({from:X.from,to:K.from}),(Te>0||!N.inclusiveRight&&!Te)&&ie.push({from:K.to,to:X.to}),i.splice.apply(i,ie),z+=ie.length-3}return i}function la(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function xn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function en(e){return e.inclusiveLeft?-1:0}function tn(e){return e.inclusiveRight?1:0}function Tn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),T=ct(r.from,i.from)||en(e)-en(t);if(T)return-T;var N=ct(r.to,i.to)||tn(e)-tn(t);return N||t.id-e.id}function kr(e,t){var n=$t&&e.markedSpans,r;if(n)for(var i=void 0,T=0;T<n.length;++T)i=n[T],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Tn(r,i.marker)<0)&&(r=i.marker);return r}function Ir(e){return kr(e,!0)}function Ur(e){return kr(e,!1)}function Sn(e,t){var n=$t&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var T=n[i];T.marker.collapsed&&(T.from==null||T.from<t)&&(T.to==null||T.to>t)&&(!r||Tn(r,T.marker)<0)&&(r=T.marker)}return r}function Mi(e,t,n,r,i){var T=nt(e,t),N=$t&&T.markedSpans;if(N)for(var K=0;K<N.length;++K){var z=N[K];if(!z.marker.collapsed)continue;var X=z.marker.find(0),ie=ct(X.from,n)||en(z.marker)-en(i),le=ct(X.to,r)||tn(z.marker)-tn(i);if(ie>=0&&le<=0||ie<=0&&le>=0)continue;if(ie<=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?ct(X.to,n)>=0:ct(X.to,n)>0)||ie>=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?ct(X.from,r)<=0:ct(X.from,r)<0))return!0}}function ur(e){for(var t;t=Ir(e);)e=t.find(-1,!0).line;return e}function ki(e){for(var t;t=Ur(e);)e=t.find(1,!0).line;return e}function wn(e){for(var t,n;t=Ur(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Qn(e,t){var n=nt(e,t),r=ur(n);return n==r?t:Tt(r)}function Hr(e,t){if(t>e.lastLine())return t;var n=nt(e,t),r;if(!Ar(e,n))return t;for(;r=Ur(n);)n=r.find(1,!0).line;return Tt(n)+1}function Ar(e,t){var n=$t&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i){if(r=n[i],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&qn(e,t,r))return!0}}function qn(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return qn(e,r.line,Er(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,T=0;T<t.markedSpans.length;++T)if(i=t.markedSpans[T],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&qn(e,t,i))return!0}function xr(e){e=ur(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var T=n.parent;T;n=T,T=n.parent)for(var N=0;N<T.children.length;++N){var K=T.children[N];if(K==n)break;t+=K.height}return t}function ei(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Ir(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Ur(r);){var T=n.find(0,!0);t-=r.text.length-T.from.ch,r=T.to.line,t+=r.text.length-T.to.ch}return t}function Ii(e){var t=e.display,n=e.doc;t.maxLine=nt(n,n.first),t.maxLineLength=ei(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=ei(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var rn=function(e,t,n){this.text=e,xn(this,t),this.height=n?n(this):1};rn.prototype.lineNo=function(){return Tt(this)},de(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&&Qt(e,i)}function it(e){e.parent=null,la(e)}var ft={},lt={};function gt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?lt:ft;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function xt(e,t){var n=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 T=i?t.rest[i-1]:t.line,N=void 0;r.pos=0,r.addToken=yt,mt(e.display.measure)&&(N=Je(T,e.doc.direction))&&(r.addToken=qt(r.addToken,N)),r.map=[];var K=t!=e.display.externalMeasured&&Tt(T);Fr(T,r,Qr(e,T,K)),T.styleClasses&&(T.styleClasses.bgClass&&(r.bgClass=j(T.styleClasses.bgClass,r.bgClass||"")),T.styleClasses.textClass&&(r.textClass=j(T.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Ye(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 z=r.content.lastChild;(/\bcm-tab\b/.test(z.className)||z.querySelector&&z.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Re(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=j(r.pre.className,r.textClass||"")),r}function At(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function yt(e,t,n,r,i,T,N){if(!t)return;var K=e.splitSpaces?Ft(t,e.trailingSpace):t,z=e.cm.state.specialChars,X=!1,ie;if(!z.test(t))e.col+=t.length,ie=document.createTextNode(K),e.map.push(e.pos,e.pos+t.length,ie),B&&U<9&&(X=!0),e.pos+=t.length;else{ie=document.createDocumentFragment();for(var le=0;;){z.lastIndex=le;var Te=z.exec(t),be=Te?Te.index-le:t.length-le;if(be){var Me=document.createTextNode(K.slice(le,le+be));B&&U<9?ie.appendChild(a("span",[Me])):ie.appendChild(Me),e.map.push(e.pos,e.pos+be,Me),e.col+=be,e.pos+=be}if(!Te)break;le+=be+1;var Ue=void 0;if(Te[0]==" "){var je=e.cm.options.tabSize,Ve=je-e.col%je;Ue=ie.appendChild(a("span",pe(Ve),"cm-tab")),Ue.setAttribute("role","presentation"),Ue.setAttribute("cm-text"," "),e.col+=Ve}else Te[0]=="\r"||Te[0]==`
`?(Ue=ie.appendChild(a("span",Te[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ue.setAttribute("cm-text",Te[0]),e.col+=1):(Ue=e.cm.options.specialCharPlaceholder(Te[0]),Ue.setAttribute("cm-text",Te[0]),B&&U<9?ie.appendChild(a("span",[Ue])):ie.appendChild(Ue),e.col+=1);e.map.push(e.pos,e.pos+1,Ue),e.pos++}}if(e.trailingSpace=K.charCodeAt(t.length-1)==32,n||r||i||X||T||N){var qe=n||"";r&&(qe+=r),i&&(qe+=i);var Xe=a("span",[ie],qe,T);if(N)for(var tt in N)N.hasOwnProperty(tt)&&tt!="style"&&tt!="class"&&Xe.setAttribute(tt,N[tt]);return e.content.appendChild(Xe)}e.content.appendChild(ie)}function Ft(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var T=e.charAt(i);T==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(T="\xA0"),r+=T,n=T==" "}return r}function qt(e,t){return function(n,r,i,T,N,K,z){i=i?i+" cm-force-border":"cm-force-border";for(var X=n.pos,ie=X+r.length;;){for(var le=void 0,Te=0;Te<t.length&&!(le=t[Te],le.to>X&&le.from<=X);Te++);if(le.to>=ie)return e(n,r,i,T,N,K,z);e(n,r.slice(0,le.to-X),i,T,null,K,z),T=null,r=r.slice(le.to-X),X=le.to}}}function vt(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Fr(e,t,n){var r=e.markedSpans,i=e.text,T=0;if(!r){for(var N=1;N<n.length;N+=2)t.addToken(t,i.slice(T,T=n[N]),gt(n[N+1],t.cm.options));return}for(var K=i.length,z=0,X=1,ie="",le,Te,be=0,Me,Ue,je,Ve,qe;;){if(be==z){Me=Ue=je=Te="",qe=null,Ve=null,be=Infinity;for(var Xe=[],tt=void 0,ut=0;ut<r.length;++ut){var at=r[ut],pt=at.marker;if(pt.type=="bookmark"&&at.from==z&&pt.widgetNode)Xe.push(pt);else if(at.from<=z&&(at.to==null||at.to>z||pt.collapsed&&at.to==z&&at.from==z)){if(at.to!=null&&at.to!=z&&be>at.to&&(be=at.to,Ue=""),pt.className&&(Me+=" "+pt.className),pt.css&&(Te=(Te?Te+";":"")+pt.css),pt.startStyle&&at.from==z&&(je+=" "+pt.startStyle),pt.endStyle&&at.to==be&&(tt||(tt=[])).push(pt.endStyle,at.to),pt.title&&((qe||(qe={})).title=pt.title),pt.attributes)for(var Lt in pt.attributes)(qe||(qe={}))[Lt]=pt.attributes[Lt];pt.collapsed&&(!Ve||Tn(Ve.marker,pt)<0)&&(Ve=at)}else at.from>z&&be>at.from&&(be=at.from)}if(tt)for(var Ht=0;Ht<tt.length;Ht+=2)tt[Ht+1]==be&&(Ue+=" "+tt[Ht]);if(!Ve||Ve.from==z)for(var Ot=0;Ot<Xe.length;++Ot)vt(t,0,Xe[Ot]);if(Ve&&(Ve.from||0)==z){if(vt(t,(Ve.to==null?K+1:Ve.to)-z,Ve.marker,Ve.from==null),Ve.to==null)return;Ve.to==z&&(Ve=!1)}}if(z>=K)break;for(var sr=Math.min(K,be);;){if(ie){var nr=z+ie.length;if(!Ve){var kt=nr>sr?ie.slice(0,sr-z):ie;t.addToken(t,kt,le?le+Me:Me,je,z+kt.length==be?Ue:"",Te,qe)}if(nr>=sr){ie=ie.slice(sr-z),z=sr;break}z=nr,je=""}ie=i.slice(T,T=n[X++]),le=gt(n[X++],t.cm.options)}}}function St(e,t,n){this.line=t,this.rest=wn(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=t;T<n;T=i){var N=new St(e.doc,nt(e.doc,T),T);i=T+N.size,r.push(N)}return r}var Vt=null;function mr(e){Vt?Vt.ops.push(e):e.ownsGroup=Vt={ops:[e],delayedCallbacks:[]}}function Os(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Rs(e,t){var n=e.ownsGroup;if(!n)return;try{Os(n)}finally{Vt=null,t(n)}}var ti=null;function Gt(e,t){var n=et(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Vt?i=Vt.delayedCallbacks:ti?i=ti:(i=ti=[],setTimeout(Ps,0));for(var T=function(K){i.push(function(){return n[K].apply(null,r)})},N=0;N<n.length;++N)T(N)}function Ps(){var e=ti;ti=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,n,r){for(var i=0;i<t.changes.length;i++){var T=t.changes[i];T=="text"?ks(e,t):T=="gutter"?Ja(e,t,n,r):T=="class"?da(e,t):T=="widget"&&Is(e,t,r)}t.changes=null}function ri(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),B&&U<8&&(e.node.style.zIndex=2)),e.node}function Ms(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=ri(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):xt(e,t)}function ks(e,t){var n=t.text.className,r=$a(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,da(e,t)):n&&(t.text.className=n)}function da(e,t){Ms(e,t),t.line.wrapClass?ri(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Ja(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=ri(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var T=t.line.gutterMarkers;if(e.options.lineNumbers||T){var N=ri(t),K=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(K),N.insertBefore(K,t.text),t.line.gutterClass&&(K.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!T||!T["CodeMirror-linenumbers"])&&(t.lineNumber=K.appendChild(a("div",pn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),T)for(var z=0;z<e.display.gutterSpecs.length;++z){var X=e.display.gutterSpecs[z].className,ie=T.hasOwnProperty(X)&&T[X];ie&&K.appendChild(a("div",[ie],"CodeMirror-gutter-elt","left: "+r.gutterLeft[X]+"px; width: "+r.gutterWidth[X]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=p("CodeMirror-linewidget"),i=t.node.firstChild,T=void 0;i;i=T)T=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Za(e,t,n)}function Us(e,t,n,r){var i=$a(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),da(e,t),Ja(e,t,n,r),Za(e,t,r),t.node}function Za(e,t,n){if(Qa(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Qa(e,t.rest[r],t,n,!1)}function Qa(e,t,n,r,i){if(!t.widgets)return;for(var T=ri(n),N=0,K=t.widgets;N<K.length;++N){var z=K[N],X=a("div",[z.node],"CodeMirror-linewidget"+(z.className?" "+z.className:""));z.handleMouseEvents||X.setAttribute("cm-ignore-events","true"),Fs(z,X,n,r),e.display.input.setUneditable(X),i&&z.above?T.insertBefore(X,n.gutter||n.text):T.appendChild(X),Gt(z,"redraw")}}function Fs(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function ni(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!E(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),l(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Nr(e,t){for(var n=ce(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Ui(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=l(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Lr(e){return oe-e.display.nativeBarWidth}function nn(e){return e.display.scroller.clientWidth-Lr(e)-e.display.barWidth}function fa(e){return e.display.scroller.clientHeight-Lr(e)-e.display.barHeight}function Ns(e,t,n){var r=e.options.lineWrapping,i=r&&nn(e);if(!t.measure.heights||r&&t.measure.width!=i){var T=t.measure.heights=[];if(r){t.measure.width=i;for(var N=t.text.firstChild.getClientRects(),K=0;K<N.length-1;K++){var z=N[K],X=N[K+1];Math.abs(z.bottom-X.bottom)>2&&T.push((z.bottom+X.top)/2-n.top)}}T.push(n.bottom-n.top)}}function eo(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(Tt(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=ur(t);var n=Tt(t),r=e.display.externalMeasured=new St(e.doc,t,n);r.lineN=n;var i=r.built=xt(e,r);return r.text=i.pre,l(e.display.lineMeasure,i.pre),r}function to(e,t,n,r){return Dr(e,Cn(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 Cn(e,t){var n=Tt(t),r=ha(e,n);r&&!r.text?r=null:r&&r.changes&&(Ya(e,r,n,ba(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=eo(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Dr(e,t,n,r,i){t.before&&(n=-1);var T=n+(r||""),N;return t.cache.hasOwnProperty(T)?N=t.cache[T]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ns(e,t.view,t.rect),t.hasHeights=!0),N=Ws(e,t,n,r),N.bogus||(t.cache[T]=N)),{left:N.left,right:N.right,top:i?N.rtop:N.top,bottom:i?N.rbottom:N.bottom}}var ro={left:0,right:0,top:0,bottom:0};function no(e,t,n){for(var r,i,T,N,K,z,X=0;X<e.length;X+=3)if(K=e[X],z=e[X+1],t<K?(i=0,T=1,N="left"):t<z?(i=t-K,T=i+1):(X==e.length-3||t==z&&e[X+3]>t)&&(T=z-K,i=T-1,t>=z&&(N="right")),i!=null){if(r=e[X+2],K==z&&n==(r.insertLeft?"left":"right")&&(N=n),n=="left"&&i==0)for(;X&&e[X-2]==e[X-3]&&e[X-1].insertLeft;)r=e[(X-=3)+2],N="left";if(n=="right"&&i==z-K)for(;X<e.length-3&&e[X+3]==e[X+4]&&!e[X+5].insertLeft;)r=e[(X+=3)+2],N="right";break}return{node:r,start:i,end:T,collapse:N,coverStart:K,coverEnd:z}}function js(e,t){var n=ro;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=no(t.map,n,r),T=i.node,N=i.start,K=i.end,z=i.collapse,X;if(T.nodeType==3){for(var ie=0;ie<4;ie++){for(;N&&De(t.line.text.charAt(i.coverStart+N));)--N;for(;i.coverStart+K<i.coverEnd&&De(t.line.text.charAt(i.coverStart+K));)++K;if(B&&U<9&&N==0&&K==i.coverEnd-i.coverStart?X=T.parentNode.getBoundingClientRect():X=js(m(T,N,K).getClientRects(),r),X.left||X.right||N==0)break;K=N,N=N-1,z="right"}B&&U<11&&(X=Hs(e.display.measure,X))}else{N>0&&(z=r="right");var le;e.options.lineWrapping&&(le=T.getClientRects()).length>1?X=le[r=="right"?le.length-1:0]:X=T.getBoundingClientRect()}if(B&&U<9&&!N&&(!X||!X.left&&!X.right)){var Te=T.parentNode.getClientRects()[0];Te?X={left:Te.left,right:Te.left+An(e.display),top:Te.top,bottom:Te.bottom}:X=ro}for(var be=X.top-t.rect.top,Me=X.bottom-t.rect.top,Ue=(be+Me)/2,je=t.view.measure.heights,Ve=0;Ve<je.length-1&&!(Ue<je[Ve]);Ve++);var qe=Ve?je[Ve-1]:0,Xe=je[Ve],tt={left:(z=="right"?X.right:X.left)-t.rect.left,right:(z=="left"?X.left:X.right)-t.rect.left,top:qe,bottom:Xe};return!X.left&&!X.right&&(tt.bogus=!0),e.options.singleCursorHeightPerLine||(tt.rtop=be,tt.rbottom=Me),tt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Bt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function io(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function ao(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)io(e.display.view[t])}function ii(e){ao(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function oo(){return b&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return b&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ma(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=ni(e.widgets[n]));return t}function Fi(e,t,n,r,i){if(!i){var T=ma(t);n.top+=T,n.bottom+=T}if(r=="line")return n;r||(r="local");var N=xr(t);if(r=="local"?N+=Ui(e.display):N-=e.display.viewOffset,r=="page"||r=="window"){var K=e.display.lineSpace.getBoundingClientRect();N+=K.top+(r=="window"?0:so());var z=K.left+(r=="window"?0:oo());n.left+=z,n.right+=z}return n.top+=N,n.bottom+=N,n}function lo(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=oo(),i-=so();else if(n=="local"||!n){var T=e.display.sizer.getBoundingClientRect();r+=T.left,i+=T.top}var N=e.display.lineSpace.getBoundingClientRect();return{left:r-N.left,top:i-N.top}}function pa(e,t,n,r,i){return r||(r=nt(e.doc,t.line)),Fi(e,r,to(e,r,t.ch,i),n)}function Tr(e,t,n,r,i,T){r=r||nt(e.doc,t.line),i||(i=Cn(e,r));function N(Me,Ue){var je=Dr(e,i,Me,Ue?"right":"left",T);return Ue?je.left=je.right:je.right=je.left,Fi(e,r,je,n)}var K=Je(r,e.doc.direction),z=t.ch,X=t.sticky;if(z>=r.text.length?(z=r.text.length,X="before"):z<=0&&(z=0,X="after"),!K)return N(X=="before"?z-1:z,X=="before");function ie(Me,Ue,je){var Ve=K[Ue],qe=Ve.level==1;return N(je?Me-1:Me,qe!=je)}var le=He(K,z,X),Te=We,be=ie(z,le,X=="before");return Te!=null&&(be.other=ie(z,Te,X!="before")),be}function uo(e,t){var n=0;t=ht(e.doc,t),e.options.lineWrapping||(n=An(e.display)*t.ch);var r=nt(e.doc,t.line),i=xr(r)+Ui(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function ga(e,t,n,r,i){var T=Ne(e,t,n);return T.xRel=i,r&&(T.outside=r),T}function va(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return ga(r.first,0,null,-1,-1);var i=gr(r,n),T=r.first+r.size-1;if(i>T)return ga(r.first+r.size-1,nt(r,T).text.length,null,1,1);t<0&&(t=0);for(var N=nt(r,i);;){var K=Ks(e,N,i,t,n),z=Sn(N,K.ch+(K.xRel>0||K.outside>0?1:0));if(!z)return K;var X=z.find(1);if(X.line==i)return X;N=nt(r,i=X.line)}}function co(e,t,n,r){r-=ma(t);var i=t.text.length,T=ze(function(N){return Dr(e,n,N-1).bottom<=r},i,0);return i=ze(function(N){return Dr(e,n,N).top>r},T,i),{begin:T,end:i}}function fo(e,t,n,r){n||(n=Cn(e,t));var i=Fi(e,t,Dr(e,n,r),"line").top;return co(e,t,n,i)}function ya(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ks(e,t,n,r,i){i-=xr(t);var T=Cn(e,t),N=ma(t),K=0,z=t.text.length,X=!0,ie=Je(t,e.doc.direction);if(ie){var le=(e.options.lineWrapping?zs:Gs)(e,t,n,T,ie,r,i);X=le.level!=1,K=X?le.from:le.to-1,z=X?le.to:le.from-1}var Te=null,be=null,Me=ze(function(ut){var at=Dr(e,T,ut);return at.top+=N,at.bottom+=N,ya(at,r,i,!1)?(at.top<=i&&at.left<=r&&(Te=ut,be=at),!0):!1},K,z),Ue,je,Ve=!1;if(be){var qe=r-be.left<be.right-r,Xe=qe==X;Me=Te+(Xe?0:1),je=Xe?"after":"before",Ue=qe?be.left:be.right}else{!X&&(Me==z||Me==K)&&Me++,je=Me==0?"after":Me==t.text.length?"before":Dr(e,T,Me-(X?1:0)).bottom+N<=i==X?"after":"before";var tt=Tr(e,Ne(n,Me,je),"line",t,T);Ue=tt.left,Ve=i<tt.top?-1:i>=tt.bottom?1:0}return Me=Pe(t.text,Me,1),ga(n,Me,je,Ve,r-Ue)}function Gs(e,t,n,r,i,T,N){var K=ze(function(le){var Te=i[le],be=Te.level!=1;return ya(Tr(e,Ne(n,be?Te.to:Te.from,be?"before":"after"),"line",t,r),T,N,!0)},0,i.length-1),z=i[K];if(K>0){var X=z.level!=1,ie=Tr(e,Ne(n,X?z.from:z.to,X?"after":"before"),"line",t,r);ya(ie,T,N,!0)&&ie.top>N&&(z=i[K-1])}return z}function zs(e,t,n,r,i,T,N){var K=co(e,t,r,N),z=K.begin,X=K.end;/\s/.test(t.text.charAt(X-1))&&X--;for(var ie=null,le=null,Te=0;Te<i.length;Te++){var be=i[Te];if(be.from>=X||be.to<=z)continue;var Me=be.level!=1,Ue=Dr(e,r,Me?Math.min(X,be.to)-1:Math.max(z,be.from)).right,je=Ue<T?T-Ue+1e9:Ue-T;(!ie||le>je)&&(ie=be,le=je)}return ie||(ie=i[i.length-1]),ie.from<z&&(ie={from:z,to:ie.to,level:ie.level}),ie.to>X&&(ie={from:ie.from,to:X,level:ie.level}),ie}var an;function _n(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(an==null){an=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)an.appendChild(document.createTextNode("x")),an.appendChild(a("br"));an.appendChild(document.createTextNode("x"))}l(e.measure,an);var n=an.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),c(e.measure),n||1}function An(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");l(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function ba(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,T=t.gutters.firstChild,N=0;T;T=T.nextSibling,++N){var K=e.display.gutterSpecs[N].className;n[K]=T.offsetLeft+T.clientLeft+i,r[K]=T.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ho(e){var t=_n(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/An(e.display)-3);return function(i){if(Ar(e.doc,i))return 0;var T=0;if(i.widgets)for(var N=0;N<i.widgets.length;N++)i.widgets[N].height&&(T+=i.widgets[N].height);return n?T+(Math.ceil(i.text.length/r)||1)*t:T+t}}function xa(e){var t=e.doc,n=ho(e);t.iter(function(r){var i=n(r);i!=r.height&&Qt(r,i)})}function on(e,t,n,r){var i=e.display;if(!n&&ce(t).getAttribute("cm-not-content")=="true")return null;var T,N,K=i.lineSpace.getBoundingClientRect();try{T=t.clientX-K.left,N=t.clientY-K.top}catch(le){return null}var z=va(e,T,N),X;if(r&&z.xRel>0&&(X=nt(e.doc,z.line).text).length==z.ch){var ie=H(X,X.length,e.options.tabSize)-X.length;z=Ne(z.line,Math.max(0,Math.round((T-qa(e.display).left)/An(e.display))-ie))}return z}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&&Qn(e.doc,t)<i.viewTo&&Gr(e);else if(n<=i.viewFrom)$t&&Hr(e.doc,n+r)>i.viewFrom?Gr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Gr(e);else if(t<=i.viewFrom){var T=Ni(e,n,n+r,1);T?(i.view=i.view.slice(T.index),i.viewFrom=T.lineN,i.viewTo+=r):Gr(e)}else if(n>=i.viewTo){var N=Ni(e,t,t,-1);N?(i.view=i.view.slice(0,N.index),i.viewTo=N.lineN):Gr(e)}else{var K=Ni(e,t,t,-1),z=Ni(e,n,n+r,1);K&&z?(i.view=i.view.slice(0,K.index).concat(er(e,K.lineN,z.lineN)).concat(i.view.slice(z.index)),i.viewTo+=r):Gr(e)}var X=i.externalMeasured;X&&(n<X.lineN?X.lineN+=r:t<X.lineN+X.size&&(i.externalMeasured=null))}function Kr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var T=r.view[sn(e,t)];if(T.node==null)return;var N=T.changes||(T.changes=[]);ee(N,n)==-1&&N.push(n)}function Gr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ni(e,t,n,r){var i=sn(e,t),T,N=e.display.view;if(!$t||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var K=e.display.viewFrom,z=0;z<i;z++)K+=N[z].size;if(K!=t){if(r>0){if(i==N.length-1)return null;T=K+N[i].size-t,i++}else T=K-t;t+=T,n+=T}for(;Qn(e.doc,n)!=n;){if(i==(r<0?0:N.length-1))return null;n+=r*N[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=er(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=er(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(sn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(er(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,sn(e,n)))),r.viewTo=n}function mo(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function ai(e){e.display.input.showSelection(e.display.input.prepareSelection())}function po(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),T=r.selection=document.createDocumentFragment(),N=0;N<n.sel.ranges.length;N++){if(!t&&N==n.sel.primIndex)continue;var K=n.sel.ranges[N];if(K.from().line>=e.display.viewTo||K.to().line<e.display.viewFrom)continue;var z=K.empty();(z||e.options.showCursorWhenSelecting)&&go(e,K.head,i),z||Xs(e,K,T)}return r}function go(e,t,n){var r=Tr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(a("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var T=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));T.style.display="",T.style.left=r.other.left+"px",T.style.top=r.other.top+"px",T.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Bi(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,T=document.createDocumentFragment(),N=qa(e.display),K=N.left,z=Math.max(r.sizerWidth,nn(e)-r.sizer.offsetLeft)-N.right,X=i.direction=="ltr";function ie(Xe,tt,ut,at){tt<0&&(tt=0),tt=Math.round(tt),at=Math.round(at),T.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Xe+`px;
top: `+tt+"px; width: "+(ut==null?z-Xe:ut)+`px;
height: `+(at-tt)+"px"))}function le(Xe,tt,ut){var at=nt(i,Xe),pt=at.text.length,Lt,Ht;function Ot(kt,ir){return pa(e,Ne(Xe,kt),"div",at,ir)}function sr(kt,ir,zt){var Nt=fo(e,at,null,kt),It=ir=="ltr"==(zt=="after")?"left":"right",Pt=zt=="after"?Nt.begin:Nt.end-(/\s/.test(at.text.charAt(Nt.end-1))?2:1);return Ot(Pt,It)[It]}var nr=Je(at,i.direction);return $e(nr,tt||0,ut==null?pt:ut,function(kt,ir,zt,Nt){var It=zt=="ltr",Pt=Ot(kt,It?"left":"right"),ar=Ot(ir-1,It?"right":"left"),jn=tt==null&&kt==0,Jr=ut==null&&ir==pt,Yt=Nt==0,Or=!nr||Nt==nr.length-1;if(ar.top-Pt.top<=3){var Kt=(X?jn:Jr)&&Yt,Va=(X?Jr:jn)&&Or,jr=Kt?K:(It?Pt:ar).left,fn=Va?z:(It?ar:Pt).right;ie(jr,Pt.top,fn-jr,Pt.bottom)}else{var hn,Zt,Wn,Xa;It?(hn=X&&jn&&Yt?K:Pt.left,Zt=X?z:sr(kt,zt,"before"),Wn=X?K:sr(ir,zt,"after"),Xa=X&&Jr&&Or?z:ar.right):(hn=X?sr(kt,zt,"before"):K,Zt=!X&&jn&&Yt?z:Pt.right,Wn=!X&&Jr&&Or?K:ar.left,Xa=X?sr(ir,zt,"after"):z),ie(hn,Pt.top,Zt-hn,Pt.bottom),Pt.bottom<ar.top&&ie(K,Pt.bottom,null,ar.top),ie(Wn,ar.top,Xa-Wn,ar.bottom)}(!Lt||Bi(Pt,Lt)<0)&&(Lt=Pt),Bi(ar,Lt)<0&&(Lt=ar),(!Ht||Bi(Pt,Ht)<0)&&(Ht=Pt),Bi(ar,Ht)<0&&(Ht=ar)}),{start:Lt,end:Ht}}var Te=t.from(),be=t.to();if(Te.line==be.line)le(Te.line,Te.ch,be.ch);else{var Me=nt(i,Te.line),Ue=nt(i,be.line),je=ur(Me)==ur(Ue),Ve=le(Te.line,Te.ch,je?Me.text.length+1:null).end,qe=le(be.line,je?0:null,be.ch).start;je&&(Ve.top<qe.top-2?(ie(Ve.right,Ve.top,null,Ve.bottom),ie(K,qe.top,qe.left,qe.bottom)):ie(Ve.right,Ve.top,qe.left-Ve.right,Ve.bottom)),Ve.bottom<qe.top&&ie(K,Ve.bottom,null,qe.top)}n.appendChild(T)}function Ta(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Ln(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function vo(e){e.state.focused||(e.display.input.focus(),Sa(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Ln(e))},100)}function Sa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Re(e,"focus",e,t),e.state.focused=!0,F(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),k&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ta(e)}function Ln(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Re(e,"blur",e,t),e.state.focused=!1,h(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function ji(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],T=e.options.lineWrapping,N=void 0,K=0;if(i.hidden)continue;if(B&&U<8){var z=i.node.offsetTop+i.node.offsetHeight;N=z-n,n=z}else{var X=i.node.getBoundingClientRect();N=X.bottom-X.top,!T&&i.text.firstChild&&(K=i.text.firstChild.getBoundingClientRect().right-X.left-1)}var ie=i.line.height-N;if((ie>.005||ie<-.005)&&(Qt(i.line,N),bo(i.line),i.rest))for(var le=0;le<i.rest.length;le++)bo(i.rest[le]);if(K>e.display.sizerWidth){var Te=Math.ceil(K/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-Ui(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,T=gr(t,r),N=gr(t,i);if(n&&n.ensure){var K=n.ensure.from.line,z=n.ensure.to.line;K<T?(T=K,N=gr(t,xr(nt(t,K))+e.wrapper.clientHeight)):Math.min(z,t.lastLine())>=N&&(T=gr(t,xr(nt(t,z))-e.wrapper.clientHeight),N=z)}return{from:T,to:Math.max(N,T+1)}}function Ys(e,t){if(Fe(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!x){var T=a("div","\u200B",null,`position: absolute;
top: `+(t.top-n.viewOffset-Ui(e.display))+`px;
height: `+(t.bottom-t.top+Lr(e)+n.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(T),T.scrollIntoView(i),e.display.lineSpace.removeChild(T)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Ne(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Ne(t.line,t.ch+1,"before"):t);for(var T=0;T<5;T++){var N=!1,K=Tr(e,t),z=!n||n==t?K:Tr(e,n);i={left:Math.min(K.left,z.left),top:Math.min(K.top,z.top)-r,right:Math.max(K.left,z.left),bottom:Math.max(K.bottom,z.bottom)+r};var X=wa(e,i),ie=e.doc.scrollTop,le=e.doc.scrollLeft;if(X.scrollTop!=null&&(si(e,X.scrollTop),Math.abs(e.doc.scrollTop-ie)>1&&(N=!0)),X.scrollLeft!=null&&(ln(e,X.scrollLeft),Math.abs(e.doc.scrollLeft-le)>1&&(N=!0)),!N)break}return i}function Js(e,t){var n=wa(e,t);n.scrollTop!=null&&si(e,n.scrollTop),n.scrollLeft!=null&&ln(e,n.scrollLeft)}function wa(e,t){var n=e.display,r=_n(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,T=fa(e),N={};t.bottom-t.top>T&&(t.bottom=t.top+T);var K=e.doc.height+ca(n),z=t.top<r,X=t.bottom>K-r;if(t.top<i)N.scrollTop=z?0:t.top;else if(t.bottom>i+T){var ie=Math.min(t.top,(X?K:t.bottom)-T);ie!=i&&(N.scrollTop=ie)}var le=e.options.fixedGutter?0:n.gutters.offsetWidth,Te=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-le,be=nn(e)-n.gutters.offsetWidth,Me=t.right-t.left>be;return Me&&(t.right=t.left+be),t.left<10?N.scrollLeft=0:t.left<Te?N.scrollLeft=Math.max(0,t.left+le-(Me?0:10)):t.right>be+Te-3&&(N.scrollLeft=t.right+(Me?0:10)-be),N}function Ca(e,t){if(t==null)return;Hi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Dn(e){Hi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function oi(e,t,n){(t!=null||n!=null)&&Hi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Zs(e,t){Hi(e),e.curOp.scrollToPos=t}function Hi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=uo(e,t.from),r=uo(e,t.to);Eo(e,n,r,t.margin)}}function Eo(e,t,n,r){var i=wa(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});oi(e,i.scrollLeft,i.scrollTop)}function si(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;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,_o(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function li(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ca(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Lr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var un=function(e,t,n){this.cm=n;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Ae(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Ae(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,B&&U<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};un.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var T=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+T)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},un.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},un.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},un.prototype.zeroWidthHack=function(){var e=u&&!C?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Y,this.disableVert=new Y},un.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),T=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);T!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},un.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ui=function(){};ui.prototype.update=function(){return{bottom:0,right:0}},ui.prototype.setScrollLeft=function(){},ui.prototype.setScrollTop=function(){},ui.prototype.clear=function(){};function On(e,t){t||(t=li(e));var n=e.display.barWidth,r=e.display.barHeight;To(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&ji(e),To(e,li(e)),n=e.display.barWidth,r=e.display.barHeight}function To(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var So={native:un,null:ui};function wo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&h(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new So[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),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&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=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:++Qs},mr(e.curOp)}function cn(e){var t=e.curOp;t&&Rs(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;qs(n)})}function qs(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var r=0;r<t.length;r++)tl(t[r]);for(var i=0;i<t.length;i++)rl(t[i]);for(var T=0;T<t.length;T++)nl(t[T]);for(var N=0;N<t.length;N++)il(t[N])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&Ii(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Ki(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&_a(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&ji(t),e.barMeasure=li(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=to(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Lr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-nn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&ln(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==M();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&On(t,e.barMeasure),e.updatedDisplay&&Da(t,e.barMeasure),e.selectionChanged&&Ta(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&vo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Co(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&xo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&ln(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,ht(r,e.scrollToPos.from),ht(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var T=e.maybeHiddenMarkers,N=e.maybeUnhiddenMarkers;if(T)for(var K=0;K<T.length;++K)T[K].lines.length||Re(T[K],"hide");if(N)for(var z=0;z<N.length;++z)N[z].lines.length&&Re(N[z],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Re(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function or(e,t){if(e.curOp)return t();dn(e);try{return t()}finally{cn(e)}}function jt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);dn(e);try{return t.apply(e,arguments)}finally{cn(e)}}}function Jt(e){return function(){if(this.curOp)return e.apply(this,arguments);dn(this);try{return e.apply(this,arguments)}finally{cn(this)}}}function Wt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);dn(t);try{return e.apply(this,arguments)}finally{cn(t)}}}function di(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,D(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=vr(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(T){if(r.line>=e.display.viewFrom){var N=T.styles,K=T.text.length>e.options.maxHighlightLength?_r(t.mode,r.state):null,z=zn(e,T,r,!0);K&&(r.state=K),T.styles=z.styles;var X=T.styleClasses,ie=z.classes;ie?T.styleClasses=ie:X&&(T.styleClasses=null);for(var le=!N||N.length!=T.styles.length||X!=ie&&(!X||!ie||X.bgClass!=ie.bgClass||X.textClass!=ie.textClass),Te=0;!le&&Te<N.length;++Te)le=N[Te]!=T.styles[Te];le&&i.push(r.line),T.stateAfter=r.save(),r.nextLine()}else T.text.length<=e.options.maxHighlightLength&&Vn(e,T.text,r),T.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return di(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&or(e,function(){for(var T=0;T<i.length;T++)Kr(e,i[T],"text")})}var Ki=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Wi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=nn(e),this.force=n,this.dims=ba(e),this.events=[]};Ki.prototype.signal=function(e,t){ue(e,t)&&this.events.push(arguments)},Ki.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Re.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Lr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Lr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=M();if(!t||!E(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&E(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==M())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&E(document.body,e.anchorNode)&&E(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function _a(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Gr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&mo(e)==0)return!1;Ao(e)&&(Gr(e),t.dims=ba(e));var i=r.first+r.size,T=Math.max(t.visible.from-e.options.viewportMargin,r.first),N=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<T&&T-n.viewFrom<20&&(T=Math.max(r.first,n.viewFrom)),n.viewTo>N&&n.viewTo-N<20&&(N=Math.min(i,n.viewTo)),$t&&(T=Qn(e.doc,T),N=Hr(e.doc,N));var K=T!=n.viewFrom||N!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,T,N),n.viewOffset=xr(nt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var z=mo(e);if(!K&&z==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var X=sl(e);return z>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),z>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(X),c(n.cursorDiv),c(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,K&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,di(e,400)),n.updateLineNumbers=null,!0}function Co(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(!_a(e,t))break;ji(e);var i=li(e);ai(e),On(e,i),Da(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Aa(e,t){var n=new Ki(e,t);if(_a(e,n)){ji(e),Co(e,n);var r=li(e);ai(e),On(e,r),Da(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,T=r.lineDiv,N=T.firstChild;function K(Me){var Ue=Me.nextSibling;return k&&u&&e.display.currentWheelTarget==Me?Me.style.display="none":Me.parentNode.removeChild(Me),Ue}for(var z=r.view,X=r.viewFrom,ie=0;ie<z.length;ie++){var le=z[ie];if(!le.hidden)if(!le.node||le.node.parentNode!=T){var Te=Us(e,le,X,n);T.insertBefore(Te,N)}else{for(;N!=le.node;)N=K(N);var be=i&&t!=null&&t<=X&&le.lineNumber;le.changes&&(ee(le.changes,"gutter")>-1&&(be=!1),Ya(e,le,X,n)),be&&(c(le.lineNumber),le.lineNumber.appendChild(document.createTextNode(pn(e.options,X)))),N=le.node.nextSibling}X+=le.size}for(;N;)N=K(N)}function La(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Da(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Lr(e)+"px"}function _o(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,T=r+"px",N=0;N<n.length;N++)if(!n[N].hidden){e.options.fixedGutter&&(n[N].gutter&&(n[N].gutter.style.left=T),n[N].gutterBackground&&(n[N].gutterBackground.style.left=T));var K=n[N].alignable;if(K)for(var z=0;z<K.length;z++)K[z].style.left=T}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Ao(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=pn(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(a("div",[a("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),T=i.firstChild.offsetWidth,N=i.offsetWidth-T;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(T,r.lineGutter.offsetWidth-N)+1,r.lineNumWidth=r.lineNumInnerWidth+N,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",La(e.display),!0}return!1}function Oa(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var T=e[i],N=null;if(typeof T!="string"&&(N=T.style,T=T.className),T=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:T,style:N})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Lo(e){var t=e.gutters,n=e.gutterSpecs;c(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],T=i.className,N=i.style,K=t.appendChild(a("div",null,"CodeMirror-gutter "+T));N&&(K.style.cssText=N),T=="CodeMirror-linenumbers"&&(e.lineGutter=K,K.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",La(e)}function ci(e){Lo(e.display),tr(e),_o(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=y("div",null,"CodeMirror-code"),i.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=a("div",null,"CodeMirror-cursors"),i.measure=a("div",null,"CodeMirror-measure"),i.lineMeasure=a("div",null,"CodeMirror-measure"),i.lineSpace=y("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var T=y("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[T],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+oe+"px; width: 1px;"),i.gutters=a("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=a("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=a("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),B&&U<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!k&&!(A&&o)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=Oa(r.gutters,r.lineNumbers),Lo(i),n.init(i)}var Gi=0,dr=null;B?dr=-.53:A?dr=15:b?dr=-.7:O&&(dr=-1/3);function Do(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function cl(e){var t=Do(e);return t.x*=dr,t.y*=dr,t}function Oo(e,t){var n=Do(t),r=n.x,i=n.y,T=e.display,N=T.scroller,K=N.scrollWidth>N.clientWidth,z=N.scrollHeight>N.clientHeight;if(!(r&&K||i&&z))return;if(i&&u&&k){e:for(var X=t.target,ie=T.view;X!=N;X=X.parentNode)for(var le=0;le<ie.length;le++)if(ie[le].node==X){e.display.currentWheelTarget=X;break e}}if(r&&!A&&!S&&dr!=null){i&&z&&si(e,Math.max(0,N.scrollTop+i*dr)),ln(e,Math.max(0,N.scrollLeft+r*dr)),(!i||i&&z)&&J(t),T.wheelStartX=null;return}if(i&&dr!=null){var Te=i*dr,be=e.doc.scrollTop,Me=be+T.wrapper.clientHeight;Te<0?be=Math.max(0,be+Te-50):Me=Math.min(e.doc.height,Me+Te+50),Aa(e,{top:be,bottom:Me})}Gi<20&&(T.wheelStartX==null?(T.wheelStartX=N.scrollLeft,T.wheelStartY=N.scrollTop,T.wheelDX=r,T.wheelDY=i,setTimeout(function(){if(T.wheelStartX==null)return;var Ue=N.scrollLeft-T.wheelStartX,je=N.scrollTop-T.wheelStartY,Ve=je&&T.wheelDY&&je/T.wheelDY||Ue&&T.wheelDX&&Ue/T.wheelDX;if(T.wheelStartX=T.wheelStartY=null,!Ve)return;dr=(dr*Gi+Ve)/(Gi+1),++Gi},200)):(T.wheelDX+=r,T.wheelDY+=i))}var cr=function(e,t){this.ranges=e,this.primIndex=t};cr.prototype.primary=function(){return this.ranges[this.primIndex]},cr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!Gn(n.anchor,r.anchor)||!Gn(n.head,r.head))return!1}return!0},cr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new wt(gn(this.ranges[t].anchor),gn(this.ranges[t].head));return new cr(e,this.primIndex)},cr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},cr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ct(t,r.from())>=0&&ct(e,r.to())<=0)return n}return-1};var wt=function(e,t){this.anchor=e,this.head=t};wt.prototype.from=function(){return Zr(this.anchor,this.head)},wt.prototype.to=function(){return vn(this.anchor,this.head)},wt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Sr(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(Te,be){return ct(Te.from(),be.from())}),n=ee(t,i);for(var T=1;T<t.length;T++){var N=t[T],K=t[T-1],z=ct(K.to(),N.from());if(r&&!N.empty()?z>0:z>=0){var X=Zr(K.from(),N.from()),ie=vn(K.to(),N.to()),le=K.empty()?N.from()==N.head:K.from()==K.head;T<=n&&--n,t.splice(--T,2,new wt(le?ie:X,le?X:ie))}}return new cr(t,n)}function zr(e,t){return new cr([new wt(e,t||e)],0)}function Vr(e){return e.text?Ne(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(ct(e,t.from)<0)return e;if(ct(e,t.to)<=0)return Vr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Vr(t).ch-t.to.ch),Ne(n,r)}function Ra(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new wt(Ro(i.anchor,t),Ro(i.head,t)))}return Sr(e.cm,n,e.sel.primIndex)}function Po(e,t,n){return e.line==t.line?Ne(n.line,e.ch-t.ch+n.ch):Ne(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Ne(e.first,0),T=i,N=0;N<t.length;N++){var K=t[N],z=Po(K.from,i,T),X=Po(Vr(K),i,T);if(i=K.to,T=X,n=="around"){var ie=e.sel.ranges[N],le=ct(ie.head,ie.anchor)<0;r[N]=new wt(le?X:z,le?z:X)}else r[N]=new wt(z,z)}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(qe){return n?n[qe]:null}function T(qe,Xe,tt){ua(qe,Xe,tt,r),Gt(qe,"change",qe,t)}function N(qe,Xe){for(var tt=[],ut=qe;ut<Xe;++ut)tt.push(new rn(X[ut],i(ut),r));return tt}var K=t.from,z=t.to,X=t.text,ie=nt(e,K.line),le=nt(e,z.line),Te=$(X),be=i(X.length-1),Me=z.line-K.line;if(t.full)e.insert(0,N(0,X.length)),e.remove(X.length,e.size-X.length);else if(Mo(e,t)){var Ue=N(0,X.length-1);T(le,le.text,be),Me&&e.remove(K.line,Me),Ue.length&&e.insert(K.line,Ue)}else if(ie==le)if(X.length==1)T(ie,ie.text.slice(0,K.ch)+Te+ie.text.slice(z.ch),be);else{var je=N(1,X.length-1);je.push(new rn(Te+ie.text.slice(z.ch),be,r)),T(ie,ie.text.slice(0,K.ch)+X[0],i(0)),e.insert(K.line+1,je)}else if(X.length==1)T(ie,ie.text.slice(0,K.ch)+X[0]+le.text.slice(z.ch),i(0)),e.remove(K.line+1,Me);else{T(ie,ie.text.slice(0,K.ch)+X[0],i(0)),T(le,Te+le.text.slice(z.ch),be);var Ve=N(1,X.length-1);Me>1&&e.remove(K.line+1,Me-1),e.insert(K.line+1,Ve)}Gt(e,"change",e,t)}function Xr(e,t,n){function r(i,T,N){if(i.linked)for(var K=0;K<i.linked.length;++K){var z=i.linked[K];if(z.doc==T)continue;var X=N&&z.sharedHist;if(n&&!X)continue;t(z.doc,X),r(z.doc,i,X)}}r(e,null,!0)}function ko(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,xa(e),Pa(e),Io(e),e.options.lineWrapping||Ii(e),e.options.mode=t.modeOption,tr(e)}function Io(e){(e.doc.direction=="rtl"?F:h)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){or(e,function(){Io(e),tr(e)})}function zi(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function ka(e,t){var n={from:gn(t.from),to:Vr(t),text:Pr(e,t.from,t.to)};return No(e,n,t.from.line,t.to.line+1),Xr(e,function(r){return No(r,n,t.from.line,t.to.line+1)},!0),n}function Uo(e){for(;e.length;){var t=$(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Uo(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 Fo(e,t,n,r){var i=e.history;i.undone.length=0;var T=+new Date,N,K;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>T-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(N=ml(i,i.lastOp==r)))K=$(N.changes),ct(t.from,t.to)==0&&ct(t.from,K.to)==0?K.to=Vr(t):N.changes.push(ka(e,t));else{var z=$(i.done);for((!z||!z.ranges)&&Vi(e.sel,i.done),N={changes:[ka(e,t)],generation:i.generation},i.done.push(N);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=T,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,K||Re(e,"historyAdded")}function pl(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var i=e.history,T=r&&r.origin;n==i.lastSelOp||T&&i.lastSelOrigin==T&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==T||pl(e,T,$(i.done),t))?i.done[i.done.length-1]=t:Vi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=T,i.lastSelOp=n,r&&r.clearRedo!==!1&&Uo(i.undone)}function Vi(e,t){var n=$(t);n&&n.ranges&&n.equals(e)||t.push(e)}function No(e,t,n,r){var i=t["spans_"+e.id],T=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(N){N.markedSpans&&((i||(i=t["spans_"+e.id]={}))[T]=N.markedSpans),++T})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function Bo(e,t){var n=yl(e,t),r=En(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var T=n[i],N=r[i];if(T&&N){e:for(var K=0;K<N.length;++K){for(var z=N[K],X=0;X<T.length;++X)if(T[X].marker==z.marker)continue e;T.push(z)}}else N&&(n[i]=N)}return n}function Rn(e,t,n){for(var r=[],i=0;i<e.length;++i){var T=e[i];if(T.ranges){r.push(n?cr.prototype.deepCopy.call(T):T);continue}var N=T.changes,K=[];r.push({changes:K});for(var z=0;z<N.length;++z){var X=N[z],ie=void 0;if(K.push({from:X.from,to:X.to,text:X.text}),t)for(var le in X)(ie=le.match(/^spans_(\d+)$/))&&(ee(t,Number(ie[1]))>-1&&($(K)[le]=X[le],delete X[le]))}}return r}function Ia(e,t,n,r){if(r){var i=e.anchor;if(n){var T=ct(t,i)<0;T!=ct(n,i)<0?(i=t,t=n):T!=ct(t,n)<0&&(t=n)}return new wt(i,t)}else return new wt(n||t,t)}function Xi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Xt(e,new cr([Ia(e.sel.primary(),t,n,i)],0),r)}function jo(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),T=0;T<e.sel.ranges.length;T++)r[T]=Ia(e.sel.ranges[T],t[T],null,i);var N=Sr(e.cm,r,e.sel.primIndex);Xt(e,N,n)}function Ua(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Xt(e,Sr(e.cm,i,e.sel.primIndex),r)}function Wo(e,t,n,r){Xt(e,zr(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var T=0;T<i.length;T++)this.ranges[T]=new wt(ht(e,i[T].anchor),ht(e,i[T].head))},origin:n&&n.origin};return Re(e,"beforeSelectionChange",e,r),e.cm&&Re(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Sr(e.cm,r.ranges,r.ranges.length-1):t}function Ho(e,t,n){var r=e.history.done,i=$(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){(ue(e,"beforeSelectionChange")||e.cm&&ue(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(ct(t.primary().head,e.sel.primary().head)<0?-1:1);Ko(e,zo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Dn(e.cm)}function Ko(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ge(e.cm)),Gt(e,"cursorActivity",e)}function Go(e){Ko(e,zo(e,e.sel,null,!1))}function zo(e,t,n,r){for(var i,T=0;T<t.ranges.length;T++){var N=t.ranges[T],K=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[T],z=$i(e,N.anchor,K&&K.anchor,n,r),X=$i(e,N.head,K&&K.head,n,r);(i||z!=N.anchor||X!=N.head)&&(i||(i=t.ranges.slice(0,T)),i[T]=new wt(z,X))}return i?Sr(e.cm,i,t.primIndex):t}function Pn(e,t,n,r,i){var T=nt(e,t.line);if(T.markedSpans)for(var N=0;N<T.markedSpans.length;++N){var K=T.markedSpans[N],z=K.marker,X="selectLeft"in z?!z.selectLeft:z.inclusiveLeft,ie="selectRight"in z?!z.selectRight:z.inclusiveRight;if((K.from==null||(X?K.from<=t.ch:K.from<t.ch))&&(K.to==null||(ie?K.to>=t.ch:K.to>t.ch))){if(i&&(Re(z,"beforeCursorEnter"),z.explicitlyCleared))if(T.markedSpans){--N;continue}else break;if(!z.atomic)continue;if(n){var le=z.find(r<0?1:-1),Te=void 0;if((r<0?ie:X)&&(le=Vo(e,le,-r,le&&le.line==t.line?T:null)),le&&le.line==t.line&&(Te=ct(le,n))&&(r<0?Te<0:Te>0))return Pn(e,le,t,r,i)}var be=z.find(r<0?-1:1);return(r<0?X:ie)&&(be=Vo(e,be,r,be.line==t.line?T:null)),be?Pn(e,be,t,r,i):null}}return t}function $i(e,t,n,r,i){var T=r||1,N=Pn(e,t,n,T,i)||!i&&Pn(e,t,n,T,!0)||Pn(e,t,n,-T,i)||!i&&Pn(e,t,n,-T,!0);return N||(e.cantEdit=!0,Ne(e.first,0))}function Vo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ht(e,Ne(t.line-1)):null:n>0&&t.ch==(r||nt(e,t.line)).text.length?t.line<e.first+e.size-1?Ne(t.line+1,0):null:new Ne(t.line,t.ch+n)}function Xo(e){e.setSelection(Ne(e.firstLine(),0),Ne(e.lastLine()),ve)}function Yo(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,T,N,K){i&&(r.from=ht(e,i)),T&&(r.to=ht(e,T)),N&&(r.text=N),K!==void 0&&(r.origin=K)}),Re(e,"beforeChange",e,r),e.cm&&Re(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((ue(e,"beforeChange")||e.cm&&ue(e.cm,"beforeChange"))&&(t=Yo(e,t,!0),!t))return;var r=Jn&&!n&&Pi(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)$o(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else $o(e,t)}function $o(e,t){if(t.text.length==1&&t.text[0]==""&&ct(t.from,t.to)==0)return;var n=Ra(e,t);Fo(e,t,n,e.cm?e.cm.curOp.id:NaN),hi(e,t,n,En(e,t));var r=[];Xr(e,function(i,T){!T&&ee(r,i.history)==-1&&(qo(i.history,t),r.push(i.history)),hi(i,t,null,En(i,t))})}function Ji(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,T,N=e.sel,K=t=="undo"?i.done:i.undone,z=t=="undo"?i.undone:i.done,X=0;X<K.length&&!(T=K[X],n?T.ranges&&!T.equals(e.sel):!T.ranges);X++);if(X==K.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(T=K.pop(),T.ranges){if(Vi(T,z),n&&!T.equals(e.sel)){Xt(e,T,{clearRedo:!1});return}N=T}else if(r){K.push(T);return}else break;var ie=[];Vi(N,z),z.push({changes:ie,generation:i.generation}),i.generation=T.generation||++i.maxGeneration;for(var le=ue(e,"beforeChange")||e.cm&&ue(e.cm,"beforeChange"),Te=function(Ue){var je=T.changes[Ue];if(je.origin=t,le&&!Yo(e,je,!1))return K.length=0,{};ie.push(ka(e,je));var Ve=Ue?Ra(e,je):$(K);hi(e,je,Ve,Bo(e,je)),!Ue&&e.cm&&e.cm.scrollIntoView({from:je.from,to:Vr(je)});var qe=[];Xr(e,function(Xe,tt){!tt&&ee(qe,Xe.history)==-1&&(qo(Xe.history,je),qe.push(Xe.history)),hi(Xe,je,null,Bo(Xe,je))})},be=T.changes.length-1;be>=0;--be){var Me=Te(be);if(Me)return Me.v}}function Jo(e,t){if(t==0)return;if(e.first+=t,e.sel=new cr(ne(e.sel.ranges,function(i){return new wt(Ne(i.anchor.line+t,i.anchor.ch),Ne(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){tr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Kr(e.cm,r,"gutter")}}function hi(e,t,n,r){if(e.cm&&!e.cm.curOp)return jt(e.cm,hi)(e,t,n,r);if(t.to.line<e.first){Jo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Jo(e,i),t={from:Ne(e.first,0),to:Ne(t.to.line+i,t.to.ch),text:[$(t.text)],origin:t.origin}}var T=e.lastLine();t.to.line>T&&(t={from:t.from,to:Ne(T,nt(e,T).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Pr(e,t.from,t.to),n||(n=Ra(e,t)),e.cm?El(e.cm,t,r):Ma(e,t,r),Yi(e,n,ve),e.cantEdit&&$i(e,Ne(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,T=t.from,N=t.to,K=!1,z=T.line;e.options.lineWrapping||(z=Tt(ur(nt(r,T.line))),r.iter(z,N.line+1,function(be){if(be==i.maxLine)return K=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ge(e),Ma(r,t,n,ho(e)),e.options.lineWrapping||(r.iter(z,T.line+t.text.length,function(be){var Me=ei(be);Me>i.maxLineLength&&(i.maxLine=be,i.maxLineLength=Me,i.maxLineChanged=!0,K=!1)}),K&&(e.curOp.updateMaxLine=!0)),aa(r,T.line),di(e,400);var X=t.text.length-(N.line-T.line)-1;t.full?tr(e):T.line==N.line&&t.text.length==1&&!Mo(e.doc,t)?Kr(e,T.line,"text"):tr(e,T.line,N.line+1,X);var ie=ue(e,"changes"),le=ue(e,"change");if(le||ie){var Te={from:T,to:N,text:t.text,removed:t.removed,origin:t.origin};le&&Gt(e,"change",e,Te),ie&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Te)}e.display.selForContextMenu=null}function kn(e,t,n,r,i){var T;r||(r=n),ct(r,n)<0&&(T=[r,n],n=T[0],r=T[1]),typeof t=="string"&&(t=e.splitLines(t)),Mn(e,{from:n,to:r,text:t,origin:i})}function Zo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Qo(e,t,n,r){for(var i=0;i<e.length;++i){var T=e[i],N=!0;if(T.ranges){T.copied||(T=e[i]=T.deepCopy(),T.copied=!0);for(var K=0;K<T.ranges.length;K++)Zo(T.ranges[K].anchor,t,n,r),Zo(T.ranges[K].head,t,n,r);continue}for(var z=0;z<T.changes.length;++z){var X=T.changes[z];if(n<X.from.line)X.from=Ne(X.from.line+r,X.from.ch),X.to=Ne(X.to.line+r,X.to.ch);else if(t<=X.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;Qo(e.done,n,r,i),Qo(e.undone,n,r,i)}function mi(e,t,n,r){var i=t,T=t;return typeof t=="number"?T=nt(e,yn(e,t)):i=Tt(t),i==null?null:(r(T,i)&&e.cm&&Kr(e.cm,i,n),T)}function pi(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}pi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,it(i),Gt(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function gi(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}gi.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var T=Math.min(t,i-e),N=r.height;if(r.removeInner(e,T),this.height-=N-r.height,i==T&&(this.children.splice(n--,1),r.parent=null),(t-=T)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof pi))){var K=[];this.collapse(K),this.children=[new pi(K)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],T=i.chunkSize();if(e<=T){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var N=i.lines.length%25+25,K=N;K<i.lines.length;){var z=new pi(i.lines.slice(K,K+=25));i.height-=z.height,this.children.splice(++r,0,z),z.parent=this}i.lines=i.lines.slice(0,N),this.maybeSpill()}break}e-=T}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new gi(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=ee(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new gi(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],T=i.chunkSize();if(e<T){var N=Math.min(t,T-e);if(i.iterN(e,N,n))return!0;if((t-=N)==0)break;e=0}else e-=T}}};var vi=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};vi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Tt(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var T=ni(this);Qt(n,Math.max(0,n.height-T)),e&&(or(e,function(){es(e,n,-T),Kr(e,r,"widget")}),Gt(e,"lineWidgetCleared",e,this,r))},vi.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=ni(this)-t;if(!i)return;Ar(this.doc,r)||Qt(r,r.height+i),n&&or(n,function(){n.curOp.forceUpdate=!0,es(n,r,i),Gt(n,"lineWidgetChanged",n,e,Tt(r))})},de(vi);function es(e,t,n){xr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ca(e,n)}function xl(e,t,n,r){var i=new vi(e,n,r),T=e.cm;return T&&i.noHScroll&&(T.display.alignWidgets=!0),mi(e,t,"widget",function(N){var K=N.widgets||(N.widgets=[]);if(i.insertAt==null?K.push(i):K.splice(Math.min(K.length-1,Math.max(0,i.insertAt)),0,i),i.line=N,T&&!Ar(e,N)){var z=xr(N)<e.scrollTop;Qt(N,N.height+ni(i)),z&&Ca(T,i.height),T.curOp.forceUpdate=!0}return!0}),T&&Gt(T,"lineWidgetAdded",T,i,typeof t=="number"?t:Tt(t)),i}var ts=0,Yr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ts};Yr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&dn(e),ue(this,"clear")){var n=this.find();n&&Gt(this,"clear",n.from,n.to)}for(var r=null,i=null,T=0;T<this.lines.length;++T){var N=this.lines[T],K=Er(N.markedSpans,this);e&&!this.collapsed?Kr(e,Tt(N),"text"):e&&(K.to!=null&&(i=Tt(N)),K.from!=null&&(r=Tt(N))),N.markedSpans=Zn(N.markedSpans,K),K.from==null&&this.collapsed&&!Ar(this.doc,N)&&e&&Qt(N,_n(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var z=0;z<this.lines.length;++z){var X=ur(this.lines[z]),ie=ei(X);ie>e.display.maxLineLength&&(e.display.maxLine=X,e.display.maxLineLength=ie,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&tr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Go(e.doc)),e&&Gt(e,"markerCleared",e,this,r,i),t&&cn(e),this.parent&&this.parent.clear()},Yr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var T=this.lines[i],N=Er(T.markedSpans,this);if(N.from!=null&&(n=Ne(t?T:Tt(T),N.from),e==-1))return n;if(N.to!=null&&(r=Ne(t?T:Tt(T),N.to),e==1))return r}return n&&{from:n,to:r}},Yr.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;or(r,function(){var i=t.line,T=Tt(t.line),N=ha(r,T);if(N&&(io(N),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Ar(n.doc,i)&&n.height!=null){var K=n.height;n.height=null;var z=ni(n)-K;z&&Qt(i,i.height+z)}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)}},de(Yr);function In(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return jt(e.cm,In)(e,t,n,r,i);var T=new Yr(e,i),N=ct(t,n);if(r&&P(r,T,!1),N>0||N==0&&T.clearWhenEmpty!==!1)return T;if(T.replacedWith&&(T.collapsed=!0,T.widgetNode=y("span",[T.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||T.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(T.widgetNode.insertLeft=!0)),T.collapsed){if(Mi(e,t.line,t,n,T)||t.line!=n.line&&Mi(e,n.line,t,n,T))throw new Error("Inserting collapsed marker partially overlapping an existing one");oa()}T.addToHistory&&Fo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var K=t.line,z=e.cm,X;if(e.iter(K,n.line+1,function(le){z&&T.collapsed&&!z.options.lineWrapping&&ur(le)==z.display.maxLine&&(X=!0),T.collapsed&&K!=t.line&&Qt(le,0),sa(le,new qr(T,K==t.line?t.ch:null,K==n.line?n.ch:null)),++K}),T.collapsed&&e.iter(t.line,n.line+1,function(le){Ar(e,le)&&Qt(le,0)}),T.clearOnEnter&&Ae(T,"beforeCursorEnter",function(){return T.clear()}),T.readOnly&&(Wr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),T.collapsed&&(T.id=++ts,T.atomic=!0),z){if(X&&(z.curOp.updateMaxLine=!0),T.collapsed)tr(z,t.line,n.line+1);else if(T.className||T.startStyle||T.endStyle||T.css||T.attributes||T.title)for(var ie=t.line;ie<=n.line;ie++)Kr(z,ie,"text");T.atomic&&Go(z.doc),Gt(z,"markerAdded",z,T)}return T}var yi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};yi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Gt(this,"clear")},yi.prototype.find=function(e,t){return this.primary.find(e,t)},de(yi);function Tl(e,t,n,r,i){r=P(r),r.shared=!1;var T=[In(e,t,n,r,i)],N=T[0],K=r.widgetNode;return Xr(e,function(z){K&&(r.widgetNode=K.cloneNode(!0)),T.push(In(z,ht(z,t),ht(z,n),r,i));for(var X=0;X<z.linked.length;++X)if(z.linked[X].isParent)return;N=$(T)}),new yi(T,N)}function rs(e){return e.findMarks(Ne(e.first,0),e.clipPos(Ne(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),T=e.clipPos(i.from),N=e.clipPos(i.to);if(ct(T,N)){var K=In(e,T,N,r.primary,r.primary.type);r.markers.push(K),K.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],T=[i.primary.doc];Xr(i.primary.doc,function(z){return T.push(z)});for(var N=0;N<i.markers.length;N++){var K=i.markers[N];ee(T,K.doc)==-1&&(K.parent=null,i.markers.splice(N--,1))}},n=0;n<e.length;n++)t(n)}var Cl=0,rr=function(e,t,n,r,i){if(!(this instanceof rr))return new rr(e,t,n,r,i);n==null&&(n=0),gi.call(this,[new pi([new rn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var T=Ne(n,0);this.sel=zr(T),this.history=new zi(null),this.id=++Cl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Ma(this,{from:T,to:T,text:e}),Xt(this,zr(T),ve)};rr.prototype=we(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=Ne(this.first,0),n=this.first+this.size-1;Mn(this,{from:t,to:Ne(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),ve)}),replaceRange:function(e,t,n,r){t=ht(this,t),n=n?ht(this,n):t,kn(this,e,t,n,r)},getRange:function(e,t,n){var r=Pr(this,ht(this,e),ht(this,t));return n===!1?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Mr(this,e))return nt(this,e)},getLineNumber:function(e){return Tt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=nt(this,e)),ur(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ht(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Wt(function(e,t,n){Wo(this,ht(this,typeof e=="number"?Ne(e,t||0):e),null,n)}),setSelection:Wt(function(e,t,n){Wo(this,ht(this,e),ht(this,t||e),n)}),extendSelection:Wt(function(e,t,n){Xi(this,ht(this,e),t&&ht(this,t),n)}),extendSelections:Wt(function(e,t){jo(this,Be(this,e),t)}),extendSelectionsBy:Wt(function(e,t){var n=ne(this.sel.ranges,e);jo(this,Be(this,n),t)}),setSelections:Wt(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new wt(ht(this,e[i].anchor),ht(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Xt(this,Sr(this.cm,r,t),n)}),addSelection:Wt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new wt(ht(this,e),ht(this,t||e))),Xt(this,Sr(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=Pr(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=Pr(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Wt(function(e,t,n){for(var r=[],i=this.sel,T=0;T<i.ranges.length;T++){var N=i.ranges[T];r[T]={from:N.from(),to:N.to(),text:this.splitLines(e[T]),origin:n}}for(var K=t&&t!="end"&&fl(this,r,t),z=r.length-1;z>=0;z--)Mn(this,r[z]);K?Ho(this,K):this.cm&&Dn(this.cm)}),undo:Wt(function(){Ji(this,"undo")}),redo:Wt(function(){Ji(this,"redo")}),undoSelection:Wt(function(){Ji(this,"undo",!0)}),redoSelection:Wt(function(){Ji(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new zi(this.history.maxGeneration),Xr(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Rn(this.history.done),undone:Rn(this.history.undone)}},setHistory:function(e){var t=this.history=new zi(this.history.maxGeneration);t.done=Rn(e.done.slice(0),null,!0),t.undone=Rn(e.undone.slice(0),null,!0)},setGutterMarker:Wt(function(e,t,n){return mi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Oe(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Wt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&mi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Oe(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Mr(this,e))return null;if(t=e,e=nt(this,e),!e)return null}else if(t=Tt(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Wt(function(e,t,n){return mi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(p(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Wt(function(e,t,n){return mi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",T=r[i];if(T)if(n==null)r[i]=null;else{var N=T.match(p(n));if(!N)return!1;var K=N.index+N[0].length;r[i]=T.slice(0,N.index)+(!N.index||K==T.length?"":" ")+T.slice(K)||null}else return!1;return!0})}),addLineWidget:Wt(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return In(this,ht(this,e),ht(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=ht(this,e),In(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ht(this,e);var t=[],n=nt(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=ht(this,e),t=ht(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(T){var N=T.markedSpans;if(N)for(var K=0;K<N.length;K++){var z=N[K];!(z.to!=null&&i==e.line&&e.ch>=z.to||z.from==null&&i!=e.line||z.from!=null&&i==t.line&&z.from>=t.ch)&&(!n||n(z.marker))&&r.push(z.marker.parent||z.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var T=i.text.length+r;if(T>e)return t=e,!0;e-=T,++n}),ht(this,Ne(n,t))},indexFromPos:function(e){e=ht(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new rr(mn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new rr(mn(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(r,rs(this)),r},unlinkDoc:function(e){if(e instanceof Dt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(rs(this));break}if(e.history==this.history){var r=[e.id];Xr(e,function(i){return r.push(i.id)},!0),e.history=new zi(null),e.history.done=Rn(this.history.done,r),e.history.undone=Rn(this.history.undone,r)}},iterLinkedDocs:function(e){Xr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):dt(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:Wt(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&hl(this.cm)})}),rr.prototype.eachLine=rr.prototype.iter;var ns=0;function _l(e){var t=this;if(is(t),Fe(t,e)||Nr(t.display,e))return;J(e),B&&(ns=+new Date);var n=on(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,T=Array(i),N=0,K=function(){++N==i&&jt(t,function(){n=ht(t.doc,n);var be={from:n,to:n,text:t.doc.splitLines(T.filter(function(Me){return Me!=null}).join(t.doc.lineSeparator())),origin:"paste"};Mn(t.doc,be),Ho(t.doc,zr(ht(t.doc,n),ht(t.doc,Vr(be))))})()},z=function(be,Me){if(t.options.allowDropFileTypes&&ee(t.options.allowDropFileTypes,be.type)==-1){K();return}var Ue=new FileReader;Ue.onerror=function(){return K()},Ue.onload=function(){var je=Ue.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(je)){K();return}T[Me]=je,K()},Ue.readAsText(be)},X=0;X<r.length;X++)z(r[X],X);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 ie=e.dataTransfer.getData("Text");if(ie){var le;if(t.state.draggingText&&!t.state.draggingText.copy&&(le=t.listSelections()),Yi(t.doc,zr(n,n)),le)for(var Te=0;Te<le.length;++Te)kn(t.doc,"",le[Te].anchor,le[Te].head,"drag");t.replaceSelection(ie,"around","paste"),t.display.input.focus()}}catch(be){}}}function Al(e,t){if(B&&(!e.state.draggingText||+new Date-ns<100)){se(t);return}if(Fe(e,t)||Nr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!O){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",S&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),S&&n.parentNode.removeChild(n)}}function Ll(e,t){var n=on(e,t);if(!n)return;var r=document.createDocumentFragment();go(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),l(e.display.dragCursor,r)}function is(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function as(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var T=0;T<n.length;T++)e(n[T])})}var os=!1;function Dl(){if(os)return;Ol(),os=!0}function Ol(){var e;Ae(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(Rl)},100))}),Ae(window,"blur",function(){return as(Ln)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var $r={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},bi=0;bi<10;bi++)$r[bi+48]=$r[bi+96]=String(bi);for(var Zi=65;Zi<=90;Zi++)$r[Zi]=String.fromCharCode(Zi);for(var Ei=1;Ei<=12;Ei++)$r[Ei+111]=$r[Ei+63235]="F"+Ei;var Br={};Br.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Br.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Br.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Br.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Br.default=u?Br.macDefault:Br.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,T,N=0;N<t.length-1;N++){var K=t[N];if(/^(cmd|meta|m)$/i.test(K))T=!0;else if(/^a(lt)?$/i.test(K))n=!0;else if(/^(c|ctrl|control)$/i.test(K))r=!0;else if(/^s(hift)?$/i.test(K))i=!0;else throw new Error("Unrecognized modifier name: "+K)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),T&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Ml(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=ne(n.split(" "),Pl),T=0;T<i.length;T++){var N=void 0,K=void 0;T==i.length-1?(K=i.join(" "),N=r):(K=i.slice(0,T+1).join(" "),N="...");var z=t[K];if(!z)t[K]=N;else if(z!=N)throw new Error("Inconsistent bindings for "+K)}delete e[n]}for(var X in t)e[X]=t[X];return e}function Un(e,t,n,r){t=Qi(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Un(e,t.fallthrough,n,r);for(var T=0;T<t.fallthrough.length;T++){var N=Un(e,t.fallthrough[T],n,r);if(N)return N}}}function ss(e){var t=typeof e=="string"?e:$r[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ls(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(f?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(f?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function us(e,t){if(S&&e.keyCode==34&&e.char)return!1;var n=$r[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),ls(n,e,t))}function Qi(e){return typeof e=="string"?Br[e]:e}function Fn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var T=t(n[i]);r.length&&ct(T.from,$(r).to)<=0;){var N=r.pop();if(ct(N.from,T.from)<0){T.from=N.from;break}}r.push(T)}or(e,function(){for(var K=r.length-1;K>=0;K--)kn(e.doc,"",r[K].from,r[K].to,"+delete");Dn(e)})}function Fa(e,t,n){var r=Pe(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Na(e,t,n){var r=Fa(e,t.ch,n);return r==null?null:new Ne(t.line,r,n<0?"after":"before")}function Ba(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var T=Je(n,t.doc.direction);if(T){var N=i<0?$(T):T[0],K=i<0==(N.level==1),z=K?"after":"before",X;if(N.level>0||t.doc.direction=="rtl"){var ie=Cn(t,n);X=i<0?n.text.length-1:0;var le=Dr(t,ie,X).top;X=ze(function(Te){return Dr(t,ie,Te).top==le},i<0==(N.level==1)?N.from:N.to-1,X),z=="before"&&(X=Fa(n,X,1))}else X=i<0?N.to:N.from;return new Ne(r,X,z)}}return new Ne(r,i<0?n.text.length:0,i<0?"before":"after")}function kl(e,t,n,r){var i=Je(t,e.doc.direction);if(!i)return Na(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var T=He(i,n.ch,n.sticky),N=i[T];if(e.doc.direction=="ltr"&&N.level%2==0&&(r>0?N.to>n.ch:N.from<n.ch))return Na(t,n,r);var K=function(Ve,qe){return Fa(t,Ve instanceof Ne?Ve.ch:Ve,qe)},z,X=function(Ve){return e.options.lineWrapping?(z=z||Cn(e,t),fo(e,t,z,Ve)):{begin:0,end:t.text.length}},ie=X(n.sticky=="before"?K(n,-1):n.ch);if(e.doc.direction=="rtl"||N.level==1){var le=N.level==1==r<0,Te=K(n,le?1:-1);if(Te!=null&&(le?Te<=N.to&&Te<=ie.end:Te>=N.from&&Te>=ie.begin)){var be=le?"before":"after";return new Ne(n.line,Te,be)}}var Me=function(Ve,qe,Xe){for(var tt=function(Lt,Ht){return Ht?new Ne(n.line,K(Lt,1),"before"):new Ne(n.line,Lt,"after")};Ve>=0&&Ve<i.length;Ve+=qe){var ut=i[Ve],at=qe>0==(ut.level!=1),pt=at?Xe.begin:K(Xe.end,-1);if(ut.from<=pt&&pt<ut.to)return tt(pt,at);if(pt=at?ut.from:K(ut.to,-1),Xe.begin<=pt&&pt<Xe.end)return tt(pt,at)}},Ue=Me(T+r,r,ie);if(Ue)return Ue;var je=r>0?ie.end:K(ie.begin,-1);return je!=null&&!(r>0&&je==t.text.length)&&(Ue=Me(r>0?0:i.length-1,r,X(je)),Ue)?Ue:null}var xi={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ve)},killLine:function(e){return Fn(e,function(t){if(t.empty()){var n=nt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Ne(t.head.line+1,0)}:{from:t.head,to:Ne(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Fn(e,function(t){return{from:Ne(t.from().line,0),to:ht(e.doc,Ne(t.to().line+1,0))}})},delLineLeft:function(e){return Fn(e,function(t){return{from:Ne(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Fn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return Fn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Ne(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ne(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")},fe)},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")},fe)},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},fe)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var T=n[i].from(),N=H(e.getLine(T.line),T.ch,r);t.push(pe(r-N%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return or(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,T=nt(e.doc,i.line).text;if(T){if(i.ch==T.length&&(i=new Ne(i.line,i.ch-1)),i.ch>0)i=new Ne(i.line,i.ch+1),e.replaceRange(T.charAt(i.ch-1)+T.charAt(i.ch-2),Ne(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 Ne(i.line,1),e.replaceRange(T.charAt(0)+e.doc.lineSeparator()+N.charAt(N.length-1),Ne(i.line-1,N.length-1),i,"+transpose"))}}n.push(new wt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return or(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Dn(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ds(e,t){var n=nt(e.doc,t),r=ur(n);return r!=n&&(t=Tt(r)),Ba(!0,e,r,t,1)}function Il(e,t){var n=nt(e.doc,t),r=ki(n);return r!=n&&(t=Tt(r)),Ba(!0,e,n,t,-1)}function cs(e,t){var n=ds(e,t.line),r=nt(e.doc,n.line),i=Je(r,e.doc.direction);if(!i||i[0].level==0){var T=Math.max(n.ch,r.text.search(/\S/)),N=t.line==n.line&&t.ch<=T&&t.ch;return Ne(n.line,N?0:T,n.sticky)}return n}function qi(e,t,n){if(typeof t=="string"&&(t=xi[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=xe}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Ul(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Un(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Un(t,e.options.extraKeys,n,e)||Un(t,e.options.keyMap,n,e)}var Fl=new Y;function Ti(e,t,n,r){var i=e.state.keySeq;if(i){if(ss(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),fs(e,i+" "+t,n,r))return!0}return fs(e,t,n,r)}function fs(e,t,n,r){var i=Ul(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Gt(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(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=M(),Fe(t,e))return;B&&U<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=hs(t,e);S&&(ja=r?n:null,!r&&n==88&&!Ct&&(u?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),A&&!u&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;F(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(h(t,"CodeMirror-crosshair"),Ze(document,"keyup",n),Ze(document,"mouseover",n))}Ae(document,"keyup",n),Ae(document,"mouseover",n)}function ps(e){e.keyCode==16&&(this.doc.sel.shift=!1),Fe(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Nr(t.display,e)||Fe(t,e)||e.ctrlKey&&!e.altKey||u&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(S&&n==ja){ja=null,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&&ct(t,this.pos)==0&&n==this.button};var Si,wi;function Wl(e,t){var n=+new Date;return wi&&wi.compare(n,e,t)?(Si=wi=null,"triple"):Si&&Si.compare(n,e,t)?(wi=new Wa(n,e,t),Si=null,"double"):(Si=new Wa(n,e,t),wi=null,"single")}function vs(e){var t=this,n=t.display;if(Fe(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Nr(n,e)){k||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=on(t,e),i=_e(e),T=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,T,e))return;i==1?r?Gl(t,r,T,e):ce(e)==n.scroller&&J(e):i==2?(r&&Xi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(_?t.display.input.onContextMenu(e):yo(t))}function Hl(e,t,n,r,i){var T="Click";return r=="double"?T="Double"+T:r=="triple"&&(T="Triple"+T),T=(t==1?"Left":t==2?"Middle":"Right")+T,Ti(e,ls(T,i),i,function(N){if(typeof N=="string"&&(N=xi[N]),!N)return!1;var K=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),K=N(e,n)!=xe}finally{e.state.suppressEdits=!1}return K})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var T=s?n.shiftKey&&n.metaKey:n.altKey;i.unit=T?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=u?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(u?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){B?setTimeout(D(vo,e),0):e.curOp.focus=M();var i=Kl(e,n,r),T=e.doc.sel,N;e.options.dragDrop&&Ce&&!e.isReadOnly()&&n=="single"&&(N=T.contains(t))>-1&&(ct((N=T.ranges[N]).from(),t)<0||t.xRel>0)&&(ct(N.to(),t)>0||t.xRel<0)?zl(e,r,t,i):Vl(e,r,t,i)}function zl(e,t,n,r){var i=e.display,T=!1,N=jt(e,function(X){k&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ze(i.wrapper.ownerDocument,"mouseup",N),Ze(i.wrapper.ownerDocument,"mousemove",K),Ze(i.scroller,"dragstart",z),Ze(i.scroller,"drop",N),T||(J(X),r.addNew||Xi(e.doc,n,null,null,r.extend),k&&!O||B&&U==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),K=function(X){T=T||Math.abs(t.clientX-X.clientX)+Math.abs(t.clientY-X.clientY)>=10},z=function(){return T=!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",K),Ae(i.scroller,"dragstart",z),Ae(i.scroller,"drop",N),yo(e),setTimeout(function(){return i.input.focus()},20)}function ys(e,t,n){if(n=="char")return new wt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new wt(Ne(t.line,0),ht(e.doc,Ne(t.line+1,0)));var r=n(e,t);return new wt(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,T=e.doc;J(t);var N,K,z=T.sel,X=z.ranges;if(r.addNew&&!r.extend?(K=T.sel.contains(n),K>-1?N=X[K]:N=new wt(n,n)):(N=T.sel.primary(),K=T.sel.primIndex),r.unit=="rectangle")r.addNew||(N=new wt(n,n)),n=on(e,t,!0,!0),K=-1;else{var ie=ys(e,n,r.unit);r.extend?N=Ia(N,ie.anchor,ie.head,r.extend):N=ie}r.addNew?K==-1?(K=X.length,Xt(T,Sr(e,X.concat([N]),K),{scroll:!1,origin:"*mouse"})):X.length>1&&X[K].empty()&&r.unit=="char"&&!r.extend?(Xt(T,Sr(e,X.slice(0,K).concat(X.slice(K+1)),0),{scroll:!1,origin:"*mouse"}),z=T.sel):Ua(T,K,N,he):(K=0,Xt(T,new cr([N],0),he),z=T.sel);var le=n;function Te(Xe){if(ct(le,Xe)==0)return;if(le=Xe,r.unit=="rectangle"){for(var tt=[],ut=e.options.tabSize,at=H(nt(T,n.line).text,n.ch,ut),pt=H(nt(T,Xe.line).text,Xe.ch,ut),Lt=Math.min(at,pt),Ht=Math.max(at,pt),Ot=Math.min(n.line,Xe.line),sr=Math.min(e.lastLine(),Math.max(n.line,Xe.line));Ot<=sr;Ot++){var nr=nt(T,Ot).text,kt=me(nr,Lt,ut);Lt==Ht?tt.push(new wt(Ne(Ot,kt),Ne(Ot,kt))):nr.length>kt&&tt.push(new wt(Ne(Ot,kt),Ne(Ot,me(nr,Ht,ut))))}tt.length||tt.push(new wt(n,n)),Xt(T,Sr(e,z.ranges.slice(0,K).concat(tt),K),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Xe)}else{var ir=N,zt=ys(e,Xe,r.unit),Nt=ir.anchor,It;ct(zt.anchor,Nt)>0?(It=zt.head,Nt=Zr(ir.from(),zt.anchor)):(It=zt.anchor,Nt=vn(ir.to(),zt.head));var Pt=z.ranges.slice(0);Pt[K]=Xl(e,new wt(ht(T,Nt),It)),Xt(T,Sr(e,Pt,K),he)}}var be=i.wrapper.getBoundingClientRect(),Me=0;function Ue(Xe){var tt=++Me,ut=on(e,Xe,!0,r.unit=="rectangle");if(!ut)return;if(ct(ut,le)!=0){e.curOp.focus=M(),Te(ut);var at=Wi(i,T);(ut.line>=at.to||ut.line<at.from)&&setTimeout(jt(e,function(){Me==tt&&Ue(Xe)}),150)}else{var pt=Xe.clientY<be.top?-20:Xe.clientY>be.bottom?20:0;pt&&setTimeout(jt(e,function(){if(Me!=tt)return;i.scroller.scrollTop+=pt,Ue(Xe)}),50)}}function je(Xe){e.state.selectingText=!1,Me=Infinity,Xe&&(J(Xe),i.input.focus()),Ze(i.wrapper.ownerDocument,"mousemove",Ve),Ze(i.wrapper.ownerDocument,"mouseup",qe),T.history.lastSelOrigin=null}var Ve=jt(e,function(Xe){Xe.buttons===0||!_e(Xe)?je(Xe):Ue(Xe)}),qe=jt(e,je);e.state.selectingText=qe,Ae(i.wrapper.ownerDocument,"mousemove",Ve),Ae(i.wrapper.ownerDocument,"mouseup",qe)}function Xl(e,t){var n=t.anchor,r=t.head,i=nt(e.doc,n.line);if(ct(n,r)==0&&n.sticky==r.sticky)return t;var T=Je(i);if(!T)return t;var N=He(T,n.ch,n.sticky),K=T[N];if(K.from!=n.ch&&K.to!=n.ch)return t;var z=N+(K.from==n.ch==(K.level!=1)?0:1);if(z==0||z==T.length)return t;var X;if(r.line!=n.line)X=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ie=He(T,r.ch,r.sticky),le=ie-N||(r.ch-n.ch)*(K.level==1?-1:1);ie==z-1||ie==z?X=le<0:X=le>0}var Te=T[z+(X?-1:0)],be=X==(Te.level==1),Me=be?Te.from:Te.to,Ue=be?"after":"before";return n.ch==Me&&n.sticky==Ue?t:new wt(new Ne(n.line,Me,Ue),r)}function bs(e,t,n,r){var i,T;if(t.touches)i=t.touches[0].clientX,T=t.touches[0].clientY;else try{i=t.clientX,T=t.clientY}catch(Te){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&J(t);var N=e.display,K=N.lineDiv.getBoundingClientRect();if(T>K.bottom||!ue(e,n))return te(t);T-=K.top-N.viewOffset;for(var z=0;z<e.display.gutterSpecs.length;++z){var X=N.gutters.childNodes[z];if(X&&X.getBoundingClientRect().right>=i){var ie=gr(e.doc,T),le=e.display.gutterSpecs[z];return Re(e,n,e,ie,le.className,t),te(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function Es(e,t){if(Nr(e.display,t)||Yl(e,t))return;if(Fe(e,t,"contextmenu"))return;_||e.display.input.onContextMenu(t)}function Yl(e,t){return ue(e,"gutterContextMenu")?bs(e,t,"gutterContextMenu",!1):!1}function xs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ii(e)}var Nn={toString:function(){return"CodeMirror.Init"}},Ts={},ea={};function $l(e){var t=e.optionHandlers;function n(r,i,T,N){e.defaults[r]=i,T&&(t[r]=N?function(K,z,X){X!=Nn&&T(K,z,X)}:T)}e.defineOption=n,e.Init=Nn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Pa(r)},!0),n("indentUnit",2,Pa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){fi(r),ii(r),tr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var T=[],N=r.doc.first;r.doc.iter(function(z){for(var X=0;;){var ie=z.text.indexOf(i,X);if(ie==-1)break;X=ie+i.length,T.push(Ne(N,ie))}N++});for(var K=T.length-1;K>=0;K--)kn(r.doc,i,T[K],Ne(T[K].line,T[K].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,T){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),T!=Nn&&r.refresh()}),n("specialCharPlaceholder",At,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!w),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){xs(r),ci(r)},!0),n("keyMap","default",function(r,i,T){var N=Qi(i),K=T!=Nn&&Qi(T);K&&K.detach&&K.detach(r,N),N.attach&&N.attach(r,K||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Zl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Oa(i,r.options.lineNumbers),ci(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Ea(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return On(r)},!0),n("scrollbarStyle","native",function(r){wo(r),On(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=Oa(r.options.gutters,i),ci(r)},!0),n("firstLineNumber",1,ci,!0),n("lineNumberFormatter",function(r){return r},ci,!0),n("showCursorWhenSelecting",!1,ai,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Ln(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,ai,!0),n("singleCursorHeightPerLine",!0,ai,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,fi,!0),n("addModeClass",!1,fi,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,fi,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Jl(e,t,n){var r=n&&n!=Nn;if(!t!=!r){var i=e.display.dragFunctions,T=t?Ae:Ze;T(e.display.scroller,"dragstart",i.start),T(e.display.scroller,"dragenter",i.enter),T(e.display.scroller,"dragover",i.over),T(e.display.scroller,"dragleave",i.leave),T(e.display.scroller,"drop",i.drop)}}function Zl(e){e.options.lineWrapping?(F(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(h(e.display.wrapper,"CodeMirror-wrap"),Ii(e)),xa(e),tr(e),ii(e),setTimeout(function(){return On(e)},100)}function Dt(e,t){var n=this;if(!(this instanceof Dt))return new Dt(e,t);this.options=t=t?P(t):{},P(Ts,t,!1);var r=t.value;typeof r=="string"?r=new rr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Dt.inputStyles[t.inputStyle](this),T=this.display=new dl(e,r,i,t);T.wrapper.CodeMirror=this,xs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),wo(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new Y,keySeq:null,specialChars:null},t.autofocus&&!o&&T.input.focus(),B&&U<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Ql(this),Dl(),dn(this),this.curOp.forceUpdate=!0,ko(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Sa(n)},20):Ln(this);for(var N in ea)ea.hasOwnProperty(N)&&ea[N](this,t[N],Nn);Ao(this),t.finishInit&&t.finishInit(this);for(var K=0;K<Ka.length;++K)Ka[K](this);cn(this),k&&t.lineWrapping&&getComputedStyle(T.lineDiv).textRendering=="optimizelegibility"&&(T.lineDiv.style.textRendering="auto")}Dt.defaults=Ts,Dt.optionHandlers=ea;function Ql(e){var t=e.display;Ae(t.scroller,"mousedown",jt(e,vs)),B&&U<11?Ae(t.scroller,"dblclick",jt(e,function(z){if(Fe(e,z))return;var X=on(e,z);if(!X||Ha(e,z)||Nr(e.display,z))return;J(z);var ie=e.findWordAt(X);Xi(e.doc,ie.anchor,ie.head)})):Ae(t.scroller,"dblclick",function(z){return Fe(e,z)||J(z)}),Ae(t.scroller,"contextmenu",function(z){return Es(e,z)}),Ae(t.input.getField(),"contextmenu",function(z){t.scroller.contains(z.target)||Es(e,z)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function T(z){if(z.touches.length!=1)return!1;var X=z.touches[0];return X.radiusX<=1&&X.radiusY<=1}function N(z,X){if(X.left==null)return!0;var ie=X.left-z.left,le=X.top-z.top;return ie*ie+le*le>20*20}Ae(t.scroller,"touchstart",function(z){if(!Fe(e,z)&&!T(z)&&!Ha(e,z)){t.input.ensurePolled(),clearTimeout(n);var X=+new Date;t.activeTouch={start:X,moved:!1,prev:X-r.end<=300?r:null},z.touches.length==1&&(t.activeTouch.left=z.touches[0].pageX,t.activeTouch.top=z.touches[0].pageY)}}),Ae(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ae(t.scroller,"touchend",function(z){var X=t.activeTouch;if(X&&!Nr(t,z)&&X.left!=null&&!X.moved&&new Date-X.start<300){var ie=e.coordsChar(t.activeTouch,"page"),le;!X.prev||N(X,X.prev)?le=new wt(ie,ie):!X.prev.prev||N(X,X.prev.prev)?le=e.findWordAt(ie):le=new wt(Ne(ie.line,0),ht(e.doc,Ne(ie.line+1,0))),e.setSelection(le.anchor,le.head),e.focus(),J(z)}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),Re(e,"scroll",e))}),Ae(t.scroller,"mousewheel",function(z){return Oo(e,z)}),Ae(t.scroller,"DOMMouseScroll",function(z){return Oo(e,z)}),Ae(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(z){Fe(e,z)||se(z)},over:function(z){Fe(e,z)||(Ll(e,z),se(z))},start:function(z){return Al(e,z)},drop:jt(e,_l),leave:function(z){Fe(e,z)||is(e)}};var K=t.input.getField();Ae(K,"keyup",function(z){return ps.call(e,z)}),Ae(K,"keydown",jt(e,ms)),Ae(K,"keypress",jt(e,gs)),Ae(K,"focus",function(z){return Sa(e,z)}),Ae(K,"blur",function(z){return Ln(e,z)})}var Ka=[];Dt.defineInitHook=function(e){return Ka.push(e)};function Ci(e,t,n,r){var i=e.doc,T;n==null&&(n="add"),n=="smart"&&(i.mode.indent?T=vr(e,t).state:n="prev");var N=e.options.tabSize,K=nt(i,t),z=H(K.text,null,N);K.stateAfter&&(K.stateAfter=null);var X=K.text.match(/^\s*/)[0],ie;if(!r&&!/\S/.test(K.text))ie=0,n="not";else if(n=="smart"&&(ie=i.mode.indent(T,K.text.slice(X.length),K.text),ie==xe||ie>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?ie=H(nt(i,t-1).text,null,N):ie=0:n=="add"?ie=z+e.options.indentUnit:n=="subtract"?ie=z-e.options.indentUnit:typeof n=="number"&&(ie=z+n),ie=Math.max(0,ie);var le="",Te=0;if(e.options.indentWithTabs)for(var be=Math.floor(ie/N);be;--be)Te+=N,le+=" ";if(Te<ie&&(le+=pe(ie-Te)),le!=X)return kn(i,le,Ne(t,0),Ne(t,X.length),"+input"),K.stateAfter=null,!0;for(var Me=0;Me<i.sel.ranges.length;Me++){var Ue=i.sel.ranges[Me];if(Ue.head.line==t&&Ue.head.ch<X.length){var je=Ne(t,X.length);Ua(i,Me,new wt(je,je));break}}}var wr=null;function ta(e){wr=e}function Ga(e,t,n,r,i){var T=e.doc;e.display.shift=!1,r||(r=T.sel);var N=+new Date-200,K=i=="paste"||e.state.pasteIncoming>N,z=dt(t),X=null;if(K&&r.ranges.length>1)if(wr&&wr.text.join(`
`)==t){if(r.ranges.length%wr.text.length==0){X=[];for(var ie=0;ie<wr.text.length;ie++)X.push(T.splitLines(wr.text[ie]))}}else z.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(X=ne(z,function(Ve){return[Ve]}));for(var le=e.curOp.updateInput,Te=r.ranges.length-1;Te>=0;Te--){var be=r.ranges[Te],Me=be.from(),Ue=be.to();be.empty()&&(n&&n>0?Me=Ne(Me.line,Me.ch-n):e.state.overwrite&&!K?Ue=Ne(Ue.line,Math.min(nt(T,Ue.line).text.length,Ue.ch+$(z).length)):K&&wr&&wr.lineWise&&wr.text.join(`
`)==z.join(`
`)&&(Me=Ue=Ne(Me.line,0)));var je={from:Me,to:Ue,text:X?X[Te%X.length]:z,origin:i||(K?"paste":e.state.cutIncoming>N?"cut":"+input")};Mn(e.doc,je),Gt(e,"inputRead",e,je)}t&&!K&&ws(e,t),Dn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=le),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ss(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&or(t,function(){return Ga(t,n,0,null,"paste")}),!0}function ws(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var T=e.getModeAt(i.head),N=!1;if(T.electricChars){for(var K=0;K<T.electricChars.length;K++)if(t.indexOf(T.electricChars.charAt(K))>-1){N=Ci(e,i.head.line,"smart");break}}else T.electricInput&&(T.electricInput.test(nt(e.doc,i.head.line).text.slice(0,i.head.ch))&&(N=Ci(e,i.head.line,"smart")));N&&Gt(e,"electricInput",e,i.head.line)}}function Cs(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,T={anchor:Ne(i,0),head:Ne(i+1,0)};n.push(T),t.push(e.getRange(T.anchor,T.head))}return{text:t,ranges:n}}function _s(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function As(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return k?e.style.width="1000px":e.setAttribute("wrap","off"),v&&(e.style.border="1px solid black"),_s(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var T=this.options,N=T[r];if(T[r]==i&&r!="mode")return;T[r]=i,t.hasOwnProperty(r)&&jt(this,t[r])(this,i,N),Re(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"](Qi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,T=0;T<i.length;++T)if(i[T]==r||i[T].name==r)return i.splice(T,1),!0},addOverlay:Jt(function(r,i){var T=r.token?r:e.getMode(this.options,r);if(T.startState)throw new Error("Overlays may not be stateful.");Q(this.state.overlays,{mode:T,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(N){return N.priority}),this.state.modeGen++,tr(this)}),removeOverlay:Jt(function(r){for(var i=this.state.overlays,T=0;T<i.length;++T){var N=i[T].modeSpec;if(N==r||typeof r=="string"&&N.name==r){i.splice(T,1),this.state.modeGen++,tr(this);return}}}),indentLine:Jt(function(r,i,T){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Mr(this.doc,r)&&Ci(this,r,i,T)}),indentSelection:Jt(function(r){for(var i=this.doc.sel.ranges,T=-1,N=0;N<i.length;N++){var K=i[N];if(K.empty())K.head.line>T&&(Ci(this,K.head.line,r,!0),T=K.head.line,N==this.doc.sel.primIndex&&Dn(this));else{var z=K.from(),X=K.to(),ie=Math.max(T,z.line);T=Math.min(this.lastLine(),X.line-(X.ch?0:1))+1;for(var le=ie;le<T;++le)Ci(this,le,r);var Te=this.doc.sel.ranges;z.ch==0&&i.length==Te.length&&Te[N].from().ch>0&&Ua(this.doc,N,new wt(z,Te[N].to()),ve)}}}),getTokenAt:function(r,i){return Ai(this,r,i)},getLineTokens:function(r,i){return Ai(this,Ne(r),i,!0)},getTokenTypeAt:function(r){r=ht(this.doc,r);var i=Qr(this,nt(this.doc,r.line)),T=0,N=(i.length-1)/2,K=r.ch,z;if(K==0)z=i[2];else for(;;){var X=T+N>>1;if((X?i[X*2-1]:0)>=K)N=X;else if(i[X*2+1]<K)T=X+1;else{z=i[X*2+2];break}}var ie=z?z.indexOf("overlay "):-1;return ie<0?z:ie==0?null:z.slice(0,ie-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var T=[];if(!n.hasOwnProperty(i))return T;var N=n[i],K=this.getModeAt(r);if(typeof K[i]=="string")N[K[i]]&&T.push(N[K[i]]);else if(K[i])for(var z=0;z<K[i].length;z++){var X=N[K[i][z]];X&&T.push(X)}else K.helperType&&N[K.helperType]?T.push(N[K.helperType]):N[K.name]&&T.push(N[K.name]);for(var ie=0;ie<N._global.length;ie++){var le=N._global[ie];le.pred(K,this)&&ee(T,le.val)==-1&&T.push(le.val)}return T},getStateAfter:function(r,i){var T=this.doc;return r=yn(T,r==null?T.first+T.size-1:r),vr(this,r+1,i).state},cursorCoords:function(r,i){var T,N=this.doc.sel.primary();return r==null?T=N.head:typeof r=="object"?T=ht(this.doc,r):T=r?N.from():N.to(),Tr(this,T,i||"page")},charCoords:function(r,i){return pa(this,ht(this.doc,r),i||"page")},coordsChar:function(r,i){return r=lo(this,r,i||"page"),va(this,r.left,r.top)},lineAtHeight:function(r,i){return r=lo(this,{top:r,left:0},i||"page").top,gr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,T){var N=!1,K;if(typeof r=="number"){var z=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>z&&(r=z,N=!0),K=nt(this.doc,r)}else K=r;return Fi(this,K,{top:0,left:0},i||"page",T||N).top+(N?this.doc.height-xr(K):0)},defaultTextHeight:function(){return _n(this.display)},defaultCharWidth:function(){return An(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,T,N,K){var z=this.display;r=Tr(this,ht(this.doc,r));var X=r.bottom,ie=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),z.sizer.appendChild(i),N=="over")X=r.top;else if(N=="above"||N=="near"){var le=Math.max(z.wrapper.clientHeight,this.doc.height),Te=Math.max(z.sizer.clientWidth,z.lineSpace.clientWidth);(N=="above"||r.bottom+i.offsetHeight>le)&&r.top>i.offsetHeight?X=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=le&&(X=r.bottom),ie+i.offsetWidth>Te&&(ie=Te-i.offsetWidth)}i.style.top=X+"px",i.style.left=i.style.right="",K=="right"?(ie=z.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(K=="left"?ie=0:K=="middle"&&(ie=(z.sizer.clientWidth-i.offsetWidth)/2),i.style.left=ie+"px"),T&&Js(this,{left:ie,top:X,right:ie+i.offsetWidth,bottom:X+i.offsetHeight})},triggerOnKeyDown:Jt(ms),triggerOnKeyPress:Jt(gs),triggerOnKeyUp:ps,triggerOnMouseDown:Jt(vs),execCommand:function(r){if(xi.hasOwnProperty(r))return xi[r].call(null,this)},triggerElectric:Jt(function(r){ws(this,r)}),findPosH:function(r,i,T,N){var K=1;i<0&&(K=-1,i=-i);for(var z=ht(this.doc,r),X=0;X<i&&!(z=za(this.doc,z,K,T,N),z.hitSide);++X);return z},moveH:Jt(function(r,i){var T=this;this.extendSelectionsBy(function(N){return T.display.shift||T.doc.extend||N.empty()?za(T.doc,N.head,r,i,T.options.rtlMoveVisually):r<0?N.from():N.to()},fe)}),deleteH:Jt(function(r,i){var T=this.doc.sel,N=this.doc;T.somethingSelected()?N.replaceSelection("",null,"+delete"):Fn(this,function(K){var z=za(N,K.head,r,i,!1);return r<0?{from:z,to:K.head}:{from:K.head,to:z}})}),findPosV:function(r,i,T,N){var K=1,z=N;i<0&&(K=-1,i=-i);for(var X=ht(this.doc,r),ie=0;ie<i;++ie){var le=Tr(this,X,"div");if(z==null?z=le.left:le.left=z,X=Ls(this,le,K,T),X.hitSide)break}return X},moveV:Jt(function(r,i){var T=this,N=this.doc,K=[],z=!this.display.shift&&!N.extend&&N.sel.somethingSelected();if(N.extendSelectionsBy(function(ie){if(z)return r<0?ie.from():ie.to();var le=Tr(T,ie.head,"div");ie.goalColumn!=null&&(le.left=ie.goalColumn),K.push(le.left);var Te=Ls(T,le,r,i);return i=="page"&&ie==N.sel.primary()&&Ca(T,pa(T,Te,"div").top-le.top),Te},fe),K.length)for(var X=0;X<N.sel.ranges.length;X++)N.sel.ranges[X].goalColumn=K[X]}),findWordAt:function(r){var i=this.doc,T=nt(i,r.line).text,N=r.ch,K=r.ch;if(T){var z=this.getHelper(r,"wordChars");(r.sticky=="before"||K==T.length)&&N?--N:++K;for(var X=T.charAt(N),ie=Le(X,z)?function(le){return Le(le,z)}:/\s/.test(X)?function(le){return/\s/.test(le)}:function(le){return!/\s/.test(le)&&!Le(le)};N>0&&ie(T.charAt(N-1));)--N;for(;K<T.length&&ie(T.charAt(K));)++K}return new wt(Ne(r.line,N),Ne(r.line,K))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?F(this.display.cursorDiv,"CodeMirror-overwrite"):h(this.display.cursorDiv,"CodeMirror-overwrite"),Re(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==M()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Jt(function(r,i){oi(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Lr(this)-this.display.barHeight,width:r.scrollWidth-Lr(this)-this.display.barWidth,clientHeight:fa(this),clientWidth:nn(this)}},scrollIntoView:Jt(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Ne(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?Zs(this,r):Eo(this,r.from,r.to,r.margin)}),setSize:Jt(function(r,i){var T=this,N=function(z){return typeof z=="number"||/^\d+$/.test(String(z))?z+"px":z};r!=null&&(this.display.wrapper.style.width=N(r)),i!=null&&(this.display.wrapper.style.height=N(i)),this.options.lineWrapping&&ao(this);var K=this.display.viewFrom;this.doc.iter(K,this.display.viewTo,function(z){if(z.widgets){for(var X=0;X<z.widgets.length;X++)if(z.widgets[X].noHScroll){Kr(T,K,"widget");break}}++K}),this.curOp.forceUpdate=!0,Re(this,"refresh",this)}),operation:function(r){return or(this,r)},startOperation:function(){return dn(this)},endOperation:function(){return cn(this)},refresh:Jt(function(){var r=this.display.cachedTextHeight;tr(this),this.curOp.forceUpdate=!0,ii(this),oi(this,this.doc.scrollLeft,this.doc.scrollTop),La(this.display),(r==null||Math.abs(r-_n(this.display))>.5||this.options.lineWrapping)&&xa(this),Re(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}},de(e),e.registerHelper=function(r,i,T){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=T},e.registerGlobalHelper=function(r,i,T,N){e.registerHelper(r,i,N),n[r]._global.push({pred:T,val:N})}}function za(e,t,n,r,i){var T=t,N=n,K=nt(e,t.line),z=i&&e.direction=="rtl"?-n:n;function X(){var qe=t.line+z;return qe<e.first||qe>=e.first+e.size?!1:(t=new Ne(qe,t.ch,t.sticky),K=nt(e,qe))}function ie(qe){var Xe;if(r=="codepoint"){var tt=K.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(tt)?Xe=null:Xe=new Ne(t.line,Math.max(0,Math.min(K.text.length,t.ch+n*(tt>=55296&&tt<56320?2:1))),-n)}else i?Xe=kl(e.cm,K,t,n):Xe=Na(K,t,n);if(Xe==null)if(!qe&&X())t=Ba(i,e.cm,K,t.line,z);else return!1;else t=Xe;return!0}if(r=="char"||r=="codepoint")ie();else if(r=="column")ie(!0);else if(r=="word"||r=="group")for(var le=null,Te=r=="group",be=e.cm&&e.cm.getHelper(t,"wordChars"),Me=!0;!(n<0&&!ie(!Me));Me=!1){var Ue=K.text.charAt(t.ch)||`
`,je=Le(Ue,be)?"w":Te&&Ue==`
`?"n":!Te||/\s/.test(Ue)?null:"p";if(Te&&!Me&&!je&&(je="s"),le&&le!=je){n<0&&(n=1,ie(),t.sticky="after");break}if(je&&(le=je),n>0&&!ie(!Me))break}var Ve=$i(e,t,T,N,!0);return Gn(T,Ve)&&(Ve.hitSide=!0),Ve}function Ls(e,t,n,r){var i=e.doc,T=t.left,N;if(r=="page"){var K=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),z=Math.max(K-.5*_n(e.display),3);N=(n>0?t.bottom:t.top)+n*z}else r=="line"&&(N=n>0?t.bottom+3:t.top-3);for(var X;!(X=va(e,T,N),!X.outside);){if(n<0?N<=0:N>=i.height){X.hitSide=!0;break}N+=n*5}return X}var _t=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Y,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};_t.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;_s(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function T(K){for(var z=K.target;z;z=z.parentNode){if(z==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(z.className))break}return!1}Ae(i,"paste",function(K){if(!T(K)||Fe(r,K)||Ss(K,r))return;U<=11&&setTimeout(jt(r,function(){return t.updateFromDOM()}),20)}),Ae(i,"compositionstart",function(K){t.composing={data:K.data,done:!1}}),Ae(i,"compositionupdate",function(K){t.composing||(t.composing={data:K.data,done:!1})}),Ae(i,"compositionend",function(K){t.composing&&(K.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(K){if(!T(K)||Fe(r,K))return;if(r.somethingSelected())ta({lineWise:!1,text:r.getSelections()}),K.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var z=Cs(r);ta({lineWise:!0,text:z.text}),K.type=="cut"&&r.operation(function(){r.setSelections(z.ranges,0,ve),r.replaceSelection("",null,"cut")})}else return;if(K.clipboardData){K.clipboardData.clearData();var X=wr.text.join(`
`);if(K.clipboardData.setData("Text",X),K.clipboardData.getData("Text")==X){K.preventDefault();return}}var ie=As(),le=ie.firstChild;r.display.lineSpace.insertBefore(ie,r.display.lineSpace.firstChild),le.value=wr.text.join(`
`);var Te=document.activeElement;W(le),setTimeout(function(){r.display.lineSpace.removeChild(ie),Te.focus(),Te==i&&n.showPrimarySelection()},50)}Ae(i,"copy",N),Ae(i,"cut",N)},_t.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},_t.prototype.prepareSelection=function(){var e=po(this.cm,!1);return e.focus=document.activeElement==this.div,e},_t.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},_t.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},_t.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var T=ra(t,e.anchorNode,e.anchorOffset),N=ra(t,e.focusNode,e.focusOffset);if(T&&!T.bad&&N&&!N.bad&&ct(Zr(T,N),r)==0&&ct(vn(T,N),i)==0)return;var K=t.display.view,z=r.line>=t.display.viewFrom&&Ds(t,r)||{node:K[0].measure.map[2],offset:0},X=i.line<t.display.viewTo&&Ds(t,i);if(!X){var ie=K[K.length-1].measure,le=ie.maps?ie.maps[ie.maps.length-1]:ie.map;X={node:le[le.length-1],offset:le[le.length-2]-le[le.length-3]}}if(!z||!X){e.removeAllRanges();return}var Te=e.rangeCount&&e.getRangeAt(0),be;try{be=m(z.node,z.offset,X.offset,X.node)}catch(Me){}be&&(!A&&t.state.focused?(e.collapse(z.node,z.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()},_t.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)},_t.prototype.showMultipleSelections=function(e){l(this.cm.display.cursorDiv,e.cursors),l(this.cm.display.selectionDiv,e.selection)},_t.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},_t.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return E(this.div,t)},_t.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},_t.prototype.blur=function(){this.div.blur()},_t.prototype.getField=function(){return this.div},_t.prototype.supportsTouch=function(){return!0},_t.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)},_t.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},_t.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(d&&b&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=ra(t,e.anchorNode,e.anchorOffset),r=ra(t,e.focusNode,e.focusOffset);n&&r&&or(t,function(){Xt(t.doc,zr(n,r),ve),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},_t.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=Ne(r.line-1,nt(e.doc,r.line-1).length)),i.ch==nt(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Ne(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var T,N,K;r.line==t.viewFrom||(T=sn(e,r.line))==0?(N=Tt(t.view[0].line),K=t.view[0].node):(N=Tt(t.view[T].line),K=t.view[T-1].node.nextSibling);var z=sn(e,i.line),X,ie;if(z==t.view.length-1?(X=t.viewTo-1,ie=t.lineDiv.lastChild):(X=Tt(t.view[z+1].line)-1,ie=t.view[z+1].node.previousSibling),!K)return!1;for(var le=e.doc.splitLines(tu(e,K,ie,N,X)),Te=Pr(e.doc,Ne(N,0),Ne(X,nt(e.doc,X).text.length));le.length>1&&Te.length>1;)if($(le)==$(Te))le.pop(),Te.pop(),X--;else if(le[0]==Te[0])le.shift(),Te.shift(),N++;else break;for(var be=0,Me=0,Ue=le[0],je=Te[0],Ve=Math.min(Ue.length,je.length);be<Ve&&Ue.charCodeAt(be)==je.charCodeAt(be);)++be;for(var qe=$(le),Xe=$(Te),tt=Math.min(qe.length-(le.length==1?be:0),Xe.length-(Te.length==1?be:0));Me<tt&&qe.charCodeAt(qe.length-Me-1)==Xe.charCodeAt(Xe.length-Me-1);)++Me;if(le.length==1&&Te.length==1&&N==r.line)for(;be&&be>r.ch&&qe.charCodeAt(qe.length-Me-1)==Xe.charCodeAt(Xe.length-Me-1);)be--,Me++;le[le.length-1]=qe.slice(0,qe.length-Me).replace(/^\u200b+/,""),le[0]=le[0].slice(be).replace(/\u200b+$/,"");var ut=Ne(N,be),at=Ne(X,Te.length?$(Te).length-Me:0);if(le.length>1||le[0]||ct(ut,at))return kn(e.doc,le,ut,at,"+input"),!0},_t.prototype.ensurePolled=function(){this.forceCompositionEnd()},_t.prototype.reset=function(){this.forceCompositionEnd()},_t.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},_t.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)},_t.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&or(this.cm,function(){return tr(e.cm)})},_t.prototype.setUneditable=function(e){e.contentEditable="false"},_t.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)},_t.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},_t.prototype.onContextMenu=function(){},_t.prototype.resetPosition=function(){},_t.prototype.needsContentAttribute=!0;function Ds(e,t){var n=ha(e,t.line);if(!n||n.hidden)return null;var r=nt(e.doc,t.line),i=eo(n,r,t.line),T=Je(r,e.doc.direction),N="left";if(T){var K=He(T,t.ch);N=K%2?"right":"left"}var z=no(i.map,t.ch,N);return z.offset=z.collapse=="right"?z.end:z.start,z}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Bn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var T="",N=!1,K=e.doc.lineSeparator(),z=!1;function X(be){return function(Me){return Me.id==be}}function ie(){N&&(T+=K,z&&(T+=K),N=z=!1)}function le(be){be&&(ie(),T+=be)}function Te(be){if(be.nodeType==1){var Me=be.getAttribute("cm-text");if(Me){le(Me);return}var Ue=be.getAttribute("cm-marker"),je;if(Ue){var Ve=e.findMarks(Ne(r,0),Ne(i+1,0),X(+Ue));Ve.length&&(je=Ve[0].find(0))&&le(Pr(e.doc,je.from,je.to).join(K));return}if(be.getAttribute("contenteditable")=="false")return;var qe=/^(pre|div|p|li|table|br)$/i.test(be.nodeName);if(!/^br$/i.test(be.nodeName)&&be.textContent.length==0)return;qe&&ie();for(var Xe=0;Xe<be.childNodes.length;Xe++)Te(be.childNodes[Xe]);/^(pre|p)$/i.test(be.nodeName)&&(z=!0),qe&&(N=!0)}else be.nodeType==3&&le(be.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Te(t),t==n);)t=t.nextSibling,z=!1;return T}function ra(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Bn(e.clipPos(Ne(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var T=e.display.view[i];if(T.node==r)return ru(T,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!E(r,t))return Bn(Ne(Tt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var T=e.rest?$(e.rest):e.line;return Bn(Ne(Tt(T),T.text.length),i)}var N=t.nodeType==3?t:null,K=t;for(!N&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(N=t.firstChild,n&&(n=N.nodeValue.length));K.parentNode!=r;)K=K.parentNode;var z=e.measure,X=z.maps;function ie(je,Ve,qe){for(var Xe=-1;Xe<(X?X.length:0);Xe++)for(var tt=Xe<0?z.map:X[Xe],ut=0;ut<tt.length;ut+=3){var at=tt[ut+2];if(at==je||at==Ve){var pt=Tt(Xe<0?e.line:e.rest[Xe]),Lt=tt[ut]+qe;return(qe<0||at!=je)&&(Lt=tt[ut+(qe?1:0)]),Ne(pt,Lt)}}}var le=ie(N,K,n);if(le)return Bn(le,i);for(var Te=K.nextSibling,be=N?N.nodeValue.length-n:0;Te;Te=Te.nextSibling){if(le=ie(Te,Te.firstChild,0),le)return Bn(Ne(le.line,le.ch-be),i);be+=Te.textContent.length}for(var Me=K.previousSibling,Ue=n;Me;Me=Me.previousSibling){if(le=ie(Me,Me.firstChild,-1),le)return Bn(Ne(le.line,le.ch+Ue),i);Ue+=Me.textContent.length}}var Mt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Y,this.hasSelection=!1,this.composing=null};Mt.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),v&&(i.style.width="0px"),Ae(i,"input",function(){B&&U>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Ae(i,"paste",function(N){if(Fe(r,N)||Ss(N,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function T(N){if(Fe(r,N))return;if(r.somethingSelected())ta({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var K=Cs(r);ta({lineWise:!0,text:K.text}),N.type=="cut"?r.setSelections(K.ranges,null,ve):(n.prevInput="",i.value=K.text.join(`
`),W(i))}else return;N.type=="cut"&&(r.state.cutIncoming=+new Date)}Ae(i,"cut",T),Ae(i,"copy",T),Ae(e.scroller,"paste",function(N){if(Nr(e,N)||Fe(r,N))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var K=new Event("paste");K.clipboardData=N.clipboardData,i.dispatchEvent(K)}),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=t.wrapper.getBoundingClientRect(),N=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+N.top-T.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+N.left-T.left))}return r},Mt.prototype.showSelection=function(e){var t=this.cm,n=t.display;l(n.cursorDiv,e.cursors),l(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Mt.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&W(this.textarea),B&&U>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",B&&U>=9&&(this.hasSelection=null))},Mt.prototype.getField=function(){return this.textarea},Mt.prototype.supportsTouch=function(){return!1},Mt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||M()!=this.textarea))try{this.textarea.focus()}catch(e){}},Mt.prototype.blur=function(){this.textarea.blur()},Mt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Mt.prototype.receivedFocus=function(){this.slowPoll()},Mt.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Mt.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},Mt.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||ot(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(B&&U>=9&&this.hasSelection===i||u&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var T=i.charCodeAt(0);if(T==8203&&!r&&(r="\u200B"),T==8666)return this.reset(),this.cm.execCommand("undo")}for(var N=0,K=Math.min(r.length,i.length);N<K&&r.charCodeAt(N)==i.charCodeAt(N);)++N;return or(t,function(){Ga(t,i.slice(N),r.length-N,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Mt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Mt.prototype.onKeyPress=function(){B&&U>=9&&(this.hasSelection=null),this.fastPoll()},Mt.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var T=on(n,e),N=r.scroller.scrollTop;if(!T||S)return;var K=n.options.resetSelectionOnContextMenu;K&&n.doc.sel.contains(T)==-1&&jt(n,Xt)(n.doc,zr(T),ve);var z=i.style.cssText,X=t.wrapper.style.cssText,ie=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-ie.top-5)+"px; left: "+(e.clientX-ie.left-5)+`px;
z-index: 1000; background: `+(B?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var le;k&&(le=window.scrollY),r.input.focus(),k&&window.scrollTo(null,le),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 Ue=n.somethingSelected(),je="\u200B"+(Ue?i.value:"");i.value="\u21DA",i.value=je,t.prevInput=Ue?"":"\u200B",i.selectionStart=1,i.selectionEnd=je.length,r.selForContextMenu=n.doc.sel}}function be(){if(t.contextMenuPending!=be)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=X,i.style.cssText=z,B&&U<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=N),i.selectionStart!=null){(!B||B&&U<9)&&Te();var Ue=0,je=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?jt(n,Xo)(n):Ue++<10?r.detectingSelectAll=setTimeout(je,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(je,200)}}if(B&&U>=9&&Te(),_){se(e);var Me=function(){Ze(window,"mouseup",Me),setTimeout(be,20)};Ae(window,"mouseup",Me)}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?P(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=M();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=K.getValue()}var i;if(e.form&&(Ae(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var T=e.form;i=T.submit;try{var N=T.submit=function(){r(),T.submit=i,T.submit(),T.submit=N}}catch(z){}}t.finishInit=function(z){z.save=r,z.getTextArea=function(){return e},z.toTextArea=function(){z.toTextArea=isNaN,r(),e.parentNode.removeChild(z.getWrapperElement()),e.style.display="",e.form&&(Ze(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var K=Dt(function(z){return e.parentNode.insertBefore(z,e.nextSibling)},t);return K}function iu(e){e.off=Ze,e.on=Ae,e.wheelEventPixels=cl,e.Doc=rr,e.splitLines=dt,e.countColumn=H,e.findColumn=me,e.isWordChar=Se,e.Pass=xe,e.signal=Re,e.Line=rn,e.changeEnd=Vr,e.scrollbarModel=So,e.Pos=Ne,e.cmpPos=ct,e.modes=Ut,e.mimeModes=Et,e.resolveMode=lr,e.getMode=pr,e.modeExtensions=fr,e.extendMode=ia,e.copyState=_r,e.startState=Kn,e.innerMode=Hn,e.commands=xi,e.keyMap=Br,e.keyName=us,e.isModifierKey=ss,e.lookupKey=Un,e.normalizeKeyMap=Ml,e.StringStream=Rt,e.SharedTextMarker=yi,e.TextMarker=Yr,e.LineWidget=vi,e.e_preventDefault=J,e.e_stopPropagation=Z,e.e_stop=se,e.addClass=F,e.contains=E,e.rmClass=h,e.keyNames=$r}$l(Dt),ql(Dt);var au="iter insert remove copy getEditor constructor".split(" ");for(var na in rr.prototype)rr.prototype.hasOwnProperty(na)&&ee(au,na)<0&&(Dt.prototype[na]=function(e){return function(){return e.apply(this.doc,arguments)}}(rr.prototype[na]));return de(rr),Dt.inputStyles={textarea:Mt,contenteditable:_t},Dt.defineMode=function(e){!Dt.defaults.mode&&e!="null"&&(Dt.defaults.mode=e),Cr.apply(this,arguments)},Dt.defineMIME=Rr,Dt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Dt.defineMIME("text/plain","null"),Dt.defineExtension=function(e,t){Dt.prototype[e]=t},Dt.defineDocExtension=function(e,t){rr.prototype[e]=t},Dt.fromTextArea=nu,iu(Dt),Dt.version="5.58.2",Dt})},Y1PL:function(st,Ke,q){"use strict";q.r(Ke),q.d(Ke,"ResizableTextArea",function(){return ee});var re=q("wx14"),V=q("1OyB"),A=q("vuIU"),G=q("Ji7U"),I=q("LK+K"),R=q("cDcd"),B=q("VTBJ"),U=q("rePB"),k=q("Zm9Q"),L=q("Kwbf"),b=q("c+Xe"),S=q("m+aA"),O=q("bdgK"),C=new Map;function x(ve){ve.forEach(function(he){var fe,me=he.target;(fe=C.get(me))===null||fe===void 0||fe.forEach(function(ae){return ae(me)})})}var v=new O.default(x),d=null,o=null;function u(ve,he){C.has(ve)||(C.set(ve,new Set),v.observe(ve)),C.get(ve).add(he)}function s(ve,he){C.has(ve)&&(C.get(ve).delete(he),C.get(ve).size||(v.unobserve(ve),C.delete(ve)))}var w=function(ve){Object(G.a)(fe,ve);var he=Object(I.a)(fe);function fe(){return Object(V.a)(this,fe),he.apply(this,arguments)}return Object(A.a)(fe,[{key:"render",value:function(){return this.props.children}}]),fe}(R.Component),g=R.createContext(null);function f(ve){var he=ve.children,fe=ve.onBatchResize,me=R.useRef(0),ae=R.useRef([]),pe=R.useContext(g),$=R.useCallback(function(ne,Q,Ee){me.current+=1;var we=me.current;ae.current.push({size:ne,element:Q,data:Ee}),Promise.resolve().then(function(){we===me.current&&(fe==null||fe(ae.current),ae.current=[])}),pe==null||pe(ne,Q,Ee)},[fe,pe]);return R.createElement(g.Provider,{value:$},he)}function _(ve){var he=ve.children,fe=ve.disabled,me=R.useRef(null),ae=R.useRef(null),pe=R.useContext(g),$=R.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ne=R.isValidElement(he)&&Object(b.c)(he),Q=ne?he.ref:null,Ee=R.useMemo(function(){return Object(b.a)(Q,me)},[Q,me]),we=R.useRef(ve);we.current=ve;var ye=R.useCallback(function(Se){var Le=we.current,Oe=Le.onResize,ke=Le.data,De=Se.getBoundingClientRect(),Pe=De.width,ze=De.height,$e=Se.offsetWidth,We=Se.offsetHeight,He=Math.floor(Pe),rt=Math.floor(ze);if($.current.width!==He||$.current.height!==rt||$.current.offsetWidth!==$e||$.current.offsetHeight!==We){var Je={width:He,height:rt,offsetWidth:$e,offsetHeight:We};$.current=Je;var Qe=$e===Math.round(Pe)?Pe:$e,Ae=We===Math.round(ze)?ze:We,et=Object(B.a)(Object(B.a)({},Je),{},{offsetWidth:Qe,offsetHeight:Ae});pe==null||pe(et,Se,ke),Oe&&Promise.resolve().then(function(){Oe(et,Se)})}},[]);return R.useEffect(function(){var Se=Object(S.a)(me.current)||Object(S.a)(ae.current);return Se&&!fe&&u(Se,ye),function(){return s(Se,ye)}},[me.current,fe]),R.createElement(w,{ref:ae},ne?R.cloneElement(he,{ref:Ee}):he)}var p="rc-observer-key";function h(ve){var he=ve.children,fe=Object(k.a)(he);return fe.map(function(me,ae){var pe=(me==null?void 0:me.key)||"".concat(p,"-").concat(ae);return R.createElement(_,Object(re.a)({},ve,{key:pe}),me)})}h.Collection=f;var c=h,l=q("bT9E"),a=q("TSYQ"),y=q.n(a),m=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important
`,E=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],M={},F;function j(ve){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,fe=ve.getAttribute("id")||ve.getAttribute("data-reactid")||ve.getAttribute("name");if(he&&M[fe])return M[fe];var me=window.getComputedStyle(ve),ae=me.getPropertyValue("box-sizing")||me.getPropertyValue("-moz-box-sizing")||me.getPropertyValue("-webkit-box-sizing"),pe=parseFloat(me.getPropertyValue("padding-bottom"))+parseFloat(me.getPropertyValue("padding-top")),$=parseFloat(me.getPropertyValue("border-bottom-width"))+parseFloat(me.getPropertyValue("border-top-width")),ne=E.map(function(Ee){return"".concat(Ee,":").concat(me.getPropertyValue(Ee))}).join(";"),Q={sizingStyle:ne,paddingSize:pe,borderSize:$,boxSizing:ae};return he&&fe&&(M[fe]=Q),Q}function W(ve){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,fe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,me=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;F||(F=document.createElement("textarea"),F.setAttribute("tab-index","-1"),F.setAttribute("aria-hidden","true"),document.body.appendChild(F)),ve.getAttribute("wrap")?F.setAttribute("wrap",ve.getAttribute("wrap")):F.removeAttribute("wrap");var ae=j(ve,he),pe=ae.paddingSize,$=ae.borderSize,ne=ae.boxSizing,Q=ae.sizingStyle;F.setAttribute("style","".concat(Q,";").concat(m)),F.value=ve.value||ve.placeholder||"";var Ee=Number.MIN_SAFE_INTEGER,we=Number.MAX_SAFE_INTEGER,ye=F.scrollHeight,Se;if(ne==="border-box"?ye+=$:ne==="content-box"&&(ye-=pe),fe!==null||me!==null){F.value=" ";var Le=F.scrollHeight-pe;fe!==null&&(Ee=Le*fe,ne==="border-box"&&(Ee=Ee+pe+$),ye=Math.max(Ee,ye)),me!==null&&(we=Le*me,ne==="border-box"&&(we=we+pe+$),Se=ye>we?"":"hidden",ye=Math.min(we,ye))}return{height:ye,minHeight:Ee,maxHeight:we,overflowY:Se,resize:"none"}}var D=q("Gytx"),P=q.n(D),H;(function(ve){ve[ve.NONE=0]="NONE",ve[ve.RESIZING=1]="RESIZING",ve[ve.RESIZED=2]="RESIZED"})(H||(H={}));var Y=function(ve){Object(G.a)(fe,ve);var he=Object(I.a)(fe);function fe(me){var ae;return Object(V.a)(this,fe),ae=he.call(this,me),ae.nextFrameActionId=void 0,ae.resizeFrameId=void 0,ae.textArea=void 0,ae.saveTextArea=function(pe){ae.textArea=pe},ae.handleResize=function(pe){var $=ae.state.resizeStatus,ne=ae.props,Q=ne.autoSize,Ee=ne.onResize;if($!==H.NONE)return;typeof Ee=="function"&&Ee(pe),Q&&ae.resizeOnNextFrame()},ae.resizeOnNextFrame=function(){cancelAnimationFrame(ae.nextFrameActionId),ae.nextFrameActionId=requestAnimationFrame(ae.resizeTextarea)},ae.resizeTextarea=function(){var pe=ae.props.autoSize;if(!pe||!ae.textArea)return;var $=pe.minRows,ne=pe.maxRows,Q=W(ae.textArea,!1,$,ne);ae.setState({textareaStyles:Q,resizeStatus:H.RESIZING},function(){cancelAnimationFrame(ae.resizeFrameId),ae.resizeFrameId=requestAnimationFrame(function(){ae.setState({resizeStatus:H.RESIZED},function(){ae.resizeFrameId=requestAnimationFrame(function(){ae.setState({resizeStatus:H.NONE}),ae.fixFirefoxAutoScroll()})})})})},ae.renderTextArea=function(){var pe=ae.props,$=pe.prefixCls,ne=$===void 0?"rc-textarea":$,Q=pe.autoSize,Ee=pe.onResize,we=pe.className,ye=pe.disabled,Se=ae.state,Le=Se.textareaStyles,Oe=Se.resizeStatus,ke=Object(l.a)(ae.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),De=y()(ne,we,Object(U.a)({},"".concat(ne,"-disabled"),ye));"value"in ke&&(ke.value=ke.value||"");var Pe=Object(B.a)(Object(B.a)(Object(B.a)({},ae.props.style),Le),Oe===H.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return R.createElement(c,{onResize:ae.handleResize,disabled:!(Q||Ee)},R.createElement("textarea",Object(re.a)({},ke,{className:De,style:Pe,ref:ae.saveTextArea})))},ae.state={textareaStyles:{},resizeStatus:H.NONE},ae}return Object(A.a)(fe,[{key:"componentDidUpdate",value:function(ae){(ae.value!==this.props.value||!P()(ae.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var ae=this.textArea.selectionStart,pe=this.textArea.selectionEnd;this.textArea.setSelectionRange(ae,pe)}}catch($){}}},{key:"render",value:function(){return this.renderTextArea()}}]),fe}(R.Component),ee=Y,oe=function(ve){Object(G.a)(fe,ve);var he=Object(I.a)(fe);function fe(me){var ae;Object(V.a)(this,fe),ae=he.call(this,me),ae.resizableTextArea=void 0,ae.focus=function(){ae.resizableTextArea.textArea.focus()},ae.saveTextArea=function($){ae.resizableTextArea=$},ae.handleChange=function($){var ne=ae.props.onChange;ae.setValue($.target.value,function(){ae.resizableTextArea.resizeTextarea()}),ne&&ne($)},ae.handleKeyDown=function($){var ne=ae.props,Q=ne.onPressEnter,Ee=ne.onKeyDown;$.keyCode===13&&Q&&Q($),Ee&&Ee($)};var pe=typeof me.value=="undefined"||me.value===null?me.defaultValue:me.value;return ae.state={value:pe},ae}return Object(A.a)(fe,[{key:"setValue",value:function(ae,pe){"value"in this.props||this.setState({value:ae},pe)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return R.createElement(ee,Object(re.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ae){return"value"in ae?{value:ae.value}:null}}]),fe}(R.Component),xe=Ke.default=oe},ZW9T:function(st,Ke,q){"use strict";q.d(Ke,"a",function(){return g});var re=q("k1fw"),V=q("miYZ"),A=q("tsqr"),G=q("rAM+"),I=q("tJVT"),R=q("PpiC"),B=q("cDcd"),U=q.n(B),k=q("bdgK");function L(f,_,p,h,c){var l=_.getWordUntilPosition(p),a={startLineNumber:p.lineNumber,endLineNumber:p.lineNumber,startColumn:l.startColumn,endColumn:l.endColumn},y=h.map(function(m){return{label:m,kind:f.languages.CompletionItemKind.Keyword,insertText:m,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:a}});return c.map(function(m){y.push(Object(re.a)(Object(re.a)({},m),{},{range:a}))}),y}var b=function(f){var _={label:"ifelse",kind:f.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},p=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];f.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(a,y){var m=L(f,a,y,p,[_]);return{suggestions:m}}});var h=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];f.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(a,y){var m=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],E=L(f,a,y,h,m);return{suggestions:E}}});var c=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];f.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(a,y){var m=[_,{label:"main",kind:f.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:f.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],E=L(f,a,y,c,m);return{suggestions:E}}})},S="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",O=q("LvDl"),C=q("+ua5");function x(f){return/^\d+$/.test(f)?"".concat(f,"px"):f}function v(){}var d=!1,o={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function u(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],_=f;if(Array.isArray(f)){for(var p=0;p<f.length;p++){var h=o[f[p]];if(h)return h}return _[0]}return o[_]||_}var s=null,w=Ke.b=function(f){var _=f.width,p=_===void 0?"100%":_,h=f.height,c=h===void 0?"100%":h,l=f.value,a=f.language,y=a===void 0?"javascript":a,m=f.style,E=m===void 0?{}:m,M=f.options,F=M===void 0?{}:M,j=f.overrideServices,W=j===void 0?{}:j,D=f.theme,P=D===void 0?"vs-dark":D,H=f.onEditBlur,Y=f.onSave,ee=f.autoHeight,oe=ee===void 0?!1:ee,xe=f.forbidCopy,ve=xe===void 0?!1:xe,he=f.onChange,fe=he===void 0?v:he,me=f.editorDidMount,ae=me===void 0?v:me,pe=f.onFocus,$=pe===void 0?v:pe,ne=f.filename,Q=ne===void 0?"educoder.txt":ne,Ee=f.errorLine,we=f.errorContent,ye=we===void 0?"":we,Se=Object(R.a)(f,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),Le=Object(B.useRef)(),Oe=Object(B.useRef)({}),ke=Object(B.useRef)(),De=Object(B.useRef)(!1),Pe=Object(B.useRef)(),ze=Object(B.useState)(!1),$e=Object(I.a)(ze,2),We=$e[0],He=$e[1];function rt(){var Ce;return Le.current&&(Ce=new k.default(function(Ie){var Ye=Object(G.a)(Ie),Ge;try{for(Ye.s();!(Ge=Ye.n()).done;){var mt=Ge.value;(mt.target.offsetHeight>0||mt.target.offsetWidth>0)&&Oe.current.instance.layout()}}catch(dt){Ye.e(dt)}finally{Ye.f()}}),Ce.observe(Le.current)),Ce}function Je(){A.b.warn(decodeURIComponent(S))}var Qe=function(){var Ie=Oe.current.instance;if(l!=null&&Ie&&We){var Ye=Ie.getModel();Ye&&l!==Ye.getValue()&&(d=!0,Ye.setValue(l),Ie.layout(),d=!1)}};Object(B.useEffect)(function(){ke.current&&clearTimeout(ke.current),ke.current=setTimeout(function(){Qe()},500)},[l,We,Oe.current]),Object(B.useEffect)(function(){if(Ee&&Oe.current&&Oe.current.instance){var Ce=Oe.current.instance;Ce.changeViewZones(function(Ye){var Ge=document.createElement("div");Ge.style.padding="10px 20px",Ge.style.width="calc(100% - 20px)",Ge.className="my-error-line-wrp",Ge.innerHTML=ye,Ye.addZone({afterLineNumber:Ee||11,heightInLines:3,domNode:Ge})});var Ie={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};Ce.addOverlayWidget(Ie),Ce.revealPositionInCenter({lineNumber:20,column:1})}},[Ee,Oe.current,We]);function Ae(){var Ce=Oe.current.instance;if(Ce){var Ie=Ce.getSelection(),Ye=Oe.current.pastePos||{},Ge=new s.Range(Ye.startLineNumber||Ie.endLineNumber,Ye.startColumn||Ie.endColumn,Ye.endLineNumber||Ie.endLineNumber,Ye.endColumn||Ie.endColumn);setTimeout(function(){Ce.executeEdits("",[{range:Ge,text:""}])},300)}}function et(Ce){(window.navigator.platform.match("Mac")?Ce.metaKey:Ce.ctrlKey)&&Ce.keyCode==83&&(Ce.preventDefault(),Y())}var Ze=function(){if(oe&&Oe.current.instance){var Ie=Oe.current.instance.getContentHeight();ce(Ie<c?c:Ie)}else ce(c)};function Re(Ce){var Ie=document.createEvent("MouseEvents");Ie.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Ce.dispatchEvent(Ie)}function Fe(Ce,Ie){var Ye=window.URL||window.webkitURL||window,Ge=new Blob([Ie]),mt=document.createElementNS("http://www.w3.org/1999/xhtml","a");mt.href=Ye.createObjectURL(Ge),mt.download=Ce,Re(mt)}Object(B.useEffect)(function(){Ze()},[Ze]),Object(B.useEffect)(function(){Le.current&&!We&&q.e(27).then(q.t.bind(null,"M/lh",7)).then(function(Ce){try{s=Ce,Oe.current.instance=s.editor.create(Le.current,{value:l,language:u(y),theme:P,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},W);var Ie=Oe.current.instance;if(ae(Ie,s),setTimeout(function(){Ze(),Oe.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Fe(Q||"educoder.txt",Ie.getValue())}})},500),Oe.current.subscription=Ie.onDidChangeModelContent(function(Ge){De.current?clearTimeout(Pe.current):(Ze(),fe(Ie.getValue(),Ge)),Pe.current=setTimeout(function(){De.current=!1},500)}),window.Monaco||b(s),ve&&(Ie.addCommand(s.KeyMod.CtrlCmd|s.KeyMod.Shift|s.KeyCode.KEY_V,function(){return Je(),null}),Ie.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_C,function(){return Je(),null})),window.Monaco=s,H&&Ie.onDidBlurEditorWidget(function(){H(Ie.getValue())}),$&&Ie.onDidFocusEditorText(function(){$(Ie.getValue())}),ve){Ie.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_V,function(){return Je(),null}),Ie.onDidPaste(function(Ge){Oe.current.pastePos=Ge});try{window.addEventListener("paste",Ae)}catch(Ge){}}var Ye=rt();return He(!0),function(){var Ge=Oe.current.instance;Ge.dispose();var mt=Ge.getModel();mt&&mt.dispose(),Oe.current.subscription&&Oe.current.subscription.dispose(),ve&&window.removeEventListener("paste",Ae),Ye.unobserve(Le.current)}}catch(Ge){}})},[]),Object(B.useEffect)(function(){var Ce=Oe.current.instance;if(Ce&&We)return document.addEventListener("keydown",et,!1),function(){document.removeEventListener("keydown",et)}},[Y,We]),Object(B.useEffect)(function(){var Ce=Oe.current.instance;if(Ce&&We){var Ie=u(y);s.editor.setModelLanguage(Ce.getModel(),Ie),console.log("language:",y,Ce.getModel(),Ie)}},[y,We]),Object(B.useEffect)(function(){var Ce=Oe.current.instance;Ce&&We&&s.editor.setTheme(P)},[P,We]),Object(B.useEffect)(function(){var Ce=Oe.current.instance;Ce&&We&&(Ce.updateOptions(Object(re.a)({},F)),setTimeout(function(){Ce.getModel().updateOptions(Object(re.a)({},F))},200))},[JSON.stringify(F),We]),Object(B.useEffect)(function(){var Ce=Oe.current.instance;Ce&&We&&Ce.layout()},[p,c,We]);var ge=Object(B.useState)(x(p)),ue=Object(I.a)(ge,2),de=ue[0],J=ue[1],Z=Object(B.useState)(x(c)),te=Object(I.a)(Z,2),se=te[0],ce=te[1],_e=Object(re.a)(Object(re.a)({},E),{},{width:de,height:se});return U.a.createElement("div",{className:"my-monaco-editor",ref:Le,style:_e})};function g(f){var _=f.width,p=_===void 0?"100%":_,h=f.height,c=h===void 0?"100%":h,l=f.original,a=f.modified,y=f.language,m=f.options,E=m===void 0?{}:m,M=Object(B.useRef)(),F=Object(B.useState)(null),j=Object(I.a)(F,2),W=j[0],D=j[1];function P(oe){var xe;return M.current&&(xe=new k.default(function(ve){var he=Object(G.a)(ve),fe;try{for(he.s();!(fe=he.n()).done;){var me=fe.value;(me.target.offsetHeight>0||me.target.offsetWidth>0)&&oe.layout()}}catch(ae){he.e(ae)}finally{he.f()}}),xe.observe(M.current)),xe}Object(B.useEffect)(function(){M.current&&q.e(27).then(q.t.bind(null,"M/lh",7)).then(function(oe){s=oe;var xe=s.editor.createDiffEditor(M.current,Object(re.a)(Object(re.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},E),{},{wordWrap:!0}));D(xe);var ve=P(xe);return function(){xe.dispose();var he=xe.getModel();he&&he.dispose(),ve.unobserve(M.current)}})},[]),Object(B.useEffect)(function(){W&&W.setModel({original:s.editor.createModel(l,y),modified:s.editor.createModel(a,y)})},[l,a,y,W]);var H=x(p),Y=x(c),ee={width:H,height:Y};return U.a.createElement("div",{className:"my-diff-editor",ref:M,style:ee})}},ZpRC:function(st,Ke,q){"use strict";function re(b){return typeof b=="object"&&b!=null&&b.nodeType===1}function V(b,S){return(!S||b!=="hidden")&&b!=="visible"&&b!=="clip"}function A(b,S){if(b.clientHeight<b.scrollHeight||b.clientWidth<b.scrollWidth){var O=getComputedStyle(b,null);return V(O.overflowY,S)||V(O.overflowX,S)||function(C){var x=function(v){if(!v.ownerDocument||!v.ownerDocument.defaultView)return null;try{return v.ownerDocument.defaultView.frameElement}catch(d){return null}}(C);return!!x&&(x.clientHeight<C.scrollHeight||x.clientWidth<C.scrollWidth)}(b)}return!1}function G(b,S,O,C,x,v,d,o){return v<b&&d>S||v>b&&d<S?0:v<=b&&o<=O||d>=S&&o>=O?v-b-C:d>S&&o<O||v<b&&o>O?d-S+x:0}var I=function(b,S){var O=window,C=S.scrollMode,x=S.block,v=S.inline,d=S.boundary,o=S.skipOverflowHiddenElements,u=typeof d=="function"?d:function(Le){return Le!==d};if(!re(b))throw new TypeError("Invalid target");for(var s=document.scrollingElement||document.documentElement,w=[],g=b;re(g)&&u(g);){if((g=g.parentElement)===s){w.push(g);break}g!=null&&g===document.body&&A(g)&&!A(document.documentElement)||g!=null&&A(g,o)&&w.push(g)}for(var f=O.visualViewport?O.visualViewport.width:innerWidth,_=O.visualViewport?O.visualViewport.height:innerHeight,p=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,c=b.getBoundingClientRect(),l=c.height,a=c.width,y=c.top,m=c.right,E=c.bottom,M=c.left,F=x==="start"||x==="nearest"?y:x==="end"?E:y+l/2,j=v==="center"?M+a/2:v==="end"?m:M,W=[],D=0;D<w.length;D++){var P=w[D],H=P.getBoundingClientRect(),Y=H.height,ee=H.width,oe=H.top,xe=H.right,ve=H.bottom,he=H.left;if(C==="if-needed"&&y>=0&&M>=0&&E<=_&&m<=f&&y>=oe&&E<=ve&&M>=he&&m<=xe)return W;var fe=getComputedStyle(P),me=parseInt(fe.borderLeftWidth,10),ae=parseInt(fe.borderTopWidth,10),pe=parseInt(fe.borderRightWidth,10),$=parseInt(fe.borderBottomWidth,10),ne=0,Q=0,Ee="offsetWidth"in P?P.offsetWidth-P.clientWidth-me-pe:0,we="offsetHeight"in P?P.offsetHeight-P.clientHeight-ae-$:0;if(s===P)ne=x==="start"?F:x==="end"?F-_:x==="nearest"?G(h,h+_,_,ae,$,h+F,h+F+l,l):F-_/2,Q=v==="start"?j:v==="center"?j-f/2:v==="end"?j-f:G(p,p+f,f,me,pe,p+j,p+j+a,a),ne=Math.max(0,ne+h),Q=Math.max(0,Q+p);else{ne=x==="start"?F-oe-ae:x==="end"?F-ve+$+we:x==="nearest"?G(oe,ve,Y,ae,$+we,F,F+l,l):F-(oe+Y/2)+we/2,Q=v==="start"?j-he-me:v==="center"?j-(he+ee/2)+Ee/2:v==="end"?j-xe+pe+Ee:G(he,xe,ee,me,pe+Ee,j,j+a,a);var ye=P.scrollLeft,Se=P.scrollTop;F+=Se-(ne=Math.max(0,Math.min(Se+ne,P.scrollHeight-Y+we))),j+=ye-(Q=Math.max(0,Math.min(ye+Q,P.scrollWidth-ee+Ee)))}W.push({el:P,top:ne,left:Q})}return W};function R(b){return b===Object(b)&&Object.keys(b).length!==0}function B(b,S){S===void 0&&(S="auto");var O="scrollBehavior"in document.body.style;b.forEach(function(C){var x=C.el,v=C.top,d=C.left;x.scroll&&O?x.scroll({top:v,left:d,behavior:S}):(x.scrollTop=v,x.scrollLeft=d)})}function U(b){return b===!1?{block:"end",inline:"nearest"}:R(b)?b:{block:"start",inline:"nearest"}}function k(b,S){var O=!b.ownerDocument.documentElement.contains(b);if(R(S)&&typeof S.behavior=="function")return S.behavior(O?[]:I(b,S));if(O)return;var C=U(S);return B(I(b,C),C.behavior)}var L=Ke.a=k},Zss7:function(st,Ke,q){var re;(function(V){var A=/^\s+/,G=/\s+$/,I=0,R=V.round,B=V.min,U=V.max,k=V.random;function L($,ne){if($=$||"",ne=ne||{},$ instanceof L)return $;if(!(this instanceof L))return new L($,ne);var Q=b($);this._originalInput=$,this._r=Q.r,this._g=Q.g,this._b=Q.b,this._a=Q.a,this._roundA=R(100*this._a)/100,this._format=ne.format||Q.format,this._gradientType=ne.gradientType,this._r<1&&(this._r=R(this._r)),this._g<1&&(this._g=R(this._g)),this._b<1&&(this._b=R(this._b)),this._ok=Q.ok,this._tc_id=I++}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(),ne,Q,Ee,we,ye,Se;return ne=$.r/255,Q=$.g/255,Ee=$.b/255,ne<=.03928?we=ne/12.92:we=V.pow((ne+.055)/1.055,2.4),Q<=.03928?ye=Q/12.92:ye=V.pow((Q+.055)/1.055,2.4),Ee<=.03928?Se=Ee/12.92:Se=V.pow((Ee+.055)/1.055,2.4),.2126*we+.7152*ye+.0722*Se},setAlpha:function($){return this._a=W($),this._roundA=R(100*this._a)/100,this},toHsv:function(){var $=x(this._r,this._g,this._b);return{h:$.h*360,s:$.s,v:$.v,a:this._a}},toHsvString:function(){var $=x(this._r,this._g,this._b),ne=R($.h*360),Q=R($.s*100),Ee=R($.v*100);return this._a==1?"hsv("+ne+", "+Q+"%, "+Ee+"%)":"hsva("+ne+", "+Q+"%, "+Ee+"%, "+this._roundA+")"},toHsl:function(){var $=O(this._r,this._g,this._b);return{h:$.h*360,s:$.s,l:$.l,a:this._a}},toHslString:function(){var $=O(this._r,this._g,this._b),ne=R($.h*360),Q=R($.s*100),Ee=R($.l*100);return this._a==1?"hsl("+ne+", "+Q+"%, "+Ee+"%)":"hsla("+ne+", "+Q+"%, "+Ee+"%, "+this._roundA+")"},toHex:function($){return d(this._r,this._g,this._b,$)},toHexString:function($){return"#"+this.toHex($)},toHex8:function($){return o(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(D(this._r,255)*100)+"%",g:R(D(this._g,255)*100)+"%",b:R(D(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+R(D(this._r,255)*100)+"%, "+R(D(this._g,255)*100)+"%, "+R(D(this._b,255)*100)+"%)":"rgba("+R(D(this._r,255)*100)+"%, "+R(D(this._g,255)*100)+"%, "+R(D(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:F[d(this._r,this._g,this._b,!0)]||!1},toFilter:function($){var ne="#"+u(this._r,this._g,this._b,this._a),Q=ne,Ee=this._gradientType?"GradientType = 1, ":"";if($){var we=L($);Q="#"+u(we._r,we._g,we._b,we._a)}return"progid:DXImageTransform.Microsoft.gradient("+Ee+"startColorstr="+ne+",endColorstr="+Q+")"},toString:function($){var ne=!!$;$=$||this._format;var Q=!1,Ee=this._a<1&&this._a>=0,we=!ne&&Ee&&($==="hex"||$==="hex6"||$==="hex3"||$==="hex4"||$==="hex8"||$==="name");return we?$==="name"&&this._a===0?this.toName():this.toRgbString():($==="rgb"&&(Q=this.toRgbString()),$==="prgb"&&(Q=this.toPercentageRgbString()),($==="hex"||$==="hex6")&&(Q=this.toHexString()),$==="hex3"&&(Q=this.toHexString(!0)),$==="hex4"&&(Q=this.toHex8String(!0)),$==="hex8"&&(Q=this.toHex8String()),$==="name"&&(Q=this.toName()),$==="hsl"&&(Q=this.toHslString()),$==="hsv"&&(Q=this.toHsvString()),Q||this.toHexString())},clone:function(){return L(this.toString())},_applyModification:function($,ne){var Q=$.apply(null,[this].concat([].slice.call(ne)));return this._r=Q._r,this._g=Q._g,this._b=Q._b,this.setAlpha(Q._a),this},lighten:function(){return this._applyModification(f,arguments)},brighten:function(){return this._applyModification(_,arguments)},darken:function(){return this._applyModification(p,arguments)},desaturate:function(){return this._applyModification(s,arguments)},saturate:function(){return this._applyModification(w,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(h,arguments)},_applyCombination:function($,ne){return $.apply(null,[this].concat([].slice.call(ne)))},analogous:function(){return this._applyCombination(m,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(E,arguments)},splitcomplement:function(){return this._applyCombination(y,arguments)},triad:function(){return this._applyCombination(l,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},L.fromRatio=function($,ne){if(typeof $=="object"){var Q={};for(var Ee in $)$.hasOwnProperty(Ee)&&(Ee==="a"?Q[Ee]=$[Ee]:Q[Ee]=xe($[Ee]));$=Q}return L($,ne)};function b($){var ne={r:0,g:0,b:0},Q=1,Ee=null,we=null,ye=null,Se=!1,Le=!1;return typeof $=="string"&&($=ae($)),typeof $=="object"&&(me($.r)&&me($.g)&&me($.b)?(ne=S($.r,$.g,$.b),Se=!0,Le=String($.r).substr(-1)==="%"?"prgb":"rgb"):me($.h)&&me($.s)&&me($.v)?(Ee=xe($.s),we=xe($.v),ne=v($.h,Ee,we),Se=!0,Le="hsv"):me($.h)&&me($.s)&&me($.l)&&(Ee=xe($.s),ye=xe($.l),ne=C($.h,Ee,ye),Se=!0,Le="hsl"),$.hasOwnProperty("a")&&(Q=$.a)),Q=W(Q),{ok:Se,format:$.format||Le,r:B(255,U(ne.r,0)),g:B(255,U(ne.g,0)),b:B(255,U(ne.b,0)),a:Q}}function S($,ne,Q){return{r:D($,255)*255,g:D(ne,255)*255,b:D(Q,255)*255}}function O($,ne,Q){$=D($,255),ne=D(ne,255),Q=D(Q,255);var Ee=U($,ne,Q),we=B($,ne,Q),ye,Se,Le=(Ee+we)/2;if(Ee==we)ye=Se=0;else{var Oe=Ee-we;Se=Le>.5?Oe/(2-Ee-we):Oe/(Ee+we);switch(Ee){case $:ye=(ne-Q)/Oe+(ne<Q?6:0);break;case ne:ye=(Q-$)/Oe+2;break;case Q:ye=($-ne)/Oe+4;break}ye/=6}return{h:ye,s:Se,l:Le}}function C($,ne,Q){var Ee,we,ye;$=D($,360),ne=D(ne,100),Q=D(Q,100);function Se(ke,De,Pe){return Pe<0&&(Pe+=1),Pe>1&&(Pe-=1),Pe<1/6?ke+(De-ke)*6*Pe:Pe<1/2?De:Pe<2/3?ke+(De-ke)*(2/3-Pe)*6:ke}if(ne===0)Ee=we=ye=Q;else{var Le=Q<.5?Q*(1+ne):Q+ne-Q*ne,Oe=2*Q-Le;Ee=Se(Oe,Le,$+1/3),we=Se(Oe,Le,$),ye=Se(Oe,Le,$-1/3)}return{r:Ee*255,g:we*255,b:ye*255}}function x($,ne,Q){$=D($,255),ne=D(ne,255),Q=D(Q,255);var Ee=U($,ne,Q),we=B($,ne,Q),ye,Se,Le=Ee,Oe=Ee-we;if(Se=Ee===0?0:Oe/Ee,Ee==we)ye=0;else{switch(Ee){case $:ye=(ne-Q)/Oe+(ne<Q?6:0);break;case ne:ye=(Q-$)/Oe+2;break;case Q:ye=($-ne)/Oe+4;break}ye/=6}return{h:ye,s:Se,v:Le}}function v($,ne,Q){$=D($,360)*6,ne=D(ne,100),Q=D(Q,100);var Ee=V.floor($),we=$-Ee,ye=Q*(1-ne),Se=Q*(1-we*ne),Le=Q*(1-(1-we)*ne),Oe=Ee%6,ke=[Q,Se,ye,ye,Le,Q][Oe],De=[Le,Q,Q,Se,ye,ye][Oe],Pe=[ye,ye,Le,Q,Q,Se][Oe];return{r:ke*255,g:De*255,b:Pe*255}}function d($,ne,Q,Ee){var we=[oe(R($).toString(16)),oe(R(ne).toString(16)),oe(R(Q).toString(16))];return Ee&&we[0].charAt(0)==we[0].charAt(1)&&we[1].charAt(0)==we[1].charAt(1)&&we[2].charAt(0)==we[2].charAt(1)?we[0].charAt(0)+we[1].charAt(0)+we[2].charAt(0):we.join("")}function o($,ne,Q,Ee,we){var ye=[oe(R($).toString(16)),oe(R(ne).toString(16)),oe(R(Q).toString(16)),oe(ve(Ee))];return we&&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 u($,ne,Q,Ee){var we=[oe(ve(Ee)),oe(R($).toString(16)),oe(R(ne).toString(16)),oe(R(Q).toString(16))];return we.join("")}L.equals=function($,ne){return!$||!ne?!1:L($).toRgbString()==L(ne).toRgbString()},L.random=function(){return L.fromRatio({r:k(),g:k(),b:k()})};function s($,ne){ne=ne===0?0:ne||10;var Q=L($).toHsl();return Q.s-=ne/100,Q.s=P(Q.s),L(Q)}function w($,ne){ne=ne===0?0:ne||10;var Q=L($).toHsl();return Q.s+=ne/100,Q.s=P(Q.s),L(Q)}function g($){return L($).desaturate(100)}function f($,ne){ne=ne===0?0:ne||10;var Q=L($).toHsl();return Q.l+=ne/100,Q.l=P(Q.l),L(Q)}function _($,ne){ne=ne===0?0:ne||10;var Q=L($).toRgb();return Q.r=U(0,B(255,Q.r-R(255*-(ne/100)))),Q.g=U(0,B(255,Q.g-R(255*-(ne/100)))),Q.b=U(0,B(255,Q.b-R(255*-(ne/100)))),L(Q)}function p($,ne){ne=ne===0?0:ne||10;var Q=L($).toHsl();return Q.l-=ne/100,Q.l=P(Q.l),L(Q)}function h($,ne){var Q=L($).toHsl(),Ee=(Q.h+ne)%360;return Q.h=Ee<0?360+Ee:Ee,L(Q)}function c($){var ne=L($).toHsl();return ne.h=(ne.h+180)%360,L(ne)}function l($){var ne=L($).toHsl(),Q=ne.h;return[L($),L({h:(Q+120)%360,s:ne.s,l:ne.l}),L({h:(Q+240)%360,s:ne.s,l:ne.l})]}function a($){var ne=L($).toHsl(),Q=ne.h;return[L($),L({h:(Q+90)%360,s:ne.s,l:ne.l}),L({h:(Q+180)%360,s:ne.s,l:ne.l}),L({h:(Q+270)%360,s:ne.s,l:ne.l})]}function y($){var ne=L($).toHsl(),Q=ne.h;return[L($),L({h:(Q+72)%360,s:ne.s,l:ne.l}),L({h:(Q+216)%360,s:ne.s,l:ne.l})]}function m($,ne,Q){ne=ne||6,Q=Q||30;var Ee=L($).toHsl(),we=360/Q,ye=[L($)];for(Ee.h=(Ee.h-(we*ne>>1)+720)%360;--ne;)Ee.h=(Ee.h+we)%360,ye.push(L(Ee));return ye}function E($,ne){ne=ne||6;for(var Q=L($).toHsv(),Ee=Q.h,we=Q.s,ye=Q.v,Se=[],Le=1/ne;ne--;)Se.push(L({h:Ee,s:we,v:ye})),ye=(ye+Le)%1;return Se}L.mix=function($,ne,Q){Q=Q===0?0:Q||50;var Ee=L($).toRgb(),we=L(ne).toRgb(),ye=Q/100,Se={r:(we.r-Ee.r)*ye+Ee.r,g:(we.g-Ee.g)*ye+Ee.g,b:(we.b-Ee.b)*ye+Ee.b,a:(we.a-Ee.a)*ye+Ee.a};return L(Se)},L.readability=function($,ne){var Q=L($),Ee=L(ne);return(V.max(Q.getLuminance(),Ee.getLuminance())+.05)/(V.min(Q.getLuminance(),Ee.getLuminance())+.05)},L.isReadable=function($,ne,Q){var Ee=L.readability($,ne),we,ye;ye=!1,we=pe(Q);switch(we.level+we.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($,ne,Q){var Ee=null,we=0,ye,Se,Le,Oe;Q=Q||{},Se=Q.includeFallbackColors,Le=Q.level,Oe=Q.size;for(var ke=0;ke<ne.length;ke++)ye=L.readability($,ne[ke]),ye>we&&(we=ye,Ee=L(ne[ke]));return L.isReadable($,Ee,{level:Le,size:Oe})||!Se?Ee:(Q.includeFallbackColors=!1,L.mostReadable($,["#fff","#000"],Q))};var M=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"},F=L.hexNames=j(M);function j($){var ne={};for(var Q in $)$.hasOwnProperty(Q)&&(ne[$[Q]]=Q);return ne}function W($){return $=parseFloat($),(isNaN($)||$<0||$>1)&&($=1),$}function D($,ne){Y($)&&($="100%");var Q=ee($);return $=B(ne,U(0,parseFloat($))),Q&&($=parseInt($*ne,10)/100),V.abs($-ne)<1e-6?1:$%ne/parseFloat(ne)}function P($){return B(1,U(0,$))}function H($){return parseInt($,16)}function Y($){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 ve($){return V.round(parseFloat($)*255).toString(16)}function he($){return H($)/255}var fe=function(){var $="[-\\+]?\\d+%?",ne="[-\\+]?\\d*\\.\\d+%?",Q="(?:"+ne+")|(?:"+$+")",Ee="[\\s|\\(]+("+Q+")[,|\\s]+("+Q+")[,|\\s]+("+Q+")\\s*\\)?",we="[\\s|\\(]+("+Q+")[,|\\s]+("+Q+")[,|\\s]+("+Q+")[,|\\s]+("+Q+")\\s*\\)?";return{CSS_UNIT:new RegExp(Q),rgb:new RegExp("rgb"+Ee),rgba:new RegExp("rgba"+we),hsl:new RegExp("hsl"+Ee),hsla:new RegExp("hsla"+we),hsv:new RegExp("hsv"+Ee),hsva:new RegExp("hsva"+we),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function me($){return!!fe.CSS_UNIT.exec($)}function ae($){$=$.replace(A,"").replace(G,"").toLowerCase();var ne=!1;if(M[$])$=M[$],ne=!0;else if($=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var Q;return(Q=fe.rgb.exec($))?{r:Q[1],g:Q[2],b:Q[3]}:(Q=fe.rgba.exec($))?{r:Q[1],g:Q[2],b:Q[3],a:Q[4]}:(Q=fe.hsl.exec($))?{h:Q[1],s:Q[2],l:Q[3]}:(Q=fe.hsla.exec($))?{h:Q[1],s:Q[2],l:Q[3],a:Q[4]}:(Q=fe.hsv.exec($))?{h:Q[1],s:Q[2],v:Q[3]}:(Q=fe.hsva.exec($))?{h:Q[1],s:Q[2],v:Q[3],a:Q[4]}:(Q=fe.hex8.exec($))?{r:H(Q[1]),g:H(Q[2]),b:H(Q[3]),a:he(Q[4]),format:ne?"name":"hex8"}:(Q=fe.hex6.exec($))?{r:H(Q[1]),g:H(Q[2]),b:H(Q[3]),format:ne?"name":"hex"}:(Q=fe.hex4.exec($))?{r:H(Q[1]+""+Q[1]),g:H(Q[2]+""+Q[2]),b:H(Q[3]+""+Q[3]),a:he(Q[4]+""+Q[4]),format:ne?"name":"hex8"}:(Q=fe.hex3.exec($))?{r:H(Q[1]+""+Q[1]),g:H(Q[2]+""+Q[2]),b:H(Q[3]+""+Q[3]),format:ne?"name":"hex"}:!1}function pe($){var ne,Q;return $=$||{level:"AA",size:"small"},ne=($.level||"AA").toUpperCase(),Q=($.size||"small").toLowerCase(),ne!=="AA"&&ne!=="AAA"&&(ne="AA"),Q!=="small"&&Q!=="large"&&(Q="small"),{level:ne,size:Q}}st.exports?st.exports=L:!(re=function(){return L}.call(Ke,q,Ke,st),re!==void 0&&(st.exports=re))})(Math)},bT9E:function(st,Ke,q){"use strict";q.d(Ke,"a",function(){return V});var re=q("VTBJ");function V(A,G){var I=Object(re.a)({},A);return Array.isArray(G)&&G.forEach(function(R){delete I[R]}),I}},c5Ni:function(st,Ke,q){},dejd:function(st,Ke,q){},dmUQ:function(st,Ke,q){"use strict";var re=q("Ff2n"),V=q("rePB"),A=q("1OyB"),G=q("vuIU"),I=q("Ji7U"),R=q("md7G"),B=q("foSv"),U=q("cDcd"),k=q.n(U),L=q("TSYQ"),b=q.n(L),S=q("4IlW");function O(l,a){var y=Object.keys(l);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(l);a&&(m=m.filter(function(E){return Object.getOwnPropertyDescriptor(l,E).enumerable})),y.push.apply(y,m)}return y}function C(l){for(var a=1;a<arguments.length;a++){var y=arguments[a]!=null?arguments[a]:{};a%2?O(Object(y),!0).forEach(function(m){Object(V.a)(l,m,y[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(y)):O(Object(y)).forEach(function(m){Object.defineProperty(l,m,Object.getOwnPropertyDescriptor(y,m))})}return l}function x(l){var a=v();return function(){var m=Object(B.a)(l),E;if(a){var M=Object(B.a)(this).constructor;E=Reflect.construct(m,arguments,M)}else E=m.apply(this,arguments);return Object(R.a)(this,E)}}function v(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(l){return!1}}function d(){}function o(l){l.preventDefault()}var u=function(a){return a.replace(/[^\w.-]+/g,"")},s=200,w=600,g=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,f=function(a){return a!=null},_=function(a,y){return y===a||typeof y=="number"&&typeof a=="number"&&isNaN(y)&&isNaN(a)},p=function(l){Object(I.a)(y,l);var a=x(y);function y(m){var E;Object(A.a)(this,y),E=a.call(this,m),E.onKeyDown=function(j){var W=E.props,D=W.onKeyDown,P=W.onPressEnter;if(j.keyCode===S.a.UP){var H=E.getRatio(j);E.up(j,H,null),E.stop()}else if(j.keyCode===S.a.DOWN){var Y=E.getRatio(j);E.down(j,Y,null),E.stop()}else j.keyCode===S.a.ENTER&&P&&P(j);if(E.recordCursorPosition(),E.lastKeyCode=j.keyCode,D){for(var ee=arguments.length,oe=new Array(ee>1?ee-1:0),xe=1;xe<ee;xe++)oe[xe-1]=arguments[xe];D.apply(void 0,[j].concat(oe))}},E.onKeyUp=function(j){var W=E.props.onKeyUp;if(E.stop(),E.recordCursorPosition(),W){for(var D=arguments.length,P=new Array(D>1?D-1:0),H=1;H<D;H++)P[H-1]=arguments[H];W.apply(void 0,[j].concat(P))}},E.onChange=function(j){var W=E.props.onChange;E.state.focused&&(E.inputting=!0),E.rawInput=E.props.parser(E.getValueFromEvent(j)),E.setState({inputValue:E.rawInput}),W(E.toNumber(E.rawInput))},E.onMouseUp=function(){var j=E.props.onMouseUp;E.recordCursorPosition(),j&&j.apply(void 0,arguments)},E.onFocus=function(){var j;E.setState({focused:!0}),(j=E.props).onFocus.apply(j,arguments)},E.onBlur=function(){var j=E.props.onBlur;E.inputting=!1,E.setState({focused:!1});var W=E.getCurrentValidValue(E.state.inputValue),D=E.setValue(W,d);if(j){var P=E.input.value,H=E.getInputDisplayValue({focus:!1,value:D});E.input.value=H&&Number(H),j.apply(void 0,arguments),E.input.value=P}},E.getRatio=function(j){var W=1;return j.metaKey||j.ctrlKey?W=.1:j.shiftKey&&(W=10),W},E.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},E.getPrecision=function(j){if(f(E.props.precision))return E.props.precision;var W=String(j);if(W.indexOf("e-")>=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var D=0;return W.indexOf(".")>=0&&(D=W.length-W.indexOf(".")-1),D},E.getInputDisplayValue=function(j){var W=j||E.state,D=W.focused,P=W.inputValue,H=W.value,Y;D?Y=P:Y=E.toPrecisionAsStep(H),Y==null&&(Y="");var ee=E.formatWrapper(Y);return f(E.props.decimalSeparator)&&(ee=ee.toString().replace(".",E.props.decimalSeparator)),ee},E.recordCursorPosition=function(){try{E.cursorStart=E.input.selectionStart,E.cursorEnd=E.input.selectionEnd,E.currentValue=E.input.value,E.cursorBefore=E.input.value.substring(0,E.cursorStart),E.cursorAfter=E.input.value.substring(E.cursorEnd)}catch(j){}},E.restoreByAfter=function(j){if(j===void 0)return!1;var W=E.input.value,D=W.lastIndexOf(j);if(D===-1)return!1;var P=E.cursorBefore.length;return E.lastKeyCode===S.a.DELETE&&E.cursorBefore.charAt(P-1)===j[0]?(E.fixCaret(P,P),!0):D+j.length===W.length?(E.fixCaret(D,D),!0):!1},E.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(W,D){var P=j.substring(D);return E.restoreByAfter(P)})},E.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},E.stop=function(){E.autoStepTimer&&clearTimeout(E.autoStepTimer)},E.down=function(j,W,D){E.pressingUpOrDown=!0,E.step("down",j,W,D)},E.up=function(j,W,D){E.pressingUpOrDown=!0,E.step("up",j,W,D)},E.saveInput=function(j){E.input=j};var M=m.value;M===void 0&&(M=m.defaultValue),E.state={focused:m.autoFocus};var F=E.getValidValue(E.toNumber(M));return E.state=C(C({},E.state),{},{inputValue:E.toPrecisionAsStep(F),value:F}),E}return Object(G.a)(y,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(E){var M=this.props,F=M.value,j=M.onChange,W=M.max,D=M.min,P=this.state.focused;if(E){if(!_(E.value,F)||!_(E.max,W)||!_(E.min,D)){var H=P?F:this.getValidValue(F),Y;this.pressingUpOrDown?Y=H:this.inputting?Y=this.rawInput:Y=this.toPrecisionAsStep(H),this.setState({value:H,inputValue:Y})}var ee="value"in this.props?F:this.state.value;"max"in this.props&&E.max!==W&&typeof ee=="number"&&ee>W&&j&&j(W),"min"in this.props&&E.min!==D&&typeof ee=="number"&&ee<D&&j&&j(D)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var oe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===S.a.BACKSPACE?oe=this.cursorStart-1:this.lastKeyCode===S.a.DELETE&&(oe=this.cursorStart):oe=this.input.value.length,this.fixCaret(oe,oe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case S.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case S.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(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(E){var M=E;return M===""?M="":this.isNotCompleteNumber(parseFloat(M))?M=this.state.value:M=this.getValidValue(M),this.toNumber(M)}},{key:"getValueFromEvent",value:function(E){var M=E.target.value.trim().replace(/。/g,".");return f(this.props.decimalSeparator)&&(M=M.replace(this.props.decimalSeparator,".")),M}},{key:"getValidValue",value:function(E){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,j=parseFloat(E);return isNaN(j)?E:(j<M&&(j=M),j>F&&(j=F),j)}},{key:"setValue",value:function(E,M){var F=this.props.precision,j=this.isNotCompleteNumber(parseFloat(E))?null:parseFloat(E),W=this.state.value,D=W===void 0?null:W,P=this.state.inputValue,H=P===void 0?null:P,Y=typeof j=="number"?j.toFixed(F):"".concat(j),ee=j!==D||Y!=="".concat(H);return"value"in this.props?(H=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:H},M)):this.setState({value:j,inputValue:this.toPrecisionAsStep(E)},M),ee&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(E){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.props,j=F.precision,W=F.step;if(f(j))return j;var D=this.getPrecision(M),P=this.getPrecision(W),H=this.getPrecision(E);return E?Math.max(H,D+P):D+P}},{key:"getPrecisionFactor",value:function(E){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.getMaxPrecision(E,M);return Math.pow(10,F)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(E){return this.props.formatter?this.props.formatter(E):E}},{key:"toPrecisionAsStep",value:function(E){if(this.isNotCompleteNumber(E)||E==="")return E;var M=Math.abs(this.getMaxPrecision(E));return isNaN(M)?E.toString():Number(E).toFixed(M)}},{key:"toNumber",value:function(E){var M=this.props.precision,F=this.state.focused,j=E&&E.length>16&&F;return this.isNotCompleteNumber(E)||j?E:f(M)?Math.round(E*Math.pow(10,M))/Math.pow(10,M):Number(E)}},{key:"upStep",value:function(E,M){var F=this.props.step,j=this.getPrecisionFactor(E,M),W=Math.abs(this.getMaxPrecision(E,M)),D=((j*E+j*F*M)/j).toFixed(W);return this.toNumber(D)}},{key:"downStep",value:function(E,M){var F=this.props.step,j=this.getPrecisionFactor(E,M),W=Math.abs(this.getMaxPrecision(E,M)),D=((j*E-j*F*M)/j).toFixed(W);return this.toNumber(D)}},{key:"step",value:function(E,M){var F=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),M&&(M.persist(),M.preventDefault());var D=this.props;if(D.disabled)return;var P=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(P))return;var H=this["".concat(E,"Step")](P,j),Y=H>D.max||H<D.min;if(H>D.max?H=D.max:H<D.min&&(H=D.min),this.setValue(H,null),this.setState({focused:!0},function(){F.pressingUpOrDown=!1}),Y)return;this.autoStepTimer=setTimeout(function(){F[E](M,j,!0)},W?s:w)}},{key:"fixCaret",value:function(E,M){if(E===void 0||M===void 0||!this.input||!this.input.value)return;try{var F=this.input.selectionStart,j=this.input.selectionEnd;(E!==F||M!==j)&&this.input.setSelectionRange(E,M)}catch(W){}}},{key:"render",value:function(){var E,M=this.props,F=M.prefixCls,j=M.disabled,W=M.readOnly,D=M.useTouch,P=M.autoComplete,H=M.upHandler,Y=M.downHandler,ee=M.className,oe=M.max,xe=M.min,ve=M.style,he=M.title,fe=M.onMouseEnter,me=M.onMouseLeave,ae=M.onMouseOver,pe=M.onMouseOut,$=M.required,ne=M.onClick,Q=M.tabIndex,Ee=M.type,we=M.placeholder,ye=M.id,Se=M.inputMode,Le=M.pattern,Oe=M.step,ke=M.maxLength,De=M.autoFocus,Pe=M.name,ze=M.onPaste,$e=M.onInput,We=Object(re.a)(M,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),He=this.state,rt=He.value,Je=He.focused,Qe=b()(F,(E={},Object(V.a)(E,ee,!!ee),Object(V.a)(E,"".concat(F,"-disabled"),j),Object(V.a)(E,"".concat(F,"-focused"),Je),E)),Ae={};Object.keys(We).forEach(function(se){(se.substr(0,5)==="data-"||se.substr(0,5)==="aria-"||se==="role")&&(Ae[se]=We[se])});var et=!W&&!j,Ze=this.getInputDisplayValue(null),Re=(rt||rt===0)&&(isNaN(rt)||Number(rt)>=oe),Fe=(rt||rt===0)&&(isNaN(rt)||Number(rt)<=xe),ge=Re||j||W,ue=Fe||j||W,de=b()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object(V.a)({},"".concat(F,"-handler-up-disabled"),ge)),J=b()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object(V.a)({},"".concat(F,"-handler-down-disabled"),ue)),Z=D?{onTouchStart:ge?d:this.up,onTouchEnd:this.stop}:{onMouseDown:ge?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},te=D?{onTouchStart:ue?d:this.down,onTouchEnd:this.stop}:{onMouseDown:ue?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return k.a.createElement("div",{className:Qe,style:ve,title:he,onMouseEnter:fe,onMouseLeave:me,onMouseOver:ae,onMouseOut:pe,onFocus:function(){return null},onBlur:function(){return null}},k.a.createElement("div",{className:"".concat(F,"-handler-wrap")},k.a.createElement("span",Object.assign({unselectable:"on"},Z,{role:"button","aria-label":"Increase Value","aria-disabled":ge,className:de}),H||k.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-up-inner"),onClick:o})),k.a.createElement("span",Object.assign({unselectable:"on"},te,{role:"button","aria-label":"Decrease Value","aria-disabled":ue,className:J}),Y||k.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-down-inner"),onClick:o}))),k.a.createElement("div",{className:"".concat(F,"-input-wrap")},k.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":xe,"aria-valuemax":oe,"aria-valuenow":rt,required:$,type:Ee,placeholder:we,onPaste:ze,onClick:ne,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:Q,autoComplete:P,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:et?this.onKeyDown:d,onKeyUp:et?this.onKeyUp:d,autoFocus:De,maxLength:ke,readOnly:W,disabled:j,max:oe,min:xe,step:Oe,name:Pe,title:he,id:ye,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ze),pattern:Le,inputMode:Se,onInput:$e},Ae))))}}]),y}(k.a.Component);p.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:g,min:-g,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:u,required:!1,autoComplete:"off"};var h=p,c=Ke.a=h},h78n:function(st,Ke,q){"use strict";q.d(Ke,"a",function(){return E});var re=q("cDcd"),V=q.n(re),A=q("TSYQ"),G=q.n(A),I={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},R=function(j){var W=j.map(function(){return Object(re.useRef)()}),D=Object(re.useRef)();return Object(re.useEffect)(function(){var P=Date.now(),H=!1;Object.keys(W).forEach(function(Y){var ee=W[Y].current;if(!ee)return;H=!0;var oe=ee.style;oe.transitionDuration=".3s, .3s, .3s, .06s",D.current&&P-D.current<100&&(oe.transitionDuration="0s, 0s")}),H&&(D.current=Date.now())}),[W]};function B(){return B=Object.assign||function(F){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var D in W)Object.prototype.hasOwnProperty.call(W,D)&&(F[D]=W[D])}return F},B.apply(this,arguments)}function U(F,j){return O(F)||S(F,j)||L(F,j)||k()}function k(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function L(F,j){if(!F)return;if(typeof F=="string")return b(F,j);var W=Object.prototype.toString.call(F).slice(8,-1);if(W==="Object"&&F.constructor&&(W=F.constructor.name),W==="Map"||W==="Set")return Array.from(F);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return b(F,j)}function b(F,j){(j==null||j>F.length)&&(j=F.length);for(var W=0,D=new Array(j);W<j;W++)D[W]=F[W];return D}function S(F,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var W=[],D=!0,P=!1,H=void 0;try{for(var Y=F[Symbol.iterator](),ee;!(D=(ee=Y.next()).done)&&!(W.push(ee.value),j&&W.length===j);D=!0);}catch(oe){P=!0,H=oe}finally{try{!D&&Y.return!=null&&Y.return()}finally{if(P)throw H}}return W}function O(F){if(Array.isArray(F))return F}function C(F,j){if(F==null)return{};var W=x(F,j),D,P;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(F);for(P=0;P<H.length;P++){if(D=H[P],j.indexOf(D)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,D))continue;W[D]=F[D]}}return W}function x(F,j){if(F==null)return{};var W={},D=Object.keys(F),P,H;for(H=0;H<D.length;H++){if(P=D[H],j.indexOf(P)>=0)continue;W[P]=F[P]}return W}var v=function(j){var W=j.className,D=j.percent,P=j.prefixCls,H=j.strokeColor,Y=j.strokeLinecap,ee=j.strokeWidth,oe=j.style,xe=j.trailColor,ve=j.trailWidth,he=j.transition,fe=C(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete fe.gapPosition;var me=Array.isArray(D)?D:[D],ae=Array.isArray(H)?H:[H],pe=R(me),$=U(pe,1),ne=$[0],Q=ee/2,Ee=100-ee/2,we="M ".concat(Y==="round"?Q:0,",").concat(Q,`
L `).concat(Y==="round"?Ee:100,",").concat(Q),ye="0 0 100 ".concat(ee),Se=0;return V.a.createElement("svg",B({className:G()("".concat(P,"-line"),W),viewBox:ye,preserveAspectRatio:"none",style:oe},fe),V.a.createElement("path",{className:"".concat(P,"-line-trail"),d:we,strokeLinecap:Y,stroke:xe,strokeWidth:ve||ee,fillOpacity:"0"}),me.map(function(Le,Oe){var ke={strokeDasharray:"".concat(Le,"px, 100px"),strokeDashoffset:"-".concat(Se,"px"),transition:he||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},De=ae[Oe]||ae[ae.length-1];return Se+=Le,V.a.createElement("path",{key:Oe,className:"".concat(P,"-line-path"),d:we,strokeLinecap:Y,stroke:De,strokeWidth:ee,fillOpacity:"0",ref:ne[Oe],style:ke})}))};v.defaultProps=I;var d=v;function o(){return o=Object.assign||function(F){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var D in W)Object.prototype.hasOwnProperty.call(W,D)&&(F[D]=W[D])}return F},o.apply(this,arguments)}function u(F,j){return _(F)||f(F,j)||w(F,j)||s()}function s(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w(F,j){if(!F)return;if(typeof F=="string")return g(F,j);var W=Object.prototype.toString.call(F).slice(8,-1);if(W==="Object"&&F.constructor&&(W=F.constructor.name),W==="Map"||W==="Set")return Array.from(F);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return g(F,j)}function g(F,j){(j==null||j>F.length)&&(j=F.length);for(var W=0,D=new Array(j);W<j;W++)D[W]=F[W];return D}function f(F,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var W=[],D=!0,P=!1,H=void 0;try{for(var Y=F[Symbol.iterator](),ee;!(D=(ee=Y.next()).done)&&!(W.push(ee.value),j&&W.length===j);D=!0);}catch(oe){P=!0,H=oe}finally{try{!D&&Y.return!=null&&Y.return()}finally{if(P)throw H}}return W}function _(F){if(Array.isArray(F))return F}function p(F,j){if(F==null)return{};var W=h(F,j),D,P;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(F);for(P=0;P<H.length;P++){if(D=H[P],j.indexOf(D)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,D))continue;W[D]=F[D]}}return W}function h(F,j){if(F==null)return{};var W={},D=Object.keys(F),P,H;for(H=0;H<D.length;H++){if(P=D[H],j.indexOf(P)>=0)continue;W[P]=F[P]}return W}var c=0;function l(F){return+F.replace("%","")}function a(F){return Array.isArray(F)?F:[F]}function y(F,j,W,D){var P=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,H=arguments.length>5?arguments[5]:void 0,Y=50-D/2,ee=0,oe=-Y,xe=0,ve=-2*Y;switch(H){case"left":ee=-Y,oe=0,xe=2*Y,ve=0;break;case"right":ee=Y,oe=0,xe=-2*Y,ve=0;break;case"bottom":oe=Y,ve=2*Y;break;default:}var he="M 50,50 m ".concat(ee,",").concat(oe,`
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(xe,",").concat(-ve,`
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(-xe,",").concat(ve),fe=Math.PI*2*Y,me={stroke:W,strokeDasharray:"".concat(j/100*(fe-P),"px ").concat(fe,"px"),strokeDashoffset:"-".concat(P/2+F/100*(fe-P),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:he,pathStyle:me}}var m=function(j){var W=j.prefixCls,D=j.strokeWidth,P=j.trailWidth,H=j.gapDegree,Y=j.gapPosition,ee=j.trailColor,oe=j.strokeLinecap,xe=j.style,ve=j.className,he=j.strokeColor,fe=j.percent,me=p(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ae=Object(re.useMemo)(function(){return c+=1,c},[]),pe=y(0,100,ee,D,H,Y),$=pe.pathString,ne=pe.pathStyle,Q=a(fe),Ee=a(he),we=Ee.find(function(ke){return Object.prototype.toString.call(ke)==="[object Object]"}),ye=R(Q),Se=u(ye,1),Le=Se[0],Oe=function(){var De=0;return Q.map(function(Pe,ze){var $e=Ee[ze]||Ee[Ee.length-1],We=Object.prototype.toString.call($e)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ae,")"):"",He=y(De,Pe,$e,D,H,Y);return De+=Pe,V.a.createElement("path",{key:ze,className:"".concat(W,"-circle-path"),d:He.pathString,stroke:We,strokeLinecap:oe,strokeWidth:D,opacity:Pe===0?0:1,fillOpacity:"0",style:He.pathStyle,ref:Le[ze]})})};return V.a.createElement("svg",o({className:G()("".concat(W,"-circle"),ve),viewBox:"0 0 100 100",style:xe},me),we&&V.a.createElement("defs",null,V.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(ae),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(we).sort(function(ke,De){return l(ke)-l(De)}).map(function(ke,De){return V.a.createElement("stop",{key:De,offset:ke,stopColor:we[ke]})}))),V.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:$,stroke:ee,strokeLinecap:oe,strokeWidth:P||D,fillOpacity:"0",style:ne}),Oe().reverse())};m.defaultProps=I;var E=m,M={Line:d,Circle:E}},kSUc:function(st,Ke,q){},lYpw:function(st,Ke,q){st.exports={flex_box_center:"flex_box_center___3D7LV",flex_space_between:"flex_space_between___2Jo8y",flex_box_vertical_center:"flex_box_vertical_center___3g7rr",flex_box_center_end:"flex_box_center_end___1WMPu",flex_box_column:"flex_box_column___37nyR",bg:"bg___22rVB",title:"title___FxZ0V",titleLeft:"titleLeft___1O0pm",titleRight:"titleRight___13DWe",btns:"btns___x4l1O"}},lZu9:function(st,Ke,q){(function(re){re(q("VrN/"),q("1eCo"),q("8EBN"))})(function(re){"use strict";re.defineMode("markdown",function(V,A){var G=re.getMode(V,"text/html"),I=G.name=="null";function R(D){if(re.findModeByName){var P=re.findModeByName(D);P&&(D=P.mime||P.mimes[0])}var H=re.getMode(V,D);return H.name=="null"?null:H}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 B={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var U in B)B.hasOwnProperty(U)&&A.tokenTypeOverrides[U]&&(B[U]=A.tokenTypeOverrides[U]);var k=/^([*\-_])(?:\s*\1){2,}\s*$/,L=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,b=/^\[(x| )\](?=\s)/i,S=A.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,O=/^ {0,3}(?:\={1,}|-{2,})\s*$/,C=/^[^#!\[\]*_\\<>` "'(~:]+/,x=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,v=/^\s*\[[^\]]+?\]:.*$/,d=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function u(D,P,H){return P.f=P.inline=H,H(D,P)}function s(D,P,H){return P.f=P.block=H,H(D,P)}function w(D){return!D||!/\S/.test(D.string)}function g(D){if(D.linkTitle=!1,D.linkHref=!1,D.linkText=!1,D.em=!1,D.strong=!1,D.strikethrough=!1,D.quote=0,D.indentedCode=!1,D.f==_){var P=I;if(!P){var H=re.innerMode(G,D.htmlState);P=H.mode.name=="xml"&&H.state.tagStart===null&&!H.state.context&&H.state.tokenize.isInText}P&&(D.f=l,D.block=f,D.htmlState=null)}return D.trailingSpace=0,D.trailingSpaceNewLine=!1,D.prevLine=D.thisLine,D.thisLine={stream:null},null}function f(D,P){var H=D.column()===P.indentation,Y=w(P.prevLine.stream),ee=P.indentedCode,oe=P.prevLine.hr,xe=P.list!==!1,ve=(P.listStack[P.listStack.length-1]||0)+3;P.indentedCode=!1;var he=P.indentation;if(P.indentationDiff===null&&(P.indentationDiff=P.indentation,xe)){for(P.list=null;he<P.listStack[P.listStack.length-1];)P.listStack.pop(),P.listStack.length?P.indentation=P.listStack[P.listStack.length-1]:P.list=!1;P.list!==!1&&(P.indentationDiff=he-P.listStack[P.listStack.length-1])}var fe=!Y&&!oe&&!P.prevLine.header&&(!xe||!ee)&&!P.prevLine.fencedCodeEnd,me=(P.list===!1||oe||Y)&&P.indentation<=ve&&D.match(k),ae=null;if(P.indentationDiff>=4&&(ee||P.prevLine.fencedCodeEnd||P.prevLine.header||Y))return D.skipToEnd(),P.indentedCode=!0,B.code;if(D.eatSpace())return null;if(H&&P.indentation<=ve&&(ae=D.match(S))&&ae[1].length<=6)return P.quote=0,P.header=ae[1].length,P.thisLine.header=!0,A.highlightFormatting&&(P.formatting="header"),P.f=P.inline,h(P);if(P.indentation<=ve&&D.eat(">"))return P.quote=H?1:P.quote+1,A.highlightFormatting&&(P.formatting="quote"),D.eatSpace(),h(P);if(!me&&!P.setext&&H&&P.indentation<=ve&&(ae=D.match(L))){var pe=ae[1]?"ol":"ul";return P.indentation=he+D.current().length,P.list=!0,P.quote=0,P.listStack.push(P.indentation),P.em=!1,P.strong=!1,P.code=!1,P.strikethrough=!1,A.taskLists&&D.match(b,!1)&&(P.taskList=!0),P.f=P.inline,A.highlightFormatting&&(P.formatting=["list","list-"+pe]),h(P)}else{if(H&&P.indentation<=ve&&(ae=D.match(x,!0)))return P.quote=0,P.fencedEndRE=new RegExp(ae[1]+"+ *$"),P.localMode=A.fencedCodeBlockHighlighting&&R(ae[2]||A.fencedCodeBlockDefaultMode),P.localMode&&(P.localState=re.startState(P.localMode)),P.f=P.block=p,A.highlightFormatting&&(P.formatting="code-block"),P.code=-1,h(P);if(P.setext||(!fe||!xe)&&!P.quote&&P.list===!1&&!P.code&&!me&&!v.test(D.string)&&(ae=D.lookAhead(1))&&(ae=ae.match(O)))return P.setext?(P.header=P.setext,P.setext=0,D.skipToEnd(),A.highlightFormatting&&(P.formatting="header")):(P.header=ae[0].charAt(0)=="="?1:2,P.setext=P.header),P.thisLine.header=!0,P.f=P.inline,h(P);if(me)return D.skipToEnd(),P.hr=!0,P.thisLine.hr=!0,B.hr;if(D.peek()==="[")return u(D,P,M)}return u(D,P,P.inline)}function _(D,P){var H=G.token(D,P.htmlState);if(!I){var Y=re.innerMode(G,P.htmlState);(Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText||P.md_inside&&D.current().indexOf(">")>-1)&&(P.f=l,P.block=f,P.htmlState=null)}return H}function p(D,P){var H=P.listStack[P.listStack.length-1]||0,Y=P.indentation<H,ee=H+3;if(P.fencedEndRE&&P.indentation<=ee&&(Y||D.match(P.fencedEndRE))){A.highlightFormatting&&(P.formatting="code-block");var oe;return Y||(oe=h(P)),P.localMode=P.localState=null,P.block=f,P.f=l,P.fencedEndRE=null,P.code=0,P.thisLine.fencedCodeEnd=!0,Y?s(D,P,P.block):oe}else return P.localMode?P.localMode.token(D,P.localState):(D.skipToEnd(),B.code)}function h(D){var P=[];if(D.formatting){P.push(B.formatting),typeof D.formatting=="string"&&(D.formatting=[D.formatting]);for(var H=0;H<D.formatting.length;H++)P.push(B.formatting+"-"+D.formatting[H]),D.formatting[H]==="header"&&P.push(B.formatting+"-"+D.formatting[H]+"-"+D.header),D.formatting[H]==="quote"&&(!A.maxBlockquoteDepth||A.maxBlockquoteDepth>=D.quote?P.push(B.formatting+"-"+D.formatting[H]+"-"+D.quote):P.push("error"))}if(D.taskOpen)return P.push("meta"),P.length?P.join(" "):null;if(D.taskClosed)return P.push("property"),P.length?P.join(" "):null;if(D.linkHref?P.push(B.linkHref,"url"):(D.strong&&P.push(B.strong),D.em&&P.push(B.em),D.strikethrough&&P.push(B.strikethrough),D.emoji&&P.push(B.emoji),D.linkText&&P.push(B.linkText),D.code&&P.push(B.code),D.image&&P.push(B.image),D.imageAltText&&P.push(B.imageAltText,"link"),D.imageMarker&&P.push(B.imageMarker)),D.header&&P.push(B.header,B.header+"-"+D.header),D.quote&&(P.push(B.quote),!A.maxBlockquoteDepth||A.maxBlockquoteDepth>=D.quote?P.push(B.quote+"-"+D.quote):P.push(B.quote+"-"+A.maxBlockquoteDepth)),D.list!==!1){var Y=(D.listStack.length-1)%3;Y?Y===1?P.push(B.list2):P.push(B.list3):P.push(B.list1)}return D.trailingSpaceNewLine?P.push("trailing-space-new-line"):D.trailingSpace&&P.push("trailing-space-"+(D.trailingSpace%2?"a":"b")),P.length?P.join(" "):null}function c(D,P){return D.match(C,!0)?h(P):void 0}function l(D,P){var H=P.text(D,P);if(typeof H!="undefined")return H;if(P.list)return P.list=null,h(P);if(P.taskList){var Y=D.match(b,!0)[1]===" ";return Y?P.taskOpen=!0:P.taskClosed=!0,A.highlightFormatting&&(P.formatting="task"),P.taskList=!1,h(P)}if(P.taskOpen=!1,P.taskClosed=!1,P.header&&D.match(/^#+$/,!0))return A.highlightFormatting&&(P.formatting="header"),h(P);var ee=D.next();if(P.linkTitle){P.linkTitle=!1;var oe=ee;ee==="("&&(oe=")"),oe=(oe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var xe="^\\s*(?:[^"+oe+"\\\\]+|\\\\\\\\|\\\\.)"+oe;if(D.match(new RegExp(xe),!0))return B.linkHref}if(ee==="`"){var ve=P.formatting;A.highlightFormatting&&(P.formatting="code"),D.eatWhile("`");var he=D.current().length;if(P.code==0&&(!P.quote||he==1))return P.code=he,h(P);if(he==P.code){var fe=h(P);return P.code=0,fe}else return P.formatting=ve,h(P)}else if(P.code)return h(P);if(ee==="\\"&&(D.next(),A.highlightFormatting)){var me=h(P),ae=B.formatting+"-escape";return me?me+" "+ae:ae}if(ee==="!"&&D.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return P.imageMarker=!0,P.image=!0,A.highlightFormatting&&(P.formatting="image"),h(P);if(ee==="["&&P.imageMarker&&D.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return P.imageMarker=!1,P.imageAltText=!0,A.highlightFormatting&&(P.formatting="image"),h(P);if(ee==="]"&&P.imageAltText){A.highlightFormatting&&(P.formatting="image");var me=h(P);return P.imageAltText=!1,P.image=!1,P.inline=P.f=y,me}if(ee==="["&&!P.image)return P.linkText&&D.match(/^.*?\]/)||(P.linkText=!0,A.highlightFormatting&&(P.formatting="link")),h(P);if(ee==="]"&&P.linkText){A.highlightFormatting&&(P.formatting="link");var me=h(P);return P.linkText=!1,P.inline=P.f=D.match(/\(.*?\)| ?\[.*?\]/,!1)?y:l,me}if(ee==="<"&&D.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){P.f=P.inline=a,A.highlightFormatting&&(P.formatting="link");var me=h(P);return me?me+=" ":me="",me+B.linkInline}if(ee==="<"&&D.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){P.f=P.inline=a,A.highlightFormatting&&(P.formatting="link");var me=h(P);return me?me+=" ":me="",me+B.linkEmail}if(A.xml&&ee==="<"&&D.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var pe=D.string.indexOf(">",D.pos);if(pe!=-1){var $=D.string.substring(D.start,pe);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test($)&&(P.md_inside=!0)}return D.backUp(1),P.htmlState=re.startState(G),s(D,P,_)}if(A.xml&&ee==="<"&&D.match(/^\/\w*?>/))return P.md_inside=!1,"tag";if(ee==="*"||ee==="_"){for(var ne=1,Q=D.pos==1?" ":D.string.charAt(D.pos-2);ne<3&&D.eat(ee);)ne++;var Ee=D.peek()||" ",we=!/\s/.test(Ee)&&(!d.test(Ee)||/\s/.test(Q)||d.test(Q)),ye=!/\s/.test(Q)&&(!d.test(Q)||/\s/.test(Ee)||d.test(Ee)),Se=null,Le=null;if(ne%2&&(!P.em&&we&&(ee==="*"||!ye||d.test(Q))?Se=!0:P.em==ee&&ye&&(ee==="*"||!we||d.test(Ee))&&(Se=!1)),ne>1&&(!P.strong&&we&&(ee==="*"||!ye||d.test(Q))?Le=!0:P.strong==ee&&ye&&(ee==="*"||!we||d.test(Ee))&&(Le=!1)),Le!=null||Se!=null){A.highlightFormatting&&(P.formatting=Se==null?"strong":Le==null?"em":"strong em"),Se===!0&&(P.em=ee),Le===!0&&(P.strong=ee);var fe=h(P);return Se===!1&&(P.em=!1),Le===!1&&(P.strong=!1),fe}}else if(ee===" "&&(D.eat("*")||D.eat("_"))){if(D.peek()===" ")return h(P);D.backUp(1)}if(A.strikethrough){if(ee==="~"&&D.eatWhile(ee)){if(P.strikethrough){A.highlightFormatting&&(P.formatting="strikethrough");var fe=h(P);return P.strikethrough=!1,fe}else if(D.match(/^[^\s]/,!1))return P.strikethrough=!0,A.highlightFormatting&&(P.formatting="strikethrough"),h(P)}else if(ee===" "&&D.match(/^~~/,!0)){if(D.peek()===" ")return h(P);D.backUp(2)}}if(A.emoji&&ee===":"&&D.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){P.emoji=!0,A.highlightFormatting&&(P.formatting="emoji");var Oe=h(P);return P.emoji=!1,Oe}return ee===" "&&(D.match(/^ +$/,!1)?P.trailingSpace++:P.trailingSpace&&(P.trailingSpaceNewLine=!0)),h(P)}function a(D,P){var H=D.next();if(H===">"){P.f=P.inline=l,A.highlightFormatting&&(P.formatting="link");var Y=h(P);return Y?Y+=" ":Y="",Y+B.linkInline}return D.match(/^[^>]+/,!0),B.linkInline}function y(D,P){if(D.eatSpace())return null;var H=D.next();return H==="("||H==="["?(P.f=P.inline=E(H==="("?")":"]"),A.highlightFormatting&&(P.formatting="link-string"),P.linkHref=!0,h(P)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function E(D){return function(P,H){var Y=P.next();if(Y===D){H.f=H.inline=l,A.highlightFormatting&&(H.formatting="link-string");var ee=h(H);return H.linkHref=!1,ee}return P.match(m[D]),H.linkHref=!0,h(H)}}function M(D,P){return D.match(/^([^\]\\]|\\.)*\]:/,!1)?(P.f=F,D.next(),A.highlightFormatting&&(P.formatting="link"),P.linkText=!0,h(P)):u(D,P,l)}function F(D,P){if(D.match(/^\]:/,!0)){P.f=P.inline=j,A.highlightFormatting&&(P.formatting="link");var H=h(P);return P.linkText=!1,H}return D.match(/^([^\]\\]|\\.)+/,!0),B.linkText}function j(D,P){return D.eatSpace()?null:(D.match(/^[^\s]+/,!0),D.peek()===void 0?P.linkTitle=!0:D.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),P.f=P.inline=l,B.linkHref+" url")}var W={startState:function(){return{f,prevLine:{stream:null},thisLine:{stream:null},block:f,htmlState:null,indentation:0,inline:l,text:c,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(D){return{f:D.f,prevLine:D.prevLine,thisLine:D.thisLine,block:D.block,htmlState:D.htmlState&&re.copyState(G,D.htmlState),indentation:D.indentation,localMode:D.localMode,localState:D.localMode?re.copyState(D.localMode,D.localState):null,inline:D.inline,text:D.text,formatting:!1,linkText:D.linkText,linkTitle:D.linkTitle,linkHref:D.linkHref,code:D.code,em:D.em,strong:D.strong,strikethrough:D.strikethrough,emoji:D.emoji,header:D.header,setext:D.setext,hr:D.hr,taskList:D.taskList,list:D.list,listStack:D.listStack.slice(0),quote:D.quote,indentedCode:D.indentedCode,trailingSpace:D.trailingSpace,trailingSpaceNewLine:D.trailingSpaceNewLine,md_inside:D.md_inside,fencedEndRE:D.fencedEndRE}},token:function(D,P){if(P.formatting=!1,D!=P.thisLine.stream){if(P.header=0,P.hr=!1,D.match(/^\s*$/,!0))return g(P),null;if(P.prevLine=P.thisLine,P.thisLine={stream:D},P.taskList=!1,P.trailingSpace=0,P.trailingSpaceNewLine=!1,!P.localState&&(P.f=P.block,P.f!=_)){var H=D.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(P.indentation=H,P.indentationDiff=null,H>0)return null}}return P.f(D,P)},innerMode:function(D){return D.block==_?{state:D.htmlState,mode:G}:D.localState?{state:D.localState,mode:D.localMode}:{state:D,mode:W}},indent:function(D,P,H){return D.block==_&&G.indent?G.indent(D.htmlState,P,H):D.localState&&D.localMode.indent?D.localMode.indent(D.localState,P,H):re.Pass},blankLine:g,getType:h,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),re.defineMIME("text/markdown","markdown"),re.defineMIME("text/x-markdown","markdown")})},osHv:function(st,Ke,q){(function(re){re(q("VrN/"))})(function(re){"use strict";var V=re.Pos;function A(d,o){return d.line-o.line||d.ch-o.ch}var G="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",I=G+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",R=new RegExp("<(/?)(["+G+"]["+I+"]*)","g");function B(d,o,u,s){this.line=o,this.ch=u,this.cm=d,this.text=d.getLine(o),this.min=s?Math.max(s.from,d.firstLine()):d.firstLine(),this.max=s?Math.min(s.to-1,d.lastLine()):d.lastLine()}function U(d,o){var u=d.cm.getTokenTypeAt(V(d.line,o));return u&&/\btag\b/.test(u)}function k(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function L(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function b(d){for(;;){var o=d.text.indexOf(">",d.ch);if(o==-1){if(k(d))continue;return}if(!U(d,o+1)){d.ch=o+1;continue}var u=d.text.lastIndexOf("/",o),s=u>-1&&!/\S/.test(d.text.slice(u+1,o));return d.ch=o+1,s?"selfClose":"regular"}}function S(d){for(;;){var o=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(o==-1){if(L(d))continue;return}if(!U(d,o+1)){d.ch=o;continue}R.lastIndex=o,d.ch=o;var u=R.exec(d.text);if(u&&u.index==o)return u}}function O(d){for(;;){R.lastIndex=d.ch;var o=R.exec(d.text);if(!o){if(k(d))continue;return}if(!U(d,o.index+1)){d.ch=o.index+1;continue}return d.ch=o.index+o[0].length,o}}function C(d){for(;;){var o=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(o==-1){if(L(d))continue;return}if(!U(d,o+1)){d.ch=o;continue}var u=d.text.lastIndexOf("/",o),s=u>-1&&!/\S/.test(d.text.slice(u+1,o));return d.ch=o+1,s?"selfClose":"regular"}}function x(d,o){for(var u=[];;){var s=O(d),w,g=d.line,f=d.ch-(s?s[0].length:0);if(!s||!(w=b(d)))return;if(w=="selfClose")continue;if(s[1]){for(var _=u.length-1;_>=0;--_)if(u[_]==s[2]){u.length=_;break}if(_<0&&(!o||o==s[2]))return{tag:s[2],from:V(g,f),to:V(d.line,d.ch)}}else u.push(s[2])}}function v(d,o){for(var u=[];;){var s=C(d);if(!s)return;if(s=="selfClose"){S(d);continue}var w=d.line,g=d.ch,f=S(d);if(!f)return;if(f[1])u.push(f[2]);else{for(var _=u.length-1;_>=0;--_)if(u[_]==f[2]){u.length=_;break}if(_<0&&(!o||o==f[2]))return{tag:f[2],from:V(d.line,d.ch),to:V(w,g)}}}}re.registerHelper("fold","xml",function(d,o){for(var u=new B(d,o.line,0);;){var s=O(u);if(!s||u.line!=o.line)return;var w=b(u);if(!w)return;if(!s[1]&&w!="selfClose"){var g=V(u.line,u.ch),f=x(u,s[2]);return f&&A(f.from,g)>0?{from:g,to:f.from}:null}}}),re.findMatchingTag=function(d,o,u){var s=new B(d,o.line,o.ch,u);if(s.text.indexOf(">")==-1&&s.text.indexOf("<")==-1)return;var w=b(s),g=w&&V(s.line,s.ch),f=w&&S(s);if(!w||!f||A(s,o)>0)return;var _={from:V(s.line,s.ch),to:g,tag:f[2]};return w=="selfClose"?{open:_,close:null,at:"open"}:f[1]?{open:v(s,f[2]),close:_,at:"close"}:(s=new B(d,g.line,g.ch,u),{open:_,close:x(s,f[2]),at:"open"})},re.findEnclosingTag=function(d,o,u,s){for(var w=new B(d,o.line,o.ch,u);;){var g=v(w,s);if(!g)break;var f=new B(d,o.line,o.ch,u),_=x(f,g.tag);if(_)return{open:g,close:_}}},re.scanForClosingTag=function(d,o,u,s){var w=new B(d,o.line,o.ch,s?{from:0,to:s}:null);return x(w,u)}})},p5ED:function(st,Ke,q){"use strict";var re=q("+L6B"),V=q("2/Rp"),A=q("5Dmo"),G=q("3S7+"),I=q("k1fw"),R=q("tJVT"),B=q("cDcd"),U=q.n(B),k=q("vHTk"),L=q.n(k),b=q("yEEn"),S=q("ZW9T"),O=q("1vsH");Ke.a=function(C){var x=C.name,v=C.data,d=C.theme,o=C.type,u=C.filename,s=C.monacoEditor,w=C.className,g=C.style,f=C.close,_=C.onClose,p=C.hasMask,h=Object(B.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),c=Object(R.a)(h,2),l=c[0],a=c[1],y=Object(B.useState)(""),m=Object(R.a)(y,2),E=m[0],M=m[1],F,j=1024*1024,W=10*j,D=Object(B.useRef)();o==="office"&&(F=Object(O.V)(v).filesize,F>W&&(o="other")),u&&(s.filename=u),Object(B.useEffect)(function(){var Y,ee,oe=(Y=document.cookie)===null||Y===void 0||((ee=Y.replace(/\s/g,""))===null||ee===void 0)?void 0:ee.split(";");oe==null||oe.map(function(xe){var ve=xe.split("=");ve[0]==="_educoder_session"&&M(ve[1])})},[]);var P=function(){if(v.startsWith("http")||v.startsWith("/")){H();return}Object(O.z)(u||"educoder",v,u)},H=function(){Object(O.x)(u||x,v)};return console.log("data:",v,"fileanme:",u," name:",x),U.a.createElement("div",{style:Object(I.a)({},g||{}),className:"".concat(p&&L.a.bgBlack," ").concat(o?L.a.wrp:"hide")},f&&U.a.createElement("div",{className:L.a.close,ref:D},U.a.createElement(G.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return D.current}},U.a.createElement("span",{onClick:H},U.a.createElement("i",{className:"icon-quxiaozhiding"}))),U.a.createElement(G.a,{title:"\u5173\u95ED",getPopupContainer:function(){return D.current}},U.a.createElement("span",{className:"",onClick:_},U.a.createElement("i",{className:"icon-guanbi1"})))),U.a.createElement("div",{className:"".concat(L.a[w]," ").concat(w," ").concat(L.a.monaco," ").concat(o==="txt"?"show":"hide")},o==="txt"&&U.a.createElement(S.b,s)),o==="audio"&&U.a.createElement("audio",{src:"".concat(v!=null&&v.startsWith("/")||(v==null?void 0:v.indexOf("https://"))>-1?v:"data:audio/mp3;base64,").concat(v),autoPlay:!0}),o==="video"&&U.a.createElement(U.a.Fragment,null,v!=null&&v.startsWith("/")?U.a.createElement("video",{controls:!0,src:"".concat(v),autoPlay:!0}):U.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(v),autoPlay:!0})),o==="html"&&U.a.createElement("iframe",{src:v+"&disposition=inline"}),o==="pdf"&&U.a.createElement("embed",{className:L.a.embed,src:v}),o==="image"&&U.a.createElement(U.a.Fragment,null,U.a.createElement("img",{src:"".concat(v!=null&&v.startsWith("/")||(v==null?void 0:v.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(v)})),o==="other"&&U.a.createElement("div",null,U.a.createElement(V.a,{type:"primary",size:"large",onClick:P},U.a.createElement(b.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&U.a.createElement(V.a,{type:"primary",size:"large",onClick:P},U.a.createElement(b.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(st,Ke,q){},"rAM+":function(st,Ke,q){"use strict";q.d(Ke,"a",function(){return V});var re=q("Qw5x");function V(A,G){var I;if(typeof Symbol=="undefined"||A[Symbol.iterator]==null){if(Array.isArray(A)||(I=Object(re.a)(A))||G&&A&&typeof A.length=="number"){I&&(A=I);var R=0,B=function(){};return{s:B,n:function(){return R>=A.length?{done:!0}:{done:!1,value:A[R++]}},e:function(S){throw S},f:B}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var U=!0,k=!1,L;return{s:function(){I=A[Symbol.iterator]()},n:function(){var S=I.next();return U=S.done,S},e:function(S){k=!0,L=S},f:function(){try{!U&&I.return!=null&&I.return()}finally{if(k)throw L}}}}},rUJ1:function(st,Ke){const q=/[&<>"']/,re=/[&<>"']/g,V=/[<>"']|&(?!#?\w+;)/,A=/[<>"']|&(?!#?\w+;)/g,G={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},I=p=>G[p];function R(p,h){if(h){if(q.test(p))return p.replace(re,I)}else if(V.test(p))return p.replace(A,I);return p}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function U(p){return p.replace(B,(h,c)=>(c=c.toLowerCase(),c==="colon"?":":c.charAt(0)==="#"?c.charAt(1)==="x"?String.fromCharCode(parseInt(c.substring(2),16)):String.fromCharCode(+c.substring(1)):""))}const k=/(^|[^\[])\^/g;function L(p,h){p=p.source||p,h=h||"";const c={replace:(l,a)=>(a=a.source||a,a=a.replace(k,"$1"),p=p.replace(l,a),c),getRegex:()=>new RegExp(p,h)};return c}const b=/[^\w:]/g,S=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(p,h,c){if(p){let l;try{l=decodeURIComponent(U(c)).replace(b,"").toLowerCase()}catch(a){return null}if(l.indexOf("javascript:")===0||l.indexOf("vbscript:")===0||l.indexOf("data:")===0)return null}h&&!S.test(c)&&(c=o(h,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(l){return null}return c}const C={},x=/^[^:]+:\/*[^/]*$/,v=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(p,h){C[" "+p]||(x.test(p)?C[" "+p]=p+"/":C[" "+p]=g(p,"/",!0)),p=C[" "+p];const c=p.indexOf(":")===-1;return h.substring(0,2)==="//"?c?h:p.replace(v,"$1")+h:h.charAt(0)==="/"?c?h:p.replace(d,"$1")+h:p+h}const u={exec:function(){}};function s(p){let h=1,c,l;for(;h<arguments.length;h++){c=arguments[h];for(l in c)Object.prototype.hasOwnProperty.call(c,l)&&(p[l]=c[l])}return p}function w(p,h){const c=p.replace(/\|/g,(y,m,E)=>{let M=!1,F=m;for(;--F>=0&&E[F]==="\\";)M=!M;return M?"|":" |"}),l=c.split(/ \|/);let a=0;if(l.length>h)l.splice(h);else for(;l.length<h;)l.push("");for(;a<l.length;a++)l[a]=l[a].trim().replace(/\\\|/g,"|");return l}function g(p,h,c){const l=p.length;if(l===0)return"";let a=0;for(;a<l;){const y=p.charAt(l-a-1);if(y===h&&!c)a++;else if(y!==h&&c)a++;else break}return p.substr(0,l-a)}function f(p,h){if(p.indexOf(h[1])===-1)return-1;const c=p.length;let l=0,a=0;for(;a<c;a++)if(p[a]==="\\")a++;else if(p[a]===h[0])l++;else if(p[a]===h[1]&&(l--,l<0))return a;return-1}function _(p){p&&p.sanitize&&!p.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")}st.exports={escape:R,unescape:U,edit:L,cleanUrl:O,resolveUrl:o,noopTest:u,merge:s,splitCells:w,rtrim:g,findClosingBracket:f,checkSanitizeDeprecation:_}},ulZh:function(st,Ke,q){typeof window!="undefined"&&function(V,A){st.exports=A()}(this,function(){return function(re){var V={};function A(G){if(V[G])return V[G].exports;var I=V[G]={i:G,l:!1,exports:{}};return re[G].call(I.exports,I,I.exports,A),I.l=!0,I.exports}return A.m=re,A.c=V,A.d=function(G,I,R){A.o(G,I)||Object.defineProperty(G,I,{enumerable:!0,get:R})},A.r=function(G){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(G,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(G,"__esModule",{value:!0})},A.t=function(G,I){if(I&1&&(G=A(G)),I&8)return G;if(I&4&&typeof G=="object"&&G&&G.__esModule)return G;var R=Object.create(null);if(A.r(R),Object.defineProperty(R,"default",{enumerable:!0,value:G}),I&2&&typeof G!="string")for(var B in G)A.d(R,B,function(U){return G[U]}.bind(null,B));return R},A.n=function(G){var I=G&&G.__esModule?function(){return G.default}:function(){return G};return A.d(I,"a",I),I},A.o=function(G,I){return Object.prototype.hasOwnProperty.call(G,I)},A.p="/dist/",A(A.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(re,V,A){"use strict";var G=Object.prototype.hasOwnProperty,I="~";function R(){}Object.create&&(R.prototype=Object.create(null),new R().__proto__||(I=!1));function B(b,S,O){this.fn=b,this.context=S,this.once=O||!1}function U(b,S,O,C,x){if(typeof O!="function")throw new TypeError("The listener must be a function");var v=new B(O,C||b,x),d=I?I+S:S;return b._events[d]?b._events[d].fn?b._events[d]=[b._events[d],v]:b._events[d].push(v):(b._events[d]=v,b._eventsCount++),b}function k(b,S){--b._eventsCount===0?b._events=new R:delete b._events[S]}function L(){this._events=new R,this._eventsCount=0}L.prototype.eventNames=function(){var S=[],O,C;if(this._eventsCount===0)return S;for(C in O=this._events)G.call(O,C)&&S.push(I?C.slice(1):C);return Object.getOwnPropertySymbols?S.concat(Object.getOwnPropertySymbols(O)):S},L.prototype.listeners=function(S){var O=I?I+S:S,C=this._events[O];if(!C)return[];if(C.fn)return[C.fn];for(var x=0,v=C.length,d=new Array(v);x<v;x++)d[x]=C[x].fn;return d},L.prototype.listenerCount=function(S){var O=I?I+S:S,C=this._events[O];return C?C.fn?1:C.length:0},L.prototype.emit=function(S,O,C,x,v,d){var o=I?I+S:S;if(!this._events[o])return!1;var u=this._events[o],s=arguments.length,w,g;if(u.fn){u.once&&this.removeListener(S,u.fn,void 0,!0);switch(s){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,O),!0;case 3:return u.fn.call(u.context,O,C),!0;case 4:return u.fn.call(u.context,O,C,x),!0;case 5:return u.fn.call(u.context,O,C,x,v),!0;case 6:return u.fn.call(u.context,O,C,x,v,d),!0}for(g=1,w=new Array(s-1);g<s;g++)w[g-1]=arguments[g];u.fn.apply(u.context,w)}else{var f=u.length,_;for(g=0;g<f;g++){u[g].once&&this.removeListener(S,u[g].fn,void 0,!0);switch(s){case 1:u[g].fn.call(u[g].context);break;case 2:u[g].fn.call(u[g].context,O);break;case 3:u[g].fn.call(u[g].context,O,C);break;case 4:u[g].fn.call(u[g].context,O,C,x);break;default:if(!w)for(_=1,w=new Array(s-1);_<s;_++)w[_-1]=arguments[_];u[g].fn.apply(u[g].context,w)}}}return!0},L.prototype.on=function(S,O,C){return U(this,S,O,C,!1)},L.prototype.once=function(S,O,C){return U(this,S,O,C,!0)},L.prototype.removeListener=function(S,O,C,x){var v=I?I+S:S;if(!this._events[v])return this;if(!O)return k(this,v),this;var d=this._events[v];if(d.fn)d.fn===O&&(!x||d.once)&&(!C||d.context===C)&&k(this,v);else{for(var o=0,u=[],s=d.length;o<s;o++)(d[o].fn!==O||x&&!d[o].once||C&&d[o].context!==C)&&u.push(d[o]);u.length?this._events[v]=u.length===1?u[0]:u:k(this,v)}return this},L.prototype.removeAllListeners=function(S){var O;return S?(O=I?I+S:S,this._events[O]&&k(this,O)):(this._events=new R,this._eventsCount=0),this},L.prototype.off=L.prototype.removeListener,L.prototype.addListener=L.prototype.on,L.prefixed=I,L.EventEmitter=L,re.exports=L},"./node_modules/url-toolkit/src/url-toolkit.js":function(re,V,A){(function(G){var I=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,R=/^([^\/?#]*)([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,U=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,k={buildAbsoluteURL:function(L,b,S){if(S=S||{},L=L.trim(),b=b.trim(),!b){if(!S.alwaysNormalize)return L;var O=k.parseURL(L);if(!O)throw new Error("Error trying to parse base URL.");return O.path=k.normalizePath(O.path),k.buildURLFromParts(O)}var C=k.parseURL(b);if(!C)throw new Error("Error trying to parse relative URL.");if(C.scheme)return S.alwaysNormalize?(C.path=k.normalizePath(C.path),k.buildURLFromParts(C)):b;var x=k.parseURL(L);if(!x)throw new Error("Error trying to parse base URL.");if(!x.netLoc&&x.path&&x.path[0]!=="/"){var v=R.exec(x.path);x.netLoc=v[1],x.path=v[2]}x.netLoc&&!x.path&&(x.path="/");var d={scheme:x.scheme,netLoc:C.netLoc,path:null,params:C.params,query:C.query,fragment:C.fragment};if(!C.netLoc&&(d.netLoc=x.netLoc,C.path[0]!=="/"))if(!C.path)d.path=x.path,C.params||(d.params=x.params,C.query||(d.query=x.query));else{var o=x.path,u=o.substring(0,o.lastIndexOf("/")+1)+C.path;d.path=k.normalizePath(u)}return d.path===null&&(d.path=S.alwaysNormalize?k.normalizePath(C.path):C.path),k.buildURLFromParts(d)},parseURL:function(L){var b=I.exec(L);return b?{scheme:b[1]||"",netLoc:b[2]||"",path:b[3]||"",params:b[4]||"",query:b[5]||"",fragment:b[6]||""}:null},normalizePath:function(L){for(L=L.split("").reverse().join("").replace(B,"");L.length!==(L=L.replace(U,"")).length;);return L.split("").reverse().join("")},buildURLFromParts:function(L){return L.scheme+L.netLoc+L.path+L.params+L.query+L.fragment}};re.exports=k})(this)},"./node_modules/webworkify-webpack/index.js":function(re,V,A){function G(S){var O={};function C(v){if(O[v])return O[v].exports;var d=O[v]={i:v,l:!1,exports:{}};return S[v].call(d.exports,d,d.exports,C),d.l=!0,d.exports}C.m=S,C.c=O,C.i=function(v){return v},C.d=function(v,d,o){C.o(v,d)||Object.defineProperty(v,d,{configurable:!1,enumerable:!0,get:o})},C.r=function(v){Object.defineProperty(v,"__esModule",{value:!0})},C.n=function(v){var d=v&&v.__esModule?function(){return v.default}:function(){return v};return C.d(d,"a",d),d},C.o=function(v,d){return Object.prototype.hasOwnProperty.call(v,d)},C.p="/",C.oe=function(v){throw console.error(v),v};var x=C(C.s=ENTRY_MODULE);return x.default||x}var I="[\\.|\\-|\\+|\\w|/|@]+",R="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+I+").*?\\)";function B(S){return(S+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function U(S){return!isNaN(1*S)}function k(S,O,C){var x={};x[C]=[];var v=O.toString(),d=v.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return x;for(var o=d[1],u=new RegExp("(\\\\n|\\W)"+B(o)+R,"g"),s;s=u.exec(v);){if(s[3]==="dll-reference")continue;x[C].push(s[3])}for(u=new RegExp("\\("+B(o)+'\\("(dll-reference\\s('+I+'))"\\)\\)'+R,"g");s=u.exec(v);)S[s[2]]||(x[C].push(s[1]),S[s[2]]=A(s[1]).m),x[s[2]]=x[s[2]]||[],x[s[2]].push(s[4]);for(var w=Object.keys(x),g=0;g<w.length;g++)for(var f=0;f<x[w[g]].length;f++)U(x[w[g]][f])&&(x[w[g]][f]=1*x[w[g]][f]);return x}function L(S){var O=Object.keys(S);return O.reduce(function(C,x){return C||S[x].length>0},!1)}function b(S,O){for(var C={main:[O]},x={main:[]},v={main:{}};L(C);)for(var d=Object.keys(C),o=0;o<d.length;o++){var u=d[o],s=C[u],w=s.pop();if(v[u]=v[u]||{},v[u][w]||!S[u][w])continue;v[u][w]=!0,x[u]=x[u]||[],x[u].push(w);for(var g=k(S,S[u][w],u),f=Object.keys(g),_=0;_<f.length;_++)C[f[_]]=C[f[_]]||[],C[f[_]]=C[f[_]].concat(g[f[_]])}return x}re.exports=function(S,O){O=O||{};var C={main:A.m},x=O.all?{main:Object.keys(C.main)}:b(C,S),v="";Object.keys(x).filter(function(w){return w!=="main"}).forEach(function(w){for(var g=0;x[w][g];)g++;x[w].push(g),C[w][g]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",v=v+"var "+w+" = ("+G.toString().replace("ENTRY_MODULE",JSON.stringify(g))+")({"+x[w].map(function(f){return""+JSON.stringify(f)+": "+C[w][f].toString()}).join(",")+`});
`}),v=v+"new (("+G.toString().replace("ENTRY_MODULE",JSON.stringify(S))+")({"+x.main.map(function(w){return""+JSON.stringify(w)+": "+C.main[w].toString()}).join(",")+"}))(self);";var d=new window.Blob([v],{type:"text/javascript"});if(O.bare)return d;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,u=o.createObjectURL(d),s=new window.Worker(u);return s.objectURL=u,s}},"./src/config.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"hlsDefaultConfig",function(){return _}),A.d(V,"mergeConfig",function(){return h}),A.d(V,"enableStreamingMode",function(){return c});var G=A("./src/controller/abr-controller.ts"),I=A("./src/controller/audio-stream-controller.ts"),R=A("./src/controller/audio-track-controller.ts"),B=A("./src/controller/subtitle-stream-controller.ts"),U=A("./src/controller/subtitle-track-controller.ts"),k=A("./src/controller/buffer-controller.ts"),L=A("./src/controller/timeline-controller.ts"),b=A("./src/controller/cap-level-controller.ts"),S=A("./src/controller/fps-controller.ts"),O=A("./src/controller/eme-controller.ts"),C=A("./src/controller/cmcd-controller.ts"),x=A("./src/utils/xhr-loader.ts"),v=A("./src/utils/fetch-loader.ts"),d=A("./src/utils/cues.ts"),o=A("./src/utils/mediakeys-helper.ts"),u=A("./src/utils/logger.ts");function s(){return s=Object.assign||function(l){for(var a=1;a<arguments.length;a++){var y=arguments[a];for(var m in y)Object.prototype.hasOwnProperty.call(y,m)&&(l[m]=y[m])}return l},s.apply(this,arguments)}function w(l,a){var y=Object.keys(l);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(l);a&&(m=m.filter(function(E){return Object.getOwnPropertyDescriptor(l,E).enumerable})),y.push.apply(y,m)}return y}function g(l){for(var a=1;a<arguments.length;a++){var y=arguments[a]!=null?arguments[a]:{};a%2?w(Object(y),!0).forEach(function(m){f(l,m,y[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(y)):w(Object(y)).forEach(function(m){Object.defineProperty(l,m,Object.getOwnPropertyDescriptor(y,m))})}return l}function f(l,a,y){return a in l?Object.defineProperty(l,a,{value:y,enumerable:!0,configurable:!0,writable:!0}):l[a]=y,l}var _=g(g({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:x.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:G.default,bufferController:k.default,capLevelController:b.default,fpsController:S.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},p()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:U.default,timelineController:L.TimelineController,audioStreamController:I.default,audioTrackController:R.default,emeController:O.default,cmcdController:C.default});function p(){return{cueHandler:d.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function h(l,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return s({},l,a)}function c(l){var a=l.loader;if(a!==v.default&&a!==x.default)u.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),l.progressive=!1;else{var y=Object(v.fetchSupported)();y&&(l.loader=v.default,l.progressive=!0,l.enableSoftwareAES=!0,u.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/polyfills/number.ts"),I=A("./src/utils/ewma-bandwidth-estimator.ts"),R=A("./src/events.ts"),B=A("./src/utils/buffer-helper.ts"),U=A("./src/errors.ts"),k=A("./src/types/loader.ts"),L=A("./src/utils/logger.ts");function b(C,x){for(var v=0;v<x.length;v++){var d=x[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(C,d.key,d)}}function S(C,x,v){return x&&b(C.prototype,x),v&&b(C,v),C}var O=function(){function C(v){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=v;var d=v.config;this.bwEstimator=new I.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var x=C.prototype;return x.registerListeners=function(){var d=this.hls;d.on(R.Events.FRAG_LOADING,this.onFragLoading,this),d.on(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(R.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var d=this.hls;d.off(R.Events.FRAG_LOADING,this.onFragLoading,this),d.off(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(R.Events.ERROR,this.onError,this)},x.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},x.onFragLoading=function(d,o){var u=o.frag;if(u.type===k.PlaylistLevelType.MAIN&&!this.timer){var s;this.fragCurrent=u,this.partCurrent=(s=o.part)!=null?s:null,this.timer=self.setInterval(this.onCheck,100)}},x.onLevelLoaded=function(d,o){var u=this.hls.config;o.details.live?this.bwEstimator.update(u.abrEwmaSlowLive,u.abrEwmaFastLive):this.bwEstimator.update(u.abrEwmaSlowVoD,u.abrEwmaFastVoD)},x._abandonRulesCheck=function(){var d=this.fragCurrent,o=this.partCurrent,u=this.hls,s=u.autoLevelEnabled,w=u.config,g=u.media;if(!d||!g)return;var f=o?o.stats:d.stats,_=o?o.duration:d.duration;if(f.aborted){L.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!s||g.paused||!g.playbackRate||!g.readyState)return;var p=performance.now()-f.loading.start,h=Math.abs(g.playbackRate);if(p<=500*_/h)return;var c=u.levels,l=u.minAutoLevel,a=c[d.level],y=f.total||Math.max(f.loaded,Math.round(_*a.maxBitrate/8)),m=Math.max(1,f.bwEstimate?f.bwEstimate/8:f.loaded*1e3/p),E=(y-f.loaded)/m,M=g.currentTime,F=(B.BufferHelper.bufferInfo(g,M,w.maxBufferHole).end-M)/h;if(F>=2*_/h||E<=F)return;var j=Number.POSITIVE_INFINITY,W;for(W=d.level-1;W>l;W--){var D=c[W].maxBitrate;if(j=_*D/(8*.8*m),j<F)break}if(j>=E)return;var P=this.bwEstimator.getEstimate();L.logger.warn("Fragment "+d.sn+(o?" part "+o.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+W+`
Current BW estimate: `+(Object(G.isFiniteNumber)(P)?(P/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+E.toFixed(3)+` s
Estimated load time for the next fragment: `+j.toFixed(3)+` s
Time to underbuffer: `+F.toFixed(3)+" s"),u.nextLoadLevel=W,this.bwEstimator.sample(p,f.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),u.trigger(R.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:o,stats:f})},x.onFragLoaded=function(d,o){var u=o.frag,s=o.part;if(u.type===k.PlaylistLevelType.MAIN&&Object(G.isFiniteNumber)(u.sn)){var w=s?s.stats:u.stats,g=s?s.duration:u.duration;if(this.clearTimer(),this.lastLoadedFragLevel=u.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var f=this.hls.levels[u.level],_=(f.loaded?f.loaded.bytes:0)+w.loaded,p=(f.loaded?f.loaded.duration:0)+g;f.loaded={bytes:_,duration:p},f.realBitrate=Math.round(8*_/p)}if(u.bitrateTest){var h={stats:w,frag:u,part:s,id:u.type};this.onFragBuffered(R.Events.FRAG_BUFFERED,h),u.bitrateTest=!1}}},x.onFragBuffered=function(d,o){var u=o.frag,s=o.part,w=s?s.stats:u.stats;if(w.aborted)return;if(u.type!==k.PlaylistLevelType.MAIN||u.sn==="initSegment")return;var g=w.parsing.end-w.loading.start;this.bwEstimator.sample(g,w.loaded),w.bwEstimate=this.bwEstimator.getEstimate(),u.bitrateTest?this.bitrateTestDelay=g/1e3:this.bitrateTestDelay=0},x.onError=function(d,o){switch(o.details){case U.ErrorDetails.FRAG_LOAD_ERROR:case U.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},x.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},x.getNextABRAutoLevel=function(){var d=this.fragCurrent,o=this.partCurrent,u=this.hls,s=u.maxAutoLevel,w=u.config,g=u.minAutoLevel,f=u.media,_=o?o.duration:d?d.duration:0,p=f?f.currentTime:0,h=f&&f.playbackRate!==0?Math.abs(f.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():w.abrEwmaDefaultEstimate,l=(B.BufferHelper.bufferInfo(f,p,w.maxBufferHole).end-p)/h,a=this.findBestLevel(c,g,s,l,w.abrBandWidthFactor,w.abrBandWidthUpFactor);if(a>=0)return a;L.logger.trace((l?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var y=_?Math.min(_,w.maxStarvationDelay):w.maxStarvationDelay,m=w.abrBandWidthFactor,E=w.abrBandWidthUpFactor;if(!l){var M=this.bitrateTestDelay;if(M){var F=_?Math.min(_,w.maxLoadingDelay):w.maxLoadingDelay;y=F-M,L.logger.trace("bitrate test took "+Math.round(1e3*M)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*y)+" ms"),m=E=1}}return a=this.findBestLevel(c,g,s,l+y,m,E),Math.max(a,0)},x.findBestLevel=function(d,o,u,s,w,g){for(var f,_=this.fragCurrent,p=this.partCurrent,h=this.lastLoadedFragLevel,c=this.hls.levels,l=c[h],a=!!(l!=null&&(f=l.details)!==null&&f!==void 0&&f.live),y=l==null?void 0:l.codecSet,m=p?p.duration:_?_.duration:0,E=u;E>=o;E--){var M=c[E];if(!M||y&&M.codecSet!==y)continue;var F=M.details,j=(p?F==null?void 0:F.partTarget:F==null?void 0:F.averagetargetduration)||m,W=void 0;E<=h?W=w*d:W=g*d;var D=c[E].maxBitrate,P=D*j/W;if(L.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+E+"/"+Math.round(W)+"/"+D+"/"+j+"/"+s+"/"+P),W>D&&(!P||a&&!this.bitrateTestDelay||P<s))return E}return-1},S(C,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,o=this.bwEstimator;if(d!==-1&&(!o||!o.canEstimate()))return d;var u=this.getNextABRAutoLevel();return d!==-1&&(u=Math.min(d,u)),u},set:function(d){this._nextAutoLevel=d}}]),C}();V.default=O},"./src/controller/audio-stream-controller.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/polyfills/number.ts"),I=A("./src/controller/base-stream-controller.ts"),R=A("./src/events.ts"),B=A("./src/utils/buffer-helper.ts"),U=A("./src/controller/fragment-tracker.ts"),k=A("./src/types/level.ts"),L=A("./src/types/loader.ts"),b=A("./src/loader/fragment.ts"),S=A("./src/demux/chunk-cache.ts"),O=A("./src/demux/transmuxer-interface.ts"),C=A("./src/types/transmuxer.ts"),x=A("./src/controller/fragment-finders.ts"),v=A("./src/utils/discontinuities.ts"),d=A("./src/errors.ts"),o=A("./src/utils/logger.ts");function u(){return u=Object.assign||function(_){for(var p=1;p<arguments.length;p++){var h=arguments[p];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(_[c]=h[c])}return _},u.apply(this,arguments)}function s(_,p){_.prototype=Object.create(p.prototype),_.prototype.constructor=_,w(_,p)}function w(_,p){return w=Object.setPrototypeOf||function(c,l){return c.__proto__=l,c},w(_,p)}var g=100,f=function(_){s(p,_);function p(c,l){var a;return a=_.call(this,c,l,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var h=p.prototype;return h.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},h._registerListeners=function(){var l=this.hls;l.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.on(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.on(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(R.Events.ERROR,this.onError,this),l.on(R.Events.BUFFER_RESET,this.onBufferReset,this),l.on(R.Events.BUFFER_CREATED,this.onBufferCreated,this),l.on(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.on(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h._unregisterListeners=function(){var l=this.hls;l.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.off(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.off(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(R.Events.ERROR,this.onError,this),l.off(R.Events.BUFFER_RESET,this.onBufferReset,this),l.off(R.Events.BUFFER_CREATED,this.onBufferCreated,this),l.off(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.off(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h.onInitPtsFound=function(l,a){var y=a.frag,m=a.id,E=a.initPTS;if(m==="main"){var M=y.cc;this.initPTS[y.cc]=E,this.log("InitPTS for cc: "+M+" found from main: "+E),this.videoTrackCC=M,this.state===I.State.WAITING_INIT_PTS&&this.tick()}},h.startLoad=function(l){if(!this.levels){this.startPosition=l,this.state=I.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(g),this.fragLoadError=0,a>0&&l===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=I.State.IDLE):(this.loadedmetadata=!1,this.state=I.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=l,this.tick()},h.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_TRACK:{var l,a=this.levels,y=this.trackId,m=a==null||((l=a[y])===null||l===void 0)?void 0:l.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=I.State.WAITING_INIT_PTS}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var E,M=performance.now(),F=this.retryDate;(!F||M>=F||(E=this.media)!==null&&E!==void 0&&E.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=I.State.IDLE);break}case I.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var W=j.frag,D=j.part,P=j.cache,H=j.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.FRAG_LOADING;var Y=P.flush(),ee={frag:W,part:D,payload:Y,networkDetails:null};this._handleFragmentLoadProgress(ee),H&&_.prototype._handleFragmentLoadComplete.call(this,ee)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+W.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var oe=this.getLoadPosition(),xe=B.BufferHelper.bufferInfo(this.mediaBuffer,oe,this.config.maxBufferHole),ve=Object(x.fragmentWithinToleranceTest)(xe.end,this.config.maxFragLookUpTolerance,W);ve<0&&(o.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()},h.clearWaitingFragment=function(){var l=this.waitingData;l&&(this.fragmentTracker.removeFragment(l.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.IDLE)},h.onTickEnd=function(){var l=this.media;if(!l||!l.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:l,y=a.buffered;!this.loadedmetadata&&y.length&&(this.loadedmetadata=!0),this.lastCurrentTime=l.currentTime},h.doTickIdle=function(){var l,a,y=this.hls,m=this.levels,E=this.media,M=this.trackId,F=y.config;if(!m||!m[M])return;if(!E&&(this.startFragRequested||!F.startFragPrefetch))return;var j=m[M],W=j.details;if(!W||W.live&&this.levelLastLoaded!==M||this.waitForCdnTuneIn(W)){this.state=I.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,b.ElementaryStreamTypes.AUDIO,L.PlaylistLevelType.AUDIO));var D=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,L.PlaylistLevelType.AUDIO);if(D===null)return;var P=D.len,H=this.getMaxBufferLength(),Y=this.audioSwitch;if(P>=H&&!Y)return;if(!Y&&this._streamEnded(D,W)){y.trigger(R.Events.BUFFER_EOS,{type:"audio"}),this.state=I.State.ENDED;return}var ee=W.fragments,oe=ee[0].start,xe=D.end;if(Y){var ve=this.getLoadPosition();xe=ve,W.PTSKnown&&ve<oe&&((D.end>oe||D.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),E.currentTime=oe+.05))}var he=this.getNextFragment(xe,W);if(!he){this.bufferFlushed=!0;return}((l=he.decryptdata)===null||l===void 0?void 0:l.keyFormat)==="identity"&&!((a=he.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(he,W):this.loadFragment(he,W,xe)},h.getMaxBufferLength=function(){var l=_.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,L.PlaylistLevelType.MAIN);return a===null?l:Math.max(l,a.len)},h.onMediaDetaching=function(){this.videoBuffer=null,_.prototype.onMediaDetaching.call(this)},h.onAudioTracksUpdated=function(l,a){var y=a.audioTracks;this.resetTransmuxer(),this.levels=y.map(function(m){return new k.Level(m)})},h.onAudioTrackSwitching=function(l,a){var y=!!a.url;this.trackId=a.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),y?this.setInterval(g):this.resetTransmuxer(),y?(this.audioSwitch=!0,this.state=I.State.IDLE):this.state=I.State.STOPPED,this.tick()},h.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},h.onLevelLoaded=function(l,a){this.mainDetails=a.details},h.onAudioTrackLoaded=function(l,a){var y,m=this.levels,E=a.details,M=a.id;if(!m){this.warn("Audio tracks were reset while loading level "+M);return}this.log("Track "+M+" loaded ["+E.startSN+","+E.endSN+"],duration:"+E.totalduration);var F=m[M],j=0;if(E.live||(y=F.details)!==null&&y!==void 0&&y.live){var W=this.mainDetails;if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed||!W)return;!F.details&&E.hasProgramDateTime&&W.hasProgramDateTime?(Object(v.alignMediaPlaylistByPDT)(E,W),j=E.fragments[0].start):j=this.alignPlaylists(E,F.details)}F.details=E,this.levelLastLoaded=M,!this.startFragRequested&&(this.mainDetails||!E.live)&&this.setStartPosition(F.details,j),this.state===I.State.WAITING_TRACK&&!this.waitForCdnTuneIn(E)&&(this.state=I.State.IDLE),this.tick()},h._handleFragmentLoadProgress=function(l){var a,y=l.frag,m=l.part,E=l.payload,M=this.config,F=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+y.sn+" of level "+y.level+" will not be buffered");return}var W=j[F];console.assert(W,"Audio track is defined on fragment load progress");var D=W.details;console.assert(D,"Audio track details are defined on fragment load progress");var P=M.defaultAudioCodec||W.audioCodec||"mp4a.40.2",H=this.transmuxer;H||(H=this.transmuxer=new O.default(this.hls,L.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Y=this.initPTS[y.cc],ee=(a=y.initSegment)===null||a===void 0?void 0:a.data;if(Y!==void 0){var oe=!1,xe=m?m.index:-1,ve=xe!==-1,he=new C.ChunkMetadata(y.level,y.sn,y.stats.chunkCount,E.byteLength,xe,ve);H.push(E,ee,P,"",y,m,D.totalduration,oe,he,Y)}else{o.logger.log("Unknown video PTS for cc "+y.cc+", waiting for video PTS before demuxing audio frag "+y.sn+" of ["+D.startSN+" ,"+D.endSN+"],track "+F);var fe=this.waitingData=this.waitingData||{frag:y,part:m,cache:new S.default,complete:!1},me=fe.cache;me.push(new Uint8Array(E)),this.waitingVideoCC=this.videoTrackCC,this.state=I.State.WAITING_INIT_PTS}},h._handleFragmentLoadComplete=function(l){if(this.waitingData){this.waitingData.complete=!0;return}_.prototype._handleFragmentLoadComplete.call(this,l)},h.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},h.onBufferCreated=function(l,a){var y=a.tracks.audio;y&&(this.mediaBuffer=y.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},h.onFragBuffered=function(l,a){var y=a.frag,m=a.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)},h.onError=function(l,a){switch(a.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.AUDIO,a);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==I.State.ERROR&&this.state!==I.State.STOPPED&&(this.state=a.fatal?I.State.ERROR:I.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var 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,_.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},h.onBufferFlushed=function(l,a){var y=a.type;y===b.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},h._handleTransmuxComplete=function(l){var a,y="audio",m=this.hls,E=l.remuxResult,M=l.chunkMeta,F=this.getCurrentContext(M);if(!F){this.warn("The loading context changed while buffering fragment "+M.sn+" of level "+M.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(M.level);return}var j=F.frag,W=F.part,D=E.audio,P=E.text,H=E.id3,Y=E.initSegment;if(this.fragContextChanged(j))return;if(this.state=I.State.PARSING,this.audioSwitch&&D&&this.completeAudioSwitch(),Y!=null&&Y.tracks&&(this._bufferInitSegment(Y.tracks,j,M),m.trigger(R.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:y,tracks:Y.tracks})),D){var ee=D.startPTS,oe=D.endPTS,xe=D.startDTS,ve=D.endDTS;W&&(W.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:ee,endPTS:oe,startDTS:xe,endDTS:ve}),j.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,ee,oe,xe,ve),this.bufferFragmentData(D,j,W,M)}if(H!=null&&(a=H.samples)!==null&&a!==void 0&&a.length){var he=u({frag:j,id:y},H);m.trigger(R.Events.FRAG_PARSING_METADATA,he)}if(P){var fe=u({frag:j,id:y},P);m.trigger(R.Events.FRAG_PARSING_USERDATA,fe)}},h._bufferInitSegment=function(l,a,y){if(this.state!==I.State.PARSING)return;l.video&&delete l.video;var m=l.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,l);var E=m.initSegment;if(E!=null&&E.byteLength){var M={type:"audio",frag:a,part:null,chunkMeta:y,parent:a.type,data:E};this.hls.trigger(R.Events.BUFFER_APPENDING,M)}this.tick()},h.loadFragment=function(l,a,y){var m=this.fragmentTracker.getState(l);this.fragCurrent=l,(this.audioSwitch||m===U.FragmentState.NOT_LOADED||m===U.FragmentState.PARTIAL)&&(l.sn==="initSegment"?this._loadInitSegment(l):a.live&&!Object(G.isFiniteNumber)(this.initPTS[l.cc])?(this.log("Waiting for video PTS in continuity counter "+l.cc+" of live stream before loading audio fragment "+l.sn+" of level "+this.trackId),this.state=I.State.WAITING_INIT_PTS):(this.startFragRequested=!0,_.prototype.loadFragment.call(this,l,a,y)))},h.completeAudioSwitch=function(){var l=this.hls,a=this.media,y=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),_.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,l.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:y})},p}(I.default);V.default=f},"./src/controller/audio-track-controller.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/events.ts"),I=A("./src/errors.ts"),R=A("./src/controller/base-playlist-controller.ts"),B=A("./src/types/loader.ts");function U(O,C){for(var x=0;x<C.length;x++){var v=C[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(O,v.key,v)}}function k(O,C,x){return C&&U(O.prototype,C),x&&U(O,x),O}function L(O,C){O.prototype=Object.create(C.prototype),O.prototype.constructor=O,b(O,C)}function b(O,C){return b=Object.setPrototypeOf||function(v,d){return v.__proto__=d,v},b(O,C)}var S=function(O){L(C,O);function C(v){var d;return d=O.call(this,v,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var x=C.prototype;return x.registerListeners=function(){var d=this.hls;d.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(G.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(G.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var d=this.hls;d.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(G.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(G.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(G.Events.ERROR,this.onError,this)},x.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,O.prototype.destroy.call(this)},x.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},x.onManifestParsed=function(d,o){this.tracks=o.audioTracks||[]},x.onAudioTrackLoaded=function(d,o){var u=o.id,s=o.details,w=this.tracksInGroup[u];if(!w){this.warn("Invalid audio track id "+u);return}var g=w.details;w.details=o.details,this.log("audioTrack "+u+" loaded ["+s.startSN+"-"+s.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,o,g))},x.onLevelLoading=function(d,o){this.switchLevel(o.level)},x.onLevelSwitching=function(d,o){this.switchLevel(o.level)},x.switchLevel=function(d){var o=this.hls.levels[d];if(!(o!=null&&o.audioGroupIds))return;var u=o.audioGroupIds[o.urlId];if(this.groupId!==u){this.groupId=u;var s=this.tracks.filter(function(g){return!u||g.groupId===u});this.selectDefaultTrack&&!s.some(function(g){return g.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=s;var w={audioTracks:s};this.log("Updating audio tracks, "+s.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(G.Events.AUDIO_TRACKS_UPDATED,w),this.selectInitialTrack()}},x.onError=function(d,o){if(O.prototype.onError.call(this,d,o),o.fatal||!o.context)return;o.context.type===B.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},x.setAudioTrack=function(d){var o=this.tracksInGroup;if(d<0||d>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var u=o[this.trackId];this.log("Now switching to audio-track index "+d);var s=o[d],w=s.id,g=s.groupId,f=g===void 0?"":g,_=s.name,p=s.type,h=s.url;if(this.trackId=d,this.trackName=_,this.selectDefaultTrack=!1,this.hls.trigger(G.Events.AUDIO_TRACK_SWITCHING,{id:w,groupId:f,name:_,type:p,url:h}),s.details&&!s.details.live)return;var c=this.switchParams(s.url,u==null?void 0:u.details);this.loadPlaylist(c)},x.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,u=this.findTrackId(o)||this.findTrackId();u!==-1?this.setAudioTrack(u):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},x.findTrackId=function(d){for(var o=this.tracksInGroup,u=0;u<o.length;u++){var s=o[u];if((!this.selectDefaultTrack||s.default)&&(!d||d===s.name))return s.id}return-1},x.loadPlaylist=function(d){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var u=o.id,s=o.groupId,w=o.url;if(d)try{w=d.addDirectives(w)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("loading audio-track playlist for id: "+u),this.clearTimer(),this.hls.trigger(G.Events.AUDIO_TRACK_LOADING,{url:w,id:u,groupId:s,deliveryDirectives:d||null})}},k(C,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),C}(R.default);V.default=S},"./src/controller/base-playlist-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return k});var G=A("./src/polyfills/number.ts"),I=A("./src/types/level.ts"),R=A("./src/controller/level-helper.ts"),B=A("./src/utils/logger.ts"),U=A("./src/errors.ts"),k=function(){function L(S,O){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=B.logger.log.bind(B.logger,O+":"),this.warn=B.logger.warn.bind(B.logger,O+":"),this.hls=S}var b=L.prototype;return b.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},b.onError=function(O,C){C.fatal&&C.type===U.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},b.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},b.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},b.stopLoad=function(){this.canLoad=!1,this.clearTimer()},b.switchParams=function(O,C){var x=C==null?void 0:C.renditionReports;if(x)for(var v=0;v<x.length;v++){var d=x[v],o=""+d.URI;if(o===O.substr(-o.length)){var u=parseInt(d["LAST-MSN"]),s=parseInt(d["LAST-PART"]);if(C&&this.hls.config.lowLatencyMode){var w=Math.min(C.age-C.partTarget,C.targetduration);s!==void 0&&w>C.partTarget&&(s+=1)}if(Object(G.isFiniteNumber)(u))return new I.HlsUrlParameters(u,Object(G.isFiniteNumber)(s)?s:void 0,I.HlsSkip.No)}}},b.loadPlaylist=function(O){},b.shouldLoadTrack=function(O){return this.canLoad&&O&&!!O.url&&(!O.details||O.details.live)},b.playlistLoaded=function(O,C,x){var v=this,d=C.details,o=C.stats,u=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(d.advancedDateTime=Date.now()-u,d.live||x!=null&&x.live){if(d.reloaded(x),x&&this.log("live playlist "+O+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),x&&d.fragments.length>0&&Object(R.mergeDetails)(x,d),!this.canLoad||!d.live)return;var s,w=void 0,g=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var f=this.hls.config.lowLatencyMode,_=d.lastPartSn,p=d.endSN,h=d.lastPartIndex,c=h!==-1,l=_===p,a=f?0:h;c?(w=l?p+1:_,g=l?a:h+1):w=p+1;var y=d.age,m=y+d.ageHeader,E=Math.min(m-d.partTarget,d.targetduration*1.5);if(E>0){if(x&&E>x.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+x.tuneInGoal+" to: "+E+" with playlist age: "+d.age),E=0;else{var M=Math.floor(E/d.targetduration);if(w+=M,g!==void 0){var F=Math.round(E%d.targetduration/d.partTarget);g+=F}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+y.toFixed(2)+"s goal: "+E+" skip sn "+M+" to part "+g)}d.tuneInGoal=E}if(s=this.getDeliveryDirectives(d,C.deliveryDirectives,w,g),f||!l){this.loadPlaylist(s);return}}else s=this.getDeliveryDirectives(d,C.deliveryDirectives,w,g);var j=Object(R.computeReloadInterval)(d,o);w!==void 0&&d.canBlockReload&&(j-=d.partTarget||1),this.log("reload live playlist "+O+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return v.loadPlaylist(s)},j)}else this.clearTimer()},b.getDeliveryDirectives=function(O,C,x,v){var d=Object(I.getSkipValue)(O,x);return C!=null&&C.skip&&O.deltaUpdateFailed&&(x=C.msn,v=C.part,d=I.HlsSkip.No),new I.HlsUrlParameters(x,v,d)},b.retryLoadingOrFail=function(O){var C=this,x=this.hls.config,v=this.retryCount<x.levelLoadingMaxRetry;if(v){var d;if(this.retryCount++,O.details.indexOf("LoadTimeOut")>-1&&(d=O.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+O.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*x.levelLoadingRetryDelay,x.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return C.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+O.details+'"')}}else this.warn('cannot recover from error "'+O.details+'"'),this.clearTimer(),O.fatal=!0;return v},L}()},"./src/controller/base-stream-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"State",function(){return p}),A.d(V,"default",function(){return h});var G=A("./src/polyfills/number.ts"),I=A("./src/task-loop.ts"),R=A("./src/controller/fragment-tracker.ts"),B=A("./src/utils/buffer-helper.ts"),U=A("./src/utils/logger.ts"),k=A("./src/events.ts"),L=A("./src/errors.ts"),b=A("./src/types/transmuxer.ts"),S=A("./src/utils/mp4-tools.ts"),O=A("./src/utils/discontinuities.ts"),C=A("./src/controller/fragment-finders.ts"),x=A("./src/controller/level-helper.ts"),v=A("./src/loader/fragment-loader.ts"),d=A("./src/crypt/decrypter.ts"),o=A("./src/utils/time-ranges.ts"),u=A("./src/types/loader.ts");function s(c,l){for(var a=0;a<l.length;a++){var y=l[a];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(c,y.key,y)}}function w(c,l,a){return l&&s(c.prototype,l),a&&s(c,a),c}function g(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function f(c,l){c.prototype=Object.create(l.prototype),c.prototype.constructor=c,_(c,l)}function _(c,l){return _=Object.setPrototypeOf||function(y,m){return y.__proto__=m,y},_(c,l)}var p={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},h=function(c){f(l,c);function l(y,m,E){var M;return M=c.call(this)||this,M.hls=void 0,M.fragPrevious=null,M.fragCurrent=null,M.fragmentTracker=void 0,M.transmuxer=null,M._state=p.STOPPED,M.media=void 0,M.mediaBuffer=void 0,M.config=void 0,M.bitrateTest=!1,M.lastCurrentTime=0,M.nextLoadPosition=0,M.startPosition=0,M.loadedmetadata=!1,M.fragLoadError=0,M.retryDate=0,M.levels=null,M.fragmentLoader=void 0,M.levelLastLoaded=null,M.startFragRequested=!1,M.decrypter=void 0,M.initPTS=[],M.onvseeking=null,M.onvended=null,M.logPrefix="",M.log=void 0,M.warn=void 0,M.logPrefix=E,M.log=U.logger.log.bind(U.logger,E+":"),M.warn=U.logger.warn.bind(U.logger,E+":"),M.hls=y,M.fragmentLoader=new v.default(y.config),M.fragmentTracker=m,M.config=y.config,M.decrypter=new d.default(y,y.config),y.on(k.Events.KEY_LOADED,M.onKeyLoaded,g(M)),M}var a=l.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(m){},a.stopLoad=function(){this.fragmentLoader.abort();var m=this.fragCurrent;m&&this.fragmentTracker.removeFragment(m),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=p.STOPPED},a._streamEnded=function(m,E){var M=this.fragCurrent,F=this.fragmentTracker;if(!E.live&&M&&M.sn===E.endSN&&!m.nextStart){var j=F.getState(M);return j===R.FragmentState.PARTIAL||j===R.FragmentState.OK}return!1},a.onMediaAttached=function(m,E){var M=this.media=this.mediaBuffer=E.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),M.addEventListener("seeking",this.onvseeking),M.addEventListener("ended",this.onvended);var F=this.config;this.levels&&F.autoStartLoad&&this.state===p.STOPPED&&this.startLoad(F.startPosition)},a.onMediaDetaching=function(){var m=this.media;m!=null&&m.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),m&&(m.removeEventListener("seeking",this.onvseeking),m.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var m=this.config,E=this.fragCurrent,M=this.media,F=this.mediaBuffer,j=this.state,W=M?M.currentTime:0,D=B.BufferHelper.bufferInfo(F||M,W,m.maxBufferHole);if(this.log("media seeking to "+(Object(G.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+j),j===p.ENDED)this.resetLoadingState();else if(E&&!D.len){var P=m.maxFragLookUpTolerance,H=E.start-P,Y=E.start+E.duration+P,ee=W>Y;(W<H||ee)&&(ee&&E.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),E.loader.abort()),this.resetLoadingState())}M&&(this.lastCurrentTime=W),!this.loadedmetadata&&!D.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(m,E){if(this.state!==p.KEY_LOADING||E.frag!==this.fragCurrent||!this.levels)return;this.state=p.IDLE;var M=this.levels[E.frag.level].details;M&&this.loadFragment(E.frag,M,E.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=p.STOPPED,this.hls.off(k.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,c.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(m,E){this.log("Loading key for "+m.sn+" of ["+E.startSN+"-"+E.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=p.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(k.Events.KEY_LOADING,{frag:m})},a.loadFragment=function(m,E,M){this._loadFragForPlayback(m,E,M)},a._loadFragForPlayback=function(m,E,M){var F=this,j=function(D){if(F.fragContextChanged(m)){F.warn("Fragment "+m.sn+(D.part?" p: "+D.part.index:"")+" of level "+m.level+" was dropped during download."),F.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,F._handleFragmentLoadProgress(D)};this._doFragLoad(m,E,M,j).then(function(W){if(!W)return;F.fragLoadError=0;var D=F.state;if(F.fragContextChanged(m)){(D===p.FRAG_LOADING||D===p.BACKTRACKING||!F.fragCurrent&&D===p.PARSING)&&(F.fragmentTracker.removeFragment(m),F.state=p.IDLE);return}if("payload"in W&&(F.log("Loaded fragment "+m.sn+" of level "+m.level),F.hls.trigger(k.Events.FRAG_LOADED,W),F.state===p.BACKTRACKING)){F.fragmentTracker.backtrack(m,W),F.resetFragmentLoading(m);return}F._handleFragmentLoadComplete(W)}).catch(function(W){F.warn(W),F.resetFragmentLoading(m)})},a.flushMainBuffer=function(m,E,M){if(M===void 0&&(M=null),!(m-E))return;var F={startOffset:m,endOffset:E,type:M};this.fragLoadError=0,this.hls.trigger(k.Events.BUFFER_FLUSHING,F)},a._loadInitSegment=function(m){var E=this;this._doFragLoad(m).then(function(M){if(!M||E.fragContextChanged(m)||!E.levels)throw new Error("init load aborted");return M}).then(function(M){var F=E.hls,j=M.payload,W=m.decryptdata;if(j&&j.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var D=self.performance.now();return E.decrypter.webCryptoDecrypt(new Uint8Array(j),W.key.buffer,W.iv.buffer).then(function(P){var H=self.performance.now();return F.trigger(k.Events.FRAG_DECRYPTED,{frag:m,payload:P,stats:{tstart:D,tdecrypt:H}}),M.payload=P,M})}return M}).then(function(M){var F=E.fragCurrent,j=E.hls,W=E.levels;if(!W)throw new Error("init load aborted, missing levels");var D=W[m.level].details;console.assert(D,"Level details are defined when init segment is loaded");var P=m.stats;E.state=p.IDLE,E.fragLoadError=0,m.data=new Uint8Array(M.payload),P.parsing.start=P.buffering.start=self.performance.now(),P.parsing.end=P.buffering.end=self.performance.now(),M.frag===F&&j.trigger(k.Events.FRAG_BUFFERED,{stats:P,frag:F,part:null,id:m.type}),E.tick()}).catch(function(M){E.warn(M),E.resetFragmentLoading(m)})},a.fragContextChanged=function(m){var E=this.fragCurrent;return!m||!E||m.level!==E.level||m.sn!==E.sn||m.urlId!==E.urlId},a.fragBufferedComplete=function(m,E){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(E?" part: "+E.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+o.default.toString(B.BufferHelper.getBuffered(M))),this.state=p.IDLE,this.tick()},a._handleFragmentLoadComplete=function(m){var E=this.transmuxer;if(!E)return;var M=m.frag,F=m.part,j=m.partsLoaded,W=!j||j.length===0||j.some(function(P){return!P}),D=new b.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,F?F.index:-1,!W);E.flush(D)},a._handleFragmentLoadProgress=function(m){},a._doFragLoad=function(m,E,M,F){var j=this;if(M===void 0&&(M=null),!this.levels)throw new Error("frag load aborted, missing levels");if(M=Math.max(m.start,M||0),this.config.lowLatencyMode&&E){var W=E.partList;if(W&&F){M>m.end&&E.fragmentHint&&(m=E.fragmentHint);var D=this.getNextPart(W,m,M);if(D>-1){var P=W[D];return this.log("Loading part sn: "+m.sn+" p: "+P.index+" cc: "+m.cc+" of playlist ["+E.startSN+"-"+E.endSN+"] parts [0-"+D+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=P.start+P.duration,this.state=p.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:m,part:W[D],targetBufferTime:M}),this.doFragPartsLoad(m,W,D,F).catch(function(H){return j.handleFragLoadError(H)})}else if(!m.url||this.loadedEndOfParts(W,M))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(E?"of ["+E.startSN+"-"+E.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(M.toFixed(3))),Object(G.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=p.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:m,targetBufferTime:M}),this.fragmentLoader.load(m,F).catch(function(H){return j.handleFragLoadError(H)})},a.doFragPartsLoad=function(m,E,M,F){var j=this;return new Promise(function(W,D){var P=[],H=function Y(ee){var oe=E[ee];j.fragmentLoader.loadPart(m,oe,F).then(function(xe){P[oe.index]=xe;var ve=xe.part;j.hls.trigger(k.Events.FRAG_LOADED,xe);var he=E[ee+1];if(he&&he.fragment===m)Y(ee+1);else return W({frag:m,part:ve,partsLoaded:P})}).catch(D)};H(M)})},a.handleFragLoadError=function(m){var E=m.data;return E&&E.details===L.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(E.frag,E.part):this.hls.trigger(k.Events.ERROR,E),null},a._handleTransmuxerFlush=function(m){var E=this.getCurrentContext(m);if(!E||this.state!==p.PARSING){this.fragCurrent||(this.state=p.IDLE);return}var M=E.frag,F=E.part,j=E.level,W=self.performance.now();M.stats.parsing.end=W,F&&(F.stats.parsing.end=W),this.updateLevelTiming(M,F,j,m.partial)},a.getCurrentContext=function(m){var E=this.levels,M=m.level,F=m.sn,j=m.part;if(!E||!E[M])return this.warn("Levels object was unset while buffering fragment "+F+" of level "+M+". The current chunk will not be buffered."),null;var W=E[M],D=j>-1?Object(x.getPartWith)(W,F,j):null,P=D?D.fragment:Object(x.getFragmentWithSN)(W,F,this.fragCurrent);return P?{frag:P,part:D,level:W}:null},a.bufferFragmentData=function(m,E,M,F){if(!m||this.state!==p.PARSING)return;var j=m.data1,W=m.data2,D=j;if(j&&W&&(D=Object(S.appendUint8Array)(j,W)),!D||!D.length)return;var P={type:m.type,frag:E,part:M,chunkMeta:F,parent:E.type,data:D};this.hls.trigger(k.Events.BUFFER_APPENDING,P),m.dropped&&m.independent&&!M&&this.flushBufferGap(E)},a.flushBufferGap=function(m){var E=this.media;if(!E)return;if(!B.BufferHelper.isBuffered(E,E.currentTime)){this.flushMainBuffer(0,m.start);return}var M=E.currentTime,F=B.BufferHelper.bufferInfo(E,M,0),j=m.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),D=Math.max(Math.min(m.start-W,F.end-W),M+W);m.start-D>W&&this.flushMainBuffer(D,m.start)},a.getFwdBufferInfo=function(m,E){var M=this.config,F=this.getLoadPosition();if(!Object(G.isFiniteNumber)(F))return null;var j=B.BufferHelper.bufferInfo(m,F,M.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(F,E);if(W&&j.nextStart<W.end)return B.BufferHelper.bufferInfo(m,F,Math.max(j.nextStart,M.maxBufferHole))}return j},a.getMaxBufferLength=function(m){var E=this.config,M;return m?M=Math.max(8*E.maxBufferSize/m,E.maxBufferLength):M=E.maxBufferLength,Math.min(M,E.maxMaxBufferLength)},a.reduceMaxBufferLength=function(m){var E=this.config,M=m||E.maxBufferLength;return E.maxMaxBufferLength>=M?(E.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+E.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(m,E){var M,F,j=E.fragments,W=j.length;if(!W)return null;var D=this.config,P=j[0].start,H;if(E.live){var Y=D.initialLiveManifestSize;if(W<Y)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+Y+")"),null;!E.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(H=this.getInitialLiveFragment(E,j),this.startPosition=H?this.hls.liveSyncPosition||H.start:m)}else m<=P&&(H=j[0]);if(!H){var ee=D.lowLatencyMode?E.partEnd:E.fragmentEnd;H=this.getFragmentAtPosition(m,ee,E)}return(M=H)!==null&&M!==void 0&&M.initSegment&&!((F=H)!==null&&F!==void 0&&F.initSegment.data)&&!this.bitrateTest&&(H=H.initSegment),H},a.getNextPart=function(m,E,M){for(var F=-1,j=!1,W=!0,D=0,P=m.length;D<P;D++){var H=m[D];if(W=W&&!H.independent,F>-1&&M<H.start)break;var Y=H.loaded;!Y&&(j||H.independent||W)&&H.fragment===E&&(F=D),j=Y}return F},a.loadedEndOfParts=function(m,E){var M=m[m.length-1];return M&&E>M.start&&M.loaded},a.getInitialLiveFragment=function(m,E){var M=this.fragPrevious,F=null;if(M){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+M.programDateTime),F=Object(C.findFragmentByPDT)(E,M.endProgramDateTime,this.config.maxFragLookUpTolerance)),!F){var j=M.sn+1;if(j>=m.startSN&&j<=m.endSN){var W=E[j-m.startSN];M.cc===W.cc&&(F=W,this.log("Live playlist, switching playlist, load frag with next SN: "+F.sn))}F||(F=Object(C.findFragWithCC)(E,M.cc),F&&this.log("Live playlist, switching playlist, load frag with same CC: "+F.sn))}}else{var D=this.hls.liveSyncPosition;D!==null&&(F=this.getFragmentAtPosition(D,this.bitrateTest?m.fragmentEnd:m.edge,m))}return F},a.getFragmentAtPosition=function(m,E,M){var F=this.config,j=this.fragPrevious,W=M.fragments,D=M.endSN,P=M.fragmentHint,H=F.maxFragLookUpTolerance,Y=!!(F.lowLatencyMode&&M.partList&&P);Y&&P&&!this.bitrateTest&&(W=W.concat(P),D=P.sn);var ee;if(m<E){var oe=m>E-H?0:H;ee=Object(C.findFragmentByPTS)(j,W,m,oe)}else ee=W[W.length-1];if(ee){var xe=ee.sn-M.startSN,ve=j&&ee.level===j.level,he=W[xe+1],fe=this.fragmentTracker.getState(ee);if(fe===R.FragmentState.BACKTRACKED){ee=null;for(var me=xe;W[me]&&this.fragmentTracker.getState(W[me])===R.FragmentState.BACKTRACKED;)j?ee=W[me--]:ee=W[--me];ee||(ee=he)}else j&&ee.sn===j.sn&&!Y&&(ve&&(ee.sn<D&&this.fragmentTracker.getState(he)!==R.FragmentState.OK?(this.log("SN "+ee.sn+" just loaded, load next one: "+he.sn),ee=he):ee=null))}return ee},a.synchronizeToLiveEdge=function(m){var E=this.config,M=this.media;if(!M)return;var F=this.hls.liveSyncPosition,j=M.currentTime,W=m.fragments[0].start,D=m.edge,P=j>=W-E.maxFragLookUpTolerance&&j<=D;if(F!==null&&M.duration>F&&(j<F||!P)){var H=E.liveMaxLatencyDuration!==void 0?E.liveMaxLatencyDuration:E.liveMaxLatencyDurationCount*m.targetduration;(!P&&M.readyState<4||j<D-H)&&(this.loadedmetadata||(this.nextLoadPosition=F),M.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+D+", reset currentTime to : "+F.toFixed(3)),M.currentTime=F))}},a.alignPlaylists=function(m,E){var M=this.levels,F=this.levelLastLoaded,j=this.fragPrevious,W=F!==null?M[F]:null,D=m.fragments.length;if(!D)return this.warn("No fragments in live playlist"),0;var P=m.fragments[0].start,H=!E,Y=m.alignedSliding&&Object(G.isFiniteNumber)(P);if(H||!Y&&!P){Object(O.alignStream)(j,W,m);var ee=m.fragments[0].start;return this.log("Live playlist sliding: "+ee.toFixed(2)+" start-sn: "+(E?E.startSN:"na")+"->"+m.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+D),ee}return P},a.waitForCdnTuneIn=function(m){var E=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*E)},a.setStartPosition=function(m,E){var M=this.startPosition;if(M<E&&(M=-1),M===-1||this.lastCurrentTime===-1){var F=m.startTimeOffset;Object(G.isFiniteNumber)(F)?(M=E+F,F<0&&(M+=m.totalduration),M=Math.min(Math.max(E,M),E+m.totalduration),this.log("Start time offset "+F+" found in playlist, adjust startPosition to "+M),this.startPosition=M):m.live?M=this.hls.liveSyncPosition||E:this.startPosition=M=0,this.lastCurrentTime=M}this.nextLoadPosition=M},a.getLoadPosition=function(){var m=this.media,E=0;return this.loadedmetadata&&m?E=m.currentTime:this.nextLoadPosition&&(E=this.nextLoadPosition),E},a.handleFragLoadAborted=function(m,E){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(E?" part"+E.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},a.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=p.IDLE)},a.onFragmentOrKeyLoadError=function(m,E){if(E.fatal)return;var M=E.frag;if(!M||M.type!==m)return;var F=this.fragCurrent;console.assert(F&&M.sn===F.sn&&M.level===F.level&&M.urlId===F.urlId,"Frag load error must match current frag to retry");var j=this.config;if(this.fragLoadError+1<=j.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(M.level))return;var W=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+M.sn+" of "+m+" "+M.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=p.FRAG_LOADING_WAITING_RETRY}else E.levelRetry?(m===u.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=p.IDLE):(U.logger.error(E.details+" reaches max retry, redispatch as fatal ..."),E.fatal=!0,this.hls.stopLoad(),this.state=p.ERROR)},a.afterBufferFlushed=function(m,E,M){if(!m)return;var F=B.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(E,F,M),this.state===p.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=p.IDLE},a.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var E=this.levels?this.levels[m].details:null;if(E!=null&&E.live)return this.startPosition=-1,this.setStartPosition(E,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(m,E,M,F){var j=this,W=M.details;console.assert(!!W,"level.details must be defined");var D=Object.keys(m.elementaryStreams).reduce(function(P,H){var Y=m.elementaryStreams[H];if(Y){var ee=Y.endPTS-Y.startPTS;if(ee<=0)return j.warn("Could not parse fragment "+m.sn+" "+H+" duration reliably ("+ee+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),P||!1;var oe=F?0:Object(x.updateFragPTSDTS)(W,m,Y.startPTS,Y.endPTS,Y.startDTS,Y.endDTS);return j.hls.trigger(k.Events.LEVEL_PTS_UPDATED,{details:W,level:M,drift:oe,type:H,frag:m,start:Y.startPTS,end:Y.endPTS}),!0}return P},!1);D?(this.state=p.PARSED,this.hls.trigger(k.Events.FRAG_PARSED,{frag:m,part:E})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},w(l,[{key:"state",get:function(){return this._state},set:function(m){var E=this._state;E!==m&&(this._state=m,this.log(E+"->"+m))}}]),l}(I.default)},"./src/controller/buffer-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return C});var G=A("./src/polyfills/number.ts"),I=A("./src/events.ts"),R=A("./src/utils/logger.ts"),B=A("./src/errors.ts"),U=A("./src/utils/buffer-helper.ts"),k=A("./src/utils/mediasource-helper.ts"),L=A("./src/loader/fragment.ts"),b=A("./src/controller/buffer-operation-queue.ts"),S=Object(k.getMediaSource)(),O=/([ha]vc.)(?:\.[^.,]+)+/,C=function(){function x(d){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var u=o.hls,s=o.media,w=o.mediaSource;R.logger.log("[buffer-controller]: Media source opened"),s&&(o.updateMediaElementDuration(),u.trigger(I.Events.MEDIA_ATTACHED,{media:s})),w&&w.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){R.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){R.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var v=x.prototype;return v.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},v.destroy=function(){this.unregisterListeners(),this.details=null},v.registerListeners=function(){var o=this.hls;o.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(I.Events.BUFFER_RESET,this.onBufferReset,this),o.on(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(I.Events.BUFFER_EOS,this.onBufferEos,this),o.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(I.Events.FRAG_PARSED,this.onFragParsed,this),o.on(I.Events.FRAG_CHANGED,this.onFragChanged,this)},v.unregisterListeners=function(){var o=this.hls;o.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(I.Events.BUFFER_RESET,this.onBufferReset,this),o.off(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(I.Events.BUFFER_EOS,this.onBufferEos,this),o.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(I.Events.FRAG_PARSED,this.onFragParsed,this),o.off(I.Events.FRAG_CHANGED,this.onFragChanged,this)},v._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new b.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},v.onManifestParsed=function(o,u){var s=2;(u.audio&&!u.video||!u.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,this.details=null,R.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},v.onMediaAttaching=function(o,u){var s=this.media=u.media;if(s&&S){var w=this.mediaSource=new S;w.addEventListener("sourceopen",this._onMediaSourceOpen),w.addEventListener("sourceended",this._onMediaSourceEnded),w.addEventListener("sourceclose",this._onMediaSourceClose),s.src=self.URL.createObjectURL(w),this._objectUrl=s.src}},v.onMediaDetaching=function(){var o=this.media,u=this.mediaSource,s=this._objectUrl;if(u){if(R.logger.log("[buffer-controller]: media source detaching"),u.readyState==="open")try{u.endOfStream()}catch(w){R.logger.warn("[buffer-controller]: onMediaDetaching: "+w.message+" while calling endOfStream")}this.onBufferReset(),u.removeEventListener("sourceopen",this._onMediaSourceOpen),u.removeEventListener("sourceended",this._onMediaSourceEnded),u.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(s&&self.URL.revokeObjectURL(s),o.src===s?(o.removeAttribute("src"),o.load()):R.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(I.Events.MEDIA_DETACHED,void 0)},v.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(u){var s=o.sourceBuffer[u];try{s&&(o.removeBufferListeners(u),o.mediaSource&&o.mediaSource.removeSourceBuffer(s),o.sourceBuffer[u]=void 0)}catch(w){R.logger.warn("[buffer-controller]: Failed to reset the "+u+" buffer",w)}}),this._initSourceBuffer()},v.onBufferCodecs=function(o,u){var s=this,w=this.getSourceBufferTypes().length;if(Object.keys(u).forEach(function(g){if(w){var f=s.tracks[g];if(f&&typeof f.buffer.changeType=="function"){var _=u[g],p=_.codec,h=_.levelCodec,c=_.container,l=(f.levelCodec||f.codec).replace(O,"$1"),a=(h||p).replace(O,"$1");if(l!==a){var y=c+";codecs="+(h||p);s.appendChangeType(g,y)}}}else s.pendingTracks[g]=u[g]}),w)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},v.appendChangeType=function(o,u){var s=this,w=this.operationQueue,g={execute:function(){var _=s.sourceBuffer[o];_&&(R.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+u),_.changeType(u)),w.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(_){R.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",_)}};w.append(g,o)},v.onBufferAppending=function(o,u){var s=this,w=this.hls,g=this.operationQueue,f=this.tracks,_=u.data,p=u.type,h=u.frag,c=u.part,l=u.chunkMeta,a=l.buffering[p],y=self.performance.now();a.start=y;var m=h.stats.buffering,E=c?c.stats.buffering:null;m.start===0&&(m.start=y),E&&E.start===0&&(E.start=y);var M=f.audio,F=p==="audio"&&l.id===1&&(M==null?void 0:M.container)==="audio/mpeg",j={execute:function(){if(a.executeStart=self.performance.now(),F){var D=s.sourceBuffer[p];if(D){var P=h.start-D.timestampOffset;Math.abs(P)>=.1&&(R.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+P+") sn: "+h.sn+")"),D.timestampOffset=h.start)}}s.appendExecutor(_,p)},onStart:function(){},onComplete:function(){var D=self.performance.now();a.executeEnd=a.end=D,m.first===0&&(m.first=D),E&&E.first===0&&(E.first=D);var P=s.sourceBuffer,H={};for(var Y in P)H[Y]=U.BufferHelper.getBuffered(P[Y]);s.appendError=0,s.hls.trigger(I.Events.BUFFER_APPENDED,{type:p,frag:h,part:c,chunkMeta:l,parent:h.type,timeRanges:H})},onError:function(D){R.logger.error("[buffer-controller]: Error encountered while trying to append to the "+p+" SourceBuffer",D);var P={type:B.ErrorTypes.MEDIA_ERROR,parent:h.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:D,fatal:!1};D.code===DOMException.QUOTA_EXCEEDED_ERR?P.details=B.ErrorDetails.BUFFER_FULL_ERROR:(s.appendError++,P.details=B.ErrorDetails.BUFFER_APPEND_ERROR,s.appendError>w.config.appendErrorMaxRetry&&(R.logger.error("[buffer-controller]: Failed "+w.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),P.fatal=!0)),w.trigger(I.Events.ERROR,P)}};g.append(j,p)},v.onBufferFlushing=function(o,u){var s=this,w=this.operationQueue,g=function(_){return{execute:s.removeExecutor.bind(s,_,u.startOffset,u.endOffset),onStart:function(){},onComplete:function(){s.hls.trigger(I.Events.BUFFER_FLUSHED,{type:_})},onError:function(h){R.logger.warn("[buffer-controller]: Failed to remove from "+_+" SourceBuffer",h)}}};u.type?w.append(g(u.type),u.type):this.getSourceBufferTypes().forEach(function(f){w.append(g(f),f)})},v.onFragParsed=function(o,u){var s=this,w=u.frag,g=u.part,f=[],_=g?g.elementaryStreams:w.elementaryStreams;_[L.ElementaryStreamTypes.AUDIOVIDEO]?f.push("audiovideo"):(_[L.ElementaryStreamTypes.AUDIO]&&f.push("audio"),_[L.ElementaryStreamTypes.VIDEO]&&f.push("video"));var p=function(){var c=self.performance.now();w.stats.buffering.end=c,g&&(g.stats.buffering.end=c);var l=g?g.stats:w.stats;s.hls.trigger(I.Events.FRAG_BUFFERED,{frag:w,part:g,stats:l,id:w.type})};f.length===0&&R.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+w.type+" level: "+w.level+" sn: "+w.sn),this.blockBuffers(p,f)},v.onFragChanged=function(o,u){this.flushBackBuffer()},v.onBufferEos=function(o,u){var s=this,w=this.getSourceBufferTypes().reduce(function(g,f){var _=s.sourceBuffer[f];return(!u.type||u.type===f)&&(_&&!_.ended&&(_.ended=!0,R.logger.log("[buffer-controller]: "+f+" sourceBuffer now EOS"))),g&&!!(!_||_.ended)},!0);w&&this.blockBuffers(function(){var g=s.mediaSource;if(!g||g.readyState!=="open")return;g.endOfStream()})},v.onLevelUpdated=function(o,u){var s=u.details;if(!s.fragments.length)return;this.details=s,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},v.flushBackBuffer=function(){var o=this.hls,u=this.details,s=this.media,w=this.sourceBuffer;if(!s||u===null)return;var g=this.getSourceBufferTypes();if(!g.length)return;var f=u.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(G.isFiniteNumber)(f)||f<0)return;var _=s.currentTime,p=u.levelTargetDuration,h=Math.max(f,p),c=Math.floor(_/p)*p-h;g.forEach(function(l){var a=w[l];if(a){var y=U.BufferHelper.getBuffered(a);y.length>0&&c>y.start(0)&&(o.trigger(I.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),u.live&&o.trigger(I.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(I.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:l}))}})},v.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,u=this.hls,s=this.media,w=this.mediaSource,g=o.fragments[0].start+o.totalduration,f=s.duration,_=Object(G.isFiniteNumber)(w.duration)?w.duration:0;o.live&&u.config.liveDurationInfinity?(R.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),w.duration=Infinity,this.updateSeekableRange(o)):(g>_&&g>f||!Object(G.isFiniteNumber)(f))&&(R.logger.log("[buffer-controller]: Updating Media Source duration to "+g.toFixed(3)),w.duration=g)},v.updateSeekableRange=function(o){var u=this.mediaSource,s=o.fragments,w=s.length;if(w&&o.live&&u!==null&&u!==void 0&&u.setLiveSeekableRange){var g=Math.max(0,s[0].start),f=Math.max(g,g+o.totalduration);u.setLiveSeekableRange(g,f)}},v.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,u=this.operationQueue,s=this.pendingTracks,w=Object.keys(s).length;if(w&&!o||w===2){this.createSourceBuffers(s),this.pendingTracks={};var g=this.getSourceBufferTypes();if(g.length===0){this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}g.forEach(function(f){u.executeNext(f)})}},v.createSourceBuffers=function(o){var u=this.sourceBuffer,s=this.mediaSource;if(!s)throw Error("createSourceBuffers called when mediaSource was null");var w=0;for(var g in o)if(!u[g]){var f=o[g];if(!f)throw Error("source buffer exists for track "+g+", however track does not");var _=f.levelCodec||f.codec,p=f.container+";codecs="+_;R.logger.log("[buffer-controller]: creating sourceBuffer("+p+")");try{var h=u[g]=s.addSourceBuffer(p),c=g;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[g]={buffer:h,codec:_,container:f.container,levelCodec:f.levelCodec,id:f.id},w++}catch(l){R.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+l.message),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:l,mimeType:p})}}w&&this.hls.trigger(I.Events.BUFFER_CREATED,{tracks:this.tracks})},v._onSBUpdateStart=function(o){var u=this.operationQueue,s=u.current(o);s.onStart()},v._onSBUpdateEnd=function(o){var u=this.operationQueue,s=u.current(o);s.onComplete(),u.shiftAndExecuteNext(o)},v._onSBUpdateError=function(o,u){R.logger.error("[buffer-controller]: "+o+" SourceBuffer error",u),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var s=this.operationQueue.current(o);s&&s.onError(u)},v.removeExecutor=function(o,u,s){var w=this.media,g=this.mediaSource,f=this.operationQueue,_=this.sourceBuffer,p=_[o];if(!w||!g||!p){R.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),f.shiftAndExecuteNext(o);return}var h=Object(G.isFiniteNumber)(w.duration)?w.duration:Infinity,c=Object(G.isFiniteNumber)(g.duration)?g.duration:Infinity,l=Math.max(0,u),a=Math.min(s,h,c);a>l?(R.logger.log("[buffer-controller]: Removing ["+l+","+a+"] from the "+o+" SourceBuffer"),console.assert(!p.updating,o+" sourceBuffer must not be updating"),p.remove(l,a)):f.shiftAndExecuteNext(o)},v.appendExecutor=function(o,u){var s=this.operationQueue,w=this.sourceBuffer,g=w[u];if(!g){R.logger.warn("[buffer-controller]: Attempting to append to the "+u+" SourceBuffer, but it does not exist"),s.shiftAndExecuteNext(u);return}g.ended=!1,console.assert(!g.updating,u+" sourceBuffer must not be updating"),g.appendBuffer(o)},v.blockBuffers=function(o,u){var s=this;if(u===void 0&&(u=this.getSourceBufferTypes()),!u.length){R.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var w=this.operationQueue,g=u.map(function(f){return w.appendBlocker(f)});Promise.all(g).then(function(){o(),u.forEach(function(f){var _=s.sourceBuffer[f];(!_||!_.updating)&&w.shiftAndExecuteNext(f)})})},v.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},v.addBufferListener=function(o,u,s){var w=this.sourceBuffer[o];if(!w)return;var g=s.bind(this,o);this.listeners[o].push({event:u,listener:g}),w.addEventListener(u,g)},v.removeBufferListeners=function(o){var u=this.sourceBuffer[o];if(!u)return;this.listeners[o].forEach(function(s){u.removeEventListener(s.event,s.listener)})},x}()},"./src/controller/buffer-operation-queue.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return I});var G=A("./src/utils/logger.ts"),I=function(){function R(U){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=U}var B=R.prototype;return B.append=function(k,L){var b=this.queues[L];b.push(k),b.length===1&&this.buffers[L]&&this.executeNext(L)},B.insertAbort=function(k,L){var b=this.queues[L];b.unshift(k),this.executeNext(L)},B.appendBlocker=function(k){var L,b=new Promise(function(O){L=O}),S={execute:L,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(S,k),b},B.executeNext=function(k){var L=this.buffers,b=this.queues,S=L[k],O=b[k];if(O.length){var C=O[0];try{C.execute()}catch(x){G.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),C.onError(x),(!S||!S.updating)&&(O.shift(),this.executeNext(k))}}},B.shiftAndExecuteNext=function(k){this.queues[k].shift(),this.executeNext(k)},B.current=function(k){return this.queues[k][0]},R}()},"./src/controller/cap-level-controller.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/events.ts");function I(U,k){for(var L=0;L<k.length;L++){var b=k[L];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(U,b.key,b)}}function R(U,k,L){return k&&I(U.prototype,k),L&&I(U,L),U}var B=function(){function U(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=U.prototype;return k.setStreamController=function(b){this.streamController=b},k.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},k.registerListeners=function(){var b=this.hls;b.on(G.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),b.on(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),b.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.on(G.Events.BUFFER_CODECS,this.onBufferCodecs,this),b.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.unregisterListener=function(){var b=this.hls;b.off(G.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),b.off(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),b.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.off(G.Events.BUFFER_CODECS,this.onBufferCodecs,this),b.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.onFpsDropLevelCapping=function(b,S){U.isLevelAllowed(S.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(S.droppedLevel)},k.onMediaAttaching=function(b,S){this.media=S.media instanceof HTMLVideoElement?S.media:null},k.onManifestParsed=function(b,S){var O=this.hls;this.restrictedLevels=[],this.firstLevel=S.firstLevel,O.config.capLevelToPlayerSize&&S.video&&this.startCapping()},k.onBufferCodecs=function(b,S){var O=this.hls;O.config.capLevelToPlayerSize&&S.video&&this.startCapping()},k.onMediaDetaching=function(){this.stopCapping()},k.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var b=this.hls.levels;if(b.length){var S=this.hls;S.autoLevelCapping=this.getMaxLevel(b.length-1),S.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=S.autoLevelCapping}}},k.getMaxLevel=function(b){var S=this,O=this.hls.levels;if(!O.length)return-1;var C=O.filter(function(x,v){return U.isLevelAllowed(v,S.restrictedLevels)&&v<=b});return this.clientRect=null,U.getMaxLevelByMediaSize(C,this.mediaWidth,this.mediaHeight)},k.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},k.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},k.getDimensions=function(){if(this.clientRect)return this.clientRect;var b=this.media,S={width:0,height:0};if(b){var O=b.getBoundingClientRect();S.width=O.width,S.height=O.height,!S.width&&!S.height&&(S.width=O.right-O.left||b.width||0,S.height=O.bottom-O.top||b.height||0)}return this.clientRect=S,S},U.isLevelAllowed=function(b,S){return S===void 0&&(S=[]),S.indexOf(b)===-1},U.getMaxLevelByMediaSize=function(b,S,O){if(!b||!b.length)return-1;for(var C=function(u,s){return s?u.width!==s.width||u.height!==s.height:!0},x=b.length-1,v=0;v<b.length;v+=1){var d=b[v];if((d.width>=S||d.height>=O)&&C(d,b[v+1])){x=v;break}}return x},R(U,[{key:"mediaWidth",get:function(){return this.getDimensions().width*U.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*U.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var b=1;try{b=self.devicePixelRatio}catch(S){}return b}}]),U}();V.default=B},"./src/controller/cmcd-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return C});var G=A("./src/events.ts"),I=A("./src/types/cmcd.ts"),R=A("./src/utils/buffer-helper.ts"),B=A("./src/utils/logger.ts");function U(x,v){for(var d=0;d<v.length;d++){var o=v[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(x,o.key,o)}}function k(x,v,d){return v&&U(x.prototype,v),d&&U(x,d),x}function L(x,v){var d=typeof Symbol!="undefined"&&x[Symbol.iterator]||x["@@iterator"];if(d)return(d=d.call(x)).next.bind(d);if(Array.isArray(x)||(d=b(x))||v&&x&&typeof x.length=="number"){d&&(x=d);var o=0;return function(){return o>=x.length?{done:!0}:{done:!1,value:x[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function b(x,v){if(!x)return;if(typeof x=="string")return S(x,v);var d=Object.prototype.toString.call(x).slice(8,-1);if(d==="Object"&&x.constructor&&(d=x.constructor.name),d==="Map"||d==="Set")return Array.from(x);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return S(x,v)}function S(x,v){(v==null||v>x.length)&&(v=x.length);for(var d=0,o=new Array(v);d<v;d++)o[d]=x[d];return o}function O(){return O=Object.assign||function(x){for(var v=1;v<arguments.length;v++){var d=arguments[v];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(x[o]=d[o])}return x},O.apply(this,arguments)}var C=function(){function x(d){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(w){try{o.apply(w,{ot:I.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(g){B.logger.warn("Could not generate manifest CMCD data.",g)}},this.applyFragmentData=function(w){try{var g=w.frag,f=o.hls.levels[g.level],_=o.getObjectType(g),p={d:g.duration*1e3,ot:_};(_===I.CMCDObjectType.VIDEO||_===I.CMCDObjectType.AUDIO||_==I.CMCDObjectType.MUXED)&&(p.br=f.bitrate/1e3,p.tb=o.getTopBandwidth(_),p.bl=o.getBufferLength(_)),o.apply(w,p)}catch(h){B.logger.warn("Could not generate segment CMCD data.",h)}},this.hls=d;var u=this.config=d.config,s=u.cmcd;s!=null&&(u.pLoader=this.createPlaylistLoader(),u.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||x.uuid(),this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.registerListeners())}var v=x.prototype;return v.registerListeners=function(){var o=this.hls;o.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(G.Events.BUFFER_CREATED,this.onBufferCreated,this)},v.unregisterListeners=function(){var o=this.hls;o.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(G.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},v.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},v.onMediaAttached=function(o,u){this.media=u.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},v.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},v.onBufferCreated=function(o,u){var s,w;this.audioBuffer=(s=u.tracks.audio)===null||s===void 0?void 0:s.buffer,this.videoBuffer=(w=u.tracks.video)===null||w===void 0?void 0:w.buffer},v.createData=function(){var o;return{v:I.CMCDVersion,sf:I.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},v.apply=function(o,u){u===void 0&&(u={}),O(u,this.createData());var s=u.ot===I.CMCDObjectType.INIT||u.ot===I.CMCDObjectType.VIDEO||u.ot===I.CMCDObjectType.MUXED;if(this.starved&&s&&(u.bs=!0,u.su=!0,this.starved=!1),u.su==null&&(u.su=this.buffering),this.useHeaders){var w=x.toHeaders(u);if(!Object.keys(w).length)return;o.headers||(o.headers={}),O(o.headers,w)}else{var g=x.toQuery(u);if(!g)return;o.url=x.appendQueryToUri(o.url,g)}},v.getObjectType=function(o){var u=o.type;return u==="subtitle"?I.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?I.CMCDObjectType.INIT:u==="audio"?I.CMCDObjectType.AUDIO:u==="main"?this.hls.audioTracks.length?I.CMCDObjectType.VIDEO:I.CMCDObjectType.MUXED:void 0},v.getTopBandwidth=function(o){for(var u=0,s=o===I.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,w=L(s),g;!(g=w()).done;){var f=g.value;f.bitrate>u&&(u=f.bitrate)}return u>0?u:NaN},v.getBufferLength=function(o){var u=this.hls.media,s=o===I.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!s||!u)return NaN;var w=R.BufferHelper.bufferInfo(s,u.currentTime,this.config.maxBufferHole);return w.len*1e3},v.createPlaylistLoader=function(){var o=this.config.pLoader,u=this.applyPlaylistData,s=o||this.config.loader;return function(){function w(f){this.loader=void 0,this.loader=new s(f)}var g=w.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(_,p,h){u(_),this.loader.load(_,p,h)},k(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},v.createFragmentLoader=function(){var o=this.config.fLoader,u=this.applyFragmentData,s=o||this.config.loader;return function(){function w(f){this.loader=void 0,this.loader=new s(f)}var g=w.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(_,p,h){u(_),this.loader.load(_,p,h)},k(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},x.uuid=function(){var o=URL.createObjectURL(new Blob),u=o.toString();return URL.revokeObjectURL(o),u.substr(u.lastIndexOf("/")+1)},x.serialize=function(o){for(var u=[],s=function(F){return!Number.isNaN(F)&&F!=null&&F!==""&&F!==!1},w=function(F){return Math.round(F)},g=function(F){return w(F/100)*100},f=function(F){return encodeURIComponent(F)},_={br:w,d:w,bl:g,dl:g,mtp:g,nor:f,rtp:g,tb:w},p=Object.keys(o||{}).sort(),h=L(p),c;!(c=h()).done;){var l=c.value,a=o[l];if(!s(a))continue;if(l==="v"&&a===1)continue;if(l=="pr"&&a===1)continue;var y=_[l];y&&(a=y(a));var m=typeof a,E=void 0;l==="ot"||l==="sf"||l==="st"?E=l+"="+a:m==="boolean"?E=l:m==="number"?E=l+"="+a:E=l+"="+JSON.stringify(a),u.push(E)}return u.join(",")},x.toHeaders=function(o){for(var u=Object.keys(o),s={},w=["Object","Request","Session","Status"],g=[{},{},{},{}],f={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},_=0,p=u;_<p.length;_++){var h=p[_],c=f[h]!=null?f[h]:1;g[c][h]=o[h]}for(var l=0;l<g.length;l++){var a=x.serialize(g[l]);a&&(s["CMCD-"+w[l]]=a)}return s},x.toQuery=function(o){return"CMCD="+encodeURIComponent(x.serialize(o))},x.appendQueryToUri=function(o,u){if(!u)return o;var s=o.includes("?")?"&":"?";return""+o+s+u},x}()},"./src/controller/eme-controller.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/events.ts"),I=A("./src/errors.ts"),R=A("./src/utils/logger.ts"),B=A("./src/utils/mediakeys-helper.ts");function U(C,x){for(var v=0;v<x.length;v++){var d=x[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(C,d.key,d)}}function k(C,x,v){return x&&U(C.prototype,x),v&&U(C,v),C}var L=3,b=function(x,v,d){var o={audioCapabilities:[],videoCapabilities:[]};return x.forEach(function(u){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+u+'"',robustness:d.audioRobustness||""})}),v.forEach(function(u){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+u+'"',robustness:d.videoRobustness||""})}),[o]},S=function(x,v,d,o){switch(x){case B.KeySystems.WIDEVINE:return b(v,d,o);default:throw new Error("Unknown key-system: "+x)}},O=function(){function C(v){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=v,this._config=v.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var x=C.prototype;return x.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},x._registerListeners=function(){this.hls.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this)},x._unregisterListeners=function(){this.hls.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this)},x.getLicenseServerUrl=function(d){switch(d){case B.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},x._attemptKeySystemAccess=function(d,o,u){var s=this,w=S(d,o,u,this._drmSystemOptions);R.logger.log("Requesting encrypted media key-system access");var g=this.requestMediaKeySystemAccess(d,w);this.mediaKeysPromise=g.then(function(f){return s._onMediaKeySystemAccessObtained(d,f)}),g.catch(function(f){R.logger.error('Failed to obtain key-system "'+d+'" access:',f)})},x._onMediaKeySystemAccessObtained=function(d,o){var u=this;R.logger.log('Access for key-system "'+d+'" obtained');var s={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:d};this._mediaKeysList.push(s);var w=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(g){return s.mediaKeys=g,R.logger.log('Media-keys created for key-system "'+d+'"'),u._onMediaKeysCreated(),g});return w.catch(function(g){R.logger.error("Failed to create media-keys:",g)}),w},x._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),d._onNewMediaKeySession(o.mediaKeysSession))})},x._onNewMediaKeySession=function(d){var o=this;R.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(u){o._onKeySessionMessage(d,u.message)},!1)},x._onKeySessionMessage=function(d,o){R.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(u){R.logger.log("Received license data (length: "+(u&&u.byteLength)+"), updating key-session"),d.update(u)})},x.onMediaEncrypted=function(d){var o=this;if(R.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var u=function(w){if(!o._media)return;o._attemptSetMediaKeys(w),o._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(u).catch(u)},x._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}R.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},x._generateRequestWithPreferredKeySession=function(d,o){var u=this,s=this._mediaKeysList[0];if(!s){R.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(s.mediaKeysSessionInitialized){R.logger.warn("Key-Session already initialized but requested again");return}var w=s.mediaKeysSession;if(!w){R.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){R.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}R.logger.log('Generating key-session request for "'+d+'" init data type'),s.mediaKeysSessionInitialized=!0,w.generateRequest(d,o).then(function(){R.logger.debug("Key-session generation succeeded")}).catch(function(g){R.logger.error("Error generating key-session request:",g),u.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},x._createLicenseXhr=function(d,o,u){var s=new XMLHttpRequest;s.responseType="arraybuffer",s.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,s,d,o,u);var w=this._licenseXhrSetup;if(w)try{w.call(this.hls,s,d),w=void 0}catch(g){R.logger.error(g)}try{s.readyState||s.open("POST",d,!0),w&&w.call(this.hls,s,d)}catch(g){throw new Error("issue setting up KeySystem license XHR "+g)}return s},x._onLicenseRequestReadyStageChange=function(d,o,u,s){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,R.logger.log("License request succeeded");var w=d.response,g=this._licenseResponseCallback;if(g)try{w=g.call(this.hls,d,o)}catch(_){R.logger.error(_)}s(w)}else{if(R.logger.error("License Request XHR failed ("+o+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>L){this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var f=L-this._requestLicenseFailureCount+1;R.logger.warn("Retrying license request, "+f+" attempts left"),this._requestLicense(u,s)}break}},x._generateLicenseRequestChallenge=function(d,o){switch(d.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},x._requestLicense=function(d,o){R.logger.log("Requesting content license for key-system");var u=this._mediaKeysList[0];if(!u){R.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var s=this.getLicenseServerUrl(u.mediaKeySystemDomain),w=this._createLicenseXhr(s,d,o);R.logger.log("Sending license request to URL: "+s);var g=this._generateLicenseRequestChallenge(u,d);w.send(g)}catch(f){R.logger.error("Failure requesting DRM license: "+f),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},x.onMediaAttached=function(d,o){if(!this._emeEnabled)return;var u=o.media;this._media=u,u.addEventListener("encrypted",this._onMediaEncrypted)},x.onMediaDetached=function(){var d=this._media,o=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(u){if(u.mediaKeysSession)return u.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},x.onManifestParsed=function(d,o){if(!this._emeEnabled)return;var u=o.levels.map(function(w){return w.audioCodec}).filter(function(w){return!!w}),s=o.levels.map(function(w){return w.videoCodec}).filter(function(w){return!!w});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,u,s)},k(C,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),C}();V.default=O},"./src/controller/fps-controller.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/events.ts"),I=A("./src/utils/logger.ts"),R=function(){function B(k){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=k,this.registerListeners()}var U=B.prototype;return U.setStreamController=function(L){this.streamController=L},U.registerListeners=function(){this.hls.on(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},U.unregisterListeners=function(){this.hls.off(G.Events.MEDIA_ATTACHING,this.onMediaAttaching)},U.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},U.onMediaAttaching=function(L,b){var S=this.hls.config;if(S.capLevelOnFPSDrop){var O=b.media instanceof self.HTMLVideoElement?b.media:null;this.media=O,O&&typeof O.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),S.fpsDroppedMonitoringPeriod)}},U.checkFPS=function(L,b,S){var O=performance.now();if(b){if(this.lastTime){var C=O-this.lastTime,x=S-this.lastDroppedFrames,v=b-this.lastDecodedFrames,d=1e3*x/C,o=this.hls;if(o.trigger(G.Events.FPS_DROP,{currentDropped:x,currentDecoded:v,totalDroppedFrames:S}),d>0&&x>o.config.fpsDroppedMonitoringThreshold*v){var u=o.currentLevel;I.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=u)&&(u=u-1,o.trigger(G.Events.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:o.currentLevel}),o.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=O,this.lastDroppedFrames=S,this.lastDecodedFrames=b}},U.checkFPSInterval=function(){var L=this.media;if(L)if(this.isVideoPlaybackQualityAvailable){var b=L.getVideoPlaybackQuality();this.checkFPS(L,b.totalVideoFrames,b.droppedVideoFrames)}else this.checkFPS(L,L.webkitDecodedFrameCount,L.webkitDroppedFrameCount)},B}();V.default=R},"./src/controller/fragment-finders.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"findFragmentByPDT",function(){return R}),A.d(V,"findFragmentByPTS",function(){return B}),A.d(V,"fragmentWithinToleranceTest",function(){return U}),A.d(V,"pdtWithinToleranceTest",function(){return k}),A.d(V,"findFragWithCC",function(){return L});var G=A("./src/polyfills/number.ts"),I=A("./src/utils/binary-search.ts");function R(b,S,O){if(S===null||!Array.isArray(b)||!b.length||!Object(G.isFiniteNumber)(S))return null;var C=b[0].programDateTime;if(S<(C||0))return null;var x=b[b.length-1].endProgramDateTime;if(S>=(x||0))return null;O=O||0;for(var v=0;v<b.length;++v){var d=b[v];if(k(S,O,d))return d}return null}function B(b,S,O,C){O===void 0&&(O=0),C===void 0&&(C=0);var x=null;if(b?x=S[b.sn-S[0].sn+1]||null:O===0&&S[0].start===0&&(x=S[0]),x&&U(O,C,x)===0)return x;var v=I.default.search(S,U.bind(null,O,C));return v||x}function U(b,S,O){b===void 0&&(b=0),S===void 0&&(S=0);var C=Math.min(S,O.duration+(O.deltaPTS?O.deltaPTS:0));return O.start+O.duration-C<=b?1:O.start-C>b&&O.start?-1:0}function k(b,S,O){var C=Math.min(S,O.duration+(O.deltaPTS?O.deltaPTS:0))*1e3,x=O.endProgramDateTime||0;return x-C>b}function L(b,S){return I.default.search(b,function(O){return O.cc<S?1:O.cc>S?-1:0})}},"./src/controller/fragment-tracker.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"FragmentState",function(){return R}),A.d(V,"FragmentTracker",function(){return B});var G=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 B=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 b=L.prototype;return b._registerListeners=function(){var O=this.hls;O.on(G.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.on(G.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.on(G.Events.FRAG_LOADED,this.onFragLoaded,this)},b._unregisterListeners=function(){var O=this.hls;O.off(G.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.off(G.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.off(G.Events.FRAG_LOADED,this.onFragLoaded,this)},b.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},b.getAppendedFrag=function(O,C){if(C===I.PlaylistLevelType.MAIN){var x=this.activeFragment,v=this.activeParts;if(!x)return null;if(v)for(var d=v.length;d--;){var o=v[d],u=o?o.end:x.appendedPTS;if(o.start<=O&&u!==void 0&&O<=u)return d>9&&(this.activeParts=v.slice(d-9)),o}else if(x.start<=O&&x.appendedPTS!==void 0&&O<=x.appendedPTS)return x}return this.getBufferedFrag(O,C)},b.getBufferedFrag=function(O,C){for(var x=this.fragments,v=Object.keys(x),d=v.length;d--;){var o=x[v[d]];if((o==null?void 0:o.body.type)===C&&o.buffered){var u=o.body;if(u.start<=O&&O<=u.end)return u}}return null},b.detectEvictedFragments=function(O,C,x){var v=this;Object.keys(this.fragments).forEach(function(d){var o=v.fragments[d];if(!o)return;if(!o.buffered){o.body.type===x&&v.removeFragment(o.body);return}var u=o.range[O];if(!u)return;u.time.some(function(s){var w=!v.isTimeBuffered(s.startPTS,s.endPTS,C);return w&&v.removeFragment(o.body),w})})},b.detectPartialFragments=function(O){var C=this,x=this.timeRanges,v=O.frag,d=O.part;if(!x||v.sn==="initSegment")return;var o=k(v),u=this.fragments[o];if(!u)return;Object.keys(x).forEach(function(s){var w=v.elementaryStreams[s];if(!w)return;var g=x[s],f=d!==null||w.partial===!0;u.range[s]=C.getBufferedTimes(v,d,f,g)}),u.backtrack=u.loaded=null,Object.keys(u.range).length?u.buffered=!0:this.removeFragment(u.body)},b.fragBuffered=function(O){var C=k(O),x=this.fragments[C];x&&(x.backtrack=x.loaded=null,x.buffered=!0)},b.getBufferedTimes=function(O,C,x,v){for(var d={time:[],partial:x},o=C?C.start:O.start,u=C?C.end:O.end,s=O.minEndPTS||u,w=O.maxStartPTS||o,g=0;g<v.length;g++){var f=v.start(g)-this.bufferPadding,_=v.end(g)+this.bufferPadding;if(w>=f&&s<=_){d.time.push({startPTS:Math.max(o,v.start(g)),endPTS:Math.min(u,v.end(g))});break}else if(o<_&&u>f)d.partial=!0,d.time.push({startPTS:Math.max(o,v.start(g)),endPTS:Math.min(u,v.end(g))});else if(u<=f)break}return d},b.getPartialFragment=function(O){var C=null,x,v,d,o=0,u=this.bufferPadding,s=this.fragments;return Object.keys(s).forEach(function(w){var g=s[w];if(!g)return;U(g)&&(v=g.body.start-u,d=g.body.end+u,O>=v&&O<=d&&(x=Math.min(O-v,d-O),o<=x&&(C=g.body,o=x)))}),C},b.getState=function(O){var C=k(O),x=this.fragments[C];return x?x.buffered?U(x)?R.PARTIAL:R.OK:x.backtrack?R.BACKTRACKED:R.APPENDING:R.NOT_LOADED},b.backtrack=function(O,C){var x=k(O),v=this.fragments[x];if(!v||v.backtrack)return null;var d=v.backtrack=C||v.loaded;return v.loaded=null,d},b.getBacktrackData=function(O){var C=k(O),x=this.fragments[C];if(x){var v,d=x.backtrack;if(d!=null&&(v=d.payload)!==null&&v!==void 0&&v.byteLength)return d;this.removeFragment(O)}return null},b.isTimeBuffered=function(O,C,x){for(var v,d,o=0;o<x.length;o++){if(v=x.start(o)-this.bufferPadding,d=x.end(o)+this.bufferPadding,O>=v&&C<=d)return!0;if(C<=v)return!1}return!1},b.onFragLoaded=function(O,C){var x=C.frag,v=C.part;if(x.sn==="initSegment"||x.bitrateTest||v)return;var d=k(x);this.fragments[d]={body:x,loaded:C,backtrack:null,buffered:!1,range:Object.create(null)}},b.onBufferAppended=function(O,C){var x=this,v=C.frag,d=C.part,o=C.timeRanges;if(v.type===I.PlaylistLevelType.MAIN)if(this.activeFragment=v,d){var u=this.activeParts;u||(this.activeParts=u=[]),u.push(d)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(s){var w=o[s];if(x.detectEvictedFragments(s,w),!d)for(var g=0;g<w.length;g++)v.appendedPTS=Math.max(w.end(g),v.appendedPTS||0)})},b.onFragBuffered=function(O,C){this.detectPartialFragments(C)},b.hasFragment=function(O){var C=k(O);return!!this.fragments[C]},b.removeFragmentsInRange=function(O,C,x){var v=this;Object.keys(this.fragments).forEach(function(d){var o=v.fragments[d];if(!o)return;if(o.buffered){var u=o.body;u.type===x&&u.start<C&&u.end>O&&v.removeFragment(u)}})},b.removeFragment=function(O){var C=k(O);O.stats.loaded=0,O.clearElementaryStreamInfo(),delete this.fragments[C]},b.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},L}();function U(L){var b,S;return L.buffered&&(((b=L.range.video)===null||b===void 0?void 0:b.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(re,V,A){"use strict";A.r(V),A.d(V,"STALL_MINIMUM_DURATION_MS",function(){return U}),A.d(V,"MAX_START_GAP_JUMP",function(){return k}),A.d(V,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return L}),A.d(V,"SKIP_BUFFER_RANGE_START",function(){return b}),A.d(V,"default",function(){return S});var G=A("./src/utils/buffer-helper.ts"),I=A("./src/errors.ts"),R=A("./src/events.ts"),B=A("./src/utils/logger.ts"),U=250,k=2,L=.1,b=.05,S=function(){function O(x,v,d,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=x,this.media=v,this.fragmentTracker=d,this.hls=o}var C=O.prototype;return C.destroy=function(){this.hls=this.fragmentTracker=this.media=null},C.poll=function(v){var d=this.config,o=this.media,u=this.stalled,s=o.currentTime,w=o.seeking,g=this.seeking&&!w,f=!this.seeking&&w;if(this.seeking=w,s!==v){if(this.moved=!0,u!==null){if(this.stallReported){var _=self.performance.now()-u;B.logger.warn("playback not stuck anymore @"+s+", after "+Math.round(_)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((f||g)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!G.BufferHelper.getBuffered(o).length)return;var p=G.BufferHelper.bufferInfo(o,s,0),h=p.len>0,c=p.nextStart||0;if(!h&&!c)return;if(w){var l=p.len>k,a=!c||c-s>k&&!this.fragmentTracker.getPartialFragment(s);if(l||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var y,m=Math.max(c,p.start||0)-s,E=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,M=E==null||((y=E.details)===null||y===void 0)?void 0:y.live,F=M?E.details.targetduration*2:k;if(m>0&&m<=F){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(u===null){this.stalled=j;return}var W=j-u;!w&&W>=U&&this._reportStall(p.len);var D=G.BufferHelper.bufferInfo(o,s,d.maxBufferHole);this._tryFixBufferStall(D,W)},C._tryFixBufferStall=function(v,d){var o=this.config,u=this.fragmentTracker,s=this.media,w=s.currentTime,g=u.getPartialFragment(w);if(g){var f=this._trySkipBufferHole(g);if(f)return}v.len>o.maxBufferHole&&d>o.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},C._reportStall=function(v){var d=this.hls,o=this.media,u=this.stallReported;u||(this.stallReported=!0,B.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+v+")"),d.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:v}))},C._trySkipBufferHole=function(v){for(var d=this.config,o=this.hls,u=this.media,s=u.currentTime,w=0,g=G.BufferHelper.getBuffered(u),f=0;f<g.length;f++){var _=g.start(f);if(s+d.maxBufferHole>=w&&s<_){var p=Math.max(_+b,u.currentTime+L);return B.logger.warn("skipping hole, adjusting currentTime from "+s+" to "+p),this.moved=!0,this.stalled=null,u.currentTime=p,v&&o.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+s+" to "+p,frag:v}),p}w=g.end(f)}return 0},C._tryNudgeBuffer=function(){var v=this.config,d=this.hls,o=this.media,u=o.currentTime,s=(this.nudgeRetry||0)+1;if(this.nudgeRetry=s,s<v.nudgeMaxRetry){var w=u+s*v.nudgeOffset;B.logger.warn("Nudging 'currentTime' from "+u+" to "+w),o.currentTime=w,d.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else B.logger.error("Playhead still not moving while enough data buffered @"+u+" after "+v.nudgeMaxRetry+" nudges"),d.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},O}()},"./src/controller/id3-track-controller.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/events.ts"),I=A("./src/utils/texttrack-utils.ts"),R=A("./src/demux/id3.ts"),B=.25,U=function(){function k(b){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=b,this._registerListeners()}var L=k.prototype;return L.destroy=function(){this._unregisterListeners()},L._registerListeners=function(){var S=this.hls;S.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.on(G.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),S.on(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L._unregisterListeners=function(){var S=this.hls;S.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.off(G.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),S.off(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L.onMediaAttached=function(S,O){this.media=O.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 O=0;O<S.length;O++){var C=S[O];if(C.kind==="metadata"&&C.label==="id3")return Object(I.sendAddTrackEvent)(C,this.media),C}return this.media.addTextTrack("metadata","id3")},L.onFragParsingMetadata=function(S,O){if(!this.media)return;var C=O.frag,x=O.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var v=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<x.length;d++){var o=R.getID3Frames(x[d].data);if(o){var u=x[d].pts,s=d<x.length-1?x[d+1].pts:C.end,w=s-u;w<=0&&(s=u+B);for(var g=0;g<o.length;g++){var f=o[g];if(!R.isTimeStampFrame(f)){var _=new v(u,s,"");_.value=f,this.id3Track.addCue(_)}}}}},L.onBufferFlushing=function(S,O){var C=O.startOffset,x=O.endOffset,v=O.type;if(!v||v==="audio"){var d=this.id3Track;d&&Object(I.removeCuesInRange)(d,C,x)}},k}();V.default=U},"./src/controller/latency-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return k});var G=A("./src/errors.ts"),I=A("./src/events.ts"),R=A("./src/utils/logger.ts");function B(L,b){for(var S=0;S<b.length;S++){var O=b[S];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(L,O.key,O)}}function U(L,b,S){return b&&B(L.prototype,b),S&&B(L,S),L}var k=function(){function L(S){var O=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return O.timeupdate()},this.hls=S,this.config=S.config,this.registerListeners()}var b=L.prototype;return b.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},b.registerListeners=function(){this.hls.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(I.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){this.hls.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(I.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(I.Events.ERROR,this.onError)},b.onMediaAttached=function(O,C){this.media=C.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},b.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},b.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},b.onLevelUpdated=function(O,C){var x=C.details;this.levelDetails=x,x.advanced&&this.timeupdate(),!x.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},b.onError=function(O,C){if(C.details!==G.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,R.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},b.timeupdate=function(){var O=this.media,C=this.levelDetails;if(!O||!C)return;this.currentTime=O.currentTime;var x=this.computeLatency();if(x===null)return;this._latency=x;var v=this.config,d=v.lowLatencyMode,o=v.maxLiveSyncPlaybackRate;if(!d||o===1)return;var u=this.targetLatency;if(u===null)return;var s=x-u,w=Math.min(this.maxLatency,u+C.targetduration),g=s<w;if(C.live&&g&&s>.05&&this.forwardBufferLength>1){var f=Math.min(2,Math.max(1,o)),_=Math.round(2/(1+Math.exp(-.75*s-this.edgeStalled))*20)/20;O.playbackRate=Math.min(f,Math.max(1,_))}else O.playbackRate!==1&&O.playbackRate!==0&&(O.playbackRate=1)},b.estimateLiveEdge=function(){var O=this.levelDetails;return O===null?null:O.edge+O.age},b.computeLatency=function(){var O=this.estimateLiveEdge();return O===null?null:O-this.currentTime},U(L,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var O=this.config,C=this.levelDetails;return O.liveMaxLatencyDuration!==void 0?O.liveMaxLatencyDuration:C?O.liveMaxLatencyDurationCount*C.targetduration:0}},{key:"targetLatency",get:function(){var O=this.levelDetails;if(O===null)return null;var C=O.holdBack,x=O.partHoldBack,v=O.targetduration,d=this.config,o=d.liveSyncDuration,u=d.liveSyncDurationCount,s=d.lowLatencyMode,w=this.hls.userConfig,g=s&&x||C;(w.liveSyncDuration||w.liveSyncDurationCount||g===0)&&(g=o!==void 0?o:u*v);var f=v,_=1;return g+Math.min(this.stallCount*_,f)}},{key:"liveSyncPosition",get:function(){var O=this.estimateLiveEdge(),C=this.targetLatency,x=this.levelDetails;if(O===null||C===null||x===null)return null;var v=x.edge,d=O-C-this.edgeStalled,o=v-x.totalduration,u=v-(this.config.lowLatencyMode&&x.partTarget||x.targetduration);return Math.min(Math.max(o,d),u)}},{key:"drift",get:function(){var O=this.levelDetails;return O===null?1:O.drift}},{key:"edgeStalled",get:function(){var O=this.levelDetails;if(O===null)return 0;var C=(this.config.lowLatencyMode&&O.partTarget||O.targetduration)*3;return Math.max(O.age-C,0)}},{key:"forwardBufferLength",get:function(){var O=this.media,C=this.levelDetails;if(!O||!C)return 0;var x=O.buffered.length;return x?O.buffered.end(x-1):C.edge-this.currentTime}}]),L}()},"./src/controller/level-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return d});var G=A("./src/types/level.ts"),I=A("./src/events.ts"),R=A("./src/errors.ts"),B=A("./src/utils/codecs.ts"),U=A("./src/controller/level-helper.ts"),k=A("./src/controller/base-playlist-controller.ts"),L=A("./src/types/loader.ts");function b(){return b=Object.assign||function(o){for(var u=1;u<arguments.length;u++){var s=arguments[u];for(var w in s)Object.prototype.hasOwnProperty.call(s,w)&&(o[w]=s[w])}return o},b.apply(this,arguments)}function S(o,u){for(var s=0;s<u.length;s++){var w=u[s];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function O(o,u,s){return u&&S(o.prototype,u),s&&S(o,s),o}function C(o,u){o.prototype=Object.create(u.prototype),o.prototype.constructor=o,x(o,u)}function x(o,u){return x=Object.setPrototypeOf||function(w,g){return w.__proto__=g,w},x(o,u)}var v=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(o){C(u,o);function u(w){var g;return g=o.call(this,w,"[level-controller]")||this,g._levels=[],g._firstLevel=-1,g._startLevel=void 0,g.currentLevelIndex=-1,g.manualLevelIndex=-1,g.onParsedComplete=void 0,g._registerListeners(),g}var s=u.prototype;return s._registerListeners=function(){var g=this.hls;g.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.on(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),g.on(I.Events.ERROR,this.onError,this)},s._unregisterListeners=function(){var g=this.hls;g.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.off(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),g.off(I.Events.ERROR,this.onError,this)},s.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},s.startLoad=function(){var g=this._levels;g.forEach(function(f){f.loadError=0}),o.prototype.startLoad.call(this)},s.onManifestLoaded=function(g,f){var _=[],p=[],h=[],c,l={},a,y=!1,m=!1,E=!1;if(f.levels.forEach(function(W){var D=W.attrs;y=y||!!(W.width&&W.height),m=m||!!W.videoCodec,E=E||!!W.audioCodec,v&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var P=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;a=l[P],a?a.url.push(W.url):(a=new G.Level(W),l[P]=a,_.push(a)),D&&(D.AUDIO&&Object(U.addGroupId)(a,"audio",D.AUDIO),D.SUBTITLES&&Object(U.addGroupId)(a,"text",D.SUBTITLES))}),(y||m)&&E&&(_=_.filter(function(W){var D=W.videoCodec,P=W.width,H=W.height;return!!D||!!(P&&H)})),_=_.filter(function(W){var D=W.audioCodec,P=W.videoCodec;return(!D||Object(B.isCodecSupportedInMp4)(D,"audio"))&&(!P||Object(B.isCodecSupportedInMp4)(P,"video"))}),f.audioTracks&&(p=f.audioTracks.filter(function(W){return!W.audioCodec||Object(B.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(U.assignTrackIdsByGroup)(p)),f.subtitles&&(h=f.subtitles,Object(U.assignTrackIdsByGroup)(h)),_.length>0){c=_[0].bitrate,_.sort(function(W,D){return W.bitrate-D.bitrate}),this._levels=_;for(var M=0;M<_.length;M++)if(_[M].bitrate===c){this._firstLevel=M,this.log("manifest loaded, "+_.length+" level(s) found, first bitrate: "+c);break}var F=E&&!m,j={levels:_,audioTracks:p,subtitleTracks:h,firstLevel:this._firstLevel,stats:f.stats,audio:E,video:m,altAudio:!F&&p.some(function(W){return!!W.url})};this.hls.trigger(I.Events.MANIFEST_PARSED,j),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:f.url,reason:"no level with compatible codecs found in manifest"})},s.onError=function(g,f){if(o.prototype.onError.call(this,g,f),f.fatal)return;var _=f.context,p=this._levels[this.currentLevelIndex];if(_&&(_.type===L.PlaylistContextType.AUDIO_TRACK&&p.audioGroupIds&&_.groupId===p.audioGroupIds[p.urlId]||_.type===L.PlaylistContextType.SUBTITLE_TRACK&&p.textGroupIds&&_.groupId===p.textGroupIds[p.urlId])){this.redundantFailover(this.currentLevelIndex);return}var h=!1,c=!0,l;switch(f.details){case R.ErrorDetails.FRAG_LOAD_ERROR:case R.ErrorDetails.FRAG_LOAD_TIMEOUT:case R.ErrorDetails.KEY_LOAD_ERROR:case R.ErrorDetails.KEY_LOAD_TIMEOUT:if(f.frag){var a=this._levels[f.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(l=f.frag.level)):l=f.frag.level}break;case R.ErrorDetails.LEVEL_LOAD_ERROR:case R.ErrorDetails.LEVEL_LOAD_TIMEOUT:_&&(_.deliveryDirectives&&(c=!1),l=_.level),h=!0;break;case R.ErrorDetails.REMUX_ALLOC_ERROR:l=f.level,h=!0;break}l!==void 0&&this.recoverLevel(f,l,h,c)},s.recoverLevel=function(g,f,_,p){var h=g.details,c=this._levels[f];if(c.loadError++,_){var l=this.retryLoadingOrFail(g);if(l)g.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(p){var a=c.url.length;if(a>1&&c.loadError<a)g.levelRetry=!0,this.redundantFailover(f);else if(this.manualLevelIndex===-1){var y=f===0?this._levels.length-1:f-1;this.currentLevelIndex!==y&&this._levels[y].loadError===0&&(this.warn(h+": switch to "+y),g.levelRetry=!0,this.hls.nextAutoLevel=y)}}},s.redundantFailover=function(g){var f=this._levels[g],_=f.url.length;if(_>1){var p=(f.urlId+1)%_;this.warn("Switching to redundant URL-id "+p),this._levels.forEach(function(h){h.urlId=p}),this.level=g}},s.onFragLoaded=function(g,f){var _=f.frag;if(_!==void 0&&_.type===L.PlaylistLevelType.MAIN){var p=this._levels[_.level];p!==void 0&&(p.fragmentError=0,p.loadError=0)}},s.onLevelLoaded=function(g,f){var _,p=f.level,h=f.details,c=this._levels[p];if(!c){var l;this.warn("Invalid level index "+p),(l=f.deliveryDirectives)!==null&&l!==void 0&&l.skip&&(h.deltaUpdateFailed=!0);return}p===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(p,f,c.details)):(_=f.deliveryDirectives)!==null&&_!==void 0&&_.skip&&(h.deltaUpdateFailed=!0)},s.onAudioTrackSwitched=function(g,f){var _=this.hls.levels[this.currentLevelIndex];if(!_)return;if(_.audioGroupIds){for(var p=-1,h=this.hls.audioTracks[f.id].groupId,c=0;c<_.audioGroupIds.length;c++)if(_.audioGroupIds[c]===h){p=c;break}p!==_.urlId&&(_.urlId=p,this.startLoad())}},s.loadPlaylist=function(g){var f=this.currentLevelIndex,_=this._levels[f];if(this.canLoad&&_&&_.url.length>0){var p=_.urlId,h=_.url[p];if(g)try{h=g.addDirectives(h)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+f+(g?" at sn "+g.msn+" part "+g.part:"")+" with URL-id "+p+" "+h),this.clearTimer(),this.hls.trigger(I.Events.LEVEL_LOADING,{url:h,level:f,id:p,deliveryDirectives:g||null})}},s.removeLevel=function(g,f){var _=function(c,l){return l!==f},p=this._levels.filter(function(h,c){return c!==g?!0:h.url.length>1&&f!==void 0?(h.url=h.url.filter(_),h.audioGroupIds&&(h.audioGroupIds=h.audioGroupIds.filter(_)),h.textGroupIds&&(h.textGroupIds=h.textGroupIds.filter(_)),h.urlId=0,!0):!1}).map(function(h,c){var l=h.details;return l!=null&&l.fragments&&l.fragments.forEach(function(a){a.level=c}),h});this._levels=p,this.hls.trigger(I.Events.LEVELS_UPDATED,{levels:p})},O(u,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(g){var f,_=this._levels;if(_.length===0)return;if(this.currentLevelIndex===g&&(f=_[g])!==null&&f!==void 0&&f.details)return;if(g<0||g>=_.length){var p=g<0;if(this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.LEVEL_SWITCH_ERROR,level:g,fatal:p,reason:"invalid level idx"}),p)return;g=Math.min(g,_.length-1)}this.clearTimer();var h=this.currentLevelIndex,c=_[h],l=_[g];this.log("switching to level "+g+" from "+h),this.currentLevelIndex=g;var a=b({},l,{level:g,maxBitrate:l.maxBitrate,uri:l.uri,urlId:l.urlId});delete a._urlId,this.hls.trigger(I.Events.LEVEL_SWITCHING,a);var y=l.details;if(!y||y.live){var m=this.switchParams(l.uri,c==null?void 0:c.details);this.loadPlaylist(m)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(g){this.manualLevelIndex=g,this._startLevel===void 0&&(this._startLevel=g),g!==-1&&(this.level=g)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(g){this._firstLevel=g}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var g=this.hls.config.startLevel;return g!==void 0?g:this._firstLevel}else return this._startLevel},set:function(g){this._startLevel=g}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(g){this.level=g,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=g)}}]),u}(k.default)},"./src/controller/level-helper.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"addGroupId",function(){return R}),A.d(V,"assignTrackIdsByGroup",function(){return B}),A.d(V,"updatePTS",function(){return U}),A.d(V,"updateFragPTSDTS",function(){return L}),A.d(V,"mergeDetails",function(){return b}),A.d(V,"mapPartIntersection",function(){return S}),A.d(V,"mapFragmentIntersection",function(){return O}),A.d(V,"adjustSliding",function(){return C}),A.d(V,"addSliding",function(){return x}),A.d(V,"computeReloadInterval",function(){return v}),A.d(V,"getFragmentWithSN",function(){return d}),A.d(V,"getPartWith",function(){return o});var G=A("./src/polyfills/number.ts"),I=A("./src/utils/logger.ts");function R(u,s,w){switch(s){case"audio":u.audioGroupIds||(u.audioGroupIds=[]),u.audioGroupIds.push(w);break;case"text":u.textGroupIds||(u.textGroupIds=[]),u.textGroupIds.push(w);break}}function B(u){var s={};u.forEach(function(w){var g=w.groupId||"";w.id=s[g]=s[g]||0,s[g]++})}function U(u,s,w){var g=u[s],f=u[w];k(g,f)}function k(u,s){var w=s.startPTS;if(Object(G.isFiniteNumber)(w)){var g=0,f;s.sn>u.sn?(g=w-u.start,f=u):(g=u.start-w,f=s),f.duration!==g&&(f.duration=g)}else if(s.sn>u.sn){var _=u.cc===s.cc;_&&u.minEndPTS?s.start=u.start+(u.minEndPTS-u.start):s.start=u.start+u.duration}else s.start=Math.max(u.start-s.duration,0)}function L(u,s,w,g,f,_){var p=g-w;p<=0&&(I.logger.warn("Fragment should have a positive duration",s),g=w+s.duration,_=f+s.duration);var h=w,c=g,l=s.startPTS,a=s.endPTS;if(Object(G.isFiniteNumber)(l)){var y=Math.abs(l-w);Object(G.isFiniteNumber)(s.deltaPTS)?s.deltaPTS=Math.max(y,s.deltaPTS):s.deltaPTS=y,h=Math.max(w,l),w=Math.min(w,l),f=Math.min(f,s.startDTS),c=Math.min(g,a),g=Math.max(g,a),_=Math.max(_,s.endDTS)}s.duration=g-w;var m=w-s.start;s.appendedPTS=g,s.start=s.startPTS=w,s.maxStartPTS=h,s.startDTS=f,s.endPTS=g,s.minEndPTS=c,s.endDTS=_;var E=s.sn;if(!u||E<u.startSN||E>u.endSN)return 0;var M,F=E-u.startSN,j=u.fragments;for(j[F]=s,M=F;M>0;M--)k(j[M],j[M-1]);for(M=F;M<j.length-1;M++)k(j[M],j[M+1]);return u.fragmentHint&&k(j[j.length-1],u.fragmentHint),u.PTSKnown=u.alignedSliding=!0,m}function b(u,s){for(var w=null,g=u.fragments,f=g.length-1;f>=0;f--){var _=g[f].initSegment;if(_){w=_;break}}u.fragmentHint&&delete u.fragmentHint.endPTS;var p=0,h;if(O(u,s,function(M,F){M.relurl&&(p=M.cc-F.cc),Object(G.isFiniteNumber)(M.startPTS)&&Object(G.isFiniteNumber)(M.endPTS)&&(F.start=F.startPTS=M.startPTS,F.startDTS=M.startDTS,F.appendedPTS=M.appendedPTS,F.maxStartPTS=M.maxStartPTS,F.endPTS=M.endPTS,F.endDTS=M.endDTS,F.minEndPTS=M.minEndPTS,F.duration=M.endPTS-M.startPTS,F.duration&&(h=F),s.PTSKnown=s.alignedSliding=!0),F.elementaryStreams=M.elementaryStreams,F.loader=M.loader,F.stats=M.stats,F.urlId=M.urlId,M.initSegment&&(F.initSegment=M.initSegment,w=M.initSegment)}),w){var c=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;c.forEach(function(M){var F;(!M.initSegment||M.initSegment.relurl===((F=w)===null||F===void 0?void 0:F.relurl))&&(M.initSegment=w)})}if(s.skippedSegments&&(s.deltaUpdateFailed=s.fragments.some(function(M){return!M}),s.deltaUpdateFailed)){I.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var l=s.skippedSegments;l--;)s.fragments.shift();s.startSN=s.fragments[0].sn,s.startCC=s.fragments[0].cc}var a=s.fragments;if(p){I.logger.warn("discontinuity sliding from playlist, take drift into account");for(var y=0;y<a.length;y++)a[y].cc+=p}s.skippedSegments&&(s.startCC=s.fragments[0].cc),S(u.partList,s.partList,function(M,F){F.elementaryStreams=M.elementaryStreams,F.stats=M.stats}),h?L(s,h,h.startPTS,h.endPTS,h.startDTS,h.endDTS):C(u,s),a.length&&(s.totalduration=s.edge-a[0].start),s.driftStartTime=u.driftStartTime,s.driftStart=u.driftStart;var m=s.advancedDateTime;if(s.advanced&&m){var E=s.edge;s.driftStart||(s.driftStartTime=m,s.driftStart=E),s.driftEndTime=m,s.driftEnd=E}else s.driftEndTime=u.driftEndTime,s.driftEnd=u.driftEnd,s.advancedDateTime=u.advancedDateTime}function S(u,s,w){if(u&&s)for(var g=0,f=0,_=u.length;f<=_;f++){var p=u[f],h=s[f+g];p&&h&&p.index===h.index&&p.fragment.sn===h.fragment.sn?w(p,h):g--}}function O(u,s,w){for(var g=s.skippedSegments,f=Math.max(u.startSN,s.startSN)-s.startSN,_=(u.fragmentHint?1:0)+(g?s.endSN:Math.min(u.endSN,s.endSN))-s.startSN,p=s.startSN-u.startSN,h=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,c=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,l=f;l<=_;l++){var a=c[p+l],y=h[l];g&&!y&&l<g&&(y=s.fragments[l]=a),a&&y&&w(a,y)}}function C(u,s){var w=s.startSN+s.skippedSegments-u.startSN,g=u.fragments;if(w<0||w>=g.length)return;x(s,g[w].start)}function x(u,s){if(s){for(var w=u.fragments,g=u.skippedSegments;g<w.length;g++)w[g].start+=s;u.fragmentHint&&(u.fragmentHint.start+=s)}}function v(u,s){var w=1e3*u.levelTargetDuration,g=w/2,f=u.age,_=f>0&&f<w*3,p=s.loading.end-s.loading.start,h,c=u.availabilityDelay;if(u.updated===!1)if(_){var l=333*u.misses;h=Math.max(Math.min(g,p*2),l),u.availabilityDelay=(u.availabilityDelay||0)+h}else h=g;else _?(c=Math.min(c||w/2,f),u.availabilityDelay=c,h=c+w-f):h=w-p;return Math.round(h)}function d(u,s,w){if(!u||!u.details)return null;var g=u.details,f=g.fragments[s-g.startSN];return f||(f=g.fragmentHint,f&&f.sn===s?f:s<g.startSN&&w&&w.sn===s?w:null)}function o(u,s,w){if(!u||!u.details)return null;var g=u.details.partList;if(g)for(var f=g.length;f--;){var _=g[f];if(_.index===w&&_.fragment.sn===s)return _}return null}},"./src/controller/stream-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return g});var G=A("./src/polyfills/number.ts"),I=A("./src/controller/base-stream-controller.ts"),R=A("./src/is-supported.ts"),B=A("./src/events.ts"),U=A("./src/utils/buffer-helper.ts"),k=A("./src/controller/fragment-tracker.ts"),L=A("./src/types/loader.ts"),b=A("./src/loader/fragment.ts"),S=A("./src/demux/transmuxer-interface.ts"),O=A("./src/types/transmuxer.ts"),C=A("./src/controller/gap-controller.ts"),x=A("./src/errors.ts"),v=A("./src/utils/logger.ts");function d(f,_){for(var p=0;p<_.length;p++){var h=_[p];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(f,h.key,h)}}function o(f,_,p){return _&&d(f.prototype,_),p&&d(f,p),f}function u(f,_){f.prototype=Object.create(_.prototype),f.prototype.constructor=f,s(f,_)}function s(f,_){return s=Object.setPrototypeOf||function(h,c){return h.__proto__=c,h},s(f,_)}var w=100,g=function(f){u(_,f);function _(h,c){var l;return l=f.call(this,h,c,"[stream-controller]")||this,l.audioCodecSwap=!1,l.gapController=null,l.level=-1,l._forceStartLoad=!1,l.altAudio=!1,l.audioOnly=!1,l.fragPlaying=null,l.onvplaying=null,l.onvseeked=null,l.fragLastKbps=0,l.stalled=!1,l.couldBacktrack=!1,l.audioCodecSwitch=!1,l.videoBuffer=null,l._registerListeners(),l}var p=_.prototype;return p._registerListeners=function(){var c=this.hls;c.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(B.Events.ERROR,this.onError,this),c.on(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(B.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},p._unregisterListeners=function(){var c=this.hls;c.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(B.Events.ERROR,this.onError,this),c.off(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(B.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},p.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},p.startLoad=function(c){if(this.levels){var l=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(w),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var y=a.startLevel;y===-1&&(a.config.testBandwidth?(y=0,this.bitrateTest=!0):y=a.nextAutoLevel),this.level=a.nextLoadLevel=y,this.loadedmetadata=!1}l>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+l.toFixed(3)),c=l),this.state=I.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=I.State.STOPPED},p.stopLoad=function(){this._forceStartLoad=!1,f.prototype.stopLoad.call(this)},p.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_LEVEL:{var c,l=this.levels,a=this.level,y=l==null||((c=l[a])===null||c===void 0)?void 0:c.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,E=self.performance.now(),M=this.retryDate;(!M||E>=M||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=I.State.IDLE)}break;default:break}this.onTickEnd()},p.onTickEnd=function(){f.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},p.doTickIdle=function(){var c,l,a=this.hls,y=this.levelLastLoaded,m=this.levels,E=this.media,M=a.config,F=a.nextLoadLevel;if(y===null||!E&&(this.startFragRequested||!M.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[F])return;var j=m[F];this.level=a.nextLoadLevel=F;var W=j.details;if(!W||this.state===I.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==F){this.state=I.State.WAITING_LEVEL;return}var D=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:E,L.PlaylistLevelType.MAIN);if(D===null)return;var P=D.len,H=this.getMaxBufferLength(j.maxBitrate);if(P>=H)return;if(this._streamEnded(D,W)){var Y={};this.altAudio&&(Y.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,Y),this.state=I.State.ENDED;return}var ee=D.end,oe=this.getNextFragment(ee,W);if(this.couldBacktrack&&!this.fragPrevious&&oe&&oe.sn!=="initSegment"){var 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 ve=this.audioOnly&&!this.altAudio?b.ElementaryStreamTypes.AUDIO:b.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(E,ve,L.PlaylistLevelType.MAIN),oe=this.getNextFragment(this.nextLoadPosition,W)}if(!oe)return;oe.initSegment&&!oe.initSegment.data&&!this.bitrateTest&&(oe=oe.initSegment),((c=oe.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((l=oe.decryptdata)!==null&&l!==void 0&&l.key)?this.loadKey(oe,W):this.loadFragment(oe,W,ee)},p.loadFragment=function(c,l,a){var y,m=this.fragmentTracker.getState(c);if(this.fragCurrent=c,m===k.FragmentState.BACKTRACKED){var E=this.fragmentTracker.getBacktrackData(c);if(E){this._handleFragmentLoadProgress(E),this._handleFragmentLoadComplete(E);return}else m=k.FragmentState.NOT_LOADED}m===k.FragmentState.NOT_LOADED||m===k.FragmentState.PARTIAL?c.sn==="initSegment"?this._loadInitSegment(c):this.bitrateTest?(c.bitrateTest=!0,this.log("Fragment "+c.sn+" of level "+c.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(c)):(this.startFragRequested=!0,f.prototype.loadFragment.call(this,c,l,a)):m===k.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((y=this.media)===null||y===void 0?void 0:y.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},p.getAppendedFrag=function(c){var l=this.fragmentTracker.getAppendedFrag(c,L.PlaylistLevelType.MAIN);return l&&"fragment"in l?l.fragment:l},p.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,L.PlaylistLevelType.MAIN)},p.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},p.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},p.nextLevelSwitch=function(){var c=this.levels,l=this.media;if(l!=null&&l.readyState){var a,y=this.getAppendedFrag(l.currentTime);if(y&&y.start>1&&this.flushMainBuffer(0,y.start-1),!l.paused&&c){var m=this.hls.nextLoadLevel,E=c[m],M=this.fragLastKbps;M&&this.fragCurrent?a=this.fragCurrent.duration*E.maxBitrate/(1e3*M)+1:a=0}else a=0;var F=this.getBufferedFrag(l.currentTime+a);if(F){var j=this.followingBufferedFrag(F);if(j){this.abortCurrentFrag();var W=j.maxStartPTS?j.maxStartPTS:j.start,D=j.duration,P=Math.max(F.end,W+Math.min(Math.max(D-this.config.maxFragLookUpTolerance,D*.5),D*.75));this.flushMainBuffer(P,Number.POSITIVE_INFINITY)}}}},p.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===I.State.KEY_LOADING&&(this.state=I.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},p.flushMainBuffer=function(c,l){f.prototype.flushMainBuffer.call(this,c,l,this.altAudio?"video":null)},p.onMediaAttached=function(c,l){f.prototype.onMediaAttached.call(this,c,l);var a=l.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new C.default(this.config,a,this.fragmentTracker,this.hls)},p.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),f.prototype.onMediaDetaching.call(this)},p.onMediaPlaying=function(){this.tick()},p.onMediaSeeked=function(){var c=this.media,l=c?c.currentTime:null;Object(G.isFiniteNumber)(l)&&this.log("Media seeked to "+l.toFixed(3)),this.tick()},p.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(B.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},p.onManifestParsed=function(c,l){var a=!1,y=!1,m;l.levels.forEach(function(E){m=E.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(a=!0),m.indexOf("mp4a.40.5")!==-1&&(y=!0))}),this.audioCodecSwitch=a&&y&&!Object(R.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=l.levels,this.startFragRequested=!1},p.onLevelLoading=function(c,l){var a=this.levels;if(!a||this.state!==I.State.IDLE)return;var y=a[l.level];(!y.details||y.details.live&&this.levelLastLoaded!==l.level||this.waitForCdnTuneIn(y.details))&&(this.state=I.State.WAITING_LEVEL)},p.onLevelLoaded=function(c,l){var a,y=this.levels,m=l.level,E=l.details,M=E.totalduration;if(!y){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+E.startSN+","+E.endSN+"], cc ["+E.startCC+", "+E.endCC+"] duration:"+M);var F=this.fragCurrent;F&&(this.state===I.State.FRAG_LOADING||this.state===I.State.FRAG_LOADING_WAITING_RETRY)&&(F.level!==l.level&&F.loader&&(this.state=I.State.IDLE,F.loader.abort()));var j=y[m],W=0;if(E.live||(a=j.details)!==null&&a!==void 0&&a.live){if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed)return;W=this.alignPlaylists(E,j.details)}if(j.details=E,this.levelLastLoaded=m,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:E,level:m}),this.state===I.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(E))return;this.state=I.State.IDLE}this.startFragRequested?E.live&&this.synchronizeToLiveEdge(E):this.setStartPosition(E,W),this.tick()},p._handleFragmentLoadProgress=function(c){var l,a=c.frag,y=c.part,m=c.payload,E=this.levels;if(!E){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var M=E[a.level],F=M.details;if(!F){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var j=M.videoCodec,W=F.PTSKnown||!F.live,D=(l=a.initSegment)===null||l===void 0?void 0:l.data,P=this._getAudioCodec(M),H=this.transmuxer=this.transmuxer||new S.default(this.hls,L.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Y=y?y.index:-1,ee=Y!==-1,oe=new O.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,m.byteLength,Y,ee),xe=this.initPTS[a.cc];H.push(m,D,P,j,a,y,F.totalduration,W,oe,xe)},p.onAudioTrackSwitching=function(c,l){var a=this.altAudio,y=!!l.url,m=l.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 E=this.fragCurrent;E!=null&&E.loader&&(this.log("Switching to main audio track, cancel main fragment load"),E.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var M=this.hls;a&&M.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),M.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:m})}},p.onAudioTrackSwitched=function(c,l){var a=l.id,y=!!this.hls.audioTracks[a].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()},p.onBufferCreated=function(c,l){var a=l.tracks,y,m,E=!1;for(var M in a){var F=a[M];if(F.id==="main"){if(m=M,y=F,M==="video"){var j=a[M];j&&(this.videoBuffer=j.buffer)}}else E=!0}E&&y?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=y.buffer):this.mediaBuffer=this.media},p.onFragBuffered=function(c,l){var a=l.frag,y=l.part;if(a&&a.type!==L.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(y?" p: "+y.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===I.State.PARSED&&(this.state=I.State.IDLE);return}var m=y?y.stats:a.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,y)},p.onError=function(c,l){switch(l.details){case x.ErrorDetails.FRAG_LOAD_ERROR:case x.ErrorDetails.FRAG_LOAD_TIMEOUT:case x.ErrorDetails.KEY_LOAD_ERROR:case x.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.MAIN,l);break;case x.ErrorDetails.LEVEL_LOAD_ERROR:case x.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==I.State.ERROR&&(l.fatal?(this.warn(""+l.details),this.state=I.State.ERROR):!l.levelRetry&&this.state===I.State.WAITING_LEVEL&&(this.state=I.State.IDLE));break;case x.ErrorDetails.BUFFER_FULL_ERROR:if(l.parent==="main"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var a=!0,y=this.getFwdBufferInfo(this.media,L.PlaylistLevelType.MAIN);y&&y.len>.5&&(a=!this.reduceMaxBufferLength(y.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},p.checkBuffer=function(){var c=this.media,l=this.gapController;if(!c||!l||!c.readyState)return;var a=U.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):l.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},p.onFragLoadEmergencyAborted=function(){this.state=I.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},p.onBufferFlushed=function(c,l){var a=l.type;if(a!==b.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var y=(a===b.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(y,a,L.PlaylistLevelType.MAIN)}},p.onLevelsUpdated=function(c,l){this.levels=l.levels},p.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},p.seekToStartPos=function(){var c=this.media,l=c.currentTime,a=this.startPosition;if(a>=0&&l<a){if(c.seeking){v.logger.log("could not seek to "+a+", already seeking at "+l);return}var y=U.BufferHelper.getBuffered(c),m=y.length?y.start(0):0,E=m-a;E>0&&(E<this.config.maxBufferHole||E<this.config.maxFragLookUpTolerance)&&(v.logger.log("adjusting start position by "+E+" to match buffer start"),a+=E,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+l),c.currentTime=a}},p._getAudioCodec=function(c){var l=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&l&&(this.log("Swapping audio codec"),l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5"),l},p._loadBitrateTestFrag=function(c){var l=this;this._doFragLoad(c).then(function(a){var y=l.hls;if(!a||y.nextLoadLevel||l.fragContextChanged(c))return;l.fragLoadError=0,l.state=I.State.IDLE,l.startFragRequested=!1,l.bitrateTest=!1;var m=c.stats;m.parsing.start=m.parsing.end=m.buffering.start=m.buffering.end=self.performance.now(),y.trigger(B.Events.FRAG_LOADED,a)})},p._handleTransmuxComplete=function(c){var l,a="main",y=this.hls,m=c.remuxResult,E=c.chunkMeta,M=this.getCurrentContext(E);if(!M){this.warn("The loading context changed while buffering fragment "+E.sn+" of level "+E.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(E.level);return}var F=M.frag,j=M.part,W=M.level,D=m.video,P=m.text,H=m.id3,Y=m.initSegment,ee=this.altAudio?void 0:m.audio;if(this.fragContextChanged(F))return;if(this.state=I.State.PARSING,Y){Y.tracks&&(this._bufferInitSegment(W,Y.tracks,F,E),y.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:a,tracks:Y.tracks}));var oe=Y.initPTS,xe=Y.timescale;Object(G.isFiniteNumber)(oe)&&(this.initPTS[F.cc]=oe,y.trigger(B.Events.INIT_PTS_FOUND,{frag:F,id:a,initPTS:oe,timescale:xe}))}if(D&&m.independent!==!1){if(W.details){var ve=D.startPTS,he=D.endPTS,fe=D.startDTS,me=D.endDTS;if(j)j.elementaryStreams[D.type]={startPTS:ve,endPTS:he,startDTS:fe,endDTS:me};else if(D.firstKeyFrame&&D.independent&&(this.couldBacktrack=!0),D.dropped&&D.independent){var ae=this.getLoadPosition()+this.config.maxBufferHole;if(ae<ve){this.backtrack(F);return}F.setElementaryStreamInfo(D.type,F.start,he,F.start,me,!0)}F.setElementaryStreamInfo(D.type,ve,he,fe,me),this.bufferFragmentData(D,F,j,E)}}else if(m.independent===!1){this.backtrack(F);return}if(ee){var pe=ee.startPTS,$=ee.endPTS,ne=ee.startDTS,Q=ee.endDTS;j&&(j.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:pe,endPTS:$,startDTS:ne,endDTS:Q}),F.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,pe,$,ne,Q),this.bufferFragmentData(ee,F,j,E)}if(H!=null&&(l=H.samples)!==null&&l!==void 0&&l.length){var Ee={frag:F,id:a,samples:H.samples};y.trigger(B.Events.FRAG_PARSING_METADATA,Ee)}if(P){var we={frag:F,id:a,samples:P.samples};y.trigger(B.Events.FRAG_PARSING_USERDATA,we)}},p._bufferInitSegment=function(c,l,a,y){var m=this;if(this.state!==I.State.PARSING)return;this.audioOnly=!!l.audio&&!l.video,this.altAudio&&!this.audioOnly&&delete l.audio;var E=l.audio,M=l.video,F=l.audiovideo;if(E){var j=c.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),E.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(j="mp4a.40.5")),W.indexOf("android")!==-1&&E.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),c.audioCodec&&c.audioCodec!==j&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+j+'"'),E.levelCodec=j,E.id="main",this.log("Init audio buffer, container:"+E.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(c.audioCodec||"")+"/"+E.codec+"]")}M&&(M.levelCodec=c.videoCodec,M.id="main",this.log("Init video buffer, container:"+M.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+M.codec+"]")),F&&this.log("Init audiovideo buffer, container:"+F.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+F.codec+"]"),this.hls.trigger(B.Events.BUFFER_CODECS,l),Object.keys(l).forEach(function(D){var P=l[D],H=P.initSegment;H!=null&&H.byteLength&&m.hls.trigger(B.Events.BUFFER_APPENDING,{type:D,data:H,frag:a,part:null,chunkMeta:y,parent:a.type})}),this.tick()},p.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var l=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,l?this.resetFragmentLoading(c):this.state=I.State.BACKTRACKING},p.checkFragmentChanged=function(){var c=this.media,l=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(U.BufferHelper.isBuffered(c,a)?l=this.getAppendedFrag(a):U.BufferHelper.isBuffered(c,a+.1)&&(l=this.getAppendedFrag(a+.1)),l){var y=this.fragPlaying,m=l.level;(!y||l.sn!==y.sn||y.level!==m||l.urlId!==y.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:l}),(!y||y.level!==m)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=l)}}},o(_,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);if(l)return l.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(l)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),_}(I.default)},"./src/controller/subtitle-stream-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"SubtitleStreamController",function(){return u});var G=A("./src/events.ts"),I=A("./src/utils/logger.ts"),R=A("./src/utils/buffer-helper.ts"),B=A("./src/controller/fragment-finders.ts"),U=A("./src/utils/discontinuities.ts"),k=A("./src/controller/level-helper.ts"),L=A("./src/controller/fragment-tracker.ts"),b=A("./src/controller/base-stream-controller.ts"),S=A("./src/types/loader.ts"),O=A("./src/types/level.ts");function C(s,w){for(var g=0;g<w.length;g++){var f=w[g];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(s,f.key,f)}}function x(s,w,g){return w&&C(s.prototype,w),g&&C(s,g),s}function v(s,w){s.prototype=Object.create(w.prototype),s.prototype.constructor=s,d(s,w)}function d(s,w){return d=Object.setPrototypeOf||function(f,_){return f.__proto__=_,f},d(s,w)}var o=500,u=function(s){v(w,s);function w(f,_){var p;return p=s.call(this,f,_,"[subtitle-stream-controller]")||this,p.levels=[],p.currentTrackId=-1,p.tracksBuffered=[],p.mainDetails=null,p._registerListeners(),p}var g=w.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var _=this.hls;_.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),_.on(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.on(G.Events.ERROR,this.onError,this),_.on(G.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),_.on(G.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),_.on(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),_.on(G.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),_.on(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g._unregisterListeners=function(){var _=this.hls;_.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),_.off(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.off(G.Events.ERROR,this.onError,this),_.off(G.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),_.off(G.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),_.off(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),_.off(G.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),_.off(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g.startLoad=function(){this.stopLoad(),this.state=b.State.IDLE,this.setInterval(o),this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},g.onLevelLoaded=function(_,p){this.mainDetails=p.details},g.onSubtitleFragProcessed=function(_,p){var h=p.frag,c=p.success;if(this.fragPrevious=h,this.state=b.State.IDLE,!c)return;var l=this.tracksBuffered[this.currentTrackId];if(!l)return;for(var a,y=h.start,m=0;m<l.length;m++)if(y>=l[m].start&&y<=l[m].end){a=l[m];break}var E=h.start+h.duration;a?a.end=E:(a={start:y,end:E},l.push(a)),this.fragmentTracker.fragBuffered(h)},g.onBufferFlushing=function(_,p){var h=p.startOffset,c=p.endOffset;if(h===0&&c!==Number.POSITIVE_INFINITY){var l=this.currentTrackId,a=this.levels;if(!a.length||!a[l]||!a[l].details)return;var y=a[l].details,m=y.targetduration,E=c-m;if(E<=0)return;p.endOffsetSubtitles=Math.max(0,E),this.tracksBuffered.forEach(function(M){for(var F=0;F<M.length;){if(M[F].end<=E){M.shift();continue}else if(M[F].start<E)M[F].start=E;else break;F++}}),this.fragmentTracker.removeFragmentsInRange(h,E,S.PlaylistLevelType.SUBTITLE)}},g.onError=function(_,p){var h,c=p.frag;if(!c||c.type!==S.PlaylistLevelType.SUBTITLE)return;(h=this.fragCurrent)!==null&&h!==void 0&&h.loader&&this.fragCurrent.loader.abort(),this.state=b.State.IDLE},g.onSubtitleTracksUpdated=function(_,p){var h=this,c=p.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(l){return new O.Level(l)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(l){h.tracksBuffered[l.id]=[]}),this.mediaBuffer=null},g.onSubtitleTrackSwitch=function(_,p){if(this.currentTrackId=p.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var h=this.levels[this.currentTrackId];h!=null&&h.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,h&&this.setInterval(o)},g.onSubtitleTrackLoaded=function(_,p){var h,c=p.details,l=p.id,a=this.currentTrackId,y=this.levels;if(!y.length)return;var m=y[a];if(l>=y.length||l!==a||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(h=m.details)!==null&&h!==void 0&&h.live){var E=this.mainDetails;if(c.deltaUpdateFailed||!E)return;var M=E.fragments[0];if(!m.details)c.hasProgramDateTime&&E.hasProgramDateTime?Object(U.alignMediaPlaylistByPDT)(c,E):M&&Object(k.addSliding)(c,M.start);else{var F=this.alignPlaylists(c,m.details);F===0&&M&&Object(k.addSliding)(c,M.start)}}if(m.details=c,this.levelLastLoaded=l,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===b.State.IDLE){var j=Object(B.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},g._handleFragmentLoadComplete=function(_){var p=_.frag,h=_.payload,c=p.decryptdata,l=this.hls;if(this.fragContextChanged(p))return;if(h&&h.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(h),c.key.buffer,c.iv.buffer).then(function(y){var m=performance.now();l.trigger(G.Events.FRAG_DECRYPTED,{frag:p,payload:y,stats:{tstart:a,tdecrypt:m}})})}},g.doTick=function(){if(!this.media){this.state=b.State.IDLE;return}if(this.state===b.State.IDLE){var _,p=this.currentTrackId,h=this.levels;if(!h.length||!h[p]||!h[p].details)return;var c=h[p].details,l=c.targetduration,a=this.config,y=this.media,m=R.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,y.currentTime-l,a.maxBufferHole),E=m.end,M=m.len,F=this.getMaxBufferLength()+l;if(M>F)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var j=c.fragments,W=j.length,D=c.edge,P,H=this.fragPrevious;if(E<D){var Y=a.maxFragLookUpTolerance;H&&c.hasProgramDateTime&&(P=Object(B.findFragmentByPDT)(j,H.endProgramDateTime,Y)),P||(P=Object(B.findFragmentByPTS)(H,j,E,Y),!P&&H&&H.start<j[0].start&&(P=j[0]))}else P=j[W-1];(_=P)!==null&&_!==void 0&&_.encrypted?(I.logger.log("Loading key for "+P.sn),this.state=b.State.KEY_LOADING,this.hls.trigger(G.Events.KEY_LOADING,{frag:P})):P&&this.fragmentTracker.getState(P)===L.FragmentState.NOT_LOADED&&this.loadFragment(P,c,E)}},g.loadFragment=function(_,p,h){this.fragCurrent=_,s.prototype.loadFragment.call(this,_,p,h)},x(w,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),w}(b.default)},"./src/controller/subtitle-track-controller.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/events.ts"),I=A("./src/utils/texttrack-utils.ts"),R=A("./src/controller/base-playlist-controller.ts"),B=A("./src/types/loader.ts");function U(C,x){for(var v=0;v<x.length;v++){var d=x[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(C,d.key,d)}}function k(C,x,v){return x&&U(C.prototype,x),v&&U(C,v),C}function L(C,x){C.prototype=Object.create(x.prototype),C.prototype.constructor=C,b(C,x)}function b(C,x){return b=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},b(C,x)}var S=function(C){L(x,C);function x(d){var o;return o=C.call(this,d,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var v=x.prototype;return v.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,C.prototype.destroy.call(this)},v.registerListeners=function(){var o=this.hls;o.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(G.Events.ERROR,this.onError,this)},v.unregisterListeners=function(){var o=this.hls;o.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(G.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(G.Events.ERROR,this.onError,this)},v.onMediaAttached=function(o,u){if(this.media=u.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},v.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},v.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=O(this.media.textTracks);o.forEach(function(u){Object(I.clearCurrentCues)(u)}),this.subtitleTrack=-1,this.media=null},v.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},v.onManifestParsed=function(o,u){this.tracks=u.subtitleTracks},v.onSubtitleTrackLoaded=function(o,u){var s=u.id,w=u.details,g=this.trackId,f=this.tracksInGroup[g];if(!f){this.warn("Invalid subtitle track id "+s);return}var _=f.details;f.details=u.details,this.log("subtitle track "+s+" loaded ["+w.startSN+"-"+w.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,u,_))},v.onLevelLoading=function(o,u){this.switchLevel(u.level)},v.onLevelSwitching=function(o,u){this.switchLevel(u.level)},v.switchLevel=function(o){var u=this.hls.levels[o];if(!(u!=null&&u.textGroupIds))return;var s=u.textGroupIds[u.urlId];if(this.groupId!==s){var w=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,g=this.tracks.filter(function(p){return!s||p.groupId===s});this.tracksInGroup=g;var f=this.findTrackId(w==null?void 0:w.name)||this.findTrackId();this.groupId=s;var _={subtitleTracks:g};this.log("Updating subtitle tracks, "+g.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(G.Events.SUBTITLE_TRACKS_UPDATED,_),f!==-1&&this.setSubtitleTrack(f,w)}},v.findTrackId=function(o){for(var u=this.tracksInGroup,s=0;s<u.length;s++){var w=u[s];if((!this.selectDefaultTrack||w.default)&&(!o||o===w.name))return w.id}return-1},v.onError=function(o,u){if(C.prototype.onError.call(this,o,u),u.fatal||!u.context)return;u.context.type===B.PlaylistContextType.SUBTITLE_TRACK&&u.context.id===this.trackId&&u.context.groupId===this.groupId&&this.retryLoadingOrFail(u)},v.loadPlaylist=function(o){var u=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(u)){var s=u.id,w=u.groupId,g=u.url;if(o)try{g=o.addDirectives(g)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Loading subtitle playlist for id "+s),this.hls.trigger(G.Events.SUBTITLE_TRACK_LOADING,{url:g,id:s,groupId:w,deliveryDirectives:o||null})}},v.toggleTrackModes=function(o){var u=this,s=this.media,w=this.subtitleDisplay,g=this.trackId;if(!s)return;var f=O(s.textTracks),_=f.filter(function(c){return c.groupId===u.groupId});if(o===-1)[].slice.call(f).forEach(function(c){c.mode="disabled"});else{var p=_[g];p&&(p.mode="disabled")}var h=_[o];h&&(h.mode=w?"showing":"hidden")},v.setSubtitleTrack=function(o,u){var s,w=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(s=w[o])!==null&&s!==void 0&&s.details)||o<-1||o>=w.length)return;this.clearTimer();var g=w[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,g){var f=g.id,_=g.groupId,p=_===void 0?"":_,h=g.name,c=g.type,l=g.url;this.hls.trigger(G.Events.SUBTITLE_TRACK_SWITCH,{id:f,groupId:p,name:h,type:c,url:l});var a=this.switchParams(g.url,u==null?void 0:u.details);this.loadPlaylist(a)}else this.hls.trigger(G.Events.SUBTITLE_TRACK_SWITCH,{id:o})},v.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,u=O(this.media.textTracks),s=0;s<u.length;s++)if(u[s].mode==="hidden")o=s;else if(u[s].mode==="showing"){o=s;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},k(x,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var u=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,u)}}]),x}(R.default);function O(C){for(var x=[],v=0;v<C.length;v++){var d=C[v];d.kind==="subtitles"&&d.label&&x.push(C[v])}return x}V.default=S},"./src/controller/timeline-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"TimelineController",function(){return O});var G=A("./src/polyfills/number.ts"),I=A("./src/events.ts"),R=A("./src/utils/cea-608-parser.ts"),B=A("./src/utils/output-filter.ts"),U=A("./src/utils/webvtt-parser.ts"),k=A("./src/utils/texttrack-utils.ts"),L=A("./src/utils/imsc1-ttml-parser.ts"),b=A("./src/types/loader.ts"),S=A("./src/utils/logger.ts"),O=function(){function d(u){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=v(),this.captionsProperties=void 0,this.hls=u,this.config=u.config,this.Cues=u.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var s=new B.default(this,"textTrack1"),w=new B.default(this,"textTrack2"),g=new B.default(this,"textTrack3"),f=new B.default(this,"textTrack4");this.cea608Parser1=new R.default(1,s,w),this.cea608Parser2=new R.default(3,g,f)}u.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.on(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.on(I.Events.FRAG_LOADING,this.onFragLoading,this),u.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.on(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.on(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=d.prototype;return o.destroy=function(){var s=this.hls;s.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.off(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.off(I.Events.FRAG_LOADING,this.onFragLoading,this),s.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.off(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.off(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(s,w,g,f,_){for(var p=!1,h=_.length;h--;){var c=_[h],l=x(c[0],c[1],w,g);if(l>=0&&(c[0]=Math.min(c[0],w),c[1]=Math.max(c[1],g),p=!0,l/(g-w)>.5))return}if(p||_.push([w,g]),this.config.renderTextTracksNatively){var a=this.captionsTracks[s];this.Cues.newCue(a,w,g,f)}else{var y=this.Cues.newCue(null,w,g,f);this.hls.trigger(I.Events.CUES_PARSED,{type:"captions",cues:y,track:s})}},o.onInitPtsFound=function(s,w){var g=this,f=w.frag,_=w.id,p=w.initPTS,h=w.timescale,c=this.unparsedVttFrags;_==="main"&&(this.initPTS[f.cc]=p,this.timescale[f.cc]=h),c.length&&(this.unparsedVttFrags=[],c.forEach(function(l){g.onFragLoaded(I.Events.FRAG_LOADED,l)}))},o.getExistingTrack=function(s){var w=this.media;if(w)for(var g=0;g<w.textTracks.length;g++){var f=w.textTracks[g];if(f[s])return f}return null},o.createCaptionsTrack=function(s){this.config.renderTextTracksNatively?this.createNativeTrack(s):this.createNonNativeTrack(s)},o.createNativeTrack=function(s){if(this.captionsTracks[s])return;var w=this.captionsProperties,g=this.captionsTracks,f=this.media,_=w[s],p=_.label,h=_.languageCode,c=this.getExistingTrack(s);if(c)g[s]=c,Object(k.clearCurrentCues)(g[s]),Object(k.sendAddTrackEvent)(g[s],f);else{var l=this.createTextTrack("captions",p,h);l&&(l[s]=!0,g[s]=l)}},o.createNonNativeTrack=function(s){if(this.nonNativeCaptionsTracks[s])return;var w=this.captionsProperties[s];if(!w)return;var g=w.label,f={_id:s,label:g,kind:"captions",default:w.media?!!w.media.default:!1,closedCaptions:w.media};this.nonNativeCaptionsTracks[s]=f,this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[f]})},o.createTextTrack=function(s,w,g){var f=this.media;return f?f.addTextTrack(s,w,g):void 0},o.onMediaAttaching=function(s,w){this.media=w.media,this._cleanTracks()},o.onMediaDetaching=function(){var s=this.captionsTracks;Object.keys(s).forEach(function(w){Object(k.clearCurrentCues)(s[w]),delete s[w]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=v(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var s=this.media;if(!s)return;var w=s.textTracks;if(w)for(var g=0;g<w.length;g++)Object(k.clearCurrentCues)(w[g])},o.onSubtitleTracksUpdated=function(s,w){var g=this;this.textTracks=[];var f=w.subtitleTracks||[],_=f.some(function(l){return l.textCodec===L.IMSC1_CODEC});if(this.config.enableWebVTT||_&&this.config.enableIMSC1){var p=this.tracks&&f&&this.tracks.length===f.length;if(this.tracks=f||[],this.config.renderTextTracksNatively){var h=this.media?this.media.textTracks:[];this.tracks.forEach(function(l,a){var y;if(a<h.length){for(var m=null,E=0;E<h.length;E++)if(C(h[E],l)){m=h[E];break}m&&(y=m)}y?Object(k.clearCurrentCues)(y):(y=g.createTextTrack("subtitles",l.name,l.lang),y&&(y.mode="disabled")),y&&(y.groupId=l.groupId,g.textTracks.push(y))})}else if(!p&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(l){return{label:l.name,kind:l.type.toLowerCase(),default:l.default,subtitleTrack:l}});this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(s,w){var g=this;this.config.enableCEA708Captions&&w.captions&&w.captions.forEach(function(f){var _=/(?:CC|SERVICE)([1-4])/.exec(f.instreamId);if(!_)return;var p="textTrack"+_[1],h=g.captionsProperties[p];if(!h)return;h.label=f.name,f.lang&&(h.languageCode=f.lang),h.media=f})},o.onFragLoading=function(s,w){var g=this.cea608Parser1,f=this.cea608Parser2,_=this.lastSn,p=this.lastPartIndex;if(!this.enabled||!(g&&f))return;if(w.frag.type===b.PlaylistLevelType.MAIN){var h,c,l=w.frag.sn,a=(h=w==null||((c=w.part)===null||c===void 0)?void 0:c.index)!=null?h:-1;l===_+1||l===_&&a===p+1||(g.reset(),f.reset()),this.lastSn=l,this.lastPartIndex=a}},o.onFragLoaded=function(s,w){var g=w.frag,f=w.payload,_=this.initPTS,p=this.unparsedVttFrags;if(g.type===b.PlaylistLevelType.SUBTITLE)if(f.byteLength){if(!Object(G.isFiniteNumber)(_[g.cc])){p.push(w),_.length&&this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Missing initial subtitle PTS")});return}var h=g.decryptdata;if(h==null||h.key==null||h.method!=="AES-128"){var c=this.tracks[g.level],l=this.vttCCs;l[g.cc]||(l[g.cc]={start:g.start,prevCC:this.prevCC,new:!0},this.prevCC=g.cc),c&&c.textCodec===L.IMSC1_CODEC?this._parseIMSC1(g,f):this._parseVTTs(g,f,l)}}else this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(s,w){var g=this,f=this.hls;Object(L.parseIMSC1)(w,this.initPTS[s.cc],this.timescale[s.cc],function(_){g._appendCues(_,s.level),f.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(_){S.logger.log("Failed to parse IMSC1: "+_),f.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:_})})},o._parseVTTs=function(s,w,g){var f=this,_=this.hls;Object(U.parseWebVTT)(w,this.initPTS[s.cc],this.timescale[s.cc],g,s.cc,s.start,function(p){f._appendCues(p,s.level),_.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(p){f._fallbackToIMSC1(s,w),S.logger.log("Failed to parse VTT cue: "+p),_.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:p})})},o._fallbackToIMSC1=function(s,w){var g=this,f=this.tracks[s.level];f.textCodec||Object(L.parseIMSC1)(w,this.initPTS[s.cc],this.timescale[s.cc],function(){f.textCodec=L.IMSC1_CODEC,g._parseIMSC1(s,w)},function(){f.textCodec="wvtt"})},o._appendCues=function(s,w){var g=this.hls;if(this.config.renderTextTracksNatively){var f=this.textTracks[w];if(f.mode==="disabled")return;s.forEach(function(h){return Object(k.addCueToTrack)(f,h)})}else{var _=this.tracks[w],p=_.default?"default":"subtitles"+w;g.trigger(I.Events.CUES_PARSED,{type:"subtitles",cues:s,track:p})}},o.onFragDecrypted=function(s,w){var g=w.frag;if(g.type===b.PlaylistLevelType.SUBTITLE){if(!Object(G.isFiniteNumber)(this.initPTS[g.cc])){this.unparsedVttFrags.push(w);return}this.onFragLoaded(I.Events.FRAG_LOADED,w)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(s,w){var g=this.cea608Parser1,f=this.cea608Parser2;if(!this.enabled||!(g&&f))return;for(var _=0;_<w.samples.length;_++){var p=w.samples[_].bytes;if(p){var h=this.extractCea608Data(p);g.addData(w.samples[_].pts,h[0]),f.addData(w.samples[_].pts,h[1])}}},o.onBufferFlushing=function(s,w){var g=w.startOffset,f=w.endOffset,_=w.endOffsetSubtitles,p=w.type,h=this.media;if(!h||h.currentTime<f)return;if(!p||p==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(k.removeCuesInRange)(c[a],g,f)})}if(this.config.renderTextTracksNatively&&(g===0&&_!==void 0)){var l=this.textTracks;Object.keys(l).forEach(function(a){return Object(k.removeCuesInRange)(l[a],g,_)})}},o.extractCea608Data=function(s){for(var w=s[0]&31,g=2,f=[[],[]],_=0;_<w;_++){var p=s[g++],h=127&s[g++],c=127&s[g++],l=(4&p)!==0,a=3&p;if(h===0&&c===0)continue;l&&((a===0||a===1)&&(f[a].push(h),f[a].push(c)))}return f},d}();function C(d,o){return d&&d.label===o.name&&!(d.textTrack1||d.textTrack2)}function x(d,o,u,s){return Math.min(o,s)-Math.max(d,u)}function v(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return G});var G=function(){function I(B,U){this.subtle=void 0,this.aesIV=void 0,this.subtle=B,this.aesIV=U}var R=I.prototype;return R.decrypt=function(U,k){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},k,U)},I}()},"./src/crypt/aes-decryptor.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"removePadding",function(){return I}),A.d(V,"default",function(){return R});var G=A("./src/utils/typed-array.ts");function I(B){var U=B.byteLength,k=U&&new DataView(B.buffer).getUint8(U-1);return k?Object(G.sliceUint8)(B,0,U-k):B}var R=function(){function B(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var U=B.prototype;return U.uint8ArrayToUint32Array_=function(L){for(var b=new DataView(L),S=new Uint32Array(4),O=0;O<4;O++)S[O]=b.getUint32(O*4);return S},U.initTable=function(){var L=this.sBox,b=this.invSBox,S=this.subMix,O=S[0],C=S[1],x=S[2],v=S[3],d=this.invSubMix,o=d[0],u=d[1],s=d[2],w=d[3],g=new Uint32Array(256),f=0,_=0,p=0;for(p=0;p<256;p++)p<128?g[p]=p<<1:g[p]=p<<1^283;for(p=0;p<256;p++){var h=_^_<<1^_<<2^_<<3^_<<4;h=h>>>8^h&255^99,L[f]=h,b[h]=f;var c=g[f],l=g[c],a=g[l],y=g[h]*257^h*16843008;O[f]=y<<24|y>>>8,C[f]=y<<16|y>>>16,x[f]=y<<8|y>>>24,v[f]=y,y=a*16843009^l*65537^c*257^f*16843008,o[h]=y<<24|y>>>8,u[h]=y<<16|y>>>16,s[h]=y<<8|y>>>24,w[h]=y,f?(f=c^g[g[g[a^c]]],_^=g[g[_]]):f=_=1}},U.expandKey=function(L){for(var b=this.uint8ArrayToUint32Array_(L),S=!0,O=0;O<b.length&&S;)S=b[O]===this.key[O],O++;if(S)return;this.key=b;var C=this.keySize=b.length;if(C!==4&&C!==6&&C!==8)throw new Error("Invalid aes key size="+C);var x=this.ksRows=(C+6+1)*4,v,d,o=this.keySchedule=new Uint32Array(x),u=this.invKeySchedule=new Uint32Array(x),s=this.sBox,w=this.rcon,g=this.invSubMix,f=g[0],_=g[1],p=g[2],h=g[3],c,l;for(v=0;v<x;v++){if(v<C){c=o[v]=b[v];continue}l=c,v%C===0?(l=l<<8|l>>>24,l=s[l>>>24]<<24|s[l>>>16&255]<<16|s[l>>>8&255]<<8|s[l&255],l^=w[v/C|0]<<24):C>6&&v%C===4&&(l=s[l>>>24]<<24|s[l>>>16&255]<<16|s[l>>>8&255]<<8|s[l&255]),o[v]=c=(o[v-C]^l)>>>0}for(d=0;d<x;d++)v=x-d,d&3?l=o[v]:l=o[v-4],d<4||v<=4?u[d]=l:u[d]=f[s[l>>>24]]^_[s[l>>>16&255]]^p[s[l>>>8&255]]^h[s[l&255]],u[d]=u[d]>>>0},U.networkToHostOrderSwap=function(L){return L<<24|(L&65280)<<8|(L&16711680)>>8|L>>>24},U.decrypt=function(L,b,S){for(var O=this.keySize+6,C=this.invKeySchedule,x=this.invSBox,v=this.invSubMix,d=v[0],o=v[1],u=v[2],s=v[3],w=this.uint8ArrayToUint32Array_(S),g=w[0],f=w[1],_=w[2],p=w[3],h=new Int32Array(L),c=new Int32Array(h.length),l,a,y,m,E,M,F,j,W,D,P,H,Y,ee,oe=this.networkToHostOrderSwap;b<h.length;){for(W=oe(h[b]),D=oe(h[b+1]),P=oe(h[b+2]),H=oe(h[b+3]),E=W^C[0],M=H^C[1],F=P^C[2],j=D^C[3],Y=4,ee=1;ee<O;ee++)l=d[E>>>24]^o[M>>16&255]^u[F>>8&255]^s[j&255]^C[Y],a=d[M>>>24]^o[F>>16&255]^u[j>>8&255]^s[E&255]^C[Y+1],y=d[F>>>24]^o[j>>16&255]^u[E>>8&255]^s[M&255]^C[Y+2],m=d[j>>>24]^o[E>>16&255]^u[M>>8&255]^s[F&255]^C[Y+3],E=l,M=a,F=y,j=m,Y=Y+4;l=x[E>>>24]<<24^x[M>>16&255]<<16^x[F>>8&255]<<8^x[j&255]^C[Y],a=x[M>>>24]<<24^x[F>>16&255]<<16^x[j>>8&255]<<8^x[E&255]^C[Y+1],y=x[F>>>24]<<24^x[j>>16&255]<<16^x[E>>8&255]<<8^x[M&255]^C[Y+2],m=x[j>>>24]<<24^x[E>>16&255]<<16^x[M>>8&255]<<8^x[F&255]^C[Y+3],c[b]=oe(l^g),c[b+1]=oe(m^f),c[b+2]=oe(y^_),c[b+3]=oe(a^p),g=W,f=D,_=P,p=H,b=b+4}return c.buffer},B}()},"./src/crypt/decrypter.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return b});var G=A("./src/crypt/aes-crypto.ts"),I=A("./src/crypt/fast-aes-key.ts"),R=A("./src/crypt/aes-decryptor.ts"),B=A("./src/utils/logger.ts"),U=A("./src/utils/mp4-tools.ts"),k=A("./src/utils/typed-array.ts"),L=16,b=function(){function S(C,x,v){var d=v===void 0?{}:v,o=d.removePKCS7Padding,u=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=C,this.config=x,this.removePKCS7Padding=u,u)try{var s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch(w){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var O=S.prototype;return O.destroy=function(){this.observer=null},O.isSync=function(){return this.config.enableSoftwareAES},O.flush=function(){var x=this.currentResult;if(!x){this.reset();return}var v=new Uint8Array(x);return this.reset(),this.removePKCS7Padding?Object(R.removePadding)(v):v},O.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},O.decrypt=function(x,v,d,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(x),v,d);var u=this.flush();u&&o(u.buffer)}else this.webCryptoDecrypt(new Uint8Array(x),v,d).then(o)},O.softwareDecrypt=function(x,v,d){var o=this.currentIV,u=this.currentResult,s=this.remainderData;this.logOnce("JS AES decrypt"),s&&(x=Object(U.appendUint8Array)(s,x),this.remainderData=null);var w=this.getValidChunk(x);if(!w.length)return null;o&&(d=o);var g=this.softwareDecrypter;g||(g=this.softwareDecrypter=new R.default),g.expandKey(v);var f=u;return this.currentResult=g.decrypt(w.buffer,0,d),this.currentIV=Object(k.sliceUint8)(w,-16).buffer,f||null},O.webCryptoDecrypt=function(x,v,d){var o=this,u=this.subtle;return(this.key!==v||!this.fastAesKey)&&(this.key=v,this.fastAesKey=new I.default(u,v)),this.fastAesKey.expandKey().then(function(s){if(!u)return Promise.reject(new Error("web crypto not initialized"));var w=new G.default(u,d);return w.decrypt(x.buffer,s)}).catch(function(s){return o.onWebCryptoError(s,x,v,d)})},O.onWebCryptoError=function(x,v,d,o){return B.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",x),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(v,d,o)},O.getValidChunk=function(x){var v=x,d=x.length-x.length%L;return d!==x.length&&(v=Object(k.sliceUint8)(x,0,d),this.remainderData=Object(k.sliceUint8)(x,d)),v},O.logOnce=function(x){if(!this.logEnabled)return;B.logger.log("[decrypter.ts]: "+x),this.logEnabled=!1},S}()},"./src/crypt/fast-aes-key.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return G});var G=function(){function I(B,U){this.subtle=void 0,this.key=void 0,this.subtle=B,this.key=U}var R=I.prototype;return R.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},I}()},"./src/demux/aacdemuxer.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/demux/base-audio-demuxer.ts"),I=A("./src/demux/adts.ts"),R=A("./src/utils/logger.ts"),B=A("./src/demux/id3.ts");function U(b,S){b.prototype=Object.create(S.prototype),b.prototype.constructor=b,k(b,S)}function k(b,S){return k=Object.setPrototypeOf||function(C,x){return C.__proto__=x,C},k(b,S)}var L=function(b){U(S,b);function S(C,x){var v;return v=b.call(this)||this,v.observer=void 0,v.config=void 0,v.observer=C,v.config=x,v}var O=S.prototype;return O.resetInitSegment=function(x,v,d){b.prototype.resetInitSegment.call(this,x,v,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:x,duration:d,inputTimeScale:9e4,dropped:0}},S.probe=function(x){if(!x)return!1;for(var v=B.getID3Data(x,0)||[],d=v.length,o=x.length;d<o;d++)if(I.probe(x,d))return R.logger.log("ADTS sync word found !"),!0;return!1},O.canParse=function(x,v){return I.canParse(x,v)},O.appendFrame=function(x,v,d){I.initTrackConfig(x,this.observer,v,d,x.manifestCodec);var o=I.appendFrame(x,v,d,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},S}(G.default);L.minProbeByteLength=9,V.default=L},"./src/demux/adts.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"getAudioConfig",function(){return B}),A.d(V,"isHeaderPattern",function(){return U}),A.d(V,"getHeaderLength",function(){return k}),A.d(V,"getFullFrameLength",function(){return L}),A.d(V,"canGetFrameLength",function(){return b}),A.d(V,"isHeader",function(){return S}),A.d(V,"canParse",function(){return O}),A.d(V,"probe",function(){return C}),A.d(V,"initTrackConfig",function(){return x}),A.d(V,"getFrameDuration",function(){return v}),A.d(V,"parseFrameHeader",function(){return d}),A.d(V,"appendFrame",function(){return o});var G=A("./src/utils/logger.ts"),I=A("./src/errors.ts"),R=A("./src/events.ts");function B(u,s,w,g){var f,_,p,h,c=navigator.userAgent.toLowerCase(),l=g,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];f=((s[w+2]&192)>>>6)+1;var y=(s[w+2]&60)>>>2;if(y>a.length-1){u.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+y});return}return p=(s[w+2]&1)<<2,p|=(s[w+3]&192)>>>6,G.logger.log("manifest codec:"+g+", ADTS type:"+f+", samplingIndex:"+y),/firefox/i.test(c)?y>=6?(f=5,h=new Array(4),_=y-3):(f=2,h=new Array(2),_=y):c.indexOf("android")!==-1?(f=2,h=new Array(2),_=y):(f=5,h=new Array(4),g&&(g.indexOf("mp4a.40.29")!==-1||g.indexOf("mp4a.40.5")!==-1)||!g&&y>=6?_=y-3:((g&&g.indexOf("mp4a.40.2")!==-1&&(y>=6&&p===1||/vivaldi/i.test(c))||!g&&p===1)&&(f=2,h=new Array(2)),_=y)),h[0]=f<<3,h[0]|=(y&14)>>1,h[1]|=(y&1)<<7,h[1]|=p<<3,f===5&&(h[1]|=(_&14)>>1,h[2]=(_&1)<<7,h[2]|=2<<2,h[3]=0),{config:h,samplerate:a[y],channelCount:p,codec:"mp4a.40."+f,manifestCodec:l}}function U(u,s){return u[s]===255&&(u[s+1]&246)===240}function k(u,s){return u[s+1]&1?7:9}function L(u,s){return(u[s+3]&3)<<11|u[s+4]<<3|(u[s+5]&224)>>>5}function b(u,s){return s+5<u.length}function S(u,s){return s+1<u.length&&U(u,s)}function O(u,s){return b(u,s)&&U(u,s)&&L(u,s)<=u.length-s}function C(u,s){if(S(u,s)){var w=k(u,s);if(s+w>=u.length)return!1;var g=L(u,s);if(g<=w)return!1;var f=s+g;return f===u.length||S(u,f)}return!1}function x(u,s,w,g,f){if(!u.samplerate){var _=B(s,w,g,f);if(!_)return;u.config=_.config,u.samplerate=_.samplerate,u.channelCount=_.channelCount,u.codec=_.codec,u.manifestCodec=_.manifestCodec,G.logger.log("parsed codec:"+u.codec+", rate:"+_.samplerate+", channels:"+_.channelCount)}}function v(u){return 1024*9e4/u}function d(u,s,w,g,f){var _=k(u,s),p=L(u,s);if(p-=_,p>0){var h=w+g*f;return{headerLength:_,frameLength:p,stamp:h}}}function o(u,s,w,g,f){var _=v(u.samplerate),p=d(s,w,g,f,_);if(p){var h=p.frameLength,c=p.headerLength,l=p.stamp,a=c+h,y=Math.max(0,w+a-s.length),m;y?(m=new Uint8Array(a-c),m.set(s.subarray(w+c,s.length),0)):m=s.subarray(w+c,w+a);var E={unit:m,pts:l};return y||u.samples.push(E),{sample:E,length:a,missing:y}}}},"./src/demux/base-audio-demuxer.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"initPTSFn",function(){return L});var G=A("./src/polyfills/number.ts"),I=A("./src/demux/id3.ts"),R=A("./src/demux/dummy-demuxed-track.ts"),B=A("./src/utils/mp4-tools.ts"),U=A("./src/utils/typed-array.ts"),k=function(){function b(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var S=b.prototype;return S.resetInitSegment=function(C,x,v){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},S.resetTimeStamp=function(){},S.resetContiguity=function(){},S.canParse=function(C,x){return!1},S.appendFrame=function(C,x,v){},S.demux=function(C,x){this.cachedData&&(C=Object(B.appendUint8Array)(this.cachedData,C),this.cachedData=null);var v=I.getID3Data(C,0),d=v?v.length:0,o,u,s=this._audioTrack,w=this._id3Track,g=v?I.getTimeStamp(v):void 0,f=C.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=L(g,x)),v&&v.length>0&&w.samples.push({pts:this.initPTS,dts:this.initPTS,data:v}),u=this.initPTS;d<f;){if(this.canParse(C,d)){var _=this.appendFrame(s,C,d);_?(this.frameIndex++,u=_.sample.pts,d+=_.length,o=d):d=f}else I.canParse(C,d)?(v=I.getID3Data(C,d),w.samples.push({pts:u,dts:u,data:v}),d+=v.length,o=d):d++;if(d===f&&o!==f){var p=Object(U.sliceUint8)(C,o);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,p):this.cachedData=p}}return{audioTrack:s,avcTrack:Object(R.dummyTrack)(),id3Track:w,textTrack:Object(R.dummyTrack)()}},S.demuxSampleAes=function(C,x,v){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},S.flush=function(C){var x=this.cachedData;return x&&(this.cachedData=null,this.demux(x,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(R.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(R.dummyTrack)()}},S.destroy=function(){},b}(),L=function(S,O){return Object(G.isFiniteNumber)(S)?S*90:O*9e4};V.default=k},"./src/demux/chunk-cache.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return G});var G=function(){function R(){this.chunks=[],this.dataLength=0}var B=R.prototype;return B.push=function(k){this.chunks.push(k),this.dataLength+=k.length},B.flush=function(){var k=this.chunks,L=this.dataLength,b;if(k.length)k.length===1?b=k[0]:b=I(k,L);else return new Uint8Array(0);return this.reset(),b},B.reset=function(){this.chunks.length=0,this.dataLength=0},R}();function I(R,B){for(var U=new Uint8Array(B),k=0,L=0;L<R.length;L++){var b=R[L];U.set(b,k),k+=b.length}return U}},"./src/demux/dummy-demuxed-track.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"dummyTrack",function(){return G});function G(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/utils/logger.ts"),I=function(){function R(U){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=U,this.bytesAvailable=U.byteLength,this.word=0,this.bitsAvailable=0}var B=R.prototype;return B.loadWord=function(){var k=this.data,L=this.bytesAvailable,b=k.byteLength-L,S=new Uint8Array(4),O=Math.min(4,L);if(O===0)throw new Error("no bytes available");S.set(k.subarray(b,b+O)),this.word=new DataView(S.buffer).getUint32(0),this.bitsAvailable=O*8,this.bytesAvailable-=O},B.skipBits=function(k){var 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)},B.readBits=function(k){var L=Math.min(this.bitsAvailable,k),b=this.word>>>32-L;return k>32&&G.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?b<<L|this.readBits(L):b},B.skipLZ=function(){var k;for(k=0;k<this.bitsAvailable;++k)if((this.word&2147483648>>>k)!==0)return this.word<<=k,this.bitsAvailable-=k,k;return this.loadWord(),k+this.skipLZ()},B.skipUEG=function(){this.skipBits(1+this.skipLZ())},B.skipEG=function(){this.skipBits(1+this.skipLZ())},B.readUEG=function(){var k=this.skipLZ();return this.readBits(k+1)-1},B.readEG=function(){var k=this.readUEG();return 1&k?1+k>>>1:-1*(k>>>1)},B.readBoolean=function(){return this.readBits(1)===1},B.readUByte=function(){return this.readBits(8)},B.readUShort=function(){return this.readBits(16)},B.readUInt=function(){return this.readBits(32)},B.skipScalingList=function(k){for(var L=8,b=8,S,O=0;O<k;O++)b!==0&&(S=this.readEG(),b=(L+S+256)%256),L=b===0?L:b},B.readSPS=function(){var k=0,L=0,b=0,S=0,O,C,x,v=this.readUByte.bind(this),d=this.readBits.bind(this),o=this.readUEG.bind(this),u=this.readBoolean.bind(this),s=this.skipBits.bind(this),w=this.skipEG.bind(this),g=this.skipUEG.bind(this),f=this.skipScalingList.bind(this);v();var _=v();if(d(5),s(3),v(),g(),_===100||_===110||_===122||_===244||_===44||_===83||_===86||_===118||_===128){var p=o();if(p===3&&s(1),g(),g(),s(1),u())for(C=p!==3?8:12,x=0;x<C;x++)u()&&(x<6?f(16):f(64))}g();var h=o();if(h===0)o();else if(h===1)for(s(1),w(),w(),O=o(),x=0;x<O;x++)w();g(),s(1);var c=o(),l=o(),a=d(1);a===0&&s(1),s(1),u()&&(k=o(),L=o(),b=o(),S=o());var y=[1,1];if(u()&&u()){var m=v();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=[v()<<8|v(),v()<<8|v()];break}}}return{width:Math.ceil((c+1)*16-k*2-L*2),height:(2-a)*(l+1)*16-(a?2:4)*(b+S),pixelRatio:y}},B.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},R}();V.default=I},"./src/demux/id3.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"isHeader",function(){return G}),A.d(V,"isFooter",function(){return I}),A.d(V,"getID3Data",function(){return R}),A.d(V,"canParse",function(){return U}),A.d(V,"getTimeStamp",function(){return k}),A.d(V,"isTimeStampFrame",function(){return L}),A.d(V,"getID3Frames",function(){return S}),A.d(V,"decodeFrame",function(){return O}),A.d(V,"utf8ArrayToStr",function(){return o}),A.d(V,"testables",function(){return u});var G=function(f,_){return _+10<=f.length&&(f[_]===73&&f[_+1]===68&&f[_+2]===51&&(f[_+3]<255&&f[_+4]<255&&(f[_+6]<128&&f[_+7]<128&&f[_+8]<128&&f[_+9]<128)))},I=function(f,_){return _+10<=f.length&&(f[_]===51&&f[_+1]===68&&f[_+2]===73&&(f[_+3]<255&&f[_+4]<255&&(f[_+6]<128&&f[_+7]<128&&f[_+8]<128&&f[_+9]<128)))},R=function(f,_){for(var p=_,h=0;G(f,_);){h+=10;var c=B(f,_+6);h+=c,I(f,_+10)&&(h+=10),_+=h}return h>0?f.subarray(p,p+h):void 0},B=function(f,_){var p=0;return p=(f[_]&127)<<21,p|=(f[_+1]&127)<<14,p|=(f[_+2]&127)<<7,p|=f[_+3]&127,p},U=function(f,_){return G(f,_)&&B(f,_+6)+10<=f.length-_},k=function(f){for(var _=S(f),p=0;p<_.length;p++){var h=_[p];if(L(h))return d(h)}return},L=function(f){return f&&f.key==="PRIV"&&f.info==="com.apple.streaming.transportStreamTimestamp"},b=function(f){var _=String.fromCharCode(f[0],f[1],f[2],f[3]),p=B(f,4),h=10;return{type:_,size:p,data:f.subarray(h,h+p)}},S=function(f){for(var _=0,p=[];G(f,_);){var h=B(f,_+6);_+=10;for(var c=_+h;_+8<c;){var l=b(f.subarray(_)),a=O(l);a&&p.push(a),_+=l.size+10}I(f,_)&&(_+=10)}return p},O=function(f){return f.type==="PRIV"?C(f):f.type[0]==="W"?v(f):x(f)},C=function(f){if(f.size<2)return;var _=o(f.data,!0),p=new Uint8Array(f.data.subarray(_.length+1));return{key:f.type,info:_,data:p.buffer}},x=function(f){if(f.size<2)return;if(f.type==="TXXX"){var _=1,p=o(f.data.subarray(_),!0);_+=p.length+1;var h=o(f.data.subarray(_));return{key:f.type,info:p,data:h}}var c=o(f.data.subarray(1));return{key:f.type,data:c}},v=function(f){if(f.type==="WXXX"){if(f.size<2)return;var _=1,p=o(f.data.subarray(_),!0);_+=p.length+1;var h=o(f.data.subarray(_));return{key:f.type,info:p,data:h}}var c=o(f.data);return{key:f.type,data:c}},d=function(f){if(f.data.byteLength===8){var _=new Uint8Array(f.data),p=_[3]&1,h=(_[4]<<23)+(_[5]<<15)+(_[6]<<7)+_[7];return h/=45,p&&(h+=4772185884e-2),Math.round(h)}return},o=function(f,_){_===void 0&&(_=!1);var p=w();if(p){var h=p.decode(f);if(_){var c=h.indexOf("\0");return c!==-1?h.substring(0,c):h}return h.replace(/\0/g,"")}for(var l=f.length,a,y,m,E="",M=0;M<l;){if(a=f[M++],a===0&&_)return E;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:E+=String.fromCharCode(a);break;case 12:case 13:y=f[M++],E+=String.fromCharCode((a&31)<<6|y&63);break;case 14:y=f[M++],m=f[M++],E+=String.fromCharCode((a&15)<<12|(y&63)<<6|(m&63)<<0);break;default:}}return E},u={decodeTextFrame:x},s;function w(){return!s&&typeof self.TextDecoder!="undefined"&&(s=new self.TextDecoder("utf-8")),s}},"./src/demux/mp3demuxer.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/demux/base-audio-demuxer.ts"),I=A("./src/demux/id3.ts"),R=A("./src/utils/logger.ts"),B=A("./src/demux/mpegaudio.ts");function U(b,S){b.prototype=Object.create(S.prototype),b.prototype.constructor=b,k(b,S)}function k(b,S){return k=Object.setPrototypeOf||function(C,x){return C.__proto__=x,C},k(b,S)}var L=function(b){U(S,b);function S(){return b.apply(this,arguments)||this}var O=S.prototype;return O.resetInitSegment=function(x,v,d){b.prototype.resetInitSegment.call(this,x,v,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:x,duration:d,inputTimeScale:9e4,dropped:0}},S.probe=function(x){if(!x)return!1;for(var v=I.getID3Data(x,0)||[],d=v.length,o=x.length;d<o;d++)if(B.probe(x,d))return R.logger.log("MPEG Audio sync word found !"),!0;return!1},O.canParse=function(x,v){return B.canParse(x,v)},O.appendFrame=function(x,v,d){return this.initPTS===null?void 0:B.appendFrame(x,v,d,this.initPTS,this.frameIndex)},S}(G.default);L.minProbeByteLength=4,V.default=L},"./src/demux/mp4demuxer.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/utils/mp4-tools.ts"),I=A("./src/demux/dummy-demuxed-track.ts"),R=function(){function B(k,L){this.remainderData=null,this.config=void 0,this.config=L}var U=B.prototype;return U.resetTimeStamp=function(){},U.resetInitSegment=function(){},U.resetContiguity=function(){},B.probe=function(L){return Object(G.findBox)({data:L,start:0,end:Math.min(L.length,16384)},["moof"]).length>0},U.demux=function(L){var b=L,S=Object(I.dummyTrack)();if(this.config.progressive){this.remainderData&&(b=Object(G.appendUint8Array)(this.remainderData,L));var O=Object(G.segmentValidRange)(b);this.remainderData=O.remainder,S.samples=O.valid||new Uint8Array}else S.samples=b;return{audioTrack:Object(I.dummyTrack)(),avcTrack:S,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},U.flush=function(){var 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)()}},U.demuxSampleAes=function(L,b,S){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},U.destroy=function(){},B}();R.minProbeByteLength=1024,V.default=R},"./src/demux/mpegaudio.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"appendFrame",function(){return k}),A.d(V,"parseHeader",function(){return L}),A.d(V,"isHeaderPattern",function(){return b}),A.d(V,"isHeader",function(){return S}),A.d(V,"canParse",function(){return O}),A.d(V,"probe",function(){return C});var G=null,I=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],R=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],B=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],U=[0,1,1,4];function k(x,v,d,o,u){if(d+24>v.length)return;var s=L(v,d);if(s&&d+s.frameLength<=v.length){var w=s.samplesPerFrame*9e4/s.sampleRate,g=o+u*w,f={unit:v.subarray(d,d+s.frameLength),pts:g,dts:g};return x.config=[],x.channelCount=s.channelCount,x.samplerate=s.sampleRate,x.samples.push(f),{sample:f,length:s.frameLength,missing:0}}}function L(x,v){var d=x[v+1]>>3&3,o=x[v+1]>>1&3,u=x[v+2]>>4&15,s=x[v+2]>>2&3;if(d!==1&&u!==0&&u!==15&&s!==3){var w=x[v+2]>>1&1,g=x[v+3]>>6,f=d===3?3-o:o===3?3:4,_=I[f*14+u-1]*1e3,p=d===3?0:d===2?1:2,h=R[p*3+s],c=g===3?1:2,l=B[d][o],a=U[o],y=l*8*a,m=Math.floor(l*_/h+w)*a;if(G===null){var E=navigator.userAgent||"",M=E.match(/Chrome\/(\d+)/i);G=M?parseInt(M[1]):0}var F=!!G&&G<=87;return F&&o===2&&_>=224e3&&g===0&&(x[v+3]=x[v+3]|128),{sampleRate:h,channelCount:c,frameLength:m,samplesPerFrame:y}}}function b(x,v){return x[v]===255&&(x[v+1]&224)===224&&(x[v+1]&6)!==0}function S(x,v){return v+1<x.length&&b(x,v)}function O(x,v){var d=4;return b(x,v)&&d<=x.length-v}function C(x,v){if(v+1<x.length&&b(x,v)){var d=4,o=L(x,v),u=d;o!=null&&o.frameLength&&(u=o.frameLength);var s=v+u;return s===x.length||S(x,s)}return!1}},"./src/demux/sample-aes.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/crypt/decrypter.ts"),I=A("./src/demux/tsdemuxer.ts"),R=function(){function B(k,L,b){this.keyData=void 0,this.decrypter=void 0,this.keyData=b,this.decrypter=new G.default(k,L,{removePKCS7Padding:!1})}var U=B.prototype;return U.decryptBuffer=function(L,b){this.decrypter.decrypt(L,this.keyData.key.buffer,this.keyData.iv.buffer,b)},U.decryptAacSample=function(L,b,S,O){var C=L[b].unit,x=C.subarray(16,C.length-C.length%16),v=x.buffer.slice(x.byteOffset,x.byteOffset+x.length),d=this;this.decryptBuffer(v,function(o){var u=new Uint8Array(o);C.set(u,16),O||d.decryptAacSamples(L,b+1,S)})},U.decryptAacSamples=function(L,b,S){for(;;b++){if(b>=L.length){S();return}if(L[b].unit.length<32)continue;var O=this.decrypter.isSync();if(this.decryptAacSample(L,b,S,O),!O)return}},U.getAvcEncryptedData=function(L){for(var b=Math.floor((L.length-48)/160)*16+16,S=new Int8Array(b),O=0,C=32;C<=L.length-16;C+=160,O+=16)S.set(L.subarray(C,C+16),O);return S},U.getAvcDecryptedUnit=function(L,b){for(var S=new Uint8Array(b),O=0,C=32;C<=L.length-16;C+=160,O+=16)L.set(S.subarray(O,O+16),C);return L},U.decryptAvcSample=function(L,b,S,O,C,x){var v=Object(I.discardEPB)(C.data),d=this.getAvcEncryptedData(v),o=this;this.decryptBuffer(d.buffer,function(u){C.data=o.getAvcDecryptedUnit(v,u),x||o.decryptAvcSamples(L,b,S+1,O)})},U.decryptAvcSamples=function(L,b,S,O){if(L instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;b++,S=0){if(b>=L.length){O();return}for(var C=L[b].units;!(S>=C.length);S++){var x=C[S];if(x.data.length<=48||x.type!==1&&x.type!==5)continue;var v=this.decrypter.isSync();if(this.decryptAvcSample(L,b,S,O,x,v),!v)return}}},B}();V.default=R},"./src/demux/transmuxer-interface.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return C});var G=A("./node_modules/webworkify-webpack/index.js"),I=A.n(G),R=A("./src/events.ts"),B=A("./src/demux/transmuxer.ts"),U=A("./src/utils/logger.ts"),k=A("./src/errors.ts"),L=A("./src/utils/mediasource-helper.ts"),b=A("./node_modules/eventemitter3/index.js"),S=A.n(b),O=Object(L.getMediaSource)()||{isTypeSupported:function(){return!1}},C=function(){function x(d,o,u,s){var w=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=d,this.id=o,this.onTransmuxComplete=u,this.onFlush=s;var g=d.config,f=function(l,a){a=a||{},a.frag=w.frag,a.id=w.id,d.trigger(l,a)};this.observer=new b.EventEmitter,this.observer.on(R.Events.FRAG_DECRYPTED,f),this.observer.on(R.Events.ERROR,f);var _={mp4:O.isTypeSupported("video/mp4"),mpeg:O.isTypeSupported("audio/mpeg"),mp3:O.isTypeSupported('audio/mp4; codecs="mp3"')},p=navigator.vendor;if(g.enableWorker&&typeof Worker!="undefined"){U.logger.log("demuxing in webworker");var h;try{h=this.worker=G("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(c){d.trigger(R.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},h.postMessage({cmd:"init",typeSupported:_,vendor:p,id:o,config:JSON.stringify(g)})}catch(c){U.logger.warn("Error in worker:",c),U.logger.error("Error while initializing DemuxerWorker, fallback to inline"),h&&self.URL.revokeObjectURL(h.objectURL),this.transmuxer=new B.default(this.observer,_,g,p,o),this.worker=null}}else this.transmuxer=new B.default(this.observer,_,g,p,o)}var v=x.prototype;return v.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var u=this.transmuxer;u&&(u.destroy(),this.transmuxer=null)}var s=this.observer;s&&s.removeAllListeners(),this.observer=null},v.push=function(o,u,s,w,g,f,_,p,h,c){var l=this;h.transmuxing.start=self.performance.now();var a=this.transmuxer,y=this.worker,m=f?f.start:g.start,E=g.decryptdata,M=this.frag,F=!(M&&g.cc===M.cc),j=!(M&&h.level===M.level),W=M?h.sn-M.sn:-1,D=this.part?h.part-this.part.index:1,P=!j&&(W===1||W===0&&D===1),H=self.performance.now();(j||W||g.stats.parsing.start===0)&&(g.stats.parsing.start=H),f&&(D||!P)&&(f.stats.parsing.start=H);var Y=new B.TransmuxState(F,P,p,j,m);if(!P||F){U.logger.log("[transmuxer-interface, "+g.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
discontinuity: `+F+`
trackSwitch: `+j+`
contiguous: `+P+`
accurateTimeOffset: `+p+`
timeOffset: `+m);var ee=new B.TransmuxConfig(s,w,u,_,c);this.configureTransmuxer(ee)}if(this.frag=g,this.part=f,y)y.postMessage({cmd:"demux",data:o,decryptdata:E,chunkMeta:h,state:Y},o instanceof ArrayBuffer?[o]:[]);else if(a){var oe=a.push(o,E,h,Y);Object(B.isPromise)(oe)?oe.then(function(xe){l.handleTransmuxComplete(xe)}):this.handleTransmuxComplete(oe)}},v.flush=function(o){var u=this;o.transmuxing.start=self.performance.now();var s=this.transmuxer,w=this.worker;if(w)w.postMessage({cmd:"flush",chunkMeta:o});else if(s){var g=s.flush(o);Object(B.isPromise)(g)?g.then(function(f){u.handleFlushResult(f,o)}):this.handleFlushResult(g,o)}},v.handleFlushResult=function(o,u){var s=this;o.forEach(function(w){s.handleTransmuxComplete(w)}),this.onFlush(u)},v.onWorkerMessage=function(o){var u=o.data,s=this.hls;switch(u.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.id=this.id,s.trigger(u.event,u.data);break}}},v.configureTransmuxer=function(o){var u=this.worker,s=this.transmuxer;u?u.postMessage({cmd:"configure",config:o}):s&&s.configure(o)},v.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},x}()},"./src/demux/transmuxer-worker.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return k});var G=A("./src/demux/transmuxer.ts"),I=A("./src/events.ts"),R=A("./src/utils/logger.ts"),B=A("./node_modules/eventemitter3/index.js"),U=A.n(B);function k(C){var x=new B.EventEmitter,v=function(o,u){C.postMessage({event:o,data:u})};x.on(I.Events.FRAG_DECRYPTED,v),x.on(I.Events.ERROR,v),C.addEventListener("message",function(d){var o=d.data;switch(o.cmd){case"init":{var u=JSON.parse(o.config);C.transmuxer=new G.default(x,o.typeSupported,u,o.vendor,o.id),Object(R.enableLogs)(u.debug),v("init",null);break}case"configure":{C.transmuxer.configure(o.config);break}case"demux":{var s=C.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(G.isPromise)(s)?s.then(function(f){L(C,f)}):L(C,s);break}case"flush":{var w=o.chunkMeta,g=C.transmuxer.flush(w);Object(G.isPromise)(g)?g.then(function(f){S(C,f,w)}):S(C,g,w);break}default:break}})}function L(C,x){if(O(x.remuxResult))return;var v=[],d=x.remuxResult,o=d.audio,u=d.video;o&&b(v,o),u&&b(v,u),C.postMessage({event:"transmuxComplete",data:x},v)}function b(C,x){x.data1&&C.push(x.data1.buffer),x.data2&&C.push(x.data2.buffer)}function S(C,x,v){x.forEach(function(d){L(C,d)}),C.postMessage({event:"flush",data:v})}function O(C){return!C.audio&&!C.video&&!C.text&&!C.id3&&!C.initSegment}},"./src/demux/transmuxer.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return u}),A.d(V,"isPromise",function(){return g}),A.d(V,"TransmuxConfig",function(){return f}),A.d(V,"TransmuxState",function(){return _});var G=A("./src/events.ts"),I=A("./src/errors.ts"),R=A("./src/crypt/decrypter.ts"),B=A("./src/demux/aacdemuxer.ts"),U=A("./src/demux/mp4demuxer.ts"),k=A("./src/demux/tsdemuxer.ts"),L=A("./src/demux/mp3demuxer.ts"),b=A("./src/remux/mp4-remuxer.ts"),S=A("./src/remux/passthrough-remuxer.ts"),O=A("./src/demux/chunk-cache.ts"),C=A("./src/utils/mp4-tools.ts"),x=A("./src/utils/logger.ts"),v;try{v=self.performance.now.bind(self.performance)}catch(p){x.logger.debug("Unable to use Performance API on this environment"),v=self.Date.now}var d=[{demux:k.default,remux:b.default},{demux:U.default,remux:S.default},{demux:B.default,remux:b.default},{demux:L.default,remux:b.default}],o=1024;d.forEach(function(p){var h=p.demux;o=Math.max(o,h.minProbeByteLength)});var u=function(){function p(c,l,a,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 O.default,this.observer=c,this.typeSupported=l,this.config=a,this.vendor=y,this.id=m}var h=p.prototype;return h.configure=function(l){this.transmuxConfig=l,this.decrypter&&this.decrypter.reset()},h.push=function(l,a,y,m){var E=this,M=y.transmuxing;M.executeStart=v();var F=new Uint8Array(l),j=this.cache,W=this.config,D=this.currentTransmuxState,P=this.transmuxConfig;m&&(this.currentTransmuxState=m);var H=s(F,a);if(H&&H.method==="AES-128"){var Y=this.getDecrypter();if(W.enableSoftwareAES){var ee=Y.softwareDecrypt(F,H.key.buffer,H.iv.buffer);if(!ee)return M.executeEnd=v(),w(y);F=new Uint8Array(ee)}else return this.decryptionPromise=Y.webCryptoDecrypt(F,H.key.buffer,H.iv.buffer).then(function(Se){var Le=E.push(Se,null,y);return E.decryptionPromise=null,Le}),this.decryptionPromise}var oe=m||D,xe=oe.contiguous,ve=oe.discontinuity,he=oe.trackSwitch,fe=oe.accurateTimeOffset,me=oe.timeOffset,ae=P.audioCodec,pe=P.videoCodec,$=P.defaultInitPts,ne=P.duration,Q=P.initSegmentData;if((ve||he)&&this.resetInitSegment(Q,ae,pe,ne),ve&&this.resetInitialTimestamp($),xe||this.resetContiguity(),this.needsProbing(F,ve,he)){if(j.dataLength){var Ee=j.flush();F=Object(C.appendUint8Array)(Ee,F)}this.configureTransmuxer(F,P)}var we=this.transmux(F,H,me,fe,y),ye=this.currentTransmuxState;return ye.contiguous=!0,ye.discontinuity=!1,ye.trackSwitch=!1,M.executeEnd=v(),we},h.flush=function(l){var a=this,y=l.transmuxing;y.executeStart=v();var m=this.decrypter,E=this.cache,M=this.currentTransmuxState,F=this.decryptionPromise;if(F)return F.then(function(){return a.flush(l)});var j=[],W=M.timeOffset;if(m){var D=m.flush();D&&j.push(this.push(D,null,l))}var P=E.dataLength;E.reset();var H=this.demuxer,Y=this.remuxer;if(!H||!Y)return P>=o&&this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),y.executeEnd=v(),[w(l)];var ee=H.flush(W);return g(ee)?ee.then(function(oe){return a.flushRemux(j,oe,l),j}):(this.flushRemux(j,ee,l),j)},h.flushRemux=function(l,a,y){var m=a.audioTrack,E=a.avcTrack,M=a.id3Track,F=a.textTrack,j=this.currentTransmuxState,W=j.accurateTimeOffset,D=j.timeOffset;x.logger.log("[transmuxer.ts]: Flushed fragment "+y.sn+(y.part>-1?" p: "+y.part:"")+" of level "+y.level);var P=this.remuxer.remux(m,E,M,F,D,W,!0,this.id);l.push({remuxResult:P,chunkMeta:y}),y.transmuxing.executeEnd=v()},h.resetInitialTimestamp=function(l){var a=this.demuxer,y=this.remuxer;if(!a||!y)return;a.resetTimeStamp(l),y.resetTimeStamp(l)},h.resetContiguity=function(){var l=this.demuxer,a=this.remuxer;if(!l||!a)return;l.resetContiguity(),a.resetNextTimestamp()},h.resetInitSegment=function(l,a,y,m){var E=this.demuxer,M=this.remuxer;if(!E||!M)return;E.resetInitSegment(a,y,m),M.resetInitSegment(l,a,y)},h.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},h.transmux=function(l,a,y,m,E){var M;return a&&a.method==="SAMPLE-AES"?M=this.transmuxSampleAes(l,a,y,m,E):M=this.transmuxUnencrypted(l,y,m,E),M},h.transmuxUnencrypted=function(l,a,y,m){var E=this.demuxer.demux(l,a,!1,!this.config.progressive),M=E.audioTrack,F=E.avcTrack,j=E.id3Track,W=E.textTrack,D=this.remuxer.remux(M,F,j,W,a,y,!1,this.id);return{remuxResult:D,chunkMeta:m}},h.transmuxSampleAes=function(l,a,y,m,E){var M=this;return this.demuxer.demuxSampleAes(l,a,y).then(function(F){var j=M.remuxer.remux(F.audioTrack,F.avcTrack,F.id3Track,F.textTrack,y,m,!1,M.id);return{remuxResult:j,chunkMeta:E}})},h.configureTransmuxer=function(l,a){for(var y=this.config,m=this.observer,E=this.typeSupported,M=this.vendor,F=a.audioCodec,j=a.defaultInitPts,W=a.duration,D=a.initSegmentData,P=a.videoCodec,H,Y=0,ee=d.length;Y<ee;Y++)if(d[Y].demux.probe(l)){H=d[Y];break}H||(x.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),H={demux:U.default,remux:S.default});var oe=this.demuxer,xe=this.remuxer,ve=H.remux,he=H.demux;(!xe||!(xe instanceof ve))&&(this.remuxer=new ve(m,y,E,M)),(!oe||!(oe instanceof he))&&(this.demuxer=new he(m,y,E),this.probe=he.probe),this.resetInitSegment(D,F,P,W),this.resetInitialTimestamp(j)},h.needsProbing=function(l,a,y){return!this.demuxer||!this.remuxer||a||y},h.getDecrypter=function(){var l=this.decrypter;return l||(l=this.decrypter=new R.default(this.observer,this.config)),l},p}();function s(p,h){var c=null;return p.byteLength>0&&h!=null&&h.key!=null&&h.iv!==null&&h.method!=null&&(c=h),c}var w=function(h){return{remuxResult:{},chunkMeta:h}};function g(p){return"then"in p&&p.then instanceof Function}var f=function(h,c,l,a,y){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=h,this.videoCodec=c,this.initSegmentData=l,this.duration=a,this.defaultInitPts=y},_=function(h,c,l,a,y){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=h,this.contiguous=c,this.accurateTimeOffset=l,this.trackSwitch=a,this.timeOffset=y}},"./src/demux/tsdemuxer.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"discardEPB",function(){return w});var G=A("./src/demux/adts.ts"),I=A("./src/demux/mpegaudio.ts"),R=A("./src/demux/exp-golomb.ts"),B=A("./src/demux/id3.ts"),U=A("./src/demux/sample-aes.ts"),k=A("./src/events.ts"),L=A("./src/utils/mp4-tools.ts"),b=A("./src/utils/logger.ts"),S=A("./src/errors.ts"),O={video:1,audio:2,id3:3,text:4},C=function(){function g(_,p,h){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=_,this.config=p,this.typeSupported=h}g.probe=function(p){var h=g.syncOffset(p);return h<0?!1:(h&&b.logger.warn("MPEG2-TS detected but first sync word found @ offset "+h+", junk ahead ?"),!0)},g.syncOffset=function(p){for(var h=Math.min(1e3,p.length-3*188),c=0;c<h;){if(p[c]===71&&p[c+188]===71&&p[c+2*188]===71)return c;c++}return-1},g.createTrack=function(p,h){return{container:p==="video"||p==="audio"?"video/mp2t":void 0,type:p,id:O[p],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:p==="audio"?h:void 0}};var f=g.prototype;return f.resetInitSegment=function(p,h,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=g.createTrack("video",c),this._audioTrack=g.createTrack("audio",c),this._id3Track=g.createTrack("id3",c),this._txtTrack=g.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=p,this.videoCodec=h,this._duration=c},f.resetTimeStamp=function(){},f.resetContiguity=function(){var p=this._audioTrack,h=this._avcTrack,c=this._id3Track;p&&(p.pesData=null),h&&(h.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},f.demux=function(p,h,c,l){c===void 0&&(c=!1),l===void 0&&(l=!1),c||(this.sampleAes=null);var a,y=this._avcTrack,m=this._audioTrack,E=this._id3Track,M=y.pid,F=y.pesData,j=m.pid,W=E.pid,D=m.pesData,P=E.pesData,H=!1,Y=this.pmtParsed,ee=this._pmtId,oe=p.length;if(this.remainderData&&(p=Object(L.appendUint8Array)(this.remainderData,p),oe=p.length,this.remainderData=null),oe<188&&!l)return this.remainderData=p,{audioTrack:m,avcTrack:y,id3Track:E,textTrack:this._txtTrack};var xe=Math.max(0,g.syncOffset(p));oe-=(oe+xe)%188,oe<p.byteLength&&!l&&(this.remainderData=new Uint8Array(p.buffer,oe,p.buffer.byteLength-oe));for(var ve=xe;ve<oe;ve+=188)if(p[ve]===71){var he=!!(p[ve+1]&64),fe=((p[ve+1]&31)<<8)+p[ve+2],me=(p[ve+3]&48)>>4,ae=void 0;if(me>1){if(ae=ve+5+p[ve+4],ae===ve+188)continue}else ae=ve+4;switch(fe){case M:he&&(F&&(a=o(F))&&this.parseAVCPES(a,!1),F={data:[],size:0}),F&&(F.data.push(p.subarray(ae,ve+188)),F.size+=ve+188-ae);break;case j:he&&(D&&(a=o(D))&&(m.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),D={data:[],size:0}),D&&(D.data.push(p.subarray(ae,ve+188)),D.size+=ve+188-ae);break;case W:he&&(P&&(a=o(P))&&this.parseID3PES(a),P={data:[],size:0}),P&&(P.data.push(p.subarray(ae,ve+188)),P.size+=ve+188-ae);break;case 0:he&&(ae+=p[ae]+1),ee=this._pmtId=v(p,ae);break;case ee:{he&&(ae+=p[ae]+1);var pe=d(p,ae,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);M=pe.avc,M>0&&(y.pid=M),j=pe.audio,j>0&&(m.pid=j,m.isAAC=pe.isAAC),W=pe.id3,W>0&&(E.pid=W),H&&!Y&&(b.logger.log("reparse from beginning"),H=!1,ve=xe-188),Y=this.pmtParsed=!0;break}case 17:case 8191:break;default:H=!0;break}}else this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});y.pesData=F,m.pesData=D,E.pesData=P;var $={audioTrack:m,avcTrack:y,id3Track:E,textTrack:this._txtTrack};return l&&this.extractRemainingSamples($),$},f.flush=function(){var p=this.remainderData;this.remainderData=null;var h;return p?h=this.demux(p,-1,!1,!0):h={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(h),this.sampleAes?this.decrypt(h,this.sampleAes):h},f.extractRemainingSamples=function(p){var h=p.audioTrack,c=p.avcTrack,l=p.id3Track,a=c.pesData,y=h.pesData,m=l.pesData,E;a&&(E=o(a))?(this.parseAVCPES(E,!0),c.pesData=null):c.pesData=a,y&&(E=o(y))?(h.isAAC?this.parseAACPES(E):this.parseMPEGPES(E),h.pesData=null):(y!=null&&y.size&&b.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=y),m&&(E=o(m))?(this.parseID3PES(E),l.pesData=null):l.pesData=m},f.demuxSampleAes=function(p,h,c){var l=this.demux(p,c,!0,!this.config.progressive),a=this.sampleAes=new U.default(this.observer,this.config,h);return this.decrypt(l,a)},f.decrypt=function(p,h){return new Promise(function(c){var l=p.audioTrack,a=p.avcTrack;l.samples&&l.isAAC?h.decryptAacSamples(l.samples,0,function(){a.samples?h.decryptAvcSamples(a.samples,0,0,function(){c(p)}):c(p)}):a.samples&&h.decryptAvcSamples(a.samples,0,0,function(){c(p)})})},f.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},f.parseAVCPES=function(p,h){var c=this,l=this._avcTrack,a=this.parseAVCNALu(p.data),y=!1,m=this.avcSample,E,M=!1;p.data=null,m&&a.length&&!l.audFound&&(u(m,l),m=this.avcSample=x(!1,p.pts,p.dts,"")),a.forEach(function(F){switch(F.type){case 1:{E=!0,m||(m=c.avcSample=x(!0,p.pts,p.dts,"")),y&&(m.debug+="NDR "),m.frame=!0;var j=F.data;if(M&&j.length>4){var W=new R.default(j).readSliceType();(W===2||W===4||W===7||W===9)&&(m.key=!0)}break}case 5:E=!0,m||(m=c.avcSample=x(!0,p.pts,p.dts,"")),y&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{E=!0,y&&m&&(m.debug+="SEI ");var D=new R.default(w(F.data));D.readUByte();for(var P=0,H=0,Y=!1,ee=0;!Y&&D.bytesAvailable>1;){P=0;do ee=D.readUByte(),P+=ee;while(ee===255);H=0;do ee=D.readUByte(),H+=ee;while(ee===255);if(P===4&&D.bytesAvailable!==0){Y=!0;var oe=D.readUByte();if(oe===181){var xe=D.readUShort();if(xe===49){var ve=D.readUInt();if(ve===1195456820){var he=D.readUByte();if(he===3){for(var fe=D.readUByte(),me=D.readUByte(),ae=31&fe,pe=[fe,me],$=0;$<ae;$++)pe.push(D.readUByte()),pe.push(D.readUByte()),pe.push(D.readUByte());s(c._txtTrack.samples,{type:3,pts:p.pts,bytes:pe})}}}}}else if(P===5&&D.bytesAvailable!==0){if(Y=!0,H>16){for(var ne=[],Q=0;Q<16;Q++)ne.push(D.readUByte().toString(16)),(Q===3||Q===5||Q===7||Q===9)&&ne.push("-");for(var Ee=H-16,we=new Uint8Array(Ee),ye=0;ye<Ee;ye++)we[ye]=D.readUByte();s(c._txtTrack.samples,{pts:p.pts,payloadType:P,uuid:ne.join(""),userData:Object(B.utf8ArrayToStr)(we),userDataBytes:we})}}else if(H<D.bytesAvailable)for(var Se=0;Se<H;Se++)D.readUByte()}break}case 7:if(E=!0,M=!0,y&&m&&(m.debug+="SPS "),!l.sps){var Le=new R.default(F.data),Oe=Le.readSPS();l.width=Oe.width,l.height=Oe.height,l.pixelRatio=Oe.pixelRatio,l.sps=[F.data],l.duration=c._duration;for(var ke=F.data.subarray(1,4),De="avc1.",Pe=0;Pe<3;Pe++){var ze=ke[Pe].toString(16);ze.length<2&&(ze="0"+ze),De+=ze}l.codec=De}break;case 8:E=!0,y&&m&&(m.debug+="PPS "),l.pps||(l.pps=[F.data]);break;case 9:E=!1,l.audFound=!0,m&&u(m,l),m=c.avcSample=x(!1,p.pts,p.dts,y?"AUD ":"");break;case 12:E=!1;break;default:E=!1,m&&(m.debug+="unknown NAL "+F.type+" ");break}if(m&&E){var $e=m.units;$e.push(F)}}),h&&m&&(u(m,l),this.avcSample=null)},f.getLastNalUnit=function(){var p,h=this.avcSample,c;if(!h||h.units.length===0){var l=this._avcTrack.samples;h=l[l.length-1]}if((p=h)!==null&&p!==void 0&&p.units){var a=h.units;c=a[a.length-1]}return c},f.parseAVCNALu=function(p){var h=p.byteLength,c=this._avcTrack,l=c.naluState||0,a=l,y=[],m=0,E,M,F,j=-1,W=0;for(l===-1&&(j=0,W=p[0]&31,l=0,m=1);m<h;){if(E=p[m++],!l){l=E?0:1;continue}if(l===1){l=E?0:2;continue}if(!E)l=3;else if(E===1){if(j>=0){var D={data:p.subarray(j,m-l-1),type:W};y.push(D)}else{var P=this.getLastNalUnit();if(P&&(a&&m<=4-a&&(P.state&&(P.data=P.data.subarray(0,P.data.byteLength-a))),M=m-l-1,M>0)){var H=new Uint8Array(P.data.byteLength+M);H.set(P.data,0),H.set(p.subarray(0,M),P.data.byteLength),P.data=H,P.state=0}}m<h?(F=p[m]&31,j=m,W=F,l=0):l=-1}else l=0}if(j>=0&&l>=0){var Y={data:p.subarray(j,h),type:W,state:l};y.push(Y)}if(y.length===0){var ee=this.getLastNalUnit();if(ee){var oe=new Uint8Array(ee.data.byteLength+p.byteLength);oe.set(ee.data,0),oe.set(p,ee.data.byteLength),ee.data=oe}}return c.naluState=l,y},f.parseAACPES=function(p){var h=0,c=this._audioTrack,l=this.aacOverFlow,a=p.data;if(l){this.aacOverFlow=null;var y=l.sample.unit.byteLength,m=Math.min(l.missing,y),E=y-m;l.sample.unit.set(a.subarray(0,m),E),c.samples.push(l.sample),h=l.missing}var M,F;for(M=h,F=a.length;M<F-1&&!G.isHeader(a,M);M++);if(M!==h){var j,W;if(M<F-1?(j="AAC PES did not start with ADTS header,offset:"+M,W=!1):(j="no ADTS header found in AAC PES",W=!0),b.logger.warn("parsing error:"+j),this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:j}),W)return}G.initTrackConfig(c,this.observer,a,M,this.audioCodec);var D;if(p.pts!==void 0)D=p.pts;else if(l){var P=G.getFrameDuration(c.samplerate);D=l.sample.pts+P}else{b.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var H=0;M<F;)if(G.isHeader(a,M)){if(M+5<F){var Y=G.appendFrame(c,a,M,D,H);if(Y)if(Y.missing)this.aacOverFlow=Y;else{M+=Y.length,H++;continue}}break}else M++},f.parseMPEGPES=function(p){var h=p.data,c=h.length,l=0,a=0,y=p.pts;if(y===void 0){b.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(I.isHeader(h,a)){var m=I.appendFrame(this._audioTrack,h,a,y,l);if(m)a+=m.length,l++;else break}else a++},f.parseID3PES=function(p){if(p.pts===void 0){b.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(p)},g}();C.minProbeByteLength=188;function x(g,f,_,p){return{key:g,frame:!1,pts:f,dts:_,units:[],debug:p,length:0}}function v(g,f){return(g[f+10]&31)<<8|g[f+11]}function d(g,f,_,p){var h={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(g[f+1]&15)<<8|g[f+2],l=f+3+c-4,a=(g[f+10]&15)<<8|g[f+11];for(f+=12+a;f<l;){var y=(g[f+1]&31)<<8|g[f+2];switch(g[f]){case 207:if(!p){b.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:h.audio===-1&&(h.audio=y);break;case 21:h.id3===-1&&(h.id3=y);break;case 219:if(!p){b.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:h.avc===-1&&(h.avc=y);break;case 3:case 4:_?h.audio===-1&&(h.audio=y,h.isAAC=!1):b.logger.log("MPEG audio found, not supported in this browser");break;case 36:b.logger.warn("Unsupported HEVC stream type found");break;default:break}f+=((g[f+3]&15)<<8|g[f+4])+5}return h}function o(g){var f=0,_,p,h,c,l,a=g.data;if(!g||g.size===0)return null;for(;a[0].length<19&&a.length>1;){var y=new Uint8Array(a[0].length+a[1].length);y.set(a[0]),y.set(a[1],a[0].length),a[0]=y,a.splice(1,1)}_=a[0];var m=(_[0]<<16)+(_[1]<<8)+_[2];if(m===1){if(p=(_[4]<<8)+_[5],p&&p>g.size-6)return null;var E=_[7];E&192&&(c=(_[9]&14)*536870912+(_[10]&255)*4194304+(_[11]&254)*16384+(_[12]&255)*128+(_[13]&254)/2,E&64?(l=(_[14]&14)*536870912+(_[15]&255)*4194304+(_[16]&254)*16384+(_[17]&255)*128+(_[18]&254)/2,c-l>60*9e4&&(b.logger.warn(Math.round((c-l)/9e4)+"s delta between PTS and DTS, align them"),c=l)):l=c),h=_[8];var M=h+9;if(g.size<=M)return null;g.size-=M;for(var F=new Uint8Array(g.size),j=0,W=a.length;j<W;j++){_=a[j];var D=_.byteLength;if(M)if(M>D){M-=D;continue}else _=_.subarray(M),D-=M,M=0;F.set(_,f),f+=D}return p&&(p-=h+3),{data:F,pts:c,dts:l,len:p}}return null}function u(g,f){if(g.units.length&&g.frame){if(g.pts===void 0){var _=f.samples,p=_.length;if(p){var h=_[p-1];g.pts=h.pts,g.dts=h.dts}else{f.dropped++;return}}f.samples.push(g)}g.debug.length&&b.logger.log(g.pts+"/"+g.dts+":"+g.debug)}function s(g,f){var _=g.length;if(_>0){if(f.pts>=g[_-1].pts)g.push(f);else for(var p=_-1;p>=0;p--)if(f.pts<g[p].pts){g.splice(p,0,f);break}}else g.push(f)}function w(g){for(var f=g.byteLength,_=[],p=1;p<f-2;)g[p]===0&&g[p+1]===0&&g[p+2]===3?(_.push(p+2),p+=2):p++;if(_.length===0)return g;var h=f-_.length,c=new Uint8Array(h),l=0;for(p=0;p<h;l++,p++)l===_[0]&&(l++,_.shift()),c[p]=g[l];return c}V.default=C},"./src/errors.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"ErrorTypes",function(){return G}),A.d(V,"ErrorDetails",function(){return I});var G;(function(R){R.NETWORK_ERROR="networkError",R.MEDIA_ERROR="mediaError",R.KEY_SYSTEM_ERROR="keySystemError",R.MUX_ERROR="muxError",R.OTHER_ERROR="otherError"})(G||(G={}));var I;(function(R){R.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",R.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",R.KEY_SYSTEM_NO_SESSION="keySystemNoSession",R.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",R.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",R.MANIFEST_LOAD_ERROR="manifestLoadError",R.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",R.MANIFEST_PARSING_ERROR="manifestParsingError",R.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",R.LEVEL_EMPTY_ERROR="levelEmptyError",R.LEVEL_LOAD_ERROR="levelLoadError",R.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",R.LEVEL_SWITCH_ERROR="levelSwitchError",R.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",R.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",R.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",R.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",R.FRAG_LOAD_ERROR="fragLoadError",R.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",R.FRAG_DECRYPT_ERROR="fragDecryptError",R.FRAG_PARSING_ERROR="fragParsingError",R.REMUX_ALLOC_ERROR="remuxAllocError",R.KEY_LOAD_ERROR="keyLoadError",R.KEY_LOAD_TIMEOUT="keyLoadTimeOut",R.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",R.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",R.BUFFER_APPEND_ERROR="bufferAppendError",R.BUFFER_APPENDING_ERROR="bufferAppendingError",R.BUFFER_STALLED_ERROR="bufferStalledError",R.BUFFER_FULL_ERROR="bufferFullError",R.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",R.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",R.INTERNAL_EXCEPTION="internalException",R.INTERNAL_ABORTED="aborted",R.UNKNOWN="unknown"})(I||(I={}))},"./src/events.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"Events",function(){return G});var G;(function(I){I.MEDIA_ATTACHING="hlsMediaAttaching",I.MEDIA_ATTACHED="hlsMediaAttached",I.MEDIA_DETACHING="hlsMediaDetaching",I.MEDIA_DETACHED="hlsMediaDetached",I.BUFFER_RESET="hlsBufferReset",I.BUFFER_CODECS="hlsBufferCodecs",I.BUFFER_CREATED="hlsBufferCreated",I.BUFFER_APPENDING="hlsBufferAppending",I.BUFFER_APPENDED="hlsBufferAppended",I.BUFFER_EOS="hlsBufferEos",I.BUFFER_FLUSHING="hlsBufferFlushing",I.BUFFER_FLUSHED="hlsBufferFlushed",I.MANIFEST_LOADING="hlsManifestLoading",I.MANIFEST_LOADED="hlsManifestLoaded",I.MANIFEST_PARSED="hlsManifestParsed",I.LEVEL_SWITCHING="hlsLevelSwitching",I.LEVEL_SWITCHED="hlsLevelSwitched",I.LEVEL_LOADING="hlsLevelLoading",I.LEVEL_LOADED="hlsLevelLoaded",I.LEVEL_UPDATED="hlsLevelUpdated",I.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",I.LEVELS_UPDATED="hlsLevelsUpdated",I.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",I.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",I.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",I.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",I.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",I.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",I.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",I.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",I.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",I.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",I.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",I.CUES_PARSED="hlsCuesParsed",I.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",I.INIT_PTS_FOUND="hlsInitPtsFound",I.FRAG_LOADING="hlsFragLoading",I.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",I.FRAG_LOADED="hlsFragLoaded",I.FRAG_DECRYPTED="hlsFragDecrypted",I.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",I.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",I.FRAG_PARSING_METADATA="hlsFragParsingMetadata",I.FRAG_PARSED="hlsFragParsed",I.FRAG_BUFFERED="hlsFragBuffered",I.FRAG_CHANGED="hlsFragChanged",I.FPS_DROP="hlsFpsDrop",I.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",I.ERROR="hlsError",I.DESTROYING="hlsDestroying",I.KEY_LOADING="hlsKeyLoading",I.KEY_LOADED="hlsKeyLoaded",I.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",I.BACK_BUFFER_REACHED="hlsBackBufferReached"})(G||(G={}))},"./src/hls.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return g});var G=A("./node_modules/url-toolkit/src/url-toolkit.js"),I=A.n(G),R=A("./src/loader/playlist-loader.ts"),B=A("./src/loader/key-loader.ts"),U=A("./src/controller/id3-track-controller.ts"),k=A("./src/controller/latency-controller.ts"),L=A("./src/controller/level-controller.ts"),b=A("./src/controller/fragment-tracker.ts"),S=A("./src/controller/stream-controller.ts"),O=A("./src/is-supported.ts"),C=A("./src/utils/logger.ts"),x=A("./src/config.ts"),v=A("./node_modules/eventemitter3/index.js"),d=A.n(v),o=A("./src/events.ts"),u=A("./src/errors.ts");function s(f,_){for(var p=0;p<_.length;p++){var h=_[p];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(f,h.key,h)}}function w(f,_,p){return _&&s(f.prototype,_),p&&s(f,p),f}var g=function(){f.isSupported=function(){return Object(O.isSupported)()};function f(p){p===void 0&&(p={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new v.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var h=this.config=Object(x.mergeConfig)(f.DefaultConfig,p);this.userConfig=p,Object(C.enableLogs)(h.debug),this._autoLevelCapping=-1,h.progressive&&Object(x.enableStreamingMode)(h);var c=h.abrController,l=h.bufferController,a=h.capLevelController,y=h.fpsController,m=this.abrController=new c(this),E=this.bufferController=new l(this),M=this.capLevelController=new a(this),F=new y(this),j=new R.default(this),W=new B.default(this),D=new U.default(this),P=this.levelController=new L.default(this),H=new b.FragmentTracker(this),Y=this.streamController=new S.default(this,H);M.setStreamController(Y),F.setStreamController(Y);var ee=[P,Y];this.networkControllers=ee;var oe=[j,W,m,E,M,F,D,H];this.audioTrackController=this.createController(h.audioTrackController,null,ee),this.createController(h.audioStreamController,H,ee),this.subtitleTrackController=this.createController(h.subtitleTrackController,null,ee),this.createController(h.subtitleStreamController,H,ee),this.createController(h.timelineController,null,oe),this.emeController=this.createController(h.emeController,null,oe),this.cmcdController=this.createController(h.cmcdController,null,oe),this.latencyController=this.createController(k.default,null,oe),this.coreComponents=oe}var _=f.prototype;return _.createController=function(h,c,l){if(h){var a=c?new h(this,c):new h(this);return l&&l.push(a),a}return null},_.on=function(h,c,l){l===void 0&&(l=this),this._emitter.on(h,c,l)},_.once=function(h,c,l){l===void 0&&(l=this),this._emitter.once(h,c,l)},_.removeAllListeners=function(h){this._emitter.removeAllListeners(h)},_.off=function(h,c,l,a){l===void 0&&(l=this),this._emitter.off(h,c,l,a)},_.listeners=function(h){return this._emitter.listeners(h)},_.emit=function(h,c,l){return this._emitter.emit(h,c,l)},_.trigger=function(h,c){if(this.config.debug)return this.emit(h,h,c);try{return this.emit(h,h,c)}catch(l){C.logger.error("An internal error happened while handling event "+h+'. Error message: "'+l.message+'". Here is a stacktrace:',l),this.trigger(o.Events.ERROR,{type:u.ErrorTypes.OTHER_ERROR,details:u.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:h,error:l})}return!1},_.listenerCount=function(h){return this._emitter.listenerCount(h)},_.destroy=function(){C.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(h){return h.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(h){return h.destroy()}),this.coreComponents.length=0},_.attachMedia=function(h){C.logger.log("attachMedia"),this._media=h,this.trigger(o.Events.MEDIA_ATTACHING,{media:h})},_.detachMedia=function(){C.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},_.loadSource=function(h){this.stopLoad();var c=this.media,l=this.url,a=this.url=G.buildAbsoluteURL(self.location.href,h,{alwaysNormalize:!0});C.logger.log("loadSource:"+a),c&&l&&l!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.Events.MANIFEST_LOADING,{url:h})},_.startLoad=function(h){h===void 0&&(h=-1),C.logger.log("startLoad("+h+")"),this.networkControllers.forEach(function(c){c.startLoad(h)})},_.stopLoad=function(){C.logger.log("stopLoad"),this.networkControllers.forEach(function(h){h.stopLoad()})},_.swapAudioCodec=function(){C.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},_.recoverMediaError=function(){C.logger.log("recoverMediaError");var h=this._media;this.detachMedia(),h&&this.attachMedia(h)},_.removeLevel=function(h,c){c===void 0&&(c=0),this.levelController.removeLevel(h,c)},w(f,[{key:"levels",get:function(){var h=this.levelController.levels;return h||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(h){C.logger.log("set currentLevel:"+h),this.loadLevel=h,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(h){C.logger.log("set nextLevel:"+h),this.levelController.manualLevel=h,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(h){C.logger.log("set loadLevel:"+h),this.levelController.manualLevel=h}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(h){this.levelController.nextLoadLevel=h}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(h){C.logger.log("set firstLevel:"+h),this.levelController.firstLevel=h}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(h){C.logger.log("set startLevel:"+h),h!==-1&&(h=Math.max(h,this.minAutoLevel)),this.levelController.startLevel=h}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(h){var c=!!h;c!==this.config.capLevelToPlayerSize&&(c?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=c)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(h){this._autoLevelCapping!==h&&(C.logger.log("set autoLevelCapping:"+h),this._autoLevelCapping=h)}},{key:"bandwidthEstimate",get:function(){var h=this.abrController.bwEstimator;return h?h.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var h=this.levels,c=this.config.minAutoBitrate;if(!h)return 0;for(var l=h.length,a=0;a<l;a++)if(h[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var h=this.levels,c=this.autoLevelCapping,l;return c===-1&&h&&h.length?l=h.length-1:l=c,l}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(h){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,h)}},{key:"audioTracks",get:function(){var h=this.audioTrackController;return h?h.audioTracks:[]}},{key:"audioTrack",get:function(){var h=this.audioTrackController;return h?h.audioTrack:-1},set:function(h){var c=this.audioTrackController;c&&(c.audioTrack=h)}},{key:"subtitleTracks",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTrack:-1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleTrack=h)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var h=this.subtitleTrackController;return h?h.subtitleDisplay:!1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=h)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(h){this.config.lowLatencyMode=h}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return u.ErrorTypes}},{key:"ErrorDetails",get:function(){return u.ErrorDetails}},{key:"DefaultConfig",get:function(){return f.defaultConfig?f.defaultConfig:x.hlsDefaultConfig},set:function(h){f.defaultConfig=h}}]),f}();g.defaultConfig=void 0},"./src/is-supported.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"isSupported",function(){return R}),A.d(V,"changeTypeSupported",function(){return B});var G=A("./src/utils/mediasource-helper.ts");function I(){return self.SourceBuffer||self.WebKitSourceBuffer}function R(){var U=Object(G.getMediaSource)();if(!U)return!1;var k=I(),L=U&&typeof U.isTypeSupported=="function"&&U.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),b=!k||k.prototype&&typeof k.prototype.appendBuffer=="function"&&typeof k.prototype.remove=="function";return!!L&&!!b}function B(){var U,k=I();return typeof(k==null||((U=k.prototype)===null||U===void 0)?void 0:U.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return C}),A.d(V,"LoadError",function(){return v});var G=A("./src/polyfills/number.ts"),I=A("./src/errors.ts");function R(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,b(d,o)}function B(d){var o=typeof Map=="function"?new Map:void 0;return B=function(s){if(s===null||!L(s))return s;if(typeof s!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(s))return o.get(s);o.set(s,w)}function w(){return U(s,arguments,S(this).constructor)}return w.prototype=Object.create(s.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),b(w,s)},B(d)}function U(d,o,u){return k()?U=Reflect.construct:U=function(w,g,f){var _=[null];_.push.apply(_,g);var p=Function.bind.apply(w,_),h=new p;return f&&b(h,f.prototype),h},U.apply(null,arguments)}function k(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function L(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function b(d,o){return b=Object.setPrototypeOf||function(s,w){return s.__proto__=w,s},b(d,o)}function S(d){return S=Object.setPrototypeOf?Object.getPrototypeOf:function(u){return u.__proto__||Object.getPrototypeOf(u)},S(d)}var O=Math.pow(2,17),C=function(){function d(u){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=u}var o=d.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(s,w){var g=this,f=s.url;if(!f)return Promise.reject(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,networkDetails:null},"Fragment does not have a "+(f?"part list":"url")));this.abort();var _=this.config,p=_.fLoader,h=_.loader;return new Promise(function(c,l){g.loader&&g.loader.destroy();var a=g.loader=s.loader=p?new p(_):new h(_),y=x(s),m={timeout:_.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:_.fragLoadingMaxRetryTimeout,highWaterMark:O};s.stats=a.stats,a.load(y,m,{onSuccess:function(M,F,j,W){g.resetLoader(s,a),c({frag:s,part:null,payload:M.data,networkDetails:W})},onError:function(M,F,j){g.resetLoader(s,a),l(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,response:M,networkDetails:j}))},onAbort:function(M,F,j){g.resetLoader(s,a),l(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,networkDetails:j}))},onTimeout:function(M,F,j){g.resetLoader(s,a),l(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,networkDetails:j}))},onProgress:function(M,F,j,W){w&&w({frag:s,part:null,payload:j,networkDetails:W})}})})},o.loadPart=function(s,w,g){var f=this;this.abort();var _=this.config,p=_.fLoader,h=_.loader;return new Promise(function(c,l){f.loader&&f.loader.destroy();var a=f.loader=s.loader=p?new p(_):new h(_),y=x(s,w),m={timeout:_.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:_.fragLoadingMaxRetryTimeout,highWaterMark:O};w.stats=a.stats,a.load(y,m,{onSuccess:function(M,F,j,W){f.resetLoader(s,a),f.updateStatsFromPart(s,w);var D={frag:s,part:w,payload:M.data,networkDetails:W};g(D),c(D)},onError:function(M,F,j){f.resetLoader(s,a),l(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,part:w,response:M,networkDetails:j}))},onAbort:function(M,F,j){s.stats.aborted=w.stats.aborted,f.resetLoader(s,a),l(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,part:w,networkDetails:j}))},onTimeout:function(M,F,j){f.resetLoader(s,a),l(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,part:w,networkDetails:j}))}})})},o.updateStatsFromPart=function(s,w){var g=s.stats,f=w.stats,_=f.total;if(g.loaded+=f.loaded,_){var p=Math.round(s.duration/w.duration),h=Math.min(Math.round(g.loaded/_),p),c=p-h,l=c*Math.round(g.loaded/h);g.total=g.loaded+l}else g.total=Math.max(g.loaded,g.total);var a=g.loading,y=f.loading;a.start?a.first+=y.first-y.start:(a.start=y.start,a.first=y.first),a.end=y.end},o.resetLoader=function(s,w){s.loader=null,this.loader===w&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),w.destroy()},d}();function x(d,o){o===void 0&&(o=null);var u=o||d,s={frag:d,part:o,responseType:"arraybuffer",url:u.url,headers:{},rangeStart:0,rangeEnd:0},w=u.byteRangeStartOffset,g=u.byteRangeEndOffset;return Object(G.isFiniteNumber)(w)&&Object(G.isFiniteNumber)(g)&&(s.rangeStart=w,s.rangeEnd=g),s}var v=function(d){R(o,d);function o(u){for(var s,w=arguments.length,g=new Array(w>1?w-1:0),f=1;f<w;f++)g[f-1]=arguments[f];return s=d.call.apply(d,[this].concat(g))||this,s.data=void 0,s.data=u,s}return o}(B(Error))},"./src/loader/fragment.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"ElementaryStreamTypes",function(){return C}),A.d(V,"BaseSegment",function(){return x}),A.d(V,"Fragment",function(){return v}),A.d(V,"Part",function(){return d});var G=A("./src/polyfills/number.ts"),I=A("./node_modules/url-toolkit/src/url-toolkit.js"),R=A.n(I),B=A("./src/utils/logger.ts"),U=A("./src/loader/level-key.ts"),k=A("./src/loader/load-stats.ts");function L(o,u){o.prototype=Object.create(u.prototype),o.prototype.constructor=o,b(o,u)}function b(o,u){return b=Object.setPrototypeOf||function(w,g){return w.__proto__=g,w},b(o,u)}function S(o,u){for(var s=0;s<u.length;s++){var w=u[s];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function O(o,u,s){return u&&S(o.prototype,u),s&&S(o,s),o}var C;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(C||(C={}));var x=function(){function o(s){var w;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(w={},w[C.AUDIO]=null,w[C.VIDEO]=null,w[C.AUDIOVIDEO]=null,w),this.baseurl=s}var u=o.prototype;return u.setByteRange=function(w,g){var f=w.split("@",2),_=[];f.length===1?_[0]=g?g.byteRangeEndOffset:0:_[0]=parseInt(f[1]),_[1]=parseInt(f[0])+_[0],this._byteRange=_},O(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(I.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(w){this._url=w}}]),o}(),v=function(o){L(u,o);function u(w,g){var f;return f=o.call(this,g)||this,f._decryptdata=null,f.rawProgramDateTime=null,f.programDateTime=null,f.tagList=[],f.duration=0,f.sn=0,f.levelkey=void 0,f.type=void 0,f.loader=null,f.level=-1,f.cc=0,f.startPTS=void 0,f.endPTS=void 0,f.appendedPTS=void 0,f.startDTS=void 0,f.endDTS=void 0,f.start=0,f.deltaPTS=void 0,f.maxStartPTS=void 0,f.minEndPTS=void 0,f.stats=new k.LoadStats,f.urlId=0,f.data=void 0,f.bitrateTest=!1,f.title=null,f.initSegment=null,f.type=w,f}var s=u.prototype;return s.createInitializationVector=function(g){for(var f=new Uint8Array(16),_=12;_<16;_++)f[_]=g>>8*(15-_)&255;return f},s.setDecryptDataFromLevelKey=function(g,f){var _=g;return(g==null?void 0:g.method)==="AES-128"&&g.uri&&!g.iv&&(_=U.LevelKey.fromURI(g.uri),_.method=g.method,_.iv=this.createInitializationVector(f),_.keyFormat="identity"),_},s.setElementaryStreamInfo=function(g,f,_,p,h,c){c===void 0&&(c=!1);var l=this.elementaryStreams,a=l[g];if(!a){l[g]={startPTS:f,endPTS:_,startDTS:p,endDTS:h,partial:c};return}a.startPTS=Math.min(a.startPTS,f),a.endPTS=Math.max(a.endPTS,_),a.startDTS=Math.min(a.startDTS,p),a.endDTS=Math.max(a.endDTS,h)},s.clearElementaryStreamInfo=function(){var g=this.elementaryStreams;g[C.AUDIO]=null,g[C.VIDEO]=null,g[C.AUDIOVIDEO]=null},O(u,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var g=this.sn;typeof g!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&B.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),g=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,g)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(G.isFiniteNumber)(this.programDateTime))return null;var g=Object(G.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+g*1e3}},{key:"encrypted",get:function(){var g;return!!((g=this.decryptdata)!==null&&g!==void 0&&g.keyFormat&&this.decryptdata.uri)}}]),u}(x),d=function(o){L(u,o);function u(s,w,g,f,_){var p;p=o.call(this,g)||this,p.fragOffset=0,p.duration=0,p.gap=!1,p.independent=!1,p.relurl=void 0,p.fragment=void 0,p.index=void 0,p.stats=new k.LoadStats,p.duration=s.decimalFloatingPoint("DURATION"),p.gap=s.bool("GAP"),p.independent=s.bool("INDEPENDENT"),p.relurl=s.enumeratedString("URI"),p.fragment=w,p.index=f;var h=s.enumeratedString("BYTERANGE");return h&&p.setByteRange(h,_),_&&(p.fragOffset=_.fragOffset+_.duration),p}return O(u,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var w=this.elementaryStreams;return!!(w.audio||w.video||w.audiovideo)}}]),u}(x)},"./src/loader/key-loader.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return B});var G=A("./src/events.ts"),I=A("./src/errors.ts"),R=A("./src/utils/logger.ts"),B=function(){function U(L){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=L,this._registerListeners()}var k=U.prototype;return k._registerListeners=function(){this.hls.on(G.Events.KEY_LOADING,this.onKeyLoading,this)},k._unregisterListeners=function(){this.hls.off(G.Events.KEY_LOADING,this.onKeyLoading)},k.destroy=function(){this._unregisterListeners();for(var b in this.loaders){var S=this.loaders[b];S&&S.destroy()}this.loaders={}},k.onKeyLoading=function(b,S){var O=S.frag,C=O.type,x=this.loaders[C];if(!O.decryptdata){R.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var v=O.decryptdata.uri;if(v!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(x&&(R.logger.warn("abort previous key loader for type:"+C),x.abort()),!v){R.logger.warn("key uri is falsy");return}var o=d.loader,u=O.loader=this.loaders[C]=new o(d);this.decrypturl=v,this.decryptkey=null;var s={url:v,frag:O,responseType:"arraybuffer"},w={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(s,w,g)}else this.decryptkey&&(O.decryptdata.key=this.decryptkey,this.hls.trigger(G.Events.KEY_LOADED,{frag:O}))},k.loadsuccess=function(b,S,O){var C=O.frag;if(!C.decryptdata){R.logger.error("after key load, decryptdata unset");return}this.decryptkey=C.decryptdata.key=new Uint8Array(b.data),C.loader=null,delete this.loaders[C.type],this.hls.trigger(G.Events.KEY_LOADED,{frag:C})},k.loaderror=function(b,S){var O=S.frag,C=O.loader;C&&C.abort(),delete this.loaders[O.type],this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:O,response:b})},k.loadtimeout=function(b,S){var O=S.frag,C=O.loader;C&&C.abort(),delete this.loaders[O.type],this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:O})},U}()},"./src/loader/level-details.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"LevelDetails",function(){return U});var G=A("./src/polyfills/number.ts");function I(k,L){for(var b=0;b<L.length;b++){var S=L[b];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(k,S.key,S)}}function R(k,L,b){return L&&I(k.prototype,L),b&&I(k,b),k}var B=10,U=function(){function k(b){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=b}var L=k.prototype;return L.reloaded=function(S){if(!S){this.advanced=!0,this.updated=!0;return}var O=this.lastPartSn-S.lastPartSn,C=this.lastPartIndex-S.lastPartIndex;this.updated=this.endSN!==S.endSN||!!C||!!O,this.advanced=this.endSN>S.endSN||O>0||O===0&&C>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(G.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||B}},{key:"drift",get:function(){var S=this.driftEndTime-this.driftStartTime;if(S>0){var O=this.driftEnd-this.driftStart;return O*1e3/S}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var S;return(S=this.fragments)!==null&&S!==void 0&&S.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),k}()},"./src/loader/level-key.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"LevelKey",function(){return U});var G=A("./node_modules/url-toolkit/src/url-toolkit.js"),I=A.n(G);function R(k,L){for(var b=0;b<L.length;b++){var S=L[b];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(k,S.key,S)}}function B(k,L,b){return L&&R(k.prototype,L),b&&R(k,b),k}var U=function(){k.fromURL=function(b,S){return new k(b,S)},k.fromURI=function(b){return new k(b)};function k(L,b){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,b?this._uri=Object(G.buildAbsoluteURL)(L,b,{alwaysNormalize:!0}):this._uri=L}return B(k,[{key:"uri",get:function(){return this._uri}}]),k}()},"./src/loader/load-stats.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"LoadStats",function(){return G});var G=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return u});var G=A("./src/polyfills/number.ts"),I=A("./node_modules/url-toolkit/src/url-toolkit.js"),R=A.n(I),B=A("./src/loader/fragment.ts"),U=A("./src/loader/level-details.ts"),k=A("./src/loader/level-key.ts"),L=A("./src/utils/attr-list.ts"),b=A("./src/utils/logger.ts"),S=A("./src/utils/codecs.ts"),O=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,C=/#EXT-X-MEDIA:(.*)/g,x=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),v=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),d=/\.(mp4|m4s|m4v|m4a)$/i;function o(_){var p,h;return d.test((p=(h=I.parseURL(_))===null||h===void 0?void 0:h.path)!=null?p:"")}var u=function(){function _(){}return _.findGroup=function(h,c){for(var l=0;l<h.length;l++){var a=h[l];if(a.id===c)return a}},_.convertAVC1ToAVCOTI=function(h){var c=h.split(".");if(c.length>2){var l=c.shift()+".";return l+=parseInt(c.shift()).toString(16),l+=("000"+parseInt(c.shift()).toString(16)).substr(-4),l}return h},_.resolve=function(h,c){return I.buildAbsoluteURL(c,h,{alwaysNormalize:!0})},_.parseMasterPlaylist=function(h,c){var l=[],a={},y=!1;O.lastIndex=0;for(var m;(m=O.exec(h))!=null;)if(m[1]){var E=new L.AttrList(m[1]),M={attrs:E,bitrate:E.decimalInteger("AVERAGE-BANDWIDTH")||E.decimalInteger("BANDWIDTH"),name:E.NAME,url:_.resolve(m[2],c)},F=E.decimalResolution("RESOLUTION");F&&(M.width=F.width,M.height=F.height),s((E.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=_.convertAVC1ToAVCOTI(M.videoCodec)),l.push(M)}else if(m[3]){var j=new L.AttrList(m[3]);j["DATA-ID"]&&(y=!0,a[j["DATA-ID"]]=j)}return{levels:l,sessionData:y?a:null}},_.parseMasterPlaylistMedia=function(h,c,l,a){a===void 0&&(a=[]);var y,m=[],E=0;for(C.lastIndex=0;(y=C.exec(h))!==null;){var M=new L.AttrList(y[1]);if(M.TYPE===l){var F={attrs:M,bitrate:0,id:E++,groupId:M["GROUP-ID"],instreamId:M["INSTREAM-ID"],name:M.NAME||M.LANGUAGE||"",type:l,default:M.bool("DEFAULT"),autoselect:M.bool("AUTOSELECT"),forced:M.bool("FORCED"),lang:M.LANGUAGE,url:M.URI?_.resolve(M.URI,c):""};if(a.length){var j=_.findGroup(a,F.groupId)||a[0];w(F,j,"audioCodec"),w(F,j,"textCodec")}m.push(F)}}return m},_.parseLevelPlaylist=function(h,c,l,a,y){var m=new U.LevelDetails(c),E=m.fragments,M=null,F=0,j=0,W=0,D=0,P=null,H=new B.Fragment(a,c),Y,ee,oe,xe=-1,ve=!1;for(x.lastIndex=0,m.m3u8=h;(Y=x.exec(h))!==null;){ve&&(ve=!1,H=new B.Fragment(a,c),H.start=W,H.sn=F,H.cc=D,H.level=l,M&&(H.initSegment=M,H.rawProgramDateTime=M.rawProgramDateTime));var he=Y[1];if(he){H.duration=parseFloat(he);var fe=(" "+Y[2]).slice(1);H.title=fe||null,H.tagList.push(fe?["INF",he,fe]:["INF",he])}else if(Y[3])Object(G.isFiniteNumber)(H.duration)&&(H.start=W,oe&&(H.levelkey=oe),H.sn=F,H.level=l,H.cc=D,H.urlId=y,E.push(H),H.relurl=(" "+Y[3]).slice(1),f(H,P),P=H,W+=H.duration,F++,j=0,ve=!0);else if(Y[4]){var me=(" "+Y[4]).slice(1);P?H.setByteRange(me,P):H.setByteRange(me)}else if(Y[5])H.rawProgramDateTime=(" "+Y[5]).slice(1),H.tagList.push(["PROGRAM-DATE-TIME",H.rawProgramDateTime]),xe===-1&&(xe=E.length);else{if(Y=Y[0].match(v),!Y){b.logger.warn("No matches on slow regex match for level playlist!");continue}for(ee=1;ee<Y.length&&!(typeof Y[ee]!="undefined");ee++);var ae=(" "+Y[ee]).slice(1),pe=(" "+Y[ee+1]).slice(1),$=Y[ee+2]?(" "+Y[ee+2]).slice(1):"";switch(ae){case"PLAYLIST-TYPE":m.type=pe.toUpperCase();break;case"MEDIA-SEQUENCE":F=m.startSN=parseInt(pe);break;case"SKIP":{var ne=new L.AttrList(pe),Q=ne.decimalInteger("SKIPPED-SEGMENTS");if(Object(G.isFiniteNumber)(Q)){m.skippedSegments=Q;for(var Ee=Q;Ee--;)E.unshift(null);F+=Q}var we=ne.enumeratedString("RECENTLY-REMOVED-DATERANGES");we&&(m.recentlyRemovedDateranges=we.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(pe);break;case"VERSION":m.version=parseInt(pe);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(pe||$)&&H.tagList.push($?[pe,$]:[pe]);break;case"DIS":D++;case"GAP":H.tagList.push([ae]);break;case"BITRATE":H.tagList.push([ae,pe]);break;case"DISCONTINUITY-SEQ":D=parseInt(pe);break;case"KEY":{var ye,Se=new L.AttrList(pe),Le=Se.enumeratedString("METHOD"),Oe=Se.URI,ke=Se.hexadecimalInteger("IV"),De=Se.enumeratedString("KEYFORMATVERSIONS"),Pe=Se.enumeratedString("KEYID"),ze=(ye=Se.enumeratedString("KEYFORMAT"))!=null?ye:"identity",$e=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if($e.indexOf(ze)>-1){b.logger.warn("Keyformat "+ze+" is not supported from the manifest");continue}else if(ze!=="identity")continue;Le&&(oe=k.LevelKey.fromURL(c,Oe),Oe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Le)>=0&&(oe.method=Le,oe.keyFormat=ze,Pe&&(oe.keyID=Pe),De&&(oe.keyFormatVersions=De),oe.iv=ke));break}case"START":{var We=new L.AttrList(pe),He=We.decimalFloatingPoint("TIME-OFFSET");Object(G.isFiniteNumber)(He)&&(m.startTimeOffset=He);break}case"MAP":{var rt=new L.AttrList(pe);H.relurl=rt.URI,rt.BYTERANGE&&H.setByteRange(rt.BYTERANGE),H.level=l,H.sn="initSegment",oe&&(H.levelkey=oe),H.initSegment=null,M=H,ve=!0;break}case"SERVER-CONTROL":{var Je=new L.AttrList(pe);m.canBlockReload=Je.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=Je.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&Je.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=Je.optionalFloat("PART-HOLD-BACK",0),m.holdBack=Je.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Qe=new L.AttrList(pe);m.partTarget=Qe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ae=m.partList;Ae||(Ae=m.partList=[]);var et=j>0?Ae[Ae.length-1]:void 0,Ze=j++,Re=new B.Part(new L.AttrList(pe),H,c,Ze,et);Ae.push(Re),H.duration+=Re.duration;break}case"PRELOAD-HINT":{var Fe=new L.AttrList(pe);m.preloadHint=Fe;break}case"RENDITION-REPORT":{var ge=new L.AttrList(pe);m.renditionReports=m.renditionReports||[],m.renditionReports.push(ge);break}default:b.logger.warn("line parsed but not handled: "+Y);break}}}P&&!P.relurl?(E.pop(),W-=P.duration,m.partList&&(m.fragmentHint=P)):m.partList&&(f(H,P),H.cc=D,m.fragmentHint=H);var ue=E.length,de=E[0],J=E[ue-1];if(W+=m.skippedSegments*m.targetduration,W>0&&ue&&J){m.averagetargetduration=W/ue;var Z=J.sn;m.endSN=Z!=="initSegment"?Z:0,de&&(m.startCC=de.cc,de.initSegment||m.fragments.every(function(te){return te.relurl&&o(te.relurl)})&&(b.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),H=new B.Fragment(a,c),H.relurl=J.relurl,H.level=l,H.sn="initSegment",de.initSegment=H,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(W+=m.fragmentHint.duration),m.totalduration=W,m.endCC=D,xe>0&&g(E,xe),m},_}();function s(_,p){["video","audio","text"].forEach(function(h){var c=_.filter(function(a){return Object(S.isCodecType)(a,h)});if(c.length){var l=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});p[h+"Codec"]=l.length>0?l[0]:c[0],_=_.filter(function(a){return c.indexOf(a)===-1})}}),p.unknownCodecs=_}function w(_,p,h){var c=p[h];c&&(_[h]=c)}function g(_,p){for(var h=_[p],c=p;c--;){var l=_[c];if(!l)return;l.programDateTime=h.programDateTime-l.duration*1e3,h=l}}function f(_,p){_.rawProgramDateTime?_.programDateTime=Date.parse(_.rawProgramDateTime):p!=null&&p.programDateTime&&(_.programDateTime=p.endProgramDateTime),Object(G.isFiniteNumber)(_.programDateTime)||(_.programDateTime=null,_.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/polyfills/number.ts"),I=A("./src/events.ts"),R=A("./src/errors.ts"),B=A("./src/utils/logger.ts"),U=A("./src/utils/mp4-tools.ts"),k=A("./src/loader/m3u8-parser.ts"),L=A("./src/types/loader.ts"),b=A("./src/utils/attr-list.ts");function S(x){var v=x.type;switch(v){case L.PlaylistContextType.AUDIO_TRACK:return L.PlaylistLevelType.AUDIO;case L.PlaylistContextType.SUBTITLE_TRACK:return L.PlaylistLevelType.SUBTITLE;default:return L.PlaylistLevelType.MAIN}}function O(x,v){var d=x.url;return(d===void 0||d.indexOf("data:")===0)&&(d=v.url),d}var C=function(){function x(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var v=x.prototype;return v.registerListeners=function(){var o=this.hls;o.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},v.unregisterListeners=function(){var o=this.hls;o.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(I.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},v.createInternalLoader=function(o){var u=this.hls.config,s=u.pLoader,w=u.loader,g=s||w,f=new g(u);return o.loader=f,this.loaders[o.type]=f,f},v.getInternalLoader=function(o){return this.loaders[o.type]},v.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},v.destroyInternalLoaders=function(){for(var o in this.loaders){var u=this.loaders[o];u&&u.destroy(),this.resetInternalLoader(o)}},v.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},v.onManifestLoading=function(o,u){var s=u.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:L.PlaylistContextType.MANIFEST,url:s,deliveryDirectives:null})},v.onLevelLoading=function(o,u){var s=u.id,w=u.level,g=u.url,f=u.deliveryDirectives;this.load({id:s,groupId:null,level:w,responseType:"text",type:L.PlaylistContextType.LEVEL,url:g,deliveryDirectives:f})},v.onAudioTrackLoading=function(o,u){var s=u.id,w=u.groupId,g=u.url,f=u.deliveryDirectives;this.load({id:s,groupId:w,level:null,responseType:"text",type:L.PlaylistContextType.AUDIO_TRACK,url:g,deliveryDirectives:f})},v.onSubtitleTrackLoading=function(o,u){var s=u.id,w=u.groupId,g=u.url,f=u.deliveryDirectives;this.load({id:s,groupId:w,level:null,responseType:"text",type:L.PlaylistContextType.SUBTITLE_TRACK,url:g,deliveryDirectives:f})},v.load=function(o){var u,s=this.hls.config,w=this.getInternalLoader(o);if(w){var g=w.context;if(g&&g.url===o.url){B.logger.trace("[playlist-loader]: playlist request ongoing");return}B.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),w.abort()}var f,_,p,h;switch(o.type){case L.PlaylistContextType.MANIFEST:f=s.manifestLoadingMaxRetry,_=s.manifestLoadingTimeOut,p=s.manifestLoadingRetryDelay,h=s.manifestLoadingMaxRetryTimeout;break;case L.PlaylistContextType.LEVEL:case L.PlaylistContextType.AUDIO_TRACK:case L.PlaylistContextType.SUBTITLE_TRACK:f=0,_=s.levelLoadingTimeOut;break;default:f=s.levelLoadingMaxRetry,_=s.levelLoadingTimeOut,p=s.levelLoadingRetryDelay,h=s.levelLoadingMaxRetryTimeout;break}if(w=this.createInternalLoader(o),(u=o.deliveryDirectives)!==null&&u!==void 0&&u.part){var c;if(o.type===L.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===L.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===L.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var l=c.partTarget,a=c.targetduration;l&&a&&(_=Math.min(Math.max(l*3,a*.8)*1e3,_))}}var y={timeout:_,maxRetry:f,retryDelay:p,maxRetryDelay:h,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};w.load(o,y,m)},v.loadsuccess=function(o,u,s,w){if(w===void 0&&(w=null),s.isSidxRequest){this.handleSidxRequest(o,s),this.handlePlaylistLoaded(o,u,s,w);return}this.resetInternalLoader(s.type);var g=o.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,s,"no EXTM3U delimiter",w);return}u.parsing.start=performance.now(),g.indexOf("#EXTINF:")>0||g.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,u,s,w):this.handleMasterPlaylist(o,u,s,w)},v.loaderror=function(o,u,s){s===void 0&&(s=null),this.handleNetworkError(u,s,!1,o)},v.loadtimeout=function(o,u,s){s===void 0&&(s=null),this.handleNetworkError(u,s,!0)},v.handleMasterPlaylist=function(o,u,s,w){var g=this.hls,f=o.data,_=O(o,s),p=k.default.parseMasterPlaylist(f,_),h=p.levels,c=p.sessionData;if(!h.length){this.handleManifestParsingError(o,s,"no level found in manifest",w);return}var l=h.map(function(F){return{id:F.attrs.AUDIO,audioCodec:F.audioCodec}}),a=h.map(function(F){return{id:F.attrs.SUBTITLES,textCodec:F.textCodec}}),y=k.default.parseMasterPlaylistMedia(f,_,"AUDIO",l),m=k.default.parseMasterPlaylistMedia(f,_,"SUBTITLES",a),E=k.default.parseMasterPlaylistMedia(f,_,"CLOSED-CAPTIONS");if(y.length){var M=y.some(function(F){return!F.url});!M&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(B.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),y.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new b.AttrList({}),bitrate:0,url:""}))}g.trigger(I.Events.MANIFEST_LOADED,{levels:h,audioTracks:y,subtitles:m,captions:E,url:_,stats:u,networkDetails:w,sessionData:c})},v.handleTrackOrLevelPlaylist=function(o,u,s,w){var g=this.hls,f=s.id,_=s.level,p=s.type,h=O(o,s),c=Object(G.isFiniteNumber)(f)?f:0,l=Object(G.isFiniteNumber)(_)?_:c,a=S(s),y=k.default.parseLevelPlaylist(o.data,h,l,a,c);if(!y.fragments.length){g.trigger(I.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:h,reason:"no fragments found in level",level:typeof s.level=="number"?s.level:void 0});return}if(p===L.PlaylistContextType.MANIFEST){var m={attrs:new b.AttrList({}),bitrate:0,details:y,name:"",url:h};g.trigger(I.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:h,stats:u,networkDetails:w,sessionData:null})}if(u.parsing.end=performance.now(),y.needSidxRanges){var E,M=(E=y.fragments[0].initSegment)===null||E===void 0?void 0:E.url;this.load({url:M,isSidxRequest:!0,type:p,level:_,levelDetails:y,id:f,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}s.levelDetails=y,this.handlePlaylistLoaded(o,u,s,w)},v.handleSidxRequest=function(o,u){var s=Object(U.parseSegmentIndex)(new Uint8Array(o.data));if(!s)return;var w=s.references,g=u.levelDetails;w.forEach(function(f,_){var p=f.info,h=g.fragments[_];h.byteRange.length===0&&h.setByteRange(String(1+p.end-p.start)+"@"+String(p.start)),h.initSegment&&h.initSegment.setByteRange(String(s.moovEndOffset)+"@0")})},v.handleManifestParsingError=function(o,u,s,w){this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:u.type===L.PlaylistContextType.MANIFEST,url:o.url,reason:s,response:o,context:u,networkDetails:w})},v.handleNetworkError=function(o,u,s,w){s===void 0&&(s=!1),B.logger.warn("[playlist-loader]: A network "+(s?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var g=R.ErrorDetails.UNKNOWN,f=!1,_=this.getInternalLoader(o);switch(o.type){case L.PlaylistContextType.MANIFEST:g=s?R.ErrorDetails.MANIFEST_LOAD_TIMEOUT:R.ErrorDetails.MANIFEST_LOAD_ERROR,f=!0;break;case L.PlaylistContextType.LEVEL:g=s?R.ErrorDetails.LEVEL_LOAD_TIMEOUT:R.ErrorDetails.LEVEL_LOAD_ERROR,f=!1;break;case L.PlaylistContextType.AUDIO_TRACK:g=s?R.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:R.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,f=!1;break;case L.PlaylistContextType.SUBTITLE_TRACK:g=s?R.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:R.ErrorDetails.SUBTITLE_LOAD_ERROR,f=!1;break}_&&this.resetInternalLoader(o.type);var p={type:R.ErrorTypes.NETWORK_ERROR,details:g,fatal:f,url:o.url,loader:_,context:o,networkDetails:u};w&&(p.response=w),this.hls.trigger(I.Events.ERROR,p)},v.handlePlaylistLoaded=function(o,u,s,w){var g=s.type,f=s.level,_=s.id,p=s.groupId,h=s.loader,c=s.levelDetails,l=s.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,s,"invalid target duration",w);return}if(!h)return;c.live&&(h.getCacheAge&&(c.ageHeader=h.getCacheAge()||0),(!h.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(g){case L.PlaylistContextType.MANIFEST:case L.PlaylistContextType.LEVEL:this.hls.trigger(I.Events.LEVEL_LOADED,{details:c,level:f||0,id:_||0,stats:u,networkDetails:w,deliveryDirectives:l});break;case L.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(I.Events.AUDIO_TRACK_LOADED,{details:c,id:_||0,groupId:p||"",stats:u,networkDetails:w,deliveryDirectives:l});break;case L.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADED,{details:c,id:_||0,groupId:p||"",stats:u,networkDetails:w,deliveryDirectives:l});break}},x}();V.default=C},"./src/polyfills/number.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"isFiniteNumber",function(){return G}),A.d(V,"MAX_SAFE_INTEGER",function(){return I});var G=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},I=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(re,V,A){"use strict";A.r(V);var G=function(){function I(){}return I.getSilentFrame=function(B,U){switch(B){case"mp4a.40.2":if(U===1)return new Uint8Array([0,200,0,128,35,128]);if(U===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(U===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(U===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(U===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(U===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(U===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(U===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(U===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},I}();V.default=G},"./src/remux/mp4-generator.ts":function(re,V,A){"use strict";A.r(V);var G=Math.pow(2,32)-1,I=function(){function R(){}return R.init=function(){R.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var U;for(U in R.types)R.types.hasOwnProperty(U)&&(R.types[U]=[U.charCodeAt(0),U.charCodeAt(1),U.charCodeAt(2),U.charCodeAt(3)]);var k=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),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 b=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),S=new Uint8Array([0,0,0,0,0,0,0,0]);R.STTS=R.STSC=R.STCO=S,R.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),R.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),R.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),R.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var O=new Uint8Array([105,115,111,109]),C=new Uint8Array([97,118,99,49]),x=new Uint8Array([0,0,0,1]);R.FTYP=R.box(R.types.ftyp,O,x,O,C),R.DINF=R.box(R.types.dinf,R.box(R.types.dref,b))},R.box=function(U){for(var k=8,L=arguments.length,b=new Array(L>1?L-1:0),S=1;S<L;S++)b[S-1]=arguments[S];for(var O=b.length,C=O;O--;)k+=b[O].byteLength;var x=new Uint8Array(k);for(x[0]=k>>24&255,x[1]=k>>16&255,x[2]=k>>8&255,x[3]=k&255,x.set(U,4),O=0,k=8;O<C;O++)x.set(b[O],k),k+=b[O].byteLength;return x},R.hdlr=function(U){return R.box(R.types.hdlr,R.HDLR_TYPES[U])},R.mdat=function(U){return R.box(R.types.mdat,U)},R.mdhd=function(U,k){k*=U;var L=Math.floor(k/(G+1)),b=Math.floor(k%(G+1));return R.box(R.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,L>>24,L>>16&255,L>>8&255,L&255,b>>24,b>>16&255,b>>8&255,b&255,85,196,0,0]))},R.mdia=function(U){return R.box(R.types.mdia,R.mdhd(U.timescale,U.duration),R.hdlr(U.type),R.minf(U))},R.mfhd=function(U){return R.box(R.types.mfhd,new Uint8Array([0,0,0,0,U>>24,U>>16&255,U>>8&255,U&255]))},R.minf=function(U){return U.type==="audio"?R.box(R.types.minf,R.box(R.types.smhd,R.SMHD),R.DINF,R.stbl(U)):R.box(R.types.minf,R.box(R.types.vmhd,R.VMHD),R.DINF,R.stbl(U))},R.moof=function(U,k,L){return R.box(R.types.moof,R.mfhd(U),R.traf(L,k))},R.moov=function(U){for(var k=U.length,L=[];k--;)L[k]=R.trak(U[k]);return R.box.apply(null,[R.types.moov,R.mvhd(U[0].timescale,U[0].duration)].concat(L).concat(R.mvex(U)))},R.mvex=function(U){for(var k=U.length,L=[];k--;)L[k]=R.trex(U[k]);return R.box.apply(null,[R.types.mvex].concat(L))},R.mvhd=function(U,k){k*=U;var L=Math.floor(k/(G+1)),b=Math.floor(k%(G+1)),S=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,L>>24,L>>16&255,L>>8&255,L&255,b>>24,b>>16&255,b>>8&255,b&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return R.box(R.types.mvhd,S)},R.sdtp=function(U){var k=U.samples||[],L=new Uint8Array(4+k.length),b,S;for(b=0;b<k.length;b++)S=k[b].flags,L[b+4]=S.dependsOn<<4|S.isDependedOn<<2|S.hasRedundancy;return R.box(R.types.sdtp,L)},R.stbl=function(U){return R.box(R.types.stbl,R.stsd(U),R.box(R.types.stts,R.STTS),R.box(R.types.stsc,R.STSC),R.box(R.types.stsz,R.STSZ),R.box(R.types.stco,R.STCO))},R.avc1=function(U){var k=[],L=[],b,S,O;for(b=0;b<U.sps.length;b++)S=U.sps[b],O=S.byteLength,k.push(O>>>8&255),k.push(O&255),k=k.concat(Array.prototype.slice.call(S));for(b=0;b<U.pps.length;b++)S=U.pps[b],O=S.byteLength,L.push(O>>>8&255),L.push(O&255),L=L.concat(Array.prototype.slice.call(S));var C=R.box(R.types.avcC,new Uint8Array([1,k[3],k[4],k[5],252|3,224|U.sps.length].concat(k).concat([U.pps.length]).concat(L))),x=U.width,v=U.height,d=U.pixelRatio[0],o=U.pixelRatio[1];return R.box(R.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,x>>8&255,x&255,v>>8&255,v&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),C,R.box(R.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),R.box(R.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,o>>24,o>>16&255,o>>8&255,o&255])))},R.esds=function(U){var k=U.config.length;return new Uint8Array([0,0,0,0,3,23+k,0,1,0,4,15+k,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([k]).concat(U.config).concat([6,1,2]))},R.mp4a=function(U){var k=U.samplerate;return R.box(R.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]),R.box(R.types.esds,R.esds(U)))},R.mp3=function(U){var k=U.samplerate;return R.box(R.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]))},R.stsd=function(U){return U.type==="audio"?!U.isAAC&&U.codec==="mp3"?R.box(R.types.stsd,R.STSD,R.mp3(U)):R.box(R.types.stsd,R.STSD,R.mp4a(U)):R.box(R.types.stsd,R.STSD,R.avc1(U))},R.tkhd=function(U){var k=U.id,L=U.duration*U.timescale,b=U.width,S=U.height,O=Math.floor(L/(G+1)),C=Math.floor(L%(G+1));return R.box(R.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,C>>24,C>>16&255,C>>8&255,C&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,b>>8&255,b&255,0,0,S>>8&255,S&255,0,0]))},R.traf=function(U,k){var L=R.sdtp(U),b=U.id,S=Math.floor(k/(G+1)),O=Math.floor(k%(G+1));return R.box(R.types.traf,R.box(R.types.tfhd,new Uint8Array([0,0,0,0,b>>24,b>>16&255,b>>8&255,b&255])),R.box(R.types.tfdt,new Uint8Array([1,0,0,0,S>>24,S>>16&255,S>>8&255,S&255,O>>24,O>>16&255,O>>8&255,O&255])),R.trun(U,L.length+16+20+8+16+8+8),L)},R.trak=function(U){return U.duration=U.duration||4294967295,R.box(R.types.trak,R.tkhd(U),R.mdia(U))},R.trex=function(U){var k=U.id;return R.box(R.types.trex,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},R.trun=function(U,k){var L=U.samples||[],b=L.length,S=12+16*b,O=new Uint8Array(S),C,x,v,d,o,u;for(k+=8+S,O.set([0,0,15,1,b>>>24&255,b>>>16&255,b>>>8&255,b&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255],0),C=0;C<b;C++)x=L[C],v=x.duration,d=x.size,o=x.flags,u=x.cts,O.set([v>>>24&255,v>>>16&255,v>>>8&255,v&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*C);return R.box(R.types.trun,O)},R.initSegment=function(U){R.types||R.init();var k=R.moov(U),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,V.default=I},"./src/remux/mp4-remuxer.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return u}),A.d(V,"normalizePts",function(){return s});var G=A("./src/polyfills/number.ts"),I=A("./src/remux/aac-helper.ts"),R=A("./src/remux/mp4-generator.ts"),B=A("./src/events.ts"),U=A("./src/errors.ts"),k=A("./src/utils/logger.ts"),L=A("./src/types/loader.ts"),b=A("./src/utils/timescale-conversion.ts");function S(){return S=Object.assign||function(_){for(var p=1;p<arguments.length;p++){var h=arguments[p];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(_[c]=h[c])}return _},S.apply(this,arguments)}var O=10*1e3,C=1024,x=1152,v=null,d=null,o=!1,u=function(){function _(h,c,l,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=h,this.config=c,this.typeSupported=l,this.ISGenerated=!1,v===null){var y=navigator.userAgent||"",m=y.match(/Chrome\/(\d+)/i);v=m?parseInt(m[1]):0}if(d===null){var E=navigator.userAgent.match(/Safari\/(\d+)/i);d=E?parseInt(E[1]):0}o=!!v&&v<75||!!d&&d<600}var p=_.prototype;return p.destroy=function(){},p.resetTimeStamp=function(c){k.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},p.resetNextTimestamp=function(){k.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},p.resetInitSegment=function(){k.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},p.getVideoStartPts=function(c){var l=!1,a=c.reduce(function(y,m){var E=m.pts-y;return E<-4294967296?(l=!0,s(y,m.pts)):E>0?y:m.pts},c[0].pts);return l&&k.logger.debug("PTS rollover detected"),a},p.remux=function(c,l,a,y,m,E,M,F){var j,W,D,P,H,Y,ee=m,oe=m,xe=c.pid>-1,ve=l.pid>-1,he=l.samples.length,fe=c.samples.length>0,me=he>1,ae=(!xe||fe)&&(!ve||me)||this.ISGenerated||M;if(ae){this.ISGenerated||(D=this.generateIS(c,l,m));var pe=this.isVideoContiguous,$=-1;if(me&&($=w(l.samples),!pe&&this.config.forceKeyFrameOnDiscontinuity))if(Y=!0,$>0){k.logger.warn("[mp4-remuxer]: Dropped "+$+" out of "+he+" video samples due to a missing keyframe");var ne=this.getVideoStartPts(l.samples);l.samples=l.samples.slice($),l.dropped+=$,oe+=(l.samples[0].pts-ne)/(l.timescale||9e4)}else $===-1&&(k.logger.warn("[mp4-remuxer]: No keyframe found out of "+he+" video samples"),Y=!1);if(this.ISGenerated){if(fe&&me){var Q=this.getVideoStartPts(l.samples),Ee=s(c.samples[0].pts,Q)-Q,we=Ee/l.inputTimeScale;ee+=Math.max(0,we),oe+=Math.max(0,-we)}if(fe){if(c.samplerate||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),D=this.generateIS(c,l,m)),W=this.remuxAudio(c,ee,this.isAudioContiguous,E,ve||me||F===L.PlaylistLevelType.AUDIO?oe:void 0),me){var ye=W?W.endPTS-W.startPTS:0;l.inputTimeScale||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),D=this.generateIS(c,l,m)),j=this.remuxVideo(l,oe,pe,ye)}}else me&&(j=this.remuxVideo(l,oe,pe,0));j&&(j.firstKeyFrame=$,j.independent=$!==-1)}}return this.ISGenerated&&(a.samples.length&&(H=this.remuxID3(a,m)),y.samples.length&&(P=this.remuxText(y,m))),{audio:W,video:j,initSegment:D,independent:Y,text:P,id3:H}},p.generateIS=function(c,l,a){var y=c.samples,m=l.samples,E=this.typeSupported,M={},F=!Object(G.isFiniteNumber)(this._initPTS),j="audio/mp4",W,D,P;if(F&&(W=D=Infinity),c.config&&y.length&&(c.timescale=c.samplerate,c.isAAC||(E.mpeg?(j="audio/mpeg",c.codec=""):E.mp3&&(c.codec="mp3")),M.audio={id:"audio",container:j,codec:c.codec,initSegment:!c.isAAC&&E.mpeg?new Uint8Array(0):R.default.initSegment([c]),metadata:{channelCount:c.channelCount}},F&&(P=c.inputTimeScale,W=D=y[0].pts-Math.round(P*a))),l.sps&&l.pps&&m.length&&(l.timescale=l.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:l.codec,initSegment:R.default.initSegment([l]),metadata:{width:l.width,height:l.height}},F)){P=l.inputTimeScale;var H=this.getVideoStartPts(m),Y=Math.round(P*a);D=Math.min(D,s(m[0].dts,H)-Y),W=Math.min(W,H-Y)}if(Object.keys(M).length)return this.ISGenerated=!0,F&&(this._initPTS=W,this._initDTS=D),{tracks:M,initPTS:W,timescale:P}},p.remuxVideo=function(c,l,a,y){var m=c.inputTimeScale,E=c.samples,M=[],F=E.length,j=this._initPTS,W=this.nextAvcDts,D=8,P,H,Y,ee=Number.POSITIVE_INFINITY,oe=Number.NEGATIVE_INFINITY,xe=0,ve=!1;if(!a||W===null){var he=l*m,fe=E[0].pts-s(E[0].dts,E[0].pts);W=he-fe}for(var me=0;me<F;me++){var ae=E[me];if(ae.pts=s(ae.pts-j,W),ae.dts=s(ae.dts-j,W),ae.dts>ae.pts){var pe=9e4*.2;xe=Math.max(Math.min(xe,ae.pts-ae.dts),-1*pe)}ae.dts<E[me>0?me-1:me].dts&&(ve=!0)}ve&&E.sort(function(mt,dt){var ot=mt.dts-dt.dts,Ct=mt.pts-dt.pts;return ot||Ct}),H=E[0].dts,Y=E[E.length-1].dts;var $=Math.round((Y-H)/(F-1));if(xe<0){if(xe<$*-2){k.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(b.toMsFromMpegTsClock)(-$,!0)+" ms");for(var ne=xe,Q=0;Q<F;Q++)E[Q].dts=ne=Math.max(ne,E[Q].pts-$),E[Q].pts=Math.max(ne,E[Q].pts)}else{k.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(b.toMsFromMpegTsClock)(xe,!0)+" ms to overcome this issue");for(var Ee=0;Ee<F;Ee++)E[Ee].dts=E[Ee].dts+xe}H=E[0].dts}if(a){var we=H-W,ye=we>$,Se=we<-1;if(ye||Se){ye?k.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(we,!0)+" ms ("+we+"dts) hole between fragments detected, filling it"):k.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(-we,!0)+" ms ("+we+"dts) overlapping between fragments detected"),H=W;var Le=E[0].pts-we;E[0].dts=H,E[0].pts=Le,k.logger.log("Video: First PTS/DTS adjusted: "+Object(b.toMsFromMpegTsClock)(Le,!0)+"/"+Object(b.toMsFromMpegTsClock)(H,!0)+", delta: "+Object(b.toMsFromMpegTsClock)(we,!0)+" ms")}}o&&(H=Math.max(0,H));for(var Oe=0,ke=0,De=0;De<F;De++){for(var Pe=E[De],ze=Pe.units,$e=ze.length,We=0,He=0;He<$e;He++)We+=ze[He].data.length;ke+=We,Oe+=$e,Pe.length=We,Pe.dts=Math.max(Pe.dts,H),Pe.pts=Math.max(Pe.pts,Pe.dts,0),ee=Math.min(Pe.pts,ee),oe=Math.max(Pe.pts,oe)}Y=E[F-1].dts;var rt=ke+4*Oe+8,Je;try{Je=new Uint8Array(rt)}catch(mt){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:rt,reason:"fail allocating video mdat "+rt});return}var Qe=new DataView(Je.buffer);Qe.setUint32(0,rt),Je.set(R.default.types.mdat,4);for(var Ae=0;Ae<F;Ae++){for(var et=E[Ae],Ze=et.units,Re=0,Fe=0,ge=Ze.length;Fe<ge;Fe++){var ue=Ze[Fe],de=ue.data,J=ue.data.byteLength;Qe.setUint32(D,J),D+=4,Je.set(de,D),D+=J,Re+=4+J}if(Ae<F-1)P=E[Ae+1].dts-et.dts;else{var Z=this.config,te=et.dts-E[Ae>0?Ae-1:Ae].dts;if(Z.stretchShortVideoTrack&&this.nextAudioPts!==null){var se=Math.floor(Z.maxBufferHole*m),ce=(y?ee+y*m:this.nextAudioPts)-et.pts;ce>se?(P=ce-te,P<0&&(P=te),k.logger.log("[mp4-remuxer]: It is approximately "+ce/90+" ms to the next segment; using duration "+P/90+" ms for the last video frame.")):P=te}else P=te}var _e=Math.round(et.pts-et.dts);M.push(new g(et.key,P,Re,_e))}if(M.length&&v&&v<70){var Ce=M[0].flags;Ce.dependsOn=2,Ce.isNonSync=0}console.assert(P!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=Y+P,this.isVideoContiguous=!0;var Ie=R.default.moof(c.sequenceNumber++,H,S({},c,{samples:M})),Ye="video",Ge={data1:Ie,data2:Je,startPTS:ee/m,endPTS:(oe+P)/m,startDTS:H/m,endDTS:W/m,type:Ye,hasAudio:!1,hasVideo:!0,nb:M.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Je.length,"MDAT length must not be zero"),Ge},p.remuxAudio=function(c,l,a,y,m){var E=c.inputTimeScale,M=c.samplerate?c.samplerate:E,F=E/M,j=c.isAAC?C:x,W=j*F,D=this._initPTS,P=!c.isAAC&&this.typeSupported.mpeg,H=[],Y=c.samples,ee=P?0:8,oe=this.nextAudioPts||-1,xe=l*E;if(this.isAudioContiguous=a=a||Y.length&&oe>0&&(y&&Math.abs(xe-oe)<9e3||Math.abs(s(Y[0].pts-D,xe)-oe)<20*W),Y.forEach(function(de){de.pts=s(de.pts-D,xe)}),!a||oe<0){if(Y=Y.filter(function(de){return de.pts>=0}),!Y.length)return;m===0?oe=0:y?oe=Math.max(0,xe):oe=Y[0].pts}if(c.isAAC)for(var ve=m!==void 0,he=this.config.maxAudioFramesDrift,fe=0,me=oe;fe<Y.length;fe++){var ae=Y[fe],pe=ae.pts,$=pe-me,ne=Math.abs(1e3*$/E);if($<=-he*W&&ve)fe===0&&(k.logger.warn("Audio frame @ "+(pe/E).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*$/E)+" ms."),this.nextAudioPts=oe=me=pe);else if($>=he*W&&ne<O&&ve){var Q=Math.round($/W);me=pe-Q*W,me<0&&(Q--,me+=W),fe===0&&(this.nextAudioPts=oe=me),k.logger.warn("[mp4-remuxer]: Injecting "+Q+" audio frame @ "+(me/E).toFixed(3)+"s due to "+Math.round(1e3*$/E)+" ms gap.");for(var Ee=0;Ee<Q;Ee++){var we=Math.max(me,0),ye=I.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);ye||(k.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ye=ae.unit.subarray()),Y.splice(fe,0,{unit:ye,pts:we}),me+=W,fe++}}ae.pts=me,me+=W}for(var Se=null,Le=null,Oe,ke=0,De=Y.length;De--;)ke+=Y[De].unit.byteLength;for(var Pe=0,ze=Y.length;Pe<ze;Pe++){var $e=Y[Pe],We=$e.unit,He=$e.pts;if(Le!==null){var rt=H[Pe-1];rt.duration=Math.round((He-Le)/F)}else if(a&&c.isAAC&&(He=oe),Se=He,ke>0){ke+=ee;try{Oe=new Uint8Array(ke)}catch(de){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ke,reason:"fail allocating audio mdat "+ke});return}if(!P){var Je=new DataView(Oe.buffer);Je.setUint32(0,ke),Oe.set(R.default.types.mdat,4)}}else return;Oe.set(We,ee);var Qe=We.byteLength;ee+=Qe,H.push(new g(!0,j,Qe,0)),Le=He}var Ae=H.length;if(!Ae)return;var et=H[H.length-1];this.nextAudioPts=oe=Le+F*et.duration;var Ze=P?new Uint8Array(0):R.default.moof(c.sequenceNumber++,Se/F,S({},c,{samples:H}));c.samples=[];var Re=Se/E,Fe=oe/E,ge="audio",ue={data1:Ze,data2:Oe,startPTS:Re,endPTS:Fe,startDTS:Re,endDTS:Fe,type:ge,hasAudio:!0,hasVideo:!1,nb:Ae};return this.isAudioContiguous=!0,console.assert(Oe.length,"MDAT length must not be zero"),ue},p.remuxEmptyAudio=function(c,l,a,y){var m=c.inputTimeScale,E=c.samplerate?c.samplerate:m,M=m/E,F=this.nextAudioPts,j=(F!==null?F:y.startDTS*m)+this._initDTS,W=y.endDTS*m+this._initDTS,D=M*C,P=Math.ceil((W-j)/D),H=I.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(k.logger.warn("[mp4-remuxer]: remux empty Audio"),!H){k.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Y=[],ee=0;ee<P;ee++){var oe=j+ee*D;Y.push({unit:H,pts:oe,dts:oe})}return c.samples=Y,this.remuxAudio(c,l,a,!1)},p.remuxID3=function(c,l){var a=c.samples.length;if(!a)return;for(var y=c.inputTimeScale,m=this._initPTS,E=this._initDTS,M=0;M<a;M++){var F=c.samples[M];F.pts=s(F.pts-m,l*y)/y,F.dts=s(F.dts-E,l*y)/y}var j=c.samples;return c.samples=[],{samples:j}},p.remuxText=function(c,l){var a=c.samples.length;if(!a)return;for(var y=c.inputTimeScale,m=this._initPTS,E=0;E<a;E++){var M=c.samples[E];M.pts=s(M.pts-m,l*y)/y}c.samples.sort(function(j,W){return j.pts-W.pts});var F=c.samples;return c.samples=[],{samples:F}},_}();function s(_,p){var h;if(p===null)return _;for(p<_?h=-8589934592:h=8589934592;Math.abs(_-p)>4294967296;)_+=h;return _}function w(_){for(var p=0;p<_.length;p++)if(_[p].key)return p;return-1}var g=function(p,h,c,l){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=h,this.size=c,this.cts=l,this.flags=new f(p)},f=function(p){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=p?2:1,this.isNonSync=p?0:1}},"./src/remux/passthrough-remuxer.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/polyfills/number.ts"),I=A("./src/utils/mp4-tools.ts"),R=A("./src/loader/fragment.ts"),B=A("./src/utils/logger.ts"),U=function(){function b(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var S=b.prototype;return S.destroy=function(){},S.resetTimeStamp=function(C){this.initPTS=C,this.lastEndDTS=null},S.resetNextTimestamp=function(){this.lastEndDTS=null},S.resetInitSegment=function(C,x,v){this.audioCodec=x,this.videoCodec=v,this.generateInitSegment(C),this.emitInitSegment=!0},S.generateInitSegment=function(C){var x=this.audioCodec,v=this.videoCodec;if(!C||!C.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(I.parseInitSegment)(C);x||(x=L(d.audio,R.ElementaryStreamTypes.AUDIO)),v||(v=L(d.video,R.ElementaryStreamTypes.VIDEO));var o={};d.audio&&d.video?o.audiovideo={container:"video/mp4",codec:x+","+v,initSegment:C,id:"main"}:d.audio?o.audio={container:"audio/mp4",codec:x,initSegment:C,id:"audio"}:d.video?o.video={container:"video/mp4",codec:v,initSegment:C,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},S.remux=function(C,x,v,d,o){var u=this.initPTS,s=this.lastEndDTS,w={audio:void 0,video:void 0,text:d,id3:v,initSegment:void 0};Object(G.isFiniteNumber)(s)||(s=this.lastEndDTS=o||0);var g=x.samples;if(!g||!g.length)return w;var f={initPTS:void 0,timescale:1},_=this.initData;if((!_||!_.length)&&(this.generateInitSegment(g),_=this.initData),!_||!_.length)return B.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),w;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1),Object(G.isFiniteNumber)(u)||(this.initPTS=f.initPTS=u=k(_,g,s));var p=Object(I.getDuration)(g,_),h=s,c=p+h;Object(I.offsetStartDTS)(_,g,u),p>0?this.lastEndDTS=c:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var l=!!_.audio,a=!!_.video,y="";l&&(y+="audio"),a&&(y+="video");var m={data1:g,startPTS:h,startDTS:h,endPTS:c,endDTS:c,type:y,hasAudio:l,hasVideo:a,nb:1,dropped:0};return w.audio=m.type==="audio"?m:void 0,w.video=m.type!=="audio"?m:void 0,w.text=d,w.id3=v,w.initSegment=f,w},b}(),k=function(S,O,C){return Object(I.getStartDTS)(S,O)-C};function L(b,S){var O=b==null?void 0:b.codec;return O&&O.length>4?O:O==="hvc1"?"hvc1.1.c.L120.90":O==="av01"?"av01.0.04M.08":O==="avc1"||S===R.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}V.default=U},"./src/task-loop.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return G});var G=function(){function I(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var R=I.prototype;return R.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},R.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},R.onHandlerDestroyed=function(){},R.hasInterval=function(){return!!this._tickInterval},R.hasNextTick=function(){return!!this._tickTimer},R.setInterval=function(U){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,U),!0)},R.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},R.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},R.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},R.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},R.doTick=function(){},I}()},"./src/types/cmcd.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"CMCDVersion",function(){return G}),A.d(V,"CMCDObjectType",function(){return I}),A.d(V,"CMCDStreamingFormat",function(){return R}),A.d(V,"CMCDStreamType",function(){return B});var G=1,I;(function(U){U.MANIFEST="m",U.AUDIO="a",U.VIDEO="v",U.MUXED="av",U.INIT="i",U.CAPTION="c",U.TIMED_TEXT="tt",U.KEY="k",U.OTHER="o"})(I||(I={}));var R;(function(U){U.DASH="d",U.HLS="h",U.SMOOTH="s",U.OTHER="o"})(R||(R={}));var B;(function(U){U.VOD="v",U.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"HlsSkip",function(){return R}),A.d(V,"getSkipValue",function(){return B}),A.d(V,"HlsUrlParameters",function(){return U}),A.d(V,"Level",function(){return k});function G(L,b){for(var S=0;S<b.length;S++){var O=b[S];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(L,O.key,O)}}function I(L,b,S){return b&&G(L.prototype,b),S&&G(L,S),L}var R;(function(L){L.No="",L.Yes="YES",L.v2="v2"})(R||(R={}));function B(L,b){var S=L.canSkipUntil,O=L.canSkipDateRanges,C=L.endSN,x=b!==void 0?b-C:0;return S&&x<S?O?R.v2:R.Yes:R.No}var U=function(){function L(S,O,C){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=S,this.part=O,this.skip=C}var b=L.prototype;return b.addDirectives=function(O){var C=new self.URL(O);return this.msn!==void 0&&C.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&C.searchParams.set("_HLS_part",this.part.toString()),this.skip&&C.searchParams.set("_HLS_skip",this.skip),C.toString()},L}(),k=function(){function L(b){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[b.url],this.attrs=b.attrs,this.bitrate=b.bitrate,b.details&&(this.details=b.details),this.id=b.id||0,this.name=b.name,this.width=b.width||0,this.height=b.height||0,this.audioCodec=b.audioCodec,this.videoCodec=b.videoCodec,this.unknownCodecs=b.unknownCodecs,this.codecSet=[b.videoCodec,b.audioCodec].filter(function(S){return S}).join(",").replace(/\.[^.,]+/g,"")}return I(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 O=S%this.url.length;this._urlId!==O&&(this.details=void 0,this._urlId=O)}}]),L}()},"./src/types/loader.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"PlaylistContextType",function(){return G}),A.d(V,"PlaylistLevelType",function(){return I});var G;(function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"})(G||(G={}));var I;(function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"})(I||(I={}))},"./src/types/transmuxer.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"ChunkMetadata",function(){return G});var G=function(B,U,k,L,b,S){L===void 0&&(L=0),b===void 0&&(b=-1),S===void 0&&(S=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=I(),this.buffering={audio:I(),video:I(),audiovideo:I()},this.level=B,this.sn=U,this.id=k,this.size=L,this.part=b,this.partial=S};function I(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"AttrList",function(){return R});var G=/^(\d+)x(\d+)$/,I=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,R=function(){function B(k){typeof k=="string"&&(k=B.parseAttrList(k));for(var L in k)k.hasOwnProperty(L)&&(this[L]=k[L])}var U=B.prototype;return U.decimalInteger=function(L){var b=parseInt(this[L],10);return b>Number.MAX_SAFE_INTEGER?Infinity:b},U.hexadecimalInteger=function(L){if(this[L]){var b=(this[L]||"0x").slice(2);b=(b.length&1?"0":"")+b;for(var S=new Uint8Array(b.length/2),O=0;O<b.length/2;O++)S[O]=parseInt(b.slice(O*2,O*2+2),16);return S}else return null},U.hexadecimalIntegerAsNumber=function(L){var b=parseInt(this[L],16);return b>Number.MAX_SAFE_INTEGER?Infinity:b},U.decimalFloatingPoint=function(L){return parseFloat(this[L])},U.optionalFloat=function(L,b){var S=this[L];return S?parseFloat(S):b},U.enumeratedString=function(L){return this[L]},U.bool=function(L){return this[L]==="YES"},U.decimalResolution=function(L){var b=G.exec(this[L]);return b===null?void 0:{width:parseInt(b[1],10),height:parseInt(b[2],10)}},B.parseAttrList=function(L){var b,S={},O='"';for(I.lastIndex=0;(b=I.exec(L))!==null;){var C=b[2];C.indexOf(O)===0&&C.lastIndexOf(O)===C.length-1&&(C=C.slice(1,-1)),S[b[1]]=C}return S},B}()},"./src/utils/binary-search.ts":function(re,V,A){"use strict";A.r(V);var G={search:function(R,B){for(var U=0,k=R.length-1,L=null,b=null;U<=k;){L=(U+k)/2|0,b=R[L];var S=B(b);if(S>0)U=L+1;else if(S<0)k=L-1;else return b}return null}};V.default=G},"./src/utils/buffer-helper.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"BufferHelper",function(){return R});var G=A("./src/utils/logger.ts"),I={length:0,start:function(){return 0},end:function(){return 0}},R=function(){function B(){}return B.isBuffered=function(k,L){try{if(k){for(var b=B.getBuffered(k),S=0;S<b.length;S++)if(L>=b.start(S)&&L<=b.end(S))return!0}}catch(O){}return!1},B.bufferInfo=function(k,L,b){try{if(k){var S=B.getBuffered(k),O=[],C;for(C=0;C<S.length;C++)O.push({start:S.start(C),end:S.end(C)});return this.bufferedInfo(O,L,b)}}catch(x){}return{len:0,start:L,end:L,nextStart:void 0}},B.bufferedInfo=function(k,L,b){L=Math.max(0,L),k.sort(function(f,_){var p=f.start-_.start;return p||_.end-f.end});var S=[];if(b)for(var O=0;O<k.length;O++){var C=S.length;if(C){var x=S[C-1].end;k[O].start-x<b?k[O].end>x&&(S[C-1].end=k[O].end):S.push(k[O])}else S.push(k[O])}else S=k;for(var v=0,d,o=L,u=L,s=0;s<S.length;s++){var w=S[s].start,g=S[s].end;if(L+b>=w&&L<g)o=w,u=g,v=u-L;else if(L+b<w){d=w;break}}return{len:v,start:o||0,end:u||0,nextStart:d}},B.getBuffered=function(k){try{return k.buffered}catch(L){return G.logger.log("failed to get media.buffered",L),I}},B}()},"./src/utils/cea-608-parser.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"Row",function(){return u}),A.d(V,"CaptionScreen",function(){return s});var G=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(c){var l=c;return I.hasOwnProperty(c)&&(l=I[c]),String.fromCharCode(l)},B=15,U=100,k={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},L={17:2,18:4,21:6,22:8,23:10,19:13,20:15},b={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},S={25:2,26:4,29:6,30:8,31:10,27:13,28:15},O=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],C;(function(h){h[h.ERROR=0]="ERROR",h[h.TEXT=1]="TEXT",h[h.WARNING=2]="WARNING",h[h.INFO=2]="INFO",h[h.DEBUG=3]="DEBUG",h[h.DATA=3]="DATA"})(C||(C={}));var x=function(){function h(){this.time=null,this.verboseLevel=C.ERROR}var c=h.prototype;return c.log=function(a,y){this.verboseLevel>=a&&G.logger.log(this.time+" ["+a+"] "+y)},h}(),v=function(c){for(var l=[],a=0;a<c.length;a++)l.push(c[a].toString(16));return l},d=function(){function h(l,a,y,m,E){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=l||"white",this.underline=a||!1,this.italics=y||!1,this.background=m||"black",this.flash=E||!1}var c=h.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(a){for(var y=["foreground","underline","italics","background","flash"],m=0;m<y.length;m++){var E=y[m];a.hasOwnProperty(E)&&(this[E]=a[E])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},c.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},h}(),o=function(){function h(l,a,y,m,E,M){this.uchar=void 0,this.penState=void 0,this.uchar=l||" ",this.penState=new d(a,y,m,E,M)}var c=h.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,y){this.uchar=a,this.penState.copy(y)},c.setPenState=function(a){this.penState.copy(a)},c.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},c.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},h}(),u=function(){function h(l){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<U;a++)this.chars.push(new o);this.logger=l,this.pos=0,this.currPenState=new d}var c=h.prototype;return c.equals=function(a){for(var y=!0,m=0;m<U;m++)if(!this.chars[m].equals(a.chars[m])){y=!1;break}return y},c.copy=function(a){for(var y=0;y<U;y++)this.chars[y].copy(a.chars[y])},c.isEmpty=function(){for(var a=!0,y=0;y<U;y++)if(!this.chars[y].isEmpty()){a=!1;break}return a},c.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(C.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>U&&(this.logger.log(C.DEBUG,"Too large cursor position "+this.pos),this.pos=U)},c.moveCursor=function(a){var y=this.pos+a;if(a>1)for(var m=this.pos+1;m<y+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(y)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var y=R(a);if(this.pos>=U){this.logger.log(C.ERROR,"Cannot insert "+a.toString(16)+" ("+y+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(y,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var y;for(y=a;y<U;y++)this.chars[y].reset()},c.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},c.clearToEndOfRow=function(){this.clearFromPos(this.pos)},c.getTextString=function(){for(var a=[],y=!0,m=0;m<U;m++){var E=this.chars[m].uchar;E!==" "&&(y=!1),a.push(E)}return y?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var y=this.chars[this.pos];y.setPenState(this.currPenState)},h}(),s=function(){function h(l){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<B;a++)this.rows.push(new u(l));this.logger=l,this.currRow=B-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=h.prototype;return c.reset=function(){for(var a=0;a<B;a++)this.rows[a].clear();this.currRow=B-1},c.equals=function(a){for(var y=!0,m=0;m<B;m++)if(!this.rows[m].equals(a.rows[m])){y=!1;break}return y},c.copy=function(a){for(var y=0;y<B;y++)this.rows[y].copy(a.rows[y])},c.isEmpty=function(){for(var a=!0,y=0;y<B;y++)if(!this.rows[y].isEmpty()){a=!1;break}return a},c.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},c.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},c.insertChar=function(a){var y=this.rows[this.currRow];y.insertChar(a)},c.setPen=function(a){var y=this.rows[this.currRow];y.setPenStyles(a)},c.moveCursor=function(a){var y=this.rows[this.currRow];y.moveCursor(a)},c.setCursor=function(a){this.logger.log(C.INFO,"setCursor: "+a);var y=this.rows[this.currRow];y.setCursor(a)},c.setPAC=function(a){this.logger.log(C.INFO,"pacData = "+JSON.stringify(a));var y=a.row-1;if(this.nrRollUpRows&&y<this.nrRollUpRows-1&&(y=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==y){for(var m=0;m<B;m++)this.rows[m].clear();var E=this.currRow+1-this.nrRollUpRows,M=this.lastOutputScreen;if(M){var F=M.rows[E].cueStartTime,j=this.logger.time;if(F&&j!==null&&F<j)for(var W=0;W<this.nrRollUpRows;W++)this.rows[y-this.nrRollUpRows+W+1].copy(M.rows[E+W])}}this.currRow=y;var D=this.rows[this.currRow];if(a.indent!==null){var P=a.indent,H=Math.max(P-1,0);D.setCursor(a.indent),a.color=D.chars[H].penState.foreground}var Y={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(Y)},c.setBkgData=function(a){this.logger.log(C.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},c.setRollUpRows=function(a){this.nrRollUpRows=a},c.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(C.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(C.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,y=this.rows.splice(a,1)[0];y.clear(),this.rows.splice(this.currRow,0,y),this.logger.log(C.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var y=[],m="",E=-1,M=0;M<B;M++){var F=this.rows[M].getTextString();F&&(E=M+1,a?y.push("Row "+E+": '"+F+"'"):y.push(F.trim()))}return y.length>0&&(a?m="["+y.join(" | ")+"]":m=y.join(`
`)),m},c.getTextAndFormat=function(){return this.rows},h}(),w=function(){function h(l,a,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=l,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new s(y),this.nonDisplayedMemory=new s(y),this.lastOutputScreen=new s(y),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=y}var c=h.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(a){this.outputFilter=a},c.setPAC=function(a){this.writeScreen.setPAC(a)},c.setBkgData=function(a){this.writeScreen.setBkgData(a)},c.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(C.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},c.insertChars=function(a){for(var y=0;y<a.length;y++)this.writeScreen.insertChar(a[y]);var m=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(C.INFO,m+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(C.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(C.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(C.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},c.ccAOF=function(){},c.ccAON=function(){},c.ccDER=function(){this.logger.log(C.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(C.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(C.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(C.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(C.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(C.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(C.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(C.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(C.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(C.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(C.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(C.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var y={flash:!1};if(y.underline=a%2===1,y.italics=a>=46,y.italics)y.foreground="white";else{var m=Math.floor(a/2)-16,E=["white","green","blue","cyan","red","yellow","magenta"];y.foreground=E[m]}this.logger.log(C.INFO,"MIDROW: "+JSON.stringify(y)),this.writeScreen.setPen(y)},c.outputDataUpdate=function(a){a===void 0&&(a=!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),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:y),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},h}(),g=function(){function h(l,a,y){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new x;this.channels=[null,new w(l,a,m),new w(l+1,y,m)],this.cmdHistory=p(),this.logger=m}var c=h.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,y){this.channels[a].setHandler(y)},c.addData=function(a,y){var m,E,M,F=!1;this.logger.time=a;for(var j=0;j<y.length;j+=2){if(E=y[j]&127,M=y[j+1]&127,E===0&&M===0)continue;if(this.logger.log(C.DATA,"["+v([y[j],y[j+1]])+"] -> ("+v([E,M])+")"),m=this.parseCmd(E,M),m||(m=this.parseMidrow(E,M)),m||(m=this.parsePAC(E,M)),m||(m=this.parseBackgroundAttributes(E,M)),!m&&(F=this.parseChars(E,M),F)){var W=this.currentChannel;if(W&&W>0){var D=this.channels[W];D.insertChars(F)}else this.logger.log(C.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!F&&this.logger.log(C.WARNING,"Couldn't parse cleaned data "+v([E,M])+" orig: "+v([y[j],y[j+1]]))}},c.parseCmd=function(a,y){var m=this.cmdHistory,E=(a===20||a===28||a===21||a===29)&&y>=32&&y<=47,M=(a===23||a===31)&&y>=33&&y<=35;if(!(E||M))return!1;if(_(a,y,m))return f(null,null,m),this.logger.log(C.DEBUG,"Repeated command ("+v([a,y])+") is dropped"),!0;var F=a===20||a===21||a===23?1:2,j=this.channels[F];return a===20||a===21||a===28||a===29?y===32?j.ccRCL():y===33?j.ccBS():y===34?j.ccAOF():y===35?j.ccAON():y===36?j.ccDER():y===37?j.ccRU(2):y===38?j.ccRU(3):y===39?j.ccRU(4):y===40?j.ccFON():y===41?j.ccRDC():y===42?j.ccTR():y===43?j.ccRTD():y===44?j.ccEDM():y===45?j.ccCR():y===46?j.ccENM():y===47&&j.ccEOC():j.ccTO(y-32),f(a,y,m),this.currentChannel=F,!0},c.parseMidrow=function(a,y){var m=0;if((a===17||a===25)&&y>=32&&y<=47){if(a===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(C.ERROR,"Mismatch channel in midrow parsing"),!1;var E=this.channels[m];return E?(E.ccMIDROW(y),this.logger.log(C.DEBUG,"MIDROW ("+v([a,y])+")"),!0):!1}return!1},c.parsePAC=function(a,y){var m,E=this.cmdHistory,M=(a>=17&&a<=23||a>=25&&a<=31)&&y>=64&&y<=127,F=(a===16||a===24)&&y>=64&&y<=95;if(!(M||F))return!1;if(_(a,y,E))return f(null,null,E),!0;var j=a<=23?1:2;y>=64&&y<=95?m=j===1?k[a]:b[a]:m=j===1?L[a]:S[a];var W=this.channels[j];return W?(W.setPAC(this.interpretPAC(m,y)),f(a,y,E),this.currentChannel=j,!0):!1},c.interpretPAC=function(a,y){var m,E={color:null,italics:!1,indent:null,underline:!1,row:a};return y>95?m=y-96:m=y-64,E.underline=(m&1)===1,m<=13?E.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(E.italics=!0,E.color="white"):E.indent=Math.floor((m-16)/2)*4,E},c.parseChars=function(a,y){var m,E=null,M=null;if(a>=25?(m=2,M=a-8):(m=1,M=a),M>=17&&M<=19){var F;M===17?F=y+80:M===18?F=y+112:F=y+144,this.logger.log(C.INFO,"Special char '"+R(F)+"' in channel "+m),E=[F]}else a>=32&&a<=127&&(E=y===0?[a]:[a,y]);if(E){var j=v(E);this.logger.log(C.DEBUG,"Char codes = "+j.join(",")),f(a,y,this.cmdHistory)}return E},c.parseBackgroundAttributes=function(a,y){var m=(a===16||a===24)&&y>=32&&y<=47,E=(a===23||a===31)&&y>=45&&y<=47;if(!(m||E))return!1;var M,F={};a===16||a===24?(M=Math.floor((y-32)/2),F.background=O[M],y%2===1&&(F.background=F.background+"_semi")):y===45?F.background="transparent":(F.foreground="black",y===47&&(F.underline=!0));var j=a<=23?1:2,W=this.channels[j];return W.setBkgData(F),f(a,y,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var y=this.channels[a];y&&y.reset()}this.cmdHistory=p()},c.cueSplitAtTime=function(a){for(var y=0;y<this.channels.length;y++){var m=this.channels[y];m&&m.cueSplitAtTime(a)}},h}();function f(h,c,l){l.a=h,l.b=c}function _(h,c,l){return l.a===h&&l.b===c}function p(){return{a:null,b:null}}V.default=g},"./src/utils/codecs.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"isCodecType",function(){return I}),A.d(V,"isCodecSupportedInMp4",function(){return R});var G={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function I(B,U){var k=G[U];return!!k&&k[B.slice(0,4)]===!0}function R(B,U){return MediaSource.isTypeSupported((U||"video")+'/mp4;codecs="'+B+'"')}},"./src/utils/cues.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/utils/vttparser.ts"),I=A("./src/utils/webvtt-parser.ts"),R=A("./src/utils/texttrack-utils.ts"),B=/\s/,U={newCue:function(L,b,S,O){for(var C=[],x,v,d,o,u,s=self.VTTCue||self.TextTrackCue,w=0;w<O.rows.length;w++)if(x=O.rows[w],d=!0,o=0,u="",!x.isEmpty()){for(var g=0;g<x.chars.length;g++)B.test(x.chars[g].uchar)&&d?o++:(u+=x.chars[g].uchar,d=!1);x.cueStartTime=b,b===S&&(S+=1e-4),o>=16?o--:o++;var f=Object(G.fixLineBreaks)(u.trim()),_=Object(I.generateCueId)(b,S,f);(!L||!L.cues||!L.cues.getCueById(_))&&(v=new s(b,S,f),v.id=_,v.line=w+1,v.align="left",v.position=10+Math.min(80,Math.floor(o*8/32)*10),C.push(v))}return L&&C.length&&(C.sort(function(p,h){return p.line==="auto"||h.line==="auto"?0:p.line>8&&h.line>8?h.line-p.line:p.line-h.line}),C.forEach(function(p){return Object(R.addCueToTrack)(L,p)})),C}};V.default=U},"./src/utils/discontinuities.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"findFirstFragWithCC",function(){return B}),A.d(V,"shouldAlignOnDiscontinuities",function(){return U}),A.d(V,"findDiscontinuousReferenceFrag",function(){return k}),A.d(V,"adjustSlidingStart",function(){return b}),A.d(V,"alignStream",function(){return S}),A.d(V,"alignPDT",function(){return C}),A.d(V,"alignFragmentByPDTDelta",function(){return x}),A.d(V,"alignMediaPlaylistByPDT",function(){return v});var G=A("./src/polyfills/number.ts"),I=A("./src/utils/logger.ts"),R=A("./src/controller/level-helper.ts");function B(d,o){for(var u=null,s=0,w=d.length;s<w;s++){var g=d[s];if(g&&g.cc===o){u=g;break}}return u}function U(d,o,u){return!!(o.details&&(u.endCC>u.startCC||d&&d.cc<u.startCC))}function k(d,o){var u=d.fragments,s=o.fragments;if(!s.length||!u.length){I.logger.log("No fragments to align");return}var w=B(u,s[0].cc);if(!w||w&&!w.startPTS){I.logger.log("No frag in previous level to align on");return}return w}function L(d,o){if(d){var u=d.start+o;d.start=d.startPTS=u,d.endPTS=u+d.duration}}function b(d,o){for(var u=o.fragments,s=0,w=u.length;s<w;s++)L(u[s],d);o.fragmentHint&&L(o.fragmentHint,d),o.alignedSliding=!0}function S(d,o,u){if(!o)return;O(d,u,o),!u.alignedSliding&&o.details&&C(u,o.details),!u.alignedSliding&&o.details&&!u.skippedSegments&&Object(R.adjustSliding)(o.details,u)}function O(d,o,u){if(U(d,u,o)){var s=k(u.details,o);s&&Object(G.isFiniteNumber)(s.start)&&(I.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),b(s.start,o))}}function C(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var u=o.fragments[0].programDateTime,s=d.fragments[0].programDateTime,w=(s-u)/1e3+o.fragments[0].start;w&&Object(G.isFiniteNumber)(w)&&(I.logger.log("Adjusting PTS using programDateTime delta "+(s-u)+"ms, sliding:"+w.toFixed(3)+" "+d.url+" "),b(w,d))}function x(d,o){var u=d.programDateTime;if(!u)return;var s=(u-o)/1e3;d.start=d.startPTS=s,d.endPTS=s+d.duration}function v(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var u=o.fragments[0].programDateTime,s=o.fragments[0].start,w=u-s*1e3;d.fragments.forEach(function(g){x(g,w)}),d.fragmentHint&&x(d.fragmentHint,w),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/utils/ewma.ts"),I=function(){function R(U,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 G.default(U),this.fast_=new G.default(k)}var B=R.prototype;return B.update=function(k,L){var b=this.slow_,S=this.fast_;this.slow_.halfLife!==k&&(this.slow_=new G.default(k,b.getEstimate(),b.getTotalWeight())),this.fast_.halfLife!==L&&(this.fast_=new G.default(L,S.getEstimate(),S.getTotalWeight()))},B.sample=function(k,L){k=Math.max(k,this.minDelayMs_);var b=8*L,S=k/1e3,O=b/S;this.fast_.sample(S,O),this.slow_.sample(S,O)},B.canEstimate=function(){var k=this.fast_;return k&&k.getTotalWeight()>=this.minWeight_},B.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},B.destroy=function(){},R}();V.default=I},"./src/utils/ewma.ts":function(re,V,A){"use strict";A.r(V);var G=function(){function I(B,U,k){U===void 0&&(U=0),k===void 0&&(k=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=B,this.alpha_=B?Math.exp(Math.log(.5)/B):0,this.estimate_=U,this.totalWeight_=k}var R=I.prototype;return R.sample=function(U,k){var L=Math.pow(this.alpha_,U);this.estimate_=k*(1-L)+L*this.estimate_,this.totalWeight_+=U},R.getTotalWeight=function(){return this.totalWeight_},R.getEstimate=function(){if(this.alpha_){var U=1-Math.pow(this.alpha_,this.totalWeight_);if(U)return this.estimate_/U}return this.estimate_},I}();V.default=G},"./src/utils/fetch-loader.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"fetchSupported",function(){return x});var G=A("./src/polyfills/number.ts"),I=A("./src/loader/load-stats.ts"),R=A("./src/demux/chunk-cache.ts");function B(s,w){s.prototype=Object.create(w.prototype),s.prototype.constructor=s,S(s,w)}function U(s){var w=typeof Map=="function"?new Map:void 0;return U=function(f){if(f===null||!b(f))return f;if(typeof f!="function")throw new TypeError("Super expression must either be null or a function");if(typeof w!="undefined"){if(w.has(f))return w.get(f);w.set(f,_)}function _(){return k(f,arguments,O(this).constructor)}return _.prototype=Object.create(f.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),S(_,f)},U(s)}function k(s,w,g){return L()?k=Reflect.construct:k=function(_,p,h){var c=[null];c.push.apply(c,p);var l=Function.bind.apply(_,c),a=new l;return h&&S(a,h.prototype),a},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(s){return!1}}function b(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function S(s,w){return S=Object.setPrototypeOf||function(f,_){return f.__proto__=_,f},S(s,w)}function O(s){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(g){return g.__proto__||Object.getPrototypeOf(g)},O(s)}function C(){return C=Object.assign||function(s){for(var w=1;w<arguments.length;w++){var g=arguments[w];for(var f in g)Object.prototype.hasOwnProperty.call(g,f)&&(s[f]=g[f])}return s},C.apply(this,arguments)}function x(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(s){}return!1}var v=function(){function s(g){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=g.fetchSetup||o,this.controller=new self.AbortController,this.stats=new I.LoadStats}var w=s.prototype;return w.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},w.abortInternal=function(){var f=this.response;(!f||!f.ok)&&(this.stats.aborted=!0,this.controller.abort())},w.abort=function(){var f;this.abortInternal(),(f=this.callbacks)!==null&&f!==void 0&&f.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},w.load=function(f,_,p){var h=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var l=d(f,this.controller.signal),a=p.onProgress,y=f.responseType==="arraybuffer",m=y?"byteLength":"length";this.context=f,this.config=_,this.callbacks=p,this.request=this.fetchSetup(f,l),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){h.abortInternal(),p.onTimeout(c,f,h.response)},_.timeout),self.fetch(this.request).then(function(E){if(h.response=h.loader=E,!E.ok){var M=E.status,F=E.statusText;throw new u(F||"fetch, bad network response",M,E)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(E.headers.get("Content-Length")||"0"),a&&Object(G.isFiniteNumber)(_.highWaterMark)?h.loadProgressively(E,c,f,_.highWaterMark,a):y?E.arrayBuffer():E.text()}).then(function(E){var M=h.response;self.clearTimeout(h.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=E[m];var F={url:M.url,data:E};a&&!Object(G.isFiniteNumber)(_.highWaterMark)&&a(c,f,E,M),p.onSuccess(F,c,f,M)}).catch(function(E){if(self.clearTimeout(h.requestTimeout),c.aborted)return;var M=E.code||0;p.onError({code:M,text:E.message},f,E.details)})},w.getCacheAge=function(){var f=null;if(this.response){var _=this.response.headers.get("age");f=_?parseFloat(_):null}return f},w.loadProgressively=function(f,_,p,h,c){h===void 0&&(h=0);var l=new R.default,a=f.body.getReader(),y=function m(){return a.read().then(function(E){if(E.done)return l.dataLength&&c(_,p,l.flush(),f),Promise.resolve(new ArrayBuffer(0));var M=E.value,F=M.length;return _.loaded+=F,F<h||l.dataLength?(l.push(M),l.dataLength>=h&&c(_,p,l.flush(),f)):c(_,p,M,f),m()}).catch(function(){return Promise.reject()})};return y()},s}();function d(s,w){var g={method:"GET",mode:"cors",credentials:"same-origin",signal:w,headers:new self.Headers(C({},s.headers))};return s.rangeEnd&&g.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),g}function o(s,w){return new self.Request(s.url,w)}var u=function(s){B(w,s);function w(g,f,_){var p;return p=s.call(this,g)||this,p.code=void 0,p.details=void 0,p.code=f,p.details=_,p}return w}(U(Error));V.default=v},"./src/utils/imsc1-ttml-parser.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"IMSC1_CODEC",function(){return b}),A.d(V,"parseIMSC1",function(){return x});var G=A("./src/utils/mp4-tools.ts"),I=A("./src/utils/vttparser.ts"),R=A("./src/utils/vttcue.ts"),B=A("./src/demux/id3.ts"),U=A("./src/utils/timescale-conversion.ts"),k=A("./src/utils/webvtt-parser.ts");function L(){return L=Object.assign||function(h){for(var c=1;c<arguments.length;c++){var l=arguments[c];for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&(h[a]=l[a])}return h},L.apply(this,arguments)}var b="stpp.ttml.im1t",S=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,O=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,C={left:"start",center:"center",right:"end",start:"start",end:"end"};function x(h,c,l,a,y){var m=Object(G.findBox)(new Uint8Array(h),["mdat"]);if(m.length===0){y(new Error("Could not parse IMSC1 mdat"));return}var E=m[0],M=Object(B.utf8ArrayToStr)(new Uint8Array(h,E.start,E.end-E.start)),F=Object(U.toTimescaleFromScale)(c,1,l);try{a(v(M,F))}catch(j){y(j)}}function v(h,c){var l=new DOMParser,a=l.parseFromString(h,"text/xml"),y=a.getElementsByTagName("tt")[0];if(!y)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},E=Object.keys(m).reduce(function(D,P){return D[P]=y.getAttribute("ttp:"+P)||m[P],D},{}),M=y.getAttribute("xml:space")!=="preserve",F=o(d(y,"styling","style")),j=o(d(y,"layout","region")),W=d(y,"body","[begin]");return[].map.call(W,function(D){var P=u(D,M);if(!P||!D.hasAttribute("begin"))return null;var H=f(D.getAttribute("begin"),E),Y=f(D.getAttribute("dur"),E),ee=f(D.getAttribute("end"),E);if(H===null)throw g(D);if(ee===null){if(Y===null)throw g(D);ee=H+Y}var oe=new R.default(H-c,ee-c,P);oe.id=Object(k.generateCueId)(oe.startTime,oe.endTime,oe.text);var xe=j[D.getAttribute("region")],ve=F[D.getAttribute("style")];oe.position=10,oe.size=80;var he=s(xe,ve),fe=he.textAlign;if(fe){var me=C[fe];me&&(oe.lineAlign=me),oe.align=fe}return L(oe,he),oe}).filter(function(D){return D!==null})}function d(h,c,l){var a=h.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(l)):[]}function o(h){return h.reduce(function(c,l){var a=l.getAttribute("xml:id");return a&&(c[a]=l),c},{})}function u(h,c){return[].slice.call(h.childNodes).reduce(function(l,a,y){var m;return a.nodeName==="br"&&y?l+`
`:(m=a.childNodes)!==null&&m!==void 0&&m.length?u(a,c):c?l+a.textContent.trim().replace(/\s+/g," "):l+a.textContent},"")}function s(h,c){var l="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(y,m){var E=w(c,l,m)||w(h,l,m);return E&&(y[m]=E),y},{})}function w(h,c,l){return h.hasAttributeNS(c,l)?h.getAttributeNS(c,l):null}function g(h){return new Error("Could not parse ttml timestamp "+h)}function f(h,c){if(!h)return null;var l=Object(I.parseTimeStamp)(h);return l===null&&(S.test(h)?l=_(h,c):O.test(h)&&(l=p(h,c))),l}function _(h,c){var l=S.exec(h),a=(l[4]|0)+(l[5]|0)/c.subFrameRate;return(l[1]|0)*3600+(l[2]|0)*60+(l[3]|0)+a/c.frameRate}function p(h,c){var l=O.exec(h),a=Number(l[1]),y=l[2];switch(y){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/c.frameRate;case"t":return a/c.tickRate}return a}},"./src/utils/logger.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"enableLogs",function(){return k}),A.d(V,"logger",function(){return L});var G=function(){},I={trace:G,debug:G,log:G,warn:G,info:G,error:G},R=I;function B(b){var S=self.console[b];return S?S.bind(self.console,"["+b+"] >"):G}function U(b){for(var S=arguments.length,O=new Array(S>1?S-1:0),C=1;C<S;C++)O[C-1]=arguments[C];O.forEach(function(x){R[x]=b[x]?b[x].bind(b):B(x)})}function k(b){if(self.console&&b===!0||typeof b=="object"){U(b,"debug","log","info","warn","error");try{R.log()}catch(S){R=I}}else R=I}var L=R},"./src/utils/mediakeys-helper.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"KeySystems",function(){return G}),A.d(V,"requestMediaKeySystemAccess",function(){return I});var G;(function(R){R.WIDEVINE="com.widevine.alpha",R.PLAYREADY="com.microsoft.playready"})(G||(G={}));var I=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"getMediaSource",function(){return G});function G(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"bin2str",function(){return U}),A.d(V,"readUint16",function(){return k}),A.d(V,"readUint32",function(){return L}),A.d(V,"writeUint32",function(){return b}),A.d(V,"findBox",function(){return S}),A.d(V,"parseSegmentIndex",function(){return O}),A.d(V,"parseInitSegment",function(){return C}),A.d(V,"getStartDTS",function(){return x}),A.d(V,"getDuration",function(){return v}),A.d(V,"computeRawDurationFromSamples",function(){return d}),A.d(V,"offsetStartDTS",function(){return o}),A.d(V,"segmentValidRange",function(){return u}),A.d(V,"appendUint8Array",function(){return s});var G=A("./src/utils/typed-array.ts"),I=A("./src/loader/fragment.ts"),R=Math.pow(2,32)-1,B=[].push;function U(w){return String.fromCharCode.apply(null,w)}function k(w,g){"data"in w&&(g+=w.start,w=w.data);var f=w[g]<<8|w[g+1];return f<0?65536+f:f}function L(w,g){"data"in w&&(g+=w.start,w=w.data);var f=w[g]<<24|w[g+1]<<16|w[g+2]<<8|w[g+3];return f<0?4294967296+f:f}function b(w,g,f){"data"in w&&(g+=w.start,w=w.data),w[g]=f>>24,w[g+1]=f>>16&255,w[g+2]=f>>8&255,w[g+3]=f&255}function S(w,g){var f=[];if(!g.length)return f;var _,p,h;"data"in w?(_=w.data,p=w.start,h=w.end):(_=w,p=0,h=_.byteLength);for(var c=p;c<h;){var l=L(_,c),a=U(_.subarray(c+4,c+8)),y=l>1?c+l:h;if(a===g[0])if(g.length===1)f.push({data:_,start:c+8,end:y});else{var m=S({data:_,start:c+8,end:y},g.slice(1));m.length&&B.apply(f,m)}c=y}return f}function O(w){var g=S(w,["moov"]),f=g[0],_=f?f.end:null,p=S(w,["sidx"]);if(!p||!p[0])return null;var h=[],c=p[0],l=c.data[0],a=l===0?8:16,y=L(c,a);a+=4;var m=0,E=0;l===0?a+=8:a+=16,a+=2;var M=c.end+E,F=k(c,a);a+=2;for(var j=0;j<F;j++){var W=a,D=L(c,W);W+=4;var P=D&2147483647,H=(D&2147483648)>>>31;if(H===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Y=L(c,W);W+=4,h.push({referenceSize:P,subsegmentDuration:Y,info:{duration:Y/y,start:M,end:M+P-1}}),M+=P,W+=4,a=W}return{earliestPresentationTime:m,timescale:y,version:l,referencesCount:F,references:h,moovEndOffset:_}}function C(w){for(var g=[],f=S(w,["moov","trak"]),_=0;_<f.length;_++){var p=f[_],h=S(p,["tkhd"])[0];if(h){var c=h.data[h.start],l=c===0?12:20,a=L(h,l),y=S(p,["mdia","mdhd"])[0];if(y){c=y.data[y.start],l=c===0?12:20;var m=L(y,l),E=S(p,["mdia","hdlr"])[0];if(E){var M=U(E.data.subarray(E.start+8,E.start+12)),F={soun:I.ElementaryStreamTypes.AUDIO,vide:I.ElementaryStreamTypes.VIDEO}[M];if(F){var j=S(p,["mdia","minf","stbl","stsd"])[0],W=void 0;j&&(W=U(j.data.subarray(j.start+12,j.start+16))),g[a]={timescale:m,type:F},g[F]={timescale:m,id:a,codec:W}}}}}}var D=S(w,["moov","mvex","trex"]);return D.forEach(function(P){var H=L(P,4),Y=g[H];Y&&(Y.default={duration:L(P,12),flags:L(P,20)})}),g}function x(w,g){return S(g,["moof","traf"]).reduce(function(f,_){var p=S(_,["tfdt"])[0],h=p.data[p.start],c=S(_,["tfhd"]).reduce(function(l,a){var y=L(a,4),m=w[y];if(m){var E=L(p,4);h===1&&(E*=Math.pow(2,32),E+=L(p,8));var M=m.timescale||9e4,F=E/M;if(isFinite(F)&&(l===null||F<l))return F}return l},null);return c!==null&&isFinite(c)&&(f===null||c<f)?c:f},null)||0}function v(w,g){for(var f=0,_=0,p=0,h=S(w,["moof","traf"]),c=0;c<h.length;c++){var l=h[c],a=S(l,["tfhd"])[0],y=L(a,4),m=g[y];if(!m)continue;var E=m.default,M=L(a,0)|(E==null?void 0:E.flags),F=E==null?void 0:E.duration;M&8&&(M&2?F=L(a,12):F=L(a,8));for(var j=m.timescale||9e4,W=S(l,["trun"]),D=0;D<W.length;D++){if(F){var P=L(W[D],4);f=F*P}else f=d(W[D]);m.type===I.ElementaryStreamTypes.VIDEO?_+=f/j:m.type===I.ElementaryStreamTypes.AUDIO&&(p+=f/j)}}if(_===0&&p===0){var H=O(w);if(H!=null&&H.references)return H.references.reduce(function(Y,ee){return Y+ee.info.duration||0},0)}return _||p}function d(w){var g=L(w,0),f=8;g&1&&(f+=4),g&4&&(f+=4);for(var _=0,p=L(w,4),h=0;h<p;h++){if(g&256){var c=L(w,f);_+=c,f+=4}g&512&&(f+=4),g&1024&&(f+=4),g&2048&&(f+=4)}return _}function o(w,g,f){S(g,["moof","traf"]).forEach(function(_){S(_,["tfhd"]).forEach(function(p){var h=L(p,4),c=w[h];if(!c)return;var l=c.timescale||9e4;S(_,["tfdt"]).forEach(function(a){var y=a.data[a.start],m=L(a,4);if(y===0)b(a,4,m-f*l);else{m*=Math.pow(2,32),m+=L(a,8),m-=f*l,m=Math.max(m,0);var E=Math.floor(m/(R+1)),M=Math.floor(m%(R+1));b(a,4,E),b(a,8,M)}})})})}function u(w){var g={valid:null,remainder:null},f=S(w,["moof"]);if(f){if(f.length<2)return g.remainder=w,g}else return g;var _=f[f.length-1];return g.valid=Object(G.sliceUint8)(w,0,_.start-8),g.remainder=Object(G.sliceUint8)(w,_.start-8),g}function s(w,g){var f=new Uint8Array(w.length+g.length);return f.set(w),f.set(g,w.length),f}},"./src/utils/output-filter.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return G});var G=function(){function I(B,U){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=B,this.trackName=U}var R=I.prototype;return R.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},R.newCue=function(U,k,L){(this.startTime===null||this.startTime>U)&&(this.startTime=U),this.endTime=k,this.screen=L,this.timelineController.createCaptionsTrack(this.trackName)},R.reset=function(){this.cueRanges=[]},I}()},"./src/utils/texttrack-utils.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"sendAddTrackEvent",function(){return I}),A.d(V,"addCueToTrack",function(){return R}),A.d(V,"clearCurrentCues",function(){return B}),A.d(V,"removeCuesInRange",function(){return U}),A.d(V,"getCuesInRange",function(){return L});var G=A("./src/utils/logger.ts");function I(b,S){var O;try{O=new Event("addtrack")}catch(C){O=document.createEvent("Event"),O.initEvent("addtrack",!1,!1)}O.track=b,S.dispatchEvent(O)}function R(b,S){var O=b.mode;if(O==="disabled"&&(b.mode="hidden"),b.cues&&!b.cues.getCueById(S.id))try{if(b.addCue(S),!b.cues.getCueById(S.id))throw new Error("addCue is failed for: "+S)}catch(x){G.logger.debug("[texttrack-utils]: "+x);var C=new self.TextTrackCue(S.startTime,S.endTime,S.text);C.id=S.id,b.addCue(C)}O==="disabled"&&(b.mode=O)}function B(b){var S=b.mode;if(S==="disabled"&&(b.mode="hidden"),b.cues)for(var O=b.cues.length;O--;)b.removeCue(b.cues[O]);S==="disabled"&&(b.mode=S)}function U(b,S,O){var C=b.mode;if(C==="disabled"&&(b.mode="hidden"),b.cues&&b.cues.length>0)for(var x=L(b.cues,S,O),v=0;v<x.length;v++)b.removeCue(x[v]);C==="disabled"&&(b.mode=C)}function k(b,S){if(S<b[0].startTime)return 0;var O=b.length-1;if(S>b[O].endTime)return-1;for(var C=0,x=O;C<=x;){var v=Math.floor((x+C)/2);if(S<b[v].startTime)x=v-1;else if(S>b[v].startTime&&C<O)C=v+1;else return v}return b[C].startTime-S<S-b[x].startTime?C:x}function L(b,S,O){var C=[],x=k(b,S);if(x>-1)for(var v=x,d=b.length;v<d;v++){var o=b[v];if(o.startTime>=S&&o.endTime<=O)C.push(o);else if(o.startTime>O)return C}return C}},"./src/utils/time-ranges.ts":function(re,V,A){"use strict";A.r(V);var G={toString:function(R){for(var B="",U=R.length,k=0;k<U;k++)B+="["+R.start(k).toFixed(3)+","+R.end(k).toFixed(3)+"]";return B}};V.default=G},"./src/utils/timescale-conversion.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"toTimescaleFromBase",function(){return I}),A.d(V,"toTimescaleFromScale",function(){return R}),A.d(V,"toMsFromMpegTsClock",function(){return B}),A.d(V,"toMpegTsClockFromTimescale",function(){return U});var G=9e4;function I(k,L,b,S){b===void 0&&(b=1),S===void 0&&(S=!1);var O=k*L*b;return S?Math.round(O):O}function R(k,L,b,S){return b===void 0&&(b=1),S===void 0&&(S=!1),I(k,L,1/b,S)}function B(k,L){return L===void 0&&(L=!1),I(k,1e3,1/G,L)}function U(k,L){return L===void 0&&(L=1),I(k,G,1/L)}},"./src/utils/typed-array.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"sliceUint8",function(){return G});function G(I,R,B){return Uint8Array.prototype.slice?I.slice(R,B):new Uint8Array(Array.prototype.slice.call(I,R,B))}},"./src/utils/vttcue.ts":function(re,V,A){"use strict";A.r(V),V.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var G=["","lr","rl"],I=["start","middle","end","left","right"];function R(b,S){if(typeof S!="string")return!1;if(!Array.isArray(b))return!1;var O=S.toLowerCase();return~b.indexOf(O)?O:!1}function B(b){return R(G,b)}function U(b){return R(I,b)}function k(b){for(var S=arguments.length,O=new Array(S>1?S-1:0),C=1;C<S;C++)O[C-1]=arguments[C];for(var x=1;x<arguments.length;x++){var v=arguments[x];for(var d in v)b[d]=v[d]}return b}function L(b,S,O){var C=this,x={enumerable:!0};C.hasBeenReset=!1;var v="",d=!1,o=b,u=S,s=O,w=null,g="",f=!0,_="auto",p="start",h=50,c="middle",l=50,a="middle";Object.defineProperty(C,"id",k({},x,{get:function(){return v},set:function(m){v=""+m}})),Object.defineProperty(C,"pauseOnExit",k({},x,{get:function(){return d},set:function(m){d=!!m}})),Object.defineProperty(C,"startTime",k({},x,{get:function(){return o},set:function(m){if(typeof m!="number")throw new TypeError("Start time must be set to a number.");o=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"endTime",k({},x,{get:function(){return u},set:function(m){if(typeof m!="number")throw new TypeError("End time must be set to a number.");u=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"text",k({},x,{get:function(){return s},set:function(m){s=""+m,this.hasBeenReset=!0}})),Object.defineProperty(C,"region",k({},x,{get:function(){return w},set:function(m){w=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"vertical",k({},x,{get:function(){return g},set:function(m){var E=B(m);if(E===!1)throw new SyntaxError("An invalid or illegal string was specified.");g=E,this.hasBeenReset=!0}})),Object.defineProperty(C,"snapToLines",k({},x,{get:function(){return f},set:function(m){f=!!m,this.hasBeenReset=!0}})),Object.defineProperty(C,"line",k({},x,{get:function(){return _},set:function(m){if(typeof m!="number"&&m!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");_=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"lineAlign",k({},x,{get:function(){return p},set:function(m){var E=U(m);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");p=E,this.hasBeenReset=!0}})),Object.defineProperty(C,"position",k({},x,{get:function(){return h},set:function(m){if(m<0||m>100)throw new Error("Position must be between 0 and 100.");h=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"positionAlign",k({},x,{get:function(){return c},set:function(m){var E=U(m);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");c=E,this.hasBeenReset=!0}})),Object.defineProperty(C,"size",k({},x,{get:function(){return l},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");l=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"align",k({},x,{get:function(){return a},set:function(m){var E=U(m);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");a=E,this.hasBeenReset=!0}})),C.displayState=void 0}return L.prototype.getCueAsHTML=function(){var b=self.WebVTT;return b.convertCueToDOMTree(self,this.text)},L}()},"./src/utils/vttparser.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"parseTimeStamp",function(){return R}),A.d(V,"fixLineBreaks",function(){return S}),A.d(V,"VTTParser",function(){return O});var G=A("./src/utils/vttcue.ts"),I=function(){function C(){}var x=C.prototype;return x.decode=function(d,o){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},C}();function R(C){function x(d,o,u,s){return(d|0)*3600+(o|0)*60+(u|0)+parseFloat(s||0)}var v=C.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return v?parseFloat(v[2])>59?x(v[2],v[3],0,v[4]):x(v[1],v[2],v[3],v[4]):null}var B=function(){function C(){this.values=Object.create(null)}var x=C.prototype;return x.set=function(d,o){!this.get(d)&&o!==""&&(this.values[d]=o)},x.get=function(d,o,u){return u?this.has(d)?this.values[d]:o[u]:this.has(d)?this.values[d]:o},x.has=function(d){return d in this.values},x.alt=function(d,o,u){for(var s=0;s<u.length;++s)if(o===u[s]){this.set(d,o);break}},x.integer=function(d,o){/^-?\d+$/.test(o)&&this.set(d,parseInt(o,10))},x.percent=function(d,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var u=parseFloat(o);if(u>=0&&u<=100)return this.set(d,u),!0}return!1},C}();function U(C,x,v,d){var o=d?C.split(d):[C];for(var u in o){if(typeof o[u]!="string")continue;var s=o[u].split(v);if(s.length!==2)continue;var w=s[0],g=s[1];x(w,g)}}var k=new G.default(0,0,""),L=k.align==="middle"?"middle":"center";function b(C,x,v){var d=C;function o(){var w=R(C);if(w===null)throw new Error("Malformed timestamp: "+d);return C=C.replace(/^[^\sa-zA-Z-]+/,""),w}function u(w,g){var f=new B;U(w,function(h,c){var l;switch(h){case"region":for(var a=v.length-1;a>=0;a--)if(v[a].id===c){f.set(h,v[a].region);break}break;case"vertical":f.alt(h,c,["rl","lr"]);break;case"line":l=c.split(","),f.integer(h,l[0]),f.percent(h,l[0])&&f.set("snapToLines",!1),f.alt(h,l[0],["auto"]),l.length===2&&f.alt("lineAlign",l[1],["start",L,"end"]);break;case"position":l=c.split(","),f.percent(h,l[0]),l.length===2&&f.alt("positionAlign",l[1],["start",L,"end","line-left","line-right","auto"]);break;case"size":f.percent(h,c);break;case"align":f.alt(h,c,["start",L,"end","left","right"]);break}},/:/,/\s/),g.region=f.get("region",null),g.vertical=f.get("vertical","");var _=f.get("line","auto");_==="auto"&&k.line===-1&&(_=-1),g.line=_,g.lineAlign=f.get("lineAlign","start"),g.snapToLines=f.get("snapToLines",!0),g.size=f.get("size",100),g.align=f.get("align",L);var p=f.get("position","auto");p==="auto"&&k.position===50&&(p=g.align==="start"||g.align==="left"?0:g.align==="end"||g.align==="right"?100:50),g.position=p}function s(){C=C.replace(/^\s+/,"")}if(s(),x.startTime=o(),s(),C.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);C=C.substr(3),s(),x.endTime=o(),s(),u(C,x)}function S(C){return C.replace(/<br(?: \/)?>/gi,`
`)}var O=function(){function C(){this.state="INITIAL",this.buffer="",this.decoder=new I,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var x=C.prototype;return x.parse=function(d){var o=this;d&&(o.buffer+=o.decoder.decode(d,{stream:!0}));function u(){var p=o.buffer,h=0;for(p=S(p);h<p.length&&p[h]!=="\r"&&p[h]!==`
`;)++h;var c=p.substr(0,h);return p[h]==="\r"&&++h,p[h]===`
`&&++h,o.buffer=p.substr(h),c}function s(p){U(p,function(h,c){},/:/)}try{var w="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;w=u();var g=w.match(/^()?WEBVTT([ \t].*)?$/);if(!g||!g[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var f=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;f?f=!1:w=u();switch(o.state){case"HEADER":/:/.test(w)?s(w):w||(o.state="ID");continue;case"NOTE":w||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(w)){o.state="NOTE";break}if(!w)continue;if(o.cue=new G.default(0,0,""),o.state="CUE",w.indexOf("-->")===-1){o.cue.id=w;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{b(w,o.cue,o.regionList)}catch(p){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var _=w.indexOf("-->")!==-1;if(!w||_&&(f=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
`),o.cue.text+=w}continue;case"BADCUE":w||(o.state="ID")}}}catch(p){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},x.flush=function(){var d=this;try{if((d.cue||d.state==="HEADER")&&(d.buffer+=`
`,d.parse()),d.state==="INITIAL"||d.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){d.onparsingerror&&d.onparsingerror(o)}return d.onflush&&d.onflush(),this},C}()},"./src/utils/webvtt-parser.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"generateCueId",function(){return O}),A.d(V,"parseWebVTT",function(){return x});var G=A("./src/polyfills/number.ts"),I=A("./src/utils/vttparser.ts"),R=A("./src/demux/id3.ts"),B=A("./src/utils/timescale-conversion.ts"),U=A("./src/remux/mp4-remuxer.ts"),k=/\r\n|\n\r|\n|\r/g,L=function(d,o,u){return u===void 0&&(u=0),d.substr(u,o.length)===o},b=function(d){var o=parseInt(d.substr(-3)),u=parseInt(d.substr(-6,2)),s=parseInt(d.substr(-9,2)),w=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(G.isFiniteNumber)(o)||!Object(G.isFiniteNumber)(u)||!Object(G.isFiniteNumber)(s)||!Object(G.isFiniteNumber)(w))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return o+=1e3*u,o+=60*1e3*s,o+=60*60*1e3*w,o},S=function(d){for(var o=5381,u=d.length;u;)o=o*33^d.charCodeAt(--u);return(o>>>0).toString()};function O(v,d,o){return S(v.toString())+S(d.toString())+S(o)}var C=function(d,o,u){var s=d[o],w=d[s.prevCC];if(!w||!w.new&&s.new){d.ccOffset=d.presentationOffset=s.start,s.new=!1;return}for(;(g=w)!==null&&g!==void 0&&g.new;){var g;d.ccOffset+=s.start-w.start,s.new=!1,s=w,w=d[s.prevCC]}d.presentationOffset=u};function x(v,d,o,u,s,w,g,f){var _=new I.VTTParser,p=Object(R.utf8ArrayToStr)(new Uint8Array(v)).trim().replace(k,`
`).split(`
`),h=[],c=Object(B.toMpegTsClockFromTimescale)(d,o),l="00:00.000",a=0,y=0,m,E=!0,M=!1;_.oncue=function(F){var j=u[s],W=u.ccOffset,D=(a-c)/9e4;if(j!=null&&j.new&&(y!==void 0?W=u.ccOffset=j.start:C(u,s,D)),D&&(W=D-u.presentationOffset),M){var P=F.endTime-F.startTime,H=Object(U.normalizePts)((F.startTime+W-y)*9e4,w*9e4)/9e4;F.startTime=H,F.endTime=H+P}var Y=F.text.trim();F.text=decodeURIComponent(encodeURIComponent(Y)),F.id||(F.id=O(F.startTime,F.endTime,Y)),F.endTime>0&&h.push(F)},_.onparsingerror=function(F){m=F},_.onflush=function(){if(m){f(m);return}g(h)},p.forEach(function(F){if(E)if(L(F,"X-TIMESTAMP-MAP=")){E=!1,M=!0,F.substr(16).split(",").forEach(function(j){L(j,"LOCAL:")?l=j.substr(6):L(j,"MPEGTS:")&&(a=parseInt(j.substr(7)))});try{y=b(l)/1e3}catch(j){M=!1,m=j}return}else F===""&&(E=!1);_.parse(F+`
`)}),_.flush()}},"./src/utils/xhr-loader.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/utils/logger.ts"),I=A("./src/loader/load-stats.ts"),R=/^age:\s*[\d.]+\s*$/m,B=function(){function U(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=U.prototype;return k.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},k.abortInternal=function(){var b=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),b&&(b.onreadystatechange=null,b.onprogress=null,b.readyState!==4&&(this.stats.aborted=!0,b.abort()))},k.abort=function(){var b;this.abortInternal(),(b=this.callbacks)!==null&&b!==void 0&&b.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},k.load=function(b,S,O){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=b,this.config=S,this.callbacks=O,this.retryDelay=S.retryDelay,this.loadInternal()},k.loadInternal=function(){var b=this.config,S=this.context;if(!b)return;var O=this.loader=new self.XMLHttpRequest,C=this.stats;C.loading.first=0,C.loaded=0;var x=this.xhrSetup;try{if(x)try{x(O,S.url)}catch(o){O.open("GET",S.url,!0),x(O,S.url)}O.readyState||O.open("GET",S.url,!0);var v=this.context.headers;if(v)for(var d in v)O.setRequestHeader(d,v[d])}catch(o){this.callbacks.onError({code:O.status,text:o.message},S,O);return}S.rangeEnd&&O.setRequestHeader("Range","bytes="+S.rangeStart+"-"+(S.rangeEnd-1)),O.onreadystatechange=this.readystatechange.bind(this),O.onprogress=this.loadprogress.bind(this),O.responseType=S.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),b.timeout),O.send()},k.readystatechange=function(){var b=this.context,S=this.loader,O=this.stats;if(!b||!S)return;var C=S.readyState,x=this.config;if(O.aborted)return;if(C>=2)if(self.clearTimeout(this.requestTimeout),O.loading.first===0&&(O.loading.first=Math.max(self.performance.now(),O.loading.start)),C===4){S.onreadystatechange=null,S.onprogress=null;var v=S.status;if(v>=200&&v<300){O.loading.end=Math.max(self.performance.now(),O.loading.first);var d,o;if(b.responseType==="arraybuffer"?(d=S.response,o=d.byteLength):(d=S.responseText,o=d.length),O.loaded=O.total=o,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(O,b,d,S),!this.callbacks)return;var s={url:S.responseURL,data:d};this.callbacks.onSuccess(s,O,b,S)}else O.retry>=x.maxRetry||v>=400&&v<499?(G.logger.error(v+" while loading "+b.url),this.callbacks.onError({code:v,text:S.statusText},b,S)):(G.logger.warn(v+" while loading "+b.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,x.maxRetryDelay),O.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),x.timeout)},k.loadtimeout=function(){G.logger.warn("timeout while loading "+this.context.url);var b=this.callbacks;b&&(this.abortInternal(),b.onTimeout(this.stats,this.context,this.loader))},k.loadprogress=function(b){var S=this.stats;S.loaded=b.loaded,b.lengthComputable&&(S.total=b.total)},k.getCacheAge=function(){var b=null;if(this.loader&&R.test(this.loader.getAllResponseHeaders())){var S=this.loader.getResponseHeader("age");b=S?parseFloat(S):null}return b},U}();V.default=B}}).default})},vHTk:function(st,Ke,q){st.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wzkS:function(st,Ke,q){"use strict";q.d(Ke,"c",function(){return I}),q.d(Ke,"b",function(){return R}),q.d(Ke,"d",function(){return B}),q.d(Ke,"a",function(){return k}),q.d(Ke,"e",function(){return L});var re=q("9og8"),V=q("WmNS"),A=q.n(V),G=q("ErOA");function I(b){return Object(G.c)("libraries/".concat(b,".json"))}function R(){return Object(G.c)("library_tags.json")}function B(b){return U.apply(this,arguments)}function U(){return U=Object(re.a)(A.a.mark(function b(S){var O;return A.a.wrap(function(x){for(;;)switch(x.prev=x.next){case 0:return x.next=2,Object(G.b)("attachments/".concat(S,".json"));case 2:return O=x.sent,x.abrupt("return",O.status===0);case 4:case"end":return x.stop()}},b)})),U.apply(this,arguments)}function k(b){return Object(G.f)("libraries.json",b)}function L(b,S){return Object(G.g)("libraries/".concat(b,".json"),S)}},y5JW:function(st,Ke,q){"use strict";q.d(Ke,"c",function(){return v}),q.d(Ke,"a",function(){return d});var re=q("DZo9"),V=q("8z0m"),A=q("+L6B"),G=q("2/Rp"),I=q("9og8"),R=q("miYZ"),B=q("tsqr"),U=q("k1fw"),k=q("oBTY"),L=q("WmNS"),b=q.n(L),S=q("cDcd"),O=q.n(S),C=q("m3rI"),x=q("wzkS"),v="\u3000\u3000";function d(o){var u=["Bytes","KB","MB","GB","TB"];if(o==0)return"0 Byte";var s=parseInt(""+Math.floor(Math.log(o)/Math.log(1024)),10);return(o/Math.pow(1024,s)).toFixed(1)+" "+u[s]}Ke.b=function(o){var u=o.value,s=u===void 0?[]:u,w=o.action,g=o.onChange,f=o.className,_=o.maxSize,p=_===void 0?150:_,h=o.title,c=h===void 0?"\u6587\u4EF6\u4E0A\u4F20":h,l=o.accept,a=l===void 0?null:l,y={multiple:!1,fileList:s,accept:a,withCredentials:!0,beforeUpload:function(M){var F=M.size/1024/1024;return!0},action:"".concat(C.a.API_SERVER,"/api/attachments.json"),onChange:function(M){var F,j,W=Object(k.a)(M.fileList);if(W=W.map(function(H){return H.name.indexOf(v)===-1&&(H.name="".concat(H.name).concat(v).concat(d(H.size))),Object(U.a)({},H)}),M.file.status==="done"&&((F=M.file)===null||F===void 0||((j=F.response)===null||j===void 0)?void 0:j.status)===-1){var D,P;B.b.error((D=M.file)===null||D===void 0||((P=D.response)===null||P===void 0)?void 0:P.message),g([]);return}g(W)},onRemove:function(){var E=Object(I.a)(b.a.mark(function F(j){var W,D,P;return b.a.wrap(function(Y){for(;;)switch(Y.prev=Y.next){case 0:if(W=j.size/1024/1024,!(j.status==="uploading")){Y.next=3;break}return Y.abrupt("return",!0);case 3:if(W<p){Y.next=7;break}return Y.abrupt("return",!0);case 7:if(D=j.response?j.response.id:j.uid,!D){Y.next=15;break}return Y.next=11,Object(x.d)(j.response?j.response.id:j.id);case 11:return P=Y.sent,Y.abrupt("return",P);case 15:return Y.abrupt("return",!0);case 16:case"end":return Y.stop()}},F)}));function M(F){return E.apply(this,arguments)}return M}()};function m(E){E.preventDefault(),E.stopPropagation()}return O.a.createElement("div",{className:"single-upload ".concat(f||"")},O.a.createElement(V.a,y,O.a.createElement(G.a,{type:"primary",title:s.length>0?"\u6BCF\u6B21\u53EA\u80FD\u4E0A\u4F20\u4E00\u4E2A\u8D44\u6E90\uFF0C \u5220\u9664\u4E0B\u9762\u8D44\u6E90\u53EF\u91CD\u65B0\u4E0A\u4F20 ":"",disabled:s.length>0,ghost:!0},c),O.a.createElement("span",{onClick:m,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",p,"M)"," ")))}}}]);