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.
139 lines
760 KiB
139 lines
760 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[143,5,7,8],{"+NIl":function(it,Je,J){(function(re){re(J("VrN/"))})(function(re){"use strict";re.defineMode("stex",function(z,L){"use strict";function H(A,w){A.cmdState.push(w)}function k(A){return A.cmdState.length>0?A.cmdState[A.cmdState.length-1]:null}function M(A){var w=A.cmdState.pop();w&&w.closeBracket()}function F(A){for(var w=A.cmdState,b=w.length-1;b>=0;b--){var d=w[b];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function P(A,w,b){return function(){this.name=A,this.bracketNo=0,this.style=w,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=P("importmodule","tag",["string","builtin"]),D.documentclass=P("documentclass","tag",["","atom"]),D.usepackage=P("usepackage","tag",["atom"]),D.begin=P("begin","tag",["atom"]),D.end=P("end","tag",["atom"]),D.label=P("label","tag",["atom"]),D.ref=P("ref","tag",["atom"]),D.eqref=P("eqref","tag",["atom"]),D.cite=P("cite","tag",["atom"]),D.bibitem=P("bibitem","tag",["atom"]),D.Bibitem=P("Bibitem","tag",["atom"]),D.RBibitem=P("RBibitem","tag",["atom"]),D.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function O(A,w){A.f=w}function E(A,w){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(w,b),O(w,T),b.style}if(A.match(/^\\[$&%#{}_]/))return"tag";if(A.match(/^\\[,;!\/\\]/))return"tag";if(A.match("\\["))return O(w,function(u,l){return _(u,l,"\\]")}),"keyword";if(A.match("\\("))return O(w,function(u,l){return _(u,l,"\\)")}),"keyword";if(A.match("$$"))return O(w,function(u,l){return _(u,l,"$$")}),"keyword";if(A.match("$"))return O(w,function(u,l){return _(u,l,"$")}),"keyword";var o=A.next();if(o=="%")return A.skipToEnd(),"comment";if(o=="}"||o=="]"){if(b=k(w),b)b.closeBracket(o),O(w,T);else return"error";return"bracket"}else return o=="{"||o=="["?(b=D.DEFAULT,b=new b,H(w,b),"bracket"):/\d/.test(o)?(A.eatWhile(/[\w.%]/),"atom"):(A.eatWhile(/[\w\-_]/),b=F(w),b.name=="begin"&&(b.argument=A.current()),b.styleIdentifier())}function _(A,w,b){if(A.eatSpace())return null;if(b&&A.match(b))return O(w,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,w){var b=A.peek(),d;return b=="{"||b=="["?(d=k(w),d.openBracket(b),A.eat(b),O(w,E),"bracket"):/[ \t\r]/.test(b)?(A.eat(b),null):(O(w,E),M(w),E(A,w))}return{startState:function(){var A=L.inMathMode?function(w,b){return _(w,b)}:E;return{cmdState:[],f:A}},copyState:function(A){return{cmdState:A.cmdState.slice(),f:A.f}},token:function(A,w){return w.f(A,w)},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(it,Je,J){(function(re){re(J("VrN/"))})(function(re){re.defineOption("placeholder","",function(P,D,O){var E=O&&O!=re.Init;if(D&&!E)P.on("blur",k),P.on("change",M),P.on("swapDoc",M),re.on(P.getInputField(),"compositionupdate",P.state.placeholderCompose=function(){H(P)}),M(P);else if(!D&&E){P.off("blur",k),P.off("change",M),P.off("swapDoc",M),re.off(P.getInputField(),"compositionupdate",P.state.placeholderCompose),z(P);var _=P.getWrapperElement();_.className=_.className.replace(" CodeMirror-empty","")}D&&!P.hasFocus()&&k(P)});function z(P){P.state.placeholder&&(P.state.placeholder.parentNode.removeChild(P.state.placeholder),P.state.placeholder=null)}function L(P){z(P);var D=P.state.placeholder=document.createElement("pre");D.style.cssText="height: 0; overflow: visible",D.style.direction=P.getOption("direction"),D.className="CodeMirror-placeholder CodeMirror-line-like";var O=P.getOption("placeholder");typeof O=="string"&&(O=document.createTextNode(O)),D.appendChild(O),P.display.lineSpace.insertBefore(D,P.display.lineSpace.firstChild)}function H(P){setTimeout(function(){var D=!1,O=P.getInputField();O.nodeName=="TEXTAREA"?D=!O.value:P.lineCount()==1&&(D=!/[^\u200b]/.test(O.querySelector(".CodeMirror-line").textContent)),D?L(P):z(P)},20)}function k(P){F(P)&&L(P)}function M(P){var D=P.getWrapperElement(),O=F(P);D.className=D.className.replace(" CodeMirror-empty","")+(O?" CodeMirror-empty":""),O?L(P):z(P)}function F(P){return P.lineCount()===1&&P.getLine(0)===""}})},"1eCo":function(it,Je,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 M=H.indentUnit,F={},P=k.htmlMode?z:L;for(var D in P)F[D]=P[D];for(var D in k)F[D]=k[D];var O,E;function _(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(w("atom","]]>")):null:a.match("--")?p(w("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),p(b(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),m.tokenize=w("meta","?>"),"meta"):(O=a.eat("/")?"closeTag":"openTag",m.tokenize=T,"tag bracket");if(v=="&"){var R;return a.eat("#")?a.eat("x")?R=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):R=a.eatWhile(/[\d]/)&&a.eat(";"):R=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),R?"atom":"error"}else return a.eatWhile(/[^&<]/),null}_.isInText=!0;function T(a,m){var p=a.next();if(p==">"||p=="/"&&a.eat(">"))return m.tokenize=_,O=p==">"?"endTag":"selfcloseTag","tag bracket";if(p=="=")return O="equals",null;if(p=="<"){m.tokenize=_,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 w(a,m){return function(p,v){for(;!p.eol();){if(p.match(m)){v.tokenize=_;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=_;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 o(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;o(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)&&o(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):(o(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,R=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,R==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"?s:a=="word"&&F.allowUnquoted?(E="string",y):(E="error",y(a,m,p))}function s(a,m,p){return a=="string"?s:y(a,m,p)}return{startState:function(a){var m={tokenize:_,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;O=null;var p=m.tokenize(a,m);return(p||O)&&p!="comment"&&(E=null,m.state=m.state(O||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+M;if(v&&v.noIndent)return re.Pass;if(a.tokenize!=T&&a.tokenize!=_)return p?p.match(/^(\s*)/)[0].length:0;if(a.tagName)return F.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+M*(F.multilineTagIndentFactor||1);if(F.alignCDATA&&/<!\[CDATA\[/.test(m))return 0;var R=m&&/^<(\/)?([\w_:\.-]*)/.exec(m);if(R&&R[1])for(;v;)if(v.tagName==R[2]){v=v.prev;break}else if(F.implicitlyClosed.hasOwnProperty(v.tagName))v=v.prev;else break;else if(R)for(;v;){var U=F.contextGrabbers[v.tagName];if(U&&U.hasOwnProperty(R[2]))v=v.prev;else break}for(;v&&v.prev&&!v.startOfLine;)v=v.prev;return v?v.indent+M: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(it,Je,J){"use strict";J.d(Je,"a",function(){return u});var re=J("Ty5D"),z=J("dI71"),L=J("q1tI"),H=J.n(L),k=J("YS25"),M=J("17x9"),F=J.n(M),P=J("wx14"),D=J("zLVn"),O=J("9R94"),E=function(c){Object(z.a)(s,c);function s(){for(var m,p=arguments.length,v=new Array(p),R=0;R<p;R++)v[R]=arguments[R];return m=c.call.apply(c,[this].concat(v))||this,m.history=Object(k.a)(m.props),m}var a=s.prototype;return a.render=function(){return H.a.createElement(re.c,{history:this.history,children:this.props.children})},s}(H.a.Component),_=function(c){Object(z.a)(s,c);function s(){for(var m,p=arguments.length,v=new Array(p),R=0;R<p;R++)v[R]=arguments[R];return m=c.call.apply(c,[this].concat(v))||this,m.history=Object(k.b)(m.props),m}var a=s.prototype;return a.render=function(){return H.a.createElement(re.c,{history:this.history,children:this.props.children})},s}(H.a.Component),T=function(s,a){return typeof s=="function"?s(a):s},A=function(s,a){return typeof s=="string"?Object(k.c)(s,null,null,a):s},w=function(s){return s},b=H.a.forwardRef;typeof b=="undefined"&&(b=w);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=b(function(c,s){var a=c.innerRef,m=c.navigate,p=c.onClick,v=Object(D.a)(c,["innerRef","navigate","onClick"]),R=v.target,U=Object(P.a)({},v,{onClick:function(G){try{p&&p(G)}catch(B){throw G.preventDefault(),B}!G.defaultPrevented&&G.button===0&&(!R||R==="_self")&&!d(G)&&(G.preventDefault(),m())}});return w!==b?U.ref=s||a:U.ref=a,H.a.createElement("a",U)}),u=b(function(c,s){var a=c.component,m=a===void 0?o:a,p=c.replace,v=c.to,R=c.innerRef,U=Object(D.a)(c,["component","replace","to","innerRef"]);return H.a.createElement(re.e.Consumer,null,function(j){j||Object(O.a)(!1);var G=j.history,B=A(T(v,j.location),j.location),N=B?G.createHref(B):"",V=Object(P.a)({},U,{href:N,navigate:function(){var ie=T(v,j.location),se=p?G.replace:G.push;se(ie)}});return w!==b?V.ref=s||R:V.innerRef=R,H.a.createElement(m,V)})});if(!1)var l,S;var h=function(s){return s},g=H.a.forwardRef;typeof g=="undefined"&&(g=h);function C(){for(var c=arguments.length,s=new Array(c),a=0;a<c;a++)s[a]=arguments[a];return s.filter(function(m){return m}).join(" ")}var y=g(function(c,s){var a=c["aria-current"],m=a===void 0?"page":a,p=c.activeClassName,v=p===void 0?"active":p,R=c.activeStyle,U=c.className,j=c.exact,G=c.isActive,B=c.location,N=c.sensitive,V=c.strict,q=c.style,ie=c.to,se=c.innerRef,xe=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(O.a)(!1);var Ee=B||fe.location,ge=A(T(ie,Ee),Ee),ve=ge.pathname,le=ve&&ve.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),ue=le?Object(re.f)(Ee.pathname,{path:le,exact:j,sensitive:N,strict:V}):null,be=!!(G?G(ue,Ee):ue),je=be?C(U,v):U,Be=be?Object(P.a)({},q,{},R):q,ke=Object(P.a)({"aria-current":be&&m||null,className:je,style:Be,to:ge},xe);return h!==g?ke.ref=s||se:ke.innerRef=se,H.a.createElement(u,ke)})});if(!1)var f},"6+eU":function(it,Je,J){"use strict";J.d(Je,"a",function(){return g});var re=J("wx14"),z=J("rePB"),L=J("VTBJ"),H=J("1OyB"),k=J("vuIU"),M=J("Ji7U"),F=J("LK+K"),P=J("q1tI"),D=J.n(P),O=J("TSYQ"),E=J.n(O),_=function(y){var f,c="".concat(y.rootPrefixCls,"-item"),s=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:s,onClick:a,onKeyPress:m,tabIndex:"0"},y.itemRender(y.page,"page",D.a.createElement("a",{rel:"nofollow"},y.page)))},T=_,A={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},w=function(C){Object(M.a)(f,C);var y=Object(F.a)(f);function f(){var c;Object(H.a)(this,f);for(var s=arguments.length,a=new Array(s),m=0;m<s;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,R=v.goButton,U=v.quickGo,j=v.rootPrefixCls,G=c.state.goInputText;if(R||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 s=this.state,a=s.goInputText,m=s.current;return!a||isNaN(a)?m:Number(a)}},{key:"getPageSizeOptions",value:function(){var s=this.props,a=s.pageSize,m=s.pageSizeOptions;return m.some(function(p){return p.toString()===a.toString()})?m:m.concat([a.toString()]).sort(function(p,v){var R=isNaN(Number(p))?0:Number(p),U=isNaN(Number(v))?0:Number(v);return R-U})}},{key:"render",value:function(){var s=this,a=this.props,m=a.pageSize,p=a.locale,v=a.rootPrefixCls,R=a.changeSize,U=a.quickGo,j=a.goButton,G=a.selectComponentClass,B=a.buildOptionText,N=a.selectPrefixCls,V=a.disabled,q=this.state.goInputText,ie="".concat(v,"-options"),se=G,xe=null,fe=null,Ee=null;if(!R&&!U)return null;var ge=this.getPageSizeOptions();if(R&&se){var ve=ge.map(function(le,ue){return D.a.createElement(se.Option,{key:ue,value:le.toString()},(B||s.buildOptionText)(le))});xe=D.a.createElement(se,{disabled:V,prefixCls:N,showSearch:!1,className:"".concat(ie,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(m||ge[0]).toString(),onChange:this.changeSize,getPopupContainer:function(ue){return ue.parentNode}},ve)}return U&&(j&&(Ee=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:q,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),p.page,Ee)),D.a.createElement("li",{className:"".concat(ie)},xe,fe)}}]),f}(D.a.Component);w.defaultProps={pageSizeOptions:["10","20","50","100"]};var b=w,d=J("N2Kk");function o(){}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(M.a)(f,C);var y=Object(F.a)(f);function f(c){var s;Object(H.a)(this,f),s=y.call(this,c),s.getJumpPrevPage=function(){return Math.max(1,s.state.current-(s.props.showLessItems?3:5))},s.getJumpNextPage=function(){return Math.min(S(void 0,s.state,s.props),s.state.current+(s.props.showLessItems?3:5))},s.getItemIcon=function(R,U){var j=s.props.prefixCls,G=R||D.a.createElement("button",{type:"button","aria-label":U,className:"".concat(j,"-item-link")});return typeof R=="function"&&(G=D.a.createElement(R,Object(L.a)({},s.props))),G},s.savePaginationNode=function(R){s.paginationNode=R},s.isValid=function(R){return u(R)&&R!==s.state.current},s.shouldDisplayQuickJumper=function(){var R=s.props,U=R.showQuickJumper,j=R.pageSize,G=R.total;return G<=j?!1:U},s.handleKeyDown=function(R){(R.keyCode===A.ARROW_UP||R.keyCode===A.ARROW_DOWN)&&R.preventDefault()},s.handleKeyUp=function(R){var U=s.getValidValue(R),j=s.state.currentInputValue;U!==j&&s.setState({currentInputValue:U}),R.keyCode===A.ENTER?s.handleChange(U):R.keyCode===A.ARROW_UP?s.handleChange(U-1):R.keyCode===A.ARROW_DOWN&&s.handleChange(U+1)},s.changePageSize=function(R){var U=s.state.current,j=S(R,s.state,s.props);U=U>j?j:U,j===0&&(U=s.state.current),typeof R=="number"&&("pageSize"in s.props||s.setState({pageSize:R}),"current"in s.props||s.setState({current:U,currentInputValue:U})),s.props.onShowSizeChange(U,R),"onChange"in s.props&&s.props.onChange&&s.props.onChange(U,R)},s.handleChange=function(R){var U=s.props.disabled,j=R;if(s.isValid(j)&&!U){var G=S(void 0,s.state,s.props);j>G?j=G:j<1&&(j=1),"current"in s.props||s.setState({current:j,currentInputValue:j});var B=s.state.pageSize;return s.props.onChange(j,B),j}return s.state.current},s.prev=function(){s.hasPrev()&&s.handleChange(s.state.current-1)},s.next=function(){s.hasNext()&&s.handleChange(s.state.current+1)},s.jumpPrev=function(){s.handleChange(s.getJumpPrevPage())},s.jumpNext=function(){s.handleChange(s.getJumpNextPage())},s.hasPrev=function(){return s.state.current>1},s.hasNext=function(){return s.state.current<S(void 0,s.state,s.props)},s.runIfEnter=function(R,U){if(R.key==="Enter"||R.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)}},s.runIfEnterPrev=function(R){s.runIfEnter(R,s.prev)},s.runIfEnterNext=function(R){s.runIfEnter(R,s.next)},s.runIfEnterJumpPrev=function(R){s.runIfEnter(R,s.jumpPrev)},s.runIfEnterJumpNext=function(R){s.runIfEnter(R,s.jumpNext)},s.handleGoTO=function(R){(R.keyCode===A.ENTER||R.type==="click")&&s.handleChange(s.state.currentInputValue)};var a=c.onChange!==o,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)),s.state={current:p,currentInputValue:p,pageSize:v},s}return Object(k.a)(f,[{key:"componentDidUpdate",value:function(s,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(s){var a=s.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 s=this.props,a=s.showSizeChanger,m=s.total,p=s.totalBoundaryShowSizeChanger;return typeof a!="undefined"?a:m>p}},{key:"renderPrev",value:function(s){var a=this.props,m=a.prevIcon,p=a.itemRender,v=p(s,"prev",this.getItemIcon(m,"prev page")),R=!this.hasPrev();return Object(P.isValidElement)(v)?Object(P.cloneElement)(v,{disabled:R}):v}},{key:"renderNext",value:function(s){var a=this.props,m=a.nextIcon,p=a.itemRender,v=p(s,"next",this.getItemIcon(m,"next page")),R=!this.hasNext();return Object(P.isValidElement)(v)?Object(P.cloneElement)(v,{disabled:R}):v}},{key:"render",value:function(){var s=this,a=this.props,m=a.prefixCls,p=a.className,v=a.style,R=a.disabled,U=a.hideOnSinglePage,j=a.total,G=a.locale,B=a.showQuickJumper,N=a.showLessItems,V=a.showTitle,q=a.showTotal,ie=a.simple,se=a.itemRender,xe=a.showPrevNextJumpers,fe=a.jumpPrevIcon,Ee=a.jumpNextIcon,ge=a.selectComponentClass,ve=a.selectPrefixCls,le=a.pageSizeOptions,ue=this.state,be=ue.current,je=ue.pageSize,Be=ue.currentInputValue;if(U===!0&&j<=je)return null;var ke=S(void 0,this.state,this.props),Me=[],we=null,Ae=null,Ue=null,Ge=null,He=null,_e=B&&B.goButton,Te=N?1:2,Ce=be-1>0?be-1:0,Re=be+1<ke?be+1:ke,Fe=Object.keys(this.props).reduce(function(Y,Q){return(Q.substr(0,5)==="data-"||Q.substr(0,5)==="aria-"||Q==="role")&&(Y[Q]=s.props[Q]),Y},{});if(ie)return _e&&(typeof _e=="boolean"?He=D.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},G.jump_to_confirm):He=D.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},_e),He=D.a.createElement("li",{title:V?"".concat(G.jump_to).concat(be,"/").concat(ke):null,className:"".concat(m,"-simple-pager")},He)),D.a.createElement("ul",Object(re.a)({className:E()(m,"".concat(m,"-simple"),Object(z.a)({},"".concat(m,"-disabled"),R),p),style:v,ref:this.savePaginationNode},Fe),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(Ce)),D.a.createElement("li",{title:V?"".concat(be,"/").concat(ke):null,className:"".concat(m,"-simple-pager")},D.a.createElement("input",{type:"text",value:Be,disabled:R,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),D.a.createElement("span",{className:"".concat(m,"-slash")},"/"),ke),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)),He);if(ke<=3+Te*2){var Ne={locale:G,rootPrefixCls:m,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:V,itemRender:se};ke||Me.push(D.a.createElement(T,Object(re.a)({},Ne,{key:"noPager",page:ke,className:"".concat(m,"-disabled")})));for(var De=1;De<=ke;De+=1){var ze=be===De;Me.push(D.a.createElement(T,Object(re.a)({},Ne,{key:De,page:De,active:ze})))}}else{var Xe=N?G.prev_3:G.prev_5,me=N?G.next_3:G.next_5;xe&&(we=D.a.createElement("li",{title:V?Xe: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))},se(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(fe,"prev page"))),Ae=D.a.createElement("li",{title:V?me: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"),!!Ee))},se(this.getJumpNextPage(),"jump-next",this.getItemIcon(Ee,"next page")))),Ge=D.a.createElement(T,{locale:G,last:!0,rootPrefixCls:m,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:ke,page:ke,active:!1,showTitle:V,itemRender:se}),Ue=D.a.createElement(T,{locale:G,rootPrefixCls:m,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:V,itemRender:se});var Ye=Math.max(1,be-Te),Ke=Math.min(be+Te,ke);be-1<=Te&&(Ke=1+Te*2),ke-be<=Te&&(Ye=ke-Te*2);for(var ye=Ye;ye<=Ke;ye+=1){var Oe=be===ye;Me.push(D.a.createElement(T,{locale:G,rootPrefixCls:m,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:ye,page:ye,active:Oe,showTitle:V,itemRender:se}))}be-1>=Te*2&&be!==1+2&&(Me[0]=Object(P.cloneElement)(Me[0],{className:"".concat(m,"-item-after-jump-prev")}),Me.unshift(we)),ke-be>=Te*2&&be!==ke-2&&(Me[Me.length-1]=Object(P.cloneElement)(Me[Me.length-1],{className:"".concat(m,"-item-before-jump-next")}),Me.push(Ae)),Ye!==1&&Me.unshift(Ue),Ke!==ke&&Me.push(Ge)}var te=null;q&&(te=D.a.createElement("li",{className:"".concat(m,"-total-text")},q(j,[j===0?0:(be-1)*je+1,be*je>j?j:be*je])));var $=!this.hasPrev()||!ke,ae=!this.hasNext()||!ke;return D.a.createElement("ul",Object(re.a)({className:E()(m,p,Object(z.a)({},"".concat(m,"-disabled"),R)),style:v,unselectable:"unselectable",ref:this.savePaginationNode},Fe),te,D.a.createElement("li",{title:V?G.prev_page:null,onClick:this.prev,tabIndex:$?null:0,onKeyPress:this.runIfEnterPrev,className:E()("".concat(m,"-prev"),Object(z.a)({},"".concat(m,"-disabled"),$)),"aria-disabled":$},this.renderPrev(Ce)),Me,D.a.createElement("li",{title:V?G.next_page:null,onClick:this.next,tabIndex:ae?null:0,onKeyPress:this.runIfEnterNext,className:E()("".concat(m,"-next"),Object(z.a)({},"".concat(m,"-disabled"),ae)),"aria-disabled":ae},this.renderNext(Re)),D.a.createElement(b,{disabled:R,locale:G,rootPrefixCls:m,selectComponentClass:ge,selectPrefixCls:ve,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:be,pageSize:je,pageSizeOptions:le,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:_e}))}}],[{key:"getDerivedStateFromProps",value:function(s,a){var m={};if("current"in s&&(m.current=s.current,s.current!==a.current&&(m.currentInputValue=m.current)),"pageSize"in s&&s.pageSize!==a.pageSize){var p=a.current,v=S(s.pageSize,a,s);p=p>v?v:p,"current"in s||(m.current=p,m.currentInputValue=p),m.pageSize=s.pageSize}return m}}]),f}(D.a.Component);h.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:o,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:o,locale:d.a,style:{},itemRender:l,totalBoundaryShowSizeChanger:50};var g=h},"6S+g":function(it,Je,J){"use strict";var re=J("PpiC"),z=J("q1tI"),L=J.n(z),H=J("8h34"),k=J.n(H),M=J("9BLJ"),F=J("BtR2"),P=J("WhZy"),D=J("sNeV"),O=J("m3rI"),E=J("9kvl"),_=function(A){var w=A.user,b=Object(re.a)(A,["user"]),d=w.userInfo;return L.a.createElement("ul",{className:k.a.forumList},b.memos.map(function(o,u){var l={index:u,admin:d&&d.admin,banned_permission:o.banned_permission,login:d&&d.login,is_currentUser:d&&o.user_login===d.login,is_fine:o.is_fine,sticky:o.sticky,memo_watched:o.memo_watched,user_banned_permission:o.banned_permission,is_deleted:o.apply_destroy};return L.a.createElement("li",{key:o.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:o.tag_name=="\u4EA4\u6D41"?k.a.blue:k.a.orange},"\u3010",o.tag_name,"\u3011")),L.a.createElement("a",{href:"/forums/".concat(o.id),className:"".concat(k.a.taskHide," ").concat(k.a.textTitle)},o.subject),o.sticky===!0?L.a.createElement("span",{className:"".concat(k.a.tag," ").concat(k.a.tagRed)},"\u7F6E\u9876"):"",o.is_original===!0?L.a.createElement("span",{className:"".concat(k.a.tag," ").concat(k.a.tagOrange)},"\u539F\u521B"):"",o.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},o.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:o.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(o.user_login,"/memos")},L.a.createElement("div",{className:k.a.kTLhbM},L.a.createElement("img",{src:O.a.IMG_SERVER+"/images/"+o.image_url,alt:"",className:k.a.dGqnMq}),L.a.createElement("span",{className:k.a.dicrWo},o.username))),o.forum_section_title?L.a.createElement("a",{href:"",className:"".concat(k.a.iwMcWy," ").concat(k.a.textType)},o.forum_section_title):"",o.published_time?L.a.createElement("span",{className:k.a.iwMcWy},o.published_time):""),L.a.createElement("span",null,L.a.createElement("span",{className:k.a.iconWrap},L.a.createElement(M.a,null),L.a.createElement("span",{className:k.a.spanText},o.viewed_count)),L.a.createElement("span",{className:k.a.iconWrap},L.a.createElement(F.a,null),L.a.createElement("span",{className:k.a.spanText},o.praises_count)),L.a.createElement("span",{className:k.a.iconWrap},L.a.createElement(P.a,null),L.a.createElement("span",{className:k.a.spanText},o.replies_count)))))}))};Je.a=Object(E.a)(function(T){var A=T.user;return{user:A}})(_)},"7ahc":function(it,Je,J){"use strict";J.d(Je,"a",function(){return S});var re=J("k1fw"),z=J("0Owb"),L=J("+L6B"),H=J("2/Rp"),k=J("y8nQ"),M=J("Vl3Y"),F=J("tJVT"),P=J("OaEy"),D=J("2fM7"),O=J("q1tI"),E=J.n(O),_=J("VrN/"),T=J.n(_),A=J("p77/"),w=J.n(A),b=J("c5Ni"),d=J.n(b),o=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"]};Je.b=function(h){var g=h.callback,C=h.onCancel,y=Object(O.useState)("python"),f=Object(F.a)(y,2),c=f[0],s=f[1];function a(p){s(l[p][1])}function m(p){g(p)}return E.a.createElement(M.a,Object(z.a)({},u,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:m}),E.a.createElement(M.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(o,{key:p,value:p},l[p][0])}))),E.a.createElement(M.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,s=Object(O.useRef)(),a=Object(O.useState)(),m=Object(F.a)(a,2),p=m[0],v=m[1];return Object(O.useEffect)(function(){if(p){function R(U){var j=U.getValue();C&&C(j)}return p.on("change",R),function(){p.off("change",R)}}},[p,C]),Object(O.useEffect)(function(){p&&p.setOption("mode",y)},[p,y]),Object(O.useEffect)(function(){p&&((g!==p.getValue()||g==="")&&setTimeout(function(){p.setValue(g||" ")},300))},[p,g]),Object(O.useEffect)(function(){if(s.current&&!p){var R=T.a.fromTextArea(s.current,Object(re.a)({mode:y,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));v(R)}},[s.current,p]),E.a.createElement("div",{className:"my-codemirror-container"},E.a.createElement("textarea",{ref:s}))}},"8EBN":function(it,Je,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 M=re.modeInfo[k];if(M.mime==H)return M;if(M.mimes){for(var F=0;F<M.mimes.length;F++)if(M.mimes[F]==H)return M}}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 M=re.modeInfo[k];if(M.ext){for(var F=0;F<M.ext.length;F++)if(M.ext[F]==H)return M}}},re.findModeByFileName=function(H){for(var k=0;k<re.modeInfo.length;k++){var M=re.modeInfo[k];if(M.file&&M.file.test(H))return M}var F=H.lastIndexOf("."),P=F>-1&&H.substring(F+1,H.length);if(P)return re.findModeByExtension(P)},re.findModeByName=function(H){H=H.toLowerCase();for(var k=0;k<re.modeInfo.length;k++){var M=re.modeInfo[k];if(M.name.toLowerCase()==H)return M;if(M.alias){for(var F=0;F<M.alias.length;F++)if(M.alias[F].toLowerCase()==H)return M}}}})},"8h34":function(it,Je,J){it.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(it,Je,J){"use strict";var re=J("k1fw"),z=J("tJVT"),L=J("q1tI"),H=J.n(L),k=J("vg9a"),M=J("DlQD"),F=J.n(M),P=J("rUJ1");function D(V,q){var ie=V.match(/^(\s+)(?:```)/);if(ie===null)return q;var se=ie[1];return q.split(`
|
|
`).map(function(xe){var fe=xe.match(/^\s+/);if(fe===null)return xe;var Ee=Object(z.a)(fe,1),ge=Ee[0];return ge.length>=se.length?xe.slice(se.length):xe}).join(`
|
|
`)}var O=[],E=["<ul>"],_=new F.a.Renderer,T=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function A(){O.length=0,E=["<ul>"]}var w={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function b(V,q,ie,se){if(q>=V.length||V[q].level<=ie)return q;var xe=V[q];se.push("<li><a href='#"+xe.anchor+"'>"+xe.text+"</a>"),q++;var fe=[];return q=b(V,q,xe.level,fe),fe.length>0&&(se.push("<ul>"),fe.forEach(function(Ee){se.push(Ee)}),se.push("</ul>")),se.push("</li>"),q=b(V,q,ie,se),q}function d(){return b(O,0,0,E),E.push("</ul>"),E.join("")}var o={heading:function(q){var ie=T.exec(q);if(ie)return{type:"heading",raw:ie[0],depth:ie[1].length,text:ie[2]}},fences:function(q){var ie=this.rules.block.fences.exec(q);if(ie){var se=ie[0],xe=D(se,ie[3]||""),fe=ie[2]?ie[2].trim():ie[2];if(["latex","katex","math"].indexOf(fe)>=0){var Ee=S(),ge=xe;xe=Ee,h[Ee]={type:"block",expression:ge}}return{type:"code",raw:se,lang:fe,text:xe}}}},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(q,ie){var se=S();return h[se]={type:"inline",expression:ie},se}),V}var f=_.listitem;_.listitem=function(V){return f(y(V))};var c=_.paragraph;_.paragraph=function(V){return c(y(V))};var s=_.tablecell;_.tablecell=function(V,q){return s(y(V),q)},_.code=function(V,q,ie){var se=(q||"").match(/\S*/)[0];return se?["latex","katex","math"].indexOf(se)>=0?"<p class='editormd-tex'>".concat(V,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(q,'">').concat(ie?V:Object(P.escape)(V,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(ie?V:Object(P.escape)(V,!0))+"</code></pre>"},_.heading=function(V,q,ie){var se=this.options.headerPrefix+ie.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return O.push({anchor:se,level:q,text:V}),"<h"+q+' id="'+se+'">'+V+"</h"+q+">"},F.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),F.a.use({tokenizer:o,renderer:_});var a=F.a,m=J("SJMd"),p=J("ulZh"),v=J.n(p),R=J("m3rI"),U=J("Oy/b"),j=J("p5ED"),G=/<pre[^>]*>/g;function B(V){var q=document.createElement("div");return q.innerHTML=V,q.childNodes.length===0?"":q.childNodes[0].nodeValue}var N=Je.a=function(V){var q=V.value,ie=q===void 0?"":q,se=V.className,xe=V.showTextOnly,fe=V.showLines,Ee=V.style,ge=Ee===void 0?{}:Ee,ve=V.stylesPrev,le=ve===void 0?{}:ve,ue=String(ie),be=Object(L.useState)(""),je=Object(z.a)(be,2),Be=je[0],ke=je[1],Me=Object(L.useMemo)(function(){try{var Ge=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,He=/\"\/api\/attachments\/|\"\/attachments\/download\//g,_e=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;ue=ue.replace(Ge,"("+R.a.API_SERVER+"/api/attachments/").replace(He,'"'+R.a.API_SERVER+"/api/attachments/").replace(_e,'"'+R.a.API_SERVER+"/files/uploads/").replace(/\r\n/g,`
|
|
`),ue=ue.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
|
|
`)}catch(Fe){}var Te=a(ue),Ce=g();if(ue.match(/\[TOC\]/)&&(Te=Te.replace("<p>[TOC]</p>",d()),A()),Te=Te.replace(/(__special_katext_id_\d+__)/g,function(Fe,Ne){var De=Ce[Ne],ze=De.type,Xe=De.expression;return Object(U.renderToString)(B(Xe)||"",{displayMode:ze==="block",throwOnError:!1,output:"html"})}),Te=Te.replace(/▁/g,"\u2581\u2581\u2581"),C(),xe){var Re=document.createElement("div");return Re.innerHTML=Te,Re.innerText}return setTimeout(function(){return Ue()},500),Te},[ue]),we=Object(L.useRef)();w.WebkitLineClamp=fe,fe&&(ge=Object(re.a)(Object(re.a)({},ge),w));function Ae(Ge){var He=Ge.target;if(He.tagName.toUpperCase()==="A"){var _e=He.getAttribute("href");if(_e.indexOf("office")>-1)Ge.preventDefault(),ke(_e);else if(_e.startsWith("#")){Ge.preventDefault();var Te=document.getElementById(_e.replace("#",""));Te&&Te.scrollIntoView(!0)}}}var Ue=function(){var He,_e=(He=we.current)===null||He===void 0?void 0:He.querySelectorAll("video");_e==null||_e.forEach(function(Te){if(Te.oncontextmenu=function(){return!1},Te.src.indexOf(".m3u8")>-1&&!Te.canPlayType("application/vnd.apple.mpegurl")){if(v.a.isSupported()){var Ce=new v.a;Ce.loadSource(Te.src),Ce.attachMedia(Te)}}})};return Object(L.useEffect)(function(){if(we.current&&Me&&(Me.match(G)&&window.PR.prettyPrint()),we.current)return we.current.addEventListener("click",Ae),function(){we.current.removeEventListener("click",Ae),C(),A()}},[Me,we.current,Ae]),H.a.createElement(H.a.Fragment,null,H.a.createElement("div",{ref:we,style:Object(re.a)({},ge),className:"".concat(se||""," markdown-body "),dangerouslySetInnerHTML:{__html:Me}}),H.a.createElement(j.a,{close:!0,data:Be,type:Be!=null&&Be.length?"office":"",style:Object(re.a)({},le),onClose:function(){return ke("")}}))}},"9VGf":function(it,Je,J){"use strict";J.d(Je,"a",function(){return L});var re=J("q1tI"),z=J.n(re);function L(H,k){var M=Object(re.useRef)();Object(re.useEffect)(function(){M.current=H}),Object(re.useEffect)(function(){function F(){M.current()}if(k!==null){var P=setInterval(F,k);return function(){return clearInterval(P)}}},[k])}},BU3w:function(it,Je,J){"use strict";J.d(Je,"a",function(){return M});var re=J("MNnm"),z="rc-util-key";function L(F){if(F.attachTo)return F.attachTo;var P=document.querySelector("head");return P||document.body}function H(F){var P,D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(re.a)())return null;var O=document.createElement("style");if((P=D.csp)===null||P===void 0?void 0:P.nonce){var E;O.nonce=(E=D.csp)===null||E===void 0?void 0:E.nonce}O.innerHTML=F;var _=L(D),T=_.firstChild;return D.prepend&&_.prepend?_.prepend(O):D.prepend&&T?_.insertBefore(O,T):_.appendChild(O),O}var k=new Map;function M(F,P){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},O=L(D);if(!k.has(O)){var E=H("",D),_=E.parentNode;k.set(O,_),_.removeChild(E)}var T=Array.from(k.get(O).children).find(function(o){return o.tagName==="STYLE"&&o[z]===P});if(T){var A,w;if(((A=D.csp)===null||A===void 0?void 0:A.nonce)&&T.nonce!==((w=D.csp)===null||w===void 0?void 0:w.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]=P,d}},Bd2K:function(it,Je,J){(function(re){re(J("VrN/"),J("osHv"))})(function(re){re.defineOption("autoCloseTags",!1,function(D,O,E){if(E!=re.Init&&E&&D.removeKeyMap("autoCloseTags"),!O)return;var _={name:"autoCloseTags"};(typeof O!="object"||O.whenClosing!==!1)&&(_["'/'"]=function(T){return M(T)}),(typeof O!="object"||O.whenOpening!==!1)&&(_["'>'"]=function(T){return H(T)}),D.addKeyMap(_)});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 O=D.listSelections(),E=[],_=D.getOption("autoCloseTags"),T=0;T<O.length;T++){if(!O[T].empty())return re.Pass;var A=O[T].head,w=D.getTokenAt(A),b=re.innerMode(D.getMode(),w.state),d=b.state,o=b.mode.xmlCurrentTag&&b.mode.xmlCurrentTag(d),u=o&&o.name;if(!u)return re.Pass;var l=b.mode.configuration=="html",S=typeof _=="object"&&_.dontCloseTags||l&&z,h=typeof _=="object"&&_.indentTags||l&&L;w.end>A.ch&&(u=u.slice(0,u.length-w.end+A.ch));var g=u.toLowerCase();if(!u||w.type=="string"&&(w.end!=A.ch||!/[\"\']/.test(w.string.charAt(w.string.length-1))||w.string.length==1)||w.type=="tag"&&o.close||w.string.indexOf("/")==A.ch-w.start-1||S&&F(S,g)>-1||P(D,b.mode.xmlCurrentContext&&b.mode.xmlCurrentContext(d)||[],u,A,!0))return re.Pass;var C=typeof _=="object"&&_.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 _=="object"&&_.dontIndentOnAutoClose,T=O.length-1;T>=0;T--){var c=E[T];D.replaceRange(c.text,O[T].head,O[T].anchor,"+insert");var s=D.listSelections().slice(0);s[T]={head:c.newPos,anchor:c.newPos},D.setSelections(s),!f&&c.indent&&(D.indentLine(c.newPos.line,null,!0),D.indentLine(c.newPos.line+1,null,!0))}}function k(D,O){for(var E=D.listSelections(),_=[],T=O?"/":"</",A=D.getOption("autoCloseTags"),w=typeof A=="object"&&A.dontIndentOnSlash,b=0;b<E.length;b++){if(!E[b].empty())return re.Pass;var d=E[b].head,o=D.getTokenAt(d),u=re.innerMode(D.getMode(),o.state),l=u.state;if(O&&(o.type=="string"||o.string.charAt(0)!="<"||o.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&&P(D,g,g[g.length-1],d))return re.Pass;S=T+g[g.length-1]}D.getLine(d.line).charAt(o.end)!=">"&&(S+=">"),_[b]=S}if(D.replaceSelections(_),E=D.listSelections(),!w)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 M(D){return D.getOption("disableInput")?re.Pass:k(D,!0)}re.commands.closeTag=function(D){return k(D)};function F(D,O){if(D.indexOf)return D.indexOf(O);for(var E=0,_=D.length;E<_;++E)if(D[E]==O)return E;return-1}function P(D,O,E,_,T){if(!re.scanForClosingTag)return!1;var A=Math.min(D.lastLine()+1,_.line+500),w=re.scanForClosingTag(D,_,null,A);if(!w||w.tag!=E)return!1;for(var b=T?1:0,d=O.length-1;d>=0&&O[d]==E;d--)++b;_=w.to;for(var d=1;d<b;d++){var o=re.scanForClosingTag(D,_,null,A);if(!o||o.tag!=E)return!1;_=o.to}return!0}})},BdwD:function(it,Je,J){"use strict";var re=J("k1fw"),z=J("q1tI"),L=J.n(z),H=J("MXfU"),k=J.n(H),M=J("Nmsl"),F=J.n(M),P=function(O){var E=O.buttonProps,_=E===void 0?{}:E,T=O.styles,A=T===void 0?{}:T,w=O.customText,b=O.ButtonText,d=O.ButtonClick,o=O.Buttonclass,u=O.ButtonTwo;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:k.a,alt:""}),L.a.createElement("p",{className:F.a.none_p_title},w||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!")))};Je.a=P},BjJ7:function(it,Je,J){"use strict";J.d(Je,"d",function(){return z}),J.d(Je,"c",function(){return L}),J.d(Je,"e",function(){return H}),J.d(Je,"b",function(){return k}),J.d(Je,"a",function(){return F});var re=J("m3rI");function z(P){var D=!0;if(P.length>0){for(var O=0;O<P.length;O++)if(P[O].compile_success==0||!P[O].compile_success){D=!1;break}}else D=!1;return D}function L(P){for(var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",O=[],E=0;E<P.length;E++){var _=P[E],T=D?"".concat(D,"/").concat(_.name):"".concat(_.name);O.push({title:_.name,isLeaf:!(_.type==="tree"),key:T})}return O}function H(P,D,O){for(var E=0;E<P.length;E++){var _=P[E];if(_.key===D){_.children=O;break}_.children&&H(_.children,D,O)}return P}function k(P,D,O){var E;return function(){var _=this,T=arguments,A=function(){E=null,O||P.apply(_,T)},w=O&&!E;clearTimeout(E),E=setTimeout(A,D),w&&P.apply(_,T)}}var M=!0,F=re.a.API_SERVER},"C+DQ":function(it,Je,J){},DlQD:function(it,Je,J){(function(re,z){it.exports=z()})(this,function(){"use strict";function re(te,$){for(var ae=0;ae<$.length;ae++){var Y=$[ae];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(te,Y.key,Y)}}function z(te,$,ae){return $&&re(te.prototype,$),ae&&re(te,ae),te}function L(te,$){if(!te)return;if(typeof te=="string")return H(te,$);var ae=Object.prototype.toString.call(te).slice(8,-1);if(ae==="Object"&&te.constructor&&(ae=te.constructor.name),ae==="Map"||ae==="Set")return Array.from(te);if(ae==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ae))return H(te,$)}function H(te,$){($==null||$>te.length)&&($=te.length);for(var ae=0,Y=new Array($);ae<$;ae++)Y[ae]=te[ae];return Y}function k(te,$){var ae;if(typeof Symbol=="undefined"||te[Symbol.iterator]==null){if(Array.isArray(te)||(ae=L(te))||$&&te&&typeof te.length=="number"){ae&&(te=ae);var Y=0;return function(){return Y>=te.length?{done:!0}:{done:!1,value:te[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 ae=te[Symbol.iterator](),ae.next.bind(ae)}function M(te,$){return $={exports:{}},te($,$.exports),$.exports}var F=M(function(te){function $(){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 ae(Y){te.exports.defaults=Y}te.exports={defaults:$(),getDefaults:$,changeDefaults:ae}}),P=F.defaults,D=F.getDefaults,O=F.changeDefaults,E=/[&<>"']/,_=/[&<>"']/g,T=/[<>"']|&(?!#?\w+;)/,A=/[<>"']|&(?!#?\w+;)/g,w={"&":"&","<":"<",">":">",'"':""","'":"'"},b=function($){return w[$]};function d(te,$){if($){if(E.test(te))return te.replace(_,b)}else if(T.test(te))return te.replace(A,b);return te}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function u(te){return te.replace(o,function($,ae){return ae=ae.toLowerCase(),ae==="colon"?":":ae.charAt(0)==="#"?ae.charAt(1)==="x"?String.fromCharCode(parseInt(ae.substring(2),16)):String.fromCharCode(+ae.substring(1)):""})}var l=/(^|[^\[])\^/g;function S(te,$){te=te.source||te,$=$||"";var ae={replace:function(Q,Z){return Z=Z.source||Z,Z=Z.replace(l,"$1"),te=te.replace(Q,Z),ae},getRegex:function(){return new RegExp(te,$)}};return ae}var h=/[^\w:]/g,g=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function C(te,$,ae){if(te){var Y;try{Y=decodeURIComponent(u(ae)).replace(h,"").toLowerCase()}catch(Q){return null}if(Y.indexOf("javascript:")===0||Y.indexOf("vbscript:")===0||Y.indexOf("data:")===0)return null}$&&!g.test(ae)&&(ae=a($,ae));try{ae=encodeURI(ae).replace(/%25/g,"%")}catch(Q){return null}return ae}var y={},f=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(te,$){y[" "+te]||(f.test(te)?y[" "+te]=te+"/":y[" "+te]=R(te,"/",!0)),te=y[" "+te];var ae=te.indexOf(":")===-1;return $.substring(0,2)==="//"?ae?$:te.replace(c,"$1")+$:$.charAt(0)==="/"?ae?$:te.replace(s,"$1")+$:te+$}var m={exec:function(){}};function p(te){for(var $=1,ae,Y;$<arguments.length;$++){ae=arguments[$];for(Y in ae)Object.prototype.hasOwnProperty.call(ae,Y)&&(te[Y]=ae[Y])}return te}function v(te,$){var ae=te.replace(/\|/g,function(Z,ee,de){for(var pe=!1,Le=ee;--Le>=0&&de[Le]==="\\";)pe=!pe;return pe?"|":" |"}),Y=ae.split(/ \|/),Q=0;if(Y.length>$)Y.splice($);else for(;Y.length<$;)Y.push("");for(;Q<Y.length;Q++)Y[Q]=Y[Q].trim().replace(/\\\|/g,"|");return Y}function R(te,$,ae){var Y=te.length;if(Y===0)return"";for(var Q=0;Q<Y;){var Z=te.charAt(Y-Q-1);if(Z===$&&!ae)Q++;else if(Z!==$&&ae)Q++;else break}return te.substr(0,Y-Q)}function U(te,$){if(te.indexOf($[1])===-1)return-1;for(var ae=te.length,Y=0,Q=0;Q<ae;Q++)if(te[Q]==="\\")Q++;else if(te[Q]===$[0])Y++;else if(te[Q]===$[1]&&(Y--,Y<0))return Q;return-1}function j(te){te&&te.sanitize&&!te.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:R,findClosingBracket:U,checkSanitizeDeprecation:j},B=F.defaults,N=G.rtrim,V=G.splitCells,q=G.escape,ie=G.findClosingBracket;function se(te,$,ae){var Y=$.href,Q=$.title?q($.title):null,Z=te[1].replace(/\\([\[\]])/g,"$1");return te[0].charAt(0)!=="!"?{type:"link",raw:ae,href:Y,title:Q,text:Z}:{type:"image",raw:ae,href:Y,title:Q,text:q(Z)}}function xe(te,$){var ae=te.match(/^(\s+)(?:```)/);if(ae===null)return $;var Y=ae[1];return $.split(`
|
|
`).map(function(Q){var Z=Q.match(/^\s+/);if(Z===null)return Q;var ee=Z[0];return ee.length>=Y.length?Q.slice(Y.length):Q}).join(`
|
|
`)}var fe=function(){function te(ae){this.options=ae||B}var $=te.prototype;return $.space=function(Y){var Q=this.rules.block.newline.exec(Y);if(Q)return Q[0].length>1?{type:"space",raw:Q[0]}:{raw:`
|
|
`}},$.code=function(Y,Q){var Z=this.rules.block.code.exec(Y);if(Z){var ee=Q[Q.length-1];if(ee&&ee.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,`
|
|
`)}}},$.fences=function(Y){var Q=this.rules.block.fences.exec(Y);if(Q){var Z=Q[0],ee=xe(Z,Q[3]||"");return{type:"code",raw:Z,lang:Q[2]?Q[2].trim():Q[2],text:ee}}},$.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]}},$.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 ee=Z.align.length,de;for(de=0;de<ee;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(ee=Z.cells.length,de=0;de<ee;de++)Z.cells[de]=V(Z.cells[de],Z.header.length);return Z}}},$.hr=function(Y){var Q=this.rules.block.hr.exec(Y);if(Q)return{type:"hr",raw:Q[0]}},$.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}}},$.list=function(Y){var Q=this.rules.block.list.exec(Y);if(Q){for(var Z=Q[0],ee=Q[2],de=ee.length>1,pe=ee[ee.length-1]===")",Le={type:"list",raw:Z,ordered:de,start:de?+ee.slice(0,-1):"",loose:!1,items:[]},tt=Q[0].match(this.rules.block.item),ct=!1,rt,Et,ht,nt,bt,vt,Bt,Dt=tt.length,ft=0;ft<Dt;ft++)rt=tt[ft],Z=rt,Et=rt.length,rt=rt.replace(/^ *([*+-]|\d+[.)]) */,""),~rt.indexOf(`
|
|
`)&&(Et-=rt.length,rt=this.options.pedantic?rt.replace(/^ {1,4}/gm,""):rt.replace(new RegExp("^ {1,"+Et+"}","gm"),"")),ft!==Dt-1&&(ht=this.rules.block.bullet.exec(tt[ft+1])[0],(de?ht.length===1||!pe&&ht[ht.length-1]===")":ht.length>1||this.options.smartLists&&ht!==ee)&&(nt=tt.slice(ft+1).join(`
|
|
`),Le.raw=Le.raw.substring(0,Le.raw.length-nt.length),ft=Dt-1)),bt=ct||/\n\n(?!\s*$)/.test(rt),ft!==Dt-1&&(ct=rt.charAt(rt.length-1)===`
|
|
`,bt||(bt=ct)),bt&&(Le.loose=!0),vt=/^\[[ xX]\] /.test(rt),Bt=void 0,vt&&(Bt=rt[1]!==" ",rt=rt.replace(/^\[[ xX]\] +/,"")),Le.items.push({type:"list_item",raw:Z,task:vt,checked:Bt,loose:bt,text:rt});return Le}},$.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(Q[0]):Q[0]}},$.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]}}},$.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 ee=Z.align.length,de;for(de=0;de<ee;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(ee=Z.cells.length,de=0;de<ee;de++)Z.cells[de]=V(Z.cells[de].replace(/^ *\| *| *\| *$/g,""),Z.header.length);return Z}}},$.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]}},$.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]}},$.text=function(Y,Q){var Z=this.rules.block.text.exec(Y);if(Z){var ee=Q[Q.length-1];return ee&&ee.type==="text"?{raw:Z[0],text:Z[0]}:{type:"text",raw:Z[0],text:Z[0]}}},$.escape=function(Y){var Q=this.rules.inline.escape.exec(Y);if(Q)return{type:"escape",raw:Q[0],text:q(Q[1])}},$.tag=function(Y,Q,Z){var ee=this.rules.inline.tag.exec(Y);if(ee)return!Q&&/^<a /i.test(ee[0])?Q=!0:Q&&/^<\/a>/i.test(ee[0])&&(Q=!1),!Z&&/^<(pre|code|kbd|script)(\s|>)/i.test(ee[0])?Z=!0:Z&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ee[0])&&(Z=!1),{type:this.options.sanitize?"text":"html",raw:ee[0],inLink:Q,inRawBlock:Z,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ee[0]):q(ee[0]):ee[0]}},$.link=function(Y){var Q=this.rules.inline.link.exec(Y);if(Q){var Z=ie(Q[2],"()");if(Z>-1){var ee=Q[0].indexOf("!")===0?5:4,de=ee+Q[1].length+Z;Q[2]=Q[2].substring(0,Z),Q[0]=Q[0].substring(0,de).trim(),Q[3]=""}var pe=Q[2],Le="";if(this.options.pedantic){var tt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(pe);tt?(pe=tt[1],Le=tt[3]):Le=""}else Le=Q[3]?Q[3].slice(1,-1):"";pe=pe.trim().replace(/^<([\s\S]*)>$/,"$1");var ct=se(Q,{href:pe&&pe.replace(this.rules.inline._escapes,"$1"),title:Le&&Le.replace(this.rules.inline._escapes,"$1")},Q[0]);return ct}},$.reflink=function(Y,Q){var Z;if((Z=this.rules.inline.reflink.exec(Y))||(Z=this.rules.inline.nolink.exec(Y))){var ee=(Z[2]||Z[1]).replace(/\s+/g," ");if(ee=Q[ee.toLowerCase()],!ee||!ee.href){var de=Z[0].charAt(0);return{type:"text",raw:de,text:de}}var pe=se(Z,ee,Z[0]);return pe}},$.strong=function(Y,Q,Z){Z===void 0&&(Z="");var ee=this.rules.inline.strong.start.exec(Y);if(ee&&(!ee[1]||ee[1]&&(Z===""||this.rules.inline.punctuation.exec(Z)))){Q=Q.slice(-1*Y.length);var de=ee[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;de.lastIndex=0;for(var pe;(ee=de.exec(Q))!=null;)if(pe=this.rules.inline.strong.middle.exec(Q.slice(0,ee.index+3)),pe)return{type:"strong",raw:Y.slice(0,pe[0].length),text:Y.slice(2,pe[0].length-2)}}},$.em=function(Y,Q,Z){Z===void 0&&(Z="");var ee=this.rules.inline.em.start.exec(Y);if(ee&&(!ee[1]||ee[1]&&(Z===""||this.rules.inline.punctuation.exec(Z)))){Q=Q.slice(-1*Y.length);var de=ee[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;de.lastIndex=0;for(var pe;(ee=de.exec(Q))!=null;)if(pe=this.rules.inline.em.middle.exec(Q.slice(0,ee.index+2)),pe)return{type:"em",raw:Y.slice(0,pe[0].length),text:Y.slice(1,pe[0].length-1)}}},$.codespan=function(Y){var Q=this.rules.inline.code.exec(Y);if(Q){var Z=Q[2].replace(/\n/g," "),ee=/[^ ]/.test(Z),de=Z.startsWith(" ")&&Z.endsWith(" ");return ee&&de&&(Z=Z.substring(1,Z.length-1)),Z=q(Z,!0),{type:"codespan",raw:Q[0],text:Z}}},$.br=function(Y){var Q=this.rules.inline.br.exec(Y);if(Q)return{type:"br",raw:Q[0]}},$.del=function(Y){var Q=this.rules.inline.del.exec(Y);if(Q)return{type:"del",raw:Q[0],text:Q[1]}},$.autolink=function(Y,Q){var Z=this.rules.inline.autolink.exec(Y);if(Z){var ee,de;return Z[2]==="@"?(ee=q(this.options.mangle?Q(Z[1]):Z[1]),de="mailto:"+ee):(ee=q(Z[1]),de=ee),{type:"link",raw:Z[0],text:ee,href:de,tokens:[{type:"text",raw:ee,text:ee}]}}},$.url=function(Y,Q){var Z;if(Z=this.rules.inline.url.exec(Y)){var ee,de;if(Z[2]==="@")ee=q(this.options.mangle?Q(Z[0]):Z[0]),de="mailto:"+ee;else{var pe;do pe=Z[0],Z[0]=this.rules.inline._backpedal.exec(Z[0])[0];while(pe!==Z[0]);ee=q(Z[0]),Z[1]==="www."?de="http://"+ee:de=ee}return{type:"link",raw:Z[0],text:ee,href:de,tokens:[{type:"text",raw:ee,text:ee}]}}},$.inlineText=function(Y,Q,Z){var ee=this.rules.inline.text.exec(Y);if(ee){var de;return Q?de=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ee[0]):q(ee[0]):ee[0]:de=q(this.options.smartypants?Z(ee[0]):ee[0]),{type:"text",raw:ee[0],text:de}}},te}(),Ee=G.noopTest,ge=G.edit,ve=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:Ee,table:Ee,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=ge(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=ge(le.item,"gm").replace(/bull/g,le.bullet).getRegex(),le.list=ge(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=ge(le.html,"i").replace("comment",le._comment).replace("tag",le._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),le.paragraph=ge(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=ge(le.blockquote).replace("paragraph",le.paragraph).getRegex(),le.normal=ve({},le),le.gfm=ve({},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=ge(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=ge(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=ve({},le.normal,{html:ge(`^ *(?: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:Ee,paragraph:ge(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:Ee,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:Ee,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};ue._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",ue.punctuation=ge(ue.punctuation).replace(/punctuation/g,ue._punctuation).getRegex(),ue._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ue._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ue.em.start=ge(ue.em.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.middle=ge(ue.em.middle).replace(/punctuation/g,ue._punctuation).replace(/overlapSkip/g,ue._overlapSkip).getRegex(),ue.em.endAst=ge(ue.em.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.endUnd=ge(ue.em.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.start=ge(ue.strong.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.middle=ge(ue.strong.middle).replace(/punctuation/g,ue._punctuation).replace(/blockSkip/g,ue._blockSkip).getRegex(),ue.strong.endAst=ge(ue.strong.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.endUnd=ge(ue.strong.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.blockSkip=ge(ue._blockSkip,"g").getRegex(),ue.overlapSkip=ge(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=ge(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=ge(ue.tag).replace("comment",le._comment).replace("attribute",ue._attribute).getRegex(),ue._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ue._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ue._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ue.link=ge(ue.link).replace("label",ue._label).replace("href",ue._href).replace("title",ue._title).getRegex(),ue.reflink=ge(ue.reflink).replace("label",ue._label).getRegex(),ue.reflinkSearch=ge(ue.reflinkSearch,"g").replace("reflink",ue.reflink).replace("nolink",ue.nolink).getRegex(),ue.normal=ve({},ue),ue.pedantic=ve({},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:ge(/^!?\[(label)\]\((.*?)\)/).replace("label",ue._label).getRegex(),reflink:ge(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ue._label).getRegex()}),ue.gfm=ve({},ue.normal,{escape:ge(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=ge(ue.gfm.url,"i").replace("email",ue.gfm._extended_email).getRegex(),ue.breaks=ve({},ue.gfm,{br:ge(ue.br).replace("{2,}","*").getRegex(),text:ge(ue.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var be={block:le,inline:ue},je=F.defaults,Be=be.block,ke=be.inline;function Me(te){return te.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 we(te){var $="",ae,Y,Q=te.length;for(ae=0;ae<Q;ae++)Y=te.charCodeAt(ae),Math.random()>.5&&(Y="x"+Y.toString(16)),$+="&#"+Y+";";return $}var Ae=function(){function te(ae){this.tokens=[],this.tokens.links=Object.create(null),this.options=ae||je,this.options.tokenizer=this.options.tokenizer||new fe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Y={block:Be.normal,inline:ke.normal};this.options.pedantic?(Y.block=Be.pedantic,Y.inline=ke.pedantic):this.options.gfm&&(Y.block=Be.gfm,this.options.breaks?Y.inline=ke.breaks:Y.inline=ke.gfm),this.tokenizer.rules=Y}te.lex=function(Y,Q){var Z=new te(Q);return Z.lex(Y)};var $=te.prototype;return $.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},$.blockTokens=function(Y,Q,Z){Q===void 0&&(Q=[]),Z===void 0&&(Z=!0),Y=Y.replace(/^ +$/gm,"");for(var ee,de,pe,Le;Y;){if(ee=this.tokenizer.space(Y)){Y=Y.substring(ee.raw.length),ee.type&&Q.push(ee);continue}if(ee=this.tokenizer.code(Y,Q)){Y=Y.substring(ee.raw.length),ee.type?Q.push(ee):(Le=Q[Q.length-1],Le.raw+=`
|
|
`+ee.raw,Le.text+=`
|
|
`+ee.text);continue}if(ee=this.tokenizer.fences(Y)){Y=Y.substring(ee.raw.length),Q.push(ee);continue}if(ee=this.tokenizer.heading(Y)){Y=Y.substring(ee.raw.length),Q.push(ee);continue}if(ee=this.tokenizer.nptable(Y)){Y=Y.substring(ee.raw.length),Q.push(ee);continue}if(ee=this.tokenizer.hr(Y)){Y=Y.substring(ee.raw.length),Q.push(ee);continue}if(ee=this.tokenizer.blockquote(Y)){Y=Y.substring(ee.raw.length),ee.tokens=this.blockTokens(ee.text,[],Z),Q.push(ee);continue}if(ee=this.tokenizer.list(Y)){for(Y=Y.substring(ee.raw.length),pe=ee.items.length,de=0;de<pe;de++)ee.items[de].tokens=this.blockTokens(ee.items[de].text,[],!1);Q.push(ee);continue}if(ee=this.tokenizer.html(Y)){Y=Y.substring(ee.raw.length),Q.push(ee);continue}if(Z&&(ee=this.tokenizer.def(Y))){Y=Y.substring(ee.raw.length),this.tokens.links[ee.tag]||(this.tokens.links[ee.tag]={href:ee.href,title:ee.title});continue}if(ee=this.tokenizer.table(Y)){Y=Y.substring(ee.raw.length),Q.push(ee);continue}if(ee=this.tokenizer.lheading(Y)){Y=Y.substring(ee.raw.length),Q.push(ee);continue}if(Z&&(ee=this.tokenizer.paragraph(Y))){Y=Y.substring(ee.raw.length),Q.push(ee);continue}if(ee=this.tokenizer.text(Y,Q)){Y=Y.substring(ee.raw.length),ee.type?Q.push(ee):(Le=Q[Q.length-1],Le.raw+=`
|
|
`+ee.raw,Le.text+=`
|
|
`+ee.text);continue}if(Y){var tt="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(tt);break}else throw new Error(tt)}}return Q},$.inline=function(Y){var Q,Z,ee,de,pe,Le,tt=Y.length;for(Q=0;Q<tt;Q++){Le=Y[Q];switch(Le.type){case"paragraph":case"text":case"heading":{Le.tokens=[],this.inlineTokens(Le.text,Le.tokens);break}case"table":{for(Le.tokens={header:[],cells:[]},de=Le.header.length,Z=0;Z<de;Z++)Le.tokens.header[Z]=[],this.inlineTokens(Le.header[Z],Le.tokens.header[Z]);for(de=Le.cells.length,Z=0;Z<de;Z++)for(pe=Le.cells[Z],Le.tokens.cells[Z]=[],ee=0;ee<pe.length;ee++)Le.tokens.cells[Z][ee]=[],this.inlineTokens(pe[ee],Le.tokens.cells[Z][ee]);break}case"blockquote":{this.inline(Le.tokens);break}case"list":{for(de=Le.items.length,Z=0;Z<de;Z++)this.inline(Le.items[Z].tokens);break}}}return Y},$.inlineTokens=function(Y,Q,Z,ee,de){Q===void 0&&(Q=[]),Z===void 0&&(Z=!1),ee===void 0&&(ee=!1),de===void 0&&(de="");var pe,Le=Y,tt;if(this.tokens.links){var ct=Object.keys(this.tokens.links);if(ct.length>0)for(;(tt=this.tokenizer.rules.inline.reflinkSearch.exec(Le))!=null;)ct.includes(tt[0].slice(tt[0].lastIndexOf("[")+1,-1))&&(Le=Le.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+Le.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(tt=this.tokenizer.rules.inline.blockSkip.exec(Le))!=null;)Le=Le.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+Le.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Y;){if(pe=this.tokenizer.escape(Y)){Y=Y.substring(pe.raw.length),Q.push(pe);continue}if(pe=this.tokenizer.tag(Y,Z,ee)){Y=Y.substring(pe.raw.length),Z=pe.inLink,ee=pe.inRawBlock,Q.push(pe);continue}if(pe=this.tokenizer.link(Y)){Y=Y.substring(pe.raw.length),pe.type==="link"&&(pe.tokens=this.inlineTokens(pe.text,[],!0,ee)),Q.push(pe);continue}if(pe=this.tokenizer.reflink(Y,this.tokens.links)){Y=Y.substring(pe.raw.length),pe.type==="link"&&(pe.tokens=this.inlineTokens(pe.text,[],!0,ee)),Q.push(pe);continue}if(pe=this.tokenizer.strong(Y,Le,de)){Y=Y.substring(pe.raw.length),pe.tokens=this.inlineTokens(pe.text,[],Z,ee),Q.push(pe);continue}if(pe=this.tokenizer.em(Y,Le,de)){Y=Y.substring(pe.raw.length),pe.tokens=this.inlineTokens(pe.text,[],Z,ee),Q.push(pe);continue}if(pe=this.tokenizer.codespan(Y)){Y=Y.substring(pe.raw.length),Q.push(pe);continue}if(pe=this.tokenizer.br(Y)){Y=Y.substring(pe.raw.length),Q.push(pe);continue}if(pe=this.tokenizer.del(Y)){Y=Y.substring(pe.raw.length),pe.tokens=this.inlineTokens(pe.text,[],Z,ee),Q.push(pe);continue}if(pe=this.tokenizer.autolink(Y,we)){Y=Y.substring(pe.raw.length),Q.push(pe);continue}if(!Z&&(pe=this.tokenizer.url(Y,we))){Y=Y.substring(pe.raw.length),Q.push(pe);continue}if(pe=this.tokenizer.inlineText(Y,ee,Me)){Y=Y.substring(pe.raw.length),de=pe.raw.slice(-1),Q.push(pe);continue}if(Y){var rt="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(rt);break}else throw new Error(rt)}}return Q},z(te,null,[{key:"rules",get:function(){return{block:Be,inline:ke}}}]),te}(),Ue=F.defaults,Ge=G.cleanUrl,He=G.escape,_e=function(){function te(ae){this.options=ae||Ue}var $=te.prototype;return $.code=function(Y,Q,Z){var ee=(Q||"").match(/\S*/)[0];if(this.options.highlight){var de=this.options.highlight(Y,ee);de!=null&&de!==Y&&(Z=!0,Y=de)}return ee?'<pre><code class="'+this.options.langPrefix+He(ee,!0)+'">'+(Z?Y:He(Y,!0))+`</code></pre>
|
|
`:"<pre><code>"+(Z?Y:He(Y,!0))+`</code></pre>
|
|
`},$.blockquote=function(Y){return`<blockquote>
|
|
`+Y+`</blockquote>
|
|
`},$.html=function(Y){return Y},$.heading=function(Y,Q,Z,ee){return this.options.headerIds?"<h"+Q+' id="'+this.options.headerPrefix+ee.slug(Z)+'">'+Y+"</h"+Q+`>
|
|
`:"<h"+Q+">"+Y+"</h"+Q+`>
|
|
`},$.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},$.list=function(Y,Q,Z){var ee=Q?"ol":"ul",de=Q&&Z!==1?' start="'+Z+'"':"";return"<"+ee+de+`>
|
|
`+Y+"</"+ee+`>
|
|
`},$.listitem=function(Y){return"<li>"+Y+`</li>
|
|
`},$.checkbox=function(Y){return"<input "+(Y?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},$.paragraph=function(Y){return"<p>"+Y+`</p>
|
|
`},$.table=function(Y,Q){return Q&&(Q="<tbody>"+Q+"</tbody>"),`<table>
|
|
<thead>
|
|
`+Y+`</thead>
|
|
`+Q+`</table>
|
|
`},$.tablerow=function(Y){return`<tr>
|
|
`+Y+`</tr>
|
|
`},$.tablecell=function(Y,Q){var Z=Q.header?"th":"td",ee=Q.align?"<"+Z+' align="'+Q.align+'">':"<"+Z+">";return ee+Y+"</"+Z+`>
|
|
`},$.strong=function(Y){return"<strong>"+Y+"</strong>"},$.em=function(Y){return"<em>"+Y+"</em>"},$.codespan=function(Y){return"<code>"+Y+"</code>"},$.br=function(){return this.options.xhtml?"<br/>":"<br>"},$.del=function(Y){return"<del>"+Y+"</del>"},$.link=function(Y,Q,Z){if(Y=Ge(this.options.sanitize,this.options.baseUrl,Y),Y===null)return Z;var ee='<a href="'+He(Y)+'"';return Q&&(ee+=' title="'+Q+'"'),ee+=">"+Z+"</a>",ee},$.image=function(Y,Q,Z){if(Y=Ge(this.options.sanitize,this.options.baseUrl,Y),Y===null)return Z;var ee='<img src="'+Y+'" alt="'+Z+'"';return Q&&(ee+=' title="'+Q+'"'),ee+=this.options.xhtml?"/>":">",ee},$.text=function(Y){return Y},te}(),Te=function(){function te(){}var $=te.prototype;return $.strong=function(Y){return Y},$.em=function(Y){return Y},$.codespan=function(Y){return Y},$.del=function(Y){return Y},$.html=function(Y){return Y},$.text=function(Y){return Y},$.link=function(Y,Q,Z){return""+Z},$.image=function(Y,Q,Z){return""+Z},$.br=function(){return""},te}(),Ce=function(){function te(){this.seen={}}var $=te.prototype;return $.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},te}(),Re=F.defaults,Fe=G.unescape,Ne=function(){function te(ae){this.options=ae||Re,this.options.renderer=this.options.renderer||new _e,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Te,this.slugger=new Ce}te.parse=function(Y,Q){var Z=new te(Q);return Z.parse(Y)};var $=te.prototype;return $.parse=function(Y,Q){Q===void 0&&(Q=!0);var Z="",ee,de,pe,Le,tt,ct,rt,Et,ht,nt,bt,vt,Bt,Dt,ft,Gt,vr,Xt,Yt=Y.length;for(ee=0;ee<Yt;ee++){nt=Y[ee];switch(nt.type){case"space":continue;case"hr":{Z+=this.renderer.hr();continue}case"heading":{Z+=this.renderer.heading(this.parseInline(nt.tokens),nt.depth,Fe(this.parseInline(nt.tokens,this.textRenderer)),this.slugger);continue}case"code":{Z+=this.renderer.code(nt.text,nt.lang,nt.escaped);continue}case"table":{for(Et="",rt="",Le=nt.header.length,de=0;de<Le;de++)rt+=this.renderer.tablecell(this.parseInline(nt.tokens.header[de]),{header:!0,align:nt.align[de]});for(Et+=this.renderer.tablerow(rt),ht="",Le=nt.cells.length,de=0;de<Le;de++){for(ct=nt.tokens.cells[de],rt="",tt=ct.length,pe=0;pe<tt;pe++)rt+=this.renderer.tablecell(this.parseInline(ct[pe]),{header:!1,align:nt.align[pe]});ht+=this.renderer.tablerow(rt)}Z+=this.renderer.table(Et,ht);continue}case"blockquote":{ht=this.parse(nt.tokens),Z+=this.renderer.blockquote(ht);continue}case"list":{for(bt=nt.ordered,vt=nt.start,Bt=nt.loose,Le=nt.items.length,ht="",de=0;de<Le;de++)ft=nt.items[de],Gt=ft.checked,vr=ft.task,Dt="",ft.task&&(Xt=this.renderer.checkbox(Gt),Bt?ft.tokens.length>0&&ft.tokens[0].type==="text"?(ft.tokens[0].text=Xt+" "+ft.tokens[0].text,ft.tokens[0].tokens&&ft.tokens[0].tokens.length>0&&ft.tokens[0].tokens[0].type==="text"&&(ft.tokens[0].tokens[0].text=Xt+" "+ft.tokens[0].tokens[0].text)):ft.tokens.unshift({type:"text",text:Xt}):Dt+=Xt),Dt+=this.parse(ft.tokens,Bt),ht+=this.renderer.listitem(Dt,vr,Gt);Z+=this.renderer.list(ht,bt,vt);continue}case"html":{Z+=this.renderer.html(nt.text);continue}case"paragraph":{Z+=this.renderer.paragraph(this.parseInline(nt.tokens));continue}case"text":{for(ht=nt.tokens?this.parseInline(nt.tokens):nt.text;ee+1<Yt&&Y[ee+1].type==="text";)nt=Y[++ee],ht+=`
|
|
`+(nt.tokens?this.parseInline(nt.tokens):nt.text);Z+=Q?this.renderer.paragraph(ht):ht;continue}default:{var rr='Token with "'+nt.type+'" type was not found.';if(this.options.silent){console.error(rr);return}else throw new Error(rr)}}}return Z},$.parseInline=function(Y,Q){Q=Q||this.renderer;var Z="",ee,de,pe=Y.length;for(ee=0;ee<pe;ee++){de=Y[ee];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 Le='Token with "'+de.type+'" type was not found.';if(this.options.silent){console.error(Le);return}else throw new Error(Le)}}}return Z},te}(),De=G.merge,ze=G.checkSanitizeDeprecation,Xe=G.escape,me=F.getDefaults,Ye=F.changeDefaults,Ke=F.defaults;function ye(te,$,ae){if(typeof te=="undefined"||te===null)throw new Error("marked(): input parameter is undefined or null");if(typeof te!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(te)+", string expected");if(typeof $=="function"&&(ae=$,$=null),$=De({},ye.defaults,$||{}),ze($),ae){var Y=$.highlight,Q;try{Q=Ae.lex(te,$)}catch(pe){return ae(pe)}var Z=function(Le){var tt;if(!Le)try{tt=Ne.parse(Q,$)}catch(ct){Le=ct}return $.highlight=Y,Le?ae(Le):ae(null,tt)};if(!Y||Y.length<3)return Z();if(delete $.highlight,!Q.length)return Z();var ee=0;ye.walkTokens(Q,function(pe){pe.type==="code"&&(ee++,setTimeout(function(){Y(pe.text,pe.lang,function(Le,tt){if(Le)return Z(Le);tt!=null&&tt!==pe.text&&(pe.text=tt,pe.escaped=!0),ee--,ee===0&&Z()})},0))}),ee===0&&Z();return}try{var de=Ae.lex(te,$);return $.walkTokens&&ye.walkTokens(de,$.walkTokens),Ne.parse(de,$)}catch(pe){if(pe.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,$.silent)return"<p>An error occurred:</p><pre>"+Xe(pe.message+"",!0)+"</pre>";throw pe}}ye.options=ye.setOptions=function(te){return De(ye.defaults,te),Ye(ye.defaults),ye},ye.getDefaults=me,ye.defaults=Ke,ye.use=function(te){var $=De({},te);if(te.renderer&&function(){var Y=ye.defaults.renderer||new _e,Q=function(de){var pe=Y[de];Y[de]=function(){for(var Le=arguments.length,tt=new Array(Le),ct=0;ct<Le;ct++)tt[ct]=arguments[ct];var rt=te.renderer[de].apply(Y,tt);return rt===!1&&(rt=pe.apply(Y,tt)),rt}};for(var Z in te.renderer)Q(Z);$.renderer=Y}(),te.tokenizer&&function(){var Y=ye.defaults.tokenizer||new fe,Q=function(de){var pe=Y[de];Y[de]=function(){for(var Le=arguments.length,tt=new Array(Le),ct=0;ct<Le;ct++)tt[ct]=arguments[ct];var rt=te.tokenizer[de].apply(Y,tt);return rt===!1&&(rt=pe.apply(Y,tt)),rt}};for(var Z in te.tokenizer)Q(Z);$.tokenizer=Y}(),te.walkTokens){var ae=ye.defaults.walkTokens;$.walkTokens=function(Y){te.walkTokens(Y),ae&&ae(Y)}}ye.setOptions($)},ye.walkTokens=function(te,$){for(var ae=k(te),Y;!(Y=ae()).done;){var Q=Y.value;$(Q);switch(Q.type){case"table":{for(var Z=k(Q.tokens.header),ee;!(ee=Z()).done;){var de=ee.value;ye.walkTokens(de,$)}for(var pe=k(Q.tokens.cells),Le;!(Le=pe()).done;)for(var tt=Le.value,ct=k(tt),rt;!(rt=ct()).done;){var Et=rt.value;ye.walkTokens(Et,$)}break}case"list":{ye.walkTokens(Q.items,$);break}default:Q.tokens&&ye.walkTokens(Q.tokens,$)}}},ye.Parser=Ne,ye.parser=Ne.parse,ye.Renderer=_e,ye.TextRenderer=Te,ye.Lexer=Ae,ye.lexer=Ae.lex,ye.Tokenizer=fe,ye.Slugger=Ce,ye.parse=ye;var Oe=ye;return Oe})},ELLl:function(it,Je,J){(function(re){re(J("VrN/"))})(function(re){var z={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},L=re.Pos;re.defineOption("autoCloseBrackets",!1,function(w,b,d){d&&d!=re.Init&&(w.removeKeyMap(k),w.state.closeBrackets=null),b&&(M(H(b,"pairs")),w.state.closeBrackets=b,w.addKeyMap(k))});function H(w,b){return b=="pairs"&&typeof w=="string"?w:typeof w=="object"&&w[b]!=null?w[b]:z[b]}var k={Backspace:D,Enter:O};function M(w){for(var b=0;b<w.length;b++){var d=w.charAt(b),o="'"+d+"'";k[o]||(k[o]=F(d))}}M(z.pairs+"`");function F(w){return function(b){return _(b,w)}}function P(w){var b=w.state.closeBrackets;if(!b||b.override)return b;var d=w.getModeAt(w.getCursor());return d.closeBrackets||b}function D(w){var b=P(w);if(!b||w.getOption("disableInput"))return re.Pass;for(var d=H(b,"pairs"),o=w.listSelections(),u=0;u<o.length;u++){if(!o[u].empty())return re.Pass;var l=T(w,o[u].head);if(!l||d.indexOf(l)%2!=0)return re.Pass}for(var u=o.length-1;u>=0;u--){var S=o[u].head;w.replaceRange("",L(S.line,S.ch-1),L(S.line,S.ch+1),"+delete")}}function O(w){var b=P(w),d=b&&H(b,"explode");if(!d||w.getOption("disableInput"))return re.Pass;for(var o=w.listSelections(),u=0;u<o.length;u++){if(!o[u].empty())return re.Pass;var l=T(w,o[u].head);if(!l||d.indexOf(l)%2!=0)return re.Pass}w.operation(function(){var S=w.lineSeparator()||`
|
|
`;w.replaceSelection(S+S,null),w.execCommand("goCharLeft"),o=w.listSelections();for(var h=0;h<o.length;h++){var g=o[h].head.line;w.indentLine(g,null,!0),w.indentLine(g+1,null,!0)}})}function E(w){var b=re.cmpPos(w.anchor,w.head)>0;return{anchor:new L(w.anchor.line,w.anchor.ch+(b?-1:1)),head:new L(w.head.line,w.head.ch+(b?1:-1))}}function _(w,b){var d=P(w);if(!d||w.getOption("disableInput"))return re.Pass;var o=H(d,"pairs"),u=o.indexOf(b);if(u==-1)return re.Pass;for(var l=H(d,"closeBefore"),S=H(d,"triples"),h=o.charAt(u+1)==b,g=w.listSelections(),C=u%2==0,y,f=0;f<g.length;f++){var c=g[f],s=c.head,a,m=w.getRange(s,L(s.line,s.ch+1));if(C&&!c.empty())a="surround";else if((h||!C)&&m==b)h&&A(w,s)?a="both":S.indexOf(b)>=0&&w.getRange(s,L(s.line,s.ch+3))==b+b+b?a="skipThree":a="skip";else if(h&&s.ch>1&&S.indexOf(b)>=0&&w.getRange(L(s.line,s.ch-2),s)==b+b){if(s.ch>2&&/\bstring/.test(w.getTokenTypeAt(L(s.line,s.ch-2))))return re.Pass;a="addFour"}else if(h){var p=s.ch==0?" ":w.getRange(L(s.line,s.ch-1),s);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?o.charAt(u-1):b,R=u%2?b:o.charAt(u+1);w.operation(function(){if(y=="skip")w.execCommand("goCharRight");else if(y=="skipThree")for(var U=0;U<3;U++)w.execCommand("goCharRight");else if(y=="surround"){for(var j=w.getSelections(),U=0;U<j.length;U++)j[U]=v+j[U]+R;w.replaceSelections(j,"around"),j=w.listSelections().slice();for(var U=0;U<j.length;U++)j[U]=E(j[U]);w.setSelections(j)}else y=="both"?(w.replaceSelection(v+R,null),w.triggerElectric(v+R),w.execCommand("goCharLeft")):y=="addFour"&&(w.replaceSelection(v+v+v+v,"before"),w.execCommand("goCharRight"))})}function T(w,b){var d=w.getRange(L(b.line,b.ch-1),L(b.line,b.ch+1));return d.length==2?d:null}function A(w,b){var d=w.getTokenAt(L(b.line,b.ch+1));return/\bstring/.test(d.type)&&d.start==b.ch&&(b.ch==0||!/\bstring/.test(w.getTokenTypeAt(b)))}})},FdIy:function(it,Je,J){},G8my:function(it,Je,J){it.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(it,Je,J){},Jtvl:function(it,Je){it.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(it,Je,J){"use strict";J.d(Je,"b",function(){return l}),J.d(Je,"a",function(){return h});var re=J("1OyB"),z=J("vuIU"),L=J("Ji7U"),H=J("LK+K"),k=J("q1tI"),M=J("rePB"),F=J("Ff2n"),P=J("ODXe"),D=J("4IlW"),O=J("bX4T"),E=J("YrtM"),_=J("TSYQ"),T=J.n(_),A=J("+nKL"),w=J("8OUc"),b=function(V,q){var ie=V.prefixCls,se=V.id,xe=V.flattenOptions,fe=V.childrenAsData,Ee=V.values,ge=V.searchValue,ve=V.multiple,le=V.defaultActiveFirstOption,ue=V.height,be=V.itemHeight,je=V.notFoundContent,Be=V.open,ke=V.menuItemSelectedIcon,Me=V.virtual,we=V.onSelect,Ae=V.onToggleOpen,Ue=V.onActiveValue,Ge=V.onScroll,He=V.onMouseEnter,_e="".concat(ie,"-item"),Te=Object(E.a)(function(){return xe},[Be,xe],function(Oe,te){return te[0]&&Oe[1]!==te[1]}),Ce=k.useRef(null),Re=function(te){te.preventDefault()},Fe=function(te){Ce.current&&Ce.current.scrollTo({index:te})},Ne=function(te){for(var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ae=Te.length,Y=0;Y<ae;Y+=1){var Q=(te+Y*$+ae)%ae,Z=Te[Q],ee=Z.group,de=Z.data;if(!ee&&!de.disabled)return Q}return-1},De=k.useState(function(){return Ne(0)}),ze=Object(P.a)(De,2),Xe=ze[0],me=ze[1],Ye=function(te){me(te);var $=Te[te];if(!$){Ue(null,-1);return}Ue($.data.value,te)};k.useEffect(function(){Ye(le!==!1?Ne(0):-1)},[Te.length,ge]),k.useEffect(function(){var Oe=setTimeout(function(){if(!ve&&Be&&Ee.size===1){var te=Array.from(Ee)[0],$=Te.findIndex(function(ae){var Y=ae.data;return Y.value===te});Ye($),Fe($)}});return function(){return clearTimeout(Oe)}},[Be]);var Ke=function(te){te!==void 0&&we(te,{selected:!Ee.has(te)}),ve||Ae(!1)};if(k.useImperativeHandle(q,function(){return{onKeyDown:function(te){var $=te.which;switch($){case D.a.UP:case D.a.DOWN:{var ae=0;if($===D.a.UP?ae=-1:$===D.a.DOWN&&(ae=1),ae!==0){var Y=Ne(Xe+ae,ae);Fe(Y),Ye(Y)}break}case D.a.ENTER:{var Q=Te[Xe];Q&&!Q.data.disabled?Ke(Q.data.value):Ke(void 0),Be&&te.preventDefault();break}case D.a.ESC:Ae(!1)}},onKeyUp:function(){},scrollTo:function(te){Fe(te)}}}),Te.length===0)return k.createElement("div",{role:"listbox",id:"".concat(se,"_list"),className:"".concat(_e,"-empty"),onMouseDown:Re},je);function ye(Oe){var te=Te[Oe];if(!te)return null;var $=te.data||{},ae=$.value,Y=$.label,Q=$.children,Z=Object(O.a)($,!0),ee=fe?Q:Y;return te?k.createElement("div",Object.assign({"aria-label":typeof ee=="string"?ee:null},Z,{key:Oe,role:"option",id:"".concat(se,"_list_").concat(Oe),"aria-selected":Ee.has(ae)}),ae):null}return k.createElement(k.Fragment,null,k.createElement("div",{role:"listbox",id:"".concat(se,"_list"),style:{height:0,width:0,overflow:"hidden"}},ye(Xe-1),ye(Xe),ye(Xe+1)),k.createElement(A.a,{itemKey:"key",ref:Ce,data:Te,height:ue,itemHeight:be,fullHeight:!1,onMouseDown:Re,onScroll:Ge,virtual:Me,onMouseEnter:He},function(Oe,te){var $,ae=Oe.group,Y=Oe.groupOption,Q=Oe.data,Z=Q.label,ee=Q.key;if(ae)return k.createElement("div",{className:T()(_e,"".concat(_e,"-group"))},Z!==void 0?Z:ee);var de=Q.disabled,pe=Q.value,Le=Q.title,tt=Q.children,ct=Q.style,rt=Q.className,Et=Object(F.a)(Q,["disabled","value","title","children","style","className"]),ht=Ee.has(pe),nt="".concat(_e,"-option"),bt=T()(_e,nt,rt,($={},Object(M.a)($,"".concat(nt,"-grouped"),Y),Object(M.a)($,"".concat(nt,"-active"),Xe===te&&!de),Object(M.a)($,"".concat(nt,"-disabled"),de),Object(M.a)($,"".concat(nt,"-selected"),ht),$)),vt=fe?tt:Z,Bt=!ke||typeof ke=="function"||ht;return k.createElement("div",Object.assign({},Et,{"aria-selected":ht,className:bt,title:Le,onMouseMove:function(){if(Xe===te||de)return;Ye(te)},onClick:function(){de||Ke(pe)},style:ct}),k.createElement("div",{className:"".concat(nt,"-content")},vt||pe),k.isValidElement(ke)||ht,Bt&&k.createElement(w.a,{className:"".concat(_e,"-option-state"),customizeIcon:ke,customizeIconProps:{isSelected:ht}},ht?"\u2713":null))}))},d=k.forwardRef(b);d.displayName="OptionList";var o=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,q=N.props,ie=q.children,se=q.value,xe=Object(F.a)(q,["children","value"]);return Object(g.a)({key:V,value:se!==void 0?se:V,children:ie},xe)}function f(N){var V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(C.a)(N).map(function(q,ie){if(!k.isValidElement(q)||!q.type)return null;var se=q.type.isSelectOptGroup,xe=q.key,fe=q.props,Ee=fe.children,ge=Object(F.a)(fe,["children"]);return V||!se?y(q):Object(g.a)(Object(g.a)({key:"__RC_SELECT_GRP__".concat(xe===null?ie:xe,"__"),label:xe},ge),{},{options:f(Ee)})}).filter(function(q){return q})}var c=J("2Qr1"),s=J("qNPg"),a=J("U8pU"),m=J("Kwbf"),p=J("WKfj");function v(N){var V=N.mode,q=N.options,ie=N.children,se=N.backfill,xe=N.allowClear,fe=N.placeholder,Ee=N.getInputElement,ge=N.showSearch,ve=N.onSearch,le=N.defaultOpen,ue=N.autoFocus,be=N.labelInValue,je=N.value,Be=N.inputValue,ke=N.optionLabelProp,Me=V==="multiple"||V==="tags",we=ge!==void 0?ge:Me||V==="combobox",Ae=q||f(ie);if(Object(m.a)(V!=="tags"||Ae.every(function(_e){return!_e.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),V==="tags"||V==="combobox"){var Ue=Ae.some(function(_e){return _e.options?_e.options.some(function(Te){return typeof("value"in Te?Te.value:Te.key)=="number"}):typeof("value"in _e?_e.value:_e.key)=="number"});Object(m.a)(!Ue,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(m.a)(V!=="combobox"||!ke,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(m.a)(V==="combobox"||!se,"`backfill` only works with `combobox` mode."),Object(m.a)(V==="combobox"||!Ee,"`getInputElement` only work with `combobox` mode."),Object(m.b)(V!=="combobox"||!Ee||!xe||!fe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),ve&&!we&&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."),je!=null){var Ge=Object(p.d)(je);Object(m.a)(!be||Ge.every(function(_e){return Object(a.a)(_e)==="object"&&("key"in _e||"value"in _e)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(m.a)(!Me||Array.isArray(je),"`value` should be array when `mode` is `multiple` or `tags`")}if(ie){var He=null;Object(C.a)(ie).some(function(_e){if(!k.isValidElement(_e)||!_e.type)return!1;var Te=_e.type;if(Te.isSelectOption)return!1;if(Te.isSelectOptGroup){var Ce=Object(C.a)(_e.props.children).every(function(Re){return!k.isValidElement(Re)||!_e.type||Re.type.isSelectOption?!0:(He=Re.type,!1)});return!Ce}return He=Te,!0}),He&&Object(m.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(He.displayName||He.name||He,"`.")),Object(m.a)(Be===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var R=v,U=Object(s.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:f,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:R,fillOptionsWithMissingValue:c.a}),j=function(N){Object(L.a)(q,N);var V=Object(H.a)(q);function q(){var ie;return Object(re.a)(this,q),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)(q,[{key:"render",value:function(){return k.createElement(U,Object.assign({ref:this.selectRef},this.props))}}]),q}(k.Component);j.Option=l,j.OptGroup=h;var G=j,B=Je.c=G},M8RZ:function(it,Je,J){"use strict";J.d(Je,"a",function(){return D});var re=J("fWQN"),z=J("mtLc"),L=J("yKVA"),H=J("879j"),k=J("q1tI"),M=J.n(k),F=J("i8i4"),P=J.n(F),D=function(O){Object(L.a)(_,O);var E=Object(H.a)(_);function _(T){var A;Object(re.a)(this,_),A=E.call(this,T);var w=window.document;return A.node=w.createElement("div"),w.body.appendChild(A.node),A}return Object(z.a)(_,[{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)}}]),_}(M.a.Component)},MXfU:function(it,Je){it.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(it,Je,J){it.exports={none_panels:"none_panels___1g-mA",none_p_title:"none_p_title___1lCVD"}},Ot1p:function(it,Je,J){"use strict";var re=J("2qtc"),z=J("kLXV"),L=J("rAM+"),H=J("miYZ"),k=J("tsqr"),M=J("tJVT"),F=J("jrin"),P=J("q1tI"),D=J.n(P),O=J("VrN/"),E=J.n(O),_=J("bdgK"),T=J("p77/"),A=J("Bd2K"),w=J("ELLl"),b=J("19Vz"),d=J("lZu9"),o=J("+NIl"),u=J("kSUc"),l=J("9Bee"),S=function(te){var $=te.value,ae=$===void 0?"":$,Y=te.className,Q=te.showTextOnly,Z=te.showLines,ee=te.style,de=ee===void 0?{}:ee,pe=Object(P.useMemo)(function(){return""},[ae]);return D.a.createElement(D.a.Fragment,null,D.a.createElement("div",{dangerouslySetInnerHTML:{__html:pe}}))},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(te){var $=te.onActionCallback,ae=te.title,Y=te.icon,Q=te.actionName,Z=te.className,ee=Z===void 0?"":Z,de=te.children;function pe(){$(Q)}return D.a.createElement("a",{title:ae,className:ee,onClick:pe},D.a.createElement("i",{className:"md-iconfont ".concat(Y)}),de)}var c=function(te){var $=te.watch,ae=te.showNullButton,Y=te.onActionCallback,Q=te.fullScreen,Z=te.insertTemp,ee=te.hidetoolBar,de=[].concat(y,[{title:"".concat($?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat($?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return D.a.createElement("ul",{className:"markdown-toolbar-container"},!ee&&de.map(function(pe,Le){return D.a.createElement("li",{key:Le},pe.actionName?D.a.createElement(f,Object(h.a)({},pe,{onActionCallback:Y})):D.a.createElement("span",{className:"v-line"}))}),ae?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:Y},D.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Z&&D.a.createElement("li",null,D.a.createElement(f,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Z),onActionCallback:Y},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:Y})))},s=J("M8RZ"),a=J("+L6B"),m=J("2/Rp"),p=J("y8nQ"),v=J("Vl3Y"),R=J("5NDa"),U=J("5rEg"),j={labelCol:{span:4},wrapperCol:{span:20}},G=function(te){var $=te.callback,ae=te.onCancel;function Y(Q){$(Q)}return D.a.createElement(v.a,Object(h.a)({},j,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Y}),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:ae},"\u53D6\u6D88")))},B=J("7ahc"),N=J("HmJG"),V=J("BjJ7"),q=v.a.useForm,ie={width:280,marginRight:10},se={labelCol:{span:5},wrapperCol:{span:19}},xe=function(te){var $=te.callback,ae=te.onCancel,Y=q(),Q=Object(M.a)(Y,1),Z=Q[0];function ee(Le){$(Le)}function de(Le,tt){Z.setFieldsValue({src:"/api/attachments/".concat(Le.id),type:tt.type})}function pe(Le){var tt=Le.target.files[0];Ee(tt,de)}return D.a.createElement(v.a,Object(h.a)({form:Z},se,{className:"upload-image-panel",onFinish:ee}),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:pe}))),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:ae},"\u53D6\u6D88")))};function fe(te){var $=te.onFileChange;return D.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",D.a.createElement("input",{type:"file",onChange:$}))}function Ee(te,$){if(!te)throw new String("\u6CA1\u6709\u6587\u4EF6");var ae=new FormData;ae.append("editormd-image-file",te),ae.append("file_param_name","editormd-image-file"),ae.append("byxhr","true");var Y=new window.XMLHttpRequest;Y.withCredentials=!0,Y.addEventListener("load",function(Q){$(JSON.parse(Q.target.responseText),te)},!1),Y.addEventListener("error",function(Q){console.error(Q)},!1),Y.open("POST","".concat(V.a,"/api/attachments.json")),Y.send(ae)}var ge=J("giR+"),ve=J("fyUT"),le=J("7Kak"),ue=J("9yH6"),be=ue.a.Group,je={margin:"0 8px"},Be=function(te){var $=te.callback,ae=te.onCancel;function Y(Q){$(Q)}return D.a.createElement(v.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Y},D.a.createElement("div",{className:"flex-container"},D.a.createElement("span",{style:je},"\u5355\u5143\u683C\u6570\uFF1A"),D.a.createElement("span",{style:je},"\u884C\u6570"),D.a.createElement(v.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},D.a.createElement(ve.a,null)),D.a.createElement("span",{style:je},"\u5217\u6570"),D.a.createElement(v.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},D.a.createElement(ve.a,null))),D.a.createElement("div",{className:"flex-container",style:{marginTop:12}},D.a.createElement("span",{style:je},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),D.a.createElement(v.a.Item,{name:"align"},D.a.createElement(be,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:ae},"\u53D6\u6D88")))},ke=J("m3rI"),Me="link",we="upload-image",Ae="code-block",Ue="add-table",Ge="------------",He={default:Ge,left:":".concat(Ge),center:":".concat(Ge,":"),right:"".concat(Ge,":")},_e=J("9VGf"),Te,Ce;function Re(){}var Fe=0,Ne=1e4,De="\u2581",ze=`
|
|
**\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 Xe(te){return/^\d+$/.test(te)?"".concat(te,"px"):te}var me=navigator.platform.toUpperCase().indexOf("MAC")>=0,Ye=me?"Cmd":"Ctrl",Ke=(Te={},Object(F.a)(Te,Ye+"-B","bold"),Object(F.a)(Te,Ye+"-I","italic"),Te),ye=(Ce={},Object(F.a)(Ce,Me,"\u6DFB\u52A0\u94FE\u63A5"),Object(F.a)(Ce,Ae,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(F.a)(Ce,we,"\u6DFB\u52A0\u56FE\u7247"),Object(F.a)(Ce,Ue,"\u6DFB\u52A0\u8868\u683C"),Ce),Oe=Je.a=function(te){var $=te.defaultValue,ae=$===void 0?"":$,Y=te.onChange,Q=te.width,Z=Q===void 0?"100%":Q,ee=te.height,de=ee===void 0?400:ee,pe=te.miniToolbar,Le=pe===void 0?!1:pe,tt=te.isFocus,ct=tt===void 0?!1:tt,rt=te.watch,Et=te.insertTemp,ht=te.mode,nt=ht===void 0?"markdown":ht,bt=te.id,vt=bt===void 0?"markdown-editor-id":bt,Bt=te.showResizeBar,Dt=Bt===void 0?!1:Bt,ft=te.noStorage,Gt=ft===void 0?!1:ft,vr=te.showNullButton,Xt=vr===void 0?!1:vr,Yt=te.hidetoolBar,rr=Yt===void 0?!1:Yt,kr=te.fullScreen,It=kr===void 0?!1:kr,Nt=te.onBlur,Ht=te.onCMBeforeChange,Ct=te.onFullScreen,et=te.className,yr=et===void 0?"":et,Ir=te.disablePaste,ur=Ir===void 0?!1:Ir,yt=te.placeholder,br=yt===void 0?"":yt,Er=te.values,dr=Er===void 0?"":Er,Ie=Object(P.useState)(null),st=Object(M.a)(Ie,2),Ve=st[0],Nr=st[1],Dr=Object(P.useState)(ae),Sr=Object(M.a)(Dr,2),Cr=Sr[0],lt=Sr[1],Pt=Object(P.useState)(rt),Vr=Object(M.a)(Pt,2),Qt=Vr[0],dt=Vr[1],Tt=Object(P.useState)(It),Ar=Object(M.a)(Tt,2),Lt=Ar[0],Wr=Ar[1],sn=Object(P.useState)(""),ln=Object(M.a)(sn,2),cr=ln[0],Hr=ln[1],Ti=Object(P.useState)(0),zn=Object(M.a)(Ti,2),un=zn[0],Gn=zn[1],Si=Object(P.useState)(de),Lr=Object(M.a)(Si,2),wi=Lr[0],_i=Lr[1],Sn=Object(P.useState)(!1),Xr=Object(M.a)(Sn,2),Ua=Xr[0],Vn=Xr[1],dn=Object(P.useRef)(),Xn=Object(P.useRef)(),Yr=Object(P.useRef)(),cn=Object(P.useRef)();Object(P.useEffect)(function(){lt(dr),Ve==null||Ve.setValue(dr)},[dr]),Object(P.useEffect)(function(){Ct==null||Ct(Lt)},[Lt]),Object(P.useEffect)(function(){if(dn.current){var at=E.a.fromTextArea(dn.current,{mode:nt,lineNumbers:!Le,lineWrapping:!0,value:ae,autoCloseTags:!0,autoCloseBrackets:!0});ct&&at.focus();function mt(pt,wt){if(ur){wt.preventDefault();return}var _t=wt.clipboardData;if(_t){var Rt=_t.types.toString(),jt=_t.items,Mt=["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(Rt==="Files"||_t.types.indexOf("Files")>-1){if(wt.preventDefault(),nt=="stex")return;try{var nr,Rr=jt[1];((nr=jt[0])===null||nr===void 0?void 0:nr.kind)==="file"&&(Rr=jt[0]);var Ot=Rr.getAsFile(),Qr=Ot.name.split(".").pop();Ee(Ot,function(ir){if(ir.id){var Zr,Jr,_n;(Ot==null||((Zr=Ot.type)===null||Zr===void 0)?void 0:Zr.indexOf("image"))>-1?at.replaceSelection(".concat(ir.content_type,")")):(Ot==null||((Jr=Ot.type)===null||Jr===void 0)?void 0:Jr.indexOf("video"))>-1?at.replaceSelection('<video width="100%" controls src="'.concat(ke.a.API_SERVER,"/api/attachments/").concat(ir.id,'"></video>')):(Ot==null||((_n=Ot.type)===null||_n===void 0)?void 0:_n.indexOf("pdf"))>-1?at.replaceSelection('<a href="'.concat(ke.a.API_SERVER,"/api/attachments/").concat(ir.id,"?type=").concat(Ot.type,'&disposition=inline" target="_blank">').concat(Ot.name,"</a>")):Mt.includes(Qr)?at.replaceSelection('<a href="'.concat(ke.a.API_SERVER,"/api/attachments/").concat(ir.id,'?type=office&disposition=inline" target="_blank">').concat(Ot.name,"</a>")):at.replaceSelection("[".concat(Ot.name,"](").concat(ke.a.API_SERVER,"/api/attachments/").concat(ir.id,"?type=").concat(ir.content_type,")"))}else(ir==null?void 0:ir.status)===401&&(document.location.href="/user/login")})}catch(ir){k.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return at.on("paste",mt),Nr(at),function(){at.off("paste",mt)}}},[]);var Ci=Object(P.useCallback)(function(){if(Xn.current)try{}catch(at){console.log(at,"---- to set md editor body height")}},[wi,Xn,Lt]);Object(P.useEffect)(function(){function at(){var pt=new _.default(function(wt){var _t=Object(L.a)(wt),Rt;try{for(_t.s();!(Rt=_t.n()).done;){var jt=Rt.value;(jt.target.offsetHeight>0||jt.target.offsetWidth>0)&&(Ci(),Ve.setSize("100%","100%"),Ve.refresh())}}catch(Mt){_t.e(Mt)}finally{_t.f()}});return pt.observe(dn.current.parentElement),pt}if(Ve){var mt=at();return function(){mt.unobserve(dn.current.parentElement)}}},[Ve,Ci]),Object(P.useEffect)(function(){if(Ve){for(var at=[],mt=function(){var jt=wt[pt];_t=Object(M.a)(jt,2);var Mt=_t[0],nr=_t[1],Rr=Object(F.a)({},Mt,function(){Yn(nr)});at.push(Rr),Ve.addKeyMap(Rr)},pt=0,wt=Object.entries(Ke);pt<wt.length;pt++){var _t;mt()}return function(){var Rt=Object(L.a)(at),jt;try{for(Rt.s();!(jt=Rt.n()).done;){var Mt=jt.value;Ve.removeKeyMap(Mt)}}catch(nr){Rt.e(nr)}finally{Rt.f()}}}},[Ve]),Object(P.useEffect)(function(){It!==Lt&&Wr(It)},[It]),Object(_e.a)(function(){if(!Gt&&un>0){var at=new Date().getTime(),mt=window.sessionStorage.getItem(vt);at>=un+Ne&&(!mt||mt!==Cr)&&(window.sessionStorage.setItem(vt,Cr),Vn(!0))}},Ne),Object(P.useEffect)(function(){dt(rt)},[Ve,rt]),Object(P.useEffect)(function(){Ve&&(ct&&Ve.focus())},[Ve,ct]),Object(P.useEffect)(function(){if(Qt&&Ve){var at=Ve.getScrollerElement();function mt(pt){var wt=pt.target;if(cn.current){var _t=wt.scrollTop/wt.scrollHeight;cn.current.scrollTop=cn.current.scrollHeight*_t}}return at.addEventListener("scroll",mt),function(){at.removeEventListener("scroll",mt)}}},[Ve,Qt]),Object(P.useEffect)(function(){if(Ve&&Ht){function at(mt,pt){Ht(mt,pt)}return Ve.on("beforeChange",at),function(){Ve.off("beforeChange",at)}}},[Ve,Ht]),Object(P.useEffect)(function(){if(Ve&&Nt){function at(){Nt(Ve.getValue())}return Ve.on("blur",at),function(){Ve.off("blur",at)}}},[Ve,Nt]),Object(P.useEffect)(function(){if(Ve){function at(mt){var pt=mt.getValue();lt(pt),Gn(new Date().getTime()),mt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Y&&Y(pt)}return Ve.on("change",at),function(){Ve.off("change",at)}}},[Ve,Y]),Object(P.useEffect)(function(){Ve&&(ae==null?(Ve.setValue(""),lt("")):ae!==Ve.getValue()&&(Ve.setValue(ae),lt(ae),Ve.setCursor(Ve.lineCount(),0)))},[Ve,ae]);var Yn=Object(P.useCallback)(function(at){var mt=Ve.getCursor(),pt=Ve.getSelection(),wt=pt.split(`
|
|
`);switch(at){case"bold":return Ve.replaceSelection("**"+pt+"**"),pt===""&&Ve.setCursor(mt.line,mt.ch+2),Ve.focus();case"italic":return Ve.replaceSelection("*"+pt+"*"),pt===""&&Ve.setCursor(mt.line,mt.ch+1),Ve.focus();case"code":return Ve.replaceSelection("`"+pt+"`"),pt===""&&Ve.setCursor(mt.line,mt.ch+1),Ve.focus();case"inline-latex":return Ve.replaceSelection("`$$"+pt+"$$`"),pt===""&&Ve.setCursor(mt.line,mt.ch+3),Ve.focus();case"latex":return Ve.replaceSelection("```latex\n"+pt+"\n```"),Ve.setCursor(mt.line+1,pt.length+1),Ve.focus();case"line-break":return Ve.replaceSelection(`<br/>
|
|
`),Ve.focus();case"list-ul":return pt===""?Ve.replaceSelection("- "+pt):Ve.replaceSelection(wt.map(function(_t){return _t===""?"":"- ".concat(_t)}).join(`
|
|
`)),Ve.focus();case"list-ol":return pt===""?Ve.replaceSelection("1. "+pt):Ve.replaceSelection(wt.map(function(_t,Rt){return _t===""?"":"".concat(Rt+1,". ").concat(_t)}).join(`
|
|
`)),Ve.focus();case"add-null-ch":return pt===""&&Ve.setCursor(mt.line,mt.ch+1),Ve.replaceSelection(De),Ve.focus();case"inster-template-1":return pt===""&&Ve.setCursor(mt.line,mt.ch),Ve.replaceSelection(ze),Ve.focus();case"eraser":return Ve.setValue(""),Ve.focus();case"trigger-watch":return dt(!Qt),Ve.focus();case"trigger-full-screen":return Wr(!Lt),Ve.focus();case Me:Hr(Me);return;case Ae:Hr(Ae);return;case we:Hr(we);return;case Ue:Hr(Ue);return;default:throw new Error}},[Ve,Qt,Lt]),fn=Object(P.useCallback)(function(at){Hr("");switch(cr){case Me:var mt=at.title,pt=at.link;return Ve.replaceSelection("[".concat(mt,"](").concat(pt,")")),Ve.focus();case Ae:var wt=at.language,_t=at.content;return Ve.replaceSelection(["```"+wt,_t,"```"].join(`
|
|
`)),Ve.focus();case we:var Rt=at.src,jt=at.alt;return Ve.replaceSelection(".concat(Rt,' "').concat(jt,'" )')),Ve.focus();case Ue:for(var Mt=at.row,nr=at.col,Rr=at.align,Ot=`
|
|
`,Qr=0;Qr<Mt;Qr++){for(var ir=[],Zr=[],Jr=0;Jr<nr;Jr++)Qr===1&&Zr.push(He[Rr]),ir.push(" ");Qr===1&&(Ot+="| ".concat(Zr.join(" | "),` |
|
|
`)),Ot+="| ".concat(ir.join(nr===1?"":" | "),` |
|
|
`)}return Ve.replaceSelection(Ot+`
|
|
`),Ve.focus();default:throw new Error}},[Ve,cr]),wn=Object(P.useMemo)(function(){switch(cr){case Me:return D.a.createElement(G,{callback:fn,onCancel:Ur});case Ae:return D.a.createElement(B.b,{callback:fn,onCancel:Ur});case we:return D.a.createElement(xe,{callback:fn,onCancel:Ur});case Ue:return D.a.createElement(Be,{callback:fn,onCancel:Ur});default:return null}},[cr]);function Ur(){Hr("")}Object(P.useEffect)(function(){if(Yr.current){var at=Yr.current,mt=!1,pt=0;function wt(jt){mt=!0,pt=jt.pageY}function _t(){mt=!1}function Rt(jt){if(mt){var Mt=jt.pageY-pt;Mt<0&&(Mt=0),Mt>300&&(Mt=300);var nr=de+Mt+"px";_i(nr)}}return at.addEventListener("mousedown",wt),document.addEventListener("mousemove",Rt),document.addEventListener("mouseup",_t),function(){at.removeEventListener("mousedown",wt),document.removeEventListener("mousemove",Rt),document.removeEventListener("mouseup",_t)}}},[Ve,Yr]),Object(P.useEffect)(function(){_i(de)},[de]);var Qn=Xe(Z),Ai=Xe(wi),Li={width:Qn,height:Ai},Zn=Object(P.useMemo)(function(){if(un){var at=new Date(un),mt=at.getHours(),pt=at.getMinutes(),wt=at.getSeconds();return mt=mt<10?"0"+mt:mt,pt=pt<10?"0"+pt:pt,wt=wt<10?"0"+wt:wt,"".concat(mt,":").concat(pt,":").concat(wt)}return 0},[un]);function Fa(){window.sessionStorage.removeItem(vt),Vn(!1),Gn(0)}function $i(){Vn(!1),Gn(0),Ve.setValue(window.sessionStorage.getItem(vt))}return D.a.createElement(P.Fragment,null,D.a.createElement("div",{className:"markdown-editor-wrapper",ref:Xn},D.a.createElement("div",{className:"markdown-editor-container ".concat(yr," ").concat(Qt?"on-preview":""," ").concat(Le?"mini":""," ").concat(Lt?"full-screen":""),style:Li},D.a.createElement(c,{insertTemp:Et,watch:Qt,fullScreen:Lt,showNullButton:Xt,onActionCallback:Yn,hidetoolBar:rr}),D.a.createElement("div",{className:"markdown-editor-body"},D.a.createElement("div",{className:"codemirror-container"},D.a.createElement("textarea",{ref:dn,placeholder:br})),Qt?D.a.createElement("div",{ref:cn,className:"preview-container"},nt==="stex"&&D.a.createElement(S,{value:Cr}),nt!=="stex"&&D.a.createElement(l.a,{value:Cr})):null))),Dt?D.a.createElement("a",{ref:Yr,className:"editor-resize"}):null,D.a.createElement(s.a,null,ye[cr]?D.a.createElement(z.a,{centered:!0,title:ye[cr],visible:!0,onCancel:Ur,footer:null},wn):null))}},SJ7D:function(it,Je,J){},SJMd:function(it,Je){/**
|
|
* @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 M,F;(function(){var P=window,D=["break,continue,do,else,for,if,return,while"],O=[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=[O,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],_=[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"],w="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",o=[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=[_,A,T,b,d,o,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",s="pun",a="pln",m="tag",p="dec",v="src",R="atn",U="atv",j="nocode",G="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function B(we){for(var Ae=0,Ue=!1,Ge=!1,He=0,_e=we.length;He<_e;++He){var Te=we[He];if(Te.ignoreCase)Ge=!0;else if(/[a-z]/i.test(Te.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ue=!0,Ge=!1;break}}var Ce={b:8,t:9,n:10,v:11,f:12,r:13};function Re(Xe){var me=Xe.charCodeAt(0);if(me!==92)return me;var Ye=Xe.charAt(1);return me=Ce[Ye],me||("0"<=Ye&&Ye<="7"?parseInt(Xe.substring(1),8):Ye==="u"||Ye==="x"?parseInt(Xe.substring(2),16):Xe.charCodeAt(1))}function Fe(Xe){if(Xe<32)return(Xe<16?"\\x0":"\\x")+Xe.toString(16);var me=String.fromCharCode(Xe);return me==="\\"||me==="-"||me==="]"||me==="^"?"\\"+me:me}function Ne(Xe){var me=Xe.substring(1,Xe.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),Ye=[],Ke=me[0]==="^",ye=["["];Ke&&ye.push("^");for(var Oe=Ke?1:0,te=me.length;Oe<te;++Oe){var $=me[Oe];if(/\\[bdsw]/i.test($))ye.push($);else{var ae=Re($),Y;Oe+2<te&&me[Oe+1]==="-"?(Y=Re(me[Oe+2]),Oe+=2):Y=ae,Ye.push([ae,Y]),Y<65||ae>122||(Y<65||ae>90||Ye.push([Math.max(65,ae)|32,Math.min(Y,90)|32]),Y<97||ae>122||Ye.push([Math.max(97,ae)&~32,Math.min(Y,122)&~32]))}}Ye.sort(function(de,pe){return de[0]-pe[0]||pe[1]-de[1]});for(var Q=[],Z=[],Oe=0;Oe<Ye.length;++Oe){var ee=Ye[Oe];ee[0]<=Z[1]+1?Z[1]=Math.max(Z[1],ee[1]):Q.push(Z=ee)}for(var Oe=0;Oe<Q.length;++Oe){var ee=Q[Oe];ye.push(Fe(ee[0])),ee[1]>ee[0]&&(ee[1]+1>ee[0]&&ye.push("-"),ye.push(Fe(ee[1])))}return ye.push("]"),ye.join("")}function De(Xe){for(var me=Xe.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),Ye=me.length,Ke=[],ye=0,Oe=0;ye<Ye;++ye){var te=me[ye];if(te==="(")++Oe;else if(te.charAt(0)==="\\"){var $=+te.substring(1);$&&($<=Oe?Ke[$]=-1:me[ye]=Fe($))}}for(var ye=1;ye<Ke.length;++ye)Ke[ye]===-1&&(Ke[ye]=++Ae);for(var ye=0,Oe=0;ye<Ye;++ye){var te=me[ye];if(te==="(")++Oe,Ke[Oe]||(me[ye]="(?:");else if(te.charAt(0)==="\\"){var $=+te.substring(1);$&&$<=Oe&&(me[ye]="\\"+Ke[$])}}for(var ye=0;ye<Ye;++ye)me[ye]==="^"&&me[ye+1]!=="^"&&(me[ye]="");if(Xe.ignoreCase&&Ue)for(var ye=0;ye<Ye;++ye){var te=me[ye],ae=te.charAt(0);te.length>=2&&ae==="["?me[ye]=Ne(te):ae!=="\\"&&(me[ye]=te.replace(/[a-zA-Z]/g,function(Z){var ee=Z.charCodeAt(0);return"["+String.fromCharCode(ee&~32,ee|32)+"]"}))}return me.join("")}for(var ze=[],He=0,_e=we.length;He<_e;++He){var Te=we[He];if(Te.global||Te.multiline)throw new Error(""+Te);ze.push("(?:"+De(Te)+")")}return new RegExp(ze.join("|"),Ge?"gi":"g")}function N(we,Ae){var Ue=/(?:^|\s)nocode(?:\s|$)/,Ge=[],He=0,_e=[],Te=0;function Ce(Re){var Fe=Re.nodeType;if(Fe==1){if(Ue.test(Re.className))return;for(var Ne=Re.firstChild;Ne;Ne=Ne.nextSibling)Ce(Ne);var De=Re.nodeName.toLowerCase();(De==="br"||De==="li")&&(Ge[Te]=`
|
|
`,_e[Te<<1]=He++,_e[Te++<<1|1]=Re)}else if(Fe==3||Fe==4){var ze=Re.nodeValue;ze.length&&(Ae?ze=ze.replace(/\r\n?/g,`
|
|
`):ze=ze.replace(/[ \t\r\n]+/g," "),Ge[Te]=ze,_e[Te<<1]=He,He+=ze.length,_e[Te++<<1|1]=Re)}}return Ce(we),{sourceCode:Ge.join("").replace(/\n$/,""),spans:_e}}function V(we,Ae,Ue,Ge,He){if(!Ue)return;var _e={sourceNode:we,pre:1,langExtension:null,numberLines:null,sourceCode:Ue,spans:null,basePos:Ae,decorations:null};Ge(_e),He.push.apply(He,_e.decorations)}var q=/\S/;function ie(we){for(var Ae=void 0,Ue=we.firstChild;Ue;Ue=Ue.nextSibling){var Ge=Ue.nodeType;Ae=Ge===1?Ae?we:Ue:Ge===3&&q.test(Ue.nodeValue)?we:Ae}return Ae===we?void 0:Ae}function se(we,Ae){var Ue={},Ge;(function(){for(var Te=we.concat(Ae),Ce=[],Re={},Fe=0,Ne=Te.length;Fe<Ne;++Fe){var De=Te[Fe],ze=De[3];if(ze)for(var Xe=ze.length;--Xe>=0;)Ue[ze.charAt(Xe)]=De;var me=De[1],Ye=""+me;Re.hasOwnProperty(Ye)||(Ce.push(me),Re[Ye]=null)}Ce.push(/[\0-\uffff]/),Ge=B(Ce)})();var He=Ae.length,_e=function(Te){for(var Ce=Te.sourceCode,Re=Te.basePos,Fe=Te.sourceNode,Ne=[Re,a],De=0,ze=Ce.match(Ge)||[],Xe={},me=0,Ye=ze.length;me<Ye;++me){var Ke=ze[me],ye=Xe[Ke],Oe=void 0,te;if(typeof ye=="string")te=!1;else{var $=Ue[Ke.charAt(0)];if($)Oe=Ke.match($[1]),ye=$[0];else{for(var ae=0;ae<He;++ae)if($=Ae[ae],Oe=Ke.match($[1]),Oe){ye=$[0];break}Oe||(ye=a)}te=ye.length>=5&&ye.substring(0,5)==="lang-",te&&!(Oe&&typeof Oe[1]=="string")&&(te=!1,ye=v),te||(Xe[Ke]=ye)}var Y=De;if(De+=Ke.length,!te)Ne.push(Re+Y,ye);else{var Q=Oe[1],Z=Ke.indexOf(Q),ee=Z+Q.length;Oe[2]&&(ee=Ke.length-Oe[2].length,Z=ee-Q.length);var de=ye.substring(5);V(Fe,Re+Y,Ke.substring(0,Z),_e,Ne),V(Fe,Re+Y+Z,Q,ue(de,Q),Ne),V(Fe,Re+Y+ee,Ke.substring(ee),_e,Ne)}}Te.decorations=Ne};return _e}function xe(we){var Ae=[],Ue=[];we.tripleQuotedStrings?Ae.push([g,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):we.multiLineStrings?Ae.push([g,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Ae.push([g,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),we.verbatimStrings&&Ue.push([g,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ge=we.hashComments;Ge&&(we.cStyleComments?(Ge>1?Ae.push([y,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Ae.push([y,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ue.push([g,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Ae.push([y,/^#[^\r\n]*/,null,"#"])),we.cStyleComments&&(Ue.push([y,/^\/\/[^\r\n]*/,null]),Ue.push([y,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var He=we.regexLiterals;if(He){var _e=He>1?"":`
|
|
\r`,Te=_e?".":"[\\S\\s]",Ce="/(?=[^/*"+_e+"])(?:[^/\\x5B\\x5C"+_e+"]|\\x5C"+Te+"|\\x5B(?:[^\\x5C\\x5D"+_e+"]|\\x5C"+Te+")*(?:\\x5D|$))+/";Ue.push(["lang-regex",RegExp("^"+G+"("+Ce+")")])}var Re=we.types;Re&&Ue.push([f,Re]);var Fe=(""+we.keywords).replace(/^ | $/g,"");Fe.length&&Ue.push([C,new RegExp("^(?:"+Fe.replace(/[\s,]+/g,"|")+")\\b"),null]),Ae.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var Ne="^.[^\\s\\w.$@'\"`/\\\\]*";return we.regexLiterals&&(Ne+="(?!s*/)"),Ue.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],[s,new RegExp(Ne),null]),se(Ae,Ue)}var fe=xe({keywords:S,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ee(we,Ae,Ue){for(var Ge=/(?:^|\s)nocode(?:\s|$)/,He=/\r\n?|\n/,_e=we.ownerDocument,Te=_e.createElement("li");we.firstChild;)Te.appendChild(we.firstChild);var Ce=[Te];function Re(me){var Ye=me.nodeType;if(Ye==1&&!Ge.test(me.className))if(me.nodeName==="br")Fe(me),me.parentNode&&me.parentNode.removeChild(me);else for(var Ke=me.firstChild;Ke;Ke=Ke.nextSibling)Re(Ke);else if((Ye==3||Ye==4)&&Ue){var ye=me.nodeValue,Oe=ye.match(He);if(Oe){var te=ye.substring(0,Oe.index);me.nodeValue=te;var $=ye.substring(Oe.index+Oe[0].length);if($){var ae=me.parentNode;ae.insertBefore(_e.createTextNode($),me.nextSibling)}Fe(me),te||me.parentNode.removeChild(me)}}}function Fe(me){for(;!me.nextSibling;)if(me=me.parentNode,!me)return;function Ye(Oe,te){var $=te?Oe.cloneNode(!1):Oe,ae=Oe.parentNode;if(ae){var Y=Ye(ae,1),Q=Oe.nextSibling;Y.appendChild($);for(var Z=Q;Z;Z=Q)Q=Z.nextSibling,Y.appendChild(Z)}return $}for(var Ke=Ye(me.nextSibling,0),ye;(ye=Ke.parentNode)&&ye.nodeType===1;)Ke=ye;Ce.push(Ke)}for(var Ne=0;Ne<Ce.length;++Ne)Re(Ce[Ne]);Ae===(Ae|0)&&Ce[0].setAttribute("value",Ae);var De=_e.createElement("ol");De.className="linenums";for(var ze=Math.max(0,Ae-1|0)||0,Ne=0,Xe=Ce.length;Ne<Xe;++Ne)Te=Ce[Ne],Te.className="L"+(Ne+ze)%10,Te.firstChild||Te.appendChild(_e.createTextNode("\xA0")),De.appendChild(Te);we.appendChild(De)}function ge(we){var Ae=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Ae=Ae&&+Ae[1]<=8;var Ue=/\n/g,Ge=we.sourceCode,He=Ge.length,_e=0,Te=we.spans,Ce=Te.length,Re=0,Fe=we.decorations,Ne=Fe.length,De=0;Fe[Ne]=He;var ze,Xe;for(Xe=ze=0;Xe<Ne;)Fe[Xe]!==Fe[Xe+2]?(Fe[ze++]=Fe[Xe++],Fe[ze++]=Fe[Xe++]):Xe+=2;for(Ne=ze,Xe=ze=0;Xe<Ne;){for(var me=Fe[Xe],Ye=Fe[Xe+1],Ke=Xe+2;Ke+2<=Ne&&Fe[Ke+1]===Ye;)Ke+=2;Fe[ze++]=me,Fe[ze++]=Ye,Xe=Ke}Ne=Fe.length=ze;var ye=we.sourceNode,Oe="";ye&&(Oe=ye.style.display,ye.style.display="none");try{for(var te=null;Re<Ce;){var $=Te[Re],ae=Te[Re+2]||He,Y=Fe[De+2]||He,Ke=Math.min(ae,Y),Q=Te[Re+1],Z;if(Q.nodeType!==1&&(Z=Ge.substring(_e,Ke))){Ae&&(Z=Z.replace(Ue,"\r")),Q.nodeValue=Z;var ee=Q.ownerDocument,de=ee.createElement("span");de.className=Fe[De+1];var pe=Q.parentNode;pe.replaceChild(de,Q),de.appendChild(Q),_e<ae&&(Te[Re+1]=Q=ee.createTextNode(Ge.substring(Ke,ae)),pe.insertBefore(Q,de.nextSibling))}_e=Ke,_e>=ae&&(Re+=2),_e>=Y&&(De+=2)}}finally{ye&&(ye.style.display=Oe)}}var ve={};function le(we,Ae){for(var Ue=Ae.length;--Ue>=0;){var Ge=Ae[Ue];ve.hasOwnProperty(Ge)?P.console&&console.warn("cannot override language handler %s",Ge):ve[Ge]=we}}function ue(we,Ae){return we&&ve.hasOwnProperty(we)||(we=/^\s*</.test(Ae)?"default-markup":"default-code"),ve[we]}le(fe,["default-code"]),le(se([],[[a,/^[^<?]+/],[p,/^<!\w[^>]*(?:>|$)/],[y,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[s,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),le(se([[a,/^[\s]+/,null,` \r
|
|
`],[U,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[R,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[s,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),le(se([],[[U,/^[\s\S]+/]]),["uq.val"]),le(xe({keywords:_,hashComments:!0,cStyleComments:!0,types:h}),["c","cc","cpp","cxx","cyc","m"]),le(xe({keywords:"null,true,false"}),["json"]),le(xe({keywords:A,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:h}),["cs"]),le(xe({keywords:T,cStyleComments:!0}),["java"]),le(xe({keywords:l,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),le(xe({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),le(xe({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),le(xe({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),le(xe({keywords:b,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),le(xe({keywords:w,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),le(se([],[[g,/^[\s\S]+/]]),["regex"]);function be(we){var Ae=we.langExtension;try{var Ue=N(we.sourceNode,we.pre),Ge=Ue.sourceCode;we.sourceCode=Ge,we.spans=Ue.spans,we.basePos=0,ue(Ae,Ge)(we),ge(we)}catch(He){P.console&&console.log(He&&He.stack||He)}}function je(we,Ae,Ue){var Ge=Ue||!1,He=Ae||null,_e=document.createElement("div");_e.innerHTML="<pre>"+we+"</pre>",_e=_e.firstChild,Ge&&Ee(_e,Ge,!0);var Te={langExtension:He,numberLines:Ge,sourceNode:_e,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return be(Te),_e.innerHTML}function Be(we,Ae){var Ue=Ae||document.body,Ge=Ue.ownerDocument||document;function He($){return Ue.getElementsByTagName($)}for(var _e=[He("pre"),He("code"),He("xmp")],Te=[],Ce=0;Ce<_e.length;++Ce)for(var Re=0,Fe=_e[Ce].length;Re<Fe;++Re)Te.push(_e[Ce][Re]);_e=null;var Ne=Date;Ne.now||(Ne={now:function(){return+new Date}});var De=0,ze=/\blang(?:uage)?-([\w.]+)(?!\S)/,Xe=/\bprettyprint\b/,me=/\bprettyprinted\b/,Ye=/pre|xmp/i,Ke=/^code$/i,ye=/^(?:pre|code|xmp)$/i,Oe={};function te(){for(var $=P.PR_SHOULD_USE_CONTINUATION?Ne.now()+250:Infinity;De<Te.length&&Ne.now()<$;De++){for(var ae=Te[De],Y=Oe,Q=ae;Q=Q.previousSibling;){var Z=Q.nodeType,ee=(Z===7||Z===8)&&Q.nodeValue;if(ee?!/^\??prettify\b/.test(ee):Z!==3||/\S/.test(Q.nodeValue))break;if(ee){Y={},ee.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Dt,ft,Gt){Y[ft]=Gt});break}}var de=ae.className;if((Y!==Oe||Xe.test(de))&&!me.test(de)){for(var pe=!1,Le=ae.parentNode;Le;Le=Le.parentNode){var tt=Le.tagName;if(ye.test(tt)&&Le.className&&Xe.test(Le.className)){pe=!0;break}}if(!pe){ae.className+=" prettyprinted";var ct=Y.lang;if(!ct){ct=de.match(ze);var rt;!ct&&(rt=ie(ae))&&Ke.test(rt.tagName)&&(ct=rt.className.match(ze)),ct&&(ct=ct[1])}var Et;if(Ye.test(ae.tagName))Et=1;else{var ht=ae.currentStyle,nt=Ge.defaultView,bt=ht?ht.whiteSpace:nt&&nt.getComputedStyle?nt.getComputedStyle(ae,null).getPropertyValue("white-space"):0;Et=bt&&bt.substring(0,3)==="pre"}var vt=Y.linenums;(vt=vt==="true"||+vt)||(vt=de.match(/\blinenums\b(?::(\d+))?/),vt=vt?vt[1]&&vt[1].length?+vt[1]:!0:!1),vt&&Ee(ae,vt,Et);var Bt={langExtension:ct,sourceNode:ae,numberLines:vt,pre:Et,sourceCode:null,basePos:null,spans:null,decorations:null};be(Bt)}}}De<Te.length?P.setTimeout(te,250):typeof we=="function"&&we()}te()}var ke=P.PR={createSimpleLexer:se,registerLangHandler:le,sourceDecorator:xe,PR_ATTRIB_NAME:R,PR_ATTRIB_VALUE:U,PR_COMMENT:y,PR_DECLARATION:p,PR_KEYWORD:C,PR_LITERAL:c,PR_NOCODE:j,PR_PLAIN:a,PR_PUNCTUATION:s,PR_SOURCE:v,PR_STRING:g,PR_TAG:m,PR_TYPE:f,prettyPrintOne:L?P.prettyPrintOne=je:M=je,prettyPrint:F=L?P.prettyPrint=Be:F=Be},Me=P.define;typeof Me=="function"&&Me.amd&&Me("google-code-prettify",[],function(){return ke})})()},"VrN/":function(it,Je,J){(function(re,z){it.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),M=/Edge\/(\d+)/.exec(re),F=H||k||M,P=F&&(H?document.documentMode||6:+(M||k)[1]),D=!M&&/WebKit\//.test(re),O=D&&/Qt\/\d+\.\d+/.test(re),E=!M&&/Chrome\//.test(re),_=/Opera\//.test(re),T=/Apple Computer/.test(navigator.vendor),A=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(re),w=/PhantomJS/.test(re),b=!M&&/AppleWebKit/.test(re)&&/Mobile\/\w+/.test(re),d=/Android/.test(re),o=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=_&&re.match(/Version\/(\d*\.\d*)/);h&&(h=Number(h[1])),h&&h>=15&&(_=!1,D=!0);var g=u&&(O||_&&(h==null||h<12.11)),C=L||F&&P>=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 s(e,t){return c(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var 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 R(){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 q=function(){this.id=null,this.f=null,this.time=0,this.handler=B(this.onTimeout,this)};q.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},q.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 se=50,xe={toString:function(){return"CodeMirror.Pass"}},fe={scroll:!1},Ee={origin:"*mouse"},ge={origin:"+move"};function ve(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(be(le)+" ");return le[e]}function be(e){return e[e.length-1]}function je(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Be(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function ke(){}function Me(e,t){var n;return Object.create?n=Object.create(e):(ke.prototype=e,n=new ke),t&&N(t,n),n}var we=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Ae(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||we.test(e))}function Ue(e,t){return t?t.source.indexOf("\\w")>-1&&Ae(e)?!0:t.test(e):Ae(e)}function Ge(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var He=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function _e(e){return e.charCodeAt(0)>=768&&He.test(e)}function Te(e,t,n){for(;(n<0?t>0:t<e.length)&&_e(e.charAt(t));)t+=n;return t}function Ce(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 Fe=null;function Ne(e,t,n){var r;Fe=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:Fe=i),x.from==t&&(x.from!=x.to&&n!="before"?r=i:Fe=i)}return r!=null?r:Fe}var De=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,oe){this.level=X,this.from=ne,this.to=oe}return function(X,ne){var oe=ne=="ltr"?"L":"R";if(X.length==0||ne=="ltr"&&!r.test(X))return!1;for(var he=X.length,ce=[],Se=0;Se<he;++Se)ce.push(n(X.charCodeAt(Se)));for(var Pe=0,We=oe;Pe<he;++Pe){var Qe=ce[Pe];Qe=="m"?ce[Pe]=We:We=Qe}for(var $e=0,Ze=oe;$e<he;++$e){var qe=ce[$e];qe=="1"&&Ze=="r"?ce[$e]="n":x.test(qe)&&(Ze=qe,qe=="r"&&(ce[$e]="R"))}for(var ut=1,ot=ce[0];ut<he-1;++ut){var gt=ce[ut];gt=="+"&&ot=="1"&&ce[ut+1]=="1"?ce[ut]="1":gt==","&&ot==ce[ut+1]&&(ot=="1"||ot=="n")&&(ce[ut]=ot),ot=gt}for(var At=0;At<he;++At){var $t=ce[At];if($t==",")ce[At]="N";else if($t=="%"){var Ut=void 0;for(Ut=At+1;Ut<he&&ce[Ut]=="%";++Ut);for(var Tr=At&&ce[At-1]=="!"||Ut<he&&ce[Ut]=="1"?"1":"N",mr=At;mr<Ut;++mr)ce[mr]=Tr;At=Ut-1}}for(var Kt=0,pr=oe;Kt<he;++Kt){var tr=ce[Kt];pr=="L"&&tr=="1"?ce[Kt]="L":x.test(tr)&&(pr=tr)}for(var Vt=0;Vt<he;++Vt)if(i.test(ce[Vt])){var zt=void 0;for(zt=Vt+1;zt<he&&i.test(ce[zt]);++zt);for(var Ft=(Vt?ce[Vt-1]:oe)=="L",gr=(zt<he?ce[zt]:oe)=="L",Hn=Ft==gr?Ft?"L":"R":oe,on=Vt;on<zt;++on)ce[on]=Hn;Vt=zt-1}for(var or=[],jr,qt=0;qt<he;)if(I.test(ce[qt])){var Ia=qt;for(++qt;qt<he&&I.test(ce[qt]);++qt);or.push(new K(0,Ia,qt))}else{var Gr=qt,xn=or.length,Tn=ne=="rtl"?1:0;for(++qt;qt<he&&ce[qt]!="L";++qt);for(var lr=Gr;lr<qt;)if(W.test(ce[lr])){Gr<lr&&(or.splice(xn,0,new K(1,Gr,lr)),xn+=Tn);var Kn=lr;for(++lr;lr<qt&&W.test(ce[lr]);++lr);or.splice(xn,0,new K(2,Kn,lr)),xn+=Tn,Gr=lr}else++lr;Gr<qt&&or.splice(xn,0,new K(1,Gr,qt))}return ne=="ltr"&&(or[0].level==1&&(jr=X.match(/^\s+/))&&(or[0].from=jr[0].length,or.unshift(new K(0,0,jr[0].length))),be(or).level==1&&(jr=X.match(/\s+$/))&&(be(or).to-=jr[0].length,or.push(new K(0,he-jr[0].length,he)))),ne=="rtl"?or.reverse():or}}();function ze(e,t){var n=e.order;return n==null&&(n=e.order=De(e.text,t)),n}var Xe=[],me=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Xe).concat(n)}};function Ye(e,t){return e._handlers&&e._handlers[t]||Xe}function Ke(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 ye(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 Oe(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),ye(e,n||t.type,e,t),Z(t)||t.codemirrorIgnore}function te(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 $(e,t){return Ye(e,t).length>0}function ae(e){e.prototype.on=function(t,n){me(this,t,n)},e.prototype.off=function(t,n){Ke(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 ee(e){Y(e),Q(e)}function de(e){return e.target||e.srcElement}function pe(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 Le=function(){if(F&&P<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),tt;function ct(e){if(tt==null){var t=a("span","\u200B");s(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(tt=t.offsetWidth<=1&&t.offsetHeight>2&&!(F&&P<8))}var n=tt?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var rt;function Et(e){if(rt!=null)return rt;var t=s(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:rt=r.right-n.right<3}var ht=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
|
|
`,t);i==-1&&(i=e.length);var 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/)},nt=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},bt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),vt=null;function Bt(e){if(vt!=null)return vt;var t=s(e,a("span","x")),n=t.getBoundingClientRect(),r=p(t,0,1).getBoundingClientRect();return vt=Math.abs(n.left-r.left)>1}var Dt={},ft={};function Gt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Dt[e]=t}function vr(e,t){ft[e]=t}function Xt(e){if(typeof e=="string"&&ft.hasOwnProperty(e))e=ft[e];else if(e&&typeof e.name=="string"&&ft.hasOwnProperty(e.name)){var t=ft[e.name];typeof t=="string"&&(t={name:t}),e=Me(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Xt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Xt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Yt(e,t){t=Xt(t);var n=Dt[t.name];if(!n)return Yt(e,"text/plain");var r=n(e,t);if(rr.hasOwnProperty(t.name)){var i=rr[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 rr={};function kr(e,t){var n=rr.hasOwnProperty(e)?rr[e]:rr[e]={};N(t,n)}function It(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 Nt(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 Ht(e,t,n){return e.startState?e.startState(t,n):!0}var Ct=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};Ct.prototype.eol=function(){return this.pos>=this.string.length},Ct.prototype.sol=function(){return this.pos==this.lineStart},Ct.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ct.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ct.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},Ct.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ct.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ct.prototype.skipToEnd=function(){this.pos=this.string.length},Ct.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ct.prototype.backUp=function(e){this.pos-=e},Ct.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)},Ct.prototype.indentation=function(){return V(this.string,null,this.tabSize)-(this.lineStart?V(this.string,this.lineStart,this.tabSize):0)},Ct.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)}},Ct.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ct.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ct.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ct.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function et(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 yr(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 Ir(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function ur(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function yt(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 br(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 Er(e,t){return t>=e.first&&t<e.first+e.size}function dr(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ie(e,t,n){if(n===void 0&&(n=null),!(this instanceof Ie))return new Ie(e,t,n);this.line=e,this.ch=t,this.sticky=n}function st(e,t){return e.line-t.line||e.ch-t.ch}function Ve(e,t){return e.sticky==t.sticky&&st(e,t)==0}function Nr(e){return Ie(e.line,e.ch)}function Dr(e,t){return st(e,t)<0?t:e}function Sr(e,t){return st(e,t)<0?e:t}function Cr(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function lt(e,t){if(t.line<e.first)return Ie(e.first,0);var n=e.first+e.size-1;return t.line>n?Ie(n,et(e,n).text.length):Pt(t,et(e,t.line).text.length)}function Pt(e,t){var n=e.ch;return n==null||n>t?Ie(e.line,t):n<0?Ie(e.line,0):e}function Vr(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=lt(e,t[r]);return n}var Qt=function(e,t){this.state=e,this.lookAhead=t},dt=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};dt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},dt.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}},dt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},dt.fromSaved=function(e,t,n){return t instanceof Qt?new dt(e,It(e.mode,t.state),n,t.lookAhead):new dt(e,It(e.mode,t),n)},dt.prototype.save=function(e){var t=e!==!1?It(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Qt(t,this.maxLookAhead):t};function Tt(e,t,n,r){var i=[e.state.modeGen],x={};zn(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],oe=1,he=0;n.state=!0,zn(e,t.text,ne.mode,n,function(ce,Se){for(var Pe=oe;he<ce;){var We=i[oe];We>ce&&i.splice(oe,1,ce,i[oe+1],We),oe+=2,he=Math.min(ce,We)}if(!Se)return;if(ne.opaque)i.splice(Pe,oe-Pe,ce,"overlay "+Se),oe=Pe+2;else for(;Pe<oe;Pe+=2){var Qe=i[Pe+1];i[Pe+1]=(Qe?Qe+" ":"")+"overlay "+Se}},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 Ar(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Lt(e,yt(t)),i=t.text.length>e.options.maxHighlightLength&&It(e.doc.mode,r.state),x=Tt(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 Lt(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new dt(r,!0,t);var x=un(e,t,n),I=x>r.first&&et(r,x-1).stateAfter,W=I?dt.fromSaved(r,I,x):new dt(r,Ht(r.mode),x);return r.iter(x,t,function(K){Wr(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 Wr(e,t,n,r){var i=e.doc.mode,x=new Ct(t,e.options.tabSize,n);for(x.start=x.pos=r||0,t==""&&sn(i,n.state);!x.eol();)ln(i,x,n.state),x.start=x.pos}function sn(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Nt(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function ln(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Nt(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 cr=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Hr(e,t,n,r){var i=e.doc,x=i.mode,I;t=lt(i,t);var W=et(i,t.line),K=Lt(e,t.line,n),X=new Ct(W.text,e.options.tabSize,K),ne;for(r&&(ne=[]);(r||X.pos<t.ch)&&!X.eol();)X.start=X.pos,I=ln(x,X,K.state),r&&ne.push(new cr(X,I,It(i.mode,K.state)));return r?ne:new cr(X,I,K.state)}function Ti(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 zn(e,t,n,r,i,x,I){var W=n.flattenSpans;W==null&&(W=e.options.flattenSpans);var K=0,X=null,ne=new Ct(t,e.options.tabSize,r),oe,he=e.options.addModeClass&&[null];for(t==""&&Ti(sn(n,r.state),x);!ne.eol();){if(ne.pos>e.options.maxHighlightLength?(W=!1,I&&Wr(e,t,r,ne.pos),ne.pos=t.length,oe=null):oe=Ti(ln(n,ne,r.state,he),x),he){var ce=he[0].name;ce&&(oe="m-"+(oe?ce+" "+oe:ce))}if(!W||X!=oe){for(;K<ne.start;)K=Math.min(ne.start,K+5e3),i(K,X);X=oe}ne.start=ne.pos}for(;K<ne.pos;){var Se=Math.min(ne.pos,K+5e3);i(Se,X),K=Se}}function un(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=et(x,W-1),X=K.stateAfter;if(X&&(!n||W+(X instanceof Qt?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 Gn(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=et(e,r).stateAfter;if(i&&(!(i instanceof Qt)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Si=!1,Lr=!1;function wi(){Si=!0}function _i(){Lr=!0}function Sn(e,t,n){this.marker=e,this.from=t,this.to=n}function Xr(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Ua(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Vn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function dn(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 Sn(I,x.from,K?null:x.to))}}return r}function Xn(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 Sn(I,K?null:x.from-t,x.to==null?null:x.to-t))}}return r}function Yr(e,t){if(t.full)return null;var n=Er(e,t.from.line)&&et(e,t.from.line).markedSpans,r=Er(e,t.to.line)&&et(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,x=t.to.ch,I=st(t.from,t.to)==0,W=dn(n,i,I),K=Xn(r,x,I),X=t.text.length==1,ne=be(t.text).length+(X?i:0);if(W)for(var oe=0;oe<W.length;++oe){var he=W[oe];if(he.to==null){var ce=Xr(K,he.marker);ce?X&&(he.to=ce.to==null?null:ce.to+ne):he.to=i}}if(K)for(var Se=0;Se<K.length;++Se){var Pe=K[Se];if(Pe.to!=null&&(Pe.to+=ne),Pe.from==null){var We=Xr(W,Pe.marker);We||(Pe.from=ne,X&&(W||(W=[])).push(Pe))}else Pe.from+=ne,X&&(W||(W=[])).push(Pe)}W&&(W=cn(W)),K&&K!=W&&(K=cn(K));var Qe=[W];if(!X){var $e=t.text.length-2,Ze;if($e>0&&W)for(var qe=0;qe<W.length;++qe)W[qe].to==null&&(Ze||(Ze=[])).push(new Sn(W[qe].marker,null,null));for(var ut=0;ut<$e;++ut)Qe.push(Ze);Qe.push(K)}return Qe}function cn(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 Ci(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(ce){if(ce.markedSpans)for(var Se=0;Se<ce.markedSpans.length;++Se){var Pe=ce.markedSpans[Se].marker;Pe.readOnly&&(!r||ie(r,Pe)==-1)&&(r||(r=[])).push(Pe)}}),!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(st(X.to,W.from)<0||st(X.from,W.to)>0)continue;var ne=[K,1],oe=st(X.from,W.from),he=st(X.to,W.to);(oe<0||!I.inclusiveLeft&&!oe)&&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 Yn(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 fn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function wn(e){return e.inclusiveLeft?-1:0}function Ur(e){return e.inclusiveRight?1:0}function Qn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),x=st(r.from,i.from)||wn(e)-wn(t);if(x)return-x;var I=st(r.to,i.to)||Ur(e)-Ur(t);return I||t.id-e.id}function Ai(e,t){var n=Lr&&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||Qn(r,i.marker)<0)&&(r=i.marker);return r}function Li(e){return Ai(e,!0)}function Zn(e){return Ai(e,!1)}function Fa(e,t){var n=Lr&&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||Qn(r,x.marker)<0)&&(r=x.marker)}return r}function $i(e,t,n,r,i){var x=et(e,t),I=Lr&&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=st(X.from,n)||wn(K.marker)-wn(i),oe=st(X.to,r)||Ur(K.marker)-Ur(i);if(ne>=0&&oe<=0||ne<=0&&oe>=0)continue;if(ne<=0&&(K.marker.inclusiveRight&&i.inclusiveLeft?st(X.to,n)>=0:st(X.to,n)>0)||ne>=0&&(K.marker.inclusiveRight&&i.inclusiveLeft?st(X.from,r)<=0:st(X.from,r)<0))return!0}}function at(e){for(var t;t=Li(e);)e=t.find(-1,!0).line;return e}function mt(e){for(var t;t=Zn(e);)e=t.find(1,!0).line;return e}function pt(e){for(var t,n;t=Zn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function wt(e,t){var n=et(e,t),r=at(n);return n==r?t:yt(r)}function _t(e,t){if(t>e.lastLine())return t;var n=et(e,t),r;if(!Rt(e,n))return t;for(;r=Zn(n);)n=r.find(1,!0).line;return yt(n)+1}function Rt(e,t){var n=Lr&&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&&jt(e,t,r))return!0}}function jt(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return jt(e,r.line,Xr(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)&&jt(e,t,i))return!0}function Mt(e){e=at(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 nr(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=Zn(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 Rr(e){var t=e.display,n=e.doc;t.maxLine=et(n,n.first),t.maxLineLength=nr(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=nr(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Ot=function(e,t,n){this.text=e,fn(this,t),this.height=n?n(this):1};Ot.prototype.lineNo=function(){return yt(this)},ae(Ot);function Qr(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Yn(e),fn(e,n);var i=r?r(e):1;i!=e.height&&ur(e,i)}function ir(e){e.parent=null,Yn(e)}var Zr={},Jr={};function _n(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Jr:Zr;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Ba(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=_s,Et(e.display.measure)&&(I=ze(x,e.doc.direction))&&(r.addToken=As(r.addToken,I)),r.map=[];var W=t!=e.display.externalMeasured&&yt(x);Ls(x,r,Ar(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(ct(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 ye(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=j(r.pre.className,r.textClass||"")),r}function ws(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 _s(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&&P<9&&(X=!0),e.pos+=t.length;else{ne=document.createDocumentFragment();for(var oe=0;;){K.lastIndex=oe;var he=K.exec(t),ce=he?he.index-oe:t.length-oe;if(ce){var Se=document.createTextNode(W.slice(oe,oe+ce));F&&P<9?ne.appendChild(a("span",[Se])):ne.appendChild(Se),e.map.push(e.pos,e.pos+ce,Se),e.col+=ce,e.pos+=ce}if(!he)break;oe+=ce+1;var Pe=void 0;if(he[0]==" "){var We=e.cm.options.tabSize,Qe=We-e.col%We;Pe=ne.appendChild(a("span",ue(Qe),"cm-tab")),Pe.setAttribute("role","presentation"),Pe.setAttribute("cm-text"," "),e.col+=Qe}else he[0]=="\r"||he[0]==`
|
|
`?(Pe=ne.appendChild(a("span",he[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Pe.setAttribute("cm-text",he[0]),e.col+=1):(Pe=e.cm.options.specialCharPlaceholder(he[0]),Pe.setAttribute("cm-text",he[0]),F&&P<9?ne.appendChild(a("span",[Pe])):ne.appendChild(Pe),e.col+=1);e.map.push(e.pos,e.pos+1,Pe),e.pos++}}if(e.trailingSpace=W.charCodeAt(t.length-1)==32,n||r||i||X||x||I){var $e=n||"";r&&($e+=r),i&&($e+=i);var Ze=a("span",[ne],$e,x);if(I)for(var qe in I)I.hasOwnProperty(qe)&&qe!="style"&&qe!="class"&&Ze.setAttribute(qe,I[qe]);return e.content.appendChild(Ze)}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 oe=void 0,he=0;he<t.length&&!(oe=t[he],oe.to>X&&oe.from<=X);he++);if(oe.to>=ne)return e(n,r,i,x,I,W,K);e(n,r.slice(0,oe.to-X),i,x,null,W,K),x=null,r=r.slice(oe.to-X),X=oe.to}}}function ja(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]),_n(n[I+1],t.cm.options));return}for(var W=i.length,K=0,X=1,ne="",oe,he,ce=0,Se,Pe,We,Qe,$e;;){if(ce==K){Se=Pe=We=he="",$e=null,Qe=null,ce=Infinity;for(var Ze=[],qe=void 0,ut=0;ut<r.length;++ut){var ot=r[ut],gt=ot.marker;if(gt.type=="bookmark"&&ot.from==K&>.widgetNode)Ze.push(gt);else if(ot.from<=K&&(ot.to==null||ot.to>K||gt.collapsed&&ot.to==K&&ot.from==K)){if(ot.to!=null&&ot.to!=K&&ce>ot.to&&(ce=ot.to,Pe=""),gt.className&&(Se+=" "+gt.className),gt.css&&(he=(he?he+";":"")+gt.css),gt.startStyle&&ot.from==K&&(We+=" "+gt.startStyle),gt.endStyle&&ot.to==ce&&(qe||(qe=[])).push(gt.endStyle,ot.to),gt.title&&(($e||($e={})).title=gt.title),gt.attributes)for(var At in gt.attributes)($e||($e={}))[At]=gt.attributes[At];gt.collapsed&&(!Qe||Qn(Qe.marker,gt)<0)&&(Qe=ot)}else ot.from>K&&ce>ot.from&&(ce=ot.from)}if(qe)for(var $t=0;$t<qe.length;$t+=2)qe[$t+1]==ce&&(Pe+=" "+qe[$t]);if(!Qe||Qe.from==K)for(var Ut=0;Ut<Ze.length;++Ut)ja(t,0,Ze[Ut]);if(Qe&&(Qe.from||0)==K){if(ja(t,(Qe.to==null?W+1:Qe.to)-K,Qe.marker,Qe.from==null),Qe.to==null)return;Qe.to==K&&(Qe=!1)}}if(K>=W)break;for(var Tr=Math.min(W,ce);;){if(ne){var mr=K+ne.length;if(!Qe){var Kt=mr>Tr?ne.slice(0,Tr-K):ne;t.addToken(t,Kt,oe?oe+Se:Se,We,K+Kt.length==ce?Pe:"",he,$e)}if(mr>=Tr){ne=ne.slice(Tr-K),K=Tr;break}K=mr,We=""}ne=i.slice(x,x=n[X++]),oe=_n(n[X++],t.cm.options)}}}function Wa(e,t,n){this.line=t,this.rest=pt(t),this.size=this.rest?yt(be(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Rt(e,t)}function Di(e,t,n){for(var r=[],i,x=t;x<n;x=i){var I=new Wa(e.doc,et(e.doc,x),x);i=x+I.size,r.push(I)}return r}var Cn=null;function Ds(e){Cn?Cn.ops.push(e):e.ownsGroup=Cn={ops:[e],delayedCallbacks:[]}}function Rs(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 Os(e,t){var n=e.ownsGroup;if(!n)return;try{Rs(n)}finally{Cn=null,t(n)}}var Jn=null;function er(e,t){var n=Ye(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Cn?i=Cn.delayedCallbacks:Jn?i=Jn:(i=Jn=[],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=Jn;Jn=null;for(var t=0;t<e.length;++t)e[t]()}function Ha(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"?za(e,t,n,r):x=="class"?qi(e,t):x=="widget"&&Is(e,t,r)}t.changes=null}function $n(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&&P<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=$n(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Ka(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Ba(e,t)}function ks(e,t){var n=t.text.className,r=Ka(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,qi(e,t)):n&&(t.text.className=n)}function qi(e,t){Ms(e,t),t.line.wrapClass?$n(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 za(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=$n(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=$n(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",dr(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);Ga(e,t,n)}function Ns(e,t,n,r){var i=Ka(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),qi(e,t),za(e,t,n,r),Ga(e,t,r),t.node}function Ga(e,t,n){if(Va(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Va(e,t.rest[r],t,n,!1)}function Va(e,t,n,r,i){if(!t.widgets)return;for(var x=$n(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),er(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 qn(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;"),s(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Kr(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 Ri(e){return e.lineSpace.offsetTop}function ea(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Xa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=s(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Fr(e){return se-e.display.nativeBarWidth}function hn(e){return e.display.scroller.clientWidth-Fr(e)-e.display.barWidth}function ta(e){return e.display.scroller.clientHeight-Fr(e)-e.display.barHeight}function Fs(e,t,n){var r=e.options.lineWrapping,i=r&&hn(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 Ya(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(yt(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=at(t);var n=yt(t),r=e.display.externalMeasured=new Wa(e.doc,t,n);r.lineN=n;var i=r.built=Ba(e,r);return r.text=i.pre,s(e.display.lineMeasure,i.pre),r}function Qa(e,t,n,r){return Br(e,An(e,t),n,r)}function ra(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[gn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function An(e,t){var n=yt(t),r=ra(e,n);r&&!r.text?r=null:r&&r.changes&&(Ha(e,r,n,la(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=Ya(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Br(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 Za={left:0,right:0,top:0,bottom:0};function Ja(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=Za;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=Ja(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&&_e(t.line.text.charAt(i.coverStart+I));)--I;for(;i.coverStart+W<i.coverEnd&&_e(t.line.text.charAt(i.coverStart+W));)++W;if(F&&P<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&&P<11&&(X=Hs(e.display.measure,X))}else{I>0&&(K=r="right");var oe;e.options.lineWrapping&&(oe=x.getClientRects()).length>1?X=oe[r=="right"?oe.length-1:0]:X=x.getBoundingClientRect()}if(F&&P<9&&!I&&(!X||!X.left&&!X.right)){var he=x.parentNode.getClientRects()[0];he?X={left:he.left,right:he.left+Dn(e.display),top:he.top,bottom:he.bottom}:X=Za}for(var ce=X.top-t.rect.top,Se=X.bottom-t.rect.top,Pe=(ce+Se)/2,We=t.view.measure.heights,Qe=0;Qe<We.length-1&&!(Pe<We[Qe]);Qe++);var $e=Qe?We[Qe-1]:0,Ze=We[Qe],qe={left:(K=="right"?X.right:X.left)-t.rect.left,right:(K=="left"?X.left:X.right)-t.rect.left,top:$e,bottom:Ze};return!X.left&&!X.right&&(qe.bogus=!0),e.options.singleCursorHeightPerLine||(qe.rtop=ce,qe.rbottom=Se),qe}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 $a(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 qa(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)$a(e.display.view[t])}function ei(e){qa(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function eo(){return E&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function to(){return E&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function na(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=qn(e.widgets[n]));return t}function Oi(e,t,n,r,i){if(!i){var x=na(t);n.top+=x,n.bottom+=x}if(r=="line")return n;r||(r="local");var I=Mt(t);if(r=="local"?I+=Ri(e.display):I-=e.display.viewOffset,r=="page"||r=="window"){var W=e.display.lineSpace.getBoundingClientRect();I+=W.top+(r=="window"?0:to());var K=W.left+(r=="window"?0:eo());n.left+=K,n.right+=K}return n.top+=I,n.bottom+=I,n}function ro(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=eo(),i-=to();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 ia(e,t,n,r,i){return r||(r=et(e.doc,t.line)),Oi(e,r,Qa(e,r,t.ch,i),n)}function Or(e,t,n,r,i,x){r=r||et(e.doc,t.line),i||(i=An(e,r));function I(Se,Pe){var We=Br(e,i,Se,Pe?"right":"left",x);return Pe?We.left=We.right:We.right=We.left,Oi(e,r,We,n)}var W=ze(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(Se,Pe,We){var Qe=W[Pe],$e=Qe.level==1;return I(We?Se-1:Se,$e!=We)}var oe=Ne(W,K,X),he=Fe,ce=ne(K,oe,X=="before");return he!=null&&(ce.other=ne(K,he,X!="before")),ce}function no(e,t){var n=0;t=lt(e.doc,t),e.options.lineWrapping||(n=Dn(e.display)*t.ch);var r=et(e.doc,t.line),i=Mt(r)+Ri(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function aa(e,t,n,r,i){var x=Ie(e,t,n);return x.xRel=i,r&&(x.outside=r),x}function oa(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return aa(r.first,0,null,-1,-1);var i=br(r,n),x=r.first+r.size-1;if(i>x)return aa(r.first+r.size-1,et(r,x).text.length,null,1,1);t<0&&(t=0);for(var I=et(r,i);;){var W=Ks(e,I,i,t,n),K=Fa(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=et(r,i=X.line)}}function io(e,t,n,r){r-=na(t);var i=t.text.length,x=Ce(function(I){return Br(e,n,I-1).bottom<=r},i,0);return i=Ce(function(I){return Br(e,n,I).top>r},x,i),{begin:x,end:i}}function ao(e,t,n,r){n||(n=An(e,t));var i=Oi(e,t,Br(e,n,r),"line").top;return io(e,t,n,i)}function sa(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-=Mt(t);var x=An(e,t),I=na(t),W=0,K=t.text.length,X=!0,ne=ze(t,e.doc.direction);if(ne){var oe=(e.options.lineWrapping?Gs:zs)(e,t,n,x,ne,r,i);X=oe.level!=1,W=X?oe.from:oe.to-1,K=X?oe.to:oe.from-1}var he=null,ce=null,Se=Ce(function(ut){var ot=Br(e,x,ut);return ot.top+=I,ot.bottom+=I,sa(ot,r,i,!1)?(ot.top<=i&&ot.left<=r&&(he=ut,ce=ot),!0):!1},W,K),Pe,We,Qe=!1;if(ce){var $e=r-ce.left<ce.right-r,Ze=$e==X;Se=he+(Ze?0:1),We=Ze?"after":"before",Pe=$e?ce.left:ce.right}else{!X&&(Se==K||Se==W)&&Se++,We=Se==0?"after":Se==t.text.length?"before":Br(e,x,Se-(X?1:0)).bottom+I<=i==X?"after":"before";var qe=Or(e,Ie(n,Se,We),"line",t,x);Pe=qe.left,Qe=i<qe.top?-1:i>=qe.bottom?1:0}return Se=Te(t.text,Se,1),aa(n,Se,We,Qe,r-Pe)}function zs(e,t,n,r,i,x,I){var W=Ce(function(oe){var he=i[oe],ce=he.level!=1;return sa(Or(e,Ie(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=Or(e,Ie(n,X?K.from:K.to,X?"after":"before"),"line",t,r);sa(ne,x,I,!0)&&ne.top>I&&(K=i[W-1])}return K}function Gs(e,t,n,r,i,x,I){var W=io(e,t,r,I),K=W.begin,X=W.end;/\s/.test(t.text.charAt(X-1))&&X--;for(var ne=null,oe=null,he=0;he<i.length;he++){var ce=i[he];if(ce.from>=X||ce.to<=K)continue;var Se=ce.level!=1,Pe=Br(e,r,Se?Math.min(X,ce.to)-1:Math.max(K,ce.from)).right,We=Pe<x?x-Pe+1e9:Pe-x;(!ne||oe>We)&&(ne=ce,oe=We)}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 mn;function Ln(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(mn==null){mn=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)mn.appendChild(document.createTextNode("x")),mn.appendChild(a("br"));mn.appendChild(document.createTextNode("x"))}s(e.measure,mn);var n=mn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),c(e.measure),n||1}function Dn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");s(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function la(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:ua(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function ua(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function oo(e){var t=Ln(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Dn(e.display)-3);return function(i){if(Rt(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 da(e){var t=e.doc,n=oo(e);t.iter(function(r){var i=n(r);i!=r.height&&ur(r,i)})}function pn(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(oe){return null}var K=oa(e,x,I),X;if(r&&K.xRel>0&&(X=et(e.doc,K.line).text).length==K.ch){var ne=V(X,X.length,e.options.tabSize)-X.length;K=Ie(K.line,Math.max(0,Math.round((x-Xa(e.display).left)/Dn(e.display))-ne))}return K}function gn(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 fr(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)Lr&&wt(e.doc,t)<i.viewTo&&qr(e);else if(n<=i.viewFrom)Lr&&_t(e.doc,n+r)>i.viewFrom?qr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)qr(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):qr(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):qr(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):qr(e)}var X=i.externalMeasured;X&&(n<X.lineN?X.lineN+=r:t<X.lineN+X.size&&(i.externalMeasured=null))}function $r(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[gn(e,t)];if(x.node==null)return;var I=x.changes||(x.changes=[]);ie(I,n)==-1&&I.push(n)}function qr(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=gn(e,t),x,I=e.display.view;if(!Lr||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(;wt(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(gn(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,gn(e,n)))),r.viewTo=n}function so(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 ti(e){e.display.input.showSelection(e.display.input.prepareSelection())}function lo(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)&&uo(e,W.head,i),K||Xs(e,W,x)}return r}function uo(e,t,n){var r=Or(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=Xa(e.display),W=I.left,K=Math.max(r.sizerWidth,hn(e)-r.sizer.offsetLeft)-I.right,X=i.direction=="ltr";function ne(Ze,qe,ut,ot){qe<0&&(qe=0),qe=Math.round(qe),ot=Math.round(ot),x.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Ze+`px;
|
|
top: `+qe+"px; width: "+(ut==null?K-Ze:ut)+`px;
|
|
height: `+(ot-qe)+"px"))}function oe(Ze,qe,ut){var ot=et(i,Ze),gt=ot.text.length,At,$t;function Ut(Kt,pr){return ia(e,Ie(Ze,Kt),"div",ot,pr)}function Tr(Kt,pr,tr){var Vt=ao(e,ot,null,Kt),zt=pr=="ltr"==(tr=="after")?"left":"right",Ft=tr=="after"?Vt.begin:Vt.end-(/\s/.test(ot.text.charAt(Vt.end-1))?2:1);return Ut(Ft,zt)[zt]}var mr=ze(ot,i.direction);return Re(mr,qe||0,ut==null?gt:ut,function(Kt,pr,tr,Vt){var zt=tr=="ltr",Ft=Ut(Kt,zt?"left":"right"),gr=Ut(pr-1,zt?"right":"left"),Hn=qe==null&&Kt==0,on=ut==null&&pr==gt,or=Vt==0,jr=!mr||Vt==mr.length-1;if(gr.top-Ft.top<=3){var qt=(X?Hn:on)&&or,Ia=(X?on:Hn)&&jr,Gr=qt?W:(zt?Ft:gr).left,xn=Ia?K:(zt?gr:Ft).right;ne(Gr,Ft.top,xn-Gr,Ft.bottom)}else{var Tn,lr,Kn,Na;zt?(Tn=X&&Hn&&or?W:Ft.left,lr=X?K:Tr(Kt,tr,"before"),Kn=X?W:Tr(pr,tr,"after"),Na=X&&on&&jr?K:gr.right):(Tn=X?Tr(Kt,tr,"before"):W,lr=!X&&Hn&&or?K:Ft.right,Kn=!X&&on&&jr?W:gr.left,Na=X?Tr(pr,tr,"after"):K),ne(Tn,Ft.top,lr-Tn,Ft.bottom),Ft.bottom<gr.top&&ne(W,Ft.bottom,null,gr.top),ne(Kn,gr.top,Na-Kn,gr.bottom)}(!At||Mi(Ft,At)<0)&&(At=Ft),Mi(gr,At)<0&&(At=gr),(!$t||Mi(Ft,$t)<0)&&($t=Ft),Mi(gr,$t)<0&&($t=gr)}),{start:At,end:$t}}var he=t.from(),ce=t.to();if(he.line==ce.line)oe(he.line,he.ch,ce.ch);else{var Se=et(i,he.line),Pe=et(i,ce.line),We=at(Se)==at(Pe),Qe=oe(he.line,he.ch,We?Se.text.length+1:null).end,$e=oe(ce.line,We?0:null,ce.ch).start;We&&(Qe.top<$e.top-2?(ne(Qe.right,Qe.top,null,Qe.bottom),ne(W,$e.top,$e.left,$e.bottom)):ne(Qe.right,Qe.top,$e.left-Qe.right,Qe.bottom)),Qe.bottom<$e.top&&ne(W,Qe.bottom,null,$e.top)}n.appendChild(x)}function ca(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()||Rn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function co(e){e.state.focused||(e.display.input.focus(),fa(e))}function fo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Rn(e))},100)}function fa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(ye(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()),ca(e)}function Rn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(ye(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&&P<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)&&(ur(i.line,I),ho(i.line),i.rest))for(var oe=0;oe<i.rest.length;oe++)ho(i.rest[oe]);if(W>e.display.sizerWidth){var he=Math.ceil(W/Dn(e.display));he>e.display.maxLineLength&&(e.display.maxLineLength=he,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function ho(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-Ri(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,x=br(t,r),I=br(t,i);if(n&&n.ensure){var W=n.ensure.from.line,K=n.ensure.to.line;W<x?(x=W,I=br(t,Mt(et(t,W))+e.wrapper.clientHeight)):Math.min(K,t.lastLine())>=I&&(x=br(t,Mt(et(t,K))-e.wrapper.clientHeight),I=K)}return{from:x,to:Math.max(I,x+1)}}function Ys(e,t){if(Oe(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&&!w){var x=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Ri(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Fr(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?Ie(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Ie(t.line,t.ch+1,"before"):t);for(var x=0;x<5;x++){var I=!1,W=Or(e,t),K=!n||n==t?W:Or(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=ha(e,i),ne=e.doc.scrollTop,oe=e.doc.scrollLeft;if(X.scrollTop!=null&&(ni(e,X.scrollTop),Math.abs(e.doc.scrollTop-ne)>1&&(I=!0)),X.scrollLeft!=null&&(vn(e,X.scrollLeft),Math.abs(e.doc.scrollLeft-oe)>1&&(I=!0)),!I)break}return i}function Zs(e,t){var n=ha(e,t);n.scrollTop!=null&&ni(e,n.scrollTop),n.scrollLeft!=null&&vn(e,n.scrollLeft)}function ha(e,t){var n=e.display,r=Ln(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,x=ta(e),I={};t.bottom-t.top>x&&(t.bottom=t.top+x);var W=e.doc.height+ea(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 oe=e.options.fixedGutter?0:n.gutters.offsetWidth,he=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-oe,ce=hn(e)-n.gutters.offsetWidth,Se=t.right-t.left>ce;return Se&&(t.right=t.left+ce),t.left<10?I.scrollLeft=0:t.left<he?I.scrollLeft=Math.max(0,t.left+oe-(Se?0:10)):t.right>ce+he-3&&(I.scrollLeft=t.right+(Se?0:10)-ce),I}function ma(e,t){if(t==null)return;Ni(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function On(e){Ni(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function ri(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=no(e,t.from),r=no(e,t.to);mo(e,n,r,t.margin)}}function mo(e,t,n,r){var i=ha(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});ri(e,i.scrollLeft,i.scrollTop)}function ni(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;L||ga(e,{top:t}),po(e,t,!0),L&&ga(e),oi(e,100)}function po(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 vn(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,Eo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function ii(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ea(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+Fr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var yn=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),me(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),me(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,F&&P<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};yn.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}},yn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},yn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},yn.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 q,this.disableVert=new q},yn.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)},yn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ai=function(){};ai.prototype.update=function(){return{bottom:0,right:0}},ai.prototype.setScrollLeft=function(){},ai.prototype.setScrollTop=function(){},ai.prototype.clear=function(){};function Pn(e,t){t||(t=ii(e));var n=e.display.barWidth,r=e.display.barHeight;go(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),go(e,ii(e)),n=e.display.barWidth,r=e.display.barHeight}function go(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 vo={native:yn,null:ai};function yo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&f(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new vo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),me(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"?vn(e,t):ni(e,t)},e),e.display.scrollbars.addClass&&U(e.display.wrapper,e.display.scrollbars.addClass)}var $s=0;function bn(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 En(e){var t=e.curOp;t&&Os(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&&Rr(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&&pa(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&ki(t),e.barMeasure=ii(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Qa(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+Fr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-hn(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&&vn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==R();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Pn(t,e.barMeasure),e.updatedDisplay&&ya(t,e.barMeasure),e.selectionChanged&&ca(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&co(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&bo(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&po(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&vn(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=Qs(t,lt(r,e.scrollToPos.from),lt(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||ye(x[W],"hide");if(I)for(var K=0;K<I.length;++K)I[K].lines.length&&ye(I[K],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&ye(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function xr(e,t){if(e.curOp)return t();bn(e);try{return t()}finally{En(e)}}function Zt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);bn(e);try{return t.apply(e,arguments)}finally{En(e)}}}function sr(e){return function(){if(this.curOp)return e.apply(this,arguments);bn(this);try{return e.apply(this,arguments)}finally{En(this)}}}function Jt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);bn(t);try{return e.apply(this,arguments)}finally{En(t)}}}function oi(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=Lt(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?It(t.mode,r.state):null,K=Tt(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 oe=!I||I.length!=x.styles.length||X!=ne&&(!X||!ne||X.bgClass!=ne.bgClass||X.textClass!=ne.textClass),he=0;!oe&&he<I.length;++he)oe=I[he]!=x.styles[he];oe&&i.push(r.line),x.stateAfter=r.save(),r.nextLine()}else x.text.length<=e.options.maxHighlightLength&&Wr(e,x.text,r),x.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return oi(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&xr(e,function(){for(var x=0;x<i.length;x++)$r(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=hn(e),this.force=n,this.dims=la(e),this.events=[]};Ui.prototype.signal=function(e,t){$(e,t)&&this.events.push(arguments)},Ui.prototype.finish=function(){for(var e=0;e<this.events.length;e++)ye.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=Fr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Fr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=R();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==R())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 pa(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return qr(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&&so(e)==0)return!1;xo(e)&&(qr(e),t.dims=la(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)),Lr&&(x=wt(e.doc,x),I=_t(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=Mt(et(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var K=so(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,oi(e,400)),n.updateLineNumbers=null,!0}function bo(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==hn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ea(e.display)-ta(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(!pa(e,t))break;ki(e);var i=ii(e);ti(e),Pn(e,i),ya(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 ga(e,t){var n=new Ui(e,t);if(pa(e,n)){ki(e),bo(e,n);var r=ii(e);ti(e),Pn(e,r),ya(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(Se){var Pe=Se.nextSibling;return D&&u&&e.display.currentWheelTarget==Se?Se.style.display="none":Se.parentNode.removeChild(Se),Pe}for(var K=r.view,X=r.viewFrom,ne=0;ne<K.length;ne++){var oe=K[ne];if(!oe.hidden)if(!oe.node||oe.node.parentNode!=x){var he=Ns(e,oe,X,n);x.insertBefore(he,I)}else{for(;I!=oe.node;)I=W(I);var ce=i&&t!=null&&t<=X&&oe.lineNumber;oe.changes&&(ie(oe.changes,"gutter")>-1&&(ce=!1),Ha(e,oe,X,n)),ce&&(c(oe.lineNumber),oe.lineNumber.appendChild(document.createTextNode(dr(e.options,X)))),I=oe.node.nextSibling}X+=oe.size}for(;I;)I=W(I)}function va(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function ya(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+Fr(e)+"px"}function Eo(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=ua(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 xo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=dr(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",va(e.display),!0}return!1}function ba(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 To(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",va(e)}function si(e){To(e.display),fr(e),Eo(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: "+se+"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&&P<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!D&&!(L&&o)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=ba(r.gutters,r.lineNumbers),To(i),n.init(i)}var Fi=0,wr=null;F?wr=-.53:L?wr=15:E?wr=-.7:T&&(wr=-1/3);function So(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=So(e);return t.x*=wr,t.y*=wr,t}function wo(e,t){var n=So(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 oe=0;oe<ne.length;oe++)if(ne[oe].node==X){e.display.currentWheelTarget=X;break e}}if(r&&!L&&!_&&wr!=null){i&&K&&ni(e,Math.max(0,I.scrollTop+i*wr)),vn(e,Math.max(0,I.scrollLeft+r*wr)),(!i||i&&K)&&Y(t),x.wheelStartX=null;return}if(i&&wr!=null){var he=i*wr,ce=e.doc.scrollTop,Se=ce+x.wrapper.clientHeight;he<0?ce=Math.max(0,ce+he-50):Se=Math.min(e.doc.height,Se+he+50),ga(e,{top:ce,bottom:Se})}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 Pe=I.scrollLeft-x.wheelStartX,We=I.scrollTop-x.wheelStartY,Qe=We&&x.wheelDY&&We/x.wheelDY||Pe&&x.wheelDX&&Pe/x.wheelDX;if(x.wheelStartX=x.wheelStartY=null,!Qe)return;wr=(wr*Fi+Qe)/(Fi+1),++Fi},200)):(x.wheelDX+=r,x.wheelDY+=i))}var _r=function(e,t){this.ranges=e,this.primIndex=t};_r.prototype.primary=function(){return this.ranges[this.primIndex]},_r.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(!Ve(n.anchor,r.anchor)||!Ve(n.head,r.head))return!1}return!0},_r.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new xt(Nr(this.ranges[t].anchor),Nr(this.ranges[t].head));return new _r(e,this.primIndex)},_r.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},_r.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(st(t,r.from())>=0&&st(e,r.to())<=0)return n}return-1};var xt=function(e,t){this.anchor=e,this.head=t};xt.prototype.from=function(){return Sr(this.anchor,this.head)},xt.prototype.to=function(){return Dr(this.anchor,this.head)},xt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Pr(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(he,ce){return st(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=st(W.to(),I.from());if(r&&!I.empty()?K>0:K>=0){var X=Sr(W.from(),I.from()),ne=Dr(W.to(),I.to()),oe=W.empty()?I.from()==I.head:W.from()==W.head;x<=n&&--n,t.splice(--x,2,new xt(oe?ne:X,oe?X:ne))}}return new _r(t,n)}function en(e,t){return new _r([new xt(e,t||e)],0)}function tn(e){return e.text?Ie(e.from.line+e.text.length-1,be(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function _o(e,t){if(st(e,t.from)<0)return e;if(st(e,t.to)<=0)return tn(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+=tn(t).ch-t.to.ch),Ie(n,r)}function Ea(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new xt(_o(i.anchor,t),_o(i.head,t)))}return Pr(e.cm,n,e.sel.primIndex)}function Co(e,t,n){return e.line==t.line?Ie(n.line,e.ch-t.ch+n.ch):Ie(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Ie(e.first,0),x=i,I=0;I<t.length;I++){var W=t[I],K=Co(W.from,i,x),X=Co(tn(W),i,x);if(i=W.to,x=X,n=="around"){var ne=e.sel.ranges[I],oe=st(ne.head,ne.anchor)<0;r[I]=new xt(oe?X:K,oe?K:X)}else r[I]=new xt(K,K)}return new _r(r,e.sel.primIndex)}function xa(e){e.doc.mode=Yt(e.options,e.doc.modeOption),li(e)}function li(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,oi(e,100),e.state.modeGen++,e.curOp&&fr(e)}function Ao(e,t){return t.from.ch==0&&t.to.ch==0&&be(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ta(e,t,n,r){function i($e){return n?n[$e]:null}function x($e,Ze,qe){Qr($e,Ze,qe,r),er($e,"change",$e,t)}function I($e,Ze){for(var qe=[],ut=$e;ut<Ze;++ut)qe.push(new Ot(X[ut],i(ut),r));return qe}var W=t.from,K=t.to,X=t.text,ne=et(e,W.line),oe=et(e,K.line),he=be(X),ce=i(X.length-1),Se=K.line-W.line;if(t.full)e.insert(0,I(0,X.length)),e.remove(X.length,e.size-X.length);else if(Ao(e,t)){var Pe=I(0,X.length-1);x(oe,oe.text,ce),Se&&e.remove(W.line,Se),Pe.length&&e.insert(W.line,Pe)}else if(ne==oe)if(X.length==1)x(ne,ne.text.slice(0,W.ch)+he+ne.text.slice(K.ch),ce);else{var We=I(1,X.length-1);We.push(new Ot(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,We)}else if(X.length==1)x(ne,ne.text.slice(0,W.ch)+X[0]+oe.text.slice(K.ch),i(0)),e.remove(W.line+1,Se);else{x(ne,ne.text.slice(0,W.ch)+X[0],i(0)),x(oe,he+oe.text.slice(K.ch),ce);var Qe=I(1,X.length-1);Se>1&&e.remove(W.line+1,Se-1),e.insert(W.line+1,Qe)}er(e,"change",e,t)}function rn(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 Lo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,da(e),xa(e),Do(e),e.options.lineWrapping||Rr(e),e.options.mode=t.modeOption,fr(e)}function Do(e){(e.doc.direction=="rtl"?U:f)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){xr(e,function(){Do(e),fr(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 Sa(e,t){var n={from:Nr(t.from),to:tn(t),text:yr(e,t.from,t.to)};return Po(e,n,t.from.line,t.to.line+1),rn(e,function(r){return Po(r,n,t.from.line,t.to.line+1)},!0),n}function Ro(e){for(;e.length;){var t=be(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Ro(e.done),be(e.done);if(e.done.length&&!be(e.done).ranges)return be(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),be(e.done)}function Oo(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=be(I.changes),st(t.from,t.to)==0&&st(t.from,W.to)==0?W.to=tn(t):I.changes.push(Sa(e,t));else{var K=be(i.done);for((!K||!K.ranges)&&ji(e.sel,i.done),I={changes:[Sa(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||ye(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,be(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=be(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Po(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 Mo(e,t){var n=yl(e,t),r=Yr(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 Mn(e,t,n){for(var r=[],i=0;i<e.length;++i){var x=e[i];if(x.ranges){r.push(n?_r.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 oe in X)(ne=oe.match(/^spans_(\d+)$/))&&(ie(t,Number(ne[1]))>-1&&(be(W)[oe]=X[oe],delete X[oe]))}}return r}function wa(e,t,n,r){if(r){var i=e.anchor;if(n){var x=st(t,i)<0;x!=st(n,i)<0?(i=t,t=n):x!=st(t,n)<0&&(t=n)}return new xt(i,t)}else return new xt(n||t,t)}function Wi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),ar(e,new _r([wa(e.sel.primary(),t,n,i)],0),r)}function ko(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]=wa(e.sel.ranges[x],t[x],null,i);var I=Pr(e.cm,r,e.sel.primIndex);ar(e,I,n)}function _a(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,ar(e,Pr(e.cm,i,e.sel.primIndex),r)}function Io(e,t,n,r){ar(e,en(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 xt(lt(e,i[x].anchor),lt(e,i[x].head))},origin:n&&n.origin};return ye(e,"beforeSelectionChange",e,r),e.cm&&ye(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Pr(e.cm,r.ranges,r.ranges.length-1):t}function No(e,t,n){var r=e.history.done,i=be(r);i&&i.ranges?(r[r.length-1]=t,Hi(e,t,n)):ar(e,t,n)}function ar(e,t,n){Hi(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Hi(e,t,n){($(e,"beforeSelectionChange")||e.cm&&$(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(st(t.primary().head,e.sel.primary().head)<0?-1:1);Uo(e,Bo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&On(e.cm)}function Uo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,te(e.cm)),er(e,"cursorActivity",e)}function Fo(e){Uo(e,Bo(e,e.sel,null,!1))}function Bo(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 xt(K,X))}return i?Pr(e.cm,i,t.primIndex):t}function kn(e,t,n,r,i){var x=et(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&&(ye(K,"beforeCursorEnter"),K.explicitlyCleared))if(x.markedSpans){--I;continue}else break;if(!K.atomic)continue;if(n){var oe=K.find(r<0?1:-1),he=void 0;if((r<0?ne:X)&&(oe=jo(e,oe,-r,oe&&oe.line==t.line?x:null)),oe&&oe.line==t.line&&(he=st(oe,n))&&(r<0?he<0:he>0))return kn(e,oe,t,r,i)}var ce=K.find(r<0?-1:1);return(r<0?X:ne)&&(ce=jo(e,ce,r,ce.line==t.line?x:null)),ce?kn(e,ce,t,r,i):null}}return t}function Ki(e,t,n,r,i){var x=r||1,I=kn(e,t,n,x,i)||!i&&kn(e,t,n,x,!0)||kn(e,t,n,-x,i)||!i&&kn(e,t,n,-x,!0);return I||(e.cantEdit=!0,Ie(e.first,0))}function jo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?lt(e,Ie(t.line-1)):null:n>0&&t.ch==(r||et(e,t.line)).text.length?t.line<e.first+e.size-1?Ie(t.line+1,0):null:new Ie(t.line,t.ch+n)}function Wo(e){e.setSelection(Ie(e.firstLine(),0),Ie(e.lastLine()),fe)}function Ho(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=lt(e,i)),x&&(r.to=lt(e,x)),I&&(r.text=I),W!==void 0&&(r.origin=W)}),ye(e,"beforeChange",e,r),e.cm&&ye(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 In(e,t,n){if(e.cm){if(!e.cm.curOp)return Zt(e.cm,In)(e,t,n);if(e.cm.state.suppressEdits)return}if(($(e,"beforeChange")||e.cm&&$(e.cm,"beforeChange"))&&(t=Ho(e,t,!0),!t))return;var r=Si&&!n&&Ci(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Ko(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Ko(e,t)}function Ko(e,t){if(t.text.length==1&&t.text[0]==""&&st(t.from,t.to)==0)return;var n=Ea(e,t);Oo(e,t,n,e.cm?e.cm.curOp.id:NaN),ui(e,t,n,Yr(e,t));var r=[];rn(e,function(i,x){!x&&ie(r,i.history)==-1&&(Xo(i.history,t),r.push(i.history)),ui(i,t,null,Yr(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)){ar(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 oe=$(e,"beforeChange")||e.cm&&$(e.cm,"beforeChange"),he=function(Pe){var We=x.changes[Pe];if(We.origin=t,oe&&!Ho(e,We,!1))return W.length=0,{};ne.push(Sa(e,We));var Qe=Pe?Ea(e,We):be(W);ui(e,We,Qe,Mo(e,We)),!Pe&&e.cm&&e.cm.scrollIntoView({from:We.from,to:tn(We)});var $e=[];rn(e,function(Ze,qe){!qe&&ie($e,Ze.history)==-1&&(Xo(Ze.history,We),$e.push(Ze.history)),ui(Ze,We,null,Mo(Ze,We))})},ce=x.changes.length-1;ce>=0;--ce){var Se=he(ce);if(Se)return Se.v}}function zo(e,t){if(t==0)return;if(e.first+=t,e.sel=new _r(je(e.sel.ranges,function(i){return new xt(Ie(i.anchor.line+t,i.anchor.ch),Ie(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){fr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)$r(e.cm,r,"gutter")}}function ui(e,t,n,r){if(e.cm&&!e.cm.curOp)return Zt(e.cm,ui)(e,t,n,r);if(t.to.line<e.first){zo(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);zo(e,i),t={from:Ie(e.first,0),to:Ie(t.to.line+i,t.to.ch),text:[be(t.text)],origin:t.origin}}var x=e.lastLine();t.to.line>x&&(t={from:t.from,to:Ie(x,et(e,x).text.length),text:[t.text[0]],origin:t.origin}),t.removed=yr(e,t.from,t.to),n||(n=Ea(e,t)),e.cm?El(e.cm,t,r):Ta(e,t,r),Hi(e,n,fe),e.cantEdit&&Ki(e,Ie(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=yt(at(et(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&&te(e),Ta(r,t,n,oo(e)),e.options.lineWrapping||(r.iter(K,x.line+t.text.length,function(ce){var Se=nr(ce);Se>i.maxLineLength&&(i.maxLine=ce,i.maxLineLength=Se,i.maxLineChanged=!0,W=!1)}),W&&(e.curOp.updateMaxLine=!0)),Gn(r,x.line),oi(e,400);var X=t.text.length-(I.line-x.line)-1;t.full?fr(e):x.line==I.line&&t.text.length==1&&!Ao(e.doc,t)?$r(e,x.line,"text"):fr(e,x.line,I.line+1,X);var ne=$(e,"changes"),oe=$(e,"change");if(oe||ne){var he={from:x,to:I,text:t.text,removed:t.removed,origin:t.origin};oe&&er(e,"change",e,he),ne&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(he)}e.display.selForContextMenu=null}function Nn(e,t,n,r,i){var x;r||(r=n),st(r,n)<0&&(x=[r,n],n=x[0],r=x[1]),typeof t=="string"&&(t=e.splitLines(t)),In(e,{from:n,to:r,text:t,origin:i})}function Go(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Vo(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++)Go(x.ranges[W].anchor,t,n,r),Go(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=Ie(X.from.line+r,X.from.ch),X.to=Ie(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 Xo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Vo(e.done,n,r,i),Vo(e.undone,n,r,i)}function di(e,t,n,r){var i=t,x=t;return typeof t=="number"?x=et(e,Cr(e,t)):i=yt(t),i==null?null:(r(x,i)&&e.cm&&$r(e.cm,i,n),x)}function ci(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}ci.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,ir(i),er(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 fi(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}fi.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 ci))){var W=[];this.collapse(W),this.children=[new ci(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 ci(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 fi(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 fi(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 hi=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};hi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=yt(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=qn(this);ur(n,Math.max(0,n.height-x)),e&&(xr(e,function(){Yo(e,n,-x),$r(e,r,"widget")}),er(e,"lineWidgetCleared",e,this,r))},hi.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=qn(this)-t;if(!i)return;Rt(this.doc,r)||ur(r,r.height+i),n&&xr(n,function(){n.curOp.forceUpdate=!0,Yo(n,r,i),er(n,"lineWidgetChanged",n,e,yt(r))})},ae(hi);function Yo(e,t,n){Mt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&ma(e,n)}function xl(e,t,n,r){var i=new hi(e,n,r),x=e.cm;return x&&i.noHScroll&&(x.display.alignWidgets=!0),di(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&&!Rt(e,I)){var K=Mt(I)<e.scrollTop;ur(I,I.height+qn(i)),K&&ma(x,i.height),x.curOp.forceUpdate=!0}return!0}),x&&er(x,"lineWidgetAdded",x,i,typeof t=="number"?t:yt(t)),i}var Qo=0,nn=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Qo};nn.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&bn(e),$(this,"clear")){var n=this.find();n&&er(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=Xr(I.markedSpans,this);e&&!this.collapsed?$r(e,yt(I),"text"):e&&(W.to!=null&&(i=yt(I)),W.from!=null&&(r=yt(I))),I.markedSpans=Ua(I.markedSpans,W),W.from==null&&this.collapsed&&!Rt(this.doc,I)&&e&&ur(I,Ln(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var K=0;K<this.lines.length;++K){var X=at(this.lines[K]),ne=nr(X);ne>e.display.maxLineLength&&(e.display.maxLine=X,e.display.maxLineLength=ne,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&fr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Fo(e.doc)),e&&er(e,"markerCleared",e,this,r,i),t&&En(e),this.parent&&this.parent.clear()},nn.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=Xr(x.markedSpans,this);if(I.from!=null&&(n=Ie(t?x:yt(x),I.from),e==-1))return n;if(I.to!=null&&(r=Ie(t?x:yt(x),I.to),e==1))return r}return n&&{from:n,to:r}},nn.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;xr(r,function(){var i=t.line,x=yt(t.line),I=ra(r,x);if(I&&($a(I),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Rt(n.doc,i)&&n.height!=null){var W=n.height;n.height=null;var K=qn(n)-W;K&&ur(i,i.height+K)}er(r,"markerChanged",r,e)})},nn.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)},nn.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)}},ae(nn);function Un(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Zt(e.cm,Un)(e,t,n,r,i);var x=new nn(e,i),I=st(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($i(e,t.line,t,n,x)||t.line!=n.line&&$i(e,n.line,t,n,x))throw new Error("Inserting collapsed marker partially overlapping an existing one");_i()}x.addToHistory&&Oo(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(oe){K&&x.collapsed&&!K.options.lineWrapping&&at(oe)==K.display.maxLine&&(X=!0),x.collapsed&&W!=t.line&&ur(oe,0),Vn(oe,new Sn(x,W==t.line?t.ch:null,W==n.line?n.ch:null)),++W}),x.collapsed&&e.iter(t.line,n.line+1,function(oe){Rt(e,oe)&&ur(oe,0)}),x.clearOnEnter&&me(x,"beforeCursorEnter",function(){return x.clear()}),x.readOnly&&(wi(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),x.collapsed&&(x.id=++Qo,x.atomic=!0),K){if(X&&(K.curOp.updateMaxLine=!0),x.collapsed)fr(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++)$r(K,ne,"text");x.atomic&&Fo(K.doc),er(K,"markerAdded",K,x)}return x}var mi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};mi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();er(this,"clear")},mi.prototype.find=function(e,t){return this.primary.find(e,t)},ae(mi);function Tl(e,t,n,r,i){r=N(r),r.shared=!1;var x=[Un(e,t,n,r,i)],I=x[0],W=r.widgetNode;return rn(e,function(K){W&&(r.widgetNode=W.cloneNode(!0)),x.push(Un(K,lt(K,t),lt(K,n),r,i));for(var X=0;X<K.linked.length;++X)if(K.linked[X].isParent)return;I=be(x)}),new mi(x,I)}function Zo(e){return e.findMarks(Ie(e.first,0),e.clipPos(Ie(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(st(x,I)){var W=Un(e,x,I,r.primary,r.primary.type);r.markers.push(W),W.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],x=[i.primary.doc];rn(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 _l=0,hr=function(e,t,n,r,i){if(!(this instanceof hr))return new hr(e,t,n,r,i);n==null&&(n=0),fi.call(this,[new ci([new Ot("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var x=Ie(n,0);this.sel=en(x),this.history=new Bi(null),this.id=++_l,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Ta(this,{from:x,to:x,text:e}),ar(this,en(x),fe)};hr.prototype=Me(fi.prototype,{constructor:hr,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=Ir(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Jt(function(e){var t=Ie(this.first,0),n=this.first+this.size-1;In(this,{from:t,to:Ie(n,et(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&ri(this.cm,0,0),ar(this,en(t),fe)}),replaceRange:function(e,t,n,r){t=lt(this,t),n=n?lt(this,n):t,Nn(this,e,t,n,r)},getRange:function(e,t,n){var r=yr(this,lt(this,e),lt(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(Er(this,e))return et(this,e)},getLineNumber:function(e){return yt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=et(this,e)),at(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return lt(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:Jt(function(e,t,n){Io(this,lt(this,typeof e=="number"?Ie(e,t||0):e),null,n)}),setSelection:Jt(function(e,t,n){Io(this,lt(this,e),lt(this,t||e),n)}),extendSelection:Jt(function(e,t,n){Wi(this,lt(this,e),t&<(this,t),n)}),extendSelections:Jt(function(e,t){ko(this,Vr(this,e),t)}),extendSelectionsBy:Jt(function(e,t){var n=je(this.sel.ranges,e);ko(this,Vr(this,n),t)}),setSelections:Jt(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new xt(lt(this,e[i].anchor),lt(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),ar(this,Pr(this.cm,r,t),n)}),addSelection:Jt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new xt(lt(this,e),lt(this,t||e))),ar(this,Pr(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=yr(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=yr(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:Jt(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--)In(this,r[K]);W?No(this,W):this.cm&&On(this.cm)}),undo:Jt(function(){zi(this,"undo")}),redo:Jt(function(){zi(this,"redo")}),undoSelection:Jt(function(){zi(this,"undo",!0)}),redoSelection:Jt(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),rn(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:Mn(this.history.done),undone:Mn(this.history.undone)}},setHistory:function(e){var t=this.history=new Bi(this.history.maxGeneration);t.done=Mn(e.done.slice(0),null,!0),t.undone=Mn(e.undone.slice(0),null,!0)},setGutterMarker:Jt(function(e,t,n){return di(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Ge(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Jt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&di(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Ge(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Er(this,e))return null;if(t=e,e=et(this,e),!e)return null}else if(t=yt(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:Jt(function(e,t,n){return di(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:Jt(function(e,t,n){return di(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:Jt(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Un(this,lt(this,e),lt(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=lt(this,e),Un(this,e,e,n,"bookmark")},findMarksAt:function(e){e=lt(this,e);var t=[],n=et(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=lt(this,e),t=lt(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}),lt(this,Ie(n,t))},indexFromPos:function(e){e=lt(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 hr(Ir(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 hr(Ir(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,Zo(this)),r},unlinkDoc:function(e){if(e instanceof kt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(Zo(this));break}if(e.history==this.history){var r=[e.id];rn(e,function(i){return r.push(i.id)},!0),e.history=new Bi(null),e.history.done=Mn(this.history.done,r),e.history.undone=Mn(this.history.undone,r)}},iterLinkedDocs:function(e){rn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):ht(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Jt(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)})}),hr.prototype.eachLine=hr.prototype.iter;var Jo=0;function Cl(e){var t=this;if($o(t),Oe(t,e)||Kr(t.display,e))return;Y(e),F&&(Jo=+new Date);var n=pn(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&&Zt(t,function(){n=lt(t.doc,n);var ce={from:n,to:n,text:t.doc.splitLines(x.filter(function(Se){return Se!=null}).join(t.doc.lineSeparator())),origin:"paste"};In(t.doc,ce),No(t.doc,en(lt(t.doc,n),lt(t.doc,tn(ce))))})()},K=function(ce,Se){if(t.options.allowDropFileTypes&&ie(t.options.allowDropFileTypes,ce.type)==-1){W();return}var Pe=new FileReader;Pe.onerror=function(){return W()},Pe.onload=function(){var We=Pe.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(We)){W();return}x[Se]=We,W()},Pe.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 oe;if(t.state.draggingText&&!t.state.draggingText.copy&&(oe=t.listSelections()),Hi(t.doc,en(n,n)),oe)for(var he=0;he<oe.length;++he)Nn(t.doc,"",oe[he].anchor,oe[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-Jo<100)){ee(t);return}if(Oe(e,t)||Kr(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==",_&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),_&&n.parentNode.removeChild(n)}}function Ll(e,t){var n=pn(e,t);if(!n)return;var r=document.createDocumentFragment();uo(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),s(e.display.dragCursor,r)}function $o(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function qo(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 es=!1;function Dl(){if(es)return;Rl(),es=!0}function Rl(){var e;me(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,qo(Ol)},100))}),me(window,"blur",function(){return qo(Rn)})}function Ol(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var an={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"},pi=0;pi<10;pi++)an[pi+48]=an[pi+96]=String(pi);for(var Gi=65;Gi<=90;Gi++)an[Gi]=String.fromCharCode(Gi);for(var gi=1;gi<=12;gi++)an[gi+111]=an[gi+63235]="F"+gi;var zr={};zr.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"},zr.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"},zr.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"},zr.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"]},zr.default=u?zr.macDefault:zr.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=je(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 Fn(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 Fn(e,t.fallthrough,n,r);for(var x=0;x<t.fallthrough.length;x++){var I=Fn(e,t.fallthrough[x],n,r);if(I)return I}}}function ts(e){var t=typeof e=="string"?e:an[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function rs(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 ns(e,t){if(_&&e.keyCode==34&&e.char)return!1;var n=an[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),rs(n,e,t))}function Vi(e){return typeof e=="string"?zr[e]:e}function Bn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var x=t(n[i]);r.length&&st(x.from,be(r).to)<=0;){var I=r.pop();if(st(I.from,x.from)<0){x.from=I.from;break}}r.push(x)}xr(e,function(){for(var W=r.length-1;W>=0;W--)Nn(e.doc,"",r[W].from,r[W].to,"+delete");On(e)})}function Ca(e,t,n){var r=Te(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Aa(e,t,n){var r=Ca(e,t.ch,n);return r==null?null:new Ie(t.line,r,n<0?"after":"before")}function La(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var x=ze(n,t.doc.direction);if(x){var I=i<0?be(x):x[0],W=i<0==(I.level==1),K=W?"after":"before",X;if(I.level>0||t.doc.direction=="rtl"){var ne=An(t,n);X=i<0?n.text.length-1:0;var oe=Br(t,ne,X).top;X=Ce(function(he){return Br(t,ne,he).top==oe},i<0==(I.level==1)?I.from:I.to-1,X),K=="before"&&(X=Ca(n,X,1))}else X=i<0?I.to:I.from;return new Ie(r,X,K)}}return new Ie(r,i<0?n.text.length:0,i<0?"before":"after")}function kl(e,t,n,r){var i=ze(t,e.doc.direction);if(!i)return Aa(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=Ne(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 Aa(t,n,r);var W=function(Qe,$e){return Ca(t,Qe instanceof Ie?Qe.ch:Qe,$e)},K,X=function(Qe){return e.options.lineWrapping?(K=K||An(e,t),ao(e,t,K,Qe)):{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 oe=I.level==1==r<0,he=W(n,oe?1:-1);if(he!=null&&(oe?he<=I.to&&he<=ne.end:he>=I.from&&he>=ne.begin)){var ce=oe?"before":"after";return new Ie(n.line,he,ce)}}var Se=function(Qe,$e,Ze){for(var qe=function(At,$t){return $t?new Ie(n.line,W(At,1),"before"):new Ie(n.line,At,"after")};Qe>=0&&Qe<i.length;Qe+=$e){var ut=i[Qe],ot=$e>0==(ut.level!=1),gt=ot?Ze.begin:W(Ze.end,-1);if(ut.from<=gt&><ut.to)return qe(gt,ot);if(gt=ot?ut.from:W(ut.to,-1),Ze.begin<=gt&><Ze.end)return qe(gt,ot)}},Pe=Se(x+r,r,ne);if(Pe)return Pe;var We=r>0?ne.end:W(ne.begin,-1);return We!=null&&!(r>0&&We==t.text.length)&&(Pe=Se(r>0?0:i.length-1,r,X(We)),Pe)?Pe:null}var vi={selectAll:Wo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),fe)},killLine:function(e){return Bn(e,function(t){if(t.empty()){var n=et(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Ie(t.head.line+1,0)}:{from:t.head,to:Ie(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Bn(e,function(t){return{from:Ie(t.from().line,0),to:lt(e.doc,Ie(t.to().line+1,0))}})},delLineLeft:function(e){return Bn(e,function(t){return{from:Ie(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Bn(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 Bn(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(Ie(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ie(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return is(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return as(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")},ge)},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")},ge)},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/)?as(e,t.head):r},ge)},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 xr(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=et(e.doc,i.line).text;if(x){if(i.ch==x.length&&(i=new Ie(i.line,i.ch-1)),i.ch>0)i=new Ie(i.line,i.ch+1),e.replaceRange(x.charAt(i.ch-1)+x.charAt(i.ch-2),Ie(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var I=et(e.doc,i.line-1).text;I&&(i=new Ie(i.line,1),e.replaceRange(x.charAt(0)+e.doc.lineSeparator()+I.charAt(I.length-1),Ie(i.line-1,I.length-1),i,"+transpose"))}}n.push(new xt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return xr(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);On(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function is(e,t){var n=et(e.doc,t),r=at(n);return r!=n&&(t=yt(r)),La(!0,e,r,t,1)}function Il(e,t){var n=et(e.doc,t),r=mt(n);return r!=n&&(t=yt(r)),La(!0,e,n,t,-1)}function as(e,t){var n=is(e,t.line),r=et(e.doc,n.line),i=ze(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 Ie(n.line,I?0:x,n.sticky)}return n}function Xi(e,t,n){if(typeof t=="string"&&(t=vi[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=xe}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Nl(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Fn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Fn(t,e.options.extraKeys,n,e)||Fn(t,e.options.keyMap,n,e)}var Ul=new q;function yi(e,t,n,r){var i=e.state.keySeq;if(i){if(ts(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())}),os(e,i+" "+t,n,r))return!0}return os(e,t,n,r)}function os(e,t,n,r){var i=Nl(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&er(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(Y(n),ca(e)),!!i}function ss(e,t){var n=ns(t,!0);return n?t.shiftKey&&!e.state.keySeq?yi(e,"Shift-"+n,t,function(r){return Xi(e,r,!0)})||yi(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Xi(e,r)}):yi(e,n,t,function(r){return Xi(e,r)}):!1}function Fl(e,t,n){return yi(e,"'"+n+"'",t,function(r){return Xi(e,r,!0)})}var Da=null;function ls(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=R(),Oe(t,e))return;F&&P<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=ss(t,e);_&&(Da=r?n:null,!r&&n==88&&!bt&&(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"),Ke(document,"keyup",n),Ke(document,"mouseover",n))}me(document,"keyup",n),me(document,"mouseover",n)}function us(e){e.keyCode==16&&(this.doc.sel.shift=!1),Oe(this,e)}function ds(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Kr(t.display,e)||Oe(t,e)||e.ctrlKey&&!e.altKey||u&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(_&&n==Da){Da=null,Y(e);return}if(_&&(!e.which||e.which<10)&&ss(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,Ra=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ra.prototype.compare=function(e,t,n){return this.time+jl>e&&st(t,this.pos)==0&&n==this.button};var bi,Ei;function Wl(e,t){var n=+new Date;return Ei&&Ei.compare(n,e,t)?(bi=Ei=null,"triple"):bi&&bi.compare(n,e,t)?(Ei=new Ra(n,e,t),bi=null,"double"):(bi=new Ra(n,e,t),Ei=null,"single")}function cs(e){var t=this,n=t.display;if(Oe(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Kr(n,e)){D||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Oa(t,e))return;var r=pn(t,e),i=pe(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):fo(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,yi(e,rs(x,i),i,function(I){if(typeof I=="string"&&(I=vi[I]),!I)return!1;var W=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),W=I(e,n)!=xe}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(co,e),0):e.curOp.focus=R();var i=Kl(e,n,r),x=e.doc.sel,I;e.options.dragDrop&&Le&&!e.isReadOnly()&&n=="single"&&(I=x.contains(t))>-1&&(st((I=x.ranges[I]).from(),t)<0||t.xRel>0)&&(st(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=Zt(e,function(X){D&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ke(i.wrapper.ownerDocument,"mouseup",I),Ke(i.wrapper.ownerDocument,"mousemove",W),Ke(i.scroller,"dragstart",K),Ke(i.scroller,"drop",I),x||(Y(X),r.addNew||Wi(e.doc,n,null,null,r.extend),D&&!T||F&&P==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(),me(i.wrapper.ownerDocument,"mouseup",I),me(i.wrapper.ownerDocument,"mousemove",W),me(i.scroller,"dragstart",K),me(i.scroller,"drop",I),fo(e),setTimeout(function(){return i.input.focus()},20)}function fs(e,t,n){if(n=="char")return new xt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new xt(Ie(t.line,0),lt(e.doc,Ie(t.line+1,0)));var r=n(e,t);return new xt(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 xt(n,n)):(I=x.sel.primary(),W=x.sel.primIndex),r.unit=="rectangle")r.addNew||(I=new xt(n,n)),n=pn(e,t,!0,!0),W=-1;else{var ne=fs(e,n,r.unit);r.extend?I=wa(I,ne.anchor,ne.head,r.extend):I=ne}r.addNew?W==-1?(W=X.length,ar(x,Pr(e,X.concat([I]),W),{scroll:!1,origin:"*mouse"})):X.length>1&&X[W].empty()&&r.unit=="char"&&!r.extend?(ar(x,Pr(e,X.slice(0,W).concat(X.slice(W+1)),0),{scroll:!1,origin:"*mouse"}),K=x.sel):_a(x,W,I,Ee):(W=0,ar(x,new _r([I],0),Ee),K=x.sel);var oe=n;function he(Ze){if(st(oe,Ze)==0)return;if(oe=Ze,r.unit=="rectangle"){for(var qe=[],ut=e.options.tabSize,ot=V(et(x,n.line).text,n.ch,ut),gt=V(et(x,Ze.line).text,Ze.ch,ut),At=Math.min(ot,gt),$t=Math.max(ot,gt),Ut=Math.min(n.line,Ze.line),Tr=Math.min(e.lastLine(),Math.max(n.line,Ze.line));Ut<=Tr;Ut++){var mr=et(x,Ut).text,Kt=ve(mr,At,ut);At==$t?qe.push(new xt(Ie(Ut,Kt),Ie(Ut,Kt))):mr.length>Kt&&qe.push(new xt(Ie(Ut,Kt),Ie(Ut,ve(mr,$t,ut))))}qe.length||qe.push(new xt(n,n)),ar(x,Pr(e,K.ranges.slice(0,W).concat(qe),W),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ze)}else{var pr=I,tr=fs(e,Ze,r.unit),Vt=pr.anchor,zt;st(tr.anchor,Vt)>0?(zt=tr.head,Vt=Sr(pr.from(),tr.anchor)):(zt=tr.anchor,Vt=Dr(pr.to(),tr.head));var Ft=K.ranges.slice(0);Ft[W]=Xl(e,new xt(lt(x,Vt),zt)),ar(x,Pr(e,Ft,W),Ee)}}var ce=i.wrapper.getBoundingClientRect(),Se=0;function Pe(Ze){var qe=++Se,ut=pn(e,Ze,!0,r.unit=="rectangle");if(!ut)return;if(st(ut,oe)!=0){e.curOp.focus=R(),he(ut);var ot=Ii(i,x);(ut.line>=ot.to||ut.line<ot.from)&&setTimeout(Zt(e,function(){Se==qe&&Pe(Ze)}),150)}else{var gt=Ze.clientY<ce.top?-20:Ze.clientY>ce.bottom?20:0;gt&&setTimeout(Zt(e,function(){if(Se!=qe)return;i.scroller.scrollTop+=gt,Pe(Ze)}),50)}}function We(Ze){e.state.selectingText=!1,Se=Infinity,Ze&&(Y(Ze),i.input.focus()),Ke(i.wrapper.ownerDocument,"mousemove",Qe),Ke(i.wrapper.ownerDocument,"mouseup",$e),x.history.lastSelOrigin=null}var Qe=Zt(e,function(Ze){Ze.buttons===0||!pe(Ze)?We(Ze):Pe(Ze)}),$e=Zt(e,We);e.state.selectingText=$e,me(i.wrapper.ownerDocument,"mousemove",Qe),me(i.wrapper.ownerDocument,"mouseup",$e)}function Xl(e,t){var n=t.anchor,r=t.head,i=et(e.doc,n.line);if(st(n,r)==0&&n.sticky==r.sticky)return t;var x=ze(i);if(!x)return t;var I=Ne(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=Ne(x,r.ch,r.sticky),oe=ne-I||(r.ch-n.ch)*(W.level==1?-1:1);ne==K-1||ne==K?X=oe<0:X=oe>0}var he=x[K+(X?-1:0)],ce=X==(he.level==1),Se=ce?he.from:he.to,Pe=ce?"after":"before";return n.ch==Se&&n.sticky==Pe?t:new xt(new Ie(n.line,Se,Pe),r)}function hs(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||!$(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=br(e.doc,x),oe=e.display.gutterSpecs[K];return ye(e,n,e,ne,oe.className,t),Z(t)}}}function Oa(e,t){return hs(e,t,"gutterClick",!0)}function ms(e,t){if(Kr(e.display,t)||Yl(e,t))return;if(Oe(e,t,"contextmenu"))return;C||e.display.input.onContextMenu(t)}function Yl(e,t){return $(e,"gutterContextMenu")?hs(e,t,"gutterContextMenu",!1):!1}function ps(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ei(e)}var jn={toString:function(){return"CodeMirror.Init"}},gs={},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!=jn&&x(W,K,X)}:x)}e.defineOption=n,e.Init=jn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,xa(r)},!0),n("indentUnit",2,xa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){li(r),ei(r),fr(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(Ie(I,ne))}I++});for(var W=x.length-1;W>=0;W--)Nn(r.doc,i,x[W],Ie(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!=jn&&r.refresh()}),n("specialCharPlaceholder",ws,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!S),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){ps(r),si(r)},!0),n("keyMap","default",function(r,i,x){var I=Vi(i),W=x!=jn&&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=ba(i,r.options.lineNumbers),si(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?ua(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Pn(r)},!0),n("scrollbarStyle","native",function(r){yo(r),Pn(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=ba(r.options.gutters,i),si(r)},!0),n("firstLineNumber",1,si,!0),n("lineNumberFormatter",function(r){return r},si,!0),n("showCursorWhenSelecting",!1,ti,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Rn(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,ti,!0),n("singleCursorHeightPerLine",!0,ti,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,li,!0),n("addModeClass",!1,li,!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,li,!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!=jn;if(!t!=!r){var i=e.display.dragFunctions,x=t?me:Ke;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"),Rr(e)),da(e),fr(e),ei(e),setTimeout(function(){return Pn(e)},100)}function kt(e,t){var n=this;if(!(this instanceof kt))return new kt(e,t);this.options=t=t?N(t):{},N(gs,t,!1);var r=t.value;typeof r=="string"?r=new hr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new kt.inputStyles[t.inputStyle](this),x=this.display=new dl(e,r,i,t);x.wrapper.CodeMirror=this,ps(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),yo(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 q,keySeq:null,specialChars:null},t.autofocus&&!o&&x.input.focus(),F&&P<11&&setTimeout(function(){return n.display.input.reset(!0)},20),$l(this),Dl(),bn(this),this.curOp.forceUpdate=!0,Lo(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&fa(n)},20):Rn(this);for(var I in Yi)Yi.hasOwnProperty(I)&&Yi[I](this,t[I],jn);xo(this),t.finishInit&&t.finishInit(this);for(var W=0;W<Pa.length;++W)Pa[W](this);En(this),D&&t.lineWrapping&&getComputedStyle(x.lineDiv).textRendering=="optimizelegibility"&&(x.lineDiv.style.textRendering="auto")}kt.defaults=gs,kt.optionHandlers=Yi;function $l(e){var t=e.display;me(t.scroller,"mousedown",Zt(e,cs)),F&&P<11?me(t.scroller,"dblclick",Zt(e,function(K){if(Oe(e,K))return;var X=pn(e,K);if(!X||Oa(e,K)||Kr(e.display,K))return;Y(K);var ne=e.findWordAt(X);Wi(e.doc,ne.anchor,ne.head)})):me(t.scroller,"dblclick",function(K){return Oe(e,K)||Y(K)}),me(t.scroller,"contextmenu",function(K){return ms(e,K)}),me(t.input.getField(),"contextmenu",function(K){t.scroller.contains(K.target)||ms(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,oe=X.top-K.top;return ne*ne+oe*oe>20*20}me(t.scroller,"touchstart",function(K){if(!Oe(e,K)&&!x(K)&&!Oa(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)}}),me(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),me(t.scroller,"touchend",function(K){var X=t.activeTouch;if(X&&!Kr(t,K)&&X.left!=null&&!X.moved&&new Date-X.start<300){var ne=e.coordsChar(t.activeTouch,"page"),oe;!X.prev||I(X,X.prev)?oe=new xt(ne,ne):!X.prev.prev||I(X,X.prev.prev)?oe=e.findWordAt(ne):oe=new xt(Ie(ne.line,0),lt(e.doc,Ie(ne.line+1,0))),e.setSelection(oe.anchor,oe.head),e.focus(),Y(K)}i()}),me(t.scroller,"touchcancel",i),me(t.scroller,"scroll",function(){t.scroller.clientHeight&&(ni(e,t.scroller.scrollTop),vn(e,t.scroller.scrollLeft,!0),ye(e,"scroll",e))}),me(t.scroller,"mousewheel",function(K){return wo(e,K)}),me(t.scroller,"DOMMouseScroll",function(K){return wo(e,K)}),me(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(K){Oe(e,K)||ee(K)},over:function(K){Oe(e,K)||(Ll(e,K),ee(K))},start:function(K){return Al(e,K)},drop:Zt(e,Cl),leave:function(K){Oe(e,K)||$o(e)}};var W=t.input.getField();me(W,"keyup",function(K){return us.call(e,K)}),me(W,"keydown",Zt(e,ls)),me(W,"keypress",Zt(e,ds)),me(W,"focus",function(K){return fa(e,K)}),me(W,"blur",function(K){return Rn(e,K)})}var Pa=[];kt.defineInitHook=function(e){return Pa.push(e)};function xi(e,t,n,r){var i=e.doc,x;n==null&&(n="add"),n=="smart"&&(i.mode.indent?x=Lt(e,t).state:n="prev");var I=e.options.tabSize,W=et(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==xe||ne>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?ne=V(et(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 oe="",he=0;if(e.options.indentWithTabs)for(var ce=Math.floor(ne/I);ce;--ce)he+=I,oe+=" ";if(he<ne&&(oe+=ue(ne-he)),oe!=X)return Nn(i,oe,Ie(t,0),Ie(t,X.length),"+input"),W.stateAfter=null,!0;for(var Se=0;Se<i.sel.ranges.length;Se++){var Pe=i.sel.ranges[Se];if(Pe.head.line==t&&Pe.head.ch<X.length){var We=Ie(t,X.length);_a(i,Se,new xt(We,We));break}}}var Mr=null;function Qi(e){Mr=e}function Ma(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=ht(t),X=null;if(W&&r.ranges.length>1)if(Mr&&Mr.text.join(`
|
|
`)==t){if(r.ranges.length%Mr.text.length==0){X=[];for(var ne=0;ne<Mr.text.length;ne++)X.push(x.splitLines(Mr.text[ne]))}}else K.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(X=je(K,function(Qe){return[Qe]}));for(var oe=e.curOp.updateInput,he=r.ranges.length-1;he>=0;he--){var ce=r.ranges[he],Se=ce.from(),Pe=ce.to();ce.empty()&&(n&&n>0?Se=Ie(Se.line,Se.ch-n):e.state.overwrite&&!W?Pe=Ie(Pe.line,Math.min(et(x,Pe.line).text.length,Pe.ch+be(K).length)):W&&Mr&&Mr.lineWise&&Mr.text.join(`
|
|
`)==K.join(`
|
|
`)&&(Se=Pe=Ie(Se.line,0)));var We={from:Se,to:Pe,text:X?X[he%X.length]:K,origin:i||(W?"paste":e.state.cutIncoming>I?"cut":"+input")};In(e.doc,We),er(e,"inputRead",e,We)}t&&!W&&ys(e,t),On(e),e.curOp.updateInput<2&&(e.curOp.updateInput=oe),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function vs(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&xr(t,function(){return Ma(t,n,0,null,"paste")}),!0}function ys(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=xi(e,i.head.line,"smart");break}}else x.electricInput&&(x.electricInput.test(et(e.doc,i.head.line).text.slice(0,i.head.ch))&&(I=xi(e,i.head.line,"smart")));I&&er(e,"electricInput",e,i.head.line)}}function bs(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:Ie(i,0),head:Ie(i+1,0)};n.push(x),t.push(e.getRange(x.anchor,x.head))}return{text:t,ranges:n}}function Es(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function xs(){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"),Es(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)&&Zt(this,t[r])(this,i,I),ye(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:sr(function(r,i){var x=r.token?r:e.getMode(this.options,r);if(x.startState)throw new Error("Overlays may not be stateful.");Be(this.state.overlays,{mode:x,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(I){return I.priority}),this.state.modeGen++,fr(this)}),removeOverlay:sr(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++,fr(this);return}}}),indentLine:sr(function(r,i,x){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Er(this.doc,r)&&xi(this,r,i,x)}),indentSelection:sr(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&&(xi(this,W.head.line,r,!0),x=W.head.line,I==this.doc.sel.primIndex&&On(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 oe=ne;oe<x;++oe)xi(this,oe,r);var he=this.doc.sel.ranges;K.ch==0&&i.length==he.length&&he[I].from().ch>0&&_a(this.doc,I,new xt(K,he[I].to()),fe)}}}),getTokenAt:function(r,i){return Hr(this,r,i)},getLineTokens:function(r,i){return Hr(this,Ie(r),i,!0)},getTokenTypeAt:function(r){r=lt(this.doc,r);var i=Ar(this,et(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 oe=I._global[ne];oe.pred(W,this)&&ie(x,oe.val)==-1&&x.push(oe.val)}return x},getStateAfter:function(r,i){var x=this.doc;return r=Cr(x,r==null?x.first+x.size-1:r),Lt(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=lt(this.doc,r):x=r?I.from():I.to(),Or(this,x,i||"page")},charCoords:function(r,i){return ia(this,lt(this.doc,r),i||"page")},coordsChar:function(r,i){return r=ro(this,r,i||"page"),oa(this,r.left,r.top)},lineAtHeight:function(r,i){return r=ro(this,{top:r,left:0},i||"page").top,br(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=et(this.doc,r)}else W=r;return Oi(this,W,{top:0,left:0},i||"page",x||I).top+(I?this.doc.height-Mt(W):0)},defaultTextHeight:function(){return Ln(this.display)},defaultCharWidth:function(){return Dn(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=Or(this,lt(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 oe=Math.max(K.wrapper.clientHeight,this.doc.height),he=Math.max(K.sizer.clientWidth,K.lineSpace.clientWidth);(I=="above"||r.bottom+i.offsetHeight>oe)&&r.top>i.offsetHeight?X=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=oe&&(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:sr(ls),triggerOnKeyPress:sr(ds),triggerOnKeyUp:us,triggerOnMouseDown:sr(cs),execCommand:function(r){if(vi.hasOwnProperty(r))return vi[r].call(null,this)},triggerElectric:sr(function(r){ys(this,r)}),findPosH:function(r,i,x,I){var W=1;i<0&&(W=-1,i=-i);for(var K=lt(this.doc,r),X=0;X<i&&!(K=ka(this.doc,K,W,x,I),K.hitSide);++X);return K},moveH:sr(function(r,i){var x=this;this.extendSelectionsBy(function(I){return x.display.shift||x.doc.extend||I.empty()?ka(x.doc,I.head,r,i,x.options.rtlMoveVisually):r<0?I.from():I.to()},ge)}),deleteH:sr(function(r,i){var x=this.doc.sel,I=this.doc;x.somethingSelected()?I.replaceSelection("",null,"+delete"):Bn(this,function(W){var K=ka(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=lt(this.doc,r),ne=0;ne<i;++ne){var oe=Or(this,X,"div");if(K==null?K=oe.left:oe.left=K,X=Ts(this,oe,W,x),X.hitSide)break}return X},moveV:sr(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 oe=Or(x,ne.head,"div");ne.goalColumn!=null&&(oe.left=ne.goalColumn),W.push(oe.left);var he=Ts(x,oe,r,i);return i=="page"&&ne==I.sel.primary()&&ma(x,ia(x,he,"div").top-oe.top),he},ge),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=et(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=Ue(X,K)?function(oe){return Ue(oe,K)}:/\s/.test(X)?function(oe){return/\s/.test(oe)}:function(oe){return!/\s/.test(oe)&&!Ue(oe)};I>0&&ne(x.charAt(I-1));)--I;for(;W<x.length&&ne(x.charAt(W));)++W}return new xt(Ie(r.line,I),Ie(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"),ye(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==R()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:sr(function(r,i){ri(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Fr(this)-this.display.barHeight,width:r.scrollWidth-Fr(this)-this.display.barWidth,clientHeight:ta(this),clientWidth:hn(this)}},scrollIntoView:sr(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:Ie(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):mo(this,r.from,r.to,r.margin)}),setSize:sr(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&&qa(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){$r(x,W,"widget");break}}++W}),this.curOp.forceUpdate=!0,ye(this,"refresh",this)}),operation:function(r){return xr(this,r)},startOperation:function(){return bn(this)},endOperation:function(){return En(this)},refresh:sr(function(){var r=this.display.cachedTextHeight;fr(this),this.curOp.forceUpdate=!0,ei(this),ri(this,this.doc.scrollLeft,this.doc.scrollTop),va(this.display),(r==null||Math.abs(r-Ln(this.display))>.5||this.options.lineWrapping)&&da(this),ye(this,"refresh",this)}),swapDoc:sr(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Lo(this,r),ei(this),this.display.input.reset(),ri(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,er(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}},ae(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 ka(e,t,n,r,i){var x=t,I=n,W=et(e,t.line),K=i&&e.direction=="rtl"?-n:n;function X(){var $e=t.line+K;return $e<e.first||$e>=e.first+e.size?!1:(t=new Ie($e,t.ch,t.sticky),W=et(e,$e))}function ne($e){var Ze;if(r=="codepoint"){var qe=W.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(qe)?Ze=null:Ze=new Ie(t.line,Math.max(0,Math.min(W.text.length,t.ch+n*(qe>=55296&&qe<56320?2:1))),-n)}else i?Ze=kl(e.cm,W,t,n):Ze=Aa(W,t,n);if(Ze==null)if(!$e&&X())t=La(i,e.cm,W,t.line,K);else return!1;else t=Ze;return!0}if(r=="char"||r=="codepoint")ne();else if(r=="column")ne(!0);else if(r=="word"||r=="group")for(var oe=null,he=r=="group",ce=e.cm&&e.cm.getHelper(t,"wordChars"),Se=!0;!(n<0&&!ne(!Se));Se=!1){var Pe=W.text.charAt(t.ch)||`
|
|
`,We=Ue(Pe,ce)?"w":he&&Pe==`
|
|
`?"n":!he||/\s/.test(Pe)?null:"p";if(he&&!Se&&!We&&(We="s"),oe&&oe!=We){n<0&&(n=1,ne(),t.sticky="after");break}if(We&&(oe=We),n>0&&!ne(!Se))break}var Qe=Ki(e,t,x,I,!0);return Ve(x,Qe)&&(Qe.hitSide=!0),Qe}function Ts(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*Ln(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=oa(e,x,I),!X.outside);){if(n<0?I<=0:I>=i.height){X.hitSide=!0;break}I+=n*5}return X}var St=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new q,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};St.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;Es(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}me(i,"paste",function(W){if(!x(W)||Oe(r,W)||vs(W,r))return;P<=11&&setTimeout(Zt(r,function(){return t.updateFromDOM()}),20)}),me(i,"compositionstart",function(W){t.composing={data:W.data,done:!1}}),me(i,"compositionupdate",function(W){t.composing||(t.composing={data:W.data,done:!1})}),me(i,"compositionend",function(W){t.composing&&(W.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),me(i,"touchstart",function(){return n.forceCompositionEnd()}),me(i,"input",function(){t.composing||t.readFromDOMSoon()});function I(W){if(!x(W)||Oe(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=bs(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=Mr.text.join(`
|
|
`);if(W.clipboardData.setData("Text",X),W.clipboardData.getData("Text")==X){W.preventDefault();return}}var ne=xs(),oe=ne.firstChild;r.display.lineSpace.insertBefore(ne,r.display.lineSpace.firstChild),oe.value=Mr.text.join(`
|
|
`);var he=document.activeElement;G(oe),setTimeout(function(){r.display.lineSpace.removeChild(ne),he.focus(),he==i&&n.showPrimarySelection()},50)}me(i,"copy",I),me(i,"cut",I)},St.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},St.prototype.prepareSelection=function(){var e=lo(this.cm,!1);return e.focus=document.activeElement==this.div,e},St.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},St.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},St.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&&st(Sr(x,I),r)==0&&st(Dr(x,I),i)==0)return;var W=t.display.view,K=r.line>=t.display.viewFrom&&Ss(t,r)||{node:W[0].measure.map[2],offset:0},X=i.line<t.display.viewTo&&Ss(t,i);if(!X){var ne=W[W.length-1].measure,oe=ne.maps?ne.maps[ne.maps.length-1]:ne.map;X={node:oe[oe.length-1],offset:oe[oe.length-2]-oe[oe.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(Se){}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()},St.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)},St.prototype.showMultipleSelections=function(e){s(this.cm.display.cursorDiv,e.cursors),s(this.cm.display.selectionDiv,e.selection)},St.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},St.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return v(this.div,t)},St.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},St.prototype.blur=function(){this.div.blur()},St.prototype.getField=function(){return this.div},St.prototype.supportsTouch=function(){return!0},St.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():xr(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)},St.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},St.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&&xr(t,function(){ar(t.doc,en(n,r),fe),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},St.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=Ie(r.line-1,et(e.doc,r.line-1).length)),i.ch==et(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Ie(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var x,I,W;r.line==t.viewFrom||(x=gn(e,r.line))==0?(I=yt(t.view[0].line),W=t.view[0].node):(I=yt(t.view[x].line),W=t.view[x-1].node.nextSibling);var K=gn(e,i.line),X,ne;if(K==t.view.length-1?(X=t.viewTo-1,ne=t.lineDiv.lastChild):(X=yt(t.view[K+1].line)-1,ne=t.view[K+1].node.previousSibling),!W)return!1;for(var oe=e.doc.splitLines(tu(e,W,ne,I,X)),he=yr(e.doc,Ie(I,0),Ie(X,et(e.doc,X).text.length));oe.length>1&&he.length>1;)if(be(oe)==be(he))oe.pop(),he.pop(),X--;else if(oe[0]==he[0])oe.shift(),he.shift(),I++;else break;for(var ce=0,Se=0,Pe=oe[0],We=he[0],Qe=Math.min(Pe.length,We.length);ce<Qe&&Pe.charCodeAt(ce)==We.charCodeAt(ce);)++ce;for(var $e=be(oe),Ze=be(he),qe=Math.min($e.length-(oe.length==1?ce:0),Ze.length-(he.length==1?ce:0));Se<qe&&$e.charCodeAt($e.length-Se-1)==Ze.charCodeAt(Ze.length-Se-1);)++Se;if(oe.length==1&&he.length==1&&I==r.line)for(;ce&&ce>r.ch&&$e.charCodeAt($e.length-Se-1)==Ze.charCodeAt(Ze.length-Se-1);)ce--,Se++;oe[oe.length-1]=$e.slice(0,$e.length-Se).replace(/^\u200b+/,""),oe[0]=oe[0].slice(ce).replace(/\u200b+$/,"");var ut=Ie(I,ce),ot=Ie(X,he.length?be(he).length-Se:0);if(oe.length>1||oe[0]||st(ut,ot))return Nn(e.doc,oe,ut,ot,"+input"),!0},St.prototype.ensurePolled=function(){this.forceCompositionEnd()},St.prototype.reset=function(){this.forceCompositionEnd()},St.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},St.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)},St.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&xr(this.cm,function(){return fr(e.cm)})},St.prototype.setUneditable=function(e){e.contentEditable="false"},St.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Zt(this.cm,Ma)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},St.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},St.prototype.onContextMenu=function(){},St.prototype.resetPosition=function(){},St.prototype.needsContentAttribute=!0;function Ss(e,t){var n=ra(e,t.line);if(!n||n.hidden)return null;var r=et(e.doc,t.line),i=Ya(n,r,t.line),x=ze(r,e.doc.direction),I="left";if(x){var W=Ne(x,t.ch);I=W%2?"right":"left"}var K=Ja(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 Wn(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(Se){return Se.id==ce}}function ne(){I&&(x+=W,K&&(x+=W),I=K=!1)}function oe(ce){ce&&(ne(),x+=ce)}function he(ce){if(ce.nodeType==1){var Se=ce.getAttribute("cm-text");if(Se){oe(Se);return}var Pe=ce.getAttribute("cm-marker"),We;if(Pe){var Qe=e.findMarks(Ie(r,0),Ie(i+1,0),X(+Pe));Qe.length&&(We=Qe[0].find(0))&&oe(yr(e.doc,We.from,We.to).join(W));return}if(ce.getAttribute("contenteditable")=="false")return;var $e=/^(pre|div|p|li|table|br)$/i.test(ce.nodeName);if(!/^br$/i.test(ce.nodeName)&&ce.textContent.length==0)return;$e&&ne();for(var Ze=0;Ze<ce.childNodes.length;Ze++)he(ce.childNodes[Ze]);/^(pre|p)$/i.test(ce.nodeName)&&(K=!0),$e&&(I=!0)}else ce.nodeType==3&&oe(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 Wn(e.clipPos(Ie(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 Wn(Ie(yt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var x=e.rest?be(e.rest):e.line;return Wn(Ie(yt(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(We,Qe,$e){for(var Ze=-1;Ze<(X?X.length:0);Ze++)for(var qe=Ze<0?K.map:X[Ze],ut=0;ut<qe.length;ut+=3){var ot=qe[ut+2];if(ot==We||ot==Qe){var gt=yt(Ze<0?e.line:e.rest[Ze]),At=qe[ut]+$e;return($e<0||ot!=We)&&(At=qe[ut+($e?1:0)]),Ie(gt,At)}}}var oe=ne(I,W,n);if(oe)return Wn(oe,i);for(var he=W.nextSibling,ce=I?I.nodeValue.length-n:0;he;he=he.nextSibling){if(oe=ne(he,he.firstChild,0),oe)return Wn(Ie(oe.line,oe.ch-ce),i);ce+=he.textContent.length}for(var Se=W.previousSibling,Pe=n;Se;Se=Se.previousSibling){if(oe=ne(Se,Se.firstChild,-1),oe)return Wn(Ie(oe.line,oe.ch+Pe),i);Pe+=Se.textContent.length}}var Wt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new q,this.hasSelection=!1,this.composing=null};Wt.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"),me(i,"input",function(){F&&P>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),me(i,"paste",function(I){if(Oe(r,I)||vs(I,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function x(I){if(Oe(r,I))return;if(r.somethingSelected())Qi({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var W=bs(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)}me(i,"cut",x),me(i,"copy",x),me(e.scroller,"paste",function(I){if(Kr(e,I)||Oe(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)}),me(e.lineSpace,"selectstart",function(I){Kr(e,I)||Y(I)}),me(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"})}}),me(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Wt.prototype.createField=function(e){this.wrapper=xs(),this.textarea=this.wrapper.firstChild},Wt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Wt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=lo(e);if(e.options.moveInputWithCursor){var i=Or(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},Wt.prototype.showSelection=function(e){var t=this.cm,n=t.display;s(n.cursorDiv,e.cursors),s(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Wt.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&&P>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",F&&P>=9&&(this.hasSelection=null))},Wt.prototype.getField=function(){return this.textarea},Wt.prototype.supportsTouch=function(){return!1},Wt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||R()!=this.textarea))try{this.textarea.focus()}catch(e){}},Wt.prototype.blur=function(){this.textarea.blur()},Wt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Wt.prototype.receivedFocus=function(){this.slowPoll()},Wt.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()})},Wt.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)},Wt.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||nt(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&&P>=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 xr(t,function(){Ma(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},Wt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Wt.prototype.onKeyPress=function(){F&&P>=9&&(this.hasSelection=null),this.fastPoll()},Wt.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var x=pn(n,e),I=r.scroller.scrollTop;if(!x||_)return;var W=n.options.resetSelectionOnContextMenu;W&&n.doc.sel.contains(x)==-1&&Zt(n,ar)(n.doc,en(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 oe;D&&(oe=window.scrollY),r.input.focus(),D&&window.scrollTo(null,oe),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 Pe=n.somethingSelected(),We="\u200B"+(Pe?i.value:"");i.value="\u21DA",i.value=We,t.prevInput=Pe?"":"\u200B",i.selectionStart=1,i.selectionEnd=We.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&&P<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=I),i.selectionStart!=null){(!F||F&&P<9)&&he();var Pe=0,We=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Zt(n,Wo)(n):Pe++<10?r.detectingSelectAll=setTimeout(We,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(We,200)}}if(F&&P>=9&&he(),C){ee(e);var Se=function(){Ke(window,"mouseup",Se),setTimeout(ce,20)};me(window,"mouseup",Se)}else setTimeout(ce,50)},Wt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Wt.prototype.setUneditable=function(){},Wt.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=R();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=W.getValue()}var i;if(e.form&&(me(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&&(Ke(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var W=kt(function(K){return e.parentNode.insertBefore(K,e.nextSibling)},t);return W}function iu(e){e.off=Ke,e.on=me,e.wheelEventPixels=cl,e.Doc=hr,e.splitLines=ht,e.countColumn=V,e.findColumn=ve,e.isWordChar=Ae,e.Pass=xe,e.signal=ye,e.Line=Ot,e.changeEnd=tn,e.scrollbarModel=vo,e.Pos=Ie,e.cmpPos=st,e.modes=Dt,e.mimeModes=ft,e.resolveMode=Xt,e.getMode=Yt,e.modeExtensions=rr,e.extendMode=kr,e.copyState=It,e.startState=Ht,e.innerMode=Nt,e.commands=vi,e.keyMap=zr,e.keyName=ns,e.isModifierKey=ts,e.lookupKey=Fn,e.normalizeKeyMap=Ml,e.StringStream=Ct,e.SharedTextMarker=mi,e.TextMarker=nn,e.LineWidget=hi,e.e_preventDefault=Y,e.e_stopPropagation=Q,e.e_stop=ee,e.addClass=U,e.contains=v,e.rmClass=f,e.keyNames=an}Ql(kt),ql(kt);var au="iter insert remove copy getEditor constructor".split(" ");for(var Ji in hr.prototype)hr.prototype.hasOwnProperty(Ji)&&ie(au,Ji)<0&&(kt.prototype[Ji]=function(e){return function(){return e.apply(this.doc,arguments)}}(hr.prototype[Ji]));return ae(hr),kt.inputStyles={textarea:Wt,contenteditable:St},kt.defineMode=function(e){!kt.defaults.mode&&e!="null"&&(kt.defaults.mode=e),Gt.apply(this,arguments)},kt.defineMIME=vr,kt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),kt.defineMIME("text/plain","null"),kt.defineExtension=function(e,t){kt.prototype[e]=t},kt.defineDocExtension=function(e,t){hr.prototype[e]=t},kt.fromTextArea=nu,iu(kt),kt.version="5.58.2",kt})},Y1PL:function(it,Je,J){"use strict";J.r(Je),J.d(Je,"ResizableTextArea",function(){return ie});var re=J("wx14"),z=J("1OyB"),L=J("vuIU"),H=J("Ji7U"),k=J("LK+K"),M=J("q1tI"),F=J("VTBJ"),P=J("rePB"),D=J("Zm9Q"),O=J("Kwbf"),E=J("c+Xe"),_=J("m+aA"),T=J("bdgK"),A=new Map;function w(fe){fe.forEach(function(Ee){var ge,ve=Ee.target;(ge=A.get(ve))===null||ge===void 0||ge.forEach(function(le){return le(ve)})})}var b=new T.default(w),d=null,o=null;function u(fe,Ee){A.has(fe)||(A.set(fe,new Set),b.observe(fe)),A.get(fe).add(Ee)}function l(fe,Ee){A.has(fe)&&(A.get(fe).delete(Ee),A.get(fe).size||(b.unobserve(fe),A.delete(fe)))}var S=function(fe){Object(H.a)(ge,fe);var Ee=Object(k.a)(ge);function ge(){return Object(z.a)(this,ge),Ee.apply(this,arguments)}return Object(L.a)(ge,[{key:"render",value:function(){return this.props.children}}]),ge}(M.Component),h=M.createContext(null);function g(fe){var Ee=fe.children,ge=fe.onBatchResize,ve=M.useRef(0),le=M.useRef([]),ue=M.useContext(h),be=M.useCallback(function(je,Be,ke){ve.current+=1;var Me=ve.current;le.current.push({size:je,element:Be,data:ke}),Promise.resolve().then(function(){Me===ve.current&&(ge==null||ge(le.current),le.current=[])}),ue==null||ue(je,Be,ke)},[ge,ue]);return M.createElement(h.Provider,{value:be},Ee)}function C(fe){var Ee=fe.children,ge=fe.disabled,ve=M.useRef(null),le=M.useRef(null),ue=M.useContext(h),be=M.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),je=M.isValidElement(Ee)&&Object(E.c)(Ee),Be=je?Ee.ref:null,ke=M.useMemo(function(){return Object(E.a)(Be,ve)},[Be,ve]),Me=M.useRef(fe);Me.current=fe;var we=M.useCallback(function(Ae){var Ue=Me.current,Ge=Ue.onResize,He=Ue.data,_e=Ae.getBoundingClientRect(),Te=_e.width,Ce=_e.height,Re=Ae.offsetWidth,Fe=Ae.offsetHeight,Ne=Math.floor(Te),De=Math.floor(Ce);if(be.current.width!==Ne||be.current.height!==De||be.current.offsetWidth!==Re||be.current.offsetHeight!==Fe){var ze={width:Ne,height:De,offsetWidth:Re,offsetHeight:Fe};be.current=ze;var Xe=Re===Math.round(Te)?Te:Re,me=Fe===Math.round(Ce)?Ce:Fe,Ye=Object(F.a)(Object(F.a)({},ze),{},{offsetWidth:Xe,offsetHeight:me});ue==null||ue(Ye,Ae,He),Ge&&Promise.resolve().then(function(){Ge(Ye,Ae)})}},[]);return M.useEffect(function(){var Ae=Object(_.a)(ve.current)||Object(_.a)(le.current);return Ae&&!ge&&u(Ae,we),function(){return l(Ae,we)}},[ve.current,ge]),M.createElement(S,{ref:le},je?M.cloneElement(Ee,{ref:ke}):Ee)}var y="rc-observer-key";function f(fe){var Ee=fe.children,ge=Object(D.a)(Ee);return ge.map(function(ve,le){var ue=(ve==null?void 0:ve.key)||"".concat(y,"-").concat(le);return M.createElement(C,Object(re.a)({},fe,{key:ue}),ve)})}f.Collection=g;var c=f,s=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"],R={},U;function j(fe){var Ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ge=fe.getAttribute("id")||fe.getAttribute("data-reactid")||fe.getAttribute("name");if(Ee&&R[ge])return R[ge];var ve=window.getComputedStyle(fe),le=ve.getPropertyValue("box-sizing")||ve.getPropertyValue("-moz-box-sizing")||ve.getPropertyValue("-webkit-box-sizing"),ue=parseFloat(ve.getPropertyValue("padding-bottom"))+parseFloat(ve.getPropertyValue("padding-top")),be=parseFloat(ve.getPropertyValue("border-bottom-width"))+parseFloat(ve.getPropertyValue("border-top-width")),je=v.map(function(ke){return"".concat(ke,":").concat(ve.getPropertyValue(ke))}).join(";"),Be={sizingStyle:je,paddingSize:ue,borderSize:be,boxSizing:le};return Ee&&ge&&(R[ge]=Be),Be}function G(fe){var Ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ge=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,ve=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,Ee),ue=le.paddingSize,be=le.borderSize,je=le.boxSizing,Be=le.sizingStyle;U.setAttribute("style","".concat(Be,";").concat(p)),U.value=fe.value||fe.placeholder||"";var ke=Number.MIN_SAFE_INTEGER,Me=Number.MAX_SAFE_INTEGER,we=U.scrollHeight,Ae;if(je==="border-box"?we+=be:je==="content-box"&&(we-=ue),ge!==null||ve!==null){U.value=" ";var Ue=U.scrollHeight-ue;ge!==null&&(ke=Ue*ge,je==="border-box"&&(ke=ke+ue+be),we=Math.max(ke,we)),ve!==null&&(Me=Ue*ve,je==="border-box"&&(Me=Me+ue+be),Ae=we>Me?"":"hidden",we=Math.min(Me,we))}return{height:we,minHeight:ke,maxHeight:Me,overflowY:Ae,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 q=function(fe){Object(H.a)(ge,fe);var Ee=Object(k.a)(ge);function ge(ve){var le;return Object(z.a)(this,ge),le=Ee.call(this,ve),le.nextFrameActionId=void 0,le.resizeFrameId=void 0,le.textArea=void 0,le.saveTextArea=function(ue){le.textArea=ue},le.handleResize=function(ue){var be=le.state.resizeStatus,je=le.props,Be=je.autoSize,ke=je.onResize;if(be!==V.NONE)return;typeof ke=="function"&&ke(ue),Be&&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 be=ue.minRows,je=ue.maxRows,Be=G(le.textArea,!1,be,je);le.setState({textareaStyles:Be,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,be=ue.prefixCls,je=be===void 0?"rc-textarea":be,Be=ue.autoSize,ke=ue.onResize,Me=ue.className,we=ue.disabled,Ae=le.state,Ue=Ae.textareaStyles,Ge=Ae.resizeStatus,He=Object(s.a)(le.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),_e=m()(je,Me,Object(P.a)({},"".concat(je,"-disabled"),we));"value"in He&&(He.value=He.value||"");var Te=Object(F.a)(Object(F.a)(Object(F.a)({},le.props.style),Ue),Ge===V.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return M.createElement(c,{onResize:le.handleResize,disabled:!(Be||ke)},M.createElement("textarea",Object(re.a)({},He,{className:_e,style:Te,ref:le.saveTextArea})))},le.state={textareaStyles:{},resizeStatus:V.NONE},le}return Object(L.a)(ge,[{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(be){}}},{key:"render",value:function(){return this.renderTextArea()}}]),ge}(M.Component),ie=q,se=function(fe){Object(H.a)(ge,fe);var Ee=Object(k.a)(ge);function ge(ve){var le;Object(z.a)(this,ge),le=Ee.call(this,ve),le.resizableTextArea=void 0,le.focus=function(){le.resizableTextArea.textArea.focus()},le.saveTextArea=function(be){le.resizableTextArea=be},le.handleChange=function(be){var je=le.props.onChange;le.setValue(be.target.value,function(){le.resizableTextArea.resizeTextarea()}),je&&je(be)},le.handleKeyDown=function(be){var je=le.props,Be=je.onPressEnter,ke=je.onKeyDown;be.keyCode===13&&Be&&Be(be),ke&&ke(be)};var ue=typeof ve.value=="undefined"||ve.value===null?ve.defaultValue:ve.value;return le.state={value:ue},le}return Object(L.a)(ge,[{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 M.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}}]),ge}(M.Component),xe=Je.default=se},ZW9T:function(it,Je,J){"use strict";J.d(Je,"a",function(){return S});var re=J("k1fw"),z=J("miYZ"),L=J("tsqr"),H=J("rAM+"),k=J("tJVT"),M=J("PpiC"),F=J("q1tI"),P=J.n(F),D=J("bdgK");function O(h,g,C,y,f){var c=g.getWordUntilPosition(C),s={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:s}});return f.map(function(m){a.push(Object(re.a)(Object(re.a)({},m),{},{range:s}))}),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(s,a){var m=O(h,s,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(s,a){var m=[{label:"print",kind:h.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:h.languages.CompletionItemInsertTextRule.InsertAsSnippet}],p=O(h,s,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(s,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=O(h,s,a,f,m);return{suggestions:p}}})},_="\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 w(){}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 o(){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=Je.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,s=h.language,a=s===void 0?"javascript":s,m=h.style,p=m===void 0?{}:m,v=h.options,R=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,q=h.autoHeight,ie=q===void 0?!1:q,se=h.forbidCopy,xe=se===void 0?!1:se,fe=h.onChange,Ee=fe===void 0?w:fe,ge=h.editorDidMount,ve=ge===void 0?w:ge,le=h.onFocus,ue=le===void 0?w:le,be=h.filename,je=be===void 0?"educoder.txt":be,Be=Object(M.a)(h,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),ke=Object(F.useRef)(),Me=Object(F.useRef)({}),we=Object(F.useRef)(),Ae=Object(F.useRef)(!1),Ue=Object(F.useRef)(),Ge=Object(F.useState)(!1),He=Object(k.a)(Ge,2),_e=He[0],Te=He[1];function Ce(){var Z;return ke.current&&(Z=new D.default(function(ee){var de=Object(H.a)(ee),pe;try{for(de.s();!(pe=de.n()).done;){var Le=pe.value;(Le.target.offsetHeight>0||Le.target.offsetWidth>0)&&Me.current.instance.layout()}}catch(tt){de.e(tt)}finally{de.f()}}),Z.observe(ke.current)),Z}function Re(){L.b.warn(decodeURIComponent(_))}var Fe=function(){var ee=Me.current.instance;if(c!=null&&ee&&_e){var de=ee.getModel();de&&c!==de.getValue()&&(b=!0,de.setValue(c),ee.layout(),b=!1)}};Object(F.useEffect)(function(){we.current&&clearTimeout(we.current),we.current=setTimeout(function(){Fe()},500)},[c,_e,Me.current]);function Ne(){var Z=Me.current.instance;if(Z){var ee=Z.getSelection(),de=Me.current.pastePos||{},pe=new u.Range(de.startLineNumber||ee.endLineNumber,de.startColumn||ee.endColumn,de.endLineNumber||ee.endLineNumber,de.endColumn||ee.endColumn);setTimeout(function(){Z.executeEdits("",[{range:pe,text:""}])},300)}}function De(Z){(window.navigator.platform.match("Mac")?Z.metaKey:Z.ctrlKey)&&Z.keyCode==83&&(Z.preventDefault(),V())}var ze=function(){if(ie&&Me.current.instance){var ee=Me.current.instance.getContentHeight();Y(ee<f?f:ee)}else Y(f)};function Xe(Z){var ee=document.createEvent("MouseEvents");ee.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Z.dispatchEvent(ee)}function me(Z,ee){var de=window.URL||window.webkitURL||window,pe=new Blob([ee]),Le=document.createElementNS("http://www.w3.org/1999/xhtml","a");Le.href=de.createObjectURL(pe),Le.download=Z,Xe(Le)}Object(F.useEffect)(function(){ze()},[ze]),Object(F.useEffect)(function(){ke.current&&!_e&&J.e(27).then(J.t.bind(null,"M/lh",7)).then(function(Z){try{u=Z,Me.current.instance=u.editor.create(ke.current,{value:c,language:o(a),theme:B,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},j);var ee=Me.current.instance;if(ve(ee,u),setTimeout(function(){ze(),Me.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){me(je||"educoder.txt",ee.getValue())}})},500),Me.current.subscription=ee.onDidChangeModelContent(function(pe){Ae.current?clearTimeout(Ue.current):(ze(),Ee(ee.getValue(),pe)),Ue.current=setTimeout(function(){Ae.current=!1},500)}),window.Monaco||E(u),xe&&(ee.addCommand(u.KeyMod.CtrlCmd|u.KeyMod.Shift|u.KeyCode.KEY_V,function(){return Re(),null}),ee.addCommand(u.KeyMod.CtrlCmd|u.KeyCode.KEY_C,function(){return Re(),null})),window.Monaco=u,N&&ee.onDidBlurEditorWidget(function(){N(ee.getValue())}),ue&&ee.onDidFocusEditorText(function(){ue(ee.getValue())}),xe){ee.addCommand(u.KeyMod.CtrlCmd|u.KeyCode.KEY_V,function(){return Re(),null}),ee.onDidPaste(function(pe){Me.current.pastePos=pe});try{window.addEventListener("paste",Ne)}catch(pe){}}var de=Ce();return Te(!0),function(){var pe=Me.current.instance;pe.dispose();var Le=pe.getModel();Le&&Le.dispose(),Me.current.subscription&&Me.current.subscription.dispose(),xe&&window.removeEventListener("paste",Ne),de.unobserve(ke.current)}}catch(pe){}})},[]),Object(F.useEffect)(function(){var Z=Me.current.instance;if(Z&&_e)return document.addEventListener("keydown",De,!1),function(){document.removeEventListener("keydown",De)}},[V,_e]),Object(F.useEffect)(function(){var Z=Me.current.instance;if(Z&&_e){var ee=o(a);u.editor.setModelLanguage(Z.getModel(),ee),console.log("language:",a,Z.getModel(),ee)}},[a,_e]),Object(F.useEffect)(function(){var Z=Me.current.instance;Z&&_e&&u.editor.setTheme(B)},[B,_e]),Object(F.useEffect)(function(){var Z=Me.current.instance;Z&&_e&&(Z.updateOptions(Object(re.a)({},R)),setTimeout(function(){Z.getModel().updateOptions(Object(re.a)({},R))},200))},[JSON.stringify(R),_e]),Object(F.useEffect)(function(){var Z=Me.current.instance;Z&&_e&&Z.layout()},[C,f,_e]);var Ye=Object(F.useState)(A(C)),Ke=Object(k.a)(Ye,2),ye=Ke[0],Oe=Ke[1],te=Object(F.useState)(A(f)),$=Object(k.a)(te,2),ae=$[0],Y=$[1],Q=Object(re.a)(Object(re.a)({},p),{},{width:ye,height:ae});return P.a.createElement("div",{className:"my-monaco-editor",ref:ke,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,s=h.modified,a=h.language,m=h.options,p=m===void 0?{}:m,v=Object(F.useRef)(),R=Object(F.useState)(null),U=Object(k.a)(R,2),j=U[0],G=U[1];function B(ie){var se;return v.current&&(se=new D.default(function(xe){var fe=Object(H.a)(xe),Ee;try{for(fe.s();!(Ee=fe.n()).done;){var ge=Ee.value;(ge.target.offsetHeight>0||ge.target.offsetWidth>0)&&ie.layout()}}catch(ve){fe.e(ve)}finally{fe.f()}}),se.observe(v.current)),se}Object(F.useEffect)(function(){v.current&&J.e(27).then(J.t.bind(null,"M/lh",7)).then(function(ie){u=ie;var se=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(se);var xe=B(se);return function(){se.dispose();var fe=se.getModel();fe&&fe.dispose(),xe.unobserve(v.current)}})},[]),Object(F.useEffect)(function(){j&&j.setModel({original:u.editor.createModel(c,a),modified:u.editor.createModel(s,a)})},[c,s,a,j]);var N=A(C),V=A(f),q={width:N,height:V};return P.a.createElement("div",{className:"my-diff-editor",ref:v,style:q})}},ZpRC:function(it,Je,J){"use strict";function re(E){return typeof E=="object"&&E!=null&&E.nodeType===1}function z(E,_){return(!_||E!=="hidden")&&E!=="visible"&&E!=="clip"}function L(E,_){if(E.clientHeight<E.scrollHeight||E.clientWidth<E.scrollWidth){var T=getComputedStyle(E,null);return z(T.overflowY,_)||z(T.overflowX,_)||function(A){var w=function(b){if(!b.ownerDocument||!b.ownerDocument.defaultView)return null;try{return b.ownerDocument.defaultView.frameElement}catch(d){return null}}(A);return!!w&&(w.clientHeight<A.scrollHeight||w.clientWidth<A.scrollWidth)}(E)}return!1}function H(E,_,T,A,w,b,d,o){return b<E&&d>_||b>E&&d<_?0:b<=E&&o<=T||d>=_&&o>=T?b-E-A:d>_&&o<T||b<E&&o>T?d-_+w:0}var k=function(E,_){var T=window,A=_.scrollMode,w=_.block,b=_.inline,d=_.boundary,o=_.skipOverflowHiddenElements,u=typeof d=="function"?d:function(Ue){return Ue!==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,o)&&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(),s=c.height,a=c.width,m=c.top,p=c.right,v=c.bottom,R=c.left,U=w==="start"||w==="nearest"?m:w==="end"?v:m+s/2,j=b==="center"?R+a/2:b==="end"?p:R,G=[],B=0;B<S.length;B++){var N=S[B],V=N.getBoundingClientRect(),q=V.height,ie=V.width,se=V.top,xe=V.right,fe=V.bottom,Ee=V.left;if(A==="if-needed"&&m>=0&&R>=0&&v<=C&&p<=g&&m>=se&&v<=fe&&R>=Ee&&p<=xe)return G;var ge=getComputedStyle(N),ve=parseInt(ge.borderLeftWidth,10),le=parseInt(ge.borderTopWidth,10),ue=parseInt(ge.borderRightWidth,10),be=parseInt(ge.borderBottomWidth,10),je=0,Be=0,ke="offsetWidth"in N?N.offsetWidth-N.clientWidth-ve-ue:0,Me="offsetHeight"in N?N.offsetHeight-N.clientHeight-le-be:0;if(l===N)je=w==="start"?U:w==="end"?U-C:w==="nearest"?H(f,f+C,C,le,be,f+U,f+U+s,s):U-C/2,Be=b==="start"?j:b==="center"?j-g/2:b==="end"?j-g:H(y,y+g,g,ve,ue,y+j,y+j+a,a),je=Math.max(0,je+f),Be=Math.max(0,Be+y);else{je=w==="start"?U-se-le:w==="end"?U-fe+be+Me:w==="nearest"?H(se,fe,q,le,be+Me,U,U+s,s):U-(se+q/2)+Me/2,Be=b==="start"?j-Ee-ve:b==="center"?j-(Ee+ie/2)+ke/2:b==="end"?j-xe+ue+ke:H(Ee,xe,ie,ve,ue+ke,j,j+a,a);var we=N.scrollLeft,Ae=N.scrollTop;U+=Ae-(je=Math.max(0,Math.min(Ae+je,N.scrollHeight-q+Me))),j+=we-(Be=Math.max(0,Math.min(we+Be,N.scrollWidth-ie+ke)))}G.push({el:N,top:je,left:Be})}return G};function M(E){return E===Object(E)&&Object.keys(E).length!==0}function F(E,_){_===void 0&&(_="auto");var T="scrollBehavior"in document.body.style;E.forEach(function(A){var w=A.el,b=A.top,d=A.left;w.scroll&&T?w.scroll({top:b,left:d,behavior:_}):(w.scrollTop=b,w.scrollLeft=d)})}function P(E){return E===!1?{block:"end",inline:"nearest"}:M(E)?E:{block:"start",inline:"nearest"}}function D(E,_){var T=!E.ownerDocument.documentElement.contains(E);if(M(_)&&typeof _.behavior=="function")return _.behavior(T?[]:k(E,_));if(T)return;var A=P(_);return F(k(E,A),A.behavior)}var O=Je.a=D},bT9E:function(it,Je,J){"use strict";J.d(Je,"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(M){delete k[M]}),k}},c5Ni:function(it,Je,J){},dejd:function(it,Je,J){},dmUQ:function(it,Je,J){"use strict";var re=J("Ff2n"),z=J("rePB"),L=J("1OyB"),H=J("vuIU"),k=J("Ji7U"),M=J("md7G"),F=J("foSv"),P=J("q1tI"),D=J.n(P),O=J("TSYQ"),E=J.n(O),_=J("4IlW");function T(s,a){var m=Object.keys(s);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(s);a&&(p=p.filter(function(v){return Object.getOwnPropertyDescriptor(s,v).enumerable})),m.push.apply(m,p)}return m}function A(s){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)(s,p,m[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(m)):T(Object(m)).forEach(function(p){Object.defineProperty(s,p,Object.getOwnPropertyDescriptor(m,p))})}return s}function w(s){var a=b();return function(){var p=Object(F.a)(s),v;if(a){var R=Object(F.a)(this).constructor;v=Reflect.construct(p,arguments,R)}else v=p.apply(this,arguments);return Object(M.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(s){return!1}}function d(){}function o(s){s.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(s){Object(k.a)(m,s);var a=w(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===_.a.UP){var V=v.getRatio(j);v.up(j,V,null),v.stop()}else if(j.keyCode===_.a.DOWN){var q=v.getRatio(j);v.down(j,q,null),v.stop()}else j.keyCode===_.a.ENTER&&N&&N(j);if(v.recordCursorPosition(),v.lastKeyCode=j.keyCode,B){for(var ie=arguments.length,se=new Array(ie>1?ie-1:0),xe=1;xe<ie;xe++)se[xe-1]=arguments[xe];B.apply(void 0,[j].concat(se))}},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,q;B?q=N:q=v.toPrecisionAsStep(V),q==null&&(q="");var ie=v.formatWrapper(q);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===_.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 R=p.value;R===void 0&&(R=p.defaultValue),v.state={focused:p.autoFocus};var U=v.getValidValue(v.toNumber(R));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 R=this.props,U=R.value,j=R.onChange,G=R.max,B=R.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),q;this.pressingUpOrDown?q=V:this.inputting?q=this.rawInput:q=this.toPrecisionAsStep(V),this.setState({value:V,inputValue:q})}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 se=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===_.a.BACKSPACE?se=this.cursorStart-1:this.lastKeyCode===_.a.DELETE&&(se=this.cursorStart):se=this.input.value.length,this.fixCaret(se,se)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case _.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case _.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(xe){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(v){var R=v;return R===""?R="":this.isNotCompleteNumber(parseFloat(R))?R=this.state.value:R=this.getValidValue(R),this.toNumber(R)}},{key:"getValueFromEvent",value:function(v){var R=v.target.value.trim().replace(/。/g,".");return g(this.props.decimalSeparator)&&(R=R.replace(this.props.decimalSeparator,".")),R}},{key:"getValidValue",value:function(v){var R=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<R&&(j=R),j>U&&(j=U),j)}},{key:"setValue",value:function(v,R){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,q=typeof j=="number"?j.toFixed(U):"".concat(j),ie=j!==B||q!=="".concat(V);return"value"in this.props?(V=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:V},R)):this.setState({value:j,inputValue:this.toPrecisionAsStep(v)},R),ie&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(v){var R=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(R),N=this.getPrecision(G),V=this.getPrecision(v);return v?Math.max(V,B+N):B+N}},{key:"getPrecisionFactor",value:function(v){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.getMaxPrecision(v,R);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 R=Math.abs(this.getMaxPrecision(v));return isNaN(R)?v.toString():Number(v).toFixed(R)}},{key:"toNumber",value:function(v){var R=this.props.precision,U=this.state.focused,j=v&&v.length>16&&U;return this.isNotCompleteNumber(v)||j?v:g(R)?Math.round(v*Math.pow(10,R))/Math.pow(10,R):Number(v)}},{key:"upStep",value:function(v,R){var U=this.props.step,j=this.getPrecisionFactor(v,R),G=Math.abs(this.getMaxPrecision(v,R)),B=((j*v+j*U*R)/j).toFixed(G);return this.toNumber(B)}},{key:"downStep",value:function(v,R){var U=this.props.step,j=this.getPrecisionFactor(v,R),G=Math.abs(this.getMaxPrecision(v,R)),B=((j*v-j*U*R)/j).toFixed(G);return this.toNumber(B)}},{key:"step",value:function(v,R){var U=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,G=arguments.length>3?arguments[3]:void 0;this.stop(),R&&(R.persist(),R.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),q=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}),q)return;this.autoStepTimer=setTimeout(function(){U[v](R,j,!0)},G?l:S)}},{key:"fixCaret",value:function(v,R){if(v===void 0||R===void 0||!this.input||!this.input.value)return;try{var U=this.input.selectionStart,j=this.input.selectionEnd;(v!==U||R!==j)&&this.input.setSelectionRange(v,R)}catch(G){}}},{key:"render",value:function(){var v,R=this.props,U=R.prefixCls,j=R.disabled,G=R.readOnly,B=R.useTouch,N=R.autoComplete,V=R.upHandler,q=R.downHandler,ie=R.className,se=R.max,xe=R.min,fe=R.style,Ee=R.title,ge=R.onMouseEnter,ve=R.onMouseLeave,le=R.onMouseOver,ue=R.onMouseOut,be=R.required,je=R.onClick,Be=R.tabIndex,ke=R.type,Me=R.placeholder,we=R.id,Ae=R.inputMode,Ue=R.pattern,Ge=R.step,He=R.maxLength,_e=R.autoFocus,Te=R.name,Ce=R.onPaste,Re=R.onInput,Fe=Object(re.a)(R,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Ne=this.state,De=Ne.value,ze=Ne.focused,Xe=E()(U,(v={},Object(z.a)(v,ie,!!ie),Object(z.a)(v,"".concat(U,"-disabled"),j),Object(z.a)(v,"".concat(U,"-focused"),ze),v)),me={};Object.keys(Fe).forEach(function(ee){(ee.substr(0,5)==="data-"||ee.substr(0,5)==="aria-"||ee==="role")&&(me[ee]=Fe[ee])});var Ye=!G&&!j,Ke=this.getInputDisplayValue(null),ye=(De||De===0)&&(isNaN(De)||Number(De)>=se),Oe=(De||De===0)&&(isNaN(De)||Number(De)<=xe),te=ye||j||G,$=Oe||j||G,ae=E()("".concat(U,"-handler"),"".concat(U,"-handler-up"),Object(z.a)({},"".concat(U,"-handler-up-disabled"),te)),Y=E()("".concat(U,"-handler"),"".concat(U,"-handler-down"),Object(z.a)({},"".concat(U,"-handler-down-disabled"),$)),Q=B?{onTouchStart:te?d:this.up,onTouchEnd:this.stop}:{onMouseDown:te?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},Z=B?{onTouchStart:$?d:this.down,onTouchEnd:this.stop}:{onMouseDown:$?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return D.a.createElement("div",{className:Xe,style:fe,title:Ee,onMouseEnter:ge,onMouseLeave:ve,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":te,className:ae}),V||D.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-up-inner"),onClick:o})),D.a.createElement("span",Object.assign({unselectable:"on"},Z,{role:"button","aria-label":"Decrease Value","aria-disabled":$,className:Y}),q||D.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-down-inner"),onClick:o}))),D.a.createElement("div",{className:"".concat(U,"-input-wrap")},D.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":xe,"aria-valuemax":se,"aria-valuenow":De,required:be,type:ke,placeholder:Me,onPaste:Ce,onClick:je,onMouseUp:this.onMouseUp,className:"".concat(U,"-input"),tabIndex:Be,autoComplete:N,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Ye?this.onKeyDown:d,onKeyUp:Ye?this.onKeyUp:d,autoFocus:_e,maxLength:He,readOnly:G,disabled:j,max:se,min:xe,step:Ge,name:Te,title:Ee,id:we,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ke),pattern:Ue,inputMode:Ae,onInput:Re},me))))}}]),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=Je.a=f},hLB0:function(it,Je,J){},kSUc:function(it,Je,J){},lZu9:function(it,Je,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 M(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 P in F)F.hasOwnProperty(P)&&L.tokenTypeOverrides[P]&&(F[P]=L.tokenTypeOverrides[P]);var D=/^([*\-_])(?:\s*\1){2,}\s*$/,O=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,E=/^\[(x| )\](?=\s)/i,_=L.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,T=/^ {0,3}(?:\={1,}|-{2,})\s*$/,A=/^[^#!\[\]*_\\<>` "'(~:]+/,w=/^(~~~+|```+)[ \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]/,o=" ";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=s,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,q=S(N.prevLine.stream),ie=N.indentedCode,se=N.prevLine.hr,xe=N.list!==!1,fe=(N.listStack[N.listStack.length-1]||0)+3;N.indentedCode=!1;var Ee=N.indentation;if(N.indentationDiff===null&&(N.indentationDiff=N.indentation,xe)){for(N.list=null;Ee<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=Ee-N.listStack[N.listStack.length-1])}var ge=!q&&!se&&!N.prevLine.header&&(!xe||!ie)&&!N.prevLine.fencedCodeEnd,ve=(N.list===!1||se||q)&&N.indentation<=fe&&B.match(D),le=null;if(N.indentationDiff>=4&&(ie||N.prevLine.fencedCodeEnd||N.prevLine.header||q))return B.skipToEnd(),N.indentedCode=!0,F.code;if(B.eatSpace())return null;if(V&&N.indentation<=fe&&(le=B.match(_))&&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(!ve&&!N.setext&&V&&N.indentation<=fe&&(le=B.match(O))){var ue=le[1]?"ol":"ul";return N.indentation=Ee+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(w,!0)))return N.quote=0,N.fencedEndRE=new RegExp(le[1]+"+ *$"),N.localMode=L.fencedCodeBlockHighlighting&&M(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||(!ge||!xe)&&!N.quote&&N.list===!1&&!N.code&&!ve&&!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(ve)return B.skipToEnd(),N.hr=!0,N.thisLine.hr=!0,F.hr;if(B.peek()==="[")return u(B,N,R)}return u(B,N,N.inline)}function C(B,N){var V=H.token(B,N.htmlState);if(!k){var q=re.innerMode(H,N.htmlState);(q.mode.name=="xml"&&q.state.tagStart===null&&!q.state.context&&q.state.tokenize.isInText||N.md_inside&&B.current().indexOf(">")>-1)&&(N.f=s,N.block=g,N.htmlState=null)}return V}function y(B,N){var V=N.listStack[N.listStack.length-1]||0,q=N.indentation<V,ie=V+3;if(N.fencedEndRE&&N.indentation<=ie&&(q||B.match(N.fencedEndRE))){L.highlightFormatting&&(N.formatting="code-block");var se;return q||(se=f(N)),N.localMode=N.localState=null,N.block=g,N.f=s,N.fencedEndRE=null,N.code=0,N.thisLine.fencedCodeEnd=!0,q?l(B,N,N.block):se}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 q=(B.listStack.length-1)%3;q?q===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 s(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 q=B.match(E,!0)[1]===" ";return q?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 se=ie;ie==="("&&(se=")"),se=(se+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var xe="^\\s*(?:[^"+se+"\\\\]+|\\\\\\\\|\\\\.)"+se;if(B.match(new RegExp(xe),!0))return F.linkHref}if(ie==="`"){var fe=N.formatting;L.highlightFormatting&&(N.formatting="code"),B.eatWhile("`");var Ee=B.current().length;if(N.code==0&&(!N.quote||Ee==1))return N.code=Ee,f(N);if(Ee==N.code){var ge=f(N);return N.code=0,ge}else return N.formatting=fe,f(N)}else if(N.code)return f(N);if(ie==="\\"&&(B.next(),L.highlightFormatting)){var ve=f(N),le=F.formatting+"-escape";return ve?ve+" "+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 ve=f(N);return N.imageAltText=!1,N.image=!1,N.inline=N.f=m,ve}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 ve=f(N);return N.linkText=!1,N.inline=N.f=B.match(/\(.*?\)| ?\[.*?\]/,!1)?m:s,ve}if(ie==="<"&&B.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=a,L.highlightFormatting&&(N.formatting="link");var ve=f(N);return ve?ve+=" ":ve="",ve+F.linkInline}if(ie==="<"&&B.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=a,L.highlightFormatting&&(N.formatting="link");var ve=f(N);return ve?ve+=" ":ve="",ve+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 be=B.string.substring(B.start,ue);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(be)&&(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 je=1,Be=B.pos==1?" ":B.string.charAt(B.pos-2);je<3&&B.eat(ie);)je++;var ke=B.peek()||" ",Me=!/\s/.test(ke)&&(!d.test(ke)||/\s/.test(Be)||d.test(Be)),we=!/\s/.test(Be)&&(!d.test(Be)||/\s/.test(ke)||d.test(ke)),Ae=null,Ue=null;if(je%2&&(!N.em&&Me&&(ie==="*"||!we||d.test(Be))?Ae=!0:N.em==ie&&we&&(ie==="*"||!Me||d.test(ke))&&(Ae=!1)),je>1&&(!N.strong&&Me&&(ie==="*"||!we||d.test(Be))?Ue=!0:N.strong==ie&&we&&(ie==="*"||!Me||d.test(ke))&&(Ue=!1)),Ue!=null||Ae!=null){L.highlightFormatting&&(N.formatting=Ae==null?"strong":Ue==null?"em":"strong em"),Ae===!0&&(N.em=ie),Ue===!0&&(N.strong=ie);var ge=f(N);return Ae===!1&&(N.em=!1),Ue===!1&&(N.strong=!1),ge}}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 ge=f(N);return N.strikethrough=!1,ge}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 Ge=f(N);return N.emoji=!1,Ge}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=s,L.highlightFormatting&&(N.formatting="link");var q=f(N);return q?q+=" ":q="",q+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 q=N.next();if(q===B){V.f=V.inline=s,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 R(B,N){return B.match(/^([^\]\\]|\\.)*\]:/,!1)?(N.f=U,B.next(),L.highlightFormatting&&(N.formatting="link"),N.linkText=!0,f(N)):u(B,N,s)}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=s,F.linkHref+" url")}var G={startState:function(){return{f:g,prevLine:{stream:null},thisLine:{stream:null},block:g,htmlState:null,indentation:0,inline:s,text:c,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(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,o).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(it,Je,J){it.exports={priseBox:"priseBox___wSohZ",iconfont:"iconfont___2Xk32"}},osHv:function(it,Je,J){(function(re){re(J("VrN/"))})(function(re){"use strict";var z=re.Pos;function L(d,o){return d.line-o.line||d.ch-o.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",M=new RegExp("<(/?)(["+H+"]["+k+"]*)","g");function F(d,o,u,l){this.line=o,this.ch=u,this.cm=d,this.text=d.getLine(o),this.min=l?Math.max(l.from,d.firstLine()):d.firstLine(),this.max=l?Math.min(l.to-1,d.lastLine()):d.lastLine()}function P(d,o){var u=d.cm.getTokenTypeAt(z(d.line,o));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 O(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 o=d.text.indexOf(">",d.ch);if(o==-1){if(D(d))continue;return}if(!P(d,o+1)){d.ch=o+1;continue}var u=d.text.lastIndexOf("/",o),l=u>-1&&!/\S/.test(d.text.slice(u+1,o));return d.ch=o+1,l?"selfClose":"regular"}}function _(d){for(;;){var o=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(o==-1){if(O(d))continue;return}if(!P(d,o+1)){d.ch=o;continue}M.lastIndex=o,d.ch=o;var u=M.exec(d.text);if(u&&u.index==o)return u}}function T(d){for(;;){M.lastIndex=d.ch;var o=M.exec(d.text);if(!o){if(D(d))continue;return}if(!P(d,o.index+1)){d.ch=o.index+1;continue}return d.ch=o.index+o[0].length,o}}function A(d){for(;;){var o=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(o==-1){if(O(d))continue;return}if(!P(d,o+1)){d.ch=o;continue}var u=d.text.lastIndexOf("/",o),l=u>-1&&!/\S/.test(d.text.slice(u+1,o));return d.ch=o+1,l?"selfClose":"regular"}}function w(d,o){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&&(!o||o==l[2]))return{tag:l[2],from:z(h,g),to:z(d.line,d.ch)}}else u.push(l[2])}}function b(d,o){for(var u=[];;){var l=A(d);if(!l)return;if(l=="selfClose"){_(d);continue}var S=d.line,h=d.ch,g=_(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&&(!o||o==g[2]))return{tag:g[2],from:z(d.line,d.ch),to:z(S,h)}}}}re.registerHelper("fold","xml",function(d,o){for(var u=new F(d,o.line,0);;){var l=T(u);if(!l||u.line!=o.line)return;var S=E(u);if(!S)return;if(!l[1]&&S!="selfClose"){var h=z(u.line,u.ch),g=w(u,l[2]);return g&&L(g.from,h)>0?{from:h,to:g.from}:null}}}),re.findMatchingTag=function(d,o,u){var l=new F(d,o.line,o.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&&_(l);if(!S||!g||L(l,o)>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:w(l,g[2]),at:"open"})},re.findEnclosingTag=function(d,o,u,l){for(var S=new F(d,o.line,o.ch,u);;){var h=b(S,l);if(!h)break;var g=new F(d,o.line,o.ch,u),C=w(g,h.tag);if(C)return{open:h,close:C}}},re.scanForClosingTag=function(d,o,u,l){var S=new F(d,o.line,o.ch,l?{from:0,to:l}:null);return w(S,u)}})},p5ED:function(it,Je,J){"use strict";var re=J("+L6B"),z=J("2/Rp"),L=J("5Dmo"),H=J("3S7+"),k=J("k1fw"),M=J("tJVT"),F=J("q1tI"),P=J.n(F),D=J("vHTk"),O=J.n(D),E=J("yEEn"),_=J("ZW9T"),T=J("1vsH");Je.a=function(A){var w=A.name,b=A.data,d=A.theme,o=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(M.a)(f,2),s=c[0],a=c[1],m=Object(F.useState)(""),p=Object(M.a)(m,2),v=p[0],R=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(q){var ie=q.split("=");ie[0]==="_educoder_session"&&R(ie[1])})},[]);var j=function(){if(b.startsWith("http")||b.startsWith("/")){G();return}Object(T.x)(u||"educoder",b,u)},G=function(){Object(T.v)(u||w,b)};return console.log("data:",b,"fileanme:",u," name:",w),P.a.createElement("div",{style:Object(k.a)({},h||{}),className:"".concat(y&&O.a.bgBlack," ").concat(o?O.a.wrp:"hide")},g&&P.a.createElement("div",{className:O.a.close,ref:U},P.a.createElement(H.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return U.current}},P.a.createElement("span",{onClick:G},P.a.createElement("i",{className:"icon-quxiaozhiding"}))),P.a.createElement(H.a,{title:"\u5173\u95ED",getPopupContainer:function(){return U.current}},P.a.createElement("span",{className:"",onClick:C},P.a.createElement("i",{className:"icon-guanbi1"})))),P.a.createElement("div",{className:"".concat(O.a[S]," ").concat(S," ").concat(O.a.monaco," ").concat(o==="txt"?"show":"hide")},o==="txt"&&P.a.createElement(_.b,l)),o==="audio"&&P.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}),o==="video"&&P.a.createElement(P.a.Fragment,null,b!=null&&b.startsWith("/")?P.a.createElement("video",{controls:!0,src:"".concat(b),autoPlay:!0}):P.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(b),autoPlay:!0})),o==="pdf"&&P.a.createElement("embed",{className:O.a.embed,src:b}),o==="image"&&P.a.createElement(P.a.Fragment,null,P.a.createElement("img",{src:"".concat(b!=null&&b.startsWith("/")||(b==null?void 0:b.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(b)})),o==="other"&&P.a.createElement("div",null,P.a.createElement(z.a,{type:"primary",size:"large",onClick:j},P.a.createElement(E.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&P.a.createElement(z.a,{type:"primary",size:"large",onClick:j},P.a.createElement(E.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(it,Je,J){},"rAM+":function(it,Je,J){"use strict";J.d(Je,"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 M=0,F=function(){};return{s:F,n:function(){return M>=L.length?{done:!0}:{done:!1,value:L[M++]}},e:function(_){throw _},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 P=!0,D=!1,O;return{s:function(){k=L[Symbol.iterator]()},n:function(){var _=k.next();return P=_.done,_},e:function(_){D=!0,O=_},f:function(){try{!P&&k.return!=null&&k.return()}finally{if(D)throw O}}}}},rUJ1:function(it,Je){const J=/[&<>"']/,re=/[&<>"']/g,z=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,H={"&":"&","<":"<",">":">",'"':""","'":"'"},k=y=>H[y];function M(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 P(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 O(y,f){y=y.source||y,f=f||"";const c={replace:(s,a)=>(a=a.source||a,a=a.replace(D,"$1"),y=y.replace(s,a),c),getRegex:()=>new RegExp(y,f)};return c}const E=/[^\w:]/g,_=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function T(y,f,c){if(y){let s;try{s=decodeURIComponent(P(c)).replace(E,"").toLowerCase()}catch(a){return null}if(s.indexOf("javascript:")===0||s.indexOf("vbscript:")===0||s.indexOf("data:")===0)return null}f&&!_.test(c)&&(c=o(f,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(s){return null}return c}const A={},w=/^[^:]+:\/*[^/]*$/,b=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(y,f){A[" "+y]||(w.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,s;for(;f<arguments.length;f++){c=arguments[f];for(s in c)Object.prototype.hasOwnProperty.call(c,s)&&(y[s]=c[s])}return y}function S(y,f){const c=y.replace(/\|/g,(m,p,v)=>{let R=!1,U=p;for(;--U>=0&&v[U]==="\\";)R=!R;return R?"|":" |"}),s=c.split(/ \|/);let a=0;if(s.length>f)s.splice(f);else for(;s.length<f;)s.push("");for(;a<s.length;a++)s[a]=s[a].trim().replace(/\\\|/g,"|");return s}function h(y,f,c){const s=y.length;if(s===0)return"";let a=0;for(;a<s;){const m=y.charAt(s-a-1);if(m===f&&!c)a++;else if(m!==f&&c)a++;else break}return y.substr(0,s-a)}function g(y,f){if(y.indexOf(f[1])===-1)return-1;const c=y.length;let s=0,a=0;for(;a<c;a++)if(y[a]==="\\")a++;else if(y[a]===f[0])s++;else if(y[a]===f[1]&&(s--,s<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")}it.exports={escape:M,unescape:P,edit:O,cleanUrl:T,resolveUrl:o,noopTest:u,merge:l,splitCells:S,rtrim:h,findClosingBracket:g,checkSanitizeDeprecation:C}},sNeV:function(it,Je,J){"use strict";var re=J("qVdP"),z=J("jsC+"),L=J("lUTK"),H=J("BvKs"),k=J("2qtc"),M=J("kLXV"),F=J("/xke"),P=J("TeRw"),D=J("q1tI"),O=J.n(D),E=J("55Ip"),_=J("h+Ho"),T=J("SJ7D"),A=J.n(T);Je.a=function(w){var b=w.id,d=w.permission,o=w.calbackFunc;function u(y){var f=y?0:1,c={id:b,sticky:f};Object(_.c)(c).then(function(s){s&&(P.a.open({message:"\u63D0\u793A",description:s.message}),o&&o())})}function l(y){var f=y?0:1,c={id:b,is_fine:f};Object(_.b)(c).then(function(s){s&&(P.a.open({message:"\u63D0\u793A",description:s.message}),o&&o())})}function S(y){var f=y?0:1,c={id:b,is_watch:f};Object(_.e)(c).then(function(s){s&&(P.a.open({message:"\u63D0\u793A",description:s.message}),o&&o())})}function h(){M.a.confirm({content:"\u786E\u8BA4\u5220\u9664\u5E16\u5B50?",onOk:function(){Object(_.h)(b).then(function(f){f.status!==-1&&(P.a.open({message:"\u63D0\u793A",description:f.message}),o&&o(),window.location.href="/forums")})}})}function g(y){var f=y?0:1,c={id:b,is_apply:f};M.a.confirm({content:"\u786E\u8BA4\u7533\u8BF7\u5220\u5E16?",onOk:function(){Object(_.f)(c).then(function(a){a&&(P.a.open({message:"\u63D0\u793A",description:a.message}),o&&o())})}})}var C=d&&O.a.createElement(H.a,{style:{minWidth:"100px",textAlign:"center"}},d.banned_permission&&O.a.createElement(H.a.Item,{onClick:function(){return u(d.sticky)}},d.sticky?"\u53D6\u6D88\u7F6E\u9876":"\u7F6E\u9876"),d.banned_permission&&O.a.createElement(H.a.Item,{onClick:function(){return l(d.is_fine)}},d.is_fine?"\u53D6\u6D88\u63A8\u8350":"\u63A8\u8350"),d.login&&O.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)&&O.a.createElement(H.a.Item,null,O.a.createElement(E.a,{to:"/forums/".concat(b,"/edit")},"\u7F16\u8F91")),d.admin?O.a.createElement(H.a.Item,{onClick:function(){return h()}},"\u5220\u9664"):d.is_currentUser?O.a.createElement(H.a.Item,{onClick:function(){return g(d.is_deleted)}},d.is_deleted?"\u64A4\u9500\u7533\u8BF7":"\u7533\u8BF7\u5220\u5E16"):"");return O.a.createElement(z.a,{overlay:C,align:"center",placement:"bottomCenter"},O.a.createElement("i",{className:"gengduo icon-gengduo1"}))}},ulZh:function(it,Je,J){typeof window!="undefined"&&function(z,L){it.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,M){L.o(H,k)||Object.defineProperty(H,k,{enumerable:!0,get:M})},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 M=Object.create(null);if(L.r(M),Object.defineProperty(M,"default",{enumerable:!0,value:H}),k&2&&typeof H!="string")for(var F in H)L.d(M,F,function(P){return H[P]}.bind(null,F));return M},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 M(){}Object.create&&(M.prototype=Object.create(null),new M().__proto__||(k=!1));function F(E,_,T){this.fn=E,this.context=_,this.once=T||!1}function P(E,_,T,A,w){if(typeof T!="function")throw new TypeError("The listener must be a function");var b=new F(T,A||E,w),d=k?k+_:_;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,_){--E._eventsCount===0?E._events=new M:delete E._events[_]}function O(){this._events=new M,this._eventsCount=0}O.prototype.eventNames=function(){var _=[],T,A;if(this._eventsCount===0)return _;for(A in T=this._events)H.call(T,A)&&_.push(k?A.slice(1):A);return Object.getOwnPropertySymbols?_.concat(Object.getOwnPropertySymbols(T)):_},O.prototype.listeners=function(_){var T=k?k+_:_,A=this._events[T];if(!A)return[];if(A.fn)return[A.fn];for(var w=0,b=A.length,d=new Array(b);w<b;w++)d[w]=A[w].fn;return d},O.prototype.listenerCount=function(_){var T=k?k+_:_,A=this._events[T];return A?A.fn?1:A.length:0},O.prototype.emit=function(_,T,A,w,b,d){var o=k?k+_:_;if(!this._events[o])return!1;var u=this._events[o],l=arguments.length,S,h;if(u.fn){u.once&&this.removeListener(_,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,w),!0;case 5:return u.fn.call(u.context,T,A,w,b),!0;case 6:return u.fn.call(u.context,T,A,w,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(_,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,w);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},O.prototype.on=function(_,T,A){return P(this,_,T,A,!1)},O.prototype.once=function(_,T,A){return P(this,_,T,A,!0)},O.prototype.removeListener=function(_,T,A,w){var b=k?k+_:_;if(!this._events[b])return this;if(!T)return D(this,b),this;var d=this._events[b];if(d.fn)d.fn===T&&(!w||d.once)&&(!A||d.context===A)&&D(this,b);else{for(var o=0,u=[],l=d.length;o<l;o++)(d[o].fn!==T||w&&!d[o].once||A&&d[o].context!==A)&&u.push(d[o]);u.length?this._events[b]=u.length===1?u[0]:u:D(this,b)}return this},O.prototype.removeAllListeners=function(_){var T;return _?(T=k?k+_:_,this._events[T]&&D(this,T)):(this._events=new M,this._eventsCount=0),this},O.prototype.off=O.prototype.removeListener,O.prototype.addListener=O.prototype.on,O.prefixed=k,O.EventEmitter=O,re.exports=O},"./node_modules/url-toolkit/src/url-toolkit.js":function(re,z,L){(function(H){var k=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,M=/^([^\/?#]*)([^]*)$/,F=/(?:\/|^)\.(?=\/)/g,P=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,D={buildAbsoluteURL:function(O,E,_){if(_=_||{},O=O.trim(),E=E.trim(),!E){if(!_.alwaysNormalize)return O;var T=D.parseURL(O);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 _.alwaysNormalize?(A.path=D.normalizePath(A.path),D.buildURLFromParts(A)):E;var w=D.parseURL(O);if(!w)throw new Error("Error trying to parse base URL.");if(!w.netLoc&&w.path&&w.path[0]!=="/"){var b=M.exec(w.path);w.netLoc=b[1],w.path=b[2]}w.netLoc&&!w.path&&(w.path="/");var d={scheme:w.scheme,netLoc:A.netLoc,path:null,params:A.params,query:A.query,fragment:A.fragment};if(!A.netLoc&&(d.netLoc=w.netLoc,A.path[0]!=="/"))if(!A.path)d.path=w.path,A.params||(d.params=w.params,A.query||(d.query=w.query));else{var o=w.path,u=o.substring(0,o.lastIndexOf("/")+1)+A.path;d.path=D.normalizePath(u)}return d.path===null&&(d.path=_.alwaysNormalize?D.normalizePath(A.path):A.path),D.buildURLFromParts(d)},parseURL:function(O){var E=k.exec(O);return E?{scheme:E[1]||"",netLoc:E[2]||"",path:E[3]||"",params:E[4]||"",query:E[5]||"",fragment:E[6]||""}:null},normalizePath:function(O){for(O=O.split("").reverse().join("").replace(F,"");O.length!==(O=O.replace(P,"")).length;);return O.split("").reverse().join("")},buildURLFromParts:function(O){return O.scheme+O.netLoc+O.path+O.params+O.query+O.fragment}};re.exports=D})(this)},"./node_modules/webworkify-webpack/index.js":function(re,z,L){function H(_){var T={};function A(b){if(T[b])return T[b].exports;var d=T[b]={i:b,l:!1,exports:{}};return _[b].call(d.exports,d,d.exports,A),d.l=!0,d.exports}A.m=_,A.c=T,A.i=function(b){return b},A.d=function(b,d,o){A.o(b,d)||Object.defineProperty(b,d,{configurable:!1,enumerable:!0,get:o})},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 w=A(A.s=ENTRY_MODULE);return w.default||w}var k="[\\.|\\-|\\+|\\w|/|@]+",M="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+k+").*?\\)";function F(_){return(_+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function P(_){return!isNaN(1*_)}function D(_,T,A){var w={};w[A]=[];var b=T.toString(),d=b.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return w;for(var o=d[1],u=new RegExp("(\\\\n|\\W)"+F(o)+M,"g"),l;l=u.exec(b);){if(l[3]==="dll-reference")continue;w[A].push(l[3])}for(u=new RegExp("\\("+F(o)+'\\("(dll-reference\\s('+k+'))"\\)\\)'+M,"g");l=u.exec(b);)_[l[2]]||(w[A].push(l[1]),_[l[2]]=L(l[1]).m),w[l[2]]=w[l[2]]||[],w[l[2]].push(l[4]);for(var S=Object.keys(w),h=0;h<S.length;h++)for(var g=0;g<w[S[h]].length;g++)P(w[S[h]][g])&&(w[S[h]][g]=1*w[S[h]][g]);return w}function O(_){var T=Object.keys(_);return T.reduce(function(A,w){return A||_[w].length>0},!1)}function E(_,T){for(var A={main:[T]},w={main:[]},b={main:{}};O(A);)for(var d=Object.keys(A),o=0;o<d.length;o++){var u=d[o],l=A[u],S=l.pop();if(b[u]=b[u]||{},b[u][S]||!_[u][S])continue;b[u][S]=!0,w[u]=w[u]||[],w[u].push(S);for(var h=D(_,_[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 w}re.exports=function(_,T){T=T||{};var A={main:L.m},w=T.all?{main:Object.keys(A.main)}:E(A,_),b="";Object.keys(w).filter(function(S){return S!=="main"}).forEach(function(S){for(var h=0;w[S][h];)h++;w[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))+")({"+w[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 o=window.URL||window.webkitURL||window.mozURL||window.msURL,u=o.createObjectURL(d),l=new window.Worker(u);return l.objectURL=u,l}},"./src/config.ts":function(re,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"),M=L("./src/controller/audio-track-controller.ts"),F=L("./src/controller/subtitle-stream-controller.ts"),P=L("./src/controller/subtitle-track-controller.ts"),D=L("./src/controller/buffer-controller.ts"),O=L("./src/controller/timeline-controller.ts"),E=L("./src/controller/cap-level-controller.ts"),_=L("./src/controller/fps-controller.ts"),T=L("./src/controller/eme-controller.ts"),A=L("./src/controller/cmcd-controller.ts"),w=L("./src/utils/xhr-loader.ts"),b=L("./src/utils/fetch-loader.ts"),d=L("./src/utils/cues.ts"),o=L("./src/utils/mediakeys-helper.ts"),u=L("./src/utils/logger.ts");function l(){return l=Object.assign||function(s){for(var a=1;a<arguments.length;a++){var m=arguments[a];for(var p in m)Object.prototype.hasOwnProperty.call(m,p)&&(s[p]=m[p])}return s},l.apply(this,arguments)}function S(s,a){var m=Object.keys(s);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(s);a&&(p=p.filter(function(v){return Object.getOwnPropertyDescriptor(s,v).enumerable})),m.push.apply(m,p)}return m}function h(s){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(s,p,m[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(m)):S(Object(m)).forEach(function(p){Object.defineProperty(s,p,Object.getOwnPropertyDescriptor(m,p))})}return s}function g(s,a,m){return a in s?Object.defineProperty(s,a,{value:m,enumerable:!0,configurable:!0,writable:!0}):s[a]=m,s}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:w.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:_.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},y()),{},{subtitleStreamController:F.SubtitleStreamController,subtitleTrackController:P.default,timelineController:O.TimelineController,audioStreamController:k.default,audioTrackController:M.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(s,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return l({},s,a)}function c(s){var a=s.loader;if(a!==b.default&&a!==w.default)u.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1;else{var m=Object(b.fetchSupported)();m&&(s.loader=b.default,s.progressive=!0,s.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"),M=L("./src/events.ts"),F=L("./src/utils/buffer-helper.ts"),P=L("./src/errors.ts"),D=L("./src/types/loader.ts"),O=L("./src/utils/logger.ts");function E(A,w){for(var b=0;b<w.length;b++){var d=w[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(A,d.key,d)}}function _(A,w,b){return w&&E(A.prototype,w),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 w=A.prototype;return w.registerListeners=function(){var d=this.hls;d.on(M.Events.FRAG_LOADING,this.onFragLoading,this),d.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(M.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var d=this.hls;d.off(M.Events.FRAG_LOADING,this.onFragLoading,this),d.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(M.Events.ERROR,this.onError,this)},w.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},w.onFragLoading=function(d,o){var u=o.frag;if(u.type===D.PlaylistLevelType.MAIN&&!this.timer){var l;this.fragCurrent=u,this.partCurrent=(l=o.part)!=null?l:null,this.timer=self.setInterval(this.onCheck,100)}},w.onLevelLoaded=function(d,o){var u=this.hls.config;o.details.live?this.bwEstimator.update(u.abrEwmaSlowLive,u.abrEwmaFastLive):this.bwEstimator.update(u.abrEwmaSlowVoD,u.abrEwmaFastVoD)},w._abandonRulesCheck=function(){var d=this.fragCurrent,o=this.partCurrent,u=this.hls,l=u.autoLevelEnabled,S=u.config,h=u.media;if(!d||!h)return;var g=o?o.stats:d.stats,C=o?o.duration:d.duration;if(g.aborted){O.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,s=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,R=h.currentTime,U=(F.BufferHelper.bufferInfo(h,R,S.maxBufferHole).end-R)/f;if(U>=2*C/f||v<=U)return;var j=Number.POSITIVE_INFINITY,G;for(G=d.level-1;G>s;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();O.logger.warn("Fragment "+d.sn+(o?" part "+o.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+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(M.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:o,stats:g})},w.onFragLoaded=function(d,o){var u=o.frag,l=o.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(M.Events.FRAG_BUFFERED,f),u.bitrateTest=!1}}},w.onFragBuffered=function(d,o){var u=o.frag,l=o.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},w.onError=function(d,o){switch(o.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},w.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},w.getNextABRAutoLevel=function(){var d=this.fragCurrent,o=this.partCurrent,u=this.hls,l=u.maxAutoLevel,S=u.config,h=u.minAutoLevel,g=u.media,C=o?o.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,s=(F.BufferHelper.bufferInfo(g,y,S.maxBufferHole).end-y)/f,a=this.findBestLevel(c,h,l,s,S.abrBandWidthFactor,S.abrBandWidthUpFactor);if(a>=0)return a;O.logger.trace((s?"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(!s){var R=this.bitrateTestDelay;if(R){var U=C?Math.min(C,S.maxLoadingDelay):S.maxLoadingDelay;m=U-R,O.logger.trace("bitrate test took "+Math.round(1e3*R)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*m)+" ms"),p=v=1}}return a=this.findBestLevel(c,h,l,s+m,p,v),Math.max(a,0)},w.findBestLevel=function(d,o,u,l,S,h){for(var g,C=this.fragCurrent,y=this.partCurrent,f=this.lastLoadedFragLevel,c=this.hls.levels,s=c[f],a=!!(s!=null&&(g=s.details)!==null&&g!==void 0&&g.live),m=s==null?void 0:s.codecSet,p=y?y.duration:C?C.duration:0,v=u;v>=o;v--){var R=c[v];if(!R||m&&R.codecSet!==m)continue;var U=R.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(O.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},_(A,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,o=this.bwEstimator;if(d!==-1&&(!o||!o.canEstimate()))return d;var u=this.getNextABRAutoLevel();return d!==-1&&(u=Math.min(d,u)),u},set:function(d){this._nextAutoLevel=d}}]),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"),M=L("./src/events.ts"),F=L("./src/utils/buffer-helper.ts"),P=L("./src/controller/fragment-tracker.ts"),D=L("./src/types/level.ts"),O=L("./src/types/loader.ts"),E=L("./src/loader/fragment.ts"),_=L("./src/demux/chunk-cache.ts"),T=L("./src/demux/transmuxer-interface.ts"),A=L("./src/types/transmuxer.ts"),w=L("./src/controller/fragment-finders.ts"),b=L("./src/utils/discontinuities.ts"),d=L("./src/errors.ts"),o=L("./src/utils/logger.ts");function u(){return u=Object.assign||function(C){for(var 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,s){return c.__proto__=s,c},S(C,y)}var h=100,g=function(C){l(y,C);function y(c,s){var a;return a=C.call(this,c,s,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var f=y.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var s=this.hls;s.on(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.on(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.on(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.on(M.Events.ERROR,this.onError,this),s.on(M.Events.BUFFER_RESET,this.onBufferReset,this),s.on(M.Events.BUFFER_CREATED,this.onBufferCreated,this),s.on(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f._unregisterListeners=function(){var s=this.hls;s.off(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.off(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.off(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.off(M.Events.ERROR,this.onError,this),s.off(M.Events.BUFFER_RESET,this.onBufferReset,this),s.off(M.Events.BUFFER_CREATED,this.onBufferCreated,this),s.off(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f.onInitPtsFound=function(s,a){var m=a.frag,p=a.id,v=a.initPTS;if(p==="main"){var R=m.cc;this.initPTS[m.cc]=v,this.log("InitPTS for cc: "+R+" found from main: "+v),this.videoTrackCC=R,this.state===k.State.WAITING_INIT_PTS&&this.tick()}},f.startLoad=function(s){if(!this.levels){this.startPosition=s,this.state=k.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(h),this.fragLoadError=0,a>0&&s===-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=s,this.tick()},f.doTick=function(){switch(this.state){case k.State.IDLE:this.doTickIdle();break;case k.State.WAITING_TRACK:{var s,a=this.levels,m=this.trackId,p=a==null||((s=a[m])===null||s===void 0)?void 0:s.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,R=performance.now(),U=this.retryDate;(!U||R>=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 q=N.flush(),ie={frag:G,part:B,payload:q,networkDetails:null};this._handleFragmentLoadProgress(ie),V&&C.prototype._handleFragmentLoadComplete.call(this,ie)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+G.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var se=this.getLoadPosition(),xe=F.BufferHelper.bufferInfo(this.mediaBuffer,se,this.config.maxBufferHole),fe=Object(w.fragmentWithinToleranceTest)(xe.end,this.config.maxFragLookUpTolerance,G);fe<0&&(o.logger.log("Waiting fragment cc ("+G.cc+") @ "+G.start+" cancelled because another fragment at "+xe.end+" is needed"),this.clearWaitingFragment())}}else this.state=k.State.IDLE}}this.onTickEnd()},f.clearWaitingFragment=function(){var s=this.waitingData;s&&(this.fragmentTracker.removeFragment(s.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=k.State.IDLE)},f.onTickEnd=function(){var s=this.media;if(!s||!s.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:s,m=a.buffered;!this.loadedmetadata&&m.length&&(this.loadedmetadata=!0),this.lastCurrentTime=s.currentTime},f.doTickIdle=function(){var s,a,m=this.hls,p=this.levels,v=this.media,R=this.trackId,U=m.config;if(!p||!p[R])return;if(!v&&(this.startFragRequested||!U.startFragPrefetch))return;var j=p[R],G=j.details;if(!G||G.live&&this.levelLastLoaded!==R||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,O.PlaylistLevelType.AUDIO));var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,O.PlaylistLevelType.AUDIO);if(B===null)return;var N=B.len,V=this.getMaxBufferLength(),q=this.audioSwitch;if(N>=V&&!q)return;if(!q&&this._streamEnded(B,G)){m.trigger(M.Events.BUFFER_EOS,{type:"audio"}),this.state=k.State.ENDED;return}var ie=G.fragments,se=ie[0].start,xe=B.end;if(q){var fe=this.getLoadPosition();xe=fe,G.PTSKnown&&fe<se&&((B.end>se||B.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),v.currentTime=se+.05))}var Ee=this.getNextFragment(xe,G);if(!Ee){this.bufferFlushed=!0;return}((s=Ee.decryptdata)===null||s===void 0?void 0:s.keyFormat)==="identity"&&!((a=Ee.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Ee,G):this.loadFragment(Ee,G,xe)},f.getMaxBufferLength=function(){var s=C.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,O.PlaylistLevelType.MAIN);return a===null?s:Math.max(s,a.len)},f.onMediaDetaching=function(){this.videoBuffer=null,C.prototype.onMediaDetaching.call(this)},f.onAudioTracksUpdated=function(s,a){var m=a.audioTracks;this.resetTransmuxer(),this.levels=m.map(function(p){return new D.Level(p)})},f.onAudioTrackSwitching=function(s,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(s,a){this.mainDetails=a.details},f.onAudioTrackLoaded=function(s,a){var m,p=this.levels,v=a.details,R=a.id;if(!p){this.warn("Audio tracks were reset while loading level "+R);return}this.log("Track "+R+" loaded ["+v.startSN+","+v.endSN+"],duration:"+v.totalduration);var U=p[R],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=R,!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(s){var a,m=s.frag,p=s.part,v=s.payload,R=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=R.defaultAudioCodec||G.audioCodec||"mp4a.40.2",V=this.transmuxer;V||(V=this.transmuxer=new T.default(this.hls,O.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var q=this.initPTS[m.cc],ie=(a=m.initSegment)===null||a===void 0?void 0:a.data;if(q!==void 0){var se=!1,xe=p?p.index:-1,fe=xe!==-1,Ee=new A.ChunkMetadata(m.level,m.sn,m.stats.chunkCount,v.byteLength,xe,fe);V.push(v,ie,N,"",m,p,B.totalduration,se,Ee,q)}else{o.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 ge=this.waitingData=this.waitingData||{frag:m,part:p,cache:new _.default,complete:!1},ve=ge.cache;ve.push(new Uint8Array(v)),this.waitingVideoCC=this.videoTrackCC,this.state=k.State.WAITING_INIT_PTS}},f._handleFragmentLoadComplete=function(s){if(this.waitingData){this.waitingData.complete=!0;return}C.prototype._handleFragmentLoadComplete.call(this,s)},f.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},f.onBufferCreated=function(s,a){var m=a.tracks.audio;m&&(this.mediaBuffer=m.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},f.onFragBuffered=function(s,a){var m=a.frag,p=a.part;if(m.type!==O.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(M.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(m,p)},f.onError=function(s,a){switch(a.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(O.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,O.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(s,a){var m=a.type;m===E.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},f._handleTransmuxComplete=function(s){var a,m="audio",p=this.hls,v=s.remuxResult,R=s.chunkMeta,U=this.getCurrentContext(R);if(!U){this.warn("The loading context changed while buffering fragment "+R.sn+" of level "+R.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(R.level);return}var j=U.frag,G=U.part,B=v.audio,N=v.text,V=v.id3,q=v.initSegment;if(this.fragContextChanged(j))return;if(this.state=k.State.PARSING,this.audioSwitch&&B&&this.completeAudioSwitch(),q!=null&&q.tracks&&(this._bufferInitSegment(q.tracks,j,R),p.trigger(M.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:m,tracks:q.tracks})),B){var ie=B.startPTS,se=B.endPTS,xe=B.startDTS,fe=B.endDTS;G&&(G.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:ie,endPTS:se,startDTS:xe,endDTS:fe}),j.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,ie,se,xe,fe),this.bufferFragmentData(B,j,G,R)}if(V!=null&&(a=V.samples)!==null&&a!==void 0&&a.length){var Ee=u({frag:j,id:m},V);p.trigger(M.Events.FRAG_PARSING_METADATA,Ee)}if(N){var ge=u({frag:j,id:m},N);p.trigger(M.Events.FRAG_PARSING_USERDATA,ge)}},f._bufferInitSegment=function(s,a,m){if(this.state!==k.State.PARSING)return;s.video&&delete s.video;var p=s.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(M.Events.BUFFER_CODECS,s);var v=p.initSegment;if(v!=null&&v.byteLength){var R={type:"audio",frag:a,part:null,chunkMeta:m,parent:a.type,data:v};this.hls.trigger(M.Events.BUFFER_APPENDING,R)}this.tick()},f.loadFragment=function(s,a,m){var p=this.fragmentTracker.getState(s);this.fragCurrent=s,(this.audioSwitch||p===P.FragmentState.NOT_LOADED||p===P.FragmentState.PARTIAL)&&(s.sn==="initSegment"?this._loadInitSegment(s):a.live&&!Object(H.isFiniteNumber)(this.initPTS[s.cc])?(this.log("Waiting for video PTS in continuity counter "+s.cc+" of live stream before loading audio fragment "+s.sn+" of level "+this.trackId),this.state=k.State.WAITING_INIT_PTS):(this.startFragRequested=!0,C.prototype.loadFragment.call(this,s,a,m)))},f.completeAudioSwitch=function(){var s=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,s.trigger(M.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"),M=L("./src/controller/base-playlist-controller.ts"),F=L("./src/types/loader.ts");function P(T,A){for(var w=0;w<A.length;w++){var b=A[w];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(T,b.key,b)}}function D(T,A,w){return A&&P(T.prototype,A),w&&P(T,w),T}function O(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 _=function(T){O(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 w=A.prototype;return w.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)},w.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)},w.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,T.prototype.destroy.call(this)},w.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},w.onManifestParsed=function(d,o){this.tracks=o.audioTracks||[]},w.onAudioTrackLoaded=function(d,o){var u=o.id,l=o.details,S=this.tracksInGroup[u];if(!S){this.warn("Invalid audio track id "+u);return}var h=S.details;S.details=o.details,this.log("audioTrack "+u+" loaded ["+l.startSN+"-"+l.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,o,h))},w.onLevelLoading=function(d,o){this.switchLevel(o.level)},w.onLevelSwitching=function(d,o){this.switchLevel(o.level)},w.switchLevel=function(d){var o=this.hls.levels[d];if(!(o!=null&&o.audioGroupIds))return;var u=o.audioGroupIds[o.urlId];if(this.groupId!==u){this.groupId=u;var l=this.tracks.filter(function(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()}},w.onError=function(d,o){if(T.prototype.onError.call(this,d,o),o.fatal||!o.context)return;o.context.type===F.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},w.setAudioTrack=function(d){var o=this.tracksInGroup;if(d<0||d>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var u=o[this.trackId];this.log("Now switching to audio-track index "+d);var l=o[d],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)},w.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,u=this.findTrackId(o)||this.findTrackId();u!==-1?this.setAudioTrack(u):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},w.findTrackId=function(d){for(var o=this.tracksInGroup,u=0;u<o.length;u++){var l=o[u];if((!this.selectDefaultTrack||l.default)&&(!d||d===l.name))return l.id}return-1},w.loadPlaylist=function(d){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var u=o.id,l=o.groupId,S=o.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}(M.default);z.default=_},"./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"),M=L("./src/controller/level-helper.ts"),F=L("./src/utils/logger.ts"),P=L("./src/errors.ts"),D=function(){function O(_,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=_}var E=O.prototype;return E.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},E.onError=function(T,A){A.fatal&&A.type===P.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 w=A==null?void 0:A.renditionReports;if(w)for(var b=0;b<w.length;b++){var d=w[b],o=""+d.URI;if(o===T.substr(-o.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,w){var b=this,d=A.details,o=A.stats,u=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(d.advancedDateTime=Date.now()-u,d.live||w!=null&&w.live){if(d.reloaded(w),w&&this.log("live playlist "+T+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),w&&d.fragments.length>0&&Object(M.mergeDetails)(w,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,s=C===y,a=g?0:f;c?(S=s?y+1:C,h=s?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(w&&v>w.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+w.tuneInGoal+" to: "+v+" with playlist age: "+d.age),v=0;else{var R=Math.floor(v/d.targetduration);if(S+=R,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 "+R+" to part "+h)}d.tuneInGoal=v}if(l=this.getDeliveryDirectives(d,A.deliveryDirectives,S,h),g||!s){this.loadPlaylist(l);return}}else l=this.getDeliveryDirectives(d,A.deliveryDirectives,S,h);var j=Object(M.computeReloadInterval)(d,o);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,w,b){var d=Object(k.getSkipValue)(T,w);return A!=null&&A.skip&&T.deltaUpdateFailed&&(w=A.msn,b=A.part,d=k.HlsSkip.No),new k.HlsUrlParameters(w,b,d)},E.retryLoadingOrFail=function(T){var A=this,w=this.hls.config,b=this.retryCount<w.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 o=Math.min(Math.pow(2,this.retryCount)*w.levelLoadingRetryDelay,w.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return A.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+T.details+'"')}}else this.warn('cannot recover from error "'+T.details+'"'),this.clearTimer(),T.fatal=!0;return b},O}()},"./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"),M=L("./src/controller/fragment-tracker.ts"),F=L("./src/utils/buffer-helper.ts"),P=L("./src/utils/logger.ts"),D=L("./src/events.ts"),O=L("./src/errors.ts"),E=L("./src/types/transmuxer.ts"),_=L("./src/utils/mp4-tools.ts"),T=L("./src/utils/discontinuities.ts"),A=L("./src/controller/fragment-finders.ts"),w=L("./src/controller/level-helper.ts"),b=L("./src/loader/fragment-loader.ts"),d=L("./src/crypt/decrypter.ts"),o=L("./src/utils/time-ranges.ts"),u=L("./src/types/loader.ts");function l(c,s){for(var a=0;a<s.length;a++){var m=s[a];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(c,m.key,m)}}function S(c,s,a){return s&&l(c.prototype,s),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,s){c.prototype=Object.create(s.prototype),c.prototype.constructor=c,C(c,s)}function C(c,s){return C=Object.setPrototypeOf||function(m,p){return m.__proto__=p,m},C(c,s)}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(s,c);function s(m,p,v){var R;return R=c.call(this)||this,R.hls=void 0,R.fragPrevious=null,R.fragCurrent=null,R.fragmentTracker=void 0,R.transmuxer=null,R._state=y.STOPPED,R.media=void 0,R.mediaBuffer=void 0,R.config=void 0,R.bitrateTest=!1,R.lastCurrentTime=0,R.nextLoadPosition=0,R.startPosition=0,R.loadedmetadata=!1,R.fragLoadError=0,R.retryDate=0,R.levels=null,R.fragmentLoader=void 0,R.levelLastLoaded=null,R.startFragRequested=!1,R.decrypter=void 0,R.initPTS=[],R.onvseeking=null,R.onvended=null,R.logPrefix="",R.log=void 0,R.warn=void 0,R.logPrefix=v,R.log=P.logger.log.bind(P.logger,v+":"),R.warn=P.logger.warn.bind(P.logger,v+":"),R.hls=m,R.fragmentLoader=new b.default(m.config),R.fragmentTracker=p,R.config=m.config,R.decrypter=new d.default(m,m.config),m.on(D.Events.KEY_LOADED,R.onKeyLoaded,h(R)),R}var a=s.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 R=this.fragCurrent,U=this.fragmentTracker;if(!v.live&&R&&R.sn===v.endSN&&!p.nextStart){var j=U.getState(R);return j===M.FragmentState.PARTIAL||j===M.FragmentState.OK}return!1},a.onMediaAttached=function(p,v){var R=this.media=this.mediaBuffer=v.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),R.addEventListener("seeking",this.onvseeking),R.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,R=this.media,U=this.mediaBuffer,j=this.state,G=R?R.currentTime:0,B=F.BufferHelper.bufferInfo(U||R,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,q=v.start+v.duration+N,ie=G>q;(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())}R&&(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 R=this.levels[v.frag.level].details;R&&this.loadFragment(v.frag,R,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,R){this._loadFragForPlayback(p,v,R)},a._loadFragForPlayback=function(p,v,R){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,R,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,R){if(R===void 0&&(R=null),!(p-v))return;var U={startOffset:p,endOffset:v,type:R};this.fragLoadError=0,this.hls.trigger(D.Events.BUFFER_FLUSHING,U)},a._loadInitSegment=function(p){var v=this;this._doFragLoad(p).then(function(R){if(!R||v.fragContextChanged(p)||!v.levels)throw new Error("init load aborted");return R}).then(function(R){var U=v.hls,j=R.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}}),R.payload=N,R})}return R}).then(function(R){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(R.payload),N.parsing.start=N.buffering.start=self.performance.now(),N.parsing.end=N.buffering.end=self.performance.now(),R.frag===U&&j.trigger(D.Events.FRAG_BUFFERED,{stats:N,frag:U,part:null,id:p.type}),v.tick()}).catch(function(R){v.warn(R),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 R=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+" "+o.default.toString(F.BufferHelper.getBuffered(R))),this.state=y.IDLE,this.tick()},a._handleFragmentLoadComplete=function(p){var v=this.transmuxer;if(!v)return;var R=p.frag,U=p.part,j=p.partsLoaded,G=!j||j.length===0||j.some(function(N){return!N}),B=new E.ChunkMetadata(R.level,R.sn,R.stats.chunkCount+1,0,U?U.index:-1,!G);v.flush(B)},a._handleFragmentLoadProgress=function(p){},a._doFragLoad=function(p,v,R,U){var j=this;if(R===void 0&&(R=null),!this.levels)throw new Error("frag load aborted, missing levels");if(R=Math.max(p.start,R||0),this.config.lowLatencyMode&&v){var G=v.partList;if(G&&U){R>p.end&&v.fragmentHint&&(p=v.fragmentHint);var B=this.getNextPart(G,p,R);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(R.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:R}),this.doFragPartsLoad(p,G,B,U).catch(function(V){return j.handleFragLoadError(V)})}else if(!p.url||this.loadedEndOfParts(G,R))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(R.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:R}),this.fragmentLoader.load(p,U).catch(function(V){return j.handleFragLoadError(V)})},a.doFragPartsLoad=function(p,v,R,U){var j=this;return new Promise(function(G,B){var N=[],V=function q(ie){var se=v[ie];j.fragmentLoader.loadPart(p,se,U).then(function(xe){N[se.index]=xe;var fe=xe.part;j.hls.trigger(D.Events.FRAG_LOADED,xe);var Ee=v[ie+1];if(Ee&&Ee.fragment===p)q(ie+1);else return G({frag:p,part:fe,partsLoaded:N})}).catch(B)};V(R)})},a.handleFragLoadError=function(p){var v=p.data;return v&&v.details===O.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 R=v.frag,U=v.part,j=v.level,G=self.performance.now();R.stats.parsing.end=G,U&&(U.stats.parsing.end=G),this.updateLevelTiming(R,U,j,p.partial)},a.getCurrentContext=function(p){var v=this.levels,R=p.level,U=p.sn,j=p.part;if(!v||!v[R])return this.warn("Levels object was unset while buffering fragment "+U+" of level "+R+". The current chunk will not be buffered."),null;var G=v[R],B=j>-1?Object(w.getPartWith)(G,U,j):null,N=B?B.fragment:Object(w.getFragmentWithSN)(G,U,this.fragCurrent);return N?{frag:N,part:B,level:G}:null},a.bufferFragmentData=function(p,v,R,U){if(!p||this.state!==y.PARSING)return;var j=p.data1,G=p.data2,B=j;if(j&&G&&(B=Object(_.appendUint8Array)(j,G)),!B||!B.length)return;var N={type:p.type,frag:v,part:R,chunkMeta:U,parent:v.type,data:B};this.hls.trigger(D.Events.BUFFER_APPENDING,N),p.dropped&&p.independent&&!R&&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 R=v.currentTime,U=F.BufferHelper.bufferInfo(v,R,0),j=p.duration,G=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),B=Math.max(Math.min(p.start-G,U.end-G),R+G);p.start-B>G&&this.flushMainBuffer(B,p.start)},a.getFwdBufferInfo=function(p,v){var R=this.config,U=this.getLoadPosition();if(!Object(H.isFiniteNumber)(U))return null;var j=F.BufferHelper.bufferInfo(p,U,R.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,R.maxBufferHole))}return j},a.getMaxBufferLength=function(p){var v=this.config,R;return p?R=Math.max(8*v.maxBufferSize/p,v.maxBufferLength):R=v.maxBufferLength,Math.min(R,v.maxMaxBufferLength)},a.reduceMaxBufferLength=function(p){var v=this.config,R=p||v.maxBufferLength;return v.maxMaxBufferLength>=R?(v.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+v.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(p,v){var R,U,j=v.fragments,G=j.length;if(!G)return null;var B=this.config,N=j[0].start,V;if(v.live){var q=B.initialLiveManifestSize;if(G<q)return this.warn("Not enough fragments to start playback (have: "+G+", need: "+q+")"),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(R=V)!==null&&R!==void 0&&R.initSegment&&!((U=V)!==null&&U!==void 0&&U.initSegment.data)&&!this.bitrateTest&&(V=V.initSegment),V},a.getNextPart=function(p,v,R){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&&R<V.start)break;var q=V.loaded;!q&&(j||V.independent||G)&&V.fragment===v&&(U=B),j=q}return U},a.loadedEndOfParts=function(p,v){var R=p[p.length-1];return R&&v>R.start&&R.loaded},a.getInitialLiveFragment=function(p,v){var R=this.fragPrevious,U=null;if(R){if(p.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+R.programDateTime),U=Object(A.findFragmentByPDT)(v,R.endProgramDateTime,this.config.maxFragLookUpTolerance)),!U){var j=R.sn+1;if(j>=p.startSN&&j<=p.endSN){var G=v[j-p.startSN];R.cc===G.cc&&(U=G,this.log("Live playlist, switching playlist, load frag with next SN: "+U.sn))}U||(U=Object(A.findFragWithCC)(v,R.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,R){var U=this.config,j=this.fragPrevious,G=R.fragments,B=R.endSN,N=R.fragmentHint,V=U.maxFragLookUpTolerance,q=!!(U.lowLatencyMode&&R.partList&&N);q&&N&&!this.bitrateTest&&(G=G.concat(N),B=N.sn);var ie;if(p<v){var se=p>v-V?0:V;ie=Object(A.findFragmentByPTS)(j,G,p,se)}else ie=G[G.length-1];if(ie){var xe=ie.sn-R.startSN,fe=j&&ie.level===j.level,Ee=G[xe+1],ge=this.fragmentTracker.getState(ie);if(ge===M.FragmentState.BACKTRACKED){ie=null;for(var ve=xe;G[ve]&&this.fragmentTracker.getState(G[ve])===M.FragmentState.BACKTRACKED;)j?ie=G[ve--]:ie=G[--ve];ie||(ie=Ee)}else j&&ie.sn===j.sn&&!q&&(fe&&(ie.sn<B&&this.fragmentTracker.getState(Ee)!==M.FragmentState.OK?(this.log("SN "+ie.sn+" just loaded, load next one: "+Ee.sn),ie=Ee):ie=null))}return ie},a.synchronizeToLiveEdge=function(p){var v=this.config,R=this.media;if(!R)return;var U=this.hls.liveSyncPosition,j=R.currentTime,G=p.fragments[0].start,B=p.edge,N=j>=G-v.maxFragLookUpTolerance&&j<=B;if(U!==null&&R.duration>U&&(j<U||!N)){var V=v.liveMaxLatencyDuration!==void 0?v.liveMaxLatencyDuration:v.liveMaxLatencyDurationCount*p.targetduration;(!N&&R.readyState<4||j<B-V)&&(this.loadedmetadata||(this.nextLoadPosition=U),R.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)),R.currentTime=U))}},a.alignPlaylists=function(p,v){var R=this.levels,U=this.levelLastLoaded,j=this.fragPrevious,G=U!==null?R[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,q=p.alignedSliding&&Object(H.isFiniteNumber)(N);if(V||!q&&!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 R=this.startPosition;if(R<v&&(R=-1),R===-1||this.lastCurrentTime===-1){var U=p.startTimeOffset;Object(H.isFiniteNumber)(U)?(R=v+U,U<0&&(R+=p.totalduration),R=Math.min(Math.max(v,R),v+p.totalduration),this.log("Start time offset "+U+" found in playlist, adjust startPosition to "+R),this.startPosition=R):p.live?R=this.hls.liveSyncPosition||v:this.startPosition=R=0,this.lastCurrentTime=R}this.nextLoadPosition=R},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 R=v.frag;if(!R||R.type!==p)return;var U=this.fragCurrent;console.assert(U&&R.sn===U.sn&&R.level===U.level&&R.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(R.level))return;var G=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+R.sn+" of "+p+" "+R.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):(P.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,R){if(!p)return;var U=F.BufferHelper.getBuffered(p);this.fragmentTracker.detectEvictedFragments(v,U,R),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,R,U){var j=this,G=R.details;console.assert(!!G,"level.details must be defined");var B=Object.keys(p.elementaryStreams).reduce(function(N,V){var q=p.elementaryStreams[V];if(q){var ie=q.endPTS-q.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 se=U?0:Object(w.updateFragPTSDTS)(G,p,q.startPTS,q.endPTS,q.startDTS,q.endDTS);return j.hls.trigger(D.Events.LEVEL_PTS_UPDATED,{details:G,level:R,drift:se,type:V,frag:p,start:q.startPTS,end:q.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(s,[{key:"state",get:function(){return this._state},set:function(p){var v=this._state;v!==p&&(this._state=p,this.log(v+"->"+p))}}]),s}(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"),M=L("./src/utils/logger.ts"),F=L("./src/errors.ts"),P=L("./src/utils/buffer-helper.ts"),D=L("./src/utils/mediasource-helper.ts"),O=L("./src/loader/fragment.ts"),E=L("./src/controller/buffer-operation-queue.ts"),_=Object(D.getMediaSource)(),T=/([ha]vc.)(?:\.[^.,]+)+/,A=function(){function w(d){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var u=o.hls,l=o.media,S=o.mediaSource;M.logger.log("[buffer-controller]: Media source opened"),l&&(o.updateMediaElementDuration(),u.trigger(k.Events.MEDIA_ATTACHED,{media:l})),S&&S.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){M.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){M.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var b=w.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 o=this.hls;o.on(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(k.Events.BUFFER_RESET,this.onBufferReset,this),o.on(k.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(k.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(k.Events.BUFFER_EOS,this.onBufferEos,this),o.on(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(k.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(k.Events.FRAG_PARSED,this.onFragParsed,this),o.on(k.Events.FRAG_CHANGED,this.onFragChanged,this)},b.unregisterListeners=function(){var o=this.hls;o.off(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(k.Events.BUFFER_RESET,this.onBufferReset,this),o.off(k.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(k.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(k.Events.BUFFER_EOS,this.onBufferEos,this),o.off(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(k.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(k.Events.FRAG_PARSED,this.onFragParsed,this),o.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(o,u){var l=2;(u.audio&&!u.video||!u.altAudio)&&(l=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=l,this.details=null,M.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},b.onMediaAttaching=function(o,u){var l=this.media=u.media;if(l&&_){var S=this.mediaSource=new _;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 o=this.media,u=this.mediaSource,l=this._objectUrl;if(u){if(M.logger.log("[buffer-controller]: media source detaching"),u.readyState==="open")try{u.endOfStream()}catch(S){M.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),o&&(l&&self.URL.revokeObjectURL(l),o.src===l?(o.removeAttribute("src"),o.load()):M.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 o=this;this.getSourceBufferTypes().forEach(function(u){var l=o.sourceBuffer[u];try{l&&(o.removeBufferListeners(u),o.mediaSource&&o.mediaSource.removeSourceBuffer(l),o.sourceBuffer[u]=void 0)}catch(S){M.logger.warn("[buffer-controller]: Failed to reset the "+u+" buffer",S)}}),this._initSourceBuffer()},b.onBufferCodecs=function(o,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,s=(g.levelCodec||g.codec).replace(T,"$1"),a=(f||y).replace(T,"$1");if(s!==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(o,u){var l=this,S=this.operationQueue,h={execute:function(){var C=l.sourceBuffer[o];C&&(M.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+u),C.changeType(u)),S.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(C){M.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",C)}};S.append(h,o)},b.onBufferAppending=function(o,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,s=u.chunkMeta,a=s.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 R=g.audio,U=y==="audio"&&s.id===1&&(R==null?void 0:R.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&&(M.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 q in N)V[q]=P.BufferHelper.getBuffered(N[q]);l.appendError=0,l.hls.trigger(k.Events.BUFFER_APPENDED,{type:y,frag:f,part:c,chunkMeta:s,parent:f.type,timeRanges:V})},onError:function(B){M.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&&(M.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(o,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){M.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(o,u){var l=this,S=u.frag,h=u.part,g=[],C=h?h.elementaryStreams:S.elementaryStreams;C[O.ElementaryStreamTypes.AUDIOVIDEO]?g.push("audiovideo"):(C[O.ElementaryStreamTypes.AUDIO]&&g.push("audio"),C[O.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 s=h?h.stats:S.stats;l.hls.trigger(k.Events.FRAG_BUFFERED,{frag:S,part:h,stats:s,id:S.type})};g.length===0&&M.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(o,u){this.flushBackBuffer()},b.onBufferEos=function(o,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,M.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(o,u){var l=u.details;if(!l.fragments.length)return;this.details=l,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},b.flushBackBuffer=function(){var o=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&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.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(s){var a=S[s];if(a){var m=P.BufferHelper.getBuffered(a);m.length>0&&c>m.start(0)&&(o.trigger(k.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),u.live&&o.trigger(k.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(k.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:s}))}})},b.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,u=this.hls,l=this.media,S=this.mediaSource,h=o.fragments[0].start+o.totalduration,g=l.duration,C=Object(H.isFiniteNumber)(S.duration)?S.duration:0;o.live&&u.config.liveDurationInfinity?(M.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),S.duration=Infinity,this.updateSeekableRange(o)):(h>C&&h>g||!Object(H.isFiniteNumber)(g))&&(M.logger.log("[buffer-controller]: Updating Media Source duration to "+h.toFixed(3)),S.duration=h)},b.updateSeekableRange=function(o){var u=this.mediaSource,l=o.fragments,S=l.length;if(S&&o.live&&u!==null&&u!==void 0&&u.setLiveSeekableRange){var h=Math.max(0,l[0].start),g=Math.max(h,h+o.totalduration);u.setLiveSeekableRange(h,g)}},b.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,u=this.operationQueue,l=this.pendingTracks,S=Object.keys(l).length;if(S&&!o||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(o){var u=this.sourceBuffer,l=this.mediaSource;if(!l)throw Error("createSourceBuffers called when mediaSource was null");var S=0;for(var h in o)if(!u[h]){var g=o[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;M.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(s){M.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+s.message),this.hls.trigger(k.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:s,mimeType:y})}}S&&this.hls.trigger(k.Events.BUFFER_CREATED,{tracks:this.tracks})},b._onSBUpdateStart=function(o){var u=this.operationQueue,l=u.current(o);l.onStart()},b._onSBUpdateEnd=function(o){var u=this.operationQueue,l=u.current(o);l.onComplete(),u.shiftAndExecuteNext(o)},b._onSBUpdateError=function(o,u){M.logger.error("[buffer-controller]: "+o+" 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(o);l&&l.onError(u)},b.removeExecutor=function(o,u,l){var S=this.media,h=this.mediaSource,g=this.operationQueue,C=this.sourceBuffer,y=C[o];if(!S||!h||!y){M.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),g.shiftAndExecuteNext(o);return}var f=Object(H.isFiniteNumber)(S.duration)?S.duration:Infinity,c=Object(H.isFiniteNumber)(h.duration)?h.duration:Infinity,s=Math.max(0,u),a=Math.min(l,f,c);a>s?(M.logger.log("[buffer-controller]: Removing ["+s+","+a+"] from the "+o+" SourceBuffer"),console.assert(!y.updating,o+" sourceBuffer must not be updating"),y.remove(s,a)):g.shiftAndExecuteNext(o)},b.appendExecutor=function(o,u){var l=this.operationQueue,S=this.sourceBuffer,h=S[u];if(!h){M.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(o)},b.blockBuffers=function(o,u){var l=this;if(u===void 0&&(u=this.getSourceBufferTypes()),!u.length){M.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var S=this.operationQueue,h=u.map(function(g){return S.appendBlocker(g)});Promise.all(h).then(function(){o(),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(o,u,l){var S=this.sourceBuffer[o];if(!S)return;var h=l.bind(this,o);this.listeners[o].push({event:u,listener:h}),S.addEventListener(u,h)},b.removeBufferListeners=function(o){var u=this.sourceBuffer[o];if(!u)return;this.listeners[o].forEach(function(l){u.removeEventListener(l.event,l.listener)})},w}()},"./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 M(P){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=P}var F=M.prototype;return F.append=function(D,O){var E=this.queues[O];E.push(D),E.length===1&&this.buffers[O]&&this.executeNext(O)},F.insertAbort=function(D,O){var E=this.queues[O];E.unshift(D),this.executeNext(O)},F.appendBlocker=function(D){var O,E=new Promise(function(T){O=T}),_={execute:O,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(_,D),E},F.executeNext=function(D){var O=this.buffers,E=this.queues,_=O[D],T=E[D];if(T.length){var A=T[0];try{A.execute()}catch(w){H.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),A.onError(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]},M}()},"./src/controller/cap-level-controller.ts":function(re,z,L){"use strict";L.r(z);var H=L("./src/events.ts");function k(P,D){for(var O=0;O<D.length;O++){var E=D[O];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(P,E.key,E)}}function M(P,D,O){return D&&k(P.prototype,D),O&&k(P,O),P}var F=function(){function P(O){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=O,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var D=P.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,_){P.isLevelAllowed(_.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(_.droppedLevel)},D.onMediaAttaching=function(E,_){this.media=_.media instanceof HTMLVideoElement?_.media:null},D.onManifestParsed=function(E,_){var T=this.hls;this.restrictedLevels=[],this.firstLevel=_.firstLevel,T.config.capLevelToPlayerSize&&_.video&&this.startCapping()},D.onBufferCodecs=function(E,_){var T=this.hls;T.config.capLevelToPlayerSize&&_.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 _=this.hls;_.autoLevelCapping=this.getMaxLevel(E.length-1),_.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=_.autoLevelCapping}}},D.getMaxLevel=function(E){var _=this,T=this.hls.levels;if(!T.length)return-1;var A=T.filter(function(w,b){return P.isLevelAllowed(b,_.restrictedLevels)&&b<=E});return this.clientRect=null,P.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,_={width:0,height:0};if(E){var T=E.getBoundingClientRect();_.width=T.width,_.height=T.height,!_.width&&!_.height&&(_.width=T.right-T.left||E.width||0,_.height=T.bottom-T.top||E.height||0)}return this.clientRect=_,_},P.isLevelAllowed=function(E,_){return _===void 0&&(_=[]),_.indexOf(E)===-1},P.getMaxLevelByMediaSize=function(E,_,T){if(!E||!E.length)return-1;for(var A=function(u,l){return l?u.width!==l.width||u.height!==l.height:!0},w=E.length-1,b=0;b<E.length;b+=1){var d=E[b];if((d.width>=_||d.height>=T)&&A(d,E[b+1])){w=b;break}}return w},M(P,[{key:"mediaWidth",get:function(){return this.getDimensions().width*P.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*P.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var E=1;try{E=self.devicePixelRatio}catch(_){}return E}}]),P}();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"),M=L("./src/utils/buffer-helper.ts"),F=L("./src/utils/logger.ts");function P(w,b){for(var d=0;d<b.length;d++){var o=b[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(w,o.key,o)}}function D(w,b,d){return b&&P(w.prototype,b),d&&P(w,d),w}function O(w,b){var d=typeof Symbol!="undefined"&&w[Symbol.iterator]||w["@@iterator"];if(d)return(d=d.call(w)).next.bind(d);if(Array.isArray(w)||(d=E(w))||b&&w&&typeof w.length=="number"){d&&(w=d);var o=0;return function(){return o>=w.length?{done:!0}:{done:!1,value:w[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E(w,b){if(!w)return;if(typeof w=="string")return _(w,b);var d=Object.prototype.toString.call(w).slice(8,-1);if(d==="Object"&&w.constructor&&(d=w.constructor.name),d==="Map"||d==="Set")return Array.from(w);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return _(w,b)}function _(w,b){(b==null||b>w.length)&&(b=w.length);for(var d=0,o=new Array(b);d<b;d++)o[d]=w[d];return o}function T(){return T=Object.assign||function(w){for(var b=1;b<arguments.length;b++){var d=arguments[b];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(w[o]=d[o])}return w},T.apply(this,arguments)}var A=function(){function w(d){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(S){try{o.apply(S,{ot:k.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(h){F.logger.warn("Could not generate manifest CMCD data.",h)}},this.applyFragmentData=function(S){try{var h=S.frag,g=o.hls.levels[h.level],C=o.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=o.getTopBandwidth(C),y.bl=o.getBufferLength(C)),o.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||w.uuid(),this.cid=l.contentId,this.useHeaders=l.useHeaders===!0,this.registerListeners())}var b=w.prototype;return b.registerListeners=function(){var o=this.hls;o.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(H.Events.BUFFER_CREATED,this.onBufferCreated,this)},b.unregisterListeners=function(){var o=this.hls;o.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.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(o,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(o,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 o;return{v:k.CMCDVersion,sf:k.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},b.apply=function(o,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=w.toHeaders(u);if(!Object.keys(S).length)return;o.headers||(o.headers={}),T(o.headers,S)}else{var h=w.toQuery(u);if(!h)return;o.url=w.appendQueryToUri(o.url,h)}},b.getObjectType=function(o){var u=o.type;return u==="subtitle"?k.CMCDObjectType.TIMED_TEXT:o.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(o){for(var u=0,l=o===k.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,S=O(l),h;!(h=S()).done;){var g=h.value;g.bitrate>u&&(u=g.bitrate)}return u>0?u:NaN},b.getBufferLength=function(o){var u=this.hls.media,l=o===k.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!l||!u)return NaN;var S=M.BufferHelper.bufferInfo(l,u.currentTime,this.config.maxBufferHole);return S.len*1e3},b.createPlaylistLoader=function(){var o=this.config.pLoader,u=this.applyPlaylistData,l=o||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 o=this.config.fLoader,u=this.applyFragmentData,l=o||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}()},w.uuid=function(){var o=URL.createObjectURL(new Blob),u=o.toString();return URL.revokeObjectURL(o),u.substr(u.lastIndexOf("/")+1)},w.serialize=function(o){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(o||{}).sort(),f=O(y),c;!(c=f()).done;){var s=c.value,a=o[s];if(!l(a))continue;if(s==="v"&&a===1)continue;if(s=="pr"&&a===1)continue;var m=C[s];m&&(a=m(a));var p=typeof a,v=void 0;s==="ot"||s==="sf"||s==="st"?v=s+"="+a:p==="boolean"?v=s:p==="number"?v=s+"="+a:v=s+"="+JSON.stringify(a),u.push(v)}return u.join(",")},w.toHeaders=function(o){for(var u=Object.keys(o),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]=o[f]}for(var s=0;s<h.length;s++){var a=w.serialize(h[s]);a&&(l["CMCD-"+S[s]]=a)}return l},w.toQuery=function(o){return"CMCD="+encodeURIComponent(w.serialize(o))},w.appendQueryToUri=function(o,u){if(!u)return o;var l=o.includes("?")?"&":"?";return""+o+l+u},w}()},"./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"),M=L("./src/utils/logger.ts"),F=L("./src/utils/mediakeys-helper.ts");function P(A,w){for(var b=0;b<w.length;b++){var d=w[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(A,d.key,d)}}function D(A,w,b){return w&&P(A.prototype,w),b&&P(A,b),A}var O=3,E=function(w,b,d){var o={audioCapabilities:[],videoCapabilities:[]};return w.forEach(function(u){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+u+'"',robustness:d.audioRobustness||""})}),b.forEach(function(u){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+u+'"',robustness:d.videoRobustness||""})}),[o]},_=function(w,b,d,o){switch(w){case F.KeySystems.WIDEVINE:return E(b,d,o);default:throw new Error("Unknown key-system: "+w)}},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 w=A.prototype;return w.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},w._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)},w._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)},w.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+'"')},w._attemptKeySystemAccess=function(d,o,u){var l=this,S=_(d,o,u,this._drmSystemOptions);M.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){M.logger.error('Failed to obtain key-system "'+d+'" access:',g)})},w._onMediaKeySystemAccessObtained=function(d,o){var u=this;M.logger.log('Access for key-system "'+d+'" obtained');var l={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:d};this._mediaKeysList.push(l);var S=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(h){return l.mediaKeys=h,M.logger.log('Media-keys created for key-system "'+d+'"'),u._onMediaKeysCreated(),h});return S.catch(function(h){M.logger.error("Failed to create media-keys:",h)}),S},w._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),d._onNewMediaKeySession(o.mediaKeysSession))})},w._onNewMediaKeySession=function(d){var o=this;M.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(u){o._onKeySessionMessage(d,u.message)},!1)},w._onKeySessionMessage=function(d,o){M.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(u){M.logger.log("Received license data (length: "+(u&&u.byteLength)+"), updating key-session"),d.update(u)})},w.onMediaEncrypted=function(d){var o=this;if(M.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){M.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(!o._media)return;o._attemptSetMediaKeys(S),o._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(u).catch(u)},w._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){M.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}M.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},w._generateRequestWithPreferredKeySession=function(d,o){var u=this,l=this._mediaKeysList[0];if(!l){M.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){M.logger.warn("Key-Session already initialized but requested again");return}var S=l.mediaKeysSession;if(!S){M.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(!o){M.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}M.logger.log('Generating key-session request for "'+d+'" init data type'),l.mediaKeysSessionInitialized=!0,S.generateRequest(d,o).then(function(){M.logger.debug("Key-session generation succeeded")}).catch(function(h){M.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})})},w._createLicenseXhr=function(d,o,u){var l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,l,d,o,u);var S=this._licenseXhrSetup;if(S)try{S.call(this.hls,l,d),S=void 0}catch(h){M.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},w._onLicenseRequestReadyStageChange=function(d,o,u,l){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,M.logger.log("License request succeeded");var S=d.response,h=this._licenseResponseCallback;if(h)try{S=h.call(this.hls,d,o)}catch(C){M.logger.error(C)}l(S)}else{if(M.logger.error("License Request XHR failed ("+o+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>O){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=O-this._requestLicenseFailureCount+1;M.logger.warn("Retrying license request, "+g+" attempts left"),this._requestLicense(u,l)}break}},w._generateLicenseRequestChallenge=function(d,o){switch(d.mediaKeySystemDomain){case F.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},w._requestLicense=function(d,o){M.logger.log("Requesting content license for key-system");var u=this._mediaKeysList[0];if(!u){M.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,o);M.logger.log("Sending license request to URL: "+l);var h=this._generateLicenseRequestChallenge(u,d);S.send(h)}catch(g){M.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})}},w.onMediaAttached=function(d,o){if(!this._emeEnabled)return;var u=o.media;this._media=u,u.addEventListener("encrypted",this._onMediaEncrypted)},w.onMediaDetached=function(){var d=this._media,o=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(u){if(u.mediaKeysSession)return u.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},w.onManifestParsed=function(d,o){if(!this._emeEnabled)return;var u=o.levels.map(function(S){return S.audioCodec}).filter(function(S){return!!S}),l=o.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"),M=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 P=F.prototype;return P.setStreamController=function(O){this.streamController=O},P.registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},P.unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching)},P.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},P.onMediaAttaching=function(O,E){var _=this.hls.config;if(_.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),_.fpsDroppedMonitoringPeriod)}},P.checkFPS=function(O,E,_){var T=performance.now();if(E){if(this.lastTime){var A=T-this.lastTime,w=_-this.lastDroppedFrames,b=E-this.lastDecodedFrames,d=1e3*w/A,o=this.hls;if(o.trigger(H.Events.FPS_DROP,{currentDropped:w,currentDecoded:b,totalDroppedFrames:_}),d>0&&w>o.config.fpsDroppedMonitoringThreshold*b){var u=o.currentLevel;k.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=u)&&(u=u-1,o.trigger(H.Events.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:o.currentLevel}),o.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=T,this.lastDroppedFrames=_,this.lastDecodedFrames=E}},P.checkFPSInterval=function(){var O=this.media;if(O)if(this.isVideoPlaybackQualityAvailable){var E=O.getVideoPlaybackQuality();this.checkFPS(O,E.totalVideoFrames,E.droppedVideoFrames)}else this.checkFPS(O,O.webkitDecodedFrameCount,O.webkitDroppedFrameCount)},F}();z.default=M},"./src/controller/fragment-finders.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"findFragmentByPDT",function(){return M}),L.d(z,"findFragmentByPTS",function(){return F}),L.d(z,"fragmentWithinToleranceTest",function(){return P}),L.d(z,"pdtWithinToleranceTest",function(){return D}),L.d(z,"findFragWithCC",function(){return O});var H=L("./src/polyfills/number.ts"),k=L("./src/utils/binary-search.ts");function M(E,_,T){if(_===null||!Array.isArray(E)||!E.length||!Object(H.isFiniteNumber)(_))return null;var A=E[0].programDateTime;if(_<(A||0))return null;var w=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(_,T,d))return d}return null}function F(E,_,T,A){T===void 0&&(T=0),A===void 0&&(A=0);var w=null;if(E?w=_[E.sn-_[0].sn+1]||null:T===0&&_[0].start===0&&(w=_[0]),w&&P(T,A,w)===0)return w;var b=k.default.search(_,P.bind(null,T,A));return b||w}function P(E,_,T){E===void 0&&(E=0),_===void 0&&(_=0);var A=Math.min(_,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,_,T){var A=Math.min(_,T.duration+(T.deltaPTS?T.deltaPTS:0))*1e3,w=T.endProgramDateTime||0;return w-A>E}function O(E,_){return k.default.search(E,function(T){return T.cc<_?1:T.cc>_?-1:0})}},"./src/controller/fragment-tracker.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"FragmentState",function(){return M}),L.d(z,"FragmentTracker",function(){return F});var H=L("./src/events.ts"),k=L("./src/types/loader.ts"),M;(function(O){O.NOT_LOADED="NOT_LOADED",O.BACKTRACKED="BACKTRACKED",O.APPENDING="APPENDING",O.PARTIAL="PARTIAL",O.OK="OK"})(M||(M={}));var F=function(){function O(_){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=_,this._registerListeners()}var E=O.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 w=this.activeFragment,b=this.activeParts;if(!w)return null;if(b)for(var d=b.length;d--;){var o=b[d],u=o?o.end:w.appendedPTS;if(o.start<=T&&u!==void 0&&T<=u)return d>9&&(this.activeParts=b.slice(d-9)),o}else if(w.start<=T&&w.appendedPTS!==void 0&&T<=w.appendedPTS)return w}return this.getBufferedFrag(T,A)},E.getBufferedFrag=function(T,A){for(var w=this.fragments,b=Object.keys(w),d=b.length;d--;){var o=w[b[d]];if((o==null?void 0:o.body.type)===A&&o.buffered){var u=o.body;if(u.start<=T&&T<=u.end)return u}}return null},E.detectEvictedFragments=function(T,A,w){var b=this;Object.keys(this.fragments).forEach(function(d){var o=b.fragments[d];if(!o)return;if(!o.buffered){o.body.type===w&&b.removeFragment(o.body);return}var u=o.range[T];if(!u)return;u.time.some(function(l){var S=!b.isTimeBuffered(l.startPTS,l.endPTS,A);return S&&b.removeFragment(o.body),S})})},E.detectPartialFragments=function(T){var A=this,w=this.timeRanges,b=T.frag,d=T.part;if(!w||b.sn==="initSegment")return;var o=D(b),u=this.fragments[o];if(!u)return;Object.keys(w).forEach(function(l){var S=b.elementaryStreams[l];if(!S)return;var h=w[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),w=this.fragments[A];w&&(w.backtrack=w.loaded=null,w.buffered=!0)},E.getBufferedTimes=function(T,A,w,b){for(var d={time:[],partial:w},o=A?A.start:T.start,u=A?A.end:T.end,l=T.minEndPTS||u,S=T.maxStartPTS||o,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(o,b.start(h)),endPTS:Math.min(u,b.end(h))});break}else if(o<C&&u>g)d.partial=!0,d.time.push({startPTS:Math.max(o,b.start(h)),endPTS:Math.min(u,b.end(h))});else if(u<=g)break}return d},E.getPartialFragment=function(T){var A=null,w,b,d,o=0,u=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach(function(S){var h=l[S];if(!h)return;P(h)&&(b=h.body.start-u,d=h.body.end+u,T>=b&&T<=d&&(w=Math.min(T-b,d-T),o<=w&&(A=h.body,o=w)))}),A},E.getState=function(T){var A=D(T),w=this.fragments[A];return w?w.buffered?P(w)?M.PARTIAL:M.OK:w.backtrack?M.BACKTRACKED:M.APPENDING:M.NOT_LOADED},E.backtrack=function(T,A){var w=D(T),b=this.fragments[w];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),w=this.fragments[A];if(w){var b,d=w.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,w){for(var b,d,o=0;o<w.length;o++){if(b=w.start(o)-this.bufferPadding,d=w.end(o)+this.bufferPadding,T>=b&&A<=d)return!0;if(A<=b)return!1}return!1},E.onFragLoaded=function(T,A){var w=A.frag,b=A.part;if(w.sn==="initSegment"||w.bitrateTest||b)return;var d=D(w);this.fragments[d]={body:w,loaded:A,backtrack:null,buffered:!1,range:Object.create(null)}},E.onBufferAppended=function(T,A){var w=this,b=A.frag,d=A.part,o=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=o,Object.keys(o).forEach(function(l){var S=o[l];if(w.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,w){var b=this;Object.keys(this.fragments).forEach(function(d){var o=b.fragments[d];if(!o)return;if(o.buffered){var u=o.body;u.type===w&&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},O}();function P(O){var E,_;return O.buffered&&(((E=O.range.video)===null||E===void 0?void 0:E.partial)||((_=O.range.audio)===null||_===void 0?void 0:_.partial))}function D(O){return O.type+"_"+O.level+"_"+O.urlId+"_"+O.sn}},"./src/controller/gap-controller.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"STALL_MINIMUM_DURATION_MS",function(){return P}),L.d(z,"MAX_START_GAP_JUMP",function(){return D}),L.d(z,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return O}),L.d(z,"SKIP_BUFFER_RANGE_START",function(){return E}),L.d(z,"default",function(){return _});var H=L("./src/utils/buffer-helper.ts"),k=L("./src/errors.ts"),M=L("./src/events.ts"),F=L("./src/utils/logger.ts"),P=250,D=2,O=.1,E=.05,_=function(){function T(w,b,d,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=w,this.media=b,this.fragmentTracker=d,this.hls=o}var A=T.prototype;return A.destroy=function(){this.hls=this.fragmentTracker=this.media=null},A.poll=function(b){var d=this.config,o=this.media,u=this.stalled,l=o.currentTime,S=o.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),o.paused||o.ended||o.playbackRate===0||!H.BufferHelper.getBuffered(o).length)return;var y=H.BufferHelper.bufferInfo(o,l,0),f=y.len>0,c=y.nextStart||0;if(!f&&!c)return;if(S){var s=y.len>D,a=!c||c-l>D&&!this.fragmentTracker.getPartialFragment(l);if(s||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,R=v==null||((m=v.details)===null||m===void 0)?void 0:m.live,U=R?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>=P&&this._reportStall(y.len);var B=H.BufferHelper.bufferInfo(o,l,d.maxBufferHole);this._tryFixBufferStall(B,G)},A._tryFixBufferStall=function(b,d){var o=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>o.maxBufferHole&&d>o.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,o=this.media,u=this.stallReported;u||(this.stallReported=!0,F.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+b+")"),d.trigger(M.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,o=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+O);return F.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+y),this.moved=!0,this.stalled=null,u.currentTime=y,b&&o.trigger(M.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,o=this.media,u=o.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),o.currentTime=S,d.trigger(M.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(M.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"),M=L("./src/demux/id3.ts"),F=.25,P=function(){function D(E){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=E,this._registerListeners()}var O=D.prototype;return O.destroy=function(){this._unregisterListeners()},O._registerListeners=function(){var _=this.hls;_.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.on(H.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),_.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},O._unregisterListeners=function(){var _=this.hls;_.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.off(H.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),_.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},O.onMediaAttached=function(_,T){this.media=T.media},O.onMediaDetaching=function(){if(!this.id3Track)return;Object(k.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},O.getID3Track=function(_){if(!this.media)return;for(var T=0;T<_.length;T++){var A=_[T];if(A.kind==="metadata"&&A.label==="id3")return Object(k.sendAddTrackEvent)(A,this.media),A}return this.media.addTextTrack("metadata","id3")},O.onFragParsingMetadata=function(_,T){if(!this.media)return;var A=T.frag,w=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<w.length;d++){var o=M.getID3Frames(w[d].data);if(o){var u=w[d].pts,l=d<w.length-1?w[d+1].pts:A.end,S=l-u;S<=0&&(l=u+F);for(var h=0;h<o.length;h++){var g=o[h];if(!M.isTimeStampFrame(g)){var C=new b(u,l,"");C.value=g,this.id3Track.addCue(C)}}}}},O.onBufferFlushing=function(_,T){var A=T.startOffset,w=T.endOffset,b=T.type;if(!b||b==="audio"){var d=this.id3Track;d&&Object(k.removeCuesInRange)(d,A,w)}},D}();z.default=P},"./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"),M=L("./src/utils/logger.ts");function F(O,E){for(var _=0;_<E.length;_++){var T=E[_];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(O,T.key,T)}}function P(O,E,_){return E&&F(O.prototype,E),_&&F(O,_),O}var D=function(){function O(_){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=_,this.config=_.config,this.registerListeners()}var E=O.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 w=A.details;this.levelDetails=w,w.advanced&&this.timeupdate(),!w.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++,M.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 w=this.computeLatency();if(w===null)return;this._latency=w;var b=this.config,d=b.lowLatencyMode,o=b.maxLiveSyncPlaybackRate;if(!d||o===1)return;var u=this.targetLatency;if(u===null)return;var l=w-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,o)),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},P(O,[{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,w=T.partHoldBack,b=T.targetduration,d=this.config,o=d.liveSyncDuration,u=d.liveSyncDurationCount,l=d.lowLatencyMode,S=this.hls.userConfig,h=l&&w||A;(S.liveSyncDuration||S.liveSyncDurationCount||h===0)&&(h=o!==void 0?o: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,w=this.levelDetails;if(T===null||A===null||w===null)return null;var b=w.edge,d=T-A-this.edgeStalled,o=b-w.totalduration,u=b-(this.config.lowLatencyMode&&w.partTarget||w.targetduration);return Math.min(Math.max(o,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 w=T.buffered.length;return w?T.buffered.end(w-1):A.edge-this.currentTime}}]),O}()},"./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"),M=L("./src/errors.ts"),F=L("./src/utils/codecs.ts"),P=L("./src/controller/level-helper.ts"),D=L("./src/controller/base-playlist-controller.ts"),O=L("./src/types/loader.ts");function E(){return E=Object.assign||function(o){for(var u=1;u<arguments.length;u++){var l=arguments[u];for(var S in l)Object.prototype.hasOwnProperty.call(l,S)&&(o[S]=l[S])}return o},E.apply(this,arguments)}function _(o,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(o,S.key,S)}}function T(o,u,l){return u&&_(o.prototype,u),l&&_(o,l),o}function A(o,u){o.prototype=Object.create(u.prototype),o.prototype.constructor=o,w(o,u)}function w(o,u){return w=Object.setPrototypeOf||function(S,h){return S.__proto__=h,S},w(o,u)}var b=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(o){A(u,o);function u(S){var h;return h=o.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,o.prototype.destroy.call(this)},l.startLoad=function(){var h=this._levels;h.forEach(function(g){g.loadError=0}),o.prototype.startLoad.call(this)},l.onManifestLoaded=function(h,g){var C=[],y=[],f=[],c,s={},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=s[N],a?a.url.push(G.url):(a=new H.Level(G),s[N]=a,C.push(a)),B&&(B.AUDIO&&Object(P.addGroupId)(a,"audio",B.AUDIO),B.SUBTITLES&&Object(P.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(P.assignTrackIdsByGroup)(y)),g.subtitles&&(f=g.subtitles,Object(P.assignTrackIdsByGroup)(f)),C.length>0){c=C[0].bitrate,C.sort(function(G,B){return G.bitrate-B.bitrate}),this._levels=C;for(var R=0;R<C.length;R++)if(C[R].bitrate===c){this._firstLevel=R,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:M.ErrorTypes.MEDIA_ERROR,details:M.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(o.prototype.onError.call(this,h,g),g.fatal)return;var C=g.context,y=this._levels[this.currentLevelIndex];if(C&&(C.type===O.PlaylistContextType.AUDIO_TRACK&&y.audioGroupIds&&C.groupId===y.audioGroupIds[y.urlId]||C.type===O.PlaylistContextType.SUBTITLE_TRACK&&y.textGroupIds&&C.groupId===y.textGroupIds[y.urlId])){this.redundantFailover(this.currentLevelIndex);return}var f=!1,c=!0,s;switch(g.details){case M.ErrorDetails.FRAG_LOAD_ERROR:case M.ErrorDetails.FRAG_LOAD_TIMEOUT:case M.ErrorDetails.KEY_LOAD_ERROR:case M.ErrorDetails.KEY_LOAD_TIMEOUT:if(g.frag){var a=this._levels[g.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(s=g.frag.level)):s=g.frag.level}break;case M.ErrorDetails.LEVEL_LOAD_ERROR:case M.ErrorDetails.LEVEL_LOAD_TIMEOUT:C&&(C.deliveryDirectives&&(c=!1),s=C.level),f=!0;break;case M.ErrorDetails.REMUX_ALLOC_ERROR:s=g.level,f=!0;break}s!==void 0&&this.recoverLevel(g,s,f,c)},l.recoverLevel=function(h,g,C,y){var f=h.details,c=this._levels[g];if(c.loadError++,C){var s=this.retryLoadingOrFail(h);if(s)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===O.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 s;this.warn("Invalid level index "+y),(s=g.deliveryDirectives)!==null&&s!==void 0&&s.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,s){return s!==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 s=f.details;return s!=null&&s.fragments&&s.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:M.ErrorTypes.OTHER_ERROR,details:M.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],s=C[h];this.log("switching to level "+h+" from "+f),this.currentLevelIndex=h;var a=E({},s,{level:h,maxBitrate:s.maxBitrate,uri:s.uri,urlId:s.urlId});delete a._urlId,this.hls.trigger(k.Events.LEVEL_SWITCHING,a);var m=s.details;if(!m||m.live){var p=this.switchParams(s.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 M}),L.d(z,"assignTrackIdsByGroup",function(){return F}),L.d(z,"updatePTS",function(){return P}),L.d(z,"updateFragPTSDTS",function(){return O}),L.d(z,"mergeDetails",function(){return E}),L.d(z,"mapPartIntersection",function(){return _}),L.d(z,"mapFragmentIntersection",function(){return T}),L.d(z,"adjustSliding",function(){return A}),L.d(z,"addSliding",function(){return w}),L.d(z,"computeReloadInterval",function(){return b}),L.d(z,"getFragmentWithSN",function(){return d}),L.d(z,"getPartWith",function(){return o});var H=L("./src/polyfills/number.ts"),k=L("./src/utils/logger.ts");function M(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 P(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 O(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,s=l.startPTS,a=l.endPTS;if(Object(H.isFiniteNumber)(s)){var m=Math.abs(s-S);Object(H.isFiniteNumber)(l.deltaPTS)?l.deltaPTS=Math.max(m,l.deltaPTS):l.deltaPTS=m,f=Math.max(S,s),S=Math.min(S,s),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 R,U=v-u.startSN,j=u.fragments;for(j[U]=l,R=U;R>0;R--)D(j[R],j[R-1]);for(R=U;R<j.length-1;R++)D(j[R],j[R+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(R,U){R.relurl&&(y=R.cc-U.cc),Object(H.isFiniteNumber)(R.startPTS)&&Object(H.isFiniteNumber)(R.endPTS)&&(U.start=U.startPTS=R.startPTS,U.startDTS=R.startDTS,U.appendedPTS=R.appendedPTS,U.maxStartPTS=R.maxStartPTS,U.endPTS=R.endPTS,U.endDTS=R.endDTS,U.minEndPTS=R.minEndPTS,U.duration=R.endPTS-R.startPTS,U.duration&&(f=U),l.PTSKnown=l.alignedSliding=!0),U.elementaryStreams=R.elementaryStreams,U.loader=R.loader,U.stats=R.stats,U.urlId=R.urlId,R.initSegment&&(U.initSegment=R.initSegment,S=R.initSegment)}),S){var c=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments;c.forEach(function(R){var U;(!R.initSegment||R.initSegment.relurl===((U=S)===null||U===void 0?void 0:U.relurl))&&(R.initSegment=S)})}if(l.skippedSegments&&(l.deltaUpdateFailed=l.fragments.some(function(R){return!R}),l.deltaUpdateFailed)){k.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var s=l.skippedSegments;s--;)l.fragments.shift();l.startSN=l.fragments[0].sn,l.startCC=l.fragments[0].cc}var a=l.fragments;if(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),_(u.partList,l.partList,function(R,U){U.elementaryStreams=R.elementaryStreams,U.stats=R.stats}),f?O(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 _(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,s=g;s<=C;s++){var a=c[y+s],m=f[s];h&&!m&&s<h&&(m=l.fragments[s]=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;w(l,h[S].start)}function w(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 s=333*u.misses;f=Math.max(Math.min(h,y*2),s),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 o(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"),M=L("./src/is-supported.ts"),F=L("./src/events.ts"),P=L("./src/utils/buffer-helper.ts"),D=L("./src/controller/fragment-tracker.ts"),O=L("./src/types/loader.ts"),E=L("./src/loader/fragment.ts"),_=L("./src/demux/transmuxer-interface.ts"),T=L("./src/types/transmuxer.ts"),A=L("./src/controller/gap-controller.ts"),w=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 o(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 s;return s=g.call(this,f,c,"[stream-controller]")||this,s.audioCodecSwap=!1,s.gapController=null,s.level=-1,s._forceStartLoad=!1,s.altAudio=!1,s.audioOnly=!1,s.fragPlaying=null,s.onvplaying=null,s.onvseeked=null,s.fragLastKbps=0,s.stalled=!1,s.couldBacktrack=!1,s.audioCodecSwitch=!1,s.videoBuffer=null,s._registerListeners(),s}var 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 s=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}s>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+s.toFixed(3)),c=s),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,s=this.levels,a=this.level,m=s==null||((c=s[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(),R=this.retryDate;(!R||v>=R||(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,s,a=this.hls,m=this.levelLastLoaded,p=this.levels,v=this.media,R=a.config,U=a.nextLoadLevel;if(m===null||!v&&(this.startFragRequested||!R.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,O.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 q={};this.altAudio&&(q.type="video"),this.hls.trigger(F.Events.BUFFER_EOS,q),this.state=k.State.ENDED;return}var ie=B.end,se=this.getNextFragment(ie,G);if(this.couldBacktrack&&!this.fragPrevious&&se&&se.sn!=="initSegment"){var xe=se.sn-G.startSN;xe>1&&(se=G.fragments[xe-1],this.fragmentTracker.removeFragment(se))}if(se&&this.fragmentTracker.getState(se)===D.FragmentState.OK&&this.nextLoadPosition>ie){var fe=this.audioOnly&&!this.altAudio?E.ElementaryStreamTypes.AUDIO:E.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(v,fe,O.PlaylistLevelType.MAIN),se=this.getNextFragment(this.nextLoadPosition,G)}if(!se)return;se.initSegment&&!se.initSegment.data&&!this.bitrateTest&&(se=se.initSegment),((c=se.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((s=se.decryptdata)!==null&&s!==void 0&&s.key)?this.loadKey(se,G):this.loadFragment(se,G,ie)},y.loadFragment=function(c,s,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,s,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 s=this.fragmentTracker.getAppendedFrag(c,O.PlaylistLevelType.MAIN);return s&&"fragment"in s?s.fragment:s},y.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,O.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,s=this.media;if(s!=null&&s.readyState){var a,m=this.getAppendedFrag(s.currentTime);if(m&&m.start>1&&this.flushMainBuffer(0,m.start-1),!s.paused&&c){var p=this.hls.nextLoadLevel,v=c[p],R=this.fragLastKbps;R&&this.fragCurrent?a=this.fragCurrent.duration*v.maxBitrate/(1e3*R)+1:a=0}else a=0;var U=this.getBufferedFrag(s.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,s){g.prototype.flushMainBuffer.call(this,c,s,this.altAudio?"video":null)},y.onMediaAttached=function(c,s){g.prototype.onMediaAttached.call(this,c,s);var a=s.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new 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,s=c?c.currentTime:null;Object(H.isFiniteNumber)(s)&&this.log("Media seeked to "+s.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,s){var a=!1,m=!1,p;s.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(M.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=s.levels,this.startFragRequested=!1},y.onLevelLoading=function(c,s){var a=this.levels;if(!a||this.state!==k.State.IDLE)return;var m=a[s.level];(!m.details||m.details.live&&this.levelLastLoaded!==s.level||this.waitForCdnTuneIn(m.details))&&(this.state=k.State.WAITING_LEVEL)},y.onLevelLoaded=function(c,s){var a,m=this.levels,p=s.level,v=s.details,R=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:"+R);var U=this.fragCurrent;U&&(this.state===k.State.FRAG_LOADING||this.state===k.State.FRAG_LOADING_WAITING_RETRY)&&(U.level!==s.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 s,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 R=v[a.level],U=R.details;if(!U){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var j=R.videoCodec,G=U.PTSKnown||!U.live,B=(s=a.initSegment)===null||s===void 0?void 0:s.data,N=this._getAudioCodec(R),V=this.transmuxer=this.transmuxer||new _.default(this.hls,O.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),q=m?m.index:-1,ie=q!==-1,se=new T.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,p.byteLength,q,ie),xe=this.initPTS[a.cc];V.push(p,B,N,j,a,m,U.totalduration,G,se,xe)},y.onAudioTrackSwitching=function(c,s){var a=this.altAudio,m=!!s.url,p=s.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 R=this.hls;a&&R.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),R.trigger(F.Events.AUDIO_TRACK_SWITCHED,{id:p})}},y.onAudioTrackSwitched=function(c,s){var a=s.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,s){var a=s.tracks,m,p,v=!1;for(var R in a){var U=a[R];if(U.id==="main"){if(p=R,m=U,R==="video"){var j=a[R];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,s){var a=s.frag,m=s.part;if(a&&a.type!==O.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,s){switch(s.details){case w.ErrorDetails.FRAG_LOAD_ERROR:case w.ErrorDetails.FRAG_LOAD_TIMEOUT:case w.ErrorDetails.KEY_LOAD_ERROR:case w.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(O.PlaylistLevelType.MAIN,s);break;case w.ErrorDetails.LEVEL_LOAD_ERROR:case w.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==k.State.ERROR&&(s.fatal?(this.warn(""+s.details),this.state=k.State.ERROR):!s.levelRetry&&this.state===k.State.WAITING_LEVEL&&(this.state=k.State.IDLE));break;case w.ErrorDetails.BUFFER_FULL_ERROR:if(s.parent==="main"&&(this.state===k.State.PARSING||this.state===k.State.PARSED)){var a=!0,m=this.getFwdBufferInfo(this.media,O.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,s=this.gapController;if(!c||!s||!c.readyState)return;var a=P.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):s.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,s){var a=s.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,O.PlaylistLevelType.MAIN)}},y.onLevelsUpdated=function(c,s){this.levels=s.levels},y.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},y.seekToStartPos=function(){var c=this.media,s=c.currentTime,a=this.startPosition;if(a>=0&&s<a){if(c.seeking){b.logger.log("could not seek to "+a+", already seeking at "+s);return}var m=P.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 "+s),c.currentTime=a}},y._getAudioCodec=function(c){var s=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&s&&(this.log("Swapping audio codec"),s.indexOf("mp4a.40.5")!==-1?s="mp4a.40.2":s="mp4a.40.5"),s},y._loadBitrateTestFrag=function(c){var s=this;this._doFragLoad(c).then(function(a){var m=s.hls;if(!a||m.nextLoadLevel||s.fragContextChanged(c))return;s.fragLoadError=0,s.state=k.State.IDLE,s.startFragRequested=!1,s.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 s,a="main",m=this.hls,p=c.remuxResult,v=c.chunkMeta,R=this.getCurrentContext(v);if(!R){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=R.frag,j=R.part,G=R.level,B=p.video,N=p.text,V=p.id3,q=p.initSegment,ie=this.altAudio?void 0:p.audio;if(this.fragContextChanged(U))return;if(this.state=k.State.PARSING,q){q.tracks&&(this._bufferInitSegment(G,q.tracks,U,v),m.trigger(F.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:a,tracks:q.tracks}));var se=q.initPTS,xe=q.timescale;Object(H.isFiniteNumber)(se)&&(this.initPTS[U.cc]=se,m.trigger(F.Events.INIT_PTS_FOUND,{frag:U,id:a,initPTS:se,timescale:xe}))}if(B&&p.independent!==!1){if(G.details){var fe=B.startPTS,Ee=B.endPTS,ge=B.startDTS,ve=B.endDTS;if(j)j.elementaryStreams[B.type]={startPTS:fe,endPTS:Ee,startDTS:ge,endDTS:ve};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,Ee,U.start,ve,!0)}U.setElementaryStreamInfo(B.type,fe,Ee,ge,ve),this.bufferFragmentData(B,U,j,v)}}else if(p.independent===!1){this.backtrack(U);return}if(ie){var ue=ie.startPTS,be=ie.endPTS,je=ie.startDTS,Be=ie.endDTS;j&&(j.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:ue,endPTS:be,startDTS:je,endDTS:Be}),U.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,ue,be,je,Be),this.bufferFragmentData(ie,U,j,v)}if(V!=null&&(s=V.samples)!==null&&s!==void 0&&s.length){var ke={frag:U,id:a,samples:V.samples};m.trigger(F.Events.FRAG_PARSING_METADATA,ke)}if(N){var Me={frag:U,id:a,samples:N.samples};m.trigger(F.Events.FRAG_PARSING_USERDATA,Me)}},y._bufferInitSegment=function(c,s,a,m){var p=this;if(this.state!==k.State.PARSING)return;this.audioOnly=!!s.audio&&!s.video,this.altAudio&&!this.audioOnly&&delete s.audio;var v=s.audio,R=s.video,U=s.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+"]")}R&&(R.levelCodec=c.videoCodec,R.id="main",this.log("Init video buffer, container:"+R.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+R.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,s),Object.keys(s).forEach(function(B){var N=s[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 s=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,s?this.resetFragmentLoading(c):this.state=k.State.BACKTRACKING},y.checkFragmentChanged=function(){var c=this.media,s=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(P.BufferHelper.isBuffered(c,a)?s=this.getAppendedFrag(a):P.BufferHelper.isBuffered(c,a+.1)&&(s=this.getAppendedFrag(a+.1)),s){var m=this.fragPlaying,p=s.level;(!m||s.sn!==m.sn||m.level!==p||s.urlId!==m.urlId)&&(this.hls.trigger(F.Events.FRAG_CHANGED,{frag:s}),(!m||m.level!==p)&&this.hls.trigger(F.Events.LEVEL_SWITCHED,{level:p}),this.fragPlaying=s)}}},o(C,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var s=this.getAppendedFrag(c.currentTime);if(s)return s.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var s=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(s)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),C}(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"),M=L("./src/utils/buffer-helper.ts"),F=L("./src/controller/fragment-finders.ts"),P=L("./src/utils/discontinuities.ts"),D=L("./src/controller/level-helper.ts"),O=L("./src/controller/fragment-tracker.ts"),E=L("./src/controller/base-stream-controller.ts"),_=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 w(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 o=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(o),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 s=this.tracksBuffered[this.currentTrackId];if(!s)return;for(var a,m=f.start,p=0;p<s.length;p++)if(m>=s[p].start&&m<=s[p].end){a=s[p];break}var v=f.start+f.duration;a?a.end=v:(a={start:m,end:v},s.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 s=this.currentTrackId,a=this.levels;if(!a.length||!a[s]||!a[s].details)return;var m=a[s].details,p=m.targetduration,v=c-p;if(v<=0)return;y.endOffsetSubtitles=Math.max(0,v),this.tracksBuffered.forEach(function(R){for(var U=0;U<R.length;){if(R[U].end<=v){R.shift();continue}else if(R[U].start<v)R[U].start=v;else break;U++}}),this.fragmentTracker.removeFragmentsInRange(f,v,_.PlaylistLevelType.SUBTITLE)}},h.onError=function(C,y){var f,c=y.frag;if(!c||c.type!==_.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(s){return new T.Level(s)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(s){f.tracksBuffered[s.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(o)},h.onSubtitleTrackLoaded=function(C,y){var f,c=y.details,s=y.id,a=this.currentTrackId,m=this.levels;if(!m.length)return;var p=m[a];if(s>=m.length||s!==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 R=v.fragments[0];if(!p.details)c.hasProgramDateTime&&v.hasProgramDateTime?Object(P.alignMediaPlaylistByPDT)(c,v):R&&Object(D.addSliding)(c,R.start);else{var U=this.alignPlaylists(c,p.details);U===0&&R&&Object(D.addSliding)(c,R.start)}}if(p.details=c,this.levelLastLoaded=s,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,s=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();s.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,s=c.targetduration,a=this.config,m=this.media,p=M.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,m.currentTime-s,a.maxBufferHole),v=p.end,R=p.len,U=this.getMaxBufferLength()+s;if(R>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 q=a.maxFragLookUpTolerance;V&&c.hasProgramDateTime&&(N=Object(F.findFragmentByPDT)(j,V.endProgramDateTime,q)),N||(N=Object(F.findFragmentByPTS)(V,j,v,q),!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)===O.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)},w(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"),M=L("./src/controller/base-playlist-controller.ts"),F=L("./src/types/loader.ts");function P(A,w){for(var b=0;b<w.length;b++){var d=w[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(A,d.key,d)}}function D(A,w,b){return w&&P(A.prototype,w),b&&P(A,b),A}function O(A,w){A.prototype=Object.create(w.prototype),A.prototype.constructor=A,E(A,w)}function E(A,w){return E=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},E(A,w)}var _=function(A){O(w,A);function w(d){var o;return o=A.call(this,d,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var b=w.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 o=this.hls;o.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(H.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var o=this.hls;o.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(H.Events.ERROR,this.onError,this)},b.onMediaAttached=function(o,u){if(this.media=u.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},b.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},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 o=T(this.media.textTracks);o.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(o,u){this.tracks=u.subtitleTracks},b.onSubtitleTrackLoaded=function(o,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(o,u){this.switchLevel(u.level)},b.onLevelSwitching=function(o,u){this.switchLevel(u.level)},b.switchLevel=function(o){var u=this.hls.levels[o];if(!(u!=null&&u.textGroupIds))return;var l=u.textGroupIds[u.urlId];if(this.groupId!==l){var 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(o){for(var u=this.tracksInGroup,l=0;l<u.length;l++){var S=u[l];if((!this.selectDefaultTrack||S.default)&&(!o||o===S.name))return S.id}return-1},b.onError=function(o,u){if(A.prototype.onError.call(this,o,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(o){var u=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(u)){var l=u.id,S=u.groupId,h=u.url;if(o)try{h=o.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:o||null})}},b.toggleTrackModes=function(o){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(o===-1)[].slice.call(g).forEach(function(c){c.mode="disabled"});else{var y=C[h];y&&(y.mode="disabled")}var f=C[o];f&&(f.mode=S?"showing":"hidden")},b.setSubtitleTrack=function(o,u){var l,S=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(l=S[o])!==null&&l!==void 0&&l.details)||o<-1||o>=S.length)return;this.clearTimer();var h=S[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,h){var g=h.id,C=h.groupId,y=C===void 0?"":C,f=h.name,c=h.type,s=h.url;this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:g,groupId:y,name:f,type:c,url:s});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:o})},b.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,u=T(this.media.textTracks),l=0;l<u.length;l++)if(u[l].mode==="hidden")o=l;else if(u[l].mode==="showing"){o=l;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},D(w,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var u=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,u)}}]),w}(M.default);function T(A){for(var w=[],b=0;b<A.length;b++){var d=A[b];d.kind==="subtitles"&&d.label&&w.push(A[b])}return w}z.default=_},"./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"),M=L("./src/utils/cea-608-parser.ts"),F=L("./src/utils/output-filter.ts"),P=L("./src/utils/webvtt-parser.ts"),D=L("./src/utils/texttrack-utils.ts"),O=L("./src/utils/imsc1-ttml-parser.ts"),E=L("./src/types/loader.ts"),_=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 M.default(1,l,S),this.cea608Parser2=new M.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 o=d.prototype;return o.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},o.addCues=function(l,S,h,g,C){for(var y=!1,f=C.length;f--;){var c=C[f],s=w(c[0],c[1],S,h);if(s>=0&&(c[0]=Math.min(c[0],S),c[1]=Math.max(c[1],h),y=!0,s/(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})}},o.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(s){h.onFragLoaded(k.Events.FRAG_LOADED,s)}))},o.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},o.createCaptionsTrack=function(l){this.config.renderTextTracksNatively?this.createNativeTrack(l):this.createNonNativeTrack(l)},o.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 s=this.createTextTrack("captions",y,f);s&&(s[l]=!0,h[l]=s)}},o.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]})},o.createTextTrack=function(l,S,h){var g=this.media;return g?g.addTextTrack(l,S,h):void 0},o.onMediaAttaching=function(l,S){this.media=S.media,this._cleanTracks()},o.onMediaDetaching=function(){var l=this.captionsTracks;Object.keys(l).forEach(function(S){Object(D.clearCurrentCues)(l[S]),delete l[S]}),this.nonNativeCaptionsTracks={}},o.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())},o._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])},o.onSubtitleTracksUpdated=function(l,S){var h=this;this.textTracks=[];var g=S.subtitleTracks||[],C=g.some(function(s){return s.textCodec===O.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(s,a){var m;if(a<f.length){for(var p=null,v=0;v<f.length;v++)if(A(f[v],s)){p=f[v];break}p&&(m=p)}m?Object(D.clearCurrentCues)(m):(m=h.createTextTrack("subtitles",s.name,s.lang),m&&(m.mode="disabled")),m&&(m.groupId=s.groupId,h.textTracks.push(m))})}else if(!y&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(s){return{label:s.name,kind:s.type.toLowerCase(),default:s.default,subtitleTrack:s}});this.hls.trigger(k.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.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})},o.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,s=S.frag.sn,a=(f=S==null||((c=S.part)===null||c===void 0)?void 0:c.index)!=null?f:-1;s===C+1||s===C&&a===y+1||(h.reset(),g.reset()),this.lastSn=s,this.lastPartIndex=a}},o.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],s=this.vttCCs;s[h.cc]||(s[h.cc]={start:h.start,prevCC:this.prevCC,new:!0},this.prevCC=h.cc),c&&c.textCodec===O.IMSC1_CODEC?this._parseIMSC1(h,g):this._parseVTTs(h,g,s)}}else this.hls.trigger(k.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(l,S){var h=this,g=this.hls;Object(O.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){_.logger.log("Failed to parse IMSC1: "+C),g.trigger(k.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:C})})},o._parseVTTs=function(l,S,h){var g=this,C=this.hls;Object(P.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),_.logger.log("Failed to parse VTT cue: "+y),C.trigger(k.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:y})})},o._fallbackToIMSC1=function(l,S){var h=this,g=this.tracks[l.level];g.textCodec||Object(O.parseIMSC1)(S,this.initPTS[l.cc],this.timescale[l.cc],function(){g.textCodec=O.IMSC1_CODEC,h._parseIMSC1(l,S)},function(){g.textCodec="wvtt"})},o._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})}},o.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)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.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])}}},o.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 s=this.textTracks;Object.keys(s).forEach(function(a){return Object(D.removeCuesInRange)(s[a],h,C)})}},o.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++],s=(4&y)!==0,a=3&y;if(f===0&&c===0)continue;s&&((a===0||a===1)&&(g[a].push(f),g[a].push(c)))}return g},d}();function A(d,o){return d&&d.label===o.name&&!(d.textTrack1||d.textTrack2)}function w(d,o,u,l){return Math.min(o,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,P){this.subtle=void 0,this.aesIV=void 0,this.subtle=F,this.aesIV=P}var M=k.prototype;return M.decrypt=function(P,D){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},D,P)},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 M});var H=L("./src/utils/typed-array.ts");function k(F){var P=F.byteLength,D=P&&new DataView(F.buffer).getUint8(P-1);return D?Object(H.sliceUint8)(F,0,P-D):F}var M=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 P=F.prototype;return P.uint8ArrayToUint32Array_=function(O){for(var E=new DataView(O),_=new Uint32Array(4),T=0;T<4;T++)_[T]=E.getUint32(T*4);return _},P.initTable=function(){var O=this.sBox,E=this.invSBox,_=this.subMix,T=_[0],A=_[1],w=_[2],b=_[3],d=this.invSubMix,o=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,O[g]=f,E[f]=g;var c=h[g],s=h[c],a=h[s],m=h[f]*257^f*16843008;T[g]=m<<24|m>>>8,A[g]=m<<16|m>>>16,w[g]=m<<8|m>>>24,b[g]=m,m=a*16843009^s*65537^c*257^g*16843008,o[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}},P.expandKey=function(O){for(var E=this.uint8ArrayToUint32Array_(O),_=!0,T=0;T<E.length&&_;)_=E[T]===this.key[T],T++;if(_)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 w=this.ksRows=(A+6+1)*4,b,d,o=this.keySchedule=new Uint32Array(w),u=this.invKeySchedule=new Uint32Array(w),l=this.sBox,S=this.rcon,h=this.invSubMix,g=h[0],C=h[1],y=h[2],f=h[3],c,s;for(b=0;b<w;b++){if(b<A){c=o[b]=E[b];continue}s=c,b%A===0?(s=s<<8|s>>>24,s=l[s>>>24]<<24|l[s>>>16&255]<<16|l[s>>>8&255]<<8|l[s&255],s^=S[b/A|0]<<24):A>6&&b%A===4&&(s=l[s>>>24]<<24|l[s>>>16&255]<<16|l[s>>>8&255]<<8|l[s&255]),o[b]=c=(o[b-A]^s)>>>0}for(d=0;d<w;d++)b=w-d,d&3?s=o[b]:s=o[b-4],d<4||b<=4?u[d]=s:u[d]=g[l[s>>>24]]^C[l[s>>>16&255]]^y[l[s>>>8&255]]^f[l[s&255]],u[d]=u[d]>>>0},P.networkToHostOrderSwap=function(O){return O<<24|(O&65280)<<8|(O&16711680)>>8|O>>>24},P.decrypt=function(O,E,_){for(var T=this.keySize+6,A=this.invKeySchedule,w=this.invSBox,b=this.invSubMix,d=b[0],o=b[1],u=b[2],l=b[3],S=this.uint8ArrayToUint32Array_(_),h=S[0],g=S[1],C=S[2],y=S[3],f=new Int32Array(O),c=new Int32Array(f.length),s,a,m,p,v,R,U,j,G,B,N,V,q,ie,se=this.networkToHostOrderSwap;E<f.length;){for(G=se(f[E]),B=se(f[E+1]),N=se(f[E+2]),V=se(f[E+3]),v=G^A[0],R=V^A[1],U=N^A[2],j=B^A[3],q=4,ie=1;ie<T;ie++)s=d[v>>>24]^o[R>>16&255]^u[U>>8&255]^l[j&255]^A[q],a=d[R>>>24]^o[U>>16&255]^u[j>>8&255]^l[v&255]^A[q+1],m=d[U>>>24]^o[j>>16&255]^u[v>>8&255]^l[R&255]^A[q+2],p=d[j>>>24]^o[v>>16&255]^u[R>>8&255]^l[U&255]^A[q+3],v=s,R=a,U=m,j=p,q=q+4;s=w[v>>>24]<<24^w[R>>16&255]<<16^w[U>>8&255]<<8^w[j&255]^A[q],a=w[R>>>24]<<24^w[U>>16&255]<<16^w[j>>8&255]<<8^w[v&255]^A[q+1],m=w[U>>>24]<<24^w[j>>16&255]<<16^w[v>>8&255]<<8^w[R&255]^A[q+2],p=w[j>>>24]<<24^w[v>>16&255]<<16^w[R>>8&255]<<8^w[U&255]^A[q+3],c[E]=se(s^h),c[E+1]=se(p^g),c[E+2]=se(m^C),c[E+3]=se(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"),M=L("./src/crypt/aes-decryptor.ts"),F=L("./src/utils/logger.ts"),P=L("./src/utils/mp4-tools.ts"),D=L("./src/utils/typed-array.ts"),O=16,E=function(){function _(A,w,b){var d=b===void 0?{}:b,o=d.removePKCS7Padding,u=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=A,this.config=w,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=_.prototype;return T.destroy=function(){this.observer=null},T.isSync=function(){return this.config.enableSoftwareAES},T.flush=function(){var w=this.currentResult;if(!w){this.reset();return}var b=new Uint8Array(w);return this.reset(),this.removePKCS7Padding?Object(M.removePadding)(b):b},T.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},T.decrypt=function(w,b,d,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(w),b,d);var u=this.flush();u&&o(u.buffer)}else this.webCryptoDecrypt(new Uint8Array(w),b,d).then(o)},T.softwareDecrypt=function(w,b,d){var o=this.currentIV,u=this.currentResult,l=this.remainderData;this.logOnce("JS AES decrypt"),l&&(w=Object(P.appendUint8Array)(l,w),this.remainderData=null);var S=this.getValidChunk(w);if(!S.length)return null;o&&(d=o);var h=this.softwareDecrypter;h||(h=this.softwareDecrypter=new M.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(w,b,d){var o=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(w.buffer,l)}).catch(function(l){return o.onWebCryptoError(l,w,b,d)})},T.onWebCryptoError=function(w,b,d,o){return F.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",w),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(b,d,o)},T.getValidChunk=function(w){var b=w,d=w.length-w.length%O;return d!==w.length&&(b=Object(D.sliceUint8)(w,0,d),this.remainderData=Object(D.sliceUint8)(w,d)),b},T.logOnce=function(w){if(!this.logEnabled)return;F.logger.log("[decrypter.ts]: "+w),this.logEnabled=!1},_}()},"./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,P){this.subtle=void 0,this.key=void 0,this.subtle=F,this.key=P}var M=k.prototype;return M.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"),M=L("./src/utils/logger.ts"),F=L("./src/demux/id3.ts");function P(E,_){E.prototype=Object.create(_.prototype),E.prototype.constructor=E,D(E,_)}function D(E,_){return D=Object.setPrototypeOf||function(A,w){return A.__proto__=w,A},D(E,_)}var O=function(E){P(_,E);function _(A,w){var b;return b=E.call(this)||this,b.observer=void 0,b.config=void 0,b.observer=A,b.config=w,b}var T=_.prototype;return T.resetInitSegment=function(w,b,d){E.prototype.resetInitSegment.call(this,w,b,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:w,duration:d,inputTimeScale:9e4,dropped:0}},_.probe=function(w){if(!w)return!1;for(var b=F.getID3Data(w,0)||[],d=b.length,o=w.length;d<o;d++)if(k.probe(w,d))return M.logger.log("ADTS sync word found !"),!0;return!1},T.canParse=function(w,b){return k.canParse(w,b)},T.appendFrame=function(w,b,d){k.initTrackConfig(w,this.observer,b,d,w.manifestCodec);var o=k.appendFrame(w,b,d,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},_}(H.default);O.minProbeByteLength=9,z.default=O},"./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 P}),L.d(z,"getHeaderLength",function(){return D}),L.d(z,"getFullFrameLength",function(){return O}),L.d(z,"canGetFrameLength",function(){return E}),L.d(z,"isHeader",function(){return _}),L.d(z,"canParse",function(){return T}),L.d(z,"probe",function(){return A}),L.d(z,"initTrackConfig",function(){return w}),L.d(z,"getFrameDuration",function(){return b}),L.d(z,"parseFrameHeader",function(){return d}),L.d(z,"appendFrame",function(){return o});var H=L("./src/utils/logger.ts"),k=L("./src/errors.ts"),M=L("./src/events.ts");function F(u,l,S,h){var g,C,y,f,c=navigator.userAgent.toLowerCase(),s=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(M.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:s}}function P(u,l){return u[l]===255&&(u[l+1]&246)===240}function D(u,l){return u[l+1]&1?7:9}function O(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 _(u,l){return l+1<u.length&&P(u,l)}function T(u,l){return E(u,l)&&P(u,l)&&O(u,l)<=u.length-l}function A(u,l){if(_(u,l)){var S=D(u,l);if(l+S>=u.length)return!1;var h=O(u,l);if(h<=S)return!1;var g=l+h;return g===u.length||_(u,g)}return!1}function w(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=O(u,l);if(y-=C,y>0){var f=S+h*g;return{headerLength:C,frameLength:y,stamp:f}}}function o(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,s=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:s};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 O});var H=L("./src/polyfills/number.ts"),k=L("./src/demux/id3.ts"),M=L("./src/demux/dummy-demuxed-track.ts"),F=L("./src/utils/mp4-tools.ts"),P=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 _=E.prototype;return _.resetInitSegment=function(A,w,b){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},_.resetTimeStamp=function(){},_.resetContiguity=function(){},_.canParse=function(A,w){return!1},_.appendFrame=function(A,w,b){},_.demux=function(A,w){this.cachedData&&(A=Object(F.appendUint8Array)(this.cachedData,A),this.cachedData=null);var b=k.getID3Data(A,0),d=b?b.length:0,o,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=O(h,w)),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,o=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,o=d):d++;if(d===g&&o!==g){var y=Object(P.sliceUint8)(A,o);this.cachedData?this.cachedData=Object(F.appendUint8Array)(this.cachedData,y):this.cachedData=y}}return{audioTrack:l,avcTrack:Object(M.dummyTrack)(),id3Track:S,textTrack:Object(M.dummyTrack)()}},_.demuxSampleAes=function(A,w,b){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},_.flush=function(A){var w=this.cachedData;return w&&(this.cachedData=null,this.demux(w,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(M.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(M.dummyTrack)()}},_.destroy=function(){},E}(),O=function(_,T){return Object(H.isFiniteNumber)(_)?_*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 M(){this.chunks=[],this.dataLength=0}var F=M.prototype;return F.push=function(D){this.chunks.push(D),this.dataLength+=D.length},F.flush=function(){var D=this.chunks,O=this.dataLength,E;if(D.length)D.length===1?E=D[0]:E=k(D,O);else return new Uint8Array(0);return this.reset(),E},F.reset=function(){this.chunks.length=0,this.dataLength=0},M}();function k(M,F){for(var P=new Uint8Array(F),D=0,O=0;O<M.length;O++){var E=M[O];P.set(E,D),D+=E.length}return P}},"./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 M(P){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=P,this.bytesAvailable=P.byteLength,this.word=0,this.bitsAvailable=0}var F=M.prototype;return F.loadWord=function(){var D=this.data,O=this.bytesAvailable,E=D.byteLength-O,_=new Uint8Array(4),T=Math.min(4,O);if(T===0)throw new Error("no bytes available");_.set(D.subarray(E,E+T)),this.word=new DataView(_.buffer).getUint32(0),this.bitsAvailable=T*8,this.bytesAvailable-=T},F.skipBits=function(D){var O;this.bitsAvailable>D?(this.word<<=D,this.bitsAvailable-=D):(D-=this.bitsAvailable,O=D>>3,D-=O>>3,this.bytesAvailable-=O,this.loadWord(),this.word<<=D,this.bitsAvailable-=D)},F.readBits=function(D){var O=Math.min(this.bitsAvailable,D),E=this.word>>>32-O;return D>32&&H.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=O,this.bitsAvailable>0?this.word<<=O:this.bytesAvailable>0&&this.loadWord(),O=D-O,O>0&&this.bitsAvailable?E<<O|this.readBits(O):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 O=8,E=8,_,T=0;T<D;T++)E!==0&&(_=this.readEG(),E=(O+_+256)%256),O=E===0?O:E},F.readSPS=function(){var D=0,O=0,E=0,_=0,T,A,w,b=this.readUByte.bind(this),d=this.readBits.bind(this),o=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=o();if(y===3&&l(1),h(),h(),l(1),u())for(A=y!==3?8:12,w=0;w<A;w++)u()&&(w<6?g(16):g(64))}h();var f=o();if(f===0)o();else if(f===1)for(l(1),S(),S(),T=o(),w=0;w<T;w++)S();h(),l(1);var c=o(),s=o(),a=d(1);a===0&&l(1),l(1),u()&&(D=o(),O=o(),E=o(),_=o());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-O*2),height:(2-a)*(s+1)*16-(a?2:4)*(E+_),pixelRatio:m}},F.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},M}();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 M}),L.d(z,"canParse",function(){return P}),L.d(z,"getTimeStamp",function(){return D}),L.d(z,"isTimeStampFrame",function(){return O}),L.d(z,"getID3Frames",function(){return _}),L.d(z,"decodeFrame",function(){return T}),L.d(z,"utf8ArrayToStr",function(){return o}),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)))},M=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},P=function(g,C){return H(g,C)&&F(g,C+6)+10<=g.length-C},D=function(g){for(var C=_(g),y=0;y<C.length;y++){var f=C[y];if(O(f))return d(f)}return},O=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)}},_=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 s=E(g.subarray(C)),a=T(s);a&&y.push(a),C+=s.size+10}k(g,C)&&(C+=10)}return y},T=function(g){return g.type==="PRIV"?A(g):g.type[0]==="W"?b(g):w(g)},A=function(g){if(g.size<2)return;var C=o(g.data,!0),y=new Uint8Array(g.data.subarray(C.length+1));return{key:g.type,info:C,data:y.buffer}},w=function(g){if(g.size<2)return;if(g.type==="TXXX"){var C=1,y=o(g.data.subarray(C),!0);C+=y.length+1;var f=o(g.data.subarray(C));return{key:g.type,info:y,data:f}}var c=o(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=o(g.data.subarray(C),!0);C+=y.length+1;var f=o(g.data.subarray(C));return{key:g.type,info:y,data:f}}var c=o(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},o=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 s=g.length,a,m,p,v="",R=0;R<s;){if(a=g[R++],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[R++],v+=String.fromCharCode((a&31)<<6|m&63);break;case 14:m=g[R++],p=g[R++],v+=String.fromCharCode((a&15)<<12|(m&63)<<6|(p&63)<<0);break;default:}}return v},u={decodeTextFrame:w},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"),M=L("./src/utils/logger.ts"),F=L("./src/demux/mpegaudio.ts");function P(E,_){E.prototype=Object.create(_.prototype),E.prototype.constructor=E,D(E,_)}function D(E,_){return D=Object.setPrototypeOf||function(A,w){return A.__proto__=w,A},D(E,_)}var O=function(E){P(_,E);function _(){return E.apply(this,arguments)||this}var T=_.prototype;return T.resetInitSegment=function(w,b,d){E.prototype.resetInitSegment.call(this,w,b,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:w,duration:d,inputTimeScale:9e4,dropped:0}},_.probe=function(w){if(!w)return!1;for(var b=k.getID3Data(w,0)||[],d=b.length,o=w.length;d<o;d++)if(F.probe(w,d))return M.logger.log("MPEG Audio sync word found !"),!0;return!1},T.canParse=function(w,b){return F.canParse(w,b)},T.appendFrame=function(w,b,d){return this.initPTS===null?void 0:F.appendFrame(w,b,d,this.initPTS,this.frameIndex)},_}(H.default);O.minProbeByteLength=4,z.default=O},"./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"),M=function(){function F(D,O){this.remainderData=null,this.config=void 0,this.config=O}var P=F.prototype;return P.resetTimeStamp=function(){},P.resetInitSegment=function(){},P.resetContiguity=function(){},F.probe=function(O){return Object(H.findBox)({data:O,start:0,end:Math.min(O.length,16384)},["moof"]).length>0},P.demux=function(O){var E=O,_=Object(k.dummyTrack)();if(this.config.progressive){this.remainderData&&(E=Object(H.appendUint8Array)(this.remainderData,O));var T=Object(H.segmentValidRange)(E);this.remainderData=T.remainder,_.samples=T.valid||new Uint8Array}else _.samples=E;return{audioTrack:Object(k.dummyTrack)(),avcTrack:_,id3Track:Object(k.dummyTrack)(),textTrack:Object(k.dummyTrack)()}},P.flush=function(){var O=Object(k.dummyTrack)();return O.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(k.dummyTrack)(),avcTrack:O,id3Track:Object(k.dummyTrack)(),textTrack:Object(k.dummyTrack)()}},P.demuxSampleAes=function(O,E,_){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},P.destroy=function(){},F}();M.minProbeByteLength=1024,z.default=M},"./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 O}),L.d(z,"isHeaderPattern",function(){return E}),L.d(z,"isHeader",function(){return _}),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],M=[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]],P=[0,1,1,4];function D(w,b,d,o,u){if(d+24>b.length)return;var l=O(b,d);if(l&&d+l.frameLength<=b.length){var S=l.samplesPerFrame*9e4/l.sampleRate,h=o+u*S,g={unit:b.subarray(d,d+l.frameLength),pts:h,dts:h};return w.config=[],w.channelCount=l.channelCount,w.samplerate=l.sampleRate,w.samples.push(g),{sample:g,length:l.frameLength,missing:0}}}function O(w,b){var d=w[b+1]>>3&3,o=w[b+1]>>1&3,u=w[b+2]>>4&15,l=w[b+2]>>2&3;if(d!==1&&u!==0&&u!==15&&l!==3){var S=w[b+2]>>1&1,h=w[b+3]>>6,g=d===3?3-o:o===3?3:4,C=k[g*14+u-1]*1e3,y=d===3?0:d===2?1:2,f=M[y*3+l],c=h===3?1:2,s=F[d][o],a=P[o],m=s*8*a,p=Math.floor(s*C/f+S)*a;if(H===null){var v=navigator.userAgent||"",R=v.match(/Chrome\/(\d+)/i);H=R?parseInt(R[1]):0}var U=!!H&&H<=87;return U&&o===2&&C>=224e3&&h===0&&(w[b+3]=w[b+3]|128),{sampleRate:f,channelCount:c,frameLength:p,samplesPerFrame:m}}}function E(w,b){return w[b]===255&&(w[b+1]&224)===224&&(w[b+1]&6)!==0}function _(w,b){return b+1<w.length&&E(w,b)}function T(w,b){var d=4;return E(w,b)&&d<=w.length-b}function A(w,b){if(b+1<w.length&&E(w,b)){var d=4,o=O(w,b),u=d;o!=null&&o.frameLength&&(u=o.frameLength);var l=b+u;return l===w.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"),M=function(){function F(D,O,E){this.keyData=void 0,this.decrypter=void 0,this.keyData=E,this.decrypter=new H.default(D,O,{removePKCS7Padding:!1})}var P=F.prototype;return P.decryptBuffer=function(O,E){this.decrypter.decrypt(O,this.keyData.key.buffer,this.keyData.iv.buffer,E)},P.decryptAacSample=function(O,E,_,T){var A=O[E].unit,w=A.subarray(16,A.length-A.length%16),b=w.buffer.slice(w.byteOffset,w.byteOffset+w.length),d=this;this.decryptBuffer(b,function(o){var u=new Uint8Array(o);A.set(u,16),T||d.decryptAacSamples(O,E+1,_)})},P.decryptAacSamples=function(O,E,_){for(;;E++){if(E>=O.length){_();return}if(O[E].unit.length<32)continue;var T=this.decrypter.isSync();if(this.decryptAacSample(O,E,_,T),!T)return}},P.getAvcEncryptedData=function(O){for(var E=Math.floor((O.length-48)/160)*16+16,_=new Int8Array(E),T=0,A=32;A<=O.length-16;A+=160,T+=16)_.set(O.subarray(A,A+16),T);return _},P.getAvcDecryptedUnit=function(O,E){for(var _=new Uint8Array(E),T=0,A=32;A<=O.length-16;A+=160,T+=16)O.set(_.subarray(T,T+16),A);return O},P.decryptAvcSample=function(O,E,_,T,A,w){var b=Object(k.discardEPB)(A.data),d=this.getAvcEncryptedData(b),o=this;this.decryptBuffer(d.buffer,function(u){A.data=o.getAvcDecryptedUnit(b,u),w||o.decryptAvcSamples(O,E,_+1,T)})},P.decryptAvcSamples=function(O,E,_,T){if(O instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;E++,_=0){if(E>=O.length){T();return}for(var A=O[E].units;!(_>=A.length);_++){var w=A[_];if(w.data.length<=48||w.type!==1&&w.type!==5)continue;var b=this.decrypter.isSync();if(this.decryptAvcSample(O,E,_,T,w,b),!b)return}}},F}();z.default=M},"./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),M=L("./src/events.ts"),F=L("./src/demux/transmuxer.ts"),P=L("./src/utils/logger.ts"),D=L("./src/errors.ts"),O=L("./src/utils/mediasource-helper.ts"),E=L("./node_modules/eventemitter3/index.js"),_=L.n(E),T=Object(O.getMediaSource)()||{isTypeSupported:function(){return!1}},A=function(){function w(d,o,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=o,this.onTransmuxComplete=u,this.onFlush=l;var h=d.config,g=function(s,a){a=a||{},a.frag=S.frag,a.id=S.id,d.trigger(s,a)};this.observer=new E.EventEmitter,this.observer.on(M.Events.FRAG_DECRYPTED,g),this.observer.on(M.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"){P.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(M.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:o,config:JSON.stringify(h)})}catch(c){P.logger.warn("Error in worker:",c),P.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,o),this.worker=null}}else this.transmuxer=new F.default(this.observer,C,h,y,o)}var b=w.prototype;return b.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var u=this.transmuxer;u&&(u.destroy(),this.transmuxer=null)}var l=this.observer;l&&l.removeAllListeners(),this.observer=null},b.push=function(o,u,l,S,h,g,C,y,f,c){var s=this;f.transmuxing.start=self.performance.now();var a=this.transmuxer,m=this.worker,p=g?g.start:h.start,v=h.decryptdata,R=this.frag,U=!(R&&h.cc===R.cc),j=!(R&&f.level===R.level),G=R?f.sn-R.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 q=new F.TransmuxState(U,N,y,j,p);if(!N||U){P.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:o,decryptdata:v,chunkMeta:f,state:q},o instanceof ArrayBuffer?[o]:[]);else if(a){var se=a.push(o,v,f,q);Object(F.isPromise)(se)?se.then(function(xe){s.handleTransmuxComplete(xe)}):this.handleTransmuxComplete(se)}},b.flush=function(o){var u=this;o.transmuxing.start=self.performance.now();var l=this.transmuxer,S=this.worker;if(S)S.postMessage({cmd:"flush",chunkMeta:o});else if(l){var h=l.flush(o);Object(F.isPromise)(h)?h.then(function(g){u.handleFlushResult(g,o)}):this.handleFlushResult(h,o)}},b.handleFlushResult=function(o,u){var l=this;o.forEach(function(S){l.handleTransmuxComplete(S)}),this.onFlush(u)},b.onWorkerMessage=function(o){var u=o.data,l=this.hls;switch(u.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.id=this.id,l.trigger(u.event,u.data);break}}},b.configureTransmuxer=function(o){var u=this.worker,l=this.transmuxer;u?u.postMessage({cmd:"configure",config:o}):l&&l.configure(o)},b.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},w}()},"./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"),M=L("./src/utils/logger.ts"),F=L("./node_modules/eventemitter3/index.js"),P=L.n(F);function D(A){var w=new F.EventEmitter,b=function(o,u){A.postMessage({event:o,data:u})};w.on(k.Events.FRAG_DECRYPTED,b),w.on(k.Events.ERROR,b),A.addEventListener("message",function(d){var o=d.data;switch(o.cmd){case"init":{var u=JSON.parse(o.config);A.transmuxer=new H.default(w,o.typeSupported,u,o.vendor,o.id),Object(M.enableLogs)(u.debug),b("init",null);break}case"configure":{A.transmuxer.configure(o.config);break}case"demux":{var l=A.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(H.isPromise)(l)?l.then(function(g){O(A,g)}):O(A,l);break}case"flush":{var S=o.chunkMeta,h=A.transmuxer.flush(S);Object(H.isPromise)(h)?h.then(function(g){_(A,g,S)}):_(A,h,S);break}default:break}})}function O(A,w){if(T(w.remuxResult))return;var b=[],d=w.remuxResult,o=d.audio,u=d.video;o&&E(b,o),u&&E(b,u),A.postMessage({event:"transmuxComplete",data:w},b)}function E(A,w){w.data1&&A.push(w.data1.buffer),w.data2&&A.push(w.data2.buffer)}function _(A,w,b){w.forEach(function(d){O(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"),M=L("./src/crypt/decrypter.ts"),F=L("./src/demux/aacdemuxer.ts"),P=L("./src/demux/mp4demuxer.ts"),D=L("./src/demux/tsdemuxer.ts"),O=L("./src/demux/mp3demuxer.ts"),E=L("./src/remux/mp4-remuxer.ts"),_=L("./src/remux/passthrough-remuxer.ts"),T=L("./src/demux/chunk-cache.ts"),A=L("./src/utils/mp4-tools.ts"),w=L("./src/utils/logger.ts"),b;try{b=self.performance.now.bind(self.performance)}catch(y){w.logger.debug("Unable to use Performance API on this environment"),b=self.Date.now}var d=[{demux:D.default,remux:E.default},{demux:P.default,remux:_.default},{demux:F.default,remux:E.default},{demux:O.default,remux:E.default}],o=1024;d.forEach(function(y){var f=y.demux;o=Math.max(o,f.minProbeByteLength)});var u=function(){function y(c,s,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=s,this.config=a,this.vendor=m,this.id=p}var f=y.prototype;return f.configure=function(s){this.transmuxConfig=s,this.decrypter&&this.decrypter.reset()},f.push=function(s,a,m,p){var v=this,R=m.transmuxing;R.executeStart=b();var U=new Uint8Array(s),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 q=this.getDecrypter();if(G.enableSoftwareAES){var ie=q.softwareDecrypt(U,V.key.buffer,V.iv.buffer);if(!ie)return R.executeEnd=b(),S(m);U=new Uint8Array(ie)}else return this.decryptionPromise=q.webCryptoDecrypt(U,V.key.buffer,V.iv.buffer).then(function(Ae){var Ue=v.push(Ae,null,m);return v.decryptionPromise=null,Ue}),this.decryptionPromise}var se=p||B,xe=se.contiguous,fe=se.discontinuity,Ee=se.trackSwitch,ge=se.accurateTimeOffset,ve=se.timeOffset,le=N.audioCodec,ue=N.videoCodec,be=N.defaultInitPts,je=N.duration,Be=N.initSegmentData;if((fe||Ee)&&this.resetInitSegment(Be,le,ue,je),fe&&this.resetInitialTimestamp(be),xe||this.resetContiguity(),this.needsProbing(U,fe,Ee)){if(j.dataLength){var ke=j.flush();U=Object(A.appendUint8Array)(ke,U)}this.configureTransmuxer(U,N)}var Me=this.transmux(U,V,ve,ge,m),we=this.currentTransmuxState;return we.contiguous=!0,we.discontinuity=!1,we.trackSwitch=!1,R.executeEnd=b(),Me},f.flush=function(s){var a=this,m=s.transmuxing;m.executeStart=b();var p=this.decrypter,v=this.cache,R=this.currentTransmuxState,U=this.decryptionPromise;if(U)return U.then(function(){return a.flush(s)});var j=[],G=R.timeOffset;if(p){var B=p.flush();B&&j.push(this.push(B,null,s))}var N=v.dataLength;v.reset();var V=this.demuxer,q=this.remuxer;if(!V||!q)return N>=o&&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(s)];var ie=V.flush(G);return h(ie)?ie.then(function(se){return a.flushRemux(j,se,s),j}):(this.flushRemux(j,ie,s),j)},f.flushRemux=function(s,a,m){var p=a.audioTrack,v=a.avcTrack,R=a.id3Track,U=a.textTrack,j=this.currentTransmuxState,G=j.accurateTimeOffset,B=j.timeOffset;w.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,R,U,B,G,!0,this.id);s.push({remuxResult:N,chunkMeta:m}),m.transmuxing.executeEnd=b()},f.resetInitialTimestamp=function(s){var a=this.demuxer,m=this.remuxer;if(!a||!m)return;a.resetTimeStamp(s),m.resetTimeStamp(s)},f.resetContiguity=function(){var s=this.demuxer,a=this.remuxer;if(!s||!a)return;s.resetContiguity(),a.resetNextTimestamp()},f.resetInitSegment=function(s,a,m,p){var v=this.demuxer,R=this.remuxer;if(!v||!R)return;v.resetInitSegment(a,m,p),R.resetInitSegment(s,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(s,a,m,p,v){var R;return a&&a.method==="SAMPLE-AES"?R=this.transmuxSampleAes(s,a,m,p,v):R=this.transmuxUnencrypted(s,m,p,v),R},f.transmuxUnencrypted=function(s,a,m,p){var v=this.demuxer.demux(s,a,!1,!this.config.progressive),R=v.audioTrack,U=v.avcTrack,j=v.id3Track,G=v.textTrack,B=this.remuxer.remux(R,U,j,G,a,m,!1,this.id);return{remuxResult:B,chunkMeta:p}},f.transmuxSampleAes=function(s,a,m,p,v){var R=this;return this.demuxer.demuxSampleAes(s,a,m).then(function(U){var j=R.remuxer.remux(U.audioTrack,U.avcTrack,U.id3Track,U.textTrack,m,p,!1,R.id);return{remuxResult:j,chunkMeta:v}})},f.configureTransmuxer=function(s,a){for(var m=this.config,p=this.observer,v=this.typeSupported,R=this.vendor,U=a.audioCodec,j=a.defaultInitPts,G=a.duration,B=a.initSegmentData,N=a.videoCodec,V,q=0,ie=d.length;q<ie;q++)if(d[q].demux.probe(s)){V=d[q];break}V||(w.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),V={demux:P.default,remux:_.default});var se=this.demuxer,xe=this.remuxer,fe=V.remux,Ee=V.demux;(!xe||!(xe instanceof fe))&&(this.remuxer=new fe(p,m,v,R)),(!se||!(se instanceof Ee))&&(this.demuxer=new Ee(p,m,v),this.probe=Ee.probe),this.resetInitSegment(B,U,N,G),this.resetInitialTimestamp(j)},f.needsProbing=function(s,a,m){return!this.demuxer||!this.remuxer||a||m},f.getDecrypter=function(){var s=this.decrypter;return s||(s=this.decrypter=new M.default(this.observer,this.config)),s},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,s,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=s,this.duration=a,this.defaultInitPts=m},C=function(f,c,s,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=s,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"),M=L("./src/demux/exp-golomb.ts"),F=L("./src/demux/id3.ts"),P=L("./src/demux/sample-aes.ts"),D=L("./src/events.ts"),O=L("./src/utils/mp4-tools.ts"),E=L("./src/utils/logger.ts"),_=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,s){c===void 0&&(c=!1),s===void 0&&(s=!1),c||(this.sampleAes=null);var a,m=this._avcTrack,p=this._audioTrack,v=this._id3Track,R=m.pid,U=m.pesData,j=p.pid,G=v.pid,B=p.pesData,N=v.pesData,V=!1,q=this.pmtParsed,ie=this._pmtId,se=y.length;if(this.remainderData&&(y=Object(O.appendUint8Array)(this.remainderData,y),se=y.length,this.remainderData=null),se<188&&!s)return this.remainderData=y,{audioTrack:p,avcTrack:m,id3Track:v,textTrack:this._txtTrack};var xe=Math.max(0,h.syncOffset(y));se-=(se+xe)%188,se<y.byteLength&&!s&&(this.remainderData=new Uint8Array(y.buffer,se,y.buffer.byteLength-se));for(var fe=xe;fe<se;fe+=188)if(y[fe]===71){var Ee=!!(y[fe+1]&64),ge=((y[fe+1]&31)<<8)+y[fe+2],ve=(y[fe+3]&48)>>4,le=void 0;if(ve>1){if(le=fe+5+y[fe+4],le===fe+188)continue}else le=fe+4;switch(ge){case R:Ee&&(U&&(a=o(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:Ee&&(B&&(a=o(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:Ee&&(N&&(a=o(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:Ee&&(le+=y[le]+1),ie=this._pmtId=b(y,le);break;case ie:{Ee&&(le+=y[le]+1);var ue=d(y,le,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);R=ue.avc,R>0&&(m.pid=R),j=ue.audio,j>0&&(p.pid=j,p.isAAC=ue.isAAC),G=ue.id3,G>0&&(v.pid=G),V&&!q&&(E.logger.log("reparse from beginning"),V=!1,fe=xe-188),q=this.pmtParsed=!0;break}case 17:case 8191:break;default:V=!0;break}}else this.observer.emit(D.Events.ERROR,D.Events.ERROR,{type:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});m.pesData=U,p.pesData=B,v.pesData=N;var be={audioTrack:p,avcTrack:m,id3Track:v,textTrack:this._txtTrack};return s&&this.extractRemainingSamples(be),be},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,s=y.id3Track,a=c.pesData,m=f.pesData,p=s.pesData,v;a&&(v=o(a))?(this.parseAVCPES(v,!0),c.pesData=null):c.pesData=a,m&&(v=o(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=o(p))?(this.parseID3PES(v),s.pesData=null):s.pesData=p},g.demuxSampleAes=function(y,f,c){var s=this.demux(y,c,!0,!this.config.progressive),a=this.sampleAes=new P.default(this.observer,this.config,f);return this.decrypt(s,a)},g.decrypt=function(y,f){return new Promise(function(c){var s=y.audioTrack,a=y.avcTrack;s.samples&&s.isAAC?f.decryptAacSamples(s.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,s=this._avcTrack,a=this.parseAVCNALu(y.data),m=!1,p=this.avcSample,v,R=!1;y.data=null,p&&a.length&&!s.audFound&&(u(p,s),p=this.avcSample=w(!1,y.pts,y.dts,"")),a.forEach(function(U){switch(U.type){case 1:{v=!0,p||(p=c.avcSample=w(!0,y.pts,y.dts,"")),m&&(p.debug+="NDR "),p.frame=!0;var j=U.data;if(R&&j.length>4){var G=new M.default(j).readSliceType();(G===2||G===4||G===7||G===9)&&(p.key=!0)}break}case 5:v=!0,p||(p=c.avcSample=w(!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 M.default(S(U.data));B.readUByte();for(var N=0,V=0,q=!1,ie=0;!q&&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){q=!0;var se=B.readUByte();if(se===181){var xe=B.readUShort();if(xe===49){var fe=B.readUInt();if(fe===1195456820){var Ee=B.readUByte();if(Ee===3){for(var ge=B.readUByte(),ve=B.readUByte(),le=31&ge,ue=[ge,ve],be=0;be<le;be++)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(q=!0,V>16){for(var je=[],Be=0;Be<16;Be++)je.push(B.readUByte().toString(16)),(Be===3||Be===5||Be===7||Be===9)&&je.push("-");for(var ke=V-16,Me=new Uint8Array(ke),we=0;we<ke;we++)Me[we]=B.readUByte();l(c._txtTrack.samples,{pts:y.pts,payloadType:N,uuid:je.join(""),userData:Object(F.utf8ArrayToStr)(Me),userDataBytes:Me})}}else if(V<B.bytesAvailable)for(var Ae=0;Ae<V;Ae++)B.readUByte()}break}case 7:if(v=!0,R=!0,m&&p&&(p.debug+="SPS "),!s.sps){var Ue=new M.default(U.data),Ge=Ue.readSPS();s.width=Ge.width,s.height=Ge.height,s.pixelRatio=Ge.pixelRatio,s.sps=[U.data],s.duration=c._duration;for(var He=U.data.subarray(1,4),_e="avc1.",Te=0;Te<3;Te++){var Ce=He[Te].toString(16);Ce.length<2&&(Ce="0"+Ce),_e+=Ce}s.codec=_e}break;case 8:v=!0,m&&p&&(p.debug+="PPS "),s.pps||(s.pps=[U.data]);break;case 9:v=!1,s.audFound=!0,p&&u(p,s),p=c.avcSample=w(!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,s),this.avcSample=null)},g.getLastNalUnit=function(){var y,f=this.avcSample,c;if(!f||f.units.length===0){var s=this._avcTrack.samples;f=s[s.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,s=c.naluState||0,a=s,m=[],p=0,v,R,U,j=-1,G=0;for(s===-1&&(j=0,G=y[0]&31,s=0,p=1);p<f;){if(v=y[p++],!s){s=v?0:1;continue}if(s===1){s=v?0:2;continue}if(!v)s=3;else if(v===1){if(j>=0){var B={data:y.subarray(j,p-s-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))),R=p-s-1,R>0)){var V=new Uint8Array(N.data.byteLength+R);V.set(N.data,0),V.set(y.subarray(0,R),N.data.byteLength),N.data=V,N.state=0}}p<f?(U=y[p]&31,j=p,G=U,s=0):s=-1}else s=0}if(j>=0&&s>=0){var q={data:y.subarray(j,f),type:G,state:s};m.push(q)}if(m.length===0){var ie=this.getLastNalUnit();if(ie){var se=new Uint8Array(ie.data.byteLength+y.byteLength);se.set(ie.data,0),se.set(y,ie.data.byteLength),ie.data=se}}return c.naluState=s,m},g.parseAACPES=function(y){var f=0,c=this._audioTrack,s=this.aacOverFlow,a=y.data;if(s){this.aacOverFlow=null;var m=s.sample.unit.byteLength,p=Math.min(s.missing,m),v=m-p;s.sample.unit.set(a.subarray(0,p),v),c.samples.push(s.sample),f=s.missing}var R,U;for(R=f,U=a.length;R<U-1&&!H.isHeader(a,R);R++);if(R!==f){var j,G;if(R<U-1?(j="AAC PES did not start with ADTS header,offset:"+R,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:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.FRAG_PARSING_ERROR,fatal:G,reason:j}),G)return}H.initTrackConfig(c,this.observer,a,R,this.audioCodec);var B;if(y.pts!==void 0)B=y.pts;else if(s){var N=H.getFrameDuration(c.samplerate);B=s.sample.pts+N}else{E.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var V=0;R<U;)if(H.isHeader(a,R)){if(R+5<U){var q=H.appendFrame(c,a,R,B,V);if(q)if(q.missing)this.aacOverFlow=q;else{R+=q.length,V++;continue}}break}else R++},g.parseMPEGPES=function(y){var f=y.data,c=f.length,s=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,s);if(p)a+=p.length,s++;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 w(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],s=g+3+c-4,a=(h[g+10]&15)<<8|h[g+11];for(g+=12+a;g<s;){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 o(h){var g=0,C,y,f,c,s,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?(s=(C[14]&14)*536870912+(C[15]&255)*4194304+(C[16]&254)*16384+(C[17]&255)*128+(C[18]&254)/2,c-s>60*9e4&&(E.logger.warn(Math.round((c-s)/9e4)+"s delta between PTS and DTS, align them"),c=s)):s=c),f=C[8];var R=f+9;if(h.size<=R)return null;h.size-=R;for(var U=new Uint8Array(h.size),j=0,G=a.length;j<G;j++){C=a[j];var B=C.byteLength;if(R)if(R>B){R-=B;continue}else C=C.subarray(R),B-=R,R=0;U.set(C,g),g+=B}return y&&(y-=f+3),{data:U,pts:c,dts:s,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),s=0;for(y=0;y<f;s++,y++)s===C[0]&&(s++,C.shift()),c[y]=h[s];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(M){M.NETWORK_ERROR="networkError",M.MEDIA_ERROR="mediaError",M.KEY_SYSTEM_ERROR="keySystemError",M.MUX_ERROR="muxError",M.OTHER_ERROR="otherError"})(H||(H={}));var k;(function(M){M.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",M.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",M.KEY_SYSTEM_NO_SESSION="keySystemNoSession",M.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",M.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",M.MANIFEST_LOAD_ERROR="manifestLoadError",M.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",M.MANIFEST_PARSING_ERROR="manifestParsingError",M.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",M.LEVEL_EMPTY_ERROR="levelEmptyError",M.LEVEL_LOAD_ERROR="levelLoadError",M.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",M.LEVEL_SWITCH_ERROR="levelSwitchError",M.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",M.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",M.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",M.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",M.FRAG_LOAD_ERROR="fragLoadError",M.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",M.FRAG_DECRYPT_ERROR="fragDecryptError",M.FRAG_PARSING_ERROR="fragParsingError",M.REMUX_ALLOC_ERROR="remuxAllocError",M.KEY_LOAD_ERROR="keyLoadError",M.KEY_LOAD_TIMEOUT="keyLoadTimeOut",M.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",M.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",M.BUFFER_APPEND_ERROR="bufferAppendError",M.BUFFER_APPENDING_ERROR="bufferAppendingError",M.BUFFER_STALLED_ERROR="bufferStalledError",M.BUFFER_FULL_ERROR="bufferFullError",M.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",M.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",M.INTERNAL_EXCEPTION="internalException",M.INTERNAL_ABORTED="aborted",M.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),M=L("./src/loader/playlist-loader.ts"),F=L("./src/loader/key-loader.ts"),P=L("./src/controller/id3-track-controller.ts"),D=L("./src/controller/latency-controller.ts"),O=L("./src/controller/level-controller.ts"),E=L("./src/controller/fragment-tracker.ts"),_=L("./src/controller/stream-controller.ts"),T=L("./src/is-supported.ts"),A=L("./src/utils/logger.ts"),w=L("./src/config.ts"),b=L("./node_modules/eventemitter3/index.js"),d=L.n(b),o=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(w.mergeConfig)(g.DefaultConfig,y);this.userConfig=y,Object(A.enableLogs)(f.debug),this._autoLevelCapping=-1,f.progressive&&Object(w.enableStreamingMode)(f);var c=f.abrController,s=f.bufferController,a=f.capLevelController,m=f.fpsController,p=this.abrController=new c(this),v=this.bufferController=new s(this),R=this.capLevelController=new a(this),U=new m(this),j=new M.default(this),G=new F.default(this),B=new P.default(this),N=this.levelController=new O.default(this),V=new E.FragmentTracker(this),q=this.streamController=new _.default(this,V);R.setStreamController(q),U.setStreamController(q);var ie=[N,q];this.networkControllers=ie;var se=[j,G,p,v,R,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,se),this.emeController=this.createController(f.emeController,null,se),this.cmcdController=this.createController(f.cmcdController,null,se),this.latencyController=this.createController(D.default,null,se),this.coreComponents=se}var C=g.prototype;return C.createController=function(f,c,s){if(f){var a=c?new f(this,c):new f(this);return s&&s.push(a),a}return null},C.on=function(f,c,s){s===void 0&&(s=this),this._emitter.on(f,c,s)},C.once=function(f,c,s){s===void 0&&(s=this),this._emitter.once(f,c,s)},C.removeAllListeners=function(f){this._emitter.removeAllListeners(f)},C.off=function(f,c,s,a){s===void 0&&(s=this),this._emitter.off(f,c,s,a)},C.listeners=function(f){return this._emitter.listeners(f)},C.emit=function(f,c,s){return this._emitter.emit(f,c,s)},C.trigger=function(f,c){if(this.config.debug)return this.emit(f,f,c);try{return this.emit(f,f,c)}catch(s){A.logger.error("An internal error happened while handling event "+f+'. Error message: "'+s.message+'". Here is a stacktrace:',s),this.trigger(o.Events.ERROR,{type:u.ErrorTypes.OTHER_ERROR,details:u.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:f,error:s})}return!1},C.listenerCount=function(f){return this._emitter.listenerCount(f)},C.destroy=function(){A.logger.log("destroy"),this.trigger(o.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(o.Events.MEDIA_ATTACHING,{media:f})},C.detachMedia=function(){A.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},C.loadSource=function(f){this.stopLoad();var c=this.media,s=this.url,a=this.url=H.buildAbsoluteURL(self.location.href,f,{alwaysNormalize:!0});A.logger.log("loadSource:"+a),c&&s&&s!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.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 s=f.length,a=0;a<s;a++)if(f[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var f=this.levels,c=this.autoLevelCapping,s;return c===-1&&f&&f.length?s=f.length-1:s=c,s}},{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 o.Events}},{key:"ErrorTypes",get:function(){return u.ErrorTypes}},{key:"ErrorDetails",get:function(){return u.ErrorDetails}},{key:"DefaultConfig",get:function(){return g.defaultConfig?g.defaultConfig:w.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 M}),L.d(z,"changeTypeSupported",function(){return F});var H=L("./src/utils/mediasource-helper.ts");function k(){return self.SourceBuffer||self.WebKitSourceBuffer}function M(){var P=Object(H.getMediaSource)();if(!P)return!1;var D=k(),O=P&&typeof P.isTypeSupported=="function"&&P.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),E=!D||D.prototype&&typeof D.prototype.appendBuffer=="function"&&typeof D.prototype.remove=="function";return!!O&&!!E}function F(){var P,D=k();return typeof(D==null||((P=D.prototype)===null||P===void 0)?void 0:P.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 M(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,E(d,o)}function F(d){var o=typeof Map=="function"?new Map:void 0;return F=function(l){if(l===null||!O(l))return l;if(typeof l!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(l))return o.get(l);o.set(l,S)}function S(){return P(l,arguments,_(this).constructor)}return S.prototype=Object.create(l.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),E(S,l)},F(d)}function P(d,o,u){return D()?P=Reflect.construct:P=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},P.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 O(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function E(d,o){return E=Object.setPrototypeOf||function(l,S){return l.__proto__=S,l},E(d,o)}function _(d){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(u){return u.__proto__||Object.getPrototypeOf(u)},_(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 o=d.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(l,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,s){h.loader&&h.loader.destroy();var a=h.loader=l.loader=y?new y(C):new f(C),m=w(l),p={timeout:C.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:C.fragLoadingMaxRetryTimeout,highWaterMark:T};l.stats=a.stats,a.load(m,p,{onSuccess:function(R,U,j,G){h.resetLoader(l,a),c({frag:l,part:null,payload:R.data,networkDetails:G})},onError:function(R,U,j){h.resetLoader(l,a),s(new b({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,response:R,networkDetails:j}))},onAbort:function(R,U,j){h.resetLoader(l,a),s(new b({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,networkDetails:j}))},onTimeout:function(R,U,j){h.resetLoader(l,a),s(new b({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,networkDetails:j}))},onProgress:function(R,U,j,G){S&&S({frag:l,part:null,payload:j,networkDetails:G})}})})},o.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,s){g.loader&&g.loader.destroy();var a=g.loader=l.loader=y?new y(C):new f(C),m=w(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(R,U,j,G){g.resetLoader(l,a),g.updateStatsFromPart(l,S);var B={frag:l,part:S,payload:R.data,networkDetails:G};h(B),c(B)},onError:function(R,U,j){g.resetLoader(l,a),s(new b({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,part:S,response:R,networkDetails:j}))},onAbort:function(R,U,j){l.stats.aborted=S.stats.aborted,g.resetLoader(l,a),s(new b({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,part:S,networkDetails:j}))},onTimeout:function(R,U,j){g.resetLoader(l,a),s(new b({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,part:S,networkDetails:j}))}})})},o.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,s=c*Math.round(h.loaded/f);h.total=h.loaded+s}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},o.resetLoader=function(l,S){l.loader=null,this.loader===S&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),S.destroy()},d}();function w(d,o){o===void 0&&(o=null);var u=o||d,l={frag:d,part:o,responseType:"arraybuffer",url:u.url,headers:{},rangeStart:0,rangeEnd:0},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){M(o,d);function o(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 o}(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 w}),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"),M=L.n(k),F=L("./src/utils/logger.ts"),P=L("./src/loader/level-key.ts"),D=L("./src/loader/load-stats.ts");function O(o,u){o.prototype=Object.create(u.prototype),o.prototype.constructor=o,E(o,u)}function E(o,u){return E=Object.setPrototypeOf||function(S,h){return S.__proto__=h,S},E(o,u)}function _(o,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(o,S.key,S)}}function T(o,u,l){return u&&_(o.prototype,u),l&&_(o,l),o}var A;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(A||(A={}));var w=function(){function o(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=o.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(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(k.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(S){this._url=S}}]),o}(),b=function(o){O(u,o);function u(S,h){var g;return g=o.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=P.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 s=this.elementaryStreams,a=s[h];if(!a){s[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}(w),d=function(o){O(u,o);function u(l,S,h,g,C){var y;y=o.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}(w)},"./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"),M=L("./src/utils/logger.ts"),F=function(){function P(O){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=O,this._registerListeners()}var D=P.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 _=this.loaders[E];_&&_.destroy()}this.loaders={}},D.onKeyLoading=function(E,_){var T=_.frag,A=T.type,w=this.loaders[A];if(!T.decryptdata){M.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(w&&(M.logger.warn("abort previous key loader for type:"+A),w.abort()),!b){M.logger.warn("key uri is falsy");return}var o=d.loader,u=T.loader=this.loaders[A]=new o(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,_,T){var A=T.frag;if(!A.decryptdata){M.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,_){var T=_.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,_){var T=_.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})},P}()},"./src/loader/level-details.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"LevelDetails",function(){return P});var H=L("./src/polyfills/number.ts");function k(D,O){for(var E=0;E<O.length;E++){var _=O[E];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(D,_.key,_)}}function M(D,O,E){return O&&k(D.prototype,O),E&&k(D,E),D}var F=10,P=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 O=D.prototype;return O.reloaded=function(_){if(!_){this.advanced=!0,this.updated=!0;return}var T=this.lastPartSn-_.lastPartSn,A=this.lastPartIndex-_.lastPartIndex;this.updated=this.endSN!==_.endSN||!!A||!!T,this.advanced=this.endSN>_.endSN||T>0||T===0&&A>0,this.updated||this.advanced?this.misses=Math.floor(_.misses*.6):this.misses=_.misses+1,this.availabilityDelay=_.availabilityDelay},M(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 _=this.driftEndTime-this.driftStartTime;if(_>0){var T=this.driftEnd-this.driftStart;return T*1e3/_}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var _;return(_=this.partList)!==null&&_!==void 0&&_.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var _;return(_=this.fragments)!==null&&_!==void 0&&_.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 _;return(_=this.partList)!==null&&_!==void 0&&_.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var _;return(_=this.partList)!==null&&_!==void 0&&_.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 P});var H=L("./node_modules/url-toolkit/src/url-toolkit.js"),k=L.n(H);function M(D,O){for(var E=0;E<O.length;E++){var _=O[E];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(D,_.key,_)}}function F(D,O,E){return O&&M(D.prototype,O),E&&M(D,E),D}var P=function(){D.fromURL=function(E,_){return new D(E,_)},D.fromURI=function(E){return new D(E)};function D(O,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)(O,E,{alwaysNormalize:!0}):this._uri=O}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"),M=L.n(k),F=L("./src/loader/fragment.ts"),P=L("./src/loader/level-details.ts"),D=L("./src/loader/level-key.ts"),O=L("./src/utils/attr-list.ts"),E=L("./src/utils/logger.ts"),_=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,w=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 o(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 s=0;s<f.length;s++){var a=f[s];if(a.id===c)return a}},C.convertAVC1ToAVCOTI=function(f){var c=f.split(".");if(c.length>2){var s=c.shift()+".";return s+=parseInt(c.shift()).toString(16),s+=("000"+parseInt(c.shift()).toString(16)).substr(-4),s}return f},C.resolve=function(f,c){return k.buildAbsoluteURL(c,f,{alwaysNormalize:!0})},C.parseMasterPlaylist=function(f,c){var s=[],a={},m=!1;T.lastIndex=0;for(var p;(p=T.exec(f))!=null;)if(p[1]){var v=new O.AttrList(p[1]),R={attrs:v,bitrate:v.decimalInteger("AVERAGE-BANDWIDTH")||v.decimalInteger("BANDWIDTH"),name:v.NAME,url:C.resolve(p[2],c)},U=v.decimalResolution("RESOLUTION");U&&(R.width=U.width,R.height=U.height),l((v.CODECS||"").split(/[ ,]+/).filter(function(G){return G}),R),R.videoCodec&&R.videoCodec.indexOf("avc1")!==-1&&(R.videoCodec=C.convertAVC1ToAVCOTI(R.videoCodec)),s.push(R)}else if(p[3]){var j=new O.AttrList(p[3]);j["DATA-ID"]&&(m=!0,a[j["DATA-ID"]]=j)}return{levels:s,sessionData:m?a:null}},C.parseMasterPlaylistMedia=function(f,c,s,a){a===void 0&&(a=[]);var m,p=[],v=0;for(A.lastIndex=0;(m=A.exec(f))!==null;){var R=new O.AttrList(m[1]);if(R.TYPE===s){var U={attrs:R,bitrate:0,id:v++,groupId:R["GROUP-ID"],instreamId:R["INSTREAM-ID"],name:R.NAME||R.LANGUAGE||"",type:s,default:R.bool("DEFAULT"),autoselect:R.bool("AUTOSELECT"),forced:R.bool("FORCED"),lang:R.LANGUAGE,url:R.URI?C.resolve(R.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,s,a,m){var p=new P.LevelDetails(c),v=p.fragments,R=null,U=0,j=0,G=0,B=0,N=null,V=new F.Fragment(a,c),q,ie,se,xe=-1,fe=!1;for(w.lastIndex=0,p.m3u8=f;(q=w.exec(f))!==null;){fe&&(fe=!1,V=new F.Fragment(a,c),V.start=G,V.sn=U,V.cc=B,V.level=s,R&&(V.initSegment=R,V.rawProgramDateTime=R.rawProgramDateTime));var Ee=q[1];if(Ee){V.duration=parseFloat(Ee);var ge=(" "+q[2]).slice(1);V.title=ge||null,V.tagList.push(ge?["INF",Ee,ge]:["INF",Ee])}else if(q[3])Object(H.isFiniteNumber)(V.duration)&&(V.start=G,se&&(V.levelkey=se),V.sn=U,V.level=s,V.cc=B,V.urlId=m,v.push(V),V.relurl=(" "+q[3]).slice(1),g(V,N),N=V,G+=V.duration,U++,j=0,fe=!0);else if(q[4]){var ve=(" "+q[4]).slice(1);N?V.setByteRange(ve,N):V.setByteRange(ve)}else if(q[5])V.rawProgramDateTime=(" "+q[5]).slice(1),V.tagList.push(["PROGRAM-DATE-TIME",V.rawProgramDateTime]),xe===-1&&(xe=v.length);else{if(q=q[0].match(b),!q){E.logger.warn("No matches on slow regex match for level playlist!");continue}for(ie=1;ie<q.length&&!(typeof q[ie]!="undefined");ie++);var le=(" "+q[ie]).slice(1),ue=(" "+q[ie+1]).slice(1),be=q[ie+2]?(" "+q[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 je=new O.AttrList(ue),Be=je.decimalInteger("SKIPPED-SEGMENTS");if(Object(H.isFiniteNumber)(Be)){p.skippedSegments=Be;for(var ke=Be;ke--;)v.unshift(null);U+=Be}var Me=je.enumeratedString("RECENTLY-REMOVED-DATERANGES");Me&&(p.recentlyRemovedDateranges=Me.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||be)&&V.tagList.push(be?[ue,be]:[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 we,Ae=new O.AttrList(ue),Ue=Ae.enumeratedString("METHOD"),Ge=Ae.URI,He=Ae.hexadecimalInteger("IV"),_e=Ae.enumeratedString("KEYFORMATVERSIONS"),Te=Ae.enumeratedString("KEYID"),Ce=(we=Ae.enumeratedString("KEYFORMAT"))!=null?we:"identity",Re=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Re.indexOf(Ce)>-1){E.logger.warn("Keyformat "+Ce+" is not supported from the manifest");continue}else if(Ce!=="identity")continue;Ue&&(se=D.LevelKey.fromURL(c,Ge),Ge&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ue)>=0&&(se.method=Ue,se.keyFormat=Ce,Te&&(se.keyID=Te),_e&&(se.keyFormatVersions=_e),se.iv=He));break}case"START":{var Fe=new O.AttrList(ue),Ne=Fe.decimalFloatingPoint("TIME-OFFSET");Object(H.isFiniteNumber)(Ne)&&(p.startTimeOffset=Ne);break}case"MAP":{var De=new O.AttrList(ue);V.relurl=De.URI,De.BYTERANGE&&V.setByteRange(De.BYTERANGE),V.level=s,V.sn="initSegment",se&&(V.levelkey=se),V.initSegment=null,R=V,fe=!0;break}case"SERVER-CONTROL":{var ze=new O.AttrList(ue);p.canBlockReload=ze.bool("CAN-BLOCK-RELOAD"),p.canSkipUntil=ze.optionalFloat("CAN-SKIP-UNTIL",0),p.canSkipDateRanges=p.canSkipUntil>0&&ze.bool("CAN-SKIP-DATERANGES"),p.partHoldBack=ze.optionalFloat("PART-HOLD-BACK",0),p.holdBack=ze.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Xe=new O.AttrList(ue);p.partTarget=Xe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var me=p.partList;me||(me=p.partList=[]);var Ye=j>0?me[me.length-1]:void 0,Ke=j++,ye=new F.Part(new O.AttrList(ue),V,c,Ke,Ye);me.push(ye),V.duration+=ye.duration;break}case"PRELOAD-HINT":{var Oe=new O.AttrList(ue);p.preloadHint=Oe;break}case"RENDITION-REPORT":{var te=new O.AttrList(ue);p.renditionReports=p.renditionReports||[],p.renditionReports.push(te);break}default:E.logger.warn("line parsed but not handled: "+q);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 $=v.length,ae=v[0],Y=v[$-1];if(G+=p.skippedSegments*p.targetduration,G>0&&$&&Y){p.averagetargetduration=G/$;var Q=Y.sn;p.endSN=Q!=="initSegment"?Q:0,ae&&(p.startCC=ae.cc,ae.initSegment||p.fragments.every(function(Z){return Z.relurl&&o(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=s,V.sn="initSegment",ae.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,xe>0&&h(v,xe),p},C}();function l(C,y){["video","audio","text"].forEach(function(f){var c=C.filter(function(a){return Object(_.isCodecType)(a,f)});if(c.length){var s=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});y[f+"Codec"]=s.length>0?s[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 s=C[c];if(!s)return;s.programDateTime=f.programDateTime-s.duration*1e3,f=s}}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"),M=L("./src/errors.ts"),F=L("./src/utils/logger.ts"),P=L("./src/utils/mp4-tools.ts"),D=L("./src/loader/m3u8-parser.ts"),O=L("./src/types/loader.ts"),E=L("./src/utils/attr-list.ts");function _(w){var b=w.type;switch(b){case O.PlaylistContextType.AUDIO_TRACK:return O.PlaylistLevelType.AUDIO;case O.PlaylistContextType.SUBTITLE_TRACK:return O.PlaylistLevelType.SUBTITLE;default:return O.PlaylistLevelType.MAIN}}function T(w,b){var d=w.url;return(d===void 0||d.indexOf("data:")===0)&&(d=b.url),d}var A=function(){function w(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var b=w.prototype;return b.registerListeners=function(){var o=this.hls;o.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(k.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(k.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(k.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.unregisterListeners=function(){var o=this.hls;o.off(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(k.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(k.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(k.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.createInternalLoader=function(o){var u=this.hls.config,l=u.pLoader,S=u.loader,h=l||S,g=new h(u);return o.loader=g,this.loaders[o.type]=g,g},b.getInternalLoader=function(o){return this.loaders[o.type]},b.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},b.destroyInternalLoaders=function(){for(var o in this.loaders){var u=this.loaders[o];u&&u.destroy(),this.resetInternalLoader(o)}},b.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},b.onManifestLoading=function(o,u){var l=u.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:O.PlaylistContextType.MANIFEST,url:l,deliveryDirectives:null})},b.onLevelLoading=function(o,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:O.PlaylistContextType.LEVEL,url:h,deliveryDirectives:g})},b.onAudioTrackLoading=function(o,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:O.PlaylistContextType.AUDIO_TRACK,url:h,deliveryDirectives:g})},b.onSubtitleTrackLoading=function(o,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:O.PlaylistContextType.SUBTITLE_TRACK,url:h,deliveryDirectives:g})},b.load=function(o){var u,l=this.hls.config,S=this.getInternalLoader(o);if(S){var h=S.context;if(h&&h.url===o.url){F.logger.trace("[playlist-loader]: playlist request ongoing");return}F.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),S.abort()}var g,C,y,f;switch(o.type){case O.PlaylistContextType.MANIFEST:g=l.manifestLoadingMaxRetry,C=l.manifestLoadingTimeOut,y=l.manifestLoadingRetryDelay,f=l.manifestLoadingMaxRetryTimeout;break;case O.PlaylistContextType.LEVEL:case O.PlaylistContextType.AUDIO_TRACK:case O.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(o),(u=o.deliveryDirectives)!==null&&u!==void 0&&u.part){var c;if(o.type===O.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===O.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===O.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var s=c.partTarget,a=c.targetduration;s&&a&&(C=Math.min(Math.max(s*3,a*.8)*1e3,C))}}var 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(o,m,p)},b.loadsuccess=function(o,u,l,S){if(S===void 0&&(S=null),l.isSidxRequest){this.handleSidxRequest(o,l),this.handlePlaylistLoaded(o,u,l,S);return}this.resetInternalLoader(l.type);var h=o.data;if(h.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,l,"no EXTM3U delimiter",S);return}u.parsing.start=performance.now(),h.indexOf("#EXTINF:")>0||h.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,u,l,S):this.handleMasterPlaylist(o,u,l,S)},b.loaderror=function(o,u,l){l===void 0&&(l=null),this.handleNetworkError(u,l,!1,o)},b.loadtimeout=function(o,u,l){l===void 0&&(l=null),this.handleNetworkError(u,l,!0)},b.handleMasterPlaylist=function(o,u,l,S){var h=this.hls,g=o.data,C=T(o,l),y=D.default.parseMasterPlaylist(g,C),f=y.levels,c=y.sessionData;if(!f.length){this.handleManifestParsingError(o,l,"no level found in manifest",S);return}var s=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",s),p=D.default.parseMasterPlaylistMedia(g,C,"SUBTITLES",a),v=D.default.parseMasterPlaylistMedia(g,C,"CLOSED-CAPTIONS");if(m.length){var R=m.some(function(U){return!U.url});!R&&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(o,u,l,S){var h=this.hls,g=l.id,C=l.level,y=l.type,f=T(o,l),c=Object(H.isFiniteNumber)(g)?g:0,s=Object(H.isFiniteNumber)(C)?C:c,a=_(l),m=D.default.parseLevelPlaylist(o.data,f,s,a,c);if(!m.fragments.length){h.trigger(k.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.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===O.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,R=(v=m.fragments[0].initSegment)===null||v===void 0?void 0:v.url;this.load({url:R,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(o,u,l,S)},b.handleSidxRequest=function(o,u){var l=Object(P.parseSegmentIndex)(new Uint8Array(o.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(o,u,l,S){this.hls.trigger(k.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:u.type===O.PlaylistContextType.MANIFEST,url:o.url,reason:l,response:o,context:u,networkDetails:S})},b.handleNetworkError=function(o,u,l,S){l===void 0&&(l=!1),F.logger.warn("[playlist-loader]: A network "+(l?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var h=M.ErrorDetails.UNKNOWN,g=!1,C=this.getInternalLoader(o);switch(o.type){case O.PlaylistContextType.MANIFEST:h=l?M.ErrorDetails.MANIFEST_LOAD_TIMEOUT:M.ErrorDetails.MANIFEST_LOAD_ERROR,g=!0;break;case O.PlaylistContextType.LEVEL:h=l?M.ErrorDetails.LEVEL_LOAD_TIMEOUT:M.ErrorDetails.LEVEL_LOAD_ERROR,g=!1;break;case O.PlaylistContextType.AUDIO_TRACK:h=l?M.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,g=!1;break;case O.PlaylistContextType.SUBTITLE_TRACK:h=l?M.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:M.ErrorDetails.SUBTITLE_LOAD_ERROR,g=!1;break}C&&this.resetInternalLoader(o.type);var y={type:M.ErrorTypes.NETWORK_ERROR,details:h,fatal:g,url:o.url,loader:C,context:o,networkDetails:u};S&&(y.response=S),this.hls.trigger(k.Events.ERROR,y)},b.handlePlaylistLoaded=function(o,u,l,S){var h=l.type,g=l.level,C=l.id,y=l.groupId,f=l.loader,c=l.levelDetails,s=l.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,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 O.PlaylistContextType.MANIFEST:case O.PlaylistContextType.LEVEL:this.hls.trigger(k.Events.LEVEL_LOADED,{details:c,level:g||0,id:C||0,stats:u,networkDetails:S,deliveryDirectives:s});break;case O.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(k.Events.AUDIO_TRACK_LOADED,{details:c,id:C||0,groupId:y||"",stats:u,networkDetails:S,deliveryDirectives:s});break;case O.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(k.Events.SUBTITLE_TRACK_LOADED,{details:c,id:C||0,groupId:y||"",stats:u,networkDetails:S,deliveryDirectives:s});break}},w}();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(M){return typeof M=="number"&&isFinite(M)},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,P){switch(F){case"mp4a.40.2":if(P===1)return new Uint8Array([0,200,0,128,35,128]);if(P===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(P===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(P===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(P===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(P===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(P===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(P===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(P===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 M(){}return M.init=function(){M.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 P;for(P in M.types)M.types.hasOwnProperty(P)&&(M.types[P]=[P.charCodeAt(0),P.charCodeAt(1),P.charCodeAt(2),P.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]),O=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]);M.HDLR_TYPES={video:D,audio:O};var E=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),_=new Uint8Array([0,0,0,0,0,0,0,0]);M.STTS=M.STSC=M.STCO=_,M.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),M.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),M.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),M.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]),w=new Uint8Array([0,0,0,1]);M.FTYP=M.box(M.types.ftyp,T,w,T,A),M.DINF=M.box(M.types.dinf,M.box(M.types.dref,E))},M.box=function(P){for(var D=8,O=arguments.length,E=new Array(O>1?O-1:0),_=1;_<O;_++)E[_-1]=arguments[_];for(var T=E.length,A=T;T--;)D+=E[T].byteLength;var w=new Uint8Array(D);for(w[0]=D>>24&255,w[1]=D>>16&255,w[2]=D>>8&255,w[3]=D&255,w.set(P,4),T=0,D=8;T<A;T++)w.set(E[T],D),D+=E[T].byteLength;return w},M.hdlr=function(P){return M.box(M.types.hdlr,M.HDLR_TYPES[P])},M.mdat=function(P){return M.box(M.types.mdat,P)},M.mdhd=function(P,D){D*=P;var O=Math.floor(D/(H+1)),E=Math.floor(D%(H+1));return M.box(M.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,P>>24&255,P>>16&255,P>>8&255,P&255,O>>24,O>>16&255,O>>8&255,O&255,E>>24,E>>16&255,E>>8&255,E&255,85,196,0,0]))},M.mdia=function(P){return M.box(M.types.mdia,M.mdhd(P.timescale,P.duration),M.hdlr(P.type),M.minf(P))},M.mfhd=function(P){return M.box(M.types.mfhd,new Uint8Array([0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255]))},M.minf=function(P){return P.type==="audio"?M.box(M.types.minf,M.box(M.types.smhd,M.SMHD),M.DINF,M.stbl(P)):M.box(M.types.minf,M.box(M.types.vmhd,M.VMHD),M.DINF,M.stbl(P))},M.moof=function(P,D,O){return M.box(M.types.moof,M.mfhd(P),M.traf(O,D))},M.moov=function(P){for(var D=P.length,O=[];D--;)O[D]=M.trak(P[D]);return M.box.apply(null,[M.types.moov,M.mvhd(P[0].timescale,P[0].duration)].concat(O).concat(M.mvex(P)))},M.mvex=function(P){for(var D=P.length,O=[];D--;)O[D]=M.trex(P[D]);return M.box.apply(null,[M.types.mvex].concat(O))},M.mvhd=function(P,D){D*=P;var O=Math.floor(D/(H+1)),E=Math.floor(D%(H+1)),_=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,P>>24&255,P>>16&255,P>>8&255,P&255,O>>24,O>>16&255,O>>8&255,O&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 M.box(M.types.mvhd,_)},M.sdtp=function(P){var D=P.samples||[],O=new Uint8Array(4+D.length),E,_;for(E=0;E<D.length;E++)_=D[E].flags,O[E+4]=_.dependsOn<<4|_.isDependedOn<<2|_.hasRedundancy;return M.box(M.types.sdtp,O)},M.stbl=function(P){return M.box(M.types.stbl,M.stsd(P),M.box(M.types.stts,M.STTS),M.box(M.types.stsc,M.STSC),M.box(M.types.stsz,M.STSZ),M.box(M.types.stco,M.STCO))},M.avc1=function(P){var D=[],O=[],E,_,T;for(E=0;E<P.sps.length;E++)_=P.sps[E],T=_.byteLength,D.push(T>>>8&255),D.push(T&255),D=D.concat(Array.prototype.slice.call(_));for(E=0;E<P.pps.length;E++)_=P.pps[E],T=_.byteLength,O.push(T>>>8&255),O.push(T&255),O=O.concat(Array.prototype.slice.call(_));var A=M.box(M.types.avcC,new Uint8Array([1,D[3],D[4],D[5],252|3,224|P.sps.length].concat(D).concat([P.pps.length]).concat(O))),w=P.width,b=P.height,d=P.pixelRatio[0],o=P.pixelRatio[1];return M.box(M.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,w>>8&255,w&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,M.box(M.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),M.box(M.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,o>>24,o>>16&255,o>>8&255,o&255])))},M.esds=function(P){var D=P.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(P.config).concat([6,1,2]))},M.mp4a=function(P){var D=P.samplerate;return M.box(M.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,P.channelCount,0,16,0,0,0,0,D>>8&255,D&255,0,0]),M.box(M.types.esds,M.esds(P)))},M.mp3=function(P){var D=P.samplerate;return M.box(M.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,P.channelCount,0,16,0,0,0,0,D>>8&255,D&255,0,0]))},M.stsd=function(P){return P.type==="audio"?!P.isAAC&&P.codec==="mp3"?M.box(M.types.stsd,M.STSD,M.mp3(P)):M.box(M.types.stsd,M.STSD,M.mp4a(P)):M.box(M.types.stsd,M.STSD,M.avc1(P))},M.tkhd=function(P){var D=P.id,O=P.duration*P.timescale,E=P.width,_=P.height,T=Math.floor(O/(H+1)),A=Math.floor(O%(H+1));return M.box(M.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,_>>8&255,_&255,0,0]))},M.traf=function(P,D){var O=M.sdtp(P),E=P.id,_=Math.floor(D/(H+1)),T=Math.floor(D%(H+1));return M.box(M.types.traf,M.box(M.types.tfhd,new Uint8Array([0,0,0,0,E>>24,E>>16&255,E>>8&255,E&255])),M.box(M.types.tfdt,new Uint8Array([1,0,0,0,_>>24,_>>16&255,_>>8&255,_&255,T>>24,T>>16&255,T>>8&255,T&255])),M.trun(P,O.length+16+20+8+16+8+8),O)},M.trak=function(P){return P.duration=P.duration||4294967295,M.box(M.types.trak,M.tkhd(P),M.mdia(P))},M.trex=function(P){var D=P.id;return M.box(M.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]))},M.trun=function(P,D){var O=P.samples||[],E=O.length,_=12+16*E,T=new Uint8Array(_),A,w,b,d,o,u;for(D+=8+_,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++)w=O[A],b=w.duration,d=w.size,o=w.flags,u=w.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,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*A);return M.box(M.types.trun,T)},M.initSegment=function(P){M.types||M.init();var D=M.moov(P),O=new Uint8Array(M.FTYP.byteLength+D.byteLength);return O.set(M.FTYP),O.set(D,M.FTYP.byteLength),O},M}();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"),M=L("./src/remux/mp4-generator.ts"),F=L("./src/events.ts"),P=L("./src/errors.ts"),D=L("./src/utils/logger.ts"),O=L("./src/types/loader.ts"),E=L("./src/utils/timescale-conversion.ts");function _(){return _=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},_.apply(this,arguments)}var T=10*1e3,A=1024,w=1152,b=null,d=null,o=!1,u=function(){function C(f,c,s,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=f,this.config=c,this.typeSupported=s,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}o=!!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 s=!1,a=c.reduce(function(m,p){var v=p.pts-m;return v<-4294967296?(s=!0,l(m,p.pts)):v>0?m:p.pts},c[0].pts);return s&&D.logger.debug("PTS rollover detected"),a},y.remux=function(c,s,a,m,p,v,R,U){var j,G,B,N,V,q,ie=p,se=p,xe=c.pid>-1,fe=s.pid>-1,Ee=s.samples.length,ge=c.samples.length>0,ve=Ee>1,le=(!xe||ge)&&(!fe||ve)||this.ISGenerated||R;if(le){this.ISGenerated||(B=this.generateIS(c,s,p));var ue=this.isVideoContiguous,be=-1;if(ve&&(be=S(s.samples),!ue&&this.config.forceKeyFrameOnDiscontinuity))if(q=!0,be>0){D.logger.warn("[mp4-remuxer]: Dropped "+be+" out of "+Ee+" video samples due to a missing keyframe");var je=this.getVideoStartPts(s.samples);s.samples=s.samples.slice(be),s.dropped+=be,se+=(s.samples[0].pts-je)/(s.timescale||9e4)}else be===-1&&(D.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ee+" video samples"),q=!1);if(this.ISGenerated){if(ge&&ve){var Be=this.getVideoStartPts(s.samples),ke=l(c.samples[0].pts,Be)-Be,Me=ke/s.inputTimeScale;ie+=Math.max(0,Me),se+=Math.max(0,-Me)}if(ge){if(c.samplerate||(D.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),B=this.generateIS(c,s,p)),G=this.remuxAudio(c,ie,this.isAudioContiguous,v,fe||ve||U===O.PlaylistLevelType.AUDIO?se:void 0),ve){var we=G?G.endPTS-G.startPTS:0;s.inputTimeScale||(D.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),B=this.generateIS(c,s,p)),j=this.remuxVideo(s,se,ue,we)}}else ve&&(j=this.remuxVideo(s,se,ue,0));j&&(j.firstKeyFrame=be,j.independent=be!==-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:q,text:N,id3:V}},y.generateIS=function(c,s,a){var m=c.samples,p=s.samples,v=this.typeSupported,R={},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")),R.audio={id:"audio",container:j,codec:c.codec,initSegment:!c.isAAC&&v.mpeg?new Uint8Array(0):M.default.initSegment([c]),metadata:{channelCount:c.channelCount}},U&&(N=c.inputTimeScale,G=B=m[0].pts-Math.round(N*a))),s.sps&&s.pps&&p.length&&(s.timescale=s.inputTimeScale,R.video={id:"main",container:"video/mp4",codec:s.codec,initSegment:M.default.initSegment([s]),metadata:{width:s.width,height:s.height}},U)){N=s.inputTimeScale;var V=this.getVideoStartPts(p),q=Math.round(N*a);B=Math.min(B,l(p[0].dts,V)-q),G=Math.min(G,V-q)}if(Object.keys(R).length)return this.ISGenerated=!0,U&&(this._initPTS=G,this._initDTS=B),{tracks:R,initPTS:G,timescale:N}},y.remuxVideo=function(c,s,a,m){var p=c.inputTimeScale,v=c.samples,R=[],U=v.length,j=this._initPTS,G=this.nextAvcDts,B=8,N,V,q,ie=Number.POSITIVE_INFINITY,se=Number.NEGATIVE_INFINITY,xe=0,fe=!1;if(!a||G===null){var Ee=s*p,ge=v[0].pts-l(v[0].dts,v[0].pts);G=Ee-ge}for(var ve=0;ve<U;ve++){var le=v[ve];if(le.pts=l(le.pts-j,G),le.dts=l(le.dts-j,G),le.dts>le.pts){var ue=9e4*.2;xe=Math.max(Math.min(xe,le.pts-le.dts),-1*ue)}le.dts<v[ve>0?ve-1:ve].dts&&(fe=!0)}fe&&v.sort(function(Et,ht){var nt=Et.dts-ht.dts,bt=Et.pts-ht.pts;return nt||bt}),V=v[0].dts,q=v[v.length-1].dts;var be=Math.round((q-V)/(U-1));if(xe<0){if(xe<be*-2){D.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(E.toMsFromMpegTsClock)(-be,!0)+" ms");for(var je=xe,Be=0;Be<U;Be++)v[Be].dts=je=Math.max(je,v[Be].pts-be),v[Be].pts=Math.max(je,v[Be].pts)}else{D.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(E.toMsFromMpegTsClock)(xe,!0)+" ms to overcome this issue");for(var ke=0;ke<U;ke++)v[ke].dts=v[ke].dts+xe}V=v[0].dts}if(a){var Me=V-G,we=Me>be,Ae=Me<-1;if(we||Ae){we?D.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(Me,!0)+" ms ("+Me+"dts) hole between fragments detected, filling it"):D.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(-Me,!0)+" ms ("+Me+"dts) overlapping between fragments detected"),V=G;var Ue=v[0].pts-Me;v[0].dts=V,v[0].pts=Ue,D.logger.log("Video: First PTS/DTS adjusted: "+Object(E.toMsFromMpegTsClock)(Ue,!0)+"/"+Object(E.toMsFromMpegTsClock)(V,!0)+", delta: "+Object(E.toMsFromMpegTsClock)(Me,!0)+" ms")}}o&&(V=Math.max(0,V));for(var Ge=0,He=0,_e=0;_e<U;_e++){for(var Te=v[_e],Ce=Te.units,Re=Ce.length,Fe=0,Ne=0;Ne<Re;Ne++)Fe+=Ce[Ne].data.length;He+=Fe,Ge+=Re,Te.length=Fe,Te.dts=Math.max(Te.dts,V),Te.pts=Math.max(Te.pts,Te.dts,0),ie=Math.min(Te.pts,ie),se=Math.max(Te.pts,se)}q=v[U-1].dts;var De=He+4*Ge+8,ze;try{ze=new Uint8Array(De)}catch(Et){this.observer.emit(F.Events.ERROR,F.Events.ERROR,{type:P.ErrorTypes.MUX_ERROR,details:P.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:De,reason:"fail allocating video mdat "+De});return}var Xe=new DataView(ze.buffer);Xe.setUint32(0,De),ze.set(M.default.types.mdat,4);for(var me=0;me<U;me++){for(var Ye=v[me],Ke=Ye.units,ye=0,Oe=0,te=Ke.length;Oe<te;Oe++){var $=Ke[Oe],ae=$.data,Y=$.data.byteLength;Xe.setUint32(B,Y),B+=4,ze.set(ae,B),B+=Y,ye+=4+Y}if(me<U-1)N=v[me+1].dts-Ye.dts;else{var Q=this.config,Z=Ye.dts-v[me>0?me-1:me].dts;if(Q.stretchShortVideoTrack&&this.nextAudioPts!==null){var ee=Math.floor(Q.maxBufferHole*p),de=(m?ie+m*p:this.nextAudioPts)-Ye.pts;de>ee?(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 pe=Math.round(Ye.pts-Ye.dts);R.push(new h(Ye.key,N,ye,pe))}if(R.length&&b&&b<70){var Le=R[0].flags;Le.dependsOn=2,Le.isNonSync=0}console.assert(N!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=G=q+N,this.isVideoContiguous=!0;var tt=M.default.moof(c.sequenceNumber++,V,_({},c,{samples:R})),ct="video",rt={data1:tt,data2:ze,startPTS:ie/p,endPTS:(se+N)/p,startDTS:V/p,endDTS:G/p,type:ct,hasAudio:!1,hasVideo:!0,nb:R.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(ze.length,"MDAT length must not be zero"),rt},y.remuxAudio=function(c,s,a,m,p){var v=c.inputTimeScale,R=c.samplerate?c.samplerate:v,U=v/R,j=c.isAAC?A:w,G=j*U,B=this._initPTS,N=!c.isAAC&&this.typeSupported.mpeg,V=[],q=c.samples,ie=N?0:8,se=this.nextAudioPts||-1,xe=s*v;if(this.isAudioContiguous=a=a||q.length&&se>0&&(m&&Math.abs(xe-se)<9e3||Math.abs(l(q[0].pts-B,xe)-se)<20*G),q.forEach(function(ae){ae.pts=l(ae.pts-B,xe)}),!a||se<0){if(q=q.filter(function(ae){return ae.pts>=0}),!q.length)return;p===0?se=0:m?se=Math.max(0,xe):se=q[0].pts}if(c.isAAC)for(var fe=p!==void 0,Ee=this.config.maxAudioFramesDrift,ge=0,ve=se;ge<q.length;ge++){var le=q[ge],ue=le.pts,be=ue-ve,je=Math.abs(1e3*be/v);if(be<=-Ee*G&&fe)ge===0&&(D.logger.warn("Audio frame @ "+(ue/v).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*be/v)+" ms."),this.nextAudioPts=se=ve=ue);else if(be>=Ee*G&&je<T&&fe){var Be=Math.round(be/G);ve=ue-Be*G,ve<0&&(Be--,ve+=G),ge===0&&(this.nextAudioPts=se=ve),D.logger.warn("[mp4-remuxer]: Injecting "+Be+" audio frame @ "+(ve/v).toFixed(3)+"s due to "+Math.round(1e3*be/v)+" ms gap.");for(var ke=0;ke<Be;ke++){var Me=Math.max(ve,0),we=k.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);we||(D.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),we=le.unit.subarray()),q.splice(ge,0,{unit:we,pts:Me}),ve+=G,ge++}}le.pts=ve,ve+=G}for(var Ae=null,Ue=null,Ge,He=0,_e=q.length;_e--;)He+=q[_e].unit.byteLength;for(var Te=0,Ce=q.length;Te<Ce;Te++){var Re=q[Te],Fe=Re.unit,Ne=Re.pts;if(Ue!==null){var De=V[Te-1];De.duration=Math.round((Ne-Ue)/U)}else if(a&&c.isAAC&&(Ne=se),Ae=Ne,He>0){He+=ie;try{Ge=new Uint8Array(He)}catch(ae){this.observer.emit(F.Events.ERROR,F.Events.ERROR,{type:P.ErrorTypes.MUX_ERROR,details:P.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:He,reason:"fail allocating audio mdat "+He});return}if(!N){var ze=new DataView(Ge.buffer);ze.setUint32(0,He),Ge.set(M.default.types.mdat,4)}}else return;Ge.set(Fe,ie);var Xe=Fe.byteLength;ie+=Xe,V.push(new h(!0,j,Xe,0)),Ue=Ne}var me=V.length;if(!me)return;var Ye=V[V.length-1];this.nextAudioPts=se=Ue+U*Ye.duration;var Ke=N?new Uint8Array(0):M.default.moof(c.sequenceNumber++,Ae/U,_({},c,{samples:V}));c.samples=[];var ye=Ae/v,Oe=se/v,te="audio",$={data1:Ke,data2:Ge,startPTS:ye,endPTS:Oe,startDTS:ye,endDTS:Oe,type:te,hasAudio:!0,hasVideo:!1,nb:me};return this.isAudioContiguous=!0,console.assert(Ge.length,"MDAT length must not be zero"),$},y.remuxEmptyAudio=function(c,s,a,m){var p=c.inputTimeScale,v=c.samplerate?c.samplerate:p,R=p/v,U=this.nextAudioPts,j=(U!==null?U:m.startDTS*p)+this._initDTS,G=m.endDTS*p+this._initDTS,B=R*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 q=[],ie=0;ie<N;ie++){var se=j+ie*B;q.push({unit:V,pts:se,dts:se})}return c.samples=q,this.remuxAudio(c,s,a,!1)},y.remuxID3=function(c,s){var a=c.samples.length;if(!a)return;for(var m=c.inputTimeScale,p=this._initPTS,v=this._initDTS,R=0;R<a;R++){var U=c.samples[R];U.pts=l(U.pts-p,s*m)/m,U.dts=l(U.dts-v,s*m)/m}var j=c.samples;return c.samples=[],{samples:j}},y.remuxText=function(c,s){var a=c.samples.length;if(!a)return;for(var m=c.inputTimeScale,p=this._initPTS,v=0;v<a;v++){var R=c.samples[v];R.pts=l(R.pts-p,s*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,s){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=f,this.size=c,this.cts=s,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"),M=L("./src/loader/fragment.ts"),F=L("./src/utils/logger.ts"),P=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 _=E.prototype;return _.destroy=function(){},_.resetTimeStamp=function(A){this.initPTS=A,this.lastEndDTS=null},_.resetNextTimestamp=function(){this.lastEndDTS=null},_.resetInitSegment=function(A,w,b){this.audioCodec=w,this.videoCodec=b,this.generateInitSegment(A),this.emitInitSegment=!0},_.generateInitSegment=function(A){var w=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);w||(w=O(d.audio,M.ElementaryStreamTypes.AUDIO)),b||(b=O(d.video,M.ElementaryStreamTypes.VIDEO));var o={};d.audio&&d.video?o.audiovideo={container:"video/mp4",codec:w+","+b,initSegment:A,id:"main"}:d.audio?o.audio={container:"audio/mp4",codec:w,initSegment:A,id:"audio"}:d.video?o.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=o},_.remux=function(A,w,b,d,o){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=o||0);var h=w.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 s=!!C.audio,a=!!C.video,m="";s&&(m+="audio"),a&&(m+="video");var p={data1:h,startPTS:f,startDTS:f,endPTS:c,endDTS:c,type:m,hasAudio:s,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(_,T,A){return Object(k.getStartDTS)(_,T)-A};function O(E,_){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"||_===M.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}z.default=P},"./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 M=k.prototype;return M.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},M.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},M.onHandlerDestroyed=function(){},M.hasInterval=function(){return!!this._tickInterval},M.hasNextTick=function(){return!!this._tickTimer},M.setInterval=function(P){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,P),!0)},M.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},M.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},M.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},M.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},M.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 M}),L.d(z,"CMCDStreamType",function(){return F});var H=1,k;(function(P){P.MANIFEST="m",P.AUDIO="a",P.VIDEO="v",P.MUXED="av",P.INIT="i",P.CAPTION="c",P.TIMED_TEXT="tt",P.KEY="k",P.OTHER="o"})(k||(k={}));var M;(function(P){P.DASH="d",P.HLS="h",P.SMOOTH="s",P.OTHER="o"})(M||(M={}));var F;(function(P){P.VOD="v",P.LIVE="l"})(F||(F={}))},"./src/types/level.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"HlsSkip",function(){return M}),L.d(z,"getSkipValue",function(){return F}),L.d(z,"HlsUrlParameters",function(){return P}),L.d(z,"Level",function(){return D});function H(O,E){for(var _=0;_<E.length;_++){var T=E[_];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(O,T.key,T)}}function k(O,E,_){return E&&H(O.prototype,E),_&&H(O,_),O}var M;(function(O){O.No="",O.Yes="YES",O.v2="v2"})(M||(M={}));function F(O,E){var _=O.canSkipUntil,T=O.canSkipDateRanges,A=O.endSN,w=E!==void 0?E-A:0;return _&&w<_?T?M.v2:M.Yes:M.No}var P=function(){function O(_,T,A){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=_,this.part=T,this.skip=A}var E=O.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()},O}(),D=function(){function O(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(_){return _}).join(",").replace(/\.[^.,]+/g,"")}return k(O,[{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(_){var T=_%this.url.length;this._urlId!==T&&(this.details=void 0,this._urlId=T)}}]),O}()},"./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(M){M.MANIFEST="manifest",M.LEVEL="level",M.AUDIO_TRACK="audioTrack",M.SUBTITLE_TRACK="subtitleTrack"})(H||(H={}));var k;(function(M){M.MAIN="main",M.AUDIO="audio",M.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,P,D,O,E,_){O===void 0&&(O=0),E===void 0&&(E=-1),_===void 0&&(_=!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=P,this.id=D,this.size=O,this.part=E,this.partial=_};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 M});var H=/^(\d+)x(\d+)$/,k=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,M=function(){function F(D){typeof D=="string"&&(D=F.parseAttrList(D));for(var O in D)D.hasOwnProperty(O)&&(this[O]=D[O])}var P=F.prototype;return P.decimalInteger=function(O){var E=parseInt(this[O],10);return E>Number.MAX_SAFE_INTEGER?Infinity:E},P.hexadecimalInteger=function(O){if(this[O]){var E=(this[O]||"0x").slice(2);E=(E.length&1?"0":"")+E;for(var _=new Uint8Array(E.length/2),T=0;T<E.length/2;T++)_[T]=parseInt(E.slice(T*2,T*2+2),16);return _}else return null},P.hexadecimalIntegerAsNumber=function(O){var E=parseInt(this[O],16);return E>Number.MAX_SAFE_INTEGER?Infinity:E},P.decimalFloatingPoint=function(O){return parseFloat(this[O])},P.optionalFloat=function(O,E){var _=this[O];return _?parseFloat(_):E},P.enumeratedString=function(O){return this[O]},P.bool=function(O){return this[O]==="YES"},P.decimalResolution=function(O){var E=H.exec(this[O]);return E===null?void 0:{width:parseInt(E[1],10),height:parseInt(E[2],10)}},F.parseAttrList=function(O){var E,_={},T='"';for(k.lastIndex=0;(E=k.exec(O))!==null;){var A=E[2];A.indexOf(T)===0&&A.lastIndexOf(T)===A.length-1&&(A=A.slice(1,-1)),_[E[1]]=A}return _},F}()},"./src/utils/binary-search.ts":function(re,z,L){"use strict";L.r(z);var H={search:function(M,F){for(var P=0,D=M.length-1,O=null,E=null;P<=D;){O=(P+D)/2|0,E=M[O];var _=F(E);if(_>0)P=O+1;else if(_<0)D=O-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 M});var H=L("./src/utils/logger.ts"),k={length:0,start:function(){return 0},end:function(){return 0}},M=function(){function F(){}return F.isBuffered=function(D,O){try{if(D){for(var E=F.getBuffered(D),_=0;_<E.length;_++)if(O>=E.start(_)&&O<=E.end(_))return!0}}catch(T){}return!1},F.bufferInfo=function(D,O,E){try{if(D){var _=F.getBuffered(D),T=[],A;for(A=0;A<_.length;A++)T.push({start:_.start(A),end:_.end(A)});return this.bufferedInfo(T,O,E)}}catch(w){}return{len:0,start:O,end:O,nextStart:void 0}},F.bufferedInfo=function(D,O,E){O=Math.max(0,O),D.sort(function(g,C){var y=g.start-C.start;return y||C.end-g.end});var _=[];if(E)for(var T=0;T<D.length;T++){var A=_.length;if(A){var w=_[A-1].end;D[T].start-w<E?D[T].end>w&&(_[A-1].end=D[T].end):_.push(D[T])}else _.push(D[T])}else _=D;for(var b=0,d,o=O,u=O,l=0;l<_.length;l++){var S=_[l].start,h=_[l].end;if(O+E>=S&&O<h)o=S,u=h,b=u-O;else if(O+E<S){d=S;break}}return{len:b,start:o||0,end:u||0,nextStart:d}},F.getBuffered=function(D){try{return D.buffered}catch(O){return H.logger.log("failed to get media.buffered",O),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},M=function(c){var s=c;return k.hasOwnProperty(c)&&(s=k[c]),String.fromCharCode(s)},F=15,P=100,D={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},O={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},_={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 w=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 s=[],a=0;a<c.length;a++)s.push(c[a].toString(16));return s},d=function(){function f(s,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=s||"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}(),o=function(){function f(s,a,m,p,v,R){this.uchar=void 0,this.penState=void 0,this.uchar=s||" ",this.penState=new d(a,m,p,v,R)}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(s){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<P;a++)this.chars.push(new o);this.logger=s,this.pos=0,this.currPenState=new d}var c=f.prototype;return c.equals=function(a){for(var m=!0,p=0;p<P;p++)if(!this.chars[p].equals(a.chars[p])){m=!1;break}return m},c.copy=function(a){for(var m=0;m<P;m++)this.chars[m].copy(a.chars[m])},c.isEmpty=function(){for(var a=!0,m=0;m<P;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>P&&(this.logger.log(A.DEBUG,"Too large cursor position "+this.pos),this.pos=P)},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=M(a);if(this.pos>=P){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<P;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<P;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(s){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<F;a++)this.rows.push(new u(s));this.logger=s,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,R=this.lastOutputScreen;if(R){var U=R.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(R.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 q={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(q)},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,R=0;R<F;R++){var U=this.rows[R].getTextString();U&&(v=R+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(s,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=s,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(s,a,m){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var p=new w;this.channels=[null,new S(s,a,p),new S(s+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,R,U=!1;this.logger.time=a;for(var j=0;j<m.length;j+=2){if(v=m[j]&127,R=m[j+1]&127,v===0&&R===0)continue;if(this.logger.log(A.DATA,"["+b([m[j],m[j+1]])+"] -> ("+b([v,R])+")"),p=this.parseCmd(v,R),p||(p=this.parseMidrow(v,R)),p||(p=this.parsePAC(v,R)),p||(p=this.parseBackgroundAttributes(v,R)),!p&&(U=this.parseChars(v,R),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,R])+" 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,R=(a===23||a===31)&&m>=33&&m<=35;if(!(v||R))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,R=(a>=17&&a<=23||a>=25&&a<=31)&&m>=64&&m<=127,U=(a===16||a===24)&&m>=64&&m<=95;if(!(R||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?O[a]:_[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,R=null;if(a>=25?(p=2,R=a-8):(p=1,R=a),R>=17&&R<=19){var U;R===17?U=m+80:R===18?U=m+112:U=m+144,this.logger.log(A.INFO,"Special char '"+M(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 R,U={};a===16||a===24?(R=Math.floor((m-32)/2),U.background=T[R],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,s){s.a=f,s.b=c}function C(f,c,s){return s.a===f&&s.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 M});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,P){var D=H[P];return!!D&&D[F.slice(0,4)]===!0}function M(F,P){return MediaSource.isTypeSupported((P||"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"),M=L("./src/utils/texttrack-utils.ts"),F=/\s/,P={newCue:function(O,E,_,T){for(var A=[],w,b,d,o,u,l=self.VTTCue||self.TextTrackCue,S=0;S<T.rows.length;S++)if(w=T.rows[S],d=!0,o=0,u="",!w.isEmpty()){for(var h=0;h<w.chars.length;h++)F.test(w.chars[h].uchar)&&d?o++:(u+=w.chars[h].uchar,d=!1);w.cueStartTime=E,E===_&&(_+=1e-4),o>=16?o--:o++;var g=Object(H.fixLineBreaks)(u.trim()),C=Object(k.generateCueId)(E,_,g);(!O||!O.cues||!O.cues.getCueById(C))&&(b=new l(E,_,g),b.id=C,b.line=S+1,b.align="left",b.position=10+Math.min(80,Math.floor(o*8/32)*10),A.push(b))}return O&&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(M.addCueToTrack)(O,y)})),A}};z.default=P},"./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 P}),L.d(z,"findDiscontinuousReferenceFrag",function(){return D}),L.d(z,"adjustSlidingStart",function(){return E}),L.d(z,"alignStream",function(){return _}),L.d(z,"alignPDT",function(){return A}),L.d(z,"alignFragmentByPDTDelta",function(){return w}),L.d(z,"alignMediaPlaylistByPDT",function(){return b});var H=L("./src/polyfills/number.ts"),k=L("./src/utils/logger.ts"),M=L("./src/controller/level-helper.ts");function F(d,o){for(var u=null,l=0,S=d.length;l<S;l++){var h=d[l];if(h&&h.cc===o){u=h;break}}return u}function P(d,o,u){return!!(o.details&&(u.endCC>u.startCC||d&&d.cc<u.startCC))}function D(d,o){var u=d.fragments,l=o.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 O(d,o){if(d){var u=d.start+o;d.start=d.startPTS=u,d.endPTS=u+d.duration}}function E(d,o){for(var u=o.fragments,l=0,S=u.length;l<S;l++)O(u[l],d);o.fragmentHint&&O(o.fragmentHint,d),o.alignedSliding=!0}function _(d,o,u){if(!o)return;T(d,u,o),!u.alignedSliding&&o.details&&A(u,o.details),!u.alignedSliding&&o.details&&!u.skippedSegments&&Object(M.adjustSliding)(o.details,u)}function T(d,o,u){if(P(d,u,o)){var l=D(u.details,o);l&&Object(H.isFiniteNumber)(l.start)&&(k.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),E(l.start,o))}}function A(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var u=o.fragments[0].programDateTime,l=d.fragments[0].programDateTime,S=(l-u)/1e3+o.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 w(d,o){var u=d.programDateTime;if(!u)return;var l=(u-o)/1e3;d.start=d.startPTS=l,d.endPTS=l+d.duration}function b(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var u=o.fragments[0].programDateTime,l=o.fragments[0].start,S=u-l*1e3;d.fragments.forEach(function(h){w(h,S)}),d.fragmentHint&&w(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 M(P,D,O){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=O,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new H.default(P),this.fast_=new H.default(D)}var F=M.prototype;return F.update=function(D,O){var E=this.slow_,_=this.fast_;this.slow_.halfLife!==D&&(this.slow_=new H.default(D,E.getEstimate(),E.getTotalWeight())),this.fast_.halfLife!==O&&(this.fast_=new H.default(O,_.getEstimate(),_.getTotalWeight()))},F.sample=function(D,O){D=Math.max(D,this.minDelayMs_);var E=8*O,_=D/1e3,T=E/_;this.fast_.sample(_,T),this.slow_.sample(_,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(){},M}();z.default=k},"./src/utils/ewma.ts":function(re,z,L){"use strict";L.r(z);var H=function(){function k(F,P,D){P===void 0&&(P=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_=P,this.totalWeight_=D}var M=k.prototype;return M.sample=function(P,D){var O=Math.pow(this.alpha_,P);this.estimate_=D*(1-O)+O*this.estimate_,this.totalWeight_+=P},M.getTotalWeight=function(){return this.totalWeight_},M.getEstimate=function(){if(this.alpha_){var P=1-Math.pow(this.alpha_,this.totalWeight_);if(P)return this.estimate_/P}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 w});var H=L("./src/polyfills/number.ts"),k=L("./src/loader/load-stats.ts"),M=L("./src/demux/chunk-cache.ts");function F(l,S){l.prototype=Object.create(S.prototype),l.prototype.constructor=l,_(l,S)}function P(l){var S=typeof Map=="function"?new Map:void 0;return P=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}}),_(C,g)},P(l)}function D(l,S,h){return O()?D=Reflect.construct:D=function(C,y,f){var c=[null];c.push.apply(c,y);var s=Function.bind.apply(C,c),a=new s;return f&&_(a,f.prototype),a},D.apply(null,arguments)}function O(){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 _(l,S){return _=Object.setPrototypeOf||function(g,C){return g.__proto__=C,g},_(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 w(){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||o,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 s=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,s),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 R=v.status,U=v.statusText;throw new u(U||"fetch, bad network response",R,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 R=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:R.url,data:v};a&&!Object(H.isFiniteNumber)(C.highWaterMark)&&a(c,g,v,R),y.onSuccess(U,c,g,R)}).catch(function(v){if(self.clearTimeout(f.requestTimeout),c.aborted)return;var R=v.code||0;y.onError({code:R,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 s=new M.default,a=g.body.getReader(),m=function p(){return a.read().then(function(v){if(v.done)return s.dataLength&&c(C,y,s.flush(),g),Promise.resolve(new ArrayBuffer(0));var R=v.value,U=R.length;return C.loaded+=U,U<f||s.dataLength?(s.push(R),s.dataLength>=f&&c(C,y,s.flush(),g)):c(C,y,R,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 o(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}(P(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 w});var H=L("./src/utils/mp4-tools.ts"),k=L("./src/utils/vttparser.ts"),M=L("./src/utils/vttcue.ts"),F=L("./src/demux/id3.ts"),P=L("./src/utils/timescale-conversion.ts"),D=L("./src/utils/webvtt-parser.ts");function O(){return O=Object.assign||function(f){for(var c=1;c<arguments.length;c++){var s=arguments[c];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(f[a]=s[a])}return f},O.apply(this,arguments)}var E="stpp.ttml.im1t",_=/^(\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 w(f,c,s,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],R=Object(F.utf8ArrayToStr)(new Uint8Array(f,v.start,v.end-v.start)),U=Object(P.toTimescaleFromScale)(c,1,s);try{a(b(R,U))}catch(j){m(j)}}function b(f,c){var s=new DOMParser,a=s.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},{}),R=m.getAttribute("xml:space")!=="preserve",U=o(d(m,"styling","style")),j=o(d(m,"layout","region")),G=d(m,"body","[begin]");return[].map.call(G,function(B){var N=u(B,R);if(!N||!B.hasAttribute("begin"))return null;var V=g(B.getAttribute("begin"),v),q=g(B.getAttribute("dur"),v),ie=g(B.getAttribute("end"),v);if(V===null)throw h(B);if(ie===null){if(q===null)throw h(B);ie=V+q}var se=new M.default(V-c,ie-c,N);se.id=Object(D.generateCueId)(se.startTime,se.endTime,se.text);var xe=j[B.getAttribute("region")],fe=U[B.getAttribute("style")];se.position=10,se.size=80;var Ee=l(xe,fe),ge=Ee.textAlign;if(ge){var ve=A[ge];ve&&(se.lineAlign=ve),se.align=ge}return O(se,Ee),se}).filter(function(B){return B!==null})}function d(f,c,s){var a=f.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(s)):[]}function o(f){return f.reduce(function(c,s){var a=s.getAttribute("xml:id");return a&&(c[a]=s),c},{})}function u(f,c){return[].slice.call(f.childNodes).reduce(function(s,a,m){var p;return a.nodeName==="br"&&m?s+`
|
|
`:(p=a.childNodes)!==null&&p!==void 0&&p.length?u(a,c):c?s+a.textContent.trim().replace(/\s+/g," "):s+a.textContent},"")}function l(f,c){var s="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(m,p){var v=S(c,s,p)||S(f,s,p);return v&&(m[p]=v),m},{})}function S(f,c,s){return f.hasAttributeNS(c,s)?f.getAttributeNS(c,s):null}function h(f){return new Error("Could not parse ttml timestamp "+f)}function g(f,c){if(!f)return null;var s=Object(k.parseTimeStamp)(f);return s===null&&(_.test(f)?s=C(f,c):T.test(f)&&(s=y(f,c))),s}function C(f,c){var s=_.exec(f),a=(s[4]|0)+(s[5]|0)/c.subFrameRate;return(s[1]|0)*3600+(s[2]|0)*60+(s[3]|0)+a/c.frameRate}function y(f,c){var s=T.exec(f),a=Number(s[1]),m=s[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 O});var H=function(){},k={trace:H,debug:H,log:H,warn:H,info:H,error:H},M=k;function F(E){var _=self.console[E];return _?_.bind(self.console,"["+E+"] >"):H}function P(E){for(var _=arguments.length,T=new Array(_>1?_-1:0),A=1;A<_;A++)T[A-1]=arguments[A];T.forEach(function(w){M[w]=E[w]?E[w].bind(E):F(w)})}function D(E){if(self.console&&E===!0||typeof E=="object"){P(E,"debug","log","info","warn","error");try{M.log()}catch(_){M=k}}else M=k}var O=M},"./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(M){M.WIDEVINE="com.widevine.alpha",M.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 P}),L.d(z,"readUint16",function(){return D}),L.d(z,"readUint32",function(){return O}),L.d(z,"writeUint32",function(){return E}),L.d(z,"findBox",function(){return _}),L.d(z,"parseSegmentIndex",function(){return T}),L.d(z,"parseInitSegment",function(){return A}),L.d(z,"getStartDTS",function(){return w}),L.d(z,"getDuration",function(){return b}),L.d(z,"computeRawDurationFromSamples",function(){return d}),L.d(z,"offsetStartDTS",function(){return o}),L.d(z,"segmentValidRange",function(){return u}),L.d(z,"appendUint8Array",function(){return l});var H=L("./src/utils/typed-array.ts"),k=L("./src/loader/fragment.ts"),M=Math.pow(2,32)-1,F=[].push;function P(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 O(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 _(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 s=O(C,c),a=P(C.subarray(c+4,c+8)),m=s>1?c+s:f;if(a===h[0])if(h.length===1)g.push({data:C,start:c+8,end:m});else{var p=_({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=_(S,["moov"]),g=h[0],C=g?g.end:null,y=_(S,["sidx"]);if(!y||!y[0])return null;var f=[],c=y[0],s=c.data[0],a=s===0?8:16,m=O(c,a);a+=4;var p=0,v=0;s===0?a+=8:a+=16,a+=2;var R=c.end+v,U=D(c,a);a+=2;for(var j=0;j<U;j++){var G=a,B=O(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 q=O(c,G);G+=4,f.push({referenceSize:N,subsegmentDuration:q,info:{duration:q/m,start:R,end:R+N-1}}),R+=N,G+=4,a=G}return{earliestPresentationTime:p,timescale:m,version:s,referencesCount:U,references:f,moovEndOffset:C}}function A(S){for(var h=[],g=_(S,["moov","trak"]),C=0;C<g.length;C++){var y=g[C],f=_(y,["tkhd"])[0];if(f){var c=f.data[f.start],s=c===0?12:20,a=O(f,s),m=_(y,["mdia","mdhd"])[0];if(m){c=m.data[m.start],s=c===0?12:20;var p=O(m,s),v=_(y,["mdia","hdlr"])[0];if(v){var R=P(v.data.subarray(v.start+8,v.start+12)),U={soun:k.ElementaryStreamTypes.AUDIO,vide:k.ElementaryStreamTypes.VIDEO}[R];if(U){var j=_(y,["mdia","minf","stbl","stsd"])[0],G=void 0;j&&(G=P(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=_(S,["moov","mvex","trex"]);return B.forEach(function(N){var V=O(N,4),q=h[V];q&&(q.default={duration:O(N,12),flags:O(N,20)})}),h}function w(S,h){return _(h,["moof","traf"]).reduce(function(g,C){var y=_(C,["tfdt"])[0],f=y.data[y.start],c=_(C,["tfhd"]).reduce(function(s,a){var m=O(a,4),p=S[m];if(p){var v=O(y,4);f===1&&(v*=Math.pow(2,32),v+=O(y,8));var R=p.timescale||9e4,U=v/R;if(isFinite(U)&&(s===null||U<s))return U}return s},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=_(S,["moof","traf"]),c=0;c<f.length;c++){var s=f[c],a=_(s,["tfhd"])[0],m=O(a,4),p=h[m];if(!p)continue;var v=p.default,R=O(a,0)|(v==null?void 0:v.flags),U=v==null?void 0:v.duration;R&8&&(R&2?U=O(a,12):U=O(a,8));for(var j=p.timescale||9e4,G=_(s,["trun"]),B=0;B<G.length;B++){if(U){var N=O(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(q,ie){return q+ie.info.duration||0},0)}return C||y}function d(S){var h=O(S,0),g=8;h&1&&(g+=4),h&4&&(g+=4);for(var C=0,y=O(S,4),f=0;f<y;f++){if(h&256){var c=O(S,g);C+=c,g+=4}h&512&&(g+=4),h&1024&&(g+=4),h&2048&&(g+=4)}return C}function o(S,h,g){_(h,["moof","traf"]).forEach(function(C){_(C,["tfhd"]).forEach(function(y){var f=O(y,4),c=S[f];if(!c)return;var s=c.timescale||9e4;_(C,["tfdt"]).forEach(function(a){var m=a.data[a.start],p=O(a,4);if(m===0)E(a,4,p-g*s);else{p*=Math.pow(2,32),p+=O(a,8),p-=g*s,p=Math.max(p,0);var v=Math.floor(p/(M+1)),R=Math.floor(p%(M+1));E(a,4,v),E(a,8,R)}})})})}function u(S){var h={valid:null,remainder:null},g=_(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,P){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=F,this.trackName=P}var M=k.prototype;return M.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},M.newCue=function(P,D,O){(this.startTime===null||this.startTime>P)&&(this.startTime=P),this.endTime=D,this.screen=O,this.timelineController.createCaptionsTrack(this.trackName)},M.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 M}),L.d(z,"clearCurrentCues",function(){return F}),L.d(z,"removeCuesInRange",function(){return P}),L.d(z,"getCuesInRange",function(){return O});var H=L("./src/utils/logger.ts");function k(E,_){var T;try{T=new Event("addtrack")}catch(A){T=document.createEvent("Event"),T.initEvent("addtrack",!1,!1)}T.track=E,_.dispatchEvent(T)}function M(E,_){var T=E.mode;if(T==="disabled"&&(E.mode="hidden"),E.cues&&!E.cues.getCueById(_.id))try{if(E.addCue(_),!E.cues.getCueById(_.id))throw new Error("addCue is failed for: "+_)}catch(w){H.logger.debug("[texttrack-utils]: "+w);var A=new self.TextTrackCue(_.startTime,_.endTime,_.text);A.id=_.id,E.addCue(A)}T==="disabled"&&(E.mode=T)}function F(E){var _=E.mode;if(_==="disabled"&&(E.mode="hidden"),E.cues)for(var T=E.cues.length;T--;)E.removeCue(E.cues[T]);_==="disabled"&&(E.mode=_)}function P(E,_,T){var A=E.mode;if(A==="disabled"&&(E.mode="hidden"),E.cues&&E.cues.length>0)for(var w=O(E.cues,_,T),b=0;b<w.length;b++)E.removeCue(w[b]);A==="disabled"&&(E.mode=A)}function D(E,_){if(_<E[0].startTime)return 0;var T=E.length-1;if(_>E[T].endTime)return-1;for(var A=0,w=T;A<=w;){var b=Math.floor((w+A)/2);if(_<E[b].startTime)w=b-1;else if(_>E[b].startTime&&A<T)A=b+1;else return b}return E[A].startTime-_<_-E[w].startTime?A:w}function O(E,_,T){var A=[],w=D(E,_);if(w>-1)for(var b=w,d=E.length;b<d;b++){var o=E[b];if(o.startTime>=_&&o.endTime<=T)A.push(o);else if(o.startTime>T)return A}return A}},"./src/utils/time-ranges.ts":function(re,z,L){"use strict";L.r(z);var H={toString:function(M){for(var F="",P=M.length,D=0;D<P;D++)F+="["+M.start(D).toFixed(3)+","+M.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 M}),L.d(z,"toMsFromMpegTsClock",function(){return F}),L.d(z,"toMpegTsClockFromTimescale",function(){return P});var H=9e4;function k(D,O,E,_){E===void 0&&(E=1),_===void 0&&(_=!1);var T=D*O*E;return _?Math.round(T):T}function M(D,O,E,_){return E===void 0&&(E=1),_===void 0&&(_=!1),k(D,O,1/E,_)}function F(D,O){return O===void 0&&(O=!1),k(D,1e3,1/H,O)}function P(D,O){return O===void 0&&(O=1),k(D,H,1/O)}},"./src/utils/typed-array.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"sliceUint8",function(){return H});function H(k,M,F){return Uint8Array.prototype.slice?k.slice(M,F):new Uint8Array(Array.prototype.slice.call(k,M,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 M(E,_){if(typeof _!="string")return!1;if(!Array.isArray(E))return!1;var T=_.toLowerCase();return~E.indexOf(T)?T:!1}function F(E){return M(H,E)}function P(E){return M(k,E)}function D(E){for(var _=arguments.length,T=new Array(_>1?_-1:0),A=1;A<_;A++)T[A-1]=arguments[A];for(var w=1;w<arguments.length;w++){var b=arguments[w];for(var d in b)E[d]=b[d]}return E}function O(E,_,T){var A=this,w={enumerable:!0};A.hasBeenReset=!1;var b="",d=!1,o=E,u=_,l=T,S=null,h="",g=!0,C="auto",y="start",f=50,c="middle",s=50,a="middle";Object.defineProperty(A,"id",D({},w,{get:function(){return b},set:function(p){b=""+p}})),Object.defineProperty(A,"pauseOnExit",D({},w,{get:function(){return d},set:function(p){d=!!p}})),Object.defineProperty(A,"startTime",D({},w,{get:function(){return o},set:function(p){if(typeof p!="number")throw new TypeError("Start time must be set to a number.");o=p,this.hasBeenReset=!0}})),Object.defineProperty(A,"endTime",D({},w,{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({},w,{get:function(){return l},set:function(p){l=""+p,this.hasBeenReset=!0}})),Object.defineProperty(A,"region",D({},w,{get:function(){return S},set:function(p){S=p,this.hasBeenReset=!0}})),Object.defineProperty(A,"vertical",D({},w,{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({},w,{get:function(){return g},set:function(p){g=!!p,this.hasBeenReset=!0}})),Object.defineProperty(A,"line",D({},w,{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({},w,{get:function(){return y},set:function(p){var v=P(p);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");y=v,this.hasBeenReset=!0}})),Object.defineProperty(A,"position",D({},w,{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({},w,{get:function(){return c},set:function(p){var v=P(p);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");c=v,this.hasBeenReset=!0}})),Object.defineProperty(A,"size",D({},w,{get:function(){return s},set:function(p){if(p<0||p>100)throw new Error("Size must be between 0 and 100.");s=p,this.hasBeenReset=!0}})),Object.defineProperty(A,"align",D({},w,{get:function(){return a},set:function(p){var v=P(p);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");a=v,this.hasBeenReset=!0}})),A.displayState=void 0}return O.prototype.getCueAsHTML=function(){var E=self.WebVTT;return E.convertCueToDOMTree(self,this.text)},O}()},"./src/utils/vttparser.ts":function(re,z,L){"use strict";L.r(z),L.d(z,"parseTimeStamp",function(){return M}),L.d(z,"fixLineBreaks",function(){return _}),L.d(z,"VTTParser",function(){return T});var H=L("./src/utils/vttcue.ts"),k=function(){function A(){}var w=A.prototype;return w.decode=function(d,o){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},A}();function M(A){function w(d,o,u,l){return(d|0)*3600+(o|0)*60+(u|0)+parseFloat(l||0)}var b=A.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return b?parseFloat(b[2])>59?w(b[2],b[3],0,b[4]):w(b[1],b[2],b[3],b[4]):null}var F=function(){function A(){this.values=Object.create(null)}var w=A.prototype;return w.set=function(d,o){!this.get(d)&&o!==""&&(this.values[d]=o)},w.get=function(d,o,u){return u?this.has(d)?this.values[d]:o[u]:this.has(d)?this.values[d]:o},w.has=function(d){return d in this.values},w.alt=function(d,o,u){for(var l=0;l<u.length;++l)if(o===u[l]){this.set(d,o);break}},w.integer=function(d,o){/^-?\d+$/.test(o)&&this.set(d,parseInt(o,10))},w.percent=function(d,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var u=parseFloat(o);if(u>=0&&u<=100)return this.set(d,u),!0}return!1},A}();function P(A,w,b,d){var o=d?A.split(d):[A];for(var u in o){if(typeof o[u]!="string")continue;var l=o[u].split(b);if(l.length!==2)continue;var S=l[0],h=l[1];w(S,h)}}var D=new H.default(0,0,""),O=D.align==="middle"?"middle":"center";function E(A,w,b){var d=A;function o(){var S=M(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;P(S,function(f,c){var s;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":s=c.split(","),g.integer(f,s[0]),g.percent(f,s[0])&&g.set("snapToLines",!1),g.alt(f,s[0],["auto"]),s.length===2&&g.alt("lineAlign",s[1],["start",O,"end"]);break;case"position":s=c.split(","),g.percent(f,s[0]),s.length===2&&g.alt("positionAlign",s[1],["start",O,"end","line-left","line-right","auto"]);break;case"size":g.percent(f,c);break;case"align":g.alt(f,c,["start",O,"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",O);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(),w.startTime=o(),l(),A.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);A=A.substr(3),l(),w.endTime=o(),l(),u(A,w)}function _(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 w=A.prototype;return w.parse=function(d){var o=this;d&&(o.buffer+=o.decoder.decode(d,{stream:!0}));function u(){var y=o.buffer,f=0;for(y=_(y);f<y.length&&y[f]!=="\r"&&y[f]!==`
|
|
`;)++f;var c=y.substr(0,f);return y[f]==="\r"&&++f,y[f]===`
|
|
`&&++f,o.buffer=y.substr(f),c}function l(y){P(y,function(f,c){},/:/)}try{var S="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;S=u();var h=S.match(/^()?WEBVTT([ \t].*)?$/);if(!h||!h[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var g=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;g?g=!1:S=u();switch(o.state){case"HEADER":/:/.test(S)?l(S):S||(o.state="ID");continue;case"NOTE":S||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(S)){o.state="NOTE";break}if(!S)continue;if(o.cue=new H.default(0,0,""),o.state="CUE",S.indexOf("-->")===-1){o.cue.id=S;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{E(S,o.cue,o.regionList)}catch(y){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var C=S.indexOf("-->")!==-1;if(!S||C&&(g=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
|
|
`),o.cue.text+=S}continue;case"BADCUE":S||(o.state="ID")}}}catch(y){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},w.flush=function(){var d=this;try{if((d.cue||d.state==="HEADER")&&(d.buffer+=`
|
|
|
|
`,d.parse()),d.state==="INITIAL"||d.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){d.onparsingerror&&d.onparsingerror(o)}return d.onflush&&d.onflush(),this},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 w});var H=L("./src/polyfills/number.ts"),k=L("./src/utils/vttparser.ts"),M=L("./src/demux/id3.ts"),F=L("./src/utils/timescale-conversion.ts"),P=L("./src/remux/mp4-remuxer.ts"),D=/\r\n|\n\r|\n|\r/g,O=function(d,o,u){return u===void 0&&(u=0),d.substr(u,o.length)===o},E=function(d){var o=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)(o)||!Object(H.isFiniteNumber)(u)||!Object(H.isFiniteNumber)(l)||!Object(H.isFiniteNumber)(S))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return o+=1e3*u,o+=60*1e3*l,o+=60*60*1e3*S,o},_=function(d){for(var o=5381,u=d.length;u;)o=o*33^d.charCodeAt(--u);return(o>>>0).toString()};function T(b,d,o){return _(b.toString())+_(d.toString())+_(o)}var A=function(d,o,u){var l=d[o],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 w(b,d,o,u,l,S,h,g){var C=new k.VTTParser,y=Object(M.utf8ArrayToStr)(new Uint8Array(b)).trim().replace(D,`
|
|
`).split(`
|
|
`),f=[],c=Object(F.toMpegTsClockFromTimescale)(d,o),s="00:00.000",a=0,m=0,p,v=!0,R=!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),R){var N=U.endTime-U.startTime,V=Object(P.normalizePts)((U.startTime+G-m)*9e4,S*9e4)/9e4;U.startTime=V,U.endTime=V+N}var q=U.text.trim();U.text=decodeURIComponent(encodeURIComponent(q)),U.id||(U.id=T(U.startTime,U.endTime,q)),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(O(U,"X-TIMESTAMP-MAP=")){v=!1,R=!0,U.substr(16).split(",").forEach(function(j){O(j,"LOCAL:")?s=j.substr(6):O(j,"MPEGTS:")&&(a=parseInt(j.substr(7)))});try{m=E(s)/1e3}catch(j){R=!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"),M=/^age:\s*[\d.]+\s*$/m,F=function(){function P(O){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=O?O.xhrSetup:null,this.stats=new k.LoadStats,this.retryDelay=0}var D=P.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,_,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=_,this.callbacks=T,this.retryDelay=_.retryDelay,this.loadInternal()},D.loadInternal=function(){var E=this.config,_=this.context;if(!E)return;var T=this.loader=new self.XMLHttpRequest,A=this.stats;A.loading.first=0,A.loaded=0;var w=this.xhrSetup;try{if(w)try{w(T,_.url)}catch(o){T.open("GET",_.url,!0),w(T,_.url)}T.readyState||T.open("GET",_.url,!0);var b=this.context.headers;if(b)for(var d in b)T.setRequestHeader(d,b[d])}catch(o){this.callbacks.onError({code:T.status,text:o.message},_,T);return}_.rangeEnd&&T.setRequestHeader("Range","bytes="+_.rangeStart+"-"+(_.rangeEnd-1)),T.onreadystatechange=this.readystatechange.bind(this),T.onprogress=this.loadprogress.bind(this),T.responseType=_.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),E.timeout),T.send()},D.readystatechange=function(){var E=this.context,_=this.loader,T=this.stats;if(!E||!_)return;var A=_.readyState,w=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){_.onreadystatechange=null,_.onprogress=null;var b=_.status;if(b>=200&&b<300){T.loading.end=Math.max(self.performance.now(),T.loading.first);var d,o;if(E.responseType==="arraybuffer"?(d=_.response,o=d.byteLength):(d=_.responseText,o=d.length),T.loaded=T.total=o,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(T,E,d,_),!this.callbacks)return;var l={url:_.responseURL,data:d};this.callbacks.onSuccess(l,T,E,_)}else T.retry>=w.maxRetry||b>=400&&b<499?(H.logger.error(b+" while loading "+E.url),this.callbacks.onError({code:b,text:_.statusText},E,_)):(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,w.maxRetryDelay),T.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),w.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 _=this.stats;_.loaded=E.loaded,E.lengthComputable&&(_.total=E.total)},D.getCacheAge=function(){var E=null;if(this.loader&&M.test(this.loader.getAllResponseHeaders())){var _=this.loader.getResponseHeader("age");E=_?parseFloat(_):null}return E},P}();z.default=F}}).default})},vHTk:function(it,Je,J){it.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},zeoU:function(it,Je,J){"use strict";J.r(Je);var re=J("T2oS"),z=J("W9HT"),L=J("R9oj"),H=J("ECub"),k=J("sPJy"),M=J("bE4q"),F=J("9og8"),P=J("tJVT"),D=J("PpiC"),O=J("WmNS"),E=J.n(O),_=J("q1tI"),T=J.n(_),A=J("Ty5D"),w=J("9kvl"),b=J("m3rI"),d=J("BdwD"),o=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"),s=J("tsqr"),a=J("lfxj"),m=J.n(a),p=function(Ce){var Re=Ce.isPrised,Fe=Ce.num,Ne=Ce.memo_id,De=Ce.container_type,ze=Ce.current_login,Xe=Ce.showLoginDialog,me=Object(_.useState)(void 0),Ye=Object(P.a)(me,2),Ke=Ye[0],ye=Ye[1],Oe=Object(_.useState)(void 0),te=Object(P.a)(Oe,2),$=te[0],ae=te[1];Object(_.useEffect)(function(){ye(Re),ae(Fe)},[]);function Y(){if(ze)Object(h.w)({container_type:De,id:Ne,type:Ke?0:1}).then(function(Q){ae(Q.praise_count),ye(!Ke),s.b.success(Ke?"\u53D6\u6D88\u70B9\u8D5E":"\u5DF2\u70B9\u8D5E")}).catch(function(Q){s.b.error(Q)});else{Xe();return}}return T.a.createElement("div",{className:m.a.priseBox},T.a.createElement("span",{onClick:Y},T.a.createElement("i",{className:Ke?"iconfont icon-dianzan":"iconfont icon-dianzan-xian"})),T.a.createElement("span",null,$))},v=J("DjyN"),R=J("NUBc"),U=J("Mwp2"),j=J("VXEj"),G=J("oBTY"),B=J("+L6B"),N=J("2/Rp"),V=J("Ot1p");function q(Ce){var Re=Ce.memo_id,Fe=Ce.user_image,Ne=Ce.click_button,De=Ce.new_reply,ze=Object(_.useState)(!1),Xe=Object(P.a)(ze,2),me=Xe[0],Ye=Xe[1],Ke=Object(_.useState)(""),ye=Object(P.a)(Ke,2),Oe=ye[0],te=ye[1];function $(Q){te(Q)}function ae(){Ye(!0),Object(h.a)({parent_id:Re,content:Oe}).then(function(Q){Q&&(Q.status===0&&De(Q.reply)),Ye(!1)}).catch(function(Q){Ye(!1),s.b.error(Q)})}function Y(){Ne(!1)}return T.a.createElement("div",{className:"grid-item-top pt20"},T.a.createElement("img",{src:b.a.IMG_SERVER+"/images/"+Fe,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:$}),T.a.createElement("p",{className:"clearfix mt20"},T.a.createElement(N.a,{type:"primary",onClick:ae,loading:me,className:"mr15 commentBtn btnSize"},"\u8BC4\u8BBA"),T.a.createElement(N.a,{className:"btnSize",onClick:Y},"\u53D6\u6D88"))))}var ie=q,se=J("P2fV"),xe=J("NJEC");function fe(Ce){var Re=Ce.replies,Fe=Ce.user_image,Ne=Ce.current_login,De=Ce.reload,ze=Ce.reload_children;return T.a.createElement("div",{className:"children-memo-item"},T.a.createElement(j.b,{size:"large",header:"",dataSource:Re,renderItem:function(me){return T.a.createElement(j.b.Item,null,T.a.createElement(be,{item:me,reload_children:ze,user_image:Fe,current_login:Ne,is_children:!0,reload:De}))}}))}var Ee=fe,ge=function(Re){var Fe=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:Fe},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"}))},ve=function(Re){var Fe=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:Fe},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(Ce){var Re,Fe,Ne,De=Ce.item,ze=Ce.user_image,Xe=Ce.current_login,me=Ce.is_children,Ye=Ce.target_type,Ke=Ce.commet_destroy,ye=Ce.user,Oe=Ce.reload,te=Ce.reload_children,$=Ce.props,ae=Object(_.useState)(!1),Y=Object(P.a)(ae,2),Q=Y[0],Z=Y[1],ee=Object(_.useState)(!1),de=Object(P.a)(ee,2),pe=de[0],Le=de[1],tt=Object(_.useState)(!1),ct=Object(P.a)(tt,2),rt=ct[0],Et=ct[1],ht=Object(_.useState)([]),nt=Object(P.a)(ht,2),bt=nt[0],vt=nt[1],Bt=Object(_.useState)(0),Dt=Object(P.a)(Bt,2),ft=Dt[0],Gt=Dt[1],vr=Object(_.useState)(1),Xt=Object(P.a)(vr,2),Yt=Xt[0],rr=Xt[1],kr=Object(_.useState)(!1),It=Object(P.a)(kr,2),Nt=It[0],Ht=It[1],Ct=Object(_.useState)(0),et=Object(P.a)(Ct,2),yr=et[0],Ir=et[1],ur=Object(_.useState)(!1),yt=Object(P.a)(ur,2),br=yt[0],Er=yt[1],dr=Object(_.useState)(5),Ie=Object(P.a)(dr,2),st=Ie[0],Ve=Ie[1];Object(_.useEffect)(function(){vt(De.children),De.children?Gt(De.children.length):Gt(0),Ht(De.user_praise),Ir(De.praise_count)},[De]);var Nr=function(Tt){if(Xe)Z(Tt);else{$.showLoginDialog();return}},Dr=function(Tt){if(Xe){var Ar={container_type:"Memo",id:Tt,type:Nt?0:1};Object(h.w)(Ar).then(function(Lt){Ir(Lt.praise_count),Ht(!Nt),s.b.success(Nt?"\u53D6\u6D88\u70B9\u8D5E":"\u5DF2\u70B9\u8D5E")}).catch(function(Lt){s.b.error(Lt)})}else{$.showLoginDialog();return}};function Sr(dt){Et(!0),Object(h.g)(dt).then(function(Tt){Tt&&(Tt.status===0?(Le(!0),me?Gt(ft-1):Ke(),s.b.success(Tt.message)):s.b.error(Tt.message)),Et(!1)}).catch(function(Tt){Et(!1),s.b.error(Tt)})}var Cr=function(Tt){if(me){te(Tt),Z(!1);return}bt&&bt.length>0?vt([].concat(Object(G.a)(bt),[Tt])):vt([Tt]),Gt(ft+1),Z(!1)},lt=function(Tt){vt([].concat(Object(G.a)(bt),[Tt])),Gt(ft+1)};function Pt(dt){var Tt=Yt;ft<st?(rr(1),Tt=1):(Tt=Yt+1,rr(Tt)),Er(!0);var Ar={page:Tt,limit:st,target_type:Ye,target_id:dt};Object(h.u)(Ar).then(function(Lt){Lt&&Lt.memo_replies&&vt(bt.concat(Lt.memo_replies)),Er(!1)}).catch(function(Lt){Er(!1),s.b.error(Lt)})}var Vr=(Re=ye.userInfo)===null||Re===void 0?void 0:Re.admin,Qt=function(){var dt=Object(F.a)(E.a.mark(function Tt(Ar,Lt,Wr){var sn;return E.a.wrap(function(cr){for(;;)switch(cr.prev=cr.next){case 0:return cr.next=2,Object(h.d)(Ar,{banned:Wr,user_id:Lt});case 2:sn=cr.sent,sn.status===0&&Oe();case 4:case"end":return cr.stop()}},Tt)}));return function(Ar,Lt,Wr){return dt.apply(this,arguments)}}();return T.a.createElement("div",{className:"width100"},pe?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(o.a,{to:"/forums/accounts/".concat(De&&De.user_login,"/memos"),className:"show-user-link"},T.a.createElement("img",{className:"user-image",src:b.a.IMG_SERVER+"/images/"+De.image_url})),T.a.createElement(o.a,{to:"/forums/accounts/".concat(De&&De.user_login,"/memos"),className:"show-user-link color-black ml10 fwb fs14"},De&&De.username),me&&!!(De!=null&&De.parent_data)&&T.a.createElement(T.a.Fragment,null,T.a.createElement(le.a,{style:{marginTop:1},className:"ml5 mr5 font12"}),T.a.createElement(o.a,{to:"/forums/accounts/".concat(De==null||((Fe=De.parent_data)===null||Fe===void 0)?void 0:Fe.user_login,"/memos"),className:"show-user-link color-black fwb fs14"},De==null||((Ne=De.parent_data)===null||Ne===void 0)?void 0:Ne.name))),T.a.createElement("div",{className:"ml40"},De.content&&T.a.createElement(S.a,{className:"tipsContent",value:De.content}),T.a.createElement("div",{className:"grid-item-left mt5"},T.a.createElement("span",{className:"color-grey-8 fs14"},De.time),T.a.createElement("div",{className:"text-right grid-item-4"},Vr&&(De.is_banned?T.a.createElement(N.a,{className:"link-btn",type:"link",icon:T.a.createElement(ve,{className:"relieve-icon mr5"}),onClick:function(){return Qt(De.id,De.user_id,0)}},T.a.createElement("span",{className:"allow-comment"},"\u6062\u590D\u8BC4\u8BBA")):T.a.createElement(xe.a,{placement:"bottom",title:"\u786E\u5B9A\u8981\u7981\u8A00\u6B64\u7528\u6237\u5417?",okText:"\u662F",cancelText:"\u5426",onConfirm:function(){return Qt(De.id,De.user_id,1)}},T.a.createElement(N.a,{className:"link-btn",type:"link",icon:T.a.createElement(ge,{className:"ban-icon mr5"})},T.a.createElement("span",{className:"font-14 color-grey-8 ver-middle"},"\u7981\u6B62\u8BC4\u8BBA")))),De.admin||Xe===De.user_login?T.a.createElement(xe.a,{placement:"bottom",title:"\u786E\u5B9A\u8981\u5220\u9664\u5F53\u524D\u8BC4\u8BBA\u5417?",okText:"\u662F",cancelText:"\u5426",onConfirm:function(){return Sr(De.id)}},T.a.createElement(N.a,{className:"link-btn",type:"link",loading:rt},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"))):"",me&&T.a.createElement(N.a,{onClick:function(){Nr(!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")),!me&&T.a.createElement(N.a,{type:"link",className:"link-btn ml-10",onClick:function(){Dr(De.id)}},Nt?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"},yr)),!me&&T.a.createElement(N.a,{type:"link",className:"link-btn ml-10",onClick:function(){Nr(!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"},ft)))),Q&&T.a.createElement(ie,{memo_id:De.id,user_image:ze,click_button:Nr,new_reply:Cr}),bt&&ft>0&&T.a.createElement(Ee,{replies:bt,user_image:ze,current_login:Xe,reload:Oe,reload_children:lt}),De&&bt&&De.replies_count>ft&&De.replies_count>=Yt*st&&T.a.createElement("div",{className:"mt10 edu-text-center"},T.a.createElement(N.a,{loading:br,type:"primary",className:"commentBtn btnSize",onClick:function(){return Pt(De.id)}},"\u67E5\u770B\u66F4\u591A\u56DE\u590D")))))}var be=Object(w.a)(function(Ce){var Re=Ce.user;return{user:Re}})(ue);function je(Ce){var Re=Ce.user_image,Fe=Ce.click_button,Ne=function(){Fe(!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:Ne},T.a.createElement("span",null,"\u6DFB\u52A0\u8BC4\u8BBA..."))))}var Be=je,ke=J("FdIy");function Me(Ce){var Re=Ce.target_id,Fe=Ce.target_type,Ne=Ce.current_user_image,De=Ce.current_login,ze=Object(D.a)(Ce,["target_id","target_type","current_user_image","current_login"]),Xe=Object(_.useState)(null),me=Object(P.a)(Xe,2),Ye=me[0],Ke=me[1],ye=Object(_.useState)([]),Oe=Object(P.a)(ye,2),te=Oe[0],$=Oe[1],ae=Object(_.useState)(0),Y=Object(P.a)(ae,2),Q=Y[0],Z=Y[1],ee=Object(_.useState)(!1),de=Object(P.a)(ee,2),pe=de[0],Le=de[1],tt=Object(_.useState)(1),ct=Object(P.a)(tt,2),rt=ct[0],Et=ct[1],ht=Object(_.useState)(10),nt=Object(P.a)(ht,2),bt=nt[0],vt=nt[1],Bt=Object(_.useState)(!1),Dt=Object(P.a)(Bt,2),ft=Dt[0],Gt=Dt[1],vr=function(){Le(!0);var Nt={target_type:Fe,target_id:Re,page:rt,limit:bt};Object(h.u)(Nt).then(function(Ht){Ht&&Ht.memo_replies&&($(Ht.memo_replies),Z(Ht.memos_count)),Le(!1)}).catch(function(Ht){Le(!1),s.b.error(Ht)})};Object(_.useEffect)(function(){vr()},[rt,Re]),Object(_.useEffect)(function(){Ke(Ne||"/images/avatars/User/boy.jpg")},[]);function Xt(It){Et(It)}var Yt=function(Nt){if(De)Gt(Nt);else{ze.showLoginDialog();return}},rr=function(Nt){var Ht=Q+1;Z(Ht),$([Nt].concat(Object(G.a)(te))),Gt(!1)},kr=function(Nt){var Ht=Q-1;Z(Ht)};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:pe},T.a.createElement("div",{className:"comments-lists"},ft?T.a.createElement(ie,{click_button:Yt,memo_id:Re,user_image:Ye,new_reply:rr}):T.a.createElement(Be,{user_image:Ye,click_button:Yt}),te&&te.length>0&&T.a.createElement(j.b,{size:"large",loading:pe,header:"",dataSource:te,renderItem:function(Nt){return T.a.createElement(j.b.Item,null,T.a.createElement(be,{item:Nt,user_image:Ye,current_login:De,reload:vr,is_children:!1,target_type:Fe,commet_destroy:kr,props:ze}))}}),Q>bt&&T.a.createElement("div",{className:"edu-text-center pd20"},T.a.createElement(R.a,{showQuickJumper:!0,current:rt,onChange:Xt,total:Q,pageSize:bt})))))}var we=Me,Ae=J("6S+g"),Ue=J("hLB0"),Ge=function(Ce){var Re=Ce.user;Object(_.useEffect)(function(){Re&&ze(Re.watchers_count)},[]);var Fe=Object(_.useState)(0),Ne=Object(P.a)(Fe,2),De=Ne[0],ze=Ne[1],Xe=function(Ye){var Ke=De+Ye;ze(Ke)};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,De),T.a.createElement("span",null,"\u5173\u6CE8\u8005"))))},He=J("sNeV"),_e=function(Re){var Fe,Ne=Re.globalSetting,De=Re.loading,ze=Re.user,Xe=Re.dispatch,me=Object(D.a)(Re,["globalSetting","loading","user","dispatch"]),Ye=Object(A.i)(),Ke=Ye.memoId,ye=ze.userInfo,Oe=Object(_.useState)(null),te=Object(P.a)(Oe,2),$=te[0],ae=te[1],Y=Object(_.useState)(null),Q=Object(P.a)(Y,2),Z=Q[0],ee=Q[1],de=Object(_.useState)([]),pe=Object(P.a)(de,2),Le=pe[0],tt=pe[1],ct=Object(_.useState)(null),rt=Object(P.a)(ct,2),Et=rt[0],ht=rt[1],nt=Object(_.useState)([]),bt=Object(P.a)(nt,2),vt=bt[0],Bt=bt[1],Dt=Object(_.useState)(void 0),ft=Object(P.a)(Dt,2),Gt=ft[0],vr=ft[1],Xt=Object(_.useState)(!1),Yt=Object(P.a)(Xt,2),rr=Yt[0],kr=Yt[1],It=Object(_.useState)(1),Nt=Object(P.a)(It,2),Ht=Nt[0],Ct=Nt[1],et=Object(_.useState)(5),yr=Object(P.a)(et,2),Ir=yr[0],ur=yr[1],yt=Object(_.useState)(!1),br=Object(P.a)(yt,2),Er=br[0],dr=br[1],Ie=Object(_.useState)({}),st=Object(P.a)(Ie,2),Ve=st[0],Nr=st[1];Object(_.useEffect)(function(){Dr(),Cr()},[Ke]);function Dr(){return Sr.apply(this,arguments)}function Sr(){return Sr=Object(F.a)(E.a.mark(function Pt(){return E.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:dr(!0),Object(h.j)({memo_id:Ke}).then(function(dt){if(dt){var Tt={admin:dt&&dt.is_current_admin,login:dt&&dt.current_login,banned_permission:dt.banned_permission,is_currentUser:dt.author_info?dt.author_info.is_current_user:void 0,is_fine:dt.memo&&dt.memo.is_fine,sticky:dt.memo&&dt.memo.sticky,memo_watched:dt.memo&&dt.memo.memo_watched,is_deleted:dt.memo&&dt.memo.apply_destroy};vr(Tt),ae(dt.memo),ht(dt.memo_image_info),Bt(dt.recent_memos),kr(dt.is_banned),ee(dt.author_info)}dr(!1)}).catch(function(dt){dr(!1),console.log(dt)});case 2:case"end":return Qt.stop()}},Pt)})),Sr.apply(this,arguments)}function Cr(){Object(h.s)({memo_id:Ke}).then(function(Pt){Pt&&tt(Pt.memos),dr(!1)}).catch(function(Pt){dr(!1),console.log(Pt)})}function lt(){var Pt;window.location.href=Ne==null||((Pt=Ne.setting)===null||Pt===void 0)?void 0:Pt.sso_url}return T.a.createElement("div",{className:l.a.educontent},T.a.createElement(z.a,{spinning:Er},$&&Z?T.a.createElement("div",null,T.a.createElement(M.a,{separator:">",style:{marginBottom:"10px"}},T.a.createElement(M.a.Item,null,T.a.createElement(o.a,{to:"/forums"},"\u8BBA\u575B")),$&&$.forum_tag&&$.forum_tag.id&&T.a.createElement(M.a.Item,null,T.a.createElement(o.a,{to:"/forums/subject/".concat($&&$.forum_tag.id)},$&&$.forum_tag.title)),T.a.createElement(M.a.Item,null,$?$.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:$.tag_name=="\u4EA4\u6D41"?l.a.blue:l.a.tag_Orange},"\u3010",$.tag_name,"\u3011"),T.a.createElement("p",{className:l.a.titleStyle},$&&$.subject),$.sticky===!0?T.a.createElement("span",{className:"".concat(l.a.tag," ").concat(l.a.tagRed)},"\u7F6E\u9876"):"",$.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"}},ye&&ye.login?T.a.createElement(He.a,{permission:Gt,id:Ke,calbackFunc:Dr}):""),$&&$.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"},$&&$.viewed_count)),T.a.createElement("span",{className:l.a.iconWrap},T.a.createElement(f.a,null),T.a.createElement("span",{className:"span-text"},$&&$.replies_count)),T.a.createElement("span",{className:"grey-8 ml20"},$&&$.published_time),$&&$.apply_destroy&&T.a.createElement("span",{style:{marginLeft:"20px",color:"#fa6400"}},"\u5DF2\u7533\u8BF7\u5220\u5E16")),T.a.createElement("div",{className:l.a.content},Et&&T.a.createElement("div",{style:{paddingBottom:"20px"}},T.a.createElement("img",{src:b.a.IMG_SERVER+Et.url,style:{width:"100%"}})),T.a.createElement(S.a,{style:{textAlign:"justify",wordBreak:"break-all"},value:$.content}),T.a.createElement("div",{className:l.a.row},$.attachment_url&&$.attachment_url.length>0&&((Fe=$.attachment_url)===null||Fe===void 0?void 0:Fe.map(function(Pt){return T.a.createElement("a",{key:Pt.id,target:"_blank",href:Pt.url},T.a.createElement("i",{className:"iconfont icon-fujian font14 mr10"}),T.a.createElement("span",{className:"mr10"},Pt.title),T.a.createElement("span",null,Pt.filesize))})))),$.reprint_link&&T.a.createElement("p",{style:{fontSize:"12px",color:"#888"}},"\u8F6C\u8F7D\u81EA\uFF1A",$.reprint_link),T.a.createElement(p,{isPrised:$.user_praise,num:$.praises_count,memo_id:$.id,container_type:"Memo",current_login:Z&&Z.current_login,showLoginDialog:lt}))),T.a.createElement("div",{className:"".concat(l.a.whiteBack," ").concat(l.a.mt15)},T.a.createElement(we,{target_id:$&&$.id,target_type:"memos",current_user_image:Z&&Z.current_image_url,current_login:Z&&Z.current_login,showLoginDialog:lt})),Le&&Le.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(Ae.a,{memos:Le,calbackFunc:Cr}))),T.a.createElement("div",{className:l.a.Short},T.a.createElement(Ge,{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},vt&&vt.length>0?vt.map(function(Pt){return T.a.createElement("li",{key:Pt.id},T.a.createElement("a",{href:"/forums/".concat(Pt.id)},Pt.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"}})))},Te=Je.default=Object(w.a)(function(Ce){var Re=Ce.loading,Fe=Ce.user,Ne=Ce.globalSetting;return{globalSetting:Ne,loading:Re.effects,user:Fe}})(_e)}}]);
|