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__Forums__Detail.bf4fa101....

139 lines
777 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[145,5,7,8],{"+NIl":function(ut,$e,J){(function(re){re(J("VrN/"))})(function(re){"use strict";re.defineMode("stex",function(z,L){"use strict";function H(A,_){A.cmdState.push(_)}function k(A){return A.cmdState.length>0?A.cmdState[A.cmdState.length-1]:null}function P(A){var _=A.cmdState.pop();_&&_.closeBracket()}function F(A){for(var _=A.cmdState,b=_.length-1;b>=0;b--){var d=_[b];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function M(A,_,b){return function(){this.name=A,this.bracketNo=0,this.style=_,this.styles=b,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var D={};D.importmodule=M("importmodule","tag",["string","builtin"]),D.documentclass=M("documentclass","tag",["","atom"]),D.usepackage=M("usepackage","tag",["atom"]),D.begin=M("begin","tag",["atom"]),D.end=M("end","tag",["atom"]),D.label=M("label","tag",["atom"]),D.ref=M("ref","tag",["atom"]),D.eqref=M("eqref","tag",["atom"]),D.cite=M("cite","tag",["atom"]),D.bibitem=M("bibitem","tag",["atom"]),D.Bibitem=M("Bibitem","tag",["atom"]),D.RBibitem=M("RBibitem","tag",["atom"]),D.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function R(A,_){A.f=_}function E(A,_){var b;if(A.match(/^\\[a-zA-Z@]+/)){var d=A.current().slice(1);return b=D.hasOwnProperty(d)?D[d]:D.DEFAULT,b=new b,H(_,b),R(_,T),b.style}if(A.match(/^\\[$&%#{}_]/))return"tag";if(A.match(/^\\[,;!\/\\]/))return"tag";if(A.match("\\["))return R(_,function(u,l){return w(u,l,"\\]")}),"keyword";if(A.match("\\("))return R(_,function(u,l){return w(u,l,"\\)")}),"keyword";if(A.match("$$"))return R(_,function(u,l){return w(u,l,"$$")}),"keyword";if(A.match("$"))return R(_,function(u,l){return w(u,l,"$")}),"keyword";var s=A.next();if(s=="%")return A.skipToEnd(),"comment";if(s=="}"||s=="]"){if(b=k(_),b)b.closeBracket(s),R(_,T);else return"error";return"bracket"}else return s=="{"||s=="["?(b=D.DEFAULT,b=new b,H(_,b),"bracket"):/\d/.test(s)?(A.eatWhile(/[\w.%]/),"atom"):(A.eatWhile(/[\w\-_]/),b=F(_),b.name=="begin"&&(b.argument=A.current()),b.styleIdentifier())}function w(A,_,b){if(A.eatSpace())return null;if(b&&A.match(b))return R(_,E),"keyword";if(A.match(/^\\[a-zA-Z@]+/))return"tag";if(A.match(/^[a-zA-Z]+/))return"variable-2";if(A.match(/^\\[$&%#{}_]/))return"tag";if(A.match(/^\\[,;!\/]/))return"tag";if(A.match(/^[\^_&]/))return"tag";if(A.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(A.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=A.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(A.skipToEnd(),"comment"):"error"}function T(A,_){var b=A.peek(),d;return b=="{"||b=="["?(d=k(_),d.openBracket(b),A.eat(b),R(_,E),"bracket"):/[ \t\r]/.test(b)?(A.eat(b),null):(R(_,E),P(_),E(A,_))}return{startState:function(){var A=L.inMathMode?function(_,b){return w(_,b)}:E;return{cmdState:[],f:A}},copyState:function(A){return{cmdState:A.cmdState.slice(),f:A.f}},token:function(A,_){return _.f(A,_)},blankLine:function(A){A.f=E,A.cmdState.length=0},lineComment:"%"}}),re.defineMIME("text/x-stex","stex"),re.defineMIME("text/x-latex","stex")})},"19Vz":function(ut,$e,J){(function(re){re(J("VrN/"))})(function(re){re.defineOption("placeholder","",function(M,D,R){var E=R&&R!=re.Init;if(D&&!E)M.on("blur",k),M.on("change",P),M.on("swapDoc",P),re.on(M.getInputField(),"compositionupdate",M.state.placeholderCompose=function(){H(M)}),P(M);else if(!D&&E){M.off("blur",k),M.off("change",P),M.off("swapDoc",P),re.off(M.getInputField(),"compositionupdate",M.state.placeholderCompose),z(M);var w=M.getWrapperElement();w.className=w.className.replace(" CodeMirror-empty","")}D&&!M.hasFocus()&&k(M)});function z(M){M.state.placeholder&&(M.state.placeholder.parentNode.removeChild(M.state.placeholder),M.state.placeholder=null)}function L(M){z(M);var D=M.state.placeholder=document.createElement("pre");D.style.cssText="height: 0; overflow: visible",D.style.direction=M.getOption("direction"),D.className="CodeMirror-placeholder CodeMirror-line-like";var R=M.getOption("placeholder");typeof R=="string"&&(R=document.createTextNode(R)),D.appendChild(R),M.display.lineSpace.insertBefore(D,M.display.lineSpace.firstChild)}function H(M){setTimeout(function(){var D=!1,R=M.getInputField();R.nodeName=="TEXTAREA"?D=!R.value:M.lineCount()==1&&(D=!/[^\u200b]/.test(R.querySelector(".CodeMirror-line").textContent)),D?L(M):z(M)},20)}function k(M){F(M)&&L(M)}function P(M){var D=M.getWrapperElement(),R=F(M);D.className=D.className.replace(" CodeMirror-empty","")+(R?" CodeMirror-empty":""),R?L(M):z(M)}function F(M){return M.lineCount()===1&&M.getLine(0)===""}})},"1eCo":function(ut,$e,J){(function(re){re(J("VrN/"))})(function(re){"use strict";var z={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},L={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};re.defineMode("xml",function(H,k){var P=H.indentUnit,F={},M=k.htmlMode?z:L;for(var D in M)F[D]=M[D];for(var D in k)F[D]=k[D];var R,E;function w(a,m){function p(U){return m.tokenize=U,U(a,m)}var v=a.next();if(v=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?p(_("atom","]]>")):null:a.match("--")?p(_("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),p(b(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),m.tokenize=_("meta","?>"),"meta"):(R=a.eat("/")?"closeTag":"openTag",m.tokenize=T,"tag bracket");if(v=="&"){var O;return a.eat("#")?a.eat("x")?O=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):O=a.eatWhile(/[\d]/)&&a.eat(";"):O=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),O?"atom":"error"}else return a.eatWhile(/[^&<]/),null}w.isInText=!0;function T(a,m){var p=a.next();if(p==">"||p=="/"&&a.eat(">"))return m.tokenize=w,R=p==">"?"endTag":"selfcloseTag","tag bracket";if(p=="=")return R="equals",null;if(p=="<"){m.tokenize=w,m.state=l,m.tagName=m.tagStart=null;var v=m.tokenize(a,m);return v?v+" tag error":"tag error"}else return/[\'\"]/.test(p)?(m.tokenize=A(p),m.stringStartCol=a.column(),m.tokenize(a,m)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function A(a){var m=function(p,v){for(;!p.eol();)if(p.next()==a){v.tokenize=T;break}return"string"};return m.isInAttribute=!0,m}function _(a,m){return function(p,v){for(;!p.eol();){if(p.match(m)){v.tokenize=w;break}p.next()}return a}}function b(a){return function(m,p){for(var v;(v=m.next())!=null;){if(v=="<")return p.tokenize=b(a+1),p.tokenize(m,p);if(v==">")if(a==1){p.tokenize=w;break}else return p.tokenize=b(a-1),p.tokenize(m,p)}return"meta"}}function d(a,m,p){this.prev=a.context,this.tagName=m,this.indent=a.indented,this.startOfLine=p,(F.doNotIndent.hasOwnProperty(m)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function s(a){a.context&&(a.context=a.context.prev)}function u(a,m){for(var p;;){if(!a.context)return;if(p=a.context.tagName,!F.contextGrabbers.hasOwnProperty(p)||!F.contextGrabbers[p].hasOwnProperty(m))return;s(a)}}function l(a,m,p){return a=="openTag"?(p.tagStart=m.column(),S):a=="closeTag"?h:l}function S(a,m,p){return a=="word"?(p.tagName=m.current(),E="tag",y):F.allowMissingTagName&&a=="endTag"?(E="tag bracket",y(a,m,p)):(E="error",S)}function h(a,m,p){if(a=="word"){var v=m.current();return p.context&&p.context.tagName!=v&&F.implicitlyClosed.hasOwnProperty(p.context.tagName)&&s(p),p.context&&p.context.tagName==v||F.matchClosing===!1?(E="tag",g):(E="tag error",C)}else return F.allowMissingTagName&&a=="endTag"?(E="tag bracket",g(a,m,p)):(E="error",C)}function g(a,m,p){return a!="endTag"?(E="error",g):(s(p),l)}function C(a,m,p){return E="error",g(a,m,p)}function y(a,m,p){if(a=="word")return E="attribute",f;if(a=="endTag"||a=="selfcloseTag"){var v=p.tagName,O=p.tagStart;return p.tagName=p.tagStart=null,a=="selfcloseTag"||F.autoSelfClosers.hasOwnProperty(v)?u(p,v):(u(p,v),p.context=new d(p,v,O==p.indented)),l}return E="error",y}function f(a,m,p){return a=="equals"?c:(F.allowMissing||(E="error"),y(a,m,p))}function c(a,m,p){return a=="string"?o:a=="word"&&F.allowUnquoted?(E="string",y):(E="error",y(a,m,p))}function o(a,m,p){return a=="string"?o:y(a,m,p)}return{startState:function(a){var m={tokenize:w,state:l,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(m.baseIndent=a),m},token:function(a,m){if(!m.tagName&&a.sol()&&(m.indented=a.indentation()),a.eatSpace())return null;R=null;var p=m.tokenize(a,m);return(p||R)&&p!="comment"&&(E=null,m.state=m.state(R||p,a,m),E&&(p=E=="error"?p+" error":E)),p},indent:function(a,m,p){var v=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+P;if(v&&v.noIndent)return re.Pass;if(a.tokenize!=T&&a.tokenize!=w)return p?p.match(/^(\s*)/)[0].length:0;if(a.tagName)return F.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+P*(F.multilineTagIndentFactor||1);if(F.alignCDATA&&/<!\[CDATA\[/.test(m))return 0;var O=m&&/^<(\/)?([\w_:\.-]*)/.exec(m);if(O&&O[1])for(;v;)if(v.tagName==O[2]){v=v.prev;break}else if(F.implicitlyClosed.hasOwnProperty(v.tagName))v=v.prev;else break;else if(O)for(;v;){var U=F.contextGrabbers[v.tagName];if(U&&U.hasOwnProperty(O[2]))v=v.prev;else break}for(;v&&v.prev&&!v.startOfLine;)v=v.prev;return v?v.indent+P:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:F.htmlMode?"html":"xml",helperType:F.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=y)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var m=[],p=a.context;p;p=p.prev)p.tagName&&m.push(p.tagName);return m.reverse()}}}),re.defineMIME("text/xml","xml"),re.defineMIME("application/xml","xml"),re.mimeModes.hasOwnProperty("text/html")||re.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"55Ip":function(ut,$e,J){"use strict";J.d($e,"a",function(){return u});var re=J("Ty5D"),z=J("dI71"),L=J("q1tI"),H=J.n(L),k=J("YS25"),P=J("17x9"),F=J.n(P),M=J("wx14"),D=J("zLVn"),R=J("9R94"),E=function(c){Object(z.a)(o,c);function o(){for(var m,p=arguments.length,v=new Array(p),O=0;O<p;O++)v[O]=arguments[O];return m=c.call.apply(c,[this].concat(v))||this,m.history=Object(k.a)(m.props),m}var a=o.prototype;return a.render=function(){return H.a.createElement(re.c,{history:this.history,children:this.props.children})},o}(H.a.Component),w=function(c){Object(z.a)(o,c);function o(){for(var m,p=arguments.length,v=new Array(p),O=0;O<p;O++)v[O]=arguments[O];return m=c.call.apply(c,[this].concat(v))||this,m.history=Object(k.b)(m.props),m}var a=o.prototype;return a.render=function(){return H.a.createElement(re.c,{history:this.history,children:this.props.children})},o}(H.a.Component),T=function(o,a){return typeof o=="function"?o(a):o},A=function(o,a){return typeof o=="string"?Object(k.c)(o,null,null,a):o},_=function(o){return o},b=H.a.forwardRef;typeof b=="undefined"&&(b=_);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var s=b(function(c,o){var a=c.innerRef,m=c.navigate,p=c.onClick,v=Object(D.a)(c,["innerRef","navigate","onClick"]),O=v.target,U=Object(M.a)({},v,{onClick:function(G){try{p&&p(G)}catch(B){throw G.preventDefault(),B}!G.defaultPrevented&&G.button===0&&(!O||O==="_self")&&!d(G)&&(G.preventDefault(),m())}});return _!==b?U.ref=o||a:U.ref=a,H.a.createElement("a",U)}),u=b(function(c,o){var a=c.component,m=a===void 0?s:a,p=c.replace,v=c.to,O=c.innerRef,U=Object(D.a)(c,["component","replace","to","innerRef"]);return H.a.createElement(re.e.Consumer,null,function(j){j||Object(R.a)(!1);var G=j.history,B=A(T(v,j.location),j.location),N=B?G.createHref(B):"",V=Object(M.a)({},U,{href:N,navigate:function(){var ie=T(v,j.location),oe=p?G.replace:G.push;oe(ie)}});return _!==b?V.ref=o||O:V.innerRef=O,H.a.createElement(m,V)})});if(!1)var l,S;var h=function(o){return o},g=H.a.forwardRef;typeof g=="undefined"&&(g=h);function C(){for(var c=arguments.length,o=new Array(c),a=0;a<c;a++)o[a]=arguments[a];return o.filter(function(m){return m}).join(" ")}var y=g(function(c,o){var a=c["aria-current"],m=a===void 0?"page":a,p=c.activeClassName,v=p===void 0?"active":p,O=c.activeStyle,U=c.className,j=c.exact,G=c.isActive,B=c.location,N=c.sensitive,V=c.strict,$=c.style,ie=c.to,oe=c.innerRef,_e=Object(D.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return H.a.createElement(re.e.Consumer,null,function(fe){fe||Object(R.a)(!1);var Se=B||fe.location,be=A(T(ie,Se),Se),me=be.pathname,le=me&&me.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),ue=le?Object(re.f)(Se.pathname,{path:le,exact:j,sensitive:N,strict:V}):null,Ee=!!(G?G(ue,Se):ue),Ge=Ee?C(U,v):U,Te=Ee?Object(M.a)({},$,{},O):$,pe=Object(M.a)({"aria-current":Ee&&m||null,className:Ge,style:Te,to:be},_e);return h!==g?pe.ref=o||oe:pe.innerRef=oe,H.a.createElement(u,pe)})});if(!1)var f},"6+eU":function(ut,$e,J){"use strict";J.d($e,"a",function(){return g});var re=J("wx14"),z=J("rePB"),L=J("VTBJ"),H=J("1OyB"),k=J("vuIU"),P=J("Ji7U"),F=J("LK+K"),M=J("q1tI"),D=J.n(M),R=J("TSYQ"),E=J.n(R),w=function(y){var f,c="".concat(y.rootPrefixCls,"-item"),o=E()(c,"".concat(c,"-").concat(y.page),(f={},Object(z.a)(f,"".concat(c,"-active"),y.active),Object(z.a)(f,y.className,!!y.className),Object(z.a)(f,"".concat(c,"-disabled"),!y.page),f)),a=function(){y.onClick(y.page)},m=function(v){y.onKeyPress(v,y.onClick,y.page)};return D.a.createElement("li",{title:y.showTitle?y.page:null,className:o,onClick:a,onKeyPress:m,tabIndex:"0"},y.itemRender(y.page,"page",D.a.createElement("a",{rel:"nofollow"},y.page)))},T=w,A={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},_=function(C){Object(P.a)(f,C);var y=Object(F.a)(f);function f(){var c;Object(H.a)(this,f);for(var o=arguments.length,a=new Array(o),m=0;m<o;m++)a[m]=arguments[m];return c=y.call.apply(y,[this].concat(a)),c.state={goInputText:""},c.buildOptionText=function(p){return"".concat(p," ").concat(c.props.locale.items_per_page)},c.changeSize=function(p){c.props.changeSize(Number(p))},c.handleChange=function(p){c.setState({goInputText:p.target.value})},c.handleBlur=function(p){var v=c.props,O=v.goButton,U=v.quickGo,j=v.rootPrefixCls,G=c.state.goInputText;if(O||G==="")return;if(p.relatedTarget&&(p.relatedTarget.className.indexOf("".concat(j,"-prev"))>=0||p.relatedTarget.className.indexOf("".concat(j,"-next"))>=0))return;c.setState({goInputText:""}),U(c.getValidValue())},c.go=function(p){var v=c.state.goInputText;if(v==="")return;(p.keyCode===A.ENTER||p.type==="click")&&(c.setState({goInputText:""}),c.props.quickGo(c.getValidValue()))},c}return Object(k.a)(f,[{key:"getValidValue",value:function(){var o=this.state,a=o.goInputText,m=o.current;return!a||isNaN(a)?m:Number(a)}},{key:"getPageSizeOptions",value:function(){var o=this.props,a=o.pageSize,m=o.pageSizeOptions;return m.some(function(p){return p.toString()===a.toString()})?m:m.concat([a.toString()]).sort(function(p,v){var O=isNaN(Number(p))?0:Number(p),U=isNaN(Number(v))?0:Number(v);return O-U})}},{key:"render",value:function(){var o=this,a=this.props,m=a.pageSize,p=a.locale,v=a.rootPrefixCls,O=a.changeSize,U=a.quickGo,j=a.goButton,G=a.selectComponentClass,B=a.buildOptionText,N=a.selectPrefixCls,V=a.disabled,$=this.state.goInputText,ie="".concat(v,"-options"),oe=G,_e=null,fe=null,Se=null;if(!O&&!U)return null;var be=this.getPageSizeOptions();if(O&&oe){var me=be.map(function(le,ue){return D.a.createElement(oe.Option,{key:ue,value:le.toString()},(B||o.buildOptionText)(le))});_e=D.a.createElement(oe,{disabled:V,prefixCls:N,showSearch:!1,className:"".concat(ie,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(m||be[0]).toString(),onChange:this.changeSize,getPopupContainer:function(ue){return ue.parentNode}},me)}return U&&(j&&(Se=typeof j=="boolean"?D.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:V,className:"".concat(ie,"-quick-jumper-button")},p.jump_to_confirm):D.a.createElement("span",{onClick:this.go,onKeyUp:this.go},j)),fe=D.a.createElement("div",{className:"".concat(ie,"-quick-jumper")},p.jump_to,D.a.createElement("input",{disabled:V,type:"text",value:$,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),p.page,Se)),D.a.createElement("li",{className:"".concat(ie)},_e,fe)}}]),f}(D.a.Component);_.defaultProps={pageSizeOptions:["10","20","50","100"]};var b=_,d=J("N2Kk");function s(){}function u(C){return typeof C=="number"&&isFinite(C)&&Math.floor(C)===C}function l(C,y,f){return f}function S(C,y,f){var c=typeof C=="undefined"?y.pageSize:C;return Math.floor((f.total-1)/c)+1}var h=function(C){Object(P.a)(f,C);var y=Object(F.a)(f);function f(c){var o;Object(H.a)(this,f),o=y.call(this,c),o.getJumpPrevPage=function(){return Math.max(1,o.state.current-(o.props.showLessItems?3:5))},o.getJumpNextPage=function(){return Math.min(S(void 0,o.state,o.props),o.state.current+(o.props.showLessItems?3:5))},o.getItemIcon=function(O,U){var j=o.props.prefixCls,G=O||D.a.createElement("button",{type:"button","aria-label":U,className:"".concat(j,"-item-link")});return typeof O=="function"&&(G=D.a.createElement(O,Object(L.a)({},o.props))),G},o.savePaginationNode=function(O){o.paginationNode=O},o.isValid=function(O){return u(O)&&O!==o.state.current},o.shouldDisplayQuickJumper=function(){var O=o.props,U=O.showQuickJumper,j=O.pageSize,G=O.total;return G<=j?!1:U},o.handleKeyDown=function(O){(O.keyCode===A.ARROW_UP||O.keyCode===A.ARROW_DOWN)&&O.preventDefault()},o.handleKeyUp=function(O){var U=o.getValidValue(O),j=o.state.currentInputValue;U!==j&&o.setState({currentInputValue:U}),O.keyCode===A.ENTER?o.handleChange(U):O.keyCode===A.ARROW_UP?o.handleChange(U-1):O.keyCode===A.ARROW_DOWN&&o.handleChange(U+1)},o.changePageSize=function(O){var U=o.state.current,j=S(O,o.state,o.props);U=U>j?j:U,j===0&&(U=o.state.current),typeof O=="number"&&("pageSize"in o.props||o.setState({pageSize:O}),"current"in o.props||o.setState({current:U,currentInputValue:U})),o.props.onShowSizeChange(U,O),"onChange"in o.props&&o.props.onChange&&o.props.onChange(U,O)},o.handleChange=function(O){var U=o.props.disabled,j=O;if(o.isValid(j)&&!U){var G=S(void 0,o.state,o.props);j>G?j=G:j<1&&(j=1),"current"in o.props||o.setState({current:j,currentInputValue:j});var B=o.state.pageSize;return o.props.onChange(j,B),j}return o.state.current},o.prev=function(){o.hasPrev()&&o.handleChange(o.state.current-1)},o.next=function(){o.hasNext()&&o.handleChange(o.state.current+1)},o.jumpPrev=function(){o.handleChange(o.getJumpPrevPage())},o.jumpNext=function(){o.handleChange(o.getJumpNextPage())},o.hasPrev=function(){return o.state.current>1},o.hasNext=function(){return o.state.current<S(void 0,o.state,o.props)},o.runIfEnter=function(O,U){if(O.key==="Enter"||O.charCode===13){for(var j=arguments.length,G=new Array(j>2?j-2:0),B=2;B<j;B++)G[B-2]=arguments[B];U.apply(void 0,G)}},o.runIfEnterPrev=function(O){o.runIfEnter(O,o.prev)},o.runIfEnterNext=function(O){o.runIfEnter(O,o.next)},o.runIfEnterJumpPrev=function(O){o.runIfEnter(O,o.jumpPrev)},o.runIfEnterJumpNext=function(O){o.runIfEnter(O,o.jumpNext)},o.handleGoTO=function(O){(O.keyCode===A.ENTER||O.type==="click")&&o.handleChange(o.state.currentInputValue)};var a=c.onChange!==s,m="current"in c;m&&!a&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var p=c.defaultCurrent;"current"in c&&(p=c.current);var v=c.defaultPageSize;return"pageSize"in c&&(v=c.pageSize),p=Math.min(p,S(v,void 0,c)),o.state={current:p,currentInputValue:p,pageSize:v},o}return Object(k.a)(f,[{key:"componentDidUpdate",value:function(o,a){var m=this.props.prefixCls;if(a.current!==this.state.current&&this.paginationNode){var p=this.paginationNode.querySelector(".".concat(m,"-item-").concat(a.current));p&&document.activeElement===p&&p.blur()}}},{key:"getValidValue",value:function(o){var a=o.target.value,m=S(void 0,this.state,this.props),p=this.state.currentInputValue,v;return a===""?v=a:isNaN(Number(a))?v=p:a>=m?v=m:v=Number(a),v}},{key:"getShowSizeChanger",value:function(){var o=this.props,a=o.showSizeChanger,m=o.total,p=o.totalBoundaryShowSizeChanger;return typeof a!="undefined"?a:m>p}},{key:"renderPrev",value:function(o){var a=this.props,m=a.prevIcon,p=a.itemRender,v=p(o,"prev",this.getItemIcon(m,"prev page")),O=!this.hasPrev();return Object(M.isValidElement)(v)?Object(M.cloneElement)(v,{disabled:O}):v}},{key:"renderNext",value:function(o){var a=this.props,m=a.nextIcon,p=a.itemRender,v=p(o,"next",this.getItemIcon(m,"next page")),O=!this.hasNext();return Object(M.isValidElement)(v)?Object(M.cloneElement)(v,{disabled:O}):v}},{key:"render",value:function(){var o=this,a=this.props,m=a.prefixCls,p=a.className,v=a.style,O=a.disabled,U=a.hideOnSinglePage,j=a.total,G=a.locale,B=a.showQuickJumper,N=a.showLessItems,V=a.showTitle,$=a.showTotal,ie=a.simple,oe=a.itemRender,_e=a.showPrevNextJumpers,fe=a.jumpPrevIcon,Se=a.jumpNextIcon,be=a.selectComponentClass,me=a.selectPrefixCls,le=a.pageSizeOptions,ue=this.state,Ee=ue.current,Ge=ue.pageSize,Te=ue.currentInputValue;if(U===!0&&j<=Ge)return null;var pe=S(void 0,this.state,this.props),Ae=[],Ce=null,we=null,Be=null,Qe=null,je=null,De=B&&B.goButton,Pe=N?1:2,Le=Ee-1>0?Ee-1:0,Re=Ee+1<pe?Ee+1:pe,Ue=Object.keys(this.props).reduce(function(Y,Q){return(Q.substr(0,5)==="data-"||Q.substr(0,5)==="aria-"||Q==="role")&&(Y[Q]=o.props[Q]),Y},{});if(ie)return De&&(typeof De=="boolean"?je=D.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},G.jump_to_confirm):je=D.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},De),je=D.a.createElement("li",{title:V?"".concat(G.jump_to).concat(Ee,"/").concat(pe):null,className:"".concat(m,"-simple-pager")},je)),D.a.createElement("ul",Object(re.a)({className:E()(m,"".concat(m,"-simple"),Object(z.a)({},"".concat(m,"-disabled"),O),p),style:v,ref:this.savePaginationNode},Ue),D.a.createElement("li",{title:V?G.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:E()("".concat(m,"-prev"),Object(z.a)({},"".concat(m,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(Le)),D.a.createElement("li",{title:V?"".concat(Ee,"/").concat(pe):null,className:"".concat(m,"-simple-pager")},D.a.createElement("input",{type:"text",value:Te,disabled:O,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),D.a.createElement("span",{className:"".concat(m,"-slash")},"/"),pe),D.a.createElement("li",{title:V?G.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:E()("".concat(m,"-next"),Object(z.a)({},"".concat(m,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(Re)),je);if(pe<=3+Pe*2){var We={locale:G,rootPrefixCls:m,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:V,itemRender:oe};pe||Ae.push(D.a.createElement(T,Object(re.a)({},We,{key:"noPager",page:pe,className:"".concat(m,"-disabled")})));for(var ke=1;ke<=pe;ke+=1){var Ke=Ee===ke;Ae.push(D.a.createElement(T,Object(re.a)({},We,{key:ke,page:ke,active:Ke})))}}else{var ze=N?G.prev_3:G.prev_5,ge=N?G.next_3:G.next_5;_e&&(Ce=D.a.createElement("li",{title:V?ze:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:E()("".concat(m,"-jump-prev"),Object(z.a)({},"".concat(m,"-jump-prev-custom-icon"),!!fe))},oe(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(fe,"prev page"))),we=D.a.createElement("li",{title:V?ge:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:E()("".concat(m,"-jump-next"),Object(z.a)({},"".concat(m,"-jump-next-custom-icon"),!!Se))},oe(this.getJumpNextPage(),"jump-next",this.getItemIcon(Se,"next page")))),Qe=D.a.createElement(T,{locale:G,last:!0,rootPrefixCls:m,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:pe,page:pe,active:!1,showTitle:V,itemRender:oe}),Be=D.a.createElement(T,{locale:G,rootPrefixCls:m,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:V,itemRender:oe});var Ye=Math.max(1,Ee-Pe),He=Math.min(Ee+Pe,pe);Ee-1<=Pe&&(He=1+Pe*2),pe-Ee<=Pe&&(Ye=pe-Pe*2);for(var xe=Ye;xe<=He;xe+=1){var Ie=Ee===xe;Ae.push(D.a.createElement(T,{locale:G,rootPrefixCls:m,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:xe,page:xe,active:Ie,showTitle:V,itemRender:oe}))}Ee-1>=Pe*2&&Ee!==1+2&&(Ae[0]=Object(M.cloneElement)(Ae[0],{className:"".concat(m,"-item-after-jump-prev")}),Ae.unshift(Ce)),pe-Ee>=Pe*2&&Ee!==pe-2&&(Ae[Ae.length-1]=Object(M.cloneElement)(Ae[Ae.length-1],{className:"".concat(m,"-item-before-jump-next")}),Ae.push(we)),Ye!==1&&Ae.unshift(Be),He!==pe&&Ae.push(Qe)}var se=null;$&&(se=D.a.createElement("li",{className:"".concat(m,"-total-text")},$(j,[j===0?0:(Ee-1)*Ge+1,Ee*Ge>j?j:Ee*Ge])));var te=!this.hasPrev()||!pe,ee=!this.hasNext()||!pe;return D.a.createElement("ul",Object(re.a)({className:E()(m,p,Object(z.a)({},"".concat(m,"-disabled"),O)),style:v,unselectable:"unselectable",ref:this.savePaginationNode},Ue),se,D.a.createElement("li",{title:V?G.prev_page:null,onClick:this.prev,tabIndex:te?null:0,onKeyPress:this.runIfEnterPrev,className:E()("".concat(m,"-prev"),Object(z.a)({},"".concat(m,"-disabled"),te)),"aria-disabled":te},this.renderPrev(Le)),Ae,D.a.createElement("li",{title:V?G.next_page:null,onClick:this.next,tabIndex:ee?null:0,onKeyPress:this.runIfEnterNext,className:E()("".concat(m,"-next"),Object(z.a)({},"".concat(m,"-disabled"),ee)),"aria-disabled":ee},this.renderNext(Re)),D.a.createElement(b,{disabled:O,locale:G,rootPrefixCls:m,selectComponentClass:be,selectPrefixCls:me,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:Ee,pageSize:Ge,pageSizeOptions:le,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:De}))}}],[{key:"getDerivedStateFromProps",value:function(o,a){var m={};if("current"in o&&(m.current=o.current,o.current!==a.current&&(m.currentInputValue=m.current)),"pageSize"in o&&o.pageSize!==a.pageSize){var p=a.current,v=S(o.pageSize,a,o);p=p>v?v:p,"current"in o||(m.current=p,m.currentInputValue=p),m.pageSize=o.pageSize}return m}}]),f}(D.a.Component);h.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:s,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:s,locale:d.a,style:{},itemRender:l,totalBoundaryShowSizeChanger:50};var g=h},"6S+g":function(ut,$e,J){"use strict";var re=J("PpiC"),z=J("q1tI"),L=J.n(z),H=J("8h34"),k=J.n(H),P=J("9BLJ"),F=J("BtR2"),M=J("WhZy"),D=J("sNeV"),R=J("m3rI"),E=J("9kvl"),w=function(A){var _=A.user,b=Object(re.a)(A,["user"]),d=_.userInfo;return L.a.createElement("ul",{className:k.a.forumList},b.memos.map(function(s,u){var l={index:u,admin:d&&d.admin,banned_permission:s.banned_permission,login:d&&d.login,is_currentUser:d&&s.user_login===d.login,is_fine:s.is_fine,sticky:s.sticky,memo_watched:s.memo_watched,user_banned_permission:s.banned_permission,is_deleted:s.apply_destroy};return L.a.createElement("li",{key:s.id},L.a.createElement("div",{className:k.a.cOuXkk,style:{lineHeight:"36px"}},L.a.createElement("div",{className:k.a.kTLhbM,style:{marginLeft:"-8px"}},L.a.createElement("span",null,L.a.createElement("span",{className:s.tag_name=="\u4EA4\u6D41"?k.a.blue:k.a.orange},"\u3010",s.tag_name,"\u3011")),L.a.createElement("a",{href:"/forums/".concat(s.id),className:"".concat(k.a.taskHide," ").concat(k.a.textTitle)},s.subject),s.sticky===!0?L.a.createElement("span",{className:"".concat(k.a.tag," ").concat(k.a.tagRed)},"\u7F6E\u9876"):"",s.is_original===!0?L.a.createElement("span",{className:"".concat(k.a.tag," ").concat(k.a.tagOrange)},"\u539F\u521B"):"",s.is_fine===!0?L.a.createElement("span",{className:"".concat(k.a.tag," ").concat(k.a.tagBlue)},"\u7CBE\u534E"):""),L.a.createElement("div",{className:k.a.kTLhbM},s.apply_destroy?L.a.createElement("span",{className:"".concat(k.a.orange," mr10"),style:{fontSize:"12px"}},"\u5DF2\u7533\u8BF7\u5220\u5E16"):"",d&&d.login?L.a.createElement(D.a,{permission:l,id:s.id,calbackFunc:b.calbackFunc}):"")),L.a.createElement("div",{className:k.a.cOuXkk,style:{marginTop:"8px"}},L.a.createElement("div",{className:k.a.kTLhbM},L.a.createElement("a",{href:"/forums/accounts/".concat(s.user_login,"/memos")},L.a.createElement("div",{className:k.a.kTLhbM},L.a.createElement("img",{src:R.a.IMG_SERVER+"/images/"+s.image_url,alt:"",className:k.a.dGqnMq}),L.a.createElement("span",{className:k.a.dicrWo},s.username))),s.forum_section_title?L.a.createElement("a",{href:"",className:"".concat(k.a.iwMcWy," ").concat(k.a.textType)},s.forum_section_title):"",s.published_time?L.a.createElement("span",{className:k.a.iwMcWy},s.published_time):""),L.a.createElement("span",null,L.a.createElement("span",{className:k.a.iconWrap},L.a.createElement(P.a,null),L.a.createElement("span",{className:k.a.spanText},s.viewed_count)),L.a.createElement("span",{className:k.a.iconWrap},L.a.createElement(F.a,null),L.a.createElement("span",{className:k.a.spanText},s.praises_count)),L.a.createElement("span",{className:k.a.iconWrap},L.a.createElement(M.a,null),L.a.createElement("span",{className:k.a.spanText},s.replies_count)))))}))};$e.a=Object(E.a)(function(T){var A=T.user;return{user:A}})(w)},"7ahc":function(ut,$e,J){"use strict";J.d($e,"a",function(){return S});var re=J("k1fw"),z=J("0Owb"),L=J("+L6B"),H=J("2/Rp"),k=J("y8nQ"),P=J("Vl3Y"),F=J("tJVT"),M=J("OaEy"),D=J("2fM7"),R=J("q1tI"),E=J.n(R),w=J("VrN/"),T=J.n(w),A=J("p77/"),_=J.n(A),b=J("c5Ni"),d=J.n(b),s=D.a.Option,u={labelCol:{span:4},wrapperCol:{span:20}},l={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};$e.b=function(h){var g=h.callback,C=h.onCancel,y=Object(R.useState)("python"),f=Object(F.a)(y,2),c=f[0],o=f[1];function a(p){o(l[p][1])}function m(p){g(p)}return E.a.createElement(P.a,Object(z.a)({},u,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:m}),E.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},E.a.createElement(D.a,{onChange:a},Object.keys(l).map(function(p){return E.a.createElement(s,{key:p,value:p},l[p][0])}))),E.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},E.a.createElement(S,{mode:c})),E.a.createElement("div",{className:"flex-container flex-end"},E.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),E.a.createElement(H.a,{type:"ghost",onClick:C},"\u53D6\u6D88")))};function S(h){var g=h.value,C=h.onChange,y=h.mode,f=h.options,c=f===void 0?{}:f,o=Object(R.useRef)(),a=Object(R.useState)(),m=Object(F.a)(a,2),p=m[0],v=m[1];return Object(R.useEffect)(function(){if(p){function O(U){var j=U.getValue();C&&C(j)}return p.on("change",O),function(){p.off("change",O)}}},[p,C]),Object(R.useEffect)(function(){p&&p.setOption("mode",y)},[p,y]),Object(R.useEffect)(function(){p&&((g!==p.getValue()||g==="")&&setTimeout(function(){p.setValue(g||" ")},300))},[p,g]),Object(R.useEffect)(function(){if(o.current&&!p){var O=T.a.fromTextArea(o.current,Object(re.a)({mode:y,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));v(O)}},[o.current,p]),E.a.createElement("div",{className:"my-codemirror-container"},E.a.createElement("textarea",{ref:o}))}},"8EBN":function(ut,$e,J){(function(re){re(J("VrN/"))})(function(re){"use strict";re.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var z=0;z<re.modeInfo.length;z++){var L=re.modeInfo[z];L.mimes&&(L.mime=L.mimes[0])}re.findModeByMIME=function(H){H=H.toLowerCase();for(var k=0;k<re.modeInfo.length;k++){var P=re.modeInfo[k];if(P.mime==H)return P;if(P.mimes){for(var F=0;F<P.mimes.length;F++)if(P.mimes[F]==H)return P}}if(/\+xml$/.test(H))return re.findModeByMIME("application/xml");if(/\+json$/.test(H))return re.findModeByMIME("application/json")},re.findModeByExtension=function(H){H=H.toLowerCase();for(var k=0;k<re.modeInfo.length;k++){var P=re.modeInfo[k];if(P.ext){for(var F=0;F<P.ext.length;F++)if(P.ext[F]==H)return P}}},re.findModeByFileName=function(H){for(var k=0;k<re.modeInfo.length;k++){var P=re.modeInfo[k];if(P.file&&P.file.test(H))return P}var F=H.lastIndexOf("."),M=F>-1&&H.substring(F+1,H.length);if(M)return re.findModeByExtension(M)},re.findModeByName=function(H){H=H.toLowerCase();for(var k=0;k<re.modeInfo.length;k++){var P=re.modeInfo[k];if(P.name.toLowerCase()==H)return P;if(P.alias){for(var F=0;F<P.alias.length;F++)if(P.alias[F].toLowerCase()==H)return P}}}})},"8h34":function(ut,$e,J){ut.exports={flex:"flex___2HH0O",gMAmTc:"gMAmTc___17yQM",kJYYQv:"kJYYQv___2ZTC2",kTLhbM:"kTLhbM___1ZHGL",listPagin:"listPagin___3pkAk",iwMcWy:"iwMcWy___9zakX",kgxtyB:"kgxtyB___xbLp9",cPointer:"cPointer___3dMmZ",forumList:"forumList___2XrK4",cOuXkk:"cOuXkk___3TqyJ",tag:"tag___3snk-",tagRed:"tagRed___AF33t",tagOrange:"tagOrange___fJ5u5",tagBlue:"tagBlue___3NO7O",tag_Red:"tag_Red___eDcdq",tag_Orange:"tag_Orange___38h_s",tag_Blue:"tag_Blue___1PDoi",orange:"orange___3Z_5Z",blue:"blue___3ikYh",iconWrap:"iconWrap___1bz4U",spanText:"spanText___8Ge3T",dGqnMq:"dGqnMq___1T97N",dicrWo:"dicrWo___3C7PU","task-hide":"task-hide___2Cssy",textTitle:"textTitle___32U1N",textType:"textType___3PKYZ"}},"9Bee":function(ut,$e,J){"use strict";var re=J("k1fw"),z=J("tJVT"),L=J("q1tI"),H=J.n(L),k=J("vg9a"),P=J("DlQD"),F=J.n(P),M=J("rUJ1");function D(V,$){var ie=V.match(/^(\s+)(?:```)/);if(ie===null)return $;var oe=ie[1];return $.split(`
`).map(function(_e){var fe=_e.match(/^\s+/);if(fe===null)return _e;var Se=Object(z.a)(fe,1),be=Se[0];return be.length>=oe.length?_e.slice(oe.length):_e}).join(`
`)}var R=[],E=["<ul>"],w=new F.a.Renderer,T=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function A(){R.length=0,E=["<ul>"]}var _={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function b(V,$,ie,oe){if($>=V.length||V[$].level<=ie)return $;var _e=V[$];oe.push("<li><a href='#"+_e.anchor+"'>"+_e.text+"</a>"),$++;var fe=[];return $=b(V,$,_e.level,fe),fe.length>0&&(oe.push("<ul>"),fe.forEach(function(Se){oe.push(Se)}),oe.push("</ul>")),oe.push("</li>"),$=b(V,$,ie,oe),$}function d(){return b(R,0,0,E),E.push("</ul>"),E.join("")}var s={heading:function($){var ie=T.exec($);if(ie)return{type:"heading",raw:ie[0],depth:ie[1].length,text:ie[2]}},fences:function($){var ie=this.rules.block.fences.exec($);if(ie){var oe=ie[0],_e=D(oe,ie[3]||""),fe=ie[2]?ie[2].trim():ie[2];if(["latex","katex","math"].indexOf(fe)>=0){var Se=S(),be=_e;_e=Se,h[Se]={type:"block",expression:be}}return{type:"code",raw:oe,lang:fe,text:_e}}}},u=/(?:\${2})([^\n`]+?)(?:\${2})/gi,l=0,S=function(){return"__special_katext_id_".concat(l++,"__")},h={};function g(){return h}function C(){l=0,h={}}function y(V){return V=V.replace(u,function($,ie){var oe=S();return h[oe]={type:"inline",expression:ie},oe}),V}var f=w.listitem;w.listitem=function(V){return f(y(V))};var c=w.paragraph;w.paragraph=function(V){return c(y(V))};var o=w.tablecell;w.tablecell=function(V,$){return o(y(V),$)},w.code=function(V,$,ie){var oe=($||"").match(/\S*/)[0];return oe?["latex","katex","math"].indexOf(oe)>=0?"<p class='editormd-tex'>".concat(V,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat($,'">').concat(ie?V:Object(M.escape)(V,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(ie?V:Object(M.escape)(V,!0))+"</code></pre>"},w.heading=function(V,$,ie){var oe=this.options.headerPrefix+ie.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return R.push({anchor:oe,level:$,text:V}),"<h"+$+' id="'+oe+'">'+V+"</h"+$+">"},F.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),F.a.use({tokenizer:s,renderer:w});var a=F.a,m=J("SJMd"),p=J("ulZh"),v=J.n(p),O=J("m3rI"),U=J("Oy/b"),j=J("p5ED"),G=/<pre[^>]*>/g;function B(V){var $=document.createElement("div");return $.innerHTML=V,$.childNodes.length===0?"":$.childNodes[0].nodeValue}var N=$e.a=function(V){var $,ie=V.value,oe=ie===void 0?"":ie,_e=V.className,fe=V.showTextOnly,Se=V.showLines,be=V.style,me=be===void 0?{}:be,le=V.stylesPrev,ue=le===void 0?{}:le,Ee=($=String(oe))===null||$===void 0?void 0:$.replace(/<script.*?>|<\/script>/gi,"").replace(/on\w+="[^"]*"/gi,""),Ge=Object(L.useState)(""),Te=Object(z.a)(Ge,2),pe=Te[0],Ae=Te[1],Ce=Object(L.useMemo)(function(){try{var je=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,De=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Pe=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Ee=Ee.replace(je,"("+O.a.API_SERVER+"/api/attachments/").replace(De,'"'+O.a.API_SERVER+"/api/attachments/").replace(Pe,'"'+O.a.API_SERVER+"/files/uploads/").replace(/\r\n/g,`
`),Ee=Ee.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
`)}catch(We){}var Le=a(Ee),Re=g();if(Ee.match(/\[TOC\]/)&&(Le=Le.replace("<p>[TOC]</p>",d()),A()),Le=Le.replace(/(__special_katext_id_\d+__)/g,function(We,ke){var Ke=Re[ke],ze=Ke.type,ge=Ke.expression;return Object(U.renderToString)(B(ge)||"",{displayMode:ze==="block",throwOnError:!1,output:"html"})}),Le=Le.replace(/▁/g,"\u2581\u2581\u2581"),C(),fe){var Ue=document.createElement("div");return Ue.innerHTML=Le,Ue.innerText}return setTimeout(function(){return Qe()},500),Le},[Ee]),we=Object(L.useRef)();_.WebkitLineClamp=Se,Se&&(me=Object(re.a)(Object(re.a)({},me),_));function Be(je){var De=je.target;if(De.tagName.toUpperCase()==="A"){var Pe=De.getAttribute("href");if(Pe.indexOf("office")>-1)je.preventDefault(),Ae(Pe);else if(Pe.startsWith("#")){je.preventDefault();var Le=document.getElementById(Pe.replace("#",""));Le&&Le.scrollIntoView(!0)}}}var Qe=function(){var De,Pe=(De=we.current)===null||De===void 0?void 0:De.querySelectorAll("video");Pe==null||Pe.forEach(function(Le){if(Le.oncontextmenu=function(){return!1},Le.src.indexOf(".m3u8")>-1&&!Le.canPlayType("application/vnd.apple.mpegurl")){if(v.a.isSupported()){var Re=new v.a;Re.loadSource(Le.src),Re.attachMedia(Le)}}})};return Object(L.useEffect)(function(){if(we.current&&Ce&&(Ce.match(G)&&window.PR.prettyPrint()),we.current)return we.current.addEventListener("click",Be),function(){we.current.removeEventListener("click",Be),C(),A()}},[Ce,we.current,Be]),H.a.createElement(H.a.Fragment,null,H.a.createElement("div",{ref:we,style:Object(re.a)({},me),className:"".concat(_e||""," markdown-body "),dangerouslySetInnerHTML:{__html:Ce}}),H.a.createElement(j.a,{close:!0,data:pe,type:pe!=null&&pe.length?"office":"",style:Object(re.a)({},ue),onClose:function(){return Ae("")}}))}},"9VGf":function(ut,$e,J){"use strict";J.d($e,"a",function(){return L});var re=J("q1tI"),z=J.n(re);function L(H,k){var P=Object(re.useRef)();Object(re.useEffect)(function(){P.current=H}),Object(re.useEffect)(function(){function F(){P.current()}if(k!==null){var M=setInterval(F,k);return function(){return clearInterval(M)}}},[k])}},BU3w:function(ut,$e,J){"use strict";J.d($e,"a",function(){return P});var re=J("MNnm"),z="rc-util-key";function L(F){if(F.attachTo)return F.attachTo;var M=document.querySelector("head");return M||document.body}function H(F){var M,D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(re.a)())return null;var R=document.createElement("style");if((M=D.csp)===null||M===void 0?void 0:M.nonce){var E;R.nonce=(E=D.csp)===null||E===void 0?void 0:E.nonce}R.innerHTML=F;var w=L(D),T=w.firstChild;return D.prepend&&w.prepend?w.prepend(R):D.prepend&&T?w.insertBefore(R,T):w.appendChild(R),R}var k=new Map;function P(F,M){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},R=L(D);if(!k.has(R)){var E=H("",D),w=E.parentNode;k.set(R,w),w.removeChild(E)}var T=Array.from(k.get(R).children).find(function(s){return s.tagName==="STYLE"&&s[z]===M});if(T){var A,_;if(((A=D.csp)===null||A===void 0?void 0:A.nonce)&&T.nonce!==((_=D.csp)===null||_===void 0?void 0:_.nonce)){var b;T.nonce=(b=D.csp)===null||b===void 0?void 0:b.nonce}return T.innerHTML!==F&&(T.innerHTML=F),T}var d=H(F,D);return d[z]=M,d}},Bd2K:function(ut,$e,J){(function(re){re(J("VrN/"),J("osHv"))})(function(re){re.defineOption("autoCloseTags",!1,function(D,R,E){if(E!=re.Init&&E&&D.removeKeyMap("autoCloseTags"),!R)return;var w={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(w["'/'"]=function(T){return P(T)}),(typeof R!="object"||R.whenOpening!==!1)&&(w["'>'"]=function(T){return H(T)}),D.addKeyMap(w)});var z=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],L=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function H(D){if(D.getOption("disableInput"))return re.Pass;for(var R=D.listSelections(),E=[],w=D.getOption("autoCloseTags"),T=0;T<R.length;T++){if(!R[T].empty())return re.Pass;var A=R[T].head,_=D.getTokenAt(A),b=re.innerMode(D.getMode(),_.state),d=b.state,s=b.mode.xmlCurrentTag&&b.mode.xmlCurrentTag(d),u=s&&s.name;if(!u)return re.Pass;var l=b.mode.configuration=="html",S=typeof w=="object"&&w.dontCloseTags||l&&z,h=typeof w=="object"&&w.indentTags||l&&L;_.end>A.ch&&(u=u.slice(0,u.length-_.end+A.ch));var g=u.toLowerCase();if(!u||_.type=="string"&&(_.end!=A.ch||!/[\"\']/.test(_.string.charAt(_.string.length-1))||_.string.length==1)||_.type=="tag"&&s.close||_.string.indexOf("/")==A.ch-_.start-1||S&&F(S,g)>-1||M(D,b.mode.xmlCurrentContext&&b.mode.xmlCurrentContext(d)||[],u,A,!0))return re.Pass;var C=typeof w=="object"&&w.emptyTags;if(C&&F(C,u)>-1){E[T]={text:"/>",newPos:re.Pos(A.line,A.ch+2)};continue}var y=h&&F(h,g)>-1;E[T]={indent:y,text:">"+(y?`
`:"")+"</"+u+">",newPos:y?re.Pos(A.line+1,0):re.Pos(A.line,A.ch+1)}}for(var f=typeof w=="object"&&w.dontIndentOnAutoClose,T=R.length-1;T>=0;T--){var c=E[T];D.replaceRange(c.text,R[T].head,R[T].anchor,"+insert");var o=D.listSelections().slice(0);o[T]={head:c.newPos,anchor:c.newPos},D.setSelections(o),!f&&c.indent&&(D.indentLine(c.newPos.line,null,!0),D.indentLine(c.newPos.line+1,null,!0))}}function k(D,R){for(var E=D.listSelections(),w=[],T=R?"/":"</",A=D.getOption("autoCloseTags"),_=typeof A=="object"&&A.dontIndentOnSlash,b=0;b<E.length;b++){if(!E[b].empty())return re.Pass;var d=E[b].head,s=D.getTokenAt(d),u=re.innerMode(D.getMode(),s.state),l=u.state;if(R&&(s.type=="string"||s.string.charAt(0)!="<"||s.start!=d.ch-1))return re.Pass;var S,h=u.mode.name!="xml"&&D.getMode().name=="htmlmixed";if(h&&u.mode.name=="javascript")S=T+"script";else if(h&&u.mode.name=="css")S=T+"style";else{var g=u.mode.xmlCurrentContext&&u.mode.xmlCurrentContext(l);if(!g||g.length&&M(D,g,g[g.length-1],d))return re.Pass;S=T+g[g.length-1]}D.getLine(d.line).charAt(s.end)!=">"&&(S+=">"),w[b]=S}if(D.replaceSelections(w),E=D.listSelections(),!_)for(var b=0;b<E.length;b++)(b==E.length-1||E[b].head.line<E[b+1].head.line)&&D.indentLine(E[b].head.line)}function P(D){return D.getOption("disableInput")?re.Pass:k(D,!0)}re.commands.closeTag=function(D){return k(D)};function F(D,R){if(D.indexOf)return D.indexOf(R);for(var E=0,w=D.length;E<w;++E)if(D[E]==R)return E;return-1}function M(D,R,E,w,T){if(!re.scanForClosingTag)return!1;var A=Math.min(D.lastLine()+1,w.line+500),_=re.scanForClosingTag(D,w,null,A);if(!_||_.tag!=E)return!1;for(var b=T?1:0,d=R.length-1;d>=0&&R[d]==E;d--)++b;w=_.to;for(var d=1;d<b;d++){var s=re.scanForClosingTag(D,w,null,A);if(!s||s.tag!=E)return!1;w=s.to}return!0}})},BdwD:function(ut,$e,J){"use strict";var re=J("k1fw"),z=J("q1tI"),L=J.n(z),H=J("MXfU"),k=J.n(H),P=J("Nmsl"),F=J.n(P),M=function(R){var E=R.buttonProps,w=E===void 0?{}:E,T=R.styles,A=T===void 0?{}:T,_=R.customText,b=R.ButtonText,d=R.ButtonClick,s=R.Buttonclass,u=R.ButtonTwo,l=R.imgUrl;return L.a.createElement("div",{className:F.a.none_panels,style:Object(re.a)({},A)},L.a.createElement("div",null,L.a.createElement("img",{src:l||k.a,alt:""}),L.a.createElement("p",{className:F.a.none_p_title},_||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!")))};$e.a=M},BjJ7:function(ut,$e,J){"use strict";J.d($e,"d",function(){return z}),J.d($e,"c",function(){return L}),J.d($e,"e",function(){return H}),J.d($e,"b",function(){return k}),J.d($e,"a",function(){return F});var re=J("m3rI");function z(M){var D=!0;if(M.length>0){for(var R=0;R<M.length;R++)if(M[R].compile_success==0||!M[R].compile_success){D=!1;break}}else D=!1;return D}function L(M){for(var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",R=[],E=0;E<M.length;E++){var w=M[E],T=D?"".concat(D,"/").concat(w.name):"".concat(w.name);R.push({title:w.name,isLeaf:!(w.type==="tree"),key:T})}return R}function H(M,D,R){for(var E=0;E<M.length;E++){var w=M[E];if(w.key===D){w.children=R;break}w.children&&H(w.children,D,R)}return M}function k(M,D,R){var E;return function(){var w=this,T=arguments,A=function(){E=null,R||M.apply(w,T)},_=R&&!E;clearTimeout(E),E=setTimeout(A,D),_&&M.apply(w,T)}}var P=!0,F=re.a.API_SERVER},"C+DQ":function(ut,$e,J){},DlQD:function(ut,$e,J){(function(re,z){ut.exports=z()})(this,function(){"use strict";function re(se,te){for(var ee=0;ee<te.length;ee++){var Y=te[ee];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(se,Y.key,Y)}}function z(se,te,ee){return te&&re(se.prototype,te),ee&&re(se,ee),se}function L(se,te){if(!se)return;if(typeof se=="string")return H(se,te);var ee=Object.prototype.toString.call(se).slice(8,-1);if(ee==="Object"&&se.constructor&&(ee=se.constructor.name),ee==="Map"||ee==="Set")return Array.from(se);if(ee==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ee))return H(se,te)}function H(se,te){(te==null||te>se.length)&&(te=se.length);for(var ee=0,Y=new Array(te);ee<te;ee++)Y[ee]=se[ee];return Y}function k(se,te){var ee;if(typeof Symbol=="undefined"||se[Symbol.iterator]==null){if(Array.isArray(se)||(ee=L(se))||te&&se&&typeof se.length=="number"){ee&&(se=ee);var Y=0;return function(){return Y>=se.length?{done:!0}:{done:!1,value:se[Y++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return ee=se[Symbol.iterator](),ee.next.bind(ee)}function P(se,te){return te={exports:{}},se(te,te.exports),te.exports}var F=P(function(se){function te(){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 ee(Y){se.exports.defaults=Y}se.exports={defaults:te(),getDefaults:te,changeDefaults:ee}}),M=F.defaults,D=F.getDefaults,R=F.changeDefaults,E=/[&<>"']/,w=/[&<>"']/g,T=/[<>"']|&(?!#?\w+;)/,A=/[<>"']|&(?!#?\w+;)/g,_={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},b=function(te){return _[te]};function d(se,te){if(te){if(E.test(se))return se.replace(w,b)}else if(T.test(se))return se.replace(A,b);return se}var s=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function u(se){return se.replace(s,function(te,ee){return ee=ee.toLowerCase(),ee==="colon"?":":ee.charAt(0)==="#"?ee.charAt(1)==="x"?String.fromCharCode(parseInt(ee.substring(2),16)):String.fromCharCode(+ee.substring(1)):""})}var l=/(^|[^\[])\^/g;function S(se,te){se=se.source||se,te=te||"";var ee={replace:function(Q,Z){return Z=Z.source||Z,Z=Z.replace(l,"$1"),se=se.replace(Q,Z),ee},getRegex:function(){return new RegExp(se,te)}};return ee}var h=/[^\w:]/g,g=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function C(se,te,ee){if(se){var Y;try{Y=decodeURIComponent(u(ee)).replace(h,"").toLowerCase()}catch(Q){return null}if(Y.indexOf("javascript:")===0||Y.indexOf("vbscript:")===0||Y.indexOf("data:")===0)return null}te&&!g.test(ee)&&(ee=a(te,ee));try{ee=encodeURI(ee).replace(/%25/g,"%")}catch(Q){return null}return ee}var y={},f=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,o=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(se,te){y[" "+se]||(f.test(se)?y[" "+se]=se+"/":y[" "+se]=O(se,"/",!0)),se=y[" "+se];var ee=se.indexOf(":")===-1;return te.substring(0,2)==="//"?ee?te:se.replace(c,"$1")+te:te.charAt(0)==="/"?ee?te:se.replace(o,"$1")+te:se+te}var m={exec:function(){}};function p(se){for(var te=1,ee,Y;te<arguments.length;te++){ee=arguments[te];for(Y in ee)Object.prototype.hasOwnProperty.call(ee,Y)&&(se[Y]=ee[Y])}return se}function v(se,te){var ee=se.replace(/\|/g,function(Z,q,de){for(var ye=!1,Me=q;--Me>=0&&de[Me]==="\\";)ye=!ye;return ye?"|":" |"}),Y=ee.split(/ \|/),Q=0;if(Y.length>te)Y.splice(te);else for(;Y.length<te;)Y.push("");for(;Q<Y.length;Q++)Y[Q]=Y[Q].trim().replace(/\\\|/g,"|");return Y}function O(se,te,ee){var Y=se.length;if(Y===0)return"";for(var Q=0;Q<Y;){var Z=se.charAt(Y-Q-1);if(Z===te&&!ee)Q++;else if(Z!==te&&ee)Q++;else break}return se.substr(0,Y-Q)}function U(se,te){if(se.indexOf(te[1])===-1)return-1;for(var ee=se.length,Y=0,Q=0;Q<ee;Q++)if(se[Q]==="\\")Q++;else if(se[Q]===te[0])Y++;else if(se[Q]===te[1]&&(Y--,Y<0))return Q;return-1}function j(se){se&&se.sanitize&&!se.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 G={escape:d,unescape:u,edit:S,cleanUrl:C,resolveUrl:a,noopTest:m,merge:p,splitCells:v,rtrim:O,findClosingBracket:U,checkSanitizeDeprecation:j},B=F.defaults,N=G.rtrim,V=G.splitCells,$=G.escape,ie=G.findClosingBracket;function oe(se,te,ee){var Y=te.href,Q=te.title?$(te.title):null,Z=se[1].replace(/\\([\[\]])/g,"$1");return se[0].charAt(0)!=="!"?{type:"link",raw:ee,href:Y,title:Q,text:Z}:{type:"image",raw:ee,href:Y,title:Q,text:$(Z)}}function _e(se,te){var ee=se.match(/^(\s+)(?:```)/);if(ee===null)return te;var Y=ee[1];return te.split(`
`).map(function(Q){var Z=Q.match(/^\s+/);if(Z===null)return Q;var q=Z[0];return q.length>=Y.length?Q.slice(Y.length):Q}).join(`
`)}var fe=function(){function se(ee){this.options=ee||B}var te=se.prototype;return te.space=function(Y){var Q=this.rules.block.newline.exec(Y);if(Q)return Q[0].length>1?{type:"space",raw:Q[0]}:{raw:`
`}},te.code=function(Y,Q){var Z=this.rules.block.code.exec(Y);if(Z){var q=Q[Q.length-1];if(q&&q.type==="paragraph")return{raw:Z[0],text:Z[0].trimRight()};var de=Z[0].replace(/^ {4}/gm,"");return{type:"code",raw:Z[0],codeBlockStyle:"indented",text:this.options.pedantic?de:N(de,`
`)}}},te.fences=function(Y){var Q=this.rules.block.fences.exec(Y);if(Q){var Z=Q[0],q=_e(Z,Q[3]||"");return{type:"code",raw:Z,lang:Q[2]?Q[2].trim():Q[2],text:q}}},te.heading=function(Y){var Q=this.rules.block.heading.exec(Y);if(Q)return{type:"heading",raw:Q[0],depth:Q[1].length,text:Q[2]}},te.nptable=function(Y){var Q=this.rules.block.nptable.exec(Y);if(Q){var Z={type:"table",header:V(Q[1].replace(/^ *| *\| *$/g,"")),align:Q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Q[3]?Q[3].replace(/\n$/,"").split(`
`):[],raw:Q[0]};if(Z.header.length===Z.align.length){var q=Z.align.length,de;for(de=0;de<q;de++)/^ *-+: *$/.test(Z.align[de])?Z.align[de]="right":/^ *:-+: *$/.test(Z.align[de])?Z.align[de]="center":/^ *:-+ *$/.test(Z.align[de])?Z.align[de]="left":Z.align[de]=null;for(q=Z.cells.length,de=0;de<q;de++)Z.cells[de]=V(Z.cells[de],Z.header.length);return Z}}},te.hr=function(Y){var Q=this.rules.block.hr.exec(Y);if(Q)return{type:"hr",raw:Q[0]}},te.blockquote=function(Y){var Q=this.rules.block.blockquote.exec(Y);if(Q){var Z=Q[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Q[0],text:Z}}},te.list=function(Y){var Q=this.rules.block.list.exec(Y);if(Q){for(var Z=Q[0],q=Q[2],de=q.length>1,ye=q[q.length-1]===")",Me={type:"list",raw:Z,ordered:de,start:de?+q.slice(0,-1):"",loose:!1,items:[]},et=Q[0].match(this.rules.block.item),qe=!1,at,gt,yt,st,_t,xt,Bt,Dt=et.length,pt=0;pt<Dt;pt++)at=et[pt],Z=at,gt=at.length,at=at.replace(/^ *([*+-]|\d+[.)]) */,""),~at.indexOf(`
`)&&(gt-=at.length,at=this.options.pedantic?at.replace(/^ {1,4}/gm,""):at.replace(new RegExp("^ {1,"+gt+"}","gm"),"")),pt!==Dt-1&&(yt=this.rules.block.bullet.exec(et[pt+1])[0],(de?yt.length===1||!ye&&yt[yt.length-1]===")":yt.length>1||this.options.smartLists&&yt!==q)&&(st=et.slice(pt+1).join(`
`),Me.raw=Me.raw.substring(0,Me.raw.length-st.length),pt=Dt-1)),_t=qe||/\n\n(?!\s*$)/.test(at),pt!==Dt-1&&(qe=at.charAt(at.length-1)===`
`,_t||(_t=qe)),_t&&(Me.loose=!0),xt=/^\[[ xX]\] /.test(at),Bt=void 0,xt&&(Bt=at[1]!==" ",at=at.replace(/^\[[ xX]\] +/,"")),Me.items.push({type:"list_item",raw:Z,task:xt,checked:Bt,loose:_t,text:at});return Me}},te.html=function(Y){var Q=this.rules.block.html.exec(Y);if(Q)return{type:this.options.sanitize?"paragraph":"html",raw:Q[0],pre:!this.options.sanitizer&&(Q[1]==="pre"||Q[1]==="script"||Q[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Q[0]):$(Q[0]):Q[0]}},te.def=function(Y){var Q=this.rules.block.def.exec(Y);if(Q){Q[3]&&(Q[3]=Q[3].substring(1,Q[3].length-1));var Z=Q[1].toLowerCase().replace(/\s+/g," ");return{tag:Z,raw:Q[0],href:Q[2],title:Q[3]}}},te.table=function(Y){var Q=this.rules.block.table.exec(Y);if(Q){var Z={type:"table",header:V(Q[1].replace(/^ *| *\| *$/g,"")),align:Q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Q[3]?Q[3].replace(/\n$/,"").split(`
`):[]};if(Z.header.length===Z.align.length){Z.raw=Q[0];var q=Z.align.length,de;for(de=0;de<q;de++)/^ *-+: *$/.test(Z.align[de])?Z.align[de]="right":/^ *:-+: *$/.test(Z.align[de])?Z.align[de]="center":/^ *:-+ *$/.test(Z.align[de])?Z.align[de]="left":Z.align[de]=null;for(q=Z.cells.length,de=0;de<q;de++)Z.cells[de]=V(Z.cells[de].replace(/^ *\| *| *\| *$/g,""),Z.header.length);return Z}}},te.lheading=function(Y){var Q=this.rules.block.lheading.exec(Y);if(Q)return{type:"heading",raw:Q[0],depth:Q[2].charAt(0)==="="?1:2,text:Q[1]}},te.paragraph=function(Y){var Q=this.rules.block.paragraph.exec(Y);if(Q)return{type:"paragraph",raw:Q[0],text:Q[1].charAt(Q[1].length-1)===`
`?Q[1].slice(0,-1):Q[1]}},te.text=function(Y,Q){var Z=this.rules.block.text.exec(Y);if(Z){var q=Q[Q.length-1];return q&&q.type==="text"?{raw:Z[0],text:Z[0]}:{type:"text",raw:Z[0],text:Z[0]}}},te.escape=function(Y){var Q=this.rules.inline.escape.exec(Y);if(Q)return{type:"escape",raw:Q[0],text:$(Q[1])}},te.tag=function(Y,Q,Z){var q=this.rules.inline.tag.exec(Y);if(q)return!Q&&/^<a /i.test(q[0])?Q=!0:Q&&/^<\/a>/i.test(q[0])&&(Q=!1),!Z&&/^<(pre|code|kbd|script)(\s|>)/i.test(q[0])?Z=!0:Z&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(q[0])&&(Z=!1),{type:this.options.sanitize?"text":"html",raw:q[0],inLink:Q,inRawBlock:Z,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(q[0]):$(q[0]):q[0]}},te.link=function(Y){var Q=this.rules.inline.link.exec(Y);if(Q){var Z=ie(Q[2],"()");if(Z>-1){var q=Q[0].indexOf("!")===0?5:4,de=q+Q[1].length+Z;Q[2]=Q[2].substring(0,Z),Q[0]=Q[0].substring(0,de).trim(),Q[3]=""}var ye=Q[2],Me="";if(this.options.pedantic){var et=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ye);et?(ye=et[1],Me=et[3]):Me=""}else Me=Q[3]?Q[3].slice(1,-1):"";ye=ye.trim().replace(/^<([\s\S]*)>$/,"$1");var qe=oe(Q,{href:ye&&ye.replace(this.rules.inline._escapes,"$1"),title:Me&&Me.replace(this.rules.inline._escapes,"$1")},Q[0]);return qe}},te.reflink=function(Y,Q){var Z;if((Z=this.rules.inline.reflink.exec(Y))||(Z=this.rules.inline.nolink.exec(Y))){var q=(Z[2]||Z[1]).replace(/\s+/g," ");if(q=Q[q.toLowerCase()],!q||!q.href){var de=Z[0].charAt(0);return{type:"text",raw:de,text:de}}var ye=oe(Z,q,Z[0]);return ye}},te.strong=function(Y,Q,Z){Z===void 0&&(Z="");var q=this.rules.inline.strong.start.exec(Y);if(q&&(!q[1]||q[1]&&(Z===""||this.rules.inline.punctuation.exec(Z)))){Q=Q.slice(-1*Y.length);var de=q[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;de.lastIndex=0;for(var ye;(q=de.exec(Q))!=null;)if(ye=this.rules.inline.strong.middle.exec(Q.slice(0,q.index+3)),ye)return{type:"strong",raw:Y.slice(0,ye[0].length),text:Y.slice(2,ye[0].length-2)}}},te.em=function(Y,Q,Z){Z===void 0&&(Z="");var q=this.rules.inline.em.start.exec(Y);if(q&&(!q[1]||q[1]&&(Z===""||this.rules.inline.punctuation.exec(Z)))){Q=Q.slice(-1*Y.length);var de=q[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;de.lastIndex=0;for(var ye;(q=de.exec(Q))!=null;)if(ye=this.rules.inline.em.middle.exec(Q.slice(0,q.index+2)),ye)return{type:"em",raw:Y.slice(0,ye[0].length),text:Y.slice(1,ye[0].length-1)}}},te.codespan=function(Y){var Q=this.rules.inline.code.exec(Y);if(Q){var Z=Q[2].replace(/\n/g," "),q=/[^ ]/.test(Z),de=Z.startsWith(" ")&&Z.endsWith(" ");return q&&de&&(Z=Z.substring(1,Z.length-1)),Z=$(Z,!0),{type:"codespan",raw:Q[0],text:Z}}},te.br=function(Y){var Q=this.rules.inline.br.exec(Y);if(Q)return{type:"br",raw:Q[0]}},te.del=function(Y){var Q=this.rules.inline.del.exec(Y);if(Q)return{type:"del",raw:Q[0],text:Q[1]}},te.autolink=function(Y,Q){var Z=this.rules.inline.autolink.exec(Y);if(Z){var q,de;return Z[2]==="@"?(q=$(this.options.mangle?Q(Z[1]):Z[1]),de="mailto:"+q):(q=$(Z[1]),de=q),{type:"link",raw:Z[0],text:q,href:de,tokens:[{type:"text",raw:q,text:q}]}}},te.url=function(Y,Q){var Z;if(Z=this.rules.inline.url.exec(Y)){var q,de;if(Z[2]==="@")q=$(this.options.mangle?Q(Z[0]):Z[0]),de="mailto:"+q;else{var ye;do ye=Z[0],Z[0]=this.rules.inline._backpedal.exec(Z[0])[0];while(ye!==Z[0]);q=$(Z[0]),Z[1]==="www."?de="http://"+q:de=q}return{type:"link",raw:Z[0],text:q,href:de,tokens:[{type:"text",raw:q,text:q}]}}},te.inlineText=function(Y,Q,Z){var q=this.rules.inline.text.exec(Y);if(q){var de;return Q?de=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(q[0]):$(q[0]):q[0]:de=$(this.options.smartypants?Z(q[0]):q[0]),{type:"text",raw:q[0],text:de}}},se}(),Se=G.noopTest,be=G.edit,me=G.merge,le={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:Se,table:Se,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};le._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,le._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,le.def=be(le.def).replace("label",le._label).replace("title",le._title).getRegex(),le.bullet=/(?:[*+-]|\d{1,9}[.)])/,le.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,le.item=be(le.item,"gm").replace(/bull/g,le.bullet).getRegex(),le.list=be(le.list).replace(/bull/g,le.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+le.def.source+")").getRegex(),le._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",le._comment=/<!--(?!-?>)[\s\S]*?-->/,le.html=be(le.html,"i").replace("comment",le._comment).replace("tag",le._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),le.paragraph=be(le._paragraph).replace("hr",le.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",le._tag).getRegex(),le.blockquote=be(le.blockquote).replace("paragraph",le.paragraph).getRegex(),le.normal=me({},le),le.gfm=me({},le.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*|$)"}),le.gfm.nptable=be(le.gfm.nptable).replace("hr",le.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",le._tag).getRegex(),le.gfm.table=be(le.gfm.table).replace("hr",le.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",le._tag).getRegex(),le.pedantic=me({},le.normal,{html:be(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",le._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:Se,paragraph:be(le.normal._paragraph).replace("hr",le.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",le.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ue={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Se,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:Se,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};ue._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",ue.punctuation=be(ue.punctuation).replace(/punctuation/g,ue._punctuation).getRegex(),ue._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ue._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ue.em.start=be(ue.em.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.middle=be(ue.em.middle).replace(/punctuation/g,ue._punctuation).replace(/overlapSkip/g,ue._overlapSkip).getRegex(),ue.em.endAst=be(ue.em.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.endUnd=be(ue.em.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.start=be(ue.strong.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.middle=be(ue.strong.middle).replace(/punctuation/g,ue._punctuation).replace(/blockSkip/g,ue._blockSkip).getRegex(),ue.strong.endAst=be(ue.strong.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.endUnd=be(ue.strong.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.blockSkip=be(ue._blockSkip,"g").getRegex(),ue.overlapSkip=be(ue._overlapSkip,"g").getRegex(),ue._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,ue._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,ue._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])?)+(?![-_])/,ue.autolink=be(ue.autolink).replace("scheme",ue._scheme).replace("email",ue._email).getRegex(),ue._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,ue.tag=be(ue.tag).replace("comment",le._comment).replace("attribute",ue._attribute).getRegex(),ue._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ue._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ue._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ue.link=be(ue.link).replace("label",ue._label).replace("href",ue._href).replace("title",ue._title).getRegex(),ue.reflink=be(ue.reflink).replace("label",ue._label).getRegex(),ue.reflinkSearch=be(ue.reflinkSearch,"g").replace("reflink",ue.reflink).replace("nolink",ue.nolink).getRegex(),ue.normal=me({},ue),ue.pedantic=me({},ue.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:be(/^!?\[(label)\]\((.*?)\)/).replace("label",ue._label).getRegex(),reflink:be(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ue._label).getRegex()}),ue.gfm=me({},ue.normal,{escape:be(ue.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),ue.gfm.url=be(ue.gfm.url,"i").replace("email",ue.gfm._extended_email).getRegex(),ue.breaks=me({},ue.gfm,{br:be(ue.br).replace("{2,}","*").getRegex(),text:be(ue.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Ee={block:le,inline:ue},Ge=F.defaults,Te=Ee.block,pe=Ee.inline;function Ae(se){return se.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 Ce(se){var te="",ee,Y,Q=se.length;for(ee=0;ee<Q;ee++)Y=se.charCodeAt(ee),Math.random()>.5&&(Y="x"+Y.toString(16)),te+="&#"+Y+";";return te}var we=function(){function se(ee){this.tokens=[],this.tokens.links=Object.create(null),this.options=ee||Ge,this.options.tokenizer=this.options.tokenizer||new fe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Y={block:Te.normal,inline:pe.normal};this.options.pedantic?(Y.block=Te.pedantic,Y.inline=pe.pedantic):this.options.gfm&&(Y.block=Te.gfm,this.options.breaks?Y.inline=pe.breaks:Y.inline=pe.gfm),this.tokenizer.rules=Y}se.lex=function(Y,Q){var Z=new se(Q);return Z.lex(Y)};var te=se.prototype;return te.lex=function(Y){return Y=Y.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(Y,this.tokens,!0),this.inline(this.tokens),this.tokens},te.blockTokens=function(Y,Q,Z){Q===void 0&&(Q=[]),Z===void 0&&(Z=!0),Y=Y.replace(/^ +$/gm,"");for(var q,de,ye,Me;Y;){if(q=this.tokenizer.space(Y)){Y=Y.substring(q.raw.length),q.type&&Q.push(q);continue}if(q=this.tokenizer.code(Y,Q)){Y=Y.substring(q.raw.length),q.type?Q.push(q):(Me=Q[Q.length-1],Me.raw+=`
`+q.raw,Me.text+=`
`+q.text);continue}if(q=this.tokenizer.fences(Y)){Y=Y.substring(q.raw.length),Q.push(q);continue}if(q=this.tokenizer.heading(Y)){Y=Y.substring(q.raw.length),Q.push(q);continue}if(q=this.tokenizer.nptable(Y)){Y=Y.substring(q.raw.length),Q.push(q);continue}if(q=this.tokenizer.hr(Y)){Y=Y.substring(q.raw.length),Q.push(q);continue}if(q=this.tokenizer.blockquote(Y)){Y=Y.substring(q.raw.length),q.tokens=this.blockTokens(q.text,[],Z),Q.push(q);continue}if(q=this.tokenizer.list(Y)){for(Y=Y.substring(q.raw.length),ye=q.items.length,de=0;de<ye;de++)q.items[de].tokens=this.blockTokens(q.items[de].text,[],!1);Q.push(q);continue}if(q=this.tokenizer.html(Y)){Y=Y.substring(q.raw.length),Q.push(q);continue}if(Z&&(q=this.tokenizer.def(Y))){Y=Y.substring(q.raw.length),this.tokens.links[q.tag]||(this.tokens.links[q.tag]={href:q.href,title:q.title});continue}if(q=this.tokenizer.table(Y)){Y=Y.substring(q.raw.length),Q.push(q);continue}if(q=this.tokenizer.lheading(Y)){Y=Y.substring(q.raw.length),Q.push(q);continue}if(Z&&(q=this.tokenizer.paragraph(Y))){Y=Y.substring(q.raw.length),Q.push(q);continue}if(q=this.tokenizer.text(Y,Q)){Y=Y.substring(q.raw.length),q.type?Q.push(q):(Me=Q[Q.length-1],Me.raw+=`
`+q.raw,Me.text+=`
`+q.text);continue}if(Y){var et="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(et);break}else throw new Error(et)}}return Q},te.inline=function(Y){var Q,Z,q,de,ye,Me,et=Y.length;for(Q=0;Q<et;Q++){Me=Y[Q];switch(Me.type){case"paragraph":case"text":case"heading":{Me.tokens=[],this.inlineTokens(Me.text,Me.tokens);break}case"table":{for(Me.tokens={header:[],cells:[]},de=Me.header.length,Z=0;Z<de;Z++)Me.tokens.header[Z]=[],this.inlineTokens(Me.header[Z],Me.tokens.header[Z]);for(de=Me.cells.length,Z=0;Z<de;Z++)for(ye=Me.cells[Z],Me.tokens.cells[Z]=[],q=0;q<ye.length;q++)Me.tokens.cells[Z][q]=[],this.inlineTokens(ye[q],Me.tokens.cells[Z][q]);break}case"blockquote":{this.inline(Me.tokens);break}case"list":{for(de=Me.items.length,Z=0;Z<de;Z++)this.inline(Me.items[Z].tokens);break}}}return Y},te.inlineTokens=function(Y,Q,Z,q,de){Q===void 0&&(Q=[]),Z===void 0&&(Z=!1),q===void 0&&(q=!1),de===void 0&&(de="");var ye,Me=Y,et;if(this.tokens.links){var qe=Object.keys(this.tokens.links);if(qe.length>0)for(;(et=this.tokenizer.rules.inline.reflinkSearch.exec(Me))!=null;)qe.includes(et[0].slice(et[0].lastIndexOf("[")+1,-1))&&(Me=Me.slice(0,et.index)+"["+"a".repeat(et[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(et=this.tokenizer.rules.inline.blockSkip.exec(Me))!=null;)Me=Me.slice(0,et.index)+"["+"a".repeat(et[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Y;){if(ye=this.tokenizer.escape(Y)){Y=Y.substring(ye.raw.length),Q.push(ye);continue}if(ye=this.tokenizer.tag(Y,Z,q)){Y=Y.substring(ye.raw.length),Z=ye.inLink,q=ye.inRawBlock,Q.push(ye);continue}if(ye=this.tokenizer.link(Y)){Y=Y.substring(ye.raw.length),ye.type==="link"&&(ye.tokens=this.inlineTokens(ye.text,[],!0,q)),Q.push(ye);continue}if(ye=this.tokenizer.reflink(Y,this.tokens.links)){Y=Y.substring(ye.raw.length),ye.type==="link"&&(ye.tokens=this.inlineTokens(ye.text,[],!0,q)),Q.push(ye);continue}if(ye=this.tokenizer.strong(Y,Me,de)){Y=Y.substring(ye.raw.length),ye.tokens=this.inlineTokens(ye.text,[],Z,q),Q.push(ye);continue}if(ye=this.tokenizer.em(Y,Me,de)){Y=Y.substring(ye.raw.length),ye.tokens=this.inlineTokens(ye.text,[],Z,q),Q.push(ye);continue}if(ye=this.tokenizer.codespan(Y)){Y=Y.substring(ye.raw.length),Q.push(ye);continue}if(ye=this.tokenizer.br(Y)){Y=Y.substring(ye.raw.length),Q.push(ye);continue}if(ye=this.tokenizer.del(Y)){Y=Y.substring(ye.raw.length),ye.tokens=this.inlineTokens(ye.text,[],Z,q),Q.push(ye);continue}if(ye=this.tokenizer.autolink(Y,Ce)){Y=Y.substring(ye.raw.length),Q.push(ye);continue}if(!Z&&(ye=this.tokenizer.url(Y,Ce))){Y=Y.substring(ye.raw.length),Q.push(ye);continue}if(ye=this.tokenizer.inlineText(Y,q,Ae)){Y=Y.substring(ye.raw.length),de=ye.raw.slice(-1),Q.push(ye);continue}if(Y){var at="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(at);break}else throw new Error(at)}}return Q},z(se,null,[{key:"rules",get:function(){return{block:Te,inline:pe}}}]),se}(),Be=F.defaults,Qe=G.cleanUrl,je=G.escape,De=function(){function se(ee){this.options=ee||Be}var te=se.prototype;return te.code=function(Y,Q,Z){var q=(Q||"").match(/\S*/)[0];if(this.options.highlight){var de=this.options.highlight(Y,q);de!=null&&de!==Y&&(Z=!0,Y=de)}return q?'<pre><code class="'+this.options.langPrefix+je(q,!0)+'">'+(Z?Y:je(Y,!0))+`</code></pre>
`:"<pre><code>"+(Z?Y:je(Y,!0))+`</code></pre>
`},te.blockquote=function(Y){return`<blockquote>
`+Y+`</blockquote>
`},te.html=function(Y){return Y},te.heading=function(Y,Q,Z,q){return this.options.headerIds?"<h"+Q+' id="'+this.options.headerPrefix+q.slug(Z)+'">'+Y+"</h"+Q+`>
`:"<h"+Q+">"+Y+"</h"+Q+`>
`},te.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},te.list=function(Y,Q,Z){var q=Q?"ol":"ul",de=Q&&Z!==1?' start="'+Z+'"':"";return"<"+q+de+`>
`+Y+"</"+q+`>
`},te.listitem=function(Y){return"<li>"+Y+`</li>
`},te.checkbox=function(Y){return"<input "+(Y?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},te.paragraph=function(Y){return"<p>"+Y+`</p>
`},te.table=function(Y,Q){return Q&&(Q="<tbody>"+Q+"</tbody>"),`<table>
<thead>
`+Y+`</thead>
`+Q+`</table>
`},te.tablerow=function(Y){return`<tr>
`+Y+`</tr>
`},te.tablecell=function(Y,Q){var Z=Q.header?"th":"td",q=Q.align?"<"+Z+' align="'+Q.align+'">':"<"+Z+">";return q+Y+"</"+Z+`>
`},te.strong=function(Y){return"<strong>"+Y+"</strong>"},te.em=function(Y){return"<em>"+Y+"</em>"},te.codespan=function(Y){return"<code>"+Y+"</code>"},te.br=function(){return this.options.xhtml?"<br/>":"<br>"},te.del=function(Y){return"<del>"+Y+"</del>"},te.link=function(Y,Q,Z){if(Y=Qe(this.options.sanitize,this.options.baseUrl,Y),Y===null)return Z;var q='<a href="'+je(Y)+'"';return Q&&(q+=' title="'+Q+'"'),q+=">"+Z+"</a>",q},te.image=function(Y,Q,Z){if(Y=Qe(this.options.sanitize,this.options.baseUrl,Y),Y===null)return Z;var q='<img src="'+Y+'" alt="'+Z+'"';return Q&&(q+=' title="'+Q+'"'),q+=this.options.xhtml?"/>":">",q},te.text=function(Y){return Y},se}(),Pe=function(){function se(){}var te=se.prototype;return te.strong=function(Y){return Y},te.em=function(Y){return Y},te.codespan=function(Y){return Y},te.del=function(Y){return Y},te.html=function(Y){return Y},te.text=function(Y){return Y},te.link=function(Y,Q,Z){return""+Z},te.image=function(Y,Q,Z){return""+Z},te.br=function(){return""},se}(),Le=function(){function se(){this.seen={}}var te=se.prototype;return te.slug=function(Y){var Q=Y.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Q)){var Z=Q;do this.seen[Z]++,Q=Z+"-"+this.seen[Z];while(this.seen.hasOwnProperty(Q))}return this.seen[Q]=0,Q},se}(),Re=F.defaults,Ue=G.unescape,We=function(){function se(ee){this.options=ee||Re,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 Le}se.parse=function(Y,Q){var Z=new se(Q);return Z.parse(Y)};var te=se.prototype;return te.parse=function(Y,Q){Q===void 0&&(Q=!0);var Z="",q,de,ye,Me,et,qe,at,gt,yt,st,_t,xt,Bt,Dt,pt,Nt,rr,Gt,Vt=Y.length;for(q=0;q<Vt;q++){st=Y[q];switch(st.type){case"space":continue;case"hr":{Z+=this.renderer.hr();continue}case"heading":{Z+=this.renderer.heading(this.parseInline(st.tokens),st.depth,Ue(this.parseInline(st.tokens,this.textRenderer)),this.slugger);continue}case"code":{Z+=this.renderer.code(st.text,st.lang,st.escaped);continue}case"table":{for(gt="",at="",Me=st.header.length,de=0;de<Me;de++)at+=this.renderer.tablecell(this.parseInline(st.tokens.header[de]),{header:!0,align:st.align[de]});for(gt+=this.renderer.tablerow(at),yt="",Me=st.cells.length,de=0;de<Me;de++){for(qe=st.tokens.cells[de],at="",et=qe.length,ye=0;ye<et;ye++)at+=this.renderer.tablecell(this.parseInline(qe[ye]),{header:!1,align:st.align[ye]});yt+=this.renderer.tablerow(at)}Z+=this.renderer.table(gt,yt);continue}case"blockquote":{yt=this.parse(st.tokens),Z+=this.renderer.blockquote(yt);continue}case"list":{for(_t=st.ordered,xt=st.start,Bt=st.loose,Me=st.items.length,yt="",de=0;de<Me;de++)pt=st.items[de],Nt=pt.checked,rr=pt.task,Dt="",pt.task&&(Gt=this.renderer.checkbox(Nt),Bt?pt.tokens.length>0&&pt.tokens[0].type==="text"?(pt.tokens[0].text=Gt+" "+pt.tokens[0].text,pt.tokens[0].tokens&&pt.tokens[0].tokens.length>0&&pt.tokens[0].tokens[0].type==="text"&&(pt.tokens[0].tokens[0].text=Gt+" "+pt.tokens[0].tokens[0].text)):pt.tokens.unshift({type:"text",text:Gt}):Dt+=Gt),Dt+=this.parse(pt.tokens,Bt),yt+=this.renderer.listitem(Dt,rr,Nt);Z+=this.renderer.list(yt,_t,xt);continue}case"html":{Z+=this.renderer.html(st.text);continue}case"paragraph":{Z+=this.renderer.paragraph(this.parseInline(st.tokens));continue}case"text":{for(yt=st.tokens?this.parseInline(st.tokens):st.text;q+1<Vt&&Y[q+1].type==="text";)st=Y[++q],yt+=`
`+(st.tokens?this.parseInline(st.tokens):st.text);Z+=Q?this.renderer.paragraph(yt):yt;continue}default:{var Xt='Token with "'+st.type+'" type was not found.';if(this.options.silent){console.error(Xt);return}else throw new Error(Xt)}}}return Z},te.parseInline=function(Y,Q){Q=Q||this.renderer;var Z="",q,de,ye=Y.length;for(q=0;q<ye;q++){de=Y[q];switch(de.type){case"escape":{Z+=Q.text(de.text);break}case"html":{Z+=Q.html(de.text);break}case"link":{Z+=Q.link(de.href,de.title,this.parseInline(de.tokens,Q));break}case"image":{Z+=Q.image(de.href,de.title,de.text);break}case"strong":{Z+=Q.strong(this.parseInline(de.tokens,Q));break}case"em":{Z+=Q.em(this.parseInline(de.tokens,Q));break}case"codespan":{Z+=Q.codespan(de.text);break}case"br":{Z+=Q.br();break}case"del":{Z+=Q.del(this.parseInline(de.tokens,Q));break}case"text":{Z+=Q.text(de.text);break}default:{var Me='Token with "'+de.type+'" type was not found.';if(this.options.silent){console.error(Me);return}else throw new Error(Me)}}}return Z},se}(),ke=G.merge,Ke=G.checkSanitizeDeprecation,ze=G.escape,ge=F.getDefaults,Ye=F.changeDefaults,He=F.defaults;function xe(se,te,ee){if(typeof se=="undefined"||se===null)throw new Error("marked(): input parameter is undefined or null");if(typeof se!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(se)+", string expected");if(typeof te=="function"&&(ee=te,te=null),te=ke({},xe.defaults,te||{}),Ke(te),ee){var Y=te.highlight,Q;try{Q=we.lex(se,te)}catch(ye){return ee(ye)}var Z=function(Me){var et;if(!Me)try{et=We.parse(Q,te)}catch(qe){Me=qe}return te.highlight=Y,Me?ee(Me):ee(null,et)};if(!Y||Y.length<3)return Z();if(delete te.highlight,!Q.length)return Z();var q=0;xe.walkTokens(Q,function(ye){ye.type==="code"&&(q++,setTimeout(function(){Y(ye.text,ye.lang,function(Me,et){if(Me)return Z(Me);et!=null&&et!==ye.text&&(ye.text=et,ye.escaped=!0),q--,q===0&&Z()})},0))}),q===0&&Z();return}try{var de=we.lex(se,te);return te.walkTokens&&xe.walkTokens(de,te.walkTokens),We.parse(de,te)}catch(ye){if(ye.message+=`
Please report this to https://github.com/markedjs/marked.`,te.silent)return"<p>An error occurred:</p><pre>"+ze(ye.message+"",!0)+"</pre>";throw ye}}xe.options=xe.setOptions=function(se){return ke(xe.defaults,se),Ye(xe.defaults),xe},xe.getDefaults=ge,xe.defaults=He,xe.use=function(se){var te=ke({},se);if(se.renderer&&function(){var Y=xe.defaults.renderer||new De,Q=function(de){var ye=Y[de];Y[de]=function(){for(var Me=arguments.length,et=new Array(Me),qe=0;qe<Me;qe++)et[qe]=arguments[qe];var at=se.renderer[de].apply(Y,et);return at===!1&&(at=ye.apply(Y,et)),at}};for(var Z in se.renderer)Q(Z);te.renderer=Y}(),se.tokenizer&&function(){var Y=xe.defaults.tokenizer||new fe,Q=function(de){var ye=Y[de];Y[de]=function(){for(var Me=arguments.length,et=new Array(Me),qe=0;qe<Me;qe++)et[qe]=arguments[qe];var at=se.tokenizer[de].apply(Y,et);return at===!1&&(at=ye.apply(Y,et)),at}};for(var Z in se.tokenizer)Q(Z);te.tokenizer=Y}(),se.walkTokens){var ee=xe.defaults.walkTokens;te.walkTokens=function(Y){se.walkTokens(Y),ee&&ee(Y)}}xe.setOptions(te)},xe.walkTokens=function(se,te){for(var ee=k(se),Y;!(Y=ee()).done;){var Q=Y.value;te(Q);switch(Q.type){case"table":{for(var Z=k(Q.tokens.header),q;!(q=Z()).done;){var de=q.value;xe.walkTokens(de,te)}for(var ye=k(Q.tokens.cells),Me;!(Me=ye()).done;)for(var et=Me.value,qe=k(et),at;!(at=qe()).done;){var gt=at.value;xe.walkTokens(gt,te)}break}case"list":{xe.walkTokens(Q.items,te);break}default:Q.tokens&&xe.walkTokens(Q.tokens,te)}}},xe.Parser=We,xe.parser=We.parse,xe.Renderer=De,xe.TextRenderer=Pe,xe.Lexer=we,xe.lexer=we.lex,xe.Tokenizer=fe,xe.Slugger=Le,xe.parse=xe;var Ie=xe;return Ie})},ELLl:function(ut,$e,J){(function(re){re(J("VrN/"))})(function(re){var z={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},L=re.Pos;re.defineOption("autoCloseBrackets",!1,function(_,b,d){d&&d!=re.Init&&(_.removeKeyMap(k),_.state.closeBrackets=null),b&&(P(H(b,"pairs")),_.state.closeBrackets=b,_.addKeyMap(k))});function H(_,b){return b=="pairs"&&typeof _=="string"?_:typeof _=="object"&&_[b]!=null?_[b]:z[b]}var k={Backspace:D,Enter:R};function P(_){for(var b=0;b<_.length;b++){var d=_.charAt(b),s="'"+d+"'";k[s]||(k[s]=F(d))}}P(z.pairs+"`");function F(_){return function(b){return w(b,_)}}function M(_){var b=_.state.closeBrackets;if(!b||b.override)return b;var d=_.getModeAt(_.getCursor());return d.closeBrackets||b}function D(_){var b=M(_);if(!b||_.getOption("disableInput"))return re.Pass;for(var d=H(b,"pairs"),s=_.listSelections(),u=0;u<s.length;u++){if(!s[u].empty())return re.Pass;var l=T(_,s[u].head);if(!l||d.indexOf(l)%2!=0)return re.Pass}for(var u=s.length-1;u>=0;u--){var S=s[u].head;_.replaceRange("",L(S.line,S.ch-1),L(S.line,S.ch+1),"+delete")}}function R(_){var b=M(_),d=b&&H(b,"explode");if(!d||_.getOption("disableInput"))return re.Pass;for(var s=_.listSelections(),u=0;u<s.length;u++){if(!s[u].empty())return re.Pass;var l=T(_,s[u].head);if(!l||d.indexOf(l)%2!=0)return re.Pass}_.operation(function(){var S=_.lineSeparator()||`
`;_.replaceSelection(S+S,null),_.execCommand("goCharLeft"),s=_.listSelections();for(var h=0;h<s.length;h++){var g=s[h].head.line;_.indentLine(g,null,!0),_.indentLine(g+1,null,!0)}})}function E(_){var b=re.cmpPos(_.anchor,_.head)>0;return{anchor:new L(_.anchor.line,_.anchor.ch+(b?-1:1)),head:new L(_.head.line,_.head.ch+(b?1:-1))}}function w(_,b){var d=M(_);if(!d||_.getOption("disableInput"))return re.Pass;var s=H(d,"pairs"),u=s.indexOf(b);if(u==-1)return re.Pass;for(var l=H(d,"closeBefore"),S=H(d,"triples"),h=s.charAt(u+1)==b,g=_.listSelections(),C=u%2==0,y,f=0;f<g.length;f++){var c=g[f],o=c.head,a,m=_.getRange(o,L(o.line,o.ch+1));if(C&&!c.empty())a="surround";else if((h||!C)&&m==b)h&&A(_,o)?a="both":S.indexOf(b)>=0&&_.getRange(o,L(o.line,o.ch+3))==b+b+b?a="skipThree":a="skip";else if(h&&o.ch>1&&S.indexOf(b)>=0&&_.getRange(L(o.line,o.ch-2),o)==b+b){if(o.ch>2&&/\bstring/.test(_.getTokenTypeAt(L(o.line,o.ch-2))))return re.Pass;a="addFour"}else if(h){var p=o.ch==0?" ":_.getRange(L(o.line,o.ch-1),o);if(!re.isWordChar(m)&&p!=b&&!re.isWordChar(p))a="both";else return re.Pass}else if(C&&(m.length===0||/\s/.test(m)||l.indexOf(m)>-1))a="both";else return re.Pass;if(!y)y=a;else if(y!=a)return re.Pass}var v=u%2?s.charAt(u-1):b,O=u%2?b:s.charAt(u+1);_.operation(function(){if(y=="skip")_.execCommand("goCharRight");else if(y=="skipThree")for(var U=0;U<3;U++)_.execCommand("goCharRight");else if(y=="surround"){for(var j=_.getSelections(),U=0;U<j.length;U++)j[U]=v+j[U]+O;_.replaceSelections(j,"around"),j=_.listSelections().slice();for(var U=0;U<j.length;U++)j[U]=E(j[U]);_.setSelections(j)}else y=="both"?(_.replaceSelection(v+O,null),_.triggerElectric(v+O),_.execCommand("goCharLeft")):y=="addFour"&&(_.replaceSelection(v+v+v+v,"before"),_.execCommand("goCharRight"))})}function T(_,b){var d=_.getRange(L(b.line,b.ch-1),L(b.line,b.ch+1));return d.length==2?d:null}function A(_,b){var d=_.getTokenAt(L(b.line,b.ch+1));return/\bstring/.test(d.type)&&d.start==b.ch&&(b.ch==0||!/\bstring/.test(_.getTokenTypeAt(b)))}})},FdIy:function(ut,$e,J){},G8my:function(ut,$e,J){ut.exports={flex:"flex___1FMOA",gMAmTc:"gMAmTc___sjLYr",kJYYQv:"kJYYQv___201JW",kTLhbM:"kTLhbM___3-mJH",listPagin:"listPagin___ex1Fn",iwMcWy:"iwMcWy___r44cm",kgxtyB:"kgxtyB___2gaNm",cPointer:"cPointer___2PAqq",forumList:"forumList___B_wlp",cOuXkk:"cOuXkk___2r4cw",tag:"tag___3KW5_",tagRed:"tagRed___2ak3H",tagOrange:"tagOrange___G1mGK",tagBlue:"tagBlue___1kOwU",tag_Red:"tag_Red___2mnNO",tag_Orange:"tag_Orange___1G47P",tag_Blue:"tag_Blue___2h7Lr",orange:"orange___3jpZ5",blue:"blue___3sShf",iconWrap:"iconWrap___k5I-P",spanText:"spanText___2za-n",dGqnMq:"dGqnMq___32gnR",dicrWo:"dicrWo___XT8T9","task-hide":"task-hide___3oV1f",textTitle:"textTitle___1SFcY",textType:"textType___1-4lN",educontent:"educontent___BaVbR",row:"row___yfLgK",box:"box___WqINE",long:"long___1Pzb3",whiteBack:"whiteBack___1QE7L",headerInfo:"headerInfo___259Mk",headerInfoLeft:"headerInfoLeft___1BA7P",originalTag:"originalTag___2jS8-",titleStyle:"titleStyle___t_kol",igfjXB:"igfjXB___2-O-u",taskHide:"taskHide___2l1A6",content:"content___BFYWn",mt15:"mt15___2J4CC",greenLiftLine:"greenLiftLine___2ta-4",title:"title___2sYOv",Short:"Short___1Gfeh",BestUl:"BestUl___3wQQl"}},HmJG:function(ut,$e,J){},Jtvl:function(ut,$e){ut.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFIAAABLCAYAAADj9dDIAAAZrElEQVR4Xs1cB1RUR/e/773ty+5SFDV2jcYSsfcGItZosCYa1BgjmCiW5IsJmmiMiolfks8SC9YoavzbNQUVRcResPeKwY7A9r7v/c+dBbPAlreASeYcD8ezU+7cN3Pn3t/9zVDwLyscAKVLjAwGsIQAMCEccEFA0SzHOmwsRVtFNKe2gujP4C8OaP5NolP/tDDaxPAGHAeRnEDUlK5Ut4kguFpjShGqoKRKIP8kCgCOBWDtwDnswJl1wGqfA6fP03C6nCz70+uZYDadYinuZJD1yBVqFrD/xJz+dkVyM4HWSLp0pxnZIKZWs55M9bCaglqtgK5YCyhG6LcOOIcNHM/ugOPxNXBkX3zmuHdmN2cz78w2P097c9Y1q98dlrLB36bI3DldqgsEzGimZssPhG9G1RTW7wyUSFpKsT034yxGsN09AfabR17Ybh1bJbJbl8q+zMgu94GKdfjKFYkKFIoDpgub9RktatFfRAdX92tOuOI4mwUoigYQioGiGd7tWfUTsJzbZbddSd1Jm3NnKj7PuM67sZ8VX5kiNTPbB4Nc9bWwae9YcfvhYlpRwa1onNUIDvUT4PS5AGI5CKs2LlLPkfsn2O6dBmAdwNktQDEiYKo2BmH1Jrynypn1YDn5i92WuXsNzRpmBkxNf8q7Mc+Kr0SR6jldhwjqtV8s7RFfiQ58za0orFkP1msHAaxGoFWVARXt/FvRy77lgLOZASgKKKGkSD3783tACYSA43latXhIWQ6v1tsu7ftc+eXhZRQAx1NPPquVqyJ1X3cI5YKrJIm7jokWhfUCAC/dcyyw+lygAyoQxZS12J/fBfuTGwBmHTCVG4CgyhsebbDt1jEwpf6Ualc/HhPixn5qV4zuoIxde9wfmco+g4LR1HPCWwlqN98h7T+9Oh0Q8lIGjuPAkXMPKLEcGFVlf2QrVV3WpAX7o6vAqh+DuMUAoGja/Y4wqsG8/3/5thvp7wYmZOzHSvqVI8Ps6heLwGbsIgiu1jNg3IZUvkKUiyLzE7uMErcctFwS+ZHE1YVhdS/AevsoUAIxCOu0AVcF8xWw1PXQ98QDylvhODAfWWu3HN/8JS2R12HBMVbSPoaiZIFg3rfgulKf8iZfv7TMilTPi0yQ9IhPFLd422UVsmDPOgeO53eJApmKtUutj/JsiA49xQj+6pJjwXrxDzClrwJh/U4g6ToGaHkQAMeBLjkeKM3TeMXE7T/xkaFMitR8GzlD0uezWaImPUuMZX98A5jQ2mQ1/hsKxzrAkrkTBFUbg+C1hmD/8yLaSaDEMpB2nwBM5XpFvYWnt0C/YZJWpVTUoOK2+gxHS61IzfyoGZI+U2eJGnf/N+iJlwxoPy0XfgP7/Uzg8h+CtNs4EDaM8NjW+Pt8sN05uTxw8s6PfA1QKkVq5obHSHpOWi9qGV2q9p6EQp/S/vAqsDn3wPHiAXCGfGBNGuJDEtsrkgKtrETcJKbKG2RlUZIAX3Mkv3NWE/qSYMncDeLWg0Dc7h2fu4U15IF+xWiWVlZsqvhw9RVvA/mtCG1i1/bCVoPSJFHxLx05+9NbBFgQVGnAa1KulTiTFqxXUsF2MwMcT28TBTGhdYHB2DsgxAlc0AIgEY7FCJz2GTjyH4PjyQ1wPL0JdIXaIGrQBYSNIokvWqJwHPFXzYdWgKB6GEgi4oBWevFVi3VAlH9800HVp7953Xp+KRL9RKpBp0uyIYmVCp1ee859sGedBVGT3kDzXB0oqyPvIViOrgfbneMgfL0DCBtHgqBGM6CE/G0qHh72B+fBfjMDrDcOg7BWSxC3e5d8DDLGkxtg3L+YrGhpj3hiH/0t+AF1K94HinVEKyf8325P7f1SpHbhwB3y0UkDCr+8Q/2YrCRRWB+gpUpeMrJGDZgPJYHt9nEQtxkM4hbRvLenV0/GYgTr5b1gObEJmJotiP9ov3cGJOFjgRyGZXD6bbePgXH3nPvn9eb6EbPS7e7k4K1ITWLXEZL+X64vPFw4u5WcgsI3ugATWIWXEm3X0sB44CcQNY4CSaeRxEkvz0JkOrEJLKe3gahFf5B0jAFKJCuXIQy//AfY5/e+UE7e+V2pFalNjAxhGna6LYv+Osi1E9aoBloW6FNQ3IKmAz8R31Lebxowr/lvS30NYrt1BEwHlwFTsQ5IIz8GOsh9jO+rH0+/O3KyQLduvEkQEFJL8VHy8+L1eK1Izfc9FwR8sHoSHVTVbznwgDBsTSDbV9ZvWrmvQkfOfTClLiYnvDQqHgS1WvgtI98Gpv2LwHY9bb1q8u5RfitSPbtDXXG7Ydck3SeI+A5YWI+z6EG/eSoIKtcHaY9JZbJTxcfG096csQas19NB0vl9EDfvB+AHVon9obvFGTVA8zRNOKZuxUhOoAhpIx+z5qyrTD5XpGZB/+SAsetjaJnKLz3idka7woTWISulLMbedWCOtYP13B4wH10PokbdQNJ5NFBShV+yuX5o7eIhII2IA4yvLRd+BdlbCe7dqIJGeC6YD608EfhZSgfeijTM7VyFbj00SxLlXI2sNgfsT2+AqH5nn4Ib//geOKMa5IO+8Q0e+OzNWcF27wyYDywhfqCk+3hgKtTi2dJDNY4D9beRzuQaAMEEFGPXeu+TdYBu9YfAWQzvqeK3biqs7HVF5idGzFLErZvBFKQHLFf2AxNSw6fjjaez6eh6ULy/rFzyMmzeQzAdXEqiHWn38SCsV2QxlEqZ6B9irG0995drKKjeBAJiFvr88PasTNBvm/7khZiuXW9iigUF8KjIs7EthQ2iemXLB8+pRFajUQ3Wy/tA3Hqw17wJgrX4xQKGfvvSMS7VTNGGWQxgPpYM1kspIGk3DEStB5Uq0+hufEvmLrAc3wisLqfIz+L2w0EaEetTZMO2L8Hx+Ops1aRdM7wqUj23a5S0//T9ojejSKfWuydJvkTo41TEQB/tDR9hPEqL8NalFDAdXgPCuu1AEo7wVrDPyZWmAtpb494fiT8sbBhOUhiCOm2Kwm1uOmbzH4NuzVibKLhSXdkHa7M9rkj1/J7LlBO3jaPETlDAei0NBHVaA40Jew8FXRH9pk9AOW5Dqd0ce/YlJ7wllIA0CuGt+t71wxWkXUoZuSCYoVs1BhSjk/w+tEyHkhDP3BY4Zc8Qt4rEJL6xyfSHskFz+IUsBVM17kkkpzTGu/4WTEyZ0paD49HVAngr3HvOp2AAw44ZIKzbHkRNe/s75Mv6ODatDPW7PZoe3ZKhHC2vGO5WkXlzO4fJoiZdRLiJb0HISZc0CpQf/+JX7IxZQcsJhLd2grjVQBC3G+YXcGG9tBdMh1aAclxyqXcB3zm61sO8kOnAEnC8yLrMBFSMc6vI3DldYpWjlych3se3WE5vBdzasr5T+TVBeOt6GpjTVoCg2psg6YbwFv9VgYeE5dQWkEZ+BLp1H4OgRnOQdovjN3YZauFhak5LAtutDDWIAhJUk7YnYVrXrSLV83uuVn7y6wf+cHH0yfEg7hADwrptfYrpeHITjKmLAexWkPaYSBTpqyC/B0NBSYcYYLA+RYEuaaTzA6gqg37DFFDGroXShLG+xsbfCSByegtYTm0FSiC6bTVZW1b8fI+usK1bReo3TrkoH/5jGFZiDfmEAYb+o6eCTAbtkqGgnLzbq3uC29+cvhLsd0+DpOuHIApDeMtHpq9gUDzsTCk/AqWoAGz+QxBUawLo9+HWVsStB1PKDwT4lQ+Zy0cvftVBqJAAIpXqgTRyHJgPLn0gHzy3SDTgVpHGPYlaab8EcjyTHLFJC6LX23scHCMOy4mNEPDeArd10Pm1ntkG5hObQdS0D0g6jiBJJ38K+rDWC79DwIhFgDQWtKsIkxl+nQfC2q1A1KwvaJePAPngOeT/5VEwC0oAEZMWpFETQVCzGenWfHAZZ7y2LjBk4imtxxWpntcpSNQ2Jg/jTyzWOyeBliq8osvmYxuAsxpIzFq8IChqOrCUhHPS7ghv+Y8gYZ9o2HHloykwH99Atpg0YixJH+g3TAZF3DqyOm3X0yBgzGq/yFbFZUYggwAiNzOcgEizt4oAIpazO8F+cEFYwBcZlz0qMn9ueDNpz0nnxS2jnYq8nkYwPm9xLTrhCOPjqigsiN+ZDiwm5Chp93gQ1G5ZpkWCq40JrurM61R6nTjQpvSVoPx4E/E78fSXvfU58RwwsSVuOcDv8RBosZ7bBbgwEMBGJbpLrmEOyLhrdreg6YcPeV6Rs7t0kw78+qCokTNNabmUQnIp3lBw/aZPQdJ+GAhqtyLbwHxkLVivHSIouKjF27xWB/py5sOrSWqgRBKLdYBh+1fAGdRAq0JBNuBrIpt26TCQhMeCoGZTQK9BGh4LFjQhJzeDauJ2vxSJjDdz6hKgVZUKAJGank3Z/bNg3PzZkMBp6ds8KjJ3dngvxZBvUoRvOBEeTG4hZ8cbKVS3dhzIesQDZhPNR9aBqGEESLogvOU7j0P8yJObnemBZn1A0mmUR38QQQv92jhQfLASzEfXgQ0R98FzwPjbPFCMWgb2h1cAwVeE1TBS4VPYvGwwpS4BR/4jkEaNJyGpa7HdPUVohK6JPfQ69KvjYgO/OrzSoyK1c7r2k7wzb4/Qy+FSXEDdmjjgTGqgg6s5WQu8KCoc2K4dItEMpl/RfhKOuEkLghpNPeoAjT8SSNF5Zyq/QZSGmKLsrS+IH4v+JdmSPtjAaG/Nx9YTuwoCESg/3uw2vjZn7iQLwzWl4nh8HfTrxn0YOC1jtWdFJoZHS4Z+t1NYt43PD8rmP3LCWzn3SZ4E+TN8iuPpLTDtXwysIRcw+FfE/gzWzN1gvbKfkO/RnaEE7gF5zqQD7fL3SNpCULUhmA6tBITtFGNW8cvTFPJ9MtaQNDAeJIadX4Ny/Ga3opvP7iD20jVLas++DMYN8SNV0w4nezlsukbIomekIfrsqaC/Zj6eDNYLf4Ck3bsgajOYF7zl9CNXge3WUaf9bN4PtIuHAtgtIGren6RndWtiCRMCXSRPBYlPxn0L0U0mAQBJdvFIF7jj+zie3wPj7tkeAV3zqc0gbtaviLnBXLpu4yfDgqenv9R+CT+SxNk9plwUt3Jz6uHXvLyPKAOhJnIwBPCHt2x3ToBhyzRQjF1D8iWm3/9LjDuCtUgSRVuJ7DXLud2giEv2CvnbENaTBoKAR0aS1Tx1AiKPb7gAIs7PhDJZM3eB/B03WVaOA9OxZGda1yVwsN08AqadM3qrEtL3elyRL+Z0qyrvOvIhGn0sjhdZwCEUbzES5xQYIcii4ksN2ho2TyXRiQi31MYpIIueAZZTm4EJfR3EHYYTmh2ewJg7EdbvyMdSeN45PPg+lrPbgc3NBmnPySX6QZIsp39Rgo6NnoHtwKLGimlHrnlUJDczXGBq21cv7f0fwh1BWB0BVg6NeEQcSTiVJZGFJy8i6IpRS4jCbPczIWD4D8C+yALTweXAVKoLCCZjaIqHDjm4eIaRLzWBgMjVAyQc9cX3Me6ZC4KazUnExbdgcKA/uk0ROitd71GR+IN+4+SLsiHfhuFKsZzZTpxbcXuEt4oS4PkOXLwermx0rGXRXxHggSZxPAUkU0kLAM0Kjmt7cB6kGFn4gW/6y/fRLhsO8iGJfiXSjLu+eSEfMLMIE8s9+rNo8EGKprsxrzUiNgXtWHkWzqQB7dLhIOuXQNwVBEgRhED3Sbc8BuSD55JEPyIu4LDxwhkJvIWAyL2zIAn/kBffB82WYfPnzhPbD4RdmzRiv2rchiLs2iKK1K4a1ZHNf7aQDq7WkrAWqhMA6JUU4lDfPk4cZ4ydHY+uEQXqN04h25vkwnkUAm+d2QqWk1tIiOoP3wdz405AYoLbkfBscD1ksBLy4rU/Df4maNrhma6NiCKNy0ZWtVk0PwBND5V0HkMR2N5fu8Rj0q5VMCupXTgQFLHrwPjbtyAO6wW2+2cBfVM8gLzBdoX9kNOTwFt1QNrNT74PywLZ1gNnuT04cYVb7xwHSbN+RWZGILUdX/VVTcv4o4gi83/s9zblcGwRNX9L9CoYYt70i0CEuEU/QjuRD5gFwDBAS9FOer8mh74fkrKQgICRVGn4Pki6wphcMXKJWxEx/CR+aq2iYIt53wKL8cT+0JBZKS8hNOyAyl81piateXI74IOVQk+3tNyN5C9vxl0fhh0zSXoB/Ug+hcBbCIjcOExi8tLwfcg4HAu61WMJHuAuGkO3B90iEhq63BnCdtrl76WoPt5c4ognW1uzcMAcpmrj6fJBs/nMxymLRU9iXH94M8U7J7G1Ic9nrobwfTL3kNi4rHwflAHja+tFBIkXu52vI/8h2LPOOz+US8HQ0LBx4tjAhPRVxRsSRd6fGS4JDhDfkw2ZVwV9Kl6lNLwZXh0XreTk+/xElF0efB9Wn1fABJnnMaiwP78DFMWUAF9M+xdaHZnbqymmHSlKz3BNHGsWD42hJPJkhKh82aiy8Gb46vIl3yf3AUgjy4fvgxeRDNumkSgKLyf5U5w57OEbVZ/uiXHXroj7o/m+9wlxRFw711tc7hqVlTfjbQKvku+D6QPCGn5vgU9KSnEZMSy07F/UVvXlkdM+FWlcNbKNTa85qYhLpshbEj5KaXkzbrsl8FYKmAi81a7gOht/QMSnrJdSCKcyYNQyoOW+6dqu/aEt168Ze1IZ+7PHDGCJyEazIDpZ2KhbDB+HuCy8maJGHPk+i4ESSvnxfXxprdjvCISYM9aCfPiPwIS4f8EAlYVbH+98l1iNmbvAvG9R98Dphw56GrqEIvUrh1Wyq9VZAe8vkzAVPOctCjssLW8G27/k+zxEvk8cCEmeyCeJmL8aye3Xnwn0Jx/+AzBeMpjW28cJmFw8lYvYq27V6L2qCVu8kovcx9r/i04QVK6XKH93Pn+h/aj5F99nFwEo/OX78BkK0SPEOzFNjMkycuvVQ0FEynb/tPPOT7GXXszpqxyOU8nNXVOvPm1kYQWE0jRyyW3ZgBm1/Mnd+JzgS75PEqGdEEDED76Pz/6xAo5xZR+Y0pKcZATkmLteLS7WCbpDliv7QPxmjxL3yRFJ0idP/C7w89QvfI3tcR9pl707gANmB3Kq/eEAefzqLnwffLfCkZdNklTCBl3IXcMyF44DJCOgLcTXWGS9EPwoenXY3RiWi38AU7URCIrx0REMMayfcPnphUOt6y2+Q+jN3opXg6T+oW+apOOICHHbd3z14/F3T3wfQnNB6nH+I4LakBtkoXX8HgeTZ8gLwgMFM4oYOgrr4eHKz9aWuAxfIIEpdbHVkrmtXVBCxnk+QnkdTb/2/SZ2de5Fxdh1lDcb424gvnwfBCDwDqHtRgbBBJGZxrzWkFBbEAdFxjBuTYS0EPLi9HmElO/IuUvCOLCZSbyM27jwMiefiXurY73wGxj/+O+YoOkZa/j25fOzqf8XnSSs3yFW1uczvn2SLVYavg9R0KOrYH9ykzzuweEbaGYDYKxNnqiRKoGWBQFdoQah0SAbDf/6A8q6wxhdJ4YZQsOWad8HTt3Lf8J81r966fAgzpD3QBGzSFH8uYLimsX8Nt6DQfBTEjWh3FhhvL+gl4rktZcn10kOHm/zUm4Qccy367cm7FLl7hjE91GQwiF9rkisqFs0YCIEVlsYMAJzySWb/MX3SS/g+/TnxfcpDwXx6YO1GEjaFaE/Ao25idoIe2Lb9J0qyZ/vUHGZNj79utbhpUjywl5Ar2uyvlPfKPIGBD64cX6PV74PrgR8baq8rxTzmSg+CII8HXv2RcKWQ5ereOoA+8GbFMYdM7Yq8zXDKQ/3sX2Nx0uR2Il+2YierMOSEhC7nsJb/vjABkGptc+PAy04I+4wLF7c9t0S9Ft0jC2X94IgtA4IqoX55OT4EpjP70SBz26Tl1TwOQdh7dbODKWbYj3/KxgPLFkYWEv5KTV0q4NP/+7q8FYkNlb/8NbvwsaRfTDH7bif+Rjkqv+oxm/5hWz/xIiBTFiv9ZKoCfLil80xJrc/vAT2Z3dJmIaYJ98XB0ozMcvVVACWBSGO48HhR6/CnLrEZDu/K86Vw1Oa8bCNX4rUrH2/Hpf7/BIlEM9/TpsTC+/hFQ6Or5NChZrrpD2ntHHHKEMnF0n1eCmdz4V5n5NCJoTDWuK1FFSStyAC7aFp36Lrjie3YgKnp2FypszFL0XiaNyi3mKq4CKju9G5LUMY9Z3cBEnrAV+JO44S8bkCzLHIKUpxvqgiCyLPJ1ASOTDKovl08iFy7hF/Et/GwJw4E/QaiBrg5SbfhcT4R362ms9sn//iUdYcPhGL716dNfxWJN+OtYmd6rPy0G8lbd+JxveBPNH0yMcp4NhgChR5iwjuYhE16FpkOFSELSuTZBopeRC580jzeBeDBAcXfgfr6a1p9vzsKcHTj1ziOw++9V6ZIgsFyEuM6CgIqTZXFNa7q6hpX14sXr7C+6qHttl6NRWsp7cddeRnfxWUkJ7uq01pf3/liiwUTD83vJldHDBR1DhimLBRpIRcUvLz6QS+k0TUxnYpxWy9cXgXa1CvcCXN8+3D33p/myILBdP82D6YNYveppWVBwrrtukuqNVSQjjaHp6O5TMhNAX2B+fQk7Dasy8eZ3Pu7wSJdYPqkxN5fNqXR52/XZGuQud811HBOJjOFFBt6eDq7QSV6rekFBVCEKzAN9AImZ8ROPFEinbaTwQuTBpgNc8QOcpx5D644sjJusRw9jSFik6jxv9FtSsPBfHt4x9VpNtTf2ZbZT4jrskwTA2WY4OB4oQUR4tYimUYGtQAdC4Al2sxU9mhs8r/0WG+iite7/8BQUB7OjiQOkYAAAAASUVORK5CYII="},LdHM:function(ut,$e,J){"use strict";J.d($e,"b",function(){return l}),J.d($e,"a",function(){return h});var re=J("1OyB"),z=J("vuIU"),L=J("Ji7U"),H=J("LK+K"),k=J("q1tI"),P=J("rePB"),F=J("Ff2n"),M=J("ODXe"),D=J("4IlW"),R=J("bX4T"),E=J("YrtM"),w=J("TSYQ"),T=J.n(w),A=J("+nKL"),_=J("8OUc"),b=function(V,$){var ie=V.prefixCls,oe=V.id,_e=V.flattenOptions,fe=V.childrenAsData,Se=V.values,be=V.searchValue,me=V.multiple,le=V.defaultActiveFirstOption,ue=V.height,Ee=V.itemHeight,Ge=V.notFoundContent,Te=V.open,pe=V.menuItemSelectedIcon,Ae=V.virtual,Ce=V.onSelect,we=V.onToggleOpen,Be=V.onActiveValue,Qe=V.onScroll,je=V.onMouseEnter,De="".concat(ie,"-item"),Pe=Object(E.a)(function(){return _e},[Te,_e],function(Ie,se){return se[0]&&Ie[1]!==se[1]}),Le=k.useRef(null),Re=function(se){se.preventDefault()},Ue=function(se){Le.current&&Le.current.scrollTo({index:se})},We=function(se){for(var te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ee=Pe.length,Y=0;Y<ee;Y+=1){var Q=(se+Y*te+ee)%ee,Z=Pe[Q],q=Z.group,de=Z.data;if(!q&&!de.disabled)return Q}return-1},ke=k.useState(function(){return We(0)}),Ke=Object(M.a)(ke,2),ze=Ke[0],ge=Ke[1],Ye=function(se){ge(se);var te=Pe[se];if(!te){Be(null,-1);return}Be(te.data.value,se)};k.useEffect(function(){Ye(le!==!1?We(0):-1)},[Pe.length,be]),k.useEffect(function(){var Ie=setTimeout(function(){if(!me&&Te&&Se.size===1){var se=Array.from(Se)[0],te=Pe.findIndex(function(ee){var Y=ee.data;return Y.value===se});Ye(te),Ue(te)}});return function(){return clearTimeout(Ie)}},[Te]);var He=function(se){se!==void 0&&Ce(se,{selected:!Se.has(se)}),me||we(!1)};if(k.useImperativeHandle($,function(){return{onKeyDown:function(se){var te=se.which;switch(te){case D.a.UP:case D.a.DOWN:{var ee=0;if(te===D.a.UP?ee=-1:te===D.a.DOWN&&(ee=1),ee!==0){var Y=We(ze+ee,ee);Ue(Y),Ye(Y)}break}case D.a.ENTER:{var Q=Pe[ze];Q&&!Q.data.disabled?He(Q.data.value):He(void 0),Te&&se.preventDefault();break}case D.a.ESC:we(!1)}},onKeyUp:function(){},scrollTo:function(se){Ue(se)}}}),Pe.length===0)return k.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),className:"".concat(De,"-empty"),onMouseDown:Re},Ge);function xe(Ie){var se=Pe[Ie];if(!se)return null;var te=se.data||{},ee=te.value,Y=te.label,Q=te.children,Z=Object(R.a)(te,!0),q=fe?Q:Y;return se?k.createElement("div",Object.assign({"aria-label":typeof q=="string"?q:null},Z,{key:Ie,role:"option",id:"".concat(oe,"_list_").concat(Ie),"aria-selected":Se.has(ee)}),ee):null}return k.createElement(k.Fragment,null,k.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),style:{height:0,width:0,overflow:"hidden"}},xe(ze-1),xe(ze),xe(ze+1)),k.createElement(A.a,{itemKey:"key",ref:Le,data:Pe,height:ue,itemHeight:Ee,fullHeight:!1,onMouseDown:Re,onScroll:Qe,virtual:Ae,onMouseEnter:je},function(Ie,se){var te,ee=Ie.group,Y=Ie.groupOption,Q=Ie.data,Z=Q.label,q=Q.key;if(ee)return k.createElement("div",{className:T()(De,"".concat(De,"-group"))},Z!==void 0?Z:q);var de=Q.disabled,ye=Q.value,Me=Q.title,et=Q.children,qe=Q.style,at=Q.className,gt=Object(F.a)(Q,["disabled","value","title","children","style","className"]),yt=Se.has(ye),st="".concat(De,"-option"),_t=T()(De,st,at,(te={},Object(P.a)(te,"".concat(st,"-grouped"),Y),Object(P.a)(te,"".concat(st,"-active"),ze===se&&!de),Object(P.a)(te,"".concat(st,"-disabled"),de),Object(P.a)(te,"".concat(st,"-selected"),yt),te)),xt=fe?et:Z,Bt=!pe||typeof pe=="function"||yt;return k.createElement("div",Object.assign({},gt,{"aria-selected":yt,className:_t,title:Me,onMouseMove:function(){if(ze===se||de)return;Ye(se)},onClick:function(){de||He(ye)},style:qe}),k.createElement("div",{className:"".concat(st,"-content")},xt||ye),k.isValidElement(pe)||yt,Bt&&k.createElement(_.a,{className:"".concat(De,"-option-state"),customizeIcon:pe,customizeIconProps:{isSelected:yt}},yt?"\u2713":null))}))},d=k.forwardRef(b);d.displayName="OptionList";var s=d,u=function(){return null};u.isSelectOption=!0;var l=u,S=function(){return null};S.isSelectOptGroup=!0;var h=S,g=J("VTBJ"),C=J("Zm9Q");function y(N){var V=N.key,$=N.props,ie=$.children,oe=$.value,_e=Object(F.a)($,["children","value"]);return Object(g.a)({key:V,value:oe!==void 0?oe:V,children:ie},_e)}function f(N){var V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(C.a)(N).map(function($,ie){if(!k.isValidElement($)||!$.type)return null;var oe=$.type.isSelectOptGroup,_e=$.key,fe=$.props,Se=fe.children,be=Object(F.a)(fe,["children"]);return V||!oe?y($):Object(g.a)(Object(g.a)({key:"__RC_SELECT_GRP__".concat(_e===null?ie:_e,"__"),label:_e},be),{},{options:f(Se)})}).filter(function($){return $})}var c=J("2Qr1"),o=J("qNPg"),a=J("U8pU"),m=J("Kwbf"),p=J("WKfj");function v(N){var V=N.mode,$=N.options,ie=N.children,oe=N.backfill,_e=N.allowClear,fe=N.placeholder,Se=N.getInputElement,be=N.showSearch,me=N.onSearch,le=N.defaultOpen,ue=N.autoFocus,Ee=N.labelInValue,Ge=N.value,Te=N.inputValue,pe=N.optionLabelProp,Ae=V==="multiple"||V==="tags",Ce=be!==void 0?be:Ae||V==="combobox",we=$||f(ie);if(Object(m.a)(V!=="tags"||we.every(function(De){return!De.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),V==="tags"||V==="combobox"){var Be=we.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(m.a)(!Be,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(m.a)(V!=="combobox"||!pe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(m.a)(V==="combobox"||!oe,"`backfill` only works with `combobox` mode."),Object(m.a)(V==="combobox"||!Se,"`getInputElement` only work with `combobox` mode."),Object(m.b)(V!=="combobox"||!Se||!_e||!fe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),me&&!Ce&&V!=="combobox"&&V!=="tags"&&Object(m.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(m.b)(!le||ue,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Ge!=null){var Qe=Object(p.d)(Ge);Object(m.a)(!Ee||Qe.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(m.a)(!Ae||Array.isArray(Ge),"`value` should be array when `mode` is `multiple` or `tags`")}if(ie){var je=null;Object(C.a)(ie).some(function(De){if(!k.isValidElement(De)||!De.type)return!1;var Pe=De.type;if(Pe.isSelectOption)return!1;if(Pe.isSelectOptGroup){var Le=Object(C.a)(De.props.children).every(function(Re){return!k.isValidElement(Re)||!De.type||Re.type.isSelectOption?!0:(je=Re.type,!1)});return!Le}return je=Pe,!0}),je&&Object(m.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(je.displayName||je.name||je,"`.")),Object(m.a)(Te===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var O=v,U=Object(o.a)({prefixCls:"rc-select",components:{optionList:s},convertChildrenToData:f,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:O,fillOptionsWithMissingValue:c.a}),j=function(N){Object(L.a)($,N);var V=Object(H.a)($);function $(){var ie;return Object(re.a)(this,$),ie=V.apply(this,arguments),ie.selectRef=k.createRef(),ie.focus=function(){ie.selectRef.current.focus()},ie.blur=function(){ie.selectRef.current.blur()},ie}return Object(z.a)($,[{key:"render",value:function(){return k.createElement(U,Object.assign({ref:this.selectRef},this.props))}}]),$}(k.Component);j.Option=l,j.OptGroup=h;var G=j,B=$e.c=G},M8RZ:function(ut,$e,J){"use strict";J.d($e,"a",function(){return D});var re=J("fWQN"),z=J("mtLc"),L=J("yKVA"),H=J("879j"),k=J("q1tI"),P=J.n(k),F=J("i8i4"),M=J.n(F),D=function(R){Object(L.a)(w,R);var E=Object(H.a)(w);function w(T){var A;Object(re.a)(this,w),A=E.call(this,T);var _=window.document;return A.node=_.createElement("div"),_.body.appendChild(A.node),A}return Object(z.a)(w,[{key:"render",value:function(){var A=this.props.children;return Object(F.createPortal)(A,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),w}(P.a.Component)},MXfU:function(ut,$e){ut.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFsAAABKCAYAAADUvCinAAAAAXNSR0IArs4c6QAAFq9JREFUeAHdnAl4VFWWx6sqlYWEkIRsJCRkJQECCXsIS0gAWWwQl1YQxQ2nRx0/u9We8etvpmf87LFt7XHs7mmXbhVEFESQdWRfwiKGXRYhkI0sQAIBAmQnqZrfKfMyZVGVqldLjL7vu9997757zz33/84995xzb5VG8xO/Fi1aNPTDDz/M7w7D1HcHJjzFAyCPNxgMi/V6/YOe6kMNXZ2ayj+mugsXLhSAFxqNxtmPPvroge7A+09Osj///HOvmzdvvoZET/D19Z04f/78i90BaOHhJwU20hx748aNZVqt9kR0dHTOnXfe2dxdgBY+tN2JGVd4QT8/gsp4GRovPfnkkytcoeWptj96ycbaiEdl/BWgEWjt+AULFlzwFFiu0v3RSvaGDRt8L168+CIALNDpdL99/PHHl7oKhqfbe3m6A3fTR4J1/fr1m88iuBxJPs8iOBdr45C7+/EEvR+NZIuVUVdX9wBg/wYgTnp7e//rI488UuoqKCyqv4FmK+rnj67Sste+2+vsjz/+OODWrVsiyb9iMIcAZh4L4El7A3PkPUA/Db2ZERERdzhS39U63RbsDz74YDBq4qmWlpZZ5GtIdz7xxBMlrg5YaY/18iuAnhsYGDht1qxZDUq5J/NuBTZSnIAUzwGEOYB7i/R3pO5f3AkGtHVI9BuAmkG644EHHrjpSYDNaf+gOvvQoUPe33zzTRYMTSVNB1xf0mfo4+V4fkXmjMr9p59+GtLU1CSSPpzHvcQ8NqK36y3r2Xpub7+M92UZGRnPjhw58patup4o71KwkahwgBqFXTyawUgS6RI9vBngNj/22GPFloNkukfTZjZ17iXl8L5jNlLexPMW8lU9e/Zcj5RetWyvPKOWsrl/HzPxTdTR35XyrszdBjZAaD/66KMgBh4KmGGkKAaSzHN/yXkv96IbD5If8PLyOpCWlnbUmnQtWbIkGV19jwBM3Uyh7efnp+nfv3/lmTNnYnx8fE7OnDkzrKioSFdYWBhx/fp1wayVurvIV/Ph1mAOnpfC9evX+1+6dOkVaEzmcb67FlehrfZyC9hI3wEG04/B1sLAFVINqYrnYsoLJfXq1asYyWu0xaDEndva2u6hjYA8ROohrW0pKSmlgCz3iRTpli1bpgHMvPvvvz9H6siFaqkuKSlp40NEX716VQMNI8US6dsCrQd5/gS18XtrH1bad9XlFrCdYRYQdIsXL84CYFEP90AjQegEBQU1p6amliYnJ/v06NFDyr7HozWwpZ1yNTc31+zZs6e1rKysj1IG2CfpYxWzaTWe5jdKeVfn3xuIpzuXBfH48eOTUDEC7t2kSOkzJCSkftCgQaXx8fGBqIs4KbN1dQK2ob6+fu+uXbt8/f39/bKysvwANxzQa8+ePdv3woULvkIT4M+RrSKtRnfv49nAfZdcHge73SmZzmhEPcwkD5KRhYeHXwPgsri4uFCsj1gpc+SyAnbNlStXjiDN0aGhoY1jxowJhN4AS1rMoNrz58/XnD59Ooo8AF6kSjVgr2XRXB0QELADNddi2c6dzw6DjbvcE3f5CZiMcZQB6qYwmKnkPaRNnz59qgcPHnw+JiYmCqmTBVT1JWADzm5sb92xY8dakdhE9HFlQkJCDDT7OUKQmXWTINbFgoKCyPLy8iCepZmssl8K8GpNSkf6lDoOgd2++5EPaCMdJWwirtVq+vbtW4bVcZlgfj8GEqGmvVndNgApQIIvbdy4MRcpbQLgIwMHDgxAr6dTz6FxmNHruIVuw+XLl8sBPrS0tDQc2qJqHDYpOwg5cOMQk1gKQ2DiuAP0hFFNfHz8WQCuxfsTc6+3I+3M6rTwUauwMCqR2pvo3J7V1dVxYWFhtUT7bh44cCAL0y9vzpw5OWZt3HXbxAc9h6rpiXUTgzcrdMWk3E2+ytykdKZDh8BeunRpWENDQyUdmBYZy45goo1pfAqAG9Gbqbw36WXLepbPqKV8pnH9tWvXfGtrawNZ4EKpo8dMvI5OvwS4BhbPSOgnS7m0b1cjngJbulCuFvgqYXH1wZ5P4OODucmkFOBnESVU7eZ3eGNKD9byefPm1SDdTzDl3kTqOkwqpS7T+Tg2bChqwmQfK+X2cnSsP/pbg5kni1oogxE1Izv+0od8tB/y8uFDJ2LjF7KveQ2h6M3YRTgnwufL5LJxoepySLLNKQL6HUjdFlb9OhhYcuTIEYlrJEkdQD82YsQIPwL6HgOqKyQbW73s1KlTLaRkkWjWhSYW9pPY/z2J5YSfPHkyCEEZjs1+whwbe/cOSbZCZOfOnfri4uK3ANqIuuhJenrYsGHHmGpvfvXVV+PQdWNIGqZ/0dixY+sxpyT28aO4mLXXEZ4LgBmP3o4DTJlxZ4YMGdKEozWIQZiMg9GjR9eBgZ6P8A6Snt2uWhwaoyqwWTR+ifucBsjmxDMok3QWa+rVzZs3D4bpWSQd9arHjx9/nsVNLAZVfZl34MH7Ntz7khMnTgQztnAAD8J6quIIRAFmqizut81QynpOnDjxwqZNm8Yzyx+Bt8WO8uewGpHoGwtVATEJMbdEr9q6ylnsFhEAimY1f5iv34MAfR0e3Rn080CY9bfV0JFyd6gRpPIicZTmb7/9Nr6xsVE82Ib09PRiFvkIJNrk1drjBaFqxjm6gceb+tBDD12zV1/eq5G2/4KhQIC2R7dfcHDwfxCPrmZQb6xdu1aP1fGLLVu2jICxVnT6MWZBLIupWpPQXr+dvkdq6wHnIo5QLKZkFOMw4sEWooe9uY+nsarFPTc3tx4rLZyP9Sptn+m08/aXDkk20yUHoHYi1Qa+fGdSba3Pawz07TVr1lxB4p9C0lNFH/LhCnBMenEfba2RrTKVkm0k/FpGPCYIPRsiNJOSkqro+wZ6WBZ1l04XMDOu5ufnBzNbMzEF7e7w6wnoxwLAW6ShdG4VSMAKY2EwOgG0jC8EKf63e++9t47799B1ryFhC44ePTqBJDHqCmi38jETpLI7Lon8EecWNdGXWRWP+qqbOnXqWfRwDLyIWXmb+epMv8yMXqgjHUL0LvhlAnqnQS09lZaQJnbWGQucJjEx0RS56ayenXc9ef/r6dOnN5Mv3Ldv35u4yPNwGO4DGC8AuYKVcwWJS7FDx+prxtCEx1mNFEeTh/Xu3bsNS6kUvoNYa0RlOUXXamfthYCrnzRpUs0XX3wxEqH9BcXvdVqfhe8GjAZ2Vmn27NmtAK5Gv3dGTnnXys1SzMaP9+7dexf3C+AjAAumAdDLxRqg7LY+LdUIDscF7N5APpo4Rhp0cBX2vgE9rEo9KUw5kyM4TZi8jcyaVMK2l23R8AJIUR9ptiogGRrccKvqxVYbB8uFZgbgPowEViLZv0TCCwkLZJAlAJ4RwIpYbP2RIG+FJsBqiNMgrPqmvLy8AMy2QKyJlnHjxl1CHQVGRUUJ6J0Kj0LLXTlBtlvM0sDW1tbwdevWrbVFV9seb36BCsOQLHNQk9HRaRLjJRjvY4uAm8s3wvDr7EEmsk6IO5xG0EmDBSNbY8FE5xq3bt0aLZE57OE2hOAiuWwi+7qZD9Xk8Ctqt23bJnuw/wSOVQoB7o0IxgnZzLZqjbR7it8MHTp0EAO1Wkch5qF8N3RfRQ+KtfAi/E5W+snMzKwaMGCAPwPopZR1lxzb21hZWWkNLwMf4SlzSe7gGW/qOaZwGmCLXv0hrmw63Yz+ex6TagqMfqEwwWzb1h2BFv4Ixl1Q+LTIdQjM726zM1ErEUzhVXh8OhbFDl1p0birHlcTnziJ2niXDk28Ijn9MbkE8P5dxYSdflrh70vi7Kzze+OpG2yjfu1tqz0No/kKAcQMdLjbrSw2t9WxQczdxWKzvs35kefgR1kzqrmPxNTqQ9i3gvcO7126mznolYHRpu3bt4diEc3iubN1o5nZ+aI1/aJBVw5Hul9lcZqOpaBBkgyYNVZVjgcGoZBcs2LFCjm9WgHAYqPLR1+ekBAfVVp6Lhu9vRgLZD5lXcmXCMAmXP4iQsvZYCSWnOxOFZDEsTkiz+YXak9+ElHAoaErVsFWKmODj+f+VQ7IZKOPxLFRXnVFPpmPns4A3sLm3l5VVSWL5PIZM6ZP3rFjZzMS3wev9BNMw0e7gJkqTNLVWBv6mpqa++FJVIVsl60lvcPassMRHjoFWyEA6FO5/090+CisAWNkZKRD7ZT2TuQnkeqhSHUxbaMmT550eNu27XIAU8CeQ/CH4yG7s5lsRUjMDQY8wok+7DURj3kHNv8hdPFQAJZTAsq436DPP7N421oQrdK+bYG0VgtDvZj0/pQpU2SjIANdFY4zYiSeoXRurZkrZb8lwJMMgQXh4aH/GxsbOwUnR+h9279/8mDWkXiOfXxJkD+LOMsuvEaZcopel3quXDXEVhYhxbu5JrDh/DNAltj2HlIthCWu8hBnBivVdqJq8aODNZwG7Q0DH1ZUVMgxMb/hw4e7G3SJDX9C2s3gjBkZw6wuPCkp/TPh4QyHJh+En7c47PO82sFb1N+NpbODKxXH6h8A2If+b6Jz/zZq1KjS3r2D79uwYdO3tHF690kV2ObMTZyYXVleXrGW6T6HraMYkkQF3SHpH6CrM+lrBLvseT4+3jJ9zbs23VMWzi7QUayBRKRQfsS0HnNQrAI1l4R/l6KTqjkzch80X5bGgHyKgNjirKzMQFQVMRtNVDsLhe3Et6Na5USunHVQ0lXuP0a1dPgE7XU7MqfBRoUkI10vpqam7C0oOGMCHSkPY2NAkHEW9Dbavs2g3xEOhw3LqOfeprUhH4LZtZQw57yVK1ca586de55mfaWtnSsfFbSGAz8xqAyxaIJI4sCtGDAgZUtiYvJ4o9HwCs++Vr4zxZok+JLc8roLQclhwdxl+UKenQZbIUan4wFc0leAvoYd6QewXHoRWFKqqMnXsVERgGTNwIM93qOH/x32GiclJU5BjRzkzMldhw8ffo3wwku0sfaBbogUf/3113ybMzPh+w9Cm74uIL1/YpZUBgT4y6+E3wdoe93afE/7XF56BmyzXscNGJA6jud9p08XlAD6fQy8BwupWRW7t3+hhsRCtEOHZojTkm6vBXUjJkyYcBBVUs/O+DMEp/7GrHvarN1hPsQytueCsGIep/yp9nd5RAsXEyns4+Wlk1+N9SOZNXP6dp+tli5LthXCYwcOHDAWxvMx/CsZ+GzUizfHGqxU/V7RCX65UEC7hzl3Uo79nOPo4PV6r58Rw36PD/wU8e5BnOfYDeWzgH8AaRf7/DWSN1Issfu/8kG2xMXFcqJWKyrL39F+FG6hs5N7UXneZqkBOqKztyj1LHNPgG3qA4bGpKUN0sDAfqbuFaRoGouoF16pJQ/K8/8QKniOBx/AOEW76coLR/L4+Lh7WeS2IL1T0Zuf0mYMNJ6UtvBygvTu5Mk5l/V633/UaIzPfifEzkkypudj/HCq3BG+zOt4DGylEwaZOWjQQA368iA7GvU4RBNZ1LToSaWK5FcJ5KwiL2Qg1yIjI0abv3TkHmAjsrOzGwhz1nD/EG3ESljODFnEgaEBGo0B9SQnt5wD2BEe7NXxONgKA4A7CutFdlkOA7qRBXQkp11Nr9kw3cDmrAAUggraTi5TX/Wl02nvRge/dPDgwRbCw/lRUX0ehMgKFrxA1cQ80KDLwFZ4xxYfkZiYoMFxOLp//34/AB/IZoUc5vk5H6S5b99om1t0Co3O8tDQ3q/MmDHtGMrjv6Gp7axuV7/73lzuys5xQIbFxsYMbGlpOobzchxg/DAf+YWX1tVjBmIbj+5uQAu2qiUb6WtB/2pY6c9zsrMV0OJc+UheXvoMzDxNRkZ6GbSzAMkVcp5uK56tzEqnmFQt2RwXXsWi915VVXWfrVu3xeEgFAD+RVdHCc04gFb98V3t15H2HKNrOn78hFg1idRfimkpnqrqS/XgMjOHpfDrh6zr12v/ed++/CklJaV3lpWVG7EwDsbF9WO113TpGT7VI1bRAFe+pbCwyIcAlQ+xkg0cyGnipMHrgO6Ui6lqAeEoQSBBeyJfxth2nvOLi0s+Jeb7JFKZgdkmh8YPYQVI/Fd2V9x2bdy4SWiZ4tluI2qDECDf4mygd0VFpSE4uNcGPGGDt7ePhFq9ALpcr/dO4/dCcpxO1aVKsgH612ZAS0djkpISSUnL8dQ+4WM8z/m98adP+9WwnXY4JCQIT9LkZali6oeqjC5uRZL1SLKORXvt5Mm5unaQZXfcxBZ5P/ZmwUHzslo+VYEN8bnWOzDOGTFi+N1arebtHTvyEIzm5/AaJ7KdVjxy5IgKpt5EmFQ1i6z345nS1ta2Vvk1AQdtNIC8Oicnx5uI4ix47gDZomex31+2KLP7qBJsY79OKIrJ9cKkSbmXm5ubfpeXtzuFE6SP5eXtSurdO+Qg8ZFbqJmxnbTv8lc4WG2ckfE6d67MCMgrOXPtx2EC+bsNWyC389gpDjbHoQpsJPcCgMqKbPOC0XAfH98/TJs29fTlyzXP8nv1u69evTZ1+/YdRs7hbR4yJC1Cp/MaZpNAF7zAejIQR9EBchsgr8rNzfFHEGTzQEuyy4HgYLeSlQqqwIYX4hdG0Vd2L5geGBYW+g4btFsJuT5z7ty5ZzjKO43f3TSyS78S130IRFLtEnJjBXgC5HM6gL6FdbGa3SY5hPlzyh0CWWHlOxyUJ8dzVXqUn0dEtrW1yt9JhDnehSnqZmCci/bvP1jADzklXt0HB+YS0b3NMTF9c6Fld6fBFWsEQTayX6ktKSnll1+9VuFEBeNMzRCQ1YxD6mKN1NB2MAG1atVt1Taorj4/BQdqPe381LaF0TqDoe0t9Lk3foKEU/2JlRSwiO7j8PrdPNu00Z0BGzBNBx0xTxsx4Vamp2eE85FVhW4txtik12tnRUb23WZR7tCj6i8rVDk+wHaVcTm3IQ71cnulyvr6hj9yVGA4r2QPUMeGwa6xY8cUsRX2IBjd9osylWAD8nkkuaRBFj5+Q8M6oXUFZBkBu/7aORxR3ioPzlxOgS0doXs5u2FYDDDZznQsbZD0QzgO73HAfR50JlFkYEdn5dixWc3oUgG9Y01xBGzoGREEURd1QocfSEUB8jRn+VPaQZdjFbpHWeDPKWXO5E6DrXTGoodkGl8BmHilTG3OYFYTe9gIUC9AZwDPjZy+Woi5yP+S6ORPYbSdgS0g8/G1RUXFN/nN5Yr09MGxgMPsc+2C7jlE4t/5ZcES1yh919plsIUMYHhXV1+Y39ZmFD3s1CEWzCnZWXl7z56vKrHPX4JmOM/VnIb6gEOUOfziYBzPt7nr1dWXNDgkN3CgPsesjAfkKdRz9TrGEZi/REZGLwFw4cstl1vANueEA5BjDIbWOUiEOAcJ5u8cvL+K8fC6HMXF55DjwrIQl5PEodqEKWnSvRxw1OBaXw8MDFg+ePAQCYA5tbtDO9MFqKWIzTqdTv8ZBznzlXJ35m4H25w5gB8M8LMpuwvwhwNchw42r2fjvrCurv4N/vspFyBEf5t4HT16lAZ1UYskf8aGcgptRdervqDJoRzTEV8BeB0An1BNRGUDj4Jtzgtg9cBOz0BaRzLQkayFnDzVDqTcy7ye5T3qZVdJSfH7BQWFv+edN2plDfY5el2Ta1nX1jP9tQHsaYyew/R3CHPzEHbyMcobbbXxRHmXgW2NeQbuS6Qwlg9AyLaNQzLySwKtqAt+dSxHwsQE1PYAWAM5Z+hM/1F1B+344ar8+6URsP4/p9512lZQXs49uVc5wFaw4VEBsLT5Ya//AzDfafkdei4SAAAAAElFTkSuQmCC"},Nmsl:function(ut,$e,J){ut.exports={none_panels:"none_panels___1g-mA",none_p_title:"none_p_title___1lCVD"}},Ot1p:function(ut,$e,J){"use strict";var re=J("2qtc"),z=J("kLXV"),L=J("rAM+"),H=J("miYZ"),k=J("tsqr"),P=J("tJVT"),F=J("jrin"),M=J("q1tI"),D=J.n(M),R=J("VrN/"),E=J.n(R),w=J("bdgK"),T=J("p77/"),A=J("Bd2K"),_=J("ELLl"),b=J("19Vz"),d=J("lZu9"),s=J("+NIl"),u=J("kSUc"),l=J("9Bee"),S=function(ee){var Y=ee.value,Q=Y===void 0?"":Y,Z=ee.className,q=ee.showTextOnly,de=ee.showLines,ye=ee.style,Me=ye===void 0?{}:ye,et=Object(M.useMemo)(function(){return""},[Q]);return D.a.createElement(D.a.Fragment,null,D.a.createElement("div",{dangerouslySetInnerHTML:{__html:et}}))},h=J("0Owb"),g=J("dejd"),C=J("C+DQ"),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 f(ee){var Y=ee.onActionCallback,Q=ee.title,Z=ee.icon,q=ee.actionName,de=ee.className,ye=de===void 0?"":de,Me=ee.children;function et(){Y(q)}return D.a.createElement("a",{title:Q,className:ye,onClick:et},D.a.createElement("i",{className:"md-iconfont ".concat(Z)}),Me)}var c=function(ee){var Y=ee.watch,Q=ee.showNullButton,Z=ee.onActionCallback,q=ee.fullScreen,de=ee.insertTemp,ye=ee.hidetoolBar,Me=[].concat(y,[{title:"".concat(Y?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Y?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return D.a.createElement("ul",{className:"markdown-toolbar-container"},!ye&&Me.map(function(et,qe){return D.a.createElement("li",{key:qe},et.actionName?D.a.createElement(f,Object(h.a)({},et,{onActionCallback:Z})):D.a.createElement("span",{className:"v-line"}))}),Q?D.a.createElement("li",null,D.a.createElement(f,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Z},D.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,de&&D.a.createElement("li",null,D.a.createElement(f,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(de),onActionCallback:Z},D.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),D.a.createElement("li",{className:"btn-full-screen"},D.a.createElement(f,{icon:"".concat(q?"icon-shrink":"icon-enlarge"),title:q?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Z})))},o=J("M8RZ"),a=J("+L6B"),m=J("2/Rp"),p=J("y8nQ"),v=J("Vl3Y"),O=J("5NDa"),U=J("5rEg"),j={labelCol:{span:4},wrapperCol:{span:20}},G=function(ee){var Y=ee.callback,Q=ee.onCancel;function Z(q){Y(q)}return D.a.createElement(v.a,Object(h.a)({},j,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Z}),D.a.createElement(v.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},D.a.createElement(U.a,null)),D.a.createElement(v.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},D.a.createElement(U.a,null)),D.a.createElement("div",{className:"flex-container flex-end"},D.a.createElement(m.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),D.a.createElement(m.a,{type:"ghost",onClick:Q},"\u53D6\u6D88")))},B=J("7ahc"),N=J("HmJG"),V=J("BjJ7"),$=v.a.useForm,ie={width:280,marginRight:10},oe={labelCol:{span:5},wrapperCol:{span:19}},_e=function(ee){var Y=ee.callback,Q=ee.onCancel,Z=$(),q=Object(P.a)(Z,1),de=q[0];function ye(qe){Y(qe)}function Me(qe,at){de.setFieldsValue({src:"/api/attachments/".concat(qe.id),type:at.type})}function et(qe){var at=qe.target.files[0];Se(at,Me)}return D.a.createElement(v.a,Object(h.a)({form:de},oe,{className:"upload-image-panel",onFinish:ye}),D.a.createElement(v.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},D.a.createElement("div",{className:"flex-container"},D.a.createElement(v.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},D.a.createElement(U.a,{style:ie})),D.a.createElement(fe,{onFileChange:et}))),D.a.createElement(v.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u63CF\u8FF0"}]},D.a.createElement(U.a,{style:{width:264}})),D.a.createElement(v.a.Item,{style:{textAlign:"right"}},D.a.createElement(m.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),D.a.createElement(m.a,{type:"ghost",onClick:Q},"\u53D6\u6D88")))};function fe(ee){var Y=ee.onFileChange;return D.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",D.a.createElement("input",{type:"file",onChange:Y}))}function Se(ee,Y){if(!ee)throw new String("\u6CA1\u6709\u6587\u4EF6");var Q=new FormData;Q.append("editormd-image-file",ee),Q.append("file_param_name","editormd-image-file"),Q.append("byxhr","true");var Z=new window.XMLHttpRequest;Z.withCredentials=!0,Z.addEventListener("load",function(q){Y(JSON.parse(q.target.responseText),ee)},!1),Z.addEventListener("error",function(q){console.error(q)},!1),Z.open("POST","".concat(V.a,"/api/attachments.json")),Z.send(Q)}var be=J("giR+"),me=J("fyUT"),le=J("7Kak"),ue=J("9yH6"),Ee=ue.a.Group,Ge={margin:"0 8px"},Te=function(ee){var Y=ee.callback,Q=ee.onCancel;function Z(q){Y(q)}return D.a.createElement(v.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Z},D.a.createElement("div",{className:"flex-container"},D.a.createElement("span",{style:Ge},"\u5355\u5143\u683C\u6570\uFF1A"),D.a.createElement("span",{style:Ge},"\u884C\u6570"),D.a.createElement(v.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},D.a.createElement(me.a,null)),D.a.createElement("span",{style:Ge},"\u5217\u6570"),D.a.createElement(v.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},D.a.createElement(me.a,null))),D.a.createElement("div",{className:"flex-container",style:{marginTop:12}},D.a.createElement("span",{style:Ge},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),D.a.createElement(v.a.Item,{name:"align"},D.a.createElement(Ee,null,D.a.createElement(ue.a,{value:"default"},D.a.createElement("i",{className:"fa fa-align-justify"})),D.a.createElement(ue.a,{value:"left"},D.a.createElement("i",{className:"fa fa-align-left"})),D.a.createElement(ue.a,{value:"center"},D.a.createElement("i",{className:"fa fa-align-center"})),D.a.createElement(ue.a,{value:"right"},D.a.createElement("i",{className:"fa fa-align-right"}))))),D.a.createElement("div",{className:"flex-container flex-end"},D.a.createElement(m.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),D.a.createElement(m.a,{type:"ghost",onClick:Q},"\u53D6\u6D88")))},pe=J("m3rI"),Ae=J("wMS7"),Ce=J.n(Ae),we="link",Be="upload-image",Qe="code-block",je="add-table",De="------------",Pe={default:De,left:":".concat(De),center:":".concat(De,":"),right:"".concat(De,":")},Le=J("9VGf"),Re,Ue;function We(){}var ke=0,Ke=1e4,ze="\u2581",ge=`
**\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 Ye(ee){return/^\d+$/.test(ee)?"".concat(ee,"px"):ee}var He=navigator.platform.toUpperCase().indexOf("MAC")>=0,xe=He?"Cmd":"Ctrl",Ie=(Re={},Object(F.a)(Re,xe+"-B","bold"),Object(F.a)(Re,xe+"-I","italic"),Re),se=(Ue={},Object(F.a)(Ue,we,"\u6DFB\u52A0\u94FE\u63A5"),Object(F.a)(Ue,Qe,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(F.a)(Ue,Be,"\u6DFB\u52A0\u56FE\u7247"),Object(F.a)(Ue,je,"\u6DFB\u52A0\u8868\u683C"),Ue),te=$e.a=function(ee){var Y=ee.defaultValue,Q=Y===void 0?"":Y,Z=ee.onChange,q=ee.width,de=q===void 0?"100%":q,ye=ee.height,Me=ye===void 0?400:ye,et=ee.miniToolbar,qe=et===void 0?!1:et,at=ee.isFocus,gt=at===void 0?!1:at,yt=ee.watch,st=ee.insertTemp,_t=ee.mode,xt=_t===void 0?"markdown":_t,Bt=ee.id,Dt=Bt===void 0?"markdown-editor-id":Bt,pt=ee.showResizeBar,Nt=pt===void 0?!1:pt,rr=ee.noStorage,Gt=rr===void 0?!1:rr,Vt=ee.showNullButton,Xt=Vt===void 0?!1:Vt,Pr=ee.hidetoolBar,Ht=Pr===void 0?!1:Pr,kt=ee.fullScreen,jt=kt===void 0?!1:kt,Ot=ee.onBlur,tt=ee.onCMBeforeChange,Yt=ee.onFullScreen,Nr=ee.className,fr=Nr===void 0?"":Nr,St=ee.disablePaste,hr=St===void 0?!1:St,gr=ee.placeholder,nr=gr===void 0?"":gr,Fe=ee.values,dt=Fe===void 0?"":Fe,_r=Object(M.useState)(null),vr=Object(P.a)(_r,2),Ve=vr[0],wr=vr[1],jr=Object(M.useState)(Q),ct=Object(P.a)(jr,2),Ct=ct[0],Ur=ct[1],xr=Object(M.useState)(yt),ht=Object(P.a)(xr,2),wt=ht[0],ot=ht[1],ve=Object(M.useState)(jt),nt=Object(P.a)(ve,2),lt=nt[0],At=nt[1],Jt=Object(M.useState)(""),ar=Object(P.a)(Jt,2),Kt=ar[0],Ut=ar[1],Ln=Object(M.useState)(0),Mr=Object(P.a)(Ln,2),Wr=Mr[0],Cr=Mr[1],wi=Object(M.useState)(Me),Ci=Object(P.a)(wi,2),pn=Ci[0],nn=Ci[1],$i=Object(M.useState)(!1),Ai=Object(P.a)($i,2),Ba=Ai[0],Zn=Ai[1],Qr=Object(M.useRef)(),Dn=Object(M.useRef)(),On=Object(M.useRef)(),gn=Object(M.useRef)();Object(M.useEffect)(function(){Ur(dt),Ve==null||Ve.setValue(dt)},[dt]),Object(M.useEffect)(function(){Yt==null||Yt(lt)},[lt]),Object(M.useEffect)(function(){if(Qr.current){var vt=E.a.fromTextArea(Qr.current,{mode:xt,lineNumbers:!qe,lineWrapping:!0,value:Q,autoCloseTags:!0,autoCloseBrackets:!0});gt&&vt.focus();function bt(Et,Lt){if(hr){Lt.preventDefault();return}var Pt=Lt.clipboardData;if(Pt){var Ft=Pt.types.toString(),Qt=Pt.items,or=["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"];if(Ft==="Files"||Pt.types.indexOf("Files")>-1){if(Lt.preventDefault(),xt=="stex")return;try{var sr,Jr=Qt[1];((sr=Qt[0])===null||sr===void 0?void 0:sr.kind)==="file"&&(Jr=Qt[0]);var qt=Jr.getAsFile(),on=qt.name.split(".").pop();Se(qt,function(yr){if(yr.id){var $r,qr,qn;(qt==null||(($r=qt.type)===null||$r===void 0)?void 0:$r.indexOf("image"))>-1?vt.replaceSelection("![,](/api/attachments/".concat(yr.id,"?type=").concat(yr.content_type,")")):(qt==null||((qr=qt.type)===null||qr===void 0)?void 0:qr.indexOf("video"))>-1?vt.replaceSelection('<video width="100%" controls src="'.concat(pe.a.API_SERVER,"/api/attachments/").concat(yr.id,'"></video>')):(qt==null||((qn=qt.type)===null||qn===void 0)?void 0:qn.indexOf("pdf"))>-1?vt.replaceSelection('<a href="'.concat(pe.a.API_SERVER,"/api/attachments/").concat(yr.id,"?type=").concat(qt.type,'&disposition=inline" target="_blank">').concat(qt.name,"</a>")):or.includes(on)?vt.replaceSelection('<a href="'.concat(pe.a.API_SERVER,"/api/attachments/").concat(yr.id,'?type=office&disposition=inline" target="_blank">').concat(qt.name,"</a>")):vt.replaceSelection("[".concat(qt.name,"](").concat(pe.a.API_SERVER,"/api/attachments/").concat(yr.id,"?type=").concat(yr.content_type,")"))}else(yr==null?void 0:yr.status)===401&&(document.location.href="/user/login")})}catch(yr){k.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return vt.on("paste",bt),wr(vt),function(){vt.off("paste",bt)}}},[]);var Jn=Object(M.useCallback)(function(){if(Dn.current)try{}catch(vt){console.log(vt,"---- to set md editor body height")}},[pn,Dn,lt]);Object(M.useEffect)(function(){function vt(){var Et=new w.default(function(Lt){var Pt=Object(L.a)(Lt),Ft;try{for(Pt.s();!(Ft=Pt.n()).done;){var Qt=Ft.value;(Qt.target.offsetHeight>0||Qt.target.offsetWidth>0)&&(Jn(),Ve.setSize("100%","100%"),Ve.refresh())}}catch(or){Pt.e(or)}finally{Pt.f()}});return Et.observe(Qr.current.parentElement),Et}if(Ve){var bt=vt();return function(){bt.unobserve(Qr.current.parentElement)}}},[Ve,Jn]),Object(M.useEffect)(function(){if(Ve){for(var vt=[],bt=function(){var Qt=Lt[Et];Pt=Object(P.a)(Qt,2);var or=Pt[0],sr=Pt[1],Jr=Object(F.a)({},or,function(){vn(sr)});vt.push(Jr),Ve.addKeyMap(Jr)},Et=0,Lt=Object.entries(Ie);Et<Lt.length;Et++){var Pt;bt()}return function(){var Ft=Object(L.a)(vt),Qt;try{for(Ft.s();!(Qt=Ft.n()).done;){var or=Qt.value;Ve.removeKeyMap(or)}}catch(sr){Ft.e(sr)}finally{Ft.f()}}}},[Ve]),Object(M.useEffect)(function(){jt!==lt&&At(jt)},[jt]),Object(Le.a)(function(){if(!Gt&&Wr>0){var vt=new Date().getTime(),bt=window.sessionStorage.getItem(Dt);vt>=Wr+Ke&&(!bt||bt!==Ct)&&(window.sessionStorage.setItem(Dt,Ct),Zn(!0))}},Ke),Object(M.useEffect)(function(){ot(yt)},[Ve,yt]),Object(M.useEffect)(function(){Ve&&(gt&&Ve.focus())},[Ve,gt]),Object(M.useEffect)(function(){if(wt&&Ve){var vt=Ve.getScrollerElement();function bt(Et){var Lt=Et.target;if(gn.current){var Pt=Lt.scrollTop/Lt.scrollHeight;gn.current.scrollTop=gn.current.scrollHeight*Pt}}return vt.addEventListener("scroll",bt),function(){vt.removeEventListener("scroll",bt)}}},[Ve,wt]),Object(M.useEffect)(function(){if(Ve&&tt){function vt(bt,Et){tt(bt,Et)}return Ve.on("beforeChange",vt),function(){Ve.off("beforeChange",vt)}}},[Ve,tt]),Object(M.useEffect)(function(){if(Ve&&Ot){function vt(){Ot(Ve.getValue())}return Ve.on("blur",vt),function(){Ve.off("blur",vt)}}},[Ve,Ot]),Object(M.useEffect)(function(){if(Ve){function vt(bt){var Et=Ce.a.sanitize(bt.getValue());Ur(Et),Cr(new Date().getTime()),bt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Z&&Z(Et)}return Ve.on("change",vt),function(){Ve.off("change",vt)}}},[Ve,Z]),Object(M.useEffect)(function(){Ve&&(Q==null?(Ve.setValue(""),Ur("")):Q!==Ve.getValue()&&(Ve.setValue(Q),Ur(Q),Ve.setCursor(Ve.lineCount(),0)))},[Ve,Q]);var vn=Object(M.useCallback)(function(vt){var bt=Ve.getCursor(),Et=Ve.getSelection(),Lt=Et.split(`
`);switch(vt){case"bold":return Ve.replaceSelection("**"+Et+"**"),Et===""&&Ve.setCursor(bt.line,bt.ch+2),Ve.focus();case"italic":return Ve.replaceSelection("*"+Et+"*"),Et===""&&Ve.setCursor(bt.line,bt.ch+1),Ve.focus();case"code":return Ve.replaceSelection("`"+Et+"`"),Et===""&&Ve.setCursor(bt.line,bt.ch+1),Ve.focus();case"inline-latex":return Ve.replaceSelection("`$$"+Et+"$$`"),Et===""&&Ve.setCursor(bt.line,bt.ch+3),Ve.focus();case"latex":return Ve.replaceSelection("```latex\n"+Et+"\n```"),Ve.setCursor(bt.line+1,Et.length+1),Ve.focus();case"line-break":return Ve.replaceSelection(`<br/>
`),Ve.focus();case"list-ul":return Et===""?Ve.replaceSelection("- "+Et):Ve.replaceSelection(Lt.map(function(Pt){return Pt===""?"":"- ".concat(Pt)}).join(`
`)),Ve.focus();case"list-ol":return Et===""?Ve.replaceSelection("1. "+Et):Ve.replaceSelection(Lt.map(function(Pt,Ft){return Pt===""?"":"".concat(Ft+1,". ").concat(Pt)}).join(`
`)),Ve.focus();case"add-null-ch":return Et===""&&Ve.setCursor(bt.line,bt.ch+1),Ve.replaceSelection(ze),Ve.focus();case"inster-template-1":return Et===""&&Ve.setCursor(bt.line,bt.ch),Ve.replaceSelection(ge),Ve.focus();case"eraser":return Ve.setValue(""),Ve.focus();case"trigger-watch":return ot(!wt),Ve.focus();case"trigger-full-screen":return At(!lt),Ve.focus();case we:Ut(we);return;case Qe:Ut(Qe);return;case Be:Ut(Be);return;case je:Ut(je);return;default:throw new Error}},[Ve,wt,lt]),Zr=Object(M.useCallback)(function(vt){Ut("");switch(Kt){case we:var bt=vt.title,Et=vt.link;return Ve.replaceSelection("[".concat(bt,"](").concat(Et,")")),Ve.focus();case Qe:var Lt=vt.language,Pt=vt.content;return Ve.replaceSelection(["```"+Lt,Pt,"```"].join(`
`)),Ve.focus();case Be:var Ft=vt.src,Qt=vt.alt;return Ve.replaceSelection("![ ".concat(Qt," ]( ").concat(Ft,' "').concat(Qt,'" )')),Ve.focus();case je:for(var or=vt.row,sr=vt.col,Jr=vt.align,qt=`
`,on=0;on<or;on++){for(var yr=[],$r=[],qr=0;qr<sr;qr++)on===1&&$r.push(Pe[Jr]),yr.push(" ");on===1&&(qt+="| ".concat($r.join(" | "),` |
`)),qt+="| ".concat(yr.join(sr===1?"":" | "),` |
`)}return Ve.replaceSelection(qt+`
`),Ve.focus();default:throw new Error}},[Ve,Kt]),$n=Object(M.useMemo)(function(){switch(Kt){case we:return D.a.createElement(G,{callback:Zr,onCancel:an});case Qe:return D.a.createElement(B.b,{callback:Zr,onCancel:an});case Be:return D.a.createElement(_e,{callback:Zr,onCancel:an});case je:return D.a.createElement(Te,{callback:Zr,onCancel:an});default:return null}},[Kt]);function an(){Ut("")}Object(M.useEffect)(function(){if(On.current){var vt=On.current,bt=!1,Et=0;function Lt(Qt){bt=!0,Et=Qt.pageY}function Pt(){bt=!1}function Ft(Qt){if(bt){var or=Qt.pageY-Et;or<0&&(or=0),or>300&&(or=300);var sr=Me+or+"px";nn(sr)}}return vt.addEventListener("mousedown",Lt),document.addEventListener("mousemove",Ft),document.addEventListener("mouseup",Pt),function(){vt.removeEventListener("mousedown",Lt),document.removeEventListener("mousemove",Ft),document.removeEventListener("mouseup",Pt)}}},[Ve,On]),Object(M.useEffect)(function(){nn(Me)},[Me]);var Li=Ye(de),Rn=Ye(pn),qi={width:Li,height:Rn},ea=Object(M.useMemo)(function(){if(Wr){var vt=new Date(Wr),bt=vt.getHours(),Et=vt.getMinutes(),Lt=vt.getSeconds();return bt=bt<10?"0"+bt:bt,Et=Et<10?"0"+Et:Et,Lt=Lt<10?"0"+Lt:Lt,"".concat(bt,":").concat(Et,":").concat(Lt)}return 0},[Wr]);function Hr(){window.sessionStorage.removeItem(Dt),Zn(!1),Cr(0)}function ja(){Zn(!1),Cr(0),Ve.setValue(window.sessionStorage.getItem(Dt))}return D.a.createElement(M.Fragment,null,D.a.createElement("div",{className:"markdown-editor-wrapper",ref:Dn},D.a.createElement("div",{className:"markdown-editor-container ".concat(fr," ").concat(wt?"on-preview":""," ").concat(qe?"mini":""," ").concat(lt?"full-screen":""),style:qi},D.a.createElement(c,{insertTemp:st,watch:wt,fullScreen:lt,showNullButton:Xt,onActionCallback:vn,hidetoolBar:Ht}),D.a.createElement("div",{className:"markdown-editor-body"},D.a.createElement("div",{className:"codemirror-container"},D.a.createElement("textarea",{ref:Qr,placeholder:nr})),wt?D.a.createElement("div",{ref:gn,className:"preview-container"},xt==="stex"&&D.a.createElement(S,{value:Ct}),xt!=="stex"&&D.a.createElement(l.a,{value:Ct})):null))),Nt?D.a.createElement("a",{ref:On,className:"editor-resize"}):null,D.a.createElement(o.a,null,se[Kt]?D.a.createElement(z.a,{centered:!0,title:se[Kt],visible:!0,onCancel:an,footer:null},$n):null))}},SJ7D:function(ut,$e,J){},SJMd:function(ut,$e){/**
* @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 J,re,z,L=!1,H,k;window.PR_SHOULD_USE_CONTINUATION=!0;var P,F;(function(){var M=window,D=["break,continue,do,else,for,if,return,while"],R=[D,"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"],E=[R,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],w=[E,"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"],T=[E,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],A=[E,"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"],_="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",b=[E,"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",s=[D,"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=[D,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],l=[D,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],S=[w,A,T,b,d,s,u,l],h=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,g="str",C="kwd",y="com",f="typ",c="lit",o="pun",a="pln",m="tag",p="dec",v="src",O="atn",U="atv",j="nocode",G="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function B(Ce){for(var we=0,Be=!1,Qe=!1,je=0,De=Ce.length;je<De;++je){var Pe=Ce[je];if(Pe.ignoreCase)Qe=!0;else if(/[a-z]/i.test(Pe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Be=!0,Qe=!1;break}}var Le={b:8,t:9,n:10,v:11,f:12,r:13};function Re(ze){var ge=ze.charCodeAt(0);if(ge!==92)return ge;var Ye=ze.charAt(1);return ge=Le[Ye],ge||("0"<=Ye&&Ye<="7"?parseInt(ze.substring(1),8):Ye==="u"||Ye==="x"?parseInt(ze.substring(2),16):ze.charCodeAt(1))}function Ue(ze){if(ze<32)return(ze<16?"\\x0":"\\x")+ze.toString(16);var ge=String.fromCharCode(ze);return ge==="\\"||ge==="-"||ge==="]"||ge==="^"?"\\"+ge:ge}function We(ze){var ge=ze.substring(1,ze.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),Ye=[],He=ge[0]==="^",xe=["["];He&&xe.push("^");for(var Ie=He?1:0,se=ge.length;Ie<se;++Ie){var te=ge[Ie];if(/\\[bdsw]/i.test(te))xe.push(te);else{var ee=Re(te),Y;Ie+2<se&&ge[Ie+1]==="-"?(Y=Re(ge[Ie+2]),Ie+=2):Y=ee,Ye.push([ee,Y]),Y<65||ee>122||(Y<65||ee>90||Ye.push([Math.max(65,ee)|32,Math.min(Y,90)|32]),Y<97||ee>122||Ye.push([Math.max(97,ee)&~32,Math.min(Y,122)&~32]))}}Ye.sort(function(de,ye){return de[0]-ye[0]||ye[1]-de[1]});for(var Q=[],Z=[],Ie=0;Ie<Ye.length;++Ie){var q=Ye[Ie];q[0]<=Z[1]+1?Z[1]=Math.max(Z[1],q[1]):Q.push(Z=q)}for(var Ie=0;Ie<Q.length;++Ie){var q=Q[Ie];xe.push(Ue(q[0])),q[1]>q[0]&&(q[1]+1>q[0]&&xe.push("-"),xe.push(Ue(q[1])))}return xe.push("]"),xe.join("")}function ke(ze){for(var ge=ze.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),Ye=ge.length,He=[],xe=0,Ie=0;xe<Ye;++xe){var se=ge[xe];if(se==="(")++Ie;else if(se.charAt(0)==="\\"){var te=+se.substring(1);te&&(te<=Ie?He[te]=-1:ge[xe]=Ue(te))}}for(var xe=1;xe<He.length;++xe)He[xe]===-1&&(He[xe]=++we);for(var xe=0,Ie=0;xe<Ye;++xe){var se=ge[xe];if(se==="(")++Ie,He[Ie]||(ge[xe]="(?:");else if(se.charAt(0)==="\\"){var te=+se.substring(1);te&&te<=Ie&&(ge[xe]="\\"+He[te])}}for(var xe=0;xe<Ye;++xe)ge[xe]==="^"&&ge[xe+1]!=="^"&&(ge[xe]="");if(ze.ignoreCase&&Be)for(var xe=0;xe<Ye;++xe){var se=ge[xe],ee=se.charAt(0);se.length>=2&&ee==="["?ge[xe]=We(se):ee!=="\\"&&(ge[xe]=se.replace(/[a-zA-Z]/g,function(Z){var q=Z.charCodeAt(0);return"["+String.fromCharCode(q&~32,q|32)+"]"}))}return ge.join("")}for(var Ke=[],je=0,De=Ce.length;je<De;++je){var Pe=Ce[je];if(Pe.global||Pe.multiline)throw new Error(""+Pe);Ke.push("(?:"+ke(Pe)+")")}return new RegExp(Ke.join("|"),Qe?"gi":"g")}function N(Ce,we){var Be=/(?:^|\s)nocode(?:\s|$)/,Qe=[],je=0,De=[],Pe=0;function Le(Re){var Ue=Re.nodeType;if(Ue==1){if(Be.test(Re.className))return;for(var We=Re.firstChild;We;We=We.nextSibling)Le(We);var ke=Re.nodeName.toLowerCase();(ke==="br"||ke==="li")&&(Qe[Pe]=`
`,De[Pe<<1]=je++,De[Pe++<<1|1]=Re)}else if(Ue==3||Ue==4){var Ke=Re.nodeValue;Ke.length&&(we?Ke=Ke.replace(/\r\n?/g,`
`):Ke=Ke.replace(/[ \t\r\n]+/g," "),Qe[Pe]=Ke,De[Pe<<1]=je,je+=Ke.length,De[Pe++<<1|1]=Re)}}return Le(Ce),{sourceCode:Qe.join("").replace(/\n$/,""),spans:De}}function V(Ce,we,Be,Qe,je){if(!Be)return;var De={sourceNode:Ce,pre:1,langExtension:null,numberLines:null,sourceCode:Be,spans:null,basePos:we,decorations:null};Qe(De),je.push.apply(je,De.decorations)}var $=/\S/;function ie(Ce){for(var we=void 0,Be=Ce.firstChild;Be;Be=Be.nextSibling){var Qe=Be.nodeType;we=Qe===1?we?Ce:Be:Qe===3&&$.test(Be.nodeValue)?Ce:we}return we===Ce?void 0:we}function oe(Ce,we){var Be={},Qe;(function(){for(var Pe=Ce.concat(we),Le=[],Re={},Ue=0,We=Pe.length;Ue<We;++Ue){var ke=Pe[Ue],Ke=ke[3];if(Ke)for(var ze=Ke.length;--ze>=0;)Be[Ke.charAt(ze)]=ke;var ge=ke[1],Ye=""+ge;Re.hasOwnProperty(Ye)||(Le.push(ge),Re[Ye]=null)}Le.push(/[\0-\uffff]/),Qe=B(Le)})();var je=we.length,De=function(Pe){for(var Le=Pe.sourceCode,Re=Pe.basePos,Ue=Pe.sourceNode,We=[Re,a],ke=0,Ke=Le.match(Qe)||[],ze={},ge=0,Ye=Ke.length;ge<Ye;++ge){var He=Ke[ge],xe=ze[He],Ie=void 0,se;if(typeof xe=="string")se=!1;else{var te=Be[He.charAt(0)];if(te)Ie=He.match(te[1]),xe=te[0];else{for(var ee=0;ee<je;++ee)if(te=we[ee],Ie=He.match(te[1]),Ie){xe=te[0];break}Ie||(xe=a)}se=xe.length>=5&&xe.substring(0,5)==="lang-",se&&!(Ie&&typeof Ie[1]=="string")&&(se=!1,xe=v),se||(ze[He]=xe)}var Y=ke;if(ke+=He.length,!se)We.push(Re+Y,xe);else{var Q=Ie[1],Z=He.indexOf(Q),q=Z+Q.length;Ie[2]&&(q=He.length-Ie[2].length,Z=q-Q.length);var de=xe.substring(5);V(Ue,Re+Y,He.substring(0,Z),De,We),V(Ue,Re+Y+Z,Q,ue(de,Q),We),V(Ue,Re+Y+q,He.substring(q),De,We)}}Pe.decorations=We};return De}function _e(Ce){var we=[],Be=[];Ce.tripleQuotedStrings?we.push([g,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ce.multiLineStrings?we.push([g,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):we.push([g,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ce.verbatimStrings&&Be.push([g,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Qe=Ce.hashComments;Qe&&(Ce.cStyleComments?(Qe>1?we.push([y,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):we.push([y,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Be.push([g,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):we.push([y,/^#[^\r\n]*/,null,"#"])),Ce.cStyleComments&&(Be.push([y,/^\/\/[^\r\n]*/,null]),Be.push([y,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var je=Ce.regexLiterals;if(je){var De=je>1?"":`
\r`,Pe=De?".":"[\\S\\s]",Le="/(?=[^/*"+De+"])(?:[^/\\x5B\\x5C"+De+"]|\\x5C"+Pe+"|\\x5B(?:[^\\x5C\\x5D"+De+"]|\\x5C"+Pe+")*(?:\\x5D|$))+/";Be.push(["lang-regex",RegExp("^"+G+"("+Le+")")])}var Re=Ce.types;Re&&Be.push([f,Re]);var Ue=(""+Ce.keywords).replace(/^ | $/g,"");Ue.length&&Be.push([C,new RegExp("^(?:"+Ue.replace(/[\s,]+/g,"|")+")\\b"),null]),we.push([a,/^\s+/,null,` \r
\xA0`]);var We="^.[^\\s\\w.$@'\"`/\\\\]*";return Ce.regexLiterals&&(We+="(?!s*/)"),Be.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[f,/^(?:[@_]?[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],[o,new RegExp(We),null]),oe(we,Be)}var fe=_e({keywords:S,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Se(Ce,we,Be){for(var Qe=/(?:^|\s)nocode(?:\s|$)/,je=/\r\n?|\n/,De=Ce.ownerDocument,Pe=De.createElement("li");Ce.firstChild;)Pe.appendChild(Ce.firstChild);var Le=[Pe];function Re(ge){var Ye=ge.nodeType;if(Ye==1&&!Qe.test(ge.className))if(ge.nodeName==="br")Ue(ge),ge.parentNode&&ge.parentNode.removeChild(ge);else for(var He=ge.firstChild;He;He=He.nextSibling)Re(He);else if((Ye==3||Ye==4)&&Be){var xe=ge.nodeValue,Ie=xe.match(je);if(Ie){var se=xe.substring(0,Ie.index);ge.nodeValue=se;var te=xe.substring(Ie.index+Ie[0].length);if(te){var ee=ge.parentNode;ee.insertBefore(De.createTextNode(te),ge.nextSibling)}Ue(ge),se||ge.parentNode.removeChild(ge)}}}function Ue(ge){for(;!ge.nextSibling;)if(ge=ge.parentNode,!ge)return;function Ye(Ie,se){var te=se?Ie.cloneNode(!1):Ie,ee=Ie.parentNode;if(ee){var Y=Ye(ee,1),Q=Ie.nextSibling;Y.appendChild(te);for(var Z=Q;Z;Z=Q)Q=Z.nextSibling,Y.appendChild(Z)}return te}for(var He=Ye(ge.nextSibling,0),xe;(xe=He.parentNode)&&xe.nodeType===1;)He=xe;Le.push(He)}for(var We=0;We<Le.length;++We)Re(Le[We]);we===(we|0)&&Le[0].setAttribute("value",we);var ke=De.createElement("ol");ke.className="linenums";for(var Ke=Math.max(0,we-1|0)||0,We=0,ze=Le.length;We<ze;++We)Pe=Le[We],Pe.className="L"+(We+Ke)%10,Pe.firstChild||Pe.appendChild(De.createTextNode("\xA0")),ke.appendChild(Pe);Ce.appendChild(ke)}function be(Ce){var we=/\bMSIE\s(\d+)/.exec(navigator.userAgent);we=we&&+we[1]<=8;var Be=/\n/g,Qe=Ce.sourceCode,je=Qe.length,De=0,Pe=Ce.spans,Le=Pe.length,Re=0,Ue=Ce.decorations,We=Ue.length,ke=0;Ue[We]=je;var Ke,ze;for(ze=Ke=0;ze<We;)Ue[ze]!==Ue[ze+2]?(Ue[Ke++]=Ue[ze++],Ue[Ke++]=Ue[ze++]):ze+=2;for(We=Ke,ze=Ke=0;ze<We;){for(var ge=Ue[ze],Ye=Ue[ze+1],He=ze+2;He+2<=We&&Ue[He+1]===Ye;)He+=2;Ue[Ke++]=ge,Ue[Ke++]=Ye,ze=He}We=Ue.length=Ke;var xe=Ce.sourceNode,Ie="";xe&&(Ie=xe.style.display,xe.style.display="none");try{for(var se=null;Re<Le;){var te=Pe[Re],ee=Pe[Re+2]||je,Y=Ue[ke+2]||je,He=Math.min(ee,Y),Q=Pe[Re+1],Z;if(Q.nodeType!==1&&(Z=Qe.substring(De,He))){we&&(Z=Z.replace(Be,"\r")),Q.nodeValue=Z;var q=Q.ownerDocument,de=q.createElement("span");de.className=Ue[ke+1];var ye=Q.parentNode;ye.replaceChild(de,Q),de.appendChild(Q),De<ee&&(Pe[Re+1]=Q=q.createTextNode(Qe.substring(He,ee)),ye.insertBefore(Q,de.nextSibling))}De=He,De>=ee&&(Re+=2),De>=Y&&(ke+=2)}}finally{xe&&(xe.style.display=Ie)}}var me={};function le(Ce,we){for(var Be=we.length;--Be>=0;){var Qe=we[Be];me.hasOwnProperty(Qe)?M.console&&console.warn("cannot override language handler %s",Qe):me[Qe]=Ce}}function ue(Ce,we){return Ce&&me.hasOwnProperty(Ce)||(Ce=/^\s*</.test(we)?"default-markup":"default-code"),me[Ce]}le(fe,["default-code"]),le(oe([],[[a,/^[^<?]+/],[p,/^<!\w[^>]*(?:>|$)/],[y,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[o,/^(?:<[%?]|[%?]>)/],["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"]),le(oe([[a,/^[\s]+/,null,` \r
`],[U,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[O,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[o,/^[=<>\/]+/],["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"]),le(oe([],[[U,/^[\s\S]+/]]),["uq.val"]),le(_e({keywords:w,hashComments:!0,cStyleComments:!0,types:h}),["c","cc","cpp","cxx","cyc","m"]),le(_e({keywords:"null,true,false"}),["json"]),le(_e({keywords:A,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:h}),["cs"]),le(_e({keywords:T,cStyleComments:!0}),["java"]),le(_e({keywords:l,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),le(_e({keywords:s,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),le(_e({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),le(_e({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),le(_e({keywords:b,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),le(_e({keywords:_,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),le(oe([],[[g,/^[\s\S]+/]]),["regex"]);function Ee(Ce){var we=Ce.langExtension;try{var Be=N(Ce.sourceNode,Ce.pre),Qe=Be.sourceCode;Ce.sourceCode=Qe,Ce.spans=Be.spans,Ce.basePos=0,ue(we,Qe)(Ce),be(Ce)}catch(je){M.console&&console.log(je&&je.stack||je)}}function Ge(Ce,we,Be){var Qe=Be||!1,je=we||null,De=document.createElement("div");De.innerHTML="<pre>"+Ce+"</pre>",De=De.firstChild,Qe&&Se(De,Qe,!0);var Pe={langExtension:je,numberLines:Qe,sourceNode:De,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Ee(Pe),De.innerHTML}function Te(Ce,we){var Be=we||document.body,Qe=Be.ownerDocument||document;function je(te){return Be.getElementsByTagName(te)}for(var De=[je("pre"),je("code"),je("xmp")],Pe=[],Le=0;Le<De.length;++Le)for(var Re=0,Ue=De[Le].length;Re<Ue;++Re)Pe.push(De[Le][Re]);De=null;var We=Date;We.now||(We={now:function(){return+new Date}});var ke=0,Ke=/\blang(?:uage)?-([\w.]+)(?!\S)/,ze=/\bprettyprint\b/,ge=/\bprettyprinted\b/,Ye=/pre|xmp/i,He=/^code$/i,xe=/^(?:pre|code|xmp)$/i,Ie={};function se(){for(var te=M.PR_SHOULD_USE_CONTINUATION?We.now()+250:Infinity;ke<Pe.length&&We.now()<te;ke++){for(var ee=Pe[ke],Y=Ie,Q=ee;Q=Q.previousSibling;){var Z=Q.nodeType,q=(Z===7||Z===8)&&Q.nodeValue;if(q?!/^\??prettify\b/.test(q):Z!==3||/\S/.test(Q.nodeValue))break;if(q){Y={},q.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Dt,pt,Nt){Y[pt]=Nt});break}}var de=ee.className;if((Y!==Ie||ze.test(de))&&!ge.test(de)){for(var ye=!1,Me=ee.parentNode;Me;Me=Me.parentNode){var et=Me.tagName;if(xe.test(et)&&Me.className&&ze.test(Me.className)){ye=!0;break}}if(!ye){ee.className+=" prettyprinted";var qe=Y.lang;if(!qe){qe=de.match(Ke);var at;!qe&&(at=ie(ee))&&He.test(at.tagName)&&(qe=at.className.match(Ke)),qe&&(qe=qe[1])}var gt;if(Ye.test(ee.tagName))gt=1;else{var yt=ee.currentStyle,st=Qe.defaultView,_t=yt?yt.whiteSpace:st&&st.getComputedStyle?st.getComputedStyle(ee,null).getPropertyValue("white-space"):0;gt=_t&&_t.substring(0,3)==="pre"}var xt=Y.linenums;(xt=xt==="true"||+xt)||(xt=de.match(/\blinenums\b(?::(\d+))?/),xt=xt?xt[1]&&xt[1].length?+xt[1]:!0:!1),xt&&Se(ee,xt,gt);var Bt={langExtension:qe,sourceNode:ee,numberLines:xt,pre:gt,sourceCode:null,basePos:null,spans:null,decorations:null};Ee(Bt)}}}ke<Pe.length?M.setTimeout(se,250):typeof Ce=="function"&&Ce()}se()}var pe=M.PR={createSimpleLexer:oe,registerLangHandler:le,sourceDecorator:_e,PR_ATTRIB_NAME:O,PR_ATTRIB_VALUE:U,PR_COMMENT:y,PR_DECLARATION:p,PR_KEYWORD:C,PR_LITERAL:c,PR_NOCODE:j,PR_PLAIN:a,PR_PUNCTUATION:o,PR_SOURCE:v,PR_STRING:g,PR_TAG:m,PR_TYPE:f,prettyPrintOne:L?M.prettyPrintOne=Ge:P=Ge,prettyPrint:F=L?M.prettyPrint=Te:F=Te},Ae=M.define;typeof Ae=="function"&&Ae.amd&&Ae("google-code-prettify",[],function(){return pe})})()},"VrN/":function(ut,$e,J){(function(re,z){ut.exports=z()})(this,function(){"use strict";var re=navigator.userAgent,z=navigator.platform,L=/gecko\/\d/i.test(re),H=/MSIE \d/.test(re),k=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(re),P=/Edge\/(\d+)/.exec(re),F=H||k||P,M=F&&(H?document.documentMode||6:+(P||k)[1]),D=!P&&/WebKit\//.test(re),R=D&&/Qt\/\d+\.\d+/.test(re),E=!P&&/Chrome\//.test(re),w=/Opera\//.test(re),T=/Apple Computer/.test(navigator.vendor),A=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(re),_=/PhantomJS/.test(re),b=!P&&/AppleWebKit/.test(re)&&/Mobile\/\w+/.test(re),d=/Android/.test(re),s=b||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(re),u=b||/Mac/.test(z),l=/\bCrOS\b/.test(re),S=/win/i.test(z),h=w&&re.match(/Version\/(\d*\.\d*)/);h&&(h=Number(h[1])),h&&h>=15&&(w=!1,D=!0);var g=u&&(R||w&&(h==null||h<12.11)),C=L||F&&M>=9;function y(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var f=function(e,t){var n=e.className,r=y(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 o(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 x=0;x<t.length;++x)i.appendChild(t[x]);return i}function m(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var p;document.createRange?p=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:p=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function v(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 O(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function U(e,t){var n=e.className;y(t).test(n)||(e.className+=(n?" ":"")+t)}function j(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!y(n[r]).test(t)&&(t+=" "+n[r]);return t}var G=function(e){e.select()};b?G=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:F&&(G=function(e){try{e.select()}catch(t){}});function B(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function N(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 V(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var x=r||0,I=i||0;;){var W=e.indexOf(" ",x);if(W<0||W>=t)return I+(t-x);I+=W-x,I+=n-I%n,x=W+1}}var $=function(){this.id=null,this.f=null,this.time=0,this.handler=B(this.onTimeout,this)};$.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},$.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 ie(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var oe=50,_e={toString:function(){return"CodeMirror.Pass"}},fe={scroll:!1},Se={origin:"*mouse"},be={origin:"+move"};function me(e,t,n){for(var r=0,i=0;;){var x=e.indexOf(" ",r);x==-1&&(x=e.length);var I=x-r;if(x==e.length||i+I>=t)return r+Math.min(I,t-i);if(i+=x-r,i+=n-i%n,r=x+1,i>=t)return r}}var le=[""];function ue(e){for(;le.length<=e;)le.push(Ee(le)+" ");return le[e]}function Ee(e){return e[e.length-1]}function Ge(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Te(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function pe(){}function Ae(e,t){var n;return Object.create?n=Object.create(e):(pe.prototype=e,n=new pe),t&&N(t,n),n}var Ce=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function we(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Ce.test(e))}function Be(e,t){return t?t.source.indexOf("\\w")>-1&&we(e)?!0:t.test(e):we(e)}function Qe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var je=/[\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&&je.test(e)}function Pe(e,t,n){for(;(n<0?t>0:t<e.length)&&De(e.charAt(t));)t+=n;return t}function Le(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,x=r<0?Math.ceil(i):Math.floor(i);if(x==t)return e(x)?t:n;e(x)?n=x:t=x+r}}function Re(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,x=0;x<e.length;++x){var I=e[x];(I.from<n&&I.to>t||t==n&&I.to==t)&&(r(Math.max(I.from,t),Math.min(I.to,n),I.level==1?"rtl":"ltr",x),i=!0)}i||r(t,n,"ltr")}var Ue=null;function We(e,t,n){var r;Ue=null;for(var i=0;i<e.length;++i){var x=e[i];if(x.from<t&&x.to>t)return i;x.to==t&&(x.from!=x.to&&n=="before"?r=i:Ue=i),x.from==t&&(x.from!=x.to&&n!="before"?r=i:Ue=i)}return r!=null?r:Ue}var ke=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]/,x=/[LRr]/,I=/[Lb1n]/,W=/[1n]/;function K(X,ne,ae){this.level=X,this.from=ne,this.to=ae}return function(X,ne){var ae=ne=="ltr"?"L":"R";if(X.length==0||ne=="ltr"&&!r.test(X))return!1;for(var he=X.length,ce=[],Oe=0;Oe<he;++Oe)ce.push(n(X.charCodeAt(Oe)));for(var Ne=0,Xe=ae;Ne<he;++Ne){var Ze=ce[Ne];Ze=="m"?ce[Ne]=Xe:Xe=Ze}for(var rt=0,Je=ae;rt<he;++rt){var it=ce[rt];it=="1"&&Je=="r"?ce[rt]="n":x.test(it)&&(Je=it,it=="r"&&(ce[rt]="R"))}for(var mt=1,ft=ce[0];mt<he-1;++mt){var Tt=ce[mt];Tt=="+"&&ft=="1"&&ce[mt+1]=="1"?ce[mt]="1":Tt==","&&ft==ce[mt+1]&&(ft=="1"||ft=="n")&&(ce[mt]=ft),ft=Tt}for(var It=0;It<he;++It){var dr=ce[It];if(dr==",")ce[It]="N";else if(dr=="%"){var zt=void 0;for(zt=It+1;zt<he&&ce[zt]=="%";++zt);for(var Ir=It&&ce[It-1]=="!"||zt<he&&ce[zt]=="1"?"1":"N",Dr=It;Dr<zt;++Dr)ce[Dr]=Ir;It=zt-1}}for(var er=0,Or=ae;er<he;++er){var pr=ce[er];Or=="L"&&pr=="1"?ce[er]="L":x.test(pr)&&(Or=pr)}for(var ir=0;ir<he;++ir)if(i.test(ce[ir])){var tr=void 0;for(tr=ir+1;tr<he&&i.test(ce[tr]);++tr);for(var Zt=(ir?ce[ir-1]:ae)=="L",Rr=(tr<he?ce[tr]:ae)=="L",Yn=Zt==Rr?Zt?"L":"R":ae,mn=ir;mn<tr;++mn)ce[mn]=Yn;ir=tr-1}for(var Er=[],Yr,cr=0;cr<he;)if(I.test(ce[cr])){var Ua=cr;for(++cr;cr<he&&I.test(ce[cr]);++cr);Er.push(new K(0,Ua,cr))}else{var rn=cr,Cn=Er.length,An=ne=="rtl"?1:0;for(++cr;cr<he&&ce[cr]!="L";++cr);for(var Sr=rn;Sr<cr;)if(W.test(ce[Sr])){rn<Sr&&(Er.splice(Cn,0,new K(1,rn,Sr)),Cn+=An);var Qn=Sr;for(++Sr;Sr<cr&&W.test(ce[Sr]);++Sr);Er.splice(Cn,0,new K(2,Qn,Sr)),Cn+=An,rn=Sr}else++Sr;rn<cr&&Er.splice(Cn,0,new K(1,rn,cr))}return ne=="ltr"&&(Er[0].level==1&&(Yr=X.match(/^\s+/))&&(Er[0].from=Yr[0].length,Er.unshift(new K(0,0,Yr[0].length))),Ee(Er).level==1&&(Yr=X.match(/\s+$/))&&(Ee(Er).to-=Yr[0].length,Er.push(new K(0,he-Yr[0].length,he)))),ne=="rtl"?Er.reverse():Er}}();function Ke(e,t){var n=e.order;return n==null&&(n=e.order=ke(e.text,t)),n}var ze=[],ge=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||ze).concat(n)}};function Ye(e,t){return e._handlers&&e._handlers[t]||ze}function He(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 x=ie(i,n);x>-1&&(r[t]=i.slice(0,x).concat(i.slice(x+1)))}}}function xe(e,t){var n=Ye(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Ie(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),xe(e,n||t.type,e,t),Z(t)||t.codemirrorIgnore}function se(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)ie(n,t[r])==-1&&n.push(t[r])}function te(e,t){return Ye(e,t).length>0}function ee(e){e.prototype.on=function(t,n){ge(this,t,n)},e.prototype.off=function(t,n){He(this,t,n)}}function Y(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Q(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Z(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function q(e){Y(e),Q(e)}function de(e){return e.target||e.srcElement}function ye(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 Me=function(){if(F&&M<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),et;function qe(e){if(et==null){var t=a("span","\u200B");o(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(et=t.offsetWidth<=1&&t.offsetHeight>2&&!(F&&M<8))}var n=et?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var at;function gt(e){if(at!=null)return at;var t=o(e,document.createTextNode("A\u062EA")),n=p(t,0,1).getBoundingClientRect(),r=p(t,1,2).getBoundingClientRect();return c(e),!n||n.left==n.right?!1:at=r.right-n.right<3}var yt=`
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 x=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),I=x.indexOf("\r");I!=-1?(n.push(x.slice(0,I)),t+=I+1):(n.push(x),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},st=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},_t=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),xt=null;function Bt(e){if(xt!=null)return xt;var t=o(e,a("span","x")),n=t.getBoundingClientRect(),r=p(t,0,1).getBoundingClientRect();return xt=Math.abs(n.left-r.left)>1}var Dt={},pt={};function Nt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Dt[e]=t}function rr(e,t){pt[e]=t}function Gt(e){if(typeof e=="string"&&pt.hasOwnProperty(e))e=pt[e];else if(e&&typeof e.name=="string"&&pt.hasOwnProperty(e.name)){var t=pt[e.name];typeof t=="string"&&(t={name:t}),e=Ae(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Gt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Gt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Vt(e,t){t=Gt(t);var n=Dt[t.name];if(!n)return Vt(e,"text/plain");var r=n(e,t);if(Xt.hasOwnProperty(t.name)){var i=Xt[t.name];for(var x in i){if(!i.hasOwnProperty(x))continue;r.hasOwnProperty(x)&&(r["_"+x]=r[x]),r[x]=i[x]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var I in t.modeProps)r[I]=t.modeProps[I];return r}var Xt={};function Pr(e,t){var n=Xt.hasOwnProperty(e)?Xt[e]:Xt[e]={};N(t,n)}function Ht(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 kt(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 jt(e,t,n){return e.startState?e.startState(t,n):!0}var Ot=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};Ot.prototype.eol=function(){return this.pos>=this.string.length},Ot.prototype.sol=function(){return this.pos==this.lineStart},Ot.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ot.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ot.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},Ot.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ot.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ot.prototype.skipToEnd=function(){this.pos=this.string.length},Ot.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ot.prototype.backUp=function(e){this.pos-=e},Ot.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=V(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?V(this.string,this.lineStart,this.tabSize):0)},Ot.prototype.indentation=function(){return V(this.string,null,this.tabSize)-(this.lineStart?V(this.string,this.lineStart,this.tabSize):0)},Ot.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(I){return n?I.toLowerCase():I},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var x=this.string.slice(this.pos).match(e);return x&&x.index>0?null:(x&&t!==!1&&(this.pos+=x[0].length),x)}},Ot.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ot.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ot.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ot.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function tt(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],x=i.chunkSize();if(t<x){n=i;break}t-=x}return n.lines[t]}function Yt(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(x){var I=x.text;i==n.line&&(I=I.slice(0,n.ch)),i==t.line&&(I=I.slice(t.ch)),r.push(I),++i}),r}function Nr(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function fr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function St(e){if(e.parent==null)return null;for(var t=e.parent,n=ie(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 hr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],x=i.height;if(t<x){e=i;continue e}t-=x,n+=i.chunkSize()}return n}while(!e.lines);for(var I=0;I<e.lines.length;++I){var W=e.lines[I],K=W.height;if(t<K)break;t-=K}return n+I}function gr(e,t){return t>=e.first&&t<e.first+e.size}function nr(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Fe(e,t,n){if(n===void 0&&(n=null),!(this instanceof Fe))return new Fe(e,t,n);this.line=e,this.ch=t,this.sticky=n}function dt(e,t){return e.line-t.line||e.ch-t.ch}function _r(e,t){return e.sticky==t.sticky&&dt(e,t)==0}function vr(e){return Fe(e.line,e.ch)}function Ve(e,t){return dt(e,t)<0?t:e}function wr(e,t){return dt(e,t)<0?e:t}function jr(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ct(e,t){if(t.line<e.first)return Fe(e.first,0);var n=e.first+e.size-1;return t.line>n?Fe(n,tt(e,n).text.length):Ct(t,tt(e,t.line).text.length)}function Ct(e,t){var n=e.ch;return n==null||n>t?Fe(e.line,t):n<0?Fe(e.line,0):e}function Ur(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ct(e,t[r]);return n}var xr=function(e,t){this.state=e,this.lookAhead=t},ht=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};ht.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ht.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}},ht.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ht.fromSaved=function(e,t,n){return t instanceof xr?new ht(e,Ht(e.mode,t.state),n,t.lookAhead):new ht(e,Ht(e.mode,t),n)},ht.prototype.save=function(e){var t=e!==!1?Ht(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new xr(t,this.maxLookAhead):t};function wt(e,t,n,r){var i=[e.state.modeGen],x={};Ut(e,t.text,e.doc.mode,n,function(X,ne){return i.push(X,ne)},x,r);for(var I=n.state,W=function(X){n.baseTokens=i;var ne=e.state.overlays[X],ae=1,he=0;n.state=!0,Ut(e,t.text,ne.mode,n,function(ce,Oe){for(var Ne=ae;he<ce;){var Xe=i[ae];Xe>ce&&i.splice(ae,1,ce,i[ae+1],Xe),ae+=2,he=Math.min(ce,Xe)}if(!Oe)return;if(ne.opaque)i.splice(Ne,ae-Ne,ce,"overlay "+Oe),ae=Ne+2;else for(;Ne<ae;Ne+=2){var Ze=i[Ne+1];i[Ne+1]=(Ze?Ze+" ":"")+"overlay "+Oe}},x),n.state=I,n.baseTokens=null,n.baseTokenPos=1},K=0;K<e.state.overlays.length;++K)W(K);return{styles:i,classes:x.bgClass||x.textClass?x:null}}function ot(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=ve(e,St(t)),i=t.text.length>e.options.maxHighlightLength&&Ht(e.doc.mode,r.state),x=wt(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=x.styles,x.classes?t.styleClasses=x.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 ve(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new ht(r,!0,t);var x=Ln(e,t,n),I=x>r.first&&tt(r,x-1).stateAfter,W=I?ht.fromSaved(r,I,x):new ht(r,jt(r.mode),x);return r.iter(x,t,function(K){nt(e,K.text,W);var X=W.line;K.stateAfter=X==t-1||X%5==0||X>=i.viewFrom&&X<i.viewTo?W.save():null,W.nextLine()}),n&&(r.modeFrontier=W.line),W}function nt(e,t,n,r){var i=e.doc.mode,x=new Ot(t,e.options.tabSize,n);for(x.start=x.pos=r||0,t==""&&lt(i,n.state);!x.eol();)At(i,x,n.state),x.start=x.pos}function lt(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=kt(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function At(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=kt(e,n).mode);var x=e.token(t,n);if(t.pos>t.start)return x}throw new Error("Mode "+e.name+" failed to advance stream.")}var Jt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function ar(e,t,n,r){var i=e.doc,x=i.mode,I;t=ct(i,t);var W=tt(i,t.line),K=ve(e,t.line,n),X=new Ot(W.text,e.options.tabSize,K),ne;for(r&&(ne=[]);(r||X.pos<t.ch)&&!X.eol();)X.start=X.pos,I=At(x,X,K.state),r&&ne.push(new Jt(X,I,Ht(i.mode,K.state)));return r?ne:new Jt(X,I,K.state)}function Kt(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 Ut(e,t,n,r,i,x,I){var W=n.flattenSpans;W==null&&(W=e.options.flattenSpans);var K=0,X=null,ne=new Ot(t,e.options.tabSize,r),ae,he=e.options.addModeClass&&[null];for(t==""&&Kt(lt(n,r.state),x);!ne.eol();){if(ne.pos>e.options.maxHighlightLength?(W=!1,I&&nt(e,t,r,ne.pos),ne.pos=t.length,ae=null):ae=Kt(At(n,ne,r.state,he),x),he){var ce=he[0].name;ce&&(ae="m-"+(ae?ce+" "+ae:ce))}if(!W||X!=ae){for(;K<ne.start;)K=Math.min(ne.start,K+5e3),i(K,X);X=ae}ne.start=ne.pos}for(;K<ne.pos;){var Oe=Math.min(ne.pos,K+5e3);i(Oe,X),K=Oe}}function Ln(e,t,n){for(var r,i,x=e.doc,I=n?-1:t-(e.doc.mode.innerMode?1e3:100),W=t;W>I;--W){if(W<=x.first)return x.first;var K=tt(x,W-1),X=K.stateAfter;if(X&&(!n||W+(X instanceof xr?X.lookAhead:0)<=x.modeFrontier))return W;var ne=V(K.text,null,e.options.tabSize);(i==null||r>ne)&&(i=W-1,r=ne)}return i}function Mr(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=tt(e,r).stateAfter;if(i&&(!(i instanceof xr)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Wr=!1,Cr=!1;function wi(){Wr=!0}function Ci(){Cr=!0}function pn(e,t,n){this.marker=e,this.from=t,this.to=n}function nn(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function $i(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Ai(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Ba(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var x=e[i],I=x.marker,W=x.from==null||(I.inclusiveLeft?x.from<=t:x.from<t);if(W||x.from==t&&I.type=="bookmark"&&(!n||!x.marker.insertLeft)){var K=x.to==null||(I.inclusiveRight?x.to>=t:x.to>t);(r||(r=[])).push(new pn(I,x.from,K?null:x.to))}}return r}function Zn(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var x=e[i],I=x.marker,W=x.to==null||(I.inclusiveRight?x.to>=t:x.to>t);if(W||x.from==t&&I.type=="bookmark"&&(!n||x.marker.insertLeft)){var K=x.from==null||(I.inclusiveLeft?x.from<=t:x.from<t);(r||(r=[])).push(new pn(I,K?null:x.from-t,x.to==null?null:x.to-t))}}return r}function Qr(e,t){if(t.full)return null;var n=gr(e,t.from.line)&&tt(e,t.from.line).markedSpans,r=gr(e,t.to.line)&&tt(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,x=t.to.ch,I=dt(t.from,t.to)==0,W=Ba(n,i,I),K=Zn(r,x,I),X=t.text.length==1,ne=Ee(t.text).length+(X?i:0);if(W)for(var ae=0;ae<W.length;++ae){var he=W[ae];if(he.to==null){var ce=nn(K,he.marker);ce?X&&(he.to=ce.to==null?null:ce.to+ne):he.to=i}}if(K)for(var Oe=0;Oe<K.length;++Oe){var Ne=K[Oe];if(Ne.to!=null&&(Ne.to+=ne),Ne.from==null){var Xe=nn(W,Ne.marker);Xe||(Ne.from=ne,X&&(W||(W=[])).push(Ne))}else Ne.from+=ne,X&&(W||(W=[])).push(Ne)}W&&(W=Dn(W)),K&&K!=W&&(K=Dn(K));var Ze=[W];if(!X){var rt=t.text.length-2,Je;if(rt>0&&W)for(var it=0;it<W.length;++it)W[it].to==null&&(Je||(Je=[])).push(new pn(W[it].marker,null,null));for(var mt=0;mt<rt;++mt)Ze.push(Je);Ze.push(K)}return Ze}function Dn(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 On(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(ce){if(ce.markedSpans)for(var Oe=0;Oe<ce.markedSpans.length;++Oe){var Ne=ce.markedSpans[Oe].marker;Ne.readOnly&&(!r||ie(r,Ne)==-1)&&(r||(r=[])).push(Ne)}}),!r)return null;for(var i=[{from:t,to:n}],x=0;x<r.length;++x)for(var I=r[x],W=I.find(0),K=0;K<i.length;++K){var X=i[K];if(dt(X.to,W.from)<0||dt(X.from,W.to)>0)continue;var ne=[K,1],ae=dt(X.from,W.from),he=dt(X.to,W.to);(ae<0||!I.inclusiveLeft&&!ae)&&ne.push({from:X.from,to:W.from}),(he>0||!I.inclusiveRight&&!he)&&ne.push({from:W.to,to:X.to}),i.splice.apply(i,ne),K+=ne.length-3}return i}function gn(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 Jn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function vn(e){return e.inclusiveLeft?-1:0}function Zr(e){return e.inclusiveRight?1:0}function $n(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),x=dt(r.from,i.from)||vn(e)-vn(t);if(x)return-x;var I=dt(r.to,i.to)||Zr(e)-Zr(t);return I||t.id-e.id}function an(e,t){var n=Cr&&e.markedSpans,r;if(n)for(var i=void 0,x=0;x<n.length;++x)i=n[x],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||$n(r,i.marker)<0)&&(r=i.marker);return r}function Li(e){return an(e,!0)}function Rn(e){return an(e,!1)}function qi(e,t){var n=Cr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var x=n[i];x.marker.collapsed&&(x.from==null||x.from<t)&&(x.to==null||x.to>t)&&(!r||$n(r,x.marker)<0)&&(r=x.marker)}return r}function ea(e,t,n,r,i){var x=tt(e,t),I=Cr&&x.markedSpans;if(I)for(var W=0;W<I.length;++W){var K=I[W];if(!K.marker.collapsed)continue;var X=K.marker.find(0),ne=dt(X.from,n)||vn(K.marker)-vn(i),ae=dt(X.to,r)||Zr(K.marker)-Zr(i);if(ne>=0&&ae<=0||ne<=0&&ae>=0)continue;if(ne<=0&&(K.marker.inclusiveRight&&i.inclusiveLeft?dt(X.to,n)>=0:dt(X.to,n)>0)||ne>=0&&(K.marker.inclusiveRight&&i.inclusiveLeft?dt(X.from,r)<=0:dt(X.from,r)<0))return!0}}function Hr(e){for(var t;t=Li(e);)e=t.find(-1,!0).line;return e}function ja(e){for(var t;t=Rn(e);)e=t.find(1,!0).line;return e}function vt(e){for(var t,n;t=Rn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function bt(e,t){var n=tt(e,t),r=Hr(n);return n==r?t:St(r)}function Et(e,t){if(t>e.lastLine())return t;var n=tt(e,t),r;if(!Lt(e,n))return t;for(;r=Rn(n);)n=r.find(1,!0).line;return St(n)+1}function Lt(e,t){var n=Cr&&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&&Pt(e,t,r))return!0}}function Pt(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return Pt(e,r.line,nn(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,x=0;x<t.markedSpans.length;++x)if(i=t.markedSpans[x],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Pt(e,t,i))return!0}function Ft(e){e=Hr(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 x=n.parent;x;n=x,x=n.parent)for(var I=0;I<x.children.length;++I){var W=x.children[I];if(W==n)break;t+=W.height}return t}function Qt(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Li(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Rn(r);){var x=n.find(0,!0);t-=r.text.length-x.from.ch,r=x.to.line,t+=r.text.length-x.to.ch}return t}function or(e){var t=e.display,n=e.doc;t.maxLine=tt(n,n.first),t.maxLineLength=Qt(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=Qt(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var sr=function(e,t,n){this.text=e,Jn(this,t),this.height=n?n(this):1};sr.prototype.lineNo=function(){return St(this)},ee(sr);function Jr(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),gn(e),Jn(e,n);var i=r?r(e):1;i!=e.height&&fr(e,i)}function qt(e){e.parent=null,gn(e)}var on={},yr={};function $r(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?yr:on;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function qr(e,t){var n=m("span",null,null,D?"padding-right: .1px":null),r={pre:m("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 x=i?t.rest[i-1]:t.line,I=void 0;r.pos=0,r.addToken=ws,gt(e.display.measure)&&(I=Ke(x,e.doc.direction))&&(r.addToken=As(r.addToken,I)),r.map=[];var W=t!=e.display.externalMeasured&&St(x);Ls(x,r,ot(e,x,W)),x.styleClasses&&(x.styleClasses.bgClass&&(r.bgClass=j(x.styleClasses.bgClass,r.bgClass||"")),x.styleClasses.textClass&&(r.textClass=j(x.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(qe(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(D){var K=r.content.lastChild;(/\bcm-tab\b/.test(K.className)||K.querySelector&&K.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return xe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=j(r.pre.className,r.textClass||"")),r}function qn(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 ws(e,t,n,r,i,x,I){if(!t)return;var W=e.splitSpaces?Cs(t,e.trailingSpace):t,K=e.cm.state.specialChars,X=!1,ne;if(!K.test(t))e.col+=t.length,ne=document.createTextNode(W),e.map.push(e.pos,e.pos+t.length,ne),F&&M<9&&(X=!0),e.pos+=t.length;else{ne=document.createDocumentFragment();for(var ae=0;;){K.lastIndex=ae;var he=K.exec(t),ce=he?he.index-ae:t.length-ae;if(ce){var Oe=document.createTextNode(W.slice(ae,ae+ce));F&&M<9?ne.appendChild(a("span",[Oe])):ne.appendChild(Oe),e.map.push(e.pos,e.pos+ce,Oe),e.col+=ce,e.pos+=ce}if(!he)break;ae+=ce+1;var Ne=void 0;if(he[0]==" "){var Xe=e.cm.options.tabSize,Ze=Xe-e.col%Xe;Ne=ne.appendChild(a("span",ue(Ze),"cm-tab")),Ne.setAttribute("role","presentation"),Ne.setAttribute("cm-text"," "),e.col+=Ze}else he[0]=="\r"||he[0]==`
`?(Ne=ne.appendChild(a("span",he[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ne.setAttribute("cm-text",he[0]),e.col+=1):(Ne=e.cm.options.specialCharPlaceholder(he[0]),Ne.setAttribute("cm-text",he[0]),F&&M<9?ne.appendChild(a("span",[Ne])):ne.appendChild(Ne),e.col+=1);e.map.push(e.pos,e.pos+1,Ne),e.pos++}}if(e.trailingSpace=W.charCodeAt(t.length-1)==32,n||r||i||X||x||I){var rt=n||"";r&&(rt+=r),i&&(rt+=i);var Je=a("span",[ne],rt,x);if(I)for(var it in I)I.hasOwnProperty(it)&&it!="style"&&it!="class"&&Je.setAttribute(it,I[it]);return e.content.appendChild(Je)}e.content.appendChild(ne)}function Cs(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var x=e.charAt(i);x==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(x="\xA0"),r+=x,n=x==" "}return r}function As(e,t){return function(n,r,i,x,I,W,K){i=i?i+" cm-force-border":"cm-force-border";for(var X=n.pos,ne=X+r.length;;){for(var ae=void 0,he=0;he<t.length&&!(ae=t[he],ae.to>X&&ae.from<=X);he++);if(ae.to>=ne)return e(n,r,i,x,I,W,K);e(n,r.slice(0,ae.to-X),i,x,null,W,K),x=null,r=r.slice(ae.to-X),X=ae.to}}}function Wa(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 Ls(e,t,n){var r=e.markedSpans,i=e.text,x=0;if(!r){for(var I=1;I<n.length;I+=2)t.addToken(t,i.slice(x,x=n[I]),$r(n[I+1],t.cm.options));return}for(var W=i.length,K=0,X=1,ne="",ae,he,ce=0,Oe,Ne,Xe,Ze,rt;;){if(ce==K){Oe=Ne=Xe=he="",rt=null,Ze=null,ce=Infinity;for(var Je=[],it=void 0,mt=0;mt<r.length;++mt){var ft=r[mt],Tt=ft.marker;if(Tt.type=="bookmark"&&ft.from==K&&Tt.widgetNode)Je.push(Tt);else if(ft.from<=K&&(ft.to==null||ft.to>K||Tt.collapsed&&ft.to==K&&ft.from==K)){if(ft.to!=null&&ft.to!=K&&ce>ft.to&&(ce=ft.to,Ne=""),Tt.className&&(Oe+=" "+Tt.className),Tt.css&&(he=(he?he+";":"")+Tt.css),Tt.startStyle&&ft.from==K&&(Xe+=" "+Tt.startStyle),Tt.endStyle&&ft.to==ce&&(it||(it=[])).push(Tt.endStyle,ft.to),Tt.title&&((rt||(rt={})).title=Tt.title),Tt.attributes)for(var It in Tt.attributes)(rt||(rt={}))[It]=Tt.attributes[It];Tt.collapsed&&(!Ze||$n(Ze.marker,Tt)<0)&&(Ze=ft)}else ft.from>K&&ce>ft.from&&(ce=ft.from)}if(it)for(var dr=0;dr<it.length;dr+=2)it[dr+1]==ce&&(Ne+=" "+it[dr]);if(!Ze||Ze.from==K)for(var zt=0;zt<Je.length;++zt)Wa(t,0,Je[zt]);if(Ze&&(Ze.from||0)==K){if(Wa(t,(Ze.to==null?W+1:Ze.to)-K,Ze.marker,Ze.from==null),Ze.to==null)return;Ze.to==K&&(Ze=!1)}}if(K>=W)break;for(var Ir=Math.min(W,ce);;){if(ne){var Dr=K+ne.length;if(!Ze){var er=Dr>Ir?ne.slice(0,Ir-K):ne;t.addToken(t,er,ae?ae+Oe:Oe,Xe,K+er.length==ce?Ne:"",he,rt)}if(Dr>=Ir){ne=ne.slice(Ir-K),K=Ir;break}K=Dr,Xe=""}ne=i.slice(x,x=n[X++]),ae=$r(n[X++],t.cm.options)}}}function Ha(e,t,n){this.line=t,this.rest=vt(t),this.size=this.rest?St(Ee(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Lt(e,t)}function Di(e,t,n){for(var r=[],i,x=t;x<n;x=i){var I=new Ha(e.doc,tt(e.doc,x),x);i=x+I.size,r.push(I)}return r}var Pn=null;function Ds(e){Pn?Pn.ops.push(e):e.ownsGroup=Pn={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{Pn=null,t(n)}}var ei=null;function mr(e,t){var n=Ye(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Pn?i=Pn.delayedCallbacks:ei?i=ei:(i=ei=[],setTimeout(Ps,0));for(var x=function(W){i.push(function(){return n[W].apply(null,r)})},I=0;I<n.length;++I)x(I)}function Ps(){var e=ei;ei=null;for(var t=0;t<e.length;++t)e[t]()}function Ka(e,t,n,r){for(var i=0;i<t.changes.length;i++){var x=t.changes[i];x=="text"?ks(e,t):x=="gutter"?Ga(e,t,n,r):x=="class"?ta(e,t):x=="widget"&&Is(e,t,r)}t.changes=null}function ti(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),F&&M<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=ti(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function za(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):qr(e,t)}function ks(e,t){var n=t.text.className,r=za(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,ta(e,t)):n&&(t.text.className=n)}function ta(e,t){Ms(e,t),t.line.wrapClass?ti(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 Ga(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=ti(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 x=t.line.gutterMarkers;if(e.options.lineNumbers||x){var I=ti(t),W=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(W),I.insertBefore(W,t.text),t.line.gutterClass&&(W.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!x||!x["CodeMirror-linenumbers"])&&(t.lineNumber=W.appendChild(a("div",nr(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),x)for(var K=0;K<e.display.gutterSpecs.length;++K){var X=e.display.gutterSpecs[K].className,ne=x.hasOwnProperty(X)&&x[X];ne&&W.appendChild(a("div",[ne],"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=y("CodeMirror-linewidget"),i=t.node.firstChild,x=void 0;i;i=x)x=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Va(e,t,n)}function Ns(e,t,n,r){var i=za(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),ta(e,t),Ga(e,t,n,r),Va(e,t,r),t.node}function Va(e,t,n){if(Xa(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Xa(e,t.rest[r],t,n,!1)}function Xa(e,t,n,r,i){if(!t.widgets)return;for(var x=ti(n),I=0,W=t.widgets;I<W.length;++I){var K=W[I],X=a("div",[K.node],"CodeMirror-linewidget"+(K.className?" "+K.className:""));K.handleMouseEvents||X.setAttribute("cm-ignore-events","true"),Us(K,X,n,r),e.display.input.setUneditable(X),i&&K.above?x.insertBefore(X,n.gutter||n.text):x.appendChild(X),mr(K,"redraw")}}function Us(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function ri(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!v(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;"),o(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function en(e,t){for(var n=de(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 Oi(e){return e.lineSpace.offsetTop}function ra(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Ya(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=o(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 Vr(e){return oe-e.display.nativeBarWidth}function yn(e){return e.display.scroller.clientWidth-Vr(e)-e.display.barWidth}function na(e){return e.display.scroller.clientHeight-Vr(e)-e.display.barHeight}function Fs(e,t,n){var r=e.options.lineWrapping,i=r&&yn(e);if(!t.measure.heights||r&&t.measure.width!=i){var x=t.measure.heights=[];if(r){t.measure.width=i;for(var I=t.text.firstChild.getClientRects(),W=0;W<I.length-1;W++){var K=I[W],X=I[W+1];Math.abs(K.bottom-X.bottom)>2&&x.push((K.bottom+X.top)/2-n.top)}}x.push(n.bottom-n.top)}}function Qa(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(St(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=Hr(t);var n=St(t),r=e.display.externalMeasured=new Ha(e.doc,t,n);r.lineN=n;var i=r.built=qr(e,r);return r.text=i.pre,o(e.display.lineMeasure,i.pre),r}function Za(e,t,n,r){return Xr(e,Mn(e,t),n,r)}function ia(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[xn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Mn(e,t){var n=St(t),r=ia(e,n);r&&!r.text?r=null:r&&r.changes&&(Ka(e,r,n,da(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=Qa(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Xr(e,t,n,r,i){t.before&&(n=-1);var x=n+(r||""),I;return t.cache.hasOwnProperty(x)?I=t.cache[x]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fs(e,t.view,t.rect),t.hasHeights=!0),I=Ws(e,t,n,r),I.bogus||(t.cache[x]=I)),{left:I.left,right:I.right,top:i?I.rtop:I.top,bottom:i?I.rbottom:I.bottom}}var Ja={left:0,right:0,top:0,bottom:0};function $a(e,t,n){for(var r,i,x,I,W,K,X=0;X<e.length;X+=3)if(W=e[X],K=e[X+1],t<W?(i=0,x=1,I="left"):t<K?(i=t-W,x=i+1):(X==e.length-3||t==K&&e[X+3]>t)&&(x=K-W,i=x-1,t>=K&&(I="right")),i!=null){if(r=e[X+2],W==K&&n==(r.insertLeft?"left":"right")&&(I=n),n=="left"&&i==0)for(;X&&e[X-2]==e[X-3]&&e[X-1].insertLeft;)r=e[(X-=3)+2],I="left";if(n=="right"&&i==K-W)for(;X<e.length-3&&e[X+3]==e[X+4]&&!e[X+5].insertLeft;)r=e[(X+=3)+2],I="right";break}return{node:r,start:i,end:x,collapse:I,coverStart:W,coverEnd:K}}function js(e,t){var n=Ja;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=$a(t.map,n,r),x=i.node,I=i.start,W=i.end,K=i.collapse,X;if(x.nodeType==3){for(var ne=0;ne<4;ne++){for(;I&&De(t.line.text.charAt(i.coverStart+I));)--I;for(;i.coverStart+W<i.coverEnd&&De(t.line.text.charAt(i.coverStart+W));)++W;if(F&&M<9&&I==0&&W==i.coverEnd-i.coverStart?X=x.parentNode.getBoundingClientRect():X=js(p(x,I,W).getClientRects(),r),X.left||X.right||I==0)break;W=I,I=I-1,K="right"}F&&M<11&&(X=Hs(e.display.measure,X))}else{I>0&&(K=r="right");var ae;e.options.lineWrapping&&(ae=x.getClientRects()).length>1?X=ae[r=="right"?ae.length-1:0]:X=x.getBoundingClientRect()}if(F&&M<9&&!I&&(!X||!X.left&&!X.right)){var he=x.parentNode.getClientRects()[0];he?X={left:he.left,right:he.left+In(e.display),top:he.top,bottom:he.bottom}:X=Ja}for(var ce=X.top-t.rect.top,Oe=X.bottom-t.rect.top,Ne=(ce+Oe)/2,Xe=t.view.measure.heights,Ze=0;Ze<Xe.length-1&&!(Ne<Xe[Ze]);Ze++);var rt=Ze?Xe[Ze-1]:0,Je=Xe[Ze],it={left:(K=="right"?X.right:X.left)-t.rect.left,right:(K=="left"?X.left:X.right)-t.rect.left,top:rt,bottom:Je};return!X.left&&!X.right&&(it.bogus=!0),e.options.singleCursorHeightPerLine||(it.rtop=ce,it.rbottom=Oe),it}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 qa(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 eo(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)qa(e.display.view[t])}function ni(e){eo(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function to(){return E&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ro(){return E&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function aa(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=ri(e.widgets[n]));return t}function Ri(e,t,n,r,i){if(!i){var x=aa(t);n.top+=x,n.bottom+=x}if(r=="line")return n;r||(r="local");var I=Ft(t);if(r=="local"?I+=Oi(e.display):I-=e.display.viewOffset,r=="page"||r=="window"){var W=e.display.lineSpace.getBoundingClientRect();I+=W.top+(r=="window"?0:ro());var K=W.left+(r=="window"?0:to());n.left+=K,n.right+=K}return n.top+=I,n.bottom+=I,n}function no(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=to(),i-=ro();else if(n=="local"||!n){var x=e.display.sizer.getBoundingClientRect();r+=x.left,i+=x.top}var I=e.display.lineSpace.getBoundingClientRect();return{left:r-I.left,top:i-I.top}}function oa(e,t,n,r,i){return r||(r=tt(e.doc,t.line)),Ri(e,r,Za(e,r,t.ch,i),n)}function Kr(e,t,n,r,i,x){r=r||tt(e.doc,t.line),i||(i=Mn(e,r));function I(Oe,Ne){var Xe=Xr(e,i,Oe,Ne?"right":"left",x);return Ne?Xe.left=Xe.right:Xe.right=Xe.left,Ri(e,r,Xe,n)}var W=Ke(r,e.doc.direction),K=t.ch,X=t.sticky;if(K>=r.text.length?(K=r.text.length,X="before"):K<=0&&(K=0,X="after"),!W)return I(X=="before"?K-1:K,X=="before");function ne(Oe,Ne,Xe){var Ze=W[Ne],rt=Ze.level==1;return I(Xe?Oe-1:Oe,rt!=Xe)}var ae=We(W,K,X),he=Ue,ce=ne(K,ae,X=="before");return he!=null&&(ce.other=ne(K,he,X!="before")),ce}function io(e,t){var n=0;t=ct(e.doc,t),e.options.lineWrapping||(n=In(e.display)*t.ch);var r=tt(e.doc,t.line),i=Ft(r)+Oi(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function sa(e,t,n,r,i){var x=Fe(e,t,n);return x.xRel=i,r&&(x.outside=r),x}function la(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return sa(r.first,0,null,-1,-1);var i=hr(r,n),x=r.first+r.size-1;if(i>x)return sa(r.first+r.size-1,tt(r,x).text.length,null,1,1);t<0&&(t=0);for(var I=tt(r,i);;){var W=Ks(e,I,i,t,n),K=qi(I,W.ch+(W.xRel>0||W.outside>0?1:0));if(!K)return W;var X=K.find(1);if(X.line==i)return X;I=tt(r,i=X.line)}}function ao(e,t,n,r){r-=aa(t);var i=t.text.length,x=Le(function(I){return Xr(e,n,I-1).bottom<=r},i,0);return i=Le(function(I){return Xr(e,n,I).top>r},x,i),{begin:x,end:i}}function oo(e,t,n,r){n||(n=Mn(e,t));var i=Ri(e,t,Xr(e,n,r),"line").top;return ao(e,t,n,i)}function ua(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-=Ft(t);var x=Mn(e,t),I=aa(t),W=0,K=t.text.length,X=!0,ne=Ke(t,e.doc.direction);if(ne){var ae=(e.options.lineWrapping?Gs:zs)(e,t,n,x,ne,r,i);X=ae.level!=1,W=X?ae.from:ae.to-1,K=X?ae.to:ae.from-1}var he=null,ce=null,Oe=Le(function(mt){var ft=Xr(e,x,mt);return ft.top+=I,ft.bottom+=I,ua(ft,r,i,!1)?(ft.top<=i&&ft.left<=r&&(he=mt,ce=ft),!0):!1},W,K),Ne,Xe,Ze=!1;if(ce){var rt=r-ce.left<ce.right-r,Je=rt==X;Oe=he+(Je?0:1),Xe=Je?"after":"before",Ne=rt?ce.left:ce.right}else{!X&&(Oe==K||Oe==W)&&Oe++,Xe=Oe==0?"after":Oe==t.text.length?"before":Xr(e,x,Oe-(X?1:0)).bottom+I<=i==X?"after":"before";var it=Kr(e,Fe(n,Oe,Xe),"line",t,x);Ne=it.left,Ze=i<it.top?-1:i>=it.bottom?1:0}return Oe=Pe(t.text,Oe,1),sa(n,Oe,Xe,Ze,r-Ne)}function zs(e,t,n,r,i,x,I){var W=Le(function(ae){var he=i[ae],ce=he.level!=1;return ua(Kr(e,Fe(n,ce?he.to:he.from,ce?"before":"after"),"line",t,r),x,I,!0)},0,i.length-1),K=i[W];if(W>0){var X=K.level!=1,ne=Kr(e,Fe(n,X?K.from:K.to,X?"after":"before"),"line",t,r);ua(ne,x,I,!0)&&ne.top>I&&(K=i[W-1])}return K}function Gs(e,t,n,r,i,x,I){var W=ao(e,t,r,I),K=W.begin,X=W.end;/\s/.test(t.text.charAt(X-1))&&X--;for(var ne=null,ae=null,he=0;he<i.length;he++){var ce=i[he];if(ce.from>=X||ce.to<=K)continue;var Oe=ce.level!=1,Ne=Xr(e,r,Oe?Math.min(X,ce.to)-1:Math.max(K,ce.from)).right,Xe=Ne<x?x-Ne+1e9:Ne-x;(!ne||ae>Xe)&&(ne=ce,ae=Xe)}return ne||(ne=i[i.length-1]),ne.from<K&&(ne={from:K,to:ne.to,level:ne.level}),ne.to>X&&(ne={from:ne.from,to:X,level:ne.level}),ne}var bn;function kn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(bn==null){bn=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)bn.appendChild(document.createTextNode("x")),bn.appendChild(a("br"));bn.appendChild(document.createTextNode("x"))}o(e.measure,bn);var n=bn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),c(e.measure),n||1}function In(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");o(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function da(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,x=t.gutters.firstChild,I=0;x;x=x.nextSibling,++I){var W=e.display.gutterSpecs[I].className;n[W]=x.offsetLeft+x.clientLeft+i,r[W]=x.clientWidth}return{fixedPos:ca(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function ca(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function so(e){var t=kn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/In(e.display)-3);return function(i){if(Lt(e.doc,i))return 0;var x=0;if(i.widgets)for(var I=0;I<i.widgets.length;I++)i.widgets[I].height&&(x+=i.widgets[I].height);return n?x+(Math.ceil(i.text.length/r)||1)*t:x+t}}function fa(e){var t=e.doc,n=so(e);t.iter(function(r){var i=n(r);i!=r.height&&fr(r,i)})}function En(e,t,n,r){var i=e.display;if(!n&&de(t).getAttribute("cm-not-content")=="true")return null;var x,I,W=i.lineSpace.getBoundingClientRect();try{x=t.clientX-W.left,I=t.clientY-W.top}catch(ae){return null}var K=la(e,x,I),X;if(r&&K.xRel>0&&(X=tt(e.doc,K.line).text).length==K.ch){var ne=V(X,X.length,e.options.tabSize)-X.length;K=Fe(K.line,Math.max(0,Math.round((x-Ya(e.display).left)/In(e.display))-ne))}return K}function xn(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 Ar(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)Cr&&bt(e.doc,t)<i.viewTo&&ln(e);else if(n<=i.viewFrom)Cr&&Et(e.doc,n+r)>i.viewFrom?ln(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)ln(e);else if(t<=i.viewFrom){var x=Pi(e,n,n+r,1);x?(i.view=i.view.slice(x.index),i.viewFrom=x.lineN,i.viewTo+=r):ln(e)}else if(n>=i.viewTo){var I=Pi(e,t,t,-1);I?(i.view=i.view.slice(0,I.index),i.viewTo=I.lineN):ln(e)}else{var W=Pi(e,t,t,-1),K=Pi(e,n,n+r,1);W&&K?(i.view=i.view.slice(0,W.index).concat(Di(e,W.lineN,K.lineN)).concat(i.view.slice(K.index)),i.viewTo+=r):ln(e)}var X=i.externalMeasured;X&&(n<X.lineN?X.lineN+=r:t<X.lineN+X.size&&(i.externalMeasured=null))}function sn(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 x=r.view[xn(e,t)];if(x.node==null)return;var I=x.changes||(x.changes=[]);ie(I,n)==-1&&I.push(n)}function ln(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Pi(e,t,n,r){var i=xn(e,t),x,I=e.display.view;if(!Cr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var W=e.display.viewFrom,K=0;K<i;K++)W+=I[K].size;if(W!=t){if(r>0){if(i==I.length-1)return null;x=W+I[i].size-t,i++}else x=W-t;t+=x,n+=x}for(;bt(e.doc,n)!=n;){if(i==(r<0?0:I.length-1))return null;n+=r*I[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=Di(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Di(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(xn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Di(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,xn(e,n)))),r.viewTo=n}function lo(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 ii(e){e.display.input.showSelection(e.display.input.prepareSelection())}function uo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),x=r.selection=document.createDocumentFragment(),I=0;I<n.sel.ranges.length;I++){if(!t&&I==n.sel.primIndex)continue;var W=n.sel.ranges[I];if(W.from().line>=e.display.viewTo||W.to().line<e.display.viewFrom)continue;var K=W.empty();(K||e.options.showCursorWhenSelecting)&&co(e,W.head,i),K||Xs(e,W,x)}return r}function co(e,t,n){var r=Kr(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 x=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));x.style.display="",x.style.left=r.other.left+"px",x.style.top=r.other.top+"px",x.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Mi(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,x=document.createDocumentFragment(),I=Ya(e.display),W=I.left,K=Math.max(r.sizerWidth,yn(e)-r.sizer.offsetLeft)-I.right,X=i.direction=="ltr";function ne(Je,it,mt,ft){it<0&&(it=0),it=Math.round(it),ft=Math.round(ft),x.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Je+`px;
top: `+it+"px; width: "+(mt==null?K-Je:mt)+`px;
height: `+(ft-it)+"px"))}function ae(Je,it,mt){var ft=tt(i,Je),Tt=ft.text.length,It,dr;function zt(er,Or){return oa(e,Fe(Je,er),"div",ft,Or)}function Ir(er,Or,pr){var ir=oo(e,ft,null,er),tr=Or=="ltr"==(pr=="after")?"left":"right",Zt=pr=="after"?ir.begin:ir.end-(/\s/.test(ft.text.charAt(ir.end-1))?2:1);return zt(Zt,tr)[tr]}var Dr=Ke(ft,i.direction);return Re(Dr,it||0,mt==null?Tt:mt,function(er,Or,pr,ir){var tr=pr=="ltr",Zt=zt(er,tr?"left":"right"),Rr=zt(Or-1,tr?"right":"left"),Yn=it==null&&er==0,mn=mt==null&&Or==Tt,Er=ir==0,Yr=!Dr||ir==Dr.length-1;if(Rr.top-Zt.top<=3){var cr=(X?Yn:mn)&&Er,Ua=(X?mn:Yn)&&Yr,rn=cr?W:(tr?Zt:Rr).left,Cn=Ua?K:(tr?Rr:Zt).right;ne(rn,Zt.top,Cn-rn,Zt.bottom)}else{var An,Sr,Qn,Fa;tr?(An=X&&Yn&&Er?W:Zt.left,Sr=X?K:Ir(er,pr,"before"),Qn=X?W:Ir(Or,pr,"after"),Fa=X&&mn&&Yr?K:Rr.right):(An=X?Ir(er,pr,"before"):W,Sr=!X&&Yn&&Er?K:Zt.right,Qn=!X&&mn&&Yr?W:Rr.left,Fa=X?Ir(Or,pr,"after"):K),ne(An,Zt.top,Sr-An,Zt.bottom),Zt.bottom<Rr.top&&ne(W,Zt.bottom,null,Rr.top),ne(Qn,Rr.top,Fa-Qn,Rr.bottom)}(!It||Mi(Zt,It)<0)&&(It=Zt),Mi(Rr,It)<0&&(It=Rr),(!dr||Mi(Zt,dr)<0)&&(dr=Zt),Mi(Rr,dr)<0&&(dr=Rr)}),{start:It,end:dr}}var he=t.from(),ce=t.to();if(he.line==ce.line)ae(he.line,he.ch,ce.ch);else{var Oe=tt(i,he.line),Ne=tt(i,ce.line),Xe=Hr(Oe)==Hr(Ne),Ze=ae(he.line,he.ch,Xe?Oe.text.length+1:null).end,rt=ae(ce.line,Xe?0:null,ce.ch).start;Xe&&(Ze.top<rt.top-2?(ne(Ze.right,Ze.top,null,Ze.bottom),ne(W,rt.top,rt.left,rt.bottom)):ne(Ze.right,Ze.top,rt.left-Ze.right,Ze.bottom)),Ze.bottom<rt.top&&ne(W,Ze.bottom,null,rt.top)}n.appendChild(x)}function ha(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()||Nn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function fo(e){e.state.focused||(e.display.input.focus(),ma(e))}function ho(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Nn(e))},100)}function ma(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(xe(e,"focus",e,t),e.state.focused=!0,U(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),D&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),ha(e)}function Nn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(xe(e,"blur",e,t),e.state.focused=!1,f(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function ki(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],x=e.options.lineWrapping,I=void 0,W=0;if(i.hidden)continue;if(F&&M<8){var K=i.node.offsetTop+i.node.offsetHeight;I=K-n,n=K}else{var X=i.node.getBoundingClientRect();I=X.bottom-X.top,!x&&i.text.firstChild&&(W=i.text.firstChild.getBoundingClientRect().right-X.left-1)}var ne=i.line.height-I;if((ne>.005||ne<-.005)&&(fr(i.line,I),mo(i.line),i.rest))for(var ae=0;ae<i.rest.length;ae++)mo(i.rest[ae]);if(W>e.display.sizerWidth){var he=Math.ceil(W/In(e.display));he>e.display.maxLineLength&&(e.display.maxLineLength=he,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function mo(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 Ii(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Oi(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,x=hr(t,r),I=hr(t,i);if(n&&n.ensure){var W=n.ensure.from.line,K=n.ensure.to.line;W<x?(x=W,I=hr(t,Ft(tt(t,W))+e.wrapper.clientHeight)):Math.min(K,t.lastLine())>=I&&(x=hr(t,Ft(tt(t,K))-e.wrapper.clientHeight),I=K)}return{from:x,to:Math.max(I,x+1)}}function Ys(e,t){if(Ie(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!_){var x=a("div","\u200B",null,`position: absolute;
top: `+(t.top-n.viewOffset-Oi(e.display))+`px;
height: `+(t.bottom-t.top+Vr(e)+n.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(x),x.scrollIntoView(i),e.display.lineSpace.removeChild(x)}}function Qs(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Fe(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Fe(t.line,t.ch+1,"before"):t);for(var x=0;x<5;x++){var I=!1,W=Kr(e,t),K=!n||n==t?W:Kr(e,n);i={left:Math.min(W.left,K.left),top:Math.min(W.top,K.top)-r,right:Math.max(W.left,K.left),bottom:Math.max(W.bottom,K.bottom)+r};var X=pa(e,i),ne=e.doc.scrollTop,ae=e.doc.scrollLeft;if(X.scrollTop!=null&&(oi(e,X.scrollTop),Math.abs(e.doc.scrollTop-ne)>1&&(I=!0)),X.scrollLeft!=null&&(Tn(e,X.scrollLeft),Math.abs(e.doc.scrollLeft-ae)>1&&(I=!0)),!I)break}return i}function Zs(e,t){var n=pa(e,t);n.scrollTop!=null&&oi(e,n.scrollTop),n.scrollLeft!=null&&Tn(e,n.scrollLeft)}function pa(e,t){var n=e.display,r=kn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,x=na(e),I={};t.bottom-t.top>x&&(t.bottom=t.top+x);var W=e.doc.height+ra(n),K=t.top<r,X=t.bottom>W-r;if(t.top<i)I.scrollTop=K?0:t.top;else if(t.bottom>i+x){var ne=Math.min(t.top,(X?W:t.bottom)-x);ne!=i&&(I.scrollTop=ne)}var ae=e.options.fixedGutter?0:n.gutters.offsetWidth,he=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ae,ce=yn(e)-n.gutters.offsetWidth,Oe=t.right-t.left>ce;return Oe&&(t.right=t.left+ce),t.left<10?I.scrollLeft=0:t.left<he?I.scrollLeft=Math.max(0,t.left+ae-(Oe?0:10)):t.right>ce+he-3&&(I.scrollLeft=t.right+(Oe?0:10)-ce),I}function ga(e,t){if(t==null)return;Ni(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Un(e){Ni(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function ai(e,t,n){(t!=null||n!=null)&&Ni(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Js(e,t){Ni(e),e.curOp.scrollToPos=t}function Ni(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=io(e,t.from),r=io(e,t.to);po(e,n,r,t.margin)}}function po(e,t,n,r){var i=pa(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});ai(e,i.scrollLeft,i.scrollTop)}function oi(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;L||ya(e,{top:t}),go(e,t,!0),L&&ya(e),ui(e,100)}function go(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 Tn(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,xo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function si(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ra(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+Vr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Sn=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),ge(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ge(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,F&&M<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Sn.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 x=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+x)+"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}},Sn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Sn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Sn.prototype.zeroWidthHack=function(){var e=u&&!A?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new $,this.disableVert=new $},Sn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),x=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);x!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Sn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var li=function(){};li.prototype.update=function(){return{bottom:0,right:0}},li.prototype.setScrollLeft=function(){},li.prototype.setScrollTop=function(){},li.prototype.clear=function(){};function Fn(e,t){t||(t=si(e));var n=e.display.barWidth,r=e.display.barHeight;vo(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&ki(e),vo(e,si(e)),n=e.display.barWidth,r=e.display.barHeight}function vo(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 yo={native:Sn,null:li};function bo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&f(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new yo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ge(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"?Tn(e,t):oi(e,t)},e),e.display.scrollbars.addClass&&U(e.display.wrapper,e.display.scrollbars.addClass)}var $s=0;function _n(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:++$s},Ds(e.curOp)}function wn(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 x=0;x<t.length;x++)nl(t[x]);for(var I=0;I<t.length;I++)il(t[I])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&or(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 Ui(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&va(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&ki(t),e.barMeasure=si(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Za(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+Vr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-yn(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&&Tn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==O();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Fn(t,e.barMeasure),e.updatedDisplay&&Ea(t,e.barMeasure),e.selectionChanged&&ha(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&fo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Eo(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&go(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Tn(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=Qs(t,ct(r,e.scrollToPos.from),ct(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var x=e.maybeHiddenMarkers,I=e.maybeUnhiddenMarkers;if(x)for(var W=0;W<x.length;++W)x[W].lines.length||xe(x[W],"hide");if(I)for(var K=0;K<I.length;++K)I[K].lines.length&&xe(I[K],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&xe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function kr(e,t){if(e.curOp)return t();_n(e);try{return t()}finally{wn(e)}}function lr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);_n(e);try{return t.apply(e,arguments)}finally{wn(e)}}}function Tr(e){return function(){if(this.curOp)return e.apply(this,arguments);_n(this);try{return e.apply(this,arguments)}finally{wn(this)}}}function ur(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);_n(t);try{return e.apply(this,arguments)}finally{wn(t)}}}function ui(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,B(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=ve(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(x){if(r.line>=e.display.viewFrom){var I=x.styles,W=x.text.length>e.options.maxHighlightLength?Ht(t.mode,r.state):null,K=wt(e,x,r,!0);W&&(r.state=W),x.styles=K.styles;var X=x.styleClasses,ne=K.classes;ne?x.styleClasses=ne:X&&(x.styleClasses=null);for(var ae=!I||I.length!=x.styles.length||X!=ne&&(!X||!ne||X.bgClass!=ne.bgClass||X.textClass!=ne.textClass),he=0;!ae&&he<I.length;++he)ae=I[he]!=x.styles[he];ae&&i.push(r.line),x.stateAfter=r.save(),r.nextLine()}else x.text.length<=e.options.maxHighlightLength&&nt(e,x.text,r),x.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return ui(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&kr(e,function(){for(var x=0;x<i.length;x++)sn(e,i[x],"text")})}var Ui=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Ii(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=yn(e),this.force=n,this.dims=da(e),this.events=[]};Ui.prototype.signal=function(e,t){te(e,t)&&this.events.push(arguments)},Ui.prototype.finish=function(){for(var e=0;e<this.events.length;e++)xe.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=Vr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Vr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=O();if(!t||!v(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&v(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==O())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&v(document.body,e.anchorNode)&&v(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 va(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return ln(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&&lo(e)==0)return!1;To(e)&&(ln(e),t.dims=da(e));var i=r.first+r.size,x=Math.max(t.visible.from-e.options.viewportMargin,r.first),I=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<x&&x-n.viewFrom<20&&(x=Math.max(r.first,n.viewFrom)),n.viewTo>I&&n.viewTo-I<20&&(I=Math.min(i,n.viewTo)),Cr&&(x=bt(e.doc,x),I=Et(e.doc,I));var W=x!=n.viewFrom||I!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,x,I),n.viewOffset=Ft(tt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var K=lo(e);if(!W&&K==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var X=sl(e);return K>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),K>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,W&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ui(e,400)),n.updateLineNumbers=null,!0}function Eo(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==yn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ra(e.display)-na(e),n.top)}),t.visible=Ii(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Ii(e.display,e.doc,n));if(!va(e,t))break;ki(e);var i=si(e);ii(e),Fn(e,i),Ea(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 ya(e,t){var n=new Ui(e,t);if(va(e,n)){ki(e),Eo(e,n);var r=si(e);ii(e),Fn(e,r),Ea(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,x=r.lineDiv,I=x.firstChild;function W(Oe){var Ne=Oe.nextSibling;return D&&u&&e.display.currentWheelTarget==Oe?Oe.style.display="none":Oe.parentNode.removeChild(Oe),Ne}for(var K=r.view,X=r.viewFrom,ne=0;ne<K.length;ne++){var ae=K[ne];if(!ae.hidden)if(!ae.node||ae.node.parentNode!=x){var he=Ns(e,ae,X,n);x.insertBefore(he,I)}else{for(;I!=ae.node;)I=W(I);var ce=i&&t!=null&&t<=X&&ae.lineNumber;ae.changes&&(ie(ae.changes,"gutter")>-1&&(ce=!1),Ka(e,ae,X,n)),ce&&(c(ae.lineNumber),ae.lineNumber.appendChild(document.createTextNode(nr(e.options,X)))),I=ae.node.nextSibling}X+=ae.size}for(;I;)I=W(I)}function ba(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Ea(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+Vr(e)+"px"}function xo(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=ca(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,x=r+"px",I=0;I<n.length;I++)if(!n[I].hidden){e.options.fixedGutter&&(n[I].gutter&&(n[I].gutter.style.left=x),n[I].gutterBackground&&(n[I].gutterBackground.style.left=x));var W=n[I].alignable;if(W)for(var K=0;K<W.length;K++)W[K].style.left=x}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function To(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=nr(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")),x=i.firstChild.offsetWidth,I=i.offsetWidth-x;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(x,r.lineGutter.offsetWidth-I)+1,r.lineNumWidth=r.lineNumInnerWidth+I,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",ba(e.display),!0}return!1}function xa(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var x=e[i],I=null;if(typeof x!="string"&&(I=x.style,x=x.className),x=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:x,style:I})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function So(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],x=i.className,I=i.style,W=t.appendChild(a("div",null,"CodeMirror-gutter "+x));I&&(W.style.cssText=I),x=="CodeMirror-linenumbers"&&(e.lineGutter=W,W.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",ba(e)}function di(e){So(e.display),Ar(e),xo(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=m("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=m("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var x=m("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[x],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"),F&&M<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!D&&!(L&&s)&&(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=xa(r.gutters,r.lineNumbers),So(i),n.init(i)}var Fi=0,Fr=null;F?Fr=-.53:L?Fr=15:E?Fr=-.7:T&&(Fr=-1/3);function _o(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=_o(e);return t.x*=Fr,t.y*=Fr,t}function wo(e,t){var n=_o(t),r=n.x,i=n.y,x=e.display,I=x.scroller,W=I.scrollWidth>I.clientWidth,K=I.scrollHeight>I.clientHeight;if(!(r&&W||i&&K))return;if(i&&u&&D){e:for(var X=t.target,ne=x.view;X!=I;X=X.parentNode)for(var ae=0;ae<ne.length;ae++)if(ne[ae].node==X){e.display.currentWheelTarget=X;break e}}if(r&&!L&&!w&&Fr!=null){i&&K&&oi(e,Math.max(0,I.scrollTop+i*Fr)),Tn(e,Math.max(0,I.scrollLeft+r*Fr)),(!i||i&&K)&&Y(t),x.wheelStartX=null;return}if(i&&Fr!=null){var he=i*Fr,ce=e.doc.scrollTop,Oe=ce+x.wrapper.clientHeight;he<0?ce=Math.max(0,ce+he-50):Oe=Math.min(e.doc.height,Oe+he+50),ya(e,{top:ce,bottom:Oe})}Fi<20&&(x.wheelStartX==null?(x.wheelStartX=I.scrollLeft,x.wheelStartY=I.scrollTop,x.wheelDX=r,x.wheelDY=i,setTimeout(function(){if(x.wheelStartX==null)return;var Ne=I.scrollLeft-x.wheelStartX,Xe=I.scrollTop-x.wheelStartY,Ze=Xe&&x.wheelDY&&Xe/x.wheelDY||Ne&&x.wheelDX&&Ne/x.wheelDX;if(x.wheelStartX=x.wheelStartY=null,!Ze)return;Fr=(Fr*Fi+Ze)/(Fi+1),++Fi},200)):(x.wheelDX+=r,x.wheelDY+=i))}var Br=function(e,t){this.ranges=e,this.primIndex=t};Br.prototype.primary=function(){return this.ranges[this.primIndex]},Br.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(!_r(n.anchor,r.anchor)||!_r(n.head,r.head))return!1}return!0},Br.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Rt(vr(this.ranges[t].anchor),vr(this.ranges[t].head));return new Br(e,this.primIndex)},Br.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Br.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(dt(t,r.from())>=0&&dt(e,r.to())<=0)return n}return-1};var Rt=function(e,t){this.anchor=e,this.head=t};Rt.prototype.from=function(){return wr(this.anchor,this.head)},Rt.prototype.to=function(){return Ve(this.anchor,this.head)},Rt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function zr(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(he,ce){return dt(he.from(),ce.from())}),n=ie(t,i);for(var x=1;x<t.length;x++){var I=t[x],W=t[x-1],K=dt(W.to(),I.from());if(r&&!I.empty()?K>0:K>=0){var X=wr(W.from(),I.from()),ne=Ve(W.to(),I.to()),ae=W.empty()?I.from()==I.head:W.from()==W.head;x<=n&&--n,t.splice(--x,2,new Rt(ae?ne:X,ae?X:ne))}}return new Br(t,n)}function un(e,t){return new Br([new Rt(e,t||e)],0)}function dn(e){return e.text?Fe(e.from.line+e.text.length-1,Ee(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Co(e,t){if(dt(e,t.from)<0)return e;if(dt(e,t.to)<=0)return dn(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+=dn(t).ch-t.to.ch),Fe(n,r)}function Ta(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new Rt(Co(i.anchor,t),Co(i.head,t)))}return zr(e.cm,n,e.sel.primIndex)}function Ao(e,t,n){return e.line==t.line?Fe(n.line,e.ch-t.ch+n.ch):Fe(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Fe(e.first,0),x=i,I=0;I<t.length;I++){var W=t[I],K=Ao(W.from,i,x),X=Ao(dn(W),i,x);if(i=W.to,x=X,n=="around"){var ne=e.sel.ranges[I],ae=dt(ne.head,ne.anchor)<0;r[I]=new Rt(ae?X:K,ae?K:X)}else r[I]=new Rt(K,K)}return new Br(r,e.sel.primIndex)}function Sa(e){e.doc.mode=Vt(e.options,e.doc.modeOption),ci(e)}function ci(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,ui(e,100),e.state.modeGen++,e.curOp&&Ar(e)}function Lo(e,t){return t.from.ch==0&&t.to.ch==0&&Ee(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function _a(e,t,n,r){function i(rt){return n?n[rt]:null}function x(rt,Je,it){Jr(rt,Je,it,r),mr(rt,"change",rt,t)}function I(rt,Je){for(var it=[],mt=rt;mt<Je;++mt)it.push(new sr(X[mt],i(mt),r));return it}var W=t.from,K=t.to,X=t.text,ne=tt(e,W.line),ae=tt(e,K.line),he=Ee(X),ce=i(X.length-1),Oe=K.line-W.line;if(t.full)e.insert(0,I(0,X.length)),e.remove(X.length,e.size-X.length);else if(Lo(e,t)){var Ne=I(0,X.length-1);x(ae,ae.text,ce),Oe&&e.remove(W.line,Oe),Ne.length&&e.insert(W.line,Ne)}else if(ne==ae)if(X.length==1)x(ne,ne.text.slice(0,W.ch)+he+ne.text.slice(K.ch),ce);else{var Xe=I(1,X.length-1);Xe.push(new sr(he+ne.text.slice(K.ch),ce,r)),x(ne,ne.text.slice(0,W.ch)+X[0],i(0)),e.insert(W.line+1,Xe)}else if(X.length==1)x(ne,ne.text.slice(0,W.ch)+X[0]+ae.text.slice(K.ch),i(0)),e.remove(W.line+1,Oe);else{x(ne,ne.text.slice(0,W.ch)+X[0],i(0)),x(ae,he+ae.text.slice(K.ch),ce);var Ze=I(1,X.length-1);Oe>1&&e.remove(W.line+1,Oe-1),e.insert(W.line+1,Ze)}mr(e,"change",e,t)}function cn(e,t,n){function r(i,x,I){if(i.linked)for(var W=0;W<i.linked.length;++W){var K=i.linked[W];if(K.doc==x)continue;var X=I&&K.sharedHist;if(n&&!X)continue;t(K.doc,X),r(K.doc,i,X)}}r(e,null,!0)}function Do(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,fa(e),Sa(e),Oo(e),e.options.lineWrapping||or(e),e.options.mode=t.modeOption,Ar(e)}function Oo(e){(e.doc.direction=="rtl"?U:f)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){kr(e,function(){Oo(e),Ar(e)})}function Bi(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 wa(e,t){var n={from:vr(t.from),to:dn(t),text:Yt(e,t.from,t.to)};return Mo(e,n,t.from.line,t.to.line+1),cn(e,function(r){return Mo(r,n,t.from.line,t.to.line+1)},!0),n}function Ro(e){for(;e.length;){var t=Ee(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Ro(e.done),Ee(e.done);if(e.done.length&&!Ee(e.done).ranges)return Ee(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Ee(e.done)}function Po(e,t,n,r){var i=e.history;i.undone.length=0;var x=+new Date,I,W;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>x-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(I=ml(i,i.lastOp==r)))W=Ee(I.changes),dt(t.from,t.to)==0&&dt(t.from,W.to)==0?W.to=dn(t):I.changes.push(wa(e,t));else{var K=Ee(i.done);for((!K||!K.ranges)&&ji(e.sel,i.done),I={changes:[wa(e,t)],generation:i.generation},i.done.push(I);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=x,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,W||xe(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,x=r&&r.origin;n==i.lastSelOp||x&&i.lastSelOrigin==x&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==x||pl(e,x,Ee(i.done),t))?i.done[i.done.length-1]=t:ji(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=x,i.lastSelOp=n,r&&r.clearRedo!==!1&&Ro(i.undone)}function ji(e,t){var n=Ee(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Mo(e,t,n,r){var i=t["spans_"+e.id],x=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(I){I.markedSpans&&((i||(i=t["spans_"+e.id]={}))[x]=I.markedSpans),++x})}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 ko(e,t){var n=yl(e,t),r=Qr(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var x=n[i],I=r[i];if(x&&I){e:for(var W=0;W<I.length;++W){for(var K=I[W],X=0;X<x.length;++X)if(x[X].marker==K.marker)continue e;x.push(K)}}else I&&(n[i]=I)}return n}function Bn(e,t,n){for(var r=[],i=0;i<e.length;++i){var x=e[i];if(x.ranges){r.push(n?Br.prototype.deepCopy.call(x):x);continue}var I=x.changes,W=[];r.push({changes:W});for(var K=0;K<I.length;++K){var X=I[K],ne=void 0;if(W.push({from:X.from,to:X.to,text:X.text}),t)for(var ae in X)(ne=ae.match(/^spans_(\d+)$/))&&(ie(t,Number(ne[1]))>-1&&(Ee(W)[ae]=X[ae],delete X[ae]))}}return r}function Ca(e,t,n,r){if(r){var i=e.anchor;if(n){var x=dt(t,i)<0;x!=dt(n,i)<0?(i=t,t=n):x!=dt(t,n)<0&&(t=n)}return new Rt(i,t)}else return new Rt(n||t,t)}function Wi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),br(e,new Br([Ca(e.sel.primary(),t,n,i)],0),r)}function Io(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),x=0;x<e.sel.ranges.length;x++)r[x]=Ca(e.sel.ranges[x],t[x],null,i);var I=zr(e.cm,r,e.sel.primIndex);br(e,I,n)}function Aa(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,br(e,zr(e.cm,i,e.sel.primIndex),r)}function No(e,t,n,r){br(e,un(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var x=0;x<i.length;x++)this.ranges[x]=new Rt(ct(e,i[x].anchor),ct(e,i[x].head))},origin:n&&n.origin};return xe(e,"beforeSelectionChange",e,r),e.cm&&xe(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?zr(e.cm,r.ranges,r.ranges.length-1):t}function Uo(e,t,n){var r=e.history.done,i=Ee(r);i&&i.ranges?(r[r.length-1]=t,Hi(e,t,n)):br(e,t,n)}function br(e,t,n){Hi(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Hi(e,t,n){(te(e,"beforeSelectionChange")||e.cm&&te(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(dt(t.primary().head,e.sel.primary().head)<0?-1:1);Fo(e,jo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Un(e.cm)}function Fo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,se(e.cm)),mr(e,"cursorActivity",e)}function Bo(e){Fo(e,jo(e,e.sel,null,!1))}function jo(e,t,n,r){for(var i,x=0;x<t.ranges.length;x++){var I=t.ranges[x],W=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[x],K=Ki(e,I.anchor,W&&W.anchor,n,r),X=Ki(e,I.head,W&&W.head,n,r);(i||K!=I.anchor||X!=I.head)&&(i||(i=t.ranges.slice(0,x)),i[x]=new Rt(K,X))}return i?zr(e.cm,i,t.primIndex):t}function jn(e,t,n,r,i){var x=tt(e,t.line);if(x.markedSpans)for(var I=0;I<x.markedSpans.length;++I){var W=x.markedSpans[I],K=W.marker,X="selectLeft"in K?!K.selectLeft:K.inclusiveLeft,ne="selectRight"in K?!K.selectRight:K.inclusiveRight;if((W.from==null||(X?W.from<=t.ch:W.from<t.ch))&&(W.to==null||(ne?W.to>=t.ch:W.to>t.ch))){if(i&&(xe(K,"beforeCursorEnter"),K.explicitlyCleared))if(x.markedSpans){--I;continue}else break;if(!K.atomic)continue;if(n){var ae=K.find(r<0?1:-1),he=void 0;if((r<0?ne:X)&&(ae=Wo(e,ae,-r,ae&&ae.line==t.line?x:null)),ae&&ae.line==t.line&&(he=dt(ae,n))&&(r<0?he<0:he>0))return jn(e,ae,t,r,i)}var ce=K.find(r<0?-1:1);return(r<0?X:ne)&&(ce=Wo(e,ce,r,ce.line==t.line?x:null)),ce?jn(e,ce,t,r,i):null}}return t}function Ki(e,t,n,r,i){var x=r||1,I=jn(e,t,n,x,i)||!i&&jn(e,t,n,x,!0)||jn(e,t,n,-x,i)||!i&&jn(e,t,n,-x,!0);return I||(e.cantEdit=!0,Fe(e.first,0))}function Wo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ct(e,Fe(t.line-1)):null:n>0&&t.ch==(r||tt(e,t.line)).text.length?t.line<e.first+e.size-1?Fe(t.line+1,0):null:new Fe(t.line,t.ch+n)}function Ho(e){e.setSelection(Fe(e.firstLine(),0),Fe(e.lastLine()),fe)}function Ko(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,x,I,W){i&&(r.from=ct(e,i)),x&&(r.to=ct(e,x)),I&&(r.text=I),W!==void 0&&(r.origin=W)}),xe(e,"beforeChange",e,r),e.cm&&xe(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 Wn(e,t,n){if(e.cm){if(!e.cm.curOp)return lr(e.cm,Wn)(e,t,n);if(e.cm.state.suppressEdits)return}if((te(e,"beforeChange")||e.cm&&te(e.cm,"beforeChange"))&&(t=Ko(e,t,!0),!t))return;var r=Wr&&!n&&On(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)zo(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else zo(e,t)}function zo(e,t){if(t.text.length==1&&t.text[0]==""&&dt(t.from,t.to)==0)return;var n=Ta(e,t);Po(e,t,n,e.cm?e.cm.curOp.id:NaN),fi(e,t,n,Qr(e,t));var r=[];cn(e,function(i,x){!x&&ie(r,i.history)==-1&&(Yo(i.history,t),r.push(i.history)),fi(i,t,null,Qr(i,t))})}function zi(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,x,I=e.sel,W=t=="undo"?i.done:i.undone,K=t=="undo"?i.undone:i.done,X=0;X<W.length&&!(x=W[X],n?x.ranges&&!x.equals(e.sel):!x.ranges);X++);if(X==W.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(x=W.pop(),x.ranges){if(ji(x,K),n&&!x.equals(e.sel)){br(e,x,{clearRedo:!1});return}I=x}else if(r){W.push(x);return}else break;var ne=[];ji(I,K),K.push({changes:ne,generation:i.generation}),i.generation=x.generation||++i.maxGeneration;for(var ae=te(e,"beforeChange")||e.cm&&te(e.cm,"beforeChange"),he=function(Ne){var Xe=x.changes[Ne];if(Xe.origin=t,ae&&!Ko(e,Xe,!1))return W.length=0,{};ne.push(wa(e,Xe));var Ze=Ne?Ta(e,Xe):Ee(W);fi(e,Xe,Ze,ko(e,Xe)),!Ne&&e.cm&&e.cm.scrollIntoView({from:Xe.from,to:dn(Xe)});var rt=[];cn(e,function(Je,it){!it&&ie(rt,Je.history)==-1&&(Yo(Je.history,Xe),rt.push(Je.history)),fi(Je,Xe,null,ko(Je,Xe))})},ce=x.changes.length-1;ce>=0;--ce){var Oe=he(ce);if(Oe)return Oe.v}}function Go(e,t){if(t==0)return;if(e.first+=t,e.sel=new Br(Ge(e.sel.ranges,function(i){return new Rt(Fe(i.anchor.line+t,i.anchor.ch),Fe(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){Ar(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)sn(e.cm,r,"gutter")}}function fi(e,t,n,r){if(e.cm&&!e.cm.curOp)return lr(e.cm,fi)(e,t,n,r);if(t.to.line<e.first){Go(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);Go(e,i),t={from:Fe(e.first,0),to:Fe(t.to.line+i,t.to.ch),text:[Ee(t.text)],origin:t.origin}}var x=e.lastLine();t.to.line>x&&(t={from:t.from,to:Fe(x,tt(e,x).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Yt(e,t.from,t.to),n||(n=Ta(e,t)),e.cm?El(e.cm,t,r):_a(e,t,r),Hi(e,n,fe),e.cantEdit&&Ki(e,Fe(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,x=t.from,I=t.to,W=!1,K=x.line;e.options.lineWrapping||(K=St(Hr(tt(r,x.line))),r.iter(K,I.line+1,function(ce){if(ce==i.maxLine)return W=!0,!0})),r.sel.contains(t.from,t.to)>-1&&se(e),_a(r,t,n,so(e)),e.options.lineWrapping||(r.iter(K,x.line+t.text.length,function(ce){var Oe=Qt(ce);Oe>i.maxLineLength&&(i.maxLine=ce,i.maxLineLength=Oe,i.maxLineChanged=!0,W=!1)}),W&&(e.curOp.updateMaxLine=!0)),Mr(r,x.line),ui(e,400);var X=t.text.length-(I.line-x.line)-1;t.full?Ar(e):x.line==I.line&&t.text.length==1&&!Lo(e.doc,t)?sn(e,x.line,"text"):Ar(e,x.line,I.line+1,X);var ne=te(e,"changes"),ae=te(e,"change");if(ae||ne){var he={from:x,to:I,text:t.text,removed:t.removed,origin:t.origin};ae&&mr(e,"change",e,he),ne&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(he)}e.display.selForContextMenu=null}function Hn(e,t,n,r,i){var x;r||(r=n),dt(r,n)<0&&(x=[r,n],n=x[0],r=x[1]),typeof t=="string"&&(t=e.splitLines(t)),Wn(e,{from:n,to:r,text:t,origin:i})}function Vo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Xo(e,t,n,r){for(var i=0;i<e.length;++i){var x=e[i],I=!0;if(x.ranges){x.copied||(x=e[i]=x.deepCopy(),x.copied=!0);for(var W=0;W<x.ranges.length;W++)Vo(x.ranges[W].anchor,t,n,r),Vo(x.ranges[W].head,t,n,r);continue}for(var K=0;K<x.changes.length;++K){var X=x.changes[K];if(n<X.from.line)X.from=Fe(X.from.line+r,X.from.ch),X.to=Fe(X.to.line+r,X.to.ch);else if(t<=X.to.line){I=!1;break}}I||(e.splice(0,i+1),i=0)}}function Yo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Xo(e.done,n,r,i),Xo(e.undone,n,r,i)}function hi(e,t,n,r){var i=t,x=t;return typeof t=="number"?x=tt(e,jr(e,t)):i=St(t),i==null?null:(r(x,i)&&e.cm&&sn(e.cm,i,n),x)}function mi(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}mi.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,qt(i),mr(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 pi(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}pi.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 x=Math.min(t,i-e),I=r.height;if(r.removeInner(e,x),this.height-=I-r.height,i==x&&(this.children.splice(n--,1),r.parent=null),(t-=x)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof mi))){var W=[];this.collapse(W),this.children=[new mi(W)],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],x=i.chunkSize();if(e<=x){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var I=i.lines.length%25+25,W=I;W<i.lines.length;){var K=new mi(i.lines.slice(W,W+=25));i.height-=K.height,this.children.splice(++r,0,K),K.parent=this}i.lines=i.lines.slice(0,I),this.maybeSpill()}break}e-=x}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new pi(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=ie(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new pi(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],x=i.chunkSize();if(e<x){var I=Math.min(t,x-e);if(i.iterN(e,I,n))return!0;if((t-=I)==0)break;e=0}else e-=x}}};var gi=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};gi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=St(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 x=ri(this);fr(n,Math.max(0,n.height-x)),e&&(kr(e,function(){Qo(e,n,-x),sn(e,r,"widget")}),mr(e,"lineWidgetCleared",e,this,r))},gi.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=ri(this)-t;if(!i)return;Lt(this.doc,r)||fr(r,r.height+i),n&&kr(n,function(){n.curOp.forceUpdate=!0,Qo(n,r,i),mr(n,"lineWidgetChanged",n,e,St(r))})},ee(gi);function Qo(e,t,n){Ft(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&ga(e,n)}function xl(e,t,n,r){var i=new gi(e,n,r),x=e.cm;return x&&i.noHScroll&&(x.display.alignWidgets=!0),hi(e,t,"widget",function(I){var W=I.widgets||(I.widgets=[]);if(i.insertAt==null?W.push(i):W.splice(Math.min(W.length-1,Math.max(0,i.insertAt)),0,i),i.line=I,x&&!Lt(e,I)){var K=Ft(I)<e.scrollTop;fr(I,I.height+ri(i)),K&&ga(x,i.height),x.curOp.forceUpdate=!0}return!0}),x&&mr(x,"lineWidgetAdded",x,i,typeof t=="number"?t:St(t)),i}var Zo=0,fn=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Zo};fn.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&_n(e),te(this,"clear")){var n=this.find();n&&mr(this,"clear",n.from,n.to)}for(var r=null,i=null,x=0;x<this.lines.length;++x){var I=this.lines[x],W=nn(I.markedSpans,this);e&&!this.collapsed?sn(e,St(I),"text"):e&&(W.to!=null&&(i=St(I)),W.from!=null&&(r=St(I))),I.markedSpans=$i(I.markedSpans,W),W.from==null&&this.collapsed&&!Lt(this.doc,I)&&e&&fr(I,kn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var K=0;K<this.lines.length;++K){var X=Hr(this.lines[K]),ne=Qt(X);ne>e.display.maxLineLength&&(e.display.maxLine=X,e.display.maxLineLength=ne,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Ar(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Bo(e.doc)),e&&mr(e,"markerCleared",e,this,r,i),t&&wn(e),this.parent&&this.parent.clear()},fn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var x=this.lines[i],I=nn(x.markedSpans,this);if(I.from!=null&&(n=Fe(t?x:St(x),I.from),e==-1))return n;if(I.to!=null&&(r=Fe(t?x:St(x),I.to),e==1))return r}return n&&{from:n,to:r}},fn.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;kr(r,function(){var i=t.line,x=St(t.line),I=ia(r,x);if(I&&(qa(I),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Lt(n.doc,i)&&n.height!=null){var W=n.height;n.height=null;var K=ri(n)-W;K&&fr(i,i.height+K)}mr(r,"markerChanged",r,e)})},fn.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ie(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},fn.prototype.detachLine=function(e){if(this.lines.splice(ie(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ee(fn);function Kn(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return lr(e.cm,Kn)(e,t,n,r,i);var x=new fn(e,i),I=dt(t,n);if(r&&N(r,x,!1),I>0||I==0&&x.clearWhenEmpty!==!1)return x;if(x.replacedWith&&(x.collapsed=!0,x.widgetNode=m("span",[x.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||x.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(x.widgetNode.insertLeft=!0)),x.collapsed){if(ea(e,t.line,t,n,x)||t.line!=n.line&&ea(e,n.line,t,n,x))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ci()}x.addToHistory&&Po(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var W=t.line,K=e.cm,X;if(e.iter(W,n.line+1,function(ae){K&&x.collapsed&&!K.options.lineWrapping&&Hr(ae)==K.display.maxLine&&(X=!0),x.collapsed&&W!=t.line&&fr(ae,0),Ai(ae,new pn(x,W==t.line?t.ch:null,W==n.line?n.ch:null)),++W}),x.collapsed&&e.iter(t.line,n.line+1,function(ae){Lt(e,ae)&&fr(ae,0)}),x.clearOnEnter&&ge(x,"beforeCursorEnter",function(){return x.clear()}),x.readOnly&&(wi(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),x.collapsed&&(x.id=++Zo,x.atomic=!0),K){if(X&&(K.curOp.updateMaxLine=!0),x.collapsed)Ar(K,t.line,n.line+1);else if(x.className||x.startStyle||x.endStyle||x.css||x.attributes||x.title)for(var ne=t.line;ne<=n.line;ne++)sn(K,ne,"text");x.atomic&&Bo(K.doc),mr(K,"markerAdded",K,x)}return x}var vi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};vi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();mr(this,"clear")},vi.prototype.find=function(e,t){return this.primary.find(e,t)},ee(vi);function Tl(e,t,n,r,i){r=N(r),r.shared=!1;var x=[Kn(e,t,n,r,i)],I=x[0],W=r.widgetNode;return cn(e,function(K){W&&(r.widgetNode=W.cloneNode(!0)),x.push(Kn(K,ct(K,t),ct(K,n),r,i));for(var X=0;X<K.linked.length;++X)if(K.linked[X].isParent)return;I=Ee(x)}),new vi(x,I)}function Jo(e){return e.findMarks(Fe(e.first,0),e.clipPos(Fe(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(),x=e.clipPos(i.from),I=e.clipPos(i.to);if(dt(x,I)){var W=Kn(e,x,I,r.primary,r.primary.type);r.markers.push(W),W.parent=r}}}function _l(e){for(var t=function(r){var i=e[r],x=[i.primary.doc];cn(i.primary.doc,function(K){return x.push(K)});for(var I=0;I<i.markers.length;I++){var W=i.markers[I];ie(x,W.doc)==-1&&(W.parent=null,i.markers.splice(I--,1))}},n=0;n<e.length;n++)t(n)}var wl=0,Lr=function(e,t,n,r,i){if(!(this instanceof Lr))return new Lr(e,t,n,r,i);n==null&&(n=0),pi.call(this,[new mi([new sr("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var x=Fe(n,0);this.sel=un(x),this.history=new Bi(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),_a(this,{from:x,to:x,text:e}),br(this,un(x),fe)};Lr.prototype=Ae(pi.prototype,{constructor:Lr,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=Nr(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:ur(function(e){var t=Fe(this.first,0),n=this.first+this.size-1;Wn(this,{from:t,to:Fe(n,tt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&ai(this.cm,0,0),br(this,un(t),fe)}),replaceRange:function(e,t,n,r){t=ct(this,t),n=n?ct(this,n):t,Hn(this,e,t,n,r)},getRange:function(e,t,n){var r=Yt(this,ct(this,e),ct(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(gr(this,e))return tt(this,e)},getLineNumber:function(e){return St(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=tt(this,e)),Hr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ct(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:ur(function(e,t,n){No(this,ct(this,typeof e=="number"?Fe(e,t||0):e),null,n)}),setSelection:ur(function(e,t,n){No(this,ct(this,e),ct(this,t||e),n)}),extendSelection:ur(function(e,t,n){Wi(this,ct(this,e),t&&ct(this,t),n)}),extendSelections:ur(function(e,t){Io(this,Ur(this,e),t)}),extendSelectionsBy:ur(function(e,t){var n=Ge(this.sel.ranges,e);Io(this,Ur(this,n),t)}),setSelections:ur(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new Rt(ct(this,e[i].anchor),ct(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),br(this,zr(this.cm,r,t),n)}),addSelection:ur(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Rt(ct(this,e),ct(this,t||e))),br(this,zr(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=Yt(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=Yt(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:ur(function(e,t,n){for(var r=[],i=this.sel,x=0;x<i.ranges.length;x++){var I=i.ranges[x];r[x]={from:I.from(),to:I.to(),text:this.splitLines(e[x]),origin:n}}for(var W=t&&t!="end"&&fl(this,r,t),K=r.length-1;K>=0;K--)Wn(this,r[K]);W?Uo(this,W):this.cm&&Un(this.cm)}),undo:ur(function(){zi(this,"undo")}),redo:ur(function(){zi(this,"redo")}),undoSelection:ur(function(){zi(this,"undo",!0)}),redoSelection:ur(function(){zi(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 Bi(this.history.maxGeneration),cn(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:Bn(this.history.done),undone:Bn(this.history.undone)}},setHistory:function(e){var t=this.history=new Bi(this.history.maxGeneration);t.done=Bn(e.done.slice(0),null,!0),t.undone=Bn(e.undone.slice(0),null,!0)},setGutterMarker:ur(function(e,t,n){return hi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Qe(i)&&(r.gutterMarkers=null),!0})}),clearGutter:ur(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&hi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Qe(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!gr(this,e))return null;if(t=e,e=tt(this,e),!e)return null}else if(t=St(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:ur(function(e,t,n){return hi(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(y(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:ur(function(e,t,n){return hi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",x=r[i];if(x)if(n==null)r[i]=null;else{var I=x.match(y(n));if(!I)return!1;var W=I.index+I[0].length;r[i]=x.slice(0,I.index)+(!I.index||W==x.length?"":" ")+x.slice(W)||null}else return!1;return!0})}),addLineWidget:ur(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Kn(this,ct(this,e),ct(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=ct(this,e),Kn(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ct(this,e);var t=[],n=tt(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=ct(this,e),t=ct(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(x){var I=x.markedSpans;if(I)for(var W=0;W<I.length;W++){var K=I[W];!(K.to!=null&&i==e.line&&e.ch>=K.to||K.from==null&&i!=e.line||K.from!=null&&i==t.line&&K.from>=t.ch)&&(!n||n(K.marker))&&r.push(K.marker.parent||K.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 x=i.text.length+r;if(x>e)return t=e,!0;e-=x,++n}),ct(this,Fe(n,t))},indexFromPos:function(e){e=ct(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 Lr(Nr(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 Lr(Nr(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,Jo(this)),r},unlinkDoc:function(e){if(e instanceof Wt&&(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),_l(Jo(this));break}if(e.history==this.history){var r=[e.id];cn(e,function(i){return r.push(i.id)},!0),e.history=new Bi(null),e.history.done=Bn(this.history.done,r),e.history.undone=Bn(this.history.undone,r)}},iterLinkedDocs:function(e){cn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):yt(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:ur(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)})}),Lr.prototype.eachLine=Lr.prototype.iter;var $o=0;function Cl(e){var t=this;if(qo(t),Ie(t,e)||en(t.display,e))return;Y(e),F&&($o=+new Date);var n=En(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,x=Array(i),I=0,W=function(){++I==i&&lr(t,function(){n=ct(t.doc,n);var ce={from:n,to:n,text:t.doc.splitLines(x.filter(function(Oe){return Oe!=null}).join(t.doc.lineSeparator())),origin:"paste"};Wn(t.doc,ce),Uo(t.doc,un(ct(t.doc,n),ct(t.doc,dn(ce))))})()},K=function(ce,Oe){if(t.options.allowDropFileTypes&&ie(t.options.allowDropFileTypes,ce.type)==-1){W();return}var Ne=new FileReader;Ne.onerror=function(){return W()},Ne.onload=function(){var Xe=Ne.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Xe)){W();return}x[Oe]=Xe,W()},Ne.readAsText(ce)},X=0;X<r.length;X++)K(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 ne=e.dataTransfer.getData("Text");if(ne){var ae;if(t.state.draggingText&&!t.state.draggingText.copy&&(ae=t.listSelections()),Hi(t.doc,un(n,n)),ae)for(var he=0;he<ae.length;++he)Hn(t.doc,"",ae[he].anchor,ae[he].head,"drag");t.replaceSelection(ne,"around","paste"),t.display.input.focus()}}catch(ce){}}}function Al(e,t){if(F&&(!e.state.draggingText||+new Date-$o<100)){q(t);return}if(Ie(e,t)||en(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!T){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",w&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),w&&n.parentNode.removeChild(n)}}function Ll(e,t){var n=En(e,t);if(!n)return;var r=document.createDocumentFragment();co(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)),o(e.display.dragCursor,r)}function qo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function es(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 x=0;x<n.length;x++)e(n[x])})}var ts=!1;function Dl(){if(ts)return;Ol(),ts=!0}function Ol(){var e;ge(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,es(Rl)},100))}),ge(window,"blur",function(){return es(Nn)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var hn={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"},yi=0;yi<10;yi++)hn[yi+48]=hn[yi+96]=String(yi);for(var Gi=65;Gi<=90;Gi++)hn[Gi]=String.fromCharCode(Gi);for(var bi=1;bi<=12;bi++)hn[bi+111]=hn[bi+63235]="F"+bi;var tn={};tn.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"},tn.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"},tn.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"},tn.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"]},tn.default=u?tn.macDefault:tn.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,x,I=0;I<t.length-1;I++){var W=t[I];if(/^(cmd|meta|m)$/i.test(W))x=!0;else if(/^a(lt)?$/i.test(W))n=!0;else if(/^(c|ctrl|control)$/i.test(W))r=!0;else if(/^s(hift)?$/i.test(W))i=!0;else throw new Error("Unrecognized modifier name: "+W)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),x&&(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=Ge(n.split(" "),Pl),x=0;x<i.length;x++){var I=void 0,W=void 0;x==i.length-1?(W=i.join(" "),I=r):(W=i.slice(0,x+1).join(" "),I="...");var K=t[W];if(!K)t[W]=I;else if(K!=I)throw new Error("Inconsistent bindings for "+W)}delete e[n]}for(var X in t)e[X]=t[X];return e}function zn(e,t,n,r){t=Vi(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 zn(e,t.fallthrough,n,r);for(var x=0;x<t.fallthrough.length;x++){var I=zn(e,t.fallthrough[x],n,r);if(I)return I}}}function rs(e){var t=typeof e=="string"?e:hn[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ns(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(g?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(g?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function is(e,t){if(w&&e.keyCode==34&&e.char)return!1;var n=hn[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),ns(n,e,t))}function Vi(e){return typeof e=="string"?tn[e]:e}function Gn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var x=t(n[i]);r.length&&dt(x.from,Ee(r).to)<=0;){var I=r.pop();if(dt(I.from,x.from)<0){x.from=I.from;break}}r.push(x)}kr(e,function(){for(var W=r.length-1;W>=0;W--)Hn(e.doc,"",r[W].from,r[W].to,"+delete");Un(e)})}function La(e,t,n){var r=Pe(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Da(e,t,n){var r=La(e,t.ch,n);return r==null?null:new Fe(t.line,r,n<0?"after":"before")}function Oa(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var x=Ke(n,t.doc.direction);if(x){var I=i<0?Ee(x):x[0],W=i<0==(I.level==1),K=W?"after":"before",X;if(I.level>0||t.doc.direction=="rtl"){var ne=Mn(t,n);X=i<0?n.text.length-1:0;var ae=Xr(t,ne,X).top;X=Le(function(he){return Xr(t,ne,he).top==ae},i<0==(I.level==1)?I.from:I.to-1,X),K=="before"&&(X=La(n,X,1))}else X=i<0?I.to:I.from;return new Fe(r,X,K)}}return new Fe(r,i<0?n.text.length:0,i<0?"before":"after")}function kl(e,t,n,r){var i=Ke(t,e.doc.direction);if(!i)return Da(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 x=We(i,n.ch,n.sticky),I=i[x];if(e.doc.direction=="ltr"&&I.level%2==0&&(r>0?I.to>n.ch:I.from<n.ch))return Da(t,n,r);var W=function(Ze,rt){return La(t,Ze instanceof Fe?Ze.ch:Ze,rt)},K,X=function(Ze){return e.options.lineWrapping?(K=K||Mn(e,t),oo(e,t,K,Ze)):{begin:0,end:t.text.length}},ne=X(n.sticky=="before"?W(n,-1):n.ch);if(e.doc.direction=="rtl"||I.level==1){var ae=I.level==1==r<0,he=W(n,ae?1:-1);if(he!=null&&(ae?he<=I.to&&he<=ne.end:he>=I.from&&he>=ne.begin)){var ce=ae?"before":"after";return new Fe(n.line,he,ce)}}var Oe=function(Ze,rt,Je){for(var it=function(It,dr){return dr?new Fe(n.line,W(It,1),"before"):new Fe(n.line,It,"after")};Ze>=0&&Ze<i.length;Ze+=rt){var mt=i[Ze],ft=rt>0==(mt.level!=1),Tt=ft?Je.begin:W(Je.end,-1);if(mt.from<=Tt&&Tt<mt.to)return it(Tt,ft);if(Tt=ft?mt.from:W(mt.to,-1),Je.begin<=Tt&&Tt<Je.end)return it(Tt,ft)}},Ne=Oe(x+r,r,ne);if(Ne)return Ne;var Xe=r>0?ne.end:W(ne.begin,-1);return Xe!=null&&!(r>0&&Xe==t.text.length)&&(Ne=Oe(r>0?0:i.length-1,r,X(Xe)),Ne)?Ne:null}var Ei={selectAll:Ho,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),fe)},killLine:function(e){return Gn(e,function(t){if(t.empty()){var n=tt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Fe(t.head.line+1,0)}:{from:t.head,to:Fe(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Gn(e,function(t){return{from:Fe(t.from().line,0),to:ct(e.doc,Fe(t.to().line+1,0))}})},delLineLeft:function(e){return Gn(e,function(t){return{from:Fe(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Gn(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 Gn(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(Fe(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Fe(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return as(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return os(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")},be)},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")},be)},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/)?os(e,t.head):r},be)},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 x=n[i].from(),I=V(e.getLine(x.line),x.ch,r);t.push(ue(r-I%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return kr(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,x=tt(e.doc,i.line).text;if(x){if(i.ch==x.length&&(i=new Fe(i.line,i.ch-1)),i.ch>0)i=new Fe(i.line,i.ch+1),e.replaceRange(x.charAt(i.ch-1)+x.charAt(i.ch-2),Fe(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var I=tt(e.doc,i.line-1).text;I&&(i=new Fe(i.line,1),e.replaceRange(x.charAt(0)+e.doc.lineSeparator()+I.charAt(I.length-1),Fe(i.line-1,I.length-1),i,"+transpose"))}}n.push(new Rt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return kr(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);Un(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function as(e,t){var n=tt(e.doc,t),r=Hr(n);return r!=n&&(t=St(r)),Oa(!0,e,r,t,1)}function Il(e,t){var n=tt(e.doc,t),r=ja(n);return r!=n&&(t=St(r)),Oa(!0,e,n,t,-1)}function os(e,t){var n=as(e,t.line),r=tt(e.doc,n.line),i=Ke(r,e.doc.direction);if(!i||i[0].level==0){var x=Math.max(n.ch,r.text.search(/\S/)),I=t.line==n.line&&t.ch<=x&&t.ch;return Fe(n.line,I?0:x,n.sticky)}return n}function Xi(e,t,n){if(typeof t=="string"&&(t=Ei[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)!=_e}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Nl(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=zn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&zn(t,e.options.extraKeys,n,e)||zn(t,e.options.keyMap,n,e)}var Ul=new $;function xi(e,t,n,r){var i=e.state.keySeq;if(i){if(rs(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),ss(e,i+" "+t,n,r))return!0}return ss(e,t,n,r)}function ss(e,t,n,r){var i=Nl(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&mr(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(Y(n),ha(e)),!!i}function ls(e,t){var n=is(t,!0);return n?t.shiftKey&&!e.state.keySeq?xi(e,"Shift-"+n,t,function(r){return Xi(e,r,!0)})||xi(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Xi(e,r)}):xi(e,n,t,function(r){return Xi(e,r)}):!1}function Fl(e,t,n){return xi(e,"'"+n+"'",t,function(r){return Xi(e,r,!0)})}var Ra=null;function us(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=O(),Ie(t,e))return;F&&M<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=ls(t,e);w&&(Ra=r?n:null,!r&&n==88&&!_t&&(u?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),L&&!u&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;U(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(f(t,"CodeMirror-crosshair"),He(document,"keyup",n),He(document,"mouseover",n))}ge(document,"keyup",n),ge(document,"mouseover",n)}function ds(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ie(this,e)}function cs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(en(t.display,e)||Ie(t,e)||e.ctrlKey&&!e.altKey||u&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(w&&n==Ra){Ra=null,Y(e);return}if(w&&(!e.which||e.which<10)&&ls(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Fl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Pa=function(e,t,n){this.time=e,this.pos=t,this.button=n};Pa.prototype.compare=function(e,t,n){return this.time+jl>e&&dt(t,this.pos)==0&&n==this.button};var Ti,Si;function Wl(e,t){var n=+new Date;return Si&&Si.compare(n,e,t)?(Ti=Si=null,"triple"):Ti&&Ti.compare(n,e,t)?(Si=new Pa(n,e,t),Ti=null,"double"):(Ti=new Pa(n,e,t),Si=null,"single")}function fs(e){var t=this,n=t.display;if(Ie(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,en(n,e)){D||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ma(t,e))return;var r=En(t,e),i=ye(e),x=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,x,e))return;i==1?r?zl(t,r,x,e):de(e)==n.scroller&&Y(e):i==2?(r&&Wi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(C?t.display.input.onContextMenu(e):ho(t))}function Hl(e,t,n,r,i){var x="Click";return r=="double"?x="Double"+x:r=="triple"&&(x="Triple"+x),x=(t==1?"Left":t==2?"Middle":"Right")+x,xi(e,ns(x,i),i,function(I){if(typeof I=="string"&&(I=Ei[I]),!I)return!1;var W=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),W=I(e,n)!=_e}finally{e.state.suppressEdits=!1}return W})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var x=l?n.shiftKey&&n.metaKey:n.altKey;i.unit=x?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=u?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(u?n.altKey:n.ctrlKey)),i}function zl(e,t,n,r){F?setTimeout(B(fo,e),0):e.curOp.focus=O();var i=Kl(e,n,r),x=e.doc.sel,I;e.options.dragDrop&&Me&&!e.isReadOnly()&&n=="single"&&(I=x.contains(t))>-1&&(dt((I=x.ranges[I]).from(),t)<0||t.xRel>0)&&(dt(I.to(),t)>0||t.xRel<0)?Gl(e,r,t,i):Vl(e,r,t,i)}function Gl(e,t,n,r){var i=e.display,x=!1,I=lr(e,function(X){D&&(i.scroller.draggable=!1),e.state.draggingText=!1,He(i.wrapper.ownerDocument,"mouseup",I),He(i.wrapper.ownerDocument,"mousemove",W),He(i.scroller,"dragstart",K),He(i.scroller,"drop",I),x||(Y(X),r.addNew||Wi(e.doc,n,null,null,r.extend),D&&!T||F&&M==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),W=function(X){x=x||Math.abs(t.clientX-X.clientX)+Math.abs(t.clientY-X.clientY)>=10},K=function(){return x=!0};D&&(i.scroller.draggable=!0),e.state.draggingText=I,I.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),ge(i.wrapper.ownerDocument,"mouseup",I),ge(i.wrapper.ownerDocument,"mousemove",W),ge(i.scroller,"dragstart",K),ge(i.scroller,"drop",I),ho(e),setTimeout(function(){return i.input.focus()},20)}function hs(e,t,n){if(n=="char")return new Rt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Rt(Fe(t.line,0),ct(e.doc,Fe(t.line+1,0)));var r=n(e,t);return new Rt(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,x=e.doc;Y(t);var I,W,K=x.sel,X=K.ranges;if(r.addNew&&!r.extend?(W=x.sel.contains(n),W>-1?I=X[W]:I=new Rt(n,n)):(I=x.sel.primary(),W=x.sel.primIndex),r.unit=="rectangle")r.addNew||(I=new Rt(n,n)),n=En(e,t,!0,!0),W=-1;else{var ne=hs(e,n,r.unit);r.extend?I=Ca(I,ne.anchor,ne.head,r.extend):I=ne}r.addNew?W==-1?(W=X.length,br(x,zr(e,X.concat([I]),W),{scroll:!1,origin:"*mouse"})):X.length>1&&X[W].empty()&&r.unit=="char"&&!r.extend?(br(x,zr(e,X.slice(0,W).concat(X.slice(W+1)),0),{scroll:!1,origin:"*mouse"}),K=x.sel):Aa(x,W,I,Se):(W=0,br(x,new Br([I],0),Se),K=x.sel);var ae=n;function he(Je){if(dt(ae,Je)==0)return;if(ae=Je,r.unit=="rectangle"){for(var it=[],mt=e.options.tabSize,ft=V(tt(x,n.line).text,n.ch,mt),Tt=V(tt(x,Je.line).text,Je.ch,mt),It=Math.min(ft,Tt),dr=Math.max(ft,Tt),zt=Math.min(n.line,Je.line),Ir=Math.min(e.lastLine(),Math.max(n.line,Je.line));zt<=Ir;zt++){var Dr=tt(x,zt).text,er=me(Dr,It,mt);It==dr?it.push(new Rt(Fe(zt,er),Fe(zt,er))):Dr.length>er&&it.push(new Rt(Fe(zt,er),Fe(zt,me(Dr,dr,mt))))}it.length||it.push(new Rt(n,n)),br(x,zr(e,K.ranges.slice(0,W).concat(it),W),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Je)}else{var Or=I,pr=hs(e,Je,r.unit),ir=Or.anchor,tr;dt(pr.anchor,ir)>0?(tr=pr.head,ir=wr(Or.from(),pr.anchor)):(tr=pr.anchor,ir=Ve(Or.to(),pr.head));var Zt=K.ranges.slice(0);Zt[W]=Xl(e,new Rt(ct(x,ir),tr)),br(x,zr(e,Zt,W),Se)}}var ce=i.wrapper.getBoundingClientRect(),Oe=0;function Ne(Je){var it=++Oe,mt=En(e,Je,!0,r.unit=="rectangle");if(!mt)return;if(dt(mt,ae)!=0){e.curOp.focus=O(),he(mt);var ft=Ii(i,x);(mt.line>=ft.to||mt.line<ft.from)&&setTimeout(lr(e,function(){Oe==it&&Ne(Je)}),150)}else{var Tt=Je.clientY<ce.top?-20:Je.clientY>ce.bottom?20:0;Tt&&setTimeout(lr(e,function(){if(Oe!=it)return;i.scroller.scrollTop+=Tt,Ne(Je)}),50)}}function Xe(Je){e.state.selectingText=!1,Oe=Infinity,Je&&(Y(Je),i.input.focus()),He(i.wrapper.ownerDocument,"mousemove",Ze),He(i.wrapper.ownerDocument,"mouseup",rt),x.history.lastSelOrigin=null}var Ze=lr(e,function(Je){Je.buttons===0||!ye(Je)?Xe(Je):Ne(Je)}),rt=lr(e,Xe);e.state.selectingText=rt,ge(i.wrapper.ownerDocument,"mousemove",Ze),ge(i.wrapper.ownerDocument,"mouseup",rt)}function Xl(e,t){var n=t.anchor,r=t.head,i=tt(e.doc,n.line);if(dt(n,r)==0&&n.sticky==r.sticky)return t;var x=Ke(i);if(!x)return t;var I=We(x,n.ch,n.sticky),W=x[I];if(W.from!=n.ch&&W.to!=n.ch)return t;var K=I+(W.from==n.ch==(W.level!=1)?0:1);if(K==0||K==x.length)return t;var X;if(r.line!=n.line)X=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ne=We(x,r.ch,r.sticky),ae=ne-I||(r.ch-n.ch)*(W.level==1?-1:1);ne==K-1||ne==K?X=ae<0:X=ae>0}var he=x[K+(X?-1:0)],ce=X==(he.level==1),Oe=ce?he.from:he.to,Ne=ce?"after":"before";return n.ch==Oe&&n.sticky==Ne?t:new Rt(new Fe(n.line,Oe,Ne),r)}function ms(e,t,n,r){var i,x;if(t.touches)i=t.touches[0].clientX,x=t.touches[0].clientY;else try{i=t.clientX,x=t.clientY}catch(he){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Y(t);var I=e.display,W=I.lineDiv.getBoundingClientRect();if(x>W.bottom||!te(e,n))return Z(t);x-=W.top-I.viewOffset;for(var K=0;K<e.display.gutterSpecs.length;++K){var X=I.gutters.childNodes[K];if(X&&X.getBoundingClientRect().right>=i){var ne=hr(e.doc,x),ae=e.display.gutterSpecs[K];return xe(e,n,e,ne,ae.className,t),Z(t)}}}function Ma(e,t){return ms(e,t,"gutterClick",!0)}function ps(e,t){if(en(e.display,t)||Yl(e,t))return;if(Ie(e,t,"contextmenu"))return;C||e.display.input.onContextMenu(t)}function Yl(e,t){return te(e,"gutterContextMenu")?ms(e,t,"gutterContextMenu",!1):!1}function gs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ni(e)}var Vn={toString:function(){return"CodeMirror.Init"}},vs={},Yi={};function Ql(e){var t=e.optionHandlers;function n(r,i,x,I){e.defaults[r]=i,x&&(t[r]=I?function(W,K,X){X!=Vn&&x(W,K,X)}:x)}e.defineOption=n,e.Init=Vn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Sa(r)},!0),n("indentUnit",2,Sa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){ci(r),ni(r),Ar(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var x=[],I=r.doc.first;r.doc.iter(function(K){for(var X=0;;){var ne=K.text.indexOf(i,X);if(ne==-1)break;X=ne+i.length,x.push(Fe(I,ne))}I++});for(var W=x.length-1;W>=0;W--)Hn(r.doc,i,x[W],Fe(x[W].line,x[W].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,x){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),x!=Vn&&r.refresh()}),n("specialCharPlaceholder",qn,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",s?"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",!S),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){gs(r),di(r)},!0),n("keyMap","default",function(r,i,x){var I=Vi(i),W=x!=Vn&&Vi(x);W&&W.detach&&W.detach(r,I),I.attach&&I.attach(r,W||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=xa(i,r.options.lineNumbers),di(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?ca(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Fn(r)},!0),n("scrollbarStyle","native",function(r){bo(r),Fn(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=xa(r.options.gutters,i),di(r)},!0),n("firstLineNumber",1,di,!0),n("lineNumberFormatter",function(r){return r},di,!0),n("showCursorWhenSelecting",!1,ii,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Nn(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,Zl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,ii,!0),n("singleCursorHeightPerLine",!0,ii,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,ci,!0),n("addModeClass",!1,ci,!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,ci,!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 Zl(e,t,n){var r=n&&n!=Vn;if(!t!=!r){var i=e.display.dragFunctions,x=t?ge:He;x(e.display.scroller,"dragstart",i.start),x(e.display.scroller,"dragenter",i.enter),x(e.display.scroller,"dragover",i.over),x(e.display.scroller,"dragleave",i.leave),x(e.display.scroller,"drop",i.drop)}}function Jl(e){e.options.lineWrapping?(U(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(f(e.display.wrapper,"CodeMirror-wrap"),or(e)),fa(e),Ar(e),ni(e),setTimeout(function(){return Fn(e)},100)}function Wt(e,t){var n=this;if(!(this instanceof Wt))return new Wt(e,t);this.options=t=t?N(t):{},N(vs,t,!1);var r=t.value;typeof r=="string"?r=new Lr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Wt.inputStyles[t.inputStyle](this),x=this.display=new dl(e,r,i,t);x.wrapper.CodeMirror=this,gs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),bo(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 $,keySeq:null,specialChars:null},t.autofocus&&!s&&x.input.focus(),F&&M<11&&setTimeout(function(){return n.display.input.reset(!0)},20),$l(this),Dl(),_n(this),this.curOp.forceUpdate=!0,Do(this,r),t.autofocus&&!s||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&ma(n)},20):Nn(this);for(var I in Yi)Yi.hasOwnProperty(I)&&Yi[I](this,t[I],Vn);To(this),t.finishInit&&t.finishInit(this);for(var W=0;W<ka.length;++W)ka[W](this);wn(this),D&&t.lineWrapping&&getComputedStyle(x.lineDiv).textRendering=="optimizelegibility"&&(x.lineDiv.style.textRendering="auto")}Wt.defaults=vs,Wt.optionHandlers=Yi;function $l(e){var t=e.display;ge(t.scroller,"mousedown",lr(e,fs)),F&&M<11?ge(t.scroller,"dblclick",lr(e,function(K){if(Ie(e,K))return;var X=En(e,K);if(!X||Ma(e,K)||en(e.display,K))return;Y(K);var ne=e.findWordAt(X);Wi(e.doc,ne.anchor,ne.head)})):ge(t.scroller,"dblclick",function(K){return Ie(e,K)||Y(K)}),ge(t.scroller,"contextmenu",function(K){return ps(e,K)}),ge(t.input.getField(),"contextmenu",function(K){t.scroller.contains(K.target)||ps(e,K)});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 x(K){if(K.touches.length!=1)return!1;var X=K.touches[0];return X.radiusX<=1&&X.radiusY<=1}function I(K,X){if(X.left==null)return!0;var ne=X.left-K.left,ae=X.top-K.top;return ne*ne+ae*ae>20*20}ge(t.scroller,"touchstart",function(K){if(!Ie(e,K)&&!x(K)&&!Ma(e,K)){t.input.ensurePolled(),clearTimeout(n);var X=+new Date;t.activeTouch={start:X,moved:!1,prev:X-r.end<=300?r:null},K.touches.length==1&&(t.activeTouch.left=K.touches[0].pageX,t.activeTouch.top=K.touches[0].pageY)}}),ge(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ge(t.scroller,"touchend",function(K){var X=t.activeTouch;if(X&&!en(t,K)&&X.left!=null&&!X.moved&&new Date-X.start<300){var ne=e.coordsChar(t.activeTouch,"page"),ae;!X.prev||I(X,X.prev)?ae=new Rt(ne,ne):!X.prev.prev||I(X,X.prev.prev)?ae=e.findWordAt(ne):ae=new Rt(Fe(ne.line,0),ct(e.doc,Fe(ne.line+1,0))),e.setSelection(ae.anchor,ae.head),e.focus(),Y(K)}i()}),ge(t.scroller,"touchcancel",i),ge(t.scroller,"scroll",function(){t.scroller.clientHeight&&(oi(e,t.scroller.scrollTop),Tn(e,t.scroller.scrollLeft,!0),xe(e,"scroll",e))}),ge(t.scroller,"mousewheel",function(K){return wo(e,K)}),ge(t.scroller,"DOMMouseScroll",function(K){return wo(e,K)}),ge(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(K){Ie(e,K)||q(K)},over:function(K){Ie(e,K)||(Ll(e,K),q(K))},start:function(K){return Al(e,K)},drop:lr(e,Cl),leave:function(K){Ie(e,K)||qo(e)}};var W=t.input.getField();ge(W,"keyup",function(K){return ds.call(e,K)}),ge(W,"keydown",lr(e,us)),ge(W,"keypress",lr(e,cs)),ge(W,"focus",function(K){return ma(e,K)}),ge(W,"blur",function(K){return Nn(e,K)})}var ka=[];Wt.defineInitHook=function(e){return ka.push(e)};function _i(e,t,n,r){var i=e.doc,x;n==null&&(n="add"),n=="smart"&&(i.mode.indent?x=ve(e,t).state:n="prev");var I=e.options.tabSize,W=tt(i,t),K=V(W.text,null,I);W.stateAfter&&(W.stateAfter=null);var X=W.text.match(/^\s*/)[0],ne;if(!r&&!/\S/.test(W.text))ne=0,n="not";else if(n=="smart"&&(ne=i.mode.indent(x,W.text.slice(X.length),W.text),ne==_e||ne>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?ne=V(tt(i,t-1).text,null,I):ne=0:n=="add"?ne=K+e.options.indentUnit:n=="subtract"?ne=K-e.options.indentUnit:typeof n=="number"&&(ne=K+n),ne=Math.max(0,ne);var ae="",he=0;if(e.options.indentWithTabs)for(var ce=Math.floor(ne/I);ce;--ce)he+=I,ae+=" ";if(he<ne&&(ae+=ue(ne-he)),ae!=X)return Hn(i,ae,Fe(t,0),Fe(t,X.length),"+input"),W.stateAfter=null,!0;for(var Oe=0;Oe<i.sel.ranges.length;Oe++){var Ne=i.sel.ranges[Oe];if(Ne.head.line==t&&Ne.head.ch<X.length){var Xe=Fe(t,X.length);Aa(i,Oe,new Rt(Xe,Xe));break}}}var Gr=null;function Qi(e){Gr=e}function Ia(e,t,n,r,i){var x=e.doc;e.display.shift=!1,r||(r=x.sel);var I=+new Date-200,W=i=="paste"||e.state.pasteIncoming>I,K=yt(t),X=null;if(W&&r.ranges.length>1)if(Gr&&Gr.text.join(`
`)==t){if(r.ranges.length%Gr.text.length==0){X=[];for(var ne=0;ne<Gr.text.length;ne++)X.push(x.splitLines(Gr.text[ne]))}}else K.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(X=Ge(K,function(Ze){return[Ze]}));for(var ae=e.curOp.updateInput,he=r.ranges.length-1;he>=0;he--){var ce=r.ranges[he],Oe=ce.from(),Ne=ce.to();ce.empty()&&(n&&n>0?Oe=Fe(Oe.line,Oe.ch-n):e.state.overwrite&&!W?Ne=Fe(Ne.line,Math.min(tt(x,Ne.line).text.length,Ne.ch+Ee(K).length)):W&&Gr&&Gr.lineWise&&Gr.text.join(`
`)==K.join(`
`)&&(Oe=Ne=Fe(Oe.line,0)));var Xe={from:Oe,to:Ne,text:X?X[he%X.length]:K,origin:i||(W?"paste":e.state.cutIncoming>I?"cut":"+input")};Wn(e.doc,Xe),mr(e,"inputRead",e,Xe)}t&&!W&&bs(e,t),Un(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ae),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ys(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&kr(t,function(){return Ia(t,n,0,null,"paste")}),!0}function bs(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 x=e.getModeAt(i.head),I=!1;if(x.electricChars){for(var W=0;W<x.electricChars.length;W++)if(t.indexOf(x.electricChars.charAt(W))>-1){I=_i(e,i.head.line,"smart");break}}else x.electricInput&&(x.electricInput.test(tt(e.doc,i.head.line).text.slice(0,i.head.ch))&&(I=_i(e,i.head.line,"smart")));I&&mr(e,"electricInput",e,i.head.line)}}function Es(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,x={anchor:Fe(i,0),head:Fe(i+1,0)};n.push(x),t.push(e.getRange(x.anchor,x.head))}return{text:t,ranges:n}}function xs(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Ts(){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 D?e.style.width="1000px":e.setAttribute("wrap","off"),b&&(e.style.border="1px solid black"),xs(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 x=this.options,I=x[r];if(x[r]==i&&r!="mode")return;x[r]=i,t.hasOwnProperty(r)&&lr(this,t[r])(this,i,I),xe(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"](Vi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,x=0;x<i.length;++x)if(i[x]==r||i[x].name==r)return i.splice(x,1),!0},addOverlay:Tr(function(r,i){var x=r.token?r:e.getMode(this.options,r);if(x.startState)throw new Error("Overlays may not be stateful.");Te(this.state.overlays,{mode:x,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(I){return I.priority}),this.state.modeGen++,Ar(this)}),removeOverlay:Tr(function(r){for(var i=this.state.overlays,x=0;x<i.length;++x){var I=i[x].modeSpec;if(I==r||typeof r=="string"&&I.name==r){i.splice(x,1),this.state.modeGen++,Ar(this);return}}}),indentLine:Tr(function(r,i,x){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),gr(this.doc,r)&&_i(this,r,i,x)}),indentSelection:Tr(function(r){for(var i=this.doc.sel.ranges,x=-1,I=0;I<i.length;I++){var W=i[I];if(W.empty())W.head.line>x&&(_i(this,W.head.line,r,!0),x=W.head.line,I==this.doc.sel.primIndex&&Un(this));else{var K=W.from(),X=W.to(),ne=Math.max(x,K.line);x=Math.min(this.lastLine(),X.line-(X.ch?0:1))+1;for(var ae=ne;ae<x;++ae)_i(this,ae,r);var he=this.doc.sel.ranges;K.ch==0&&i.length==he.length&&he[I].from().ch>0&&Aa(this.doc,I,new Rt(K,he[I].to()),fe)}}}),getTokenAt:function(r,i){return ar(this,r,i)},getLineTokens:function(r,i){return ar(this,Fe(r),i,!0)},getTokenTypeAt:function(r){r=ct(this.doc,r);var i=ot(this,tt(this.doc,r.line)),x=0,I=(i.length-1)/2,W=r.ch,K;if(W==0)K=i[2];else for(;;){var X=x+I>>1;if((X?i[X*2-1]:0)>=W)I=X;else if(i[X*2+1]<W)x=X+1;else{K=i[X*2+2];break}}var ne=K?K.indexOf("overlay "):-1;return ne<0?K:ne==0?null:K.slice(0,ne-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 x=[];if(!n.hasOwnProperty(i))return x;var I=n[i],W=this.getModeAt(r);if(typeof W[i]=="string")I[W[i]]&&x.push(I[W[i]]);else if(W[i])for(var K=0;K<W[i].length;K++){var X=I[W[i][K]];X&&x.push(X)}else W.helperType&&I[W.helperType]?x.push(I[W.helperType]):I[W.name]&&x.push(I[W.name]);for(var ne=0;ne<I._global.length;ne++){var ae=I._global[ne];ae.pred(W,this)&&ie(x,ae.val)==-1&&x.push(ae.val)}return x},getStateAfter:function(r,i){var x=this.doc;return r=jr(x,r==null?x.first+x.size-1:r),ve(this,r+1,i).state},cursorCoords:function(r,i){var x,I=this.doc.sel.primary();return r==null?x=I.head:typeof r=="object"?x=ct(this.doc,r):x=r?I.from():I.to(),Kr(this,x,i||"page")},charCoords:function(r,i){return oa(this,ct(this.doc,r),i||"page")},coordsChar:function(r,i){return r=no(this,r,i||"page"),la(this,r.left,r.top)},lineAtHeight:function(r,i){return r=no(this,{top:r,left:0},i||"page").top,hr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,x){var I=!1,W;if(typeof r=="number"){var K=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>K&&(r=K,I=!0),W=tt(this.doc,r)}else W=r;return Ri(this,W,{top:0,left:0},i||"page",x||I).top+(I?this.doc.height-Ft(W):0)},defaultTextHeight:function(){return kn(this.display)},defaultCharWidth:function(){return In(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,x,I,W){var K=this.display;r=Kr(this,ct(this.doc,r));var X=r.bottom,ne=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),K.sizer.appendChild(i),I=="over")X=r.top;else if(I=="above"||I=="near"){var ae=Math.max(K.wrapper.clientHeight,this.doc.height),he=Math.max(K.sizer.clientWidth,K.lineSpace.clientWidth);(I=="above"||r.bottom+i.offsetHeight>ae)&&r.top>i.offsetHeight?X=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=ae&&(X=r.bottom),ne+i.offsetWidth>he&&(ne=he-i.offsetWidth)}i.style.top=X+"px",i.style.left=i.style.right="",W=="right"?(ne=K.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(W=="left"?ne=0:W=="middle"&&(ne=(K.sizer.clientWidth-i.offsetWidth)/2),i.style.left=ne+"px"),x&&Zs(this,{left:ne,top:X,right:ne+i.offsetWidth,bottom:X+i.offsetHeight})},triggerOnKeyDown:Tr(us),triggerOnKeyPress:Tr(cs),triggerOnKeyUp:ds,triggerOnMouseDown:Tr(fs),execCommand:function(r){if(Ei.hasOwnProperty(r))return Ei[r].call(null,this)},triggerElectric:Tr(function(r){bs(this,r)}),findPosH:function(r,i,x,I){var W=1;i<0&&(W=-1,i=-i);for(var K=ct(this.doc,r),X=0;X<i&&!(K=Na(this.doc,K,W,x,I),K.hitSide);++X);return K},moveH:Tr(function(r,i){var x=this;this.extendSelectionsBy(function(I){return x.display.shift||x.doc.extend||I.empty()?Na(x.doc,I.head,r,i,x.options.rtlMoveVisually):r<0?I.from():I.to()},be)}),deleteH:Tr(function(r,i){var x=this.doc.sel,I=this.doc;x.somethingSelected()?I.replaceSelection("",null,"+delete"):Gn(this,function(W){var K=Na(I,W.head,r,i,!1);return r<0?{from:K,to:W.head}:{from:W.head,to:K}})}),findPosV:function(r,i,x,I){var W=1,K=I;i<0&&(W=-1,i=-i);for(var X=ct(this.doc,r),ne=0;ne<i;++ne){var ae=Kr(this,X,"div");if(K==null?K=ae.left:ae.left=K,X=Ss(this,ae,W,x),X.hitSide)break}return X},moveV:Tr(function(r,i){var x=this,I=this.doc,W=[],K=!this.display.shift&&!I.extend&&I.sel.somethingSelected();if(I.extendSelectionsBy(function(ne){if(K)return r<0?ne.from():ne.to();var ae=Kr(x,ne.head,"div");ne.goalColumn!=null&&(ae.left=ne.goalColumn),W.push(ae.left);var he=Ss(x,ae,r,i);return i=="page"&&ne==I.sel.primary()&&ga(x,oa(x,he,"div").top-ae.top),he},be),W.length)for(var X=0;X<I.sel.ranges.length;X++)I.sel.ranges[X].goalColumn=W[X]}),findWordAt:function(r){var i=this.doc,x=tt(i,r.line).text,I=r.ch,W=r.ch;if(x){var K=this.getHelper(r,"wordChars");(r.sticky=="before"||W==x.length)&&I?--I:++W;for(var X=x.charAt(I),ne=Be(X,K)?function(ae){return Be(ae,K)}:/\s/.test(X)?function(ae){return/\s/.test(ae)}:function(ae){return!/\s/.test(ae)&&!Be(ae)};I>0&&ne(x.charAt(I-1));)--I;for(;W<x.length&&ne(x.charAt(W));)++W}return new Rt(Fe(r.line,I),Fe(r.line,W))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?U(this.display.cursorDiv,"CodeMirror-overwrite"):f(this.display.cursorDiv,"CodeMirror-overwrite"),xe(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==O()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Tr(function(r,i){ai(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Vr(this)-this.display.barHeight,width:r.scrollWidth-Vr(this)-this.display.barWidth,clientHeight:na(this),clientWidth:yn(this)}},scrollIntoView:Tr(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:Fe(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?Js(this,r):po(this,r.from,r.to,r.margin)}),setSize:Tr(function(r,i){var x=this,I=function(K){return typeof K=="number"||/^\d+$/.test(String(K))?K+"px":K};r!=null&&(this.display.wrapper.style.width=I(r)),i!=null&&(this.display.wrapper.style.height=I(i)),this.options.lineWrapping&&eo(this);var W=this.display.viewFrom;this.doc.iter(W,this.display.viewTo,function(K){if(K.widgets){for(var X=0;X<K.widgets.length;X++)if(K.widgets[X].noHScroll){sn(x,W,"widget");break}}++W}),this.curOp.forceUpdate=!0,xe(this,"refresh",this)}),operation:function(r){return kr(this,r)},startOperation:function(){return _n(this)},endOperation:function(){return wn(this)},refresh:Tr(function(){var r=this.display.cachedTextHeight;Ar(this),this.curOp.forceUpdate=!0,ni(this),ai(this,this.doc.scrollLeft,this.doc.scrollTop),ba(this.display),(r==null||Math.abs(r-kn(this.display))>.5||this.options.lineWrapping)&&fa(this),xe(this,"refresh",this)}),swapDoc:Tr(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Do(this,r),ni(this),this.display.input.reset(),ai(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,mr(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}},ee(e),e.registerHelper=function(r,i,x){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=x},e.registerGlobalHelper=function(r,i,x,I){e.registerHelper(r,i,I),n[r]._global.push({pred:x,val:I})}}function Na(e,t,n,r,i){var x=t,I=n,W=tt(e,t.line),K=i&&e.direction=="rtl"?-n:n;function X(){var rt=t.line+K;return rt<e.first||rt>=e.first+e.size?!1:(t=new Fe(rt,t.ch,t.sticky),W=tt(e,rt))}function ne(rt){var Je;if(r=="codepoint"){var it=W.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(it)?Je=null:Je=new Fe(t.line,Math.max(0,Math.min(W.text.length,t.ch+n*(it>=55296&&it<56320?2:1))),-n)}else i?Je=kl(e.cm,W,t,n):Je=Da(W,t,n);if(Je==null)if(!rt&&X())t=Oa(i,e.cm,W,t.line,K);else return!1;else t=Je;return!0}if(r=="char"||r=="codepoint")ne();else if(r=="column")ne(!0);else if(r=="word"||r=="group")for(var ae=null,he=r=="group",ce=e.cm&&e.cm.getHelper(t,"wordChars"),Oe=!0;!(n<0&&!ne(!Oe));Oe=!1){var Ne=W.text.charAt(t.ch)||`
`,Xe=Be(Ne,ce)?"w":he&&Ne==`
`?"n":!he||/\s/.test(Ne)?null:"p";if(he&&!Oe&&!Xe&&(Xe="s"),ae&&ae!=Xe){n<0&&(n=1,ne(),t.sticky="after");break}if(Xe&&(ae=Xe),n>0&&!ne(!Oe))break}var Ze=Ki(e,t,x,I,!0);return _r(x,Ze)&&(Ze.hitSide=!0),Ze}function Ss(e,t,n,r){var i=e.doc,x=t.left,I;if(r=="page"){var W=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),K=Math.max(W-.5*kn(e.display),3);I=(n>0?t.bottom:t.top)+n*K}else r=="line"&&(I=n>0?t.bottom+3:t.top-3);for(var X;!(X=la(e,x,I),!X.outside);){if(n<0?I<=0:I>=i.height){X.hitSide=!0;break}I+=n*5}return X}var Mt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new $,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Mt.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;xs(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function x(W){for(var K=W.target;K;K=K.parentNode){if(K==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(K.className))break}return!1}ge(i,"paste",function(W){if(!x(W)||Ie(r,W)||ys(W,r))return;M<=11&&setTimeout(lr(r,function(){return t.updateFromDOM()}),20)}),ge(i,"compositionstart",function(W){t.composing={data:W.data,done:!1}}),ge(i,"compositionupdate",function(W){t.composing||(t.composing={data:W.data,done:!1})}),ge(i,"compositionend",function(W){t.composing&&(W.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ge(i,"touchstart",function(){return n.forceCompositionEnd()}),ge(i,"input",function(){t.composing||t.readFromDOMSoon()});function I(W){if(!x(W)||Ie(r,W))return;if(r.somethingSelected())Qi({lineWise:!1,text:r.getSelections()}),W.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var K=Es(r);Qi({lineWise:!0,text:K.text}),W.type=="cut"&&r.operation(function(){r.setSelections(K.ranges,0,fe),r.replaceSelection("",null,"cut")})}else return;if(W.clipboardData){W.clipboardData.clearData();var X=Gr.text.join(`
`);if(W.clipboardData.setData("Text",X),W.clipboardData.getData("Text")==X){W.preventDefault();return}}var ne=Ts(),ae=ne.firstChild;r.display.lineSpace.insertBefore(ne,r.display.lineSpace.firstChild),ae.value=Gr.text.join(`
`);var he=document.activeElement;G(ae),setTimeout(function(){r.display.lineSpace.removeChild(ne),he.focus(),he==i&&n.showPrimarySelection()},50)}ge(i,"copy",I),ge(i,"cut",I)},Mt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Mt.prototype.prepareSelection=function(){var e=uo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Mt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Mt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Mt.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 x=Zi(t,e.anchorNode,e.anchorOffset),I=Zi(t,e.focusNode,e.focusOffset);if(x&&!x.bad&&I&&!I.bad&&dt(wr(x,I),r)==0&&dt(Ve(x,I),i)==0)return;var W=t.display.view,K=r.line>=t.display.viewFrom&&_s(t,r)||{node:W[0].measure.map[2],offset:0},X=i.line<t.display.viewTo&&_s(t,i);if(!X){var ne=W[W.length-1].measure,ae=ne.maps?ne.maps[ne.maps.length-1]:ne.map;X={node:ae[ae.length-1],offset:ae[ae.length-2]-ae[ae.length-3]}}if(!K||!X){e.removeAllRanges();return}var he=e.rangeCount&&e.getRangeAt(0),ce;try{ce=p(K.node,K.offset,X.offset,X.node)}catch(Oe){}ce&&(!L&&t.state.focused?(e.collapse(K.node,K.offset),ce.collapsed||(e.removeAllRanges(),e.addRange(ce))):(e.removeAllRanges(),e.addRange(ce)),he&&e.anchorNode==null?e.addRange(he):L&&this.startGracePeriod()),this.rememberSelection()},Mt.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)},Mt.prototype.showMultipleSelections=function(e){o(this.cm.display.cursorDiv,e.cursors),o(this.cm.display.selectionDiv,e.selection)},Mt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Mt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return v(this.div,t)},Mt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Mt.prototype.blur=function(){this.div.blur()},Mt.prototype.getField=function(){return this.div},Mt.prototype.supportsTouch=function(){return!0},Mt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():kr(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)},Mt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Mt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(d&&E&&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=Zi(t,e.anchorNode,e.anchorOffset),r=Zi(t,e.focusNode,e.focusOffset);n&&r&&kr(t,function(){br(t.doc,un(n,r),fe),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Mt.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=Fe(r.line-1,tt(e.doc,r.line-1).length)),i.ch==tt(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Fe(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var x,I,W;r.line==t.viewFrom||(x=xn(e,r.line))==0?(I=St(t.view[0].line),W=t.view[0].node):(I=St(t.view[x].line),W=t.view[x-1].node.nextSibling);var K=xn(e,i.line),X,ne;if(K==t.view.length-1?(X=t.viewTo-1,ne=t.lineDiv.lastChild):(X=St(t.view[K+1].line)-1,ne=t.view[K+1].node.previousSibling),!W)return!1;for(var ae=e.doc.splitLines(tu(e,W,ne,I,X)),he=Yt(e.doc,Fe(I,0),Fe(X,tt(e.doc,X).text.length));ae.length>1&&he.length>1;)if(Ee(ae)==Ee(he))ae.pop(),he.pop(),X--;else if(ae[0]==he[0])ae.shift(),he.shift(),I++;else break;for(var ce=0,Oe=0,Ne=ae[0],Xe=he[0],Ze=Math.min(Ne.length,Xe.length);ce<Ze&&Ne.charCodeAt(ce)==Xe.charCodeAt(ce);)++ce;for(var rt=Ee(ae),Je=Ee(he),it=Math.min(rt.length-(ae.length==1?ce:0),Je.length-(he.length==1?ce:0));Oe<it&&rt.charCodeAt(rt.length-Oe-1)==Je.charCodeAt(Je.length-Oe-1);)++Oe;if(ae.length==1&&he.length==1&&I==r.line)for(;ce&&ce>r.ch&&rt.charCodeAt(rt.length-Oe-1)==Je.charCodeAt(Je.length-Oe-1);)ce--,Oe++;ae[ae.length-1]=rt.slice(0,rt.length-Oe).replace(/^\u200b+/,""),ae[0]=ae[0].slice(ce).replace(/\u200b+$/,"");var mt=Fe(I,ce),ft=Fe(X,he.length?Ee(he).length-Oe:0);if(ae.length>1||ae[0]||dt(mt,ft))return Hn(e.doc,ae,mt,ft,"+input"),!0},Mt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Mt.prototype.reset=function(){this.forceCompositionEnd()},Mt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Mt.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)},Mt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&kr(this.cm,function(){return Ar(e.cm)})},Mt.prototype.setUneditable=function(e){e.contentEditable="false"},Mt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||lr(this.cm,Ia)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Mt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Mt.prototype.onContextMenu=function(){},Mt.prototype.resetPosition=function(){},Mt.prototype.needsContentAttribute=!0;function _s(e,t){var n=ia(e,t.line);if(!n||n.hidden)return null;var r=tt(e.doc,t.line),i=Qa(n,r,t.line),x=Ke(r,e.doc.direction),I="left";if(x){var W=We(x,t.ch);I=W%2?"right":"left"}var K=$a(i.map,t.ch,I);return K.offset=K.collapse=="right"?K.end:K.start,K}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Xn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var x="",I=!1,W=e.doc.lineSeparator(),K=!1;function X(ce){return function(Oe){return Oe.id==ce}}function ne(){I&&(x+=W,K&&(x+=W),I=K=!1)}function ae(ce){ce&&(ne(),x+=ce)}function he(ce){if(ce.nodeType==1){var Oe=ce.getAttribute("cm-text");if(Oe){ae(Oe);return}var Ne=ce.getAttribute("cm-marker"),Xe;if(Ne){var Ze=e.findMarks(Fe(r,0),Fe(i+1,0),X(+Ne));Ze.length&&(Xe=Ze[0].find(0))&&ae(Yt(e.doc,Xe.from,Xe.to).join(W));return}if(ce.getAttribute("contenteditable")=="false")return;var rt=/^(pre|div|p|li|table|br)$/i.test(ce.nodeName);if(!/^br$/i.test(ce.nodeName)&&ce.textContent.length==0)return;rt&&ne();for(var Je=0;Je<ce.childNodes.length;Je++)he(ce.childNodes[Je]);/^(pre|p)$/i.test(ce.nodeName)&&(K=!0),rt&&(I=!0)}else ce.nodeType==3&&ae(ce.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(he(t),t==n);)t=t.nextSibling,K=!1;return x}function Zi(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Xn(e.clipPos(Fe(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 x=e.display.view[i];if(x.node==r)return ru(x,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!v(r,t))return Xn(Fe(St(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var x=e.rest?Ee(e.rest):e.line;return Xn(Fe(St(x),x.text.length),i)}var I=t.nodeType==3?t:null,W=t;for(!I&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(I=t.firstChild,n&&(n=I.nodeValue.length));W.parentNode!=r;)W=W.parentNode;var K=e.measure,X=K.maps;function ne(Xe,Ze,rt){for(var Je=-1;Je<(X?X.length:0);Je++)for(var it=Je<0?K.map:X[Je],mt=0;mt<it.length;mt+=3){var ft=it[mt+2];if(ft==Xe||ft==Ze){var Tt=St(Je<0?e.line:e.rest[Je]),It=it[mt]+rt;return(rt<0||ft!=Xe)&&(It=it[mt+(rt?1:0)]),Fe(Tt,It)}}}var ae=ne(I,W,n);if(ae)return Xn(ae,i);for(var he=W.nextSibling,ce=I?I.nodeValue.length-n:0;he;he=he.nextSibling){if(ae=ne(he,he.firstChild,0),ae)return Xn(Fe(ae.line,ae.ch-ce),i);ce+=he.textContent.length}for(var Oe=W.previousSibling,Ne=n;Oe;Oe=Oe.previousSibling){if(ae=ne(Oe,Oe.firstChild,-1),ae)return Xn(Fe(ae.line,ae.ch+Ne),i);Ne+=Oe.textContent.length}}var $t=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new $,this.hasSelection=!1,this.composing=null};$t.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),b&&(i.style.width="0px"),ge(i,"input",function(){F&&M>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),ge(i,"paste",function(I){if(Ie(r,I)||ys(I,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function x(I){if(Ie(r,I))return;if(r.somethingSelected())Qi({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var W=Es(r);Qi({lineWise:!0,text:W.text}),I.type=="cut"?r.setSelections(W.ranges,null,fe):(n.prevInput="",i.value=W.text.join(`
`),G(i))}else return;I.type=="cut"&&(r.state.cutIncoming=+new Date)}ge(i,"cut",x),ge(i,"copy",x),ge(e.scroller,"paste",function(I){if(en(e,I)||Ie(r,I))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var W=new Event("paste");W.clipboardData=I.clipboardData,i.dispatchEvent(W)}),ge(e.lineSpace,"selectstart",function(I){en(e,I)||Y(I)}),ge(i,"compositionstart",function(){var I=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:I,range:r.markText(I,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ge(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},$t.prototype.createField=function(e){this.wrapper=Ts(),this.textarea=this.wrapper.firstChild},$t.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},$t.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=uo(e);if(e.options.moveInputWithCursor){var i=Kr(e,n.sel.primary().head,"div"),x=t.wrapper.getBoundingClientRect(),I=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+I.top-x.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+I.left-x.left))}return r},$t.prototype.showSelection=function(e){var t=this.cm,n=t.display;o(n.cursorDiv,e.cursors),o(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},$t.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&&G(this.textarea),F&&M>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",F&&M>=9&&(this.hasSelection=null))},$t.prototype.getField=function(){return this.textarea},$t.prototype.supportsTouch=function(){return!1},$t.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!s||O()!=this.textarea))try{this.textarea.focus()}catch(e){}},$t.prototype.blur=function(){this.textarea.blur()},$t.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},$t.prototype.receivedFocus=function(){this.slowPoll()},$t.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()})},$t.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)},$t.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||st(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(F&&M>=9&&this.hasSelection===i||u&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var x=i.charCodeAt(0);if(x==8203&&!r&&(r="\u200B"),x==8666)return this.reset(),this.cm.execCommand("undo")}for(var I=0,W=Math.min(r.length,i.length);I<W&&r.charCodeAt(I)==i.charCodeAt(I);)++I;return kr(t,function(){Ia(t,i.slice(I),r.length-I,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},$t.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},$t.prototype.onKeyPress=function(){F&&M>=9&&(this.hasSelection=null),this.fastPoll()},$t.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var x=En(n,e),I=r.scroller.scrollTop;if(!x||w)return;var W=n.options.resetSelectionOnContextMenu;W&&n.doc.sel.contains(x)==-1&&lr(n,br)(n.doc,un(x),fe);var K=i.style.cssText,X=t.wrapper.style.cssText,ne=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-ne.top-5)+"px; left: "+(e.clientX-ne.left-5)+`px;
z-index: 1000; background: `+(F?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ae;D&&(ae=window.scrollY),r.input.focus(),D&&window.scrollTo(null,ae),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=ce,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function he(){if(i.selectionStart!=null){var Ne=n.somethingSelected(),Xe="\u200B"+(Ne?i.value:"");i.value="\u21DA",i.value=Xe,t.prevInput=Ne?"":"\u200B",i.selectionStart=1,i.selectionEnd=Xe.length,r.selForContextMenu=n.doc.sel}}function ce(){if(t.contextMenuPending!=ce)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=X,i.style.cssText=K,F&&M<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=I),i.selectionStart!=null){(!F||F&&M<9)&&he();var Ne=0,Xe=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?lr(n,Ho)(n):Ne++<10?r.detectingSelectAll=setTimeout(Xe,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Xe,200)}}if(F&&M>=9&&he(),C){q(e);var Oe=function(){He(window,"mouseup",Oe),setTimeout(ce,20)};ge(window,"mouseup",Oe)}else setTimeout(ce,50)},$t.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},$t.prototype.setUneditable=function(){},$t.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?N(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=O();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=W.getValue()}var i;if(e.form&&(ge(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var x=e.form;i=x.submit;try{var I=x.submit=function(){r(),x.submit=i,x.submit(),x.submit=I}}catch(K){}}t.finishInit=function(K){K.save=r,K.getTextArea=function(){return e},K.toTextArea=function(){K.toTextArea=isNaN,r(),e.parentNode.removeChild(K.getWrapperElement()),e.style.display="",e.form&&(He(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var W=Wt(function(K){return e.parentNode.insertBefore(K,e.nextSibling)},t);return W}function iu(e){e.off=He,e.on=ge,e.wheelEventPixels=cl,e.Doc=Lr,e.splitLines=yt,e.countColumn=V,e.findColumn=me,e.isWordChar=we,e.Pass=_e,e.signal=xe,e.Line=sr,e.changeEnd=dn,e.scrollbarModel=yo,e.Pos=Fe,e.cmpPos=dt,e.modes=Dt,e.mimeModes=pt,e.resolveMode=Gt,e.getMode=Vt,e.modeExtensions=Xt,e.extendMode=Pr,e.copyState=Ht,e.startState=jt,e.innerMode=kt,e.commands=Ei,e.keyMap=tn,e.keyName=is,e.isModifierKey=rs,e.lookupKey=zn,e.normalizeKeyMap=Ml,e.StringStream=Ot,e.SharedTextMarker=vi,e.TextMarker=fn,e.LineWidget=gi,e.e_preventDefault=Y,e.e_stopPropagation=Q,e.e_stop=q,e.addClass=U,e.contains=v,e.rmClass=f,e.keyNames=hn}Ql(Wt),ql(Wt);var au="iter insert remove copy getEditor constructor".split(" ");for(var Ji in Lr.prototype)Lr.prototype.hasOwnProperty(Ji)&&ie(au,Ji)<0&&(Wt.prototype[Ji]=function(e){return function(){return e.apply(this.doc,arguments)}}(Lr.prototype[Ji]));return ee(Lr),Wt.inputStyles={textarea:$t,contenteditable:Mt},Wt.defineMode=function(e){!Wt.defaults.mode&&e!="null"&&(Wt.defaults.mode=e),Nt.apply(this,arguments)},Wt.defineMIME=rr,Wt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Wt.defineMIME("text/plain","null"),Wt.defineExtension=function(e,t){Wt.prototype[e]=t},Wt.defineDocExtension=function(e,t){Lr.prototype[e]=t},Wt.fromTextArea=nu,iu(Wt),Wt.version="5.58.2",Wt})},Y1PL:function(ut,$e,J){"use strict";J.r($e),J.d($e,"ResizableTextArea",function(){return ie});var re=J("wx14"),z=J("1OyB"),L=J("vuIU"),H=J("Ji7U"),k=J("LK+K"),P=J("q1tI"),F=J("VTBJ"),M=J("rePB"),D=J("Zm9Q"),R=J("Kwbf"),E=J("c+Xe"),w=J("m+aA"),T=J("bdgK"),A=new Map;function _(fe){fe.forEach(function(Se){var be,me=Se.target;(be=A.get(me))===null||be===void 0||be.forEach(function(le){return le(me)})})}var b=new T.default(_),d=null,s=null;function u(fe,Se){A.has(fe)||(A.set(fe,new Set),b.observe(fe)),A.get(fe).add(Se)}function l(fe,Se){A.has(fe)&&(A.get(fe).delete(Se),A.get(fe).size||(b.unobserve(fe),A.delete(fe)))}var S=function(fe){Object(H.a)(be,fe);var Se=Object(k.a)(be);function be(){return Object(z.a)(this,be),Se.apply(this,arguments)}return Object(L.a)(be,[{key:"render",value:function(){return this.props.children}}]),be}(P.Component),h=P.createContext(null);function g(fe){var Se=fe.children,be=fe.onBatchResize,me=P.useRef(0),le=P.useRef([]),ue=P.useContext(h),Ee=P.useCallback(function(Ge,Te,pe){me.current+=1;var Ae=me.current;le.current.push({size:Ge,element:Te,data:pe}),Promise.resolve().then(function(){Ae===me.current&&(be==null||be(le.current),le.current=[])}),ue==null||ue(Ge,Te,pe)},[be,ue]);return P.createElement(h.Provider,{value:Ee},Se)}function C(fe){var Se=fe.children,be=fe.disabled,me=P.useRef(null),le=P.useRef(null),ue=P.useContext(h),Ee=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Ge=P.isValidElement(Se)&&Object(E.c)(Se),Te=Ge?Se.ref:null,pe=P.useMemo(function(){return Object(E.a)(Te,me)},[Te,me]),Ae=P.useRef(fe);Ae.current=fe;var Ce=P.useCallback(function(we){var Be=Ae.current,Qe=Be.onResize,je=Be.data,De=we.getBoundingClientRect(),Pe=De.width,Le=De.height,Re=we.offsetWidth,Ue=we.offsetHeight,We=Math.floor(Pe),ke=Math.floor(Le);if(Ee.current.width!==We||Ee.current.height!==ke||Ee.current.offsetWidth!==Re||Ee.current.offsetHeight!==Ue){var Ke={width:We,height:ke,offsetWidth:Re,offsetHeight:Ue};Ee.current=Ke;var ze=Re===Math.round(Pe)?Pe:Re,ge=Ue===Math.round(Le)?Le:Ue,Ye=Object(F.a)(Object(F.a)({},Ke),{},{offsetWidth:ze,offsetHeight:ge});ue==null||ue(Ye,we,je),Qe&&Promise.resolve().then(function(){Qe(Ye,we)})}},[]);return P.useEffect(function(){var we=Object(w.a)(me.current)||Object(w.a)(le.current);return we&&!be&&u(we,Ce),function(){return l(we,Ce)}},[me.current,be]),P.createElement(S,{ref:le},Ge?P.cloneElement(Se,{ref:pe}):Se)}var y="rc-observer-key";function f(fe){var Se=fe.children,be=Object(D.a)(Se);return be.map(function(me,le){var ue=(me==null?void 0:me.key)||"".concat(y,"-").concat(le);return P.createElement(C,Object(re.a)({},fe,{key:ue}),me)})}f.Collection=g;var c=f,o=J("bT9E"),a=J("TSYQ"),m=J.n(a),p=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important
`,v=["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"],O={},U;function j(fe){var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,be=fe.getAttribute("id")||fe.getAttribute("data-reactid")||fe.getAttribute("name");if(Se&&O[be])return O[be];var me=window.getComputedStyle(fe),le=me.getPropertyValue("box-sizing")||me.getPropertyValue("-moz-box-sizing")||me.getPropertyValue("-webkit-box-sizing"),ue=parseFloat(me.getPropertyValue("padding-bottom"))+parseFloat(me.getPropertyValue("padding-top")),Ee=parseFloat(me.getPropertyValue("border-bottom-width"))+parseFloat(me.getPropertyValue("border-top-width")),Ge=v.map(function(pe){return"".concat(pe,":").concat(me.getPropertyValue(pe))}).join(";"),Te={sizingStyle:Ge,paddingSize:ue,borderSize:Ee,boxSizing:le};return Se&&be&&(O[be]=Te),Te}function G(fe){var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,be=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,me=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;U||(U=document.createElement("textarea"),U.setAttribute("tab-index","-1"),U.setAttribute("aria-hidden","true"),document.body.appendChild(U)),fe.getAttribute("wrap")?U.setAttribute("wrap",fe.getAttribute("wrap")):U.removeAttribute("wrap");var le=j(fe,Se),ue=le.paddingSize,Ee=le.borderSize,Ge=le.boxSizing,Te=le.sizingStyle;U.setAttribute("style","".concat(Te,";").concat(p)),U.value=fe.value||fe.placeholder||"";var pe=Number.MIN_SAFE_INTEGER,Ae=Number.MAX_SAFE_INTEGER,Ce=U.scrollHeight,we;if(Ge==="border-box"?Ce+=Ee:Ge==="content-box"&&(Ce-=ue),be!==null||me!==null){U.value=" ";var Be=U.scrollHeight-ue;be!==null&&(pe=Be*be,Ge==="border-box"&&(pe=pe+ue+Ee),Ce=Math.max(pe,Ce)),me!==null&&(Ae=Be*me,Ge==="border-box"&&(Ae=Ae+ue+Ee),we=Ce>Ae?"":"hidden",Ce=Math.min(Ae,Ce))}return{height:Ce,minHeight:pe,maxHeight:Ae,overflowY:we,resize:"none"}}var B=J("Gytx"),N=J.n(B),V;(function(fe){fe[fe.NONE=0]="NONE",fe[fe.RESIZING=1]="RESIZING",fe[fe.RESIZED=2]="RESIZED"})(V||(V={}));var $=function(fe){Object(H.a)(be,fe);var Se=Object(k.a)(be);function be(me){var le;return Object(z.a)(this,be),le=Se.call(this,me),le.nextFrameActionId=void 0,le.resizeFrameId=void 0,le.textArea=void 0,le.saveTextArea=function(ue){le.textArea=ue},le.handleResize=function(ue){var Ee=le.state.resizeStatus,Ge=le.props,Te=Ge.autoSize,pe=Ge.onResize;if(Ee!==V.NONE)return;typeof pe=="function"&&pe(ue),Te&&le.resizeOnNextFrame()},le.resizeOnNextFrame=function(){cancelAnimationFrame(le.nextFrameActionId),le.nextFrameActionId=requestAnimationFrame(le.resizeTextarea)},le.resizeTextarea=function(){var ue=le.props.autoSize;if(!ue||!le.textArea)return;var Ee=ue.minRows,Ge=ue.maxRows,Te=G(le.textArea,!1,Ee,Ge);le.setState({textareaStyles:Te,resizeStatus:V.RESIZING},function(){cancelAnimationFrame(le.resizeFrameId),le.resizeFrameId=requestAnimationFrame(function(){le.setState({resizeStatus:V.RESIZED},function(){le.resizeFrameId=requestAnimationFrame(function(){le.setState({resizeStatus:V.NONE}),le.fixFirefoxAutoScroll()})})})})},le.renderTextArea=function(){var ue=le.props,Ee=ue.prefixCls,Ge=Ee===void 0?"rc-textarea":Ee,Te=ue.autoSize,pe=ue.onResize,Ae=ue.className,Ce=ue.disabled,we=le.state,Be=we.textareaStyles,Qe=we.resizeStatus,je=Object(o.a)(le.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),De=m()(Ge,Ae,Object(M.a)({},"".concat(Ge,"-disabled"),Ce));"value"in je&&(je.value=je.value||"");var Pe=Object(F.a)(Object(F.a)(Object(F.a)({},le.props.style),Be),Qe===V.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(c,{onResize:le.handleResize,disabled:!(Te||pe)},P.createElement("textarea",Object(re.a)({},je,{className:De,style:Pe,ref:le.saveTextArea})))},le.state={textareaStyles:{},resizeStatus:V.NONE},le}return Object(L.a)(be,[{key:"componentDidUpdate",value:function(le){(le.value!==this.props.value||!N()(le.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 le=this.textArea.selectionStart,ue=this.textArea.selectionEnd;this.textArea.setSelectionRange(le,ue)}}catch(Ee){}}},{key:"render",value:function(){return this.renderTextArea()}}]),be}(P.Component),ie=$,oe=function(fe){Object(H.a)(be,fe);var Se=Object(k.a)(be);function be(me){var le;Object(z.a)(this,be),le=Se.call(this,me),le.resizableTextArea=void 0,le.focus=function(){le.resizableTextArea.textArea.focus()},le.saveTextArea=function(Ee){le.resizableTextArea=Ee},le.handleChange=function(Ee){var Ge=le.props.onChange;le.setValue(Ee.target.value,function(){le.resizableTextArea.resizeTextarea()}),Ge&&Ge(Ee)},le.handleKeyDown=function(Ee){var Ge=le.props,Te=Ge.onPressEnter,pe=Ge.onKeyDown;Ee.keyCode===13&&Te&&Te(Ee),pe&&pe(Ee)};var ue=typeof me.value=="undefined"||me.value===null?me.defaultValue:me.value;return le.state={value:ue},le}return Object(L.a)(be,[{key:"setValue",value:function(le,ue){"value"in this.props||this.setState({value:le},ue)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(ie,Object(re.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(le){return"value"in le?{value:le.value}:null}}]),be}(P.Component),_e=$e.default=oe},ZW9T:function(ut,$e,J){"use strict";J.d($e,"a",function(){return S});var re=J("k1fw"),z=J("miYZ"),L=J("tsqr"),H=J("rAM+"),k=J("tJVT"),P=J("PpiC"),F=J("q1tI"),M=J.n(F),D=J("bdgK");function R(h,g,C,y,f){var c=g.getWordUntilPosition(C),o={startLineNumber:C.lineNumber,endLineNumber:C.lineNumber,startColumn:c.startColumn,endColumn:c.endColumn},a=y.map(function(m){return{label:m,kind:h.languages.CompletionItemKind.Keyword,insertText:m,insertTextRules:h.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:o}});return f.map(function(m){a.push(Object(re.a)(Object(re.a)({},m),{},{range:o}))}),a}var E=function(h){var g={label:"ifelse",kind:h.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:h.languages.CompletionItemInsertTextRule.InsertAsSnippet},C=["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"];h.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(o,a){var m=R(h,o,a,C,[g]);return{suggestions:m}}});var y=["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"];h.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(o,a){var m=[{label:"print",kind:h.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:h.languages.CompletionItemInsertTextRule.InsertAsSnippet}],p=R(h,o,a,y,m);return{suggestions:p}}});var f=["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"];h.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(o,a){var m=[g,{label:"main",kind:h.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
`),insertTextRules:h.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:h.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
`),insertTextRules:h.languages.CompletionItemInsertTextRule.InsertAsSnippet}],p=R(h,o,a,f,m);return{suggestions:p}}})},w="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",T=J("LvDl");function A(h){return/^\d+$/.test(h)?"".concat(h,"px"):h}function _(){}var b=!1,d={"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 s(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],g=h;if(Array.isArray(h)){for(var C=0;C<h.length;C++){var y=d[h[C]];if(y)return y}return g[0]}return d[g]||g}var u=null,l=$e.b=function(h){var g=h.width,C=g===void 0?"100%":g,y=h.height,f=y===void 0?"100%":y,c=h.value,o=h.language,a=o===void 0?"javascript":o,m=h.style,p=m===void 0?{}:m,v=h.options,O=v===void 0?{}:v,U=h.overrideServices,j=U===void 0?{}:U,G=h.theme,B=G===void 0?"vs-dark":G,N=h.onEditBlur,V=h.onSave,$=h.autoHeight,ie=$===void 0?!1:$,oe=h.forbidCopy,_e=oe===void 0?!1:oe,fe=h.onChange,Se=fe===void 0?_:fe,be=h.editorDidMount,me=be===void 0?_:be,le=h.onFocus,ue=le===void 0?_:le,Ee=h.filename,Ge=Ee===void 0?"educoder.txt":Ee,Te=Object(P.a)(h,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),pe=Object(F.useRef)(),Ae=Object(F.useRef)({}),Ce=Object(F.useRef)(),we=Object(F.useRef)(!1),Be=Object(F.useRef)(),Qe=Object(F.useState)(!1),je=Object(k.a)(Qe,2),De=je[0],Pe=je[1];function Le(){var Z;return pe.current&&(Z=new D.default(function(q){var de=Object(H.a)(q),ye;try{for(de.s();!(ye=de.n()).done;){var Me=ye.value;(Me.target.offsetHeight>0||Me.target.offsetWidth>0)&&Ae.current.instance.layout()}}catch(et){de.e(et)}finally{de.f()}}),Z.observe(pe.current)),Z}function Re(){L.b.warn(decodeURIComponent(w))}var Ue=function(){var q=Ae.current.instance;if(c!=null&&q&&De){var de=q.getModel();de&&c!==de.getValue()&&(b=!0,de.setValue(c),q.layout(),b=!1)}};Object(F.useEffect)(function(){Ce.current&&clearTimeout(Ce.current),Ce.current=setTimeout(function(){Ue()},500)},[c,De,Ae.current]);function We(){var Z=Ae.current.instance;if(Z){var q=Z.getSelection(),de=Ae.current.pastePos||{},ye=new u.Range(de.startLineNumber||q.endLineNumber,de.startColumn||q.endColumn,de.endLineNumber||q.endLineNumber,de.endColumn||q.endColumn);setTimeout(function(){Z.executeEdits("",[{range:ye,text:""}])},300)}}function ke(Z){(window.navigator.platform.match("Mac")?Z.metaKey:Z.ctrlKey)&&Z.keyCode==83&&(Z.preventDefault(),V())}var Ke=function(){if(ie&&Ae.current.instance){var q=Ae.current.instance.getContentHeight();Y(q<f?f:q)}else Y(f)};function ze(Z){var q=document.createEvent("MouseEvents");q.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Z.dispatchEvent(q)}function ge(Z,q){var de=window.URL||window.webkitURL||window,ye=new Blob([q]),Me=document.createElementNS("http://www.w3.org/1999/xhtml","a");Me.href=de.createObjectURL(ye),Me.download=Z,ze(Me)}Object(F.useEffect)(function(){Ke()},[Ke]),Object(F.useEffect)(function(){pe.current&&!De&&J.e(26).then(J.t.bind(null,"M/lh",7)).then(function(Z){try{u=Z,Ae.current.instance=u.editor.create(pe.current,{value:c,language:s(a),theme:B,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},j);var q=Ae.current.instance;if(me(q,u),setTimeout(function(){Ke(),Ae.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){ge(Ge||"educoder.txt",q.getValue())}})},500),Ae.current.subscription=q.onDidChangeModelContent(function(ye){we.current?clearTimeout(Be.current):(Ke(),Se(q.getValue(),ye)),Be.current=setTimeout(function(){we.current=!1},500)}),window.Monaco||E(u),_e&&(q.addCommand(u.KeyMod.CtrlCmd|u.KeyMod.Shift|u.KeyCode.KEY_V,function(){return Re(),null}),q.addCommand(u.KeyMod.CtrlCmd|u.KeyCode.KEY_C,function(){return Re(),null})),window.Monaco=u,N&&q.onDidBlurEditorWidget(function(){N(q.getValue())}),ue&&q.onDidFocusEditorText(function(){ue(q.getValue())}),_e){q.addCommand(u.KeyMod.CtrlCmd|u.KeyCode.KEY_V,function(){return Re(),null}),q.onDidPaste(function(ye){Ae.current.pastePos=ye});try{window.addEventListener("paste",We)}catch(ye){}}var de=Le();return Pe(!0),function(){var ye=Ae.current.instance;ye.dispose();var Me=ye.getModel();Me&&Me.dispose(),Ae.current.subscription&&Ae.current.subscription.dispose(),_e&&window.removeEventListener("paste",We),de.unobserve(pe.current)}}catch(ye){}})},[]),Object(F.useEffect)(function(){var Z=Ae.current.instance;if(Z&&De)return document.addEventListener("keydown",ke,!1),function(){document.removeEventListener("keydown",ke)}},[V,De]),Object(F.useEffect)(function(){var Z=Ae.current.instance;if(Z&&De){var q=s(a);u.editor.setModelLanguage(Z.getModel(),q),console.log("language:",a,Z.getModel(),q)}},[a,De]),Object(F.useEffect)(function(){var Z=Ae.current.instance;Z&&De&&u.editor.setTheme(B)},[B,De]),Object(F.useEffect)(function(){var Z=Ae.current.instance;Z&&De&&(Z.updateOptions(Object(re.a)({},O)),setTimeout(function(){Z.getModel().updateOptions(Object(re.a)({},O))},200))},[JSON.stringify(O),De]),Object(F.useEffect)(function(){var Z=Ae.current.instance;Z&&De&&Z.layout()},[C,f,De]);var Ye=Object(F.useState)(A(C)),He=Object(k.a)(Ye,2),xe=He[0],Ie=He[1],se=Object(F.useState)(A(f)),te=Object(k.a)(se,2),ee=te[0],Y=te[1],Q=Object(re.a)(Object(re.a)({},p),{},{width:xe,height:ee});return M.a.createElement("div",{className:"my-monaco-editor",ref:pe,style:Q})};function S(h){var g=h.width,C=g===void 0?"100%":g,y=h.height,f=y===void 0?"100%":y,c=h.original,o=h.modified,a=h.language,m=h.options,p=m===void 0?{}:m,v=Object(F.useRef)(),O=Object(F.useState)(null),U=Object(k.a)(O,2),j=U[0],G=U[1];function B(ie){var oe;return v.current&&(oe=new D.default(function(_e){var fe=Object(H.a)(_e),Se;try{for(fe.s();!(Se=fe.n()).done;){var be=Se.value;(be.target.offsetHeight>0||be.target.offsetWidth>0)&&ie.layout()}}catch(me){fe.e(me)}finally{fe.f()}}),oe.observe(v.current)),oe}Object(F.useEffect)(function(){v.current&&J.e(26).then(J.t.bind(null,"M/lh",7)).then(function(ie){u=ie;var oe=u.editor.createDiffEditor(v.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},p),{},{wordWrap:!0}));G(oe);var _e=B(oe);return function(){oe.dispose();var fe=oe.getModel();fe&&fe.dispose(),_e.unobserve(v.current)}})},[]),Object(F.useEffect)(function(){j&&j.setModel({original:u.editor.createModel(c,a),modified:u.editor.createModel(o,a)})},[c,o,a,j]);var N=A(C),V=A(f),$={width:N,height:V};return M.a.createElement("div",{className:"my-diff-editor",ref:v,style:$})}},ZpRC:function(ut,$e,J){"use strict";function re(E){return typeof E=="object"&&E!=null&&E.nodeType===1}function z(E,w){return(!w||E!=="hidden")&&E!=="visible"&&E!=="clip"}function L(E,w){if(E.clientHeight<E.scrollHeight||E.clientWidth<E.scrollWidth){var T=getComputedStyle(E,null);return z(T.overflowY,w)||z(T.overflowX,w)||function(A){var _=function(b){if(!b.ownerDocument||!b.ownerDocument.defaultView)return null;try{return b.ownerDocument.defaultView.frameElement}catch(d){return null}}(A);return!!_&&(_.clientHeight<A.scrollHeight||_.clientWidth<A.scrollWidth)}(E)}return!1}function H(E,w,T,A,_,b,d,s){return b<E&&d>w||b>E&&d<w?0:b<=E&&s<=T||d>=w&&s>=T?b-E-A:d>w&&s<T||b<E&&s>T?d-w+_:0}var k=function(E,w){var T=window,A=w.scrollMode,_=w.block,b=w.inline,d=w.boundary,s=w.skipOverflowHiddenElements,u=typeof d=="function"?d:function(Be){return Be!==d};if(!re(E))throw new TypeError("Invalid target");for(var l=document.scrollingElement||document.documentElement,S=[],h=E;re(h)&&u(h);){if((h=h.parentElement)===l){S.push(h);break}h!=null&&h===document.body&&L(h)&&!L(document.documentElement)||h!=null&&L(h,s)&&S.push(h)}for(var g=T.visualViewport?T.visualViewport.width:innerWidth,C=T.visualViewport?T.visualViewport.height:innerHeight,y=window.scrollX||pageXOffset,f=window.scrollY||pageYOffset,c=E.getBoundingClientRect(),o=c.height,a=c.width,m=c.top,p=c.right,v=c.bottom,O=c.left,U=_==="start"||_==="nearest"?m:_==="end"?v:m+o/2,j=b==="center"?O+a/2:b==="end"?p:O,G=[],B=0;B<S.length;B++){var N=S[B],V=N.getBoundingClientRect(),$=V.height,ie=V.width,oe=V.top,_e=V.right,fe=V.bottom,Se=V.left;if(A==="if-needed"&&m>=0&&O>=0&&v<=C&&p<=g&&m>=oe&&v<=fe&&O>=Se&&p<=_e)return G;var be=getComputedStyle(N),me=parseInt(be.borderLeftWidth,10),le=parseInt(be.borderTopWidth,10),ue=parseInt(be.borderRightWidth,10),Ee=parseInt(be.borderBottomWidth,10),Ge=0,Te=0,pe="offsetWidth"in N?N.offsetWidth-N.clientWidth-me-ue:0,Ae="offsetHeight"in N?N.offsetHeight-N.clientHeight-le-Ee:0;if(l===N)Ge=_==="start"?U:_==="end"?U-C:_==="nearest"?H(f,f+C,C,le,Ee,f+U,f+U+o,o):U-C/2,Te=b==="start"?j:b==="center"?j-g/2:b==="end"?j-g:H(y,y+g,g,me,ue,y+j,y+j+a,a),Ge=Math.max(0,Ge+f),Te=Math.max(0,Te+y);else{Ge=_==="start"?U-oe-le:_==="end"?U-fe+Ee+Ae:_==="nearest"?H(oe,fe,$,le,Ee+Ae,U,U+o,o):U-(oe+$/2)+Ae/2,Te=b==="start"?j-Se-me:b==="center"?j-(Se+ie/2)+pe/2:b==="end"?j-_e+ue+pe:H(Se,_e,ie,me,ue+pe,j,j+a,a);var Ce=N.scrollLeft,we=N.scrollTop;U+=we-(Ge=Math.max(0,Math.min(we+Ge,N.scrollHeight-$+Ae))),j+=Ce-(Te=Math.max(0,Math.min(Ce+Te,N.scrollWidth-ie+pe)))}G.push({el:N,top:Ge,left:Te})}return G};function P(E){return E===Object(E)&&Object.keys(E).length!==0}function F(E,w){w===void 0&&(w="auto");var T="scrollBehavior"in document.body.style;E.forEach(function(A){var _=A.el,b=A.top,d=A.left;_.scroll&&T?_.scroll({top:b,left:d,behavior:w}):(_.scrollTop=b,_.scrollLeft=d)})}function M(E){return E===!1?{block:"end",inline:"nearest"}:P(E)?E:{block:"start",inline:"nearest"}}function D(E,w){var T=!E.ownerDocument.documentElement.contains(E);if(P(w)&&typeof w.behavior=="function")return w.behavior(T?[]:k(E,w));if(T)return;var A=M(w);return F(k(E,A),A.behavior)}var R=$e.a=D},bT9E:function(ut,$e,J){"use strict";J.d($e,"a",function(){return z});var re=J("VTBJ");function z(L,H){var k=Object(re.a)({},L);return Array.isArray(H)&&H.forEach(function(P){delete k[P]}),k}},c5Ni:function(ut,$e,J){},dejd:function(ut,$e,J){},dmUQ:function(ut,$e,J){"use strict";var re=J("Ff2n"),z=J("rePB"),L=J("1OyB"),H=J("vuIU"),k=J("Ji7U"),P=J("md7G"),F=J("foSv"),M=J("q1tI"),D=J.n(M),R=J("TSYQ"),E=J.n(R),w=J("4IlW");function T(o,a){var m=Object.keys(o);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(o);a&&(p=p.filter(function(v){return Object.getOwnPropertyDescriptor(o,v).enumerable})),m.push.apply(m,p)}return m}function A(o){for(var a=1;a<arguments.length;a++){var m=arguments[a]!=null?arguments[a]:{};a%2?T(Object(m),!0).forEach(function(p){Object(z.a)(o,p,m[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(m)):T(Object(m)).forEach(function(p){Object.defineProperty(o,p,Object.getOwnPropertyDescriptor(m,p))})}return o}function _(o){var a=b();return function(){var p=Object(F.a)(o),v;if(a){var O=Object(F.a)(this).constructor;v=Reflect.construct(p,arguments,O)}else v=p.apply(this,arguments);return Object(P.a)(this,v)}}function b(){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(o){return!1}}function d(){}function s(o){o.preventDefault()}var u=function(a){return a.replace(/[^\w.-]+/g,"")},l=200,S=600,h=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,g=function(a){return a!=null},C=function(a,m){return m===a||typeof m=="number"&&typeof a=="number"&&isNaN(m)&&isNaN(a)},y=function(o){Object(k.a)(m,o);var a=_(m);function m(p){var v;Object(L.a)(this,m),v=a.call(this,p),v.onKeyDown=function(j){var G=v.props,B=G.onKeyDown,N=G.onPressEnter;if(j.keyCode===w.a.UP){var V=v.getRatio(j);v.up(j,V,null),v.stop()}else if(j.keyCode===w.a.DOWN){var $=v.getRatio(j);v.down(j,$,null),v.stop()}else j.keyCode===w.a.ENTER&&N&&N(j);if(v.recordCursorPosition(),v.lastKeyCode=j.keyCode,B){for(var ie=arguments.length,oe=new Array(ie>1?ie-1:0),_e=1;_e<ie;_e++)oe[_e-1]=arguments[_e];B.apply(void 0,[j].concat(oe))}},v.onKeyUp=function(j){var G=v.props.onKeyUp;if(v.stop(),v.recordCursorPosition(),G){for(var B=arguments.length,N=new Array(B>1?B-1:0),V=1;V<B;V++)N[V-1]=arguments[V];G.apply(void 0,[j].concat(N))}},v.onChange=function(j){var G=v.props.onChange;v.state.focused&&(v.inputting=!0),v.rawInput=v.props.parser(v.getValueFromEvent(j)),v.setState({inputValue:v.rawInput}),G(v.toNumber(v.rawInput))},v.onMouseUp=function(){var j=v.props.onMouseUp;v.recordCursorPosition(),j&&j.apply(void 0,arguments)},v.onFocus=function(){var j;v.setState({focused:!0}),(j=v.props).onFocus.apply(j,arguments)},v.onBlur=function(){var j=v.props.onBlur;v.inputting=!1,v.setState({focused:!1});var G=v.getCurrentValidValue(v.state.inputValue),B=v.setValue(G,d);if(j){var N=v.input.value,V=v.getInputDisplayValue({focus:!1,value:B});v.input.value=V&&Number(V),j.apply(void 0,arguments),v.input.value=N}},v.getRatio=function(j){var G=1;return j.metaKey||j.ctrlKey?G=.1:j.shiftKey&&(G=10),G},v.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},v.getPrecision=function(j){if(g(v.props.precision))return v.props.precision;var G=String(j);if(G.indexOf("e-")>=0)return parseInt(G.slice(G.indexOf("e-")+2),10);var B=0;return G.indexOf(".")>=0&&(B=G.length-G.indexOf(".")-1),B},v.getInputDisplayValue=function(j){var G=j||v.state,B=G.focused,N=G.inputValue,V=G.value,$;B?$=N:$=v.toPrecisionAsStep(V),$==null&&($="");var ie=v.formatWrapper($);return g(v.props.decimalSeparator)&&(ie=ie.toString().replace(".",v.props.decimalSeparator)),ie},v.recordCursorPosition=function(){try{v.cursorStart=v.input.selectionStart,v.cursorEnd=v.input.selectionEnd,v.currentValue=v.input.value,v.cursorBefore=v.input.value.substring(0,v.cursorStart),v.cursorAfter=v.input.value.substring(v.cursorEnd)}catch(j){}},v.restoreByAfter=function(j){if(j===void 0)return!1;var G=v.input.value,B=G.lastIndexOf(j);if(B===-1)return!1;var N=v.cursorBefore.length;return v.lastKeyCode===w.a.DELETE&&v.cursorBefore.charAt(N-1)===j[0]?(v.fixCaret(N,N),!0):B+j.length===G.length?(v.fixCaret(B,B),!0):!1},v.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(G,B){var N=j.substring(B);return v.restoreByAfter(N)})},v.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},v.stop=function(){v.autoStepTimer&&clearTimeout(v.autoStepTimer)},v.down=function(j,G,B){v.pressingUpOrDown=!0,v.step("down",j,G,B)},v.up=function(j,G,B){v.pressingUpOrDown=!0,v.step("up",j,G,B)},v.saveInput=function(j){v.input=j};var O=p.value;O===void 0&&(O=p.defaultValue),v.state={focused:p.autoFocus};var U=v.getValidValue(v.toNumber(O));return v.state=A(A({},v.state),{},{inputValue:v.toPrecisionAsStep(U),value:U}),v}return Object(H.a)(m,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(v){var O=this.props,U=O.value,j=O.onChange,G=O.max,B=O.min,N=this.state.focused;if(v){if(!C(v.value,U)||!C(v.max,G)||!C(v.min,B)){var V=N?U:this.getValidValue(U),$;this.pressingUpOrDown?$=V:this.inputting?$=this.rawInput:$=this.toPrecisionAsStep(V),this.setState({value:V,inputValue:$})}var ie="value"in this.props?U:this.state.value;"max"in this.props&&v.max!==G&&typeof ie=="number"&&ie>G&&j&&j(G),"min"in this.props&&v.min!==B&&typeof ie=="number"&&ie<B&&j&&j(B)}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===w.a.BACKSPACE?oe=this.cursorStart-1:this.lastKeyCode===w.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 w.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case w.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(_e){}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(v){var O=v;return O===""?O="":this.isNotCompleteNumber(parseFloat(O))?O=this.state.value:O=this.getValidValue(O),this.toNumber(O)}},{key:"getValueFromEvent",value:function(v){var O=v.target.value.trim().replace(/。/g,".");return g(this.props.decimalSeparator)&&(O=O.replace(this.props.decimalSeparator,".")),O}},{key:"getValidValue",value:function(v){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,j=parseFloat(v);return isNaN(j)?v:(j<O&&(j=O),j>U&&(j=U),j)}},{key:"setValue",value:function(v,O){var U=this.props.precision,j=this.isNotCompleteNumber(parseFloat(v))?null:parseFloat(v),G=this.state.value,B=G===void 0?null:G,N=this.state.inputValue,V=N===void 0?null:N,$=typeof j=="number"?j.toFixed(U):"".concat(j),ie=j!==B||$!=="".concat(V);return"value"in this.props?(V=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:V},O)):this.setState({value:j,inputValue:this.toPrecisionAsStep(v)},O),ie&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(v){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.props,j=U.precision,G=U.step;if(g(j))return j;var B=this.getPrecision(O),N=this.getPrecision(G),V=this.getPrecision(v);return v?Math.max(V,B+N):B+N}},{key:"getPrecisionFactor",value:function(v){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.getMaxPrecision(v,O);return Math.pow(10,U)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(v){return this.props.formatter?this.props.formatter(v):v}},{key:"toPrecisionAsStep",value:function(v){if(this.isNotCompleteNumber(v)||v==="")return v;var O=Math.abs(this.getMaxPrecision(v));return isNaN(O)?v.toString():Number(v).toFixed(O)}},{key:"toNumber",value:function(v){var O=this.props.precision,U=this.state.focused,j=v&&v.length>16&&U;return this.isNotCompleteNumber(v)||j?v:g(O)?Math.round(v*Math.pow(10,O))/Math.pow(10,O):Number(v)}},{key:"upStep",value:function(v,O){var U=this.props.step,j=this.getPrecisionFactor(v,O),G=Math.abs(this.getMaxPrecision(v,O)),B=((j*v+j*U*O)/j).toFixed(G);return this.toNumber(B)}},{key:"downStep",value:function(v,O){var U=this.props.step,j=this.getPrecisionFactor(v,O),G=Math.abs(this.getMaxPrecision(v,O)),B=((j*v-j*U*O)/j).toFixed(G);return this.toNumber(B)}},{key:"step",value:function(v,O){var U=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,G=arguments.length>3?arguments[3]:void 0;this.stop(),O&&(O.persist(),O.preventDefault());var B=this.props;if(B.disabled)return;var N=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(N))return;var V=this["".concat(v,"Step")](N,j),$=V>B.max||V<B.min;if(V>B.max?V=B.max:V<B.min&&(V=B.min),this.setValue(V,null),this.setState({focused:!0},function(){U.pressingUpOrDown=!1}),$)return;this.autoStepTimer=setTimeout(function(){U[v](O,j,!0)},G?l:S)}},{key:"fixCaret",value:function(v,O){if(v===void 0||O===void 0||!this.input||!this.input.value)return;try{var U=this.input.selectionStart,j=this.input.selectionEnd;(v!==U||O!==j)&&this.input.setSelectionRange(v,O)}catch(G){}}},{key:"render",value:function(){var v,O=this.props,U=O.prefixCls,j=O.disabled,G=O.readOnly,B=O.useTouch,N=O.autoComplete,V=O.upHandler,$=O.downHandler,ie=O.className,oe=O.max,_e=O.min,fe=O.style,Se=O.title,be=O.onMouseEnter,me=O.onMouseLeave,le=O.onMouseOver,ue=O.onMouseOut,Ee=O.required,Ge=O.onClick,Te=O.tabIndex,pe=O.type,Ae=O.placeholder,Ce=O.id,we=O.inputMode,Be=O.pattern,Qe=O.step,je=O.maxLength,De=O.autoFocus,Pe=O.name,Le=O.onPaste,Re=O.onInput,Ue=Object(re.a)(O,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),We=this.state,ke=We.value,Ke=We.focused,ze=E()(U,(v={},Object(z.a)(v,ie,!!ie),Object(z.a)(v,"".concat(U,"-disabled"),j),Object(z.a)(v,"".concat(U,"-focused"),Ke),v)),ge={};Object.keys(Ue).forEach(function(q){(q.substr(0,5)==="data-"||q.substr(0,5)==="aria-"||q==="role")&&(ge[q]=Ue[q])});var Ye=!G&&!j,He=this.getInputDisplayValue(null),xe=(ke||ke===0)&&(isNaN(ke)||Number(ke)>=oe),Ie=(ke||ke===0)&&(isNaN(ke)||Number(ke)<=_e),se=xe||j||G,te=Ie||j||G,ee=E()("".concat(U,"-handler"),"".concat(U,"-handler-up"),Object(z.a)({},"".concat(U,"-handler-up-disabled"),se)),Y=E()("".concat(U,"-handler"),"".concat(U,"-handler-down"),Object(z.a)({},"".concat(U,"-handler-down-disabled"),te)),Q=B?{onTouchStart:se?d:this.up,onTouchEnd:this.stop}:{onMouseDown:se?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},Z=B?{onTouchStart:te?d:this.down,onTouchEnd:this.stop}:{onMouseDown:te?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return D.a.createElement("div",{className:ze,style:fe,title:Se,onMouseEnter:be,onMouseLeave:me,onMouseOver:le,onMouseOut:ue,onFocus:function(){return null},onBlur:function(){return null}},D.a.createElement("div",{className:"".concat(U,"-handler-wrap")},D.a.createElement("span",Object.assign({unselectable:"on"},Q,{role:"button","aria-label":"Increase Value","aria-disabled":se,className:ee}),V||D.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-up-inner"),onClick:s})),D.a.createElement("span",Object.assign({unselectable:"on"},Z,{role:"button","aria-label":"Decrease Value","aria-disabled":te,className:Y}),$||D.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-down-inner"),onClick:s}))),D.a.createElement("div",{className:"".concat(U,"-input-wrap")},D.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":_e,"aria-valuemax":oe,"aria-valuenow":ke,required:Ee,type:pe,placeholder:Ae,onPaste:Le,onClick:Ge,onMouseUp:this.onMouseUp,className:"".concat(U,"-input"),tabIndex:Te,autoComplete:N,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Ye?this.onKeyDown:d,onKeyUp:Ye?this.onKeyUp:d,autoFocus:De,maxLength:je,readOnly:G,disabled:j,max:oe,min:_e,step:Qe,name:Pe,title:Se,id:Ce,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(He),pattern:Be,inputMode:we,onInput:Re},ge))))}}]),m}(D.a.Component);y.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:h,min:-h,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:u,required:!1,autoComplete:"off"};var f=y,c=$e.a=f},hLB0:function(ut,$e,J){},kSUc:function(ut,$e,J){},lZu9:function(ut,$e,J){(function(re){re(J("VrN/"),J("1eCo"),J("8EBN"))})(function(re){"use strict";re.defineMode("markdown",function(z,L){var H=re.getMode(z,"text/html"),k=H.name=="null";function P(B){if(re.findModeByName){var N=re.findModeByName(B);N&&(B=N.mime||N.mimes[0])}var V=re.getMode(z,B);return V.name=="null"?null:V}L.highlightFormatting===void 0&&(L.highlightFormatting=!1),L.maxBlockquoteDepth===void 0&&(L.maxBlockquoteDepth=0),L.taskLists===void 0&&(L.taskLists=!1),L.strikethrough===void 0&&(L.strikethrough=!1),L.emoji===void 0&&(L.emoji=!1),L.fencedCodeBlockHighlighting===void 0&&(L.fencedCodeBlockHighlighting=!0),L.fencedCodeBlockDefaultMode===void 0&&(L.fencedCodeBlockDefaultMode="text/plain"),L.xml===void 0&&(L.xml=!0),L.tokenTypeOverrides===void 0&&(L.tokenTypeOverrides={});var F={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 M in F)F.hasOwnProperty(M)&&L.tokenTypeOverrides[M]&&(F[M]=L.tokenTypeOverrides[M]);var D=/^([*\-_])(?:\s*\1){2,}\s*$/,R=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,E=/^\[(x| )\](?=\s)/i,w=L.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,T=/^ {0,3}(?:\={1,}|-{2,})\s*$/,A=/^[^#!\[\]*_\\<>` "'(~:]+/,_=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,b=/^\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]/,s=" ";function u(B,N,V){return N.f=N.inline=V,V(B,N)}function l(B,N,V){return N.f=N.block=V,V(B,N)}function S(B){return!B||!/\S/.test(B.string)}function h(B){if(B.linkTitle=!1,B.linkHref=!1,B.linkText=!1,B.em=!1,B.strong=!1,B.strikethrough=!1,B.quote=0,B.indentedCode=!1,B.f==C){var N=k;if(!N){var V=re.innerMode(H,B.htmlState);N=V.mode.name=="xml"&&V.state.tagStart===null&&!V.state.context&&V.state.tokenize.isInText}N&&(B.f=o,B.block=g,B.htmlState=null)}return B.trailingSpace=0,B.trailingSpaceNewLine=!1,B.prevLine=B.thisLine,B.thisLine={stream:null},null}function g(B,N){var V=B.column()===N.indentation,$=S(N.prevLine.stream),ie=N.indentedCode,oe=N.prevLine.hr,_e=N.list!==!1,fe=(N.listStack[N.listStack.length-1]||0)+3;N.indentedCode=!1;var Se=N.indentation;if(N.indentationDiff===null&&(N.indentationDiff=N.indentation,_e)){for(N.list=null;Se<N.listStack[N.listStack.length-1];)N.listStack.pop(),N.listStack.length?N.indentation=N.listStack[N.listStack.length-1]:N.list=!1;N.list!==!1&&(N.indentationDiff=Se-N.listStack[N.listStack.length-1])}var be=!$&&!oe&&!N.prevLine.header&&(!_e||!ie)&&!N.prevLine.fencedCodeEnd,me=(N.list===!1||oe||$)&&N.indentation<=fe&&B.match(D),le=null;if(N.indentationDiff>=4&&(ie||N.prevLine.fencedCodeEnd||N.prevLine.header||$))return B.skipToEnd(),N.indentedCode=!0,F.code;if(B.eatSpace())return null;if(V&&N.indentation<=fe&&(le=B.match(w))&&le[1].length<=6)return N.quote=0,N.header=le[1].length,N.thisLine.header=!0,L.highlightFormatting&&(N.formatting="header"),N.f=N.inline,f(N);if(N.indentation<=fe&&B.eat(">"))return N.quote=V?1:N.quote+1,L.highlightFormatting&&(N.formatting="quote"),B.eatSpace(),f(N);if(!me&&!N.setext&&V&&N.indentation<=fe&&(le=B.match(R))){var ue=le[1]?"ol":"ul";return N.indentation=Se+B.current().length,N.list=!0,N.quote=0,N.listStack.push(N.indentation),N.em=!1,N.strong=!1,N.code=!1,N.strikethrough=!1,L.taskLists&&B.match(E,!1)&&(N.taskList=!0),N.f=N.inline,L.highlightFormatting&&(N.formatting=["list","list-"+ue]),f(N)}else{if(V&&N.indentation<=fe&&(le=B.match(_,!0)))return N.quote=0,N.fencedEndRE=new RegExp(le[1]+"+ *$"),N.localMode=L.fencedCodeBlockHighlighting&&P(le[2]||L.fencedCodeBlockDefaultMode),N.localMode&&(N.localState=re.startState(N.localMode)),N.f=N.block=y,L.highlightFormatting&&(N.formatting="code-block"),N.code=-1,f(N);if(N.setext||(!be||!_e)&&!N.quote&&N.list===!1&&!N.code&&!me&&!b.test(B.string)&&(le=B.lookAhead(1))&&(le=le.match(T)))return N.setext?(N.header=N.setext,N.setext=0,B.skipToEnd(),L.highlightFormatting&&(N.formatting="header")):(N.header=le[0].charAt(0)=="="?1:2,N.setext=N.header),N.thisLine.header=!0,N.f=N.inline,f(N);if(me)return B.skipToEnd(),N.hr=!0,N.thisLine.hr=!0,F.hr;if(B.peek()==="[")return u(B,N,O)}return u(B,N,N.inline)}function C(B,N){var V=H.token(B,N.htmlState);if(!k){var $=re.innerMode(H,N.htmlState);($.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText||N.md_inside&&B.current().indexOf(">")>-1)&&(N.f=o,N.block=g,N.htmlState=null)}return V}function y(B,N){var V=N.listStack[N.listStack.length-1]||0,$=N.indentation<V,ie=V+3;if(N.fencedEndRE&&N.indentation<=ie&&($||B.match(N.fencedEndRE))){L.highlightFormatting&&(N.formatting="code-block");var oe;return $||(oe=f(N)),N.localMode=N.localState=null,N.block=g,N.f=o,N.fencedEndRE=null,N.code=0,N.thisLine.fencedCodeEnd=!0,$?l(B,N,N.block):oe}else return N.localMode?N.localMode.token(B,N.localState):(B.skipToEnd(),F.code)}function f(B){var N=[];if(B.formatting){N.push(F.formatting),typeof B.formatting=="string"&&(B.formatting=[B.formatting]);for(var V=0;V<B.formatting.length;V++)N.push(F.formatting+"-"+B.formatting[V]),B.formatting[V]==="header"&&N.push(F.formatting+"-"+B.formatting[V]+"-"+B.header),B.formatting[V]==="quote"&&(!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=B.quote?N.push(F.formatting+"-"+B.formatting[V]+"-"+B.quote):N.push("error"))}if(B.taskOpen)return N.push("meta"),N.length?N.join(" "):null;if(B.taskClosed)return N.push("property"),N.length?N.join(" "):null;if(B.linkHref?N.push(F.linkHref,"url"):(B.strong&&N.push(F.strong),B.em&&N.push(F.em),B.strikethrough&&N.push(F.strikethrough),B.emoji&&N.push(F.emoji),B.linkText&&N.push(F.linkText),B.code&&N.push(F.code),B.image&&N.push(F.image),B.imageAltText&&N.push(F.imageAltText,"link"),B.imageMarker&&N.push(F.imageMarker)),B.header&&N.push(F.header,F.header+"-"+B.header),B.quote&&(N.push(F.quote),!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=B.quote?N.push(F.quote+"-"+B.quote):N.push(F.quote+"-"+L.maxBlockquoteDepth)),B.list!==!1){var $=(B.listStack.length-1)%3;$?$===1?N.push(F.list2):N.push(F.list3):N.push(F.list1)}return B.trailingSpaceNewLine?N.push("trailing-space-new-line"):B.trailingSpace&&N.push("trailing-space-"+(B.trailingSpace%2?"a":"b")),N.length?N.join(" "):null}function c(B,N){return B.match(A,!0)?f(N):void 0}function o(B,N){var V=N.text(B,N);if(typeof V!="undefined")return V;if(N.list)return N.list=null,f(N);if(N.taskList){var $=B.match(E,!0)[1]===" ";return $?N.taskOpen=!0:N.taskClosed=!0,L.highlightFormatting&&(N.formatting="task"),N.taskList=!1,f(N)}if(N.taskOpen=!1,N.taskClosed=!1,N.header&&B.match(/^#+$/,!0))return L.highlightFormatting&&(N.formatting="header"),f(N);var ie=B.next();if(N.linkTitle){N.linkTitle=!1;var oe=ie;ie==="("&&(oe=")"),oe=(oe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var _e="^\\s*(?:[^"+oe+"\\\\]+|\\\\\\\\|\\\\.)"+oe;if(B.match(new RegExp(_e),!0))return F.linkHref}if(ie==="`"){var fe=N.formatting;L.highlightFormatting&&(N.formatting="code"),B.eatWhile("`");var Se=B.current().length;if(N.code==0&&(!N.quote||Se==1))return N.code=Se,f(N);if(Se==N.code){var be=f(N);return N.code=0,be}else return N.formatting=fe,f(N)}else if(N.code)return f(N);if(ie==="\\"&&(B.next(),L.highlightFormatting)){var me=f(N),le=F.formatting+"-escape";return me?me+" "+le:le}if(ie==="!"&&B.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return N.imageMarker=!0,N.image=!0,L.highlightFormatting&&(N.formatting="image"),f(N);if(ie==="["&&N.imageMarker&&B.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return N.imageMarker=!1,N.imageAltText=!0,L.highlightFormatting&&(N.formatting="image"),f(N);if(ie==="]"&&N.imageAltText){L.highlightFormatting&&(N.formatting="image");var me=f(N);return N.imageAltText=!1,N.image=!1,N.inline=N.f=m,me}if(ie==="["&&!N.image)return N.linkText&&B.match(/^.*?\]/)||(N.linkText=!0,L.highlightFormatting&&(N.formatting="link")),f(N);if(ie==="]"&&N.linkText){L.highlightFormatting&&(N.formatting="link");var me=f(N);return N.linkText=!1,N.inline=N.f=B.match(/\(.*?\)| ?\[.*?\]/,!1)?m:o,me}if(ie==="<"&&B.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=a,L.highlightFormatting&&(N.formatting="link");var me=f(N);return me?me+=" ":me="",me+F.linkInline}if(ie==="<"&&B.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=a,L.highlightFormatting&&(N.formatting="link");var me=f(N);return me?me+=" ":me="",me+F.linkEmail}if(L.xml&&ie==="<"&&B.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ue=B.string.indexOf(">",B.pos);if(ue!=-1){var Ee=B.string.substring(B.start,ue);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Ee)&&(N.md_inside=!0)}return B.backUp(1),N.htmlState=re.startState(H),l(B,N,C)}if(L.xml&&ie==="<"&&B.match(/^\/\w*?>/))return N.md_inside=!1,"tag";if(ie==="*"||ie==="_"){for(var Ge=1,Te=B.pos==1?" ":B.string.charAt(B.pos-2);Ge<3&&B.eat(ie);)Ge++;var pe=B.peek()||" ",Ae=!/\s/.test(pe)&&(!d.test(pe)||/\s/.test(Te)||d.test(Te)),Ce=!/\s/.test(Te)&&(!d.test(Te)||/\s/.test(pe)||d.test(pe)),we=null,Be=null;if(Ge%2&&(!N.em&&Ae&&(ie==="*"||!Ce||d.test(Te))?we=!0:N.em==ie&&Ce&&(ie==="*"||!Ae||d.test(pe))&&(we=!1)),Ge>1&&(!N.strong&&Ae&&(ie==="*"||!Ce||d.test(Te))?Be=!0:N.strong==ie&&Ce&&(ie==="*"||!Ae||d.test(pe))&&(Be=!1)),Be!=null||we!=null){L.highlightFormatting&&(N.formatting=we==null?"strong":Be==null?"em":"strong em"),we===!0&&(N.em=ie),Be===!0&&(N.strong=ie);var be=f(N);return we===!1&&(N.em=!1),Be===!1&&(N.strong=!1),be}}else if(ie===" "&&(B.eat("*")||B.eat("_"))){if(B.peek()===" ")return f(N);B.backUp(1)}if(L.strikethrough){if(ie==="~"&&B.eatWhile(ie)){if(N.strikethrough){L.highlightFormatting&&(N.formatting="strikethrough");var be=f(N);return N.strikethrough=!1,be}else if(B.match(/^[^\s]/,!1))return N.strikethrough=!0,L.highlightFormatting&&(N.formatting="strikethrough"),f(N)}else if(ie===" "&&B.match(/^~~/,!0)){if(B.peek()===" ")return f(N);B.backUp(2)}}if(L.emoji&&ie===":"&&B.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){N.emoji=!0,L.highlightFormatting&&(N.formatting="emoji");var Qe=f(N);return N.emoji=!1,Qe}return ie===" "&&(B.match(/^ +$/,!1)?N.trailingSpace++:N.trailingSpace&&(N.trailingSpaceNewLine=!0)),f(N)}function a(B,N){var V=B.next();if(V===">"){N.f=N.inline=o,L.highlightFormatting&&(N.formatting="link");var $=f(N);return $?$+=" ":$="",$+F.linkInline}return B.match(/^[^>]+/,!0),F.linkInline}function m(B,N){if(B.eatSpace())return null;var V=B.next();return V==="("||V==="["?(N.f=N.inline=v(V==="("?")":"]"),L.highlightFormatting&&(N.formatting="link-string"),N.linkHref=!0,f(N)):"error"}var p={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function v(B){return function(N,V){var $=N.next();if($===B){V.f=V.inline=o,L.highlightFormatting&&(V.formatting="link-string");var ie=f(V);return V.linkHref=!1,ie}return N.match(p[B]),V.linkHref=!0,f(V)}}function O(B,N){return B.match(/^([^\]\\]|\\.)*\]:/,!1)?(N.f=U,B.next(),L.highlightFormatting&&(N.formatting="link"),N.linkText=!0,f(N)):u(B,N,o)}function U(B,N){if(B.match(/^\]:/,!0)){N.f=N.inline=j,L.highlightFormatting&&(N.formatting="link");var V=f(N);return N.linkText=!1,V}return B.match(/^([^\]\\]|\\.)+/,!0),F.linkText}function j(B,N){return B.eatSpace()?null:(B.match(/^[^\s]+/,!0),B.peek()===void 0?N.linkTitle=!0:B.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),N.f=N.inline=o,F.linkHref+" url")}var G={startState:function(){return{f:g,prevLine:{stream:null},thisLine:{stream:null},block:g,htmlState:null,indentation:0,inline:o,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(B){return{f:B.f,prevLine:B.prevLine,thisLine:B.thisLine,block:B.block,htmlState:B.htmlState&&re.copyState(H,B.htmlState),indentation:B.indentation,localMode:B.localMode,localState:B.localMode?re.copyState(B.localMode,B.localState):null,inline:B.inline,text:B.text,formatting:!1,linkText:B.linkText,linkTitle:B.linkTitle,linkHref:B.linkHref,code:B.code,em:B.em,strong:B.strong,strikethrough:B.strikethrough,emoji:B.emoji,header:B.header,setext:B.setext,hr:B.hr,taskList:B.taskList,list:B.list,listStack:B.listStack.slice(0),quote:B.quote,indentedCode:B.indentedCode,trailingSpace:B.trailingSpace,trailingSpaceNewLine:B.trailingSpaceNewLine,md_inside:B.md_inside,fencedEndRE:B.fencedEndRE}},token:function(B,N){if(N.formatting=!1,B!=N.thisLine.stream){if(N.header=0,N.hr=!1,B.match(/^\s*$/,!0))return h(N),null;if(N.prevLine=N.thisLine,N.thisLine={stream:B},N.taskList=!1,N.trailingSpace=0,N.trailingSpaceNewLine=!1,!N.localState&&(N.f=N.block,N.f!=C)){var V=B.match(/^\s*/,!0)[0].replace(/\t/g,s).length;if(N.indentation=V,N.indentationDiff=null,V>0)return null}}return N.f(B,N)},innerMode:function(B){return B.block==C?{state:B.htmlState,mode:H}:B.localState?{state:B.localState,mode:B.localMode}:{state:B,mode:G}},indent:function(B,N,V){return B.block==C&&H.indent?H.indent(B.htmlState,N,V):B.localState&&B.localMode.indent?B.localMode.indent(B.localState,N,V):re.Pass},blankLine:h,getType:f,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return G},"xml"),re.defineMIME("text/markdown","markdown"),re.defineMIME("text/x-markdown","markdown")})},lfxj:function(ut,$e,J){ut.exports={priseBox:"priseBox___wSohZ",iconfont:"iconfont___2Xk32"}},osHv:function(ut,$e,J){(function(re){re(J("VrN/"))})(function(re){"use strict";var z=re.Pos;function L(d,s){return d.line-s.line||d.ch-s.ch}var H="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",k=H+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",P=new RegExp("<(/?)(["+H+"]["+k+"]*)","g");function F(d,s,u,l){this.line=s,this.ch=u,this.cm=d,this.text=d.getLine(s),this.min=l?Math.max(l.from,d.firstLine()):d.firstLine(),this.max=l?Math.min(l.to-1,d.lastLine()):d.lastLine()}function M(d,s){var u=d.cm.getTokenTypeAt(z(d.line,s));return u&&/\btag\b/.test(u)}function D(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function R(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function E(d){for(;;){var s=d.text.indexOf(">",d.ch);if(s==-1){if(D(d))continue;return}if(!M(d,s+1)){d.ch=s+1;continue}var u=d.text.lastIndexOf("/",s),l=u>-1&&!/\S/.test(d.text.slice(u+1,s));return d.ch=s+1,l?"selfClose":"regular"}}function w(d){for(;;){var s=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(s==-1){if(R(d))continue;return}if(!M(d,s+1)){d.ch=s;continue}P.lastIndex=s,d.ch=s;var u=P.exec(d.text);if(u&&u.index==s)return u}}function T(d){for(;;){P.lastIndex=d.ch;var s=P.exec(d.text);if(!s){if(D(d))continue;return}if(!M(d,s.index+1)){d.ch=s.index+1;continue}return d.ch=s.index+s[0].length,s}}function A(d){for(;;){var s=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(s==-1){if(R(d))continue;return}if(!M(d,s+1)){d.ch=s;continue}var u=d.text.lastIndexOf("/",s),l=u>-1&&!/\S/.test(d.text.slice(u+1,s));return d.ch=s+1,l?"selfClose":"regular"}}function _(d,s){for(var u=[];;){var l=T(d),S,h=d.line,g=d.ch-(l?l[0].length:0);if(!l||!(S=E(d)))return;if(S=="selfClose")continue;if(l[1]){for(var C=u.length-1;C>=0;--C)if(u[C]==l[2]){u.length=C;break}if(C<0&&(!s||s==l[2]))return{tag:l[2],from:z(h,g),to:z(d.line,d.ch)}}else u.push(l[2])}}function b(d,s){for(var u=[];;){var l=A(d);if(!l)return;if(l=="selfClose"){w(d);continue}var S=d.line,h=d.ch,g=w(d);if(!g)return;if(g[1])u.push(g[2]);else{for(var C=u.length-1;C>=0;--C)if(u[C]==g[2]){u.length=C;break}if(C<0&&(!s||s==g[2]))return{tag:g[2],from:z(d.line,d.ch),to:z(S,h)}}}}re.registerHelper("fold","xml",function(d,s){for(var u=new F(d,s.line,0);;){var l=T(u);if(!l||u.line!=s.line)return;var S=E(u);if(!S)return;if(!l[1]&&S!="selfClose"){var h=z(u.line,u.ch),g=_(u,l[2]);return g&&L(g.from,h)>0?{from:h,to:g.from}:null}}}),re.findMatchingTag=function(d,s,u){var l=new F(d,s.line,s.ch,u);if(l.text.indexOf(">")==-1&&l.text.indexOf("<")==-1)return;var S=E(l),h=S&&z(l.line,l.ch),g=S&&w(l);if(!S||!g||L(l,s)>0)return;var C={from:z(l.line,l.ch),to:h,tag:g[2]};return S=="selfClose"?{open:C,close:null,at:"open"}:g[1]?{open:b(l,g[2]),close:C,at:"close"}:(l=new F(d,h.line,h.ch,u),{open:C,close:_(l,g[2]),at:"open"})},re.findEnclosingTag=function(d,s,u,l){for(var S=new F(d,s.line,s.ch,u);;){var h=b(S,l);if(!h)break;var g=new F(d,s.line,s.ch,u),C=_(g,h.tag);if(C)return{open:h,close:C}}},re.scanForClosingTag=function(d,s,u,l){var S=new F(d,s.line,s.ch,l?{from:0,to:l}:null);return _(S,u)}})},p5ED:function(ut,$e,J){"use strict";var re=J("+L6B"),z=J("2/Rp"),L=J("5Dmo"),H=J("3S7+"),k=J("k1fw"),P=J("tJVT"),F=J("q1tI"),M=J.n(F),D=J("vHTk"),R=J.n(D),E=J("yEEn"),w=J("ZW9T"),T=J("1vsH");$e.a=function(A){var _=A.name,b=A.data,d=A.theme,s=A.type,u=A.filename,l=A.monacoEditor,S=A.className,h=A.style,g=A.close,C=A.onClose,y=A.hasMask,f=Object(F.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),c=Object(P.a)(f,2),o=c[0],a=c[1],m=Object(F.useState)(""),p=Object(P.a)(m,2),v=p[0],O=p[1],U=Object(F.useRef)();u&&(l.filename=u),Object(F.useEffect)(function(){var B,N,V=(B=document.cookie)===null||B===void 0||((N=B.replace(/\s/g,""))===null||N===void 0)?void 0:N.split(";");V==null||V.map(function($){var ie=$.split("=");ie[0]==="_educoder_session"&&O(ie[1])})},[]);var j=function(){if(b.startsWith("http")||b.startsWith("/")){G();return}Object(T.y)(u||"educoder",b,u)},G=function(){Object(T.w)(u||_,b)};return console.log("data:",b,"fileanme:",u," name:",_),M.a.createElement("div",{style:Object(k.a)({},h||{}),className:"".concat(y&&R.a.bgBlack," ").concat(s?R.a.wrp:"hide")},g&&M.a.createElement("div",{className:R.a.close,ref:U},M.a.createElement(H.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return U.current}},M.a.createElement("span",{onClick:G},M.a.createElement("i",{className:"icon-quxiaozhiding"}))),M.a.createElement(H.a,{title:"\u5173\u95ED",getPopupContainer:function(){return U.current}},M.a.createElement("span",{className:"",onClick:C},M.a.createElement("i",{className:"icon-guanbi1"})))),M.a.createElement("div",{className:"".concat(R.a[S]," ").concat(S," ").concat(R.a.monaco," ").concat(s==="txt"?"show":"hide")},s==="txt"&&M.a.createElement(w.b,l)),s==="audio"&&M.a.createElement("audio",{src:"".concat(b!=null&&b.startsWith("/")||(b==null?void 0:b.indexOf("https://"))>-1?b:"data:audio/mp3;base64,").concat(b),autoPlay:!0}),s==="video"&&M.a.createElement(M.a.Fragment,null,b!=null&&b.startsWith("/")?M.a.createElement("video",{controls:!0,src:"".concat(b),autoPlay:!0}):M.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(b),autoPlay:!0})),s==="pdf"&&M.a.createElement("embed",{className:R.a.embed,src:b}),s==="image"&&M.a.createElement(M.a.Fragment,null,M.a.createElement("img",{src:"".concat(b!=null&&b.startsWith("/")||(b==null?void 0:b.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(b)})),s==="other"&&M.a.createElement("div",null,M.a.createElement(z.a,{type:"primary",size:"large",onClick:j},M.a.createElement(E.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(s==="download"||s==="office")&&M.a.createElement(z.a,{type:"primary",size:"large",onClick:j},M.a.createElement(E.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(ut,$e,J){},"rAM+":function(ut,$e,J){"use strict";J.d($e,"a",function(){return z});var re=J("Qw5x");function z(L,H){var k;if(typeof Symbol=="undefined"||L[Symbol.iterator]==null){if(Array.isArray(L)||(k=Object(re.a)(L))||H&&L&&typeof L.length=="number"){k&&(L=k);var P=0,F=function(){};return{s:F,n:function(){return P>=L.length?{done:!0}:{done:!1,value:L[P++]}},e:function(w){throw w},f:F}}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 M=!0,D=!1,R;return{s:function(){k=L[Symbol.iterator]()},n:function(){var w=k.next();return M=w.done,w},e:function(w){D=!0,R=w},f:function(){try{!M&&k.return!=null&&k.return()}finally{if(D)throw R}}}}},rUJ1:function(ut,$e){const J=/[&<>"']/,re=/[&<>"']/g,z=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,H={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},k=y=>H[y];function P(y,f){if(f){if(J.test(y))return y.replace(re,k)}else if(z.test(y))return y.replace(L,k);return y}const F=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function M(y){return y.replace(F,(f,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 D=/(^|[^\[])\^/g;function R(y,f){y=y.source||y,f=f||"";const c={replace:(o,a)=>(a=a.source||a,a=a.replace(D,"$1"),y=y.replace(o,a),c),getRegex:()=>new RegExp(y,f)};return c}const E=/[^\w:]/g,w=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function T(y,f,c){if(y){let o;try{o=decodeURIComponent(M(c)).replace(E,"").toLowerCase()}catch(a){return null}if(o.indexOf("javascript:")===0||o.indexOf("vbscript:")===0||o.indexOf("data:")===0)return null}f&&!w.test(c)&&(c=s(f,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(o){return null}return c}const A={},_=/^[^:]+:\/*[^/]*$/,b=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function s(y,f){A[" "+y]||(_.test(y)?A[" "+y]=y+"/":A[" "+y]=h(y,"/",!0)),y=A[" "+y];const c=y.indexOf(":")===-1;return f.substring(0,2)==="//"?c?f:y.replace(b,"$1")+f:f.charAt(0)==="/"?c?f:y.replace(d,"$1")+f:y+f}const u={exec:function(){}};function l(y){let f=1,c,o;for(;f<arguments.length;f++){c=arguments[f];for(o in c)Object.prototype.hasOwnProperty.call(c,o)&&(y[o]=c[o])}return y}function S(y,f){const c=y.replace(/\|/g,(m,p,v)=>{let O=!1,U=p;for(;--U>=0&&v[U]==="\\";)O=!O;return O?"|":" |"}),o=c.split(/ \|/);let a=0;if(o.length>f)o.splice(f);else for(;o.length<f;)o.push("");for(;a<o.length;a++)o[a]=o[a].trim().replace(/\\\|/g,"|");return o}function h(y,f,c){const o=y.length;if(o===0)return"";let a=0;for(;a<o;){const m=y.charAt(o-a-1);if(m===f&&!c)a++;else if(m!==f&&c)a++;else break}return y.substr(0,o-a)}function g(y,f){if(y.indexOf(f[1])===-1)return-1;const c=y.length;let o=0,a=0;for(;a<c;a++)if(y[a]==="\\")a++;else if(y[a]===f[0])o++;else if(y[a]===f[1]&&(o--,o<0))return a;return-1}function C(y){y&&y.sanitize&&!y.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")}ut.exports={escape:P,unescape:M,edit:R,cleanUrl:T,resolveUrl:s,noopTest:u,merge:l,splitCells:S,rtrim:h,findClosingBracket:g,checkSanitizeDeprecation:C}},sNeV:function(ut,$e,J){"use strict";var re=J("qVdP"),z=J("jsC+"),L=J("lUTK"),H=J("BvKs"),k=J("2qtc"),P=J("kLXV"),F=J("/xke"),M=J("TeRw"),D=J("q1tI"),R=J.n(D),E=J("55Ip"),w=J("h+Ho"),T=J("SJ7D"),A=J.n(T);$e.a=function(_){var b=_.id,d=_.permission,s=_.calbackFunc;function u(y){var f=y?0:1,c={id:b,sticky:f};Object(w.c)(c).then(function(o){o&&(M.a.open({message:"\u63D0\u793A",description:o.message}),s&&s())})}function l(y){var f=y?0:1,c={id:b,is_fine:f};Object(w.b)(c).then(function(o){o&&(M.a.open({message:"\u63D0\u793A",description:o.message}),s&&s())})}function S(y){var f=y?0:1,c={id:b,is_watch:f};Object(w.e)(c).then(function(o){o&&(M.a.open({message:"\u63D0\u793A",description:o.message}),s&&s())})}function h(){P.a.confirm({content:"\u786E\u8BA4\u5220\u9664\u5E16\u5B50?",onOk:function(){Object(w.h)(b).then(function(f){f.status!==-1&&(M.a.open({message:"\u63D0\u793A",description:f.message}),s&&s(),window.location.href="/forums")})}})}function g(y){var f=y?0:1,c={id:b,is_apply:f};P.a.confirm({content:"\u786E\u8BA4\u7533\u8BF7\u5220\u5E16?",onOk:function(){Object(w.f)(c).then(function(a){a&&(M.a.open({message:"\u63D0\u793A",description:a.message}),s&&s())})}})}var C=d&&R.a.createElement(H.a,{style:{minWidth:"100px",textAlign:"center"}},d.banned_permission&&R.a.createElement(H.a.Item,{onClick:function(){return u(d.sticky)}},d.sticky?"\u53D6\u6D88\u7F6E\u9876":"\u7F6E\u9876"),d.banned_permission&&R.a.createElement(H.a.Item,{onClick:function(){return l(d.is_fine)}},d.is_fine?"\u53D6\u6D88\u63A8\u8350":"\u63A8\u8350"),d.login&&R.a.createElement(H.a.Item,{onClick:function(){return S(d.memo_watched)}},d.memo_watched?"\u53D6\u6D88\u6536\u85CF":"\u6536\u85CF"),(d.admin||d.is_currentUser)&&R.a.createElement(H.a.Item,null,R.a.createElement(E.a,{to:"/forums/".concat(b,"/edit")},"\u7F16\u8F91")),d.admin?R.a.createElement(H.a.Item,{onClick:function(){return h()}},"\u5220\u9664"):d.is_currentUser?R.a.createElement(H.a.Item,{onClick:function(){return g(d.is_deleted)}},d.is_deleted?"\u64A4\u9500\u7533\u8BF7":"\u7533\u8BF7\u5220\u5E16"):"");return R.a.createElement(z.a,{overlay:C,align:"center",placement:"bottomCenter"},R.a.createElement("i",{className:"gengduo icon-gengduo1"}))}},ulZh:function(ut,$e,J){typeof window!="undefined"&&function(z,L){ut.exports=L()}(this,function(){return function(re){var z={};function L(H){if(z[H])return z[H].exports;var k=z[H]={i:H,l:!1,exports:{}};return re[H].call(k.exports,k,k.exports,L),k.l=!0,k.exports}return L.m=re,L.c=z,L.d=function(H,k,P){L.o(H,k)||Object.defineProperty(H,k,{enumerable:!0,get:P})},L.r=function(H){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(H,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(H,"__esModule",{value:!0})},L.t=function(H,k){if(k&1&&(H=L(H)),k&8)return H;if(k&4&&typeof H=="object"&&H&&H.__esModule)return H;var P=Object.create(null);if(L.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:H}),k&2&&typeof H!="string")for(var F in H)L.d(P,F,function(M){return H[M]}.bind(null,F));return P},L.n=function(H){var k=H&&H.__esModule?function(){return H.default}:function(){return H};return L.d(k,"a",k),k},L.o=function(H,k){return Object.prototype.hasOwnProperty.call(H,k)},L.p="/dist/",L(L.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(re,z,L){"use strict";var H=Object.prototype.hasOwnProperty,k="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(k=!1));function F(E,w,T){this.fn=E,this.context=w,this.once=T||!1}function M(E,w,T,A,_){if(typeof T!="function")throw new TypeError("The listener must be a function");var b=new F(T,A||E,_),d=k?k+w:w;return E._events[d]?E._events[d].fn?E._events[d]=[E._events[d],b]:E._events[d].push(b):(E._events[d]=b,E._eventsCount++),E}function D(E,w){--E._eventsCount===0?E._events=new P:delete E._events[w]}function R(){this._events=new P,this._eventsCount=0}R.prototype.eventNames=function(){var w=[],T,A;if(this._eventsCount===0)return w;for(A in T=this._events)H.call(T,A)&&w.push(k?A.slice(1):A);return Object.getOwnPropertySymbols?w.concat(Object.getOwnPropertySymbols(T)):w},R.prototype.listeners=function(w){var T=k?k+w:w,A=this._events[T];if(!A)return[];if(A.fn)return[A.fn];for(var _=0,b=A.length,d=new Array(b);_<b;_++)d[_]=A[_].fn;return d},R.prototype.listenerCount=function(w){var T=k?k+w:w,A=this._events[T];return A?A.fn?1:A.length:0},R.prototype.emit=function(w,T,A,_,b,d){var s=k?k+w:w;if(!this._events[s])return!1;var u=this._events[s],l=arguments.length,S,h;if(u.fn){u.once&&this.removeListener(w,u.fn,void 0,!0);switch(l){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,T),!0;case 3:return u.fn.call(u.context,T,A),!0;case 4:return u.fn.call(u.context,T,A,_),!0;case 5:return u.fn.call(u.context,T,A,_,b),!0;case 6:return u.fn.call(u.context,T,A,_,b,d),!0}for(h=1,S=new Array(l-1);h<l;h++)S[h-1]=arguments[h];u.fn.apply(u.context,S)}else{var g=u.length,C;for(h=0;h<g;h++){u[h].once&&this.removeListener(w,u[h].fn,void 0,!0);switch(l){case 1:u[h].fn.call(u[h].context);break;case 2:u[h].fn.call(u[h].context,T);break;case 3:u[h].fn.call(u[h].context,T,A);break;case 4:u[h].fn.call(u[h].context,T,A,_);break;default:if(!S)for(C=1,S=new Array(l-1);C<l;C++)S[C-1]=arguments[C];u[h].fn.apply(u[h].context,S)}}}return!0},R.prototype.on=function(w,T,A){return M(this,w,T,A,!1)},R.prototype.once=function(w,T,A){return M(this,w,T,A,!0)},R.prototype.removeListener=function(w,T,A,_){var b=k?k+w:w;if(!this._events[b])return this;if(!T)return D(this,b),this;var d=this._events[b];if(d.fn)d.fn===T&&(!_||d.once)&&(!A||d.context===A)&&D(this,b);else{for(var s=0,u=[],l=d.length;s<l;s++)(d[s].fn!==T||_&&!d[s].once||A&&d[s].context!==A)&&u.push(d[s]);u.length?this._events[b]=u.length===1?u[0]:u:D(this,b)}return this},R.prototype.removeAllListeners=function(w){var T;return w?(T=k?k+w:w,this._events[T]&&D(this,T)):(this._events=new P,this._eventsCount=0),this},R.prototype.off=R.prototype.removeListener,R.prototype.addListener=R.prototype.on,R.prefixed=k,R.EventEmitter=R,re.exports=R},"./node_modules/url-toolkit/src/url-toolkit.js":function(re,z,L){(function(H){var k=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,P=/^([^\/?#]*)([^]*)$/,F=/(?:\/|^)\.(?=\/)/g,M=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,D={buildAbsoluteURL:function(R,E,w){if(w=w||{},R=R.trim(),E=E.trim(),!E){if(!w.alwaysNormalize)return R;var T=D.parseURL(R);if(!T)throw new Error("Error trying to parse base URL.");return T.path=D.normalizePath(T.path),D.buildURLFromParts(T)}var A=D.parseURL(E);if(!A)throw new Error("Error trying to parse relative URL.");if(A.scheme)return w.alwaysNormalize?(A.path=D.normalizePath(A.path),D.buildURLFromParts(A)):E;var _=D.parseURL(R);if(!_)throw new Error("Error trying to parse base URL.");if(!_.netLoc&&_.path&&_.path[0]!=="/"){var b=P.exec(_.path);_.netLoc=b[1],_.path=b[2]}_.netLoc&&!_.path&&(_.path="/");var d={scheme:_.scheme,netLoc:A.netLoc,path:null,params:A.params,query:A.query,fragment:A.fragment};if(!A.netLoc&&(d.netLoc=_.netLoc,A.path[0]!=="/"))if(!A.path)d.path=_.path,A.params||(d.params=_.params,A.query||(d.query=_.query));else{var s=_.path,u=s.substring(0,s.lastIndexOf("/")+1)+A.path;d.path=D.normalizePath(u)}return d.path===null&&(d.path=w.alwaysNormalize?D.normalizePath(A.path):A.path),D.buildURLFromParts(d)},parseURL:function(R){var E=k.exec(R);return E?{scheme:E[1]||"",netLoc:E[2]||"",path:E[3]||"",params:E[4]||"",query:E[5]||"",fragment:E[6]||""}:null},normalizePath:function(R){for(R=R.split("").reverse().join("").replace(F,"");R.length!==(R=R.replace(M,"")).length;);return R.split("").reverse().join("")},buildURLFromParts:function(R){return R.scheme+R.netLoc+R.path+R.params+R.query+R.fragment}};re.exports=D})(this)},"./node_modules/webworkify-webpack/index.js":function(re,z,L){function H(w){var T={};function A(b){if(T[b])return T[b].exports;var d=T[b]={i:b,l:!1,exports:{}};return w[b].call(d.exports,d,d.exports,A),d.l=!0,d.exports}A.m=w,A.c=T,A.i=function(b){return b},A.d=function(b,d,s){A.o(b,d)||Object.defineProperty(b,d,{configurable:!1,enumerable:!0,get:s})},A.r=function(b){Object.defineProperty(b,"__esModule",{value:!0})},A.n=function(b){var d=b&&b.__esModule?function(){return b.default}:function(){return b};return A.d(d,"a",d),d},A.o=function(b,d){return Object.prototype.hasOwnProperty.call(b,d)},A.p="/",A.oe=function(b){throw console.error(b),b};var _=A(A.s=ENTRY_MODULE);return _.default||_}var k="[\\.|\\-|\\+|\\w|/|@]+",P="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+k+").*?\\)";function F(w){return(w+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function M(w){return!isNaN(1*w)}function D(w,T,A){var _={};_[A]=[];var b=T.toString(),d=b.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return _;for(var s=d[1],u=new RegExp("(\\\\n|\\W)"+F(s)+P,"g"),l;l=u.exec(b);){if(l[3]==="dll-reference")continue;_[A].push(l[3])}for(u=new RegExp("\\("+F(s)+'\\("(dll-reference\\s('+k+'))"\\)\\)'+P,"g");l=u.exec(b);)w[l[2]]||(_[A].push(l[1]),w[l[2]]=L(l[1]).m),_[l[2]]=_[l[2]]||[],_[l[2]].push(l[4]);for(var S=Object.keys(_),h=0;h<S.length;h++)for(var g=0;g<_[S[h]].length;g++)M(_[S[h]][g])&&(_[S[h]][g]=1*_[S[h]][g]);return _}function R(w){var T=Object.keys(w);return T.reduce(function(A,_){return A||w[_].length>0},!1)}function E(w,T){for(var A={main:[T]},_={main:[]},b={main:{}};R(A);)for(var d=Object.keys(A),s=0;s<d.length;s++){var u=d[s],l=A[u],S=l.pop();if(b[u]=b[u]||{},b[u][S]||!w[u][S])continue;b[u][S]=!0,_[u]=_[u]||[],_[u].push(S);for(var h=D(w,w[u][S],u),g=Object.keys(h),C=0;C<g.length;C++)A[g[C]]=A[g[C]]||[],A[g[C]]=A[g[C]].concat(h[g[C]])}return _}re.exports=function(w,T){T=T||{};var A={main:L.m},_=T.all?{main:Object.keys(A.main)}:E(A,w),b="";Object.keys(_).filter(function(S){return S!=="main"}).forEach(function(S){for(var h=0;_[S][h];)h++;_[S].push(h),A[S][h]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",b=b+"var "+S+" = ("+H.toString().replace("ENTRY_MODULE",JSON.stringify(h))+")({"+_[S].map(function(g){return""+JSON.stringify(g)+": "+A[S][g].toString()}).join(",")+`});
`}),b=b+"new (("+H.toString().replace("ENTRY_MODULE",JSON.stringify(w))+")({"+_.main.map(function(S){return""+JSON.stringify(S)+": "+A.main[S].toString()}).join(",")+"}))(self);";var d=new window.Blob([b],{type:"text/javascript"});if(T.bare)return d;var s=window.URL||window.webkitURL||window.mozURL||window.msURL,u=s.createObjectURL(d),l=new window.Worker(u);return l.objectURL=u,l}},"./src/config.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"hlsDefaultConfig",function(){return C}),L.d(z,"mergeConfig",function(){return f}),L.d(z,"enableStreamingMode",function(){return c});var H=L("./src/controller/abr-controller.ts"),k=L("./src/controller/audio-stream-controller.ts"),P=L("./src/controller/audio-track-controller.ts"),F=L("./src/controller/subtitle-stream-controller.ts"),M=L("./src/controller/subtitle-track-controller.ts"),D=L("./src/controller/buffer-controller.ts"),R=L("./src/controller/timeline-controller.ts"),E=L("./src/controller/cap-level-controller.ts"),w=L("./src/controller/fps-controller.ts"),T=L("./src/controller/eme-controller.ts"),A=L("./src/controller/cmcd-controller.ts"),_=L("./src/utils/xhr-loader.ts"),b=L("./src/utils/fetch-loader.ts"),d=L("./src/utils/cues.ts"),s=L("./src/utils/mediakeys-helper.ts"),u=L("./src/utils/logger.ts");function l(){return l=Object.assign||function(o){for(var a=1;a<arguments.length;a++){var m=arguments[a];for(var p in m)Object.prototype.hasOwnProperty.call(m,p)&&(o[p]=m[p])}return o},l.apply(this,arguments)}function S(o,a){var m=Object.keys(o);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(o);a&&(p=p.filter(function(v){return Object.getOwnPropertyDescriptor(o,v).enumerable})),m.push.apply(m,p)}return m}function h(o){for(var a=1;a<arguments.length;a++){var m=arguments[a]!=null?arguments[a]:{};a%2?S(Object(m),!0).forEach(function(p){g(o,p,m[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(m)):S(Object(m)).forEach(function(p){Object.defineProperty(o,p,Object.getOwnPropertyDescriptor(m,p))})}return o}function g(o,a,m){return a in o?Object.defineProperty(o,a,{value:m,enumerable:!0,configurable:!0,writable:!0}):o[a]=m,o}var C=h(h({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:_.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:H.default,bufferController:D.default,capLevelController:E.default,fpsController:w.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:s.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},y()),{},{subtitleStreamController:F.SubtitleStreamController,subtitleTrackController:M.default,timelineController:R.TimelineController,audioStreamController:k.default,audioTrackController:P.default,emeController:T.default,cmcdController:A.default});function y(){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 f(o,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return l({},o,a)}function c(o){var a=o.loader;if(a!==b.default&&a!==_.default)u.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),o.progressive=!1;else{var m=Object(b.fetchSupported)();m&&(o.loader=b.default,o.progressive=!0,o.enableSoftwareAES=!0,u.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(re,z,L){"use strict";L.r(z);var H=L("./src/polyfills/number.ts"),k=L("./src/utils/ewma-bandwidth-estimator.ts"),P=L("./src/events.ts"),F=L("./src/utils/buffer-helper.ts"),M=L("./src/errors.ts"),D=L("./src/types/loader.ts"),R=L("./src/utils/logger.ts");function E(A,_){for(var b=0;b<_.length;b++){var d=_[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(A,d.key,d)}}function w(A,_,b){return _&&E(A.prototype,_),b&&E(A,b),A}var T=function(){function A(b){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=b;var d=b.config;this.bwEstimator=new k.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var _=A.prototype;return _.registerListeners=function(){var d=this.hls;d.on(P.Events.FRAG_LOADING,this.onFragLoading,this),d.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(P.Events.ERROR,this.onError,this)},_.unregisterListeners=function(){var d=this.hls;d.off(P.Events.FRAG_LOADING,this.onFragLoading,this),d.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(P.Events.ERROR,this.onError,this)},_.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},_.onFragLoading=function(d,s){var u=s.frag;if(u.type===D.PlaylistLevelType.MAIN&&!this.timer){var l;this.fragCurrent=u,this.partCurrent=(l=s.part)!=null?l:null,this.timer=self.setInterval(this.onCheck,100)}},_.onLevelLoaded=function(d,s){var u=this.hls.config;s.details.live?this.bwEstimator.update(u.abrEwmaSlowLive,u.abrEwmaFastLive):this.bwEstimator.update(u.abrEwmaSlowVoD,u.abrEwmaFastVoD)},_._abandonRulesCheck=function(){var d=this.fragCurrent,s=this.partCurrent,u=this.hls,l=u.autoLevelEnabled,S=u.config,h=u.media;if(!d||!h)return;var g=s?s.stats:d.stats,C=s?s.duration:d.duration;if(g.aborted){R.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!l||h.paused||!h.playbackRate||!h.readyState)return;var y=performance.now()-g.loading.start,f=Math.abs(h.playbackRate);if(y<=500*C/f)return;var c=u.levels,o=u.minAutoLevel,a=c[d.level],m=g.total||Math.max(g.loaded,Math.round(C*a.maxBitrate/8)),p=Math.max(1,g.bwEstimate?g.bwEstimate/8:g.loaded*1e3/y),v=(m-g.loaded)/p,O=h.currentTime,U=(F.BufferHelper.bufferInfo(h,O,S.maxBufferHole).end-O)/f;if(U>=2*C/f||v<=U)return;var j=Number.POSITIVE_INFINITY,G;for(G=d.level-1;G>o;G--){var B=c[G].maxBitrate;if(j=C*B/(8*.8*p),j<U)break}if(j>=v)return;var N=this.bwEstimator.getEstimate();R.logger.warn("Fragment "+d.sn+(s?" part "+s.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+G+`
Current BW estimate: `+(Object(H.isFiniteNumber)(N)?(N/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+v.toFixed(3)+` s
Estimated load time for the next fragment: `+j.toFixed(3)+` s
Time to underbuffer: `+U.toFixed(3)+" s"),u.nextLoadLevel=G,this.bwEstimator.sample(y,g.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),u.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:s,stats:g})},_.onFragLoaded=function(d,s){var u=s.frag,l=s.part;if(u.type===D.PlaylistLevelType.MAIN&&Object(H.isFiniteNumber)(u.sn)){var S=l?l.stats:u.stats,h=l?l.duration:u.duration;if(this.clearTimer(),this.lastLoadedFragLevel=u.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var g=this.hls.levels[u.level],C=(g.loaded?g.loaded.bytes:0)+S.loaded,y=(g.loaded?g.loaded.duration:0)+h;g.loaded={bytes:C,duration:y},g.realBitrate=Math.round(8*C/y)}if(u.bitrateTest){var f={stats:S,frag:u,part:l,id:u.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,f),u.bitrateTest=!1}}},_.onFragBuffered=function(d,s){var u=s.frag,l=s.part,S=l?l.stats:u.stats;if(S.aborted)return;if(u.type!==D.PlaylistLevelType.MAIN||u.sn==="initSegment")return;var h=S.parsing.end-S.loading.start;this.bwEstimator.sample(h,S.loaded),S.bwEstimate=this.bwEstimator.getEstimate(),u.bitrateTest?this.bitrateTestDelay=h/1e3:this.bitrateTestDelay=0},_.onError=function(d,s){switch(s.details){case M.ErrorDetails.FRAG_LOAD_ERROR:case M.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},_.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},_.getNextABRAutoLevel=function(){var d=this.fragCurrent,s=this.partCurrent,u=this.hls,l=u.maxAutoLevel,S=u.config,h=u.minAutoLevel,g=u.media,C=s?s.duration:d?d.duration:0,y=g?g.currentTime:0,f=g&&g.playbackRate!==0?Math.abs(g.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():S.abrEwmaDefaultEstimate,o=(F.BufferHelper.bufferInfo(g,y,S.maxBufferHole).end-y)/f,a=this.findBestLevel(c,h,l,o,S.abrBandWidthFactor,S.abrBandWidthUpFactor);if(a>=0)return a;R.logger.trace((o?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var m=C?Math.min(C,S.maxStarvationDelay):S.maxStarvationDelay,p=S.abrBandWidthFactor,v=S.abrBandWidthUpFactor;if(!o){var O=this.bitrateTestDelay;if(O){var U=C?Math.min(C,S.maxLoadingDelay):S.maxLoadingDelay;m=U-O,R.logger.trace("bitrate test took "+Math.round(1e3*O)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*m)+" ms"),p=v=1}}return a=this.findBestLevel(c,h,l,o+m,p,v),Math.max(a,0)},_.findBestLevel=function(d,s,u,l,S,h){for(var g,C=this.fragCurrent,y=this.partCurrent,f=this.lastLoadedFragLevel,c=this.hls.levels,o=c[f],a=!!(o!=null&&(g=o.details)!==null&&g!==void 0&&g.live),m=o==null?void 0:o.codecSet,p=y?y.duration:C?C.duration:0,v=u;v>=s;v--){var O=c[v];if(!O||m&&O.codecSet!==m)continue;var U=O.details,j=(y?U==null?void 0:U.partTarget:U==null?void 0:U.averagetargetduration)||p,G=void 0;v<=f?G=S*d:G=h*d;var B=c[v].maxBitrate,N=B*j/G;if(R.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+v+"/"+Math.round(G)+"/"+B+"/"+j+"/"+l+"/"+N),G>B&&(!N||a&&!this.bitrateTestDelay||N<l))return v}return-1},w(A,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,s=this.bwEstimator;if(d!==-1&&(!s||!s.canEstimate()))return d;var u=this.getNextABRAutoLevel();return d!==-1&&(u=Math.min(d,u)),u},set:function(d){this._nextAutoLevel=d}}]),A}();z.default=T},"./src/controller/audio-stream-controller.ts":function(re,z,L){"use strict";L.r(z);var H=L("./src/polyfills/number.ts"),k=L("./src/controller/base-stream-controller.ts"),P=L("./src/events.ts"),F=L("./src/utils/buffer-helper.ts"),M=L("./src/controller/fragment-tracker.ts"),D=L("./src/types/level.ts"),R=L("./src/types/loader.ts"),E=L("./src/loader/fragment.ts"),w=L("./src/demux/chunk-cache.ts"),T=L("./src/demux/transmuxer-interface.ts"),A=L("./src/types/transmuxer.ts"),_=L("./src/controller/fragment-finders.ts"),b=L("./src/utils/discontinuities.ts"),d=L("./src/errors.ts"),s=L("./src/utils/logger.ts");function u(){return u=Object.assign||function(C){for(var y=1;y<arguments.length;y++){var f=arguments[y];for(var c in f)Object.prototype.hasOwnProperty.call(f,c)&&(C[c]=f[c])}return C},u.apply(this,arguments)}function l(C,y){C.prototype=Object.create(y.prototype),C.prototype.constructor=C,S(C,y)}function S(C,y){return S=Object.setPrototypeOf||function(c,o){return c.__proto__=o,c},S(C,y)}var h=100,g=function(C){l(y,C);function y(c,o){var a;return a=C.call(this,c,o,"[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 f=y.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var o=this.hls;o.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.on(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),o.on(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),o.on(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.on(P.Events.ERROR,this.onError,this),o.on(P.Events.BUFFER_RESET,this.onBufferReset,this),o.on(P.Events.BUFFER_CREATED,this.onBufferCreated,this),o.on(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),o.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f._unregisterListeners=function(){var o=this.hls;o.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.off(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),o.off(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),o.off(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.off(P.Events.ERROR,this.onError,this),o.off(P.Events.BUFFER_RESET,this.onBufferReset,this),o.off(P.Events.BUFFER_CREATED,this.onBufferCreated,this),o.off(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),o.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f.onInitPtsFound=function(o,a){var m=a.frag,p=a.id,v=a.initPTS;if(p==="main"){var O=m.cc;this.initPTS[m.cc]=v,this.log("InitPTS for cc: "+O+" found from main: "+v),this.videoTrackCC=O,this.state===k.State.WAITING_INIT_PTS&&this.tick()}},f.startLoad=function(o){if(!this.levels){this.startPosition=o,this.state=k.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(h),this.fragLoadError=0,a>0&&o===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=k.State.IDLE):(this.loadedmetadata=!1,this.state=k.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=o,this.tick()},f.doTick=function(){switch(this.state){case k.State.IDLE:this.doTickIdle();break;case k.State.WAITING_TRACK:{var o,a=this.levels,m=this.trackId,p=a==null||((o=a[m])===null||o===void 0)?void 0:o.details;if(p){if(this.waitForCdnTuneIn(p))break;this.state=k.State.WAITING_INIT_PTS}break}case k.State.FRAG_LOADING_WAITING_RETRY:{var v,O=performance.now(),U=this.retryDate;(!U||O>=U||(v=this.media)!==null&&v!==void 0&&v.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=k.State.IDLE);break}case k.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var G=j.frag,B=j.part,N=j.cache,V=j.complete;if(this.initPTS[G.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=k.State.FRAG_LOADING;var $=N.flush(),ie={frag:G,part:B,payload:$,networkDetails:null};this._handleFragmentLoadProgress(ie),V&&C.prototype._handleFragmentLoadComplete.call(this,ie)}else if(this.videoTrackCC!==this.waitingVideoCC)s.logger.log("Waiting fragment cc ("+G.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var oe=this.getLoadPosition(),_e=F.BufferHelper.bufferInfo(this.mediaBuffer,oe,this.config.maxBufferHole),fe=Object(_.fragmentWithinToleranceTest)(_e.end,this.config.maxFragLookUpTolerance,G);fe<0&&(s.logger.log("Waiting fragment cc ("+G.cc+") @ "+G.start+" cancelled because another fragment at "+_e.end+" is needed"),this.clearWaitingFragment())}}else this.state=k.State.IDLE}}this.onTickEnd()},f.clearWaitingFragment=function(){var o=this.waitingData;o&&(this.fragmentTracker.removeFragment(o.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=k.State.IDLE)},f.onTickEnd=function(){var o=this.media;if(!o||!o.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:o,m=a.buffered;!this.loadedmetadata&&m.length&&(this.loadedmetadata=!0),this.lastCurrentTime=o.currentTime},f.doTickIdle=function(){var o,a,m=this.hls,p=this.levels,v=this.media,O=this.trackId,U=m.config;if(!p||!p[O])return;if(!v&&(this.startFragRequested||!U.startFragPrefetch))return;var j=p[O],G=j.details;if(!G||G.live&&this.levelLastLoaded!==O||this.waitForCdnTuneIn(G)){this.state=k.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,E.ElementaryStreamTypes.AUDIO,R.PlaylistLevelType.AUDIO));var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,R.PlaylistLevelType.AUDIO);if(B===null)return;var N=B.len,V=this.getMaxBufferLength(),$=this.audioSwitch;if(N>=V&&!$)return;if(!$&&this._streamEnded(B,G)){m.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=k.State.ENDED;return}var ie=G.fragments,oe=ie[0].start,_e=B.end;if($){var fe=this.getLoadPosition();_e=fe,G.PTSKnown&&fe<oe&&((B.end>oe||B.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),v.currentTime=oe+.05))}var Se=this.getNextFragment(_e,G);if(!Se){this.bufferFlushed=!0;return}((o=Se.decryptdata)===null||o===void 0?void 0:o.keyFormat)==="identity"&&!((a=Se.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Se,G):this.loadFragment(Se,G,_e)},f.getMaxBufferLength=function(){var o=C.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,R.PlaylistLevelType.MAIN);return a===null?o:Math.max(o,a.len)},f.onMediaDetaching=function(){this.videoBuffer=null,C.prototype.onMediaDetaching.call(this)},f.onAudioTracksUpdated=function(o,a){var m=a.audioTracks;this.resetTransmuxer(),this.levels=m.map(function(p){return new D.Level(p)})},f.onAudioTrackSwitching=function(o,a){var m=!!a.url;this.trackId=a.id;var p=this.fragCurrent;p!=null&&p.loader&&p.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),m?this.setInterval(h):this.resetTransmuxer(),m?(this.audioSwitch=!0,this.state=k.State.IDLE):this.state=k.State.STOPPED,this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},f.onLevelLoaded=function(o,a){this.mainDetails=a.details},f.onAudioTrackLoaded=function(o,a){var m,p=this.levels,v=a.details,O=a.id;if(!p){this.warn("Audio tracks were reset while loading level "+O);return}this.log("Track "+O+" loaded ["+v.startSN+","+v.endSN+"],duration:"+v.totalduration);var U=p[O],j=0;if(v.live||(m=U.details)!==null&&m!==void 0&&m.live){var G=this.mainDetails;if(v.fragments[0]||(v.deltaUpdateFailed=!0),v.deltaUpdateFailed||!G)return;!U.details&&v.hasProgramDateTime&&G.hasProgramDateTime?(Object(b.alignMediaPlaylistByPDT)(v,G),j=v.fragments[0].start):j=this.alignPlaylists(v,U.details)}U.details=v,this.levelLastLoaded=O,!this.startFragRequested&&(this.mainDetails||!v.live)&&this.setStartPosition(U.details,j),this.state===k.State.WAITING_TRACK&&!this.waitForCdnTuneIn(v)&&(this.state=k.State.IDLE),this.tick()},f._handleFragmentLoadProgress=function(o){var a,m=o.frag,p=o.part,v=o.payload,O=this.config,U=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+m.sn+" of level "+m.level+" will not be buffered");return}var G=j[U];console.assert(G,"Audio track is defined on fragment load progress");var B=G.details;console.assert(B,"Audio track details are defined on fragment load progress");var N=O.defaultAudioCodec||G.audioCodec||"mp4a.40.2",V=this.transmuxer;V||(V=this.transmuxer=new T.default(this.hls,R.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var $=this.initPTS[m.cc],ie=(a=m.initSegment)===null||a===void 0?void 0:a.data;if($!==void 0){var oe=!1,_e=p?p.index:-1,fe=_e!==-1,Se=new A.ChunkMetadata(m.level,m.sn,m.stats.chunkCount,v.byteLength,_e,fe);V.push(v,ie,N,"",m,p,B.totalduration,oe,Se,$)}else{s.logger.log("Unknown video PTS for cc "+m.cc+", waiting for video PTS before demuxing audio frag "+m.sn+" of ["+B.startSN+" ,"+B.endSN+"],track "+U);var be=this.waitingData=this.waitingData||{frag:m,part:p,cache:new w.default,complete:!1},me=be.cache;me.push(new Uint8Array(v)),this.waitingVideoCC=this.videoTrackCC,this.state=k.State.WAITING_INIT_PTS}},f._handleFragmentLoadComplete=function(o){if(this.waitingData){this.waitingData.complete=!0;return}C.prototype._handleFragmentLoadComplete.call(this,o)},f.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},f.onBufferCreated=function(o,a){var m=a.tracks.audio;m&&(this.mediaBuffer=m.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},f.onFragBuffered=function(o,a){var m=a.frag,p=a.part;if(m.type!==R.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(m)){this.warn("Fragment "+m.sn+(p?" p: "+p.index:"")+" of level "+m.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}m.sn!=="initSegment"&&(this.fragPrevious=m,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(m,p)},f.onError=function(o,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(R.PlaylistLevelType.AUDIO,a);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==k.State.ERROR&&this.state!==k.State.STOPPED&&(this.state=a.fatal?k.State.ERROR:k.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===k.State.PARSING||this.state===k.State.PARSED)){var m=!0,p=this.getFwdBufferInfo(this.mediaBuffer,R.PlaylistLevelType.AUDIO);p&&p.len>.5&&(m=!this.reduceMaxBufferLength(p.len)),m&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,C.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},f.onBufferFlushed=function(o,a){var m=a.type;m===E.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},f._handleTransmuxComplete=function(o){var a,m="audio",p=this.hls,v=o.remuxResult,O=o.chunkMeta,U=this.getCurrentContext(O);if(!U){this.warn("The loading context changed while buffering fragment "+O.sn+" of level "+O.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(O.level);return}var j=U.frag,G=U.part,B=v.audio,N=v.text,V=v.id3,$=v.initSegment;if(this.fragContextChanged(j))return;if(this.state=k.State.PARSING,this.audioSwitch&&B&&this.completeAudioSwitch(),$!=null&&$.tracks&&(this._bufferInitSegment($.tracks,j,O),p.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:m,tracks:$.tracks})),B){var ie=B.startPTS,oe=B.endPTS,_e=B.startDTS,fe=B.endDTS;G&&(G.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:ie,endPTS:oe,startDTS:_e,endDTS:fe}),j.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,ie,oe,_e,fe),this.bufferFragmentData(B,j,G,O)}if(V!=null&&(a=V.samples)!==null&&a!==void 0&&a.length){var Se=u({frag:j,id:m},V);p.trigger(P.Events.FRAG_PARSING_METADATA,Se)}if(N){var be=u({frag:j,id:m},N);p.trigger(P.Events.FRAG_PARSING_USERDATA,be)}},f._bufferInitSegment=function(o,a,m){if(this.state!==k.State.PARSING)return;o.video&&delete o.video;var p=o.audio;if(!p)return;p.levelCodec=p.codec,p.id="audio",this.log("Init audio buffer, container:"+p.container+", codecs[parsed]=["+p.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,o);var v=p.initSegment;if(v!=null&&v.byteLength){var O={type:"audio",frag:a,part:null,chunkMeta:m,parent:a.type,data:v};this.hls.trigger(P.Events.BUFFER_APPENDING,O)}this.tick()},f.loadFragment=function(o,a,m){var p=this.fragmentTracker.getState(o);this.fragCurrent=o,(this.audioSwitch||p===M.FragmentState.NOT_LOADED||p===M.FragmentState.PARTIAL)&&(o.sn==="initSegment"?this._loadInitSegment(o):a.live&&!Object(H.isFiniteNumber)(this.initPTS[o.cc])?(this.log("Waiting for video PTS in continuity counter "+o.cc+" of live stream before loading audio fragment "+o.sn+" of level "+this.trackId),this.state=k.State.WAITING_INIT_PTS):(this.startFragRequested=!0,C.prototype.loadFragment.call(this,o,a,m)))},f.completeAudioSwitch=function(){var o=this.hls,a=this.media,m=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),C.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,o.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:m})},y}(k.default);z.default=g},"./src/controller/audio-track-controller.ts":function(re,z,L){"use strict";L.r(z);var H=L("./src/events.ts"),k=L("./src/errors.ts"),P=L("./src/controller/base-playlist-controller.ts"),F=L("./src/types/loader.ts");function M(T,A){for(var _=0;_<A.length;_++){var b=A[_];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(T,b.key,b)}}function D(T,A,_){return A&&M(T.prototype,A),_&&M(T,_),T}function R(T,A){T.prototype=Object.create(A.prototype),T.prototype.constructor=T,E(T,A)}function E(T,A){return E=Object.setPrototypeOf||function(b,d){return b.__proto__=d,b},E(T,A)}var w=function(T){R(A,T);function A(b){var d;return d=T.call(this,b,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var _=A.prototype;return _.registerListeners=function(){var d=this.hls;d.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(H.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(H.Events.ERROR,this.onError,this)},_.unregisterListeners=function(){var d=this.hls;d.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(H.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(H.Events.ERROR,this.onError,this)},_.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,T.prototype.destroy.call(this)},_.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},_.onManifestParsed=function(d,s){this.tracks=s.audioTracks||[]},_.onAudioTrackLoaded=function(d,s){var u=s.id,l=s.details,S=this.tracksInGroup[u];if(!S){this.warn("Invalid audio track id "+u);return}var h=S.details;S.details=s.details,this.log("audioTrack "+u+" loaded ["+l.startSN+"-"+l.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,s,h))},_.onLevelLoading=function(d,s){this.switchLevel(s.level)},_.onLevelSwitching=function(d,s){this.switchLevel(s.level)},_.switchLevel=function(d){var s=this.hls.levels[d];if(!(s!=null&&s.audioGroupIds))return;var u=s.audioGroupIds[s.urlId];if(this.groupId!==u){this.groupId=u;var l=this.tracks.filter(function(h){return!u||h.groupId===u});this.selectDefaultTrack&&!l.some(function(h){return h.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=l;var S={audioTracks:l};this.log("Updating audio tracks, "+l.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(H.Events.AUDIO_TRACKS_UPDATED,S),this.selectInitialTrack()}},_.onError=function(d,s){if(T.prototype.onError.call(this,d,s),s.fatal||!s.context)return;s.context.type===F.PlaylistContextType.AUDIO_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},_.setAudioTrack=function(d){var s=this.tracksInGroup;if(d<0||d>=s.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var u=s[this.trackId];this.log("Now switching to audio-track index "+d);var l=s[d],S=l.id,h=l.groupId,g=h===void 0?"":h,C=l.name,y=l.type,f=l.url;if(this.trackId=d,this.trackName=C,this.selectDefaultTrack=!1,this.hls.trigger(H.Events.AUDIO_TRACK_SWITCHING,{id:S,groupId:g,name:C,type:y,url:f}),l.details&&!l.details.live)return;var c=this.switchParams(l.url,u==null?void 0:u.details);this.loadPlaylist(c)},_.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var s=this.trackName,u=this.findTrackId(s)||this.findTrackId();u!==-1?this.setAudioTrack(u):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},_.findTrackId=function(d){for(var s=this.tracksInGroup,u=0;u<s.length;u++){var l=s[u];if((!this.selectDefaultTrack||l.default)&&(!d||d===l.name))return l.id}return-1},_.loadPlaylist=function(d){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var u=s.id,l=s.groupId,S=s.url;if(d)try{S=d.addDirectives(S)}catch(h){this.warn("Could not construct new URL with HLS Delivery Directives: "+h)}this.log("loading audio-track playlist for id: "+u),this.clearTimer(),this.hls.trigger(H.Events.AUDIO_TRACK_LOADING,{url:S,id:u,groupId:l,deliveryDirectives:d||null})}},D(A,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),A}(P.default);z.default=w},"./src/controller/base-playlist-controller.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return D});var H=L("./src/polyfills/number.ts"),k=L("./src/types/level.ts"),P=L("./src/controller/level-helper.ts"),F=L("./src/utils/logger.ts"),M=L("./src/errors.ts"),D=function(){function R(w,T){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=F.logger.log.bind(F.logger,T+":"),this.warn=F.logger.warn.bind(F.logger,T+":"),this.hls=w}var E=R.prototype;return E.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},E.onError=function(T,A){A.fatal&&A.type===M.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},E.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},E.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},E.stopLoad=function(){this.canLoad=!1,this.clearTimer()},E.switchParams=function(T,A){var _=A==null?void 0:A.renditionReports;if(_)for(var b=0;b<_.length;b++){var d=_[b],s=""+d.URI;if(s===T.substr(-s.length)){var u=parseInt(d["LAST-MSN"]),l=parseInt(d["LAST-PART"]);if(A&&this.hls.config.lowLatencyMode){var S=Math.min(A.age-A.partTarget,A.targetduration);l!==void 0&&S>A.partTarget&&(l+=1)}if(Object(H.isFiniteNumber)(u))return new k.HlsUrlParameters(u,Object(H.isFiniteNumber)(l)?l:void 0,k.HlsSkip.No)}}},E.loadPlaylist=function(T){},E.shouldLoadTrack=function(T){return this.canLoad&&T&&!!T.url&&(!T.details||T.details.live)},E.playlistLoaded=function(T,A,_){var b=this,d=A.details,s=A.stats,u=s.loading.end?Math.max(0,self.performance.now()-s.loading.end):0;if(d.advancedDateTime=Date.now()-u,d.live||_!=null&&_.live){if(d.reloaded(_),_&&this.log("live playlist "+T+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),_&&d.fragments.length>0&&Object(P.mergeDetails)(_,d),!this.canLoad||!d.live)return;var l,S=void 0,h=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var g=this.hls.config.lowLatencyMode,C=d.lastPartSn,y=d.endSN,f=d.lastPartIndex,c=f!==-1,o=C===y,a=g?0:f;c?(S=o?y+1:C,h=o?a:f+1):S=y+1;var m=d.age,p=m+d.ageHeader,v=Math.min(p-d.partTarget,d.targetduration*1.5);if(v>0){if(_&&v>_.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+_.tuneInGoal+" to: "+v+" with playlist age: "+d.age),v=0;else{var O=Math.floor(v/d.targetduration);if(S+=O,h!==void 0){var U=Math.round(v%d.targetduration/d.partTarget);h+=U}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+m.toFixed(2)+"s goal: "+v+" skip sn "+O+" to part "+h)}d.tuneInGoal=v}if(l=this.getDeliveryDirectives(d,A.deliveryDirectives,S,h),g||!o){this.loadPlaylist(l);return}}else l=this.getDeliveryDirectives(d,A.deliveryDirectives,S,h);var j=Object(P.computeReloadInterval)(d,s);S!==void 0&&d.canBlockReload&&(j-=d.partTarget||1),this.log("reload live playlist "+T+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return b.loadPlaylist(l)},j)}else this.clearTimer()},E.getDeliveryDirectives=function(T,A,_,b){var d=Object(k.getSkipValue)(T,_);return A!=null&&A.skip&&T.deltaUpdateFailed&&(_=A.msn,b=A.part,d=k.HlsSkip.No),new k.HlsUrlParameters(_,b,d)},E.retryLoadingOrFail=function(T){var A=this,_=this.hls.config,b=this.retryCount<_.levelLoadingMaxRetry;if(b){var d;if(this.retryCount++,T.details.indexOf("LoadTimeOut")>-1&&(d=T.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+T.details+'"'),this.loadPlaylist();else{var s=Math.min(Math.pow(2,this.retryCount)*_.levelLoadingRetryDelay,_.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return A.loadPlaylist()},s),this.warn("retry playlist loading #"+this.retryCount+" in "+s+' ms after "'+T.details+'"')}}else this.warn('cannot recover from error "'+T.details+'"'),this.clearTimer(),T.fatal=!0;return b},R}()},"./src/controller/base-stream-controller.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"State",function(){return y}),L.d(z,"default",function(){return f});var H=L("./src/polyfills/number.ts"),k=L("./src/task-loop.ts"),P=L("./src/controller/fragment-tracker.ts"),F=L("./src/utils/buffer-helper.ts"),M=L("./src/utils/logger.ts"),D=L("./src/events.ts"),R=L("./src/errors.ts"),E=L("./src/types/transmuxer.ts"),w=L("./src/utils/mp4-tools.ts"),T=L("./src/utils/discontinuities.ts"),A=L("./src/controller/fragment-finders.ts"),_=L("./src/controller/level-helper.ts"),b=L("./src/loader/fragment-loader.ts"),d=L("./src/crypt/decrypter.ts"),s=L("./src/utils/time-ranges.ts"),u=L("./src/types/loader.ts");function l(c,o){for(var a=0;a<o.length;a++){var m=o[a];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(c,m.key,m)}}function S(c,o,a){return o&&l(c.prototype,o),a&&l(c,a),c}function h(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function g(c,o){c.prototype=Object.create(o.prototype),c.prototype.constructor=c,C(c,o)}function C(c,o){return C=Object.setPrototypeOf||function(m,p){return m.__proto__=p,m},C(c,o)}var y={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"},f=function(c){g(o,c);function o(m,p,v){var O;return O=c.call(this)||this,O.hls=void 0,O.fragPrevious=null,O.fragCurrent=null,O.fragmentTracker=void 0,O.transmuxer=null,O._state=y.STOPPED,O.media=void 0,O.mediaBuffer=void 0,O.config=void 0,O.bitrateTest=!1,O.lastCurrentTime=0,O.nextLoadPosition=0,O.startPosition=0,O.loadedmetadata=!1,O.fragLoadError=0,O.retryDate=0,O.levels=null,O.fragmentLoader=void 0,O.levelLastLoaded=null,O.startFragRequested=!1,O.decrypter=void 0,O.initPTS=[],O.onvseeking=null,O.onvended=null,O.logPrefix="",O.log=void 0,O.warn=void 0,O.logPrefix=v,O.log=M.logger.log.bind(M.logger,v+":"),O.warn=M.logger.warn.bind(M.logger,v+":"),O.hls=m,O.fragmentLoader=new b.default(m.config),O.fragmentTracker=p,O.config=m.config,O.decrypter=new d.default(m,m.config),m.on(D.Events.KEY_LOADED,O.onKeyLoaded,h(O)),O}var a=o.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(p){},a.stopLoad=function(){this.fragmentLoader.abort();var p=this.fragCurrent;p&&this.fragmentTracker.removeFragment(p),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=y.STOPPED},a._streamEnded=function(p,v){var O=this.fragCurrent,U=this.fragmentTracker;if(!v.live&&O&&O.sn===v.endSN&&!p.nextStart){var j=U.getState(O);return j===P.FragmentState.PARTIAL||j===P.FragmentState.OK}return!1},a.onMediaAttached=function(p,v){var O=this.media=this.mediaBuffer=v.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),O.addEventListener("seeking",this.onvseeking),O.addEventListener("ended",this.onvended);var U=this.config;this.levels&&U.autoStartLoad&&this.state===y.STOPPED&&this.startLoad(U.startPosition)},a.onMediaDetaching=function(){var p=this.media;p!=null&&p.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),p&&(p.removeEventListener("seeking",this.onvseeking),p.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var p=this.config,v=this.fragCurrent,O=this.media,U=this.mediaBuffer,j=this.state,G=O?O.currentTime:0,B=F.BufferHelper.bufferInfo(U||O,G,p.maxBufferHole);if(this.log("media seeking to "+(Object(H.isFiniteNumber)(G)?G.toFixed(3):G)+", state: "+j),j===y.ENDED)this.resetLoadingState();else if(v&&!B.len){var N=p.maxFragLookUpTolerance,V=v.start-N,$=v.start+v.duration+N,ie=G>$;(G<V||ie)&&(ie&&v.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),v.loader.abort()),this.resetLoadingState())}O&&(this.lastCurrentTime=G),!this.loadedmetadata&&!B.len&&(this.nextLoadPosition=this.startPosition=G),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(p,v){if(this.state!==y.KEY_LOADING||v.frag!==this.fragCurrent||!this.levels)return;this.state=y.IDLE;var O=this.levels[v.frag.level].details;O&&this.loadFragment(v.frag,O,v.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=y.STOPPED,this.hls.off(D.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,c.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(p,v){this.log("Loading key for "+p.sn+" of ["+v.startSN+"-"+v.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level),this.state=y.KEY_LOADING,this.fragCurrent=p,this.hls.trigger(D.Events.KEY_LOADING,{frag:p})},a.loadFragment=function(p,v,O){this._loadFragForPlayback(p,v,O)},a._loadFragForPlayback=function(p,v,O){var U=this,j=function(B){if(U.fragContextChanged(p)){U.warn("Fragment "+p.sn+(B.part?" p: "+B.part.index:"")+" of level "+p.level+" was dropped during download."),U.fragmentTracker.removeFragment(p);return}p.stats.chunkCount++,U._handleFragmentLoadProgress(B)};this._doFragLoad(p,v,O,j).then(function(G){if(!G)return;U.fragLoadError=0;var B=U.state;if(U.fragContextChanged(p)){(B===y.FRAG_LOADING||B===y.BACKTRACKING||!U.fragCurrent&&B===y.PARSING)&&(U.fragmentTracker.removeFragment(p),U.state=y.IDLE);return}if("payload"in G&&(U.log("Loaded fragment "+p.sn+" of level "+p.level),U.hls.trigger(D.Events.FRAG_LOADED,G),U.state===y.BACKTRACKING)){U.fragmentTracker.backtrack(p,G),U.resetFragmentLoading(p);return}U._handleFragmentLoadComplete(G)}).catch(function(G){U.warn(G),U.resetFragmentLoading(p)})},a.flushMainBuffer=function(p,v,O){if(O===void 0&&(O=null),!(p-v))return;var U={startOffset:p,endOffset:v,type:O};this.fragLoadError=0,this.hls.trigger(D.Events.BUFFER_FLUSHING,U)},a._loadInitSegment=function(p){var v=this;this._doFragLoad(p).then(function(O){if(!O||v.fragContextChanged(p)||!v.levels)throw new Error("init load aborted");return O}).then(function(O){var U=v.hls,j=O.payload,G=p.decryptdata;if(j&&j.byteLength>0&&G&&G.key&&G.iv&&G.method==="AES-128"){var B=self.performance.now();return v.decrypter.webCryptoDecrypt(new Uint8Array(j),G.key.buffer,G.iv.buffer).then(function(N){var V=self.performance.now();return U.trigger(D.Events.FRAG_DECRYPTED,{frag:p,payload:N,stats:{tstart:B,tdecrypt:V}}),O.payload=N,O})}return O}).then(function(O){var U=v.fragCurrent,j=v.hls,G=v.levels;if(!G)throw new Error("init load aborted, missing levels");var B=G[p.level].details;console.assert(B,"Level details are defined when init segment is loaded");var N=p.stats;v.state=y.IDLE,v.fragLoadError=0,p.data=new Uint8Array(O.payload),N.parsing.start=N.buffering.start=self.performance.now(),N.parsing.end=N.buffering.end=self.performance.now(),O.frag===U&&j.trigger(D.Events.FRAG_BUFFERED,{stats:N,frag:U,part:null,id:p.type}),v.tick()}).catch(function(O){v.warn(O),v.resetFragmentLoading(p)})},a.fragContextChanged=function(p){var v=this.fragCurrent;return!p||!v||p.level!==v.level||p.sn!==v.sn||p.urlId!==v.urlId},a.fragBufferedComplete=function(p,v){var O=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+p.type+" sn: "+p.sn+(v?" part: "+v.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level+" "+s.default.toString(F.BufferHelper.getBuffered(O))),this.state=y.IDLE,this.tick()},a._handleFragmentLoadComplete=function(p){var v=this.transmuxer;if(!v)return;var O=p.frag,U=p.part,j=p.partsLoaded,G=!j||j.length===0||j.some(function(N){return!N}),B=new E.ChunkMetadata(O.level,O.sn,O.stats.chunkCount+1,0,U?U.index:-1,!G);v.flush(B)},a._handleFragmentLoadProgress=function(p){},a._doFragLoad=function(p,v,O,U){var j=this;if(O===void 0&&(O=null),!this.levels)throw new Error("frag load aborted, missing levels");if(O=Math.max(p.start,O||0),this.config.lowLatencyMode&&v){var G=v.partList;if(G&&U){O>p.end&&v.fragmentHint&&(p=v.fragmentHint);var B=this.getNextPart(G,p,O);if(B>-1){var N=G[B];return this.log("Loading part sn: "+p.sn+" p: "+N.index+" cc: "+p.cc+" of playlist ["+v.startSN+"-"+v.endSN+"] parts [0-"+B+"-"+(G.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(O.toFixed(3))),this.nextLoadPosition=N.start+N.duration,this.state=y.FRAG_LOADING,this.hls.trigger(D.Events.FRAG_LOADING,{frag:p,part:G[B],targetBufferTime:O}),this.doFragPartsLoad(p,G,B,U).catch(function(V){return j.handleFragLoadError(V)})}else if(!p.url||this.loadedEndOfParts(G,O))return Promise.resolve(null)}}return this.log("Loading fragment "+p.sn+" cc: "+p.cc+" "+(v?"of ["+v.startSN+"-"+v.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(O.toFixed(3))),Object(H.isFiniteNumber)(p.sn)&&!this.bitrateTest&&(this.nextLoadPosition=p.start+p.duration),this.state=y.FRAG_LOADING,this.hls.trigger(D.Events.FRAG_LOADING,{frag:p,targetBufferTime:O}),this.fragmentLoader.load(p,U).catch(function(V){return j.handleFragLoadError(V)})},a.doFragPartsLoad=function(p,v,O,U){var j=this;return new Promise(function(G,B){var N=[],V=function $(ie){var oe=v[ie];j.fragmentLoader.loadPart(p,oe,U).then(function(_e){N[oe.index]=_e;var fe=_e.part;j.hls.trigger(D.Events.FRAG_LOADED,_e);var Se=v[ie+1];if(Se&&Se.fragment===p)$(ie+1);else return G({frag:p,part:fe,partsLoaded:N})}).catch(B)};V(O)})},a.handleFragLoadError=function(p){var v=p.data;return v&&v.details===R.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(v.frag,v.part):this.hls.trigger(D.Events.ERROR,v),null},a._handleTransmuxerFlush=function(p){var v=this.getCurrentContext(p);if(!v||this.state!==y.PARSING){this.fragCurrent||(this.state=y.IDLE);return}var O=v.frag,U=v.part,j=v.level,G=self.performance.now();O.stats.parsing.end=G,U&&(U.stats.parsing.end=G),this.updateLevelTiming(O,U,j,p.partial)},a.getCurrentContext=function(p){var v=this.levels,O=p.level,U=p.sn,j=p.part;if(!v||!v[O])return this.warn("Levels object was unset while buffering fragment "+U+" of level "+O+". The current chunk will not be buffered."),null;var G=v[O],B=j>-1?Object(_.getPartWith)(G,U,j):null,N=B?B.fragment:Object(_.getFragmentWithSN)(G,U,this.fragCurrent);return N?{frag:N,part:B,level:G}:null},a.bufferFragmentData=function(p,v,O,U){if(!p||this.state!==y.PARSING)return;var j=p.data1,G=p.data2,B=j;if(j&&G&&(B=Object(w.appendUint8Array)(j,G)),!B||!B.length)return;var N={type:p.type,frag:v,part:O,chunkMeta:U,parent:v.type,data:B};this.hls.trigger(D.Events.BUFFER_APPENDING,N),p.dropped&&p.independent&&!O&&this.flushBufferGap(v)},a.flushBufferGap=function(p){var v=this.media;if(!v)return;if(!F.BufferHelper.isBuffered(v,v.currentTime)){this.flushMainBuffer(0,p.start);return}var O=v.currentTime,U=F.BufferHelper.bufferInfo(v,O,0),j=p.duration,G=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),B=Math.max(Math.min(p.start-G,U.end-G),O+G);p.start-B>G&&this.flushMainBuffer(B,p.start)},a.getFwdBufferInfo=function(p,v){var O=this.config,U=this.getLoadPosition();if(!Object(H.isFiniteNumber)(U))return null;var j=F.BufferHelper.bufferInfo(p,U,O.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var G=this.fragmentTracker.getBufferedFrag(U,v);if(G&&j.nextStart<G.end)return F.BufferHelper.bufferInfo(p,U,Math.max(j.nextStart,O.maxBufferHole))}return j},a.getMaxBufferLength=function(p){var v=this.config,O;return p?O=Math.max(8*v.maxBufferSize/p,v.maxBufferLength):O=v.maxBufferLength,Math.min(O,v.maxMaxBufferLength)},a.reduceMaxBufferLength=function(p){var v=this.config,O=p||v.maxBufferLength;return v.maxMaxBufferLength>=O?(v.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+v.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(p,v){var O,U,j=v.fragments,G=j.length;if(!G)return null;var B=this.config,N=j[0].start,V;if(v.live){var $=B.initialLiveManifestSize;if(G<$)return this.warn("Not enough fragments to start playback (have: "+G+", need: "+$+")"),null;!v.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(V=this.getInitialLiveFragment(v,j),this.startPosition=V?this.hls.liveSyncPosition||V.start:p)}else p<=N&&(V=j[0]);if(!V){var ie=B.lowLatencyMode?v.partEnd:v.fragmentEnd;V=this.getFragmentAtPosition(p,ie,v)}return(O=V)!==null&&O!==void 0&&O.initSegment&&!((U=V)!==null&&U!==void 0&&U.initSegment.data)&&!this.bitrateTest&&(V=V.initSegment),V},a.getNextPart=function(p,v,O){for(var U=-1,j=!1,G=!0,B=0,N=p.length;B<N;B++){var V=p[B];if(G=G&&!V.independent,U>-1&&O<V.start)break;var $=V.loaded;!$&&(j||V.independent||G)&&V.fragment===v&&(U=B),j=$}return U},a.loadedEndOfParts=function(p,v){var O=p[p.length-1];return O&&v>O.start&&O.loaded},a.getInitialLiveFragment=function(p,v){var O=this.fragPrevious,U=null;if(O){if(p.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+O.programDateTime),U=Object(A.findFragmentByPDT)(v,O.endProgramDateTime,this.config.maxFragLookUpTolerance)),!U){var j=O.sn+1;if(j>=p.startSN&&j<=p.endSN){var G=v[j-p.startSN];O.cc===G.cc&&(U=G,this.log("Live playlist, switching playlist, load frag with next SN: "+U.sn))}U||(U=Object(A.findFragWithCC)(v,O.cc),U&&this.log("Live playlist, switching playlist, load frag with same CC: "+U.sn))}}else{var B=this.hls.liveSyncPosition;B!==null&&(U=this.getFragmentAtPosition(B,this.bitrateTest?p.fragmentEnd:p.edge,p))}return U},a.getFragmentAtPosition=function(p,v,O){var U=this.config,j=this.fragPrevious,G=O.fragments,B=O.endSN,N=O.fragmentHint,V=U.maxFragLookUpTolerance,$=!!(U.lowLatencyMode&&O.partList&&N);$&&N&&!this.bitrateTest&&(G=G.concat(N),B=N.sn);var ie;if(p<v){var oe=p>v-V?0:V;ie=Object(A.findFragmentByPTS)(j,G,p,oe)}else ie=G[G.length-1];if(ie){var _e=ie.sn-O.startSN,fe=j&&ie.level===j.level,Se=G[_e+1],be=this.fragmentTracker.getState(ie);if(be===P.FragmentState.BACKTRACKED){ie=null;for(var me=_e;G[me]&&this.fragmentTracker.getState(G[me])===P.FragmentState.BACKTRACKED;)j?ie=G[me--]:ie=G[--me];ie||(ie=Se)}else j&&ie.sn===j.sn&&!$&&(fe&&(ie.sn<B&&this.fragmentTracker.getState(Se)!==P.FragmentState.OK?(this.log("SN "+ie.sn+" just loaded, load next one: "+Se.sn),ie=Se):ie=null))}return ie},a.synchronizeToLiveEdge=function(p){var v=this.config,O=this.media;if(!O)return;var U=this.hls.liveSyncPosition,j=O.currentTime,G=p.fragments[0].start,B=p.edge,N=j>=G-v.maxFragLookUpTolerance&&j<=B;if(U!==null&&O.duration>U&&(j<U||!N)){var V=v.liveMaxLatencyDuration!==void 0?v.liveMaxLatencyDuration:v.liveMaxLatencyDurationCount*p.targetduration;(!N&&O.readyState<4||j<B-V)&&(this.loadedmetadata||(this.nextLoadPosition=U),O.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+B+", reset currentTime to : "+U.toFixed(3)),O.currentTime=U))}},a.alignPlaylists=function(p,v){var O=this.levels,U=this.levelLastLoaded,j=this.fragPrevious,G=U!==null?O[U]:null,B=p.fragments.length;if(!B)return this.warn("No fragments in live playlist"),0;var N=p.fragments[0].start,V=!v,$=p.alignedSliding&&Object(H.isFiniteNumber)(N);if(V||!$&&!N){Object(T.alignStream)(j,G,p);var ie=p.fragments[0].start;return this.log("Live playlist sliding: "+ie.toFixed(2)+" start-sn: "+(v?v.startSN:"na")+"->"+p.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+B),ie}return N},a.waitForCdnTuneIn=function(p){var v=3;return p.live&&p.canBlockReload&&p.tuneInGoal>Math.max(p.partHoldBack,p.partTarget*v)},a.setStartPosition=function(p,v){var O=this.startPosition;if(O<v&&(O=-1),O===-1||this.lastCurrentTime===-1){var U=p.startTimeOffset;Object(H.isFiniteNumber)(U)?(O=v+U,U<0&&(O+=p.totalduration),O=Math.min(Math.max(v,O),v+p.totalduration),this.log("Start time offset "+U+" found in playlist, adjust startPosition to "+O),this.startPosition=O):p.live?O=this.hls.liveSyncPosition||v:this.startPosition=O=0,this.lastCurrentTime=O}this.nextLoadPosition=O},a.getLoadPosition=function(){var p=this.media,v=0;return this.loadedmetadata&&p?v=p.currentTime:this.nextLoadPosition&&(v=this.nextLoadPosition),v},a.handleFragLoadAborted=function(p,v){this.transmuxer&&p.sn!=="initSegment"&&p.stats.aborted&&(this.warn("Fragment "+p.sn+(v?" part"+v.index:"")+" of level "+p.level+" was aborted"),this.resetFragmentLoading(p))},a.resetFragmentLoading=function(p){(!this.fragCurrent||!this.fragContextChanged(p))&&(this.state=y.IDLE)},a.onFragmentOrKeyLoadError=function(p,v){if(v.fatal)return;var O=v.frag;if(!O||O.type!==p)return;var U=this.fragCurrent;console.assert(U&&O.sn===U.sn&&O.level===U.level&&O.urlId===U.urlId,"Frag load error must match current frag to retry");var j=this.config;if(this.fragLoadError+1<=j.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(O.level))return;var G=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+O.sn+" of "+p+" "+O.level+" failed to load, retrying in "+G+"ms"),this.retryDate=self.performance.now()+G,this.fragLoadError++,this.state=y.FRAG_LOADING_WAITING_RETRY}else v.levelRetry?(p===u.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=y.IDLE):(M.logger.error(v.details+" reaches max retry, redispatch as fatal ..."),v.fatal=!0,this.hls.stopLoad(),this.state=y.ERROR)},a.afterBufferFlushed=function(p,v,O){if(!p)return;var U=F.BufferHelper.getBuffered(p);this.fragmentTracker.detectEvictedFragments(v,U,O),this.state===y.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=y.IDLE},a.resetLiveStartWhenNotLoaded=function(p){if(!this.loadedmetadata){this.startFragRequested=!1;var v=this.levels?this.levels[p].details:null;if(v!=null&&v.live)return this.startPosition=-1,this.setStartPosition(v,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(p,v,O,U){var j=this,G=O.details;console.assert(!!G,"level.details must be defined");var B=Object.keys(p.elementaryStreams).reduce(function(N,V){var $=p.elementaryStreams[V];if($){var ie=$.endPTS-$.startPTS;if(ie<=0)return j.warn("Could not parse fragment "+p.sn+" "+V+" duration reliably ("+ie+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),N||!1;var oe=U?0:Object(_.updateFragPTSDTS)(G,p,$.startPTS,$.endPTS,$.startDTS,$.endDTS);return j.hls.trigger(D.Events.LEVEL_PTS_UPDATED,{details:G,level:O,drift:oe,type:V,frag:p,start:$.startPTS,end:$.endPTS}),!0}return N},!1);B?(this.state=y.PARSED,this.hls.trigger(D.Events.FRAG_PARSED,{frag:p,part:v})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},S(o,[{key:"state",get:function(){return this._state},set:function(p){var v=this._state;v!==p&&(this._state=p,this.log(v+"->"+p))}}]),o}(k.default)},"./src/controller/buffer-controller.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return A});var H=L("./src/polyfills/number.ts"),k=L("./src/events.ts"),P=L("./src/utils/logger.ts"),F=L("./src/errors.ts"),M=L("./src/utils/buffer-helper.ts"),D=L("./src/utils/mediasource-helper.ts"),R=L("./src/loader/fragment.ts"),E=L("./src/controller/buffer-operation-queue.ts"),w=Object(D.getMediaSource)(),T=/([ha]vc.)(?:\.[^.,]+)+/,A=function(){function _(d){var s=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=s.hls,l=s.media,S=s.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),l&&(s.updateMediaElementDuration(),u.trigger(k.Events.MEDIA_ATTACHED,{media:l})),S&&S.removeEventListener("sourceopen",s._onMediaSourceOpen),s.checkPendingTracks()},this._onMediaSourceClose=function(){P.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){P.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var b=_.prototype;return b.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},b.destroy=function(){this.unregisterListeners(),this.details=null},b.registerListeners=function(){var s=this.hls;s.on(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(k.Events.BUFFER_RESET,this.onBufferReset,this),s.on(k.Events.BUFFER_APPENDING,this.onBufferAppending,this),s.on(k.Events.BUFFER_CODECS,this.onBufferCodecs,this),s.on(k.Events.BUFFER_EOS,this.onBufferEos,this),s.on(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),s.on(k.Events.LEVEL_UPDATED,this.onLevelUpdated,this),s.on(k.Events.FRAG_PARSED,this.onFragParsed,this),s.on(k.Events.FRAG_CHANGED,this.onFragChanged,this)},b.unregisterListeners=function(){var s=this.hls;s.off(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(k.Events.BUFFER_RESET,this.onBufferReset,this),s.off(k.Events.BUFFER_APPENDING,this.onBufferAppending,this),s.off(k.Events.BUFFER_CODECS,this.onBufferCodecs,this),s.off(k.Events.BUFFER_EOS,this.onBufferEos,this),s.off(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),s.off(k.Events.LEVEL_UPDATED,this.onLevelUpdated,this),s.off(k.Events.FRAG_PARSED,this.onFragParsed,this),s.off(k.Events.FRAG_CHANGED,this.onFragChanged,this)},b._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new E.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},b.onManifestParsed=function(s,u){var l=2;(u.audio&&!u.video||!u.altAudio)&&(l=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=l,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},b.onMediaAttaching=function(s,u){var l=this.media=u.media;if(l&&w){var S=this.mediaSource=new w;S.addEventListener("sourceopen",this._onMediaSourceOpen),S.addEventListener("sourceended",this._onMediaSourceEnded),S.addEventListener("sourceclose",this._onMediaSourceClose),l.src=self.URL.createObjectURL(S),this._objectUrl=l.src}},b.onMediaDetaching=function(){var s=this.media,u=this.mediaSource,l=this._objectUrl;if(u){if(P.logger.log("[buffer-controller]: media source detaching"),u.readyState==="open")try{u.endOfStream()}catch(S){P.logger.warn("[buffer-controller]: onMediaDetaching: "+S.message+" while calling endOfStream")}this.onBufferReset(),u.removeEventListener("sourceopen",this._onMediaSourceOpen),u.removeEventListener("sourceended",this._onMediaSourceEnded),u.removeEventListener("sourceclose",this._onMediaSourceClose),s&&(l&&self.URL.revokeObjectURL(l),s.src===l?(s.removeAttribute("src"),s.load()):P.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(k.Events.MEDIA_DETACHED,void 0)},b.onBufferReset=function(){var s=this;this.getSourceBufferTypes().forEach(function(u){var l=s.sourceBuffer[u];try{l&&(s.removeBufferListeners(u),s.mediaSource&&s.mediaSource.removeSourceBuffer(l),s.sourceBuffer[u]=void 0)}catch(S){P.logger.warn("[buffer-controller]: Failed to reset the "+u+" buffer",S)}}),this._initSourceBuffer()},b.onBufferCodecs=function(s,u){var l=this,S=this.getSourceBufferTypes().length;if(Object.keys(u).forEach(function(h){if(S){var g=l.tracks[h];if(g&&typeof g.buffer.changeType=="function"){var C=u[h],y=C.codec,f=C.levelCodec,c=C.container,o=(g.levelCodec||g.codec).replace(T,"$1"),a=(f||y).replace(T,"$1");if(o!==a){var m=c+";codecs="+(f||y);l.appendChangeType(h,m)}}}else l.pendingTracks[h]=u[h]}),S)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},b.appendChangeType=function(s,u){var l=this,S=this.operationQueue,h={execute:function(){var C=l.sourceBuffer[s];C&&(P.logger.log("[buffer-controller]: changing "+s+" sourceBuffer type to "+u),C.changeType(u)),S.shiftAndExecuteNext(s)},onStart:function(){},onComplete:function(){},onError:function(C){P.logger.warn("[buffer-controller]: Failed to change "+s+" SourceBuffer type",C)}};S.append(h,s)},b.onBufferAppending=function(s,u){var l=this,S=this.hls,h=this.operationQueue,g=this.tracks,C=u.data,y=u.type,f=u.frag,c=u.part,o=u.chunkMeta,a=o.buffering[y],m=self.performance.now();a.start=m;var p=f.stats.buffering,v=c?c.stats.buffering:null;p.start===0&&(p.start=m),v&&v.start===0&&(v.start=m);var O=g.audio,U=y==="audio"&&o.id===1&&(O==null?void 0:O.container)==="audio/mpeg",j={execute:function(){if(a.executeStart=self.performance.now(),U){var B=l.sourceBuffer[y];if(B){var N=f.start-B.timestampOffset;Math.abs(N)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+f.start+" (delta: "+N+") sn: "+f.sn+")"),B.timestampOffset=f.start)}}l.appendExecutor(C,y)},onStart:function(){},onComplete:function(){var B=self.performance.now();a.executeEnd=a.end=B,p.first===0&&(p.first=B),v&&v.first===0&&(v.first=B);var N=l.sourceBuffer,V={};for(var $ in N)V[$]=M.BufferHelper.getBuffered(N[$]);l.appendError=0,l.hls.trigger(k.Events.BUFFER_APPENDED,{type:y,frag:f,part:c,chunkMeta:o,parent:f.type,timeRanges:V})},onError:function(B){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+y+" SourceBuffer",B);var N={type:F.ErrorTypes.MEDIA_ERROR,parent:f.type,details:F.ErrorDetails.BUFFER_APPEND_ERROR,err:B,fatal:!1};B.code===DOMException.QUOTA_EXCEEDED_ERR?N.details=F.ErrorDetails.BUFFER_FULL_ERROR:(l.appendError++,N.details=F.ErrorDetails.BUFFER_APPEND_ERROR,l.appendError>S.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+S.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),N.fatal=!0)),S.trigger(k.Events.ERROR,N)}};h.append(j,y)},b.onBufferFlushing=function(s,u){var l=this,S=this.operationQueue,h=function(C){return{execute:l.removeExecutor.bind(l,C,u.startOffset,u.endOffset),onStart:function(){},onComplete:function(){l.hls.trigger(k.Events.BUFFER_FLUSHED,{type:C})},onError:function(f){P.logger.warn("[buffer-controller]: Failed to remove from "+C+" SourceBuffer",f)}}};u.type?S.append(h(u.type),u.type):this.getSourceBufferTypes().forEach(function(g){S.append(h(g),g)})},b.onFragParsed=function(s,u){var l=this,S=u.frag,h=u.part,g=[],C=h?h.elementaryStreams:S.elementaryStreams;C[R.ElementaryStreamTypes.AUDIOVIDEO]?g.push("audiovideo"):(C[R.ElementaryStreamTypes.AUDIO]&&g.push("audio"),C[R.ElementaryStreamTypes.VIDEO]&&g.push("video"));var y=function(){var c=self.performance.now();S.stats.buffering.end=c,h&&(h.stats.buffering.end=c);var o=h?h.stats:S.stats;l.hls.trigger(k.Events.FRAG_BUFFERED,{frag:S,part:h,stats:o,id:S.type})};g.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+S.type+" level: "+S.level+" sn: "+S.sn),this.blockBuffers(y,g)},b.onFragChanged=function(s,u){this.flushBackBuffer()},b.onBufferEos=function(s,u){var l=this,S=this.getSourceBufferTypes().reduce(function(h,g){var C=l.sourceBuffer[g];return(!u.type||u.type===g)&&(C&&!C.ended&&(C.ended=!0,P.logger.log("[buffer-controller]: "+g+" sourceBuffer now EOS"))),h&&!!(!C||C.ended)},!0);S&&this.blockBuffers(function(){var h=l.mediaSource;if(!h||h.readyState!=="open")return;h.endOfStream()})},b.onLevelUpdated=function(s,u){var l=u.details;if(!l.fragments.length)return;this.details=l,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},b.flushBackBuffer=function(){var s=this.hls,u=this.details,l=this.media,S=this.sourceBuffer;if(!l||u===null)return;var h=this.getSourceBufferTypes();if(!h.length)return;var g=u.live&&s.config.liveBackBufferLength!==null?s.config.liveBackBufferLength:s.config.backBufferLength;if(!Object(H.isFiniteNumber)(g)||g<0)return;var C=l.currentTime,y=u.levelTargetDuration,f=Math.max(g,y),c=Math.floor(C/y)*y-f;h.forEach(function(o){var a=S[o];if(a){var m=M.BufferHelper.getBuffered(a);m.length>0&&c>m.start(0)&&(s.trigger(k.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),u.live&&s.trigger(k.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),s.trigger(k.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:o}))}})},b.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var s=this.details,u=this.hls,l=this.media,S=this.mediaSource,h=s.fragments[0].start+s.totalduration,g=l.duration,C=Object(H.isFiniteNumber)(S.duration)?S.duration:0;s.live&&u.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),S.duration=Infinity,this.updateSeekableRange(s)):(h>C&&h>g||!Object(H.isFiniteNumber)(g))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+h.toFixed(3)),S.duration=h)},b.updateSeekableRange=function(s){var u=this.mediaSource,l=s.fragments,S=l.length;if(S&&s.live&&u!==null&&u!==void 0&&u.setLiveSeekableRange){var h=Math.max(0,l[0].start),g=Math.max(h,h+s.totalduration);u.setLiveSeekableRange(h,g)}},b.checkPendingTracks=function(){var s=this.bufferCodecEventsExpected,u=this.operationQueue,l=this.pendingTracks,S=Object.keys(l).length;if(S&&!s||S===2){this.createSourceBuffers(l),this.pendingTracks={};var h=this.getSourceBufferTypes();if(h.length===0){this.hls.trigger(k.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}h.forEach(function(g){u.executeNext(g)})}},b.createSourceBuffers=function(s){var u=this.sourceBuffer,l=this.mediaSource;if(!l)throw Error("createSourceBuffers called when mediaSource was null");var S=0;for(var h in s)if(!u[h]){var g=s[h];if(!g)throw Error("source buffer exists for track "+h+", however track does not");var C=g.levelCodec||g.codec,y=g.container+";codecs="+C;P.logger.log("[buffer-controller]: creating sourceBuffer("+y+")");try{var f=u[h]=l.addSourceBuffer(y),c=h;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[h]={buffer:f,codec:C,container:g.container,levelCodec:g.levelCodec,id:g.id},S++}catch(o){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+o.message),this.hls.trigger(k.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:o,mimeType:y})}}S&&this.hls.trigger(k.Events.BUFFER_CREATED,{tracks:this.tracks})},b._onSBUpdateStart=function(s){var u=this.operationQueue,l=u.current(s);l.onStart()},b._onSBUpdateEnd=function(s){var u=this.operationQueue,l=u.current(s);l.onComplete(),u.shiftAndExecuteNext(s)},b._onSBUpdateError=function(s,u){P.logger.error("[buffer-controller]: "+s+" SourceBuffer error",u),this.hls.trigger(k.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var l=this.operationQueue.current(s);l&&l.onError(u)},b.removeExecutor=function(s,u,l){var S=this.media,h=this.mediaSource,g=this.operationQueue,C=this.sourceBuffer,y=C[s];if(!S||!h||!y){P.logger.warn("[buffer-controller]: Attempting to remove from the "+s+" SourceBuffer, but it does not exist"),g.shiftAndExecuteNext(s);return}var f=Object(H.isFiniteNumber)(S.duration)?S.duration:Infinity,c=Object(H.isFiniteNumber)(h.duration)?h.duration:Infinity,o=Math.max(0,u),a=Math.min(l,f,c);a>o?(P.logger.log("[buffer-controller]: Removing ["+o+","+a+"] from the "+s+" SourceBuffer"),console.assert(!y.updating,s+" sourceBuffer must not be updating"),y.remove(o,a)):g.shiftAndExecuteNext(s)},b.appendExecutor=function(s,u){var l=this.operationQueue,S=this.sourceBuffer,h=S[u];if(!h){P.logger.warn("[buffer-controller]: Attempting to append to the "+u+" SourceBuffer, but it does not exist"),l.shiftAndExecuteNext(u);return}h.ended=!1,console.assert(!h.updating,u+" sourceBuffer must not be updating"),h.appendBuffer(s)},b.blockBuffers=function(s,u){var l=this;if(u===void 0&&(u=this.getSourceBufferTypes()),!u.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(s);return}var S=this.operationQueue,h=u.map(function(g){return S.appendBlocker(g)});Promise.all(h).then(function(){s(),u.forEach(function(g){var C=l.sourceBuffer[g];(!C||!C.updating)&&S.shiftAndExecuteNext(g)})})},b.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},b.addBufferListener=function(s,u,l){var S=this.sourceBuffer[s];if(!S)return;var h=l.bind(this,s);this.listeners[s].push({event:u,listener:h}),S.addEventListener(u,h)},b.removeBufferListeners=function(s){var u=this.sourceBuffer[s];if(!u)return;this.listeners[s].forEach(function(l){u.removeEventListener(l.event,l.listener)})},_}()},"./src/controller/buffer-operation-queue.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return k});var H=L("./src/utils/logger.ts"),k=function(){function P(M){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=M}var F=P.prototype;return F.append=function(D,R){var E=this.queues[R];E.push(D),E.length===1&&this.buffers[R]&&this.executeNext(R)},F.insertAbort=function(D,R){var E=this.queues[R];E.unshift(D),this.executeNext(R)},F.appendBlocker=function(D){var R,E=new Promise(function(T){R=T}),w={execute:R,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(w,D),E},F.executeNext=function(D){var R=this.buffers,E=this.queues,w=R[D],T=E[D];if(T.length){var A=T[0];try{A.execute()}catch(_){H.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),A.onError(_),(!w||!w.updating)&&(T.shift(),this.executeNext(D))}}},F.shiftAndExecuteNext=function(D){this.queues[D].shift(),this.executeNext(D)},F.current=function(D){return this.queues[D][0]},P}()},"./src/controller/cap-level-controller.ts":function(re,z,L){"use strict";L.r(z);var H=L("./src/events.ts");function k(M,D){for(var R=0;R<D.length;R++){var E=D[R];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(M,E.key,E)}}function P(M,D,R){return D&&k(M.prototype,D),R&&k(M,R),M}var F=function(){function M(R){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=R,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var D=M.prototype;return D.setStreamController=function(E){this.streamController=E},D.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},D.registerListeners=function(){var E=this.hls;E.on(H.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),E.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),E.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.on(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),E.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},D.unregisterListener=function(){var E=this.hls;E.off(H.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),E.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),E.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.off(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),E.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},D.onFpsDropLevelCapping=function(E,w){M.isLevelAllowed(w.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(w.droppedLevel)},D.onMediaAttaching=function(E,w){this.media=w.media instanceof HTMLVideoElement?w.media:null},D.onManifestParsed=function(E,w){var T=this.hls;this.restrictedLevels=[],this.firstLevel=w.firstLevel,T.config.capLevelToPlayerSize&&w.video&&this.startCapping()},D.onBufferCodecs=function(E,w){var T=this.hls;T.config.capLevelToPlayerSize&&w.video&&this.startCapping()},D.onMediaDetaching=function(){this.stopCapping()},D.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var E=this.hls.levels;if(E.length){var w=this.hls;w.autoLevelCapping=this.getMaxLevel(E.length-1),w.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=w.autoLevelCapping}}},D.getMaxLevel=function(E){var w=this,T=this.hls.levels;if(!T.length)return-1;var A=T.filter(function(_,b){return M.isLevelAllowed(b,w.restrictedLevels)&&b<=E});return this.clientRect=null,M.getMaxLevelByMediaSize(A,this.mediaWidth,this.mediaHeight)},D.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()},D.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},D.getDimensions=function(){if(this.clientRect)return this.clientRect;var E=this.media,w={width:0,height:0};if(E){var T=E.getBoundingClientRect();w.width=T.width,w.height=T.height,!w.width&&!w.height&&(w.width=T.right-T.left||E.width||0,w.height=T.bottom-T.top||E.height||0)}return this.clientRect=w,w},M.isLevelAllowed=function(E,w){return w===void 0&&(w=[]),w.indexOf(E)===-1},M.getMaxLevelByMediaSize=function(E,w,T){if(!E||!E.length)return-1;for(var A=function(u,l){return l?u.width!==l.width||u.height!==l.height:!0},_=E.length-1,b=0;b<E.length;b+=1){var d=E[b];if((d.width>=w||d.height>=T)&&A(d,E[b+1])){_=b;break}}return _},P(M,[{key:"mediaWidth",get:function(){return this.getDimensions().width*M.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*M.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var E=1;try{E=self.devicePixelRatio}catch(w){}return E}}]),M}();z.default=F},"./src/controller/cmcd-controller.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return A});var H=L("./src/events.ts"),k=L("./src/types/cmcd.ts"),P=L("./src/utils/buffer-helper.ts"),F=L("./src/utils/logger.ts");function M(_,b){for(var d=0;d<b.length;d++){var s=b[d];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(_,s.key,s)}}function D(_,b,d){return b&&M(_.prototype,b),d&&M(_,d),_}function R(_,b){var d=typeof Symbol!="undefined"&&_[Symbol.iterator]||_["@@iterator"];if(d)return(d=d.call(_)).next.bind(d);if(Array.isArray(_)||(d=E(_))||b&&_&&typeof _.length=="number"){d&&(_=d);var s=0;return function(){return s>=_.length?{done:!0}:{done:!1,value:_[s++]}}}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 E(_,b){if(!_)return;if(typeof _=="string")return w(_,b);var d=Object.prototype.toString.call(_).slice(8,-1);if(d==="Object"&&_.constructor&&(d=_.constructor.name),d==="Map"||d==="Set")return Array.from(_);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return w(_,b)}function w(_,b){(b==null||b>_.length)&&(b=_.length);for(var d=0,s=new Array(b);d<b;d++)s[d]=_[d];return s}function T(){return T=Object.assign||function(_){for(var b=1;b<arguments.length;b++){var d=arguments[b];for(var s in d)Object.prototype.hasOwnProperty.call(d,s)&&(_[s]=d[s])}return _},T.apply(this,arguments)}var A=function(){function _(d){var s=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(){s.initialized&&(s.starved=!0),s.buffering=!0},this.onPlaying=function(){s.initialized||(s.initialized=!0),s.buffering=!1},this.applyPlaylistData=function(S){try{s.apply(S,{ot:k.CMCDObjectType.MANIFEST,su:!s.initialized})}catch(h){F.logger.warn("Could not generate manifest CMCD data.",h)}},this.applyFragmentData=function(S){try{var h=S.frag,g=s.hls.levels[h.level],C=s.getObjectType(h),y={d:h.duration*1e3,ot:C};(C===k.CMCDObjectType.VIDEO||C===k.CMCDObjectType.AUDIO||C==k.CMCDObjectType.MUXED)&&(y.br=g.bitrate/1e3,y.tb=s.getTopBandwidth(C),y.bl=s.getBufferLength(C)),s.apply(S,y)}catch(f){F.logger.warn("Could not generate segment CMCD data.",f)}},this.hls=d;var u=this.config=d.config,l=u.cmcd;l!=null&&(u.pLoader=this.createPlaylistLoader(),u.fLoader=this.createFragmentLoader(),this.sid=l.sessionId||_.uuid(),this.cid=l.contentId,this.useHeaders=l.useHeaders===!0,this.registerListeners())}var b=_.prototype;return b.registerListeners=function(){var s=this.hls;s.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),s.on(H.Events.BUFFER_CREATED,this.onBufferCreated,this)},b.unregisterListeners=function(){var s=this.hls;s.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),s.off(H.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},b.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},b.onMediaAttached=function(s,u){this.media=u.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},b.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},b.onBufferCreated=function(s,u){var l,S;this.audioBuffer=(l=u.tracks.audio)===null||l===void 0?void 0:l.buffer,this.videoBuffer=(S=u.tracks.video)===null||S===void 0?void 0:S.buffer},b.createData=function(){var s;return{v:k.CMCDVersion,sf:k.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(s=this.media)===null||s===void 0?void 0:s.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},b.apply=function(s,u){u===void 0&&(u={}),T(u,this.createData());var l=u.ot===k.CMCDObjectType.INIT||u.ot===k.CMCDObjectType.VIDEO||u.ot===k.CMCDObjectType.MUXED;if(this.starved&&l&&(u.bs=!0,u.su=!0,this.starved=!1),u.su==null&&(u.su=this.buffering),this.useHeaders){var S=_.toHeaders(u);if(!Object.keys(S).length)return;s.headers||(s.headers={}),T(s.headers,S)}else{var h=_.toQuery(u);if(!h)return;s.url=_.appendQueryToUri(s.url,h)}},b.getObjectType=function(s){var u=s.type;return u==="subtitle"?k.CMCDObjectType.TIMED_TEXT:s.sn==="initSegment"?k.CMCDObjectType.INIT:u==="audio"?k.CMCDObjectType.AUDIO:u==="main"?this.hls.audioTracks.length?k.CMCDObjectType.VIDEO:k.CMCDObjectType.MUXED:void 0},b.getTopBandwidth=function(s){for(var u=0,l=s===k.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,S=R(l),h;!(h=S()).done;){var g=h.value;g.bitrate>u&&(u=g.bitrate)}return u>0?u:NaN},b.getBufferLength=function(s){var u=this.hls.media,l=s===k.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!l||!u)return NaN;var S=P.BufferHelper.bufferInfo(l,u.currentTime,this.config.maxBufferHole);return S.len*1e3},b.createPlaylistLoader=function(){var s=this.config.pLoader,u=this.applyPlaylistData,l=s||this.config.loader;return function(){function S(g){this.loader=void 0,this.loader=new l(g)}var h=S.prototype;return h.destroy=function(){this.loader.destroy()},h.abort=function(){this.loader.abort()},h.load=function(C,y,f){u(C),this.loader.load(C,y,f)},D(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},b.createFragmentLoader=function(){var s=this.config.fLoader,u=this.applyFragmentData,l=s||this.config.loader;return function(){function S(g){this.loader=void 0,this.loader=new l(g)}var h=S.prototype;return h.destroy=function(){this.loader.destroy()},h.abort=function(){this.loader.abort()},h.load=function(C,y,f){u(C),this.loader.load(C,y,f)},D(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},_.uuid=function(){var s=URL.createObjectURL(new Blob),u=s.toString();return URL.revokeObjectURL(s),u.substr(u.lastIndexOf("/")+1)},_.serialize=function(s){for(var u=[],l=function(U){return!Number.isNaN(U)&&U!=null&&U!==""&&U!==!1},S=function(U){return Math.round(U)},h=function(U){return S(U/100)*100},g=function(U){return encodeURIComponent(U)},C={br:S,d:S,bl:h,dl:h,mtp:h,nor:g,rtp:h,tb:S},y=Object.keys(s||{}).sort(),f=R(y),c;!(c=f()).done;){var o=c.value,a=s[o];if(!l(a))continue;if(o==="v"&&a===1)continue;if(o=="pr"&&a===1)continue;var m=C[o];m&&(a=m(a));var p=typeof a,v=void 0;o==="ot"||o==="sf"||o==="st"?v=o+"="+a:p==="boolean"?v=o:p==="number"?v=o+"="+a:v=o+"="+JSON.stringify(a),u.push(v)}return u.join(",")},_.toHeaders=function(s){for(var u=Object.keys(s),l={},S=["Object","Request","Session","Status"],h=[{},{},{},{}],g={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},C=0,y=u;C<y.length;C++){var f=y[C],c=g[f]!=null?g[f]:1;h[c][f]=s[f]}for(var o=0;o<h.length;o++){var a=_.serialize(h[o]);a&&(l["CMCD-"+S[o]]=a)}return l},_.toQuery=function(s){return"CMCD="+encodeURIComponent(_.serialize(s))},_.appendQueryToUri=function(s,u){if(!u)return s;var l=s.includes("?")?"&":"?";return""+s+l+u},_}()},"./src/controller/eme-controller.ts":function(re,z,L){"use strict";L.r(z);var H=L("./src/events.ts"),k=L("./src/errors.ts"),P=L("./src/utils/logger.ts"),F=L("./src/utils/mediakeys-helper.ts");function M(A,_){for(var b=0;b<_.length;b++){var d=_[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(A,d.key,d)}}function D(A,_,b){return _&&M(A.prototype,_),b&&M(A,b),A}var R=3,E=function(_,b,d){var s={audioCapabilities:[],videoCapabilities:[]};return _.forEach(function(u){s.audioCapabilities.push({contentType:'audio/mp4; codecs="'+u+'"',robustness:d.audioRobustness||""})}),b.forEach(function(u){s.videoCapabilities.push({contentType:'video/mp4; codecs="'+u+'"',robustness:d.videoRobustness||""})}),[s]},w=function(_,b,d,s){switch(_){case F.KeySystems.WIDEVINE:return E(b,d,s);default:throw new Error("Unknown key-system: "+_)}},T=function(){function A(b){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=b,this._config=b.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 _=A.prototype;return _.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},_._registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this)},_._unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this)},_.getLicenseServerUrl=function(d){switch(d){case F.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},_._attemptKeySystemAccess=function(d,s,u){var l=this,S=w(d,s,u,this._drmSystemOptions);P.logger.log("Requesting encrypted media key-system access");var h=this.requestMediaKeySystemAccess(d,S);this.mediaKeysPromise=h.then(function(g){return l._onMediaKeySystemAccessObtained(d,g)}),h.catch(function(g){P.logger.error('Failed to obtain key-system "'+d+'" access:',g)})},_._onMediaKeySystemAccessObtained=function(d,s){var u=this;P.logger.log('Access for key-system "'+d+'" obtained');var l={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:s,mediaKeySystemDomain:d};this._mediaKeysList.push(l);var S=Promise.resolve().then(function(){return s.createMediaKeys()}).then(function(h){return l.mediaKeys=h,P.logger.log('Media-keys created for key-system "'+d+'"'),u._onMediaKeysCreated(),h});return S.catch(function(h){P.logger.error("Failed to create media-keys:",h)}),S},_._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(s){s.mediaKeysSession||(s.mediaKeysSession=s.mediaKeys.createSession(),d._onNewMediaKeySession(s.mediaKeysSession))})},_._onNewMediaKeySession=function(d){var s=this;P.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(u){s._onKeySessionMessage(d,u.message)},!1)},_._onKeySessionMessage=function(d,s){P.logger.log("Got EME message event, creating license request"),this._requestLicense(s,function(u){P.logger.log("Received license data (length: "+(u&&u.byteLength)+"), updating key-session"),d.update(u)})},_.onMediaEncrypted=function(d){var s=this;if(P.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var u=function(S){if(!s._media)return;s._attemptSetMediaKeys(S),s._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(u).catch(u)},_._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var s=this._mediaKeysList[0];if(!s||!s.mediaKeys){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}P.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(s.mediaKeys),this._hasSetMediaKeys=!0}},_._generateRequestWithPreferredKeySession=function(d,s){var u=this,l=this._mediaKeysList[0];if(!l){P.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(l.mediaKeysSessionInitialized){P.logger.warn("Key-Session already initialized but requested again");return}var S=l.mediaKeysSession;if(!S){P.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!s){P.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}P.logger.log('Generating key-session request for "'+d+'" init data type'),l.mediaKeysSessionInitialized=!0,S.generateRequest(d,s).then(function(){P.logger.debug("Key-session generation succeeded")}).catch(function(h){P.logger.error("Error generating key-session request:",h),u.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},_._createLicenseXhr=function(d,s,u){var l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,l,d,s,u);var S=this._licenseXhrSetup;if(S)try{S.call(this.hls,l,d),S=void 0}catch(h){P.logger.error(h)}try{l.readyState||l.open("POST",d,!0),S&&S.call(this.hls,l,d)}catch(h){throw new Error("issue setting up KeySystem license XHR "+h)}return l},_._onLicenseRequestReadyStageChange=function(d,s,u,l){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,P.logger.log("License request succeeded");var S=d.response,h=this._licenseResponseCallback;if(h)try{S=h.call(this.hls,d,s)}catch(C){P.logger.error(C)}l(S)}else{if(P.logger.error("License Request XHR failed ("+s+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>R){this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var g=R-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+g+" attempts left"),this._requestLicense(u,l)}break}},_._generateLicenseRequestChallenge=function(d,s){switch(d.mediaKeySystemDomain){case F.KeySystems.WIDEVINE:return s}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},_._requestLicense=function(d,s){P.logger.log("Requesting content license for key-system");var u=this._mediaKeysList[0];if(!u){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var l=this.getLicenseServerUrl(u.mediaKeySystemDomain),S=this._createLicenseXhr(l,d,s);P.logger.log("Sending license request to URL: "+l);var h=this._generateLicenseRequestChallenge(u,d);S.send(h)}catch(g){P.logger.error("Failure requesting DRM license: "+g),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},_.onMediaAttached=function(d,s){if(!this._emeEnabled)return;var u=s.media;this._media=u,u.addEventListener("encrypted",this._onMediaEncrypted)},_.onMediaDetached=function(){var d=this._media,s=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(s.map(function(u){if(u.mediaKeysSession)return u.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},_.onManifestParsed=function(d,s){if(!this._emeEnabled)return;var u=s.levels.map(function(S){return S.audioCodec}).filter(function(S){return!!S}),l=s.levels.map(function(S){return S.videoCodec}).filter(function(S){return!!S});this._attemptKeySystemAccess(F.KeySystems.WIDEVINE,u,l)},D(A,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),A}();z.default=T},"./src/controller/fps-controller.ts":function(re,z,L){"use strict";L.r(z);var H=L("./src/events.ts"),k=L("./src/utils/logger.ts"),P=function(){function F(D){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=D,this.registerListeners()}var M=F.prototype;return M.setStreamController=function(R){this.streamController=R},M.registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},M.unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching)},M.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},M.onMediaAttaching=function(R,E){var w=this.hls.config;if(w.capLevelOnFPSDrop){var T=E.media instanceof self.HTMLVideoElement?E.media:null;this.media=T,T&&typeof T.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),w.fpsDroppedMonitoringPeriod)}},M.checkFPS=function(R,E,w){var T=performance.now();if(E){if(this.lastTime){var A=T-this.lastTime,_=w-this.lastDroppedFrames,b=E-this.lastDecodedFrames,d=1e3*_/A,s=this.hls;if(s.trigger(H.Events.FPS_DROP,{currentDropped:_,currentDecoded:b,totalDroppedFrames:w}),d>0&&_>s.config.fpsDroppedMonitoringThreshold*b){var u=s.currentLevel;k.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(s.autoLevelCapping===-1||s.autoLevelCapping>=u)&&(u=u-1,s.trigger(H.Events.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:s.currentLevel}),s.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=T,this.lastDroppedFrames=w,this.lastDecodedFrames=E}},M.checkFPSInterval=function(){var R=this.media;if(R)if(this.isVideoPlaybackQualityAvailable){var E=R.getVideoPlaybackQuality();this.checkFPS(R,E.totalVideoFrames,E.droppedVideoFrames)}else this.checkFPS(R,R.webkitDecodedFrameCount,R.webkitDroppedFrameCount)},F}();z.default=P},"./src/controller/fragment-finders.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"findFragmentByPDT",function(){return P}),L.d(z,"findFragmentByPTS",function(){return F}),L.d(z,"fragmentWithinToleranceTest",function(){return M}),L.d(z,"pdtWithinToleranceTest",function(){return D}),L.d(z,"findFragWithCC",function(){return R});var H=L("./src/polyfills/number.ts"),k=L("./src/utils/binary-search.ts");function P(E,w,T){if(w===null||!Array.isArray(E)||!E.length||!Object(H.isFiniteNumber)(w))return null;var A=E[0].programDateTime;if(w<(A||0))return null;var _=E[E.length-1].endProgramDateTime;if(w>=(_||0))return null;T=T||0;for(var b=0;b<E.length;++b){var d=E[b];if(D(w,T,d))return d}return null}function F(E,w,T,A){T===void 0&&(T=0),A===void 0&&(A=0);var _=null;if(E?_=w[E.sn-w[0].sn+1]||null:T===0&&w[0].start===0&&(_=w[0]),_&&M(T,A,_)===0)return _;var b=k.default.search(w,M.bind(null,T,A));return b||_}function M(E,w,T){E===void 0&&(E=0),w===void 0&&(w=0);var A=Math.min(w,T.duration+(T.deltaPTS?T.deltaPTS:0));return T.start+T.duration-A<=E?1:T.start-A>E&&T.start?-1:0}function D(E,w,T){var A=Math.min(w,T.duration+(T.deltaPTS?T.deltaPTS:0))*1e3,_=T.endProgramDateTime||0;return _-A>E}function R(E,w){return k.default.search(E,function(T){return T.cc<w?1:T.cc>w?-1:0})}},"./src/controller/fragment-tracker.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"FragmentState",function(){return P}),L.d(z,"FragmentTracker",function(){return F});var H=L("./src/events.ts"),k=L("./src/types/loader.ts"),P;(function(R){R.NOT_LOADED="NOT_LOADED",R.BACKTRACKED="BACKTRACKED",R.APPENDING="APPENDING",R.PARTIAL="PARTIAL",R.OK="OK"})(P||(P={}));var F=function(){function R(w){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=w,this._registerListeners()}var E=R.prototype;return E._registerListeners=function(){var T=this.hls;T.on(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),T.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),T.on(H.Events.FRAG_LOADED,this.onFragLoaded,this)},E._unregisterListeners=function(){var T=this.hls;T.off(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),T.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),T.off(H.Events.FRAG_LOADED,this.onFragLoaded,this)},E.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},E.getAppendedFrag=function(T,A){if(A===k.PlaylistLevelType.MAIN){var _=this.activeFragment,b=this.activeParts;if(!_)return null;if(b)for(var d=b.length;d--;){var s=b[d],u=s?s.end:_.appendedPTS;if(s.start<=T&&u!==void 0&&T<=u)return d>9&&(this.activeParts=b.slice(d-9)),s}else if(_.start<=T&&_.appendedPTS!==void 0&&T<=_.appendedPTS)return _}return this.getBufferedFrag(T,A)},E.getBufferedFrag=function(T,A){for(var _=this.fragments,b=Object.keys(_),d=b.length;d--;){var s=_[b[d]];if((s==null?void 0:s.body.type)===A&&s.buffered){var u=s.body;if(u.start<=T&&T<=u.end)return u}}return null},E.detectEvictedFragments=function(T,A,_){var b=this;Object.keys(this.fragments).forEach(function(d){var s=b.fragments[d];if(!s)return;if(!s.buffered){s.body.type===_&&b.removeFragment(s.body);return}var u=s.range[T];if(!u)return;u.time.some(function(l){var S=!b.isTimeBuffered(l.startPTS,l.endPTS,A);return S&&b.removeFragment(s.body),S})})},E.detectPartialFragments=function(T){var A=this,_=this.timeRanges,b=T.frag,d=T.part;if(!_||b.sn==="initSegment")return;var s=D(b),u=this.fragments[s];if(!u)return;Object.keys(_).forEach(function(l){var S=b.elementaryStreams[l];if(!S)return;var h=_[l],g=d!==null||S.partial===!0;u.range[l]=A.getBufferedTimes(b,d,g,h)}),u.backtrack=u.loaded=null,Object.keys(u.range).length?u.buffered=!0:this.removeFragment(u.body)},E.fragBuffered=function(T){var A=D(T),_=this.fragments[A];_&&(_.backtrack=_.loaded=null,_.buffered=!0)},E.getBufferedTimes=function(T,A,_,b){for(var d={time:[],partial:_},s=A?A.start:T.start,u=A?A.end:T.end,l=T.minEndPTS||u,S=T.maxStartPTS||s,h=0;h<b.length;h++){var g=b.start(h)-this.bufferPadding,C=b.end(h)+this.bufferPadding;if(S>=g&&l<=C){d.time.push({startPTS:Math.max(s,b.start(h)),endPTS:Math.min(u,b.end(h))});break}else if(s<C&&u>g)d.partial=!0,d.time.push({startPTS:Math.max(s,b.start(h)),endPTS:Math.min(u,b.end(h))});else if(u<=g)break}return d},E.getPartialFragment=function(T){var A=null,_,b,d,s=0,u=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach(function(S){var h=l[S];if(!h)return;M(h)&&(b=h.body.start-u,d=h.body.end+u,T>=b&&T<=d&&(_=Math.min(T-b,d-T),s<=_&&(A=h.body,s=_)))}),A},E.getState=function(T){var A=D(T),_=this.fragments[A];return _?_.buffered?M(_)?P.PARTIAL:P.OK:_.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},E.backtrack=function(T,A){var _=D(T),b=this.fragments[_];if(!b||b.backtrack)return null;var d=b.backtrack=A||b.loaded;return b.loaded=null,d},E.getBacktrackData=function(T){var A=D(T),_=this.fragments[A];if(_){var b,d=_.backtrack;if(d!=null&&(b=d.payload)!==null&&b!==void 0&&b.byteLength)return d;this.removeFragment(T)}return null},E.isTimeBuffered=function(T,A,_){for(var b,d,s=0;s<_.length;s++){if(b=_.start(s)-this.bufferPadding,d=_.end(s)+this.bufferPadding,T>=b&&A<=d)return!0;if(A<=b)return!1}return!1},E.onFragLoaded=function(T,A){var _=A.frag,b=A.part;if(_.sn==="initSegment"||_.bitrateTest||b)return;var d=D(_);this.fragments[d]={body:_,loaded:A,backtrack:null,buffered:!1,range:Object.create(null)}},E.onBufferAppended=function(T,A){var _=this,b=A.frag,d=A.part,s=A.timeRanges;if(b.type===k.PlaylistLevelType.MAIN)if(this.activeFragment=b,d){var u=this.activeParts;u||(this.activeParts=u=[]),u.push(d)}else this.activeParts=null;this.timeRanges=s,Object.keys(s).forEach(function(l){var S=s[l];if(_.detectEvictedFragments(l,S),!d)for(var h=0;h<S.length;h++)b.appendedPTS=Math.max(S.end(h),b.appendedPTS||0)})},E.onFragBuffered=function(T,A){this.detectPartialFragments(A)},E.hasFragment=function(T){var A=D(T);return!!this.fragments[A]},E.removeFragmentsInRange=function(T,A,_){var b=this;Object.keys(this.fragments).forEach(function(d){var s=b.fragments[d];if(!s)return;if(s.buffered){var u=s.body;u.type===_&&u.start<A&&u.end>T&&b.removeFragment(u)}})},E.removeFragment=function(T){var A=D(T);T.stats.loaded=0,T.clearElementaryStreamInfo(),delete this.fragments[A]},E.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},R}();function M(R){var E,w;return R.buffered&&(((E=R.range.video)===null||E===void 0?void 0:E.partial)||((w=R.range.audio)===null||w===void 0?void 0:w.partial))}function D(R){return R.type+"_"+R.level+"_"+R.urlId+"_"+R.sn}},"./src/controller/gap-controller.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"STALL_MINIMUM_DURATION_MS",function(){return M}),L.d(z,"MAX_START_GAP_JUMP",function(){return D}),L.d(z,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return R}),L.d(z,"SKIP_BUFFER_RANGE_START",function(){return E}),L.d(z,"default",function(){return w});var H=L("./src/utils/buffer-helper.ts"),k=L("./src/errors.ts"),P=L("./src/events.ts"),F=L("./src/utils/logger.ts"),M=250,D=2,R=.1,E=.05,w=function(){function T(_,b,d,s){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=_,this.media=b,this.fragmentTracker=d,this.hls=s}var A=T.prototype;return A.destroy=function(){this.hls=this.fragmentTracker=this.media=null},A.poll=function(b){var d=this.config,s=this.media,u=this.stalled,l=s.currentTime,S=s.seeking,h=this.seeking&&!S,g=!this.seeking&&S;if(this.seeking=S,l!==b){if(this.moved=!0,u!==null){if(this.stallReported){var C=self.performance.now()-u;F.logger.warn("playback not stuck anymore @"+l+", after "+Math.round(C)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((g||h)&&(this.stalled=null),s.paused||s.ended||s.playbackRate===0||!H.BufferHelper.getBuffered(s).length)return;var y=H.BufferHelper.bufferInfo(s,l,0),f=y.len>0,c=y.nextStart||0;if(!f&&!c)return;if(S){var o=y.len>D,a=!c||c-l>D&&!this.fragmentTracker.getPartialFragment(l);if(o||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var m,p=Math.max(c,y.start||0)-l,v=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,O=v==null||((m=v.details)===null||m===void 0)?void 0:m.live,U=O?v.details.targetduration*2:D;if(p>0&&p<=U){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(u===null){this.stalled=j;return}var G=j-u;!S&&G>=M&&this._reportStall(y.len);var B=H.BufferHelper.bufferInfo(s,l,d.maxBufferHole);this._tryFixBufferStall(B,G)},A._tryFixBufferStall=function(b,d){var s=this.config,u=this.fragmentTracker,l=this.media,S=l.currentTime,h=u.getPartialFragment(S);if(h){var g=this._trySkipBufferHole(h);if(g)return}b.len>s.maxBufferHole&&d>s.highBufferWatchdogPeriod*1e3&&(F.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},A._reportStall=function(b){var d=this.hls,s=this.media,u=this.stallReported;u||(this.stallReported=!0,F.logger.warn("Playback stalling at @"+s.currentTime+" due to low buffer (buffer="+b+")"),d.trigger(P.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:b}))},A._trySkipBufferHole=function(b){for(var d=this.config,s=this.hls,u=this.media,l=u.currentTime,S=0,h=H.BufferHelper.getBuffered(u),g=0;g<h.length;g++){var C=h.start(g);if(l+d.maxBufferHole>=S&&l<C){var y=Math.max(C+E,u.currentTime+R);return F.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+y),this.moved=!0,this.stalled=null,u.currentTime=y,b&&s.trigger(P.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+l+" to "+y,frag:b}),y}S=h.end(g)}return 0},A._tryNudgeBuffer=function(){var b=this.config,d=this.hls,s=this.media,u=s.currentTime,l=(this.nudgeRetry||0)+1;if(this.nudgeRetry=l,l<b.nudgeMaxRetry){var S=u+l*b.nudgeOffset;F.logger.warn("Nudging 'currentTime' from "+u+" to "+S),s.currentTime=S,d.trigger(P.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else F.logger.error("Playhead still not moving while enough data buffered @"+u+" after "+b.nudgeMaxRetry+" nudges"),d.trigger(P.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},T}()},"./src/controller/id3-track-controller.ts":function(re,z,L){"use strict";L.r(z);var H=L("./src/events.ts"),k=L("./src/utils/texttrack-utils.ts"),P=L("./src/demux/id3.ts"),F=.25,M=function(){function D(E){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=E,this._registerListeners()}var R=D.prototype;return R.destroy=function(){this._unregisterListeners()},R._registerListeners=function(){var w=this.hls;w.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.on(H.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),w.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R._unregisterListeners=function(){var w=this.hls;w.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.off(H.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),w.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R.onMediaAttached=function(w,T){this.media=T.media},R.onMediaDetaching=function(){if(!this.id3Track)return;Object(k.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},R.getID3Track=function(w){if(!this.media)return;for(var T=0;T<w.length;T++){var A=w[T];if(A.kind==="metadata"&&A.label==="id3")return Object(k.sendAddTrackEvent)(A,this.media),A}return this.media.addTextTrack("metadata","id3")},R.onFragParsingMetadata=function(w,T){if(!this.media)return;var A=T.frag,_=T.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var b=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<_.length;d++){var s=P.getID3Frames(_[d].data);if(s){var u=_[d].pts,l=d<_.length-1?_[d+1].pts:A.end,S=l-u;S<=0&&(l=u+F);for(var h=0;h<s.length;h++){var g=s[h];if(!P.isTimeStampFrame(g)){var C=new b(u,l,"");C.value=g,this.id3Track.addCue(C)}}}}},R.onBufferFlushing=function(w,T){var A=T.startOffset,_=T.endOffset,b=T.type;if(!b||b==="audio"){var d=this.id3Track;d&&Object(k.removeCuesInRange)(d,A,_)}},D}();z.default=M},"./src/controller/latency-controller.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return D});var H=L("./src/errors.ts"),k=L("./src/events.ts"),P=L("./src/utils/logger.ts");function F(R,E){for(var w=0;w<E.length;w++){var T=E[w];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(R,T.key,T)}}function M(R,E,w){return E&&F(R.prototype,E),w&&F(R,w),R}var D=function(){function R(w){var T=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 T.timeupdate()},this.hls=w,this.config=w.config,this.registerListeners()}var E=R.prototype;return E.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},E.registerListeners=function(){this.hls.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(k.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(k.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){this.hls.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(k.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(k.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(k.Events.ERROR,this.onError)},E.onMediaAttached=function(T,A){this.media=A.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},E.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},E.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},E.onLevelUpdated=function(T,A){var _=A.details;this.levelDetails=_,_.advanced&&this.timeupdate(),!_.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},E.onError=function(T,A){if(A.details!==H.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,P.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},E.timeupdate=function(){var T=this.media,A=this.levelDetails;if(!T||!A)return;this.currentTime=T.currentTime;var _=this.computeLatency();if(_===null)return;this._latency=_;var b=this.config,d=b.lowLatencyMode,s=b.maxLiveSyncPlaybackRate;if(!d||s===1)return;var u=this.targetLatency;if(u===null)return;var l=_-u,S=Math.min(this.maxLatency,u+A.targetduration),h=l<S;if(A.live&&h&&l>.05&&this.forwardBufferLength>1){var g=Math.min(2,Math.max(1,s)),C=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20;T.playbackRate=Math.min(g,Math.max(1,C))}else T.playbackRate!==1&&T.playbackRate!==0&&(T.playbackRate=1)},E.estimateLiveEdge=function(){var T=this.levelDetails;return T===null?null:T.edge+T.age},E.computeLatency=function(){var T=this.estimateLiveEdge();return T===null?null:T-this.currentTime},M(R,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var T=this.config,A=this.levelDetails;return T.liveMaxLatencyDuration!==void 0?T.liveMaxLatencyDuration:A?T.liveMaxLatencyDurationCount*A.targetduration:0}},{key:"targetLatency",get:function(){var T=this.levelDetails;if(T===null)return null;var A=T.holdBack,_=T.partHoldBack,b=T.targetduration,d=this.config,s=d.liveSyncDuration,u=d.liveSyncDurationCount,l=d.lowLatencyMode,S=this.hls.userConfig,h=l&&_||A;(S.liveSyncDuration||S.liveSyncDurationCount||h===0)&&(h=s!==void 0?s:u*b);var g=b,C=1;return h+Math.min(this.stallCount*C,g)}},{key:"liveSyncPosition",get:function(){var T=this.estimateLiveEdge(),A=this.targetLatency,_=this.levelDetails;if(T===null||A===null||_===null)return null;var b=_.edge,d=T-A-this.edgeStalled,s=b-_.totalduration,u=b-(this.config.lowLatencyMode&&_.partTarget||_.targetduration);return Math.min(Math.max(s,d),u)}},{key:"drift",get:function(){var T=this.levelDetails;return T===null?1:T.drift}},{key:"edgeStalled",get:function(){var T=this.levelDetails;if(T===null)return 0;var A=(this.config.lowLatencyMode&&T.partTarget||T.targetduration)*3;return Math.max(T.age-A,0)}},{key:"forwardBufferLength",get:function(){var T=this.media,A=this.levelDetails;if(!T||!A)return 0;var _=T.buffered.length;return _?T.buffered.end(_-1):A.edge-this.currentTime}}]),R}()},"./src/controller/level-controller.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return d});var H=L("./src/types/level.ts"),k=L("./src/events.ts"),P=L("./src/errors.ts"),F=L("./src/utils/codecs.ts"),M=L("./src/controller/level-helper.ts"),D=L("./src/controller/base-playlist-controller.ts"),R=L("./src/types/loader.ts");function E(){return E=Object.assign||function(s){for(var u=1;u<arguments.length;u++){var l=arguments[u];for(var S in l)Object.prototype.hasOwnProperty.call(l,S)&&(s[S]=l[S])}return s},E.apply(this,arguments)}function w(s,u){for(var l=0;l<u.length;l++){var S=u[l];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(s,S.key,S)}}function T(s,u,l){return u&&w(s.prototype,u),l&&w(s,l),s}function A(s,u){s.prototype=Object.create(u.prototype),s.prototype.constructor=s,_(s,u)}function _(s,u){return _=Object.setPrototypeOf||function(S,h){return S.__proto__=h,S},_(s,u)}var b=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(s){A(u,s);function u(S){var h;return h=s.call(this,S,"[level-controller]")||this,h._levels=[],h._firstLevel=-1,h._startLevel=void 0,h.currentLevelIndex=-1,h.manualLevelIndex=-1,h.onParsedComplete=void 0,h._registerListeners(),h}var l=u.prototype;return l._registerListeners=function(){var h=this.hls;h.on(k.Events.MANIFEST_LOADED,this.onManifestLoaded,this),h.on(k.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(k.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),h.on(k.Events.FRAG_LOADED,this.onFragLoaded,this),h.on(k.Events.ERROR,this.onError,this)},l._unregisterListeners=function(){var h=this.hls;h.off(k.Events.MANIFEST_LOADED,this.onManifestLoaded,this),h.off(k.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(k.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),h.off(k.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(k.Events.ERROR,this.onError,this)},l.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,s.prototype.destroy.call(this)},l.startLoad=function(){var h=this._levels;h.forEach(function(g){g.loadError=0}),s.prototype.startLoad.call(this)},l.onManifestLoaded=function(h,g){var C=[],y=[],f=[],c,o={},a,m=!1,p=!1,v=!1;if(g.levels.forEach(function(G){var B=G.attrs;m=m||!!(G.width&&G.height),p=p||!!G.videoCodec,v=v||!!G.audioCodec,b&&G.audioCodec&&G.audioCodec.indexOf("mp4a.40.34")!==-1&&(G.audioCodec=void 0);var N=G.bitrate+"-"+G.attrs.RESOLUTION+"-"+G.attrs.CODECS;a=o[N],a?a.url.push(G.url):(a=new H.Level(G),o[N]=a,C.push(a)),B&&(B.AUDIO&&Object(M.addGroupId)(a,"audio",B.AUDIO),B.SUBTITLES&&Object(M.addGroupId)(a,"text",B.SUBTITLES))}),(m||p)&&v&&(C=C.filter(function(G){var B=G.videoCodec,N=G.width,V=G.height;return!!B||!!(N&&V)})),C=C.filter(function(G){var B=G.audioCodec,N=G.videoCodec;return(!B||Object(F.isCodecSupportedInMp4)(B,"audio"))&&(!N||Object(F.isCodecSupportedInMp4)(N,"video"))}),g.audioTracks&&(y=g.audioTracks.filter(function(G){return!G.audioCodec||Object(F.isCodecSupportedInMp4)(G.audioCodec,"audio")}),Object(M.assignTrackIdsByGroup)(y)),g.subtitles&&(f=g.subtitles,Object(M.assignTrackIdsByGroup)(f)),C.length>0){c=C[0].bitrate,C.sort(function(G,B){return G.bitrate-B.bitrate}),this._levels=C;for(var O=0;O<C.length;O++)if(C[O].bitrate===c){this._firstLevel=O,this.log("manifest loaded, "+C.length+" level(s) found, first bitrate: "+c);break}var U=v&&!p,j={levels:C,audioTracks:y,subtitleTracks:f,firstLevel:this._firstLevel,stats:g.stats,audio:v,video:p,altAudio:!U&&y.some(function(G){return!!G.url})};this.hls.trigger(k.Events.MANIFEST_PARSED,j),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(k.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:g.url,reason:"no level with compatible codecs found in manifest"})},l.onError=function(h,g){if(s.prototype.onError.call(this,h,g),g.fatal)return;var C=g.context,y=this._levels[this.currentLevelIndex];if(C&&(C.type===R.PlaylistContextType.AUDIO_TRACK&&y.audioGroupIds&&C.groupId===y.audioGroupIds[y.urlId]||C.type===R.PlaylistContextType.SUBTITLE_TRACK&&y.textGroupIds&&C.groupId===y.textGroupIds[y.urlId])){this.redundantFailover(this.currentLevelIndex);return}var f=!1,c=!0,o;switch(g.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:if(g.frag){var a=this._levels[g.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(o=g.frag.level)):o=g.frag.level}break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:C&&(C.deliveryDirectives&&(c=!1),o=C.level),f=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:o=g.level,f=!0;break}o!==void 0&&this.recoverLevel(g,o,f,c)},l.recoverLevel=function(h,g,C,y){var f=h.details,c=this._levels[g];if(c.loadError++,C){var o=this.retryLoadingOrFail(h);if(o)h.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(y){var a=c.url.length;if(a>1&&c.loadError<a)h.levelRetry=!0,this.redundantFailover(g);else if(this.manualLevelIndex===-1){var m=g===0?this._levels.length-1:g-1;this.currentLevelIndex!==m&&this._levels[m].loadError===0&&(this.warn(f+": switch to "+m),h.levelRetry=!0,this.hls.nextAutoLevel=m)}}},l.redundantFailover=function(h){var g=this._levels[h],C=g.url.length;if(C>1){var y=(g.urlId+1)%C;this.warn("Switching to redundant URL-id "+y),this._levels.forEach(function(f){f.urlId=y}),this.level=h}},l.onFragLoaded=function(h,g){var C=g.frag;if(C!==void 0&&C.type===R.PlaylistLevelType.MAIN){var y=this._levels[C.level];y!==void 0&&(y.fragmentError=0,y.loadError=0)}},l.onLevelLoaded=function(h,g){var C,y=g.level,f=g.details,c=this._levels[y];if(!c){var o;this.warn("Invalid level index "+y),(o=g.deliveryDirectives)!==null&&o!==void 0&&o.skip&&(f.deltaUpdateFailed=!0);return}y===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(y,g,c.details)):(C=g.deliveryDirectives)!==null&&C!==void 0&&C.skip&&(f.deltaUpdateFailed=!0)},l.onAudioTrackSwitched=function(h,g){var C=this.hls.levels[this.currentLevelIndex];if(!C)return;if(C.audioGroupIds){for(var y=-1,f=this.hls.audioTracks[g.id].groupId,c=0;c<C.audioGroupIds.length;c++)if(C.audioGroupIds[c]===f){y=c;break}y!==C.urlId&&(C.urlId=y,this.startLoad())}},l.loadPlaylist=function(h){var g=this.currentLevelIndex,C=this._levels[g];if(this.canLoad&&C&&C.url.length>0){var y=C.urlId,f=C.url[y];if(h)try{f=h.addDirectives(f)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+g+(h?" at sn "+h.msn+" part "+h.part:"")+" with URL-id "+y+" "+f),this.clearTimer(),this.hls.trigger(k.Events.LEVEL_LOADING,{url:f,level:g,id:y,deliveryDirectives:h||null})}},l.removeLevel=function(h,g){var C=function(c,o){return o!==g},y=this._levels.filter(function(f,c){return c!==h?!0:f.url.length>1&&g!==void 0?(f.url=f.url.filter(C),f.audioGroupIds&&(f.audioGroupIds=f.audioGroupIds.filter(C)),f.textGroupIds&&(f.textGroupIds=f.textGroupIds.filter(C)),f.urlId=0,!0):!1}).map(function(f,c){var o=f.details;return o!=null&&o.fragments&&o.fragments.forEach(function(a){a.level=c}),f});this._levels=y,this.hls.trigger(k.Events.LEVELS_UPDATED,{levels:y})},T(u,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(h){var g,C=this._levels;if(C.length===0)return;if(this.currentLevelIndex===h&&(g=C[h])!==null&&g!==void 0&&g.details)return;if(h<0||h>=C.length){var y=h<0;if(this.hls.trigger(k.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:h,fatal:y,reason:"invalid level idx"}),y)return;h=Math.min(h,C.length-1)}this.clearTimer();var f=this.currentLevelIndex,c=C[f],o=C[h];this.log("switching to level "+h+" from "+f),this.currentLevelIndex=h;var a=E({},o,{level:h,maxBitrate:o.maxBitrate,uri:o.uri,urlId:o.urlId});delete a._urlId,this.hls.trigger(k.Events.LEVEL_SWITCHING,a);var m=o.details;if(!m||m.live){var p=this.switchParams(o.uri,c==null?void 0:c.details);this.loadPlaylist(p)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(h){this.manualLevelIndex=h,this._startLevel===void 0&&(this._startLevel=h),h!==-1&&(this.level=h)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(h){this._firstLevel=h}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var h=this.hls.config.startLevel;return h!==void 0?h:this._firstLevel}else return this._startLevel},set:function(h){this._startLevel=h}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(h){this.level=h,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=h)}}]),u}(D.default)},"./src/controller/level-helper.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"addGroupId",function(){return P}),L.d(z,"assignTrackIdsByGroup",function(){return F}),L.d(z,"updatePTS",function(){return M}),L.d(z,"updateFragPTSDTS",function(){return R}),L.d(z,"mergeDetails",function(){return E}),L.d(z,"mapPartIntersection",function(){return w}),L.d(z,"mapFragmentIntersection",function(){return T}),L.d(z,"adjustSliding",function(){return A}),L.d(z,"addSliding",function(){return _}),L.d(z,"computeReloadInterval",function(){return b}),L.d(z,"getFragmentWithSN",function(){return d}),L.d(z,"getPartWith",function(){return s});var H=L("./src/polyfills/number.ts"),k=L("./src/utils/logger.ts");function P(u,l,S){switch(l){case"audio":u.audioGroupIds||(u.audioGroupIds=[]),u.audioGroupIds.push(S);break;case"text":u.textGroupIds||(u.textGroupIds=[]),u.textGroupIds.push(S);break}}function F(u){var l={};u.forEach(function(S){var h=S.groupId||"";S.id=l[h]=l[h]||0,l[h]++})}function M(u,l,S){var h=u[l],g=u[S];D(h,g)}function D(u,l){var S=l.startPTS;if(Object(H.isFiniteNumber)(S)){var h=0,g;l.sn>u.sn?(h=S-u.start,g=u):(h=u.start-S,g=l),g.duration!==h&&(g.duration=h)}else if(l.sn>u.sn){var C=u.cc===l.cc;C&&u.minEndPTS?l.start=u.start+(u.minEndPTS-u.start):l.start=u.start+u.duration}else l.start=Math.max(u.start-l.duration,0)}function R(u,l,S,h,g,C){var y=h-S;y<=0&&(k.logger.warn("Fragment should have a positive duration",l),h=S+l.duration,C=g+l.duration);var f=S,c=h,o=l.startPTS,a=l.endPTS;if(Object(H.isFiniteNumber)(o)){var m=Math.abs(o-S);Object(H.isFiniteNumber)(l.deltaPTS)?l.deltaPTS=Math.max(m,l.deltaPTS):l.deltaPTS=m,f=Math.max(S,o),S=Math.min(S,o),g=Math.min(g,l.startDTS),c=Math.min(h,a),h=Math.max(h,a),C=Math.max(C,l.endDTS)}l.duration=h-S;var p=S-l.start;l.appendedPTS=h,l.start=l.startPTS=S,l.maxStartPTS=f,l.startDTS=g,l.endPTS=h,l.minEndPTS=c,l.endDTS=C;var v=l.sn;if(!u||v<u.startSN||v>u.endSN)return 0;var O,U=v-u.startSN,j=u.fragments;for(j[U]=l,O=U;O>0;O--)D(j[O],j[O-1]);for(O=U;O<j.length-1;O++)D(j[O],j[O+1]);return u.fragmentHint&&D(j[j.length-1],u.fragmentHint),u.PTSKnown=u.alignedSliding=!0,p}function E(u,l){for(var S=null,h=u.fragments,g=h.length-1;g>=0;g--){var C=h[g].initSegment;if(C){S=C;break}}u.fragmentHint&&delete u.fragmentHint.endPTS;var y=0,f;if(T(u,l,function(O,U){O.relurl&&(y=O.cc-U.cc),Object(H.isFiniteNumber)(O.startPTS)&&Object(H.isFiniteNumber)(O.endPTS)&&(U.start=U.startPTS=O.startPTS,U.startDTS=O.startDTS,U.appendedPTS=O.appendedPTS,U.maxStartPTS=O.maxStartPTS,U.endPTS=O.endPTS,U.endDTS=O.endDTS,U.minEndPTS=O.minEndPTS,U.duration=O.endPTS-O.startPTS,U.duration&&(f=U),l.PTSKnown=l.alignedSliding=!0),U.elementaryStreams=O.elementaryStreams,U.loader=O.loader,U.stats=O.stats,U.urlId=O.urlId,O.initSegment&&(U.initSegment=O.initSegment,S=O.initSegment)}),S){var c=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments;c.forEach(function(O){var U;(!O.initSegment||O.initSegment.relurl===((U=S)===null||U===void 0?void 0:U.relurl))&&(O.initSegment=S)})}if(l.skippedSegments&&(l.deltaUpdateFailed=l.fragments.some(function(O){return!O}),l.deltaUpdateFailed)){k.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var o=l.skippedSegments;o--;)l.fragments.shift();l.startSN=l.fragments[0].sn,l.startCC=l.fragments[0].cc}var a=l.fragments;if(y){k.logger.warn("discontinuity sliding from playlist, take drift into account");for(var m=0;m<a.length;m++)a[m].cc+=y}l.skippedSegments&&(l.startCC=l.fragments[0].cc),w(u.partList,l.partList,function(O,U){U.elementaryStreams=O.elementaryStreams,U.stats=O.stats}),f?R(l,f,f.startPTS,f.endPTS,f.startDTS,f.endDTS):A(u,l),a.length&&(l.totalduration=l.edge-a[0].start),l.driftStartTime=u.driftStartTime,l.driftStart=u.driftStart;var p=l.advancedDateTime;if(l.advanced&&p){var v=l.edge;l.driftStart||(l.driftStartTime=p,l.driftStart=v),l.driftEndTime=p,l.driftEnd=v}else l.driftEndTime=u.driftEndTime,l.driftEnd=u.driftEnd,l.advancedDateTime=u.advancedDateTime}function w(u,l,S){if(u&&l)for(var h=0,g=0,C=u.length;g<=C;g++){var y=u[g],f=l[g+h];y&&f&&y.index===f.index&&y.fragment.sn===f.fragment.sn?S(y,f):h--}}function T(u,l,S){for(var h=l.skippedSegments,g=Math.max(u.startSN,l.startSN)-l.startSN,C=(u.fragmentHint?1:0)+(h?l.endSN:Math.min(u.endSN,l.endSN))-l.startSN,y=l.startSN-u.startSN,f=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,c=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,o=g;o<=C;o++){var a=c[y+o],m=f[o];h&&!m&&o<h&&(m=l.fragments[o]=a),a&&m&&S(a,m)}}function A(u,l){var S=l.startSN+l.skippedSegments-u.startSN,h=u.fragments;if(S<0||S>=h.length)return;_(l,h[S].start)}function _(u,l){if(l){for(var S=u.fragments,h=u.skippedSegments;h<S.length;h++)S[h].start+=l;u.fragmentHint&&(u.fragmentHint.start+=l)}}function b(u,l){var S=1e3*u.levelTargetDuration,h=S/2,g=u.age,C=g>0&&g<S*3,y=l.loading.end-l.loading.start,f,c=u.availabilityDelay;if(u.updated===!1)if(C){var o=333*u.misses;f=Math.max(Math.min(h,y*2),o),u.availabilityDelay=(u.availabilityDelay||0)+f}else f=h;else C?(c=Math.min(c||S/2,g),u.availabilityDelay=c,f=c+S-g):f=S-y;return Math.round(f)}function d(u,l,S){if(!u||!u.details)return null;var h=u.details,g=h.fragments[l-h.startSN];return g||(g=h.fragmentHint,g&&g.sn===l?g:l<h.startSN&&S&&S.sn===l?S:null)}function s(u,l,S){if(!u||!u.details)return null;var h=u.details.partList;if(h)for(var g=h.length;g--;){var C=h[g];if(C.index===S&&C.fragment.sn===l)return C}return null}},"./src/controller/stream-controller.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return h});var H=L("./src/polyfills/number.ts"),k=L("./src/controller/base-stream-controller.ts"),P=L("./src/is-supported.ts"),F=L("./src/events.ts"),M=L("./src/utils/buffer-helper.ts"),D=L("./src/controller/fragment-tracker.ts"),R=L("./src/types/loader.ts"),E=L("./src/loader/fragment.ts"),w=L("./src/demux/transmuxer-interface.ts"),T=L("./src/types/transmuxer.ts"),A=L("./src/controller/gap-controller.ts"),_=L("./src/errors.ts"),b=L("./src/utils/logger.ts");function d(g,C){for(var y=0;y<C.length;y++){var f=C[y];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(g,f.key,f)}}function s(g,C,y){return C&&d(g.prototype,C),y&&d(g,y),g}function u(g,C){g.prototype=Object.create(C.prototype),g.prototype.constructor=g,l(g,C)}function l(g,C){return l=Object.setPrototypeOf||function(f,c){return f.__proto__=c,f},l(g,C)}var S=100,h=function(g){u(C,g);function C(f,c){var o;return o=g.call(this,f,c,"[stream-controller]")||this,o.audioCodecSwap=!1,o.gapController=null,o.level=-1,o._forceStartLoad=!1,o.altAudio=!1,o.audioOnly=!1,o.fragPlaying=null,o.onvplaying=null,o.onvseeked=null,o.fragLastKbps=0,o.stalled=!1,o.couldBacktrack=!1,o.audioCodecSwitch=!1,o.videoBuffer=null,o._registerListeners(),o}var y=C.prototype;return y._registerListeners=function(){var c=this.hls;c.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(F.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(F.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(F.Events.ERROR,this.onError,this),c.on(F.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(F.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(F.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(F.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(F.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y._unregisterListeners=function(){var c=this.hls;c.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(F.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(F.Events.ERROR,this.onError,this),c.off(F.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(F.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(F.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(F.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(F.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},y.startLoad=function(c){if(this.levels){var o=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(S),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var m=a.startLevel;m===-1&&(a.config.testBandwidth?(m=0,this.bitrateTest=!0):m=a.nextAutoLevel),this.level=a.nextLoadLevel=m,this.loadedmetadata=!1}o>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),c=o),this.state=k.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=k.State.STOPPED},y.stopLoad=function(){this._forceStartLoad=!1,g.prototype.stopLoad.call(this)},y.doTick=function(){switch(this.state){case k.State.IDLE:this.doTickIdle();break;case k.State.WAITING_LEVEL:{var c,o=this.levels,a=this.level,m=o==null||((c=o[a])===null||c===void 0)?void 0:c.details;if(m&&(!m.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(m))break;this.state=k.State.IDLE;break}break}case k.State.FRAG_LOADING_WAITING_RETRY:{var p,v=self.performance.now(),O=this.retryDate;(!O||v>=O||(p=this.media)!==null&&p!==void 0&&p.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=k.State.IDLE)}break;default:break}this.onTickEnd()},y.onTickEnd=function(){g.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},y.doTickIdle=function(){var c,o,a=this.hls,m=this.levelLastLoaded,p=this.levels,v=this.media,O=a.config,U=a.nextLoadLevel;if(m===null||!v&&(this.startFragRequested||!O.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!p||!p[U])return;var j=p[U];this.level=a.nextLoadLevel=U;var G=j.details;if(!G||this.state===k.State.WAITING_LEVEL||G.live&&this.levelLastLoaded!==U){this.state=k.State.WAITING_LEVEL;return}var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:v,R.PlaylistLevelType.MAIN);if(B===null)return;var N=B.len,V=this.getMaxBufferLength(j.maxBitrate);if(N>=V)return;if(this._streamEnded(B,G)){var $={};this.altAudio&&($.type="video"),this.hls.trigger(F.Events.BUFFER_EOS,$),this.state=k.State.ENDED;return}var ie=B.end,oe=this.getNextFragment(ie,G);if(this.couldBacktrack&&!this.fragPrevious&&oe&&oe.sn!=="initSegment"){var _e=oe.sn-G.startSN;_e>1&&(oe=G.fragments[_e-1],this.fragmentTracker.removeFragment(oe))}if(oe&&this.fragmentTracker.getState(oe)===D.FragmentState.OK&&this.nextLoadPosition>ie){var fe=this.audioOnly&&!this.altAudio?E.ElementaryStreamTypes.AUDIO:E.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(v,fe,R.PlaylistLevelType.MAIN),oe=this.getNextFragment(this.nextLoadPosition,G)}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"&&!((o=oe.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(oe,G):this.loadFragment(oe,G,ie)},y.loadFragment=function(c,o,a){var m,p=this.fragmentTracker.getState(c);if(this.fragCurrent=c,p===D.FragmentState.BACKTRACKED){var v=this.fragmentTracker.getBacktrackData(c);if(v){this._handleFragmentLoadProgress(v),this._handleFragmentLoadComplete(v);return}else p=D.FragmentState.NOT_LOADED}p===D.FragmentState.NOT_LOADED||p===D.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,g.prototype.loadFragment.call(this,c,o,a)):p===D.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((m=this.media)===null||m===void 0?void 0:m.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},y.getAppendedFrag=function(c){var o=this.fragmentTracker.getAppendedFrag(c,R.PlaylistLevelType.MAIN);return o&&"fragment"in o?o.fragment:o},y.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,R.PlaylistLevelType.MAIN)},y.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},y.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},y.nextLevelSwitch=function(){var c=this.levels,o=this.media;if(o!=null&&o.readyState){var a,m=this.getAppendedFrag(o.currentTime);if(m&&m.start>1&&this.flushMainBuffer(0,m.start-1),!o.paused&&c){var p=this.hls.nextLoadLevel,v=c[p],O=this.fragLastKbps;O&&this.fragCurrent?a=this.fragCurrent.duration*v.maxBitrate/(1e3*O)+1:a=0}else a=0;var U=this.getBufferedFrag(o.currentTime+a);if(U){var j=this.followingBufferedFrag(U);if(j){this.abortCurrentFrag();var G=j.maxStartPTS?j.maxStartPTS:j.start,B=j.duration,N=Math.max(U.end,G+Math.min(Math.max(B-this.config.maxFragLookUpTolerance,B*.5),B*.75));this.flushMainBuffer(N,Number.POSITIVE_INFINITY)}}}},y.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===k.State.KEY_LOADING&&(this.state=k.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},y.flushMainBuffer=function(c,o){g.prototype.flushMainBuffer.call(this,c,o,this.altAudio?"video":null)},y.onMediaAttached=function(c,o){g.prototype.onMediaAttached.call(this,c,o);var a=o.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 A.default(this.config,a,this.fragmentTracker,this.hls)},y.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),g.prototype.onMediaDetaching.call(this)},y.onMediaPlaying=function(){this.tick()},y.onMediaSeeked=function(){var c=this.media,o=c?c.currentTime:null;Object(H.isFiniteNumber)(o)&&this.log("Media seeked to "+o.toFixed(3)),this.tick()},y.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(F.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},y.onManifestParsed=function(c,o){var a=!1,m=!1,p;o.levels.forEach(function(v){p=v.audioCodec,p&&(p.indexOf("mp4a.40.2")!==-1&&(a=!0),p.indexOf("mp4a.40.5")!==-1&&(m=!0))}),this.audioCodecSwitch=a&&m&&!Object(P.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=o.levels,this.startFragRequested=!1},y.onLevelLoading=function(c,o){var a=this.levels;if(!a||this.state!==k.State.IDLE)return;var m=a[o.level];(!m.details||m.details.live&&this.levelLastLoaded!==o.level||this.waitForCdnTuneIn(m.details))&&(this.state=k.State.WAITING_LEVEL)},y.onLevelLoaded=function(c,o){var a,m=this.levels,p=o.level,v=o.details,O=v.totalduration;if(!m){this.warn("Levels were reset while loading level "+p);return}this.log("Level "+p+" loaded ["+v.startSN+","+v.endSN+"], cc ["+v.startCC+", "+v.endCC+"] duration:"+O);var U=this.fragCurrent;U&&(this.state===k.State.FRAG_LOADING||this.state===k.State.FRAG_LOADING_WAITING_RETRY)&&(U.level!==o.level&&U.loader&&(this.state=k.State.IDLE,U.loader.abort()));var j=m[p],G=0;if(v.live||(a=j.details)!==null&&a!==void 0&&a.live){if(v.fragments[0]||(v.deltaUpdateFailed=!0),v.deltaUpdateFailed)return;G=this.alignPlaylists(v,j.details)}if(j.details=v,this.levelLastLoaded=p,this.hls.trigger(F.Events.LEVEL_UPDATED,{details:v,level:p}),this.state===k.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(v))return;this.state=k.State.IDLE}this.startFragRequested?v.live&&this.synchronizeToLiveEdge(v):this.setStartPosition(v,G),this.tick()},y._handleFragmentLoadProgress=function(c){var o,a=c.frag,m=c.part,p=c.payload,v=this.levels;if(!v){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var O=v[a.level],U=O.details;if(!U){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var j=O.videoCodec,G=U.PTSKnown||!U.live,B=(o=a.initSegment)===null||o===void 0?void 0:o.data,N=this._getAudioCodec(O),V=this.transmuxer=this.transmuxer||new w.default(this.hls,R.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),$=m?m.index:-1,ie=$!==-1,oe=new T.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,p.byteLength,$,ie),_e=this.initPTS[a.cc];V.push(p,B,N,j,a,m,U.totalduration,G,oe,_e)},y.onAudioTrackSwitching=function(c,o){var a=this.altAudio,m=!!o.url,p=o.id;if(!m){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var v=this.fragCurrent;v!=null&&v.loader&&(this.log("Switching to main audio track, cancel main fragment load"),v.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var O=this.hls;a&&O.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),O.trigger(F.Events.AUDIO_TRACK_SWITCHED,{id:p})}},y.onAudioTrackSwitched=function(c,o){var a=o.id,m=!!this.hls.audioTracks[a].url;if(m){var p=this.videoBuffer;p&&this.mediaBuffer!==p&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=p)}this.altAudio=m,this.tick()},y.onBufferCreated=function(c,o){var a=o.tracks,m,p,v=!1;for(var O in a){var U=a[O];if(U.id==="main"){if(p=O,m=U,O==="video"){var j=a[O];j&&(this.videoBuffer=j.buffer)}}else v=!0}v&&m?(this.log("Alternate track found, use "+p+".buffered to schedule main fragment loading"),this.mediaBuffer=m.buffer):this.mediaBuffer=this.media},y.onFragBuffered=function(c,o){var a=o.frag,m=o.part;if(a&&a.type!==R.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(m?" p: "+m.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===k.State.PARSED&&(this.state=k.State.IDLE);return}var p=m?m.stats:a.stats;this.fragLastKbps=Math.round(8*p.total/(p.buffering.end-p.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,m)},y.onError=function(c,o){switch(o.details){case _.ErrorDetails.FRAG_LOAD_ERROR:case _.ErrorDetails.FRAG_LOAD_TIMEOUT:case _.ErrorDetails.KEY_LOAD_ERROR:case _.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.MAIN,o);break;case _.ErrorDetails.LEVEL_LOAD_ERROR:case _.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==k.State.ERROR&&(o.fatal?(this.warn(""+o.details),this.state=k.State.ERROR):!o.levelRetry&&this.state===k.State.WAITING_LEVEL&&(this.state=k.State.IDLE));break;case _.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="main"&&(this.state===k.State.PARSING||this.state===k.State.PARSED)){var a=!0,m=this.getFwdBufferInfo(this.media,R.PlaylistLevelType.MAIN);m&&m.len>.5&&(a=!this.reduceMaxBufferLength(m.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},y.checkBuffer=function(){var c=this.media,o=this.gapController;if(!c||!o||!c.readyState)return;var a=M.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):o.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},y.onFragLoadEmergencyAborted=function(){this.state=k.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},y.onBufferFlushed=function(c,o){var a=o.type;if(a!==E.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var m=(a===E.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(m,a,R.PlaylistLevelType.MAIN)}},y.onLevelsUpdated=function(c,o){this.levels=o.levels},y.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},y.seekToStartPos=function(){var c=this.media,o=c.currentTime,a=this.startPosition;if(a>=0&&o<a){if(c.seeking){b.logger.log("could not seek to "+a+", already seeking at "+o);return}var m=M.BufferHelper.getBuffered(c),p=m.length?m.start(0):0,v=p-a;v>0&&(v<this.config.maxBufferHole||v<this.config.maxFragLookUpTolerance)&&(b.logger.log("adjusting start position by "+v+" to match buffer start"),a+=v,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+o),c.currentTime=a}},y._getAudioCodec=function(c){var o=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&o&&(this.log("Swapping audio codec"),o.indexOf("mp4a.40.5")!==-1?o="mp4a.40.2":o="mp4a.40.5"),o},y._loadBitrateTestFrag=function(c){var o=this;this._doFragLoad(c).then(function(a){var m=o.hls;if(!a||m.nextLoadLevel||o.fragContextChanged(c))return;o.fragLoadError=0,o.state=k.State.IDLE,o.startFragRequested=!1,o.bitrateTest=!1;var p=c.stats;p.parsing.start=p.parsing.end=p.buffering.start=p.buffering.end=self.performance.now(),m.trigger(F.Events.FRAG_LOADED,a)})},y._handleTransmuxComplete=function(c){var o,a="main",m=this.hls,p=c.remuxResult,v=c.chunkMeta,O=this.getCurrentContext(v);if(!O){this.warn("The loading context changed while buffering fragment "+v.sn+" of level "+v.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(v.level);return}var U=O.frag,j=O.part,G=O.level,B=p.video,N=p.text,V=p.id3,$=p.initSegment,ie=this.altAudio?void 0:p.audio;if(this.fragContextChanged(U))return;if(this.state=k.State.PARSING,$){$.tracks&&(this._bufferInitSegment(G,$.tracks,U,v),m.trigger(F.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:a,tracks:$.tracks}));var oe=$.initPTS,_e=$.timescale;Object(H.isFiniteNumber)(oe)&&(this.initPTS[U.cc]=oe,m.trigger(F.Events.INIT_PTS_FOUND,{frag:U,id:a,initPTS:oe,timescale:_e}))}if(B&&p.independent!==!1){if(G.details){var fe=B.startPTS,Se=B.endPTS,be=B.startDTS,me=B.endDTS;if(j)j.elementaryStreams[B.type]={startPTS:fe,endPTS:Se,startDTS:be,endDTS:me};else if(B.firstKeyFrame&&B.independent&&(this.couldBacktrack=!0),B.dropped&&B.independent){var le=this.getLoadPosition()+this.config.maxBufferHole;if(le<fe){this.backtrack(U);return}U.setElementaryStreamInfo(B.type,U.start,Se,U.start,me,!0)}U.setElementaryStreamInfo(B.type,fe,Se,be,me),this.bufferFragmentData(B,U,j,v)}}else if(p.independent===!1){this.backtrack(U);return}if(ie){var ue=ie.startPTS,Ee=ie.endPTS,Ge=ie.startDTS,Te=ie.endDTS;j&&(j.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:ue,endPTS:Ee,startDTS:Ge,endDTS:Te}),U.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,ue,Ee,Ge,Te),this.bufferFragmentData(ie,U,j,v)}if(V!=null&&(o=V.samples)!==null&&o!==void 0&&o.length){var pe={frag:U,id:a,samples:V.samples};m.trigger(F.Events.FRAG_PARSING_METADATA,pe)}if(N){var Ae={frag:U,id:a,samples:N.samples};m.trigger(F.Events.FRAG_PARSING_USERDATA,Ae)}},y._bufferInitSegment=function(c,o,a,m){var p=this;if(this.state!==k.State.PARSING)return;this.audioOnly=!!o.audio&&!o.video,this.altAudio&&!this.audioOnly&&delete o.audio;var v=o.audio,O=o.video,U=o.audiovideo;if(v){var j=c.audioCodec,G=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),v.metadata.channelCount!==1&&G.indexOf("firefox")===-1&&(j="mp4a.40.5")),G.indexOf("android")!==-1&&v.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+'"'),v.levelCodec=j,v.id="main",this.log("Init audio buffer, container:"+v.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(c.audioCodec||"")+"/"+v.codec+"]")}O&&(O.levelCodec=c.videoCodec,O.id="main",this.log("Init video buffer, container:"+O.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+O.codec+"]")),U&&this.log("Init audiovideo buffer, container:"+U.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+U.codec+"]"),this.hls.trigger(F.Events.BUFFER_CODECS,o),Object.keys(o).forEach(function(B){var N=o[B],V=N.initSegment;V!=null&&V.byteLength&&p.hls.trigger(F.Events.BUFFER_APPENDING,{type:B,data:V,frag:a,part:null,chunkMeta:m,parent:a.type})}),this.tick()},y.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var o=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,o?this.resetFragmentLoading(c):this.state=k.State.BACKTRACKING},y.checkFragmentChanged=function(){var c=this.media,o=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(M.BufferHelper.isBuffered(c,a)?o=this.getAppendedFrag(a):M.BufferHelper.isBuffered(c,a+.1)&&(o=this.getAppendedFrag(a+.1)),o){var m=this.fragPlaying,p=o.level;(!m||o.sn!==m.sn||m.level!==p||o.urlId!==m.urlId)&&(this.hls.trigger(F.Events.FRAG_CHANGED,{frag:o}),(!m||m.level!==p)&&this.hls.trigger(F.Events.LEVEL_SWITCHED,{level:p}),this.fragPlaying=o)}}},s(C,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var o=this.getAppendedFrag(c.currentTime);if(o)return o.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var o=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(o)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),C}(k.default)},"./src/controller/subtitle-stream-controller.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"SubtitleStreamController",function(){return u});var H=L("./src/events.ts"),k=L("./src/utils/logger.ts"),P=L("./src/utils/buffer-helper.ts"),F=L("./src/controller/fragment-finders.ts"),M=L("./src/utils/discontinuities.ts"),D=L("./src/controller/level-helper.ts"),R=L("./src/controller/fragment-tracker.ts"),E=L("./src/controller/base-stream-controller.ts"),w=L("./src/types/loader.ts"),T=L("./src/types/level.ts");function A(l,S){for(var h=0;h<S.length;h++){var g=S[h];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(l,g.key,g)}}function _(l,S,h){return S&&A(l.prototype,S),h&&A(l,h),l}function b(l,S){l.prototype=Object.create(S.prototype),l.prototype.constructor=l,d(l,S)}function d(l,S){return d=Object.setPrototypeOf||function(g,C){return g.__proto__=C,g},d(l,S)}var s=500,u=function(l){b(S,l);function S(g,C){var y;return y=l.call(this,g,C,"[subtitle-stream-controller]")||this,y.levels=[],y.currentTrackId=-1,y.tracksBuffered=[],y.mainDetails=null,y._registerListeners(),y}var h=S.prototype;return h.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},h._registerListeners=function(){var C=this.hls;C.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),C.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),C.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),C.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),C.on(H.Events.ERROR,this.onError,this),C.on(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),C.on(H.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),C.on(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),C.on(H.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),C.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},h._unregisterListeners=function(){var C=this.hls;C.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),C.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),C.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),C.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),C.off(H.Events.ERROR,this.onError,this),C.off(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),C.off(H.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),C.off(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),C.off(H.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),C.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},h.startLoad=function(){this.stopLoad(),this.state=E.State.IDLE,this.setInterval(s),this.tick()},h.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},h.onLevelLoaded=function(C,y){this.mainDetails=y.details},h.onSubtitleFragProcessed=function(C,y){var f=y.frag,c=y.success;if(this.fragPrevious=f,this.state=E.State.IDLE,!c)return;var o=this.tracksBuffered[this.currentTrackId];if(!o)return;for(var a,m=f.start,p=0;p<o.length;p++)if(m>=o[p].start&&m<=o[p].end){a=o[p];break}var v=f.start+f.duration;a?a.end=v:(a={start:m,end:v},o.push(a)),this.fragmentTracker.fragBuffered(f)},h.onBufferFlushing=function(C,y){var f=y.startOffset,c=y.endOffset;if(f===0&&c!==Number.POSITIVE_INFINITY){var o=this.currentTrackId,a=this.levels;if(!a.length||!a[o]||!a[o].details)return;var m=a[o].details,p=m.targetduration,v=c-p;if(v<=0)return;y.endOffsetSubtitles=Math.max(0,v),this.tracksBuffered.forEach(function(O){for(var U=0;U<O.length;){if(O[U].end<=v){O.shift();continue}else if(O[U].start<v)O[U].start=v;else break;U++}}),this.fragmentTracker.removeFragmentsInRange(f,v,w.PlaylistLevelType.SUBTITLE)}},h.onError=function(C,y){var f,c=y.frag;if(!c||c.type!==w.PlaylistLevelType.SUBTITLE)return;(f=this.fragCurrent)!==null&&f!==void 0&&f.loader&&this.fragCurrent.loader.abort(),this.state=E.State.IDLE},h.onSubtitleTracksUpdated=function(C,y){var f=this,c=y.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(o){return new T.Level(o)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(o){f.tracksBuffered[o.id]=[]}),this.mediaBuffer=null},h.onSubtitleTrackSwitch=function(C,y){if(this.currentTrackId=y.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var f=this.levels[this.currentTrackId];f!=null&&f.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,f&&this.setInterval(s)},h.onSubtitleTrackLoaded=function(C,y){var f,c=y.details,o=y.id,a=this.currentTrackId,m=this.levels;if(!m.length)return;var p=m[a];if(o>=m.length||o!==a||!p)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(f=p.details)!==null&&f!==void 0&&f.live){var v=this.mainDetails;if(c.deltaUpdateFailed||!v)return;var O=v.fragments[0];if(!p.details)c.hasProgramDateTime&&v.hasProgramDateTime?Object(M.alignMediaPlaylistByPDT)(c,v):O&&Object(D.addSliding)(c,O.start);else{var U=this.alignPlaylists(c,p.details);U===0&&O&&Object(D.addSliding)(c,O.start)}}if(p.details=c,this.levelLastLoaded=o,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===E.State.IDLE){var j=Object(F.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),p.details=void 0)}},h._handleFragmentLoadComplete=function(C){var y=C.frag,f=C.payload,c=y.decryptdata,o=this.hls;if(this.fragContextChanged(y))return;if(f&&f.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(f),c.key.buffer,c.iv.buffer).then(function(m){var p=performance.now();o.trigger(H.Events.FRAG_DECRYPTED,{frag:y,payload:m,stats:{tstart:a,tdecrypt:p}})})}},h.doTick=function(){if(!this.media){this.state=E.State.IDLE;return}if(this.state===E.State.IDLE){var C,y=this.currentTrackId,f=this.levels;if(!f.length||!f[y]||!f[y].details)return;var c=f[y].details,o=c.targetduration,a=this.config,m=this.media,p=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,m.currentTime-o,a.maxBufferHole),v=p.end,O=p.len,U=this.getMaxBufferLength()+o;if(O>U)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var j=c.fragments,G=j.length,B=c.edge,N,V=this.fragPrevious;if(v<B){var $=a.maxFragLookUpTolerance;V&&c.hasProgramDateTime&&(N=Object(F.findFragmentByPDT)(j,V.endProgramDateTime,$)),N||(N=Object(F.findFragmentByPTS)(V,j,v,$),!N&&V&&V.start<j[0].start&&(N=j[0]))}else N=j[G-1];(C=N)!==null&&C!==void 0&&C.encrypted?(k.logger.log("Loading key for "+N.sn),this.state=E.State.KEY_LOADING,this.hls.trigger(H.Events.KEY_LOADING,{frag:N})):N&&this.fragmentTracker.getState(N)===R.FragmentState.NOT_LOADED&&this.loadFragment(N,c,v)}},h.loadFragment=function(C,y,f){this.fragCurrent=C,l.prototype.loadFragment.call(this,C,y,f)},_(S,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),S}(E.default)},"./src/controller/subtitle-track-controller.ts":function(re,z,L){"use strict";L.r(z);var H=L("./src/events.ts"),k=L("./src/utils/texttrack-utils.ts"),P=L("./src/controller/base-playlist-controller.ts"),F=L("./src/types/loader.ts");function M(A,_){for(var b=0;b<_.length;b++){var d=_[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(A,d.key,d)}}function D(A,_,b){return _&&M(A.prototype,_),b&&M(A,b),A}function R(A,_){A.prototype=Object.create(_.prototype),A.prototype.constructor=A,E(A,_)}function E(A,_){return E=Object.setPrototypeOf||function(d,s){return d.__proto__=s,d},E(A,_)}var w=function(A){R(_,A);function _(d){var s;return s=A.call(this,d,"[subtitle-track-controller]")||this,s.media=null,s.tracks=[],s.groupId=null,s.tracksInGroup=[],s.trackId=-1,s.selectDefaultTrack=!0,s.queuedDefaultTrack=-1,s.trackChangeListener=function(){return s.onTextTracksChanged()},s.asyncPollTrackChange=function(){return s.pollTrackChange(0)},s.useTextTrackPolling=!1,s.subtitlePollingInterval=-1,s.subtitleDisplay=!0,s.registerListeners(),s}var b=_.prototype;return b.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,A.prototype.destroy.call(this)},b.registerListeners=function(){var s=this.hls;s.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),s.on(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.on(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),s.on(H.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var s=this.hls;s.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),s.off(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.off(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),s.off(H.Events.ERROR,this.onError,this)},b.onMediaAttached=function(s,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)},b.pollTrackChange=function(s){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,s)},b.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 s=T(this.media.textTracks);s.forEach(function(u){Object(k.clearCurrentCues)(u)}),this.subtitleTrack=-1,this.media=null},b.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},b.onManifestParsed=function(s,u){this.tracks=u.subtitleTracks},b.onSubtitleTrackLoaded=function(s,u){var l=u.id,S=u.details,h=this.trackId,g=this.tracksInGroup[h];if(!g){this.warn("Invalid subtitle track id "+l);return}var C=g.details;g.details=u.details,this.log("subtitle track "+l+" loaded ["+S.startSN+"-"+S.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,u,C))},b.onLevelLoading=function(s,u){this.switchLevel(u.level)},b.onLevelSwitching=function(s,u){this.switchLevel(u.level)},b.switchLevel=function(s){var u=this.hls.levels[s];if(!(u!=null&&u.textGroupIds))return;var l=u.textGroupIds[u.urlId];if(this.groupId!==l){var S=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,h=this.tracks.filter(function(y){return!l||y.groupId===l});this.tracksInGroup=h;var g=this.findTrackId(S==null?void 0:S.name)||this.findTrackId();this.groupId=l;var C={subtitleTracks:h};this.log("Updating subtitle tracks, "+h.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(H.Events.SUBTITLE_TRACKS_UPDATED,C),g!==-1&&this.setSubtitleTrack(g,S)}},b.findTrackId=function(s){for(var u=this.tracksInGroup,l=0;l<u.length;l++){var S=u[l];if((!this.selectDefaultTrack||S.default)&&(!s||s===S.name))return S.id}return-1},b.onError=function(s,u){if(A.prototype.onError.call(this,s,u),u.fatal||!u.context)return;u.context.type===F.PlaylistContextType.SUBTITLE_TRACK&&u.context.id===this.trackId&&u.context.groupId===this.groupId&&this.retryLoadingOrFail(u)},b.loadPlaylist=function(s){var u=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(u)){var l=u.id,S=u.groupId,h=u.url;if(s)try{h=s.addDirectives(h)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("Loading subtitle playlist for id "+l),this.hls.trigger(H.Events.SUBTITLE_TRACK_LOADING,{url:h,id:l,groupId:S,deliveryDirectives:s||null})}},b.toggleTrackModes=function(s){var u=this,l=this.media,S=this.subtitleDisplay,h=this.trackId;if(!l)return;var g=T(l.textTracks),C=g.filter(function(c){return c.groupId===u.groupId});if(s===-1)[].slice.call(g).forEach(function(c){c.mode="disabled"});else{var y=C[h];y&&(y.mode="disabled")}var f=C[s];f&&(f.mode=S?"showing":"hidden")},b.setSubtitleTrack=function(s,u){var l,S=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=s;return}if(this.trackId!==s&&this.toggleTrackModes(s),this.trackId===s&&(s===-1||(l=S[s])!==null&&l!==void 0&&l.details)||s<-1||s>=S.length)return;this.clearTimer();var h=S[s];if(this.log("Switching to subtitle track "+s),this.trackId=s,h){var g=h.id,C=h.groupId,y=C===void 0?"":C,f=h.name,c=h.type,o=h.url;this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:g,groupId:y,name:f,type:c,url:o});var a=this.switchParams(h.url,u==null?void 0:u.details);this.loadPlaylist(a)}else this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:s})},b.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var s=-1,u=T(this.media.textTracks),l=0;l<u.length;l++)if(u[l].mode==="hidden")s=l;else if(u[l].mode==="showing"){s=l;break}this.subtitleTrack!==s&&(this.subtitleTrack=s)},D(_,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(s){this.selectDefaultTrack=!1;var u=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(s,u)}}]),_}(P.default);function T(A){for(var _=[],b=0;b<A.length;b++){var d=A[b];d.kind==="subtitles"&&d.label&&_.push(A[b])}return _}z.default=w},"./src/controller/timeline-controller.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"TimelineController",function(){return T});var H=L("./src/polyfills/number.ts"),k=L("./src/events.ts"),P=L("./src/utils/cea-608-parser.ts"),F=L("./src/utils/output-filter.ts"),M=L("./src/utils/webvtt-parser.ts"),D=L("./src/utils/texttrack-utils.ts"),R=L("./src/utils/imsc1-ttml-parser.ts"),E=L("./src/types/loader.ts"),w=L("./src/utils/logger.ts"),T=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=b(),this.captionsProperties=void 0,this.hls=u,this.config=u.config,this.Cues=u.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var l=new F.default(this,"textTrack1"),S=new F.default(this,"textTrack2"),h=new F.default(this,"textTrack3"),g=new F.default(this,"textTrack4");this.cea608Parser1=new P.default(1,l,S),this.cea608Parser2=new P.default(3,h,g)}u.on(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(k.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.on(k.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.on(k.Events.FRAG_LOADING,this.onFragLoading,this),u.on(k.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(k.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.on(k.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.on(k.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(k.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.on(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var s=d.prototype;return s.destroy=function(){var l=this.hls;l.off(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(k.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.off(k.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.off(k.Events.FRAG_LOADING,this.onFragLoading,this),l.off(k.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(k.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.off(k.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.off(k.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(k.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.off(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},s.addCues=function(l,S,h,g,C){for(var y=!1,f=C.length;f--;){var c=C[f],o=_(c[0],c[1],S,h);if(o>=0&&(c[0]=Math.min(c[0],S),c[1]=Math.max(c[1],h),y=!0,o/(h-S)>.5))return}if(y||C.push([S,h]),this.config.renderTextTracksNatively){var a=this.captionsTracks[l];this.Cues.newCue(a,S,h,g)}else{var m=this.Cues.newCue(null,S,h,g);this.hls.trigger(k.Events.CUES_PARSED,{type:"captions",cues:m,track:l})}},s.onInitPtsFound=function(l,S){var h=this,g=S.frag,C=S.id,y=S.initPTS,f=S.timescale,c=this.unparsedVttFrags;C==="main"&&(this.initPTS[g.cc]=y,this.timescale[g.cc]=f),c.length&&(this.unparsedVttFrags=[],c.forEach(function(o){h.onFragLoaded(k.Events.FRAG_LOADED,o)}))},s.getExistingTrack=function(l){var S=this.media;if(S)for(var h=0;h<S.textTracks.length;h++){var g=S.textTracks[h];if(g[l])return g}return null},s.createCaptionsTrack=function(l){this.config.renderTextTracksNatively?this.createNativeTrack(l):this.createNonNativeTrack(l)},s.createNativeTrack=function(l){if(this.captionsTracks[l])return;var S=this.captionsProperties,h=this.captionsTracks,g=this.media,C=S[l],y=C.label,f=C.languageCode,c=this.getExistingTrack(l);if(c)h[l]=c,Object(D.clearCurrentCues)(h[l]),Object(D.sendAddTrackEvent)(h[l],g);else{var o=this.createTextTrack("captions",y,f);o&&(o[l]=!0,h[l]=o)}},s.createNonNativeTrack=function(l){if(this.nonNativeCaptionsTracks[l])return;var S=this.captionsProperties[l];if(!S)return;var h=S.label,g={_id:l,label:h,kind:"captions",default:S.media?!!S.media.default:!1,closedCaptions:S.media};this.nonNativeCaptionsTracks[l]=g,this.hls.trigger(k.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[g]})},s.createTextTrack=function(l,S,h){var g=this.media;return g?g.addTextTrack(l,S,h):void 0},s.onMediaAttaching=function(l,S){this.media=S.media,this._cleanTracks()},s.onMediaDetaching=function(){var l=this.captionsTracks;Object.keys(l).forEach(function(S){Object(D.clearCurrentCues)(l[S]),delete l[S]}),this.nonNativeCaptionsTracks={}},s.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=b(),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())},s._cleanTracks=function(){var l=this.media;if(!l)return;var S=l.textTracks;if(S)for(var h=0;h<S.length;h++)Object(D.clearCurrentCues)(S[h])},s.onSubtitleTracksUpdated=function(l,S){var h=this;this.textTracks=[];var g=S.subtitleTracks||[],C=g.some(function(o){return o.textCodec===R.IMSC1_CODEC});if(this.config.enableWebVTT||C&&this.config.enableIMSC1){var y=this.tracks&&g&&this.tracks.length===g.length;if(this.tracks=g||[],this.config.renderTextTracksNatively){var f=this.media?this.media.textTracks:[];this.tracks.forEach(function(o,a){var m;if(a<f.length){for(var p=null,v=0;v<f.length;v++)if(A(f[v],o)){p=f[v];break}p&&(m=p)}m?Object(D.clearCurrentCues)(m):(m=h.createTextTrack("subtitles",o.name,o.lang),m&&(m.mode="disabled")),m&&(m.groupId=o.groupId,h.textTracks.push(m))})}else if(!y&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(o){return{label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}});this.hls.trigger(k.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},s.onManifestLoaded=function(l,S){var h=this;this.config.enableCEA708Captions&&S.captions&&S.captions.forEach(function(g){var C=/(?:CC|SERVICE)([1-4])/.exec(g.instreamId);if(!C)return;var y="textTrack"+C[1],f=h.captionsProperties[y];if(!f)return;f.label=g.name,g.lang&&(f.languageCode=g.lang),f.media=g})},s.onFragLoading=function(l,S){var h=this.cea608Parser1,g=this.cea608Parser2,C=this.lastSn,y=this.lastPartIndex;if(!this.enabled||!(h&&g))return;if(S.frag.type===E.PlaylistLevelType.MAIN){var f,c,o=S.frag.sn,a=(f=S==null||((c=S.part)===null||c===void 0)?void 0:c.index)!=null?f:-1;o===C+1||o===C&&a===y+1||(h.reset(),g.reset()),this.lastSn=o,this.lastPartIndex=a}},s.onFragLoaded=function(l,S){var h=S.frag,g=S.payload,C=this.initPTS,y=this.unparsedVttFrags;if(h.type===E.PlaylistLevelType.SUBTITLE)if(g.byteLength){if(!Object(H.isFiniteNumber)(C[h.cc])){y.push(S),C.length&&this.hls.trigger(k.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:new Error("Missing initial subtitle PTS")});return}var f=h.decryptdata;if(f==null||f.key==null||f.method!=="AES-128"){var c=this.tracks[h.level],o=this.vttCCs;o[h.cc]||(o[h.cc]={start:h.start,prevCC:this.prevCC,new:!0},this.prevCC=h.cc),c&&c.textCodec===R.IMSC1_CODEC?this._parseIMSC1(h,g):this._parseVTTs(h,g,o)}}else this.hls.trigger(k.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:new Error("Empty subtitle payload")})},s._parseIMSC1=function(l,S){var h=this,g=this.hls;Object(R.parseIMSC1)(S,this.initPTS[l.cc],this.timescale[l.cc],function(C){h._appendCues(C,l.level),g.trigger(k.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(C){w.logger.log("Failed to parse IMSC1: "+C),g.trigger(k.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:C})})},s._parseVTTs=function(l,S,h){var g=this,C=this.hls;Object(M.parseWebVTT)(S,this.initPTS[l.cc],this.timescale[l.cc],h,l.cc,l.start,function(y){g._appendCues(y,l.level),C.trigger(k.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(y){g._fallbackToIMSC1(l,S),w.logger.log("Failed to parse VTT cue: "+y),C.trigger(k.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:y})})},s._fallbackToIMSC1=function(l,S){var h=this,g=this.tracks[l.level];g.textCodec||Object(R.parseIMSC1)(S,this.initPTS[l.cc],this.timescale[l.cc],function(){g.textCodec=R.IMSC1_CODEC,h._parseIMSC1(l,S)},function(){g.textCodec="wvtt"})},s._appendCues=function(l,S){var h=this.hls;if(this.config.renderTextTracksNatively){var g=this.textTracks[S];if(g.mode==="disabled")return;l.forEach(function(f){return Object(D.addCueToTrack)(g,f)})}else{var C=this.tracks[S],y=C.default?"default":"subtitles"+S;h.trigger(k.Events.CUES_PARSED,{type:"subtitles",cues:l,track:y})}},s.onFragDecrypted=function(l,S){var h=S.frag;if(h.type===E.PlaylistLevelType.SUBTITLE){if(!Object(H.isFiniteNumber)(this.initPTS[h.cc])){this.unparsedVttFrags.push(S);return}this.onFragLoaded(k.Events.FRAG_LOADED,S)}},s.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},s.onFragParsingUserdata=function(l,S){var h=this.cea608Parser1,g=this.cea608Parser2;if(!this.enabled||!(h&&g))return;for(var C=0;C<S.samples.length;C++){var y=S.samples[C].bytes;if(y){var f=this.extractCea608Data(y);h.addData(S.samples[C].pts,f[0]),g.addData(S.samples[C].pts,f[1])}}},s.onBufferFlushing=function(l,S){var h=S.startOffset,g=S.endOffset,C=S.endOffsetSubtitles,y=S.type,f=this.media;if(!f||f.currentTime<g)return;if(!y||y==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(D.removeCuesInRange)(c[a],h,g)})}if(this.config.renderTextTracksNatively&&(h===0&&C!==void 0)){var o=this.textTracks;Object.keys(o).forEach(function(a){return Object(D.removeCuesInRange)(o[a],h,C)})}},s.extractCea608Data=function(l){for(var S=l[0]&31,h=2,g=[[],[]],C=0;C<S;C++){var y=l[h++],f=127&l[h++],c=127&l[h++],o=(4&y)!==0,a=3&y;if(f===0&&c===0)continue;o&&((a===0||a===1)&&(g[a].push(f),g[a].push(c)))}return g},d}();function A(d,s){return d&&d.label===s.name&&!(d.textTrack1||d.textTrack2)}function _(d,s,u,l){return Math.min(s,l)-Math.max(d,u)}function b(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return H});var H=function(){function k(F,M){this.subtle=void 0,this.aesIV=void 0,this.subtle=F,this.aesIV=M}var P=k.prototype;return P.decrypt=function(M,D){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},D,M)},k}()},"./src/crypt/aes-decryptor.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"removePadding",function(){return k}),L.d(z,"default",function(){return P});var H=L("./src/utils/typed-array.ts");function k(F){var M=F.byteLength,D=M&&new DataView(F.buffer).getUint8(M-1);return D?Object(H.sliceUint8)(F,0,M-D):F}var P=function(){function F(){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 M=F.prototype;return M.uint8ArrayToUint32Array_=function(R){for(var E=new DataView(R),w=new Uint32Array(4),T=0;T<4;T++)w[T]=E.getUint32(T*4);return w},M.initTable=function(){var R=this.sBox,E=this.invSBox,w=this.subMix,T=w[0],A=w[1],_=w[2],b=w[3],d=this.invSubMix,s=d[0],u=d[1],l=d[2],S=d[3],h=new Uint32Array(256),g=0,C=0,y=0;for(y=0;y<256;y++)y<128?h[y]=y<<1:h[y]=y<<1^283;for(y=0;y<256;y++){var f=C^C<<1^C<<2^C<<3^C<<4;f=f>>>8^f&255^99,R[g]=f,E[f]=g;var c=h[g],o=h[c],a=h[o],m=h[f]*257^f*16843008;T[g]=m<<24|m>>>8,A[g]=m<<16|m>>>16,_[g]=m<<8|m>>>24,b[g]=m,m=a*16843009^o*65537^c*257^g*16843008,s[f]=m<<24|m>>>8,u[f]=m<<16|m>>>16,l[f]=m<<8|m>>>24,S[f]=m,g?(g=c^h[h[h[a^c]]],C^=h[h[C]]):g=C=1}},M.expandKey=function(R){for(var E=this.uint8ArrayToUint32Array_(R),w=!0,T=0;T<E.length&&w;)w=E[T]===this.key[T],T++;if(w)return;this.key=E;var A=this.keySize=E.length;if(A!==4&&A!==6&&A!==8)throw new Error("Invalid aes key size="+A);var _=this.ksRows=(A+6+1)*4,b,d,s=this.keySchedule=new Uint32Array(_),u=this.invKeySchedule=new Uint32Array(_),l=this.sBox,S=this.rcon,h=this.invSubMix,g=h[0],C=h[1],y=h[2],f=h[3],c,o;for(b=0;b<_;b++){if(b<A){c=s[b]=E[b];continue}o=c,b%A===0?(o=o<<8|o>>>24,o=l[o>>>24]<<24|l[o>>>16&255]<<16|l[o>>>8&255]<<8|l[o&255],o^=S[b/A|0]<<24):A>6&&b%A===4&&(o=l[o>>>24]<<24|l[o>>>16&255]<<16|l[o>>>8&255]<<8|l[o&255]),s[b]=c=(s[b-A]^o)>>>0}for(d=0;d<_;d++)b=_-d,d&3?o=s[b]:o=s[b-4],d<4||b<=4?u[d]=o:u[d]=g[l[o>>>24]]^C[l[o>>>16&255]]^y[l[o>>>8&255]]^f[l[o&255]],u[d]=u[d]>>>0},M.networkToHostOrderSwap=function(R){return R<<24|(R&65280)<<8|(R&16711680)>>8|R>>>24},M.decrypt=function(R,E,w){for(var T=this.keySize+6,A=this.invKeySchedule,_=this.invSBox,b=this.invSubMix,d=b[0],s=b[1],u=b[2],l=b[3],S=this.uint8ArrayToUint32Array_(w),h=S[0],g=S[1],C=S[2],y=S[3],f=new Int32Array(R),c=new Int32Array(f.length),o,a,m,p,v,O,U,j,G,B,N,V,$,ie,oe=this.networkToHostOrderSwap;E<f.length;){for(G=oe(f[E]),B=oe(f[E+1]),N=oe(f[E+2]),V=oe(f[E+3]),v=G^A[0],O=V^A[1],U=N^A[2],j=B^A[3],$=4,ie=1;ie<T;ie++)o=d[v>>>24]^s[O>>16&255]^u[U>>8&255]^l[j&255]^A[$],a=d[O>>>24]^s[U>>16&255]^u[j>>8&255]^l[v&255]^A[$+1],m=d[U>>>24]^s[j>>16&255]^u[v>>8&255]^l[O&255]^A[$+2],p=d[j>>>24]^s[v>>16&255]^u[O>>8&255]^l[U&255]^A[$+3],v=o,O=a,U=m,j=p,$=$+4;o=_[v>>>24]<<24^_[O>>16&255]<<16^_[U>>8&255]<<8^_[j&255]^A[$],a=_[O>>>24]<<24^_[U>>16&255]<<16^_[j>>8&255]<<8^_[v&255]^A[$+1],m=_[U>>>24]<<24^_[j>>16&255]<<16^_[v>>8&255]<<8^_[O&255]^A[$+2],p=_[j>>>24]<<24^_[v>>16&255]<<16^_[O>>8&255]<<8^_[U&255]^A[$+3],c[E]=oe(o^h),c[E+1]=oe(p^g),c[E+2]=oe(m^C),c[E+3]=oe(a^y),h=G,g=B,C=N,y=V,E=E+4}return c.buffer},F}()},"./src/crypt/decrypter.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return E});var H=L("./src/crypt/aes-crypto.ts"),k=L("./src/crypt/fast-aes-key.ts"),P=L("./src/crypt/aes-decryptor.ts"),F=L("./src/utils/logger.ts"),M=L("./src/utils/mp4-tools.ts"),D=L("./src/utils/typed-array.ts"),R=16,E=function(){function w(A,_,b){var d=b===void 0?{}:b,s=d.removePKCS7Padding,u=s===void 0?!0:s;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=A,this.config=_,this.removePKCS7Padding=u,u)try{var l=self.crypto;l&&(this.subtle=l.subtle||l.webkitSubtle)}catch(S){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var T=w.prototype;return T.destroy=function(){this.observer=null},T.isSync=function(){return this.config.enableSoftwareAES},T.flush=function(){var _=this.currentResult;if(!_){this.reset();return}var b=new Uint8Array(_);return this.reset(),this.removePKCS7Padding?Object(P.removePadding)(b):b},T.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},T.decrypt=function(_,b,d,s){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(_),b,d);var u=this.flush();u&&s(u.buffer)}else this.webCryptoDecrypt(new Uint8Array(_),b,d).then(s)},T.softwareDecrypt=function(_,b,d){var s=this.currentIV,u=this.currentResult,l=this.remainderData;this.logOnce("JS AES decrypt"),l&&(_=Object(M.appendUint8Array)(l,_),this.remainderData=null);var S=this.getValidChunk(_);if(!S.length)return null;s&&(d=s);var h=this.softwareDecrypter;h||(h=this.softwareDecrypter=new P.default),h.expandKey(b);var g=u;return this.currentResult=h.decrypt(S.buffer,0,d),this.currentIV=Object(D.sliceUint8)(S,-16).buffer,g||null},T.webCryptoDecrypt=function(_,b,d){var s=this,u=this.subtle;return(this.key!==b||!this.fastAesKey)&&(this.key=b,this.fastAesKey=new k.default(u,b)),this.fastAesKey.expandKey().then(function(l){if(!u)return Promise.reject(new Error("web crypto not initialized"));var S=new H.default(u,d);return S.decrypt(_.buffer,l)}).catch(function(l){return s.onWebCryptoError(l,_,b,d)})},T.onWebCryptoError=function(_,b,d,s){return F.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",_),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(b,d,s)},T.getValidChunk=function(_){var b=_,d=_.length-_.length%R;return d!==_.length&&(b=Object(D.sliceUint8)(_,0,d),this.remainderData=Object(D.sliceUint8)(_,d)),b},T.logOnce=function(_){if(!this.logEnabled)return;F.logger.log("[decrypter.ts]: "+_),this.logEnabled=!1},w}()},"./src/crypt/fast-aes-key.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return H});var H=function(){function k(F,M){this.subtle=void 0,this.key=void 0,this.subtle=F,this.key=M}var P=k.prototype;return P.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},k}()},"./src/demux/aacdemuxer.ts":function(re,z,L){"use strict";L.r(z);var H=L("./src/demux/base-audio-demuxer.ts"),k=L("./src/demux/adts.ts"),P=L("./src/utils/logger.ts"),F=L("./src/demux/id3.ts");function M(E,w){E.prototype=Object.create(w.prototype),E.prototype.constructor=E,D(E,w)}function D(E,w){return D=Object.setPrototypeOf||function(A,_){return A.__proto__=_,A},D(E,w)}var R=function(E){M(w,E);function w(A,_){var b;return b=E.call(this)||this,b.observer=void 0,b.config=void 0,b.observer=A,b.config=_,b}var T=w.prototype;return T.resetInitSegment=function(_,b,d){E.prototype.resetInitSegment.call(this,_,b,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:_,duration:d,inputTimeScale:9e4,dropped:0}},w.probe=function(_){if(!_)return!1;for(var b=F.getID3Data(_,0)||[],d=b.length,s=_.length;d<s;d++)if(k.probe(_,d))return P.logger.log("ADTS sync word found !"),!0;return!1},T.canParse=function(_,b){return k.canParse(_,b)},T.appendFrame=function(_,b,d){k.initTrackConfig(_,this.observer,b,d,_.manifestCodec);var s=k.appendFrame(_,b,d,this.initPTS,this.frameIndex);if(s&&s.missing===0)return s},w}(H.default);R.minProbeByteLength=9,z.default=R},"./src/demux/adts.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"getAudioConfig",function(){return F}),L.d(z,"isHeaderPattern",function(){return M}),L.d(z,"getHeaderLength",function(){return D}),L.d(z,"getFullFrameLength",function(){return R}),L.d(z,"canGetFrameLength",function(){return E}),L.d(z,"isHeader",function(){return w}),L.d(z,"canParse",function(){return T}),L.d(z,"probe",function(){return A}),L.d(z,"initTrackConfig",function(){return _}),L.d(z,"getFrameDuration",function(){return b}),L.d(z,"parseFrameHeader",function(){return d}),L.d(z,"appendFrame",function(){return s});var H=L("./src/utils/logger.ts"),k=L("./src/errors.ts"),P=L("./src/events.ts");function F(u,l,S,h){var g,C,y,f,c=navigator.userAgent.toLowerCase(),o=h,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];g=((l[S+2]&192)>>>6)+1;var m=(l[S+2]&60)>>>2;if(m>a.length-1){u.trigger(P.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+m});return}return y=(l[S+2]&1)<<2,y|=(l[S+3]&192)>>>6,H.logger.log("manifest codec:"+h+", ADTS type:"+g+", samplingIndex:"+m),/firefox/i.test(c)?m>=6?(g=5,f=new Array(4),C=m-3):(g=2,f=new Array(2),C=m):c.indexOf("android")!==-1?(g=2,f=new Array(2),C=m):(g=5,f=new Array(4),h&&(h.indexOf("mp4a.40.29")!==-1||h.indexOf("mp4a.40.5")!==-1)||!h&&m>=6?C=m-3:((h&&h.indexOf("mp4a.40.2")!==-1&&(m>=6&&y===1||/vivaldi/i.test(c))||!h&&y===1)&&(g=2,f=new Array(2)),C=m)),f[0]=g<<3,f[0]|=(m&14)>>1,f[1]|=(m&1)<<7,f[1]|=y<<3,g===5&&(f[1]|=(C&14)>>1,f[2]=(C&1)<<7,f[2]|=2<<2,f[3]=0),{config:f,samplerate:a[m],channelCount:y,codec:"mp4a.40."+g,manifestCodec:o}}function M(u,l){return u[l]===255&&(u[l+1]&246)===240}function D(u,l){return u[l+1]&1?7:9}function R(u,l){return(u[l+3]&3)<<11|u[l+4]<<3|(u[l+5]&224)>>>5}function E(u,l){return l+5<u.length}function w(u,l){return l+1<u.length&&M(u,l)}function T(u,l){return E(u,l)&&M(u,l)&&R(u,l)<=u.length-l}function A(u,l){if(w(u,l)){var S=D(u,l);if(l+S>=u.length)return!1;var h=R(u,l);if(h<=S)return!1;var g=l+h;return g===u.length||w(u,g)}return!1}function _(u,l,S,h,g){if(!u.samplerate){var C=F(l,S,h,g);if(!C)return;u.config=C.config,u.samplerate=C.samplerate,u.channelCount=C.channelCount,u.codec=C.codec,u.manifestCodec=C.manifestCodec,H.logger.log("parsed codec:"+u.codec+", rate:"+C.samplerate+", channels:"+C.channelCount)}}function b(u){return 1024*9e4/u}function d(u,l,S,h,g){var C=D(u,l),y=R(u,l);if(y-=C,y>0){var f=S+h*g;return{headerLength:C,frameLength:y,stamp:f}}}function s(u,l,S,h,g){var C=b(u.samplerate),y=d(l,S,h,g,C);if(y){var f=y.frameLength,c=y.headerLength,o=y.stamp,a=c+f,m=Math.max(0,S+a-l.length),p;m?(p=new Uint8Array(a-c),p.set(l.subarray(S+c,l.length),0)):p=l.subarray(S+c,S+a);var v={unit:p,pts:o};return m||u.samples.push(v),{sample:v,length:a,missing:m}}}},"./src/demux/base-audio-demuxer.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"initPTSFn",function(){return R});var H=L("./src/polyfills/number.ts"),k=L("./src/demux/id3.ts"),P=L("./src/demux/dummy-demuxed-track.ts"),F=L("./src/utils/mp4-tools.ts"),M=L("./src/utils/typed-array.ts"),D=function(){function E(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var w=E.prototype;return w.resetInitSegment=function(A,_,b){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},w.resetTimeStamp=function(){},w.resetContiguity=function(){},w.canParse=function(A,_){return!1},w.appendFrame=function(A,_,b){},w.demux=function(A,_){this.cachedData&&(A=Object(F.appendUint8Array)(this.cachedData,A),this.cachedData=null);var b=k.getID3Data(A,0),d=b?b.length:0,s,u,l=this._audioTrack,S=this._id3Track,h=b?k.getTimeStamp(b):void 0,g=A.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=R(h,_)),b&&b.length>0&&S.samples.push({pts:this.initPTS,dts:this.initPTS,data:b}),u=this.initPTS;d<g;){if(this.canParse(A,d)){var C=this.appendFrame(l,A,d);C?(this.frameIndex++,u=C.sample.pts,d+=C.length,s=d):d=g}else k.canParse(A,d)?(b=k.getID3Data(A,d),S.samples.push({pts:u,dts:u,data:b}),d+=b.length,s=d):d++;if(d===g&&s!==g){var y=Object(M.sliceUint8)(A,s);this.cachedData?this.cachedData=Object(F.appendUint8Array)(this.cachedData,y):this.cachedData=y}}return{audioTrack:l,avcTrack:Object(P.dummyTrack)(),id3Track:S,textTrack:Object(P.dummyTrack)()}},w.demuxSampleAes=function(A,_,b){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},w.flush=function(A){var _=this.cachedData;return _&&(this.cachedData=null,this.demux(_,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(P.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(P.dummyTrack)()}},w.destroy=function(){},E}(),R=function(w,T){return Object(H.isFiniteNumber)(w)?w*90:T*9e4};z.default=D},"./src/demux/chunk-cache.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return H});var H=function(){function P(){this.chunks=[],this.dataLength=0}var F=P.prototype;return F.push=function(D){this.chunks.push(D),this.dataLength+=D.length},F.flush=function(){var D=this.chunks,R=this.dataLength,E;if(D.length)D.length===1?E=D[0]:E=k(D,R);else return new Uint8Array(0);return this.reset(),E},F.reset=function(){this.chunks.length=0,this.dataLength=0},P}();function k(P,F){for(var M=new Uint8Array(F),D=0,R=0;R<P.length;R++){var E=P[R];M.set(E,D),D+=E.length}return M}},"./src/demux/dummy-demuxed-track.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"dummyTrack",function(){return H});function H(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(re,z,L){"use strict";L.r(z);var H=L("./src/utils/logger.ts"),k=function(){function P(M){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=M,this.bytesAvailable=M.byteLength,this.word=0,this.bitsAvailable=0}var F=P.prototype;return F.loadWord=function(){var D=this.data,R=this.bytesAvailable,E=D.byteLength-R,w=new Uint8Array(4),T=Math.min(4,R);if(T===0)throw new Error("no bytes available");w.set(D.subarray(E,E+T)),this.word=new DataView(w.buffer).getUint32(0),this.bitsAvailable=T*8,this.bytesAvailable-=T},F.skipBits=function(D){var R;this.bitsAvailable>D?(this.word<<=D,this.bitsAvailable-=D):(D-=this.bitsAvailable,R=D>>3,D-=R>>3,this.bytesAvailable-=R,this.loadWord(),this.word<<=D,this.bitsAvailable-=D)},F.readBits=function(D){var R=Math.min(this.bitsAvailable,D),E=this.word>>>32-R;return D>32&&H.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=R,this.bitsAvailable>0?this.word<<=R:this.bytesAvailable>0&&this.loadWord(),R=D-R,R>0&&this.bitsAvailable?E<<R|this.readBits(R):E},F.skipLZ=function(){var D;for(D=0;D<this.bitsAvailable;++D)if((this.word&2147483648>>>D)!==0)return this.word<<=D,this.bitsAvailable-=D,D;return this.loadWord(),D+this.skipLZ()},F.skipUEG=function(){this.skipBits(1+this.skipLZ())},F.skipEG=function(){this.skipBits(1+this.skipLZ())},F.readUEG=function(){var D=this.skipLZ();return this.readBits(D+1)-1},F.readEG=function(){var D=this.readUEG();return 1&D?1+D>>>1:-1*(D>>>1)},F.readBoolean=function(){return this.readBits(1)===1},F.readUByte=function(){return this.readBits(8)},F.readUShort=function(){return this.readBits(16)},F.readUInt=function(){return this.readBits(32)},F.skipScalingList=function(D){for(var R=8,E=8,w,T=0;T<D;T++)E!==0&&(w=this.readEG(),E=(R+w+256)%256),R=E===0?R:E},F.readSPS=function(){var D=0,R=0,E=0,w=0,T,A,_,b=this.readUByte.bind(this),d=this.readBits.bind(this),s=this.readUEG.bind(this),u=this.readBoolean.bind(this),l=this.skipBits.bind(this),S=this.skipEG.bind(this),h=this.skipUEG.bind(this),g=this.skipScalingList.bind(this);b();var C=b();if(d(5),l(3),b(),h(),C===100||C===110||C===122||C===244||C===44||C===83||C===86||C===118||C===128){var y=s();if(y===3&&l(1),h(),h(),l(1),u())for(A=y!==3?8:12,_=0;_<A;_++)u()&&(_<6?g(16):g(64))}h();var f=s();if(f===0)s();else if(f===1)for(l(1),S(),S(),T=s(),_=0;_<T;_++)S();h(),l(1);var c=s(),o=s(),a=d(1);a===0&&l(1),l(1),u()&&(D=s(),R=s(),E=s(),w=s());var m=[1,1];if(u()&&u()){var p=b();switch(p){case 1:m=[1,1];break;case 2:m=[12,11];break;case 3:m=[10,11];break;case 4:m=[16,11];break;case 5:m=[40,33];break;case 6:m=[24,11];break;case 7:m=[20,11];break;case 8:m=[32,11];break;case 9:m=[80,33];break;case 10:m=[18,11];break;case 11:m=[15,11];break;case 12:m=[64,33];break;case 13:m=[160,99];break;case 14:m=[4,3];break;case 15:m=[3,2];break;case 16:m=[2,1];break;case 255:{m=[b()<<8|b(),b()<<8|b()];break}}}return{width:Math.ceil((c+1)*16-D*2-R*2),height:(2-a)*(o+1)*16-(a?2:4)*(E+w),pixelRatio:m}},F.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},P}();z.default=k},"./src/demux/id3.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"isHeader",function(){return H}),L.d(z,"isFooter",function(){return k}),L.d(z,"getID3Data",function(){return P}),L.d(z,"canParse",function(){return M}),L.d(z,"getTimeStamp",function(){return D}),L.d(z,"isTimeStampFrame",function(){return R}),L.d(z,"getID3Frames",function(){return w}),L.d(z,"decodeFrame",function(){return T}),L.d(z,"utf8ArrayToStr",function(){return s}),L.d(z,"testables",function(){return u});var H=function(g,C){return C+10<=g.length&&(g[C]===73&&g[C+1]===68&&g[C+2]===51&&(g[C+3]<255&&g[C+4]<255&&(g[C+6]<128&&g[C+7]<128&&g[C+8]<128&&g[C+9]<128)))},k=function(g,C){return C+10<=g.length&&(g[C]===51&&g[C+1]===68&&g[C+2]===73&&(g[C+3]<255&&g[C+4]<255&&(g[C+6]<128&&g[C+7]<128&&g[C+8]<128&&g[C+9]<128)))},P=function(g,C){for(var y=C,f=0;H(g,C);){f+=10;var c=F(g,C+6);f+=c,k(g,C+10)&&(f+=10),C+=f}return f>0?g.subarray(y,y+f):void 0},F=function(g,C){var y=0;return y=(g[C]&127)<<21,y|=(g[C+1]&127)<<14,y|=(g[C+2]&127)<<7,y|=g[C+3]&127,y},M=function(g,C){return H(g,C)&&F(g,C+6)+10<=g.length-C},D=function(g){for(var C=w(g),y=0;y<C.length;y++){var f=C[y];if(R(f))return d(f)}return},R=function(g){return g&&g.key==="PRIV"&&g.info==="com.apple.streaming.transportStreamTimestamp"},E=function(g){var C=String.fromCharCode(g[0],g[1],g[2],g[3]),y=F(g,4),f=10;return{type:C,size:y,data:g.subarray(f,f+y)}},w=function(g){for(var C=0,y=[];H(g,C);){var f=F(g,C+6);C+=10;for(var c=C+f;C+8<c;){var o=E(g.subarray(C)),a=T(o);a&&y.push(a),C+=o.size+10}k(g,C)&&(C+=10)}return y},T=function(g){return g.type==="PRIV"?A(g):g.type[0]==="W"?b(g):_(g)},A=function(g){if(g.size<2)return;var C=s(g.data,!0),y=new Uint8Array(g.data.subarray(C.length+1));return{key:g.type,info:C,data:y.buffer}},_=function(g){if(g.size<2)return;if(g.type==="TXXX"){var C=1,y=s(g.data.subarray(C),!0);C+=y.length+1;var f=s(g.data.subarray(C));return{key:g.type,info:y,data:f}}var c=s(g.data.subarray(1));return{key:g.type,data:c}},b=function(g){if(g.type==="WXXX"){if(g.size<2)return;var C=1,y=s(g.data.subarray(C),!0);C+=y.length+1;var f=s(g.data.subarray(C));return{key:g.type,info:y,data:f}}var c=s(g.data);return{key:g.type,data:c}},d=function(g){if(g.data.byteLength===8){var C=new Uint8Array(g.data),y=C[3]&1,f=(C[4]<<23)+(C[5]<<15)+(C[6]<<7)+C[7];return f/=45,y&&(f+=4772185884e-2),Math.round(f)}return},s=function(g,C){C===void 0&&(C=!1);var y=S();if(y){var f=y.decode(g);if(C){var c=f.indexOf("\0");return c!==-1?f.substring(0,c):f}return f.replace(/\0/g,"")}for(var o=g.length,a,m,p,v="",O=0;O<o;){if(a=g[O++],a===0&&C)return v;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:v+=String.fromCharCode(a);break;case 12:case 13:m=g[O++],v+=String.fromCharCode((a&31)<<6|m&63);break;case 14:m=g[O++],p=g[O++],v+=String.fromCharCode((a&15)<<12|(m&63)<<6|(p&63)<<0);break;default:}}return v},u={decodeTextFrame:_},l;function S(){return!l&&typeof self.TextDecoder!="undefined"&&(l=new self.TextDecoder("utf-8")),l}},"./src/demux/mp3demuxer.ts":function(re,z,L){"use strict";L.r(z);var H=L("./src/demux/base-audio-demuxer.ts"),k=L("./src/demux/id3.ts"),P=L("./src/utils/logger.ts"),F=L("./src/demux/mpegaudio.ts");function M(E,w){E.prototype=Object.create(w.prototype),E.prototype.constructor=E,D(E,w)}function D(E,w){return D=Object.setPrototypeOf||function(A,_){return A.__proto__=_,A},D(E,w)}var R=function(E){M(w,E);function w(){return E.apply(this,arguments)||this}var T=w.prototype;return T.resetInitSegment=function(_,b,d){E.prototype.resetInitSegment.call(this,_,b,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:_,duration:d,inputTimeScale:9e4,dropped:0}},w.probe=function(_){if(!_)return!1;for(var b=k.getID3Data(_,0)||[],d=b.length,s=_.length;d<s;d++)if(F.probe(_,d))return P.logger.log("MPEG Audio sync word found !"),!0;return!1},T.canParse=function(_,b){return F.canParse(_,b)},T.appendFrame=function(_,b,d){return this.initPTS===null?void 0:F.appendFrame(_,b,d,this.initPTS,this.frameIndex)},w}(H.default);R.minProbeByteLength=4,z.default=R},"./src/demux/mp4demuxer.ts":function(re,z,L){"use strict";L.r(z);var H=L("./src/utils/mp4-tools.ts"),k=L("./src/demux/dummy-demuxed-track.ts"),P=function(){function F(D,R){this.remainderData=null,this.config=void 0,this.config=R}var M=F.prototype;return M.resetTimeStamp=function(){},M.resetInitSegment=function(){},M.resetContiguity=function(){},F.probe=function(R){return Object(H.findBox)({data:R,start:0,end:Math.min(R.length,16384)},["moof"]).length>0},M.demux=function(R){var E=R,w=Object(k.dummyTrack)();if(this.config.progressive){this.remainderData&&(E=Object(H.appendUint8Array)(this.remainderData,R));var T=Object(H.segmentValidRange)(E);this.remainderData=T.remainder,w.samples=T.valid||new Uint8Array}else w.samples=E;return{audioTrack:Object(k.dummyTrack)(),avcTrack:w,id3Track:Object(k.dummyTrack)(),textTrack:Object(k.dummyTrack)()}},M.flush=function(){var R=Object(k.dummyTrack)();return R.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(k.dummyTrack)(),avcTrack:R,id3Track:Object(k.dummyTrack)(),textTrack:Object(k.dummyTrack)()}},M.demuxSampleAes=function(R,E,w){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},M.destroy=function(){},F}();P.minProbeByteLength=1024,z.default=P},"./src/demux/mpegaudio.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"appendFrame",function(){return D}),L.d(z,"parseHeader",function(){return R}),L.d(z,"isHeaderPattern",function(){return E}),L.d(z,"isHeader",function(){return w}),L.d(z,"canParse",function(){return T}),L.d(z,"probe",function(){return A});var H=null,k=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],P=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],F=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],M=[0,1,1,4];function D(_,b,d,s,u){if(d+24>b.length)return;var l=R(b,d);if(l&&d+l.frameLength<=b.length){var S=l.samplesPerFrame*9e4/l.sampleRate,h=s+u*S,g={unit:b.subarray(d,d+l.frameLength),pts:h,dts:h};return _.config=[],_.channelCount=l.channelCount,_.samplerate=l.sampleRate,_.samples.push(g),{sample:g,length:l.frameLength,missing:0}}}function R(_,b){var d=_[b+1]>>3&3,s=_[b+1]>>1&3,u=_[b+2]>>4&15,l=_[b+2]>>2&3;if(d!==1&&u!==0&&u!==15&&l!==3){var S=_[b+2]>>1&1,h=_[b+3]>>6,g=d===3?3-s:s===3?3:4,C=k[g*14+u-1]*1e3,y=d===3?0:d===2?1:2,f=P[y*3+l],c=h===3?1:2,o=F[d][s],a=M[s],m=o*8*a,p=Math.floor(o*C/f+S)*a;if(H===null){var v=navigator.userAgent||"",O=v.match(/Chrome\/(\d+)/i);H=O?parseInt(O[1]):0}var U=!!H&&H<=87;return U&&s===2&&C>=224e3&&h===0&&(_[b+3]=_[b+3]|128),{sampleRate:f,channelCount:c,frameLength:p,samplesPerFrame:m}}}function E(_,b){return _[b]===255&&(_[b+1]&224)===224&&(_[b+1]&6)!==0}function w(_,b){return b+1<_.length&&E(_,b)}function T(_,b){var d=4;return E(_,b)&&d<=_.length-b}function A(_,b){if(b+1<_.length&&E(_,b)){var d=4,s=R(_,b),u=d;s!=null&&s.frameLength&&(u=s.frameLength);var l=b+u;return l===_.length||w(_,l)}return!1}},"./src/demux/sample-aes.ts":function(re,z,L){"use strict";L.r(z);var H=L("./src/crypt/decrypter.ts"),k=L("./src/demux/tsdemuxer.ts"),P=function(){function F(D,R,E){this.keyData=void 0,this.decrypter=void 0,this.keyData=E,this.decrypter=new H.default(D,R,{removePKCS7Padding:!1})}var M=F.prototype;return M.decryptBuffer=function(R,E){this.decrypter.decrypt(R,this.keyData.key.buffer,this.keyData.iv.buffer,E)},M.decryptAacSample=function(R,E,w,T){var A=R[E].unit,_=A.subarray(16,A.length-A.length%16),b=_.buffer.slice(_.byteOffset,_.byteOffset+_.length),d=this;this.decryptBuffer(b,function(s){var u=new Uint8Array(s);A.set(u,16),T||d.decryptAacSamples(R,E+1,w)})},M.decryptAacSamples=function(R,E,w){for(;;E++){if(E>=R.length){w();return}if(R[E].unit.length<32)continue;var T=this.decrypter.isSync();if(this.decryptAacSample(R,E,w,T),!T)return}},M.getAvcEncryptedData=function(R){for(var E=Math.floor((R.length-48)/160)*16+16,w=new Int8Array(E),T=0,A=32;A<=R.length-16;A+=160,T+=16)w.set(R.subarray(A,A+16),T);return w},M.getAvcDecryptedUnit=function(R,E){for(var w=new Uint8Array(E),T=0,A=32;A<=R.length-16;A+=160,T+=16)R.set(w.subarray(T,T+16),A);return R},M.decryptAvcSample=function(R,E,w,T,A,_){var b=Object(k.discardEPB)(A.data),d=this.getAvcEncryptedData(b),s=this;this.decryptBuffer(d.buffer,function(u){A.data=s.getAvcDecryptedUnit(b,u),_||s.decryptAvcSamples(R,E,w+1,T)})},M.decryptAvcSamples=function(R,E,w,T){if(R instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;E++,w=0){if(E>=R.length){T();return}for(var A=R[E].units;!(w>=A.length);w++){var _=A[w];if(_.data.length<=48||_.type!==1&&_.type!==5)continue;var b=this.decrypter.isSync();if(this.decryptAvcSample(R,E,w,T,_,b),!b)return}}},F}();z.default=P},"./src/demux/transmuxer-interface.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return A});var H=L("./node_modules/webworkify-webpack/index.js"),k=L.n(H),P=L("./src/events.ts"),F=L("./src/demux/transmuxer.ts"),M=L("./src/utils/logger.ts"),D=L("./src/errors.ts"),R=L("./src/utils/mediasource-helper.ts"),E=L("./node_modules/eventemitter3/index.js"),w=L.n(E),T=Object(R.getMediaSource)()||{isTypeSupported:function(){return!1}},A=function(){function _(d,s,u,l){var S=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=s,this.onTransmuxComplete=u,this.onFlush=l;var h=d.config,g=function(o,a){a=a||{},a.frag=S.frag,a.id=S.id,d.trigger(o,a)};this.observer=new E.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,g),this.observer.on(P.Events.ERROR,g);var C={mp4:T.isTypeSupported("video/mp4"),mpeg:T.isTypeSupported("audio/mpeg"),mp3:T.isTypeSupported('audio/mp4; codecs="mp3"')},y=navigator.vendor;if(h.enableWorker&&typeof Worker!="undefined"){M.logger.log("demuxing in webworker");var f;try{f=this.worker=H("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),f.addEventListener("message",this.onwmsg),f.onerror=function(c){d.trigger(P.Events.ERROR,{type:D.ErrorTypes.OTHER_ERROR,details:D.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},f.postMessage({cmd:"init",typeSupported:C,vendor:y,id:s,config:JSON.stringify(h)})}catch(c){M.logger.warn("Error in worker:",c),M.logger.error("Error while initializing DemuxerWorker, fallback to inline"),f&&self.URL.revokeObjectURL(f.objectURL),this.transmuxer=new F.default(this.observer,C,h,y,s),this.worker=null}}else this.transmuxer=new F.default(this.observer,C,h,y,s)}var b=_.prototype;return b.destroy=function(){var s=this.worker;if(s)s.removeEventListener("message",this.onwmsg),s.terminate(),this.worker=null;else{var u=this.transmuxer;u&&(u.destroy(),this.transmuxer=null)}var l=this.observer;l&&l.removeAllListeners(),this.observer=null},b.push=function(s,u,l,S,h,g,C,y,f,c){var o=this;f.transmuxing.start=self.performance.now();var a=this.transmuxer,m=this.worker,p=g?g.start:h.start,v=h.decryptdata,O=this.frag,U=!(O&&h.cc===O.cc),j=!(O&&f.level===O.level),G=O?f.sn-O.sn:-1,B=this.part?f.part-this.part.index:1,N=!j&&(G===1||G===0&&B===1),V=self.performance.now();(j||G||h.stats.parsing.start===0)&&(h.stats.parsing.start=V),g&&(B||!N)&&(g.stats.parsing.start=V);var $=new F.TransmuxState(U,N,y,j,p);if(!N||U){M.logger.log("[transmuxer-interface, "+h.type+"]: Starting new transmux session for sn: "+f.sn+" p: "+f.part+" level: "+f.level+" id: "+f.id+`
discontinuity: `+U+`
trackSwitch: `+j+`
contiguous: `+N+`
accurateTimeOffset: `+y+`
timeOffset: `+p);var ie=new F.TransmuxConfig(l,S,u,C,c);this.configureTransmuxer(ie)}if(this.frag=h,this.part=g,m)m.postMessage({cmd:"demux",data:s,decryptdata:v,chunkMeta:f,state:$},s instanceof ArrayBuffer?[s]:[]);else if(a){var oe=a.push(s,v,f,$);Object(F.isPromise)(oe)?oe.then(function(_e){o.handleTransmuxComplete(_e)}):this.handleTransmuxComplete(oe)}},b.flush=function(s){var u=this;s.transmuxing.start=self.performance.now();var l=this.transmuxer,S=this.worker;if(S)S.postMessage({cmd:"flush",chunkMeta:s});else if(l){var h=l.flush(s);Object(F.isPromise)(h)?h.then(function(g){u.handleFlushResult(g,s)}):this.handleFlushResult(h,s)}},b.handleFlushResult=function(s,u){var l=this;s.forEach(function(S){l.handleTransmuxComplete(S)}),this.onFlush(u)},b.onWorkerMessage=function(s){var u=s.data,l=this.hls;switch(u.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.id=this.id,l.trigger(u.event,u.data);break}}},b.configureTransmuxer=function(s){var u=this.worker,l=this.transmuxer;u?u.postMessage({cmd:"configure",config:s}):l&&l.configure(s)},b.handleTransmuxComplete=function(s){s.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(s)},_}()},"./src/demux/transmuxer-worker.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return D});var H=L("./src/demux/transmuxer.ts"),k=L("./src/events.ts"),P=L("./src/utils/logger.ts"),F=L("./node_modules/eventemitter3/index.js"),M=L.n(F);function D(A){var _=new F.EventEmitter,b=function(s,u){A.postMessage({event:s,data:u})};_.on(k.Events.FRAG_DECRYPTED,b),_.on(k.Events.ERROR,b),A.addEventListener("message",function(d){var s=d.data;switch(s.cmd){case"init":{var u=JSON.parse(s.config);A.transmuxer=new H.default(_,s.typeSupported,u,s.vendor,s.id),Object(P.enableLogs)(u.debug),b("init",null);break}case"configure":{A.transmuxer.configure(s.config);break}case"demux":{var l=A.transmuxer.push(s.data,s.decryptdata,s.chunkMeta,s.state);Object(H.isPromise)(l)?l.then(function(g){R(A,g)}):R(A,l);break}case"flush":{var S=s.chunkMeta,h=A.transmuxer.flush(S);Object(H.isPromise)(h)?h.then(function(g){w(A,g,S)}):w(A,h,S);break}default:break}})}function R(A,_){if(T(_.remuxResult))return;var b=[],d=_.remuxResult,s=d.audio,u=d.video;s&&E(b,s),u&&E(b,u),A.postMessage({event:"transmuxComplete",data:_},b)}function E(A,_){_.data1&&A.push(_.data1.buffer),_.data2&&A.push(_.data2.buffer)}function w(A,_,b){_.forEach(function(d){R(A,d)}),A.postMessage({event:"flush",data:b})}function T(A){return!A.audio&&!A.video&&!A.text&&!A.id3&&!A.initSegment}},"./src/demux/transmuxer.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return u}),L.d(z,"isPromise",function(){return h}),L.d(z,"TransmuxConfig",function(){return g}),L.d(z,"TransmuxState",function(){return C});var H=L("./src/events.ts"),k=L("./src/errors.ts"),P=L("./src/crypt/decrypter.ts"),F=L("./src/demux/aacdemuxer.ts"),M=L("./src/demux/mp4demuxer.ts"),D=L("./src/demux/tsdemuxer.ts"),R=L("./src/demux/mp3demuxer.ts"),E=L("./src/remux/mp4-remuxer.ts"),w=L("./src/remux/passthrough-remuxer.ts"),T=L("./src/demux/chunk-cache.ts"),A=L("./src/utils/mp4-tools.ts"),_=L("./src/utils/logger.ts"),b;try{b=self.performance.now.bind(self.performance)}catch(y){_.logger.debug("Unable to use Performance API on this environment"),b=self.Date.now}var d=[{demux:D.default,remux:E.default},{demux:M.default,remux:w.default},{demux:F.default,remux:E.default},{demux:R.default,remux:E.default}],s=1024;d.forEach(function(y){var f=y.demux;s=Math.max(s,f.minProbeByteLength)});var u=function(){function y(c,o,a,m,p){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new T.default,this.observer=c,this.typeSupported=o,this.config=a,this.vendor=m,this.id=p}var f=y.prototype;return f.configure=function(o){this.transmuxConfig=o,this.decrypter&&this.decrypter.reset()},f.push=function(o,a,m,p){var v=this,O=m.transmuxing;O.executeStart=b();var U=new Uint8Array(o),j=this.cache,G=this.config,B=this.currentTransmuxState,N=this.transmuxConfig;p&&(this.currentTransmuxState=p);var V=l(U,a);if(V&&V.method==="AES-128"){var $=this.getDecrypter();if(G.enableSoftwareAES){var ie=$.softwareDecrypt(U,V.key.buffer,V.iv.buffer);if(!ie)return O.executeEnd=b(),S(m);U=new Uint8Array(ie)}else return this.decryptionPromise=$.webCryptoDecrypt(U,V.key.buffer,V.iv.buffer).then(function(we){var Be=v.push(we,null,m);return v.decryptionPromise=null,Be}),this.decryptionPromise}var oe=p||B,_e=oe.contiguous,fe=oe.discontinuity,Se=oe.trackSwitch,be=oe.accurateTimeOffset,me=oe.timeOffset,le=N.audioCodec,ue=N.videoCodec,Ee=N.defaultInitPts,Ge=N.duration,Te=N.initSegmentData;if((fe||Se)&&this.resetInitSegment(Te,le,ue,Ge),fe&&this.resetInitialTimestamp(Ee),_e||this.resetContiguity(),this.needsProbing(U,fe,Se)){if(j.dataLength){var pe=j.flush();U=Object(A.appendUint8Array)(pe,U)}this.configureTransmuxer(U,N)}var Ae=this.transmux(U,V,me,be,m),Ce=this.currentTransmuxState;return Ce.contiguous=!0,Ce.discontinuity=!1,Ce.trackSwitch=!1,O.executeEnd=b(),Ae},f.flush=function(o){var a=this,m=o.transmuxing;m.executeStart=b();var p=this.decrypter,v=this.cache,O=this.currentTransmuxState,U=this.decryptionPromise;if(U)return U.then(function(){return a.flush(o)});var j=[],G=O.timeOffset;if(p){var B=p.flush();B&&j.push(this.push(B,null,o))}var N=v.dataLength;v.reset();var V=this.demuxer,$=this.remuxer;if(!V||!$)return N>=s&&this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),m.executeEnd=b(),[S(o)];var ie=V.flush(G);return h(ie)?ie.then(function(oe){return a.flushRemux(j,oe,o),j}):(this.flushRemux(j,ie,o),j)},f.flushRemux=function(o,a,m){var p=a.audioTrack,v=a.avcTrack,O=a.id3Track,U=a.textTrack,j=this.currentTransmuxState,G=j.accurateTimeOffset,B=j.timeOffset;_.logger.log("[transmuxer.ts]: Flushed fragment "+m.sn+(m.part>-1?" p: "+m.part:"")+" of level "+m.level);var N=this.remuxer.remux(p,v,O,U,B,G,!0,this.id);o.push({remuxResult:N,chunkMeta:m}),m.transmuxing.executeEnd=b()},f.resetInitialTimestamp=function(o){var a=this.demuxer,m=this.remuxer;if(!a||!m)return;a.resetTimeStamp(o),m.resetTimeStamp(o)},f.resetContiguity=function(){var o=this.demuxer,a=this.remuxer;if(!o||!a)return;o.resetContiguity(),a.resetNextTimestamp()},f.resetInitSegment=function(o,a,m,p){var v=this.demuxer,O=this.remuxer;if(!v||!O)return;v.resetInitSegment(a,m,p),O.resetInitSegment(o,a,m)},f.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},f.transmux=function(o,a,m,p,v){var O;return a&&a.method==="SAMPLE-AES"?O=this.transmuxSampleAes(o,a,m,p,v):O=this.transmuxUnencrypted(o,m,p,v),O},f.transmuxUnencrypted=function(o,a,m,p){var v=this.demuxer.demux(o,a,!1,!this.config.progressive),O=v.audioTrack,U=v.avcTrack,j=v.id3Track,G=v.textTrack,B=this.remuxer.remux(O,U,j,G,a,m,!1,this.id);return{remuxResult:B,chunkMeta:p}},f.transmuxSampleAes=function(o,a,m,p,v){var O=this;return this.demuxer.demuxSampleAes(o,a,m).then(function(U){var j=O.remuxer.remux(U.audioTrack,U.avcTrack,U.id3Track,U.textTrack,m,p,!1,O.id);return{remuxResult:j,chunkMeta:v}})},f.configureTransmuxer=function(o,a){for(var m=this.config,p=this.observer,v=this.typeSupported,O=this.vendor,U=a.audioCodec,j=a.defaultInitPts,G=a.duration,B=a.initSegmentData,N=a.videoCodec,V,$=0,ie=d.length;$<ie;$++)if(d[$].demux.probe(o)){V=d[$];break}V||(_.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),V={demux:M.default,remux:w.default});var oe=this.demuxer,_e=this.remuxer,fe=V.remux,Se=V.demux;(!_e||!(_e instanceof fe))&&(this.remuxer=new fe(p,m,v,O)),(!oe||!(oe instanceof Se))&&(this.demuxer=new Se(p,m,v),this.probe=Se.probe),this.resetInitSegment(B,U,N,G),this.resetInitialTimestamp(j)},f.needsProbing=function(o,a,m){return!this.demuxer||!this.remuxer||a||m},f.getDecrypter=function(){var o=this.decrypter;return o||(o=this.decrypter=new P.default(this.observer,this.config)),o},y}();function l(y,f){var c=null;return y.byteLength>0&&f!=null&&f.key!=null&&f.iv!==null&&f.method!=null&&(c=f),c}var S=function(f){return{remuxResult:{},chunkMeta:f}};function h(y){return"then"in y&&y.then instanceof Function}var g=function(f,c,o,a,m){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=f,this.videoCodec=c,this.initSegmentData=o,this.duration=a,this.defaultInitPts=m},C=function(f,c,o,a,m){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=f,this.contiguous=c,this.accurateTimeOffset=o,this.trackSwitch=a,this.timeOffset=m}},"./src/demux/tsdemuxer.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"discardEPB",function(){return S});var H=L("./src/demux/adts.ts"),k=L("./src/demux/mpegaudio.ts"),P=L("./src/demux/exp-golomb.ts"),F=L("./src/demux/id3.ts"),M=L("./src/demux/sample-aes.ts"),D=L("./src/events.ts"),R=L("./src/utils/mp4-tools.ts"),E=L("./src/utils/logger.ts"),w=L("./src/errors.ts"),T={video:1,audio:2,id3:3,text:4},A=function(){function h(C,y,f){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=C,this.config=y,this.typeSupported=f}h.probe=function(y){var f=h.syncOffset(y);return f<0?!1:(f&&E.logger.warn("MPEG2-TS detected but first sync word found @ offset "+f+", junk ahead ?"),!0)},h.syncOffset=function(y){for(var f=Math.min(1e3,y.length-3*188),c=0;c<f;){if(y[c]===71&&y[c+188]===71&&y[c+2*188]===71)return c;c++}return-1},h.createTrack=function(y,f){return{container:y==="video"||y==="audio"?"video/mp2t":void 0,type:y,id:T[y],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:y==="audio"?f:void 0}};var g=h.prototype;return g.resetInitSegment=function(y,f,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=h.createTrack("video",c),this._audioTrack=h.createTrack("audio",c),this._id3Track=h.createTrack("id3",c),this._txtTrack=h.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=y,this.videoCodec=f,this._duration=c},g.resetTimeStamp=function(){},g.resetContiguity=function(){var y=this._audioTrack,f=this._avcTrack,c=this._id3Track;y&&(y.pesData=null),f&&(f.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},g.demux=function(y,f,c,o){c===void 0&&(c=!1),o===void 0&&(o=!1),c||(this.sampleAes=null);var a,m=this._avcTrack,p=this._audioTrack,v=this._id3Track,O=m.pid,U=m.pesData,j=p.pid,G=v.pid,B=p.pesData,N=v.pesData,V=!1,$=this.pmtParsed,ie=this._pmtId,oe=y.length;if(this.remainderData&&(y=Object(R.appendUint8Array)(this.remainderData,y),oe=y.length,this.remainderData=null),oe<188&&!o)return this.remainderData=y,{audioTrack:p,avcTrack:m,id3Track:v,textTrack:this._txtTrack};var _e=Math.max(0,h.syncOffset(y));oe-=(oe+_e)%188,oe<y.byteLength&&!o&&(this.remainderData=new Uint8Array(y.buffer,oe,y.buffer.byteLength-oe));for(var fe=_e;fe<oe;fe+=188)if(y[fe]===71){var Se=!!(y[fe+1]&64),be=((y[fe+1]&31)<<8)+y[fe+2],me=(y[fe+3]&48)>>4,le=void 0;if(me>1){if(le=fe+5+y[fe+4],le===fe+188)continue}else le=fe+4;switch(be){case O:Se&&(U&&(a=s(U))&&this.parseAVCPES(a,!1),U={data:[],size:0}),U&&(U.data.push(y.subarray(le,fe+188)),U.size+=fe+188-le);break;case j:Se&&(B&&(a=s(B))&&(p.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),B={data:[],size:0}),B&&(B.data.push(y.subarray(le,fe+188)),B.size+=fe+188-le);break;case G:Se&&(N&&(a=s(N))&&this.parseID3PES(a),N={data:[],size:0}),N&&(N.data.push(y.subarray(le,fe+188)),N.size+=fe+188-le);break;case 0:Se&&(le+=y[le]+1),ie=this._pmtId=b(y,le);break;case ie:{Se&&(le+=y[le]+1);var ue=d(y,le,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);O=ue.avc,O>0&&(m.pid=O),j=ue.audio,j>0&&(p.pid=j,p.isAAC=ue.isAAC),G=ue.id3,G>0&&(v.pid=G),V&&!$&&(E.logger.log("reparse from beginning"),V=!1,fe=_e-188),$=this.pmtParsed=!0;break}case 17:case 8191:break;default:V=!0;break}}else this.observer.emit(D.Events.ERROR,D.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});m.pesData=U,p.pesData=B,v.pesData=N;var Ee={audioTrack:p,avcTrack:m,id3Track:v,textTrack:this._txtTrack};return o&&this.extractRemainingSamples(Ee),Ee},g.flush=function(){var y=this.remainderData;this.remainderData=null;var f;return y?f=this.demux(y,-1,!1,!0):f={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(f),this.sampleAes?this.decrypt(f,this.sampleAes):f},g.extractRemainingSamples=function(y){var f=y.audioTrack,c=y.avcTrack,o=y.id3Track,a=c.pesData,m=f.pesData,p=o.pesData,v;a&&(v=s(a))?(this.parseAVCPES(v,!0),c.pesData=null):c.pesData=a,m&&(v=s(m))?(f.isAAC?this.parseAACPES(v):this.parseMPEGPES(v),f.pesData=null):(m!=null&&m.size&&E.logger.log("last AAC PES packet truncated,might overlap between fragments"),f.pesData=m),p&&(v=s(p))?(this.parseID3PES(v),o.pesData=null):o.pesData=p},g.demuxSampleAes=function(y,f,c){var o=this.demux(y,c,!0,!this.config.progressive),a=this.sampleAes=new M.default(this.observer,this.config,f);return this.decrypt(o,a)},g.decrypt=function(y,f){return new Promise(function(c){var o=y.audioTrack,a=y.avcTrack;o.samples&&o.isAAC?f.decryptAacSamples(o.samples,0,function(){a.samples?f.decryptAvcSamples(a.samples,0,0,function(){c(y)}):c(y)}):a.samples&&f.decryptAvcSamples(a.samples,0,0,function(){c(y)})})},g.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},g.parseAVCPES=function(y,f){var c=this,o=this._avcTrack,a=this.parseAVCNALu(y.data),m=!1,p=this.avcSample,v,O=!1;y.data=null,p&&a.length&&!o.audFound&&(u(p,o),p=this.avcSample=_(!1,y.pts,y.dts,"")),a.forEach(function(U){switch(U.type){case 1:{v=!0,p||(p=c.avcSample=_(!0,y.pts,y.dts,"")),m&&(p.debug+="NDR "),p.frame=!0;var j=U.data;if(O&&j.length>4){var G=new P.default(j).readSliceType();(G===2||G===4||G===7||G===9)&&(p.key=!0)}break}case 5:v=!0,p||(p=c.avcSample=_(!0,y.pts,y.dts,"")),m&&(p.debug+="IDR "),p.key=!0,p.frame=!0;break;case 6:{v=!0,m&&p&&(p.debug+="SEI ");var B=new P.default(S(U.data));B.readUByte();for(var N=0,V=0,$=!1,ie=0;!$&&B.bytesAvailable>1;){N=0;do ie=B.readUByte(),N+=ie;while(ie===255);V=0;do ie=B.readUByte(),V+=ie;while(ie===255);if(N===4&&B.bytesAvailable!==0){$=!0;var oe=B.readUByte();if(oe===181){var _e=B.readUShort();if(_e===49){var fe=B.readUInt();if(fe===1195456820){var Se=B.readUByte();if(Se===3){for(var be=B.readUByte(),me=B.readUByte(),le=31&be,ue=[be,me],Ee=0;Ee<le;Ee++)ue.push(B.readUByte()),ue.push(B.readUByte()),ue.push(B.readUByte());l(c._txtTrack.samples,{type:3,pts:y.pts,bytes:ue})}}}}}else if(N===5&&B.bytesAvailable!==0){if($=!0,V>16){for(var Ge=[],Te=0;Te<16;Te++)Ge.push(B.readUByte().toString(16)),(Te===3||Te===5||Te===7||Te===9)&&Ge.push("-");for(var pe=V-16,Ae=new Uint8Array(pe),Ce=0;Ce<pe;Ce++)Ae[Ce]=B.readUByte();l(c._txtTrack.samples,{pts:y.pts,payloadType:N,uuid:Ge.join(""),userData:Object(F.utf8ArrayToStr)(Ae),userDataBytes:Ae})}}else if(V<B.bytesAvailable)for(var we=0;we<V;we++)B.readUByte()}break}case 7:if(v=!0,O=!0,m&&p&&(p.debug+="SPS "),!o.sps){var Be=new P.default(U.data),Qe=Be.readSPS();o.width=Qe.width,o.height=Qe.height,o.pixelRatio=Qe.pixelRatio,o.sps=[U.data],o.duration=c._duration;for(var je=U.data.subarray(1,4),De="avc1.",Pe=0;Pe<3;Pe++){var Le=je[Pe].toString(16);Le.length<2&&(Le="0"+Le),De+=Le}o.codec=De}break;case 8:v=!0,m&&p&&(p.debug+="PPS "),o.pps||(o.pps=[U.data]);break;case 9:v=!1,o.audFound=!0,p&&u(p,o),p=c.avcSample=_(!1,y.pts,y.dts,m?"AUD ":"");break;case 12:v=!1;break;default:v=!1,p&&(p.debug+="unknown NAL "+U.type+" ");break}if(p&&v){var Re=p.units;Re.push(U)}}),f&&p&&(u(p,o),this.avcSample=null)},g.getLastNalUnit=function(){var y,f=this.avcSample,c;if(!f||f.units.length===0){var o=this._avcTrack.samples;f=o[o.length-1]}if((y=f)!==null&&y!==void 0&&y.units){var a=f.units;c=a[a.length-1]}return c},g.parseAVCNALu=function(y){var f=y.byteLength,c=this._avcTrack,o=c.naluState||0,a=o,m=[],p=0,v,O,U,j=-1,G=0;for(o===-1&&(j=0,G=y[0]&31,o=0,p=1);p<f;){if(v=y[p++],!o){o=v?0:1;continue}if(o===1){o=v?0:2;continue}if(!v)o=3;else if(v===1){if(j>=0){var B={data:y.subarray(j,p-o-1),type:G};m.push(B)}else{var N=this.getLastNalUnit();if(N&&(a&&p<=4-a&&(N.state&&(N.data=N.data.subarray(0,N.data.byteLength-a))),O=p-o-1,O>0)){var V=new Uint8Array(N.data.byteLength+O);V.set(N.data,0),V.set(y.subarray(0,O),N.data.byteLength),N.data=V,N.state=0}}p<f?(U=y[p]&31,j=p,G=U,o=0):o=-1}else o=0}if(j>=0&&o>=0){var $={data:y.subarray(j,f),type:G,state:o};m.push($)}if(m.length===0){var ie=this.getLastNalUnit();if(ie){var oe=new Uint8Array(ie.data.byteLength+y.byteLength);oe.set(ie.data,0),oe.set(y,ie.data.byteLength),ie.data=oe}}return c.naluState=o,m},g.parseAACPES=function(y){var f=0,c=this._audioTrack,o=this.aacOverFlow,a=y.data;if(o){this.aacOverFlow=null;var m=o.sample.unit.byteLength,p=Math.min(o.missing,m),v=m-p;o.sample.unit.set(a.subarray(0,p),v),c.samples.push(o.sample),f=o.missing}var O,U;for(O=f,U=a.length;O<U-1&&!H.isHeader(a,O);O++);if(O!==f){var j,G;if(O<U-1?(j="AAC PES did not start with ADTS header,offset:"+O,G=!1):(j="no ADTS header found in AAC PES",G=!0),E.logger.warn("parsing error:"+j),this.observer.emit(D.Events.ERROR,D.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_PARSING_ERROR,fatal:G,reason:j}),G)return}H.initTrackConfig(c,this.observer,a,O,this.audioCodec);var B;if(y.pts!==void 0)B=y.pts;else if(o){var N=H.getFrameDuration(c.samplerate);B=o.sample.pts+N}else{E.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var V=0;O<U;)if(H.isHeader(a,O)){if(O+5<U){var $=H.appendFrame(c,a,O,B,V);if($)if($.missing)this.aacOverFlow=$;else{O+=$.length,V++;continue}}break}else O++},g.parseMPEGPES=function(y){var f=y.data,c=f.length,o=0,a=0,m=y.pts;if(m===void 0){E.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(k.isHeader(f,a)){var p=k.appendFrame(this._audioTrack,f,a,m,o);if(p)a+=p.length,o++;else break}else a++},g.parseID3PES=function(y){if(y.pts===void 0){E.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(y)},h}();A.minProbeByteLength=188;function _(h,g,C,y){return{key:h,frame:!1,pts:g,dts:C,units:[],debug:y,length:0}}function b(h,g){return(h[g+10]&31)<<8|h[g+11]}function d(h,g,C,y){var f={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(h[g+1]&15)<<8|h[g+2],o=g+3+c-4,a=(h[g+10]&15)<<8|h[g+11];for(g+=12+a;g<o;){var m=(h[g+1]&31)<<8|h[g+2];switch(h[g]){case 207:if(!y){E.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:f.audio===-1&&(f.audio=m);break;case 21:f.id3===-1&&(f.id3=m);break;case 219:if(!y){E.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:f.avc===-1&&(f.avc=m);break;case 3:case 4:C?f.audio===-1&&(f.audio=m,f.isAAC=!1):E.logger.log("MPEG audio found, not supported in this browser");break;case 36:E.logger.warn("Unsupported HEVC stream type found");break;default:break}g+=((h[g+3]&15)<<8|h[g+4])+5}return f}function s(h){var g=0,C,y,f,c,o,a=h.data;if(!h||h.size===0)return null;for(;a[0].length<19&&a.length>1;){var m=new Uint8Array(a[0].length+a[1].length);m.set(a[0]),m.set(a[1],a[0].length),a[0]=m,a.splice(1,1)}C=a[0];var p=(C[0]<<16)+(C[1]<<8)+C[2];if(p===1){if(y=(C[4]<<8)+C[5],y&&y>h.size-6)return null;var v=C[7];v&192&&(c=(C[9]&14)*536870912+(C[10]&255)*4194304+(C[11]&254)*16384+(C[12]&255)*128+(C[13]&254)/2,v&64?(o=(C[14]&14)*536870912+(C[15]&255)*4194304+(C[16]&254)*16384+(C[17]&255)*128+(C[18]&254)/2,c-o>60*9e4&&(E.logger.warn(Math.round((c-o)/9e4)+"s delta between PTS and DTS, align them"),c=o)):o=c),f=C[8];var O=f+9;if(h.size<=O)return null;h.size-=O;for(var U=new Uint8Array(h.size),j=0,G=a.length;j<G;j++){C=a[j];var B=C.byteLength;if(O)if(O>B){O-=B;continue}else C=C.subarray(O),B-=O,O=0;U.set(C,g),g+=B}return y&&(y-=f+3),{data:U,pts:c,dts:o,len:y}}return null}function u(h,g){if(h.units.length&&h.frame){if(h.pts===void 0){var C=g.samples,y=C.length;if(y){var f=C[y-1];h.pts=f.pts,h.dts=f.dts}else{g.dropped++;return}}g.samples.push(h)}h.debug.length&&E.logger.log(h.pts+"/"+h.dts+":"+h.debug)}function l(h,g){var C=h.length;if(C>0){if(g.pts>=h[C-1].pts)h.push(g);else for(var y=C-1;y>=0;y--)if(g.pts<h[y].pts){h.splice(y,0,g);break}}else h.push(g)}function S(h){for(var g=h.byteLength,C=[],y=1;y<g-2;)h[y]===0&&h[y+1]===0&&h[y+2]===3?(C.push(y+2),y+=2):y++;if(C.length===0)return h;var f=g-C.length,c=new Uint8Array(f),o=0;for(y=0;y<f;o++,y++)o===C[0]&&(o++,C.shift()),c[y]=h[o];return c}z.default=A},"./src/errors.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"ErrorTypes",function(){return H}),L.d(z,"ErrorDetails",function(){return k});var H;(function(P){P.NETWORK_ERROR="networkError",P.MEDIA_ERROR="mediaError",P.KEY_SYSTEM_ERROR="keySystemError",P.MUX_ERROR="muxError",P.OTHER_ERROR="otherError"})(H||(H={}));var k;(function(P){P.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",P.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",P.KEY_SYSTEM_NO_SESSION="keySystemNoSession",P.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",P.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",P.MANIFEST_LOAD_ERROR="manifestLoadError",P.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",P.MANIFEST_PARSING_ERROR="manifestParsingError",P.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",P.LEVEL_EMPTY_ERROR="levelEmptyError",P.LEVEL_LOAD_ERROR="levelLoadError",P.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",P.LEVEL_SWITCH_ERROR="levelSwitchError",P.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",P.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",P.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",P.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",P.FRAG_LOAD_ERROR="fragLoadError",P.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",P.FRAG_DECRYPT_ERROR="fragDecryptError",P.FRAG_PARSING_ERROR="fragParsingError",P.REMUX_ALLOC_ERROR="remuxAllocError",P.KEY_LOAD_ERROR="keyLoadError",P.KEY_LOAD_TIMEOUT="keyLoadTimeOut",P.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",P.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",P.BUFFER_APPEND_ERROR="bufferAppendError",P.BUFFER_APPENDING_ERROR="bufferAppendingError",P.BUFFER_STALLED_ERROR="bufferStalledError",P.BUFFER_FULL_ERROR="bufferFullError",P.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",P.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",P.INTERNAL_EXCEPTION="internalException",P.INTERNAL_ABORTED="aborted",P.UNKNOWN="unknown"})(k||(k={}))},"./src/events.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"Events",function(){return H});var H;(function(k){k.MEDIA_ATTACHING="hlsMediaAttaching",k.MEDIA_ATTACHED="hlsMediaAttached",k.MEDIA_DETACHING="hlsMediaDetaching",k.MEDIA_DETACHED="hlsMediaDetached",k.BUFFER_RESET="hlsBufferReset",k.BUFFER_CODECS="hlsBufferCodecs",k.BUFFER_CREATED="hlsBufferCreated",k.BUFFER_APPENDING="hlsBufferAppending",k.BUFFER_APPENDED="hlsBufferAppended",k.BUFFER_EOS="hlsBufferEos",k.BUFFER_FLUSHING="hlsBufferFlushing",k.BUFFER_FLUSHED="hlsBufferFlushed",k.MANIFEST_LOADING="hlsManifestLoading",k.MANIFEST_LOADED="hlsManifestLoaded",k.MANIFEST_PARSED="hlsManifestParsed",k.LEVEL_SWITCHING="hlsLevelSwitching",k.LEVEL_SWITCHED="hlsLevelSwitched",k.LEVEL_LOADING="hlsLevelLoading",k.LEVEL_LOADED="hlsLevelLoaded",k.LEVEL_UPDATED="hlsLevelUpdated",k.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",k.LEVELS_UPDATED="hlsLevelsUpdated",k.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",k.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",k.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",k.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",k.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",k.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",k.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",k.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",k.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",k.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",k.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",k.CUES_PARSED="hlsCuesParsed",k.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",k.INIT_PTS_FOUND="hlsInitPtsFound",k.FRAG_LOADING="hlsFragLoading",k.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",k.FRAG_LOADED="hlsFragLoaded",k.FRAG_DECRYPTED="hlsFragDecrypted",k.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",k.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",k.FRAG_PARSING_METADATA="hlsFragParsingMetadata",k.FRAG_PARSED="hlsFragParsed",k.FRAG_BUFFERED="hlsFragBuffered",k.FRAG_CHANGED="hlsFragChanged",k.FPS_DROP="hlsFpsDrop",k.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",k.ERROR="hlsError",k.DESTROYING="hlsDestroying",k.KEY_LOADING="hlsKeyLoading",k.KEY_LOADED="hlsKeyLoaded",k.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",k.BACK_BUFFER_REACHED="hlsBackBufferReached"})(H||(H={}))},"./src/hls.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return h});var H=L("./node_modules/url-toolkit/src/url-toolkit.js"),k=L.n(H),P=L("./src/loader/playlist-loader.ts"),F=L("./src/loader/key-loader.ts"),M=L("./src/controller/id3-track-controller.ts"),D=L("./src/controller/latency-controller.ts"),R=L("./src/controller/level-controller.ts"),E=L("./src/controller/fragment-tracker.ts"),w=L("./src/controller/stream-controller.ts"),T=L("./src/is-supported.ts"),A=L("./src/utils/logger.ts"),_=L("./src/config.ts"),b=L("./node_modules/eventemitter3/index.js"),d=L.n(b),s=L("./src/events.ts"),u=L("./src/errors.ts");function l(g,C){for(var y=0;y<C.length;y++){var f=C[y];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(g,f.key,f)}}function S(g,C,y){return C&&l(g.prototype,C),y&&l(g,y),g}var h=function(){g.isSupported=function(){return Object(T.isSupported)()};function g(y){y===void 0&&(y={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new b.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 f=this.config=Object(_.mergeConfig)(g.DefaultConfig,y);this.userConfig=y,Object(A.enableLogs)(f.debug),this._autoLevelCapping=-1,f.progressive&&Object(_.enableStreamingMode)(f);var c=f.abrController,o=f.bufferController,a=f.capLevelController,m=f.fpsController,p=this.abrController=new c(this),v=this.bufferController=new o(this),O=this.capLevelController=new a(this),U=new m(this),j=new P.default(this),G=new F.default(this),B=new M.default(this),N=this.levelController=new R.default(this),V=new E.FragmentTracker(this),$=this.streamController=new w.default(this,V);O.setStreamController($),U.setStreamController($);var ie=[N,$];this.networkControllers=ie;var oe=[j,G,p,v,O,U,B,V];this.audioTrackController=this.createController(f.audioTrackController,null,ie),this.createController(f.audioStreamController,V,ie),this.subtitleTrackController=this.createController(f.subtitleTrackController,null,ie),this.createController(f.subtitleStreamController,V,ie),this.createController(f.timelineController,null,oe),this.emeController=this.createController(f.emeController,null,oe),this.cmcdController=this.createController(f.cmcdController,null,oe),this.latencyController=this.createController(D.default,null,oe),this.coreComponents=oe}var C=g.prototype;return C.createController=function(f,c,o){if(f){var a=c?new f(this,c):new f(this);return o&&o.push(a),a}return null},C.on=function(f,c,o){o===void 0&&(o=this),this._emitter.on(f,c,o)},C.once=function(f,c,o){o===void 0&&(o=this),this._emitter.once(f,c,o)},C.removeAllListeners=function(f){this._emitter.removeAllListeners(f)},C.off=function(f,c,o,a){o===void 0&&(o=this),this._emitter.off(f,c,o,a)},C.listeners=function(f){return this._emitter.listeners(f)},C.emit=function(f,c,o){return this._emitter.emit(f,c,o)},C.trigger=function(f,c){if(this.config.debug)return this.emit(f,f,c);try{return this.emit(f,f,c)}catch(o){A.logger.error("An internal error happened while handling event "+f+'. Error message: "'+o.message+'". Here is a stacktrace:',o),this.trigger(s.Events.ERROR,{type:u.ErrorTypes.OTHER_ERROR,details:u.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:f,error:o})}return!1},C.listenerCount=function(f){return this._emitter.listenerCount(f)},C.destroy=function(){A.logger.log("destroy"),this.trigger(s.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(f){return f.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(f){return f.destroy()}),this.coreComponents.length=0},C.attachMedia=function(f){A.logger.log("attachMedia"),this._media=f,this.trigger(s.Events.MEDIA_ATTACHING,{media:f})},C.detachMedia=function(){A.logger.log("detachMedia"),this.trigger(s.Events.MEDIA_DETACHING,void 0),this._media=null},C.loadSource=function(f){this.stopLoad();var c=this.media,o=this.url,a=this.url=H.buildAbsoluteURL(self.location.href,f,{alwaysNormalize:!0});A.logger.log("loadSource:"+a),c&&o&&o!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(s.Events.MANIFEST_LOADING,{url:f})},C.startLoad=function(f){f===void 0&&(f=-1),A.logger.log("startLoad("+f+")"),this.networkControllers.forEach(function(c){c.startLoad(f)})},C.stopLoad=function(){A.logger.log("stopLoad"),this.networkControllers.forEach(function(f){f.stopLoad()})},C.swapAudioCodec=function(){A.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},C.recoverMediaError=function(){A.logger.log("recoverMediaError");var f=this._media;this.detachMedia(),f&&this.attachMedia(f)},C.removeLevel=function(f,c){c===void 0&&(c=0),this.levelController.removeLevel(f,c)},S(g,[{key:"levels",get:function(){var f=this.levelController.levels;return f||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(f){A.logger.log("set currentLevel:"+f),this.loadLevel=f,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(f){A.logger.log("set nextLevel:"+f),this.levelController.manualLevel=f,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(f){A.logger.log("set loadLevel:"+f),this.levelController.manualLevel=f}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(f){this.levelController.nextLoadLevel=f}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(f){A.logger.log("set firstLevel:"+f),this.levelController.firstLevel=f}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(f){A.logger.log("set startLevel:"+f),f!==-1&&(f=Math.max(f,this.minAutoLevel)),this.levelController.startLevel=f}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(f){var c=!!f;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(f){this._autoLevelCapping!==f&&(A.logger.log("set autoLevelCapping:"+f),this._autoLevelCapping=f)}},{key:"bandwidthEstimate",get:function(){var f=this.abrController.bwEstimator;return f?f.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var f=this.levels,c=this.config.minAutoBitrate;if(!f)return 0;for(var o=f.length,a=0;a<o;a++)if(f[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var f=this.levels,c=this.autoLevelCapping,o;return c===-1&&f&&f.length?o=f.length-1:o=c,o}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(f){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,f)}},{key:"audioTracks",get:function(){var f=this.audioTrackController;return f?f.audioTracks:[]}},{key:"audioTrack",get:function(){var f=this.audioTrackController;return f?f.audioTrack:-1},set:function(f){var c=this.audioTrackController;c&&(c.audioTrack=f)}},{key:"subtitleTracks",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTrack:-1},set:function(f){var c=this.subtitleTrackController;c&&(c.subtitleTrack=f)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var f=this.subtitleTrackController;return f?f.subtitleDisplay:!1},set:function(f){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=f)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(f){this.config.lowLatencyMode=f}},{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 s.Events}},{key:"ErrorTypes",get:function(){return u.ErrorTypes}},{key:"ErrorDetails",get:function(){return u.ErrorDetails}},{key:"DefaultConfig",get:function(){return g.defaultConfig?g.defaultConfig:_.hlsDefaultConfig},set:function(f){g.defaultConfig=f}}]),g}();h.defaultConfig=void 0},"./src/is-supported.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"isSupported",function(){return P}),L.d(z,"changeTypeSupported",function(){return F});var H=L("./src/utils/mediasource-helper.ts");function k(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var M=Object(H.getMediaSource)();if(!M)return!1;var D=k(),R=M&&typeof M.isTypeSupported=="function"&&M.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),E=!D||D.prototype&&typeof D.prototype.appendBuffer=="function"&&typeof D.prototype.remove=="function";return!!R&&!!E}function F(){var M,D=k();return typeof(D==null||((M=D.prototype)===null||M===void 0)?void 0:M.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return A}),L.d(z,"LoadError",function(){return b});var H=L("./src/polyfills/number.ts"),k=L("./src/errors.ts");function P(d,s){d.prototype=Object.create(s.prototype),d.prototype.constructor=d,E(d,s)}function F(d){var s=typeof Map=="function"?new Map:void 0;return F=function(l){if(l===null||!R(l))return l;if(typeof l!="function")throw new TypeError("Super expression must either be null or a function");if(typeof s!="undefined"){if(s.has(l))return s.get(l);s.set(l,S)}function S(){return M(l,arguments,w(this).constructor)}return S.prototype=Object.create(l.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),E(S,l)},F(d)}function M(d,s,u){return D()?M=Reflect.construct:M=function(S,h,g){var C=[null];C.push.apply(C,h);var y=Function.bind.apply(S,C),f=new y;return g&&E(f,g.prototype),f},M.apply(null,arguments)}function D(){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 R(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function E(d,s){return E=Object.setPrototypeOf||function(l,S){return l.__proto__=S,l},E(d,s)}function w(d){return w=Object.setPrototypeOf?Object.getPrototypeOf:function(u){return u.__proto__||Object.getPrototypeOf(u)},w(d)}var T=Math.pow(2,17),A=function(){function d(u){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=u}var s=d.prototype;return s.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},s.abort=function(){this.loader&&this.loader.abort()},s.load=function(l,S){var h=this,g=l.url;if(!g)return Promise.reject(new b({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,networkDetails:null},"Fragment does not have a "+(g?"part list":"url")));this.abort();var C=this.config,y=C.fLoader,f=C.loader;return new Promise(function(c,o){h.loader&&h.loader.destroy();var a=h.loader=l.loader=y?new y(C):new f(C),m=_(l),p={timeout:C.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:C.fragLoadingMaxRetryTimeout,highWaterMark:T};l.stats=a.stats,a.load(m,p,{onSuccess:function(O,U,j,G){h.resetLoader(l,a),c({frag:l,part:null,payload:O.data,networkDetails:G})},onError:function(O,U,j){h.resetLoader(l,a),o(new b({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,response:O,networkDetails:j}))},onAbort:function(O,U,j){h.resetLoader(l,a),o(new b({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,networkDetails:j}))},onTimeout:function(O,U,j){h.resetLoader(l,a),o(new b({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,networkDetails:j}))},onProgress:function(O,U,j,G){S&&S({frag:l,part:null,payload:j,networkDetails:G})}})})},s.loadPart=function(l,S,h){var g=this;this.abort();var C=this.config,y=C.fLoader,f=C.loader;return new Promise(function(c,o){g.loader&&g.loader.destroy();var a=g.loader=l.loader=y?new y(C):new f(C),m=_(l,S),p={timeout:C.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:C.fragLoadingMaxRetryTimeout,highWaterMark:T};S.stats=a.stats,a.load(m,p,{onSuccess:function(O,U,j,G){g.resetLoader(l,a),g.updateStatsFromPart(l,S);var B={frag:l,part:S,payload:O.data,networkDetails:G};h(B),c(B)},onError:function(O,U,j){g.resetLoader(l,a),o(new b({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,part:S,response:O,networkDetails:j}))},onAbort:function(O,U,j){l.stats.aborted=S.stats.aborted,g.resetLoader(l,a),o(new b({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,part:S,networkDetails:j}))},onTimeout:function(O,U,j){g.resetLoader(l,a),o(new b({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,part:S,networkDetails:j}))}})})},s.updateStatsFromPart=function(l,S){var h=l.stats,g=S.stats,C=g.total;if(h.loaded+=g.loaded,C){var y=Math.round(l.duration/S.duration),f=Math.min(Math.round(h.loaded/C),y),c=y-f,o=c*Math.round(h.loaded/f);h.total=h.loaded+o}else h.total=Math.max(h.loaded,h.total);var a=h.loading,m=g.loading;a.start?a.first+=m.first-m.start:(a.start=m.start,a.first=m.first),a.end=m.end},s.resetLoader=function(l,S){l.loader=null,this.loader===S&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),S.destroy()},d}();function _(d,s){s===void 0&&(s=null);var u=s||d,l={frag:d,part:s,responseType:"arraybuffer",url:u.url,headers:{},rangeStart:0,rangeEnd:0},S=u.byteRangeStartOffset,h=u.byteRangeEndOffset;return Object(H.isFiniteNumber)(S)&&Object(H.isFiniteNumber)(h)&&(l.rangeStart=S,l.rangeEnd=h),l}var b=function(d){P(s,d);function s(u){for(var l,S=arguments.length,h=new Array(S>1?S-1:0),g=1;g<S;g++)h[g-1]=arguments[g];return l=d.call.apply(d,[this].concat(h))||this,l.data=void 0,l.data=u,l}return s}(F(Error))},"./src/loader/fragment.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"ElementaryStreamTypes",function(){return A}),L.d(z,"BaseSegment",function(){return _}),L.d(z,"Fragment",function(){return b}),L.d(z,"Part",function(){return d});var H=L("./src/polyfills/number.ts"),k=L("./node_modules/url-toolkit/src/url-toolkit.js"),P=L.n(k),F=L("./src/utils/logger.ts"),M=L("./src/loader/level-key.ts"),D=L("./src/loader/load-stats.ts");function R(s,u){s.prototype=Object.create(u.prototype),s.prototype.constructor=s,E(s,u)}function E(s,u){return E=Object.setPrototypeOf||function(S,h){return S.__proto__=h,S},E(s,u)}function w(s,u){for(var l=0;l<u.length;l++){var S=u[l];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(s,S.key,S)}}function T(s,u,l){return u&&w(s.prototype,u),l&&w(s,l),s}var A;(function(s){s.AUDIO="audio",s.VIDEO="video",s.AUDIOVIDEO="audiovideo"})(A||(A={}));var _=function(){function s(l){var S;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(S={},S[A.AUDIO]=null,S[A.VIDEO]=null,S[A.AUDIOVIDEO]=null,S),this.baseurl=l}var u=s.prototype;return u.setByteRange=function(S,h){var g=S.split("@",2),C=[];g.length===1?C[0]=h?h.byteRangeEndOffset:0:C[0]=parseInt(g[1]),C[1]=parseInt(g[0])+C[0],this._byteRange=C},T(s,[{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(k.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(S){this._url=S}}]),s}(),b=function(s){R(u,s);function u(S,h){var g;return g=s.call(this,h)||this,g._decryptdata=null,g.rawProgramDateTime=null,g.programDateTime=null,g.tagList=[],g.duration=0,g.sn=0,g.levelkey=void 0,g.type=void 0,g.loader=null,g.level=-1,g.cc=0,g.startPTS=void 0,g.endPTS=void 0,g.appendedPTS=void 0,g.startDTS=void 0,g.endDTS=void 0,g.start=0,g.deltaPTS=void 0,g.maxStartPTS=void 0,g.minEndPTS=void 0,g.stats=new D.LoadStats,g.urlId=0,g.data=void 0,g.bitrateTest=!1,g.title=null,g.initSegment=null,g.type=S,g}var l=u.prototype;return l.createInitializationVector=function(h){for(var g=new Uint8Array(16),C=12;C<16;C++)g[C]=h>>8*(15-C)&255;return g},l.setDecryptDataFromLevelKey=function(h,g){var C=h;return(h==null?void 0:h.method)==="AES-128"&&h.uri&&!h.iv&&(C=M.LevelKey.fromURI(h.uri),C.method=h.method,C.iv=this.createInitializationVector(g),C.keyFormat="identity"),C},l.setElementaryStreamInfo=function(h,g,C,y,f,c){c===void 0&&(c=!1);var o=this.elementaryStreams,a=o[h];if(!a){o[h]={startPTS:g,endPTS:C,startDTS:y,endDTS:f,partial:c};return}a.startPTS=Math.min(a.startPTS,g),a.endPTS=Math.max(a.endPTS,C),a.startDTS=Math.min(a.startDTS,y),a.endDTS=Math.max(a.endDTS,f)},l.clearElementaryStreamInfo=function(){var h=this.elementaryStreams;h[A.AUDIO]=null,h[A.VIDEO]=null,h[A.AUDIOVIDEO]=null},T(u,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var h=this.sn;typeof h!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&F.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),h=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,h)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(H.isFiniteNumber)(this.programDateTime))return null;var h=Object(H.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+h*1e3}},{key:"encrypted",get:function(){var h;return!!((h=this.decryptdata)!==null&&h!==void 0&&h.keyFormat&&this.decryptdata.uri)}}]),u}(_),d=function(s){R(u,s);function u(l,S,h,g,C){var y;y=s.call(this,h)||this,y.fragOffset=0,y.duration=0,y.gap=!1,y.independent=!1,y.relurl=void 0,y.fragment=void 0,y.index=void 0,y.stats=new D.LoadStats,y.duration=l.decimalFloatingPoint("DURATION"),y.gap=l.bool("GAP"),y.independent=l.bool("INDEPENDENT"),y.relurl=l.enumeratedString("URI"),y.fragment=S,y.index=g;var f=l.enumeratedString("BYTERANGE");return f&&y.setByteRange(f,C),C&&(y.fragOffset=C.fragOffset+C.duration),y}return T(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 S=this.elementaryStreams;return!!(S.audio||S.video||S.audiovideo)}}]),u}(_)},"./src/loader/key-loader.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return F});var H=L("./src/events.ts"),k=L("./src/errors.ts"),P=L("./src/utils/logger.ts"),F=function(){function M(R){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=R,this._registerListeners()}var D=M.prototype;return D._registerListeners=function(){this.hls.on(H.Events.KEY_LOADING,this.onKeyLoading,this)},D._unregisterListeners=function(){this.hls.off(H.Events.KEY_LOADING,this.onKeyLoading)},D.destroy=function(){this._unregisterListeners();for(var E in this.loaders){var w=this.loaders[E];w&&w.destroy()}this.loaders={}},D.onKeyLoading=function(E,w){var T=w.frag,A=T.type,_=this.loaders[A];if(!T.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var b=T.decryptdata.uri;if(b!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(_&&(P.logger.warn("abort previous key loader for type:"+A),_.abort()),!b){P.logger.warn("key uri is falsy");return}var s=d.loader,u=T.loader=this.loaders[A]=new s(d);this.decrypturl=b,this.decryptkey=null;var l={url:b,frag:T,responseType:"arraybuffer"},S={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},h={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(l,S,h)}else this.decryptkey&&(T.decryptdata.key=this.decryptkey,this.hls.trigger(H.Events.KEY_LOADED,{frag:T}))},D.loadsuccess=function(E,w,T){var A=T.frag;if(!A.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=A.decryptdata.key=new Uint8Array(E.data),A.loader=null,delete this.loaders[A.type],this.hls.trigger(H.Events.KEY_LOADED,{frag:A})},D.loaderror=function(E,w){var T=w.frag,A=T.loader;A&&A.abort(),delete this.loaders[T.type],this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:T,response:E})},D.loadtimeout=function(E,w){var T=w.frag,A=T.loader;A&&A.abort(),delete this.loaders[T.type],this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:T})},M}()},"./src/loader/level-details.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"LevelDetails",function(){return M});var H=L("./src/polyfills/number.ts");function k(D,R){for(var E=0;E<R.length;E++){var w=R[E];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(D,w.key,w)}}function P(D,R,E){return R&&k(D.prototype,R),E&&k(D,E),D}var F=10,M=function(){function D(E){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=E}var R=D.prototype;return R.reloaded=function(w){if(!w){this.advanced=!0,this.updated=!0;return}var T=this.lastPartSn-w.lastPartSn,A=this.lastPartIndex-w.lastPartIndex;this.updated=this.endSN!==w.endSN||!!A||!!T,this.advanced=this.endSN>w.endSN||T>0||T===0&&A>0,this.updated||this.advanced?this.misses=Math.floor(w.misses*.6):this.misses=w.misses+1,this.availabilityDelay=w.availabilityDelay},P(D,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(H.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||F}},{key:"drift",get:function(){var w=this.driftEndTime-this.driftStartTime;if(w>0){var T=this.driftEnd-this.driftStart;return T*1e3/w}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var w;return(w=this.fragments)!==null&&w!==void 0&&w.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 w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),D}()},"./src/loader/level-key.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"LevelKey",function(){return M});var H=L("./node_modules/url-toolkit/src/url-toolkit.js"),k=L.n(H);function P(D,R){for(var E=0;E<R.length;E++){var w=R[E];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(D,w.key,w)}}function F(D,R,E){return R&&P(D.prototype,R),E&&P(D,E),D}var M=function(){D.fromURL=function(E,w){return new D(E,w)},D.fromURI=function(E){return new D(E)};function D(R,E){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,E?this._uri=Object(H.buildAbsoluteURL)(R,E,{alwaysNormalize:!0}):this._uri=R}return F(D,[{key:"uri",get:function(){return this._uri}}]),D}()},"./src/loader/load-stats.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"LoadStats",function(){return H});var H=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return u});var H=L("./src/polyfills/number.ts"),k=L("./node_modules/url-toolkit/src/url-toolkit.js"),P=L.n(k),F=L("./src/loader/fragment.ts"),M=L("./src/loader/level-details.ts"),D=L("./src/loader/level-key.ts"),R=L("./src/utils/attr-list.ts"),E=L("./src/utils/logger.ts"),w=L("./src/utils/codecs.ts"),T=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,A=/#EXT-X-MEDIA:(.*)/g,_=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),b=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 s(C){var y,f;return d.test((y=(f=k.parseURL(C))===null||f===void 0?void 0:f.path)!=null?y:"")}var u=function(){function C(){}return C.findGroup=function(f,c){for(var o=0;o<f.length;o++){var a=f[o];if(a.id===c)return a}},C.convertAVC1ToAVCOTI=function(f){var c=f.split(".");if(c.length>2){var o=c.shift()+".";return o+=parseInt(c.shift()).toString(16),o+=("000"+parseInt(c.shift()).toString(16)).substr(-4),o}return f},C.resolve=function(f,c){return k.buildAbsoluteURL(c,f,{alwaysNormalize:!0})},C.parseMasterPlaylist=function(f,c){var o=[],a={},m=!1;T.lastIndex=0;for(var p;(p=T.exec(f))!=null;)if(p[1]){var v=new R.AttrList(p[1]),O={attrs:v,bitrate:v.decimalInteger("AVERAGE-BANDWIDTH")||v.decimalInteger("BANDWIDTH"),name:v.NAME,url:C.resolve(p[2],c)},U=v.decimalResolution("RESOLUTION");U&&(O.width=U.width,O.height=U.height),l((v.CODECS||"").split(/[ ,]+/).filter(function(G){return G}),O),O.videoCodec&&O.videoCodec.indexOf("avc1")!==-1&&(O.videoCodec=C.convertAVC1ToAVCOTI(O.videoCodec)),o.push(O)}else if(p[3]){var j=new R.AttrList(p[3]);j["DATA-ID"]&&(m=!0,a[j["DATA-ID"]]=j)}return{levels:o,sessionData:m?a:null}},C.parseMasterPlaylistMedia=function(f,c,o,a){a===void 0&&(a=[]);var m,p=[],v=0;for(A.lastIndex=0;(m=A.exec(f))!==null;){var O=new R.AttrList(m[1]);if(O.TYPE===o){var U={attrs:O,bitrate:0,id:v++,groupId:O["GROUP-ID"],instreamId:O["INSTREAM-ID"],name:O.NAME||O.LANGUAGE||"",type:o,default:O.bool("DEFAULT"),autoselect:O.bool("AUTOSELECT"),forced:O.bool("FORCED"),lang:O.LANGUAGE,url:O.URI?C.resolve(O.URI,c):""};if(a.length){var j=C.findGroup(a,U.groupId)||a[0];S(U,j,"audioCodec"),S(U,j,"textCodec")}p.push(U)}}return p},C.parseLevelPlaylist=function(f,c,o,a,m){var p=new M.LevelDetails(c),v=p.fragments,O=null,U=0,j=0,G=0,B=0,N=null,V=new F.Fragment(a,c),$,ie,oe,_e=-1,fe=!1;for(_.lastIndex=0,p.m3u8=f;($=_.exec(f))!==null;){fe&&(fe=!1,V=new F.Fragment(a,c),V.start=G,V.sn=U,V.cc=B,V.level=o,O&&(V.initSegment=O,V.rawProgramDateTime=O.rawProgramDateTime));var Se=$[1];if(Se){V.duration=parseFloat(Se);var be=(" "+$[2]).slice(1);V.title=be||null,V.tagList.push(be?["INF",Se,be]:["INF",Se])}else if($[3])Object(H.isFiniteNumber)(V.duration)&&(V.start=G,oe&&(V.levelkey=oe),V.sn=U,V.level=o,V.cc=B,V.urlId=m,v.push(V),V.relurl=(" "+$[3]).slice(1),g(V,N),N=V,G+=V.duration,U++,j=0,fe=!0);else if($[4]){var me=(" "+$[4]).slice(1);N?V.setByteRange(me,N):V.setByteRange(me)}else if($[5])V.rawProgramDateTime=(" "+$[5]).slice(1),V.tagList.push(["PROGRAM-DATE-TIME",V.rawProgramDateTime]),_e===-1&&(_e=v.length);else{if($=$[0].match(b),!$){E.logger.warn("No matches on slow regex match for level playlist!");continue}for(ie=1;ie<$.length&&!(typeof $[ie]!="undefined");ie++);var le=(" "+$[ie]).slice(1),ue=(" "+$[ie+1]).slice(1),Ee=$[ie+2]?(" "+$[ie+2]).slice(1):"";switch(le){case"PLAYLIST-TYPE":p.type=ue.toUpperCase();break;case"MEDIA-SEQUENCE":U=p.startSN=parseInt(ue);break;case"SKIP":{var Ge=new R.AttrList(ue),Te=Ge.decimalInteger("SKIPPED-SEGMENTS");if(Object(H.isFiniteNumber)(Te)){p.skippedSegments=Te;for(var pe=Te;pe--;)v.unshift(null);U+=Te}var Ae=Ge.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ae&&(p.recentlyRemovedDateranges=Ae.split(" "));break}case"TARGETDURATION":p.targetduration=parseFloat(ue);break;case"VERSION":p.version=parseInt(ue);break;case"EXTM3U":break;case"ENDLIST":p.live=!1;break;case"#":(ue||Ee)&&V.tagList.push(Ee?[ue,Ee]:[ue]);break;case"DIS":B++;case"GAP":V.tagList.push([le]);break;case"BITRATE":V.tagList.push([le,ue]);break;case"DISCONTINUITY-SEQ":B=parseInt(ue);break;case"KEY":{var Ce,we=new R.AttrList(ue),Be=we.enumeratedString("METHOD"),Qe=we.URI,je=we.hexadecimalInteger("IV"),De=we.enumeratedString("KEYFORMATVERSIONS"),Pe=we.enumeratedString("KEYID"),Le=(Ce=we.enumeratedString("KEYFORMAT"))!=null?Ce:"identity",Re=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Re.indexOf(Le)>-1){E.logger.warn("Keyformat "+Le+" is not supported from the manifest");continue}else if(Le!=="identity")continue;Be&&(oe=D.LevelKey.fromURL(c,Qe),Qe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Be)>=0&&(oe.method=Be,oe.keyFormat=Le,Pe&&(oe.keyID=Pe),De&&(oe.keyFormatVersions=De),oe.iv=je));break}case"START":{var Ue=new R.AttrList(ue),We=Ue.decimalFloatingPoint("TIME-OFFSET");Object(H.isFiniteNumber)(We)&&(p.startTimeOffset=We);break}case"MAP":{var ke=new R.AttrList(ue);V.relurl=ke.URI,ke.BYTERANGE&&V.setByteRange(ke.BYTERANGE),V.level=o,V.sn="initSegment",oe&&(V.levelkey=oe),V.initSegment=null,O=V,fe=!0;break}case"SERVER-CONTROL":{var Ke=new R.AttrList(ue);p.canBlockReload=Ke.bool("CAN-BLOCK-RELOAD"),p.canSkipUntil=Ke.optionalFloat("CAN-SKIP-UNTIL",0),p.canSkipDateRanges=p.canSkipUntil>0&&Ke.bool("CAN-SKIP-DATERANGES"),p.partHoldBack=Ke.optionalFloat("PART-HOLD-BACK",0),p.holdBack=Ke.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var ze=new R.AttrList(ue);p.partTarget=ze.decimalFloatingPoint("PART-TARGET");break}case"PART":{var ge=p.partList;ge||(ge=p.partList=[]);var Ye=j>0?ge[ge.length-1]:void 0,He=j++,xe=new F.Part(new R.AttrList(ue),V,c,He,Ye);ge.push(xe),V.duration+=xe.duration;break}case"PRELOAD-HINT":{var Ie=new R.AttrList(ue);p.preloadHint=Ie;break}case"RENDITION-REPORT":{var se=new R.AttrList(ue);p.renditionReports=p.renditionReports||[],p.renditionReports.push(se);break}default:E.logger.warn("line parsed but not handled: "+$);break}}}N&&!N.relurl?(v.pop(),G-=N.duration,p.partList&&(p.fragmentHint=N)):p.partList&&(g(V,N),V.cc=B,p.fragmentHint=V);var te=v.length,ee=v[0],Y=v[te-1];if(G+=p.skippedSegments*p.targetduration,G>0&&te&&Y){p.averagetargetduration=G/te;var Q=Y.sn;p.endSN=Q!=="initSegment"?Q:0,ee&&(p.startCC=ee.cc,ee.initSegment||p.fragments.every(function(Z){return Z.relurl&&s(Z.relurl)})&&(E.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),V=new F.Fragment(a,c),V.relurl=Y.relurl,V.level=o,V.sn="initSegment",ee.initSegment=V,p.needSidxRanges=!0))}else p.endSN=0,p.startCC=0;return p.fragmentHint&&(G+=p.fragmentHint.duration),p.totalduration=G,p.endCC=B,_e>0&&h(v,_e),p},C}();function l(C,y){["video","audio","text"].forEach(function(f){var c=C.filter(function(a){return Object(w.isCodecType)(a,f)});if(c.length){var o=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});y[f+"Codec"]=o.length>0?o[0]:c[0],C=C.filter(function(a){return c.indexOf(a)===-1})}}),y.unknownCodecs=C}function S(C,y,f){var c=y[f];c&&(C[f]=c)}function h(C,y){for(var f=C[y],c=y;c--;){var o=C[c];if(!o)return;o.programDateTime=f.programDateTime-o.duration*1e3,f=o}}function g(C,y){C.rawProgramDateTime?C.programDateTime=Date.parse(C.rawProgramDateTime):y!=null&&y.programDateTime&&(C.programDateTime=y.endProgramDateTime),Object(H.isFiniteNumber)(C.programDateTime)||(C.programDateTime=null,C.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(re,z,L){"use strict";L.r(z);var H=L("./src/polyfills/number.ts"),k=L("./src/events.ts"),P=L("./src/errors.ts"),F=L("./src/utils/logger.ts"),M=L("./src/utils/mp4-tools.ts"),D=L("./src/loader/m3u8-parser.ts"),R=L("./src/types/loader.ts"),E=L("./src/utils/attr-list.ts");function w(_){var b=_.type;switch(b){case R.PlaylistContextType.AUDIO_TRACK:return R.PlaylistLevelType.AUDIO;case R.PlaylistContextType.SUBTITLE_TRACK:return R.PlaylistLevelType.SUBTITLE;default:return R.PlaylistLevelType.MAIN}}function T(_,b){var d=_.url;return(d===void 0||d.indexOf("data:")===0)&&(d=b.url),d}var A=function(){function _(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var b=_.prototype;return b.registerListeners=function(){var s=this.hls;s.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(k.Events.LEVEL_LOADING,this.onLevelLoading,this),s.on(k.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),s.on(k.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.unregisterListeners=function(){var s=this.hls;s.off(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(k.Events.LEVEL_LOADING,this.onLevelLoading,this),s.off(k.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),s.off(k.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.createInternalLoader=function(s){var u=this.hls.config,l=u.pLoader,S=u.loader,h=l||S,g=new h(u);return s.loader=g,this.loaders[s.type]=g,g},b.getInternalLoader=function(s){return this.loaders[s.type]},b.resetInternalLoader=function(s){this.loaders[s]&&delete this.loaders[s]},b.destroyInternalLoaders=function(){for(var s in this.loaders){var u=this.loaders[s];u&&u.destroy(),this.resetInternalLoader(s)}},b.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},b.onManifestLoading=function(s,u){var l=u.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:R.PlaylistContextType.MANIFEST,url:l,deliveryDirectives:null})},b.onLevelLoading=function(s,u){var l=u.id,S=u.level,h=u.url,g=u.deliveryDirectives;this.load({id:l,groupId:null,level:S,responseType:"text",type:R.PlaylistContextType.LEVEL,url:h,deliveryDirectives:g})},b.onAudioTrackLoading=function(s,u){var l=u.id,S=u.groupId,h=u.url,g=u.deliveryDirectives;this.load({id:l,groupId:S,level:null,responseType:"text",type:R.PlaylistContextType.AUDIO_TRACK,url:h,deliveryDirectives:g})},b.onSubtitleTrackLoading=function(s,u){var l=u.id,S=u.groupId,h=u.url,g=u.deliveryDirectives;this.load({id:l,groupId:S,level:null,responseType:"text",type:R.PlaylistContextType.SUBTITLE_TRACK,url:h,deliveryDirectives:g})},b.load=function(s){var u,l=this.hls.config,S=this.getInternalLoader(s);if(S){var h=S.context;if(h&&h.url===s.url){F.logger.trace("[playlist-loader]: playlist request ongoing");return}F.logger.log("[playlist-loader]: aborting previous loader for type: "+s.type),S.abort()}var g,C,y,f;switch(s.type){case R.PlaylistContextType.MANIFEST:g=l.manifestLoadingMaxRetry,C=l.manifestLoadingTimeOut,y=l.manifestLoadingRetryDelay,f=l.manifestLoadingMaxRetryTimeout;break;case R.PlaylistContextType.LEVEL:case R.PlaylistContextType.AUDIO_TRACK:case R.PlaylistContextType.SUBTITLE_TRACK:g=0,C=l.levelLoadingTimeOut;break;default:g=l.levelLoadingMaxRetry,C=l.levelLoadingTimeOut,y=l.levelLoadingRetryDelay,f=l.levelLoadingMaxRetryTimeout;break}if(S=this.createInternalLoader(s),(u=s.deliveryDirectives)!==null&&u!==void 0&&u.part){var c;if(s.type===R.PlaylistContextType.LEVEL&&s.level!==null?c=this.hls.levels[s.level].details:s.type===R.PlaylistContextType.AUDIO_TRACK&&s.id!==null?c=this.hls.audioTracks[s.id].details:s.type===R.PlaylistContextType.SUBTITLE_TRACK&&s.id!==null&&(c=this.hls.subtitleTracks[s.id].details),c){var o=c.partTarget,a=c.targetduration;o&&a&&(C=Math.min(Math.max(o*3,a*.8)*1e3,C))}}var m={timeout:C,maxRetry:g,retryDelay:y,maxRetryDelay:f,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};S.load(s,m,p)},b.loadsuccess=function(s,u,l,S){if(S===void 0&&(S=null),l.isSidxRequest){this.handleSidxRequest(s,l),this.handlePlaylistLoaded(s,u,l,S);return}this.resetInternalLoader(l.type);var h=s.data;if(h.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(s,l,"no EXTM3U delimiter",S);return}u.parsing.start=performance.now(),h.indexOf("#EXTINF:")>0||h.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(s,u,l,S):this.handleMasterPlaylist(s,u,l,S)},b.loaderror=function(s,u,l){l===void 0&&(l=null),this.handleNetworkError(u,l,!1,s)},b.loadtimeout=function(s,u,l){l===void 0&&(l=null),this.handleNetworkError(u,l,!0)},b.handleMasterPlaylist=function(s,u,l,S){var h=this.hls,g=s.data,C=T(s,l),y=D.default.parseMasterPlaylist(g,C),f=y.levels,c=y.sessionData;if(!f.length){this.handleManifestParsingError(s,l,"no level found in manifest",S);return}var o=f.map(function(U){return{id:U.attrs.AUDIO,audioCodec:U.audioCodec}}),a=f.map(function(U){return{id:U.attrs.SUBTITLES,textCodec:U.textCodec}}),m=D.default.parseMasterPlaylistMedia(g,C,"AUDIO",o),p=D.default.parseMasterPlaylistMedia(g,C,"SUBTITLES",a),v=D.default.parseMasterPlaylistMedia(g,C,"CLOSED-CAPTIONS");if(m.length){var O=m.some(function(U){return!U.url});!O&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(F.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),m.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new E.AttrList({}),bitrate:0,url:""}))}h.trigger(k.Events.MANIFEST_LOADED,{levels:f,audioTracks:m,subtitles:p,captions:v,url:C,stats:u,networkDetails:S,sessionData:c})},b.handleTrackOrLevelPlaylist=function(s,u,l,S){var h=this.hls,g=l.id,C=l.level,y=l.type,f=T(s,l),c=Object(H.isFiniteNumber)(g)?g:0,o=Object(H.isFiniteNumber)(C)?C:c,a=w(l),m=D.default.parseLevelPlaylist(s.data,f,o,a,c);if(!m.fragments.length){h.trigger(k.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:f,reason:"no fragments found in level",level:typeof l.level=="number"?l.level:void 0});return}if(y===R.PlaylistContextType.MANIFEST){var p={attrs:new E.AttrList({}),bitrate:0,details:m,name:"",url:f};h.trigger(k.Events.MANIFEST_LOADED,{levels:[p],audioTracks:[],url:f,stats:u,networkDetails:S,sessionData:null})}if(u.parsing.end=performance.now(),m.needSidxRanges){var v,O=(v=m.fragments[0].initSegment)===null||v===void 0?void 0:v.url;this.load({url:O,isSidxRequest:!0,type:y,level:C,levelDetails:m,id:g,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}l.levelDetails=m,this.handlePlaylistLoaded(s,u,l,S)},b.handleSidxRequest=function(s,u){var l=Object(M.parseSegmentIndex)(new Uint8Array(s.data));if(!l)return;var S=l.references,h=u.levelDetails;S.forEach(function(g,C){var y=g.info,f=h.fragments[C];f.byteRange.length===0&&f.setByteRange(String(1+y.end-y.start)+"@"+String(y.start)),f.initSegment&&f.initSegment.setByteRange(String(l.moovEndOffset)+"@0")})},b.handleManifestParsingError=function(s,u,l,S){this.hls.trigger(k.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:u.type===R.PlaylistContextType.MANIFEST,url:s.url,reason:l,response:s,context:u,networkDetails:S})},b.handleNetworkError=function(s,u,l,S){l===void 0&&(l=!1),F.logger.warn("[playlist-loader]: A network "+(l?"timeout":"error")+" occurred while loading "+s.type+" level: "+s.level+" id: "+s.id+' group-id: "'+s.groupId+'"');var h=P.ErrorDetails.UNKNOWN,g=!1,C=this.getInternalLoader(s);switch(s.type){case R.PlaylistContextType.MANIFEST:h=l?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,g=!0;break;case R.PlaylistContextType.LEVEL:h=l?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,g=!1;break;case R.PlaylistContextType.AUDIO_TRACK:h=l?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,g=!1;break;case R.PlaylistContextType.SUBTITLE_TRACK:h=l?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,g=!1;break}C&&this.resetInternalLoader(s.type);var y={type:P.ErrorTypes.NETWORK_ERROR,details:h,fatal:g,url:s.url,loader:C,context:s,networkDetails:u};S&&(y.response=S),this.hls.trigger(k.Events.ERROR,y)},b.handlePlaylistLoaded=function(s,u,l,S){var h=l.type,g=l.level,C=l.id,y=l.groupId,f=l.loader,c=l.levelDetails,o=l.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(s,l,"invalid target duration",S);return}if(!f)return;c.live&&(f.getCacheAge&&(c.ageHeader=f.getCacheAge()||0),(!f.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(h){case R.PlaylistContextType.MANIFEST:case R.PlaylistContextType.LEVEL:this.hls.trigger(k.Events.LEVEL_LOADED,{details:c,level:g||0,id:C||0,stats:u,networkDetails:S,deliveryDirectives:o});break;case R.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(k.Events.AUDIO_TRACK_LOADED,{details:c,id:C||0,groupId:y||"",stats:u,networkDetails:S,deliveryDirectives:o});break;case R.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(k.Events.SUBTITLE_TRACK_LOADED,{details:c,id:C||0,groupId:y||"",stats:u,networkDetails:S,deliveryDirectives:o});break}},_}();z.default=A},"./src/polyfills/number.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"isFiniteNumber",function(){return H}),L.d(z,"MAX_SAFE_INTEGER",function(){return k});var H=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},k=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(re,z,L){"use strict";L.r(z);var H=function(){function k(){}return k.getSilentFrame=function(F,M){switch(F){case"mp4a.40.2":if(M===1)return new Uint8Array([0,200,0,128,35,128]);if(M===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(M===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(M===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(M===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(M===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(M===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(M===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(M===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},k}();z.default=H},"./src/remux/mp4-generator.ts":function(re,z,L){"use strict";L.r(z);var H=Math.pow(2,32)-1,k=function(){function P(){}return P.init=function(){P.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var M;for(M in P.types)P.types.hasOwnProperty(M)&&(P.types[M]=[M.charCodeAt(0),M.charCodeAt(1),M.charCodeAt(2),M.charCodeAt(3)]);var D=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]),R=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);P.HDLR_TYPES={video:D,audio:R};var E=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),w=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=w,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var T=new Uint8Array([105,115,111,109]),A=new Uint8Array([97,118,99,49]),_=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,T,_,T,A),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,E))},P.box=function(M){for(var D=8,R=arguments.length,E=new Array(R>1?R-1:0),w=1;w<R;w++)E[w-1]=arguments[w];for(var T=E.length,A=T;T--;)D+=E[T].byteLength;var _=new Uint8Array(D);for(_[0]=D>>24&255,_[1]=D>>16&255,_[2]=D>>8&255,_[3]=D&255,_.set(M,4),T=0,D=8;T<A;T++)_.set(E[T],D),D+=E[T].byteLength;return _},P.hdlr=function(M){return P.box(P.types.hdlr,P.HDLR_TYPES[M])},P.mdat=function(M){return P.box(P.types.mdat,M)},P.mdhd=function(M,D){D*=M;var R=Math.floor(D/(H+1)),E=Math.floor(D%(H+1));return P.box(P.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,R>>24,R>>16&255,R>>8&255,R&255,E>>24,E>>16&255,E>>8&255,E&255,85,196,0,0]))},P.mdia=function(M){return P.box(P.types.mdia,P.mdhd(M.timescale,M.duration),P.hdlr(M.type),P.minf(M))},P.mfhd=function(M){return P.box(P.types.mfhd,new Uint8Array([0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255]))},P.minf=function(M){return M.type==="audio"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(M)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(M))},P.moof=function(M,D,R){return P.box(P.types.moof,P.mfhd(M),P.traf(R,D))},P.moov=function(M){for(var D=M.length,R=[];D--;)R[D]=P.trak(M[D]);return P.box.apply(null,[P.types.moov,P.mvhd(M[0].timescale,M[0].duration)].concat(R).concat(P.mvex(M)))},P.mvex=function(M){for(var D=M.length,R=[];D--;)R[D]=P.trex(M[D]);return P.box.apply(null,[P.types.mvex].concat(R))},P.mvhd=function(M,D){D*=M;var R=Math.floor(D/(H+1)),E=Math.floor(D%(H+1)),w=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,R>>24,R>>16&255,R>>8&255,R&255,E>>24,E>>16&255,E>>8&255,E&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return P.box(P.types.mvhd,w)},P.sdtp=function(M){var D=M.samples||[],R=new Uint8Array(4+D.length),E,w;for(E=0;E<D.length;E++)w=D[E].flags,R[E+4]=w.dependsOn<<4|w.isDependedOn<<2|w.hasRedundancy;return P.box(P.types.sdtp,R)},P.stbl=function(M){return P.box(P.types.stbl,P.stsd(M),P.box(P.types.stts,P.STTS),P.box(P.types.stsc,P.STSC),P.box(P.types.stsz,P.STSZ),P.box(P.types.stco,P.STCO))},P.avc1=function(M){var D=[],R=[],E,w,T;for(E=0;E<M.sps.length;E++)w=M.sps[E],T=w.byteLength,D.push(T>>>8&255),D.push(T&255),D=D.concat(Array.prototype.slice.call(w));for(E=0;E<M.pps.length;E++)w=M.pps[E],T=w.byteLength,R.push(T>>>8&255),R.push(T&255),R=R.concat(Array.prototype.slice.call(w));var A=P.box(P.types.avcC,new Uint8Array([1,D[3],D[4],D[5],252|3,224|M.sps.length].concat(D).concat([M.pps.length]).concat(R))),_=M.width,b=M.height,d=M.pixelRatio[0],s=M.pixelRatio[1];return P.box(P.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,_>>8&255,_&255,b>>8&255,b&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]),A,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,s>>24,s>>16&255,s>>8&255,s&255])))},P.esds=function(M){var D=M.config.length;return new Uint8Array([0,0,0,0,3,23+D,0,1,0,4,15+D,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([D]).concat(M.config).concat([6,1,2]))},P.mp4a=function(M){var D=M.samplerate;return P.box(P.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,M.channelCount,0,16,0,0,0,0,D>>8&255,D&255,0,0]),P.box(P.types.esds,P.esds(M)))},P.mp3=function(M){var D=M.samplerate;return P.box(P.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,M.channelCount,0,16,0,0,0,0,D>>8&255,D&255,0,0]))},P.stsd=function(M){return M.type==="audio"?!M.isAAC&&M.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(M)):P.box(P.types.stsd,P.STSD,P.mp4a(M)):P.box(P.types.stsd,P.STSD,P.avc1(M))},P.tkhd=function(M){var D=M.id,R=M.duration*M.timescale,E=M.width,w=M.height,T=Math.floor(R/(H+1)),A=Math.floor(R%(H+1));return P.box(P.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,D>>24&255,D>>16&255,D>>8&255,D&255,0,0,0,0,T>>24,T>>16&255,T>>8&255,T&255,A>>24,A>>16&255,A>>8&255,A&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,E>>8&255,E&255,0,0,w>>8&255,w&255,0,0]))},P.traf=function(M,D){var R=P.sdtp(M),E=M.id,w=Math.floor(D/(H+1)),T=Math.floor(D%(H+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,E>>24,E>>16&255,E>>8&255,E&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,w>>24,w>>16&255,w>>8&255,w&255,T>>24,T>>16&255,T>>8&255,T&255])),P.trun(M,R.length+16+20+8+16+8+8),R)},P.trak=function(M){return M.duration=M.duration||4294967295,P.box(P.types.trak,P.tkhd(M),P.mdia(M))},P.trex=function(M){var D=M.id;return P.box(P.types.trex,new Uint8Array([0,0,0,0,D>>24,D>>16&255,D>>8&255,D&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},P.trun=function(M,D){var R=M.samples||[],E=R.length,w=12+16*E,T=new Uint8Array(w),A,_,b,d,s,u;for(D+=8+w,T.set([0,0,15,1,E>>>24&255,E>>>16&255,E>>>8&255,E&255,D>>>24&255,D>>>16&255,D>>>8&255,D&255],0),A=0;A<E;A++)_=R[A],b=_.duration,d=_.size,s=_.flags,u=_.cts,T.set([b>>>24&255,b>>>16&255,b>>>8&255,b&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,s.degradPrio&240<<8,s.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*A);return P.box(P.types.trun,T)},P.initSegment=function(M){P.types||P.init();var D=P.moov(M),R=new Uint8Array(P.FTYP.byteLength+D.byteLength);return R.set(P.FTYP),R.set(D,P.FTYP.byteLength),R},P}();k.types=void 0,k.HDLR_TYPES=void 0,k.STTS=void 0,k.STSC=void 0,k.STCO=void 0,k.STSZ=void 0,k.VMHD=void 0,k.SMHD=void 0,k.STSD=void 0,k.FTYP=void 0,k.DINF=void 0,z.default=k},"./src/remux/mp4-remuxer.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return u}),L.d(z,"normalizePts",function(){return l});var H=L("./src/polyfills/number.ts"),k=L("./src/remux/aac-helper.ts"),P=L("./src/remux/mp4-generator.ts"),F=L("./src/events.ts"),M=L("./src/errors.ts"),D=L("./src/utils/logger.ts"),R=L("./src/types/loader.ts"),E=L("./src/utils/timescale-conversion.ts");function w(){return w=Object.assign||function(C){for(var y=1;y<arguments.length;y++){var f=arguments[y];for(var c in f)Object.prototype.hasOwnProperty.call(f,c)&&(C[c]=f[c])}return C},w.apply(this,arguments)}var T=10*1e3,A=1024,_=1152,b=null,d=null,s=!1,u=function(){function C(f,c,o,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=f,this.config=c,this.typeSupported=o,this.ISGenerated=!1,b===null){var m=navigator.userAgent||"",p=m.match(/Chrome\/(\d+)/i);b=p?parseInt(p[1]):0}if(d===null){var v=navigator.userAgent.match(/Safari\/(\d+)/i);d=v?parseInt(v[1]):0}s=!!b&&b<75||!!d&&d<600}var y=C.prototype;return y.destroy=function(){},y.resetTimeStamp=function(c){D.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},y.resetNextTimestamp=function(){D.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},y.resetInitSegment=function(){D.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},y.getVideoStartPts=function(c){var o=!1,a=c.reduce(function(m,p){var v=p.pts-m;return v<-4294967296?(o=!0,l(m,p.pts)):v>0?m:p.pts},c[0].pts);return o&&D.logger.debug("PTS rollover detected"),a},y.remux=function(c,o,a,m,p,v,O,U){var j,G,B,N,V,$,ie=p,oe=p,_e=c.pid>-1,fe=o.pid>-1,Se=o.samples.length,be=c.samples.length>0,me=Se>1,le=(!_e||be)&&(!fe||me)||this.ISGenerated||O;if(le){this.ISGenerated||(B=this.generateIS(c,o,p));var ue=this.isVideoContiguous,Ee=-1;if(me&&(Ee=S(o.samples),!ue&&this.config.forceKeyFrameOnDiscontinuity))if($=!0,Ee>0){D.logger.warn("[mp4-remuxer]: Dropped "+Ee+" out of "+Se+" video samples due to a missing keyframe");var Ge=this.getVideoStartPts(o.samples);o.samples=o.samples.slice(Ee),o.dropped+=Ee,oe+=(o.samples[0].pts-Ge)/(o.timescale||9e4)}else Ee===-1&&(D.logger.warn("[mp4-remuxer]: No keyframe found out of "+Se+" video samples"),$=!1);if(this.ISGenerated){if(be&&me){var Te=this.getVideoStartPts(o.samples),pe=l(c.samples[0].pts,Te)-Te,Ae=pe/o.inputTimeScale;ie+=Math.max(0,Ae),oe+=Math.max(0,-Ae)}if(be){if(c.samplerate||(D.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),B=this.generateIS(c,o,p)),G=this.remuxAudio(c,ie,this.isAudioContiguous,v,fe||me||U===R.PlaylistLevelType.AUDIO?oe:void 0),me){var Ce=G?G.endPTS-G.startPTS:0;o.inputTimeScale||(D.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),B=this.generateIS(c,o,p)),j=this.remuxVideo(o,oe,ue,Ce)}}else me&&(j=this.remuxVideo(o,oe,ue,0));j&&(j.firstKeyFrame=Ee,j.independent=Ee!==-1)}}return this.ISGenerated&&(a.samples.length&&(V=this.remuxID3(a,p)),m.samples.length&&(N=this.remuxText(m,p))),{audio:G,video:j,initSegment:B,independent:$,text:N,id3:V}},y.generateIS=function(c,o,a){var m=c.samples,p=o.samples,v=this.typeSupported,O={},U=!Object(H.isFiniteNumber)(this._initPTS),j="audio/mp4",G,B,N;if(U&&(G=B=Infinity),c.config&&m.length&&(c.timescale=c.samplerate,c.isAAC||(v.mpeg?(j="audio/mpeg",c.codec=""):v.mp3&&(c.codec="mp3")),O.audio={id:"audio",container:j,codec:c.codec,initSegment:!c.isAAC&&v.mpeg?new Uint8Array(0):P.default.initSegment([c]),metadata:{channelCount:c.channelCount}},U&&(N=c.inputTimeScale,G=B=m[0].pts-Math.round(N*a))),o.sps&&o.pps&&p.length&&(o.timescale=o.inputTimeScale,O.video={id:"main",container:"video/mp4",codec:o.codec,initSegment:P.default.initSegment([o]),metadata:{width:o.width,height:o.height}},U)){N=o.inputTimeScale;var V=this.getVideoStartPts(p),$=Math.round(N*a);B=Math.min(B,l(p[0].dts,V)-$),G=Math.min(G,V-$)}if(Object.keys(O).length)return this.ISGenerated=!0,U&&(this._initPTS=G,this._initDTS=B),{tracks:O,initPTS:G,timescale:N}},y.remuxVideo=function(c,o,a,m){var p=c.inputTimeScale,v=c.samples,O=[],U=v.length,j=this._initPTS,G=this.nextAvcDts,B=8,N,V,$,ie=Number.POSITIVE_INFINITY,oe=Number.NEGATIVE_INFINITY,_e=0,fe=!1;if(!a||G===null){var Se=o*p,be=v[0].pts-l(v[0].dts,v[0].pts);G=Se-be}for(var me=0;me<U;me++){var le=v[me];if(le.pts=l(le.pts-j,G),le.dts=l(le.dts-j,G),le.dts>le.pts){var ue=9e4*.2;_e=Math.max(Math.min(_e,le.pts-le.dts),-1*ue)}le.dts<v[me>0?me-1:me].dts&&(fe=!0)}fe&&v.sort(function(gt,yt){var st=gt.dts-yt.dts,_t=gt.pts-yt.pts;return st||_t}),V=v[0].dts,$=v[v.length-1].dts;var Ee=Math.round(($-V)/(U-1));if(_e<0){if(_e<Ee*-2){D.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(E.toMsFromMpegTsClock)(-Ee,!0)+" ms");for(var Ge=_e,Te=0;Te<U;Te++)v[Te].dts=Ge=Math.max(Ge,v[Te].pts-Ee),v[Te].pts=Math.max(Ge,v[Te].pts)}else{D.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(E.toMsFromMpegTsClock)(_e,!0)+" ms to overcome this issue");for(var pe=0;pe<U;pe++)v[pe].dts=v[pe].dts+_e}V=v[0].dts}if(a){var Ae=V-G,Ce=Ae>Ee,we=Ae<-1;if(Ce||we){Ce?D.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(Ae,!0)+" ms ("+Ae+"dts) hole between fragments detected, filling it"):D.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(-Ae,!0)+" ms ("+Ae+"dts) overlapping between fragments detected"),V=G;var Be=v[0].pts-Ae;v[0].dts=V,v[0].pts=Be,D.logger.log("Video: First PTS/DTS adjusted: "+Object(E.toMsFromMpegTsClock)(Be,!0)+"/"+Object(E.toMsFromMpegTsClock)(V,!0)+", delta: "+Object(E.toMsFromMpegTsClock)(Ae,!0)+" ms")}}s&&(V=Math.max(0,V));for(var Qe=0,je=0,De=0;De<U;De++){for(var Pe=v[De],Le=Pe.units,Re=Le.length,Ue=0,We=0;We<Re;We++)Ue+=Le[We].data.length;je+=Ue,Qe+=Re,Pe.length=Ue,Pe.dts=Math.max(Pe.dts,V),Pe.pts=Math.max(Pe.pts,Pe.dts,0),ie=Math.min(Pe.pts,ie),oe=Math.max(Pe.pts,oe)}$=v[U-1].dts;var ke=je+4*Qe+8,Ke;try{Ke=new Uint8Array(ke)}catch(gt){this.observer.emit(F.Events.ERROR,F.Events.ERROR,{type:M.ErrorTypes.MUX_ERROR,details:M.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ke,reason:"fail allocating video mdat "+ke});return}var ze=new DataView(Ke.buffer);ze.setUint32(0,ke),Ke.set(P.default.types.mdat,4);for(var ge=0;ge<U;ge++){for(var Ye=v[ge],He=Ye.units,xe=0,Ie=0,se=He.length;Ie<se;Ie++){var te=He[Ie],ee=te.data,Y=te.data.byteLength;ze.setUint32(B,Y),B+=4,Ke.set(ee,B),B+=Y,xe+=4+Y}if(ge<U-1)N=v[ge+1].dts-Ye.dts;else{var Q=this.config,Z=Ye.dts-v[ge>0?ge-1:ge].dts;if(Q.stretchShortVideoTrack&&this.nextAudioPts!==null){var q=Math.floor(Q.maxBufferHole*p),de=(m?ie+m*p:this.nextAudioPts)-Ye.pts;de>q?(N=de-Z,N<0&&(N=Z),D.logger.log("[mp4-remuxer]: It is approximately "+de/90+" ms to the next segment; using duration "+N/90+" ms for the last video frame.")):N=Z}else N=Z}var ye=Math.round(Ye.pts-Ye.dts);O.push(new h(Ye.key,N,xe,ye))}if(O.length&&b&&b<70){var Me=O[0].flags;Me.dependsOn=2,Me.isNonSync=0}console.assert(N!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=G=$+N,this.isVideoContiguous=!0;var et=P.default.moof(c.sequenceNumber++,V,w({},c,{samples:O})),qe="video",at={data1:et,data2:Ke,startPTS:ie/p,endPTS:(oe+N)/p,startDTS:V/p,endDTS:G/p,type:qe,hasAudio:!1,hasVideo:!0,nb:O.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Ke.length,"MDAT length must not be zero"),at},y.remuxAudio=function(c,o,a,m,p){var v=c.inputTimeScale,O=c.samplerate?c.samplerate:v,U=v/O,j=c.isAAC?A:_,G=j*U,B=this._initPTS,N=!c.isAAC&&this.typeSupported.mpeg,V=[],$=c.samples,ie=N?0:8,oe=this.nextAudioPts||-1,_e=o*v;if(this.isAudioContiguous=a=a||$.length&&oe>0&&(m&&Math.abs(_e-oe)<9e3||Math.abs(l($[0].pts-B,_e)-oe)<20*G),$.forEach(function(ee){ee.pts=l(ee.pts-B,_e)}),!a||oe<0){if($=$.filter(function(ee){return ee.pts>=0}),!$.length)return;p===0?oe=0:m?oe=Math.max(0,_e):oe=$[0].pts}if(c.isAAC)for(var fe=p!==void 0,Se=this.config.maxAudioFramesDrift,be=0,me=oe;be<$.length;be++){var le=$[be],ue=le.pts,Ee=ue-me,Ge=Math.abs(1e3*Ee/v);if(Ee<=-Se*G&&fe)be===0&&(D.logger.warn("Audio frame @ "+(ue/v).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Ee/v)+" ms."),this.nextAudioPts=oe=me=ue);else if(Ee>=Se*G&&Ge<T&&fe){var Te=Math.round(Ee/G);me=ue-Te*G,me<0&&(Te--,me+=G),be===0&&(this.nextAudioPts=oe=me),D.logger.warn("[mp4-remuxer]: Injecting "+Te+" audio frame @ "+(me/v).toFixed(3)+"s due to "+Math.round(1e3*Ee/v)+" ms gap.");for(var pe=0;pe<Te;pe++){var Ae=Math.max(me,0),Ce=k.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);Ce||(D.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ce=le.unit.subarray()),$.splice(be,0,{unit:Ce,pts:Ae}),me+=G,be++}}le.pts=me,me+=G}for(var we=null,Be=null,Qe,je=0,De=$.length;De--;)je+=$[De].unit.byteLength;for(var Pe=0,Le=$.length;Pe<Le;Pe++){var Re=$[Pe],Ue=Re.unit,We=Re.pts;if(Be!==null){var ke=V[Pe-1];ke.duration=Math.round((We-Be)/U)}else if(a&&c.isAAC&&(We=oe),we=We,je>0){je+=ie;try{Qe=new Uint8Array(je)}catch(ee){this.observer.emit(F.Events.ERROR,F.Events.ERROR,{type:M.ErrorTypes.MUX_ERROR,details:M.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:je,reason:"fail allocating audio mdat "+je});return}if(!N){var Ke=new DataView(Qe.buffer);Ke.setUint32(0,je),Qe.set(P.default.types.mdat,4)}}else return;Qe.set(Ue,ie);var ze=Ue.byteLength;ie+=ze,V.push(new h(!0,j,ze,0)),Be=We}var ge=V.length;if(!ge)return;var Ye=V[V.length-1];this.nextAudioPts=oe=Be+U*Ye.duration;var He=N?new Uint8Array(0):P.default.moof(c.sequenceNumber++,we/U,w({},c,{samples:V}));c.samples=[];var xe=we/v,Ie=oe/v,se="audio",te={data1:He,data2:Qe,startPTS:xe,endPTS:Ie,startDTS:xe,endDTS:Ie,type:se,hasAudio:!0,hasVideo:!1,nb:ge};return this.isAudioContiguous=!0,console.assert(Qe.length,"MDAT length must not be zero"),te},y.remuxEmptyAudio=function(c,o,a,m){var p=c.inputTimeScale,v=c.samplerate?c.samplerate:p,O=p/v,U=this.nextAudioPts,j=(U!==null?U:m.startDTS*p)+this._initDTS,G=m.endDTS*p+this._initDTS,B=O*A,N=Math.ceil((G-j)/B),V=k.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(D.logger.warn("[mp4-remuxer]: remux empty Audio"),!V){D.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var $=[],ie=0;ie<N;ie++){var oe=j+ie*B;$.push({unit:V,pts:oe,dts:oe})}return c.samples=$,this.remuxAudio(c,o,a,!1)},y.remuxID3=function(c,o){var a=c.samples.length;if(!a)return;for(var m=c.inputTimeScale,p=this._initPTS,v=this._initDTS,O=0;O<a;O++){var U=c.samples[O];U.pts=l(U.pts-p,o*m)/m,U.dts=l(U.dts-v,o*m)/m}var j=c.samples;return c.samples=[],{samples:j}},y.remuxText=function(c,o){var a=c.samples.length;if(!a)return;for(var m=c.inputTimeScale,p=this._initPTS,v=0;v<a;v++){var O=c.samples[v];O.pts=l(O.pts-p,o*m)/m}c.samples.sort(function(j,G){return j.pts-G.pts});var U=c.samples;return c.samples=[],{samples:U}},C}();function l(C,y){var f;if(y===null)return C;for(y<C?f=-8589934592:f=8589934592;Math.abs(C-y)>4294967296;)C+=f;return C}function S(C){for(var y=0;y<C.length;y++)if(C[y].key)return y;return-1}var h=function(y,f,c,o){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=f,this.size=c,this.cts=o,this.flags=new g(y)},g=function(y){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=y?2:1,this.isNonSync=y?0:1}},"./src/remux/passthrough-remuxer.ts":function(re,z,L){"use strict";L.r(z);var H=L("./src/polyfills/number.ts"),k=L("./src/utils/mp4-tools.ts"),P=L("./src/loader/fragment.ts"),F=L("./src/utils/logger.ts"),M=function(){function E(){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 w=E.prototype;return w.destroy=function(){},w.resetTimeStamp=function(A){this.initPTS=A,this.lastEndDTS=null},w.resetNextTimestamp=function(){this.lastEndDTS=null},w.resetInitSegment=function(A,_,b){this.audioCodec=_,this.videoCodec=b,this.generateInitSegment(A),this.emitInitSegment=!0},w.generateInitSegment=function(A){var _=this.audioCodec,b=this.videoCodec;if(!A||!A.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(k.parseInitSegment)(A);_||(_=R(d.audio,P.ElementaryStreamTypes.AUDIO)),b||(b=R(d.video,P.ElementaryStreamTypes.VIDEO));var s={};d.audio&&d.video?s.audiovideo={container:"video/mp4",codec:_+","+b,initSegment:A,id:"main"}:d.audio?s.audio={container:"audio/mp4",codec:_,initSegment:A,id:"audio"}:d.video?s.video={container:"video/mp4",codec:b,initSegment:A,id:"main"}:F.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=s},w.remux=function(A,_,b,d,s){var u=this.initPTS,l=this.lastEndDTS,S={audio:void 0,video:void 0,text:d,id3:b,initSegment:void 0};Object(H.isFiniteNumber)(l)||(l=this.lastEndDTS=s||0);var h=_.samples;if(!h||!h.length)return S;var g={initPTS:void 0,timescale:1},C=this.initData;if((!C||!C.length)&&(this.generateInitSegment(h),C=this.initData),!C||!C.length)return F.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),S;this.emitInitSegment&&(g.tracks=this.initTracks,this.emitInitSegment=!1),Object(H.isFiniteNumber)(u)||(this.initPTS=g.initPTS=u=D(C,h,l));var y=Object(k.getDuration)(h,C),f=l,c=y+f;Object(k.offsetStartDTS)(C,h,u),y>0?this.lastEndDTS=c:(F.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var o=!!C.audio,a=!!C.video,m="";o&&(m+="audio"),a&&(m+="video");var p={data1:h,startPTS:f,startDTS:f,endPTS:c,endDTS:c,type:m,hasAudio:o,hasVideo:a,nb:1,dropped:0};return S.audio=p.type==="audio"?p:void 0,S.video=p.type!=="audio"?p:void 0,S.text=d,S.id3=b,S.initSegment=g,S},E}(),D=function(w,T,A){return Object(k.getStartDTS)(w,T)-A};function R(E,w){var T=E==null?void 0:E.codec;return T&&T.length>4?T:T==="hvc1"?"hvc1.1.c.L120.90":T==="av01"?"av01.0.04M.08":T==="avc1"||w===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}z.default=M},"./src/task-loop.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return H});var H=function(){function k(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var P=k.prototype;return P.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},P.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},P.onHandlerDestroyed=function(){},P.hasInterval=function(){return!!this._tickInterval},P.hasNextTick=function(){return!!this._tickTimer},P.setInterval=function(M){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,M),!0)},P.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},P.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},P.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},P.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},P.doTick=function(){},k}()},"./src/types/cmcd.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"CMCDVersion",function(){return H}),L.d(z,"CMCDObjectType",function(){return k}),L.d(z,"CMCDStreamingFormat",function(){return P}),L.d(z,"CMCDStreamType",function(){return F});var H=1,k;(function(M){M.MANIFEST="m",M.AUDIO="a",M.VIDEO="v",M.MUXED="av",M.INIT="i",M.CAPTION="c",M.TIMED_TEXT="tt",M.KEY="k",M.OTHER="o"})(k||(k={}));var P;(function(M){M.DASH="d",M.HLS="h",M.SMOOTH="s",M.OTHER="o"})(P||(P={}));var F;(function(M){M.VOD="v",M.LIVE="l"})(F||(F={}))},"./src/types/level.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"HlsSkip",function(){return P}),L.d(z,"getSkipValue",function(){return F}),L.d(z,"HlsUrlParameters",function(){return M}),L.d(z,"Level",function(){return D});function H(R,E){for(var w=0;w<E.length;w++){var T=E[w];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(R,T.key,T)}}function k(R,E,w){return E&&H(R.prototype,E),w&&H(R,w),R}var P;(function(R){R.No="",R.Yes="YES",R.v2="v2"})(P||(P={}));function F(R,E){var w=R.canSkipUntil,T=R.canSkipDateRanges,A=R.endSN,_=E!==void 0?E-A:0;return w&&_<w?T?P.v2:P.Yes:P.No}var M=function(){function R(w,T,A){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=w,this.part=T,this.skip=A}var E=R.prototype;return E.addDirectives=function(T){var A=new self.URL(T);return this.msn!==void 0&&A.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&A.searchParams.set("_HLS_part",this.part.toString()),this.skip&&A.searchParams.set("_HLS_skip",this.skip),A.toString()},R}(),D=function(){function R(E){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=[E.url],this.attrs=E.attrs,this.bitrate=E.bitrate,E.details&&(this.details=E.details),this.id=E.id||0,this.name=E.name,this.width=E.width||0,this.height=E.height||0,this.audioCodec=E.audioCodec,this.videoCodec=E.videoCodec,this.unknownCodecs=E.unknownCodecs,this.codecSet=[E.videoCodec,E.audioCodec].filter(function(w){return w}).join(",").replace(/\.[^.,]+/g,"")}return k(R,[{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(w){var T=w%this.url.length;this._urlId!==T&&(this.details=void 0,this._urlId=T)}}]),R}()},"./src/types/loader.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"PlaylistContextType",function(){return H}),L.d(z,"PlaylistLevelType",function(){return k});var H;(function(P){P.MANIFEST="manifest",P.LEVEL="level",P.AUDIO_TRACK="audioTrack",P.SUBTITLE_TRACK="subtitleTrack"})(H||(H={}));var k;(function(P){P.MAIN="main",P.AUDIO="audio",P.SUBTITLE="subtitle"})(k||(k={}))},"./src/types/transmuxer.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"ChunkMetadata",function(){return H});var H=function(F,M,D,R,E,w){R===void 0&&(R=0),E===void 0&&(E=-1),w===void 0&&(w=!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=k(),this.buffering={audio:k(),video:k(),audiovideo:k()},this.level=F,this.sn=M,this.id=D,this.size=R,this.part=E,this.partial=w};function k(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"AttrList",function(){return P});var H=/^(\d+)x(\d+)$/,k=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,P=function(){function F(D){typeof D=="string"&&(D=F.parseAttrList(D));for(var R in D)D.hasOwnProperty(R)&&(this[R]=D[R])}var M=F.prototype;return M.decimalInteger=function(R){var E=parseInt(this[R],10);return E>Number.MAX_SAFE_INTEGER?Infinity:E},M.hexadecimalInteger=function(R){if(this[R]){var E=(this[R]||"0x").slice(2);E=(E.length&1?"0":"")+E;for(var w=new Uint8Array(E.length/2),T=0;T<E.length/2;T++)w[T]=parseInt(E.slice(T*2,T*2+2),16);return w}else return null},M.hexadecimalIntegerAsNumber=function(R){var E=parseInt(this[R],16);return E>Number.MAX_SAFE_INTEGER?Infinity:E},M.decimalFloatingPoint=function(R){return parseFloat(this[R])},M.optionalFloat=function(R,E){var w=this[R];return w?parseFloat(w):E},M.enumeratedString=function(R){return this[R]},M.bool=function(R){return this[R]==="YES"},M.decimalResolution=function(R){var E=H.exec(this[R]);return E===null?void 0:{width:parseInt(E[1],10),height:parseInt(E[2],10)}},F.parseAttrList=function(R){var E,w={},T='"';for(k.lastIndex=0;(E=k.exec(R))!==null;){var A=E[2];A.indexOf(T)===0&&A.lastIndexOf(T)===A.length-1&&(A=A.slice(1,-1)),w[E[1]]=A}return w},F}()},"./src/utils/binary-search.ts":function(re,z,L){"use strict";L.r(z);var H={search:function(P,F){for(var M=0,D=P.length-1,R=null,E=null;M<=D;){R=(M+D)/2|0,E=P[R];var w=F(E);if(w>0)M=R+1;else if(w<0)D=R-1;else return E}return null}};z.default=H},"./src/utils/buffer-helper.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"BufferHelper",function(){return P});var H=L("./src/utils/logger.ts"),k={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function F(){}return F.isBuffered=function(D,R){try{if(D){for(var E=F.getBuffered(D),w=0;w<E.length;w++)if(R>=E.start(w)&&R<=E.end(w))return!0}}catch(T){}return!1},F.bufferInfo=function(D,R,E){try{if(D){var w=F.getBuffered(D),T=[],A;for(A=0;A<w.length;A++)T.push({start:w.start(A),end:w.end(A)});return this.bufferedInfo(T,R,E)}}catch(_){}return{len:0,start:R,end:R,nextStart:void 0}},F.bufferedInfo=function(D,R,E){R=Math.max(0,R),D.sort(function(g,C){var y=g.start-C.start;return y||C.end-g.end});var w=[];if(E)for(var T=0;T<D.length;T++){var A=w.length;if(A){var _=w[A-1].end;D[T].start-_<E?D[T].end>_&&(w[A-1].end=D[T].end):w.push(D[T])}else w.push(D[T])}else w=D;for(var b=0,d,s=R,u=R,l=0;l<w.length;l++){var S=w[l].start,h=w[l].end;if(R+E>=S&&R<h)s=S,u=h,b=u-R;else if(R+E<S){d=S;break}}return{len:b,start:s||0,end:u||0,nextStart:d}},F.getBuffered=function(D){try{return D.buffered}catch(R){return H.logger.log("failed to get media.buffered",R),k}},F}()},"./src/utils/cea-608-parser.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"Row",function(){return u}),L.d(z,"CaptionScreen",function(){return l});var H=L("./src/utils/logger.ts"),k={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},P=function(c){var o=c;return k.hasOwnProperty(c)&&(o=k[c]),String.fromCharCode(o)},F=15,M=100,D={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},R={17:2,18:4,21:6,22:8,23:10,19:13,20:15},E={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},w={25:2,26:4,29:6,30:8,31:10,27:13,28:15},T=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],A;(function(f){f[f.ERROR=0]="ERROR",f[f.TEXT=1]="TEXT",f[f.WARNING=2]="WARNING",f[f.INFO=2]="INFO",f[f.DEBUG=3]="DEBUG",f[f.DATA=3]="DATA"})(A||(A={}));var _=function(){function f(){this.time=null,this.verboseLevel=A.ERROR}var c=f.prototype;return c.log=function(a,m){this.verboseLevel>=a&&H.logger.log(this.time+" ["+a+"] "+m)},f}(),b=function(c){for(var o=[],a=0;a<c.length;a++)o.push(c[a].toString(16));return o},d=function(){function f(o,a,m,p,v){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=o||"white",this.underline=a||!1,this.italics=m||!1,this.background=p||"black",this.flash=v||!1}var c=f.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 m=["foreground","underline","italics","background","flash"],p=0;p<m.length;p++){var v=m[p];a.hasOwnProperty(v)&&(this[v]=a[v])}},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},f}(),s=function(){function f(o,a,m,p,v,O){this.uchar=void 0,this.penState=void 0,this.uchar=o||" ",this.penState=new d(a,m,p,v,O)}var c=f.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,m){this.uchar=a,this.penState.copy(m)},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()},f}(),u=function(){function f(o){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<M;a++)this.chars.push(new s);this.logger=o,this.pos=0,this.currPenState=new d}var c=f.prototype;return c.equals=function(a){for(var m=!0,p=0;p<M;p++)if(!this.chars[p].equals(a.chars[p])){m=!1;break}return m},c.copy=function(a){for(var m=0;m<M;m++)this.chars[m].copy(a.chars[m])},c.isEmpty=function(){for(var a=!0,m=0;m<M;m++)if(!this.chars[m].isEmpty()){a=!1;break}return a},c.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(A.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>M&&(this.logger.log(A.DEBUG,"Too large cursor position "+this.pos),this.pos=M)},c.moveCursor=function(a){var m=this.pos+a;if(a>1)for(var p=this.pos+1;p<m+1;p++)this.chars[p].setPenState(this.currPenState);this.setCursor(m)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var m=P(a);if(this.pos>=M){this.logger.log(A.ERROR,"Cannot insert "+a.toString(16)+" ("+m+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(m,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var m;for(m=a;m<M;m++)this.chars[m].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=[],m=!0,p=0;p<M;p++){var v=this.chars[p].uchar;v!==" "&&(m=!1),a.push(v)}return m?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var m=this.chars[this.pos];m.setPenState(this.currPenState)},f}(),l=function(){function f(o){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<F;a++)this.rows.push(new u(o));this.logger=o,this.currRow=F-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=f.prototype;return c.reset=function(){for(var a=0;a<F;a++)this.rows[a].clear();this.currRow=F-1},c.equals=function(a){for(var m=!0,p=0;p<F;p++)if(!this.rows[p].equals(a.rows[p])){m=!1;break}return m},c.copy=function(a){for(var m=0;m<F;m++)this.rows[m].copy(a.rows[m])},c.isEmpty=function(){for(var a=!0,m=0;m<F;m++)if(!this.rows[m].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 m=this.rows[this.currRow];m.insertChar(a)},c.setPen=function(a){var m=this.rows[this.currRow];m.setPenStyles(a)},c.moveCursor=function(a){var m=this.rows[this.currRow];m.moveCursor(a)},c.setCursor=function(a){this.logger.log(A.INFO,"setCursor: "+a);var m=this.rows[this.currRow];m.setCursor(a)},c.setPAC=function(a){this.logger.log(A.INFO,"pacData = "+JSON.stringify(a));var m=a.row-1;if(this.nrRollUpRows&&m<this.nrRollUpRows-1&&(m=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==m){for(var p=0;p<F;p++)this.rows[p].clear();var v=this.currRow+1-this.nrRollUpRows,O=this.lastOutputScreen;if(O){var U=O.rows[v].cueStartTime,j=this.logger.time;if(U&&j!==null&&U<j)for(var G=0;G<this.nrRollUpRows;G++)this.rows[m-this.nrRollUpRows+G+1].copy(O.rows[v+G])}}this.currRow=m;var B=this.rows[this.currRow];if(a.indent!==null){var N=a.indent,V=Math.max(N-1,0);B.setCursor(a.indent),a.color=B.chars[V].penState.foreground}var $={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen($)},c.setBkgData=function(a){this.logger.log(A.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(A.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(A.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,m=this.rows.splice(a,1)[0];m.clear(),this.rows.splice(this.currRow,0,m),this.logger.log(A.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var m=[],p="",v=-1,O=0;O<F;O++){var U=this.rows[O].getTextString();U&&(v=O+1,a?m.push("Row "+v+": '"+U+"'"):m.push(U.trim()))}return m.length>0&&(a?p="["+m.join(" | ")+"]":p=m.join(`
`)),p},c.getTextAndFormat=function(){return this.rows},f}(),S=function(){function f(o,a,m){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=o,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new l(m),this.nonDisplayedMemory=new l(m),this.lastOutputScreen=new l(m),this.currRollUpRow=this.displayedMemory.rows[F-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=m}var c=f.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[F-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(A.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 m=0;m<a.length;m++)this.writeScreen.insertChar(a[m]);var p=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(A.INFO,p+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(A.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(A.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(A.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(A.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(A.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(A.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(A.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(A.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(A.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(A.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(A.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(A.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(A.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(A.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(A.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var m={flash:!1};if(m.underline=a%2===1,m.italics=a>=46,m.italics)m.foreground="white";else{var p=Math.floor(a/2)-16,v=["white","green","blue","cyan","red","yellow","magenta"];m.foreground=v[p]}this.logger.log(A.INFO,"MIDROW: "+JSON.stringify(m)),this.writeScreen.setPen(m)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var m=this.logger.time;if(m===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=m:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,m,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:m),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))},f}(),h=function(){function f(o,a,m){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var p=new _;this.channels=[null,new S(o,a,p),new S(o+1,m,p)],this.cmdHistory=y(),this.logger=p}var c=f.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,m){this.channels[a].setHandler(m)},c.addData=function(a,m){var p,v,O,U=!1;this.logger.time=a;for(var j=0;j<m.length;j+=2){if(v=m[j]&127,O=m[j+1]&127,v===0&&O===0)continue;if(this.logger.log(A.DATA,"["+b([m[j],m[j+1]])+"] -> ("+b([v,O])+")"),p=this.parseCmd(v,O),p||(p=this.parseMidrow(v,O)),p||(p=this.parsePAC(v,O)),p||(p=this.parseBackgroundAttributes(v,O)),!p&&(U=this.parseChars(v,O),U)){var G=this.currentChannel;if(G&&G>0){var B=this.channels[G];B.insertChars(U)}else this.logger.log(A.WARNING,"No channel found yet. TEXT-MODE?")}!p&&!U&&this.logger.log(A.WARNING,"Couldn't parse cleaned data "+b([v,O])+" orig: "+b([m[j],m[j+1]]))}},c.parseCmd=function(a,m){var p=this.cmdHistory,v=(a===20||a===28||a===21||a===29)&&m>=32&&m<=47,O=(a===23||a===31)&&m>=33&&m<=35;if(!(v||O))return!1;if(C(a,m,p))return g(null,null,p),this.logger.log(A.DEBUG,"Repeated command ("+b([a,m])+") is dropped"),!0;var U=a===20||a===21||a===23?1:2,j=this.channels[U];return a===20||a===21||a===28||a===29?m===32?j.ccRCL():m===33?j.ccBS():m===34?j.ccAOF():m===35?j.ccAON():m===36?j.ccDER():m===37?j.ccRU(2):m===38?j.ccRU(3):m===39?j.ccRU(4):m===40?j.ccFON():m===41?j.ccRDC():m===42?j.ccTR():m===43?j.ccRTD():m===44?j.ccEDM():m===45?j.ccCR():m===46?j.ccENM():m===47&&j.ccEOC():j.ccTO(m-32),g(a,m,p),this.currentChannel=U,!0},c.parseMidrow=function(a,m){var p=0;if((a===17||a===25)&&m>=32&&m<=47){if(a===17?p=1:p=2,p!==this.currentChannel)return this.logger.log(A.ERROR,"Mismatch channel in midrow parsing"),!1;var v=this.channels[p];return v?(v.ccMIDROW(m),this.logger.log(A.DEBUG,"MIDROW ("+b([a,m])+")"),!0):!1}return!1},c.parsePAC=function(a,m){var p,v=this.cmdHistory,O=(a>=17&&a<=23||a>=25&&a<=31)&&m>=64&&m<=127,U=(a===16||a===24)&&m>=64&&m<=95;if(!(O||U))return!1;if(C(a,m,v))return g(null,null,v),!0;var j=a<=23?1:2;m>=64&&m<=95?p=j===1?D[a]:E[a]:p=j===1?R[a]:w[a];var G=this.channels[j];return G?(G.setPAC(this.interpretPAC(p,m)),g(a,m,v),this.currentChannel=j,!0):!1},c.interpretPAC=function(a,m){var p,v={color:null,italics:!1,indent:null,underline:!1,row:a};return m>95?p=m-96:p=m-64,v.underline=(p&1)===1,p<=13?v.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(p/2)]:p<=15?(v.italics=!0,v.color="white"):v.indent=Math.floor((p-16)/2)*4,v},c.parseChars=function(a,m){var p,v=null,O=null;if(a>=25?(p=2,O=a-8):(p=1,O=a),O>=17&&O<=19){var U;O===17?U=m+80:O===18?U=m+112:U=m+144,this.logger.log(A.INFO,"Special char '"+P(U)+"' in channel "+p),v=[U]}else a>=32&&a<=127&&(v=m===0?[a]:[a,m]);if(v){var j=b(v);this.logger.log(A.DEBUG,"Char codes = "+j.join(",")),g(a,m,this.cmdHistory)}return v},c.parseBackgroundAttributes=function(a,m){var p=(a===16||a===24)&&m>=32&&m<=47,v=(a===23||a===31)&&m>=45&&m<=47;if(!(p||v))return!1;var O,U={};a===16||a===24?(O=Math.floor((m-32)/2),U.background=T[O],m%2===1&&(U.background=U.background+"_semi")):m===45?U.background="transparent":(U.foreground="black",m===47&&(U.underline=!0));var j=a<=23?1:2,G=this.channels[j];return G.setBkgData(U),g(a,m,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var m=this.channels[a];m&&m.reset()}this.cmdHistory=y()},c.cueSplitAtTime=function(a){for(var m=0;m<this.channels.length;m++){var p=this.channels[m];p&&p.cueSplitAtTime(a)}},f}();function g(f,c,o){o.a=f,o.b=c}function C(f,c,o){return o.a===f&&o.b===c}function y(){return{a:null,b:null}}z.default=h},"./src/utils/codecs.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"isCodecType",function(){return k}),L.d(z,"isCodecSupportedInMp4",function(){return P});var H={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 k(F,M){var D=H[M];return!!D&&D[F.slice(0,4)]===!0}function P(F,M){return MediaSource.isTypeSupported((M||"video")+'/mp4;codecs="'+F+'"')}},"./src/utils/cues.ts":function(re,z,L){"use strict";L.r(z);var H=L("./src/utils/vttparser.ts"),k=L("./src/utils/webvtt-parser.ts"),P=L("./src/utils/texttrack-utils.ts"),F=/\s/,M={newCue:function(R,E,w,T){for(var A=[],_,b,d,s,u,l=self.VTTCue||self.TextTrackCue,S=0;S<T.rows.length;S++)if(_=T.rows[S],d=!0,s=0,u="",!_.isEmpty()){for(var h=0;h<_.chars.length;h++)F.test(_.chars[h].uchar)&&d?s++:(u+=_.chars[h].uchar,d=!1);_.cueStartTime=E,E===w&&(w+=1e-4),s>=16?s--:s++;var g=Object(H.fixLineBreaks)(u.trim()),C=Object(k.generateCueId)(E,w,g);(!R||!R.cues||!R.cues.getCueById(C))&&(b=new l(E,w,g),b.id=C,b.line=S+1,b.align="left",b.position=10+Math.min(80,Math.floor(s*8/32)*10),A.push(b))}return R&&A.length&&(A.sort(function(y,f){return y.line==="auto"||f.line==="auto"?0:y.line>8&&f.line>8?f.line-y.line:y.line-f.line}),A.forEach(function(y){return Object(P.addCueToTrack)(R,y)})),A}};z.default=M},"./src/utils/discontinuities.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"findFirstFragWithCC",function(){return F}),L.d(z,"shouldAlignOnDiscontinuities",function(){return M}),L.d(z,"findDiscontinuousReferenceFrag",function(){return D}),L.d(z,"adjustSlidingStart",function(){return E}),L.d(z,"alignStream",function(){return w}),L.d(z,"alignPDT",function(){return A}),L.d(z,"alignFragmentByPDTDelta",function(){return _}),L.d(z,"alignMediaPlaylistByPDT",function(){return b});var H=L("./src/polyfills/number.ts"),k=L("./src/utils/logger.ts"),P=L("./src/controller/level-helper.ts");function F(d,s){for(var u=null,l=0,S=d.length;l<S;l++){var h=d[l];if(h&&h.cc===s){u=h;break}}return u}function M(d,s,u){return!!(s.details&&(u.endCC>u.startCC||d&&d.cc<u.startCC))}function D(d,s){var u=d.fragments,l=s.fragments;if(!l.length||!u.length){k.logger.log("No fragments to align");return}var S=F(u,l[0].cc);if(!S||S&&!S.startPTS){k.logger.log("No frag in previous level to align on");return}return S}function R(d,s){if(d){var u=d.start+s;d.start=d.startPTS=u,d.endPTS=u+d.duration}}function E(d,s){for(var u=s.fragments,l=0,S=u.length;l<S;l++)R(u[l],d);s.fragmentHint&&R(s.fragmentHint,d),s.alignedSliding=!0}function w(d,s,u){if(!s)return;T(d,u,s),!u.alignedSliding&&s.details&&A(u,s.details),!u.alignedSliding&&s.details&&!u.skippedSegments&&Object(P.adjustSliding)(s.details,u)}function T(d,s,u){if(M(d,u,s)){var l=D(u.details,s);l&&Object(H.isFiniteNumber)(l.start)&&(k.logger.log("Adjusting PTS using last level due to CC increase within current level "+s.url),E(l.start,s))}}function A(d,s){if(!s.fragments.length||!d.hasProgramDateTime||!s.hasProgramDateTime)return;var u=s.fragments[0].programDateTime,l=d.fragments[0].programDateTime,S=(l-u)/1e3+s.fragments[0].start;S&&Object(H.isFiniteNumber)(S)&&(k.logger.log("Adjusting PTS using programDateTime delta "+(l-u)+"ms, sliding:"+S.toFixed(3)+" "+d.url+" "),E(S,d))}function _(d,s){var u=d.programDateTime;if(!u)return;var l=(u-s)/1e3;d.start=d.startPTS=l,d.endPTS=l+d.duration}function b(d,s){if(!s.fragments.length||!d.hasProgramDateTime||!s.hasProgramDateTime)return;var u=s.fragments[0].programDateTime,l=s.fragments[0].start,S=u-l*1e3;d.fragments.forEach(function(h){_(h,S)}),d.fragmentHint&&_(d.fragmentHint,S),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(re,z,L){"use strict";L.r(z);var H=L("./src/utils/ewma.ts"),k=function(){function P(M,D,R){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=R,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new H.default(M),this.fast_=new H.default(D)}var F=P.prototype;return F.update=function(D,R){var E=this.slow_,w=this.fast_;this.slow_.halfLife!==D&&(this.slow_=new H.default(D,E.getEstimate(),E.getTotalWeight())),this.fast_.halfLife!==R&&(this.fast_=new H.default(R,w.getEstimate(),w.getTotalWeight()))},F.sample=function(D,R){D=Math.max(D,this.minDelayMs_);var E=8*R,w=D/1e3,T=E/w;this.fast_.sample(w,T),this.slow_.sample(w,T)},F.canEstimate=function(){var D=this.fast_;return D&&D.getTotalWeight()>=this.minWeight_},F.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},F.destroy=function(){},P}();z.default=k},"./src/utils/ewma.ts":function(re,z,L){"use strict";L.r(z);var H=function(){function k(F,M,D){M===void 0&&(M=0),D===void 0&&(D=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=F,this.alpha_=F?Math.exp(Math.log(.5)/F):0,this.estimate_=M,this.totalWeight_=D}var P=k.prototype;return P.sample=function(M,D){var R=Math.pow(this.alpha_,M);this.estimate_=D*(1-R)+R*this.estimate_,this.totalWeight_+=M},P.getTotalWeight=function(){return this.totalWeight_},P.getEstimate=function(){if(this.alpha_){var M=1-Math.pow(this.alpha_,this.totalWeight_);if(M)return this.estimate_/M}return this.estimate_},k}();z.default=H},"./src/utils/fetch-loader.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"fetchSupported",function(){return _});var H=L("./src/polyfills/number.ts"),k=L("./src/loader/load-stats.ts"),P=L("./src/demux/chunk-cache.ts");function F(l,S){l.prototype=Object.create(S.prototype),l.prototype.constructor=l,w(l,S)}function M(l){var S=typeof Map=="function"?new Map:void 0;return M=function(g){if(g===null||!E(g))return g;if(typeof g!="function")throw new TypeError("Super expression must either be null or a function");if(typeof S!="undefined"){if(S.has(g))return S.get(g);S.set(g,C)}function C(){return D(g,arguments,T(this).constructor)}return C.prototype=Object.create(g.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),w(C,g)},M(l)}function D(l,S,h){return R()?D=Reflect.construct:D=function(C,y,f){var c=[null];c.push.apply(c,y);var o=Function.bind.apply(C,c),a=new o;return f&&w(a,f.prototype),a},D.apply(null,arguments)}function R(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(l){return!1}}function E(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function w(l,S){return w=Object.setPrototypeOf||function(g,C){return g.__proto__=C,g},w(l,S)}function T(l){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(h){return h.__proto__||Object.getPrototypeOf(h)},T(l)}function A(){return A=Object.assign||function(l){for(var S=1;S<arguments.length;S++){var h=arguments[S];for(var g in h)Object.prototype.hasOwnProperty.call(h,g)&&(l[g]=h[g])}return l},A.apply(this,arguments)}function _(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(l){}return!1}var b=function(){function l(h){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=h.fetchSetup||s,this.controller=new self.AbortController,this.stats=new k.LoadStats}var S=l.prototype;return S.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},S.abortInternal=function(){var g=this.response;(!g||!g.ok)&&(this.stats.aborted=!0,this.controller.abort())},S.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},S.load=function(g,C,y){var f=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var o=d(g,this.controller.signal),a=y.onProgress,m=g.responseType==="arraybuffer",p=m?"byteLength":"length";this.context=g,this.config=C,this.callbacks=y,this.request=this.fetchSetup(g,o),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){f.abortInternal(),y.onTimeout(c,g,f.response)},C.timeout),self.fetch(this.request).then(function(v){if(f.response=f.loader=v,!v.ok){var O=v.status,U=v.statusText;throw new u(U||"fetch, bad network response",O,v)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(v.headers.get("Content-Length")||"0"),a&&Object(H.isFiniteNumber)(C.highWaterMark)?f.loadProgressively(v,c,g,C.highWaterMark,a):m?v.arrayBuffer():v.text()}).then(function(v){var O=f.response;self.clearTimeout(f.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=v[p];var U={url:O.url,data:v};a&&!Object(H.isFiniteNumber)(C.highWaterMark)&&a(c,g,v,O),y.onSuccess(U,c,g,O)}).catch(function(v){if(self.clearTimeout(f.requestTimeout),c.aborted)return;var O=v.code||0;y.onError({code:O,text:v.message},g,v.details)})},S.getCacheAge=function(){var g=null;if(this.response){var C=this.response.headers.get("age");g=C?parseFloat(C):null}return g},S.loadProgressively=function(g,C,y,f,c){f===void 0&&(f=0);var o=new P.default,a=g.body.getReader(),m=function p(){return a.read().then(function(v){if(v.done)return o.dataLength&&c(C,y,o.flush(),g),Promise.resolve(new ArrayBuffer(0));var O=v.value,U=O.length;return C.loaded+=U,U<f||o.dataLength?(o.push(O),o.dataLength>=f&&c(C,y,o.flush(),g)):c(C,y,O,g),p()}).catch(function(){return Promise.reject()})};return m()},l}();function d(l,S){var h={method:"GET",mode:"cors",credentials:"same-origin",signal:S,headers:new self.Headers(A({},l.headers))};return l.rangeEnd&&h.headers.set("Range","bytes="+l.rangeStart+"-"+String(l.rangeEnd-1)),h}function s(l,S){return new self.Request(l.url,S)}var u=function(l){F(S,l);function S(h,g,C){var y;return y=l.call(this,h)||this,y.code=void 0,y.details=void 0,y.code=g,y.details=C,y}return S}(M(Error));z.default=b},"./src/utils/imsc1-ttml-parser.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"IMSC1_CODEC",function(){return E}),L.d(z,"parseIMSC1",function(){return _});var H=L("./src/utils/mp4-tools.ts"),k=L("./src/utils/vttparser.ts"),P=L("./src/utils/vttcue.ts"),F=L("./src/demux/id3.ts"),M=L("./src/utils/timescale-conversion.ts"),D=L("./src/utils/webvtt-parser.ts");function R(){return R=Object.assign||function(f){for(var c=1;c<arguments.length;c++){var o=arguments[c];for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(f[a]=o[a])}return f},R.apply(this,arguments)}var E="stpp.ttml.im1t",w=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,T=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,A={left:"start",center:"center",right:"end",start:"start",end:"end"};function _(f,c,o,a,m){var p=Object(H.findBox)(new Uint8Array(f),["mdat"]);if(p.length===0){m(new Error("Could not parse IMSC1 mdat"));return}var v=p[0],O=Object(F.utf8ArrayToStr)(new Uint8Array(f,v.start,v.end-v.start)),U=Object(M.toTimescaleFromScale)(c,1,o);try{a(b(O,U))}catch(j){m(j)}}function b(f,c){var o=new DOMParser,a=o.parseFromString(f,"text/xml"),m=a.getElementsByTagName("tt")[0];if(!m)throw new Error("Invalid ttml");var p={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},v=Object.keys(p).reduce(function(B,N){return B[N]=m.getAttribute("ttp:"+N)||p[N],B},{}),O=m.getAttribute("xml:space")!=="preserve",U=s(d(m,"styling","style")),j=s(d(m,"layout","region")),G=d(m,"body","[begin]");return[].map.call(G,function(B){var N=u(B,O);if(!N||!B.hasAttribute("begin"))return null;var V=g(B.getAttribute("begin"),v),$=g(B.getAttribute("dur"),v),ie=g(B.getAttribute("end"),v);if(V===null)throw h(B);if(ie===null){if($===null)throw h(B);ie=V+$}var oe=new P.default(V-c,ie-c,N);oe.id=Object(D.generateCueId)(oe.startTime,oe.endTime,oe.text);var _e=j[B.getAttribute("region")],fe=U[B.getAttribute("style")];oe.position=10,oe.size=80;var Se=l(_e,fe),be=Se.textAlign;if(be){var me=A[be];me&&(oe.lineAlign=me),oe.align=be}return R(oe,Se),oe}).filter(function(B){return B!==null})}function d(f,c,o){var a=f.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(o)):[]}function s(f){return f.reduce(function(c,o){var a=o.getAttribute("xml:id");return a&&(c[a]=o),c},{})}function u(f,c){return[].slice.call(f.childNodes).reduce(function(o,a,m){var p;return a.nodeName==="br"&&m?o+`
`:(p=a.childNodes)!==null&&p!==void 0&&p.length?u(a,c):c?o+a.textContent.trim().replace(/\s+/g," "):o+a.textContent},"")}function l(f,c){var o="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(m,p){var v=S(c,o,p)||S(f,o,p);return v&&(m[p]=v),m},{})}function S(f,c,o){return f.hasAttributeNS(c,o)?f.getAttributeNS(c,o):null}function h(f){return new Error("Could not parse ttml timestamp "+f)}function g(f,c){if(!f)return null;var o=Object(k.parseTimeStamp)(f);return o===null&&(w.test(f)?o=C(f,c):T.test(f)&&(o=y(f,c))),o}function C(f,c){var o=w.exec(f),a=(o[4]|0)+(o[5]|0)/c.subFrameRate;return(o[1]|0)*3600+(o[2]|0)*60+(o[3]|0)+a/c.frameRate}function y(f,c){var o=T.exec(f),a=Number(o[1]),m=o[2];switch(m){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/c.frameRate;case"t":return a/c.tickRate}return a}},"./src/utils/logger.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"enableLogs",function(){return D}),L.d(z,"logger",function(){return R});var H=function(){},k={trace:H,debug:H,log:H,warn:H,info:H,error:H},P=k;function F(E){var w=self.console[E];return w?w.bind(self.console,"["+E+"] >"):H}function M(E){for(var w=arguments.length,T=new Array(w>1?w-1:0),A=1;A<w;A++)T[A-1]=arguments[A];T.forEach(function(_){P[_]=E[_]?E[_].bind(E):F(_)})}function D(E){if(self.console&&E===!0||typeof E=="object"){M(E,"debug","log","info","warn","error");try{P.log()}catch(w){P=k}}else P=k}var R=P},"./src/utils/mediakeys-helper.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"KeySystems",function(){return H}),L.d(z,"requestMediaKeySystemAccess",function(){return k});var H;(function(P){P.WIDEVINE="com.widevine.alpha",P.PLAYREADY="com.microsoft.playready"})(H||(H={}));var k=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"getMediaSource",function(){return H});function H(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"bin2str",function(){return M}),L.d(z,"readUint16",function(){return D}),L.d(z,"readUint32",function(){return R}),L.d(z,"writeUint32",function(){return E}),L.d(z,"findBox",function(){return w}),L.d(z,"parseSegmentIndex",function(){return T}),L.d(z,"parseInitSegment",function(){return A}),L.d(z,"getStartDTS",function(){return _}),L.d(z,"getDuration",function(){return b}),L.d(z,"computeRawDurationFromSamples",function(){return d}),L.d(z,"offsetStartDTS",function(){return s}),L.d(z,"segmentValidRange",function(){return u}),L.d(z,"appendUint8Array",function(){return l});var H=L("./src/utils/typed-array.ts"),k=L("./src/loader/fragment.ts"),P=Math.pow(2,32)-1,F=[].push;function M(S){return String.fromCharCode.apply(null,S)}function D(S,h){"data"in S&&(h+=S.start,S=S.data);var g=S[h]<<8|S[h+1];return g<0?65536+g:g}function R(S,h){"data"in S&&(h+=S.start,S=S.data);var g=S[h]<<24|S[h+1]<<16|S[h+2]<<8|S[h+3];return g<0?4294967296+g:g}function E(S,h,g){"data"in S&&(h+=S.start,S=S.data),S[h]=g>>24,S[h+1]=g>>16&255,S[h+2]=g>>8&255,S[h+3]=g&255}function w(S,h){var g=[];if(!h.length)return g;var C,y,f;"data"in S?(C=S.data,y=S.start,f=S.end):(C=S,y=0,f=C.byteLength);for(var c=y;c<f;){var o=R(C,c),a=M(C.subarray(c+4,c+8)),m=o>1?c+o:f;if(a===h[0])if(h.length===1)g.push({data:C,start:c+8,end:m});else{var p=w({data:C,start:c+8,end:m},h.slice(1));p.length&&F.apply(g,p)}c=m}return g}function T(S){var h=w(S,["moov"]),g=h[0],C=g?g.end:null,y=w(S,["sidx"]);if(!y||!y[0])return null;var f=[],c=y[0],o=c.data[0],a=o===0?8:16,m=R(c,a);a+=4;var p=0,v=0;o===0?a+=8:a+=16,a+=2;var O=c.end+v,U=D(c,a);a+=2;for(var j=0;j<U;j++){var G=a,B=R(c,G);G+=4;var N=B&2147483647,V=(B&2147483648)>>>31;if(V===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var $=R(c,G);G+=4,f.push({referenceSize:N,subsegmentDuration:$,info:{duration:$/m,start:O,end:O+N-1}}),O+=N,G+=4,a=G}return{earliestPresentationTime:p,timescale:m,version:o,referencesCount:U,references:f,moovEndOffset:C}}function A(S){for(var h=[],g=w(S,["moov","trak"]),C=0;C<g.length;C++){var y=g[C],f=w(y,["tkhd"])[0];if(f){var c=f.data[f.start],o=c===0?12:20,a=R(f,o),m=w(y,["mdia","mdhd"])[0];if(m){c=m.data[m.start],o=c===0?12:20;var p=R(m,o),v=w(y,["mdia","hdlr"])[0];if(v){var O=M(v.data.subarray(v.start+8,v.start+12)),U={soun:k.ElementaryStreamTypes.AUDIO,vide:k.ElementaryStreamTypes.VIDEO}[O];if(U){var j=w(y,["mdia","minf","stbl","stsd"])[0],G=void 0;j&&(G=M(j.data.subarray(j.start+12,j.start+16))),h[a]={timescale:p,type:U},h[U]={timescale:p,id:a,codec:G}}}}}}var B=w(S,["moov","mvex","trex"]);return B.forEach(function(N){var V=R(N,4),$=h[V];$&&($.default={duration:R(N,12),flags:R(N,20)})}),h}function _(S,h){return w(h,["moof","traf"]).reduce(function(g,C){var y=w(C,["tfdt"])[0],f=y.data[y.start],c=w(C,["tfhd"]).reduce(function(o,a){var m=R(a,4),p=S[m];if(p){var v=R(y,4);f===1&&(v*=Math.pow(2,32),v+=R(y,8));var O=p.timescale||9e4,U=v/O;if(isFinite(U)&&(o===null||U<o))return U}return o},null);return c!==null&&isFinite(c)&&(g===null||c<g)?c:g},null)||0}function b(S,h){for(var g=0,C=0,y=0,f=w(S,["moof","traf"]),c=0;c<f.length;c++){var o=f[c],a=w(o,["tfhd"])[0],m=R(a,4),p=h[m];if(!p)continue;var v=p.default,O=R(a,0)|(v==null?void 0:v.flags),U=v==null?void 0:v.duration;O&8&&(O&2?U=R(a,12):U=R(a,8));for(var j=p.timescale||9e4,G=w(o,["trun"]),B=0;B<G.length;B++){if(U){var N=R(G[B],4);g=U*N}else g=d(G[B]);p.type===k.ElementaryStreamTypes.VIDEO?C+=g/j:p.type===k.ElementaryStreamTypes.AUDIO&&(y+=g/j)}}if(C===0&&y===0){var V=T(S);if(V!=null&&V.references)return V.references.reduce(function($,ie){return $+ie.info.duration||0},0)}return C||y}function d(S){var h=R(S,0),g=8;h&1&&(g+=4),h&4&&(g+=4);for(var C=0,y=R(S,4),f=0;f<y;f++){if(h&256){var c=R(S,g);C+=c,g+=4}h&512&&(g+=4),h&1024&&(g+=4),h&2048&&(g+=4)}return C}function s(S,h,g){w(h,["moof","traf"]).forEach(function(C){w(C,["tfhd"]).forEach(function(y){var f=R(y,4),c=S[f];if(!c)return;var o=c.timescale||9e4;w(C,["tfdt"]).forEach(function(a){var m=a.data[a.start],p=R(a,4);if(m===0)E(a,4,p-g*o);else{p*=Math.pow(2,32),p+=R(a,8),p-=g*o,p=Math.max(p,0);var v=Math.floor(p/(P+1)),O=Math.floor(p%(P+1));E(a,4,v),E(a,8,O)}})})})}function u(S){var h={valid:null,remainder:null},g=w(S,["moof"]);if(g){if(g.length<2)return h.remainder=S,h}else return h;var C=g[g.length-1];return h.valid=Object(H.sliceUint8)(S,0,C.start-8),h.remainder=Object(H.sliceUint8)(S,C.start-8),h}function l(S,h){var g=new Uint8Array(S.length+h.length);return g.set(S),g.set(h,S.length),g}},"./src/utils/output-filter.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"default",function(){return H});var H=function(){function k(F,M){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=F,this.trackName=M}var P=k.prototype;return P.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},P.newCue=function(M,D,R){(this.startTime===null||this.startTime>M)&&(this.startTime=M),this.endTime=D,this.screen=R,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},k}()},"./src/utils/texttrack-utils.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"sendAddTrackEvent",function(){return k}),L.d(z,"addCueToTrack",function(){return P}),L.d(z,"clearCurrentCues",function(){return F}),L.d(z,"removeCuesInRange",function(){return M}),L.d(z,"getCuesInRange",function(){return R});var H=L("./src/utils/logger.ts");function k(E,w){var T;try{T=new Event("addtrack")}catch(A){T=document.createEvent("Event"),T.initEvent("addtrack",!1,!1)}T.track=E,w.dispatchEvent(T)}function P(E,w){var T=E.mode;if(T==="disabled"&&(E.mode="hidden"),E.cues&&!E.cues.getCueById(w.id))try{if(E.addCue(w),!E.cues.getCueById(w.id))throw new Error("addCue is failed for: "+w)}catch(_){H.logger.debug("[texttrack-utils]: "+_);var A=new self.TextTrackCue(w.startTime,w.endTime,w.text);A.id=w.id,E.addCue(A)}T==="disabled"&&(E.mode=T)}function F(E){var w=E.mode;if(w==="disabled"&&(E.mode="hidden"),E.cues)for(var T=E.cues.length;T--;)E.removeCue(E.cues[T]);w==="disabled"&&(E.mode=w)}function M(E,w,T){var A=E.mode;if(A==="disabled"&&(E.mode="hidden"),E.cues&&E.cues.length>0)for(var _=R(E.cues,w,T),b=0;b<_.length;b++)E.removeCue(_[b]);A==="disabled"&&(E.mode=A)}function D(E,w){if(w<E[0].startTime)return 0;var T=E.length-1;if(w>E[T].endTime)return-1;for(var A=0,_=T;A<=_;){var b=Math.floor((_+A)/2);if(w<E[b].startTime)_=b-1;else if(w>E[b].startTime&&A<T)A=b+1;else return b}return E[A].startTime-w<w-E[_].startTime?A:_}function R(E,w,T){var A=[],_=D(E,w);if(_>-1)for(var b=_,d=E.length;b<d;b++){var s=E[b];if(s.startTime>=w&&s.endTime<=T)A.push(s);else if(s.startTime>T)return A}return A}},"./src/utils/time-ranges.ts":function(re,z,L){"use strict";L.r(z);var H={toString:function(P){for(var F="",M=P.length,D=0;D<M;D++)F+="["+P.start(D).toFixed(3)+","+P.end(D).toFixed(3)+"]";return F}};z.default=H},"./src/utils/timescale-conversion.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"toTimescaleFromBase",function(){return k}),L.d(z,"toTimescaleFromScale",function(){return P}),L.d(z,"toMsFromMpegTsClock",function(){return F}),L.d(z,"toMpegTsClockFromTimescale",function(){return M});var H=9e4;function k(D,R,E,w){E===void 0&&(E=1),w===void 0&&(w=!1);var T=D*R*E;return w?Math.round(T):T}function P(D,R,E,w){return E===void 0&&(E=1),w===void 0&&(w=!1),k(D,R,1/E,w)}function F(D,R){return R===void 0&&(R=!1),k(D,1e3,1/H,R)}function M(D,R){return R===void 0&&(R=1),k(D,H,1/R)}},"./src/utils/typed-array.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"sliceUint8",function(){return H});function H(k,P,F){return Uint8Array.prototype.slice?k.slice(P,F):new Uint8Array(Array.prototype.slice.call(k,P,F))}},"./src/utils/vttcue.ts":function(re,z,L){"use strict";L.r(z),z.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var H=["","lr","rl"],k=["start","middle","end","left","right"];function P(E,w){if(typeof w!="string")return!1;if(!Array.isArray(E))return!1;var T=w.toLowerCase();return~E.indexOf(T)?T:!1}function F(E){return P(H,E)}function M(E){return P(k,E)}function D(E){for(var w=arguments.length,T=new Array(w>1?w-1:0),A=1;A<w;A++)T[A-1]=arguments[A];for(var _=1;_<arguments.length;_++){var b=arguments[_];for(var d in b)E[d]=b[d]}return E}function R(E,w,T){var A=this,_={enumerable:!0};A.hasBeenReset=!1;var b="",d=!1,s=E,u=w,l=T,S=null,h="",g=!0,C="auto",y="start",f=50,c="middle",o=50,a="middle";Object.defineProperty(A,"id",D({},_,{get:function(){return b},set:function(p){b=""+p}})),Object.defineProperty(A,"pauseOnExit",D({},_,{get:function(){return d},set:function(p){d=!!p}})),Object.defineProperty(A,"startTime",D({},_,{get:function(){return s},set:function(p){if(typeof p!="number")throw new TypeError("Start time must be set to a number.");s=p,this.hasBeenReset=!0}})),Object.defineProperty(A,"endTime",D({},_,{get:function(){return u},set:function(p){if(typeof p!="number")throw new TypeError("End time must be set to a number.");u=p,this.hasBeenReset=!0}})),Object.defineProperty(A,"text",D({},_,{get:function(){return l},set:function(p){l=""+p,this.hasBeenReset=!0}})),Object.defineProperty(A,"region",D({},_,{get:function(){return S},set:function(p){S=p,this.hasBeenReset=!0}})),Object.defineProperty(A,"vertical",D({},_,{get:function(){return h},set:function(p){var v=F(p);if(v===!1)throw new SyntaxError("An invalid or illegal string was specified.");h=v,this.hasBeenReset=!0}})),Object.defineProperty(A,"snapToLines",D({},_,{get:function(){return g},set:function(p){g=!!p,this.hasBeenReset=!0}})),Object.defineProperty(A,"line",D({},_,{get:function(){return C},set:function(p){if(typeof p!="number"&&p!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");C=p,this.hasBeenReset=!0}})),Object.defineProperty(A,"lineAlign",D({},_,{get:function(){return y},set:function(p){var v=M(p);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");y=v,this.hasBeenReset=!0}})),Object.defineProperty(A,"position",D({},_,{get:function(){return f},set:function(p){if(p<0||p>100)throw new Error("Position must be between 0 and 100.");f=p,this.hasBeenReset=!0}})),Object.defineProperty(A,"positionAlign",D({},_,{get:function(){return c},set:function(p){var v=M(p);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");c=v,this.hasBeenReset=!0}})),Object.defineProperty(A,"size",D({},_,{get:function(){return o},set:function(p){if(p<0||p>100)throw new Error("Size must be between 0 and 100.");o=p,this.hasBeenReset=!0}})),Object.defineProperty(A,"align",D({},_,{get:function(){return a},set:function(p){var v=M(p);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");a=v,this.hasBeenReset=!0}})),A.displayState=void 0}return R.prototype.getCueAsHTML=function(){var E=self.WebVTT;return E.convertCueToDOMTree(self,this.text)},R}()},"./src/utils/vttparser.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"parseTimeStamp",function(){return P}),L.d(z,"fixLineBreaks",function(){return w}),L.d(z,"VTTParser",function(){return T});var H=L("./src/utils/vttcue.ts"),k=function(){function A(){}var _=A.prototype;return _.decode=function(d,s){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},A}();function P(A){function _(d,s,u,l){return(d|0)*3600+(s|0)*60+(u|0)+parseFloat(l||0)}var b=A.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return b?parseFloat(b[2])>59?_(b[2],b[3],0,b[4]):_(b[1],b[2],b[3],b[4]):null}var F=function(){function A(){this.values=Object.create(null)}var _=A.prototype;return _.set=function(d,s){!this.get(d)&&s!==""&&(this.values[d]=s)},_.get=function(d,s,u){return u?this.has(d)?this.values[d]:s[u]:this.has(d)?this.values[d]:s},_.has=function(d){return d in this.values},_.alt=function(d,s,u){for(var l=0;l<u.length;++l)if(s===u[l]){this.set(d,s);break}},_.integer=function(d,s){/^-?\d+$/.test(s)&&this.set(d,parseInt(s,10))},_.percent=function(d,s){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(s)){var u=parseFloat(s);if(u>=0&&u<=100)return this.set(d,u),!0}return!1},A}();function M(A,_,b,d){var s=d?A.split(d):[A];for(var u in s){if(typeof s[u]!="string")continue;var l=s[u].split(b);if(l.length!==2)continue;var S=l[0],h=l[1];_(S,h)}}var D=new H.default(0,0,""),R=D.align==="middle"?"middle":"center";function E(A,_,b){var d=A;function s(){var S=P(A);if(S===null)throw new Error("Malformed timestamp: "+d);return A=A.replace(/^[^\sa-zA-Z-]+/,""),S}function u(S,h){var g=new F;M(S,function(f,c){var o;switch(f){case"region":for(var a=b.length-1;a>=0;a--)if(b[a].id===c){g.set(f,b[a].region);break}break;case"vertical":g.alt(f,c,["rl","lr"]);break;case"line":o=c.split(","),g.integer(f,o[0]),g.percent(f,o[0])&&g.set("snapToLines",!1),g.alt(f,o[0],["auto"]),o.length===2&&g.alt("lineAlign",o[1],["start",R,"end"]);break;case"position":o=c.split(","),g.percent(f,o[0]),o.length===2&&g.alt("positionAlign",o[1],["start",R,"end","line-left","line-right","auto"]);break;case"size":g.percent(f,c);break;case"align":g.alt(f,c,["start",R,"end","left","right"]);break}},/:/,/\s/),h.region=g.get("region",null),h.vertical=g.get("vertical","");var C=g.get("line","auto");C==="auto"&&D.line===-1&&(C=-1),h.line=C,h.lineAlign=g.get("lineAlign","start"),h.snapToLines=g.get("snapToLines",!0),h.size=g.get("size",100),h.align=g.get("align",R);var y=g.get("position","auto");y==="auto"&&D.position===50&&(y=h.align==="start"||h.align==="left"?0:h.align==="end"||h.align==="right"?100:50),h.position=y}function l(){A=A.replace(/^\s+/,"")}if(l(),_.startTime=s(),l(),A.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);A=A.substr(3),l(),_.endTime=s(),l(),u(A,_)}function w(A){return A.replace(/<br(?: \/)?>/gi,`
`)}var T=function(){function A(){this.state="INITIAL",this.buffer="",this.decoder=new k,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var _=A.prototype;return _.parse=function(d){var s=this;d&&(s.buffer+=s.decoder.decode(d,{stream:!0}));function u(){var y=s.buffer,f=0;for(y=w(y);f<y.length&&y[f]!=="\r"&&y[f]!==`
`;)++f;var c=y.substr(0,f);return y[f]==="\r"&&++f,y[f]===`
`&&++f,s.buffer=y.substr(f),c}function l(y){M(y,function(f,c){},/:/)}try{var S="";if(s.state==="INITIAL"){if(!/\r\n|\n/.test(s.buffer))return this;S=u();var h=S.match(/^()?WEBVTT([ \t].*)?$/);if(!h||!h[0])throw new Error("Malformed WebVTT signature.");s.state="HEADER"}for(var g=!1;s.buffer;){if(!/\r\n|\n/.test(s.buffer))return this;g?g=!1:S=u();switch(s.state){case"HEADER":/:/.test(S)?l(S):S||(s.state="ID");continue;case"NOTE":S||(s.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(S)){s.state="NOTE";break}if(!S)continue;if(s.cue=new H.default(0,0,""),s.state="CUE",S.indexOf("-->")===-1){s.cue.id=S;continue}case"CUE":if(!s.cue){s.state="BADCUE";continue}try{E(S,s.cue,s.regionList)}catch(y){s.cue=null,s.state="BADCUE";continue}s.state="CUETEXT";continue;case"CUETEXT":{var C=S.indexOf("-->")!==-1;if(!S||C&&(g=!0)){s.oncue&&s.cue&&s.oncue(s.cue),s.cue=null,s.state="ID";continue}if(s.cue===null)continue;s.cue.text&&(s.cue.text+=`
`),s.cue.text+=S}continue;case"BADCUE":S||(s.state="ID")}}}catch(y){s.state==="CUETEXT"&&s.cue&&s.oncue&&s.oncue(s.cue),s.cue=null,s.state=s.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},_.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(s){d.onparsingerror&&d.onparsingerror(s)}return d.onflush&&d.onflush(),this},A}()},"./src/utils/webvtt-parser.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"generateCueId",function(){return T}),L.d(z,"parseWebVTT",function(){return _});var H=L("./src/polyfills/number.ts"),k=L("./src/utils/vttparser.ts"),P=L("./src/demux/id3.ts"),F=L("./src/utils/timescale-conversion.ts"),M=L("./src/remux/mp4-remuxer.ts"),D=/\r\n|\n\r|\n|\r/g,R=function(d,s,u){return u===void 0&&(u=0),d.substr(u,s.length)===s},E=function(d){var s=parseInt(d.substr(-3)),u=parseInt(d.substr(-6,2)),l=parseInt(d.substr(-9,2)),S=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(H.isFiniteNumber)(s)||!Object(H.isFiniteNumber)(u)||!Object(H.isFiniteNumber)(l)||!Object(H.isFiniteNumber)(S))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return s+=1e3*u,s+=60*1e3*l,s+=60*60*1e3*S,s},w=function(d){for(var s=5381,u=d.length;u;)s=s*33^d.charCodeAt(--u);return(s>>>0).toString()};function T(b,d,s){return w(b.toString())+w(d.toString())+w(s)}var A=function(d,s,u){var l=d[s],S=d[l.prevCC];if(!S||!S.new&&l.new){d.ccOffset=d.presentationOffset=l.start,l.new=!1;return}for(;(h=S)!==null&&h!==void 0&&h.new;){var h;d.ccOffset+=l.start-S.start,l.new=!1,l=S,S=d[l.prevCC]}d.presentationOffset=u};function _(b,d,s,u,l,S,h,g){var C=new k.VTTParser,y=Object(P.utf8ArrayToStr)(new Uint8Array(b)).trim().replace(D,`
`).split(`
`),f=[],c=Object(F.toMpegTsClockFromTimescale)(d,s),o="00:00.000",a=0,m=0,p,v=!0,O=!1;C.oncue=function(U){var j=u[l],G=u.ccOffset,B=(a-c)/9e4;if(j!=null&&j.new&&(m!==void 0?G=u.ccOffset=j.start:A(u,l,B)),B&&(G=B-u.presentationOffset),O){var N=U.endTime-U.startTime,V=Object(M.normalizePts)((U.startTime+G-m)*9e4,S*9e4)/9e4;U.startTime=V,U.endTime=V+N}var $=U.text.trim();U.text=decodeURIComponent(encodeURIComponent($)),U.id||(U.id=T(U.startTime,U.endTime,$)),U.endTime>0&&f.push(U)},C.onparsingerror=function(U){p=U},C.onflush=function(){if(p){g(p);return}h(f)},y.forEach(function(U){if(v)if(R(U,"X-TIMESTAMP-MAP=")){v=!1,O=!0,U.substr(16).split(",").forEach(function(j){R(j,"LOCAL:")?o=j.substr(6):R(j,"MPEGTS:")&&(a=parseInt(j.substr(7)))});try{m=E(o)/1e3}catch(j){O=!1,p=j}return}else U===""&&(v=!1);C.parse(U+`
`)}),C.flush()}},"./src/utils/xhr-loader.ts":function(re,z,L){"use strict";L.r(z);var H=L("./src/utils/logger.ts"),k=L("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,F=function(){function M(R){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=R?R.xhrSetup:null,this.stats=new k.LoadStats,this.retryDelay=0}var D=M.prototype;return D.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},D.abortInternal=function(){var E=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),E&&(E.onreadystatechange=null,E.onprogress=null,E.readyState!==4&&(this.stats.aborted=!0,E.abort()))},D.abort=function(){var E;this.abortInternal(),(E=this.callbacks)!==null&&E!==void 0&&E.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},D.load=function(E,w,T){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=E,this.config=w,this.callbacks=T,this.retryDelay=w.retryDelay,this.loadInternal()},D.loadInternal=function(){var E=this.config,w=this.context;if(!E)return;var T=this.loader=new self.XMLHttpRequest,A=this.stats;A.loading.first=0,A.loaded=0;var _=this.xhrSetup;try{if(_)try{_(T,w.url)}catch(s){T.open("GET",w.url,!0),_(T,w.url)}T.readyState||T.open("GET",w.url,!0);var b=this.context.headers;if(b)for(var d in b)T.setRequestHeader(d,b[d])}catch(s){this.callbacks.onError({code:T.status,text:s.message},w,T);return}w.rangeEnd&&T.setRequestHeader("Range","bytes="+w.rangeStart+"-"+(w.rangeEnd-1)),T.onreadystatechange=this.readystatechange.bind(this),T.onprogress=this.loadprogress.bind(this),T.responseType=w.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),E.timeout),T.send()},D.readystatechange=function(){var E=this.context,w=this.loader,T=this.stats;if(!E||!w)return;var A=w.readyState,_=this.config;if(T.aborted)return;if(A>=2)if(self.clearTimeout(this.requestTimeout),T.loading.first===0&&(T.loading.first=Math.max(self.performance.now(),T.loading.start)),A===4){w.onreadystatechange=null,w.onprogress=null;var b=w.status;if(b>=200&&b<300){T.loading.end=Math.max(self.performance.now(),T.loading.first);var d,s;if(E.responseType==="arraybuffer"?(d=w.response,s=d.byteLength):(d=w.responseText,s=d.length),T.loaded=T.total=s,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(T,E,d,w),!this.callbacks)return;var l={url:w.responseURL,data:d};this.callbacks.onSuccess(l,T,E,w)}else T.retry>=_.maxRetry||b>=400&&b<499?(H.logger.error(b+" while loading "+E.url),this.callbacks.onError({code:b,text:w.statusText},E,w)):(H.logger.warn(b+" while loading "+E.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,_.maxRetryDelay),T.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),_.timeout)},D.loadtimeout=function(){H.logger.warn("timeout while loading "+this.context.url);var E=this.callbacks;E&&(this.abortInternal(),E.onTimeout(this.stats,this.context,this.loader))},D.loadprogress=function(E){var w=this.stats;w.loaded=E.loaded,E.lengthComputable&&(w.total=E.total)},D.getCacheAge=function(){var E=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var w=this.loader.getResponseHeader("age");E=w?parseFloat(w):null}return E},M}();z.default=F}}).default})},vHTk:function(ut,$e,J){ut.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wMS7:function(ut,$e,J){/*! @license DOMPurify | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.0.8/LICENSE */(function(re,z){ut.exports=z()})(this,function(){"use strict";function re(Te){if(Array.isArray(Te)){for(var pe=0,Ae=Array(Te.length);pe<Te.length;pe++)Ae[pe]=Te[pe];return Ae}else return Array.from(Te)}var z=Object.hasOwnProperty,L=Object.setPrototypeOf,H=Object.isFrozen,k=Object.keys,P=Object.freeze,F=Object.seal,M=Object.create,D=typeof Reflect!="undefined"&&Reflect,R=D.apply,E=D.construct;R||(R=function(pe,Ae,Ce){return pe.apply(Ae,Ce)}),P||(P=function(pe){return pe}),F||(F=function(pe){return pe}),E||(E=function(pe,Ae){return new(Function.prototype.bind.apply(pe,[null].concat(re(Ae))))});var w=f(Array.prototype.forEach),T=f(Array.prototype.indexOf),A=f(Array.prototype.join),_=f(Array.prototype.pop),b=f(Array.prototype.push),d=f(Array.prototype.slice),s=f(String.prototype.toLowerCase),u=f(String.prototype.match),l=f(String.prototype.replace),S=f(String.prototype.indexOf),h=f(String.prototype.trim),g=f(RegExp.prototype.test),C=c(RegExp),y=c(TypeError);function f(Te){return function(pe){for(var Ae=arguments.length,Ce=Array(Ae>1?Ae-1:0),we=1;we<Ae;we++)Ce[we-1]=arguments[we];return R(Te,pe,Ce)}}function c(Te){return function(){for(var pe=arguments.length,Ae=Array(pe),Ce=0;Ce<pe;Ce++)Ae[Ce]=arguments[Ce];return E(Te,Ae)}}function o(Te,pe){L&&L(Te,null);for(var Ae=pe.length;Ae--;){var Ce=pe[Ae];if(typeof Ce=="string"){var we=s(Ce);we!==Ce&&(H(pe)||(pe[Ae]=we),Ce=we)}Te[Ce]=!0}return Te}function a(Te){var pe=M(null),Ae=void 0;for(Ae in Te)R(z,Te,[Ae])&&(pe[Ae]=Te[Ae]);return pe}var m=P(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),p=P(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","audio","canvas","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","video","view","vkern"]),v=P(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),O=P(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),U=P(["#text"]),j=P(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns"]),G=P(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),B=P(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),N=P(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),V=F(/\{\{[\s\S]*|[\s\S]*\}\}/gm),$=F(/<%[\s\S]*|[\s\S]*%>/gm),ie=F(/^data-[\-\w.\u00B7-\uFFFF]/),oe=F(/^aria-[\-\w]+$/),_e=F(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),fe=F(/^(?:\w+script|data):/i),Se=F(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),be=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Te){return typeof Te}:function(Te){return Te&&typeof Symbol=="function"&&Te.constructor===Symbol&&Te!==Symbol.prototype?"symbol":typeof Te};function me(Te){if(Array.isArray(Te)){for(var pe=0,Ae=Array(Te.length);pe<Te.length;pe++)Ae[pe]=Te[pe];return Ae}else return Array.from(Te)}var le=function(){return typeof window=="undefined"?null:window},ue=function(pe,Ae){if((typeof pe=="undefined"?"undefined":be(pe))!=="object"||typeof pe.createPolicy!="function")return null;var Ce=null,we="data-tt-policy-suffix";Ae.currentScript&&Ae.currentScript.hasAttribute(we)&&(Ce=Ae.currentScript.getAttribute(we));var Be="dompurify"+(Ce?"#"+Ce:"");try{return pe.createPolicy(Be,{createHTML:function(je){return je}})}catch(Qe){return console.warn("TrustedTypes policy "+Be+" could not be created."),null}};function Ee(){var Te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:le(),pe=function(ve){return Ee(ve)};if(pe.version="2.0.15",pe.removed=[],!Te||!Te.document||Te.document.nodeType!==9)return pe.isSupported=!1,pe;var Ae=Te.document,Ce=!1,we=Te.document,Be=Te.DocumentFragment,Qe=Te.HTMLTemplateElement,je=Te.Node,De=Te.NodeFilter,Pe=Te.NamedNodeMap,Le=Pe===void 0?Te.NamedNodeMap||Te.MozNamedAttrMap:Pe,Re=Te.Text,Ue=Te.Comment,We=Te.DOMParser,ke=Te.trustedTypes;if(typeof Qe=="function"){var Ke=we.createElement("template");Ke.content&&Ke.content.ownerDocument&&(we=Ke.content.ownerDocument)}var ze=ue(ke,Ae),ge=ze&&kt?ze.createHTML(""):"",Ye=we,He=Ye.implementation,xe=Ye.createNodeIterator,Ie=Ye.getElementsByTagName,se=Ye.createDocumentFragment,te=Ae.importNode,ee=a(we).documentMode?we.documentMode:{},Y={};pe.isSupported=He&&typeof He.createHTMLDocument!="undefined"&&ee!==9;var Q=V,Z=$,q=ie,de=oe,ye=fe,Me=Se,et=_e,qe=null,at=o({},[].concat(me(m),me(p),me(v),me(O),me(U))),gt=null,yt=o({},[].concat(me(j),me(G),me(B),me(N))),st=null,_t=null,xt=!0,Bt=!0,Dt=!1,pt=!1,Nt=!1,rr=!1,Gt=!1,Vt=!1,Xt=!1,Pr=!1,Ht=!1,kt=!1,jt=!0,Ot=!0,tt=!1,Yt={},Nr=o({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","plaintext","script","style","svg","template","thead","title","video","xmp"]),fr=null,St=o({},["audio","video","img","source","image","track"]),hr=null,gr=o({},["alt","class","for","id","label","name","pattern","placeholder","summary","title","value","style","xmlns"]),nr=null,Fe=we.createElement("form"),dt=function(ve){if(nr&&nr===ve)return;(!ve||(typeof ve=="undefined"?"undefined":be(ve))!=="object")&&(ve={}),ve=a(ve),qe="ALLOWED_TAGS"in ve?o({},ve.ALLOWED_TAGS):at,gt="ALLOWED_ATTR"in ve?o({},ve.ALLOWED_ATTR):yt,hr="ADD_URI_SAFE_ATTR"in ve?o(a(gr),ve.ADD_URI_SAFE_ATTR):gr,fr="ADD_DATA_URI_TAGS"in ve?o(a(St),ve.ADD_DATA_URI_TAGS):St,st="FORBID_TAGS"in ve?o({},ve.FORBID_TAGS):{},_t="FORBID_ATTR"in ve?o({},ve.FORBID_ATTR):{},Yt="USE_PROFILES"in ve?ve.USE_PROFILES:!1,xt=ve.ALLOW_ARIA_ATTR!==!1,Bt=ve.ALLOW_DATA_ATTR!==!1,Dt=ve.ALLOW_UNKNOWN_PROTOCOLS||!1,pt=ve.SAFE_FOR_JQUERY||!1,Nt=ve.SAFE_FOR_TEMPLATES||!1,rr=ve.WHOLE_DOCUMENT||!1,Xt=ve.RETURN_DOM||!1,Pr=ve.RETURN_DOM_FRAGMENT||!1,Ht=ve.RETURN_DOM_IMPORT||!1,kt=ve.RETURN_TRUSTED_TYPE||!1,Vt=ve.FORCE_BODY||!1,jt=ve.SANITIZE_DOM!==!1,Ot=ve.KEEP_CONTENT!==!1,tt=ve.IN_PLACE||!1,et=ve.ALLOWED_URI_REGEXP||et,Nt&&(Bt=!1),Pr&&(Xt=!0),Yt&&(qe=o({},[].concat(me(U))),gt=[],Yt.html===!0&&(o(qe,m),o(gt,j)),Yt.svg===!0&&(o(qe,p),o(gt,G),o(gt,N)),Yt.svgFilters===!0&&(o(qe,v),o(gt,G),o(gt,N)),Yt.mathMl===!0&&(o(qe,O),o(gt,B),o(gt,N))),ve.ADD_TAGS&&(qe===at&&(qe=a(qe)),o(qe,ve.ADD_TAGS)),ve.ADD_ATTR&&(gt===yt&&(gt=a(gt)),o(gt,ve.ADD_ATTR)),ve.ADD_URI_SAFE_ATTR&&o(hr,ve.ADD_URI_SAFE_ATTR),Ot&&(qe["#text"]=!0),rr&&o(qe,["html","head","body"]),qe.table&&(o(qe,["tbody"]),delete st.tbody),P&&P(ve),nr=ve},_r=function(ve){b(pe.removed,{element:ve});try{ve.parentNode.removeChild(ve)}catch(nt){ve.outerHTML=ge}},vr=function(ve,nt){try{b(pe.removed,{attribute:nt.getAttributeNode(ve),from:nt})}catch(lt){b(pe.removed,{attribute:null,from:nt})}nt.removeAttribute(ve)},Ve=function(ve){var nt=void 0,lt=void 0;if(Vt)ve="<remove></remove>"+ve;else{var At=u(ve,/^[\r\n\t ]+/);lt=At&&At[0]}var Jt=ze?ze.createHTML(ve):ve;try{nt=new We().parseFromString(Jt,"text/html")}catch(Ut){}if(Ce&&o(st,["title"]),!nt||!nt.documentElement){nt=He.createHTMLDocument("");var ar=nt,Kt=ar.body;Kt.parentNode.removeChild(Kt.parentNode.firstElementChild),Kt.outerHTML=Jt}return ve&&lt&&nt.body.insertBefore(we.createTextNode(lt),nt.body.childNodes[0]||null),Ie.call(nt,rr?"html":"body")[0]};pe.isSupported&&function(){try{var ot=Ve("<x/><title>&lt;/title&gt;&lt;img&gt;");g(/<\/title/,ot.querySelector("title").innerHTML)&&(Ce=!0)}catch(ve){}}();var wr=function(ve){return xe.call(ve.ownerDocument||ve,ve,De.SHOW_ELEMENT|De.SHOW_COMMENT|De.SHOW_TEXT,function(){return De.FILTER_ACCEPT},!1)},jr=function(ve){return ve instanceof Re||ve instanceof Ue?!1:typeof ve.nodeName!="string"||typeof ve.textContent!="string"||typeof ve.removeChild!="function"||!(ve.attributes instanceof Le)||typeof ve.removeAttribute!="function"||typeof ve.setAttribute!="function"||typeof ve.namespaceURI!="string"},ct=function(ve){return(typeof je=="undefined"?"undefined":be(je))==="object"?ve instanceof je:ve&&(typeof ve=="undefined"?"undefined":be(ve))==="object"&&typeof ve.nodeType=="number"&&typeof ve.nodeName=="string"},Ct=function(ve,nt,lt){if(!Y[ve])return;w(Y[ve],function(At){At.call(pe,nt,lt,nr)})},Ur=function(ve){var nt=void 0;if(Ct("beforeSanitizeElements",ve,null),jr(ve))return _r(ve),!0;if(u(ve.nodeName,/[\u0080-\uFFFF]/))return _r(ve),!0;var lt=s(ve.nodeName);if(Ct("uponSanitizeElement",ve,{tagName:lt,allowedTags:qe}),(lt==="svg"||lt==="math")&&ve.querySelectorAll("p, br").length!==0)return _r(ve),!0;if(!qe[lt]||st[lt]){if(Ot&&!Nr[lt]&&typeof ve.insertAdjacentHTML=="function")try{var At=ve.innerHTML;ve.insertAdjacentHTML("AfterEnd",ze?ze.createHTML(At):At)}catch(Jt){}return _r(ve),!0}return lt==="noscript"&&g(/<\/noscript/i,ve.innerHTML)||lt==="noembed"&&g(/<\/noembed/i,ve.innerHTML)?(_r(ve),!0):(pt&&!ct(ve.firstElementChild)&&(!ct(ve.content)||!ct(ve.content.firstElementChild))&&g(/</g,ve.textContent)&&(b(pe.removed,{element:ve.cloneNode()}),ve.innerHTML?ve.innerHTML=l(ve.innerHTML,/</g,"&lt;"):ve.innerHTML=l(ve.textContent,/</g,"&lt;")),Nt&&ve.nodeType===3&&(nt=ve.textContent,nt=l(nt,Q," "),nt=l(nt,Z," "),ve.textContent!==nt&&(b(pe.removed,{element:ve.cloneNode()}),ve.textContent=nt)),Ct("afterSanitizeElements",ve,null),!1)},xr=function(ve,nt,lt){if(jt&&(nt==="id"||nt==="name")&&(lt in we||lt in Fe))return!1;if(!(Bt&&g(q,nt))){if(!(xt&&g(de,nt))){if(!gt[nt]||_t[nt])return!1;if(!hr[nt]){if(!g(et,l(lt,Me,""))){if(!((nt==="src"||nt==="xlink:href"||nt==="href")&&ve!=="script"&&S(lt,"data:")===0&&fr[ve])){if(!(Dt&&!g(ye,l(lt,Me,"")))){if(lt)return!1}}}}}}return!0},ht=function(ve){var nt=void 0,lt=void 0,At=void 0,Jt=void 0,ar=void 0;Ct("beforeSanitizeAttributes",ve,null);var Kt=ve.attributes;if(!Kt)return;var Ut={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:gt};for(ar=Kt.length;ar--;){nt=Kt[ar];var Ln=nt,Mr=Ln.name,Wr=Ln.namespaceURI;if(lt=h(nt.value),At=s(Mr),Ut.attrName=At,Ut.attrValue=lt,Ut.keepAttr=!0,Ut.forceKeepAttr=void 0,Ct("uponSanitizeAttribute",ve,Ut),lt=Ut.attrValue,Ut.forceKeepAttr)continue;if(At==="name"&&ve.nodeName==="IMG"&&Kt.id)Jt=Kt.id,Kt=d(Kt,[]),vr("id",ve),vr(Mr,ve),T(Kt,Jt)>ar&&ve.setAttribute("id",Jt.value);else{if(ve.nodeName==="INPUT"&&At==="type"&&lt==="file"&&Ut.keepAttr&&(gt[At]||!_t[At]))continue;Mr==="id"&&ve.setAttribute(Mr,""),vr(Mr,ve)}if(!Ut.keepAttr)continue;if(pt&&g(/\/>/i,lt)){vr(Mr,ve);continue}if(g(/svg|math/i,ve.namespaceURI)&&g(C("</("+A(k(Nr),"|")+")","i"),lt)){vr(Mr,ve);continue}Nt&&(lt=l(lt,Q," "),lt=l(lt,Z," "));var Cr=ve.nodeName.toLowerCase();if(!xr(Cr,At,lt))continue;try{Wr?ve.setAttributeNS(Wr,Mr,lt):ve.setAttribute(Mr,lt),_(pe.removed)}catch(wi){}}Ct("afterSanitizeAttributes",ve,null)},wt=function ot(ve){var nt=void 0,lt=wr(ve);for(Ct("beforeSanitizeShadowDOM",ve,null);nt=lt.nextNode();){if(Ct("uponSanitizeShadowNode",nt,null),Ur(nt))continue;nt.content instanceof Be&&ot(nt.content),ht(nt)}Ct("afterSanitizeShadowDOM",ve,null)};return pe.sanitize=function(ot,ve){var nt=void 0,lt=void 0,At=void 0,Jt=void 0,ar=void 0;if(ot||(ot="<!-->"),typeof ot!="string"&&!ct(ot)){if(typeof ot.toString!="function")throw y("toString is not a function");if(ot=ot.toString(),typeof ot!="string")throw y("dirty is not a string, aborting")}if(!pe.isSupported){if(be(Te.toStaticHTML)==="object"||typeof Te.toStaticHTML=="function"){if(typeof ot=="string")return Te.toStaticHTML(ot);if(ct(ot))return Te.toStaticHTML(ot.outerHTML)}return ot}if(Gt||dt(ve),pe.removed=[],typeof ot=="string"&&(tt=!1),!tt)if(ot instanceof je)nt=Ve("<!-->"),lt=nt.ownerDocument.importNode(ot,!0),lt.nodeType===1&&lt.nodeName==="BODY"||lt.nodeName==="HTML"?nt=lt:nt.appendChild(lt);else{if(!Xt&&!Nt&&!rr&&ot.indexOf("<")===-1)return ze&&kt?ze.createHTML(ot):ot;if(nt=Ve(ot),!nt)return Xt?null:ge}nt&&Vt&&_r(nt.firstChild);for(var Kt=wr(tt?ot:nt);At=Kt.nextNode();){if(At.nodeType===3&&At===Jt)continue;if(Ur(At))continue;At.content instanceof Be&&wt(At.content),ht(At),Jt=At}if(Jt=null,tt)return ot;if(Xt){if(Pr)for(ar=se.call(nt.ownerDocument);nt.firstChild;)ar.appendChild(nt.firstChild);else ar=nt;return Ht&&(ar=te.call(Ae,ar,!0)),ar}var Ut=rr?nt.outerHTML:nt.innerHTML;return Nt&&(Ut=l(Ut,Q," "),Ut=l(Ut,Z," ")),ze&&kt?ze.createHTML(Ut):Ut},pe.setConfig=function(ot){dt(ot),Gt=!0},pe.clearConfig=function(){nr=null,Gt=!1},pe.isValidAttribute=function(ot,ve,nt){nr||dt({});var lt=s(ot),At=s(ve);return xr(lt,At,nt)},pe.addHook=function(ot,ve){if(typeof ve!="function")return;Y[ot]=Y[ot]||[],b(Y[ot],ve)},pe.removeHook=function(ot){Y[ot]&&_(Y[ot])},pe.removeHooks=function(ot){Y[ot]&&(Y[ot]=[])},pe.removeAllHooks=function(){Y={}},pe}var Ge=Ee();return Ge})},zeoU:function(ut,$e,J){"use strict";J.r($e);var re=J("T2oS"),z=J("W9HT"),L=J("R9oj"),H=J("ECub"),k=J("sPJy"),P=J("bE4q"),F=J("9og8"),M=J("tJVT"),D=J("PpiC"),R=J("WmNS"),E=J.n(R),w=J("q1tI"),T=J.n(w),A=J("Ty5D"),_=J("9kvl"),b=J("m3rI"),d=J("BdwD"),s=J("55Ip"),u=J("G8my"),l=J.n(u),S=J("9Bee"),h=J("h+Ho"),g=J("Jtvl"),C=J.n(g),y=J("9BLJ"),f=J("WhZy"),c=J("miYZ"),o=J("tsqr"),a=J("lfxj"),m=J.n(a),p=function(Le){var Re=Le.isPrised,Ue=Le.num,We=Le.memo_id,ke=Le.container_type,Ke=Le.current_login,ze=Le.showLoginDialog,ge=Object(w.useState)(void 0),Ye=Object(M.a)(ge,2),He=Ye[0],xe=Ye[1],Ie=Object(w.useState)(void 0),se=Object(M.a)(Ie,2),te=se[0],ee=se[1];Object(w.useEffect)(function(){xe(Re),ee(Ue)},[]);function Y(){if(Ke)Object(h.w)({container_type:ke,id:We,type:He?0:1}).then(function(Q){ee(Q.praise_count),xe(!He),o.b.success(He?"\u53D6\u6D88\u70B9\u8D5E":"\u5DF2\u70B9\u8D5E")}).catch(function(Q){o.b.error(Q)});else{ze();return}}return T.a.createElement("div",{className:m.a.priseBox},T.a.createElement("span",{onClick:Y},T.a.createElement("i",{className:He?"iconfont icon-dianzan":"iconfont icon-dianzan-xian"})),T.a.createElement("span",null,te))},v=J("DjyN"),O=J("NUBc"),U=J("Mwp2"),j=J("VXEj"),G=J("oBTY"),B=J("+L6B"),N=J("2/Rp"),V=J("Ot1p");function $(Le){var Re=Le.memo_id,Ue=Le.user_image,We=Le.click_button,ke=Le.new_reply,Ke=Object(w.useState)(!1),ze=Object(M.a)(Ke,2),ge=ze[0],Ye=ze[1],He=Object(w.useState)(""),xe=Object(M.a)(He,2),Ie=xe[0],se=xe[1];function te(Q){se(Q)}function ee(){Ye(!0),Object(h.a)({parent_id:Re,content:Ie}).then(function(Q){Q&&(Q.status===0&&ke(Q.reply)),Ye(!1)}).catch(function(Q){Ye(!1),o.b.error(Q)})}function Y(){We(!1)}return T.a.createElement("div",{className:"grid-item-top pt20"},T.a.createElement("img",{src:b.a.IMG_SERVER+"/images/"+Ue,className:"user-image mr10"}),T.a.createElement("div",null,T.a.createElement(V.a,{placeholder:"\u6DFB\u52A0\u8BC4\u8BBA...",watch:!0,height:200,id:Re?"orderdetail-add-descriptions"+Re:"orderdetail-add-descriptions",onChange:te}),T.a.createElement("p",{className:"clearfix mt20"},T.a.createElement(N.a,{type:"primary",onClick:ee,loading:ge,className:"mr15 commentBtn btnSize"},"\u8BC4\u8BBA"),T.a.createElement(N.a,{className:"btnSize",onClick:Y},"\u53D6\u6D88"))))}var ie=$,oe=J("P2fV"),_e=J("NJEC");function fe(Le){var Re=Le.replies,Ue=Le.user_image,We=Le.current_login,ke=Le.reload,Ke=Le.reload_children;return T.a.createElement("div",{className:"children-memo-item"},T.a.createElement(j.b,{size:"large",header:"",dataSource:Re,renderItem:function(ge){return T.a.createElement(j.b.Item,null,T.a.createElement(Ee,{item:ge,reload_children:Ke,user_image:Ue,current_login:We,is_children:!0,reload:ke}))}}))}var Se=fe,be=function(Re){var Ue=Re.className;return T.a.createElement("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"2108",width:"200",height:"200",className:Ue},T.a.createElement("path",{d:"M174.592 886.784c-9.216 0-18.944-3.584-26.112-10.752-14.336-14.336-14.336-37.376 0-51.712L823.296 149.504c14.336-14.336 37.376-14.336 51.712 0s14.336 37.376 0 51.712L200.192 876.032c-7.168 7.168-16.384 10.752-25.6 10.752z",fill:"","p-id":"2109"}),T.a.createElement("path",{d:"M824.832 250.368c-9.216-22.016-25.088-40.448-46.08-53.76-34.816-21.504-77.312-24.576-114.176-7.168L382.464 305.152H263.168c-65.536 0-119.296 53.248-119.296 119.296v208.384c0 65.536 53.248 119.296 119.296 119.296h59.904m72.704-72.704c-2.048-0.512-4.096-0.512-6.144-0.512H263.168c-25.6 0-46.08-20.48-46.08-46.08V424.448c0-25.6 20.48-46.08 46.08-46.08h126.464c4.608 0 9.216-1.024 13.824-2.56l289.792-118.784c0.512-0.512 1.536-0.512 2.048-1.024 14.336-7.168 30.72-6.144 44.544 2.56 13.824 8.704 21.504 23.04 21.504 38.912v16.384m0 0l-365.568 365.568m365.568-262.144v342.016c0 16.384-7.68 30.208-21.504 38.912-13.824 8.704-29.696 9.728-44.544 2.56-0.512-0.512-1.536-0.512-2.048-1.024l-223.232-91.648-56.32 56.32 250.88 102.912c16.384 7.68 33.28 11.264 50.688 11.264 22.016 0 44.032-6.144 63.488-18.432 34.816-22.016 55.808-59.904 55.808-100.864V344.064",fill:"","p-id":"2110"}))},me=function(Re){var Ue=Re.className;return T.a.createElement("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"7298",width:"200",height:"200",className:Ue},T.a.createElement("path",{d:"M616.533333 156.8a53.333333 53.333333 0 0 0-48.426666-2.986667l-307.626667 137.6h-85.333333A88.533333 88.533333 0 0 0 85.333333 378.24v267.52a88.533333 88.533333 0 0 0 90.026667 86.826667h85.333333l307.626667 137.6a52.906667 52.906667 0 0 0 48.426667-2.986667A48 48 0 0 0 640 826.026667V197.973333a48 48 0 0 0-23.466667-41.173333zM578.346667 810.666667l-293.973334-132.48a52.48 52.48 0 0 0-21.333333-4.48H175.36a28.373333 28.373333 0 0 1-28.373333-27.946667V378.24a28.373333 28.373333 0 0 1 28.373333-27.946667h87.68a52.48 52.48 0 0 0 21.333333-4.48L578.346667 213.333333zM715.946667 366.506667a32 32 0 0 0-4.906667 45.013333 159.573333 159.573333 0 0 1 0 200.96 32 32 0 0 0 49.92 40.106667 223.573333 223.573333 0 0 0 0-281.173334 32 32 0 0 0-45.013333-4.906666z","p-id":"7299"}),T.a.createElement("path",{d:"M868.266667 301.44a32 32 0 1 0-51.2 38.4 286.08 286.08 0 0 1 0 344.32 32 32 0 0 0 6.4 44.8 32.426667 32.426667 0 0 0 19.2 6.4 31.786667 31.786667 0 0 0 25.6-12.8 350.08 350.08 0 0 0 0-421.12z","p-id":"7300"}))},le=J("X72a");function ue(Le){var Re,Ue,We,ke=Le.item,Ke=Le.user_image,ze=Le.current_login,ge=Le.is_children,Ye=Le.target_type,He=Le.commet_destroy,xe=Le.user,Ie=Le.reload,se=Le.reload_children,te=Le.props,ee=Object(w.useState)(!1),Y=Object(M.a)(ee,2),Q=Y[0],Z=Y[1],q=Object(w.useState)(!1),de=Object(M.a)(q,2),ye=de[0],Me=de[1],et=Object(w.useState)(!1),qe=Object(M.a)(et,2),at=qe[0],gt=qe[1],yt=Object(w.useState)([]),st=Object(M.a)(yt,2),_t=st[0],xt=st[1],Bt=Object(w.useState)(0),Dt=Object(M.a)(Bt,2),pt=Dt[0],Nt=Dt[1],rr=Object(w.useState)(1),Gt=Object(M.a)(rr,2),Vt=Gt[0],Xt=Gt[1],Pr=Object(w.useState)(!1),Ht=Object(M.a)(Pr,2),kt=Ht[0],jt=Ht[1],Ot=Object(w.useState)(0),tt=Object(M.a)(Ot,2),Yt=tt[0],Nr=tt[1],fr=Object(w.useState)(!1),St=Object(M.a)(fr,2),hr=St[0],gr=St[1],nr=Object(w.useState)(5),Fe=Object(M.a)(nr,2),dt=Fe[0],_r=Fe[1];Object(w.useEffect)(function(){xt(ke.children),ke.children?Nt(ke.children.length):Nt(0),jt(ke.user_praise),Nr(ke.praise_count)},[ke]);var vr=function(wt){if(ze)Z(wt);else{te.showLoginDialog();return}},Ve=function(wt){if(ze){var ot={container_type:"Memo",id:wt,type:kt?0:1};Object(h.w)(ot).then(function(ve){Nr(ve.praise_count),jt(!kt),o.b.success(kt?"\u53D6\u6D88\u70B9\u8D5E":"\u5DF2\u70B9\u8D5E")}).catch(function(ve){o.b.error(ve)})}else{te.showLoginDialog();return}};function wr(ht){gt(!0),Object(h.g)(ht).then(function(wt){wt&&(wt.status===0?(Me(!0),ge?Nt(pt-1):He(),o.b.success(wt.message)):o.b.error(wt.message)),gt(!1)}).catch(function(wt){gt(!1),o.b.error(wt)})}var jr=function(wt){if(ge){se(wt),Z(!1);return}_t&&_t.length>0?xt([].concat(Object(G.a)(_t),[wt])):xt([wt]),Nt(pt+1),Z(!1)},ct=function(wt){xt([].concat(Object(G.a)(_t),[wt])),Nt(pt+1)};function Ct(ht){var wt=Vt;pt<dt?(Xt(1),wt=1):(wt=Vt+1,Xt(wt)),gr(!0);var ot={page:wt,limit:dt,target_type:Ye,target_id:ht};Object(h.u)(ot).then(function(ve){ve&&ve.memo_replies&&xt(_t.concat(ve.memo_replies)),gr(!1)}).catch(function(ve){gr(!1),o.b.error(ve)})}var Ur=(Re=xe.userInfo)===null||Re===void 0?void 0:Re.admin,xr=function(){var ht=Object(F.a)(E.a.mark(function wt(ot,ve,nt){var lt;return E.a.wrap(function(Jt){for(;;)switch(Jt.prev=Jt.next){case 0:return Jt.next=2,Object(h.d)(ot,{banned:nt,user_id:ve});case 2:lt=Jt.sent,lt.status===0&&Ie();case 4:case"end":return Jt.stop()}},wt)}));return function(ot,ve,nt){return ht.apply(this,arguments)}}();return T.a.createElement("div",{className:"width100"},ye?T.a.createElement("div",{className:"pd20 edu-text-center"},"\u5DF2\u5220\u9664"):T.a.createElement("div",null,T.a.createElement("div",{className:"pb5",style:{display:"flex",alignItems:"center"}},T.a.createElement(s.a,{to:"/forums/accounts/".concat(ke&&ke.user_login,"/memos"),className:"show-user-link"},T.a.createElement("img",{className:"user-image",src:b.a.IMG_SERVER+"/images/"+ke.image_url})),T.a.createElement(s.a,{to:"/forums/accounts/".concat(ke&&ke.user_login,"/memos"),className:"show-user-link color-black ml10 fwb fs14"},ke&&ke.username),ge&&!!(ke!=null&&ke.parent_data)&&T.a.createElement(T.a.Fragment,null,T.a.createElement(le.a,{style:{marginTop:1},className:"ml5 mr5 font12"}),T.a.createElement(s.a,{to:"/forums/accounts/".concat(ke==null||((Ue=ke.parent_data)===null||Ue===void 0)?void 0:Ue.user_login,"/memos"),className:"show-user-link color-black fwb fs14"},ke==null||((We=ke.parent_data)===null||We===void 0)?void 0:We.name))),T.a.createElement("div",{className:"ml40"},ke.content&&T.a.createElement(S.a,{className:"tipsContent",value:ke.content}),T.a.createElement("div",{className:"grid-item-left mt5"},T.a.createElement("span",{className:"color-grey-8 fs14"},ke.time),T.a.createElement("div",{className:"text-right grid-item-4"},Ur&&(ke.is_banned?T.a.createElement(N.a,{className:"link-btn",type:"link",icon:T.a.createElement(me,{className:"relieve-icon mr5"}),onClick:function(){return xr(ke.id,ke.user_id,0)}},T.a.createElement("span",{className:"allow-comment"},"\u6062\u590D\u8BC4\u8BBA")):T.a.createElement(_e.a,{placement:"bottom",title:"\u786E\u5B9A\u8981\u7981\u8A00\u6B64\u7528\u6237\u5417?",okText:"\u662F",cancelText:"\u5426",onConfirm:function(){return xr(ke.id,ke.user_id,1)}},T.a.createElement(N.a,{className:"link-btn",type:"link",icon:T.a.createElement(be,{className:"ban-icon mr5"})},T.a.createElement("span",{className:"font-14 color-grey-8 ver-middle"},"\u7981\u6B62\u8BC4\u8BBA")))),ke.admin||ze===ke.user_login?T.a.createElement(_e.a,{placement:"bottom",title:"\u786E\u5B9A\u8981\u5220\u9664\u5F53\u524D\u8BC4\u8BBA\u5417?",okText:"\u662F",cancelText:"\u5426",onConfirm:function(){return wr(ke.id)}},T.a.createElement(N.a,{className:"link-btn",type:"link",loading:at},T.a.createElement("i",{className:"iconfont icon-shanchu font-14 color-grey-8 mr5 ver-middle"}),T.a.createElement("span",{className:"font-14 color-grey-8 ver-middle"},"\u5220\u9664"))):"",ge&&T.a.createElement(N.a,{onClick:function(){vr(!0)},className:"link-btn",type:"link"},T.a.createElement("i",{className:"iconfont icon-pinglun1 font-14 color-grey-8 mr5 ver-middle"}),T.a.createElement("span",{className:"font-14 color-grey-8 ver-middle"},"\u56DE\u590D")),!ge&&T.a.createElement(N.a,{type:"link",className:"link-btn ml-10",onClick:function(){Ve(ke.id)}},kt?T.a.createElement("i",{className:"iconfont icon-dianzan color-green font-14 mr5 ver-middle"}):T.a.createElement("i",{className:"iconfont icon-dianzan-xian font-14 color-grey-8 mr5 ver-middle"}),T.a.createElement("span",{className:"font-14 color-grey-8 ver-middle"},Yt)),!ge&&T.a.createElement(N.a,{type:"link",className:"link-btn ml-10",onClick:function(){vr(!0)}},T.a.createElement("i",{className:"iconfont icon-pinglun1 font-14 color-grey-8 mr5 ver-middle"}),T.a.createElement("span",{className:"font-14 color-grey-8 ver-middle"},pt)))),Q&&T.a.createElement(ie,{memo_id:ke.id,user_image:Ke,click_button:vr,new_reply:jr}),_t&&pt>0&&T.a.createElement(Se,{replies:_t,user_image:Ke,current_login:ze,reload:Ie,reload_children:ct}),ke&&_t&&ke.replies_count>pt&&ke.replies_count>=Vt*dt&&T.a.createElement("div",{className:"mt10 edu-text-center"},T.a.createElement(N.a,{loading:hr,type:"primary",className:"commentBtn btnSize",onClick:function(){return Ct(ke.id)}},"\u67E5\u770B\u66F4\u591A\u56DE\u590D")))))}var Ee=Object(_.a)(function(Le){var Re=Le.user;return{user:Re}})(ue);function Ge(Le){var Re=Le.user_image,Ue=Le.click_button,We=function(){Ue(!0)};return T.a.createElement("div",{className:"new-comment-head grid-item pd20"},T.a.createElement("img",{src:b.a.IMG_SERVER+"/images/"+Re,className:"user-image"}),T.a.createElement("span",{className:"reply-comment-input mr20"},T.a.createElement(N.a,{className:"add_reply_button ml10",onClick:We},T.a.createElement("span",null,"\u6DFB\u52A0\u8BC4\u8BBA..."))))}var Te=Ge,pe=J("FdIy");function Ae(Le){var Re=Le.target_id,Ue=Le.target_type,We=Le.current_user_image,ke=Le.current_login,Ke=Object(D.a)(Le,["target_id","target_type","current_user_image","current_login"]),ze=Object(w.useState)(null),ge=Object(M.a)(ze,2),Ye=ge[0],He=ge[1],xe=Object(w.useState)([]),Ie=Object(M.a)(xe,2),se=Ie[0],te=Ie[1],ee=Object(w.useState)(0),Y=Object(M.a)(ee,2),Q=Y[0],Z=Y[1],q=Object(w.useState)(!1),de=Object(M.a)(q,2),ye=de[0],Me=de[1],et=Object(w.useState)(1),qe=Object(M.a)(et,2),at=qe[0],gt=qe[1],yt=Object(w.useState)(10),st=Object(M.a)(yt,2),_t=st[0],xt=st[1],Bt=Object(w.useState)(!1),Dt=Object(M.a)(Bt,2),pt=Dt[0],Nt=Dt[1],rr=function(){Me(!0);var kt={target_type:Ue,target_id:Re,page:at,limit:_t};Object(h.u)(kt).then(function(jt){jt&&jt.memo_replies&&(te(jt.memo_replies),Z(jt.memos_count)),Me(!1)}).catch(function(jt){Me(!1),o.b.error(jt)})};Object(w.useEffect)(function(){rr()},[at,Re]),Object(w.useEffect)(function(){He(We||"/images/avatars/User/boy.jpg")},[]);function Gt(Ht){gt(Ht)}var Vt=function(kt){if(ke)Nt(kt);else{Ke.showLoginDialog();return}},Xt=function(kt){var jt=Q+1;Z(jt),te([kt].concat(Object(G.a)(se))),Nt(!1)},Pr=function(kt){var jt=Q-1;Z(jt)};return T.a.createElement("div",null,T.a.createElement("div",{className:"b-bottom-none title"},T.a.createElement("span",{className:"greenLiftLine"},"\u8BC4\u8BBA",Q>0&&T.a.createElement("span",{className:"tip_tag"},Q))),T.a.createElement(z.a,{spinning:ye},T.a.createElement("div",{className:"comments-lists"},pt?T.a.createElement(ie,{click_button:Vt,memo_id:Re,user_image:Ye,new_reply:Xt}):T.a.createElement(Te,{user_image:Ye,click_button:Vt}),se&&se.length>0&&T.a.createElement(j.b,{size:"large",loading:ye,header:"",dataSource:se,renderItem:function(kt){return T.a.createElement(j.b.Item,null,T.a.createElement(Ee,{item:kt,user_image:Ye,current_login:ke,reload:rr,is_children:!1,target_type:Ue,commet_destroy:Pr,props:Ke}))}}),Q>_t&&T.a.createElement("div",{className:"edu-text-center pd20"},T.a.createElement(O.a,{showQuickJumper:!0,current:at,onChange:Gt,total:Q,pageSize:_t})))))}var Ce=Ae,we=J("6S+g"),Be=J("hLB0"),Qe=function(Le){var Re=Le.user;Object(w.useEffect)(function(){Re&&Ke(Re.watchers_count)},[]);var Ue=Object(w.useState)(0),We=Object(M.a)(Ue,2),ke=We[0],Ke=We[1],ze=function(Ye){var He=ke+Ye;Ke(He)};return T.a.createElement("div",{className:"whiteBack authorCard"},T.a.createElement("a",{href:"/forums/accounts/".concat(Re&&Re.login,"/memos")},T.a.createElement("span",{className:"kvFNwe"},T.a.createElement("img",{src:b.a.IMG_SERVER+"/images/"+(Re&&Re.image_url),alt:""}),T.a.createElement("span",{className:"task-hide",style:{maxWidth:"84px",textAlign:"center"}},Re&&Re.username))),T.a.createElement("p",{style:{width:"100%",fontSize:"14px"},className:"task-hide grey-8 mt10 mb15 edu-text-center"},Re&&Re.description?Re.description:"\u8FD9\u5BB6\u4F19\u592A\u61D2\u4E86\uFF0C\u8FD8\u672A\u586B\u5199\u4E2A\u4EBA\u63CF\u8FF0\uFF01"),T.a.createElement("div",{className:"Grid mt20"},T.a.createElement("span",{className:"UDStructure"},T.a.createElement("span",null,Re&&Re.memos_count),T.a.createElement("span",null,"\u6587\u7AE0\u6570")),T.a.createElement("span",{className:"UDStructure"},T.a.createElement("span",null,Re&&Re.replies_count),T.a.createElement("span",null,"\u8BC4\u8BBA\u6570")),T.a.createElement("span",{className:"UDStructure"},T.a.createElement("span",null,ke),T.a.createElement("span",null,"\u5173\u6CE8\u8005"))))},je=J("sNeV"),De=function(Re){var Ue,We=Re.globalSetting,ke=Re.loading,Ke=Re.user,ze=Re.dispatch,ge=Object(D.a)(Re,["globalSetting","loading","user","dispatch"]),Ye=Object(A.i)(),He=Ye.memoId,xe=Ke.userInfo,Ie=Object(w.useState)(null),se=Object(M.a)(Ie,2),te=se[0],ee=se[1],Y=Object(w.useState)(null),Q=Object(M.a)(Y,2),Z=Q[0],q=Q[1],de=Object(w.useState)([]),ye=Object(M.a)(de,2),Me=ye[0],et=ye[1],qe=Object(w.useState)(null),at=Object(M.a)(qe,2),gt=at[0],yt=at[1],st=Object(w.useState)([]),_t=Object(M.a)(st,2),xt=_t[0],Bt=_t[1],Dt=Object(w.useState)(void 0),pt=Object(M.a)(Dt,2),Nt=pt[0],rr=pt[1],Gt=Object(w.useState)(!1),Vt=Object(M.a)(Gt,2),Xt=Vt[0],Pr=Vt[1],Ht=Object(w.useState)(1),kt=Object(M.a)(Ht,2),jt=kt[0],Ot=kt[1],tt=Object(w.useState)(5),Yt=Object(M.a)(tt,2),Nr=Yt[0],fr=Yt[1],St=Object(w.useState)(!1),hr=Object(M.a)(St,2),gr=hr[0],nr=hr[1],Fe=Object(w.useState)({}),dt=Object(M.a)(Fe,2),_r=dt[0],vr=dt[1];Object(w.useEffect)(function(){Ve(),jr()},[He]);function Ve(){return wr.apply(this,arguments)}function wr(){return wr=Object(F.a)(E.a.mark(function Ct(){return E.a.wrap(function(xr){for(;;)switch(xr.prev=xr.next){case 0:nr(!0),Object(h.j)({memo_id:He}).then(function(ht){if(ht){var wt={admin:ht&&ht.is_current_admin,login:ht&&ht.current_login,banned_permission:ht.banned_permission,is_currentUser:ht.author_info?ht.author_info.is_current_user:void 0,is_fine:ht.memo&&ht.memo.is_fine,sticky:ht.memo&&ht.memo.sticky,memo_watched:ht.memo&&ht.memo.memo_watched,is_deleted:ht.memo&&ht.memo.apply_destroy};rr(wt),ee(ht.memo),yt(ht.memo_image_info),Bt(ht.recent_memos),Pr(ht.is_banned),q(ht.author_info)}nr(!1)}).catch(function(ht){nr(!1),console.log(ht)});case 2:case"end":return xr.stop()}},Ct)})),wr.apply(this,arguments)}function jr(){Object(h.s)({memo_id:He}).then(function(Ct){Ct&&et(Ct.memos),nr(!1)}).catch(function(Ct){nr(!1),console.log(Ct)})}function ct(){var Ct;window.location.href=We==null||((Ct=We.setting)===null||Ct===void 0)?void 0:Ct.sso_url}return T.a.createElement("div",{className:l.a.educontent},T.a.createElement(z.a,{spinning:gr},te&&Z?T.a.createElement("div",null,T.a.createElement(P.a,{separator:">",style:{marginBottom:"10px"}},T.a.createElement(P.a.Item,null,T.a.createElement(s.a,{to:"/forums"},"\u8BBA\u575B")),te&&te.forum_tag&&te.forum_tag.id&&T.a.createElement(P.a.Item,null,T.a.createElement(s.a,{to:"/forums/subject/".concat(te&&te.forum_tag.id)},te&&te.forum_tag.title)),T.a.createElement(P.a.Item,null,te?te.subject:"\u5E16\u5B50\u8BE6\u60C5")),T.a.createElement("div",{className:l.a.box},T.a.createElement("div",{className:l.a.long},T.a.createElement("div",{className:l.a.whiteBack},T.a.createElement("div",{style:{padding:"0px 30px"}},T.a.createElement("div",{className:"".concat(l.a.gMAmTc," ").concat(l.a.headerInfo)},T.a.createElement("div",{className:l.a.headerInfoLeft},T.a.createElement("span",{className:te.tag_name=="\u4EA4\u6D41"?l.a.blue:l.a.tag_Orange},"\u3010",te.tag_name,"\u3011"),T.a.createElement("p",{className:l.a.titleStyle},te&&te.subject),te.sticky===!0?T.a.createElement("span",{className:"".concat(l.a.tag," ").concat(l.a.tagRed)},"\u7F6E\u9876"):"",te.is_fine===!0?T.a.createElement("span",{className:"".concat(l.a.tag," ").concat(l.a.tagBlue)},"\u7CBE\u534E"):""),T.a.createElement("div",{style:{width:"130px",textAlign:"right"}},xe&&xe.login?T.a.createElement(je.a,{permission:Nt,id:He,calbackFunc:Ve}):""),te&&te.is_original&&T.a.createElement("img",{src:C.a,className:l.a.originalTag,width:"80px"})),T.a.createElement("div",{className:l.a.kTLhbM,style:{padding:"15px 0"}},T.a.createElement("a",{href:"/forums/accounts/".concat(Z.login,"/memos")},T.a.createElement("span",{className:l.a.igfjXB},T.a.createElement("img",{src:b.a.IMG_SERVER+"/images/"+Z.image_url,alt:""}),T.a.createElement("span",{className:l.a.taskHide},Z.username))),T.a.createElement("span",{className:l.a.iconWrap},T.a.createElement(y.a,null),T.a.createElement("span",{className:"span-text"},te&&te.viewed_count)),T.a.createElement("span",{className:l.a.iconWrap},T.a.createElement(f.a,null),T.a.createElement("span",{className:"span-text"},te&&te.replies_count)),T.a.createElement("span",{className:"grey-8 ml20"},te&&te.published_time),te&&te.apply_destroy&&T.a.createElement("span",{style:{marginLeft:"20px",color:"#fa6400"}},"\u5DF2\u7533\u8BF7\u5220\u5E16")),T.a.createElement("div",{className:l.a.content},gt&&T.a.createElement("div",{style:{paddingBottom:"20px"}},T.a.createElement("img",{src:b.a.IMG_SERVER+gt.url,style:{width:"100%"}})),T.a.createElement(S.a,{style:{textAlign:"justify",wordBreak:"break-all"},value:te.content}),T.a.createElement("div",{className:l.a.row},te.attachment_url&&te.attachment_url.length>0&&((Ue=te.attachment_url)===null||Ue===void 0?void 0:Ue.map(function(Ct){return T.a.createElement("a",{key:Ct.id,target:"_blank",href:Ct.url},T.a.createElement("i",{className:"iconfont icon-fujian font14 mr10"}),T.a.createElement("span",{className:"mr10"},Ct.title),T.a.createElement("span",null,Ct.filesize))})))),te.reprint_link&&T.a.createElement("p",{style:{fontSize:"12px",color:"#888"}},"\u8F6C\u8F7D\u81EA\uFF1A",te.reprint_link),T.a.createElement(p,{isPrised:te.user_praise,num:te.praises_count,memo_id:te.id,container_type:"Memo",current_login:Z&&Z.current_login,showLoginDialog:ct}))),T.a.createElement("div",{className:"".concat(l.a.whiteBack," ").concat(l.a.mt15)},T.a.createElement(Ce,{target_id:te&&te.id,target_type:"memos",current_user_image:Z&&Z.current_image_url,current_login:Z&&Z.current_login,showLoginDialog:ct})),Me&&Me.length>0&&T.a.createElement("div",{className:"".concat(l.a.whiteBack," ").concat(l.a.mt15)},T.a.createElement("div",{className:l.a.title},T.a.createElement("span",{className:l.a.greenLiftLine},"\u76F8\u5173\u63A8\u8350")),T.a.createElement(we.a,{memos:Me,calbackFunc:jr}))),T.a.createElement("div",{className:l.a.Short},T.a.createElement(Qe,{user:Z}),T.a.createElement("div",{className:"".concat(l.a.whiteBack," ").concat(l.a.mt15)},T.a.createElement("div",{className:l.a.title},T.a.createElement("span",null,"\u4F5C\u8005\u6700\u8FD1\u6587\u7AE0"),T.a.createElement("a",{style:{fontSize:"12px",color:"#999"},href:"/forums/accounts/".concat(Z&&Z.login,"/memos")},"\u66F4\u591A",T.a.createElement("i",{className:"iconfont icon-youjiantou ml5",style:{fontSize:"12px"}}))),T.a.createElement("div",{className:"memo-detail-ul"},T.a.createElement("ul",{className:l.a.BestUl},xt&&xt.length>0?xt.map(function(Ct){return T.a.createElement("li",{key:Ct.id},T.a.createElement("a",{href:"/forums/".concat(Ct.id)},Ct.subject))}):T.a.createElement(d.a,{customText:"\u6682\u65E0\u63A8\u8350"}))))))):T.a.createElement(H.a,{image:H.a.PRESENTED_IMAGE_SIMPLE,style:{padding:"200px"}})))},Pe=$e.default=Object(_.a)(function(Le){var Re=Le.loading,Ue=Le.user,We=Le.globalSetting;return{globalSetting:We,loading:Re.effects,user:Ue}})(De)}}]);