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
791 KiB
139 lines
791 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[243,5,7,8],{"+NIl":function(Rt,rt,Z){(function(re){re(Z("VrN/"))})(function(re){"use strict";re.defineMode("stex",function(V,L){"use strict";function K(S,_){S.cmdState.push(_)}function M(S){return S.cmdState.length>0?S.cmdState[S.cmdState.length-1]:null}function P(S){var _=S.cmdState.pop();_&&_.closeBracket()}function j(S){for(var _=S.cmdState,b=_.length-1;b>=0;b--){var d=_[b];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function k(S,_,b){return function(){this.name=S,this.bracketNo=0,this.style=_,this.styles=b,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var C={};C.importmodule=k("importmodule","tag",["string","builtin"]),C.documentclass=k("documentclass","tag",["","atom"]),C.usepackage=k("usepackage","tag",["atom"]),C.begin=k("begin","tag",["atom"]),C.end=k("end","tag",["atom"]),C.label=k("label","tag",["atom"]),C.ref=k("ref","tag",["atom"]),C.eqref=k("eqref","tag",["atom"]),C.cite=k("cite","tag",["atom"]),C.bibitem=k("bibitem","tag",["atom"]),C.Bibitem=k("Bibitem","tag",["atom"]),C.RBibitem=k("RBibitem","tag",["atom"]),C.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function R(S,_){S.f=_}function x(S,_){var b;if(S.match(/^\\[a-zA-Z@]+/)){var d=S.current().slice(1);return b=C.hasOwnProperty(d)?C[d]:C.DEFAULT,b=new b,K(_,b),R(_,O),b.style}if(S.match(/^\\[$&%#{}_]/))return"tag";if(S.match(/^\\[,;!\/\\]/))return"tag";if(S.match("\\["))return R(_,function(u,h){return A(u,h,"\\]")}),"keyword";if(S.match("\\("))return R(_,function(u,h){return A(u,h,"\\)")}),"keyword";if(S.match("$$"))return R(_,function(u,h){return A(u,h,"$$")}),"keyword";if(S.match("$"))return R(_,function(u,h){return A(u,h,"$")}),"keyword";var s=S.next();if(s=="%")return S.skipToEnd(),"comment";if(s=="}"||s=="]"){if(b=M(_),b)b.closeBracket(s),R(_,O);else return"error";return"bracket"}else return s=="{"||s=="["?(b=C.DEFAULT,b=new b,K(_,b),"bracket"):/\d/.test(s)?(S.eatWhile(/[\w.%]/),"atom"):(S.eatWhile(/[\w\-_]/),b=j(_),b.name=="begin"&&(b.argument=S.current()),b.styleIdentifier())}function A(S,_,b){if(S.eatSpace())return null;if(b&&S.match(b))return R(_,x),"keyword";if(S.match(/^\\[a-zA-Z@]+/))return"tag";if(S.match(/^[a-zA-Z]+/))return"variable-2";if(S.match(/^\\[$&%#{}_]/))return"tag";if(S.match(/^\\[,;!\/]/))return"tag";if(S.match(/^[\^_&]/))return"tag";if(S.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(S.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=S.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(S.skipToEnd(),"comment"):"error"}function O(S,_){var b=S.peek(),d;return b=="{"||b=="["?(d=M(_),d.openBracket(b),S.eat(b),R(_,x),"bracket"):/[ \t\r]/.test(b)?(S.eat(b),null):(R(_,x),P(_),x(S,_))}return{startState:function(){var S=L.inMathMode?function(_,b){return A(_,b)}:x;return{cmdState:[],f:S}},copyState:function(S){return{cmdState:S.cmdState.slice(),f:S.f}},token:function(S,_){return _.f(S,_)},blankLine:function(S){S.f=x,S.cmdState.length=0},lineComment:"%"}}),re.defineMIME("text/x-stex","stex"),re.defineMIME("text/x-latex","stex")})},"19Vz":function(Rt,rt,Z){(function(re){re(Z("VrN/"))})(function(re){re.defineOption("placeholder","",function(k,C,R){var x=R&&R!=re.Init;if(C&&!x)k.on("blur",M),k.on("change",P),k.on("swapDoc",P),re.on(k.getInputField(),"compositionupdate",k.state.placeholderCompose=function(){K(k)}),P(k);else if(!C&&x){k.off("blur",M),k.off("change",P),k.off("swapDoc",P),re.off(k.getInputField(),"compositionupdate",k.state.placeholderCompose),V(k);var A=k.getWrapperElement();A.className=A.className.replace(" CodeMirror-empty","")}C&&!k.hasFocus()&&M(k)});function V(k){k.state.placeholder&&(k.state.placeholder.parentNode.removeChild(k.state.placeholder),k.state.placeholder=null)}function L(k){V(k);var C=k.state.placeholder=document.createElement("pre");C.style.cssText="height: 0; overflow: visible",C.style.direction=k.getOption("direction"),C.className="CodeMirror-placeholder CodeMirror-line-like";var R=k.getOption("placeholder");typeof R=="string"&&(R=document.createTextNode(R)),C.appendChild(R),k.display.lineSpace.insertBefore(C,k.display.lineSpace.firstChild)}function K(k){setTimeout(function(){var C=!1,R=k.getInputField();R.nodeName=="TEXTAREA"?C=!R.value:k.lineCount()==1&&(C=!/[^\u200b]/.test(R.querySelector(".CodeMirror-line").textContent)),C?L(k):V(k)},20)}function M(k){j(k)&&L(k)}function P(k){var C=k.getWrapperElement(),R=j(k);C.className=C.className.replace(" CodeMirror-empty","")+(R?" CodeMirror-empty":""),R?L(k):V(k)}function j(k){return k.lineCount()===1&&k.getLine(0)===""}})},"1eCo":function(Rt,rt,Z){(function(re){re(Z("VrN/"))})(function(re){"use strict";var V={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},L={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};re.defineMode("xml",function(K,M){var P=K.indentUnit,j={},k=M.htmlMode?V:L;for(var C in k)j[C]=k[C];for(var C in M)j[C]=M[C];var R,x;function A(a,f){function o(N){return f.tokenize=N,N(a,f)}var v=a.next();if(v=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?o(_("atom","]]>")):null:a.match("--")?o(_("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),o(b(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),f.tokenize=_("meta","?>"),"meta"):(R=a.eat("/")?"closeTag":"openTag",f.tokenize=O,"tag bracket");if(v=="&"){var D;return a.eat("#")?a.eat("x")?D=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):D=a.eatWhile(/[\d]/)&&a.eat(";"):D=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),D?"atom":"error"}else return a.eatWhile(/[^&<]/),null}A.isInText=!0;function O(a,f){var o=a.next();if(o==">"||o=="/"&&a.eat(">"))return f.tokenize=A,R=o==">"?"endTag":"selfcloseTag","tag bracket";if(o=="=")return R="equals",null;if(o=="<"){f.tokenize=A,f.state=h,f.tagName=f.tagStart=null;var v=f.tokenize(a,f);return v?v+" tag error":"tag error"}else return/[\'\"]/.test(o)?(f.tokenize=S(o),f.stringStartCol=a.column(),f.tokenize(a,f)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function S(a){var f=function(o,v){for(;!o.eol();)if(o.next()==a){v.tokenize=O;break}return"string"};return f.isInAttribute=!0,f}function _(a,f){return function(o,v){for(;!o.eol();){if(o.match(f)){v.tokenize=A;break}o.next()}return a}}function b(a){return function(f,o){for(var v;(v=f.next())!=null;){if(v=="<")return o.tokenize=b(a+1),o.tokenize(f,o);if(v==">")if(a==1){o.tokenize=A;break}else return o.tokenize=b(a-1),o.tokenize(f,o)}return"meta"}}function d(a,f,o){this.prev=a.context,this.tagName=f,this.indent=a.indented,this.startOfLine=o,(j.doNotIndent.hasOwnProperty(f)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function s(a){a.context&&(a.context=a.context.prev)}function u(a,f){for(var o;;){if(!a.context)return;if(o=a.context.tagName,!j.contextGrabbers.hasOwnProperty(o)||!j.contextGrabbers[o].hasOwnProperty(f))return;s(a)}}function h(a,f,o){return a=="openTag"?(o.tagStart=f.column(),E):a=="closeTag"?m:h}function E(a,f,o){return a=="word"?(o.tagName=f.current(),x="tag",y):j.allowMissingTagName&&a=="endTag"?(x="tag bracket",y(a,f,o)):(x="error",E)}function m(a,f,o){if(a=="word"){var v=f.current();return o.context&&o.context.tagName!=v&&j.implicitlyClosed.hasOwnProperty(o.context.tagName)&&s(o),o.context&&o.context.tagName==v||j.matchClosing===!1?(x="tag",g):(x="tag error",w)}else return j.allowMissingTagName&&a=="endTag"?(x="tag bracket",g(a,f,o)):(x="error",w)}function g(a,f,o){return a!="endTag"?(x="error",g):(s(o),h)}function w(a,f,o){return x="error",g(a,f,o)}function y(a,f,o){if(a=="word")return x="attribute",p;if(a=="endTag"||a=="selfcloseTag"){var v=o.tagName,D=o.tagStart;return o.tagName=o.tagStart=null,a=="selfcloseTag"||j.autoSelfClosers.hasOwnProperty(v)?u(o,v):(u(o,v),o.context=new d(o,v,D==o.indented)),h}return x="error",y}function p(a,f,o){return a=="equals"?c:(j.allowMissing||(x="error"),y(a,f,o))}function c(a,f,o){return a=="string"?l:a=="word"&&j.allowUnquoted?(x="string",y):(x="error",y(a,f,o))}function l(a,f,o){return a=="string"?l:y(a,f,o)}return{startState:function(a){var f={tokenize:A,state:h,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(f.baseIndent=a),f},token:function(a,f){if(!f.tagName&&a.sol()&&(f.indented=a.indentation()),a.eatSpace())return null;R=null;var o=f.tokenize(a,f);return(o||R)&&o!="comment"&&(x=null,f.state=f.state(R||o,a,f),x&&(o=x=="error"?o+" error":x)),o},indent:function(a,f,o){var v=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+P;if(v&&v.noIndent)return re.Pass;if(a.tokenize!=O&&a.tokenize!=A)return o?o.match(/^(\s*)/)[0].length:0;if(a.tagName)return j.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+P*(j.multilineTagIndentFactor||1);if(j.alignCDATA&&/<!\[CDATA\[/.test(f))return 0;var D=f&&/^<(\/)?([\w_:\.-]*)/.exec(f);if(D&&D[1])for(;v;)if(v.tagName==D[2]){v=v.prev;break}else if(j.implicitlyClosed.hasOwnProperty(v.tagName))v=v.prev;else break;else if(D)for(;v;){var N=j.contextGrabbers[v.tagName];if(N&&N.hasOwnProperty(D[2]))v=v.prev;else break}for(;v&&v.prev&&!v.startOfLine;)v=v.prev;return v?v.indent+P:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:j.htmlMode?"html":"xml",helperType:j.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 f=[],o=a.context;o;o=o.prev)o.tagName&&f.push(o.tagName);return f.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(Rt,rt,Z){"use strict";Z.d(rt,"a",function(){return u});var re=Z("Ty5D"),V=Z("dI71"),L=Z("q1tI"),K=Z.n(L),M=Z("YS25"),P=Z("17x9"),j=Z.n(P),k=Z("wx14"),C=Z("zLVn"),R=Z("9R94"),x=function(c){Object(V.a)(l,c);function l(){for(var f,o=arguments.length,v=new Array(o),D=0;D<o;D++)v[D]=arguments[D];return f=c.call.apply(c,[this].concat(v))||this,f.history=Object(M.a)(f.props),f}var a=l.prototype;return a.render=function(){return K.a.createElement(re.c,{history:this.history,children:this.props.children})},l}(K.a.Component),A=function(c){Object(V.a)(l,c);function l(){for(var f,o=arguments.length,v=new Array(o),D=0;D<o;D++)v[D]=arguments[D];return f=c.call.apply(c,[this].concat(v))||this,f.history=Object(M.b)(f.props),f}var a=l.prototype;return a.render=function(){return K.a.createElement(re.c,{history:this.history,children:this.props.children})},l}(K.a.Component),O=function(l,a){return typeof l=="function"?l(a):l},S=function(l,a){return typeof l=="string"?Object(M.c)(l,null,null,a):l},_=function(l){return l},b=K.a.forwardRef;typeof b=="undefined"&&(b=_);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var s=b(function(c,l){var a=c.innerRef,f=c.navigate,o=c.onClick,v=Object(C.a)(c,["innerRef","navigate","onClick"]),D=v.target,N=Object(k.a)({},v,{onClick:function(z){try{o&&o(z)}catch(F){throw z.preventDefault(),F}!z.defaultPrevented&&z.button===0&&(!D||D==="_self")&&!d(z)&&(z.preventDefault(),f())}});return _!==b?N.ref=l||a:N.ref=a,K.a.createElement("a",N)}),u=b(function(c,l){var a=c.component,f=a===void 0?s:a,o=c.replace,v=c.to,D=c.innerRef,N=Object(C.a)(c,["component","replace","to","innerRef"]);return K.a.createElement(re.e.Consumer,null,function(W){W||Object(R.a)(!1);var z=W.history,F=S(O(v,W.location),W.location),I=F?z.createHref(F):"",B=Object(k.a)({},N,{href:I,navigate:function(){var Q=O(v,W.location),ee=o?z.replace:z.push;ee(Q)}});return _!==b?B.ref=l||D:B.innerRef=D,K.a.createElement(f,B)})});if(!1)var h,E;var m=function(l){return l},g=K.a.forwardRef;typeof g=="undefined"&&(g=m);function w(){for(var c=arguments.length,l=new Array(c),a=0;a<c;a++)l[a]=arguments[a];return l.filter(function(f){return f}).join(" ")}var y=g(function(c,l){var a=c["aria-current"],f=a===void 0?"page":a,o=c.activeClassName,v=o===void 0?"active":o,D=c.activeStyle,N=c.className,W=c.exact,z=c.isActive,F=c.location,I=c.sensitive,B=c.strict,Y=c.style,Q=c.to,ee=c.innerRef,fe=Object(C.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return K.a.createElement(re.e.Consumer,null,function(ce){ce||Object(R.a)(!1);var ge=F||ce.location,pe=S(O(Q,ge),ge),ue=pe.pathname,le=ue&&ue.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),de=le?Object(re.f)(ge.pathname,{path:le,exact:W,sensitive:I,strict:B}):null,ye=!!(z?z(de,ge):de),Me=ye?w(N,v):N,Ue=ye?Object(k.a)({},Y,{},D):Y,Re=Object(k.a)({"aria-current":ye&&f||null,className:Me,style:Ue,to:pe},fe);return m!==g?Re.ref=l||ee:Re.innerRef=ee,K.a.createElement(u,Re)})});if(!1)var p},"6+eU":function(Rt,rt,Z){"use strict";Z.d(rt,"a",function(){return g});var re=Z("wx14"),V=Z("rePB"),L=Z("VTBJ"),K=Z("1OyB"),M=Z("vuIU"),P=Z("Ji7U"),j=Z("LK+K"),k=Z("q1tI"),C=Z.n(k),R=Z("TSYQ"),x=Z.n(R),A=function(y){var p,c="".concat(y.rootPrefixCls,"-item"),l=x()(c,"".concat(c,"-").concat(y.page),(p={},Object(V.a)(p,"".concat(c,"-active"),y.active),Object(V.a)(p,y.className,!!y.className),Object(V.a)(p,"".concat(c,"-disabled"),!y.page),p)),a=function(){y.onClick(y.page)},f=function(v){y.onKeyPress(v,y.onClick,y.page)};return C.a.createElement("li",{title:y.showTitle?y.page:null,className:l,onClick:a,onKeyPress:f,tabIndex:"0"},y.itemRender(y.page,"page",C.a.createElement("a",{rel:"nofollow"},y.page)))},O=A,S={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},_=function(w){Object(P.a)(p,w);var y=Object(j.a)(p);function p(){var c;Object(K.a)(this,p);for(var l=arguments.length,a=new Array(l),f=0;f<l;f++)a[f]=arguments[f];return c=y.call.apply(y,[this].concat(a)),c.state={goInputText:""},c.buildOptionText=function(o){return"".concat(o," ").concat(c.props.locale.items_per_page)},c.changeSize=function(o){c.props.changeSize(Number(o))},c.handleChange=function(o){c.setState({goInputText:o.target.value})},c.handleBlur=function(o){var v=c.props,D=v.goButton,N=v.quickGo,W=v.rootPrefixCls,z=c.state.goInputText;if(D||z==="")return;if(o.relatedTarget&&(o.relatedTarget.className.indexOf("".concat(W,"-prev"))>=0||o.relatedTarget.className.indexOf("".concat(W,"-next"))>=0))return;c.setState({goInputText:""}),N(c.getValidValue())},c.go=function(o){var v=c.state.goInputText;if(v==="")return;(o.keyCode===S.ENTER||o.type==="click")&&(c.setState({goInputText:""}),c.props.quickGo(c.getValidValue()))},c}return Object(M.a)(p,[{key:"getValidValue",value:function(){var l=this.state,a=l.goInputText,f=l.current;return!a||isNaN(a)?f:Number(a)}},{key:"getPageSizeOptions",value:function(){var l=this.props,a=l.pageSize,f=l.pageSizeOptions;return f.some(function(o){return o.toString()===a.toString()})?f:f.concat([a.toString()]).sort(function(o,v){var D=isNaN(Number(o))?0:Number(o),N=isNaN(Number(v))?0:Number(v);return D-N})}},{key:"render",value:function(){var l=this,a=this.props,f=a.pageSize,o=a.locale,v=a.rootPrefixCls,D=a.changeSize,N=a.quickGo,W=a.goButton,z=a.selectComponentClass,F=a.buildOptionText,I=a.selectPrefixCls,B=a.disabled,Y=this.state.goInputText,Q="".concat(v,"-options"),ee=z,fe=null,ce=null,ge=null;if(!D&&!N)return null;var pe=this.getPageSizeOptions();if(D&&ee){var ue=pe.map(function(le,de){return C.a.createElement(ee.Option,{key:de,value:le.toString()},(F||l.buildOptionText)(le))});fe=C.a.createElement(ee,{disabled:B,prefixCls:I,showSearch:!1,className:"".concat(Q,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(f||pe[0]).toString(),onChange:this.changeSize,getPopupContainer:function(de){return de.parentNode}},ue)}return N&&(W&&(ge=typeof W=="boolean"?C.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:B,className:"".concat(Q,"-quick-jumper-button")},o.jump_to_confirm):C.a.createElement("span",{onClick:this.go,onKeyUp:this.go},W)),ce=C.a.createElement("div",{className:"".concat(Q,"-quick-jumper")},o.jump_to,C.a.createElement("input",{disabled:B,type:"text",value:Y,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),o.page,ge)),C.a.createElement("li",{className:"".concat(Q)},fe,ce)}}]),p}(C.a.Component);_.defaultProps={pageSizeOptions:["10","20","50","100"]};var b=_,d=Z("N2Kk");function s(){}function u(w){return typeof w=="number"&&isFinite(w)&&Math.floor(w)===w}function h(w,y,p){return p}function E(w,y,p){var c=typeof w=="undefined"?y.pageSize:w;return Math.floor((p.total-1)/c)+1}var m=function(w){Object(P.a)(p,w);var y=Object(j.a)(p);function p(c){var l;Object(K.a)(this,p),l=y.call(this,c),l.getJumpPrevPage=function(){return Math.max(1,l.state.current-(l.props.showLessItems?3:5))},l.getJumpNextPage=function(){return Math.min(E(void 0,l.state,l.props),l.state.current+(l.props.showLessItems?3:5))},l.getItemIcon=function(D,N){var W=l.props.prefixCls,z=D||C.a.createElement("button",{type:"button","aria-label":N,className:"".concat(W,"-item-link")});return typeof D=="function"&&(z=C.a.createElement(D,Object(L.a)({},l.props))),z},l.savePaginationNode=function(D){l.paginationNode=D},l.isValid=function(D){return u(D)&&D!==l.state.current},l.shouldDisplayQuickJumper=function(){var D=l.props,N=D.showQuickJumper,W=D.pageSize,z=D.total;return z<=W?!1:N},l.handleKeyDown=function(D){(D.keyCode===S.ARROW_UP||D.keyCode===S.ARROW_DOWN)&&D.preventDefault()},l.handleKeyUp=function(D){var N=l.getValidValue(D),W=l.state.currentInputValue;N!==W&&l.setState({currentInputValue:N}),D.keyCode===S.ENTER?l.handleChange(N):D.keyCode===S.ARROW_UP?l.handleChange(N-1):D.keyCode===S.ARROW_DOWN&&l.handleChange(N+1)},l.changePageSize=function(D){var N=l.state.current,W=E(D,l.state,l.props);N=N>W?W:N,W===0&&(N=l.state.current),typeof D=="number"&&("pageSize"in l.props||l.setState({pageSize:D}),"current"in l.props||l.setState({current:N,currentInputValue:N})),l.props.onShowSizeChange(N,D),"onChange"in l.props&&l.props.onChange&&l.props.onChange(N,D)},l.handleChange=function(D){var N=l.props.disabled,W=D;if(l.isValid(W)&&!N){var z=E(void 0,l.state,l.props);W>z?W=z:W<1&&(W=1),"current"in l.props||l.setState({current:W,currentInputValue:W});var F=l.state.pageSize;return l.props.onChange(W,F),W}return l.state.current},l.prev=function(){l.hasPrev()&&l.handleChange(l.state.current-1)},l.next=function(){l.hasNext()&&l.handleChange(l.state.current+1)},l.jumpPrev=function(){l.handleChange(l.getJumpPrevPage())},l.jumpNext=function(){l.handleChange(l.getJumpNextPage())},l.hasPrev=function(){return l.state.current>1},l.hasNext=function(){return l.state.current<E(void 0,l.state,l.props)},l.runIfEnter=function(D,N){if(D.key==="Enter"||D.charCode===13){for(var W=arguments.length,z=new Array(W>2?W-2:0),F=2;F<W;F++)z[F-2]=arguments[F];N.apply(void 0,z)}},l.runIfEnterPrev=function(D){l.runIfEnter(D,l.prev)},l.runIfEnterNext=function(D){l.runIfEnter(D,l.next)},l.runIfEnterJumpPrev=function(D){l.runIfEnter(D,l.jumpPrev)},l.runIfEnterJumpNext=function(D){l.runIfEnter(D,l.jumpNext)},l.handleGoTO=function(D){(D.keyCode===S.ENTER||D.type==="click")&&l.handleChange(l.state.currentInputValue)};var a=c.onChange!==s,f="current"in c;f&&!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 o=c.defaultCurrent;"current"in c&&(o=c.current);var v=c.defaultPageSize;return"pageSize"in c&&(v=c.pageSize),o=Math.min(o,E(v,void 0,c)),l.state={current:o,currentInputValue:o,pageSize:v},l}return Object(M.a)(p,[{key:"componentDidUpdate",value:function(l,a){var f=this.props.prefixCls;if(a.current!==this.state.current&&this.paginationNode){var o=this.paginationNode.querySelector(".".concat(f,"-item-").concat(a.current));o&&document.activeElement===o&&o.blur()}}},{key:"getValidValue",value:function(l){var a=l.target.value,f=E(void 0,this.state,this.props),o=this.state.currentInputValue,v;return a===""?v=a:isNaN(Number(a))?v=o:a>=f?v=f:v=Number(a),v}},{key:"getShowSizeChanger",value:function(){var l=this.props,a=l.showSizeChanger,f=l.total,o=l.totalBoundaryShowSizeChanger;return typeof a!="undefined"?a:f>o}},{key:"renderPrev",value:function(l){var a=this.props,f=a.prevIcon,o=a.itemRender,v=o(l,"prev",this.getItemIcon(f,"prev page")),D=!this.hasPrev();return Object(k.isValidElement)(v)?Object(k.cloneElement)(v,{disabled:D}):v}},{key:"renderNext",value:function(l){var a=this.props,f=a.nextIcon,o=a.itemRender,v=o(l,"next",this.getItemIcon(f,"next page")),D=!this.hasNext();return Object(k.isValidElement)(v)?Object(k.cloneElement)(v,{disabled:D}):v}},{key:"render",value:function(){var l=this,a=this.props,f=a.prefixCls,o=a.className,v=a.style,D=a.disabled,N=a.hideOnSinglePage,W=a.total,z=a.locale,F=a.showQuickJumper,I=a.showLessItems,B=a.showTitle,Y=a.showTotal,Q=a.simple,ee=a.itemRender,fe=a.showPrevNextJumpers,ce=a.jumpPrevIcon,ge=a.jumpNextIcon,pe=a.selectComponentClass,ue=a.selectPrefixCls,le=a.pageSizeOptions,de=this.state,ye=de.current,Me=de.pageSize,Ue=de.currentInputValue;if(N===!0&&W<=Me)return null;var Re=E(void 0,this.state,this.props),Oe=[],Ce=null,Le=null,Fe=null,We=null,Be=null,Ae=F&&F.goButton,Se=I?1:2,$e=ye-1>0?ye-1:0,qe=ye+1<Re?ye+1:Re,Je=Object.keys(this.props).reduce(function($,J){return(J.substr(0,5)==="data-"||J.substr(0,5)==="aria-"||J==="role")&&($[J]=l.props[J]),$},{});if(Q)return Ae&&(typeof Ae=="boolean"?Be=C.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},z.jump_to_confirm):Be=C.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},Ae),Be=C.a.createElement("li",{title:B?"".concat(z.jump_to).concat(ye,"/").concat(Re):null,className:"".concat(f,"-simple-pager")},Be)),C.a.createElement("ul",Object(re.a)({className:x()(f,"".concat(f,"-simple"),Object(V.a)({},"".concat(f,"-disabled"),D),o),style:v,ref:this.savePaginationNode},Je),C.a.createElement("li",{title:B?z.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:x()("".concat(f,"-prev"),Object(V.a)({},"".concat(f,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev($e)),C.a.createElement("li",{title:B?"".concat(ye,"/").concat(Re):null,className:"".concat(f,"-simple-pager")},C.a.createElement("input",{type:"text",value:Ue,disabled:D,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),C.a.createElement("span",{className:"".concat(f,"-slash")},"/"),Re),C.a.createElement("li",{title:B?z.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:x()("".concat(f,"-next"),Object(V.a)({},"".concat(f,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(qe)),Be);if(Re<=3+Se*2){var Xe={locale:z,rootPrefixCls:f,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:B,itemRender:ee};Re||Oe.push(C.a.createElement(O,Object(re.a)({},Xe,{key:"noPager",page:Re,className:"".concat(f,"-disabled")})));for(var ot=1;ot<=Re;ot+=1){var Qe=ye===ot;Oe.push(C.a.createElement(O,Object(re.a)({},Xe,{key:ot,page:ot,active:Qe})))}}else{var Ye=I?z.prev_3:z.prev_5,Ee=I?z.next_3:z.next_5;fe&&(Ce=C.a.createElement("li",{title:B?Ye:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:x()("".concat(f,"-jump-prev"),Object(V.a)({},"".concat(f,"-jump-prev-custom-icon"),!!ce))},ee(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(ce,"prev page"))),Le=C.a.createElement("li",{title:B?Ee:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:x()("".concat(f,"-jump-next"),Object(V.a)({},"".concat(f,"-jump-next-custom-icon"),!!ge))},ee(this.getJumpNextPage(),"jump-next",this.getItemIcon(ge,"next page")))),We=C.a.createElement(O,{locale:z,last:!0,rootPrefixCls:f,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:Re,page:Re,active:!1,showTitle:B,itemRender:ee}),Fe=C.a.createElement(O,{locale:z,rootPrefixCls:f,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:B,itemRender:ee});var nt=Math.max(1,ye-Se),Ze=Math.min(ye+Se,Re);ye-1<=Se&&(Ze=1+Se*2),Re-ye<=Se&&(nt=Re-Se*2);for(var xe=nt;xe<=Ze;xe+=1){var Ne=ye===xe;Oe.push(C.a.createElement(O,{locale:z,rootPrefixCls:f,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:xe,page:xe,active:Ne,showTitle:B,itemRender:ee}))}ye-1>=Se*2&&ye!==1+2&&(Oe[0]=Object(k.cloneElement)(Oe[0],{className:"".concat(f,"-item-after-jump-prev")}),Oe.unshift(Ce)),Re-ye>=Se*2&&ye!==Re-2&&(Oe[Oe.length-1]=Object(k.cloneElement)(Oe[Oe.length-1],{className:"".concat(f,"-item-before-jump-next")}),Oe.push(Le)),nt!==1&&Oe.unshift(Fe),Ze!==Re&&Oe.push(We)}var ne=null;Y&&(ne=C.a.createElement("li",{className:"".concat(f,"-total-text")},Y(W,[W===0?0:(ye-1)*Me+1,ye*Me>W?W:ye*Me])));var oe=!this.hasPrev()||!Re,ae=!this.hasNext()||!Re;return C.a.createElement("ul",Object(re.a)({className:x()(f,o,Object(V.a)({},"".concat(f,"-disabled"),D)),style:v,unselectable:"unselectable",ref:this.savePaginationNode},Je),ne,C.a.createElement("li",{title:B?z.prev_page:null,onClick:this.prev,tabIndex:oe?null:0,onKeyPress:this.runIfEnterPrev,className:x()("".concat(f,"-prev"),Object(V.a)({},"".concat(f,"-disabled"),oe)),"aria-disabled":oe},this.renderPrev($e)),Oe,C.a.createElement("li",{title:B?z.next_page:null,onClick:this.next,tabIndex:ae?null:0,onKeyPress:this.runIfEnterNext,className:x()("".concat(f,"-next"),Object(V.a)({},"".concat(f,"-disabled"),ae)),"aria-disabled":ae},this.renderNext(qe)),C.a.createElement(b,{disabled:D,locale:z,rootPrefixCls:f,selectComponentClass:pe,selectPrefixCls:ue,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:ye,pageSize:Me,pageSizeOptions:le,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:Ae}))}}],[{key:"getDerivedStateFromProps",value:function(l,a){var f={};if("current"in l&&(f.current=l.current,l.current!==a.current&&(f.currentInputValue=f.current)),"pageSize"in l&&l.pageSize!==a.pageSize){var o=a.current,v=E(l.pageSize,a,l);o=o>v?v:o,"current"in l||(f.current=o,f.currentInputValue=o),f.pageSize=l.pageSize}return f}}]),p}(C.a.Component);m.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:s,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:s,locale:d.a,style:{},itemRender:h,totalBoundaryShowSizeChanger:50};var g=m},"7ahc":function(Rt,rt,Z){"use strict";Z.d(rt,"a",function(){return E});var re=Z("k1fw"),V=Z("0Owb"),L=Z("+L6B"),K=Z("2/Rp"),M=Z("y8nQ"),P=Z("Vl3Y"),j=Z("tJVT"),k=Z("OaEy"),C=Z("2fM7"),R=Z("q1tI"),x=Z.n(R),A=Z("VrN/"),O=Z.n(A),S=Z("p77/"),_=Z.n(S),b=Z("c5Ni"),d=Z.n(b),s=C.a.Option,u={labelCol:{span:4},wrapperCol:{span:20}},h={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"]};rt.b=function(m){var g=m.callback,w=m.onCancel,y=Object(R.useState)("python"),p=Object(j.a)(y,2),c=p[0],l=p[1];function a(o){l(h[o][1])}function f(o){g(o)}return x.a.createElement(P.a,Object(V.a)({},u,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:f}),x.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},x.a.createElement(C.a,{onChange:a},Object.keys(h).map(function(o){return x.a.createElement(s,{key:o,value:o},h[o][0])}))),x.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},x.a.createElement(E,{mode:c})),x.a.createElement("div",{className:"flex-container flex-end"},x.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),x.a.createElement(K.a,{type:"ghost",onClick:w},"\u53D6\u6D88")))};function E(m){var g=m.value,w=m.onChange,y=m.mode,p=m.options,c=p===void 0?{}:p,l=Object(R.useRef)(),a=Object(R.useState)(),f=Object(j.a)(a,2),o=f[0],v=f[1];return Object(R.useEffect)(function(){if(o){function D(N){var W=N.getValue();w&&w(W)}return o.on("change",D),function(){o.off("change",D)}}},[o,w]),Object(R.useEffect)(function(){o&&o.setOption("mode",y)},[o,y]),Object(R.useEffect)(function(){o&&((g!==o.getValue()||g==="")&&setTimeout(function(){o.setValue(g||" ")},300))},[o,g]),Object(R.useEffect)(function(){if(l.current&&!o){var D=O.a.fromTextArea(l.current,Object(re.a)({mode:y,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));v(D)}},[l.current,o]),x.a.createElement("div",{className:"my-codemirror-container"},x.a.createElement("textarea",{ref:l}))}},"7qnI":function(Rt,rt,Z){"use strict";var re=Z("5Dmo"),V=Z("3S7+"),L=Z("fWQN"),K=Z("mtLc"),M=Z("yKVA"),P=Z("879j"),j=Z("5NDa"),k=Z("5rEg"),C=Z("q1tI"),R=Z.n(C),x=Z("O2Wb"),A=Z.n(x),O=k.a.TextArea,S=function(_){Object(M.a)(d,_);var b=Object(P.a)(d);function d(){return Object(L.a)(this,d),b.apply(this,arguments)}return Object(K.a)(d,[{key:"render",value:function(){var u=this,h=this.props,E=h.index,m=h.onAnswerChange,g=h.addChildAnswer,w=h.exerciseIsPublish,y=h.answers,p=h.activeOptionErrorIndex,c=h.flex,l=c===void 0?"0 0 1000px":c;return R.a.createElement("div",{className:A.a.flex},R.a.createElement("div",{className:"".concat(A.a.color666," mb5 mt6"),style:{flex:"0 0 90px"}},"\u7B54\u6848(\u586B\u7A7A",E+1,"):"),R.a.createElement("div",{className:"".concat(A.a.flex," ").concat(A.a.flex1),style:{flexDirection:"column"}},y.map(function(a,f){var o="".concat(E,"-").concat(f);return R.a.createElement("div",{className:"".concat(A.a.flex," ").concat(A.a.flex1),key:f},R.a.createElement("div",{className:A.a.flex1,style:{flex:l}},R.a.createElement("div",null,R.a.createElement(O,{className:o===p?A.a.error:"",spellCheck:!1,rows:4,value:a||"",defaultValue:"\u8BF7\u8F93\u5165\u53C2\u8003\u7B54\u6848".concat(f==0?"":"(\u53EF\u9009)"),onChange:function(D){return m(E,f,D.target.value)},style:{minHeight:95}}))),!w&&R.a.createElement(R.a.Fragment,null,f!=0&&R.a.createElement(V.a,{title:"\u5220\u9664"},R.a.createElement("i",{className:"".concat(A.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return u.props.deleteChildAnswer(E,f)},style:{float:"right"}})),f===0&&R.a.createElement(V.a,{title:"\u5220\u9664"},R.a.createElement("i",{className:"".concat(A.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return u.props.deleteChildAnswermain(E,f)},style:{float:"right"}})),R.a.createElement(V.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},R.a.createElement("i",{className:"".concat(A.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return g(E)},style:{float:"right",visibility:f==y.length-1?"":"hidden"}}))))})))}}]),d}(C.Component);rt.a=S},"8EBN":function(Rt,rt,Z){(function(re){re(Z("VrN/"))})(function(re){"use strict";re.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var V=0;V<re.modeInfo.length;V++){var L=re.modeInfo[V];L.mimes&&(L.mime=L.mimes[0])}re.findModeByMIME=function(K){K=K.toLowerCase();for(var M=0;M<re.modeInfo.length;M++){var P=re.modeInfo[M];if(P.mime==K)return P;if(P.mimes){for(var j=0;j<P.mimes.length;j++)if(P.mimes[j]==K)return P}}if(/\+xml$/.test(K))return re.findModeByMIME("application/xml");if(/\+json$/.test(K))return re.findModeByMIME("application/json")},re.findModeByExtension=function(K){K=K.toLowerCase();for(var M=0;M<re.modeInfo.length;M++){var P=re.modeInfo[M];if(P.ext){for(var j=0;j<P.ext.length;j++)if(P.ext[j]==K)return P}}},re.findModeByFileName=function(K){for(var M=0;M<re.modeInfo.length;M++){var P=re.modeInfo[M];if(P.file&&P.file.test(K))return P}var j=K.lastIndexOf("."),k=j>-1&&K.substring(j+1,K.length);if(k)return re.findModeByExtension(k)},re.findModeByName=function(K){K=K.toLowerCase();for(var M=0;M<re.modeInfo.length;M++){var P=re.modeInfo[M];if(P.name.toLowerCase()==K)return P;if(P.alias){for(var j=0;j<P.alias.length;j++)if(P.alias[j].toLowerCase()==K)return P}}}})},"9Bee":function(Rt,rt,Z){"use strict";var re=Z("k1fw"),V=Z("tJVT"),L=Z("q1tI"),K=Z.n(L),M=Z("vg9a"),P=Z("DlQD"),j=Z.n(P),k=Z("rUJ1");function C(B,Y){var Q=B.match(/^(\s+)(?:```)/);if(Q===null)return Y;var ee=Q[1];return Y.split(`
|
|
`).map(function(fe){var ce=fe.match(/^\s+/);if(ce===null)return fe;var ge=Object(V.a)(ce,1),pe=ge[0];return pe.length>=ee.length?fe.slice(ee.length):fe}).join(`
|
|
`)}var R=[],x=["<ul>"],A=new j.a.Renderer,O=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function S(){R.length=0,x=["<ul>"]}var _={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function b(B,Y,Q,ee){if(Y>=B.length||B[Y].level<=Q)return Y;var fe=B[Y];ee.push("<li><a href='#"+fe.anchor+"'>"+fe.text+"</a>"),Y++;var ce=[];return Y=b(B,Y,fe.level,ce),ce.length>0&&(ee.push("<ul>"),ce.forEach(function(ge){ee.push(ge)}),ee.push("</ul>")),ee.push("</li>"),Y=b(B,Y,Q,ee),Y}function d(){return b(R,0,0,x),x.push("</ul>"),x.join("")}var s={heading:function(Y){var Q=O.exec(Y);if(Q)return{type:"heading",raw:Q[0],depth:Q[1].length,text:Q[2]}},fences:function(Y){var Q=this.rules.block.fences.exec(Y);if(Q){var ee=Q[0],fe=C(ee,Q[3]||""),ce=Q[2]?Q[2].trim():Q[2];if(["latex","katex","math"].indexOf(ce)>=0){var ge=E(),pe=fe;fe=ge,m[ge]={type:"block",expression:pe}}return{type:"code",raw:ee,lang:ce,text:fe}}}},u=/(?:\${2})([^\n`]+?)(?:\${2})/gi,h=0,E=function(){return"__special_katext_id_".concat(h++,"__")},m={};function g(){return m}function w(){h=0,m={}}function y(B){return B=B.replace(u,function(Y,Q){var ee=E();return m[ee]={type:"inline",expression:Q},ee}),B}var p=A.listitem;A.listitem=function(B){return p(y(B))};var c=A.paragraph;A.paragraph=function(B){return c(y(B))};var l=A.tablecell;A.tablecell=function(B,Y){return l(y(B),Y)},A.code=function(B,Y,Q){var ee=(Y||"").match(/\S*/)[0];return ee?["latex","katex","math"].indexOf(ee)>=0?"<p class='editormd-tex'>".concat(B,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(Y,'">').concat(Q?B:Object(k.escape)(B,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(Q?B:Object(k.escape)(B,!0))+"</code></pre>"},A.heading=function(B,Y,Q){var ee=this.options.headerPrefix+Q.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return R.push({anchor:ee,level:Y,text:B}),"<h"+Y+' id="'+ee+'">'+B+"</h"+Y+">"},j.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),j.a.use({tokenizer:s,renderer:A});var a=j.a,f=Z("SJMd"),o=Z("ulZh"),v=Z.n(o),D=Z("m3rI"),N=Z("Oy/b"),W=Z("p5ED"),z=/<pre[^>]*>/g;function F(B){var Y=document.createElement("div");return Y.innerHTML=B,Y.childNodes.length===0?"":Y.childNodes[0].nodeValue}var I=rt.a=function(B){var Y=B.value,Q=Y===void 0?"":Y,ee=B.className,fe=B.showTextOnly,ce=B.showLines,ge=B.style,pe=ge===void 0?{}:ge,ue=B.stylesPrev,le=ue===void 0?{}:ue,de=String(Q),ye=Object(L.useState)(""),Me=Object(V.a)(ye,2),Ue=Me[0],Re=Me[1],Oe=Object(L.useMemo)(function(){try{var We=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Be=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Ae=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;de=de.replace(We,"("+D.a.API_SERVER+"/api/attachments/").replace(Be,'"'+D.a.API_SERVER+"/api/attachments/").replace(Ae,'"'+D.a.API_SERVER+"/files/uploads/").replace(/\r\n/g,`
|
|
`),de=de.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
|
|
`)}catch(Je){}var Se=a(de),$e=g();if(de.match(/\[TOC\]/)&&(Se=Se.replace("<p>[TOC]</p>",d()),S()),Se=Se.replace(/(__special_katext_id_\d+__)/g,function(Je,Xe){var ot=$e[Xe],Qe=ot.type,Ye=ot.expression;return Object(N.renderToString)(F(Ye)||"",{displayMode:Qe==="block",throwOnError:!1,output:"html"})}),Se=Se.replace(/▁/g,"\u2581\u2581\u2581"),w(),fe){var qe=document.createElement("div");return qe.innerHTML=Se,qe.innerText}return setTimeout(function(){return Fe()},500),Se},[de]),Ce=Object(L.useRef)();_.WebkitLineClamp=ce,ce&&(pe=Object(re.a)(Object(re.a)({},pe),_));function Le(We){var Be=We.target;if(Be.tagName.toUpperCase()==="A"){var Ae=Be.getAttribute("href");if(Ae.indexOf("office")>-1)We.preventDefault(),Re(Ae);else if(Ae.startsWith("#")){We.preventDefault();var Se=document.getElementById(Ae.replace("#",""));Se&&Se.scrollIntoView(!0)}}}var Fe=function(){var Be,Ae=(Be=Ce.current)===null||Be===void 0?void 0:Be.querySelectorAll("video");Ae==null||Ae.forEach(function(Se){if(Se.oncontextmenu=function(){return!1},Se.src.indexOf(".m3u8")>-1&&!Se.canPlayType("application/vnd.apple.mpegurl")){if(v.a.isSupported()){var $e=new v.a;$e.loadSource(Se.src),$e.attachMedia(Se)}}})};return Object(L.useEffect)(function(){if(Ce.current&&Oe&&(Oe.match(z)&&window.PR.prettyPrint()),Ce.current)return Ce.current.addEventListener("click",Le),function(){Ce.current.removeEventListener("click",Le),w(),S()}},[Oe,Ce.current,Le]),K.a.createElement(K.a.Fragment,null,K.a.createElement("div",{ref:Ce,style:Object(re.a)({},pe),className:"".concat(ee||""," markdown-body "),dangerouslySetInnerHTML:{__html:Oe}}),K.a.createElement(W.a,{close:!0,data:Ue,type:Ue!=null&&Ue.length?"office":"",style:Object(re.a)({},le),onClose:function(){return Re("")}}))}},"9VGf":function(Rt,rt,Z){"use strict";Z.d(rt,"a",function(){return L});var re=Z("q1tI"),V=Z.n(re);function L(K,M){var P=Object(re.useRef)();Object(re.useEffect)(function(){P.current=K}),Object(re.useEffect)(function(){function j(){P.current()}if(M!==null){var k=setInterval(j,M);return function(){return clearInterval(k)}}},[M])}},BU3w:function(Rt,rt,Z){"use strict";Z.d(rt,"a",function(){return P});var re=Z("MNnm"),V="rc-util-key";function L(j){if(j.attachTo)return j.attachTo;var k=document.querySelector("head");return k||document.body}function K(j){var k,C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(re.a)())return null;var R=document.createElement("style");if((k=C.csp)===null||k===void 0?void 0:k.nonce){var x;R.nonce=(x=C.csp)===null||x===void 0?void 0:x.nonce}R.innerHTML=j;var A=L(C),O=A.firstChild;return C.prepend&&A.prepend?A.prepend(R):C.prepend&&O?A.insertBefore(R,O):A.appendChild(R),R}var M=new Map;function P(j,k){var C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},R=L(C);if(!M.has(R)){var x=K("",C),A=x.parentNode;M.set(R,A),A.removeChild(x)}var O=Array.from(M.get(R).children).find(function(s){return s.tagName==="STYLE"&&s[V]===k});if(O){var S,_;if(((S=C.csp)===null||S===void 0?void 0:S.nonce)&&O.nonce!==((_=C.csp)===null||_===void 0?void 0:_.nonce)){var b;O.nonce=(b=C.csp)===null||b===void 0?void 0:b.nonce}return O.innerHTML!==j&&(O.innerHTML=j),O}var d=K(j,C);return d[V]=k,d}},Bd2K:function(Rt,rt,Z){(function(re){re(Z("VrN/"),Z("osHv"))})(function(re){re.defineOption("autoCloseTags",!1,function(C,R,x){if(x!=re.Init&&x&&C.removeKeyMap("autoCloseTags"),!R)return;var A={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(A["'/'"]=function(O){return P(O)}),(typeof R!="object"||R.whenOpening!==!1)&&(A["'>'"]=function(O){return K(O)}),C.addKeyMap(A)});var V=["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 K(C){if(C.getOption("disableInput"))return re.Pass;for(var R=C.listSelections(),x=[],A=C.getOption("autoCloseTags"),O=0;O<R.length;O++){if(!R[O].empty())return re.Pass;var S=R[O].head,_=C.getTokenAt(S),b=re.innerMode(C.getMode(),_.state),d=b.state,s=b.mode.xmlCurrentTag&&b.mode.xmlCurrentTag(d),u=s&&s.name;if(!u)return re.Pass;var h=b.mode.configuration=="html",E=typeof A=="object"&&A.dontCloseTags||h&&V,m=typeof A=="object"&&A.indentTags||h&&L;_.end>S.ch&&(u=u.slice(0,u.length-_.end+S.ch));var g=u.toLowerCase();if(!u||_.type=="string"&&(_.end!=S.ch||!/[\"\']/.test(_.string.charAt(_.string.length-1))||_.string.length==1)||_.type=="tag"&&s.close||_.string.indexOf("/")==S.ch-_.start-1||E&&j(E,g)>-1||k(C,b.mode.xmlCurrentContext&&b.mode.xmlCurrentContext(d)||[],u,S,!0))return re.Pass;var w=typeof A=="object"&&A.emptyTags;if(w&&j(w,u)>-1){x[O]={text:"/>",newPos:re.Pos(S.line,S.ch+2)};continue}var y=m&&j(m,g)>-1;x[O]={indent:y,text:">"+(y?`
|
|
|
|
`:"")+"</"+u+">",newPos:y?re.Pos(S.line+1,0):re.Pos(S.line,S.ch+1)}}for(var p=typeof A=="object"&&A.dontIndentOnAutoClose,O=R.length-1;O>=0;O--){var c=x[O];C.replaceRange(c.text,R[O].head,R[O].anchor,"+insert");var l=C.listSelections().slice(0);l[O]={head:c.newPos,anchor:c.newPos},C.setSelections(l),!p&&c.indent&&(C.indentLine(c.newPos.line,null,!0),C.indentLine(c.newPos.line+1,null,!0))}}function M(C,R){for(var x=C.listSelections(),A=[],O=R?"/":"</",S=C.getOption("autoCloseTags"),_=typeof S=="object"&&S.dontIndentOnSlash,b=0;b<x.length;b++){if(!x[b].empty())return re.Pass;var d=x[b].head,s=C.getTokenAt(d),u=re.innerMode(C.getMode(),s.state),h=u.state;if(R&&(s.type=="string"||s.string.charAt(0)!="<"||s.start!=d.ch-1))return re.Pass;var E,m=u.mode.name!="xml"&&C.getMode().name=="htmlmixed";if(m&&u.mode.name=="javascript")E=O+"script";else if(m&&u.mode.name=="css")E=O+"style";else{var g=u.mode.xmlCurrentContext&&u.mode.xmlCurrentContext(h);if(!g||g.length&&k(C,g,g[g.length-1],d))return re.Pass;E=O+g[g.length-1]}C.getLine(d.line).charAt(s.end)!=">"&&(E+=">"),A[b]=E}if(C.replaceSelections(A),x=C.listSelections(),!_)for(var b=0;b<x.length;b++)(b==x.length-1||x[b].head.line<x[b+1].head.line)&&C.indentLine(x[b].head.line)}function P(C){return C.getOption("disableInput")?re.Pass:M(C,!0)}re.commands.closeTag=function(C){return M(C)};function j(C,R){if(C.indexOf)return C.indexOf(R);for(var x=0,A=C.length;x<A;++x)if(C[x]==R)return x;return-1}function k(C,R,x,A,O){if(!re.scanForClosingTag)return!1;var S=Math.min(C.lastLine()+1,A.line+500),_=re.scanForClosingTag(C,A,null,S);if(!_||_.tag!=x)return!1;for(var b=O?1:0,d=R.length-1;d>=0&&R[d]==x;d--)++b;A=_.to;for(var d=1;d<b;d++){var s=re.scanForClosingTag(C,A,null,S);if(!s||s.tag!=x)return!1;A=s.to}return!0}})},BjJ7:function(Rt,rt,Z){"use strict";Z.d(rt,"d",function(){return V}),Z.d(rt,"c",function(){return L}),Z.d(rt,"e",function(){return K}),Z.d(rt,"b",function(){return M}),Z.d(rt,"a",function(){return j});var re=Z("m3rI");function V(k){var C=!0;if(k.length>0){for(var R=0;R<k.length;R++)if(k[R].compile_success==0||!k[R].compile_success){C=!1;break}}else C=!1;return C}function L(k){for(var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",R=[],x=0;x<k.length;x++){var A=k[x],O=C?"".concat(C,"/").concat(A.name):"".concat(A.name);R.push({title:A.name,isLeaf:!(A.type==="tree"),key:O})}return R}function K(k,C,R){for(var x=0;x<k.length;x++){var A=k[x];if(A.key===C){A.children=R;break}A.children&&K(A.children,C,R)}return k}function M(k,C,R){var x;return function(){var A=this,O=arguments,S=function(){x=null,R||k.apply(A,O)},_=R&&!x;clearTimeout(x),x=setTimeout(S,C),_&&k.apply(A,O)}}var P=!0,j=re.a.API_SERVER},"C+DQ":function(Rt,rt,Z){},DlQD:function(Rt,rt,Z){(function(re,V){Rt.exports=V()})(this,function(){"use strict";function re(ne,oe){for(var ae=0;ae<oe.length;ae++){var $=oe[ae];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(ne,$.key,$)}}function V(ne,oe,ae){return oe&&re(ne.prototype,oe),ae&&re(ne,ae),ne}function L(ne,oe){if(!ne)return;if(typeof ne=="string")return K(ne,oe);var ae=Object.prototype.toString.call(ne).slice(8,-1);if(ae==="Object"&&ne.constructor&&(ae=ne.constructor.name),ae==="Map"||ae==="Set")return Array.from(ne);if(ae==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ae))return K(ne,oe)}function K(ne,oe){(oe==null||oe>ne.length)&&(oe=ne.length);for(var ae=0,$=new Array(oe);ae<oe;ae++)$[ae]=ne[ae];return $}function M(ne,oe){var ae;if(typeof Symbol=="undefined"||ne[Symbol.iterator]==null){if(Array.isArray(ne)||(ae=L(ne))||oe&&ne&&typeof ne.length=="number"){ae&&(ne=ae);var $=0;return function(){return $>=ne.length?{done:!0}:{done:!1,value:ne[$++]}}}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=ne[Symbol.iterator](),ae.next.bind(ae)}function P(ne,oe){return oe={exports:{}},ne(oe,oe.exports),oe.exports}var j=P(function(ne){function oe(){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($){ne.exports.defaults=$}ne.exports={defaults:oe(),getDefaults:oe,changeDefaults:ae}}),k=j.defaults,C=j.getDefaults,R=j.changeDefaults,x=/[&<>"']/,A=/[&<>"']/g,O=/[<>"']|&(?!#?\w+;)/,S=/[<>"']|&(?!#?\w+;)/g,_={"&":"&","<":"<",">":">",'"':""","'":"'"},b=function(oe){return _[oe]};function d(ne,oe){if(oe){if(x.test(ne))return ne.replace(A,b)}else if(O.test(ne))return ne.replace(S,b);return ne}var s=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function u(ne){return ne.replace(s,function(oe,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 h=/(^|[^\[])\^/g;function E(ne,oe){ne=ne.source||ne,oe=oe||"";var ae={replace:function(J,q){return q=q.source||q,q=q.replace(h,"$1"),ne=ne.replace(J,q),ae},getRegex:function(){return new RegExp(ne,oe)}};return ae}var m=/[^\w:]/g,g=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function w(ne,oe,ae){if(ne){var $;try{$=decodeURIComponent(u(ae)).replace(m,"").toLowerCase()}catch(J){return null}if($.indexOf("javascript:")===0||$.indexOf("vbscript:")===0||$.indexOf("data:")===0)return null}oe&&!g.test(ae)&&(ae=a(oe,ae));try{ae=encodeURI(ae).replace(/%25/g,"%")}catch(J){return null}return ae}var y={},p=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ne,oe){y[" "+ne]||(p.test(ne)?y[" "+ne]=ne+"/":y[" "+ne]=D(ne,"/",!0)),ne=y[" "+ne];var ae=ne.indexOf(":")===-1;return oe.substring(0,2)==="//"?ae?oe:ne.replace(c,"$1")+oe:oe.charAt(0)==="/"?ae?oe:ne.replace(l,"$1")+oe:ne+oe}var f={exec:function(){}};function o(ne){for(var oe=1,ae,$;oe<arguments.length;oe++){ae=arguments[oe];for($ in ae)Object.prototype.hasOwnProperty.call(ae,$)&&(ne[$]=ae[$])}return ne}function v(ne,oe){var ae=ne.replace(/\|/g,function(q,te,me){for(var be=!1,Pe=te;--Pe>=0&&me[Pe]==="\\";)be=!be;return be?"|":" |"}),$=ae.split(/ \|/),J=0;if($.length>oe)$.splice(oe);else for(;$.length<oe;)$.push("");for(;J<$.length;J++)$[J]=$[J].trim().replace(/\\\|/g,"|");return $}function D(ne,oe,ae){var $=ne.length;if($===0)return"";for(var J=0;J<$;){var q=ne.charAt($-J-1);if(q===oe&&!ae)J++;else if(q!==oe&&ae)J++;else break}return ne.substr(0,$-J)}function N(ne,oe){if(ne.indexOf(oe[1])===-1)return-1;for(var ae=ne.length,$=0,J=0;J<ae;J++)if(ne[J]==="\\")J++;else if(ne[J]===oe[0])$++;else if(ne[J]===oe[1]&&($--,$<0))return J;return-1}function W(ne){ne&&ne.sanitize&&!ne.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 z={escape:d,unescape:u,edit:E,cleanUrl:w,resolveUrl:a,noopTest:f,merge:o,splitCells:v,rtrim:D,findClosingBracket:N,checkSanitizeDeprecation:W},F=j.defaults,I=z.rtrim,B=z.splitCells,Y=z.escape,Q=z.findClosingBracket;function ee(ne,oe,ae){var $=oe.href,J=oe.title?Y(oe.title):null,q=ne[1].replace(/\\([\[\]])/g,"$1");return ne[0].charAt(0)!=="!"?{type:"link",raw:ae,href:$,title:J,text:q}:{type:"image",raw:ae,href:$,title:J,text:Y(q)}}function fe(ne,oe){var ae=ne.match(/^(\s+)(?:```)/);if(ae===null)return oe;var $=ae[1];return oe.split(`
|
|
`).map(function(J){var q=J.match(/^\s+/);if(q===null)return J;var te=q[0];return te.length>=$.length?J.slice($.length):J}).join(`
|
|
`)}var ce=function(){function ne(ae){this.options=ae||F}var oe=ne.prototype;return oe.space=function($){var J=this.rules.block.newline.exec($);if(J)return J[0].length>1?{type:"space",raw:J[0]}:{raw:`
|
|
`}},oe.code=function($,J){var q=this.rules.block.code.exec($);if(q){var te=J[J.length-1];if(te&&te.type==="paragraph")return{raw:q[0],text:q[0].trimRight()};var me=q[0].replace(/^ {4}/gm,"");return{type:"code",raw:q[0],codeBlockStyle:"indented",text:this.options.pedantic?me:I(me,`
|
|
`)}}},oe.fences=function($){var J=this.rules.block.fences.exec($);if(J){var q=J[0],te=fe(q,J[3]||"");return{type:"code",raw:q,lang:J[2]?J[2].trim():J[2],text:te}}},oe.heading=function($){var J=this.rules.block.heading.exec($);if(J)return{type:"heading",raw:J[0],depth:J[1].length,text:J[2]}},oe.nptable=function($){var J=this.rules.block.nptable.exec($);if(J){var q={type:"table",header:B(J[1].replace(/^ *| *\| *$/g,"")),align:J[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:J[3]?J[3].replace(/\n$/,"").split(`
|
|
`):[],raw:J[0]};if(q.header.length===q.align.length){var te=q.align.length,me;for(me=0;me<te;me++)/^ *-+: *$/.test(q.align[me])?q.align[me]="right":/^ *:-+: *$/.test(q.align[me])?q.align[me]="center":/^ *:-+ *$/.test(q.align[me])?q.align[me]="left":q.align[me]=null;for(te=q.cells.length,me=0;me<te;me++)q.cells[me]=B(q.cells[me],q.header.length);return q}}},oe.hr=function($){var J=this.rules.block.hr.exec($);if(J)return{type:"hr",raw:J[0]}},oe.blockquote=function($){var J=this.rules.block.blockquote.exec($);if(J){var q=J[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:J[0],text:q}}},oe.list=function($){var J=this.rules.block.list.exec($);if(J){for(var q=J[0],te=J[2],me=te.length>1,be=te[te.length-1]===")",Pe={type:"list",raw:q,ordered:me,start:me?+te.slice(0,-1):"",loose:!1,items:[]},gt=J[0].match(this.rules.block.item),Ft=!1,St,pr,et,De,Ct,vt,ir,$t=gt.length,ut=0;ut<$t;ut++)St=gt[ut],q=St,pr=St.length,St=St.replace(/^ *([*+-]|\d+[.)]) */,""),~St.indexOf(`
|
|
`)&&(pr-=St.length,St=this.options.pedantic?St.replace(/^ {1,4}/gm,""):St.replace(new RegExp("^ {1,"+pr+"}","gm"),"")),ut!==$t-1&&(et=this.rules.block.bullet.exec(gt[ut+1])[0],(me?et.length===1||!be&&et[et.length-1]===")":et.length>1||this.options.smartLists&&et!==te)&&(De=gt.slice(ut+1).join(`
|
|
`),Pe.raw=Pe.raw.substring(0,Pe.raw.length-De.length),ut=$t-1)),Ct=Ft||/\n\n(?!\s*$)/.test(St),ut!==$t-1&&(Ft=St.charAt(St.length-1)===`
|
|
`,Ct||(Ct=Ft)),Ct&&(Pe.loose=!0),vt=/^\[[ xX]\] /.test(St),ir=void 0,vt&&(ir=St[1]!==" ",St=St.replace(/^\[[ xX]\] +/,"")),Pe.items.push({type:"list_item",raw:q,task:vt,checked:ir,loose:Ct,text:St});return Pe}},oe.html=function($){var J=this.rules.block.html.exec($);if(J)return{type:this.options.sanitize?"paragraph":"html",raw:J[0],pre:!this.options.sanitizer&&(J[1]==="pre"||J[1]==="script"||J[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(J[0]):Y(J[0]):J[0]}},oe.def=function($){var J=this.rules.block.def.exec($);if(J){J[3]&&(J[3]=J[3].substring(1,J[3].length-1));var q=J[1].toLowerCase().replace(/\s+/g," ");return{tag:q,raw:J[0],href:J[2],title:J[3]}}},oe.table=function($){var J=this.rules.block.table.exec($);if(J){var q={type:"table",header:B(J[1].replace(/^ *| *\| *$/g,"")),align:J[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:J[3]?J[3].replace(/\n$/,"").split(`
|
|
`):[]};if(q.header.length===q.align.length){q.raw=J[0];var te=q.align.length,me;for(me=0;me<te;me++)/^ *-+: *$/.test(q.align[me])?q.align[me]="right":/^ *:-+: *$/.test(q.align[me])?q.align[me]="center":/^ *:-+ *$/.test(q.align[me])?q.align[me]="left":q.align[me]=null;for(te=q.cells.length,me=0;me<te;me++)q.cells[me]=B(q.cells[me].replace(/^ *\| *| *\| *$/g,""),q.header.length);return q}}},oe.lheading=function($){var J=this.rules.block.lheading.exec($);if(J)return{type:"heading",raw:J[0],depth:J[2].charAt(0)==="="?1:2,text:J[1]}},oe.paragraph=function($){var J=this.rules.block.paragraph.exec($);if(J)return{type:"paragraph",raw:J[0],text:J[1].charAt(J[1].length-1)===`
|
|
`?J[1].slice(0,-1):J[1]}},oe.text=function($,J){var q=this.rules.block.text.exec($);if(q){var te=J[J.length-1];return te&&te.type==="text"?{raw:q[0],text:q[0]}:{type:"text",raw:q[0],text:q[0]}}},oe.escape=function($){var J=this.rules.inline.escape.exec($);if(J)return{type:"escape",raw:J[0],text:Y(J[1])}},oe.tag=function($,J,q){var te=this.rules.inline.tag.exec($);if(te)return!J&&/^<a /i.test(te[0])?J=!0:J&&/^<\/a>/i.test(te[0])&&(J=!1),!q&&/^<(pre|code|kbd|script)(\s|>)/i.test(te[0])?q=!0:q&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(te[0])&&(q=!1),{type:this.options.sanitize?"text":"html",raw:te[0],inLink:J,inRawBlock:q,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(te[0]):Y(te[0]):te[0]}},oe.link=function($){var J=this.rules.inline.link.exec($);if(J){var q=Q(J[2],"()");if(q>-1){var te=J[0].indexOf("!")===0?5:4,me=te+J[1].length+q;J[2]=J[2].substring(0,q),J[0]=J[0].substring(0,me).trim(),J[3]=""}var be=J[2],Pe="";if(this.options.pedantic){var gt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(be);gt?(be=gt[1],Pe=gt[3]):Pe=""}else Pe=J[3]?J[3].slice(1,-1):"";be=be.trim().replace(/^<([\s\S]*)>$/,"$1");var Ft=ee(J,{href:be&&be.replace(this.rules.inline._escapes,"$1"),title:Pe&&Pe.replace(this.rules.inline._escapes,"$1")},J[0]);return Ft}},oe.reflink=function($,J){var q;if((q=this.rules.inline.reflink.exec($))||(q=this.rules.inline.nolink.exec($))){var te=(q[2]||q[1]).replace(/\s+/g," ");if(te=J[te.toLowerCase()],!te||!te.href){var me=q[0].charAt(0);return{type:"text",raw:me,text:me}}var be=ee(q,te,q[0]);return be}},oe.strong=function($,J,q){q===void 0&&(q="");var te=this.rules.inline.strong.start.exec($);if(te&&(!te[1]||te[1]&&(q===""||this.rules.inline.punctuation.exec(q)))){J=J.slice(-1*$.length);var me=te[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;me.lastIndex=0;for(var be;(te=me.exec(J))!=null;)if(be=this.rules.inline.strong.middle.exec(J.slice(0,te.index+3)),be)return{type:"strong",raw:$.slice(0,be[0].length),text:$.slice(2,be[0].length-2)}}},oe.em=function($,J,q){q===void 0&&(q="");var te=this.rules.inline.em.start.exec($);if(te&&(!te[1]||te[1]&&(q===""||this.rules.inline.punctuation.exec(q)))){J=J.slice(-1*$.length);var me=te[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;me.lastIndex=0;for(var be;(te=me.exec(J))!=null;)if(be=this.rules.inline.em.middle.exec(J.slice(0,te.index+2)),be)return{type:"em",raw:$.slice(0,be[0].length),text:$.slice(1,be[0].length-1)}}},oe.codespan=function($){var J=this.rules.inline.code.exec($);if(J){var q=J[2].replace(/\n/g," "),te=/[^ ]/.test(q),me=q.startsWith(" ")&&q.endsWith(" ");return te&&me&&(q=q.substring(1,q.length-1)),q=Y(q,!0),{type:"codespan",raw:J[0],text:q}}},oe.br=function($){var J=this.rules.inline.br.exec($);if(J)return{type:"br",raw:J[0]}},oe.del=function($){var J=this.rules.inline.del.exec($);if(J)return{type:"del",raw:J[0],text:J[1]}},oe.autolink=function($,J){var q=this.rules.inline.autolink.exec($);if(q){var te,me;return q[2]==="@"?(te=Y(this.options.mangle?J(q[1]):q[1]),me="mailto:"+te):(te=Y(q[1]),me=te),{type:"link",raw:q[0],text:te,href:me,tokens:[{type:"text",raw:te,text:te}]}}},oe.url=function($,J){var q;if(q=this.rules.inline.url.exec($)){var te,me;if(q[2]==="@")te=Y(this.options.mangle?J(q[0]):q[0]),me="mailto:"+te;else{var be;do be=q[0],q[0]=this.rules.inline._backpedal.exec(q[0])[0];while(be!==q[0]);te=Y(q[0]),q[1]==="www."?me="http://"+te:me=te}return{type:"link",raw:q[0],text:te,href:me,tokens:[{type:"text",raw:te,text:te}]}}},oe.inlineText=function($,J,q){var te=this.rules.inline.text.exec($);if(te){var me;return J?me=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(te[0]):Y(te[0]):te[0]:me=Y(this.options.smartypants?q(te[0]):te[0]),{type:"text",raw:te[0],text:me}}},ne}(),ge=z.noopTest,pe=z.edit,ue=z.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:ge,table:ge,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=pe(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=pe(le.item,"gm").replace(/bull/g,le.bullet).getRegex(),le.list=pe(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=pe(le.html,"i").replace("comment",le._comment).replace("tag",le._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),le.paragraph=pe(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=pe(le.blockquote).replace("paragraph",le.paragraph).getRegex(),le.normal=ue({},le),le.gfm=ue({},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=pe(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=pe(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=ue({},le.normal,{html:pe(`^ *(?: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:ge,paragraph:pe(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 de={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ge,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:ge,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};de._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",de.punctuation=pe(de.punctuation).replace(/punctuation/g,de._punctuation).getRegex(),de._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",de._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",de.em.start=pe(de.em.start).replace(/punctuation/g,de._punctuation).getRegex(),de.em.middle=pe(de.em.middle).replace(/punctuation/g,de._punctuation).replace(/overlapSkip/g,de._overlapSkip).getRegex(),de.em.endAst=pe(de.em.endAst,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.em.endUnd=pe(de.em.endUnd,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.strong.start=pe(de.strong.start).replace(/punctuation/g,de._punctuation).getRegex(),de.strong.middle=pe(de.strong.middle).replace(/punctuation/g,de._punctuation).replace(/blockSkip/g,de._blockSkip).getRegex(),de.strong.endAst=pe(de.strong.endAst,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.strong.endUnd=pe(de.strong.endUnd,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.blockSkip=pe(de._blockSkip,"g").getRegex(),de.overlapSkip=pe(de._overlapSkip,"g").getRegex(),de._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,de._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,de._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])?)+(?![-_])/,de.autolink=pe(de.autolink).replace("scheme",de._scheme).replace("email",de._email).getRegex(),de._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,de.tag=pe(de.tag).replace("comment",le._comment).replace("attribute",de._attribute).getRegex(),de._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,de._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,de._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,de.link=pe(de.link).replace("label",de._label).replace("href",de._href).replace("title",de._title).getRegex(),de.reflink=pe(de.reflink).replace("label",de._label).getRegex(),de.reflinkSearch=pe(de.reflinkSearch,"g").replace("reflink",de.reflink).replace("nolink",de.nolink).getRegex(),de.normal=ue({},de),de.pedantic=ue({},de.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:pe(/^!?\[(label)\]\((.*?)\)/).replace("label",de._label).getRegex(),reflink:pe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",de._label).getRegex()}),de.gfm=ue({},de.normal,{escape:pe(de.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),de.gfm.url=pe(de.gfm.url,"i").replace("email",de.gfm._extended_email).getRegex(),de.breaks=ue({},de.gfm,{br:pe(de.br).replace("{2,}","*").getRegex(),text:pe(de.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var ye={block:le,inline:de},Me=j.defaults,Ue=ye.block,Re=ye.inline;function Oe(ne){return ne.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function Ce(ne){var oe="",ae,$,J=ne.length;for(ae=0;ae<J;ae++)$=ne.charCodeAt(ae),Math.random()>.5&&($="x"+$.toString(16)),oe+="&#"+$+";";return oe}var Le=function(){function ne(ae){this.tokens=[],this.tokens.links=Object.create(null),this.options=ae||Me,this.options.tokenizer=this.options.tokenizer||new ce,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var $={block:Ue.normal,inline:Re.normal};this.options.pedantic?($.block=Ue.pedantic,$.inline=Re.pedantic):this.options.gfm&&($.block=Ue.gfm,this.options.breaks?$.inline=Re.breaks:$.inline=Re.gfm),this.tokenizer.rules=$}ne.lex=function($,J){var q=new ne(J);return q.lex($)};var oe=ne.prototype;return oe.lex=function($){return $=$.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens($,this.tokens,!0),this.inline(this.tokens),this.tokens},oe.blockTokens=function($,J,q){J===void 0&&(J=[]),q===void 0&&(q=!0),$=$.replace(/^ +$/gm,"");for(var te,me,be,Pe;$;){if(te=this.tokenizer.space($)){$=$.substring(te.raw.length),te.type&&J.push(te);continue}if(te=this.tokenizer.code($,J)){$=$.substring(te.raw.length),te.type?J.push(te):(Pe=J[J.length-1],Pe.raw+=`
|
|
`+te.raw,Pe.text+=`
|
|
`+te.text);continue}if(te=this.tokenizer.fences($)){$=$.substring(te.raw.length),J.push(te);continue}if(te=this.tokenizer.heading($)){$=$.substring(te.raw.length),J.push(te);continue}if(te=this.tokenizer.nptable($)){$=$.substring(te.raw.length),J.push(te);continue}if(te=this.tokenizer.hr($)){$=$.substring(te.raw.length),J.push(te);continue}if(te=this.tokenizer.blockquote($)){$=$.substring(te.raw.length),te.tokens=this.blockTokens(te.text,[],q),J.push(te);continue}if(te=this.tokenizer.list($)){for($=$.substring(te.raw.length),be=te.items.length,me=0;me<be;me++)te.items[me].tokens=this.blockTokens(te.items[me].text,[],!1);J.push(te);continue}if(te=this.tokenizer.html($)){$=$.substring(te.raw.length),J.push(te);continue}if(q&&(te=this.tokenizer.def($))){$=$.substring(te.raw.length),this.tokens.links[te.tag]||(this.tokens.links[te.tag]={href:te.href,title:te.title});continue}if(te=this.tokenizer.table($)){$=$.substring(te.raw.length),J.push(te);continue}if(te=this.tokenizer.lheading($)){$=$.substring(te.raw.length),J.push(te);continue}if(q&&(te=this.tokenizer.paragraph($))){$=$.substring(te.raw.length),J.push(te);continue}if(te=this.tokenizer.text($,J)){$=$.substring(te.raw.length),te.type?J.push(te):(Pe=J[J.length-1],Pe.raw+=`
|
|
`+te.raw,Pe.text+=`
|
|
`+te.text);continue}if($){var gt="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(gt);break}else throw new Error(gt)}}return J},oe.inline=function($){var J,q,te,me,be,Pe,gt=$.length;for(J=0;J<gt;J++){Pe=$[J];switch(Pe.type){case"paragraph":case"text":case"heading":{Pe.tokens=[],this.inlineTokens(Pe.text,Pe.tokens);break}case"table":{for(Pe.tokens={header:[],cells:[]},me=Pe.header.length,q=0;q<me;q++)Pe.tokens.header[q]=[],this.inlineTokens(Pe.header[q],Pe.tokens.header[q]);for(me=Pe.cells.length,q=0;q<me;q++)for(be=Pe.cells[q],Pe.tokens.cells[q]=[],te=0;te<be.length;te++)Pe.tokens.cells[q][te]=[],this.inlineTokens(be[te],Pe.tokens.cells[q][te]);break}case"blockquote":{this.inline(Pe.tokens);break}case"list":{for(me=Pe.items.length,q=0;q<me;q++)this.inline(Pe.items[q].tokens);break}}}return $},oe.inlineTokens=function($,J,q,te,me){J===void 0&&(J=[]),q===void 0&&(q=!1),te===void 0&&(te=!1),me===void 0&&(me="");var be,Pe=$,gt;if(this.tokens.links){var Ft=Object.keys(this.tokens.links);if(Ft.length>0)for(;(gt=this.tokenizer.rules.inline.reflinkSearch.exec(Pe))!=null;)Ft.includes(gt[0].slice(gt[0].lastIndexOf("[")+1,-1))&&(Pe=Pe.slice(0,gt.index)+"["+"a".repeat(gt[0].length-2)+"]"+Pe.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(gt=this.tokenizer.rules.inline.blockSkip.exec(Pe))!=null;)Pe=Pe.slice(0,gt.index)+"["+"a".repeat(gt[0].length-2)+"]"+Pe.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;$;){if(be=this.tokenizer.escape($)){$=$.substring(be.raw.length),J.push(be);continue}if(be=this.tokenizer.tag($,q,te)){$=$.substring(be.raw.length),q=be.inLink,te=be.inRawBlock,J.push(be);continue}if(be=this.tokenizer.link($)){$=$.substring(be.raw.length),be.type==="link"&&(be.tokens=this.inlineTokens(be.text,[],!0,te)),J.push(be);continue}if(be=this.tokenizer.reflink($,this.tokens.links)){$=$.substring(be.raw.length),be.type==="link"&&(be.tokens=this.inlineTokens(be.text,[],!0,te)),J.push(be);continue}if(be=this.tokenizer.strong($,Pe,me)){$=$.substring(be.raw.length),be.tokens=this.inlineTokens(be.text,[],q,te),J.push(be);continue}if(be=this.tokenizer.em($,Pe,me)){$=$.substring(be.raw.length),be.tokens=this.inlineTokens(be.text,[],q,te),J.push(be);continue}if(be=this.tokenizer.codespan($)){$=$.substring(be.raw.length),J.push(be);continue}if(be=this.tokenizer.br($)){$=$.substring(be.raw.length),J.push(be);continue}if(be=this.tokenizer.del($)){$=$.substring(be.raw.length),be.tokens=this.inlineTokens(be.text,[],q,te),J.push(be);continue}if(be=this.tokenizer.autolink($,Ce)){$=$.substring(be.raw.length),J.push(be);continue}if(!q&&(be=this.tokenizer.url($,Ce))){$=$.substring(be.raw.length),J.push(be);continue}if(be=this.tokenizer.inlineText($,te,Oe)){$=$.substring(be.raw.length),me=be.raw.slice(-1),J.push(be);continue}if($){var St="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(St);break}else throw new Error(St)}}return J},V(ne,null,[{key:"rules",get:function(){return{block:Ue,inline:Re}}}]),ne}(),Fe=j.defaults,We=z.cleanUrl,Be=z.escape,Ae=function(){function ne(ae){this.options=ae||Fe}var oe=ne.prototype;return oe.code=function($,J,q){var te=(J||"").match(/\S*/)[0];if(this.options.highlight){var me=this.options.highlight($,te);me!=null&&me!==$&&(q=!0,$=me)}return te?'<pre><code class="'+this.options.langPrefix+Be(te,!0)+'">'+(q?$:Be($,!0))+`</code></pre>
|
|
`:"<pre><code>"+(q?$:Be($,!0))+`</code></pre>
|
|
`},oe.blockquote=function($){return`<blockquote>
|
|
`+$+`</blockquote>
|
|
`},oe.html=function($){return $},oe.heading=function($,J,q,te){return this.options.headerIds?"<h"+J+' id="'+this.options.headerPrefix+te.slug(q)+'">'+$+"</h"+J+`>
|
|
`:"<h"+J+">"+$+"</h"+J+`>
|
|
`},oe.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},oe.list=function($,J,q){var te=J?"ol":"ul",me=J&&q!==1?' start="'+q+'"':"";return"<"+te+me+`>
|
|
`+$+"</"+te+`>
|
|
`},oe.listitem=function($){return"<li>"+$+`</li>
|
|
`},oe.checkbox=function($){return"<input "+($?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},oe.paragraph=function($){return"<p>"+$+`</p>
|
|
`},oe.table=function($,J){return J&&(J="<tbody>"+J+"</tbody>"),`<table>
|
|
<thead>
|
|
`+$+`</thead>
|
|
`+J+`</table>
|
|
`},oe.tablerow=function($){return`<tr>
|
|
`+$+`</tr>
|
|
`},oe.tablecell=function($,J){var q=J.header?"th":"td",te=J.align?"<"+q+' align="'+J.align+'">':"<"+q+">";return te+$+"</"+q+`>
|
|
`},oe.strong=function($){return"<strong>"+$+"</strong>"},oe.em=function($){return"<em>"+$+"</em>"},oe.codespan=function($){return"<code>"+$+"</code>"},oe.br=function(){return this.options.xhtml?"<br/>":"<br>"},oe.del=function($){return"<del>"+$+"</del>"},oe.link=function($,J,q){if($=We(this.options.sanitize,this.options.baseUrl,$),$===null)return q;var te='<a href="'+Be($)+'"';return J&&(te+=' title="'+J+'"'),te+=">"+q+"</a>",te},oe.image=function($,J,q){if($=We(this.options.sanitize,this.options.baseUrl,$),$===null)return q;var te='<img src="'+$+'" alt="'+q+'"';return J&&(te+=' title="'+J+'"'),te+=this.options.xhtml?"/>":">",te},oe.text=function($){return $},ne}(),Se=function(){function ne(){}var oe=ne.prototype;return oe.strong=function($){return $},oe.em=function($){return $},oe.codespan=function($){return $},oe.del=function($){return $},oe.html=function($){return $},oe.text=function($){return $},oe.link=function($,J,q){return""+q},oe.image=function($,J,q){return""+q},oe.br=function(){return""},ne}(),$e=function(){function ne(){this.seen={}}var oe=ne.prototype;return oe.slug=function($){var J=$.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(J)){var q=J;do this.seen[q]++,J=q+"-"+this.seen[q];while(this.seen.hasOwnProperty(J))}return this.seen[J]=0,J},ne}(),qe=j.defaults,Je=z.unescape,Xe=function(){function ne(ae){this.options=ae||qe,this.options.renderer=this.options.renderer||new Ae,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Se,this.slugger=new $e}ne.parse=function($,J){var q=new ne(J);return q.parse($)};var oe=ne.prototype;return oe.parse=function($,J){J===void 0&&(J=!0);var q="",te,me,be,Pe,gt,Ft,St,pr,et,De,Ct,vt,ir,$t,ut,ze,Fr,Te,gr=$.length;for(te=0;te<gr;te++){De=$[te];switch(De.type){case"space":continue;case"hr":{q+=this.renderer.hr();continue}case"heading":{q+=this.renderer.heading(this.parseInline(De.tokens),De.depth,Je(this.parseInline(De.tokens,this.textRenderer)),this.slugger);continue}case"code":{q+=this.renderer.code(De.text,De.lang,De.escaped);continue}case"table":{for(pr="",St="",Pe=De.header.length,me=0;me<Pe;me++)St+=this.renderer.tablecell(this.parseInline(De.tokens.header[me]),{header:!0,align:De.align[me]});for(pr+=this.renderer.tablerow(St),et="",Pe=De.cells.length,me=0;me<Pe;me++){for(Ft=De.tokens.cells[me],St="",gt=Ft.length,be=0;be<gt;be++)St+=this.renderer.tablecell(this.parseInline(Ft[be]),{header:!1,align:De.align[be]});et+=this.renderer.tablerow(St)}q+=this.renderer.table(pr,et);continue}case"blockquote":{et=this.parse(De.tokens),q+=this.renderer.blockquote(et);continue}case"list":{for(Ct=De.ordered,vt=De.start,ir=De.loose,Pe=De.items.length,et="",me=0;me<Pe;me++)ut=De.items[me],ze=ut.checked,Fr=ut.task,$t="",ut.task&&(Te=this.renderer.checkbox(ze),ir?ut.tokens.length>0&&ut.tokens[0].type==="text"?(ut.tokens[0].text=Te+" "+ut.tokens[0].text,ut.tokens[0].tokens&&ut.tokens[0].tokens.length>0&&ut.tokens[0].tokens[0].type==="text"&&(ut.tokens[0].tokens[0].text=Te+" "+ut.tokens[0].tokens[0].text)):ut.tokens.unshift({type:"text",text:Te}):$t+=Te),$t+=this.parse(ut.tokens,ir),et+=this.renderer.listitem($t,Fr,ze);q+=this.renderer.list(et,Ct,vt);continue}case"html":{q+=this.renderer.html(De.text);continue}case"paragraph":{q+=this.renderer.paragraph(this.parseInline(De.tokens));continue}case"text":{for(et=De.tokens?this.parseInline(De.tokens):De.text;te+1<gr&&$[te+1].type==="text";)De=$[++te],et+=`
|
|
`+(De.tokens?this.parseInline(De.tokens):De.text);q+=J?this.renderer.paragraph(et):et;continue}default:{var Jt='Token with "'+De.type+'" type was not found.';if(this.options.silent){console.error(Jt);return}else throw new Error(Jt)}}}return q},oe.parseInline=function($,J){J=J||this.renderer;var q="",te,me,be=$.length;for(te=0;te<be;te++){me=$[te];switch(me.type){case"escape":{q+=J.text(me.text);break}case"html":{q+=J.html(me.text);break}case"link":{q+=J.link(me.href,me.title,this.parseInline(me.tokens,J));break}case"image":{q+=J.image(me.href,me.title,me.text);break}case"strong":{q+=J.strong(this.parseInline(me.tokens,J));break}case"em":{q+=J.em(this.parseInline(me.tokens,J));break}case"codespan":{q+=J.codespan(me.text);break}case"br":{q+=J.br();break}case"del":{q+=J.del(this.parseInline(me.tokens,J));break}case"text":{q+=J.text(me.text);break}default:{var Pe='Token with "'+me.type+'" type was not found.';if(this.options.silent){console.error(Pe);return}else throw new Error(Pe)}}}return q},ne}(),ot=z.merge,Qe=z.checkSanitizeDeprecation,Ye=z.escape,Ee=j.getDefaults,nt=j.changeDefaults,Ze=j.defaults;function xe(ne,oe,ae){if(typeof ne=="undefined"||ne===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ne!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ne)+", string expected");if(typeof oe=="function"&&(ae=oe,oe=null),oe=ot({},xe.defaults,oe||{}),Qe(oe),ae){var $=oe.highlight,J;try{J=Le.lex(ne,oe)}catch(be){return ae(be)}var q=function(Pe){var gt;if(!Pe)try{gt=Xe.parse(J,oe)}catch(Ft){Pe=Ft}return oe.highlight=$,Pe?ae(Pe):ae(null,gt)};if(!$||$.length<3)return q();if(delete oe.highlight,!J.length)return q();var te=0;xe.walkTokens(J,function(be){be.type==="code"&&(te++,setTimeout(function(){$(be.text,be.lang,function(Pe,gt){if(Pe)return q(Pe);gt!=null&>!==be.text&&(be.text=gt,be.escaped=!0),te--,te===0&&q()})},0))}),te===0&&q();return}try{var me=Le.lex(ne,oe);return oe.walkTokens&&xe.walkTokens(me,oe.walkTokens),Xe.parse(me,oe)}catch(be){if(be.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,oe.silent)return"<p>An error occurred:</p><pre>"+Ye(be.message+"",!0)+"</pre>";throw be}}xe.options=xe.setOptions=function(ne){return ot(xe.defaults,ne),nt(xe.defaults),xe},xe.getDefaults=Ee,xe.defaults=Ze,xe.use=function(ne){var oe=ot({},ne);if(ne.renderer&&function(){var $=xe.defaults.renderer||new Ae,J=function(me){var be=$[me];$[me]=function(){for(var Pe=arguments.length,gt=new Array(Pe),Ft=0;Ft<Pe;Ft++)gt[Ft]=arguments[Ft];var St=ne.renderer[me].apply($,gt);return St===!1&&(St=be.apply($,gt)),St}};for(var q in ne.renderer)J(q);oe.renderer=$}(),ne.tokenizer&&function(){var $=xe.defaults.tokenizer||new ce,J=function(me){var be=$[me];$[me]=function(){for(var Pe=arguments.length,gt=new Array(Pe),Ft=0;Ft<Pe;Ft++)gt[Ft]=arguments[Ft];var St=ne.tokenizer[me].apply($,gt);return St===!1&&(St=be.apply($,gt)),St}};for(var q in ne.tokenizer)J(q);oe.tokenizer=$}(),ne.walkTokens){var ae=xe.defaults.walkTokens;oe.walkTokens=function($){ne.walkTokens($),ae&&ae($)}}xe.setOptions(oe)},xe.walkTokens=function(ne,oe){for(var ae=M(ne),$;!($=ae()).done;){var J=$.value;oe(J);switch(J.type){case"table":{for(var q=M(J.tokens.header),te;!(te=q()).done;){var me=te.value;xe.walkTokens(me,oe)}for(var be=M(J.tokens.cells),Pe;!(Pe=be()).done;)for(var gt=Pe.value,Ft=M(gt),St;!(St=Ft()).done;){var pr=St.value;xe.walkTokens(pr,oe)}break}case"list":{xe.walkTokens(J.items,oe);break}default:J.tokens&&xe.walkTokens(J.tokens,oe)}}},xe.Parser=Xe,xe.parser=Xe.parse,xe.Renderer=Ae,xe.TextRenderer=Se,xe.Lexer=Le,xe.lexer=Le.lex,xe.Tokenizer=ce,xe.Slugger=$e,xe.parse=xe;var Ne=xe;return Ne})},ELLl:function(Rt,rt,Z){(function(re){re(Z("VrN/"))})(function(re){var V={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},L=re.Pos;re.defineOption("autoCloseBrackets",!1,function(_,b,d){d&&d!=re.Init&&(_.removeKeyMap(M),_.state.closeBrackets=null),b&&(P(K(b,"pairs")),_.state.closeBrackets=b,_.addKeyMap(M))});function K(_,b){return b=="pairs"&&typeof _=="string"?_:typeof _=="object"&&_[b]!=null?_[b]:V[b]}var M={Backspace:C,Enter:R};function P(_){for(var b=0;b<_.length;b++){var d=_.charAt(b),s="'"+d+"'";M[s]||(M[s]=j(d))}}P(V.pairs+"`");function j(_){return function(b){return A(b,_)}}function k(_){var b=_.state.closeBrackets;if(!b||b.override)return b;var d=_.getModeAt(_.getCursor());return d.closeBrackets||b}function C(_){var b=k(_);if(!b||_.getOption("disableInput"))return re.Pass;for(var d=K(b,"pairs"),s=_.listSelections(),u=0;u<s.length;u++){if(!s[u].empty())return re.Pass;var h=O(_,s[u].head);if(!h||d.indexOf(h)%2!=0)return re.Pass}for(var u=s.length-1;u>=0;u--){var E=s[u].head;_.replaceRange("",L(E.line,E.ch-1),L(E.line,E.ch+1),"+delete")}}function R(_){var b=k(_),d=b&&K(b,"explode");if(!d||_.getOption("disableInput"))return re.Pass;for(var s=_.listSelections(),u=0;u<s.length;u++){if(!s[u].empty())return re.Pass;var h=O(_,s[u].head);if(!h||d.indexOf(h)%2!=0)return re.Pass}_.operation(function(){var E=_.lineSeparator()||`
|
|
`;_.replaceSelection(E+E,null),_.execCommand("goCharLeft"),s=_.listSelections();for(var m=0;m<s.length;m++){var g=s[m].head.line;_.indentLine(g,null,!0),_.indentLine(g+1,null,!0)}})}function x(_){var b=re.cmpPos(_.anchor,_.head)>0;return{anchor:new L(_.anchor.line,_.anchor.ch+(b?-1:1)),head:new L(_.head.line,_.head.ch+(b?1:-1))}}function A(_,b){var d=k(_);if(!d||_.getOption("disableInput"))return re.Pass;var s=K(d,"pairs"),u=s.indexOf(b);if(u==-1)return re.Pass;for(var h=K(d,"closeBefore"),E=K(d,"triples"),m=s.charAt(u+1)==b,g=_.listSelections(),w=u%2==0,y,p=0;p<g.length;p++){var c=g[p],l=c.head,a,f=_.getRange(l,L(l.line,l.ch+1));if(w&&!c.empty())a="surround";else if((m||!w)&&f==b)m&&S(_,l)?a="both":E.indexOf(b)>=0&&_.getRange(l,L(l.line,l.ch+3))==b+b+b?a="skipThree":a="skip";else if(m&&l.ch>1&&E.indexOf(b)>=0&&_.getRange(L(l.line,l.ch-2),l)==b+b){if(l.ch>2&&/\bstring/.test(_.getTokenTypeAt(L(l.line,l.ch-2))))return re.Pass;a="addFour"}else if(m){var o=l.ch==0?" ":_.getRange(L(l.line,l.ch-1),l);if(!re.isWordChar(f)&&o!=b&&!re.isWordChar(o))a="both";else return re.Pass}else if(w&&(f.length===0||/\s/.test(f)||h.indexOf(f)>-1))a="both";else return re.Pass;if(!y)y=a;else if(y!=a)return re.Pass}var v=u%2?s.charAt(u-1):b,D=u%2?b:s.charAt(u+1);_.operation(function(){if(y=="skip")_.execCommand("goCharRight");else if(y=="skipThree")for(var N=0;N<3;N++)_.execCommand("goCharRight");else if(y=="surround"){for(var W=_.getSelections(),N=0;N<W.length;N++)W[N]=v+W[N]+D;_.replaceSelections(W,"around"),W=_.listSelections().slice();for(var N=0;N<W.length;N++)W[N]=x(W[N]);_.setSelections(W)}else y=="both"?(_.replaceSelection(v+D,null),_.triggerElectric(v+D),_.execCommand("goCharLeft")):y=="addFour"&&(_.replaceSelection(v+v+v+v,"before"),_.execCommand("goCharRight"))})}function O(_,b){var d=_.getRange(L(b.line,b.ch-1),L(b.line,b.ch+1));return d.length==2?d:null}function S(_,b){var d=_.getTokenAt(L(b.line,b.ch+1));return/\bstring/.test(d.type)&&d.start==b.ch&&(b.ch==0||!/\bstring/.test(_.getTokenTypeAt(b)))}})},HmJG:function(Rt,rt,Z){},LdHM:function(Rt,rt,Z){"use strict";Z.d(rt,"b",function(){return h}),Z.d(rt,"a",function(){return m});var re=Z("1OyB"),V=Z("vuIU"),L=Z("Ji7U"),K=Z("LK+K"),M=Z("q1tI"),P=Z("rePB"),j=Z("Ff2n"),k=Z("ODXe"),C=Z("4IlW"),R=Z("bX4T"),x=Z("YrtM"),A=Z("TSYQ"),O=Z.n(A),S=Z("+nKL"),_=Z("8OUc"),b=function(B,Y){var Q=B.prefixCls,ee=B.id,fe=B.flattenOptions,ce=B.childrenAsData,ge=B.values,pe=B.searchValue,ue=B.multiple,le=B.defaultActiveFirstOption,de=B.height,ye=B.itemHeight,Me=B.notFoundContent,Ue=B.open,Re=B.menuItemSelectedIcon,Oe=B.virtual,Ce=B.onSelect,Le=B.onToggleOpen,Fe=B.onActiveValue,We=B.onScroll,Be=B.onMouseEnter,Ae="".concat(Q,"-item"),Se=Object(x.a)(function(){return fe},[Ue,fe],function(Ne,ne){return ne[0]&&Ne[1]!==ne[1]}),$e=M.useRef(null),qe=function(ne){ne.preventDefault()},Je=function(ne){$e.current&&$e.current.scrollTo({index:ne})},Xe=function(ne){for(var oe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ae=Se.length,$=0;$<ae;$+=1){var J=(ne+$*oe+ae)%ae,q=Se[J],te=q.group,me=q.data;if(!te&&!me.disabled)return J}return-1},ot=M.useState(function(){return Xe(0)}),Qe=Object(k.a)(ot,2),Ye=Qe[0],Ee=Qe[1],nt=function(ne){Ee(ne);var oe=Se[ne];if(!oe){Fe(null,-1);return}Fe(oe.data.value,ne)};M.useEffect(function(){nt(le!==!1?Xe(0):-1)},[Se.length,pe]),M.useEffect(function(){var Ne=setTimeout(function(){if(!ue&&Ue&&ge.size===1){var ne=Array.from(ge)[0],oe=Se.findIndex(function(ae){var $=ae.data;return $.value===ne});nt(oe),Je(oe)}});return function(){return clearTimeout(Ne)}},[Ue]);var Ze=function(ne){ne!==void 0&&Ce(ne,{selected:!ge.has(ne)}),ue||Le(!1)};if(M.useImperativeHandle(Y,function(){return{onKeyDown:function(ne){var oe=ne.which;switch(oe){case C.a.UP:case C.a.DOWN:{var ae=0;if(oe===C.a.UP?ae=-1:oe===C.a.DOWN&&(ae=1),ae!==0){var $=Xe(Ye+ae,ae);Je($),nt($)}break}case C.a.ENTER:{var J=Se[Ye];J&&!J.data.disabled?Ze(J.data.value):Ze(void 0),Ue&&ne.preventDefault();break}case C.a.ESC:Le(!1)}},onKeyUp:function(){},scrollTo:function(ne){Je(ne)}}}),Se.length===0)return M.createElement("div",{role:"listbox",id:"".concat(ee,"_list"),className:"".concat(Ae,"-empty"),onMouseDown:qe},Me);function xe(Ne){var ne=Se[Ne];if(!ne)return null;var oe=ne.data||{},ae=oe.value,$=oe.label,J=oe.children,q=Object(R.a)(oe,!0),te=ce?J:$;return ne?M.createElement("div",Object.assign({"aria-label":typeof te=="string"?te:null},q,{key:Ne,role:"option",id:"".concat(ee,"_list_").concat(Ne),"aria-selected":ge.has(ae)}),ae):null}return M.createElement(M.Fragment,null,M.createElement("div",{role:"listbox",id:"".concat(ee,"_list"),style:{height:0,width:0,overflow:"hidden"}},xe(Ye-1),xe(Ye),xe(Ye+1)),M.createElement(S.a,{itemKey:"key",ref:$e,data:Se,height:de,itemHeight:ye,fullHeight:!1,onMouseDown:qe,onScroll:We,virtual:Oe,onMouseEnter:Be},function(Ne,ne){var oe,ae=Ne.group,$=Ne.groupOption,J=Ne.data,q=J.label,te=J.key;if(ae)return M.createElement("div",{className:O()(Ae,"".concat(Ae,"-group"))},q!==void 0?q:te);var me=J.disabled,be=J.value,Pe=J.title,gt=J.children,Ft=J.style,St=J.className,pr=Object(j.a)(J,["disabled","value","title","children","style","className"]),et=ge.has(be),De="".concat(Ae,"-option"),Ct=O()(Ae,De,St,(oe={},Object(P.a)(oe,"".concat(De,"-grouped"),$),Object(P.a)(oe,"".concat(De,"-active"),Ye===ne&&!me),Object(P.a)(oe,"".concat(De,"-disabled"),me),Object(P.a)(oe,"".concat(De,"-selected"),et),oe)),vt=ce?gt:q,ir=!Re||typeof Re=="function"||et;return M.createElement("div",Object.assign({},pr,{"aria-selected":et,className:Ct,title:Pe,onMouseMove:function(){if(Ye===ne||me)return;nt(ne)},onClick:function(){me||Ze(be)},style:Ft}),M.createElement("div",{className:"".concat(De,"-content")},vt||be),M.isValidElement(Re)||et,ir&&M.createElement(_.a,{className:"".concat(Ae,"-option-state"),customizeIcon:Re,customizeIconProps:{isSelected:et}},et?"\u2713":null))}))},d=M.forwardRef(b);d.displayName="OptionList";var s=d,u=function(){return null};u.isSelectOption=!0;var h=u,E=function(){return null};E.isSelectOptGroup=!0;var m=E,g=Z("VTBJ"),w=Z("Zm9Q");function y(I){var B=I.key,Y=I.props,Q=Y.children,ee=Y.value,fe=Object(j.a)(Y,["children","value"]);return Object(g.a)({key:B,value:ee!==void 0?ee:B,children:Q},fe)}function p(I){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(w.a)(I).map(function(Y,Q){if(!M.isValidElement(Y)||!Y.type)return null;var ee=Y.type.isSelectOptGroup,fe=Y.key,ce=Y.props,ge=ce.children,pe=Object(j.a)(ce,["children"]);return B||!ee?y(Y):Object(g.a)(Object(g.a)({key:"__RC_SELECT_GRP__".concat(fe===null?Q:fe,"__"),label:fe},pe),{},{options:p(ge)})}).filter(function(Y){return Y})}var c=Z("2Qr1"),l=Z("qNPg"),a=Z("U8pU"),f=Z("Kwbf"),o=Z("WKfj");function v(I){var B=I.mode,Y=I.options,Q=I.children,ee=I.backfill,fe=I.allowClear,ce=I.placeholder,ge=I.getInputElement,pe=I.showSearch,ue=I.onSearch,le=I.defaultOpen,de=I.autoFocus,ye=I.labelInValue,Me=I.value,Ue=I.inputValue,Re=I.optionLabelProp,Oe=B==="multiple"||B==="tags",Ce=pe!==void 0?pe:Oe||B==="combobox",Le=Y||p(Q);if(Object(f.a)(B!=="tags"||Le.every(function(Ae){return!Ae.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),B==="tags"||B==="combobox"){var Fe=Le.some(function(Ae){return Ae.options?Ae.options.some(function(Se){return typeof("value"in Se?Se.value:Se.key)=="number"}):typeof("value"in Ae?Ae.value:Ae.key)=="number"});Object(f.a)(!Fe,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(f.a)(B!=="combobox"||!Re,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(f.a)(B==="combobox"||!ee,"`backfill` only works with `combobox` mode."),Object(f.a)(B==="combobox"||!ge,"`getInputElement` only work with `combobox` mode."),Object(f.b)(B!=="combobox"||!ge||!fe||!ce,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),ue&&!Ce&&B!=="combobox"&&B!=="tags"&&Object(f.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(f.b)(!le||de,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Me!=null){var We=Object(o.d)(Me);Object(f.a)(!ye||We.every(function(Ae){return Object(a.a)(Ae)==="object"&&("key"in Ae||"value"in Ae)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(f.a)(!Oe||Array.isArray(Me),"`value` should be array when `mode` is `multiple` or `tags`")}if(Q){var Be=null;Object(w.a)(Q).some(function(Ae){if(!M.isValidElement(Ae)||!Ae.type)return!1;var Se=Ae.type;if(Se.isSelectOption)return!1;if(Se.isSelectOptGroup){var $e=Object(w.a)(Ae.props.children).every(function(qe){return!M.isValidElement(qe)||!Ae.type||qe.type.isSelectOption?!0:(Be=qe.type,!1)});return!$e}return Be=Se,!0}),Be&&Object(f.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Be.displayName||Be.name||Be,"`.")),Object(f.a)(Ue===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var D=v,N=Object(l.a)({prefixCls:"rc-select",components:{optionList:s},convertChildrenToData:p,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:D,fillOptionsWithMissingValue:c.a}),W=function(I){Object(L.a)(Y,I);var B=Object(K.a)(Y);function Y(){var Q;return Object(re.a)(this,Y),Q=B.apply(this,arguments),Q.selectRef=M.createRef(),Q.focus=function(){Q.selectRef.current.focus()},Q.blur=function(){Q.selectRef.current.blur()},Q}return Object(V.a)(Y,[{key:"render",value:function(){return M.createElement(N,Object.assign({ref:this.selectRef},this.props))}}]),Y}(M.Component);W.Option=h,W.OptGroup=m;var z=W,F=rt.c=z},LuLp:function(Rt,rt,Z){Rt.exports={flex_box_center:"flex_box_center___4bUZY",flex_space_between:"flex_space_between___1xTjN",flex_box_vertical_center:"flex_box_vertical_center___1vgGz",flex_box_center_end:"flex_box_center_end___P7hNa",flex_box_column:"flex_box_column___2sxpi",wrap:"wrap___lYrXF",modal:"modal___jAVte",titleWrap:"titleWrap___3ZYOv",required:"required___TyqrE",title:"title___YHdJB",colorGray:"colorGray___QPU3J",choiceWrap:"choiceWrap___3fip5",answer:"answer___1b5_q",activeAnswer:"activeAnswer___3IKUq",deleteIcon:"deleteIcon___dg_3n",addIcon:"addIcon___3bFJA",editorWrap:"editorWrap___xeZgL",htmlWrap:"htmlWrap___1-J33",radio:"radio___14ZC8",color333:"color333___2Hi7e",color999:"color999___wFMNh",questionType:"questionType___2DcP-",questionChoices:"questionChoices___1QDDn"}},M8RZ:function(Rt,rt,Z){"use strict";Z.d(rt,"a",function(){return C});var re=Z("fWQN"),V=Z("mtLc"),L=Z("yKVA"),K=Z("879j"),M=Z("q1tI"),P=Z.n(M),j=Z("i8i4"),k=Z.n(j),C=function(R){Object(L.a)(A,R);var x=Object(K.a)(A);function A(O){var S;Object(re.a)(this,A),S=x.call(this,O);var _=window.document;return S.node=_.createElement("div"),_.body.appendChild(S.node),S}return Object(V.a)(A,[{key:"render",value:function(){var S=this.props.children;return Object(j.createPortal)(S,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),A}(P.a.Component)},O2Wb:function(Rt,rt,Z){Rt.exports={flex:"flex___2gmSR",flex1:"flex1___3Tu1g",color666:"color666___2uyGL",error:"error___yJ86W",deleteIcon:"deleteIcon___1D2tg",addIcon:"addIcon___2VIYB"}},Ot1p:function(Rt,rt,Z){"use strict";var re=Z("2qtc"),V=Z("kLXV"),L=Z("rAM+"),K=Z("miYZ"),M=Z("tsqr"),P=Z("tJVT"),j=Z("jrin"),k=Z("q1tI"),C=Z.n(k),R=Z("VrN/"),x=Z.n(R),A=Z("bdgK"),O=Z("p77/"),S=Z("Bd2K"),_=Z("ELLl"),b=Z("19Vz"),d=Z("lZu9"),s=Z("+NIl"),u=Z("kSUc"),h=Z("9Bee"),E=function(ne){var oe=ne.value,ae=oe===void 0?"":oe,$=ne.className,J=ne.showTextOnly,q=ne.showLines,te=ne.style,me=te===void 0?{}:te,be=Object(k.useMemo)(function(){return""},[ae]);return C.a.createElement(C.a.Fragment,null,C.a.createElement("div",{dangerouslySetInnerHTML:{__html:be}}))},m=Z("0Owb"),g=Z("dejd"),w=Z("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 p(ne){var oe=ne.onActionCallback,ae=ne.title,$=ne.icon,J=ne.actionName,q=ne.className,te=q===void 0?"":q,me=ne.children;function be(){oe(J)}return C.a.createElement("a",{title:ae,className:te,onClick:be},C.a.createElement("i",{className:"md-iconfont ".concat($)}),me)}var c=function(ne){var oe=ne.watch,ae=ne.showNullButton,$=ne.onActionCallback,J=ne.fullScreen,q=ne.insertTemp,te=ne.hidetoolBar,me=[].concat(y,[{title:"".concat(oe?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(oe?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return C.a.createElement("ul",{className:"markdown-toolbar-container"},!te&&me.map(function(be,Pe){return C.a.createElement("li",{key:Pe},be.actionName?C.a.createElement(p,Object(m.a)({},be,{onActionCallback:$})):C.a.createElement("span",{className:"v-line"}))}),ae?C.a.createElement("li",null,C.a.createElement(p,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:$},C.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,q&&C.a.createElement("li",null,C.a.createElement(p,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(q),onActionCallback:$},C.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),C.a.createElement("li",{className:"btn-full-screen"},C.a.createElement(p,{icon:"".concat(J?"icon-shrink":"icon-enlarge"),title:J?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:$})))},l=Z("M8RZ"),a=Z("+L6B"),f=Z("2/Rp"),o=Z("y8nQ"),v=Z("Vl3Y"),D=Z("5NDa"),N=Z("5rEg"),W={labelCol:{span:4},wrapperCol:{span:20}},z=function(ne){var oe=ne.callback,ae=ne.onCancel;function $(J){oe(J)}return C.a.createElement(v.a,Object(m.a)({},W,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:$}),C.a.createElement(v.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},C.a.createElement(N.a,null)),C.a.createElement(v.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},C.a.createElement(N.a,null)),C.a.createElement("div",{className:"flex-container flex-end"},C.a.createElement(f.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),C.a.createElement(f.a,{type:"ghost",onClick:ae},"\u53D6\u6D88")))},F=Z("7ahc"),I=Z("HmJG"),B=Z("BjJ7"),Y=v.a.useForm,Q={width:280,marginRight:10},ee={labelCol:{span:5},wrapperCol:{span:19}},fe=function(ne){var oe=ne.callback,ae=ne.onCancel,$=Y(),J=Object(P.a)($,1),q=J[0];function te(Pe){oe(Pe)}function me(Pe,gt){q.setFieldsValue({src:"/api/attachments/".concat(Pe.id),type:gt.type})}function be(Pe){var gt=Pe.target.files[0];ge(gt,me)}return C.a.createElement(v.a,Object(m.a)({form:q},ee,{className:"upload-image-panel",onFinish:te}),C.a.createElement(v.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},C.a.createElement("div",{className:"flex-container"},C.a.createElement(v.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},C.a.createElement(N.a,{style:Q})),C.a.createElement(ce,{onFileChange:be}))),C.a.createElement(v.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u63CF\u8FF0"}]},C.a.createElement(N.a,{style:{width:264}})),C.a.createElement(v.a.Item,{style:{textAlign:"right"}},C.a.createElement(f.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),C.a.createElement(f.a,{type:"ghost",onClick:ae},"\u53D6\u6D88")))};function ce(ne){var oe=ne.onFileChange;return C.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",C.a.createElement("input",{type:"file",onChange:oe}))}function ge(ne,oe){if(!ne)throw new String("\u6CA1\u6709\u6587\u4EF6");var ae=new FormData;ae.append("editormd-image-file",ne),ae.append("file_param_name","editormd-image-file"),ae.append("byxhr","true");var $=new window.XMLHttpRequest;$.withCredentials=!0,$.addEventListener("load",function(J){oe(JSON.parse(J.target.responseText),ne)},!1),$.addEventListener("error",function(J){console.error(J)},!1),$.open("POST","".concat(B.a,"/api/attachments.json")),$.send(ae)}var pe=Z("giR+"),ue=Z("fyUT"),le=Z("7Kak"),de=Z("9yH6"),ye=de.a.Group,Me={margin:"0 8px"},Ue=function(ne){var oe=ne.callback,ae=ne.onCancel;function $(J){oe(J)}return C.a.createElement(v.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:$},C.a.createElement("div",{className:"flex-container"},C.a.createElement("span",{style:Me},"\u5355\u5143\u683C\u6570\uFF1A"),C.a.createElement("span",{style:Me},"\u884C\u6570"),C.a.createElement(v.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},C.a.createElement(ue.a,null)),C.a.createElement("span",{style:Me},"\u5217\u6570"),C.a.createElement(v.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},C.a.createElement(ue.a,null))),C.a.createElement("div",{className:"flex-container",style:{marginTop:12}},C.a.createElement("span",{style:Me},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),C.a.createElement(v.a.Item,{name:"align"},C.a.createElement(ye,null,C.a.createElement(de.a,{value:"default"},C.a.createElement("i",{className:"fa fa-align-justify"})),C.a.createElement(de.a,{value:"left"},C.a.createElement("i",{className:"fa fa-align-left"})),C.a.createElement(de.a,{value:"center"},C.a.createElement("i",{className:"fa fa-align-center"})),C.a.createElement(de.a,{value:"right"},C.a.createElement("i",{className:"fa fa-align-right"}))))),C.a.createElement("div",{className:"flex-container flex-end"},C.a.createElement(f.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),C.a.createElement(f.a,{type:"ghost",onClick:ae},"\u53D6\u6D88")))},Re=Z("m3rI"),Oe="link",Ce="upload-image",Le="code-block",Fe="add-table",We="------------",Be={default:We,left:":".concat(We),center:":".concat(We,":"),right:"".concat(We,":")},Ae=Z("9VGf"),Se,$e;function qe(){}var Je=0,Xe=1e4,ot="\u2581",Qe=`
|
|
**\u6A21\u677F\u6807\u9898**
|
|
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function Ye(ne){return/^\d+$/.test(ne)?"".concat(ne,"px"):ne}var Ee=navigator.platform.toUpperCase().indexOf("MAC")>=0,nt=Ee?"Cmd":"Ctrl",Ze=(Se={},Object(j.a)(Se,nt+"-B","bold"),Object(j.a)(Se,nt+"-I","italic"),Se),xe=($e={},Object(j.a)($e,Oe,"\u6DFB\u52A0\u94FE\u63A5"),Object(j.a)($e,Le,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(j.a)($e,Ce,"\u6DFB\u52A0\u56FE\u7247"),Object(j.a)($e,Fe,"\u6DFB\u52A0\u8868\u683C"),$e),Ne=rt.a=function(ne){var oe=ne.defaultValue,ae=oe===void 0?"":oe,$=ne.onChange,J=ne.width,q=J===void 0?"100%":J,te=ne.height,me=te===void 0?400:te,be=ne.miniToolbar,Pe=be===void 0?!1:be,gt=ne.isFocus,Ft=gt===void 0?!1:gt,St=ne.watch,pr=ne.insertTemp,et=ne.mode,De=et===void 0?"markdown":et,Ct=ne.id,vt=Ct===void 0?"markdown-editor-id":Ct,ir=ne.showResizeBar,$t=ir===void 0?!1:ir,ut=ne.noStorage,ze=ut===void 0?!1:ut,Fr=ne.showNullButton,Te=Fr===void 0?!1:Fr,gr=ne.hidetoolBar,Jt=gr===void 0?!1:gr,cr=ne.fullScreen,Et=cr===void 0?!1:cr,Vt=ne.onBlur,sr=ne.onCMBeforeChange,Dt=ne.onFullScreen,Ke=ne.className,ar=Ke===void 0?"":Ke,Qt=ne.disablePaste,Mt=Qt===void 0?!1:Qt,ct=ne.placeholder,yt=ct===void 0?"":ct,Xt=ne.values,Yt=Xt===void 0?"":Xt,_e=Object(k.useState)(null),tt=Object(P.a)(_e,2),Ie=tt[0],vr=tt[1],yr=Object(k.useState)(ae),rr=Object(P.a)(yr,2),fr=rr[0],st=rr[1],hr=Object(k.useState)(St),Bt=Object(P.a)(hr,2),Tt=Bt[0],Kt=Bt[1],jt=Object(k.useState)(Et),Ot=Object(P.a)(jt,2),pt=Ot[0],mr=Ot[1],mt=Object(k.useState)(""),xt=Object(P.a)(mt,2),He=xt[0],wt=xt[1],ht=Object(k.useState)(0),wr=Object(P.a)(ht,2),At=wr[0],It=wr[1],lr=Object(k.useState)(me),Rr=Object(P.a)(lr,2),Or=Rr[0],zt=Rr[1],dt=Object(k.useState)(!1),at=Object(P.a)(dt,2),Pt=at[0],Wt=at[1],Gt=Object(k.useRef)(),_t=Object(k.useRef)(),Wr=Object(k.useRef)(),Hr=Object(k.useRef)();Object(k.useEffect)(function(){st(Yt),Ie==null||Ie.setValue(Yt)},[Yt]),Object(k.useEffect)(function(){Dt==null||Dt(pt)},[pt]),Object(k.useEffect)(function(){if(Gt.current){var ft=x.a.fromTextArea(Gt.current,{mode:De,lineNumbers:!Pe,lineWrapping:!0,value:ae,autoCloseTags:!0,autoCloseBrackets:!0});Ft&&ft.focus();function kt(Ut,Zt){if(Mt){Zt.preventDefault();return}var qt=Zt.clipboardData;if(qt){var or=qt.types.toString(),xr=qt.items,er=["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(or==="Files"||qt.types.indexOf("Files")>-1){if(Zt.preventDefault(),De=="stex")return;try{var kr,rn=xr[1];((kr=xr[0])===null||kr===void 0?void 0:kr.kind)==="file"&&(rn=xr[0]);var ur=rn.getAsFile(),_r=ur.name.split(".").pop();ge(ur,function(Nt){if(Nt.id){var br,Ar,Gr;(ur==null||((br=ur.type)===null||br===void 0)?void 0:br.indexOf("image"))>-1?ft.replaceSelection(".concat(Nt.content_type,")")):(ur==null||((Ar=ur.type)===null||Ar===void 0)?void 0:Ar.indexOf("video"))>-1?ft.replaceSelection('<video width="100%" controls src="'.concat(Re.a.API_SERVER,"/api/attachments/").concat(Nt.id,'"></video>')):(ur==null||((Gr=ur.type)===null||Gr===void 0)?void 0:Gr.indexOf("pdf"))>-1?ft.replaceSelection('<a href="'.concat(Re.a.API_SERVER,"/api/attachments/").concat(Nt.id,"?type=").concat(ur.type,'&disposition=inline" target="_blank">').concat(ur.name,"</a>")):er.includes(_r)?ft.replaceSelection('<a href="'.concat(Re.a.API_SERVER,"/api/attachments/").concat(Nt.id,'?type=office&disposition=inline" target="_blank">').concat(ur.name,"</a>")):ft.replaceSelection("[".concat(ur.name,"](").concat(Re.a.API_SERVER,"/api/attachments/").concat(Nt.id,"?type=").concat(Nt.content_type,")"))}else(Nt==null?void 0:Nt.status)===401&&(document.location.href="/user/login")})}catch(Nt){M.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return ft.on("paste",kt),vr(ft),function(){ft.off("paste",kt)}}},[]);var ln=Object(k.useCallback)(function(){if(_t.current)try{}catch(ft){console.log(ft,"---- to set md editor body height")}},[Or,_t,pt]);Object(k.useEffect)(function(){function ft(){var Ut=new A.default(function(Zt){var qt=Object(L.a)(Zt),or;try{for(qt.s();!(or=qt.n()).done;){var xr=or.value;(xr.target.offsetHeight>0||xr.target.offsetWidth>0)&&(ln(),Ie.setSize("100%","100%"),Ie.refresh())}}catch(er){qt.e(er)}finally{qt.f()}});return Ut.observe(Gt.current.parentElement),Ut}if(Ie){var kt=ft();return function(){kt.unobserve(Gt.current.parentElement)}}},[Ie,ln]),Object(k.useEffect)(function(){if(Ie){for(var ft=[],kt=function(){var xr=Zt[Ut];qt=Object(P.a)(xr,2);var er=qt[0],kr=qt[1],rn=Object(j.a)({},er,function(){un(kr)});ft.push(rn),Ie.addKeyMap(rn)},Ut=0,Zt=Object.entries(Ze);Ut<Zt.length;Ut++){var qt;kt()}return function(){var or=Object(L.a)(ft),xr;try{for(or.s();!(xr=or.n()).done;){var er=xr.value;Ie.removeKeyMap(er)}}catch(kr){or.e(kr)}finally{or.f()}}}},[Ie]),Object(k.useEffect)(function(){Et!==pt&&mr(Et)},[Et]),Object(Ae.a)(function(){if(!ze&&At>0){var ft=new Date().getTime(),kt=window.sessionStorage.getItem(vt);ft>=At+Xe&&(!kt||kt!==fr)&&(window.sessionStorage.setItem(vt,fr),Wt(!0))}},Xe),Object(k.useEffect)(function(){Kt(St)},[Ie,St]),Object(k.useEffect)(function(){Ie&&(Ft&&Ie.focus())},[Ie,Ft]),Object(k.useEffect)(function(){if(Tt&&Ie){var ft=Ie.getScrollerElement();function kt(Ut){var Zt=Ut.target;if(Hr.current){var qt=Zt.scrollTop/Zt.scrollHeight;Hr.current.scrollTop=Hr.current.scrollHeight*qt}}return ft.addEventListener("scroll",kt),function(){ft.removeEventListener("scroll",kt)}}},[Ie,Tt]),Object(k.useEffect)(function(){if(Ie&&sr){function ft(kt,Ut){sr(kt,Ut)}return Ie.on("beforeChange",ft),function(){Ie.off("beforeChange",ft)}}},[Ie,sr]),Object(k.useEffect)(function(){if(Ie&&Vt){function ft(){Vt(Ie.getValue())}return Ie.on("blur",ft),function(){Ie.off("blur",ft)}}},[Ie,Vt]),Object(k.useEffect)(function(){if(Ie){function ft(kt){var Ut=kt.getValue();st(Ut),It(new Date().getTime()),kt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),$&&$(Ut)}return Ie.on("change",ft),function(){Ie.off("change",ft)}}},[Ie,$]),Object(k.useEffect)(function(){Ie&&(ae==null?(Ie.setValue(""),st("")):ae!==Ie.getValue()&&(Ie.setValue(ae),st(ae),Ie.setCursor(Ie.lineCount(),0)))},[Ie,ae]);var un=Object(k.useCallback)(function(ft){var kt=Ie.getCursor(),Ut=Ie.getSelection(),Zt=Ut.split(`
|
|
`);switch(ft){case"bold":return Ie.replaceSelection("**"+Ut+"**"),Ut===""&&Ie.setCursor(kt.line,kt.ch+2),Ie.focus();case"italic":return Ie.replaceSelection("*"+Ut+"*"),Ut===""&&Ie.setCursor(kt.line,kt.ch+1),Ie.focus();case"code":return Ie.replaceSelection("`"+Ut+"`"),Ut===""&&Ie.setCursor(kt.line,kt.ch+1),Ie.focus();case"inline-latex":return Ie.replaceSelection("`$$"+Ut+"$$`"),Ut===""&&Ie.setCursor(kt.line,kt.ch+3),Ie.focus();case"latex":return Ie.replaceSelection("```latex\n"+Ut+"\n```"),Ie.setCursor(kt.line+1,Ut.length+1),Ie.focus();case"line-break":return Ie.replaceSelection(`<br/>
|
|
`),Ie.focus();case"list-ul":return Ut===""?Ie.replaceSelection("- "+Ut):Ie.replaceSelection(Zt.map(function(qt){return qt===""?"":"- ".concat(qt)}).join(`
|
|
`)),Ie.focus();case"list-ol":return Ut===""?Ie.replaceSelection("1. "+Ut):Ie.replaceSelection(Zt.map(function(qt,or){return qt===""?"":"".concat(or+1,". ").concat(qt)}).join(`
|
|
`)),Ie.focus();case"add-null-ch":return Ut===""&&Ie.setCursor(kt.line,kt.ch+1),Ie.replaceSelection(ot),Ie.focus();case"inster-template-1":return Ut===""&&Ie.setCursor(kt.line,kt.ch),Ie.replaceSelection(Qe),Ie.focus();case"eraser":return Ie.setValue(""),Ie.focus();case"trigger-watch":return Kt(!Tt),Ie.focus();case"trigger-full-screen":return mr(!pt),Ie.focus();case Oe:wt(Oe);return;case Le:wt(Le);return;case Ce:wt(Ce);return;case Fe:wt(Fe);return;default:throw new Error}},[Ie,Tt,pt]),xn=Object(k.useCallback)(function(ft){wt("");switch(He){case Oe:var kt=ft.title,Ut=ft.link;return Ie.replaceSelection("[".concat(kt,"](").concat(Ut,")")),Ie.focus();case Le:var Zt=ft.language,qt=ft.content;return Ie.replaceSelection(["```"+Zt,qt,"```"].join(`
|
|
`)),Ie.focus();case Ce:var or=ft.src,xr=ft.alt;return Ie.replaceSelection(".concat(or,' "').concat(xr,'" )')),Ie.focus();case Fe:for(var er=ft.row,kr=ft.col,rn=ft.align,ur=`
|
|
`,_r=0;_r<er;_r++){for(var Nt=[],br=[],Ar=0;Ar<kr;Ar++)_r===1&&br.push(Be[rn]),Nt.push(" ");_r===1&&(ur+="| ".concat(br.join(" | "),` |
|
|
`)),ur+="| ".concat(Nt.join(kr===1?"":" | "),` |
|
|
`)}return Ie.replaceSelection(ur+`
|
|
`),Ie.focus();default:throw new Error}},[Ie,He]),on=Object(k.useMemo)(function(){switch(He){case Oe:return C.a.createElement(z,{callback:xn,onCancel:dn});case Le:return C.a.createElement(F.b,{callback:xn,onCancel:dn});case Ce:return C.a.createElement(fe,{callback:xn,onCancel:dn});case Fe:return C.a.createElement(Ue,{callback:xn,onCancel:dn});default:return null}},[He]);function dn(){wt("")}Object(k.useEffect)(function(){if(Wr.current){var ft=Wr.current,kt=!1,Ut=0;function Zt(xr){kt=!0,Ut=xr.pageY}function qt(){kt=!1}function or(xr){if(kt){var er=xr.pageY-Ut;er<0&&(er=0),er>300&&(er=300);var kr=me+er+"px";zt(kr)}}return ft.addEventListener("mousedown",Zt),document.addEventListener("mousemove",or),document.addEventListener("mouseup",qt),function(){ft.removeEventListener("mousedown",Zt),document.removeEventListener("mousemove",or),document.removeEventListener("mouseup",qt)}}},[Ie,Wr]),Object(k.useEffect)(function(){zt(me)},[me]);var sn=Ye(q),Wn=Ye(Or),Hn={width:sn,height:Wn},mn=Object(k.useMemo)(function(){if(At){var ft=new Date(At),kt=ft.getHours(),Ut=ft.getMinutes(),Zt=ft.getSeconds();return kt=kt<10?"0"+kt:kt,Ut=Ut<10?"0"+Ut:Ut,Zt=Zt<10?"0"+Zt:Zt,"".concat(kt,":").concat(Ut,":").concat(Zt)}return 0},[At]);function ki(){window.sessionStorage.removeItem(vt),Wt(!1),It(0)}function Kn(){Wt(!1),It(0),Ie.setValue(window.sessionStorage.getItem(vt))}return C.a.createElement(k.Fragment,null,C.a.createElement("div",{className:"markdown-editor-wrapper",ref:_t},C.a.createElement("div",{className:"markdown-editor-container ".concat(ar," ").concat(Tt?"on-preview":""," ").concat(Pe?"mini":""," ").concat(pt?"full-screen":""),style:Hn},C.a.createElement(c,{insertTemp:pr,watch:Tt,fullScreen:pt,showNullButton:Te,onActionCallback:un,hidetoolBar:Jt}),C.a.createElement("div",{className:"markdown-editor-body"},C.a.createElement("div",{className:"codemirror-container"},C.a.createElement("textarea",{ref:Gt,placeholder:yt})),Tt?C.a.createElement("div",{ref:Hr,className:"preview-container"},De==="stex"&&C.a.createElement(E,{value:fr}),De!=="stex"&&C.a.createElement(h.a,{value:fr})):null))),$t?C.a.createElement("a",{ref:Wr,className:"editor-resize"}):null,C.a.createElement(l.a,null,xe[He]?C.a.createElement(V.a,{centered:!0,title:xe[He],visible:!0,onCancel:dn,footer:null},on):null))}},SJMd:function(Rt,rt){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var Z,re,V,L=!1,K,M;window.PR_SHOULD_USE_CONTINUATION=!0;var P,j;(function(){var k=window,C=["break,continue,do,else,for,if,return,while"],R=[C,"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"],x=[R,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],A=[x,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],O=[x,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],S=[x,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],_="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",b=[x,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",s=[C,"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=[C,"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"],h=[C,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],E=[A,S,O,b,d,s,u,h],m=/^(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",w="kwd",y="com",p="typ",c="lit",l="pun",a="pln",f="tag",o="dec",v="src",D="atn",N="atv",W="nocode",z="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function F(Ce){for(var Le=0,Fe=!1,We=!1,Be=0,Ae=Ce.length;Be<Ae;++Be){var Se=Ce[Be];if(Se.ignoreCase)We=!0;else if(/[a-z]/i.test(Se.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Fe=!0,We=!1;break}}var $e={b:8,t:9,n:10,v:11,f:12,r:13};function qe(Ye){var Ee=Ye.charCodeAt(0);if(Ee!==92)return Ee;var nt=Ye.charAt(1);return Ee=$e[nt],Ee||("0"<=nt&&nt<="7"?parseInt(Ye.substring(1),8):nt==="u"||nt==="x"?parseInt(Ye.substring(2),16):Ye.charCodeAt(1))}function Je(Ye){if(Ye<32)return(Ye<16?"\\x0":"\\x")+Ye.toString(16);var Ee=String.fromCharCode(Ye);return Ee==="\\"||Ee==="-"||Ee==="]"||Ee==="^"?"\\"+Ee:Ee}function Xe(Ye){var Ee=Ye.substring(1,Ye.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")),nt=[],Ze=Ee[0]==="^",xe=["["];Ze&&xe.push("^");for(var Ne=Ze?1:0,ne=Ee.length;Ne<ne;++Ne){var oe=Ee[Ne];if(/\\[bdsw]/i.test(oe))xe.push(oe);else{var ae=qe(oe),$;Ne+2<ne&&Ee[Ne+1]==="-"?($=qe(Ee[Ne+2]),Ne+=2):$=ae,nt.push([ae,$]),$<65||ae>122||($<65||ae>90||nt.push([Math.max(65,ae)|32,Math.min($,90)|32]),$<97||ae>122||nt.push([Math.max(97,ae)&~32,Math.min($,122)&~32]))}}nt.sort(function(me,be){return me[0]-be[0]||be[1]-me[1]});for(var J=[],q=[],Ne=0;Ne<nt.length;++Ne){var te=nt[Ne];te[0]<=q[1]+1?q[1]=Math.max(q[1],te[1]):J.push(q=te)}for(var Ne=0;Ne<J.length;++Ne){var te=J[Ne];xe.push(Je(te[0])),te[1]>te[0]&&(te[1]+1>te[0]&&xe.push("-"),xe.push(Je(te[1])))}return xe.push("]"),xe.join("")}function ot(Ye){for(var Ee=Ye.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")),nt=Ee.length,Ze=[],xe=0,Ne=0;xe<nt;++xe){var ne=Ee[xe];if(ne==="(")++Ne;else if(ne.charAt(0)==="\\"){var oe=+ne.substring(1);oe&&(oe<=Ne?Ze[oe]=-1:Ee[xe]=Je(oe))}}for(var xe=1;xe<Ze.length;++xe)Ze[xe]===-1&&(Ze[xe]=++Le);for(var xe=0,Ne=0;xe<nt;++xe){var ne=Ee[xe];if(ne==="(")++Ne,Ze[Ne]||(Ee[xe]="(?:");else if(ne.charAt(0)==="\\"){var oe=+ne.substring(1);oe&&oe<=Ne&&(Ee[xe]="\\"+Ze[oe])}}for(var xe=0;xe<nt;++xe)Ee[xe]==="^"&&Ee[xe+1]!=="^"&&(Ee[xe]="");if(Ye.ignoreCase&&Fe)for(var xe=0;xe<nt;++xe){var ne=Ee[xe],ae=ne.charAt(0);ne.length>=2&&ae==="["?Ee[xe]=Xe(ne):ae!=="\\"&&(Ee[xe]=ne.replace(/[a-zA-Z]/g,function(q){var te=q.charCodeAt(0);return"["+String.fromCharCode(te&~32,te|32)+"]"}))}return Ee.join("")}for(var Qe=[],Be=0,Ae=Ce.length;Be<Ae;++Be){var Se=Ce[Be];if(Se.global||Se.multiline)throw new Error(""+Se);Qe.push("(?:"+ot(Se)+")")}return new RegExp(Qe.join("|"),We?"gi":"g")}function I(Ce,Le){var Fe=/(?:^|\s)nocode(?:\s|$)/,We=[],Be=0,Ae=[],Se=0;function $e(qe){var Je=qe.nodeType;if(Je==1){if(Fe.test(qe.className))return;for(var Xe=qe.firstChild;Xe;Xe=Xe.nextSibling)$e(Xe);var ot=qe.nodeName.toLowerCase();(ot==="br"||ot==="li")&&(We[Se]=`
|
|
`,Ae[Se<<1]=Be++,Ae[Se++<<1|1]=qe)}else if(Je==3||Je==4){var Qe=qe.nodeValue;Qe.length&&(Le?Qe=Qe.replace(/\r\n?/g,`
|
|
`):Qe=Qe.replace(/[ \t\r\n]+/g," "),We[Se]=Qe,Ae[Se<<1]=Be,Be+=Qe.length,Ae[Se++<<1|1]=qe)}}return $e(Ce),{sourceCode:We.join("").replace(/\n$/,""),spans:Ae}}function B(Ce,Le,Fe,We,Be){if(!Fe)return;var Ae={sourceNode:Ce,pre:1,langExtension:null,numberLines:null,sourceCode:Fe,spans:null,basePos:Le,decorations:null};We(Ae),Be.push.apply(Be,Ae.decorations)}var Y=/\S/;function Q(Ce){for(var Le=void 0,Fe=Ce.firstChild;Fe;Fe=Fe.nextSibling){var We=Fe.nodeType;Le=We===1?Le?Ce:Fe:We===3&&Y.test(Fe.nodeValue)?Ce:Le}return Le===Ce?void 0:Le}function ee(Ce,Le){var Fe={},We;(function(){for(var Se=Ce.concat(Le),$e=[],qe={},Je=0,Xe=Se.length;Je<Xe;++Je){var ot=Se[Je],Qe=ot[3];if(Qe)for(var Ye=Qe.length;--Ye>=0;)Fe[Qe.charAt(Ye)]=ot;var Ee=ot[1],nt=""+Ee;qe.hasOwnProperty(nt)||($e.push(Ee),qe[nt]=null)}$e.push(/[\0-\uffff]/),We=F($e)})();var Be=Le.length,Ae=function(Se){for(var $e=Se.sourceCode,qe=Se.basePos,Je=Se.sourceNode,Xe=[qe,a],ot=0,Qe=$e.match(We)||[],Ye={},Ee=0,nt=Qe.length;Ee<nt;++Ee){var Ze=Qe[Ee],xe=Ye[Ze],Ne=void 0,ne;if(typeof xe=="string")ne=!1;else{var oe=Fe[Ze.charAt(0)];if(oe)Ne=Ze.match(oe[1]),xe=oe[0];else{for(var ae=0;ae<Be;++ae)if(oe=Le[ae],Ne=Ze.match(oe[1]),Ne){xe=oe[0];break}Ne||(xe=a)}ne=xe.length>=5&&xe.substring(0,5)==="lang-",ne&&!(Ne&&typeof Ne[1]=="string")&&(ne=!1,xe=v),ne||(Ye[Ze]=xe)}var $=ot;if(ot+=Ze.length,!ne)Xe.push(qe+$,xe);else{var J=Ne[1],q=Ze.indexOf(J),te=q+J.length;Ne[2]&&(te=Ze.length-Ne[2].length,q=te-J.length);var me=xe.substring(5);B(Je,qe+$,Ze.substring(0,q),Ae,Xe),B(Je,qe+$+q,J,de(me,J),Xe),B(Je,qe+$+te,Ze.substring(te),Ae,Xe)}}Se.decorations=Xe};return Ae}function fe(Ce){var Le=[],Fe=[];Ce.tripleQuotedStrings?Le.push([g,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ce.multiLineStrings?Le.push([g,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Le.push([g,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ce.verbatimStrings&&Fe.push([g,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var We=Ce.hashComments;We&&(Ce.cStyleComments?(We>1?Le.push([y,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Le.push([y,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Fe.push([g,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Le.push([y,/^#[^\r\n]*/,null,"#"])),Ce.cStyleComments&&(Fe.push([y,/^\/\/[^\r\n]*/,null]),Fe.push([y,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Be=Ce.regexLiterals;if(Be){var Ae=Be>1?"":`
|
|
\r`,Se=Ae?".":"[\\S\\s]",$e="/(?=[^/*"+Ae+"])(?:[^/\\x5B\\x5C"+Ae+"]|\\x5C"+Se+"|\\x5B(?:[^\\x5C\\x5D"+Ae+"]|\\x5C"+Se+")*(?:\\x5D|$))+/";Fe.push(["lang-regex",RegExp("^"+z+"("+$e+")")])}var qe=Ce.types;qe&&Fe.push([p,qe]);var Je=(""+Ce.keywords).replace(/^ | $/g,"");Je.length&&Fe.push([w,new RegExp("^(?:"+Je.replace(/[\s,]+/g,"|")+")\\b"),null]),Le.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var Xe="^.[^\\s\\w.$@'\"`/\\\\]*";return Ce.regexLiterals&&(Xe+="(?!s*/)"),Fe.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[p,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[l,new RegExp(Xe),null]),ee(Le,Fe)}var ce=fe({keywords:E,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function ge(Ce,Le,Fe){for(var We=/(?:^|\s)nocode(?:\s|$)/,Be=/\r\n?|\n/,Ae=Ce.ownerDocument,Se=Ae.createElement("li");Ce.firstChild;)Se.appendChild(Ce.firstChild);var $e=[Se];function qe(Ee){var nt=Ee.nodeType;if(nt==1&&!We.test(Ee.className))if(Ee.nodeName==="br")Je(Ee),Ee.parentNode&&Ee.parentNode.removeChild(Ee);else for(var Ze=Ee.firstChild;Ze;Ze=Ze.nextSibling)qe(Ze);else if((nt==3||nt==4)&&Fe){var xe=Ee.nodeValue,Ne=xe.match(Be);if(Ne){var ne=xe.substring(0,Ne.index);Ee.nodeValue=ne;var oe=xe.substring(Ne.index+Ne[0].length);if(oe){var ae=Ee.parentNode;ae.insertBefore(Ae.createTextNode(oe),Ee.nextSibling)}Je(Ee),ne||Ee.parentNode.removeChild(Ee)}}}function Je(Ee){for(;!Ee.nextSibling;)if(Ee=Ee.parentNode,!Ee)return;function nt(Ne,ne){var oe=ne?Ne.cloneNode(!1):Ne,ae=Ne.parentNode;if(ae){var $=nt(ae,1),J=Ne.nextSibling;$.appendChild(oe);for(var q=J;q;q=J)J=q.nextSibling,$.appendChild(q)}return oe}for(var Ze=nt(Ee.nextSibling,0),xe;(xe=Ze.parentNode)&&xe.nodeType===1;)Ze=xe;$e.push(Ze)}for(var Xe=0;Xe<$e.length;++Xe)qe($e[Xe]);Le===(Le|0)&&$e[0].setAttribute("value",Le);var ot=Ae.createElement("ol");ot.className="linenums";for(var Qe=Math.max(0,Le-1|0)||0,Xe=0,Ye=$e.length;Xe<Ye;++Xe)Se=$e[Xe],Se.className="L"+(Xe+Qe)%10,Se.firstChild||Se.appendChild(Ae.createTextNode("\xA0")),ot.appendChild(Se);Ce.appendChild(ot)}function pe(Ce){var Le=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Le=Le&&+Le[1]<=8;var Fe=/\n/g,We=Ce.sourceCode,Be=We.length,Ae=0,Se=Ce.spans,$e=Se.length,qe=0,Je=Ce.decorations,Xe=Je.length,ot=0;Je[Xe]=Be;var Qe,Ye;for(Ye=Qe=0;Ye<Xe;)Je[Ye]!==Je[Ye+2]?(Je[Qe++]=Je[Ye++],Je[Qe++]=Je[Ye++]):Ye+=2;for(Xe=Qe,Ye=Qe=0;Ye<Xe;){for(var Ee=Je[Ye],nt=Je[Ye+1],Ze=Ye+2;Ze+2<=Xe&&Je[Ze+1]===nt;)Ze+=2;Je[Qe++]=Ee,Je[Qe++]=nt,Ye=Ze}Xe=Je.length=Qe;var xe=Ce.sourceNode,Ne="";xe&&(Ne=xe.style.display,xe.style.display="none");try{for(var ne=null;qe<$e;){var oe=Se[qe],ae=Se[qe+2]||Be,$=Je[ot+2]||Be,Ze=Math.min(ae,$),J=Se[qe+1],q;if(J.nodeType!==1&&(q=We.substring(Ae,Ze))){Le&&(q=q.replace(Fe,"\r")),J.nodeValue=q;var te=J.ownerDocument,me=te.createElement("span");me.className=Je[ot+1];var be=J.parentNode;be.replaceChild(me,J),me.appendChild(J),Ae<ae&&(Se[qe+1]=J=te.createTextNode(We.substring(Ze,ae)),be.insertBefore(J,me.nextSibling))}Ae=Ze,Ae>=ae&&(qe+=2),Ae>=$&&(ot+=2)}}finally{xe&&(xe.style.display=Ne)}}var ue={};function le(Ce,Le){for(var Fe=Le.length;--Fe>=0;){var We=Le[Fe];ue.hasOwnProperty(We)?k.console&&console.warn("cannot override language handler %s",We):ue[We]=Ce}}function de(Ce,Le){return Ce&&ue.hasOwnProperty(Ce)||(Ce=/^\s*</.test(Le)?"default-markup":"default-code"),ue[Ce]}le(ce,["default-code"]),le(ee([],[[a,/^[^<?]+/],[o,/^<!\w[^>]*(?:>|$)/],[y,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[l,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),le(ee([[a,/^[\s]+/,null,` \r
|
|
`],[N,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[f,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[D,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[l,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),le(ee([],[[N,/^[\s\S]+/]]),["uq.val"]),le(fe({keywords:A,hashComments:!0,cStyleComments:!0,types:m}),["c","cc","cpp","cxx","cyc","m"]),le(fe({keywords:"null,true,false"}),["json"]),le(fe({keywords:S,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:m}),["cs"]),le(fe({keywords:O,cStyleComments:!0}),["java"]),le(fe({keywords:h,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),le(fe({keywords:s,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),le(fe({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),le(fe({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),le(fe({keywords:b,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),le(fe({keywords:_,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),le(ee([],[[g,/^[\s\S]+/]]),["regex"]);function ye(Ce){var Le=Ce.langExtension;try{var Fe=I(Ce.sourceNode,Ce.pre),We=Fe.sourceCode;Ce.sourceCode=We,Ce.spans=Fe.spans,Ce.basePos=0,de(Le,We)(Ce),pe(Ce)}catch(Be){k.console&&console.log(Be&&Be.stack||Be)}}function Me(Ce,Le,Fe){var We=Fe||!1,Be=Le||null,Ae=document.createElement("div");Ae.innerHTML="<pre>"+Ce+"</pre>",Ae=Ae.firstChild,We&&ge(Ae,We,!0);var Se={langExtension:Be,numberLines:We,sourceNode:Ae,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return ye(Se),Ae.innerHTML}function Ue(Ce,Le){var Fe=Le||document.body,We=Fe.ownerDocument||document;function Be(oe){return Fe.getElementsByTagName(oe)}for(var Ae=[Be("pre"),Be("code"),Be("xmp")],Se=[],$e=0;$e<Ae.length;++$e)for(var qe=0,Je=Ae[$e].length;qe<Je;++qe)Se.push(Ae[$e][qe]);Ae=null;var Xe=Date;Xe.now||(Xe={now:function(){return+new Date}});var ot=0,Qe=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ye=/\bprettyprint\b/,Ee=/\bprettyprinted\b/,nt=/pre|xmp/i,Ze=/^code$/i,xe=/^(?:pre|code|xmp)$/i,Ne={};function ne(){for(var oe=k.PR_SHOULD_USE_CONTINUATION?Xe.now()+250:Infinity;ot<Se.length&&Xe.now()<oe;ot++){for(var ae=Se[ot],$=Ne,J=ae;J=J.previousSibling;){var q=J.nodeType,te=(q===7||q===8)&&J.nodeValue;if(te?!/^\??prettify\b/.test(te):q!==3||/\S/.test(J.nodeValue))break;if(te){$={},te.replace(/\b(\w+)=([\w:.%+-]+)/g,function($t,ut,ze){$[ut]=ze});break}}var me=ae.className;if(($!==Ne||Ye.test(me))&&!Ee.test(me)){for(var be=!1,Pe=ae.parentNode;Pe;Pe=Pe.parentNode){var gt=Pe.tagName;if(xe.test(gt)&&Pe.className&&Ye.test(Pe.className)){be=!0;break}}if(!be){ae.className+=" prettyprinted";var Ft=$.lang;if(!Ft){Ft=me.match(Qe);var St;!Ft&&(St=Q(ae))&&Ze.test(St.tagName)&&(Ft=St.className.match(Qe)),Ft&&(Ft=Ft[1])}var pr;if(nt.test(ae.tagName))pr=1;else{var et=ae.currentStyle,De=We.defaultView,Ct=et?et.whiteSpace:De&&De.getComputedStyle?De.getComputedStyle(ae,null).getPropertyValue("white-space"):0;pr=Ct&&Ct.substring(0,3)==="pre"}var vt=$.linenums;(vt=vt==="true"||+vt)||(vt=me.match(/\blinenums\b(?::(\d+))?/),vt=vt?vt[1]&&vt[1].length?+vt[1]:!0:!1),vt&&ge(ae,vt,pr);var ir={langExtension:Ft,sourceNode:ae,numberLines:vt,pre:pr,sourceCode:null,basePos:null,spans:null,decorations:null};ye(ir)}}}ot<Se.length?k.setTimeout(ne,250):typeof Ce=="function"&&Ce()}ne()}var Re=k.PR={createSimpleLexer:ee,registerLangHandler:le,sourceDecorator:fe,PR_ATTRIB_NAME:D,PR_ATTRIB_VALUE:N,PR_COMMENT:y,PR_DECLARATION:o,PR_KEYWORD:w,PR_LITERAL:c,PR_NOCODE:W,PR_PLAIN:a,PR_PUNCTUATION:l,PR_SOURCE:v,PR_STRING:g,PR_TAG:f,PR_TYPE:p,prettyPrintOne:L?k.prettyPrintOne=Me:P=Me,prettyPrint:j=L?k.prettyPrint=Ue:j=Ue},Oe=k.define;typeof Oe=="function"&&Oe.amd&&Oe("google-code-prettify",[],function(){return Re})})()},"VrN/":function(Rt,rt,Z){(function(re,V){Rt.exports=V()})(this,function(){"use strict";var re=navigator.userAgent,V=navigator.platform,L=/gecko\/\d/i.test(re),K=/MSIE \d/.test(re),M=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(re),P=/Edge\/(\d+)/.exec(re),j=K||M||P,k=j&&(K?document.documentMode||6:+(P||M)[1]),C=!P&&/WebKit\//.test(re),R=C&&/Qt\/\d+\.\d+/.test(re),x=!P&&/Chrome\//.test(re),A=/Opera\//.test(re),O=/Apple Computer/.test(navigator.vendor),S=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(re),_=/PhantomJS/.test(re),b=!P&&/AppleWebKit/.test(re)&&/Mobile\/\w+/.test(re),d=/Android/.test(re),s=b||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(re),u=b||/Mac/.test(V),h=/\bCrOS\b/.test(re),E=/win/i.test(V),m=A&&re.match(/Version\/(\d*\.\d*)/);m&&(m=Number(m[1])),m&&m>=15&&(A=!1,C=!0);var g=u&&(R||A&&(m==null||m<12.11)),w=L||j&&k>=9;function y(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var p=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 l(e,t){return c(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var T=0;T<t.length;++T)i.appendChild(t[T]);return i}function f(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var o;document.createRange?o=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:o=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 D(){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 N(e,t){var n=e.className;y(t).test(n)||(e.className+=(n?" ":"")+t)}function W(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 z=function(e){e.select()};b?z=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:j&&(z=function(e){try{e.select()}catch(t){}});function F(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function I(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 B(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var T=r||0,U=i||0;;){var H=e.indexOf(" ",T);if(H<0||H>=t)return U+(t-T);U+=H-T,U+=n-U%n,T=H+1}}var Y=function(){this.id=null,this.f=null,this.time=0,this.handler=F(this.onTimeout,this)};Y.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Y.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function Q(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var ee=50,fe={toString:function(){return"CodeMirror.Pass"}},ce={scroll:!1},ge={origin:"*mouse"},pe={origin:"+move"};function ue(e,t,n){for(var r=0,i=0;;){var T=e.indexOf(" ",r);T==-1&&(T=e.length);var U=T-r;if(T==e.length||i+U>=t)return r+Math.min(U,t-i);if(i+=T-r,i+=n-i%n,r=T+1,i>=t)return r}}var le=[""];function de(e){for(;le.length<=e;)le.push(ye(le)+" ");return le[e]}function ye(e){return e[e.length-1]}function Me(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Ue(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function Re(){}function Oe(e,t){var n;return Object.create?n=Object.create(e):(Re.prototype=e,n=new Re),t&&I(t,n),n}var Ce=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Le(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Ce.test(e))}function Fe(e,t){return t?t.source.indexOf("\\w")>-1&&Le(e)?!0:t.test(e):Le(e)}function We(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Be=/[\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 Ae(e){return e.charCodeAt(0)>=768&&Be.test(e)}function Se(e,t,n){for(;(n<0?t>0:t<e.length)&&Ae(e.charAt(t));)t+=n;return t}function $e(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,T=r<0?Math.ceil(i):Math.floor(i);if(T==t)return e(T)?t:n;e(T)?n=T:t=T+r}}function qe(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,T=0;T<e.length;++T){var U=e[T];(U.from<n&&U.to>t||t==n&&U.to==t)&&(r(Math.max(U.from,t),Math.min(U.to,n),U.level==1?"rtl":"ltr",T),i=!0)}i||r(t,n,"ltr")}var Je=null;function Xe(e,t,n){var r;Je=null;for(var i=0;i<e.length;++i){var T=e[i];if(T.from<t&&T.to>t)return i;T.to==t&&(T.from!=T.to&&n=="before"?r=i:Je=i),T.from==t&&(T.from!=T.to&&n!="before"?r=i:Je=i)}return r!=null?r:Je}var ot=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(X){return X<=247?e.charAt(X):1424<=X&&X<=1524?"R":1536<=X&&X<=1785?t.charAt(X-1536):1774<=X&&X<=2220?"r":8192<=X&&X<=8203?"w":X==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,T=/[LRr]/,U=/[Lb1n]/,H=/[1n]/;function G(X,ie,se){this.level=X,this.from=ie,this.to=se}return function(X,ie){var se=ie=="ltr"?"L":"R";if(X.length==0||ie=="ltr"&&!r.test(X))return!1;for(var ve=X.length,he=[],we=0;we<ve;++we)he.push(n(X.charCodeAt(we)));for(var ke=0,je=se;ke<ve;++ke){var Ge=he[ke];Ge=="m"?he[ke]=je:je=Ge}for(var it=0,Ve=se;it<ve;++it){var lt=he[it];lt=="1"&&Ve=="r"?he[it]="n":T.test(lt)&&(Ve=lt,lt=="r"&&(he[it]="R"))}for(var Lt=1,bt=he[0];Lt<ve-1;++Lt){var Ht=he[Lt];Ht=="+"&&bt=="1"&&he[Lt+1]=="1"?he[Lt]="1":Ht==","&&bt==he[Lt+1]&&(bt=="1"||bt=="n")&&(he[Lt]=bt),bt=Ht}for(var dr=0;dr<ve;++dr){var Ur=he[dr];if(Ur==",")he[dr]="N";else if(Ur=="%"){var Tr=void 0;for(Tr=dr+1;Tr<ve&&he[Tr]=="%";++Tr);for(var tn=dr&&he[dr-1]=="!"||Tr<ve&&he[Tr]=="1"?"1":"N",Qr=dr;Qr<Tr;++Qr)he[Qr]=tn;dr=Tr-1}}for(var Lr=0,Zr=se;Lr<ve;++Lr){var jr=he[Lr];Zr=="L"&&jr=="1"?he[Lr]="L":T.test(jr)&&(Zr=jr)}for(var Pr=0;Pr<ve;++Pr)if(i.test(he[Pr])){var Dr=void 0;for(Dr=Pr+1;Dr<ve&&i.test(he[Dr]);++Dr);for(var Sr=(Pr?he[Pr-1]:se)=="L",qr=(Dr<ve?he[Dr]:se)=="L",oi=Sr==qr?Sr?"L":"R":se,Dn=Pr;Dn<Dr;++Dn)he[Dn]=oi;Pr=Dr-1}for(var zr=[],vn,Nr=0;Nr<ve;)if(U.test(he[Nr])){var Ba=Nr;for(++Nr;Nr<ve&&U.test(he[Nr]);++Nr);zr.push(new G(0,Ba,Nr))}else{var En=Nr,Bn=zr.length,jn=ie=="rtl"?1:0;for(++Nr;Nr<ve&&he[Nr]!="L";++Nr);for(var Xr=En;Xr<Nr;)if(H.test(he[Xr])){En<Xr&&(zr.splice(Bn,0,new G(1,En,Xr)),Bn+=jn);var si=Xr;for(++Xr;Xr<Nr&&H.test(he[Xr]);++Xr);zr.splice(Bn,0,new G(2,si,Xr)),Bn+=jn,En=Xr}else++Xr;En<Nr&&zr.splice(Bn,0,new G(1,En,Nr))}return ie=="ltr"&&(zr[0].level==1&&(vn=X.match(/^\s+/))&&(zr[0].from=vn[0].length,zr.unshift(new G(0,0,vn[0].length))),ye(zr).level==1&&(vn=X.match(/\s+$/))&&(ye(zr).to-=vn[0].length,zr.push(new G(0,ve-vn[0].length,ve)))),ie=="rtl"?zr.reverse():zr}}();function Qe(e,t){var n=e.order;return n==null&&(n=e.order=ot(e.text,t)),n}var Ye=[],Ee=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]||Ye).concat(n)}};function nt(e,t){return e._handlers&&e._handlers[t]||Ye}function Ze(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var T=Q(i,n);T>-1&&(r[t]=i.slice(0,T).concat(i.slice(T+1)))}}}function xe(e,t){var n=nt(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Ne(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),xe(e,n||t.type,e,t),q(t)||t.codemirrorIgnore}function ne(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)Q(n,t[r])==-1&&n.push(t[r])}function oe(e,t){return nt(e,t).length>0}function ae(e){e.prototype.on=function(t,n){Ee(this,t,n)},e.prototype.off=function(t,n){Ze(this,t,n)}}function $(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function J(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function q(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function te(e){$(e),J(e)}function me(e){return e.target||e.srcElement}function be(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 Pe=function(){if(j&&k<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),gt;function Ft(e){if(gt==null){var t=a("span","\u200B");l(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(gt=t.offsetWidth<=1&&t.offsetHeight>2&&!(j&&k<8))}var n=gt?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var St;function pr(e){if(St!=null)return St;var t=l(e,document.createTextNode("A\u062EA")),n=o(t,0,1).getBoundingClientRect(),r=o(t,1,2).getBoundingClientRect();return c(e),!n||n.left==n.right?!1:St=r.right-n.right<3}var et=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
|
|
`,t);i==-1&&(i=e.length);var T=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),U=T.indexOf("\r");U!=-1?(n.push(T.slice(0,U)),t+=U+1):(n.push(T),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},De=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Ct=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),vt=null;function ir(e){if(vt!=null)return vt;var t=l(e,a("span","x")),n=t.getBoundingClientRect(),r=o(t,0,1).getBoundingClientRect();return vt=Math.abs(n.left-r.left)>1}var $t={},ut={};function ze(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),$t[e]=t}function Fr(e,t){ut[e]=t}function Te(e){if(typeof e=="string"&&ut.hasOwnProperty(e))e=ut[e];else if(e&&typeof e.name=="string"&&ut.hasOwnProperty(e.name)){var t=ut[e.name];typeof t=="string"&&(t={name:t}),e=Oe(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Te("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Te("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function gr(e,t){t=Te(t);var n=$t[t.name];if(!n)return gr(e,"text/plain");var r=n(e,t);if(Jt.hasOwnProperty(t.name)){var i=Jt[t.name];for(var T in i){if(!i.hasOwnProperty(T))continue;r.hasOwnProperty(T)&&(r["_"+T]=r[T]),r[T]=i[T]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var U in t.modeProps)r[U]=t.modeProps[U];return r}var Jt={};function cr(e,t){var n=Jt.hasOwnProperty(e)?Jt[e]:Jt[e]={};I(t,n)}function Et(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 Vt(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 sr(e,t,n){return e.startState?e.startState(t,n):!0}var Dt=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};Dt.prototype.eol=function(){return this.pos>=this.string.length},Dt.prototype.sol=function(){return this.pos==this.lineStart},Dt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Dt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Dt.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},Dt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Dt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Dt.prototype.skipToEnd=function(){this.pos=this.string.length},Dt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Dt.prototype.backUp=function(e){this.pos-=e},Dt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=B(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?B(this.string,this.lineStart,this.tabSize):0)},Dt.prototype.indentation=function(){return B(this.string,null,this.tabSize)-(this.lineStart?B(this.string,this.lineStart,this.tabSize):0)},Dt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(U){return n?U.toLowerCase():U},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var T=this.string.slice(this.pos).match(e);return T&&T.index>0?null:(T&&t!==!1&&(this.pos+=T[0].length),T)}},Dt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Dt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Dt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Dt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Ke(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],T=i.chunkSize();if(t<T){n=i;break}t-=T}return n.lines[t]}function ar(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(T){var U=T.text;i==n.line&&(U=U.slice(0,n.ch)),i==t.line&&(U=U.slice(t.ch)),r.push(U),++i}),r}function Qt(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function Mt(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function ct(e){if(e.parent==null)return null;for(var t=e.parent,n=Q(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 yt(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],T=i.height;if(t<T){e=i;continue e}t-=T,n+=i.chunkSize()}return n}while(!e.lines);for(var U=0;U<e.lines.length;++U){var H=e.lines[U],G=H.height;if(t<G)break;t-=G}return n+U}function Xt(e,t){return t>=e.first&&t<e.first+e.size}function Yt(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function _e(e,t,n){if(n===void 0&&(n=null),!(this instanceof _e))return new _e(e,t,n);this.line=e,this.ch=t,this.sticky=n}function tt(e,t){return e.line-t.line||e.ch-t.ch}function Ie(e,t){return e.sticky==t.sticky&&tt(e,t)==0}function vr(e){return _e(e.line,e.ch)}function yr(e,t){return tt(e,t)<0?t:e}function rr(e,t){return tt(e,t)<0?e:t}function fr(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function st(e,t){if(t.line<e.first)return _e(e.first,0);var n=e.first+e.size-1;return t.line>n?_e(n,Ke(e,n).text.length):hr(t,Ke(e,t.line).text.length)}function hr(e,t){var n=e.ch;return n==null||n>t?_e(e.line,t):n<0?_e(e.line,0):e}function Bt(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=st(e,t[r]);return n}var Tt=function(e,t){this.state=e,this.lookAhead=t},Kt=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};Kt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Kt.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}},Kt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Kt.fromSaved=function(e,t,n){return t instanceof Tt?new Kt(e,Et(e.mode,t.state),n,t.lookAhead):new Kt(e,Et(e.mode,t),n)},Kt.prototype.save=function(e){var t=e!==!1?Et(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Tt(t,this.maxLookAhead):t};function jt(e,t,n,r){var i=[e.state.modeGen],T={};wr(e,t.text,e.doc.mode,n,function(X,ie){return i.push(X,ie)},T,r);for(var U=n.state,H=function(X){n.baseTokens=i;var ie=e.state.overlays[X],se=1,ve=0;n.state=!0,wr(e,t.text,ie.mode,n,function(he,we){for(var ke=se;ve<he;){var je=i[se];je>he&&i.splice(se,1,he,i[se+1],je),se+=2,ve=Math.min(he,je)}if(!we)return;if(ie.opaque)i.splice(ke,se-ke,he,"overlay "+we),se=ke+2;else for(;ke<se;ke+=2){var Ge=i[ke+1];i[ke+1]=(Ge?Ge+" ":"")+"overlay "+we}},T),n.state=U,n.baseTokens=null,n.baseTokenPos=1},G=0;G<e.state.overlays.length;++G)H(G);return{styles:i,classes:T.bgClass||T.textClass?T:null}}function Ot(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=pt(e,ct(t)),i=t.text.length>e.options.maxHighlightLength&&Et(e.doc.mode,r.state),T=jt(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=T.styles,T.classes?t.styleClasses=T.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function pt(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new Kt(r,!0,t);var T=At(e,t,n),U=T>r.first&&Ke(r,T-1).stateAfter,H=U?Kt.fromSaved(r,U,T):new Kt(r,sr(r.mode),T);return r.iter(T,t,function(G){mr(e,G.text,H);var X=H.line;G.stateAfter=X==t-1||X%5==0||X>=i.viewFrom&&X<i.viewTo?H.save():null,H.nextLine()}),n&&(r.modeFrontier=H.line),H}function mr(e,t,n,r){var i=e.doc.mode,T=new Dt(t,e.options.tabSize,n);for(T.start=T.pos=r||0,t==""&&mt(i,n.state);!T.eol();)xt(i,T,n.state),T.start=T.pos}function mt(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Vt(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function xt(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Vt(e,n).mode);var T=e.token(t,n);if(t.pos>t.start)return T}throw new Error("Mode "+e.name+" failed to advance stream.")}var He=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function wt(e,t,n,r){var i=e.doc,T=i.mode,U;t=st(i,t);var H=Ke(i,t.line),G=pt(e,t.line,n),X=new Dt(H.text,e.options.tabSize,G),ie;for(r&&(ie=[]);(r||X.pos<t.ch)&&!X.eol();)X.start=X.pos,U=xt(T,X,G.state),r&&ie.push(new He(X,U,Et(i.mode,G.state)));return r?ie:new He(X,U,G.state)}function ht(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 wr(e,t,n,r,i,T,U){var H=n.flattenSpans;H==null&&(H=e.options.flattenSpans);var G=0,X=null,ie=new Dt(t,e.options.tabSize,r),se,ve=e.options.addModeClass&&[null];for(t==""&&ht(mt(n,r.state),T);!ie.eol();){if(ie.pos>e.options.maxHighlightLength?(H=!1,U&&mr(e,t,r,ie.pos),ie.pos=t.length,se=null):se=ht(xt(n,ie,r.state,ve),T),ve){var he=ve[0].name;he&&(se="m-"+(se?he+" "+se:he))}if(!H||X!=se){for(;G<ie.start;)G=Math.min(ie.start,G+5e3),i(G,X);X=se}ie.start=ie.pos}for(;G<ie.pos;){var we=Math.min(ie.pos,G+5e3);i(we,X),G=we}}function At(e,t,n){for(var r,i,T=e.doc,U=n?-1:t-(e.doc.mode.innerMode?1e3:100),H=t;H>U;--H){if(H<=T.first)return T.first;var G=Ke(T,H-1),X=G.stateAfter;if(X&&(!n||H+(X instanceof Tt?X.lookAhead:0)<=T.modeFrontier))return H;var ie=B(G.text,null,e.options.tabSize);(i==null||r>ie)&&(i=H-1,r=ie)}return i}function It(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=Ke(e,r).stateAfter;if(i&&(!(i instanceof Tt)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var lr=!1,Rr=!1;function Or(){lr=!0}function zt(){Rr=!0}function dt(e,t,n){this.marker=e,this.from=t,this.to=n}function at(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Pt(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Wt(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Gt(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var T=e[i],U=T.marker,H=T.from==null||(U.inclusiveLeft?T.from<=t:T.from<t);if(H||T.from==t&&U.type=="bookmark"&&(!n||!T.marker.insertLeft)){var G=T.to==null||(U.inclusiveRight?T.to>=t:T.to>t);(r||(r=[])).push(new dt(U,T.from,G?null:T.to))}}return r}function _t(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var T=e[i],U=T.marker,H=T.to==null||(U.inclusiveRight?T.to>=t:T.to>t);if(H||T.from==t&&U.type=="bookmark"&&(!n||T.marker.insertLeft)){var G=T.from==null||(U.inclusiveLeft?T.from<=t:T.from<t);(r||(r=[])).push(new dt(U,G?null:T.from-t,T.to==null?null:T.to-t))}}return r}function Wr(e,t){if(t.full)return null;var n=Xt(e,t.from.line)&&Ke(e,t.from.line).markedSpans,r=Xt(e,t.to.line)&&Ke(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,T=t.to.ch,U=tt(t.from,t.to)==0,H=Gt(n,i,U),G=_t(r,T,U),X=t.text.length==1,ie=ye(t.text).length+(X?i:0);if(H)for(var se=0;se<H.length;++se){var ve=H[se];if(ve.to==null){var he=at(G,ve.marker);he?X&&(ve.to=he.to==null?null:he.to+ie):ve.to=i}}if(G)for(var we=0;we<G.length;++we){var ke=G[we];if(ke.to!=null&&(ke.to+=ie),ke.from==null){var je=at(H,ke.marker);je||(ke.from=ie,X&&(H||(H=[])).push(ke))}else ke.from+=ie,X&&(H||(H=[])).push(ke)}H&&(H=Hr(H)),G&&G!=H&&(G=Hr(G));var Ge=[H];if(!X){var it=t.text.length-2,Ve;if(it>0&&H)for(var lt=0;lt<H.length;++lt)H[lt].to==null&&(Ve||(Ve=[])).push(new dt(H[lt].marker,null,null));for(var Lt=0;Lt<it;++Lt)Ge.push(Ve);Ge.push(G)}return Ge}function Hr(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 ln(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(he){if(he.markedSpans)for(var we=0;we<he.markedSpans.length;++we){var ke=he.markedSpans[we].marker;ke.readOnly&&(!r||Q(r,ke)==-1)&&(r||(r=[])).push(ke)}}),!r)return null;for(var i=[{from:t,to:n}],T=0;T<r.length;++T)for(var U=r[T],H=U.find(0),G=0;G<i.length;++G){var X=i[G];if(tt(X.to,H.from)<0||tt(X.from,H.to)>0)continue;var ie=[G,1],se=tt(X.from,H.from),ve=tt(X.to,H.to);(se<0||!U.inclusiveLeft&&!se)&&ie.push({from:X.from,to:H.from}),(ve>0||!U.inclusiveRight&&!ve)&&ie.push({from:H.to,to:X.to}),i.splice.apply(i,ie),G+=ie.length-3}return i}function un(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function xn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function on(e){return e.inclusiveLeft?-1:0}function dn(e){return e.inclusiveRight?1:0}function sn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),T=tt(r.from,i.from)||on(e)-on(t);if(T)return-T;var U=tt(r.to,i.to)||dn(e)-dn(t);return U||t.id-e.id}function Wn(e,t){var n=Rr&&e.markedSpans,r;if(n)for(var i=void 0,T=0;T<n.length;++T)i=n[T],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||sn(r,i.marker)<0)&&(r=i.marker);return r}function Hn(e){return Wn(e,!0)}function mn(e){return Wn(e,!1)}function ki(e,t){var n=Rr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var T=n[i];T.marker.collapsed&&(T.from==null||T.from<t)&&(T.to==null||T.to>t)&&(!r||sn(r,T.marker)<0)&&(r=T.marker)}return r}function Kn(e,t,n,r,i){var T=Ke(e,t),U=Rr&&T.markedSpans;if(U)for(var H=0;H<U.length;++H){var G=U[H];if(!G.marker.collapsed)continue;var X=G.marker.find(0),ie=tt(X.from,n)||on(G.marker)-on(i),se=tt(X.to,r)||dn(G.marker)-dn(i);if(ie>=0&&se<=0||ie<=0&&se>=0)continue;if(ie<=0&&(G.marker.inclusiveRight&&i.inclusiveLeft?tt(X.to,n)>=0:tt(X.to,n)>0)||ie>=0&&(G.marker.inclusiveRight&&i.inclusiveLeft?tt(X.from,r)<=0:tt(X.from,r)<0))return!0}}function ft(e){for(var t;t=Hn(e);)e=t.find(-1,!0).line;return e}function kt(e){for(var t;t=mn(e);)e=t.find(1,!0).line;return e}function Ut(e){for(var t,n;t=mn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Zt(e,t){var n=Ke(e,t),r=ft(n);return n==r?t:ct(r)}function qt(e,t){if(t>e.lastLine())return t;var n=Ke(e,t),r;if(!or(e,n))return t;for(;r=mn(n);)n=r.find(1,!0).line;return ct(n)+1}function or(e,t){var n=Rr&&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&&xr(e,t,r))return!0}}function xr(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return xr(e,r.line,at(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,T=0;T<t.markedSpans.length;++T)if(i=t.markedSpans[T],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&xr(e,t,i))return!0}function er(e){e=ft(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var T=n.parent;T;n=T,T=n.parent)for(var U=0;U<T.children.length;++U){var H=T.children[U];if(H==n)break;t+=H.height}return t}function kr(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Hn(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=mn(r);){var T=n.find(0,!0);t-=r.text.length-T.from.ch,r=T.to.line,t+=r.text.length-T.to.ch}return t}function rn(e){var t=e.display,n=e.doc;t.maxLine=Ke(n,n.first),t.maxLineLength=kr(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=kr(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var ur=function(e,t,n){this.text=e,xn(this,t),this.height=n?n(this):1};ur.prototype.lineNo=function(){return ct(this)},ae(ur);function _r(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),un(e),xn(e,n);var i=r?r(e):1;i!=e.height&&Mt(e,i)}function Nt(e){e.parent=null,un(e)}var br={},Ar={};function Gr(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Ar:br;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function $r(e,t){var n=f("span",null,null,C?"padding-right: .1px":null),r={pre:f("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var T=i?t.rest[i-1]:t.line,U=void 0;r.pos=0,r.addToken=ws,pr(e.display.measure)&&(U=Qe(T,e.doc.direction))&&(r.addToken=As(r.addToken,U)),r.map=[];var H=t!=e.display.externalMeasured&&ct(T);Ls(T,r,Ot(e,T,H)),T.styleClasses&&(T.styleClasses.bgClass&&(r.bgClass=W(T.styleClasses.bgClass,r.bgClass||"")),T.styleClasses.textClass&&(r.textClass=W(T.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Ft(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(C){var G=r.content.lastChild;(/\bcm-tab\b/.test(G.className)||G.querySelector&&G.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return xe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=W(r.pre.className,r.textClass||"")),r}function Rn(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ws(e,t,n,r,i,T,U){if(!t)return;var H=e.splitSpaces?Cs(t,e.trailingSpace):t,G=e.cm.state.specialChars,X=!1,ie;if(!G.test(t))e.col+=t.length,ie=document.createTextNode(H),e.map.push(e.pos,e.pos+t.length,ie),j&&k<9&&(X=!0),e.pos+=t.length;else{ie=document.createDocumentFragment();for(var se=0;;){G.lastIndex=se;var ve=G.exec(t),he=ve?ve.index-se:t.length-se;if(he){var we=document.createTextNode(H.slice(se,se+he));j&&k<9?ie.appendChild(a("span",[we])):ie.appendChild(we),e.map.push(e.pos,e.pos+he,we),e.col+=he,e.pos+=he}if(!ve)break;se+=he+1;var ke=void 0;if(ve[0]==" "){var je=e.cm.options.tabSize,Ge=je-e.col%je;ke=ie.appendChild(a("span",de(Ge),"cm-tab")),ke.setAttribute("role","presentation"),ke.setAttribute("cm-text"," "),e.col+=Ge}else ve[0]=="\r"||ve[0]==`
|
|
`?(ke=ie.appendChild(a("span",ve[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),ke.setAttribute("cm-text",ve[0]),e.col+=1):(ke=e.cm.options.specialCharPlaceholder(ve[0]),ke.setAttribute("cm-text",ve[0]),j&&k<9?ie.appendChild(a("span",[ke])):ie.appendChild(ke),e.col+=1);e.map.push(e.pos,e.pos+1,ke),e.pos++}}if(e.trailingSpace=H.charCodeAt(t.length-1)==32,n||r||i||X||T||U){var it=n||"";r&&(it+=r),i&&(it+=i);var Ve=a("span",[ie],it,T);if(U)for(var lt in U)U.hasOwnProperty(lt)&<!="style"&<!="class"&&Ve.setAttribute(lt,U[lt]);return e.content.appendChild(Ve)}e.content.appendChild(ie)}function Cs(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var T=e.charAt(i);T==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(T="\xA0"),r+=T,n=T==" "}return r}function As(e,t){return function(n,r,i,T,U,H,G){i=i?i+" cm-force-border":"cm-force-border";for(var X=n.pos,ie=X+r.length;;){for(var se=void 0,ve=0;ve<t.length&&!(se=t[ve],se.to>X&&se.from<=X);ve++);if(se.to>=ie)return e(n,r,i,T,U,H,G);e(n,r.slice(0,se.to-X),i,T,null,H,G),T=null,r=r.slice(se.to-X),X=se.to}}}function Wa(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Ls(e,t,n){var r=e.markedSpans,i=e.text,T=0;if(!r){for(var U=1;U<n.length;U+=2)t.addToken(t,i.slice(T,T=n[U]),Gr(n[U+1],t.cm.options));return}for(var H=i.length,G=0,X=1,ie="",se,ve,he=0,we,ke,je,Ge,it;;){if(he==G){we=ke=je=ve="",it=null,Ge=null,he=Infinity;for(var Ve=[],lt=void 0,Lt=0;Lt<r.length;++Lt){var bt=r[Lt],Ht=bt.marker;if(Ht.type=="bookmark"&&bt.from==G&&Ht.widgetNode)Ve.push(Ht);else if(bt.from<=G&&(bt.to==null||bt.to>G||Ht.collapsed&&bt.to==G&&bt.from==G)){if(bt.to!=null&&bt.to!=G&&he>bt.to&&(he=bt.to,ke=""),Ht.className&&(we+=" "+Ht.className),Ht.css&&(ve=(ve?ve+";":"")+Ht.css),Ht.startStyle&&bt.from==G&&(je+=" "+Ht.startStyle),Ht.endStyle&&bt.to==he&&(lt||(lt=[])).push(Ht.endStyle,bt.to),Ht.title&&((it||(it={})).title=Ht.title),Ht.attributes)for(var dr in Ht.attributes)(it||(it={}))[dr]=Ht.attributes[dr];Ht.collapsed&&(!Ge||sn(Ge.marker,Ht)<0)&&(Ge=bt)}else bt.from>G&&he>bt.from&&(he=bt.from)}if(lt)for(var Ur=0;Ur<lt.length;Ur+=2)lt[Ur+1]==he&&(ke+=" "+lt[Ur]);if(!Ge||Ge.from==G)for(var Tr=0;Tr<Ve.length;++Tr)Wa(t,0,Ve[Tr]);if(Ge&&(Ge.from||0)==G){if(Wa(t,(Ge.to==null?H+1:Ge.to)-G,Ge.marker,Ge.from==null),Ge.to==null)return;Ge.to==G&&(Ge=!1)}}if(G>=H)break;for(var tn=Math.min(H,he);;){if(ie){var Qr=G+ie.length;if(!Ge){var Lr=Qr>tn?ie.slice(0,tn-G):ie;t.addToken(t,Lr,se?se+we:we,je,G+Lr.length==he?ke:"",ve,it)}if(Qr>=tn){ie=ie.slice(tn-G),G=tn;break}G=Qr,je=""}ie=i.slice(T,T=n[X++]),se=Gr(n[X++],t.cm.options)}}}function Ha(e,t,n){this.line=t,this.rest=Ut(t),this.size=this.rest?ct(ye(this.rest))-n+1:1,this.node=this.text=null,this.hidden=or(e,t)}function Mi(e,t,n){for(var r=[],i,T=t;T<n;T=i){var U=new Ha(e.doc,Ke(e.doc,T),T);i=T+U.size,r.push(U)}return r}var zn=null;function Ds(e){zn?zn.ops.push(e):e.ownsGroup=zn={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{zn=null,t(n)}}var li=null;function Br(e,t){var n=nt(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;zn?i=zn.delayedCallbacks:li?i=li:(i=li=[],setTimeout(Ps,0));for(var T=function(H){i.push(function(){return n[H].apply(null,r)})},U=0;U<n.length;++U)T(U)}function Ps(){var e=li;li=null;for(var t=0;t<e.length;++t)e[t]()}function Ka(e,t,n,r){for(var i=0;i<t.changes.length;i++){var T=t.changes[i];T=="text"?Ms(e,t):T=="gutter"?Ga(e,t,n,r):T=="class"?na(e,t):T=="widget"&&Is(e,t,r)}t.changes=null}function ui(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),j&&k<8&&(e.node.style.zIndex=2)),e.node}function ks(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=ui(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function za(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):$r(e,t)}function Ms(e,t){var n=t.text.className,r=za(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,na(e,t)):n&&(t.text.className=n)}function na(e,t){ks(e,t),t.line.wrapClass?ui(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Ga(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=ui(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var T=t.line.gutterMarkers;if(e.options.lineNumbers||T){var U=ui(t),H=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(H),U.insertBefore(H,t.text),t.line.gutterClass&&(H.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!T||!T["CodeMirror-linenumbers"])&&(t.lineNumber=H.appendChild(a("div",Yt(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),T)for(var G=0;G<e.display.gutterSpecs.length;++G){var X=e.display.gutterSpecs[G].className,ie=T.hasOwnProperty(X)&&T[X];ie&&H.appendChild(a("div",[ie],"CodeMirror-gutter-elt","left: "+r.gutterLeft[X]+"px; width: "+r.gutterWidth[X]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=y("CodeMirror-linewidget"),i=t.node.firstChild,T=void 0;i;i=T)T=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Va(e,t,n)}function Us(e,t,n,r){var i=za(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),na(e,t),Ga(e,t,n,r),Va(e,t,r),t.node}function Va(e,t,n){if(Xa(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Xa(e,t.rest[r],t,n,!1)}function Xa(e,t,n,r,i){if(!t.widgets)return;for(var T=ui(n),U=0,H=t.widgets;U<H.length;++U){var G=H[U],X=a("div",[G.node],"CodeMirror-linewidget"+(G.className?" "+G.className:""));G.handleMouseEvents||X.setAttribute("cm-ignore-events","true"),Ns(G,X,n,r),e.display.input.setUneditable(X),i&&G.above?T.insertBefore(X,n.gutter||n.text):T.appendChild(X),Br(G,"redraw")}}function Ns(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 di(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;"),l(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function yn(e,t){for(var n=me(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 Ii(e){return e.lineSpace.offsetTop}function ia(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function $a(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=l(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function pn(e){return ee-e.display.nativeBarWidth}function On(e){return e.display.scroller.clientWidth-pn(e)-e.display.barWidth}function aa(e){return e.display.scroller.clientHeight-pn(e)-e.display.barHeight}function Fs(e,t,n){var r=e.options.lineWrapping,i=r&&On(e);if(!t.measure.heights||r&&t.measure.width!=i){var T=t.measure.heights=[];if(r){t.measure.width=i;for(var U=t.text.firstChild.getClientRects(),H=0;H<U.length-1;H++){var G=U[H],X=U[H+1];Math.abs(G.bottom-X.bottom)>2&&T.push((G.bottom+X.top)/2-n.top)}}T.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(ct(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=ft(t);var n=ct(t),r=e.display.externalMeasured=new Ha(e.doc,t,n);r.lineN=n;var i=r.built=$r(e,r);return r.text=i.pre,l(e.display.lineMeasure,i.pre),r}function Ja(e,t,n,r){return gn(e,Gn(e,t),n,r)}function oa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Mn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Gn(e,t){var n=ct(t),r=oa(e,n);r&&!r.text?r=null:r&&r.changes&&(Ka(e,r,n,fa(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 gn(e,t,n,r,i){t.before&&(n=-1);var T=n+(r||""),U;return t.cache.hasOwnProperty(T)?U=t.cache[T]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fs(e,t.view,t.rect),t.hasHeights=!0),U=Ws(e,t,n,r),U.bogus||(t.cache[T]=U)),{left:U.left,right:U.right,top:i?U.rtop:U.top,bottom:i?U.rbottom:U.bottom}}var Qa={left:0,right:0,top:0,bottom:0};function Za(e,t,n){for(var r,i,T,U,H,G,X=0;X<e.length;X+=3)if(H=e[X],G=e[X+1],t<H?(i=0,T=1,U="left"):t<G?(i=t-H,T=i+1):(X==e.length-3||t==G&&e[X+3]>t)&&(T=G-H,i=T-1,t>=G&&(U="right")),i!=null){if(r=e[X+2],H==G&&n==(r.insertLeft?"left":"right")&&(U=n),n=="left"&&i==0)for(;X&&e[X-2]==e[X-3]&&e[X-1].insertLeft;)r=e[(X-=3)+2],U="left";if(n=="right"&&i==G-H)for(;X<e.length-3&&e[X+3]==e[X+4]&&!e[X+5].insertLeft;)r=e[(X+=3)+2],U="right";break}return{node:r,start:i,end:T,collapse:U,coverStart:H,coverEnd:G}}function js(e,t){var n=Qa;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=Za(t.map,n,r),T=i.node,U=i.start,H=i.end,G=i.collapse,X;if(T.nodeType==3){for(var ie=0;ie<4;ie++){for(;U&&Ae(t.line.text.charAt(i.coverStart+U));)--U;for(;i.coverStart+H<i.coverEnd&&Ae(t.line.text.charAt(i.coverStart+H));)++H;if(j&&k<9&&U==0&&H==i.coverEnd-i.coverStart?X=T.parentNode.getBoundingClientRect():X=js(o(T,U,H).getClientRects(),r),X.left||X.right||U==0)break;H=U,U=U-1,G="right"}j&&k<11&&(X=Hs(e.display.measure,X))}else{U>0&&(G=r="right");var se;e.options.lineWrapping&&(se=T.getClientRects()).length>1?X=se[r=="right"?se.length-1:0]:X=T.getBoundingClientRect()}if(j&&k<9&&!U&&(!X||!X.left&&!X.right)){var ve=T.parentNode.getClientRects()[0];ve?X={left:ve.left,right:ve.left+Xn(e.display),top:ve.top,bottom:ve.bottom}:X=Qa}for(var he=X.top-t.rect.top,we=X.bottom-t.rect.top,ke=(he+we)/2,je=t.view.measure.heights,Ge=0;Ge<je.length-1&&!(ke<je[Ge]);Ge++);var it=Ge?je[Ge-1]:0,Ve=je[Ge],lt={left:(G=="right"?X.right:X.left)-t.rect.left,right:(G=="left"?X.left:X.right)-t.rect.left,top:it,bottom:Ve};return!X.left&&!X.right&&(lt.bogus=!0),e.options.singleCursorHeightPerLine||(lt.rtop=he,lt.rbottom=we),lt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!ir(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function qa(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function eo(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)qa(e.display.view[t])}function ci(e){eo(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function to(){return x&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ro(){return x&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function sa(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=di(e.widgets[n]));return t}function Ui(e,t,n,r,i){if(!i){var T=sa(t);n.top+=T,n.bottom+=T}if(r=="line")return n;r||(r="local");var U=er(t);if(r=="local"?U+=Ii(e.display):U-=e.display.viewOffset,r=="page"||r=="window"){var H=e.display.lineSpace.getBoundingClientRect();U+=H.top+(r=="window"?0:ro());var G=H.left+(r=="window"?0:to());n.left+=G,n.right+=G}return n.top+=U,n.bottom+=U,n}function no(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=to(),i-=ro();else if(n=="local"||!n){var T=e.display.sizer.getBoundingClientRect();r+=T.left,i+=T.top}var U=e.display.lineSpace.getBoundingClientRect();return{left:r-U.left,top:i-U.top}}function la(e,t,n,r,i){return r||(r=Ke(e.doc,t.line)),Ui(e,r,Ja(e,r,t.ch,i),n)}function cn(e,t,n,r,i,T){r=r||Ke(e.doc,t.line),i||(i=Gn(e,r));function U(we,ke){var je=gn(e,i,we,ke?"right":"left",T);return ke?je.left=je.right:je.right=je.left,Ui(e,r,je,n)}var H=Qe(r,e.doc.direction),G=t.ch,X=t.sticky;if(G>=r.text.length?(G=r.text.length,X="before"):G<=0&&(G=0,X="after"),!H)return U(X=="before"?G-1:G,X=="before");function ie(we,ke,je){var Ge=H[ke],it=Ge.level==1;return U(je?we-1:we,it!=je)}var se=Xe(H,G,X),ve=Je,he=ie(G,se,X=="before");return ve!=null&&(he.other=ie(G,ve,X!="before")),he}function io(e,t){var n=0;t=st(e.doc,t),e.options.lineWrapping||(n=Xn(e.display)*t.ch);var r=Ke(e.doc,t.line),i=er(r)+Ii(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function ua(e,t,n,r,i){var T=_e(e,t,n);return T.xRel=i,r&&(T.outside=r),T}function da(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return ua(r.first,0,null,-1,-1);var i=yt(r,n),T=r.first+r.size-1;if(i>T)return ua(r.first+r.size-1,Ke(r,T).text.length,null,1,1);t<0&&(t=0);for(var U=Ke(r,i);;){var H=Ks(e,U,i,t,n),G=ki(U,H.ch+(H.xRel>0||H.outside>0?1:0));if(!G)return H;var X=G.find(1);if(X.line==i)return X;U=Ke(r,i=X.line)}}function ao(e,t,n,r){r-=sa(t);var i=t.text.length,T=$e(function(U){return gn(e,n,U-1).bottom<=r},i,0);return i=$e(function(U){return gn(e,n,U).top>r},T,i),{begin:T,end:i}}function oo(e,t,n,r){n||(n=Gn(e,t));var i=Ui(e,t,gn(e,n,r),"line").top;return ao(e,t,n,i)}function ca(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-=er(t);var T=Gn(e,t),U=sa(t),H=0,G=t.text.length,X=!0,ie=Qe(t,e.doc.direction);if(ie){var se=(e.options.lineWrapping?Gs:zs)(e,t,n,T,ie,r,i);X=se.level!=1,H=X?se.from:se.to-1,G=X?se.to:se.from-1}var ve=null,he=null,we=$e(function(Lt){var bt=gn(e,T,Lt);return bt.top+=U,bt.bottom+=U,ca(bt,r,i,!1)?(bt.top<=i&&bt.left<=r&&(ve=Lt,he=bt),!0):!1},H,G),ke,je,Ge=!1;if(he){var it=r-he.left<he.right-r,Ve=it==X;we=ve+(Ve?0:1),je=Ve?"after":"before",ke=it?he.left:he.right}else{!X&&(we==G||we==H)&&we++,je=we==0?"after":we==t.text.length?"before":gn(e,T,we-(X?1:0)).bottom+U<=i==X?"after":"before";var lt=cn(e,_e(n,we,je),"line",t,T);ke=lt.left,Ge=i<lt.top?-1:i>=lt.bottom?1:0}return we=Se(t.text,we,1),ua(n,we,je,Ge,r-ke)}function zs(e,t,n,r,i,T,U){var H=$e(function(se){var ve=i[se],he=ve.level!=1;return ca(cn(e,_e(n,he?ve.to:ve.from,he?"before":"after"),"line",t,r),T,U,!0)},0,i.length-1),G=i[H];if(H>0){var X=G.level!=1,ie=cn(e,_e(n,X?G.from:G.to,X?"after":"before"),"line",t,r);ca(ie,T,U,!0)&&ie.top>U&&(G=i[H-1])}return G}function Gs(e,t,n,r,i,T,U){var H=ao(e,t,r,U),G=H.begin,X=H.end;/\s/.test(t.text.charAt(X-1))&&X--;for(var ie=null,se=null,ve=0;ve<i.length;ve++){var he=i[ve];if(he.from>=X||he.to<=G)continue;var we=he.level!=1,ke=gn(e,r,we?Math.min(X,he.to)-1:Math.max(G,he.from)).right,je=ke<T?T-ke+1e9:ke-T;(!ie||se>je)&&(ie=he,se=je)}return ie||(ie=i[i.length-1]),ie.from<G&&(ie={from:G,to:ie.to,level:ie.level}),ie.to>X&&(ie={from:ie.from,to:X,level:ie.level}),ie}var Pn;function Vn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Pn==null){Pn=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Pn.appendChild(document.createTextNode("x")),Pn.appendChild(a("br"));Pn.appendChild(document.createTextNode("x"))}l(e.measure,Pn);var n=Pn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),c(e.measure),n||1}function Xn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");l(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function fa(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,T=t.gutters.firstChild,U=0;T;T=T.nextSibling,++U){var H=e.display.gutterSpecs[U].className;n[H]=T.offsetLeft+T.clientLeft+i,r[H]=T.clientWidth}return{fixedPos:ha(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function ha(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function so(e){var t=Vn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Xn(e.display)-3);return function(i){if(or(e.doc,i))return 0;var T=0;if(i.widgets)for(var U=0;U<i.widgets.length;U++)i.widgets[U].height&&(T+=i.widgets[U].height);return n?T+(Math.ceil(i.text.length/r)||1)*t:T+t}}function ma(e){var t=e.doc,n=so(e);t.iter(function(r){var i=n(r);i!=r.height&&Mt(r,i)})}function kn(e,t,n,r){var i=e.display;if(!n&&me(t).getAttribute("cm-not-content")=="true")return null;var T,U,H=i.lineSpace.getBoundingClientRect();try{T=t.clientX-H.left,U=t.clientY-H.top}catch(se){return null}var G=da(e,T,U),X;if(r&&G.xRel>0&&(X=Ke(e.doc,G.line).text).length==G.ch){var ie=B(X,X.length,e.options.tabSize)-X.length;G=_e(G.line,Math.max(0,Math.round((T-$a(e.display).left)/Xn(e.display))-ie))}return G}function Mn(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 Yr(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)Rr&&Zt(e.doc,t)<i.viewTo&&_n(e);else if(n<=i.viewFrom)Rr&&qt(e.doc,n+r)>i.viewFrom?_n(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)_n(e);else if(t<=i.viewFrom){var T=Ni(e,n,n+r,1);T?(i.view=i.view.slice(T.index),i.viewFrom=T.lineN,i.viewTo+=r):_n(e)}else if(n>=i.viewTo){var U=Ni(e,t,t,-1);U?(i.view=i.view.slice(0,U.index),i.viewTo=U.lineN):_n(e)}else{var H=Ni(e,t,t,-1),G=Ni(e,n,n+r,1);H&&G?(i.view=i.view.slice(0,H.index).concat(Mi(e,H.lineN,G.lineN)).concat(i.view.slice(G.index)),i.viewTo+=r):_n(e)}var X=i.externalMeasured;X&&(n<X.lineN?X.lineN+=r:t<X.lineN+X.size&&(i.externalMeasured=null))}function Tn(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var T=r.view[Mn(e,t)];if(T.node==null)return;var U=T.changes||(T.changes=[]);Q(U,n)==-1&&U.push(n)}function _n(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ni(e,t,n,r){var i=Mn(e,t),T,U=e.display.view;if(!Rr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var H=e.display.viewFrom,G=0;G<i;G++)H+=U[G].size;if(H!=t){if(r>0){if(i==U.length-1)return null;T=H+U[i].size-t,i++}else T=H-t;t+=T,n+=T}for(;Zt(e.doc,n)!=n;){if(i==(r<0?0:U.length-1))return null;n+=r*U[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=Mi(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Mi(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Mn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Mi(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Mn(e,n)))),r.viewTo=n}function lo(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function fi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function uo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),T=r.selection=document.createDocumentFragment(),U=0;U<n.sel.ranges.length;U++){if(!t&&U==n.sel.primIndex)continue;var H=n.sel.ranges[U];if(H.from().line>=e.display.viewTo||H.to().line<e.display.viewFrom)continue;var G=H.empty();(G||e.options.showCursorWhenSelecting)&&co(e,H.head,i),G||Xs(e,H,T)}return r}function co(e,t,n){var r=cn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(a("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var T=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));T.style.display="",T.style.left=r.other.left+"px",T.style.top=r.other.top+"px",T.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Fi(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,T=document.createDocumentFragment(),U=$a(e.display),H=U.left,G=Math.max(r.sizerWidth,On(e)-r.sizer.offsetLeft)-U.right,X=i.direction=="ltr";function ie(Ve,lt,Lt,bt){lt<0&&(lt=0),lt=Math.round(lt),bt=Math.round(bt),T.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Ve+`px;
|
|
top: `+lt+"px; width: "+(Lt==null?G-Ve:Lt)+`px;
|
|
height: `+(bt-lt)+"px"))}function se(Ve,lt,Lt){var bt=Ke(i,Ve),Ht=bt.text.length,dr,Ur;function Tr(Lr,Zr){return la(e,_e(Ve,Lr),"div",bt,Zr)}function tn(Lr,Zr,jr){var Pr=oo(e,bt,null,Lr),Dr=Zr=="ltr"==(jr=="after")?"left":"right",Sr=jr=="after"?Pr.begin:Pr.end-(/\s/.test(bt.text.charAt(Pr.end-1))?2:1);return Tr(Sr,Dr)[Dr]}var Qr=Qe(bt,i.direction);return qe(Qr,lt||0,Lt==null?Ht:Lt,function(Lr,Zr,jr,Pr){var Dr=jr=="ltr",Sr=Tr(Lr,Dr?"left":"right"),qr=Tr(Zr-1,Dr?"right":"left"),oi=lt==null&&Lr==0,Dn=Lt==null&&Zr==Ht,zr=Pr==0,vn=!Qr||Pr==Qr.length-1;if(qr.top-Sr.top<=3){var Nr=(X?oi:Dn)&&zr,Ba=(X?Dn:oi)&&vn,En=Nr?H:(Dr?Sr:qr).left,Bn=Ba?G:(Dr?qr:Sr).right;ie(En,Sr.top,Bn-En,Sr.bottom)}else{var jn,Xr,si,ja;Dr?(jn=X&&oi&&zr?H:Sr.left,Xr=X?G:tn(Lr,jr,"before"),si=X?H:tn(Zr,jr,"after"),ja=X&&Dn&&vn?G:qr.right):(jn=X?tn(Lr,jr,"before"):H,Xr=!X&&oi&&zr?G:Sr.right,si=!X&&Dn&&vn?H:qr.left,ja=X?tn(Zr,jr,"after"):G),ie(jn,Sr.top,Xr-jn,Sr.bottom),Sr.bottom<qr.top&&ie(H,Sr.bottom,null,qr.top),ie(si,qr.top,ja-si,qr.bottom)}(!dr||Fi(Sr,dr)<0)&&(dr=Sr),Fi(qr,dr)<0&&(dr=qr),(!Ur||Fi(Sr,Ur)<0)&&(Ur=Sr),Fi(qr,Ur)<0&&(Ur=qr)}),{start:dr,end:Ur}}var ve=t.from(),he=t.to();if(ve.line==he.line)se(ve.line,ve.ch,he.ch);else{var we=Ke(i,ve.line),ke=Ke(i,he.line),je=ft(we)==ft(ke),Ge=se(ve.line,ve.ch,je?we.text.length+1:null).end,it=se(he.line,je?0:null,he.ch).start;je&&(Ge.top<it.top-2?(ie(Ge.right,Ge.top,null,Ge.bottom),ie(H,it.top,it.left,it.bottom)):ie(Ge.right,Ge.top,it.left-Ge.right,Ge.bottom)),Ge.bottom<it.top&&ie(H,Ge.bottom,null,it.top)}n.appendChild(T)}function pa(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()||$n(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function fo(e){e.state.focused||(e.display.input.focus(),ga(e))}function ho(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,$n(e))},100)}function ga(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(xe(e,"focus",e,t),e.state.focused=!0,N(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),C&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),pa(e)}function $n(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(xe(e,"blur",e,t),e.state.focused=!1,p(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Bi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],T=e.options.lineWrapping,U=void 0,H=0;if(i.hidden)continue;if(j&&k<8){var G=i.node.offsetTop+i.node.offsetHeight;U=G-n,n=G}else{var X=i.node.getBoundingClientRect();U=X.bottom-X.top,!T&&i.text.firstChild&&(H=i.text.firstChild.getBoundingClientRect().right-X.left-1)}var ie=i.line.height-U;if((ie>.005||ie<-.005)&&(Mt(i.line,U),mo(i.line),i.rest))for(var se=0;se<i.rest.length;se++)mo(i.rest[se]);if(H>e.display.sizerWidth){var ve=Math.ceil(H/Xn(e.display));ve>e.display.maxLineLength&&(e.display.maxLineLength=ve,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function mo(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function ji(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Ii(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,T=yt(t,r),U=yt(t,i);if(n&&n.ensure){var H=n.ensure.from.line,G=n.ensure.to.line;H<T?(T=H,U=yt(t,er(Ke(t,H))+e.wrapper.clientHeight)):Math.min(G,t.lastLine())>=U&&(T=yt(t,er(Ke(t,G))-e.wrapper.clientHeight),U=G)}return{from:T,to:Math.max(U,T+1)}}function $s(e,t){if(Ne(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!_){var T=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Ii(e.display))+`px;
|
|
height: `+(t.bottom-t.top+pn(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(T),T.scrollIntoView(i),e.display.lineSpace.removeChild(T)}}function Ys(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?_e(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?_e(t.line,t.ch+1,"before"):t);for(var T=0;T<5;T++){var U=!1,H=cn(e,t),G=!n||n==t?H:cn(e,n);i={left:Math.min(H.left,G.left),top:Math.min(H.top,G.top)-r,right:Math.max(H.left,G.left),bottom:Math.max(H.bottom,G.bottom)+r};var X=va(e,i),ie=e.doc.scrollTop,se=e.doc.scrollLeft;if(X.scrollTop!=null&&(mi(e,X.scrollTop),Math.abs(e.doc.scrollTop-ie)>1&&(U=!0)),X.scrollLeft!=null&&(In(e,X.scrollLeft),Math.abs(e.doc.scrollLeft-se)>1&&(U=!0)),!U)break}return i}function Js(e,t){var n=va(e,t);n.scrollTop!=null&&mi(e,n.scrollTop),n.scrollLeft!=null&&In(e,n.scrollLeft)}function va(e,t){var n=e.display,r=Vn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,T=aa(e),U={};t.bottom-t.top>T&&(t.bottom=t.top+T);var H=e.doc.height+ia(n),G=t.top<r,X=t.bottom>H-r;if(t.top<i)U.scrollTop=G?0:t.top;else if(t.bottom>i+T){var ie=Math.min(t.top,(X?H:t.bottom)-T);ie!=i&&(U.scrollTop=ie)}var se=e.options.fixedGutter?0:n.gutters.offsetWidth,ve=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-se,he=On(e)-n.gutters.offsetWidth,we=t.right-t.left>he;return we&&(t.right=t.left+he),t.left<10?U.scrollLeft=0:t.left<ve?U.scrollLeft=Math.max(0,t.left+se-(we?0:10)):t.right>he+ve-3&&(U.scrollLeft=t.right+(we?0:10)-he),U}function ya(e,t){if(t==null)return;Wi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Yn(e){Wi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function hi(e,t,n){(t!=null||n!=null)&&Wi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Qs(e,t){Wi(e),e.curOp.scrollToPos=t}function Wi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=io(e,t.from),r=io(e,t.to);po(e,n,r,t.margin)}}function po(e,t,n,r){var i=va(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});hi(e,i.scrollLeft,i.scrollTop)}function mi(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;L||Ea(e,{top:t}),go(e,t,!0),L&&Ea(e),vi(e,100)}function go(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function In(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,xo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function pi(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ia(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+pn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Un=function(e,t,n){this.cm=n;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Ee(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Ee(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,j&&k<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Un.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var T=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+T)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Un.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Un.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Un.prototype.zeroWidthHack=function(){var e=u&&!S?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Y,this.disableVert=new Y},Un.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),T=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);T!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Un.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var gi=function(){};gi.prototype.update=function(){return{bottom:0,right:0}},gi.prototype.setScrollLeft=function(){},gi.prototype.setScrollTop=function(){},gi.prototype.clear=function(){};function Jn(e,t){t||(t=pi(e));var n=e.display.barWidth,r=e.display.barHeight;vo(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Bi(e),vo(e,pi(e)),n=e.display.barWidth,r=e.display.barHeight}function vo(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var yo={native:Un,null:gi};function bo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&p(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new yo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ee(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"?In(e,t):mi(e,t)},e),e.display.scrollbars.addClass&&N(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function Nn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs},Ds(e.curOp)}function Fn(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 T=0;T<t.length;T++)nl(t[T]);for(var U=0;U<t.length;U++)il(t[U])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&rn(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Hi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&ba(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Bi(t),e.barMeasure=pi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ja(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+pn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-On(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&&In(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==D();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Jn(t,e.barMeasure),e.updatedDisplay&&Ta(t,e.barMeasure),e.selectionChanged&&pa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&fo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Eo(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&go(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&In(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=Ys(t,st(r,e.scrollToPos.from),st(r,e.scrollToPos.to),e.scrollToPos.margin);$s(t,i)}var T=e.maybeHiddenMarkers,U=e.maybeUnhiddenMarkers;if(T)for(var H=0;H<T.length;++H)T[H].lines.length||xe(T[H],"hide");if(U)for(var G=0;G<U.length;++G)U[G].lines.length&&xe(U[G],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&xe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function en(e,t){if(e.curOp)return t();Nn(e);try{return t()}finally{Fn(e)}}function Mr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Nn(e);try{return t.apply(e,arguments)}finally{Fn(e)}}}function Vr(e){return function(){if(this.curOp)return e.apply(this,arguments);Nn(this);try{return e.apply(this,arguments)}finally{Fn(this)}}}function Ir(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Nn(t);try{return e.apply(this,arguments)}finally{Fn(t)}}}function vi(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,F(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=pt(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(T){if(r.line>=e.display.viewFrom){var U=T.styles,H=T.text.length>e.options.maxHighlightLength?Et(t.mode,r.state):null,G=jt(e,T,r,!0);H&&(r.state=H),T.styles=G.styles;var X=T.styleClasses,ie=G.classes;ie?T.styleClasses=ie:X&&(T.styleClasses=null);for(var se=!U||U.length!=T.styles.length||X!=ie&&(!X||!ie||X.bgClass!=ie.bgClass||X.textClass!=ie.textClass),ve=0;!se&&ve<U.length;++ve)se=U[ve]!=T.styles[ve];se&&i.push(r.line),T.stateAfter=r.save(),r.nextLine()}else T.text.length<=e.options.maxHighlightLength&&mr(e,T.text,r),T.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return vi(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&en(e,function(){for(var T=0;T<i.length;T++)Tn(e,i[T],"text")})}var Hi=function(e,t,n){var r=e.display;this.viewport=t,this.visible=ji(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=On(e),this.force=n,this.dims=fa(e),this.events=[]};Hi.prototype.signal=function(e,t){oe(e,t)&&this.events.push(arguments)},Hi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)xe.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=pn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=pn(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=D();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==D())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 ba(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return _n(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&lo(e)==0)return!1;To(e)&&(_n(e),t.dims=fa(e));var i=r.first+r.size,T=Math.max(t.visible.from-e.options.viewportMargin,r.first),U=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<T&&T-n.viewFrom<20&&(T=Math.max(r.first,n.viewFrom)),n.viewTo>U&&n.viewTo-U<20&&(U=Math.min(i,n.viewTo)),Rr&&(T=Zt(e.doc,T),U=qt(e.doc,U));var H=T!=n.viewFrom||U!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,T,U),n.viewOffset=er(Ke(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var G=lo(e);if(!H&&G==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var X=sl(e);return G>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),G>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,H&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,vi(e,400)),n.updateLineNumbers=null,!0}function Eo(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==On(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ia(e.display)-aa(e),n.top)}),t.visible=ji(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=ji(e.display,e.doc,n));if(!ba(e,t))break;Bi(e);var i=pi(e);fi(e),Jn(e,i),Ta(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 Ea(e,t){var n=new Hi(e,t);if(ba(e,n)){Bi(e),Eo(e,n);var r=pi(e);fi(e),Jn(e,r),Ta(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,T=r.lineDiv,U=T.firstChild;function H(we){var ke=we.nextSibling;return C&&u&&e.display.currentWheelTarget==we?we.style.display="none":we.parentNode.removeChild(we),ke}for(var G=r.view,X=r.viewFrom,ie=0;ie<G.length;ie++){var se=G[ie];if(!se.hidden)if(!se.node||se.node.parentNode!=T){var ve=Us(e,se,X,n);T.insertBefore(ve,U)}else{for(;U!=se.node;)U=H(U);var he=i&&t!=null&&t<=X&&se.lineNumber;se.changes&&(Q(se.changes,"gutter")>-1&&(he=!1),Ka(e,se,X,n)),he&&(c(se.lineNumber),se.lineNumber.appendChild(document.createTextNode(Yt(e.options,X)))),U=se.node.nextSibling}X+=se.size}for(;U;)U=H(U)}function xa(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Ta(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+pn(e)+"px"}function xo(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=ha(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,T=r+"px",U=0;U<n.length;U++)if(!n[U].hidden){e.options.fixedGutter&&(n[U].gutter&&(n[U].gutter.style.left=T),n[U].gutterBackground&&(n[U].gutterBackground.style.left=T));var H=n[U].alignable;if(H)for(var G=0;G<H.length;G++)H[G].style.left=T}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function To(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=Yt(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(a("div",[a("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),T=i.firstChild.offsetWidth,U=i.offsetWidth-T;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(T,r.lineGutter.offsetWidth-U)+1,r.lineNumWidth=r.lineNumInnerWidth+U,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",xa(e.display),!0}return!1}function _a(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var T=e[i],U=null;if(typeof T!="string"&&(U=T.style,T=T.className),T=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:T,style:U})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function _o(e){var t=e.gutters,n=e.gutterSpecs;c(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],T=i.className,U=i.style,H=t.appendChild(a("div",null,"CodeMirror-gutter "+T));U&&(H.style.cssText=U),T=="CodeMirror-linenumbers"&&(e.lineGutter=H,H.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",xa(e)}function yi(e){_o(e.display),Yr(e),xo(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=f("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=f("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var T=f("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[T],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+ee+"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"),j&&k<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!C&&!(L&&s)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=_a(r.gutters,r.lineNumbers),_o(i),n.init(i)}var Ki=0,nn=null;j?nn=-.53:L?nn=15:x?nn=-.7:O&&(nn=-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*=nn,t.y*=nn,t}function wo(e,t){var n=So(t),r=n.x,i=n.y,T=e.display,U=T.scroller,H=U.scrollWidth>U.clientWidth,G=U.scrollHeight>U.clientHeight;if(!(r&&H||i&&G))return;if(i&&u&&C){e:for(var X=t.target,ie=T.view;X!=U;X=X.parentNode)for(var se=0;se<ie.length;se++)if(ie[se].node==X){e.display.currentWheelTarget=X;break e}}if(r&&!L&&!A&&nn!=null){i&&G&&mi(e,Math.max(0,U.scrollTop+i*nn)),In(e,Math.max(0,U.scrollLeft+r*nn)),(!i||i&&G)&&$(t),T.wheelStartX=null;return}if(i&&nn!=null){var ve=i*nn,he=e.doc.scrollTop,we=he+T.wrapper.clientHeight;ve<0?he=Math.max(0,he+ve-50):we=Math.min(e.doc.height,we+ve+50),Ea(e,{top:he,bottom:we})}Ki<20&&(T.wheelStartX==null?(T.wheelStartX=U.scrollLeft,T.wheelStartY=U.scrollTop,T.wheelDX=r,T.wheelDY=i,setTimeout(function(){if(T.wheelStartX==null)return;var ke=U.scrollLeft-T.wheelStartX,je=U.scrollTop-T.wheelStartY,Ge=je&&T.wheelDY&&je/T.wheelDY||ke&&T.wheelDX&&ke/T.wheelDX;if(T.wheelStartX=T.wheelStartY=null,!Ge)return;nn=(nn*Ki+Ge)/(Ki+1),++Ki},200)):(T.wheelDX+=r,T.wheelDY+=i))}var an=function(e,t){this.ranges=e,this.primIndex=t};an.prototype.primary=function(){return this.ranges[this.primIndex]},an.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(!Ie(n.anchor,r.anchor)||!Ie(n.head,r.head))return!1}return!0},an.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new tr(vr(this.ranges[t].anchor),vr(this.ranges[t].head));return new an(e,this.primIndex)},an.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},an.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(tt(t,r.from())>=0&&tt(e,r.to())<=0)return n}return-1};var tr=function(e,t){this.anchor=e,this.head=t};tr.prototype.from=function(){return rr(this.anchor,this.head)},tr.prototype.to=function(){return yr(this.anchor,this.head)},tr.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function fn(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(ve,he){return tt(ve.from(),he.from())}),n=Q(t,i);for(var T=1;T<t.length;T++){var U=t[T],H=t[T-1],G=tt(H.to(),U.from());if(r&&!U.empty()?G>0:G>=0){var X=rr(H.from(),U.from()),ie=yr(H.to(),U.to()),se=H.empty()?U.from()==U.head:H.from()==H.head;T<=n&&--n,t.splice(--T,2,new tr(se?ie:X,se?X:ie))}}return new an(t,n)}function Sn(e,t){return new an([new tr(e,t||e)],0)}function wn(e){return e.text?_e(e.from.line+e.text.length-1,ye(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Co(e,t){if(tt(e,t.from)<0)return e;if(tt(e,t.to)<=0)return wn(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+=wn(t).ch-t.to.ch),_e(n,r)}function Sa(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new tr(Co(i.anchor,t),Co(i.head,t)))}return fn(e.cm,n,e.sel.primIndex)}function Ao(e,t,n){return e.line==t.line?_e(n.line,e.ch-t.ch+n.ch):_e(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=_e(e.first,0),T=i,U=0;U<t.length;U++){var H=t[U],G=Ao(H.from,i,T),X=Ao(wn(H),i,T);if(i=H.to,T=X,n=="around"){var ie=e.sel.ranges[U],se=tt(ie.head,ie.anchor)<0;r[U]=new tr(se?X:G,se?G:X)}else r[U]=new tr(G,G)}return new an(r,e.sel.primIndex)}function wa(e){e.doc.mode=gr(e.options,e.doc.modeOption),bi(e)}function bi(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,vi(e,100),e.state.modeGen++,e.curOp&&Yr(e)}function Lo(e,t){return t.from.ch==0&&t.to.ch==0&&ye(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ca(e,t,n,r){function i(it){return n?n[it]:null}function T(it,Ve,lt){_r(it,Ve,lt,r),Br(it,"change",it,t)}function U(it,Ve){for(var lt=[],Lt=it;Lt<Ve;++Lt)lt.push(new ur(X[Lt],i(Lt),r));return lt}var H=t.from,G=t.to,X=t.text,ie=Ke(e,H.line),se=Ke(e,G.line),ve=ye(X),he=i(X.length-1),we=G.line-H.line;if(t.full)e.insert(0,U(0,X.length)),e.remove(X.length,e.size-X.length);else if(Lo(e,t)){var ke=U(0,X.length-1);T(se,se.text,he),we&&e.remove(H.line,we),ke.length&&e.insert(H.line,ke)}else if(ie==se)if(X.length==1)T(ie,ie.text.slice(0,H.ch)+ve+ie.text.slice(G.ch),he);else{var je=U(1,X.length-1);je.push(new ur(ve+ie.text.slice(G.ch),he,r)),T(ie,ie.text.slice(0,H.ch)+X[0],i(0)),e.insert(H.line+1,je)}else if(X.length==1)T(ie,ie.text.slice(0,H.ch)+X[0]+se.text.slice(G.ch),i(0)),e.remove(H.line+1,we);else{T(ie,ie.text.slice(0,H.ch)+X[0],i(0)),T(se,ve+se.text.slice(G.ch),he);var Ge=U(1,X.length-1);we>1&&e.remove(H.line+1,we-1),e.insert(H.line+1,Ge)}Br(e,"change",e,t)}function Cn(e,t,n){function r(i,T,U){if(i.linked)for(var H=0;H<i.linked.length;++H){var G=i.linked[H];if(G.doc==T)continue;var X=U&&G.sharedHist;if(n&&!X)continue;t(G.doc,X),r(G.doc,i,X)}}r(e,null,!0)}function Do(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,ma(e),wa(e),Ro(e),e.options.lineWrapping||rn(e),e.options.mode=t.modeOption,Yr(e)}function Ro(e){(e.doc.direction=="rtl"?N:p)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){en(e,function(){Ro(e),Yr(e)})}function zi(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Aa(e,t){var n={from:vr(t.from),to:wn(t),text:ar(e,t.from,t.to)};return ko(e,n,t.from.line,t.to.line+1),Cn(e,function(r){return ko(r,n,t.from.line,t.to.line+1)},!0),n}function Oo(e){for(;e.length;){var t=ye(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Oo(e.done),ye(e.done);if(e.done.length&&!ye(e.done).ranges)return ye(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),ye(e.done)}function Po(e,t,n,r){var i=e.history;i.undone.length=0;var T=+new Date,U,H;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>T-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(U=ml(i,i.lastOp==r)))H=ye(U.changes),tt(t.from,t.to)==0&&tt(t.from,H.to)==0?H.to=wn(t):U.changes.push(Aa(e,t));else{var G=ye(i.done);for((!G||!G.ranges)&&Gi(e.sel,i.done),U={changes:[Aa(e,t)],generation:i.generation},i.done.push(U);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=T,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,H||xe(e,"historyAdded")}function pl(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var i=e.history,T=r&&r.origin;n==i.lastSelOp||T&&i.lastSelOrigin==T&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==T||pl(e,T,ye(i.done),t))?i.done[i.done.length-1]=t:Gi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=T,i.lastSelOp=n,r&&r.clearRedo!==!1&&Oo(i.undone)}function Gi(e,t){var n=ye(t);n&&n.ranges&&n.equals(e)||t.push(e)}function ko(e,t,n,r){var i=t["spans_"+e.id],T=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(U){U.markedSpans&&((i||(i=t["spans_"+e.id]={}))[T]=U.markedSpans),++T})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function Mo(e,t){var n=yl(e,t),r=Wr(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var T=n[i],U=r[i];if(T&&U){e:for(var H=0;H<U.length;++H){for(var G=U[H],X=0;X<T.length;++X)if(T[X].marker==G.marker)continue e;T.push(G)}}else U&&(n[i]=U)}return n}function Qn(e,t,n){for(var r=[],i=0;i<e.length;++i){var T=e[i];if(T.ranges){r.push(n?an.prototype.deepCopy.call(T):T);continue}var U=T.changes,H=[];r.push({changes:H});for(var G=0;G<U.length;++G){var X=U[G],ie=void 0;if(H.push({from:X.from,to:X.to,text:X.text}),t)for(var se in X)(ie=se.match(/^spans_(\d+)$/))&&(Q(t,Number(ie[1]))>-1&&(ye(H)[se]=X[se],delete X[se]))}}return r}function La(e,t,n,r){if(r){var i=e.anchor;if(n){var T=tt(t,i)<0;T!=tt(n,i)<0?(i=t,t=n):T!=tt(t,n)<0&&(t=n)}return new tr(i,t)}else return new tr(n||t,t)}function Vi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Kr(e,new an([La(e.sel.primary(),t,n,i)],0),r)}function Io(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),T=0;T<e.sel.ranges.length;T++)r[T]=La(e.sel.ranges[T],t[T],null,i);var U=fn(e.cm,r,e.sel.primIndex);Kr(e,U,n)}function Da(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Kr(e,fn(e.cm,i,e.sel.primIndex),r)}function Uo(e,t,n,r){Kr(e,Sn(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var T=0;T<i.length;T++)this.ranges[T]=new tr(st(e,i[T].anchor),st(e,i[T].head))},origin:n&&n.origin};return xe(e,"beforeSelectionChange",e,r),e.cm&&xe(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?fn(e.cm,r.ranges,r.ranges.length-1):t}function No(e,t,n){var r=e.history.done,i=ye(r);i&&i.ranges?(r[r.length-1]=t,Xi(e,t,n)):Kr(e,t,n)}function Kr(e,t,n){Xi(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Xi(e,t,n){(oe(e,"beforeSelectionChange")||e.cm&&oe(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(tt(t.primary().head,e.sel.primary().head)<0?-1:1);Fo(e,jo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Yn(e.cm)}function Fo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ne(e.cm)),Br(e,"cursorActivity",e)}function Bo(e){Fo(e,jo(e,e.sel,null,!1))}function jo(e,t,n,r){for(var i,T=0;T<t.ranges.length;T++){var U=t.ranges[T],H=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[T],G=$i(e,U.anchor,H&&H.anchor,n,r),X=$i(e,U.head,H&&H.head,n,r);(i||G!=U.anchor||X!=U.head)&&(i||(i=t.ranges.slice(0,T)),i[T]=new tr(G,X))}return i?fn(e.cm,i,t.primIndex):t}function Zn(e,t,n,r,i){var T=Ke(e,t.line);if(T.markedSpans)for(var U=0;U<T.markedSpans.length;++U){var H=T.markedSpans[U],G=H.marker,X="selectLeft"in G?!G.selectLeft:G.inclusiveLeft,ie="selectRight"in G?!G.selectRight:G.inclusiveRight;if((H.from==null||(X?H.from<=t.ch:H.from<t.ch))&&(H.to==null||(ie?H.to>=t.ch:H.to>t.ch))){if(i&&(xe(G,"beforeCursorEnter"),G.explicitlyCleared))if(T.markedSpans){--U;continue}else break;if(!G.atomic)continue;if(n){var se=G.find(r<0?1:-1),ve=void 0;if((r<0?ie:X)&&(se=Wo(e,se,-r,se&&se.line==t.line?T:null)),se&&se.line==t.line&&(ve=tt(se,n))&&(r<0?ve<0:ve>0))return Zn(e,se,t,r,i)}var he=G.find(r<0?-1:1);return(r<0?X:ie)&&(he=Wo(e,he,r,he.line==t.line?T:null)),he?Zn(e,he,t,r,i):null}}return t}function $i(e,t,n,r,i){var T=r||1,U=Zn(e,t,n,T,i)||!i&&Zn(e,t,n,T,!0)||Zn(e,t,n,-T,i)||!i&&Zn(e,t,n,-T,!0);return U||(e.cantEdit=!0,_e(e.first,0))}function Wo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?st(e,_e(t.line-1)):null:n>0&&t.ch==(r||Ke(e,t.line)).text.length?t.line<e.first+e.size-1?_e(t.line+1,0):null:new _e(t.line,t.ch+n)}function Ho(e){e.setSelection(_e(e.firstLine(),0),_e(e.lastLine()),ce)}function Ko(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,T,U,H){i&&(r.from=st(e,i)),T&&(r.to=st(e,T)),U&&(r.text=U),H!==void 0&&(r.origin=H)}),xe(e,"beforeChange",e,r),e.cm&&xe(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function qn(e,t,n){if(e.cm){if(!e.cm.curOp)return Mr(e.cm,qn)(e,t,n);if(e.cm.state.suppressEdits)return}if((oe(e,"beforeChange")||e.cm&&oe(e.cm,"beforeChange"))&&(t=Ko(e,t,!0),!t))return;var r=lr&&!n&&ln(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)zo(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else zo(e,t)}function zo(e,t){if(t.text.length==1&&t.text[0]==""&&tt(t.from,t.to)==0)return;var n=Sa(e,t);Po(e,t,n,e.cm?e.cm.curOp.id:NaN),Ei(e,t,n,Wr(e,t));var r=[];Cn(e,function(i,T){!T&&Q(r,i.history)==-1&&($o(i.history,t),r.push(i.history)),Ei(i,t,null,Wr(i,t))})}function Yi(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,T,U=e.sel,H=t=="undo"?i.done:i.undone,G=t=="undo"?i.undone:i.done,X=0;X<H.length&&!(T=H[X],n?T.ranges&&!T.equals(e.sel):!T.ranges);X++);if(X==H.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(T=H.pop(),T.ranges){if(Gi(T,G),n&&!T.equals(e.sel)){Kr(e,T,{clearRedo:!1});return}U=T}else if(r){H.push(T);return}else break;var ie=[];Gi(U,G),G.push({changes:ie,generation:i.generation}),i.generation=T.generation||++i.maxGeneration;for(var se=oe(e,"beforeChange")||e.cm&&oe(e.cm,"beforeChange"),ve=function(ke){var je=T.changes[ke];if(je.origin=t,se&&!Ko(e,je,!1))return H.length=0,{};ie.push(Aa(e,je));var Ge=ke?Sa(e,je):ye(H);Ei(e,je,Ge,Mo(e,je)),!ke&&e.cm&&e.cm.scrollIntoView({from:je.from,to:wn(je)});var it=[];Cn(e,function(Ve,lt){!lt&&Q(it,Ve.history)==-1&&($o(Ve.history,je),it.push(Ve.history)),Ei(Ve,je,null,Mo(Ve,je))})},he=T.changes.length-1;he>=0;--he){var we=ve(he);if(we)return we.v}}function Go(e,t){if(t==0)return;if(e.first+=t,e.sel=new an(Me(e.sel.ranges,function(i){return new tr(_e(i.anchor.line+t,i.anchor.ch),_e(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){Yr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Tn(e.cm,r,"gutter")}}function Ei(e,t,n,r){if(e.cm&&!e.cm.curOp)return Mr(e.cm,Ei)(e,t,n,r);if(t.to.line<e.first){Go(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Go(e,i),t={from:_e(e.first,0),to:_e(t.to.line+i,t.to.ch),text:[ye(t.text)],origin:t.origin}}var T=e.lastLine();t.to.line>T&&(t={from:t.from,to:_e(T,Ke(e,T).text.length),text:[t.text[0]],origin:t.origin}),t.removed=ar(e,t.from,t.to),n||(n=Sa(e,t)),e.cm?El(e.cm,t,r):Ca(e,t,r),Xi(e,n,ce),e.cantEdit&&$i(e,_e(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,T=t.from,U=t.to,H=!1,G=T.line;e.options.lineWrapping||(G=ct(ft(Ke(r,T.line))),r.iter(G,U.line+1,function(he){if(he==i.maxLine)return H=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ne(e),Ca(r,t,n,so(e)),e.options.lineWrapping||(r.iter(G,T.line+t.text.length,function(he){var we=kr(he);we>i.maxLineLength&&(i.maxLine=he,i.maxLineLength=we,i.maxLineChanged=!0,H=!1)}),H&&(e.curOp.updateMaxLine=!0)),It(r,T.line),vi(e,400);var X=t.text.length-(U.line-T.line)-1;t.full?Yr(e):T.line==U.line&&t.text.length==1&&!Lo(e.doc,t)?Tn(e,T.line,"text"):Yr(e,T.line,U.line+1,X);var ie=oe(e,"changes"),se=oe(e,"change");if(se||ie){var ve={from:T,to:U,text:t.text,removed:t.removed,origin:t.origin};se&&Br(e,"change",e,ve),ie&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(ve)}e.display.selForContextMenu=null}function ei(e,t,n,r,i){var T;r||(r=n),tt(r,n)<0&&(T=[r,n],n=T[0],r=T[1]),typeof t=="string"&&(t=e.splitLines(t)),qn(e,{from:n,to:r,text:t,origin:i})}function Vo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Xo(e,t,n,r){for(var i=0;i<e.length;++i){var T=e[i],U=!0;if(T.ranges){T.copied||(T=e[i]=T.deepCopy(),T.copied=!0);for(var H=0;H<T.ranges.length;H++)Vo(T.ranges[H].anchor,t,n,r),Vo(T.ranges[H].head,t,n,r);continue}for(var G=0;G<T.changes.length;++G){var X=T.changes[G];if(n<X.from.line)X.from=_e(X.from.line+r,X.from.ch),X.to=_e(X.to.line+r,X.to.ch);else if(t<=X.to.line){U=!1;break}}U||(e.splice(0,i+1),i=0)}}function $o(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Xo(e.done,n,r,i),Xo(e.undone,n,r,i)}function xi(e,t,n,r){var i=t,T=t;return typeof t=="number"?T=Ke(e,fr(e,t)):i=ct(t),i==null?null:(r(T,i)&&e.cm&&Tn(e.cm,i,n),T)}function Ti(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}Ti.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,Nt(i),Br(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 _i(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}_i.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var T=Math.min(t,i-e),U=r.height;if(r.removeInner(e,T),this.height-=U-r.height,i==T&&(this.children.splice(n--,1),r.parent=null),(t-=T)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Ti))){var H=[];this.collapse(H),this.children=[new Ti(H)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],T=i.chunkSize();if(e<=T){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var U=i.lines.length%25+25,H=U;H<i.lines.length;){var G=new Ti(i.lines.slice(H,H+=25));i.height-=G.height,this.children.splice(++r,0,G),G.parent=this}i.lines=i.lines.slice(0,U),this.maybeSpill()}break}e-=T}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new _i(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=Q(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new _i(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],T=i.chunkSize();if(e<T){var U=Math.min(t,T-e);if(i.iterN(e,U,n))return!0;if((t-=U)==0)break;e=0}else e-=T}}};var Si=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};Si.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=ct(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var T=di(this);Mt(n,Math.max(0,n.height-T)),e&&(en(e,function(){Yo(e,n,-T),Tn(e,r,"widget")}),Br(e,"lineWidgetCleared",e,this,r))},Si.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=di(this)-t;if(!i)return;or(this.doc,r)||Mt(r,r.height+i),n&&en(n,function(){n.curOp.forceUpdate=!0,Yo(n,r,i),Br(n,"lineWidgetChanged",n,e,ct(r))})},ae(Si);function Yo(e,t,n){er(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&ya(e,n)}function xl(e,t,n,r){var i=new Si(e,n,r),T=e.cm;return T&&i.noHScroll&&(T.display.alignWidgets=!0),xi(e,t,"widget",function(U){var H=U.widgets||(U.widgets=[]);if(i.insertAt==null?H.push(i):H.splice(Math.min(H.length-1,Math.max(0,i.insertAt)),0,i),i.line=U,T&&!or(e,U)){var G=er(U)<e.scrollTop;Mt(U,U.height+di(i)),G&&ya(T,i.height),T.curOp.forceUpdate=!0}return!0}),T&&Br(T,"lineWidgetAdded",T,i,typeof t=="number"?t:ct(t)),i}var Jo=0,An=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Jo};An.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Nn(e),oe(this,"clear")){var n=this.find();n&&Br(this,"clear",n.from,n.to)}for(var r=null,i=null,T=0;T<this.lines.length;++T){var U=this.lines[T],H=at(U.markedSpans,this);e&&!this.collapsed?Tn(e,ct(U),"text"):e&&(H.to!=null&&(i=ct(U)),H.from!=null&&(r=ct(U))),U.markedSpans=Pt(U.markedSpans,H),H.from==null&&this.collapsed&&!or(this.doc,U)&&e&&Mt(U,Vn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var G=0;G<this.lines.length;++G){var X=ft(this.lines[G]),ie=kr(X);ie>e.display.maxLineLength&&(e.display.maxLine=X,e.display.maxLineLength=ie,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Yr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Bo(e.doc)),e&&Br(e,"markerCleared",e,this,r,i),t&&Fn(e),this.parent&&this.parent.clear()},An.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var T=this.lines[i],U=at(T.markedSpans,this);if(U.from!=null&&(n=_e(t?T:ct(T),U.from),e==-1))return n;if(U.to!=null&&(r=_e(t?T:ct(T),U.to),e==1))return r}return n&&{from:n,to:r}},An.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;en(r,function(){var i=t.line,T=ct(t.line),U=oa(r,T);if(U&&(qa(U),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!or(n.doc,i)&&n.height!=null){var H=n.height;n.height=null;var G=di(n)-H;G&&Mt(i,i.height+G)}Br(r,"markerChanged",r,e)})},An.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||Q(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},An.prototype.detachLine=function(e){if(this.lines.splice(Q(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ae(An);function ti(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Mr(e.cm,ti)(e,t,n,r,i);var T=new An(e,i),U=tt(t,n);if(r&&I(r,T,!1),U>0||U==0&&T.clearWhenEmpty!==!1)return T;if(T.replacedWith&&(T.collapsed=!0,T.widgetNode=f("span",[T.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||T.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(T.widgetNode.insertLeft=!0)),T.collapsed){if(Kn(e,t.line,t,n,T)||t.line!=n.line&&Kn(e,n.line,t,n,T))throw new Error("Inserting collapsed marker partially overlapping an existing one");zt()}T.addToHistory&&Po(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var H=t.line,G=e.cm,X;if(e.iter(H,n.line+1,function(se){G&&T.collapsed&&!G.options.lineWrapping&&ft(se)==G.display.maxLine&&(X=!0),T.collapsed&&H!=t.line&&Mt(se,0),Wt(se,new dt(T,H==t.line?t.ch:null,H==n.line?n.ch:null)),++H}),T.collapsed&&e.iter(t.line,n.line+1,function(se){or(e,se)&&Mt(se,0)}),T.clearOnEnter&&Ee(T,"beforeCursorEnter",function(){return T.clear()}),T.readOnly&&(Or(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),T.collapsed&&(T.id=++Jo,T.atomic=!0),G){if(X&&(G.curOp.updateMaxLine=!0),T.collapsed)Yr(G,t.line,n.line+1);else if(T.className||T.startStyle||T.endStyle||T.css||T.attributes||T.title)for(var ie=t.line;ie<=n.line;ie++)Tn(G,ie,"text");T.atomic&&Bo(G.doc),Br(G,"markerAdded",G,T)}return T}var wi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};wi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Br(this,"clear")},wi.prototype.find=function(e,t){return this.primary.find(e,t)},ae(wi);function Tl(e,t,n,r,i){r=I(r),r.shared=!1;var T=[ti(e,t,n,r,i)],U=T[0],H=r.widgetNode;return Cn(e,function(G){H&&(r.widgetNode=H.cloneNode(!0)),T.push(ti(G,st(G,t),st(G,n),r,i));for(var X=0;X<G.linked.length;++X)if(G.linked[X].isParent)return;U=ye(T)}),new wi(T,U)}function Qo(e){return e.findMarks(_e(e.first,0),e.clipPos(_e(e.lastLine())),function(t){return t.parent})}function _l(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),T=e.clipPos(i.from),U=e.clipPos(i.to);if(tt(T,U)){var H=ti(e,T,U,r.primary,r.primary.type);r.markers.push(H),H.parent=r}}}function Sl(e){for(var t=function(r){var i=e[r],T=[i.primary.doc];Cn(i.primary.doc,function(G){return T.push(G)});for(var U=0;U<i.markers.length;U++){var H=i.markers[U];Q(T,H.doc)==-1&&(H.parent=null,i.markers.splice(U--,1))}},n=0;n<e.length;n++)t(n)}var wl=0,Jr=function(e,t,n,r,i){if(!(this instanceof Jr))return new Jr(e,t,n,r,i);n==null&&(n=0),_i.call(this,[new Ti([new ur("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var T=_e(n,0);this.sel=Sn(T),this.history=new zi(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Ca(this,{from:T,to:T,text:e}),Kr(this,Sn(T),ce)};Jr.prototype=Oe(_i.prototype,{constructor:Jr,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=Qt(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Ir(function(e){var t=_e(this.first,0),n=this.first+this.size-1;qn(this,{from:t,to:_e(n,Ke(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&hi(this.cm,0,0),Kr(this,Sn(t),ce)}),replaceRange:function(e,t,n,r){t=st(this,t),n=n?st(this,n):t,ei(this,e,t,n,r)},getRange:function(e,t,n){var r=ar(this,st(this,e),st(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(Xt(this,e))return Ke(this,e)},getLineNumber:function(e){return ct(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=Ke(this,e)),ft(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return st(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:Ir(function(e,t,n){Uo(this,st(this,typeof e=="number"?_e(e,t||0):e),null,n)}),setSelection:Ir(function(e,t,n){Uo(this,st(this,e),st(this,t||e),n)}),extendSelection:Ir(function(e,t,n){Vi(this,st(this,e),t&&st(this,t),n)}),extendSelections:Ir(function(e,t){Io(this,Bt(this,e),t)}),extendSelectionsBy:Ir(function(e,t){var n=Me(this.sel.ranges,e);Io(this,Bt(this,n),t)}),setSelections:Ir(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new tr(st(this,e[i].anchor),st(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Kr(this,fn(this.cm,r,t),n)}),addSelection:Ir(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new tr(st(this,e),st(this,t||e))),Kr(this,fn(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=ar(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=ar(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:Ir(function(e,t,n){for(var r=[],i=this.sel,T=0;T<i.ranges.length;T++){var U=i.ranges[T];r[T]={from:U.from(),to:U.to(),text:this.splitLines(e[T]),origin:n}}for(var H=t&&t!="end"&&fl(this,r,t),G=r.length-1;G>=0;G--)qn(this,r[G]);H?No(this,H):this.cm&&Yn(this.cm)}),undo:Ir(function(){Yi(this,"undo")}),redo:Ir(function(){Yi(this,"redo")}),undoSelection:Ir(function(){Yi(this,"undo",!0)}),redoSelection:Ir(function(){Yi(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new zi(this.history.maxGeneration),Cn(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Qn(this.history.done),undone:Qn(this.history.undone)}},setHistory:function(e){var t=this.history=new zi(this.history.maxGeneration);t.done=Qn(e.done.slice(0),null,!0),t.undone=Qn(e.undone.slice(0),null,!0)},setGutterMarker:Ir(function(e,t,n){return xi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&We(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Ir(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&xi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,We(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Xt(this,e))return null;if(t=e,e=Ke(this,e),!e)return null}else if(t=ct(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:Ir(function(e,t,n){return xi(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:Ir(function(e,t,n){return xi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",T=r[i];if(T)if(n==null)r[i]=null;else{var U=T.match(y(n));if(!U)return!1;var H=U.index+U[0].length;r[i]=T.slice(0,U.index)+(!U.index||H==T.length?"":" ")+T.slice(H)||null}else return!1;return!0})}),addLineWidget:Ir(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return ti(this,st(this,e),st(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=st(this,e),ti(this,e,e,n,"bookmark")},findMarksAt:function(e){e=st(this,e);var t=[],n=Ke(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=st(this,e),t=st(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(T){var U=T.markedSpans;if(U)for(var H=0;H<U.length;H++){var G=U[H];!(G.to!=null&&i==e.line&&e.ch>=G.to||G.from==null&&i!=e.line||G.from!=null&&i==t.line&&G.from>=t.ch)&&(!n||n(G.marker))&&r.push(G.marker.parent||G.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var T=i.text.length+r;if(T>e)return t=e,!0;e-=T,++n}),st(this,_e(n,t))},indexFromPos:function(e){e=st(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 Jr(Qt(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 Jr(Qt(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],_l(r,Qo(this)),r},unlinkDoc:function(e){if(e instanceof Er&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Sl(Qo(this));break}if(e.history==this.history){var r=[e.id];Cn(e,function(i){return r.push(i.id)},!0),e.history=new zi(null),e.history.done=Qn(this.history.done,r),e.history.undone=Qn(this.history.undone,r)}},iterLinkedDocs:function(e){Cn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):et(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Ir(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)})}),Jr.prototype.eachLine=Jr.prototype.iter;var Zo=0;function Cl(e){var t=this;if(qo(t),Ne(t,e)||yn(t.display,e))return;$(e),j&&(Zo=+new Date);var n=kn(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,T=Array(i),U=0,H=function(){++U==i&&Mr(t,function(){n=st(t.doc,n);var he={from:n,to:n,text:t.doc.splitLines(T.filter(function(we){return we!=null}).join(t.doc.lineSeparator())),origin:"paste"};qn(t.doc,he),No(t.doc,Sn(st(t.doc,n),st(t.doc,wn(he))))})()},G=function(he,we){if(t.options.allowDropFileTypes&&Q(t.options.allowDropFileTypes,he.type)==-1){H();return}var ke=new FileReader;ke.onerror=function(){return H()},ke.onload=function(){var je=ke.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(je)){H();return}T[we]=je,H()},ke.readAsText(he)},X=0;X<r.length;X++)G(r[X],X);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ie=e.dataTransfer.getData("Text");if(ie){var se;if(t.state.draggingText&&!t.state.draggingText.copy&&(se=t.listSelections()),Xi(t.doc,Sn(n,n)),se)for(var ve=0;ve<se.length;++ve)ei(t.doc,"",se[ve].anchor,se[ve].head,"drag");t.replaceSelection(ie,"around","paste"),t.display.input.focus()}}catch(he){}}}function Al(e,t){if(j&&(!e.state.draggingText||+new Date-Zo<100)){te(t);return}if(Ne(e,t)||yn(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!O){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",A&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),A&&n.parentNode.removeChild(n)}}function Ll(e,t){var n=kn(e,t);if(!n)return;var r=document.createDocumentFragment();co(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),l(e.display.dragCursor,r)}function qo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function es(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var T=0;T<n.length;T++)e(n[T])})}var ts=!1;function Dl(){if(ts)return;Rl(),ts=!0}function Rl(){var e;Ee(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,es(Ol)},100))}),Ee(window,"blur",function(){return es($n)})}function Ol(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Ln={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"},Ci=0;Ci<10;Ci++)Ln[Ci+48]=Ln[Ci+96]=String(Ci);for(var Ji=65;Ji<=90;Ji++)Ln[Ji]=String.fromCharCode(Ji);for(var Ai=1;Ai<=12;Ai++)Ln[Ai+111]=Ln[Ai+63235]="F"+Ai;var bn={};bn.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"},bn.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"},bn.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"},bn.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"]},bn.default=u?bn.macDefault:bn.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,T,U=0;U<t.length-1;U++){var H=t[U];if(/^(cmd|meta|m)$/i.test(H))T=!0;else if(/^a(lt)?$/i.test(H))n=!0;else if(/^(c|ctrl|control)$/i.test(H))r=!0;else if(/^s(hift)?$/i.test(H))i=!0;else throw new Error("Unrecognized modifier name: "+H)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),T&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function kl(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=Me(n.split(" "),Pl),T=0;T<i.length;T++){var U=void 0,H=void 0;T==i.length-1?(H=i.join(" "),U=r):(H=i.slice(0,T+1).join(" "),U="...");var G=t[H];if(!G)t[H]=U;else if(G!=U)throw new Error("Inconsistent bindings for "+H)}delete e[n]}for(var X in t)e[X]=t[X];return e}function ri(e,t,n,r){t=Qi(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return ri(e,t.fallthrough,n,r);for(var T=0;T<t.fallthrough.length;T++){var U=ri(e,t.fallthrough[T],n,r);if(U)return U}}}function rs(e){var t=typeof e=="string"?e:Ln[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ns(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(g?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(g?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function is(e,t){if(A&&e.keyCode==34&&e.char)return!1;var n=Ln[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),ns(n,e,t))}function Qi(e){return typeof e=="string"?bn[e]:e}function ni(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var T=t(n[i]);r.length&&tt(T.from,ye(r).to)<=0;){var U=r.pop();if(tt(U.from,T.from)<0){T.from=U.from;break}}r.push(T)}en(e,function(){for(var H=r.length-1;H>=0;H--)ei(e.doc,"",r[H].from,r[H].to,"+delete");Yn(e)})}function Ra(e,t,n){var r=Se(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Oa(e,t,n){var r=Ra(e,t.ch,n);return r==null?null:new _e(t.line,r,n<0?"after":"before")}function Pa(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var T=Qe(n,t.doc.direction);if(T){var U=i<0?ye(T):T[0],H=i<0==(U.level==1),G=H?"after":"before",X;if(U.level>0||t.doc.direction=="rtl"){var ie=Gn(t,n);X=i<0?n.text.length-1:0;var se=gn(t,ie,X).top;X=$e(function(ve){return gn(t,ie,ve).top==se},i<0==(U.level==1)?U.from:U.to-1,X),G=="before"&&(X=Ra(n,X,1))}else X=i<0?U.to:U.from;return new _e(r,X,G)}}return new _e(r,i<0?n.text.length:0,i<0?"before":"after")}function Ml(e,t,n,r){var i=Qe(t,e.doc.direction);if(!i)return Oa(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var T=Xe(i,n.ch,n.sticky),U=i[T];if(e.doc.direction=="ltr"&&U.level%2==0&&(r>0?U.to>n.ch:U.from<n.ch))return Oa(t,n,r);var H=function(Ge,it){return Ra(t,Ge instanceof _e?Ge.ch:Ge,it)},G,X=function(Ge){return e.options.lineWrapping?(G=G||Gn(e,t),oo(e,t,G,Ge)):{begin:0,end:t.text.length}},ie=X(n.sticky=="before"?H(n,-1):n.ch);if(e.doc.direction=="rtl"||U.level==1){var se=U.level==1==r<0,ve=H(n,se?1:-1);if(ve!=null&&(se?ve<=U.to&&ve<=ie.end:ve>=U.from&&ve>=ie.begin)){var he=se?"before":"after";return new _e(n.line,ve,he)}}var we=function(Ge,it,Ve){for(var lt=function(dr,Ur){return Ur?new _e(n.line,H(dr,1),"before"):new _e(n.line,dr,"after")};Ge>=0&&Ge<i.length;Ge+=it){var Lt=i[Ge],bt=it>0==(Lt.level!=1),Ht=bt?Ve.begin:H(Ve.end,-1);if(Lt.from<=Ht&&Ht<Lt.to)return lt(Ht,bt);if(Ht=bt?Lt.from:H(Lt.to,-1),Ve.begin<=Ht&&Ht<Ve.end)return lt(Ht,bt)}},ke=we(T+r,r,ie);if(ke)return ke;var je=r>0?ie.end:H(ie.begin,-1);return je!=null&&!(r>0&&je==t.text.length)&&(ke=we(r>0?0:i.length-1,r,X(je)),ke)?ke:null}var Li={selectAll:Ho,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ce)},killLine:function(e){return ni(e,function(t){if(t.empty()){var n=Ke(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:_e(t.head.line+1,0)}:{from:t.head,to:_e(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return ni(e,function(t){return{from:_e(t.from().line,0),to:st(e.doc,_e(t.to().line+1,0))}})},delLineLeft:function(e){return ni(e,function(t){return{from:_e(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return ni(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 ni(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(_e(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(_e(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return as(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return os(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},pe)},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")},pe)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?os(e,t.head):r},pe)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var T=n[i].from(),U=B(e.getLine(T.line),T.ch,r);t.push(de(r-U%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return en(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,T=Ke(e.doc,i.line).text;if(T){if(i.ch==T.length&&(i=new _e(i.line,i.ch-1)),i.ch>0)i=new _e(i.line,i.ch+1),e.replaceRange(T.charAt(i.ch-1)+T.charAt(i.ch-2),_e(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var U=Ke(e.doc,i.line-1).text;U&&(i=new _e(i.line,1),e.replaceRange(T.charAt(0)+e.doc.lineSeparator()+U.charAt(U.length-1),_e(i.line-1,U.length-1),i,"+transpose"))}}n.push(new tr(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return en(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);Yn(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function as(e,t){var n=Ke(e.doc,t),r=ft(n);return r!=n&&(t=ct(r)),Pa(!0,e,r,t,1)}function Il(e,t){var n=Ke(e.doc,t),r=kt(n);return r!=n&&(t=ct(r)),Pa(!0,e,n,t,-1)}function os(e,t){var n=as(e,t.line),r=Ke(e.doc,n.line),i=Qe(r,e.doc.direction);if(!i||i[0].level==0){var T=Math.max(n.ch,r.text.search(/\S/)),U=t.line==n.line&&t.ch<=T&&t.ch;return _e(n.line,U?0:T,n.sticky)}return n}function Zi(e,t,n){if(typeof t=="string"&&(t=Li[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)!=fe}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Ul(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=ri(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&ri(t,e.options.extraKeys,n,e)||ri(t,e.options.keyMap,n,e)}var Nl=new Y;function Di(e,t,n,r){var i=e.state.keySeq;if(i){if(rs(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Nl.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),ss(e,i+" "+t,n,r))return!0}return ss(e,t,n,r)}function ss(e,t,n,r){var i=Ul(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Br(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&($(n),pa(e)),!!i}function ls(e,t){var n=is(t,!0);return n?t.shiftKey&&!e.state.keySeq?Di(e,"Shift-"+n,t,function(r){return Zi(e,r,!0)})||Di(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Zi(e,r)}):Di(e,n,t,function(r){return Zi(e,r)}):!1}function Fl(e,t,n){return Di(e,"'"+n+"'",t,function(r){return Zi(e,r,!0)})}var ka=null;function us(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=D(),Ne(t,e))return;j&&k<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=ls(t,e);A&&(ka=r?n:null,!r&&n==88&&!Ct&&(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;N(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(p(t,"CodeMirror-crosshair"),Ze(document,"keyup",n),Ze(document,"mouseover",n))}Ee(document,"keyup",n),Ee(document,"mouseover",n)}function ds(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ne(this,e)}function cs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(yn(t.display,e)||Ne(t,e)||e.ctrlKey&&!e.altKey||u&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(A&&n==ka){ka=null,$(e);return}if(A&&(!e.which||e.which<10)&&ls(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Fl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Ma=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ma.prototype.compare=function(e,t,n){return this.time+jl>e&&tt(t,this.pos)==0&&n==this.button};var Ri,Oi;function Wl(e,t){var n=+new Date;return Oi&&Oi.compare(n,e,t)?(Ri=Oi=null,"triple"):Ri&&Ri.compare(n,e,t)?(Oi=new Ma(n,e,t),Ri=null,"double"):(Ri=new Ma(n,e,t),Oi=null,"single")}function fs(e){var t=this,n=t.display;if(Ne(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,yn(n,e)){C||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ia(t,e))return;var r=kn(t,e),i=be(e),T=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,T,e))return;i==1?r?zl(t,r,T,e):me(e)==n.scroller&&$(e):i==2?(r&&Vi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(w?t.display.input.onContextMenu(e):ho(t))}function Hl(e,t,n,r,i){var T="Click";return r=="double"?T="Double"+T:r=="triple"&&(T="Triple"+T),T=(t==1?"Left":t==2?"Middle":"Right")+T,Di(e,ns(T,i),i,function(U){if(typeof U=="string"&&(U=Li[U]),!U)return!1;var H=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),H=U(e,n)!=fe}finally{e.state.suppressEdits=!1}return H})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var T=h?n.shiftKey&&n.metaKey:n.altKey;i.unit=T?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=u?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(u?n.altKey:n.ctrlKey)),i}function zl(e,t,n,r){j?setTimeout(F(fo,e),0):e.curOp.focus=D();var i=Kl(e,n,r),T=e.doc.sel,U;e.options.dragDrop&&Pe&&!e.isReadOnly()&&n=="single"&&(U=T.contains(t))>-1&&(tt((U=T.ranges[U]).from(),t)<0||t.xRel>0)&&(tt(U.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,T=!1,U=Mr(e,function(X){C&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ze(i.wrapper.ownerDocument,"mouseup",U),Ze(i.wrapper.ownerDocument,"mousemove",H),Ze(i.scroller,"dragstart",G),Ze(i.scroller,"drop",U),T||($(X),r.addNew||Vi(e.doc,n,null,null,r.extend),C&&!O||j&&k==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),H=function(X){T=T||Math.abs(t.clientX-X.clientX)+Math.abs(t.clientY-X.clientY)>=10},G=function(){return T=!0};C&&(i.scroller.draggable=!0),e.state.draggingText=U,U.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Ee(i.wrapper.ownerDocument,"mouseup",U),Ee(i.wrapper.ownerDocument,"mousemove",H),Ee(i.scroller,"dragstart",G),Ee(i.scroller,"drop",U),ho(e),setTimeout(function(){return i.input.focus()},20)}function hs(e,t,n){if(n=="char")return new tr(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new tr(_e(t.line,0),st(e.doc,_e(t.line+1,0)));var r=n(e,t);return new tr(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,T=e.doc;$(t);var U,H,G=T.sel,X=G.ranges;if(r.addNew&&!r.extend?(H=T.sel.contains(n),H>-1?U=X[H]:U=new tr(n,n)):(U=T.sel.primary(),H=T.sel.primIndex),r.unit=="rectangle")r.addNew||(U=new tr(n,n)),n=kn(e,t,!0,!0),H=-1;else{var ie=hs(e,n,r.unit);r.extend?U=La(U,ie.anchor,ie.head,r.extend):U=ie}r.addNew?H==-1?(H=X.length,Kr(T,fn(e,X.concat([U]),H),{scroll:!1,origin:"*mouse"})):X.length>1&&X[H].empty()&&r.unit=="char"&&!r.extend?(Kr(T,fn(e,X.slice(0,H).concat(X.slice(H+1)),0),{scroll:!1,origin:"*mouse"}),G=T.sel):Da(T,H,U,ge):(H=0,Kr(T,new an([U],0),ge),G=T.sel);var se=n;function ve(Ve){if(tt(se,Ve)==0)return;if(se=Ve,r.unit=="rectangle"){for(var lt=[],Lt=e.options.tabSize,bt=B(Ke(T,n.line).text,n.ch,Lt),Ht=B(Ke(T,Ve.line).text,Ve.ch,Lt),dr=Math.min(bt,Ht),Ur=Math.max(bt,Ht),Tr=Math.min(n.line,Ve.line),tn=Math.min(e.lastLine(),Math.max(n.line,Ve.line));Tr<=tn;Tr++){var Qr=Ke(T,Tr).text,Lr=ue(Qr,dr,Lt);dr==Ur?lt.push(new tr(_e(Tr,Lr),_e(Tr,Lr))):Qr.length>Lr&<.push(new tr(_e(Tr,Lr),_e(Tr,ue(Qr,Ur,Lt))))}lt.length||lt.push(new tr(n,n)),Kr(T,fn(e,G.ranges.slice(0,H).concat(lt),H),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ve)}else{var Zr=U,jr=hs(e,Ve,r.unit),Pr=Zr.anchor,Dr;tt(jr.anchor,Pr)>0?(Dr=jr.head,Pr=rr(Zr.from(),jr.anchor)):(Dr=jr.anchor,Pr=yr(Zr.to(),jr.head));var Sr=G.ranges.slice(0);Sr[H]=Xl(e,new tr(st(T,Pr),Dr)),Kr(T,fn(e,Sr,H),ge)}}var he=i.wrapper.getBoundingClientRect(),we=0;function ke(Ve){var lt=++we,Lt=kn(e,Ve,!0,r.unit=="rectangle");if(!Lt)return;if(tt(Lt,se)!=0){e.curOp.focus=D(),ve(Lt);var bt=ji(i,T);(Lt.line>=bt.to||Lt.line<bt.from)&&setTimeout(Mr(e,function(){we==lt&&ke(Ve)}),150)}else{var Ht=Ve.clientY<he.top?-20:Ve.clientY>he.bottom?20:0;Ht&&setTimeout(Mr(e,function(){if(we!=lt)return;i.scroller.scrollTop+=Ht,ke(Ve)}),50)}}function je(Ve){e.state.selectingText=!1,we=Infinity,Ve&&($(Ve),i.input.focus()),Ze(i.wrapper.ownerDocument,"mousemove",Ge),Ze(i.wrapper.ownerDocument,"mouseup",it),T.history.lastSelOrigin=null}var Ge=Mr(e,function(Ve){Ve.buttons===0||!be(Ve)?je(Ve):ke(Ve)}),it=Mr(e,je);e.state.selectingText=it,Ee(i.wrapper.ownerDocument,"mousemove",Ge),Ee(i.wrapper.ownerDocument,"mouseup",it)}function Xl(e,t){var n=t.anchor,r=t.head,i=Ke(e.doc,n.line);if(tt(n,r)==0&&n.sticky==r.sticky)return t;var T=Qe(i);if(!T)return t;var U=Xe(T,n.ch,n.sticky),H=T[U];if(H.from!=n.ch&&H.to!=n.ch)return t;var G=U+(H.from==n.ch==(H.level!=1)?0:1);if(G==0||G==T.length)return t;var X;if(r.line!=n.line)X=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ie=Xe(T,r.ch,r.sticky),se=ie-U||(r.ch-n.ch)*(H.level==1?-1:1);ie==G-1||ie==G?X=se<0:X=se>0}var ve=T[G+(X?-1:0)],he=X==(ve.level==1),we=he?ve.from:ve.to,ke=he?"after":"before";return n.ch==we&&n.sticky==ke?t:new tr(new _e(n.line,we,ke),r)}function ms(e,t,n,r){var i,T;if(t.touches)i=t.touches[0].clientX,T=t.touches[0].clientY;else try{i=t.clientX,T=t.clientY}catch(ve){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&$(t);var U=e.display,H=U.lineDiv.getBoundingClientRect();if(T>H.bottom||!oe(e,n))return q(t);T-=H.top-U.viewOffset;for(var G=0;G<e.display.gutterSpecs.length;++G){var X=U.gutters.childNodes[G];if(X&&X.getBoundingClientRect().right>=i){var ie=yt(e.doc,T),se=e.display.gutterSpecs[G];return xe(e,n,e,ie,se.className,t),q(t)}}}function Ia(e,t){return ms(e,t,"gutterClick",!0)}function ps(e,t){if(yn(e.display,t)||$l(e,t))return;if(Ne(e,t,"contextmenu"))return;w||e.display.input.onContextMenu(t)}function $l(e,t){return oe(e,"gutterContextMenu")?ms(e,t,"gutterContextMenu",!1):!1}function gs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ci(e)}var ii={toString:function(){return"CodeMirror.Init"}},vs={},qi={};function Yl(e){var t=e.optionHandlers;function n(r,i,T,U){e.defaults[r]=i,T&&(t[r]=U?function(H,G,X){X!=ii&&T(H,G,X)}:T)}e.defineOption=n,e.Init=ii,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,wa(r)},!0),n("indentUnit",2,wa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){bi(r),ci(r),Yr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var T=[],U=r.doc.first;r.doc.iter(function(G){for(var X=0;;){var ie=G.text.indexOf(i,X);if(ie==-1)break;X=ie+i.length,T.push(_e(U,ie))}U++});for(var H=T.length-1;H>=0;H--)ei(r.doc,i,T[H],_e(T[H].line,T[H].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,T){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),T!=ii&&r.refresh()}),n("specialCharPlaceholder",Rn,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",s?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!E),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){gs(r),yi(r)},!0),n("keyMap","default",function(r,i,T){var U=Qi(i),H=T!=ii&&Qi(T);H&&H.detach&&H.detach(r,U),U.attach&&U.attach(r,H||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ql,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=_a(i,r.options.lineNumbers),yi(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?ha(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Jn(r)},!0),n("scrollbarStyle","native",function(r){bo(r),Jn(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=_a(r.options.gutters,i),yi(r)},!0),n("firstLineNumber",1,yi,!0),n("lineNumberFormatter",function(r){return r},yi,!0),n("showCursorWhenSelecting",!1,fi,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&($n(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,fi,!0),n("singleCursorHeightPerLine",!0,fi,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,bi,!0),n("addModeClass",!1,bi,!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,bi,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Jl(e,t,n){var r=n&&n!=ii;if(!t!=!r){var i=e.display.dragFunctions,T=t?Ee:Ze;T(e.display.scroller,"dragstart",i.start),T(e.display.scroller,"dragenter",i.enter),T(e.display.scroller,"dragover",i.over),T(e.display.scroller,"dragleave",i.leave),T(e.display.scroller,"drop",i.drop)}}function Ql(e){e.options.lineWrapping?(N(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(p(e.display.wrapper,"CodeMirror-wrap"),rn(e)),ma(e),Yr(e),ci(e),setTimeout(function(){return Jn(e)},100)}function Er(e,t){var n=this;if(!(this instanceof Er))return new Er(e,t);this.options=t=t?I(t):{},I(vs,t,!1);var r=t.value;typeof r=="string"?r=new Jr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Er.inputStyles[t.inputStyle](this),T=this.display=new dl(e,r,i,t);T.wrapper.CodeMirror=this,gs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),bo(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new Y,keySeq:null,specialChars:null},t.autofocus&&!s&&T.input.focus(),j&&k<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Dl(),Nn(this),this.curOp.forceUpdate=!0,Do(this,r),t.autofocus&&!s||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&ga(n)},20):$n(this);for(var U in qi)qi.hasOwnProperty(U)&&qi[U](this,t[U],ii);To(this),t.finishInit&&t.finishInit(this);for(var H=0;H<Ua.length;++H)Ua[H](this);Fn(this),C&&t.lineWrapping&&getComputedStyle(T.lineDiv).textRendering=="optimizelegibility"&&(T.lineDiv.style.textRendering="auto")}Er.defaults=vs,Er.optionHandlers=qi;function Zl(e){var t=e.display;Ee(t.scroller,"mousedown",Mr(e,fs)),j&&k<11?Ee(t.scroller,"dblclick",Mr(e,function(G){if(Ne(e,G))return;var X=kn(e,G);if(!X||Ia(e,G)||yn(e.display,G))return;$(G);var ie=e.findWordAt(X);Vi(e.doc,ie.anchor,ie.head)})):Ee(t.scroller,"dblclick",function(G){return Ne(e,G)||$(G)}),Ee(t.scroller,"contextmenu",function(G){return ps(e,G)}),Ee(t.input.getField(),"contextmenu",function(G){t.scroller.contains(G.target)||ps(e,G)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function T(G){if(G.touches.length!=1)return!1;var X=G.touches[0];return X.radiusX<=1&&X.radiusY<=1}function U(G,X){if(X.left==null)return!0;var ie=X.left-G.left,se=X.top-G.top;return ie*ie+se*se>20*20}Ee(t.scroller,"touchstart",function(G){if(!Ne(e,G)&&!T(G)&&!Ia(e,G)){t.input.ensurePolled(),clearTimeout(n);var X=+new Date;t.activeTouch={start:X,moved:!1,prev:X-r.end<=300?r:null},G.touches.length==1&&(t.activeTouch.left=G.touches[0].pageX,t.activeTouch.top=G.touches[0].pageY)}}),Ee(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ee(t.scroller,"touchend",function(G){var X=t.activeTouch;if(X&&!yn(t,G)&&X.left!=null&&!X.moved&&new Date-X.start<300){var ie=e.coordsChar(t.activeTouch,"page"),se;!X.prev||U(X,X.prev)?se=new tr(ie,ie):!X.prev.prev||U(X,X.prev.prev)?se=e.findWordAt(ie):se=new tr(_e(ie.line,0),st(e.doc,_e(ie.line+1,0))),e.setSelection(se.anchor,se.head),e.focus(),$(G)}i()}),Ee(t.scroller,"touchcancel",i),Ee(t.scroller,"scroll",function(){t.scroller.clientHeight&&(mi(e,t.scroller.scrollTop),In(e,t.scroller.scrollLeft,!0),xe(e,"scroll",e))}),Ee(t.scroller,"mousewheel",function(G){return wo(e,G)}),Ee(t.scroller,"DOMMouseScroll",function(G){return wo(e,G)}),Ee(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(G){Ne(e,G)||te(G)},over:function(G){Ne(e,G)||(Ll(e,G),te(G))},start:function(G){return Al(e,G)},drop:Mr(e,Cl),leave:function(G){Ne(e,G)||qo(e)}};var H=t.input.getField();Ee(H,"keyup",function(G){return ds.call(e,G)}),Ee(H,"keydown",Mr(e,us)),Ee(H,"keypress",Mr(e,cs)),Ee(H,"focus",function(G){return ga(e,G)}),Ee(H,"blur",function(G){return $n(e,G)})}var Ua=[];Er.defineInitHook=function(e){return Ua.push(e)};function Pi(e,t,n,r){var i=e.doc,T;n==null&&(n="add"),n=="smart"&&(i.mode.indent?T=pt(e,t).state:n="prev");var U=e.options.tabSize,H=Ke(i,t),G=B(H.text,null,U);H.stateAfter&&(H.stateAfter=null);var X=H.text.match(/^\s*/)[0],ie;if(!r&&!/\S/.test(H.text))ie=0,n="not";else if(n=="smart"&&(ie=i.mode.indent(T,H.text.slice(X.length),H.text),ie==fe||ie>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?ie=B(Ke(i,t-1).text,null,U):ie=0:n=="add"?ie=G+e.options.indentUnit:n=="subtract"?ie=G-e.options.indentUnit:typeof n=="number"&&(ie=G+n),ie=Math.max(0,ie);var se="",ve=0;if(e.options.indentWithTabs)for(var he=Math.floor(ie/U);he;--he)ve+=U,se+=" ";if(ve<ie&&(se+=de(ie-ve)),se!=X)return ei(i,se,_e(t,0),_e(t,X.length),"+input"),H.stateAfter=null,!0;for(var we=0;we<i.sel.ranges.length;we++){var ke=i.sel.ranges[we];if(ke.head.line==t&&ke.head.ch<X.length){var je=_e(t,X.length);Da(i,we,new tr(je,je));break}}}var hn=null;function ea(e){hn=e}function Na(e,t,n,r,i){var T=e.doc;e.display.shift=!1,r||(r=T.sel);var U=+new Date-200,H=i=="paste"||e.state.pasteIncoming>U,G=et(t),X=null;if(H&&r.ranges.length>1)if(hn&&hn.text.join(`
|
|
`)==t){if(r.ranges.length%hn.text.length==0){X=[];for(var ie=0;ie<hn.text.length;ie++)X.push(T.splitLines(hn.text[ie]))}}else G.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(X=Me(G,function(Ge){return[Ge]}));for(var se=e.curOp.updateInput,ve=r.ranges.length-1;ve>=0;ve--){var he=r.ranges[ve],we=he.from(),ke=he.to();he.empty()&&(n&&n>0?we=_e(we.line,we.ch-n):e.state.overwrite&&!H?ke=_e(ke.line,Math.min(Ke(T,ke.line).text.length,ke.ch+ye(G).length)):H&&hn&&hn.lineWise&&hn.text.join(`
|
|
`)==G.join(`
|
|
`)&&(we=ke=_e(we.line,0)));var je={from:we,to:ke,text:X?X[ve%X.length]:G,origin:i||(H?"paste":e.state.cutIncoming>U?"cut":"+input")};qn(e.doc,je),Br(e,"inputRead",e,je)}t&&!H&&bs(e,t),Yn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=se),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ys(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&en(t,function(){return Na(t,n,0,null,"paste")}),!0}function bs(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var T=e.getModeAt(i.head),U=!1;if(T.electricChars){for(var H=0;H<T.electricChars.length;H++)if(t.indexOf(T.electricChars.charAt(H))>-1){U=Pi(e,i.head.line,"smart");break}}else T.electricInput&&(T.electricInput.test(Ke(e.doc,i.head.line).text.slice(0,i.head.ch))&&(U=Pi(e,i.head.line,"smart")));U&&Br(e,"electricInput",e,i.head.line)}}function Es(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,T={anchor:_e(i,0),head:_e(i+1,0)};n.push(T),t.push(e.getRange(T.anchor,T.head))}return{text:t,ranges:n}}function xs(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Ts(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return C?e.style.width="1000px":e.setAttribute("wrap","off"),b&&(e.style.border="1px solid black"),xs(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var T=this.options,U=T[r];if(T[r]==i&&r!="mode")return;T[r]=i,t.hasOwnProperty(r)&&Mr(this,t[r])(this,i,U),xe(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](Qi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,T=0;T<i.length;++T)if(i[T]==r||i[T].name==r)return i.splice(T,1),!0},addOverlay:Vr(function(r,i){var T=r.token?r:e.getMode(this.options,r);if(T.startState)throw new Error("Overlays may not be stateful.");Ue(this.state.overlays,{mode:T,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(U){return U.priority}),this.state.modeGen++,Yr(this)}),removeOverlay:Vr(function(r){for(var i=this.state.overlays,T=0;T<i.length;++T){var U=i[T].modeSpec;if(U==r||typeof r=="string"&&U.name==r){i.splice(T,1),this.state.modeGen++,Yr(this);return}}}),indentLine:Vr(function(r,i,T){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Xt(this.doc,r)&&Pi(this,r,i,T)}),indentSelection:Vr(function(r){for(var i=this.doc.sel.ranges,T=-1,U=0;U<i.length;U++){var H=i[U];if(H.empty())H.head.line>T&&(Pi(this,H.head.line,r,!0),T=H.head.line,U==this.doc.sel.primIndex&&Yn(this));else{var G=H.from(),X=H.to(),ie=Math.max(T,G.line);T=Math.min(this.lastLine(),X.line-(X.ch?0:1))+1;for(var se=ie;se<T;++se)Pi(this,se,r);var ve=this.doc.sel.ranges;G.ch==0&&i.length==ve.length&&ve[U].from().ch>0&&Da(this.doc,U,new tr(G,ve[U].to()),ce)}}}),getTokenAt:function(r,i){return wt(this,r,i)},getLineTokens:function(r,i){return wt(this,_e(r),i,!0)},getTokenTypeAt:function(r){r=st(this.doc,r);var i=Ot(this,Ke(this.doc,r.line)),T=0,U=(i.length-1)/2,H=r.ch,G;if(H==0)G=i[2];else for(;;){var X=T+U>>1;if((X?i[X*2-1]:0)>=H)U=X;else if(i[X*2+1]<H)T=X+1;else{G=i[X*2+2];break}}var ie=G?G.indexOf("overlay "):-1;return ie<0?G:ie==0?null:G.slice(0,ie-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var T=[];if(!n.hasOwnProperty(i))return T;var U=n[i],H=this.getModeAt(r);if(typeof H[i]=="string")U[H[i]]&&T.push(U[H[i]]);else if(H[i])for(var G=0;G<H[i].length;G++){var X=U[H[i][G]];X&&T.push(X)}else H.helperType&&U[H.helperType]?T.push(U[H.helperType]):U[H.name]&&T.push(U[H.name]);for(var ie=0;ie<U._global.length;ie++){var se=U._global[ie];se.pred(H,this)&&Q(T,se.val)==-1&&T.push(se.val)}return T},getStateAfter:function(r,i){var T=this.doc;return r=fr(T,r==null?T.first+T.size-1:r),pt(this,r+1,i).state},cursorCoords:function(r,i){var T,U=this.doc.sel.primary();return r==null?T=U.head:typeof r=="object"?T=st(this.doc,r):T=r?U.from():U.to(),cn(this,T,i||"page")},charCoords:function(r,i){return la(this,st(this.doc,r),i||"page")},coordsChar:function(r,i){return r=no(this,r,i||"page"),da(this,r.left,r.top)},lineAtHeight:function(r,i){return r=no(this,{top:r,left:0},i||"page").top,yt(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,T){var U=!1,H;if(typeof r=="number"){var G=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>G&&(r=G,U=!0),H=Ke(this.doc,r)}else H=r;return Ui(this,H,{top:0,left:0},i||"page",T||U).top+(U?this.doc.height-er(H):0)},defaultTextHeight:function(){return Vn(this.display)},defaultCharWidth:function(){return Xn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,T,U,H){var G=this.display;r=cn(this,st(this.doc,r));var X=r.bottom,ie=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),G.sizer.appendChild(i),U=="over")X=r.top;else if(U=="above"||U=="near"){var se=Math.max(G.wrapper.clientHeight,this.doc.height),ve=Math.max(G.sizer.clientWidth,G.lineSpace.clientWidth);(U=="above"||r.bottom+i.offsetHeight>se)&&r.top>i.offsetHeight?X=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=se&&(X=r.bottom),ie+i.offsetWidth>ve&&(ie=ve-i.offsetWidth)}i.style.top=X+"px",i.style.left=i.style.right="",H=="right"?(ie=G.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(H=="left"?ie=0:H=="middle"&&(ie=(G.sizer.clientWidth-i.offsetWidth)/2),i.style.left=ie+"px"),T&&Js(this,{left:ie,top:X,right:ie+i.offsetWidth,bottom:X+i.offsetHeight})},triggerOnKeyDown:Vr(us),triggerOnKeyPress:Vr(cs),triggerOnKeyUp:ds,triggerOnMouseDown:Vr(fs),execCommand:function(r){if(Li.hasOwnProperty(r))return Li[r].call(null,this)},triggerElectric:Vr(function(r){bs(this,r)}),findPosH:function(r,i,T,U){var H=1;i<0&&(H=-1,i=-i);for(var G=st(this.doc,r),X=0;X<i&&!(G=Fa(this.doc,G,H,T,U),G.hitSide);++X);return G},moveH:Vr(function(r,i){var T=this;this.extendSelectionsBy(function(U){return T.display.shift||T.doc.extend||U.empty()?Fa(T.doc,U.head,r,i,T.options.rtlMoveVisually):r<0?U.from():U.to()},pe)}),deleteH:Vr(function(r,i){var T=this.doc.sel,U=this.doc;T.somethingSelected()?U.replaceSelection("",null,"+delete"):ni(this,function(H){var G=Fa(U,H.head,r,i,!1);return r<0?{from:G,to:H.head}:{from:H.head,to:G}})}),findPosV:function(r,i,T,U){var H=1,G=U;i<0&&(H=-1,i=-i);for(var X=st(this.doc,r),ie=0;ie<i;++ie){var se=cn(this,X,"div");if(G==null?G=se.left:se.left=G,X=_s(this,se,H,T),X.hitSide)break}return X},moveV:Vr(function(r,i){var T=this,U=this.doc,H=[],G=!this.display.shift&&!U.extend&&U.sel.somethingSelected();if(U.extendSelectionsBy(function(ie){if(G)return r<0?ie.from():ie.to();var se=cn(T,ie.head,"div");ie.goalColumn!=null&&(se.left=ie.goalColumn),H.push(se.left);var ve=_s(T,se,r,i);return i=="page"&&ie==U.sel.primary()&&ya(T,la(T,ve,"div").top-se.top),ve},pe),H.length)for(var X=0;X<U.sel.ranges.length;X++)U.sel.ranges[X].goalColumn=H[X]}),findWordAt:function(r){var i=this.doc,T=Ke(i,r.line).text,U=r.ch,H=r.ch;if(T){var G=this.getHelper(r,"wordChars");(r.sticky=="before"||H==T.length)&&U?--U:++H;for(var X=T.charAt(U),ie=Fe(X,G)?function(se){return Fe(se,G)}:/\s/.test(X)?function(se){return/\s/.test(se)}:function(se){return!/\s/.test(se)&&!Fe(se)};U>0&&ie(T.charAt(U-1));)--U;for(;H<T.length&&ie(T.charAt(H));)++H}return new tr(_e(r.line,U),_e(r.line,H))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?N(this.display.cursorDiv,"CodeMirror-overwrite"):p(this.display.cursorDiv,"CodeMirror-overwrite"),xe(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==D()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Vr(function(r,i){hi(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-pn(this)-this.display.barHeight,width:r.scrollWidth-pn(this)-this.display.barWidth,clientHeight:aa(this),clientWidth:On(this)}},scrollIntoView:Vr(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:_e(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?Qs(this,r):po(this,r.from,r.to,r.margin)}),setSize:Vr(function(r,i){var T=this,U=function(G){return typeof G=="number"||/^\d+$/.test(String(G))?G+"px":G};r!=null&&(this.display.wrapper.style.width=U(r)),i!=null&&(this.display.wrapper.style.height=U(i)),this.options.lineWrapping&&eo(this);var H=this.display.viewFrom;this.doc.iter(H,this.display.viewTo,function(G){if(G.widgets){for(var X=0;X<G.widgets.length;X++)if(G.widgets[X].noHScroll){Tn(T,H,"widget");break}}++H}),this.curOp.forceUpdate=!0,xe(this,"refresh",this)}),operation:function(r){return en(this,r)},startOperation:function(){return Nn(this)},endOperation:function(){return Fn(this)},refresh:Vr(function(){var r=this.display.cachedTextHeight;Yr(this),this.curOp.forceUpdate=!0,ci(this),hi(this,this.doc.scrollLeft,this.doc.scrollTop),xa(this.display),(r==null||Math.abs(r-Vn(this.display))>.5||this.options.lineWrapping)&&ma(this),xe(this,"refresh",this)}),swapDoc:Vr(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Do(this,r),ci(this),this.display.input.reset(),hi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Br(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,T){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=T},e.registerGlobalHelper=function(r,i,T,U){e.registerHelper(r,i,U),n[r]._global.push({pred:T,val:U})}}function Fa(e,t,n,r,i){var T=t,U=n,H=Ke(e,t.line),G=i&&e.direction=="rtl"?-n:n;function X(){var it=t.line+G;return it<e.first||it>=e.first+e.size?!1:(t=new _e(it,t.ch,t.sticky),H=Ke(e,it))}function ie(it){var Ve;if(r=="codepoint"){var lt=H.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(lt)?Ve=null:Ve=new _e(t.line,Math.max(0,Math.min(H.text.length,t.ch+n*(lt>=55296&<<56320?2:1))),-n)}else i?Ve=Ml(e.cm,H,t,n):Ve=Oa(H,t,n);if(Ve==null)if(!it&&X())t=Pa(i,e.cm,H,t.line,G);else return!1;else t=Ve;return!0}if(r=="char"||r=="codepoint")ie();else if(r=="column")ie(!0);else if(r=="word"||r=="group")for(var se=null,ve=r=="group",he=e.cm&&e.cm.getHelper(t,"wordChars"),we=!0;!(n<0&&!ie(!we));we=!1){var ke=H.text.charAt(t.ch)||`
|
|
`,je=Fe(ke,he)?"w":ve&&ke==`
|
|
`?"n":!ve||/\s/.test(ke)?null:"p";if(ve&&!we&&!je&&(je="s"),se&&se!=je){n<0&&(n=1,ie(),t.sticky="after");break}if(je&&(se=je),n>0&&!ie(!we))break}var Ge=$i(e,t,T,U,!0);return Ie(T,Ge)&&(Ge.hitSide=!0),Ge}function _s(e,t,n,r){var i=e.doc,T=t.left,U;if(r=="page"){var H=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),G=Math.max(H-.5*Vn(e.display),3);U=(n>0?t.bottom:t.top)+n*G}else r=="line"&&(U=n>0?t.bottom+3:t.top-3);for(var X;!(X=da(e,T,U),!X.outside);){if(n<0?U<=0:U>=i.height){X.hitSide=!0;break}U+=n*5}return X}var nr=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Y,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};nr.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;xs(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function T(H){for(var G=H.target;G;G=G.parentNode){if(G==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(G.className))break}return!1}Ee(i,"paste",function(H){if(!T(H)||Ne(r,H)||ys(H,r))return;k<=11&&setTimeout(Mr(r,function(){return t.updateFromDOM()}),20)}),Ee(i,"compositionstart",function(H){t.composing={data:H.data,done:!1}}),Ee(i,"compositionupdate",function(H){t.composing||(t.composing={data:H.data,done:!1})}),Ee(i,"compositionend",function(H){t.composing&&(H.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ee(i,"touchstart",function(){return n.forceCompositionEnd()}),Ee(i,"input",function(){t.composing||t.readFromDOMSoon()});function U(H){if(!T(H)||Ne(r,H))return;if(r.somethingSelected())ea({lineWise:!1,text:r.getSelections()}),H.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var G=Es(r);ea({lineWise:!0,text:G.text}),H.type=="cut"&&r.operation(function(){r.setSelections(G.ranges,0,ce),r.replaceSelection("",null,"cut")})}else return;if(H.clipboardData){H.clipboardData.clearData();var X=hn.text.join(`
|
|
`);if(H.clipboardData.setData("Text",X),H.clipboardData.getData("Text")==X){H.preventDefault();return}}var ie=Ts(),se=ie.firstChild;r.display.lineSpace.insertBefore(ie,r.display.lineSpace.firstChild),se.value=hn.text.join(`
|
|
`);var ve=document.activeElement;z(se),setTimeout(function(){r.display.lineSpace.removeChild(ie),ve.focus(),ve==i&&n.showPrimarySelection()},50)}Ee(i,"copy",U),Ee(i,"cut",U)},nr.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},nr.prototype.prepareSelection=function(){var e=uo(this.cm,!1);return e.focus=document.activeElement==this.div,e},nr.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},nr.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},nr.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var T=ta(t,e.anchorNode,e.anchorOffset),U=ta(t,e.focusNode,e.focusOffset);if(T&&!T.bad&&U&&!U.bad&&tt(rr(T,U),r)==0&&tt(yr(T,U),i)==0)return;var H=t.display.view,G=r.line>=t.display.viewFrom&&Ss(t,r)||{node:H[0].measure.map[2],offset:0},X=i.line<t.display.viewTo&&Ss(t,i);if(!X){var ie=H[H.length-1].measure,se=ie.maps?ie.maps[ie.maps.length-1]:ie.map;X={node:se[se.length-1],offset:se[se.length-2]-se[se.length-3]}}if(!G||!X){e.removeAllRanges();return}var ve=e.rangeCount&&e.getRangeAt(0),he;try{he=o(G.node,G.offset,X.offset,X.node)}catch(we){}he&&(!L&&t.state.focused?(e.collapse(G.node,G.offset),he.collapsed||(e.removeAllRanges(),e.addRange(he))):(e.removeAllRanges(),e.addRange(he)),ve&&e.anchorNode==null?e.addRange(ve):L&&this.startGracePeriod()),this.rememberSelection()},nr.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)},nr.prototype.showMultipleSelections=function(e){l(this.cm.display.cursorDiv,e.cursors),l(this.cm.display.selectionDiv,e.selection)},nr.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},nr.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return v(this.div,t)},nr.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},nr.prototype.blur=function(){this.div.blur()},nr.prototype.getField=function(){return this.div},nr.prototype.supportsTouch=function(){return!0},nr.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():en(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)},nr.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},nr.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(d&&x&&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=ta(t,e.anchorNode,e.anchorOffset),r=ta(t,e.focusNode,e.focusOffset);n&&r&&en(t,function(){Kr(t.doc,Sn(n,r),ce),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},nr.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=_e(r.line-1,Ke(e.doc,r.line-1).length)),i.ch==Ke(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=_e(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var T,U,H;r.line==t.viewFrom||(T=Mn(e,r.line))==0?(U=ct(t.view[0].line),H=t.view[0].node):(U=ct(t.view[T].line),H=t.view[T-1].node.nextSibling);var G=Mn(e,i.line),X,ie;if(G==t.view.length-1?(X=t.viewTo-1,ie=t.lineDiv.lastChild):(X=ct(t.view[G+1].line)-1,ie=t.view[G+1].node.previousSibling),!H)return!1;for(var se=e.doc.splitLines(tu(e,H,ie,U,X)),ve=ar(e.doc,_e(U,0),_e(X,Ke(e.doc,X).text.length));se.length>1&&ve.length>1;)if(ye(se)==ye(ve))se.pop(),ve.pop(),X--;else if(se[0]==ve[0])se.shift(),ve.shift(),U++;else break;for(var he=0,we=0,ke=se[0],je=ve[0],Ge=Math.min(ke.length,je.length);he<Ge&&ke.charCodeAt(he)==je.charCodeAt(he);)++he;for(var it=ye(se),Ve=ye(ve),lt=Math.min(it.length-(se.length==1?he:0),Ve.length-(ve.length==1?he:0));we<lt&&it.charCodeAt(it.length-we-1)==Ve.charCodeAt(Ve.length-we-1);)++we;if(se.length==1&&ve.length==1&&U==r.line)for(;he&&he>r.ch&&it.charCodeAt(it.length-we-1)==Ve.charCodeAt(Ve.length-we-1);)he--,we++;se[se.length-1]=it.slice(0,it.length-we).replace(/^\u200b+/,""),se[0]=se[0].slice(he).replace(/\u200b+$/,"");var Lt=_e(U,he),bt=_e(X,ve.length?ye(ve).length-we:0);if(se.length>1||se[0]||tt(Lt,bt))return ei(e.doc,se,Lt,bt,"+input"),!0},nr.prototype.ensurePolled=function(){this.forceCompositionEnd()},nr.prototype.reset=function(){this.forceCompositionEnd()},nr.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},nr.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)},nr.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&en(this.cm,function(){return Yr(e.cm)})},nr.prototype.setUneditable=function(e){e.contentEditable="false"},nr.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Mr(this.cm,Na)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},nr.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},nr.prototype.onContextMenu=function(){},nr.prototype.resetPosition=function(){},nr.prototype.needsContentAttribute=!0;function Ss(e,t){var n=oa(e,t.line);if(!n||n.hidden)return null;var r=Ke(e.doc,t.line),i=Ya(n,r,t.line),T=Qe(r,e.doc.direction),U="left";if(T){var H=Xe(T,t.ch);U=H%2?"right":"left"}var G=Za(i.map,t.ch,U);return G.offset=G.collapse=="right"?G.end:G.start,G}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function ai(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var T="",U=!1,H=e.doc.lineSeparator(),G=!1;function X(he){return function(we){return we.id==he}}function ie(){U&&(T+=H,G&&(T+=H),U=G=!1)}function se(he){he&&(ie(),T+=he)}function ve(he){if(he.nodeType==1){var we=he.getAttribute("cm-text");if(we){se(we);return}var ke=he.getAttribute("cm-marker"),je;if(ke){var Ge=e.findMarks(_e(r,0),_e(i+1,0),X(+ke));Ge.length&&(je=Ge[0].find(0))&&se(ar(e.doc,je.from,je.to).join(H));return}if(he.getAttribute("contenteditable")=="false")return;var it=/^(pre|div|p|li|table|br)$/i.test(he.nodeName);if(!/^br$/i.test(he.nodeName)&&he.textContent.length==0)return;it&&ie();for(var Ve=0;Ve<he.childNodes.length;Ve++)ve(he.childNodes[Ve]);/^(pre|p)$/i.test(he.nodeName)&&(G=!0),it&&(U=!0)}else he.nodeType==3&&se(he.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(ve(t),t==n);)t=t.nextSibling,G=!1;return T}function ta(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return ai(e.clipPos(_e(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var T=e.display.view[i];if(T.node==r)return ru(T,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!v(r,t))return ai(_e(ct(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var T=e.rest?ye(e.rest):e.line;return ai(_e(ct(T),T.text.length),i)}var U=t.nodeType==3?t:null,H=t;for(!U&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(U=t.firstChild,n&&(n=U.nodeValue.length));H.parentNode!=r;)H=H.parentNode;var G=e.measure,X=G.maps;function ie(je,Ge,it){for(var Ve=-1;Ve<(X?X.length:0);Ve++)for(var lt=Ve<0?G.map:X[Ve],Lt=0;Lt<lt.length;Lt+=3){var bt=lt[Lt+2];if(bt==je||bt==Ge){var Ht=ct(Ve<0?e.line:e.rest[Ve]),dr=lt[Lt]+it;return(it<0||bt!=je)&&(dr=lt[Lt+(it?1:0)]),_e(Ht,dr)}}}var se=ie(U,H,n);if(se)return ai(se,i);for(var ve=H.nextSibling,he=U?U.nodeValue.length-n:0;ve;ve=ve.nextSibling){if(se=ie(ve,ve.firstChild,0),se)return ai(_e(se.line,se.ch-he),i);he+=ve.textContent.length}for(var we=H.previousSibling,ke=n;we;we=we.previousSibling){if(se=ie(we,we.firstChild,-1),se)return ai(_e(se.line,se.ch+ke),i);ke+=we.textContent.length}}var Cr=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Y,this.hasSelection=!1,this.composing=null};Cr.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"),Ee(i,"input",function(){j&&k>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Ee(i,"paste",function(U){if(Ne(r,U)||ys(U,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function T(U){if(Ne(r,U))return;if(r.somethingSelected())ea({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var H=Es(r);ea({lineWise:!0,text:H.text}),U.type=="cut"?r.setSelections(H.ranges,null,ce):(n.prevInput="",i.value=H.text.join(`
|
|
`),z(i))}else return;U.type=="cut"&&(r.state.cutIncoming=+new Date)}Ee(i,"cut",T),Ee(i,"copy",T),Ee(e.scroller,"paste",function(U){if(yn(e,U)||Ne(r,U))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var H=new Event("paste");H.clipboardData=U.clipboardData,i.dispatchEvent(H)}),Ee(e.lineSpace,"selectstart",function(U){yn(e,U)||$(U)}),Ee(i,"compositionstart",function(){var U=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:U,range:r.markText(U,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Ee(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Cr.prototype.createField=function(e){this.wrapper=Ts(),this.textarea=this.wrapper.firstChild},Cr.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Cr.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=uo(e);if(e.options.moveInputWithCursor){var i=cn(e,n.sel.primary().head,"div"),T=t.wrapper.getBoundingClientRect(),U=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+U.top-T.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+U.left-T.left))}return r},Cr.prototype.showSelection=function(e){var t=this.cm,n=t.display;l(n.cursorDiv,e.cursors),l(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Cr.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&&z(this.textarea),j&&k>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",j&&k>=9&&(this.hasSelection=null))},Cr.prototype.getField=function(){return this.textarea},Cr.prototype.supportsTouch=function(){return!1},Cr.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!s||D()!=this.textarea))try{this.textarea.focus()}catch(e){}},Cr.prototype.blur=function(){this.textarea.blur()},Cr.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Cr.prototype.receivedFocus=function(){this.slowPoll()},Cr.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()})},Cr.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)},Cr.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||De(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(j&&k>=9&&this.hasSelection===i||u&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var T=i.charCodeAt(0);if(T==8203&&!r&&(r="\u200B"),T==8666)return this.reset(),this.cm.execCommand("undo")}for(var U=0,H=Math.min(r.length,i.length);U<H&&r.charCodeAt(U)==i.charCodeAt(U);)++U;return en(t,function(){Na(t,i.slice(U),r.length-U,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},Cr.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Cr.prototype.onKeyPress=function(){j&&k>=9&&(this.hasSelection=null),this.fastPoll()},Cr.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var T=kn(n,e),U=r.scroller.scrollTop;if(!T||A)return;var H=n.options.resetSelectionOnContextMenu;H&&n.doc.sel.contains(T)==-1&&Mr(n,Kr)(n.doc,Sn(T),ce);var G=i.style.cssText,X=t.wrapper.style.cssText,ie=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-ie.top-5)+"px; left: "+(e.clientX-ie.left-5)+`px;
|
|
z-index: 1000; background: `+(j?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var se;C&&(se=window.scrollY),r.input.focus(),C&&window.scrollTo(null,se),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=he,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function ve(){if(i.selectionStart!=null){var ke=n.somethingSelected(),je="\u200B"+(ke?i.value:"");i.value="\u21DA",i.value=je,t.prevInput=ke?"":"\u200B",i.selectionStart=1,i.selectionEnd=je.length,r.selForContextMenu=n.doc.sel}}function he(){if(t.contextMenuPending!=he)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=X,i.style.cssText=G,j&&k<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=U),i.selectionStart!=null){(!j||j&&k<9)&&ve();var ke=0,je=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Mr(n,Ho)(n):ke++<10?r.detectingSelectAll=setTimeout(je,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(je,200)}}if(j&&k>=9&&ve(),w){te(e);var we=function(){Ze(window,"mouseup",we),setTimeout(he,20)};Ee(window,"mouseup",we)}else setTimeout(he,50)},Cr.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Cr.prototype.setUneditable=function(){},Cr.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?I(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=D();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=H.getValue()}var i;if(e.form&&(Ee(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var T=e.form;i=T.submit;try{var U=T.submit=function(){r(),T.submit=i,T.submit(),T.submit=U}}catch(G){}}t.finishInit=function(G){G.save=r,G.getTextArea=function(){return e},G.toTextArea=function(){G.toTextArea=isNaN,r(),e.parentNode.removeChild(G.getWrapperElement()),e.style.display="",e.form&&(Ze(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var H=Er(function(G){return e.parentNode.insertBefore(G,e.nextSibling)},t);return H}function iu(e){e.off=Ze,e.on=Ee,e.wheelEventPixels=cl,e.Doc=Jr,e.splitLines=et,e.countColumn=B,e.findColumn=ue,e.isWordChar=Le,e.Pass=fe,e.signal=xe,e.Line=ur,e.changeEnd=wn,e.scrollbarModel=yo,e.Pos=_e,e.cmpPos=tt,e.modes=$t,e.mimeModes=ut,e.resolveMode=Te,e.getMode=gr,e.modeExtensions=Jt,e.extendMode=cr,e.copyState=Et,e.startState=sr,e.innerMode=Vt,e.commands=Li,e.keyMap=bn,e.keyName=is,e.isModifierKey=rs,e.lookupKey=ri,e.normalizeKeyMap=kl,e.StringStream=Dt,e.SharedTextMarker=wi,e.TextMarker=An,e.LineWidget=Si,e.e_preventDefault=$,e.e_stopPropagation=J,e.e_stop=te,e.addClass=N,e.contains=v,e.rmClass=p,e.keyNames=Ln}Yl(Er),ql(Er);var au="iter insert remove copy getEditor constructor".split(" ");for(var ra in Jr.prototype)Jr.prototype.hasOwnProperty(ra)&&Q(au,ra)<0&&(Er.prototype[ra]=function(e){return function(){return e.apply(this.doc,arguments)}}(Jr.prototype[ra]));return ae(Jr),Er.inputStyles={textarea:Cr,contenteditable:nr},Er.defineMode=function(e){!Er.defaults.mode&&e!="null"&&(Er.defaults.mode=e),ze.apply(this,arguments)},Er.defineMIME=Fr,Er.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Er.defineMIME("text/plain","null"),Er.defineExtension=function(e,t){Er.prototype[e]=t},Er.defineDocExtension=function(e,t){Jr.prototype[e]=t},Er.fromTextArea=nu,iu(Er),Er.version="5.58.2",Er})},Y1PL:function(Rt,rt,Z){"use strict";Z.r(rt),Z.d(rt,"ResizableTextArea",function(){return Q});var re=Z("wx14"),V=Z("1OyB"),L=Z("vuIU"),K=Z("Ji7U"),M=Z("LK+K"),P=Z("q1tI"),j=Z("VTBJ"),k=Z("rePB"),C=Z("Zm9Q"),R=Z("Kwbf"),x=Z("c+Xe"),A=Z("m+aA"),O=Z("bdgK"),S=new Map;function _(ce){ce.forEach(function(ge){var pe,ue=ge.target;(pe=S.get(ue))===null||pe===void 0||pe.forEach(function(le){return le(ue)})})}var b=new O.default(_),d=null,s=null;function u(ce,ge){S.has(ce)||(S.set(ce,new Set),b.observe(ce)),S.get(ce).add(ge)}function h(ce,ge){S.has(ce)&&(S.get(ce).delete(ge),S.get(ce).size||(b.unobserve(ce),S.delete(ce)))}var E=function(ce){Object(K.a)(pe,ce);var ge=Object(M.a)(pe);function pe(){return Object(V.a)(this,pe),ge.apply(this,arguments)}return Object(L.a)(pe,[{key:"render",value:function(){return this.props.children}}]),pe}(P.Component),m=P.createContext(null);function g(ce){var ge=ce.children,pe=ce.onBatchResize,ue=P.useRef(0),le=P.useRef([]),de=P.useContext(m),ye=P.useCallback(function(Me,Ue,Re){ue.current+=1;var Oe=ue.current;le.current.push({size:Me,element:Ue,data:Re}),Promise.resolve().then(function(){Oe===ue.current&&(pe==null||pe(le.current),le.current=[])}),de==null||de(Me,Ue,Re)},[pe,de]);return P.createElement(m.Provider,{value:ye},ge)}function w(ce){var ge=ce.children,pe=ce.disabled,ue=P.useRef(null),le=P.useRef(null),de=P.useContext(m),ye=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Me=P.isValidElement(ge)&&Object(x.c)(ge),Ue=Me?ge.ref:null,Re=P.useMemo(function(){return Object(x.a)(Ue,ue)},[Ue,ue]),Oe=P.useRef(ce);Oe.current=ce;var Ce=P.useCallback(function(Le){var Fe=Oe.current,We=Fe.onResize,Be=Fe.data,Ae=Le.getBoundingClientRect(),Se=Ae.width,$e=Ae.height,qe=Le.offsetWidth,Je=Le.offsetHeight,Xe=Math.floor(Se),ot=Math.floor($e);if(ye.current.width!==Xe||ye.current.height!==ot||ye.current.offsetWidth!==qe||ye.current.offsetHeight!==Je){var Qe={width:Xe,height:ot,offsetWidth:qe,offsetHeight:Je};ye.current=Qe;var Ye=qe===Math.round(Se)?Se:qe,Ee=Je===Math.round($e)?$e:Je,nt=Object(j.a)(Object(j.a)({},Qe),{},{offsetWidth:Ye,offsetHeight:Ee});de==null||de(nt,Le,Be),We&&Promise.resolve().then(function(){We(nt,Le)})}},[]);return P.useEffect(function(){var Le=Object(A.a)(ue.current)||Object(A.a)(le.current);return Le&&!pe&&u(Le,Ce),function(){return h(Le,Ce)}},[ue.current,pe]),P.createElement(E,{ref:le},Me?P.cloneElement(ge,{ref:Re}):ge)}var y="rc-observer-key";function p(ce){var ge=ce.children,pe=Object(C.a)(ge);return pe.map(function(ue,le){var de=(ue==null?void 0:ue.key)||"".concat(y,"-").concat(le);return P.createElement(w,Object(re.a)({},ce,{key:de}),ue)})}p.Collection=g;var c=p,l=Z("bT9E"),a=Z("TSYQ"),f=Z.n(a),o=`
|
|
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"],D={},N;function W(ce){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,pe=ce.getAttribute("id")||ce.getAttribute("data-reactid")||ce.getAttribute("name");if(ge&&D[pe])return D[pe];var ue=window.getComputedStyle(ce),le=ue.getPropertyValue("box-sizing")||ue.getPropertyValue("-moz-box-sizing")||ue.getPropertyValue("-webkit-box-sizing"),de=parseFloat(ue.getPropertyValue("padding-bottom"))+parseFloat(ue.getPropertyValue("padding-top")),ye=parseFloat(ue.getPropertyValue("border-bottom-width"))+parseFloat(ue.getPropertyValue("border-top-width")),Me=v.map(function(Re){return"".concat(Re,":").concat(ue.getPropertyValue(Re))}).join(";"),Ue={sizingStyle:Me,paddingSize:de,borderSize:ye,boxSizing:le};return ge&&pe&&(D[pe]=Ue),Ue}function z(ce){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,pe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,ue=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;N||(N=document.createElement("textarea"),N.setAttribute("tab-index","-1"),N.setAttribute("aria-hidden","true"),document.body.appendChild(N)),ce.getAttribute("wrap")?N.setAttribute("wrap",ce.getAttribute("wrap")):N.removeAttribute("wrap");var le=W(ce,ge),de=le.paddingSize,ye=le.borderSize,Me=le.boxSizing,Ue=le.sizingStyle;N.setAttribute("style","".concat(Ue,";").concat(o)),N.value=ce.value||ce.placeholder||"";var Re=Number.MIN_SAFE_INTEGER,Oe=Number.MAX_SAFE_INTEGER,Ce=N.scrollHeight,Le;if(Me==="border-box"?Ce+=ye:Me==="content-box"&&(Ce-=de),pe!==null||ue!==null){N.value=" ";var Fe=N.scrollHeight-de;pe!==null&&(Re=Fe*pe,Me==="border-box"&&(Re=Re+de+ye),Ce=Math.max(Re,Ce)),ue!==null&&(Oe=Fe*ue,Me==="border-box"&&(Oe=Oe+de+ye),Le=Ce>Oe?"":"hidden",Ce=Math.min(Oe,Ce))}return{height:Ce,minHeight:Re,maxHeight:Oe,overflowY:Le,resize:"none"}}var F=Z("Gytx"),I=Z.n(F),B;(function(ce){ce[ce.NONE=0]="NONE",ce[ce.RESIZING=1]="RESIZING",ce[ce.RESIZED=2]="RESIZED"})(B||(B={}));var Y=function(ce){Object(K.a)(pe,ce);var ge=Object(M.a)(pe);function pe(ue){var le;return Object(V.a)(this,pe),le=ge.call(this,ue),le.nextFrameActionId=void 0,le.resizeFrameId=void 0,le.textArea=void 0,le.saveTextArea=function(de){le.textArea=de},le.handleResize=function(de){var ye=le.state.resizeStatus,Me=le.props,Ue=Me.autoSize,Re=Me.onResize;if(ye!==B.NONE)return;typeof Re=="function"&&Re(de),Ue&&le.resizeOnNextFrame()},le.resizeOnNextFrame=function(){cancelAnimationFrame(le.nextFrameActionId),le.nextFrameActionId=requestAnimationFrame(le.resizeTextarea)},le.resizeTextarea=function(){var de=le.props.autoSize;if(!de||!le.textArea)return;var ye=de.minRows,Me=de.maxRows,Ue=z(le.textArea,!1,ye,Me);le.setState({textareaStyles:Ue,resizeStatus:B.RESIZING},function(){cancelAnimationFrame(le.resizeFrameId),le.resizeFrameId=requestAnimationFrame(function(){le.setState({resizeStatus:B.RESIZED},function(){le.resizeFrameId=requestAnimationFrame(function(){le.setState({resizeStatus:B.NONE}),le.fixFirefoxAutoScroll()})})})})},le.renderTextArea=function(){var de=le.props,ye=de.prefixCls,Me=ye===void 0?"rc-textarea":ye,Ue=de.autoSize,Re=de.onResize,Oe=de.className,Ce=de.disabled,Le=le.state,Fe=Le.textareaStyles,We=Le.resizeStatus,Be=Object(l.a)(le.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ae=f()(Me,Oe,Object(k.a)({},"".concat(Me,"-disabled"),Ce));"value"in Be&&(Be.value=Be.value||"");var Se=Object(j.a)(Object(j.a)(Object(j.a)({},le.props.style),Fe),We===B.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(c,{onResize:le.handleResize,disabled:!(Ue||Re)},P.createElement("textarea",Object(re.a)({},Be,{className:Ae,style:Se,ref:le.saveTextArea})))},le.state={textareaStyles:{},resizeStatus:B.NONE},le}return Object(L.a)(pe,[{key:"componentDidUpdate",value:function(le){(le.value!==this.props.value||!I()(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,de=this.textArea.selectionEnd;this.textArea.setSelectionRange(le,de)}}catch(ye){}}},{key:"render",value:function(){return this.renderTextArea()}}]),pe}(P.Component),Q=Y,ee=function(ce){Object(K.a)(pe,ce);var ge=Object(M.a)(pe);function pe(ue){var le;Object(V.a)(this,pe),le=ge.call(this,ue),le.resizableTextArea=void 0,le.focus=function(){le.resizableTextArea.textArea.focus()},le.saveTextArea=function(ye){le.resizableTextArea=ye},le.handleChange=function(ye){var Me=le.props.onChange;le.setValue(ye.target.value,function(){le.resizableTextArea.resizeTextarea()}),Me&&Me(ye)},le.handleKeyDown=function(ye){var Me=le.props,Ue=Me.onPressEnter,Re=Me.onKeyDown;ye.keyCode===13&&Ue&&Ue(ye),Re&&Re(ye)};var de=typeof ue.value=="undefined"||ue.value===null?ue.defaultValue:ue.value;return le.state={value:de},le}return Object(L.a)(pe,[{key:"setValue",value:function(le,de){"value"in this.props||this.setState({value:le},de)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(Q,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}}]),pe}(P.Component),fe=rt.default=ee},ZW9T:function(Rt,rt,Z){"use strict";Z.d(rt,"a",function(){return E});var re=Z("k1fw"),V=Z("miYZ"),L=Z("tsqr"),K=Z("rAM+"),M=Z("tJVT"),P=Z("PpiC"),j=Z("q1tI"),k=Z.n(j),C=Z("bdgK");function R(m,g,w,y,p){var c=g.getWordUntilPosition(w),l={startLineNumber:w.lineNumber,endLineNumber:w.lineNumber,startColumn:c.startColumn,endColumn:c.endColumn},a=y.map(function(f){return{label:f,kind:m.languages.CompletionItemKind.Keyword,insertText:f,insertTextRules:m.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:l}});return p.map(function(f){a.push(Object(re.a)(Object(re.a)({},f),{},{range:l}))}),a}var x=function(m){var g={label:"ifelse",kind:m.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:m.languages.CompletionItemInsertTextRule.InsertAsSnippet},w=["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"];m.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(l,a){var f=R(m,l,a,w,[g]);return{suggestions:f}}});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"];m.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(l,a){var f=[{label:"print",kind:m.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:m.languages.CompletionItemInsertTextRule.InsertAsSnippet}],o=R(m,l,a,y,f);return{suggestions:o}}});var p=["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"];m.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(l,a){var f=[g,{label:"main",kind:m.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`),insertTextRules:m.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:m.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
|
|
`),insertTextRules:m.languages.CompletionItemInsertTextRule.InsertAsSnippet}],o=R(m,l,a,p,f);return{suggestions:o}}})},A="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",O=Z("LvDl");function S(m){return/^\d+$/.test(m)?"".concat(m,"px"):m}function _(){}var b=!1,d={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function s(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],g=m;if(Array.isArray(m)){for(var w=0;w<m.length;w++){var y=d[m[w]];if(y)return y}return g[0]}return d[g]||g}var u=null,h=rt.b=function(m){var g=m.width,w=g===void 0?"100%":g,y=m.height,p=y===void 0?"100%":y,c=m.value,l=m.language,a=l===void 0?"javascript":l,f=m.style,o=f===void 0?{}:f,v=m.options,D=v===void 0?{}:v,N=m.overrideServices,W=N===void 0?{}:N,z=m.theme,F=z===void 0?"vs-dark":z,I=m.onEditBlur,B=m.onSave,Y=m.autoHeight,Q=Y===void 0?!1:Y,ee=m.forbidCopy,fe=ee===void 0?!1:ee,ce=m.onChange,ge=ce===void 0?_:ce,pe=m.editorDidMount,ue=pe===void 0?_:pe,le=m.onFocus,de=le===void 0?_:le,ye=m.filename,Me=ye===void 0?"educoder.txt":ye,Ue=Object(P.a)(m,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),Re=Object(j.useRef)(),Oe=Object(j.useRef)({}),Ce=Object(j.useRef)(),Le=Object(j.useRef)(!1),Fe=Object(j.useRef)(),We=Object(j.useState)(!1),Be=Object(M.a)(We,2),Ae=Be[0],Se=Be[1];function $e(){var q;return Re.current&&(q=new C.default(function(te){var me=Object(K.a)(te),be;try{for(me.s();!(be=me.n()).done;){var Pe=be.value;(Pe.target.offsetHeight>0||Pe.target.offsetWidth>0)&&Oe.current.instance.layout()}}catch(gt){me.e(gt)}finally{me.f()}}),q.observe(Re.current)),q}function qe(){L.b.warn(decodeURIComponent(A))}var Je=function(){var te=Oe.current.instance;if(c!=null&&te&&Ae){var me=te.getModel();me&&c!==me.getValue()&&(b=!0,me.setValue(c),te.layout(),b=!1)}};Object(j.useEffect)(function(){Ce.current&&clearTimeout(Ce.current),Ce.current=setTimeout(function(){Je()},500)},[c,Ae,Oe.current]);function Xe(){var q=Oe.current.instance;if(q){var te=q.getSelection(),me=Oe.current.pastePos||{},be=new u.Range(me.startLineNumber||te.endLineNumber,me.startColumn||te.endColumn,me.endLineNumber||te.endLineNumber,me.endColumn||te.endColumn);setTimeout(function(){q.executeEdits("",[{range:be,text:""}])},300)}}function ot(q){(window.navigator.platform.match("Mac")?q.metaKey:q.ctrlKey)&&q.keyCode==83&&(q.preventDefault(),B())}var Qe=function(){if(Q&&Oe.current.instance){var te=Oe.current.instance.getContentHeight();$(te<p?p:te)}else $(p)};function Ye(q){var te=document.createEvent("MouseEvents");te.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),q.dispatchEvent(te)}function Ee(q,te){var me=window.URL||window.webkitURL||window,be=new Blob([te]),Pe=document.createElementNS("http://www.w3.org/1999/xhtml","a");Pe.href=me.createObjectURL(be),Pe.download=q,Ye(Pe)}Object(j.useEffect)(function(){Qe()},[Qe]),Object(j.useEffect)(function(){Re.current&&!Ae&&Z.e(27).then(Z.t.bind(null,"M/lh",7)).then(function(q){try{u=q,Oe.current.instance=u.editor.create(Re.current,{value:c,language:s(a),theme:F,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},W);var te=Oe.current.instance;if(ue(te,u),setTimeout(function(){Qe(),Oe.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Ee(Me||"educoder.txt",te.getValue())}})},500),Oe.current.subscription=te.onDidChangeModelContent(function(be){Le.current?clearTimeout(Fe.current):(Qe(),ge(te.getValue(),be)),Fe.current=setTimeout(function(){Le.current=!1},500)}),window.Monaco||x(u),fe&&(te.addCommand(u.KeyMod.CtrlCmd|u.KeyMod.Shift|u.KeyCode.KEY_V,function(){return qe(),null}),te.addCommand(u.KeyMod.CtrlCmd|u.KeyCode.KEY_C,function(){return qe(),null})),window.Monaco=u,I&&te.onDidBlurEditorWidget(function(){I(te.getValue())}),de&&te.onDidFocusEditorText(function(){de(te.getValue())}),fe){te.addCommand(u.KeyMod.CtrlCmd|u.KeyCode.KEY_V,function(){return qe(),null}),te.onDidPaste(function(be){Oe.current.pastePos=be});try{window.addEventListener("paste",Xe)}catch(be){}}var me=$e();return Se(!0),function(){var be=Oe.current.instance;be.dispose();var Pe=be.getModel();Pe&&Pe.dispose(),Oe.current.subscription&&Oe.current.subscription.dispose(),fe&&window.removeEventListener("paste",Xe),me.unobserve(Re.current)}}catch(be){}})},[]),Object(j.useEffect)(function(){var q=Oe.current.instance;if(q&&Ae)return document.addEventListener("keydown",ot,!1),function(){document.removeEventListener("keydown",ot)}},[B,Ae]),Object(j.useEffect)(function(){var q=Oe.current.instance;if(q&&Ae){var te=s(a);u.editor.setModelLanguage(q.getModel(),te),console.log("language:",a,q.getModel(),te)}},[a,Ae]),Object(j.useEffect)(function(){var q=Oe.current.instance;q&&Ae&&u.editor.setTheme(F)},[F,Ae]),Object(j.useEffect)(function(){var q=Oe.current.instance;q&&Ae&&(q.updateOptions(Object(re.a)({},D)),setTimeout(function(){q.getModel().updateOptions(Object(re.a)({},D))},200))},[JSON.stringify(D),Ae]),Object(j.useEffect)(function(){var q=Oe.current.instance;q&&Ae&&q.layout()},[w,p,Ae]);var nt=Object(j.useState)(S(w)),Ze=Object(M.a)(nt,2),xe=Ze[0],Ne=Ze[1],ne=Object(j.useState)(S(p)),oe=Object(M.a)(ne,2),ae=oe[0],$=oe[1],J=Object(re.a)(Object(re.a)({},o),{},{width:xe,height:ae});return k.a.createElement("div",{className:"my-monaco-editor",ref:Re,style:J})};function E(m){var g=m.width,w=g===void 0?"100%":g,y=m.height,p=y===void 0?"100%":y,c=m.original,l=m.modified,a=m.language,f=m.options,o=f===void 0?{}:f,v=Object(j.useRef)(),D=Object(j.useState)(null),N=Object(M.a)(D,2),W=N[0],z=N[1];function F(Q){var ee;return v.current&&(ee=new C.default(function(fe){var ce=Object(K.a)(fe),ge;try{for(ce.s();!(ge=ce.n()).done;){var pe=ge.value;(pe.target.offsetHeight>0||pe.target.offsetWidth>0)&&Q.layout()}}catch(ue){ce.e(ue)}finally{ce.f()}}),ee.observe(v.current)),ee}Object(j.useEffect)(function(){v.current&&Z.e(27).then(Z.t.bind(null,"M/lh",7)).then(function(Q){u=Q;var ee=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},o),{},{wordWrap:!0}));z(ee);var fe=F(ee);return function(){ee.dispose();var ce=ee.getModel();ce&&ce.dispose(),fe.unobserve(v.current)}})},[]),Object(j.useEffect)(function(){W&&W.setModel({original:u.editor.createModel(c,a),modified:u.editor.createModel(l,a)})},[c,l,a,W]);var I=S(w),B=S(p),Y={width:I,height:B};return k.a.createElement("div",{className:"my-diff-editor",ref:v,style:Y})}},ZpRC:function(Rt,rt,Z){"use strict";function re(x){return typeof x=="object"&&x!=null&&x.nodeType===1}function V(x,A){return(!A||x!=="hidden")&&x!=="visible"&&x!=="clip"}function L(x,A){if(x.clientHeight<x.scrollHeight||x.clientWidth<x.scrollWidth){var O=getComputedStyle(x,null);return V(O.overflowY,A)||V(O.overflowX,A)||function(S){var _=function(b){if(!b.ownerDocument||!b.ownerDocument.defaultView)return null;try{return b.ownerDocument.defaultView.frameElement}catch(d){return null}}(S);return!!_&&(_.clientHeight<S.scrollHeight||_.clientWidth<S.scrollWidth)}(x)}return!1}function K(x,A,O,S,_,b,d,s){return b<x&&d>A||b>x&&d<A?0:b<=x&&s<=O||d>=A&&s>=O?b-x-S:d>A&&s<O||b<x&&s>O?d-A+_:0}var M=function(x,A){var O=window,S=A.scrollMode,_=A.block,b=A.inline,d=A.boundary,s=A.skipOverflowHiddenElements,u=typeof d=="function"?d:function(Fe){return Fe!==d};if(!re(x))throw new TypeError("Invalid target");for(var h=document.scrollingElement||document.documentElement,E=[],m=x;re(m)&&u(m);){if((m=m.parentElement)===h){E.push(m);break}m!=null&&m===document.body&&L(m)&&!L(document.documentElement)||m!=null&&L(m,s)&&E.push(m)}for(var g=O.visualViewport?O.visualViewport.width:innerWidth,w=O.visualViewport?O.visualViewport.height:innerHeight,y=window.scrollX||pageXOffset,p=window.scrollY||pageYOffset,c=x.getBoundingClientRect(),l=c.height,a=c.width,f=c.top,o=c.right,v=c.bottom,D=c.left,N=_==="start"||_==="nearest"?f:_==="end"?v:f+l/2,W=b==="center"?D+a/2:b==="end"?o:D,z=[],F=0;F<E.length;F++){var I=E[F],B=I.getBoundingClientRect(),Y=B.height,Q=B.width,ee=B.top,fe=B.right,ce=B.bottom,ge=B.left;if(S==="if-needed"&&f>=0&&D>=0&&v<=w&&o<=g&&f>=ee&&v<=ce&&D>=ge&&o<=fe)return z;var pe=getComputedStyle(I),ue=parseInt(pe.borderLeftWidth,10),le=parseInt(pe.borderTopWidth,10),de=parseInt(pe.borderRightWidth,10),ye=parseInt(pe.borderBottomWidth,10),Me=0,Ue=0,Re="offsetWidth"in I?I.offsetWidth-I.clientWidth-ue-de:0,Oe="offsetHeight"in I?I.offsetHeight-I.clientHeight-le-ye:0;if(h===I)Me=_==="start"?N:_==="end"?N-w:_==="nearest"?K(p,p+w,w,le,ye,p+N,p+N+l,l):N-w/2,Ue=b==="start"?W:b==="center"?W-g/2:b==="end"?W-g:K(y,y+g,g,ue,de,y+W,y+W+a,a),Me=Math.max(0,Me+p),Ue=Math.max(0,Ue+y);else{Me=_==="start"?N-ee-le:_==="end"?N-ce+ye+Oe:_==="nearest"?K(ee,ce,Y,le,ye+Oe,N,N+l,l):N-(ee+Y/2)+Oe/2,Ue=b==="start"?W-ge-ue:b==="center"?W-(ge+Q/2)+Re/2:b==="end"?W-fe+de+Re:K(ge,fe,Q,ue,de+Re,W,W+a,a);var Ce=I.scrollLeft,Le=I.scrollTop;N+=Le-(Me=Math.max(0,Math.min(Le+Me,I.scrollHeight-Y+Oe))),W+=Ce-(Ue=Math.max(0,Math.min(Ce+Ue,I.scrollWidth-Q+Re)))}z.push({el:I,top:Me,left:Ue})}return z};function P(x){return x===Object(x)&&Object.keys(x).length!==0}function j(x,A){A===void 0&&(A="auto");var O="scrollBehavior"in document.body.style;x.forEach(function(S){var _=S.el,b=S.top,d=S.left;_.scroll&&O?_.scroll({top:b,left:d,behavior:A}):(_.scrollTop=b,_.scrollLeft=d)})}function k(x){return x===!1?{block:"end",inline:"nearest"}:P(x)?x:{block:"start",inline:"nearest"}}function C(x,A){var O=!x.ownerDocument.documentElement.contains(x);if(P(A)&&typeof A.behavior=="function")return A.behavior(O?[]:M(x,A));if(O)return;var S=k(A);return j(M(x,S),S.behavior)}var R=rt.a=C},bT9E:function(Rt,rt,Z){"use strict";Z.d(rt,"a",function(){return V});var re=Z("VTBJ");function V(L,K){var M=Object(re.a)({},L);return Array.isArray(K)&&K.forEach(function(P){delete M[P]}),M}},c5Ni:function(Rt,rt,Z){},dejd:function(Rt,rt,Z){},dmUQ:function(Rt,rt,Z){"use strict";var re=Z("Ff2n"),V=Z("rePB"),L=Z("1OyB"),K=Z("vuIU"),M=Z("Ji7U"),P=Z("md7G"),j=Z("foSv"),k=Z("q1tI"),C=Z.n(k),R=Z("TSYQ"),x=Z.n(R),A=Z("4IlW");function O(l,a){var f=Object.keys(l);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(l);a&&(o=o.filter(function(v){return Object.getOwnPropertyDescriptor(l,v).enumerable})),f.push.apply(f,o)}return f}function S(l){for(var a=1;a<arguments.length;a++){var f=arguments[a]!=null?arguments[a]:{};a%2?O(Object(f),!0).forEach(function(o){Object(V.a)(l,o,f[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(f)):O(Object(f)).forEach(function(o){Object.defineProperty(l,o,Object.getOwnPropertyDescriptor(f,o))})}return l}function _(l){var a=b();return function(){var o=Object(j.a)(l),v;if(a){var D=Object(j.a)(this).constructor;v=Reflect.construct(o,arguments,D)}else v=o.apply(this,arguments);return Object(P.a)(this,v)}}function b(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(l){return!1}}function d(){}function s(l){l.preventDefault()}var u=function(a){return a.replace(/[^\w.-]+/g,"")},h=200,E=600,m=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,g=function(a){return a!=null},w=function(a,f){return f===a||typeof f=="number"&&typeof a=="number"&&isNaN(f)&&isNaN(a)},y=function(l){Object(M.a)(f,l);var a=_(f);function f(o){var v;Object(L.a)(this,f),v=a.call(this,o),v.onKeyDown=function(W){var z=v.props,F=z.onKeyDown,I=z.onPressEnter;if(W.keyCode===A.a.UP){var B=v.getRatio(W);v.up(W,B,null),v.stop()}else if(W.keyCode===A.a.DOWN){var Y=v.getRatio(W);v.down(W,Y,null),v.stop()}else W.keyCode===A.a.ENTER&&I&&I(W);if(v.recordCursorPosition(),v.lastKeyCode=W.keyCode,F){for(var Q=arguments.length,ee=new Array(Q>1?Q-1:0),fe=1;fe<Q;fe++)ee[fe-1]=arguments[fe];F.apply(void 0,[W].concat(ee))}},v.onKeyUp=function(W){var z=v.props.onKeyUp;if(v.stop(),v.recordCursorPosition(),z){for(var F=arguments.length,I=new Array(F>1?F-1:0),B=1;B<F;B++)I[B-1]=arguments[B];z.apply(void 0,[W].concat(I))}},v.onChange=function(W){var z=v.props.onChange;v.state.focused&&(v.inputting=!0),v.rawInput=v.props.parser(v.getValueFromEvent(W)),v.setState({inputValue:v.rawInput}),z(v.toNumber(v.rawInput))},v.onMouseUp=function(){var W=v.props.onMouseUp;v.recordCursorPosition(),W&&W.apply(void 0,arguments)},v.onFocus=function(){var W;v.setState({focused:!0}),(W=v.props).onFocus.apply(W,arguments)},v.onBlur=function(){var W=v.props.onBlur;v.inputting=!1,v.setState({focused:!1});var z=v.getCurrentValidValue(v.state.inputValue),F=v.setValue(z,d);if(W){var I=v.input.value,B=v.getInputDisplayValue({focus:!1,value:F});v.input.value=B&&Number(B),W.apply(void 0,arguments),v.input.value=I}},v.getRatio=function(W){var z=1;return W.metaKey||W.ctrlKey?z=.1:W.shiftKey&&(z=10),z},v.getFullNum=function(W){return isNaN(W)?W:/e/i.test(String(W))?Number(W).toFixed(18).replace(/\.?0+$/,""):W},v.getPrecision=function(W){if(g(v.props.precision))return v.props.precision;var z=String(W);if(z.indexOf("e-")>=0)return parseInt(z.slice(z.indexOf("e-")+2),10);var F=0;return z.indexOf(".")>=0&&(F=z.length-z.indexOf(".")-1),F},v.getInputDisplayValue=function(W){var z=W||v.state,F=z.focused,I=z.inputValue,B=z.value,Y;F?Y=I:Y=v.toPrecisionAsStep(B),Y==null&&(Y="");var Q=v.formatWrapper(Y);return g(v.props.decimalSeparator)&&(Q=Q.toString().replace(".",v.props.decimalSeparator)),Q},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(W){}},v.restoreByAfter=function(W){if(W===void 0)return!1;var z=v.input.value,F=z.lastIndexOf(W);if(F===-1)return!1;var I=v.cursorBefore.length;return v.lastKeyCode===A.a.DELETE&&v.cursorBefore.charAt(I-1)===W[0]?(v.fixCaret(I,I),!0):F+W.length===z.length?(v.fixCaret(F,F),!0):!1},v.partRestoreByAfter=function(W){return W===void 0?!1:Array.prototype.some.call(W,function(z,F){var I=W.substring(F);return v.restoreByAfter(I)})},v.isNotCompleteNumber=function(W){return isNaN(W)||W===""||W===null||W&&W.toString().indexOf(".")===W.toString().length-1},v.stop=function(){v.autoStepTimer&&clearTimeout(v.autoStepTimer)},v.down=function(W,z,F){v.pressingUpOrDown=!0,v.step("down",W,z,F)},v.up=function(W,z,F){v.pressingUpOrDown=!0,v.step("up",W,z,F)},v.saveInput=function(W){v.input=W};var D=o.value;D===void 0&&(D=o.defaultValue),v.state={focused:o.autoFocus};var N=v.getValidValue(v.toNumber(D));return v.state=S(S({},v.state),{},{inputValue:v.toPrecisionAsStep(N),value:N}),v}return Object(K.a)(f,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(v){var D=this.props,N=D.value,W=D.onChange,z=D.max,F=D.min,I=this.state.focused;if(v){if(!w(v.value,N)||!w(v.max,z)||!w(v.min,F)){var B=I?N:this.getValidValue(N),Y;this.pressingUpOrDown?Y=B:this.inputting?Y=this.rawInput:Y=this.toPrecisionAsStep(B),this.setState({value:B,inputValue:Y})}var Q="value"in this.props?N:this.state.value;"max"in this.props&&v.max!==z&&typeof Q=="number"&&Q>z&&W&&W(z),"min"in this.props&&v.min!==F&&typeof Q=="number"&&Q<F&&W&&W(F)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ee=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===A.a.BACKSPACE?ee=this.cursorStart-1:this.lastKeyCode===A.a.DELETE&&(ee=this.cursorStart):ee=this.input.value.length,this.fixCaret(ee,ee)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case A.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case A.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(fe){}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 D=v;return D===""?D="":this.isNotCompleteNumber(parseFloat(D))?D=this.state.value:D=this.getValidValue(D),this.toNumber(D)}},{key:"getValueFromEvent",value:function(v){var D=v.target.value.trim().replace(/。/g,".");return g(this.props.decimalSeparator)&&(D=D.replace(this.props.decimalSeparator,".")),D}},{key:"getValidValue",value:function(v){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,W=parseFloat(v);return isNaN(W)?v:(W<D&&(W=D),W>N&&(W=N),W)}},{key:"setValue",value:function(v,D){var N=this.props.precision,W=this.isNotCompleteNumber(parseFloat(v))?null:parseFloat(v),z=this.state.value,F=z===void 0?null:z,I=this.state.inputValue,B=I===void 0?null:I,Y=typeof W=="number"?W.toFixed(N):"".concat(W),Q=W!==F||Y!=="".concat(B);return"value"in this.props?(B=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:B},D)):this.setState({value:W,inputValue:this.toPrecisionAsStep(v)},D),Q&&this.props.onChange(W),W}},{key:"getMaxPrecision",value:function(v){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,N=this.props,W=N.precision,z=N.step;if(g(W))return W;var F=this.getPrecision(D),I=this.getPrecision(z),B=this.getPrecision(v);return v?Math.max(B,F+I):F+I}},{key:"getPrecisionFactor",value:function(v){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,N=this.getMaxPrecision(v,D);return Math.pow(10,N)}},{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 D=Math.abs(this.getMaxPrecision(v));return isNaN(D)?v.toString():Number(v).toFixed(D)}},{key:"toNumber",value:function(v){var D=this.props.precision,N=this.state.focused,W=v&&v.length>16&&N;return this.isNotCompleteNumber(v)||W?v:g(D)?Math.round(v*Math.pow(10,D))/Math.pow(10,D):Number(v)}},{key:"upStep",value:function(v,D){var N=this.props.step,W=this.getPrecisionFactor(v,D),z=Math.abs(this.getMaxPrecision(v,D)),F=((W*v+W*N*D)/W).toFixed(z);return this.toNumber(F)}},{key:"downStep",value:function(v,D){var N=this.props.step,W=this.getPrecisionFactor(v,D),z=Math.abs(this.getMaxPrecision(v,D)),F=((W*v-W*N*D)/W).toFixed(z);return this.toNumber(F)}},{key:"step",value:function(v,D){var N=this,W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,z=arguments.length>3?arguments[3]:void 0;this.stop(),D&&(D.persist(),D.preventDefault());var F=this.props;if(F.disabled)return;var I=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(I))return;var B=this["".concat(v,"Step")](I,W),Y=B>F.max||B<F.min;if(B>F.max?B=F.max:B<F.min&&(B=F.min),this.setValue(B,null),this.setState({focused:!0},function(){N.pressingUpOrDown=!1}),Y)return;this.autoStepTimer=setTimeout(function(){N[v](D,W,!0)},z?h:E)}},{key:"fixCaret",value:function(v,D){if(v===void 0||D===void 0||!this.input||!this.input.value)return;try{var N=this.input.selectionStart,W=this.input.selectionEnd;(v!==N||D!==W)&&this.input.setSelectionRange(v,D)}catch(z){}}},{key:"render",value:function(){var v,D=this.props,N=D.prefixCls,W=D.disabled,z=D.readOnly,F=D.useTouch,I=D.autoComplete,B=D.upHandler,Y=D.downHandler,Q=D.className,ee=D.max,fe=D.min,ce=D.style,ge=D.title,pe=D.onMouseEnter,ue=D.onMouseLeave,le=D.onMouseOver,de=D.onMouseOut,ye=D.required,Me=D.onClick,Ue=D.tabIndex,Re=D.type,Oe=D.placeholder,Ce=D.id,Le=D.inputMode,Fe=D.pattern,We=D.step,Be=D.maxLength,Ae=D.autoFocus,Se=D.name,$e=D.onPaste,qe=D.onInput,Je=Object(re.a)(D,["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"]),Xe=this.state,ot=Xe.value,Qe=Xe.focused,Ye=x()(N,(v={},Object(V.a)(v,Q,!!Q),Object(V.a)(v,"".concat(N,"-disabled"),W),Object(V.a)(v,"".concat(N,"-focused"),Qe),v)),Ee={};Object.keys(Je).forEach(function(te){(te.substr(0,5)==="data-"||te.substr(0,5)==="aria-"||te==="role")&&(Ee[te]=Je[te])});var nt=!z&&!W,Ze=this.getInputDisplayValue(null),xe=(ot||ot===0)&&(isNaN(ot)||Number(ot)>=ee),Ne=(ot||ot===0)&&(isNaN(ot)||Number(ot)<=fe),ne=xe||W||z,oe=Ne||W||z,ae=x()("".concat(N,"-handler"),"".concat(N,"-handler-up"),Object(V.a)({},"".concat(N,"-handler-up-disabled"),ne)),$=x()("".concat(N,"-handler"),"".concat(N,"-handler-down"),Object(V.a)({},"".concat(N,"-handler-down-disabled"),oe)),J=F?{onTouchStart:ne?d:this.up,onTouchEnd:this.stop}:{onMouseDown:ne?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},q=F?{onTouchStart:oe?d:this.down,onTouchEnd:this.stop}:{onMouseDown:oe?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return C.a.createElement("div",{className:Ye,style:ce,title:ge,onMouseEnter:pe,onMouseLeave:ue,onMouseOver:le,onMouseOut:de,onFocus:function(){return null},onBlur:function(){return null}},C.a.createElement("div",{className:"".concat(N,"-handler-wrap")},C.a.createElement("span",Object.assign({unselectable:"on"},J,{role:"button","aria-label":"Increase Value","aria-disabled":ne,className:ae}),B||C.a.createElement("span",{unselectable:"on",className:"".concat(N,"-handler-up-inner"),onClick:s})),C.a.createElement("span",Object.assign({unselectable:"on"},q,{role:"button","aria-label":"Decrease Value","aria-disabled":oe,className:$}),Y||C.a.createElement("span",{unselectable:"on",className:"".concat(N,"-handler-down-inner"),onClick:s}))),C.a.createElement("div",{className:"".concat(N,"-input-wrap")},C.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":fe,"aria-valuemax":ee,"aria-valuenow":ot,required:ye,type:Re,placeholder:Oe,onPaste:$e,onClick:Me,onMouseUp:this.onMouseUp,className:"".concat(N,"-input"),tabIndex:Ue,autoComplete:I,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:nt?this.onKeyDown:d,onKeyUp:nt?this.onKeyUp:d,autoFocus:Ae,maxLength:Be,readOnly:z,disabled:W,max:ee,min:fe,step:We,name:Se,title:ge,id:Ce,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ze),pattern:Fe,inputMode:Le,onInput:qe},Ee))))}}]),f}(C.a.Component);y.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:m,min:-m,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:u,required:!1,autoComplete:"off"};var p=y,c=rt.a=p},fcSX:function(Rt,rt,Z){"use strict";var re=Z("Ff2n"),V=Z("1OyB"),L=Z("vuIU"),K=Z("Ji7U"),M=Z("md7G"),P=Z("foSv"),j=Z("1W/9"),k=Z("q1tI"),C=Z("rePB"),R=Z("JX7q"),x=Z("TSYQ"),A=Z.n(x),O=Z("qx4F"),S=Z("4IlW");function _(W){return Array.isArray(W)?W:[W]}var b={transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend"},d=Object.keys(b).filter(function(W){if(typeof document=="undefined")return!1;var z=document.getElementsByTagName("html")[0];return W in(z?z.style:{})})[0],s=b[d];function u(W,z,F,I){W.addEventListener?W.addEventListener(z,F,I):W.attachEvent&&W.attachEvent("on".concat(z),F)}function h(W,z,F,I){W.removeEventListener?W.removeEventListener(z,F,I):W.attachEvent&&W.detachEvent("on".concat(z),F)}function E(W,z){var F=typeof W=="function"?W(z):W;return Array.isArray(F)?F.length===2?F:[F[0],F[1]]:[F]}var m=function(z){return!isNaN(parseFloat(z))&&isFinite(z)},g=!(typeof window!="undefined"&&window.document&&window.document.createElement),w=function W(z,F,I,B){if(!F||F===document||F instanceof Document)return!1;if(F===z.parentNode)return!0;var Y=Math.max(Math.abs(I),Math.abs(B))===Math.abs(B),Q=Math.max(Math.abs(I),Math.abs(B))===Math.abs(I),ee=F.scrollHeight-F.clientHeight,fe=F.scrollWidth-F.clientWidth,ce=document.defaultView.getComputedStyle(F),ge=ce.overflowY==="auto"||ce.overflowY==="scroll",pe=ce.overflowX==="auto"||ce.overflowX==="scroll",ue=ee&&ge,le=fe&&pe;return Y&&(!ue||ue&&(F.scrollTop>=ee&&B<0||F.scrollTop<=0&&B>0))||Q&&(!le||le&&(F.scrollLeft>=fe&&I<0||F.scrollLeft<=0&&I>0))?W(z,F.parentNode,I,B):!1};function y(W){var z=p();return function(){var I=Object(P.a)(W),B;if(z){var Y=Object(P.a)(this).constructor;B=Reflect.construct(I,arguments,Y)}else B=I.apply(this,arguments);return Object(M.a)(this,B)}}function p(){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(W){return!1}}var c={},l=function(W){Object(K.a)(F,W);var z=y(F);function F(I){var B;return Object(V.a)(this,F),B=z.call(this,I),B.domFocus=function(){B.dom&&B.dom.focus()},B.removeStartHandler=function(Y){if(Y.touches.length>1)return;B.startPos={x:Y.touches[0].clientX,y:Y.touches[0].clientY}},B.removeMoveHandler=function(Y){if(Y.changedTouches.length>1)return;var Q=Y.currentTarget,ee=Y.changedTouches[0].clientX-B.startPos.x,fe=Y.changedTouches[0].clientY-B.startPos.y;(Q===B.maskDom||Q===B.handlerDom||Q===B.contentDom&&w(Q,Y.target,ee,fe))&&Y.cancelable&&Y.preventDefault()},B.transitionEnd=function(Y){var Q=Y.target;h(Q,s,B.transitionEnd),Q.style.transition=""},B.onKeyDown=function(Y){if(Y.keyCode===S.a.ESC){var Q=B.props.onClose;Y.stopPropagation(),Q&&Q(Y)}},B.onWrapperTransitionEnd=function(Y){var Q=B.props,ee=Q.open,fe=Q.afterVisibleChange;Y.target===B.contentWrapper&&Y.propertyName.match(/transform$/)&&(B.dom.style.transition="",!ee&&B.getCurrentDrawerSome()&&(document.body.style.overflowX="",B.maskDom&&(B.maskDom.style.left="",B.maskDom.style.width="")),fe&&fe(!!ee))},B.openLevelTransition=function(){var Y=B.props,Q=Y.open,ee=Y.width,fe=Y.height,ce=B.getHorizontalBoolAndPlacementName(),ge=ce.isHorizontal,pe=ce.placementName,ue=B.contentDom?B.contentDom.getBoundingClientRect()[ge?"width":"height"]:0,le=(ge?ee:fe)||ue;B.setLevelAndScrolling(Q,pe,le)},B.setLevelTransform=function(Y,Q,ee,fe){var ce=B.props,ge=ce.placement,pe=ce.levelMove,ue=ce.duration,le=ce.ease,de=ce.showMask;B.levelDom.forEach(function(ye){ye.style.transition="transform ".concat(ue," ").concat(le),u(ye,s,B.transitionEnd);var Me=Y?ee:0;if(pe){var Ue=E(pe,{target:ye,open:Y});Me=Y?Ue[0]:Ue[1]||0}var Re=typeof Me=="number"?"".concat(Me,"px"):Me,Oe=ge==="left"||ge==="top"?Re:"-".concat(Re);Oe=de&&ge==="right"&&fe?"calc(".concat(Oe," + ").concat(fe,"px)"):Oe,ye.style.transform=Me?"".concat(Q,"(").concat(Oe,")"):""})},B.setLevelAndScrolling=function(Y,Q,ee){var fe=B.props.onChange;if(!g){var ce=document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth?Object(O.a)(!0):0;B.setLevelTransform(Y,Q,ee,ce),B.toggleScrollingToDrawerAndBody(ce)}fe&&fe(Y)},B.toggleScrollingToDrawerAndBody=function(Y){var Q=B.props,ee=Q.getOpenCount,fe=Q.getContainer,ce=Q.showMask,ge=Q.open,pe=fe&&fe(),ue=ee&&ee();if(pe&&pe.parentNode===document.body&&ce){var le=["touchstart"],de=[document.body,B.maskDom,B.handlerDom,B.contentDom];ge&&document.body.style.overflow!=="hidden"?(Y&&B.addScrollingEffect(Y),ue===1&&(document.body.style.overflow="hidden"),document.body.style.touchAction="none",de.forEach(function(ye,Me){if(!ye)return;u(ye,le[Me]||"touchmove",Me?B.removeMoveHandler:B.removeStartHandler,B.passive)})):B.getCurrentDrawerSome()&&(ue||(document.body.style.overflow=""),document.body.style.touchAction="",Y&&B.remScrollingEffect(Y),de.forEach(function(ye,Me){if(!ye)return;h(ye,le[Me]||"touchmove",Me?B.removeMoveHandler:B.removeStartHandler,B.passive)}))}},B.addScrollingEffect=function(Y){var Q=B.props,ee=Q.placement,fe=Q.duration,ce=Q.ease,ge=Q.getOpenCount,pe=Q.switchScrollingEffect,ue=ge&&ge();ue===1&&pe();var le="width ".concat(fe," ").concat(ce),de="transform ".concat(fe," ").concat(ce);B.dom.style.transition="none";switch(ee){case"right":B.dom.style.transform="translateX(-".concat(Y,"px)");break;case"top":case"bottom":B.dom.style.width="calc(100% - ".concat(Y,"px)"),B.dom.style.transform="translateZ(0)";break;default:break}clearTimeout(B.timeout),B.timeout=setTimeout(function(){B.dom&&(B.dom.style.transition="".concat(de,",").concat(le),B.dom.style.width="",B.dom.style.transform="")})},B.remScrollingEffect=function(Y){var Q=B.props,ee=Q.placement,fe=Q.duration,ce=Q.ease,ge=Q.getOpenCount,pe=Q.switchScrollingEffect,ue=ge&&ge();ue||pe(!0),d&&(document.body.style.overflowX="hidden"),B.dom.style.transition="none";var le,de="width ".concat(fe," ").concat(ce),ye="transform ".concat(fe," ").concat(ce);switch(ee){case"left":{B.dom.style.width="100%",de="width 0s ".concat(ce," ").concat(fe);break}case"right":{B.dom.style.transform="translateX(".concat(Y,"px)"),B.dom.style.width="100%",de="width 0s ".concat(ce," ").concat(fe),B.maskDom&&(B.maskDom.style.left="-".concat(Y,"px"),B.maskDom.style.width="calc(100% + ".concat(Y,"px)"));break}case"top":case"bottom":{B.dom.style.width="calc(100% + ".concat(Y,"px)"),B.dom.style.height="100%",B.dom.style.transform="translateZ(0)",le="height 0s ".concat(ce," ").concat(fe);break}default:break}clearTimeout(B.timeout),B.timeout=setTimeout(function(){B.dom&&(B.dom.style.transition="".concat(ye,",").concat(le?"".concat(le,","):"").concat(de),B.dom.style.transform="",B.dom.style.width="",B.dom.style.height="")})},B.getCurrentDrawerSome=function(){return!Object.keys(c).some(function(Y){return c[Y]})},B.getLevelDom=function(Y){var Q=Y.level,ee=Y.getContainer;if(g)return;var fe=ee&&ee(),ce=fe?fe.parentNode:null;if(B.levelDom=[],Q==="all"){var ge=ce?Array.prototype.slice.call(ce.children):[];ge.forEach(function(pe){pe.nodeName!=="SCRIPT"&&pe.nodeName!=="STYLE"&&pe.nodeName!=="LINK"&&pe!==fe&&B.levelDom.push(pe)})}else Q&&_(Q).forEach(function(pe){document.querySelectorAll(pe).forEach(function(ue){B.levelDom.push(ue)})})},B.getHorizontalBoolAndPlacementName=function(){var Y=B.props.placement,Q=Y==="left"||Y==="right",ee="translate".concat(Q?"X":"Y");return{isHorizontal:Q,placementName:ee}},B.state={_self:Object(R.a)(B)},B}return Object(L.a)(F,[{key:"componentDidMount",value:function(){var B=this;if(!g){var Y=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){return Y=!0,null}}))}catch(ge){}this.passive=Y?{passive:!1}:!1}var Q=this.props,ee=Q.open,fe=Q.getContainer,ce=fe&&fe();this.drawerId="drawer_id_".concat(Number((Date.now()+Math.random()).toString().replace(".",Math.round(Math.random()*9).toString())).toString(16)),this.getLevelDom(this.props),ee&&(ce&&ce.parentNode===document.body&&(c[this.drawerId]=ee),this.openLevelTransition(),this.forceUpdate(function(){B.domFocus()}))}},{key:"componentDidUpdate",value:function(B){var Y=this.props,Q=Y.open,ee=Y.getContainer,fe=ee&&ee();Q!==B.open&&(Q&&this.domFocus(),fe&&fe.parentNode===document.body&&(c[this.drawerId]=!!Q),this.openLevelTransition())}},{key:"componentWillUnmount",value:function(){var B=this.props,Y=B.getOpenCount,Q=B.open,ee=B.switchScrollingEffect,fe=typeof Y=="function"&&Y();delete c[this.drawerId],Q&&(this.setLevelTransform(!1),document.body.style.touchAction=""),fe||(document.body.style.overflow="",ee(!0))}},{key:"render",value:function(){var B,Y=this,Q=this.props,ee=Q.className,fe=Q.children,ce=Q.style,ge=Q.width,pe=Q.height,ue=Q.defaultOpen,le=Q.open,de=Q.prefixCls,ye=Q.placement,Me=Q.level,Ue=Q.levelMove,Re=Q.ease,Oe=Q.duration,Ce=Q.getContainer,Le=Q.handler,Fe=Q.onChange,We=Q.afterVisibleChange,Be=Q.showMask,Ae=Q.maskClosable,Se=Q.maskStyle,$e=Q.onClose,qe=Q.onHandleClick,Je=Q.keyboard,Xe=Q.getOpenCount,ot=Q.switchScrollingEffect,Qe=Object(re.a)(Q,["className","children","style","width","height","defaultOpen","open","prefixCls","placement","level","levelMove","ease","duration","getContainer","handler","onChange","afterVisibleChange","showMask","maskClosable","maskStyle","onClose","onHandleClick","keyboard","getOpenCount","switchScrollingEffect"]),Ye=this.dom?le:!1,Ee=A()(de,(B={},Object(C.a)(B,"".concat(de,"-").concat(ye),!0),Object(C.a)(B,"".concat(de,"-open"),Ye),Object(C.a)(B,ee||"",!!ee),Object(C.a)(B,"no-mask",!Be),B)),nt=this.getHorizontalBoolAndPlacementName(),Ze=nt.placementName,xe=ye==="left"||ye==="top"?"-100%":"100%",Ne=Ye?"":"".concat(Ze,"(").concat(xe,")"),ne=Le&&k.cloneElement(Le,{onClick:function(ae){Le.props.onClick&&Le.props.onClick(),qe&&qe(ae)},ref:function(ae){Y.handlerDom=ae}});return k.createElement("div",Object.assign({},Qe,{tabIndex:-1,className:Ee,style:ce,ref:function(ae){Y.dom=ae},onKeyDown:Ye&&Je?this.onKeyDown:void 0,onTransitionEnd:this.onWrapperTransitionEnd}),Be&&k.createElement("div",{className:"".concat(de,"-mask"),onClick:Ae?$e:void 0,style:Se,ref:function(ae){Y.maskDom=ae}}),k.createElement("div",{className:"".concat(de,"-content-wrapper"),style:{transform:Ne,msTransform:Ne,width:m(ge)?"".concat(ge,"px"):ge,height:m(pe)?"".concat(pe,"px"):pe},ref:function(ae){Y.contentWrapper=ae}},k.createElement("div",{className:"".concat(de,"-content"),ref:function(ae){Y.contentDom=ae},onTouchStart:Ye&&Be?this.removeStartHandler:void 0,onTouchMove:Ye&&Be?this.removeMoveHandler:void 0},fe),ne))}}],[{key:"getDerivedStateFromProps",value:function(B,Y){var Q=Y.prevProps,ee=Y._self,fe={prevProps:B};if(Q!==void 0){var ce=B.placement,ge=B.level;ce!==Q.placement&&(ee.contentDom=null),ge!==Q.level&&ee.getLevelDom(B)}return fe}}]),F}(k.Component);l.defaultProps={switchScrollingEffect:function(){}};var a=l;function f(W){var z=o();return function(){var I=Object(P.a)(W),B;if(z){var Y=Object(P.a)(this).constructor;B=Reflect.construct(I,arguments,Y)}else B=I.apply(this,arguments);return Object(M.a)(this,B)}}function o(){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(W){return!1}}var v=function(W){Object(K.a)(F,W);var z=f(F);function F(I){var B;Object(V.a)(this,F),B=z.call(this,I),B.onHandleClick=function(Q){var ee=B.props,fe=ee.onHandleClick,ce=ee.open;if(fe&&fe(Q),typeof ce=="undefined"){var ge=B.state.open;B.setState({open:!ge})}},B.onClose=function(Q){var ee=B.props,fe=ee.onClose,ce=ee.open;fe&&fe(Q),typeof ce=="undefined"&&B.setState({open:!1})};var Y=typeof I.open!="undefined"?I.open:!!I.defaultOpen;return B.state={open:Y},"onMaskClick"in I&&console.warn("`onMaskClick` are removed, please use `onClose` instead."),B}return Object(L.a)(F,[{key:"render",value:function(){var B=this,Y=this.props,Q=Y.defaultOpen,ee=Y.getContainer,fe=Y.wrapperClassName,ce=Y.forceRender,ge=Y.handler,pe=Object(re.a)(Y,["defaultOpen","getContainer","wrapperClassName","forceRender","handler"]),ue=this.state.open;if(!ee)return k.createElement("div",{className:fe,ref:function(ye){B.dom=ye}},k.createElement(a,Object.assign({},pe,{open:ue,handler:ge,getContainer:function(){return B.dom},onClose:this.onClose,onHandleClick:this.onHandleClick})));var le=!!ge||ce;return k.createElement(j.a,{visible:ue,forceRender:le,getContainer:ee,wrapperClassName:fe},function(de){var ye=de.visible,Me=de.afterClose,Ue=Object(re.a)(de,["visible","afterClose"]);return k.createElement(a,Object.assign({},pe,Ue,{open:ye!==void 0?ye:ue,afterVisibleChange:Me!==void 0?Me:pe.afterVisibleChange,handler:ge,onClose:B.onClose,onHandleClick:B.onHandleClick}))})}}],[{key:"getDerivedStateFromProps",value:function(B,Y){var Q=Y.prevProps,ee={prevProps:B};return typeof Q!="undefined"&&B.open!==Q.open&&(ee.open=B.open),ee}}]),F}(k.Component);v.defaultProps={prefixCls:"drawer",placement:"left",getContainer:"body",defaultOpen:!1,level:"all",duration:".3s",ease:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",onChange:function(){},afterVisibleChange:function(){},handler:k.createElement("div",{className:"drawer-handle"},k.createElement("i",{className:"drawer-handle-icon"})),showMask:!0,maskClosable:!0,maskStyle:{},wrapperClassName:"",className:"",keyboard:!0,forceRender:!1};var D=v,N=rt.a=D},kSUc:function(Rt,rt,Z){},kqOp:function(Rt,rt,Z){"use strict";Z.d(rt,"a",function(){return R});var re=Z("0Owb"),V=Z("fWQN"),L=Z("mtLc"),K=Z("yKVA"),M=Z("879j"),P=Z("q1tI"),j=Z.n(P),k=Z("Ot1p"),C="\u2581",R=function(x){Object(K.a)(O,x);var A=Object(M.a)(O);function O(){var S;Object(V.a)(this,O);for(var _=arguments.length,b=new Array(_),d=0;d<_;d++)b[d]=arguments[d];return S=A.call.apply(A,[this].concat(b)),S.getChCountBeforeCursor=function(s,u){for(var h=u.line,E=0,m=0;m<h;m++)E+=s.getLine(m).split(C).length-1;var g=s.getLine(h).substring(0,u.ch);return E+=g.split(C).length-1,E},S.onCMBeforeChange=function(s,u){var h=s.getRange(u.from,u.to),E=0;if(u.text.forEach(function(y){E+=y.split(C).length-1}),h&&h.indexOf(C)!=-1){var m=h.split(C).length-1,g=S.getChCountBeforeCursor(s,u.from);console.log("\u5220\u9664".concat(m,"\u4E2A\uFF0C \u4E4B\u524D\u6709").concat(g,"\u4E2A\uFF0C\u65B0\u589E").concat(E,"\u4E2A")),S.props.deleteEmptyDisabled?u.cancel():S.props.onPlaceholderChange&&S.props.onPlaceholderChange(g,m,E)}else if(E){var w=S.getChCountBeforeCursor(s,u.from);console.log("\u65B0\u589E".concat(E,"\u4E2A\uFF0C\u4E4B\u524D\u6709").concat(w,"\u4E2A")),S.props.onPlaceholderChange&&S.props.onPlaceholderChange(w,0,E)}},S}return Object(L.a)(O,[{key:"render",value:function(){return j.a.createElement(k.a,Object(re.a)({},this.props,{onCMBeforeChange:this.onCMBeforeChange}))}}]),O}(P.Component)},lZu9:function(Rt,rt,Z){(function(re){re(Z("VrN/"),Z("1eCo"),Z("8EBN"))})(function(re){"use strict";re.defineMode("markdown",function(V,L){var K=re.getMode(V,"text/html"),M=K.name=="null";function P(F){if(re.findModeByName){var I=re.findModeByName(F);I&&(F=I.mime||I.mimes[0])}var B=re.getMode(V,F);return B.name=="null"?null:B}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 j={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var k in j)j.hasOwnProperty(k)&&L.tokenTypeOverrides[k]&&(j[k]=L.tokenTypeOverrides[k]);var C=/^([*\-_])(?:\s*\1){2,}\s*$/,R=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,x=/^\[(x| )\](?=\s)/i,A=L.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,O=/^ {0,3}(?:\={1,}|-{2,})\s*$/,S=/^[^#!\[\]*_\\<>` "'(~:]+/,_=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,b=/^\s*\[[^\]]+?\]:.*$/,d=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,s=" ";function u(F,I,B){return I.f=I.inline=B,B(F,I)}function h(F,I,B){return I.f=I.block=B,B(F,I)}function E(F){return!F||!/\S/.test(F.string)}function m(F){if(F.linkTitle=!1,F.linkHref=!1,F.linkText=!1,F.em=!1,F.strong=!1,F.strikethrough=!1,F.quote=0,F.indentedCode=!1,F.f==w){var I=M;if(!I){var B=re.innerMode(K,F.htmlState);I=B.mode.name=="xml"&&B.state.tagStart===null&&!B.state.context&&B.state.tokenize.isInText}I&&(F.f=l,F.block=g,F.htmlState=null)}return F.trailingSpace=0,F.trailingSpaceNewLine=!1,F.prevLine=F.thisLine,F.thisLine={stream:null},null}function g(F,I){var B=F.column()===I.indentation,Y=E(I.prevLine.stream),Q=I.indentedCode,ee=I.prevLine.hr,fe=I.list!==!1,ce=(I.listStack[I.listStack.length-1]||0)+3;I.indentedCode=!1;var ge=I.indentation;if(I.indentationDiff===null&&(I.indentationDiff=I.indentation,fe)){for(I.list=null;ge<I.listStack[I.listStack.length-1];)I.listStack.pop(),I.listStack.length?I.indentation=I.listStack[I.listStack.length-1]:I.list=!1;I.list!==!1&&(I.indentationDiff=ge-I.listStack[I.listStack.length-1])}var pe=!Y&&!ee&&!I.prevLine.header&&(!fe||!Q)&&!I.prevLine.fencedCodeEnd,ue=(I.list===!1||ee||Y)&&I.indentation<=ce&&F.match(C),le=null;if(I.indentationDiff>=4&&(Q||I.prevLine.fencedCodeEnd||I.prevLine.header||Y))return F.skipToEnd(),I.indentedCode=!0,j.code;if(F.eatSpace())return null;if(B&&I.indentation<=ce&&(le=F.match(A))&&le[1].length<=6)return I.quote=0,I.header=le[1].length,I.thisLine.header=!0,L.highlightFormatting&&(I.formatting="header"),I.f=I.inline,p(I);if(I.indentation<=ce&&F.eat(">"))return I.quote=B?1:I.quote+1,L.highlightFormatting&&(I.formatting="quote"),F.eatSpace(),p(I);if(!ue&&!I.setext&&B&&I.indentation<=ce&&(le=F.match(R))){var de=le[1]?"ol":"ul";return I.indentation=ge+F.current().length,I.list=!0,I.quote=0,I.listStack.push(I.indentation),I.em=!1,I.strong=!1,I.code=!1,I.strikethrough=!1,L.taskLists&&F.match(x,!1)&&(I.taskList=!0),I.f=I.inline,L.highlightFormatting&&(I.formatting=["list","list-"+de]),p(I)}else{if(B&&I.indentation<=ce&&(le=F.match(_,!0)))return I.quote=0,I.fencedEndRE=new RegExp(le[1]+"+ *$"),I.localMode=L.fencedCodeBlockHighlighting&&P(le[2]||L.fencedCodeBlockDefaultMode),I.localMode&&(I.localState=re.startState(I.localMode)),I.f=I.block=y,L.highlightFormatting&&(I.formatting="code-block"),I.code=-1,p(I);if(I.setext||(!pe||!fe)&&!I.quote&&I.list===!1&&!I.code&&!ue&&!b.test(F.string)&&(le=F.lookAhead(1))&&(le=le.match(O)))return I.setext?(I.header=I.setext,I.setext=0,F.skipToEnd(),L.highlightFormatting&&(I.formatting="header")):(I.header=le[0].charAt(0)=="="?1:2,I.setext=I.header),I.thisLine.header=!0,I.f=I.inline,p(I);if(ue)return F.skipToEnd(),I.hr=!0,I.thisLine.hr=!0,j.hr;if(F.peek()==="[")return u(F,I,D)}return u(F,I,I.inline)}function w(F,I){var B=K.token(F,I.htmlState);if(!M){var Y=re.innerMode(K,I.htmlState);(Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText||I.md_inside&&F.current().indexOf(">")>-1)&&(I.f=l,I.block=g,I.htmlState=null)}return B}function y(F,I){var B=I.listStack[I.listStack.length-1]||0,Y=I.indentation<B,Q=B+3;if(I.fencedEndRE&&I.indentation<=Q&&(Y||F.match(I.fencedEndRE))){L.highlightFormatting&&(I.formatting="code-block");var ee;return Y||(ee=p(I)),I.localMode=I.localState=null,I.block=g,I.f=l,I.fencedEndRE=null,I.code=0,I.thisLine.fencedCodeEnd=!0,Y?h(F,I,I.block):ee}else return I.localMode?I.localMode.token(F,I.localState):(F.skipToEnd(),j.code)}function p(F){var I=[];if(F.formatting){I.push(j.formatting),typeof F.formatting=="string"&&(F.formatting=[F.formatting]);for(var B=0;B<F.formatting.length;B++)I.push(j.formatting+"-"+F.formatting[B]),F.formatting[B]==="header"&&I.push(j.formatting+"-"+F.formatting[B]+"-"+F.header),F.formatting[B]==="quote"&&(!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=F.quote?I.push(j.formatting+"-"+F.formatting[B]+"-"+F.quote):I.push("error"))}if(F.taskOpen)return I.push("meta"),I.length?I.join(" "):null;if(F.taskClosed)return I.push("property"),I.length?I.join(" "):null;if(F.linkHref?I.push(j.linkHref,"url"):(F.strong&&I.push(j.strong),F.em&&I.push(j.em),F.strikethrough&&I.push(j.strikethrough),F.emoji&&I.push(j.emoji),F.linkText&&I.push(j.linkText),F.code&&I.push(j.code),F.image&&I.push(j.image),F.imageAltText&&I.push(j.imageAltText,"link"),F.imageMarker&&I.push(j.imageMarker)),F.header&&I.push(j.header,j.header+"-"+F.header),F.quote&&(I.push(j.quote),!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=F.quote?I.push(j.quote+"-"+F.quote):I.push(j.quote+"-"+L.maxBlockquoteDepth)),F.list!==!1){var Y=(F.listStack.length-1)%3;Y?Y===1?I.push(j.list2):I.push(j.list3):I.push(j.list1)}return F.trailingSpaceNewLine?I.push("trailing-space-new-line"):F.trailingSpace&&I.push("trailing-space-"+(F.trailingSpace%2?"a":"b")),I.length?I.join(" "):null}function c(F,I){return F.match(S,!0)?p(I):void 0}function l(F,I){var B=I.text(F,I);if(typeof B!="undefined")return B;if(I.list)return I.list=null,p(I);if(I.taskList){var Y=F.match(x,!0)[1]===" ";return Y?I.taskOpen=!0:I.taskClosed=!0,L.highlightFormatting&&(I.formatting="task"),I.taskList=!1,p(I)}if(I.taskOpen=!1,I.taskClosed=!1,I.header&&F.match(/^#+$/,!0))return L.highlightFormatting&&(I.formatting="header"),p(I);var Q=F.next();if(I.linkTitle){I.linkTitle=!1;var ee=Q;Q==="("&&(ee=")"),ee=(ee+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var fe="^\\s*(?:[^"+ee+"\\\\]+|\\\\\\\\|\\\\.)"+ee;if(F.match(new RegExp(fe),!0))return j.linkHref}if(Q==="`"){var ce=I.formatting;L.highlightFormatting&&(I.formatting="code"),F.eatWhile("`");var ge=F.current().length;if(I.code==0&&(!I.quote||ge==1))return I.code=ge,p(I);if(ge==I.code){var pe=p(I);return I.code=0,pe}else return I.formatting=ce,p(I)}else if(I.code)return p(I);if(Q==="\\"&&(F.next(),L.highlightFormatting)){var ue=p(I),le=j.formatting+"-escape";return ue?ue+" "+le:le}if(Q==="!"&&F.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return I.imageMarker=!0,I.image=!0,L.highlightFormatting&&(I.formatting="image"),p(I);if(Q==="["&&I.imageMarker&&F.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return I.imageMarker=!1,I.imageAltText=!0,L.highlightFormatting&&(I.formatting="image"),p(I);if(Q==="]"&&I.imageAltText){L.highlightFormatting&&(I.formatting="image");var ue=p(I);return I.imageAltText=!1,I.image=!1,I.inline=I.f=f,ue}if(Q==="["&&!I.image)return I.linkText&&F.match(/^.*?\]/)||(I.linkText=!0,L.highlightFormatting&&(I.formatting="link")),p(I);if(Q==="]"&&I.linkText){L.highlightFormatting&&(I.formatting="link");var ue=p(I);return I.linkText=!1,I.inline=I.f=F.match(/\(.*?\)| ?\[.*?\]/,!1)?f:l,ue}if(Q==="<"&&F.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=a,L.highlightFormatting&&(I.formatting="link");var ue=p(I);return ue?ue+=" ":ue="",ue+j.linkInline}if(Q==="<"&&F.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=a,L.highlightFormatting&&(I.formatting="link");var ue=p(I);return ue?ue+=" ":ue="",ue+j.linkEmail}if(L.xml&&Q==="<"&&F.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var de=F.string.indexOf(">",F.pos);if(de!=-1){var ye=F.string.substring(F.start,de);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(ye)&&(I.md_inside=!0)}return F.backUp(1),I.htmlState=re.startState(K),h(F,I,w)}if(L.xml&&Q==="<"&&F.match(/^\/\w*?>/))return I.md_inside=!1,"tag";if(Q==="*"||Q==="_"){for(var Me=1,Ue=F.pos==1?" ":F.string.charAt(F.pos-2);Me<3&&F.eat(Q);)Me++;var Re=F.peek()||" ",Oe=!/\s/.test(Re)&&(!d.test(Re)||/\s/.test(Ue)||d.test(Ue)),Ce=!/\s/.test(Ue)&&(!d.test(Ue)||/\s/.test(Re)||d.test(Re)),Le=null,Fe=null;if(Me%2&&(!I.em&&Oe&&(Q==="*"||!Ce||d.test(Ue))?Le=!0:I.em==Q&&Ce&&(Q==="*"||!Oe||d.test(Re))&&(Le=!1)),Me>1&&(!I.strong&&Oe&&(Q==="*"||!Ce||d.test(Ue))?Fe=!0:I.strong==Q&&Ce&&(Q==="*"||!Oe||d.test(Re))&&(Fe=!1)),Fe!=null||Le!=null){L.highlightFormatting&&(I.formatting=Le==null?"strong":Fe==null?"em":"strong em"),Le===!0&&(I.em=Q),Fe===!0&&(I.strong=Q);var pe=p(I);return Le===!1&&(I.em=!1),Fe===!1&&(I.strong=!1),pe}}else if(Q===" "&&(F.eat("*")||F.eat("_"))){if(F.peek()===" ")return p(I);F.backUp(1)}if(L.strikethrough){if(Q==="~"&&F.eatWhile(Q)){if(I.strikethrough){L.highlightFormatting&&(I.formatting="strikethrough");var pe=p(I);return I.strikethrough=!1,pe}else if(F.match(/^[^\s]/,!1))return I.strikethrough=!0,L.highlightFormatting&&(I.formatting="strikethrough"),p(I)}else if(Q===" "&&F.match(/^~~/,!0)){if(F.peek()===" ")return p(I);F.backUp(2)}}if(L.emoji&&Q===":"&&F.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){I.emoji=!0,L.highlightFormatting&&(I.formatting="emoji");var We=p(I);return I.emoji=!1,We}return Q===" "&&(F.match(/^ +$/,!1)?I.trailingSpace++:I.trailingSpace&&(I.trailingSpaceNewLine=!0)),p(I)}function a(F,I){var B=F.next();if(B===">"){I.f=I.inline=l,L.highlightFormatting&&(I.formatting="link");var Y=p(I);return Y?Y+=" ":Y="",Y+j.linkInline}return F.match(/^[^>]+/,!0),j.linkInline}function f(F,I){if(F.eatSpace())return null;var B=F.next();return B==="("||B==="["?(I.f=I.inline=v(B==="("?")":"]"),L.highlightFormatting&&(I.formatting="link-string"),I.linkHref=!0,p(I)):"error"}var o={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function v(F){return function(I,B){var Y=I.next();if(Y===F){B.f=B.inline=l,L.highlightFormatting&&(B.formatting="link-string");var Q=p(B);return B.linkHref=!1,Q}return I.match(o[F]),B.linkHref=!0,p(B)}}function D(F,I){return F.match(/^([^\]\\]|\\.)*\]:/,!1)?(I.f=N,F.next(),L.highlightFormatting&&(I.formatting="link"),I.linkText=!0,p(I)):u(F,I,l)}function N(F,I){if(F.match(/^\]:/,!0)){I.f=I.inline=W,L.highlightFormatting&&(I.formatting="link");var B=p(I);return I.linkText=!1,B}return F.match(/^([^\]\\]|\\.)+/,!0),j.linkText}function W(F,I){return F.eatSpace()?null:(F.match(/^[^\s]+/,!0),F.peek()===void 0?I.linkTitle=!0:F.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),I.f=I.inline=l,j.linkHref+" url")}var z={startState:function(){return{f:g,prevLine:{stream:null},thisLine:{stream:null},block:g,htmlState:null,indentation:0,inline:l,text:c,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(F){return{f:F.f,prevLine:F.prevLine,thisLine:F.thisLine,block:F.block,htmlState:F.htmlState&&re.copyState(K,F.htmlState),indentation:F.indentation,localMode:F.localMode,localState:F.localMode?re.copyState(F.localMode,F.localState):null,inline:F.inline,text:F.text,formatting:!1,linkText:F.linkText,linkTitle:F.linkTitle,linkHref:F.linkHref,code:F.code,em:F.em,strong:F.strong,strikethrough:F.strikethrough,emoji:F.emoji,header:F.header,setext:F.setext,hr:F.hr,taskList:F.taskList,list:F.list,listStack:F.listStack.slice(0),quote:F.quote,indentedCode:F.indentedCode,trailingSpace:F.trailingSpace,trailingSpaceNewLine:F.trailingSpaceNewLine,md_inside:F.md_inside,fencedEndRE:F.fencedEndRE}},token:function(F,I){if(I.formatting=!1,F!=I.thisLine.stream){if(I.header=0,I.hr=!1,F.match(/^\s*$/,!0))return m(I),null;if(I.prevLine=I.thisLine,I.thisLine={stream:F},I.taskList=!1,I.trailingSpace=0,I.trailingSpaceNewLine=!1,!I.localState&&(I.f=I.block,I.f!=w)){var B=F.match(/^\s*/,!0)[0].replace(/\t/g,s).length;if(I.indentation=B,I.indentationDiff=null,B>0)return null}}return I.f(F,I)},innerMode:function(F){return F.block==w?{state:F.htmlState,mode:K}:F.localState?{state:F.localState,mode:F.localMode}:{state:F,mode:z}},indent:function(F,I,B){return F.block==w&&K.indent?K.indent(F.htmlState,I,B):F.localState&&F.localMode.indent?F.localMode.indent(F.localState,I,B):re.Pass},blankLine:m,getType:p,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return z},"xml"),re.defineMIME("text/markdown","markdown"),re.defineMIME("text/x-markdown","markdown")})},osHv:function(Rt,rt,Z){(function(re){re(Z("VrN/"))})(function(re){"use strict";var V=re.Pos;function L(d,s){return d.line-s.line||d.ch-s.ch}var K="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",M=K+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",P=new RegExp("<(/?)(["+K+"]["+M+"]*)","g");function j(d,s,u,h){this.line=s,this.ch=u,this.cm=d,this.text=d.getLine(s),this.min=h?Math.max(h.from,d.firstLine()):d.firstLine(),this.max=h?Math.min(h.to-1,d.lastLine()):d.lastLine()}function k(d,s){var u=d.cm.getTokenTypeAt(V(d.line,s));return u&&/\btag\b/.test(u)}function C(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function R(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function x(d){for(;;){var s=d.text.indexOf(">",d.ch);if(s==-1){if(C(d))continue;return}if(!k(d,s+1)){d.ch=s+1;continue}var u=d.text.lastIndexOf("/",s),h=u>-1&&!/\S/.test(d.text.slice(u+1,s));return d.ch=s+1,h?"selfClose":"regular"}}function A(d){for(;;){var s=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(s==-1){if(R(d))continue;return}if(!k(d,s+1)){d.ch=s;continue}P.lastIndex=s,d.ch=s;var u=P.exec(d.text);if(u&&u.index==s)return u}}function O(d){for(;;){P.lastIndex=d.ch;var s=P.exec(d.text);if(!s){if(C(d))continue;return}if(!k(d,s.index+1)){d.ch=s.index+1;continue}return d.ch=s.index+s[0].length,s}}function S(d){for(;;){var s=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(s==-1){if(R(d))continue;return}if(!k(d,s+1)){d.ch=s;continue}var u=d.text.lastIndexOf("/",s),h=u>-1&&!/\S/.test(d.text.slice(u+1,s));return d.ch=s+1,h?"selfClose":"regular"}}function _(d,s){for(var u=[];;){var h=O(d),E,m=d.line,g=d.ch-(h?h[0].length:0);if(!h||!(E=x(d)))return;if(E=="selfClose")continue;if(h[1]){for(var w=u.length-1;w>=0;--w)if(u[w]==h[2]){u.length=w;break}if(w<0&&(!s||s==h[2]))return{tag:h[2],from:V(m,g),to:V(d.line,d.ch)}}else u.push(h[2])}}function b(d,s){for(var u=[];;){var h=S(d);if(!h)return;if(h=="selfClose"){A(d);continue}var E=d.line,m=d.ch,g=A(d);if(!g)return;if(g[1])u.push(g[2]);else{for(var w=u.length-1;w>=0;--w)if(u[w]==g[2]){u.length=w;break}if(w<0&&(!s||s==g[2]))return{tag:g[2],from:V(d.line,d.ch),to:V(E,m)}}}}re.registerHelper("fold","xml",function(d,s){for(var u=new j(d,s.line,0);;){var h=O(u);if(!h||u.line!=s.line)return;var E=x(u);if(!E)return;if(!h[1]&&E!="selfClose"){var m=V(u.line,u.ch),g=_(u,h[2]);return g&&L(g.from,m)>0?{from:m,to:g.from}:null}}}),re.findMatchingTag=function(d,s,u){var h=new j(d,s.line,s.ch,u);if(h.text.indexOf(">")==-1&&h.text.indexOf("<")==-1)return;var E=x(h),m=E&&V(h.line,h.ch),g=E&&A(h);if(!E||!g||L(h,s)>0)return;var w={from:V(h.line,h.ch),to:m,tag:g[2]};return E=="selfClose"?{open:w,close:null,at:"open"}:g[1]?{open:b(h,g[2]),close:w,at:"close"}:(h=new j(d,m.line,m.ch,u),{open:w,close:_(h,g[2]),at:"open"})},re.findEnclosingTag=function(d,s,u,h){for(var E=new j(d,s.line,s.ch,u);;){var m=b(E,h);if(!m)break;var g=new j(d,s.line,s.ch,u),w=_(g,m.tag);if(w)return{open:m,close:w}}},re.scanForClosingTag=function(d,s,u,h){var E=new j(d,s.line,s.ch,h?{from:0,to:h}:null);return _(E,u)}})},p5ED:function(Rt,rt,Z){"use strict";var re=Z("+L6B"),V=Z("2/Rp"),L=Z("5Dmo"),K=Z("3S7+"),M=Z("k1fw"),P=Z("tJVT"),j=Z("q1tI"),k=Z.n(j),C=Z("vHTk"),R=Z.n(C),x=Z("yEEn"),A=Z("ZW9T"),O=Z("1vsH");rt.a=function(S){var _=S.name,b=S.data,d=S.theme,s=S.type,u=S.filename,h=S.monacoEditor,E=S.className,m=S.style,g=S.close,w=S.onClose,y=S.hasMask,p=Object(j.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),c=Object(P.a)(p,2),l=c[0],a=c[1],f=Object(j.useState)(""),o=Object(P.a)(f,2),v=o[0],D=o[1],N=Object(j.useRef)();u&&(h.filename=u),Object(j.useEffect)(function(){var F,I,B=(F=document.cookie)===null||F===void 0||((I=F.replace(/\s/g,""))===null||I===void 0)?void 0:I.split(";");B==null||B.map(function(Y){var Q=Y.split("=");Q[0]==="_educoder_session"&&D(Q[1])})},[]);var W=function(){if(b.startsWith("http")||b.startsWith("/")){z();return}Object(O.y)(u||"educoder",b,u)},z=function(){Object(O.w)(u||_,b)};return console.log("data:",b,"fileanme:",u," name:",_),k.a.createElement("div",{style:Object(M.a)({},m||{}),className:"".concat(y&&R.a.bgBlack," ").concat(s?R.a.wrp:"hide")},g&&k.a.createElement("div",{className:R.a.close,ref:N},k.a.createElement(K.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return N.current}},k.a.createElement("span",{onClick:z},k.a.createElement("i",{className:"icon-quxiaozhiding"}))),k.a.createElement(K.a,{title:"\u5173\u95ED",getPopupContainer:function(){return N.current}},k.a.createElement("span",{className:"",onClick:w},k.a.createElement("i",{className:"icon-guanbi1"})))),k.a.createElement("div",{className:"".concat(R.a[E]," ").concat(E," ").concat(R.a.monaco," ").concat(s==="txt"?"show":"hide")},s==="txt"&&k.a.createElement(A.b,h)),s==="audio"&&k.a.createElement("audio",{src:"".concat(b!=null&&b.startsWith("/")||(b==null?void 0:b.indexOf("https://"))>-1?b:"data:audio/mp3;base64,").concat(b),autoPlay:!0}),s==="video"&&k.a.createElement(k.a.Fragment,null,b!=null&&b.startsWith("/")?k.a.createElement("video",{controls:!0,src:"".concat(b),autoPlay:!0}):k.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(b),autoPlay:!0})),s==="pdf"&&k.a.createElement("embed",{className:R.a.embed,src:b}),s==="image"&&k.a.createElement(k.a.Fragment,null,k.a.createElement("img",{src:"".concat(b!=null&&b.startsWith("/")||(b==null?void 0:b.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(b)})),s==="other"&&k.a.createElement("div",null,k.a.createElement(V.a,{type:"primary",size:"large",onClick:W},k.a.createElement(x.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(s==="download"||s==="office")&&k.a.createElement(V.a,{type:"primary",size:"large",onClick:W},k.a.createElement(x.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(Rt,rt,Z){},pr0Y:function(Rt,rt,Z){"use strict";Z.r(rt);var re=Z("+L6B"),V=Z("2/Rp"),L=Z("5NDa"),K=Z("5rEg"),M=Z("5Dmo"),P=Z("3S7+"),j=Z("14J3"),k=Z("BMrR"),C=Z("jCWc"),R=Z("kPKH"),x=Z("sPJy"),A=Z("bE4q"),O=Z("/zsF"),S=Z("PArb"),_=Z("miYZ"),b=Z("tsqr"),d=Z("9og8"),s=Z("k1fw"),u=Z("oBTY"),h=Z("y8nQ"),E=Z("Vl3Y"),m=Z("tJVT"),g=Z("PpiC"),w=Z("B9cy"),y=Z("Ol7k"),p=Z("lUTK"),c=Z("BvKs"),l=Z("WmNS"),a=Z.n(l),f=Z("q1tI"),o=Z.n(f),v=Z("Ty5D"),D=Z("55Ip"),N=Z("9kvl"),W=Z("w5pM"),z=Z("tgas"),F=Z("giR+"),I=Z("fyUT"),B=Z("sRBo"),Y=Z("kaz8"),Q=Z("2qtc"),ee=Z("kLXV"),fe=Z("V0Rq"),ce=Z("Ot1p"),ge=Z("9Bee"),pe=Z("LuLp"),ue=Z.n(pe),le=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],de=function(De,Ct){var vt=De.problemset,ir=De.globalSetting,$t=De.loading,ut=De.dispatch,ze=De.onRef,Fr=ze===void 0?function(){}:ze,Te=De.editData,gr=Object(g.a)(De,["problemset","globalSetting","loading","dispatch","onRef","editData"]),Jt=Object(f.useState)([]),cr=Object(m.a)(Jt,2),Et=cr[0],Vt=cr[1],sr=Object(f.useState)(),Dt=Object(m.a)(sr,2),Ke=Dt[0],ar=Dt[1],Qt=Object(f.useState)([]),Mt=Object(m.a)(Qt,2),ct=Mt[0],yt=Mt[1],Xt=Object(f.useState)(""),Yt=Object(m.a)(Xt,2),_e=Yt[0],tt=Yt[1],Ie=Object(f.useState)(5),vr=Object(m.a)(Ie,2),yr=vr[0],rr=vr[1],fr=Object(f.useState)(!1),st=Object(m.a)(fr,2),hr=st[0],Bt=st[1],Tt=Object(v.i)();Object(f.useEffect)(function(){Vt(["","","",""])},[]),Object(f.useEffect)(function(){if(!(Te!=null&&Te.question_choices)){Bt(!0);return}tt(Te==null?void 0:Te.question_title),rr(parseInt(Te==null?void 0:Te.question_score)),Vt(Te==null?void 0:Te.question_choices.map(function(xt){return xt.choice_text}));var mt=[];Te==null||Te.standard_answer.map(function(xt,He){mt.push(xt-1)}),yt(mt)},[Te]),Object(f.useImperativeHandle)(Ct,function(){return{onSave:Kt,isEdit:hr}});var Kt=function(){var mt=Object(d.a)(a.a.mark(function xt(){var He,wt,ht;return a.a.wrap(function(At){for(;;)switch(At.prev=At.next){case 0:if(_e){At.next=3;break}return b.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE"),At.abrupt("return",!1);case 3:if(He=Et.findIndex(function(It){return!It}),!(He>-1)){At.next=7;break}return b.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(le[He]," \u9009\u9879\u7684\u5185\u5BB9")),At.abrupt("return",!1);case 7:if(ct.length){At.next=10;break}return b.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),At.abrupt("return",!1);case 10:if(!(ct.length<1)){At.next=13;break}return b.b.info("\u8BF7\u9009\u62E9\u7B54\u6848"),At.abrupt("return",!1);case 13:if(wt=Et.map(function(It,lr){return{choice_text:It,is_answer:ct.includes(lr)?lr+1:0}}),!Te.question_id){At.next=20;break}return At.next=17,ut({type:"exercise/editExerciseQuestion",payload:{id:Te.question_id,question_title:_e,question_type:1,question_score:"5.0",question_choices:wt.map(function(It){return It.choice_text}),standard_answers:wt.filter(function(It){return It.is_answer}).map(function(It){return It.is_answer})}});case 17:ht=At.sent,At.next=23;break;case 20:return At.next=22,ut({type:"exercise/addExerciseQuestion",payload:{categoryId:Tt.categoryId,question_title:_e,question_type:1,question_score:"5.0",question_choices:wt.map(function(It){return It.choice_text}),standard_answers:wt.filter(function(It){return It.is_answer}).map(function(It){return It.is_answer})}});case 22:ht=At.sent;case 23:ht.status===0&&(b.b.success("\u4FDD\u5B58\u6210\u529F"),Bt(!1),ut({type:"exercise/editExercise",payload:Object(s.a)({},Tt)}));case 24:case"end":return At.stop()}},xt)}));return function(){return mt.apply(this,arguments)}}(),jt=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],Ot=function(){var mt=Object(d.a)(a.a.mark(function xt(He){return a.a.wrap(function(ht){for(;;)switch(ht.prev=ht.next){case 0:ht.t0=He.id,ht.next=ht.t0==="del"?3:ht.t0==="up"||ht.t0==="down"?5:ht.t0==="edit"?9:11;break;case 3:return ee.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(d.a)(a.a.mark(function At(){return a.a.wrap(function(lr){for(;;)switch(lr.prev=lr.next){case 0:return lr.next=2,Object(fe.m)({id:Te.question_id});case 2:ut({type:"exercise/editExercise",payload:Object(s.a)({},Tt)});case 3:case"end":return lr.stop()}},At)}))()}}),ht.abrupt("break",11);case 5:return ht.next=7,ut({type:"exercise/exeriseMoveUpDown",payload:{id:Te.question_id,opr:He.id}});case 7:return ut({type:"exercise/editExercise",payload:Object(s.a)({},Tt)}),ht.abrupt("break",11);case 9:return Bt(!0),ht.abrupt("break",11);case 11:case"end":return ht.stop()}},xt)}));return function(He){return mt.apply(this,arguments)}}(),pt=function(){var xt;return o.a.createElement("aside",null,o.a.createElement("div",{className:ue.a.questionType},o.a.createElement("div",null,o.a.createElement("span",{className:"font16 c-blue"},Te.key,"\u3001\u591A\u9009\u9898"),"\uFF08",Te.question_score,"\u5206\uFF09"),!Te.hideAction&&jt.map(function(He,wt){return He.id==="up"&&Te.key===1||He.id==="down"&&Te.key===Te.len?null:o.a.createElement(P.a,{key:wt,placement:"bottom",title:He.name},o.a.createElement("span",{onClick:function(){return Ot(He)},className:He.icon}))})),o.a.createElement("div",{className:"mt5"},o.a.createElement(ge.a,{value:Te.question_title})),o.a.createElement("div",{className:ue.a.questionChoices},Te==null||((xt=Te.question_choices)===null||xt===void 0)?void 0:xt.map(function(He,wt){return o.a.createElement(k.a,null,o.a.createElement(R.a,null,o.a.createElement(Y.a,{key:wt,checked:Te.standard_answer.includes(wt+1),disabled:!0},le[wt],".")),o.a.createElement(R.a,{flex:"1"},o.a.createElement("span",{className:"c-black font14"},o.a.createElement(ge.a,{value:He.choice_text}))))})))},mr=function(){return o.a.createElement("aside",null,o.a.createElement("div",{className:ue.a.questionType},o.a.createElement("div",null,o.a.createElement("span",{className:"font16 c-blue"},"\u9009\u62E9\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09")),o.a.createElement("p",{className:ue.a.titleWrap},o.a.createElement("span",{className:ue.a.required},"*"),o.a.createElement("span",{className:ue.a.title},"\u9898\u5E72\uFF1A")),o.a.createElement(ce.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:_e,onChange:function(He){return tt(He)}}),Et.map(function(xt,He){return o.a.createElement("div",{className:ue.a.choiceWrap,key:He},o.a.createElement(P.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},o.a.createElement("div",{className:"".concat(ue.a.answer," ").concat(ct.includes(He)?ue.a.activeAnswer:""),onClick:function(){ct.includes(He)?yt(ct.filter(function(ht){return ht!==He})):yt([].concat(Object(u.a)(ct),[He]))}},le[He])),o.a.createElement("div",{className:ue.a.editorWrap},Ke===He?o.a.createElement(ce.a,{id:"single-question-option-".concat(He),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:xt,onChange:function(ht){Et[He]=ht,Vt(Et)}}):o.a.createElement("div",{className:ue.a.htmlWrap,onClick:function(){return ar(He)}},o.a.createElement(ge.a,{value:xt}))),He>1&&o.a.createElement(P.a,{title:"\u5220\u9664"},o.a.createElement("i",{className:"".concat(ue.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return Vt(Et.filter(function(ht,wr){return wr!==He}))}})),He<7&&He===Et.length-1&&o.a.createElement(P.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},o.a.createElement("i",{className:"".concat(ue.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return Vt([].concat(Object(u.a)(Et),[""]))}})))}),o.a.createElement("p",{className:"c-orange"},"\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\u8F93\u5165\u6846\u53EF\u8BBE\u7F6E\u7B54\u6848\uFF1B\u9009\u4E2D\u7684\u9009\u9879\u5373\u4E3A\u6B63\u786E\u7B54\u6848\uFF0C\u9009\u62E9\u591A\u4E2A\u7B54\u6848\u5373\u4E3A\u591A\u9009\u9898"),o.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",o.a.createElement(I.a,{value:yr,max:1e4,min:-1,onChange:function(He){rr(He)}})," \u5206"),o.a.createElement("aside",{className:"tr"},Te.question_id&&o.a.createElement(V.a,{type:"default",onClick:function(){return Bt(!1)}},"\u53D6\u6D88"),o.a.createElement(V.a,{className:"ml20",type:"primary",onClick:function(){return Kt()}},"\u4FDD\u5B58")))};return o.a.createElement("section",{className:ue.a.wrap},!hr&&pt(),hr&&mr())},ye=Object(N.a)(function(et){var De=et.problemset,Ct=et.loading,vt=et.globalSetting;return{problemset:De,globalSetting:vt,loading:Ct.effects}},null,null,{forwardRef:!0})(Object(f.forwardRef)(de)),Me=Z("7Kak"),Ue=Z("9yH6"),Re=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Oe=function(De,Ct){var vt=De.problemset,ir=De.globalSetting,$t=De.loading,ut=De.dispatch,ze=De.onRef,Fr=ze===void 0?function(){}:ze,Te=De.editData,gr=Object(g.a)(De,["problemset","globalSetting","loading","dispatch","onRef","editData"]),Jt=Object(f.useState)([]),cr=Object(m.a)(Jt,2),Et=cr[0],Vt=cr[1],sr=Object(f.useState)(),Dt=Object(m.a)(sr,2),Ke=Dt[0],ar=Dt[1],Qt=Object(f.useState)([]),Mt=Object(m.a)(Qt,2),ct=Mt[0],yt=Mt[1],Xt=Object(f.useState)(""),Yt=Object(m.a)(Xt,2),_e=Yt[0],tt=Yt[1],Ie=Object(f.useState)(0),vr=Object(m.a)(Ie,2),yr=vr[0],rr=vr[1],fr=Object(f.useState)(!1),st=Object(m.a)(fr,2),hr=st[0],Bt=st[1],Tt=Object(v.i)();Object(f.useEffect)(function(){Vt(["","","",""])},[]),Object(f.useEffect)(function(){if(!(Te!=null&&Te.question_choices)){Bt(!0);return}tt(Te==null?void 0:Te.question_title),rr(parseInt(Te==null?void 0:Te.question_score)),Vt(Te==null?void 0:Te.question_choices.map(function(xt){return xt.choice_text}));var mt=[];Te==null||Te.standard_answer.map(function(xt,He){mt.push(xt-1)}),yt(mt)},[Te]),Object(f.useImperativeHandle)(Ct,function(){return{onSave:Kt,isEdit:hr}});var Kt=function(){var mt=Object(d.a)(a.a.mark(function xt(){var He,wt,ht;return a.a.wrap(function(At){for(;;)switch(At.prev=At.next){case 0:if(_e){At.next=3;break}return b.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE"),At.abrupt("return",!1);case 3:if(He=Et.findIndex(function(It){return!It}),!(He>-1)){At.next=7;break}return b.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(Re[He]," \u9009\u9879\u7684\u5185\u5BB9")),At.abrupt("return",!1);case 7:if(ct.length){At.next=10;break}return b.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),At.abrupt("return",!1);case 10:if(!(ct.length<1)){At.next=13;break}return b.b.info("\u8BF7\u9009\u62E9\u7B54\u6848"),At.abrupt("return",!1);case 13:if(wt=Et.map(function(It,lr){return{choice_text:It,is_answer:ct.includes(lr)?lr+1:0}}),!Te.question_id){At.next=20;break}return At.next=17,Object(z.u)({id:Te.question_id,question_title:_e,question_type:1,question_score:yr,question_choices:wt.map(function(It){return It.choice_text}),standard_answers:wt.filter(function(It){return It.is_answer}).map(function(It){return It.is_answer})});case 17:ht=At.sent,At.next=23;break;case 20:return At.next=22,Object(z.a)({exercise_bank_id:Tt.topicId,question_title:_e,question_type:1,question_score:"5.0",question_choices:wt.map(function(It){return It.choice_text}),standard_answers:wt.filter(function(It){return It.is_answer}).map(function(It){return It.is_answer})});case 22:ht=At.sent;case 23:return ht.status===0&&(b.b.success("\u4FDD\u5B58\u6210\u529F"),Bt(!1)),At.next=26,ut({type:"polls/getExerciseBanks",payload:Object(s.a)({},Tt)});case 26:case"end":return At.stop()}},xt)}));return function(){return mt.apply(this,arguments)}}(),jt=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],Ot=function(){var mt=Object(d.a)(a.a.mark(function xt(He){return a.a.wrap(function(ht){for(;;)switch(ht.prev=ht.next){case 0:ht.t0=He.id,ht.next=ht.t0==="del"?3:ht.t0==="up"||ht.t0==="down"?5:ht.t0==="edit"?9:11;break;case 3:return ee.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(d.a)(a.a.mark(function At(){return a.a.wrap(function(lr){for(;;)switch(lr.prev=lr.next){case 0:return lr.next=2,Object(z.e)({pollsId:Te.question_id});case 2:ut({type:"polls/getExerciseBanks",payload:Object(s.a)({},Tt)});case 3:case"end":return lr.stop()}},At)}))()}}),ht.abrupt("break",11);case 5:return ht.next=7,Object(z.j)({exerciseId:Te==null?void 0:Te.question_id,opr:He.id});case 7:return ut({type:"polls/getExerciseBanks",payload:Object(s.a)({},Tt)}),ht.abrupt("break",11);case 9:return Bt(!0),ht.abrupt("break",11);case 11:case"end":return ht.stop()}},xt)}));return function(He){return mt.apply(this,arguments)}}(),pt=function(){var xt;return o.a.createElement("aside",null,o.a.createElement("div",{className:ue.a.questionType},o.a.createElement("div",null,o.a.createElement("span",{className:"font16 c-blue"},Te.key,"\u3001\u5355\u9009\u9898"),"\uFF08",Te.question_score,"\u5206\uFF09"),!Te.hideAction&&jt.map(function(He,wt){return He.id==="up"&&Te.key===1||He.id==="down"&&Te.key===Te.len?null:o.a.createElement(P.a,{key:wt,placement:"bottom",title:He.name},o.a.createElement("span",{onClick:function(){return Ot(He)},className:He.icon}))})),o.a.createElement("div",{className:"mt5"},o.a.createElement(ge.a,{value:Te.question_title})),o.a.createElement("div",{className:ue.a.questionChoices},Te==null||((xt=Te.question_choices)===null||xt===void 0)?void 0:xt.map(function(He,wt){return o.a.createElement(k.a,null,o.a.createElement(R.a,null,o.a.createElement(Ue.a,{key:wt,checked:Te.standard_answer.includes(wt+1),disabled:!0},Re[wt],".")),o.a.createElement(R.a,{flex:"1"},o.a.createElement("span",{className:"c-black font14"},o.a.createElement(ge.a,{value:He.choice_text}))))})))},mr=function(){return o.a.createElement("aside",null,o.a.createElement("div",{className:ue.a.questionType},o.a.createElement("div",null,o.a.createElement("span",{className:"font16 c-blue"},"\u9009\u62E9\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09")),o.a.createElement("p",{className:ue.a.titleWrap},o.a.createElement("span",{className:ue.a.required},"*"),o.a.createElement("span",{className:ue.a.title},"\u9898\u5E72\uFF1A")),o.a.createElement(ce.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:_e,onChange:function(He){return tt(He)}}),Et.map(function(xt,He){return o.a.createElement("div",{className:ue.a.choiceWrap,key:He},o.a.createElement(P.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},o.a.createElement("div",{className:"".concat(ue.a.answer," ").concat(ct.includes(He)?ue.a.activeAnswer:""),onClick:function(){ct.includes(He)?yt(ct.filter(function(ht){return ht!==He})):yt([].concat(Object(u.a)(ct),[He]))}},Re[He])),o.a.createElement("div",{className:ue.a.editorWrap},Ke===He?o.a.createElement(ce.a,{id:"single-question-option-".concat(He),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:xt,onChange:function(ht){Et[He]=ht,Vt(Et)}}):o.a.createElement("div",{className:ue.a.htmlWrap,onClick:function(){return ar(He)}},o.a.createElement(ge.a,{value:xt}))),He>1&&o.a.createElement(P.a,{title:"\u5220\u9664"},o.a.createElement("i",{className:"".concat(ue.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return Vt(Et.filter(function(ht,wr){return wr!==He}))}})),He<7&&He===Et.length-1&&o.a.createElement(P.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},o.a.createElement("i",{className:"".concat(ue.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return Vt([].concat(Object(u.a)(Et),[""]))}})))}),o.a.createElement("p",{className:"c-orange"},"\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\u8F93\u5165\u6846\u53EF\u8BBE\u7F6E\u7B54\u6848\uFF1B\u9009\u4E2D\u7684\u9009\u9879\u5373\u4E3A\u6B63\u786E\u7B54\u6848\uFF0C\u9009\u62E9\u591A\u4E2A\u7B54\u6848\u5373\u4E3A\u591A\u9009\u9898"),o.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",o.a.createElement(I.a,{value:yr,max:1e4,min:-1,onChange:function(He){rr(He)}})," \u5206"),o.a.createElement("aside",{className:"tr"},Te.question_id&&o.a.createElement(V.a,{type:"default",onClick:function(){return Bt(!1)}},"\u53D6\u6D88"),o.a.createElement(V.a,{className:"ml20",type:"primary",onClick:function(){return Kt()}},"\u4FDD\u5B58")))};return o.a.createElement("section",{className:ue.a.wrap},!hr&&pt(),hr&&mr())},Ce=Object(N.a)(function(et){var De=et.problemset,Ct=et.loading,vt=et.globalSetting;return{problemset:De,globalSetting:vt,loading:Ct.effects}},null,null,{forwardRef:!0})(Object(f.forwardRef)(Oe)),Le=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Fe=function(De,Ct){var vt=De.problemset,ir=De.globalSetting,$t=De.loading,ut=De.dispatch,ze=De.onRef,Fr=ze===void 0?function(){}:ze,Te=De.editData,gr=Object(g.a)(De,["problemset","globalSetting","loading","dispatch","onRef","editData"]),Jt=Object(f.useState)(),cr=Object(m.a)(Jt,2),Et=cr[0],Vt=cr[1],sr=Object(f.useState)(""),Dt=Object(m.a)(sr,2),Ke=Dt[0],ar=Dt[1],Qt=Object(f.useState)(!1),Mt=Object(m.a)(Qt,2),ct=Mt[0],yt=Mt[1],Xt=Object(f.useState)(5),Yt=Object(m.a)(Xt,2),_e=Yt[0],tt=Yt[1],Ie=Object(v.i)();Object(f.useEffect)(function(){if(!(Te!=null&&Te.question_choices)){yt(!0);return}ar(Te==null?void 0:Te.question_title),tt(Te==null?void 0:Te.question_score),Vt(Te.standard_answer[0]+"")},[Te]),Object(f.useImperativeHandle)(Ct,function(){return{onSave:vr,isEdit:ct}});var vr=function(){var hr=Object(d.a)(a.a.mark(function Bt(){var Tt,Kt;return a.a.wrap(function(Ot){for(;;)switch(Ot.prev=Ot.next){case 0:if(Ke){Ot.next=3;break}return b.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),Ot.abrupt("return",!1);case 3:if(Et){Ot.next=6;break}return b.b.info("\u8BF7\u5148\u70B9\u51FB\u9009\u62E9\u672C\u9009\u62E9\u9898\u7684\u6B63\u786E\u9009\u9879"),Ot.abrupt("return",!1);case 6:if(Tt=[{choice_text:"\u6B63\u786E",is_answer:Et==="1"?1:0},{choice_text:"\u9519\u8BEF",is_answer:Et==="2"?2:0}],!Te.question_id){Ot.next=13;break}return Ot.next=10,Object(z.u)({id:Te.question_id,question_title:Ke,question_type:2,question_score:_e,question_choices:Tt.map(function(pt){return pt.choice_text}),standard_answers:Tt.filter(function(pt){return pt.is_answer}).map(function(pt){return pt.is_answer})});case 10:Kt=Ot.sent,Ot.next=16;break;case 13:return Ot.next=15,Object(z.a)({exercise_bank_id:Ie.topicId,question_title:Ke,question_type:2,question_score:_e,question_choices:Tt.map(function(pt){return pt.choice_text}),standard_answers:Tt.filter(function(pt){return pt.is_answer}).map(function(pt){return pt.is_answer})});case 15:Kt=Ot.sent;case 16:return Kt.status===0&&(b.b.success("\u4FDD\u5B58\u6210\u529F"),yt(!1)),ut({type:"polls/getExerciseBanks",payload:Object(s.a)({},Ie)}),Ot.abrupt("return",{name:Ke,choices:Tt});case 19:case"end":return Ot.stop()}},Bt)}));return function(){return hr.apply(this,arguments)}}(),yr=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],rr=function(){var hr=Object(d.a)(a.a.mark(function Bt(Tt){return a.a.wrap(function(jt){for(;;)switch(jt.prev=jt.next){case 0:jt.t0=Tt.id,jt.next=jt.t0==="del"?3:jt.t0==="up"||jt.t0==="down"?5:jt.t0==="edit"?9:11;break;case 3:return ee.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(d.a)(a.a.mark(function pt(){return a.a.wrap(function(mt){for(;;)switch(mt.prev=mt.next){case 0:return mt.next=2,Object(z.e)({pollsId:Te.question_id});case 2:ut({type:"polls/getExerciseBanks",payload:Object(s.a)({},Ie)});case 3:case"end":return mt.stop()}},pt)}))()}}),jt.abrupt("break",11);case 5:return jt.next=7,Object(z.j)({exerciseId:Te==null?void 0:Te.question_id,opr:Tt.id});case 7:return ut({type:"polls/getExerciseBanks",payload:Object(s.a)({},Ie)}),jt.abrupt("break",11);case 9:return yt(!0),jt.abrupt("break",11);case 11:case"end":return jt.stop()}},Bt)}));return function(Tt){return hr.apply(this,arguments)}}(),fr=function(){var Bt;return o.a.createElement("aside",null,o.a.createElement("div",{className:ue.a.questionType},o.a.createElement("div",null,o.a.createElement("span",{className:"font16 c-blue"},Te.key,"\u3001\u5224\u65AD\u9898"),"\uFF08",Te.question_score,"\u5206\uFF09"),!Te.hideAction&&yr.map(function(Tt,Kt){return Tt.id==="up"&&Te.key===1||Tt.id==="down"&&Te.key===Te.len?null:o.a.createElement(P.a,{key:Kt,placement:"bottom",title:Tt.name},o.a.createElement("span",{onClick:function(){return rr(Tt)},className:Tt.icon}))})),o.a.createElement("div",{className:"mt5"},Te.question_title),o.a.createElement("div",{className:ue.a.questionChoices},Te==null||((Bt=Te.question_choices)===null||Bt===void 0)?void 0:Bt.map(function(Tt,Kt){return o.a.createElement(Ue.a,{key:Kt,checked:Te.standard_answer.includes(Kt+1),disabled:!0},Le[Kt],". ",o.a.createElement("span",{className:"c-black font14"},Tt.choice_text))})))},st=function(){return o.a.createElement("aside",null,o.a.createElement("div",null,o.a.createElement("span",{className:"font16 c-blue"},"\u5224\u65AD\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09"),o.a.createElement("p",{className:ue.a.titleWrap},o.a.createElement("span",{className:ue.a.required},"*"),o.a.createElement("span",{className:ue.a.title},"\u9898\u5E72\uFF1A")),o.a.createElement(ce.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Ke,onChange:function(Tt){return ar(Tt)}}),o.a.createElement("p",{className:ue.a.titleWrap},o.a.createElement("span",{className:ue.a.required},"*"),o.a.createElement("span",{className:ue.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",o.a.createElement("span",{className:ue.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),o.a.createElement(Ue.a.Group,{buttonStyle:"solid",value:Et,onChange:function(Tt){return Vt(Tt.target.value)}},o.a.createElement(Ue.a.Button,{value:"1",className:"".concat(ue.a.radio," mr40")},"\u6B63\u786E"),o.a.createElement(Ue.a.Button,{value:"2",className:ue.a.radio},"\u9519\u8BEF")),o.a.createElement("p",{className:"c-orange"},"\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\uFF0C\u53EF\u4EE5\u76F4\u63A5\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848"),o.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",o.a.createElement(I.a,{value:_e,max:1e4,min:-1,onChange:function(Tt){tt(Tt)}})," \u5206"),o.a.createElement("aside",{className:"tr"},Te.question_id&&o.a.createElement(V.a,{type:"default",onClick:function(){return yt(!1)}},"\u53D6\u6D88"),o.a.createElement(V.a,{className:"ml20",type:"primary",onClick:function(){return vr()}},"\u4FDD\u5B58")))};return o.a.createElement("section",{className:ue.a.wrap},!ct&&fr(),ct&&st())},We=Object(N.a)(function(et){var De=et.problemset,Ct=et.loading,vt=et.globalSetting;return{problemset:De,globalSetting:vt,loading:Ct.effects}},null,null,{forwardRef:!0})(Object(f.forwardRef)(Fe)),Be=Z("kqOp"),Ae=Z("7qnI"),Se=Z("1vsH"),$e=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],qe=function(De,Ct){var vt=De.problemset,ir=De.globalSetting,$t=De.loading,ut=De.dispatch,ze=De.editData,Fr=Object(g.a)(De,["problemset","globalSetting","loading","dispatch","editData"]),Te=Object(f.useState)(""),gr=Object(m.a)(Te,2),Jt=gr[0],cr=gr[1],Et=Object(f.useState)(""),Vt=Object(m.a)(Et,2),sr=Vt[0],Dt=Vt[1],Ke=Object(f.useState)([]),ar=Object(m.a)(Ke,2),Qt=ar[0],Mt=ar[1],ct=Object(f.useState)(""),yt=Object(m.a)(ct,2),Xt=yt[0],Yt=yt[1],_e=Object(f.useState)(),tt=Object(m.a)(_e,2),Ie=tt[0],vr=tt[1],yr=Object(f.useState)(!1),rr=Object(m.a)(yr,2),fr=rr[0],st=rr[1],hr=Object(f.useState)(5),Bt=Object(m.a)(hr,2),Tt=Bt[0],Kt=Bt[1],jt=Object(f.useState)(!1),Ot=Object(m.a)(jt,2),pt=Ot[0],mr=Ot[1],mt=Object(v.i)();Object(f.useEffect)(function(){if(!(ze!=null&&ze.question_title)){mr(!0);return}cr(ze==null?void 0:ze.question_title),vr(ze==null?void 0:ze.is_ordered),Kt(ze==null?void 0:ze.question_score);var zt=ze==null?void 0:ze.standard_answer.map(function(dt){return dt.answer_text});Mt(zt)},[vt.editData]),Object(f.useEffect)(function(){st(!1)},[pt]),Object(f.useImperativeHandle)(Ct,function(){return{onSave:xt,isEdit:pt}});var xt=function(){var zt=Object(d.a)(a.a.mark(function dt(){var at,Pt,Wt;return a.a.wrap(function(_t){for(;;)switch(_t.prev=_t.next){case 0:if(at=[],Pt=!1,Qt.forEach(function(Wr,Hr){at.push({choice_id:Hr+1,answer_text:[]}),Wr.forEach(function(ln,un){at[Hr].answer_text.push(ln),(!ln||!Object(Se.cb)(ln,1e4))&&(Yt("".concat(Hr,"-").concat(un)),b.b.info(ln?"\u7B54\u6848\u4E0D\u80FD\u8D85\u8FC710000\u5B57\u7B26":"\u7B54\u6848\uFF1A\u4E0D\u80FD\u4E3A\u7A7A"),Pt=!0)})}),!Pt){_t.next=5;break}return _t.abrupt("return",!1);case 5:if(!ze.question_id){_t.next=11;break}return _t.next=8,Object(z.u)({id:ze.question_id,question_title:Jt,question_type:3,question_score:Tt,is_ordered:Ie,standard_answers:at});case 8:Wt=_t.sent,_t.next=14;break;case 11:return _t.next=13,Object(z.a)({exercise_bank_id:mt.topicId,question_title:Jt,question_type:3,question_score:Tt,is_ordered:Ie,standard_answers:at});case 13:Wt=_t.sent;case 14:return Wt.status===0&&(b.b.success("\u4FDD\u5B58\u6210\u529F"),mr(!1)),ut({type:"polls/getExerciseBanks",payload:Object(s.a)({},mt)}),_t.abrupt("return",{name:Jt,analysis:sr,standard_answers:at,is_ordered:Ie});case 17:case"end":return _t.stop()}},dt)}));return function(){return zt.apply(this,arguments)}}(),He=function(dt,at,Pt){var Wt=Qt.slice();if(at&&Wt.splice(dt,at),Pt&&fr)for(var Gt=0;Gt<Pt;Gt++)Wt.splice(dt+Gt,0,[""]);st(!0),Mt(Wt)},wt=function(dt,at,Pt){Yt("");var Wt=Qt.slice();Wt[dt][at]=Pt,Mt(Wt)},ht=function(dt){var at=Qt.slice();at[dt]=[].concat(Object(u.a)(at[dt]),[""]),Mt(at)},wr=function(dt,at){var Pt=Qt.slice();if(!Pt[dt][at]){Pt[dt]=Pt[dt].filter(function(Wt,Gt){return Gt!==at}),Mt(Pt);return}ee.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:ue.a.modal,onOk:function(){Pt[dt]=Pt[dt].filter(function(Gt,_t){return _t!==at}),Mt(Pt)}})},At=function(dt){ee.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:ue.a.modal,onOk:function(){var Pt=Qt.slice();Pt=Qt.filter(function(Wt,Gt){return dt!==Gt}),Mt(Pt)}})},It=function(){return o.a.createElement("aside",null,o.a.createElement("div",{className:ue.a.questionType},o.a.createElement("div",null,o.a.createElement("span",{className:"font16 c-blue"},"\u586B\u7A7A\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u5141\u8BB8\u624B\u52A8\u8C03\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848 \uFF1B\u652F\u6301\u6700\u591A5\u4E2A\u7A7A\uFF0C\u6BCF\u7A7A\u5F97\u5206\u6309\u7167\u672C\u9898\u7684\u603B\u5206\u5E73\u5747\u8BA1\u7B97\uFF09")),o.a.createElement("div",null,o.a.createElement(Be.a,{id:"completion-question-tittle",placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE",height:155,defaultValue:Jt,onChange:function(at){return cr(at)},showNullButton:!0,onPlaceholderChange:He})),o.a.createElement("div",{className:"mt20"},Qt.map(function(dt,at){return o.a.createElement(Ae.a,{key:at,answers:dt,index:at,is_md:!0,activeOptionErrorIndex:Xt,onAnswerChange:wt,addChildAnswer:ht,deleteChildAnswer:wr,deleteChildAnswermain:At})})),o.a.createElement("div",{className:"mt20"},Qt.length>1&&o.a.createElement("span",null,o.a.createElement(Y.a,{checked:Ie,onChange:function(at){return vr(at.target.checked)},className:"".concat(ue.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),o.a.createElement("span",{className:"".concat(ue.a.color999," font12")},"\uFF08\u9009\u4E2D\uFF0C\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u987A\u5E8F\u5FC5\u987B\u4E0E\u53C2\u8003\u7B54\u6848\u4E00\u81F4\uFF09"))),o.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",o.a.createElement(I.a,{value:Tt,max:1e4,min:-1,onChange:function(at){Kt(at)}})," \u5206"),o.a.createElement("aside",{className:"tr"},ze.question_id&&o.a.createElement(V.a,{type:"default",onClick:function(){return mr(!1)}},"\u53D6\u6D88"),o.a.createElement(V.a,{className:"ml20",type:"primary",onClick:function(){return xt()}},"\u4FDD\u5B58")))},lr=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],Rr=function(){var zt=Object(d.a)(a.a.mark(function dt(at){return a.a.wrap(function(Wt){for(;;)switch(Wt.prev=Wt.next){case 0:Wt.t0=at.id,Wt.next=Wt.t0==="del"?3:Wt.t0==="up"||Wt.t0==="down"?5:Wt.t0==="edit"?9:11;break;case 3:return ee.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(d.a)(a.a.mark(function _t(){return a.a.wrap(function(Hr){for(;;)switch(Hr.prev=Hr.next){case 0:return Hr.next=2,Object(z.e)({pollsId:ze.question_id});case 2:ut({type:"polls/getExerciseBanks",payload:Object(s.a)({},mt)});case 3:case"end":return Hr.stop()}},_t)}))()}}),Wt.abrupt("break",11);case 5:return Wt.next=7,Object(z.j)({exerciseId:ze==null?void 0:ze.question_id,opr:at.id});case 7:return ut({type:"polls/getExerciseBanks",payload:Object(s.a)({},mt)}),Wt.abrupt("break",11);case 9:return mr(!0),Wt.abrupt("break",11);case 11:case"end":return Wt.stop()}},dt)}));return function(at){return zt.apply(this,arguments)}}(),Or=function(){var dt;return o.a.createElement("aside",null,o.a.createElement("div",{className:ue.a.questionType},o.a.createElement("div",null,o.a.createElement("span",{className:"font16 c-blue"},ze.key,"\u3001\u586B\u7A7A\u9898"),"\uFF08",ze.question_score,"\u5206\uFF09"),!ze.hideAction&&lr.map(function(at,Pt){return at.id==="up"&&ze.key===1||at.id==="down"&&ze.key===ze.len?null:o.a.createElement(P.a,{key:Pt,placement:"bottom",title:at.name},o.a.createElement("span",{onClick:function(){return Rr(at)},className:at.icon}))})),o.a.createElement("div",{className:"mt5"},ze.question_title),o.a.createElement("div",{className:ue.a.questionChoices},ze==null||((dt=ze.standard_answer)===null||dt===void 0)?void 0:dt.map(function(at,Pt){return o.a.createElement(k.a,null,o.a.createElement(R.a,null,"\u7B54\u6848\uFF08\u586B\u7A7A",at.choice_id,"\uFF09\uFF1A"),o.a.createElement(R.a,{flex:"1"},o.a.createElement(K.a,{key:Pt,checked:ze.standard_answer.includes(Pt),disabled:!0,value:at.answer_text})))})))};return o.a.createElement("section",{className:ue.a.wrap},!pt&&Or(),pt&&It())},Je=Object(N.a)(function(et){var De=et.problemset,Ct=et.loading,vt=et.globalSetting;return{problemset:De,globalSetting:vt,loading:Ct.effects}},null,null,{forwardRef:!0})(Object(f.forwardRef)(qe)),Xe=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],ot=function(De,Ct){var vt=De.problemset,ir=De.globalSetting,$t=De.loading,ut=De.dispatch,ze=De.onRef,Fr=ze===void 0?function(){}:ze,Te=De.editData,gr=Object(g.a)(De,["problemset","globalSetting","loading","dispatch","onRef","editData"]),Jt=Object(f.useState)(""),cr=Object(m.a)(Jt,2),Et=cr[0],Vt=cr[1],sr=Object(f.useState)(""),Dt=Object(m.a)(sr,2),Ke=Dt[0],ar=Dt[1],Qt=Object(f.useState)(""),Mt=Object(m.a)(Qt,2),ct=Mt[0],yt=Mt[1],Xt=Object(f.useState)(5),Yt=Object(m.a)(Xt,2),_e=Yt[0],tt=Yt[1],Ie=Object(f.useState)(!1),vr=Object(m.a)(Ie,2),yr=vr[0],rr=vr[1],fr=Object(v.i)();Object(f.useEffect)(function(){var jt;if(!(Te!=null&&Te.question_title)){rr(!0);return}Vt(Te==null?void 0:Te.question_title),yt(Te==null||((jt=Te.standard_answer)===null||jt===void 0)?void 0:jt[0]),tt(Te==null?void 0:Te.question_score)},[vt.editData]),Object(f.useImperativeHandle)(Ct,function(){return{onSave:st,isEdit:yr}});var st=function(){var jt=Object(d.a)(a.a.mark(function Ot(){var pt;return a.a.wrap(function(mt){for(;;)switch(mt.prev=mt.next){case 0:if(Et){mt.next=3;break}return b.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),mt.abrupt("return",!1);case 3:if(!Te.question_id){mt.next=9;break}return mt.next=6,Object(z.u)({id:Te.question_id,question_title:Et,question_type:4,question_score:_e,standard_answers:[ct]});case 6:pt=mt.sent,mt.next=12;break;case 9:return mt.next=11,Object(z.a)({exercise_bank_id:fr.topicId,question_title:Et,question_type:4,question_score:_e,standard_answers:[ct]});case 11:pt=mt.sent;case 12:return pt.status===0&&(b.b.success("\u4FDD\u5B58\u6210\u529F"),rr(!1),ut({type:"polls/getExerciseBanks",payload:Object(s.a)({},fr)})),mt.abrupt("return",{name:Et,answer_texts:[ct],analysis:Ke});case 14:case"end":return mt.stop()}},Ot)}));return function(){return jt.apply(this,arguments)}}(),hr=function(){return o.a.createElement("aside",null,o.a.createElement("div",{className:ue.a.questionType},o.a.createElement("div",null,o.a.createElement("span",{className:"font16 c-blue"},"\u7B80\u7B54\u9898"),"\uFF08\u4E3B\u89C2\u9898\uFF0C\u672A\u4F5C\u7B54\u7684\u60C5\u51B5\u4E0B\u81EA\u52A8\u8BC4\u4E3A\u96F6\u5206\uFF09")),o.a.createElement(ce.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Et,onChange:function(pt){return Vt(pt)}}),o.a.createElement("p",{className:ue.a.titleWrap},o.a.createElement("span",{className:ue.a.title},"\u53C2\u8003\u7B54\u6848\uFF1A")),o.a.createElement(ce.a,{id:"single-question-reference-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848",defaultValue:ct,onChange:function(pt){return yt(pt)}}),o.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",o.a.createElement(I.a,{value:_e,max:1e4,min:-1,onChange:function(pt){tt(pt)}})," \u5206"),o.a.createElement("aside",{className:"tr"},Te.question_id&&o.a.createElement(V.a,{type:"default",onClick:function(){return rr(!1)}},"\u53D6\u6D88"),o.a.createElement(V.a,{className:"ml20",type:"primary",onClick:function(){return st()}},"\u4FDD\u5B58")))},Bt=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],Tt=function(){var jt=Object(d.a)(a.a.mark(function Ot(pt){return a.a.wrap(function(mt){for(;;)switch(mt.prev=mt.next){case 0:mt.t0=pt.id,mt.next=mt.t0==="del"?3:mt.t0==="up"||mt.t0==="down"?5:mt.t0==="edit"?9:11;break;case 3:return ee.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(d.a)(a.a.mark(function He(){return a.a.wrap(function(ht){for(;;)switch(ht.prev=ht.next){case 0:return ht.next=2,Object(z.e)({pollsId:Te.question_id});case 2:ut({type:"polls/getExerciseBanks",payload:Object(s.a)({},fr)});case 3:case"end":return ht.stop()}},He)}))()}}),mt.abrupt("break",11);case 5:return mt.next=7,Object(z.j)({exerciseId:Te==null?void 0:Te.question_id,opr:pt.id});case 7:return ut({type:"polls/getExerciseBanks",payload:Object(s.a)({},fr)}),mt.abrupt("break",11);case 9:return rr(!0),mt.abrupt("break",11);case 11:case"end":return mt.stop()}},Ot)}));return function(pt){return jt.apply(this,arguments)}}(),Kt=function(){return o.a.createElement("aside",null,o.a.createElement("div",{className:ue.a.questionType},o.a.createElement("div",null,o.a.createElement("span",{className:"font16 c-blue"},Te.key,"\u3001\u7B80\u7B54\u9898"),"\uFF08",Te.question_score,"\u5206\uFF09"),!Te.hideAction&&Bt.map(function(Ot,pt){return Ot.id==="up"&&Te.key===1||Ot.id==="down"&&Te.key===Te.len?null:o.a.createElement(P.a,{key:pt,placement:"bottom",title:Ot.name},o.a.createElement("span",{onClick:function(){return Tt(Ot)},className:Ot.icon}))})),o.a.createElement("div",{className:"mt5"},Te.question_title),o.a.createElement("div",{className:ue.a.questionChoices},o.a.createElement("p",null,o.a.createElement("strong",null,"\u53C2\u8003\u7B54\u6848\uFF1A")),o.a.createElement(ge.a,{value:ct})))};return o.a.createElement("section",{className:ue.a.wrap},!yr&&Kt(),yr&&hr())},Qe=Object(N.a)(function(et){var De=et.problemset,Ct=et.loading,vt=et.globalSetting;return{problemset:De,globalSetting:vt,loading:Ct.effects}},null,null,{forwardRef:!0})(Object(f.forwardRef)(ot)),Ye=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Ee=function(De,Ct){var vt=De.problemset,ir=De.globalSetting,$t=De.loading,ut=De.dispatch,ze=De.editData,Fr=Object(g.a)(De,["problemset","globalSetting","loading","dispatch","editData"]),Te=Object(f.useState)(""),gr=Object(m.a)(Te,2),Jt=gr[0],cr=gr[1],Et=Object(f.useState)(""),Vt=Object(m.a)(Et,2),sr=Vt[0],Dt=Vt[1],Ke=Object(f.useState)(""),ar=Object(m.a)(Ke,2),Qt=ar[0],Mt=ar[1],ct=Object(f.useState)([]),yt=Object(m.a)(ct,2),Xt=yt[0],Yt=yt[1],_e=Object(f.useState)(""),tt=Object(m.a)(_e,2),Ie=tt[0],vr=tt[1],yr=Object(f.useState)(),rr=Object(m.a)(yr,2),fr=rr[0],st=rr[1],hr=Object(f.useState)(!1),Bt=Object(m.a)(hr,2),Tt=Bt[0],Kt=Bt[1],jt=Object(f.useState)([]),Ot=Object(m.a)(jt,2),pt=Ot[0],mr=Ot[1],mt=Object(f.useState)(!1),xt=Object(m.a)(mt,2),He=xt[0],wt=xt[1],ht=Object(v.i)();Object(f.useEffect)(function(){var Or;ze.edit&&wt(!0),cr(ze.shixun_name),Dt(ze.question_title);var zt=[];(Or=ze.shixun)===null||Or===void 0||Or.map(function(dt){zt.push(dt.challenge_score)}),mr(zt)},[ze]),Object(f.useEffect)(function(){Kt(!1)},[He]),Object(f.useImperativeHandle)(Ct,function(){return{onSave:wr,isEdit:He}});var wr=function(){var Or=Object(d.a)(a.a.mark(function zt(){var dt,at,Pt;return a.a.wrap(function(Gt){for(;;)switch(Gt.prev=Gt.next){case 0:if(dt=[],at=!1,!at){Gt.next=4;break}return Gt.abrupt("return",!1);case 4:if(!ze.question_id){Gt.next=10;break}return Gt.next=7,Object(z.u)({id:ze.question_id,question_title:sr,shixun_name:Jt,shixun_id:ze.shixun_id,question_type:5,question_scores:pt});case 7:Pt=Gt.sent,Gt.next=13;break;case 10:return Gt.next=12,Object(z.a)({exercise_bank_id:ht.topicId,question_title:sr,shixun_name:Jt,shixun_id:ze.shixun_id,question_type:5,question_scores:pt});case 12:Pt=Gt.sent;case 13:return Pt.status===0&&(b.b.success("\u4FDD\u5B58\u6210\u529F"),wt(!1)),Gt.next=16,ut({type:"polls/getExerciseBanks",payload:Object(s.a)({},ht)});case 16:return Gt.abrupt("return",{name:sr,analysis:Qt,standard_answers:dt,is_ordered:fr});case 17:case"end":return Gt.stop()}},zt)}));return function(){return Or.apply(this,arguments)}}(),At=function(){var zt;return o.a.createElement("aside",null,o.a.createElement("div",{className:ue.a.questionType},o.a.createElement("div",null,o.a.createElement("span",{className:"font16 c-blue"},"\u5B9E\u8BAD\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u5141\u8BB8\u624B\u52A8\u8C03\u5206\uFF09")),o.a.createElement("div",{className:"mt10"},o.a.createElement(K.a,{defaultValue:Jt,onChange:function(at){cr(at.target.value)}})),o.a.createElement("div",{className:"mt10"},o.a.createElement(ce.a,{id:"single-question-option-0",height:155,placeholder:"\u8BF7\u8F93\u5165\u5B9E\u8BAD\u9898\u5B8C\u6210\u8981\u6C42",defaultValue:sr,onChange:function(at){Dt(at)}})),o.a.createElement("div",{className:"mt20"},(zt=ze.shixun)===null||zt===void 0?void 0:zt.map(function(dt,at){return o.a.createElement(k.a,{gutter:[20,20]},o.a.createElement(R.a,{flex:"1"},at+1,".",dt.challenge_name),o.a.createElement(R.a,null,o.a.createElement(I.a,{defaultValue:pt[at],onChange:function(Wt){pt[at]=Wt,mr(pt),console.log("srore:L",pt[at])}})))})),o.a.createElement("div",{className:"mt20"},Xt.length>1&&o.a.createElement("span",null,o.a.createElement(Y.a,{checked:fr,onChange:function(at){return st(at.target.checked)},className:"".concat(ue.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),o.a.createElement("span",{className:"".concat(ue.a.color999," font12")},"\uFF08\u9009\u4E2D\uFF0C\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u987A\u5E8F\u5FC5\u987B\u4E0E\u53C2\u8003\u7B54\u6848\u4E00\u81F4\uFF09"))),o.a.createElement("aside",{className:"tr"},!(ze!=null&&ze.edit)&&o.a.createElement(V.a,{type:"default",onClick:function(){return wt(!1)}},"\u53D6\u6D88"),o.a.createElement(V.a,{className:"ml20",type:"primary",onClick:function(){return wr()}},"\u4FDD\u5B58")))},It=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],lr=function(){var Or=Object(d.a)(a.a.mark(function zt(dt){return a.a.wrap(function(Pt){for(;;)switch(Pt.prev=Pt.next){case 0:Pt.t0=dt.id,Pt.next=Pt.t0==="del"?3:Pt.t0==="up"||Pt.t0==="down"?5:Pt.t0==="edit"?9:11;break;case 3:return ee.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(d.a)(a.a.mark(function Gt(){return a.a.wrap(function(Wr){for(;;)switch(Wr.prev=Wr.next){case 0:return Wr.next=2,Object(z.e)({pollsId:ze.question_id});case 2:ut({type:"polls/getExerciseBanks",payload:Object(s.a)({},ht)});case 3:case"end":return Wr.stop()}},Gt)}))()}}),Pt.abrupt("break",11);case 5:return Pt.next=7,Object(z.j)({exerciseId:ze==null?void 0:ze.question_id,opr:dt.id});case 7:return ut({type:"polls/getExerciseBanks",payload:Object(s.a)({},ht)}),Pt.abrupt("break",11);case 9:return wt(!0),Pt.abrupt("break",11);case 11:case"end":return Pt.stop()}},zt)}));return function(dt){return Or.apply(this,arguments)}}(),Rr=function(){var zt;return o.a.createElement("aside",null,o.a.createElement("div",{className:ue.a.questionType},o.a.createElement("div",null,o.a.createElement("span",{className:"font16 c-blue"},ze.key,"\u3001\u5B9E\u8BAD\u9898"),"\uFF08",ze.question_score,"\u5206\uFF09"),o.a.createElement("div",{className:"tr"},o.a.createElement(D.a,{target:"_blank",to:"/shixuns/".concat(ze.shixun_identifier,"/challenges")},"\u5B9E\u8BAD\u8BE6\u60C5"),!ze.hideAction&&It.map(function(dt,at){return dt.id==="up"&&ze.key===1||dt.id==="down"&&ze.key===ze.len?null:o.a.createElement(P.a,{key:at,placement:"bottom",title:dt.name},o.a.createElement("span",{onClick:function(){return lr(dt)},className:dt.icon}))}))),o.a.createElement("div",{className:"font16"},ze.shixun_name),o.a.createElement("div",{className:"mt30"}),(zt=ze.shixun)===null||zt===void 0?void 0:zt.map(function(dt,at){return o.a.createElement("div",{key:at},"\u7B2C",at+1,"\u5173 ",o.a.createElement("span",{className:"ml10"},dt.challenge_name)," ",o.a.createElement("span",{className:"ml10"},dt.challenge_score))}))};return o.a.createElement("section",{className:ue.a.wrap},!He&&Rr(),He&&At())},nt=Object(N.a)(function(et){var De=et.problemset,Ct=et.loading,vt=et.globalSetting;return{problemset:De,globalSetting:vt,loading:Ct.effects}},null,null,{forwardRef:!0})(Object(f.forwardRef)(Ee)),Ze=Z("bbsP"),xe=Z("/wGt"),Ne=Z("DjyN"),ne=Z("NUBc"),oe=Z("uSYw"),ae=Z.n(oe),$=K.a.Search,J=[{id:"type",name:"\u7B5B\u9009",children:[{name:"\u5168\u90E8\u5B9E\u8BAD",id:"all",type:"type"},{name:"\u6211\u7684\u5B9E\u8BAD",id:"mine",type:"type"}]},{id:"diff",name:"\u96BE\u5EA6",children:[{name:"\u5168\u90E8",id:"",type:"diff"},{name:"\u521D\u7EA7",id:1,type:"diff"},{name:"\u4E2D\u7EA7",id:2,type:"diff"},{name:"\u4E2D\u9AD8\u7EA7",id:3,type:"diff"},{name:"\u9AD8\u7EA7",id:4,type:"diff"}]}],q=function(De){var Ct,vt=De.classroomList,ir=De.loading,$t=De.dispatch,ut=De.callback,ze=Object(v.i)(),Fr=Object(v.h)(),Te=vt.actionTabs,gr=E.a.useForm(),Jt=Object(m.a)(gr,1),cr=Jt[0],Et=vt.shixunLists,Vt=Object(f.useState)([]),sr=Object(m.a)(Vt,2),Dt=sr[0],Ke=sr[1],ar=Object(f.useState)({page:1,type:"all",diff:"",status:"published",order:"desc",limit:20,sort:"publish_time",no_jupyter:1}),Qt=Object(m.a)(ar,2),Mt=Qt[0],ct=Qt[1];return Object(f.useEffect)(function(){$t({type:"classroomList/getShixunLists",payload:Object(s.a)({},Mt)})},[ze.categoryId]),Object(f.useEffect)(function(){Ke([])},[vt.actionTabs.key]),vt.actionTabs.key!=="\u9009\u7528\u5B9E\u8DF5\u9879\u76EE"?null:o.a.createElement(xe.a,{title:"\u9009\u7528\u5B9E\u8DF5\u9879\u76EE",placement:"bottom",height:"100%",closable:!1,visible:vt.actionTabs.key==="\u9009\u7528\u5B9E\u8DF5\u9879\u76EE",key:"bottom",className:ae.a.drawer,footer:o.a.createElement("div",{className:"tc"},o.a.createElement(V.a,{size:"large",onClick:function(){$t({type:"classroomList/setActionTabs",payload:{key:""}})},style:{marginRight:8}},"\u53D6\u6D88"),o.a.createElement(V.a,{size:"large",onClick:Object(d.a)(a.a.mark(function yt(){var Xt;return a.a.wrap(function(_e){for(;;)switch(_e.prev=_e.next){case 0:Dt.length>1?b.b.error("\u53EA\u80FD\u9009\u62E9\u4E00\u4E2A\u5B9E\u8DF5\u9879\u76EE"):Dt.length===0?b.b.error("\u8BF7\u9009\u62E9\u5B9E\u8DF5\u9879\u76EE"):(ut&&ut(Et==null||((Xt=Et.shixun_list)===null||Xt===void 0)?void 0:Xt.filter(function(tt){return tt.id===Dt[0]})[0]),$t({type:"classroomList/setActionTabs",payload:{key:""}}));case 1:case"end":return _e.stop()}},yt)})),type:"primary"},"\u786E\u5B9A"))},o.a.createElement("section",{className:"tc"},o.a.createElement($,{placeholder:"\u5B9E\u8BAD\u4FE1\u606F/\u9662\u6821\u540D\u79F0/\u521B\u5EFA\u8005",enterButton:"\u641C\u7D22",size:"large",className:ae.a.search,onSearch:function(Xt){Mt.keyword=Xt,$t({type:"classroomList/getShixunLists",payload:Object(s.a)({},Mt)})}})),o.a.createElement("section",{className:"edu-container"},J.map(function(yt,Xt){var Yt;return o.a.createElement("ul",{className:ae.a.menu,key:Xt},o.a.createElement("li",null,yt.name),yt==null||((Yt=yt.children)===null||Yt===void 0)?void 0:Yt.map(function(_e,tt){return o.a.createElement("li",{key:tt,className:Mt[yt.id]==_e.id?ae.a.actived:"",onClick:function(){Mt[yt.id]=_e.id,ct(Object(s.a)({},Mt)),$t({type:"classroomList/getShixunLists",payload:Object(s.a)({},Mt)})}},o.a.createElement("strong",null,_e.name))}))}),Et==null||((Ct=Et.shixun_list)===null||Ct===void 0)?void 0:Ct.map(function(yt,Xt){return o.a.createElement("div",{className:ae.a.listItem,key:Xt},o.a.createElement(Y.a,{checked:Dt.includes(yt.id),value:yt.id,onChange:function(_e){var tt=Dt.indexOf(yt.id);Dt.indexOf(yt.id)>-1?Ke(Dt.filter(function(Ie){return Ie!==yt.id})):Ke(Dt.concat(yt.id))}}),o.a.createElement("div",{className:ae.a.info},o.a.createElement("div",{className:ae.a.title},o.a.createElement("div",{className:ae.a.titleLeft},o.a.createElement("strong",{className:"font16",dangerouslySetInnerHTML:{__html:yt.title}}))),o.a.createElement("div",{className:"flex-wrp mt10 font14 c-light-black"},o.a.createElement("span",{className:ae.a.description,dangerouslySetInnerHTML:{__html:yt.description}})),o.a.createElement("div",{className:" mt15"},yt.challenge_names.map(function(Yt,_e){return o.a.createElement("span",{key:_e,className:"mr30"},"\u7B2C",_e+1,"\u5173 ",Yt," ")})),o.a.createElement(S.a,{dashed:!0}),o.a.createElement("div",{className:"c-light-black mt20"},o.a.createElement("span",null,yt.author_name),o.a.createElement("span",{className:"ml15 mr15"},"|"),o.a.createElement("span",null,yt.author_school_name),o.a.createElement("span",{className:"ml15 mr15"},"|"),o.a.createElement("span",null,"\u96BE\u5EA6\u7CFB\u6570:",yt.level),o.a.createElement("span",{className:"ml15 mr15"},"|"),o.a.createElement("span",null,"\u5B66\u4E60\u4EBA\u6570:"),o.a.createElement("span",null,yt.study_count))))}),o.a.createElement("p",null)),o.a.createElement("div",{className:"tc"},o.a.createElement(ne.a,{defaultCurrent:1,hideOnSinglePage:!0,defaultPageSize:20,showQuickJumper:!0,total:Et==null?void 0:Et.shixuns_count,onChange:function(Xt){Mt.page=Xt,Ke([]),$t({type:"classroomList/getShixunLists",payload:Object(s.a)({},Mt)})}})))},te=Object(N.a)(function(et){var De=et.classroomList,Ct=et.loading;return{classroomList:De,loading:Ct}})(q),me=Z("uLbx"),be=Z.n(me),Pe=c.a.SubMenu,gt=y.a.Content,Ft=y.a.Sider,St=function(De){var Ct,vt,ir,$t,ut,ze,Fr,Te,gr,Jt,cr,Et,Vt,sr,Dt,Ke,ar,Qt,Mt,ct,yt,Xt,Yt,_e,tt,Ie,vr,yr,rr,fr,st,hr,Bt,Tt,Kt,jt,Ot,pt,mr,mt,xt,He,wt,ht,wr,At,It,lr,Rr,Or,zt,dt,at,Pt,Wt,Gt,_t=De.polls,Wr=De.globalSetting,Hr=De.loading,ln=De.user,un=De.dispatch,xn=Object(g.a)(De,["polls","globalSetting","loading","user","dispatch"]),on=Object(v.i)(),dn=Object(v.h)(),sn=ln.userInfo,Wn=E.a.useForm(),Hn=Object(m.a)(Wn,1),mn=Hn[0],ki=Object(f.useState)([]),Kn=Object(m.a)(ki,2),ft=Kn[0],kt=Kn[1],Ut=Object(f.useState)(!1),Zt=Object(m.a)(Ut,2),qt=Zt[0],or=Zt[1],xr=[{name:"\u9009\u62E9\u9898",id:0},{name:"\u5224\u65AD\u9898",id:2},{name:"\u586B\u7A7A\u9898",id:3},{name:"\u7B80\u7B54\u9898",id:4},{name:"\u5B9E\u8BAD\u9898",id:5}],er=Object(f.useRef)();Object(f.useEffect)(function(){var _r;if((_r=_t.exerciseBanks)!==null&&_r!==void 0&&_r.exercise_questions){var Nt,br,Ar,Gr,$r;kt(Object(u.a)((Nt=_t.exerciseBanks)===null||Nt===void 0?void 0:Nt.exercise_questions)),mn.setFieldsValue({exercise_name:(br=_t.exerciseBanks)===null||br===void 0||((Ar=br.exercise)===null||Ar===void 0)?void 0:Ar.exercise_name,exercise_description:(Gr=_t.exerciseBanks)===null||Gr===void 0||(($r=Gr.exercise)===null||$r===void 0)?void 0:$r.exercise_description})}},[_t.exerciseBanks]),Object(f.useEffect)(function(){un({type:"polls/getExerciseBanks",payload:Object(s.a)({},on)})},[on.categoryId]);var kr=function(){var _r=Object(d.a)(a.a.mark(function Nt(){var br,Ar,Gr;return a.a.wrap(function(Rn){for(;;)switch(Rn.prev=Rn.next){case 0:return Rn.next=2,mn.validateFields();case 2:return Gr=mn.getFieldValue(),Gr.is_md=!0,Gr.topicId=(br=_t.exerciseBanks)===null||br===void 0||((Ar=br.exercise)===null||Ar===void 0)?void 0:Ar.id,or(!1),Rn.next=8,Object(z.v)(Object(s.a)({},Gr));case 8:un({type:"polls/getExerciseBanks",payload:Object(s.a)({},on)});case 9:case"end":return Rn.stop()}},Nt)}));return function(){return _r.apply(this,arguments)}}(),rn=function(){var _r=Object(d.a)(a.a.mark(function Nt(br){var Ar;return a.a.wrap(function($r){for(;;)switch($r.prev=$r.next){case 0:return $r.next=2,er==null?void 0:er.current;case 2:if(Ar=$r.sent,!(Ar!=null&&Ar.isEdit)){$r.next=6;break}return b.b.error("\u4E0D\u80FD\u540C\u65F6\u7F16\u8F91\u4E24\u9898"),$r.abrupt("return");case 6:br===5?un({type:"classroomList/setActionTabs",payload:{key:"\u9009\u7528\u5B9E\u8DF5\u9879\u76EE"}}):kt([].concat(Object(u.a)(ft),[{question_type:br}]));case 7:case"end":return $r.stop()}},Nt)}));return function(br){return _r.apply(this,arguments)}}(),ur=function(){return ft==null?void 0:ft.map(function(Nt,br){if(Nt.key=br+1,Nt.len=ft.length,Nt.question_type===0)return o.a.createElement("aside",null,o.a.createElement(Ce,{ref:er,editData:Nt}),o.a.createElement(S.a,null));if(Nt.question_type===1)return o.a.createElement("aside",null,o.a.createElement(ye,{ref:er,editData:Nt}),o.a.createElement(S.a,null));if(Nt.question_type===2)return o.a.createElement("aside",null,o.a.createElement(We,{ref:er,editData:Nt}),o.a.createElement(S.a,null));if(Nt.question_type===3)return o.a.createElement("aside",null,o.a.createElement(Je,{editData:Nt}),o.a.createElement(S.a,null));if(Nt.question_type===4)return o.a.createElement("aside",null,o.a.createElement(Qe,{editData:Nt}),o.a.createElement(S.a,null));if(Nt.question_type===5)return o.a.createElement("aside",null,o.a.createElement(nt,{editData:Nt}),o.a.createElement(S.a,null))})};return o.a.createElement("section",{className:"edu-container"},o.a.createElement("section",{className:"animated fadeIn"},o.a.createElement("aside",{className:"mt10"},sn&&o.a.createElement(A.a,{separator:">"},o.a.createElement(A.a.Item,null,o.a.createElement(D.a,{to:"/users/".concat(sn.login,"/topics/personal")},"\u6211\u7684\u9898\u5E93")),o.a.createElement(A.a.Item,null,o.a.createElement(D.a,{to:"/users/".concat(sn==null?void 0:sn.login,"/topics/").concat(on.topicId,"/").concat(on.topictype,"/exercise/detail")},"\u8BE6\u60C5")),o.a.createElement(A.a.Item,null,"\u7F16\u8F91"))),o.a.createElement("aside",{className:[be.a.title,"mt20"].join(" ")},o.a.createElement(k.a,{style:{width:"100%"},align:"middle"},o.a.createElement(R.a,{flex:"1"},o.a.createElement("strong",{className:"font20 ml5"},"\u7F16\u8F91\u8BD5\u5377"),o.a.createElement(Se.k,{status:[(Ct=_t.exerciseBanks)!==null&&Ct!==void 0&&(vt=Ct.exercise)!==null&&vt!==void 0&&vt.is_public?"\u516C\u5F00":"\u79C1\u6709"]})),o.a.createElement(R.a,null,o.a.createElement(D.a,{className:"font16 c-light-black",to:"/users/".concat(sn.login,"/topics/personal")},"\u8FD4\u56DE"))))),o.a.createElement("section",{className:[be.a.bg,"pt30","pl30","pr30","pb30","mt20"].join(" ")},!qt&&o.a.createElement("aside",null,o.a.createElement("div",{className:be.a.containerDesc},o.a.createElement("div",null,(ir=_t.exerciseBanks)===null||ir===void 0||(($t=ir.exercise)===null||$t===void 0)?void 0:$t.exercise_name),o.a.createElement("div",null,o.a.createElement(P.a,{title:"\u7F16\u8F91"},o.a.createElement("span",{onClick:function(){return or(!0)},className:"iconfont c-green ml30 icon-bianjishijuan3x"})))),o.a.createElement("div",{className:"c-light-black"},(ut=_t.exerciseBanks)===null||ut===void 0||((ze=ut.exercise)===null||ze===void 0)?void 0:ze.exercise_description)),qt&&o.a.createElement(E.a,{layout:"vertical",form:mn},o.a.createElement(E.a.Item,{name:"exercise_name",label:"\u8BD5\u5377\u6807\u9898\uFF1A",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BD5\u5377\u6807\u9898"}]},o.a.createElement(K.a,{maxLength:60,placeholder:"\u8BD5\u5377\u6807\u9898\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26"})),o.a.createElement(E.a.Item,{label:"\u8BD5\u5377\u987B\u77E5\uFF1A",name:"exercise_description"},o.a.createElement(K.a.TextArea,{rows:6,placeholder:"\u8BF7\u5728\u6B64\u8F93\u5165\u672C\u6B21\u8BD5\u5377\u7B54\u9898\u7684\u76F8\u5173\u8BF4\u660E\uFF0C\u6700\u5927\u9650\u5236100\u4E2A\u5B57\u7B26"})),o.a.createElement(E.a.Item,{className:"tr"},o.a.createElement(V.a,{type:"primary",onClick:function(){kr()}},"\u4FDD\u5B58")))),o.a.createElement("p",{className:"mt10",style:{display:"flex"}},o.a.createElement("span",{className:"fl",style:{flex:"1"}},!!((Fr=_t.exerciseBanks)!==null&&Fr!==void 0&&(Te=Fr.exercise_types)!==null&&Te!==void 0&&Te.q_singles)&&o.a.createElement("span",{className:"ml20"},"\u5355\u9009\u9898",(gr=_t.exerciseBanks)===null||gr===void 0||((Jt=gr.exercise_types)===null||Jt===void 0)?void 0:Jt.q_singles,"\u9898\uFF0C\u5171",(cr=_t.exerciseBanks)===null||cr===void 0||((Et=cr.exercise_types)===null||Et===void 0)?void 0:Et.q_singles_scores,"\u5206"),!!((Vt=_t.exerciseBanks)!==null&&Vt!==void 0&&(sr=Vt.exercise_types)!==null&&sr!==void 0&&sr.q_doubles)&&o.a.createElement("span",{className:"ml20"},"\u591A\u9009\u9898",(Dt=_t.exerciseBanks)===null||Dt===void 0||((Ke=Dt.exercise_types)===null||Ke===void 0)?void 0:Ke.q_doubles,"\u9898\uFF0C\u5171",(ar=_t.exerciseBanks)===null||ar===void 0||((Qt=ar.exercise_types)===null||Qt===void 0)?void 0:Qt.q_doubles_scores,"\u5206"),!!((Mt=_t.exerciseBanks)!==null&&Mt!==void 0&&(ct=Mt.exercise_types)!==null&&ct!==void 0&&ct.q_judges)&&o.a.createElement("span",{className:"ml20"},"\u5224\u65AD\u9898",(yt=_t.exerciseBanks)===null||yt===void 0||((Xt=yt.exercise_types)===null||Xt===void 0)?void 0:Xt.q_judges,"\u9898\uFF0C\u5171",(Yt=_t.exerciseBanks)===null||Yt===void 0||((_e=Yt.exercise_types)===null||_e===void 0)?void 0:_e.q_judges_scores,"\u5206"),!!((tt=_t.exerciseBanks)!==null&&tt!==void 0&&(Ie=tt.exercise_types)!==null&&Ie!==void 0&&Ie.q_nulls)&&o.a.createElement("span",{className:"ml20"},"\u586B\u7A7A\u9898",(vr=_t.exerciseBanks)===null||vr===void 0||((yr=vr.exercise_types)===null||yr===void 0)?void 0:yr.q_nulls,"\u9898\uFF0C\u5171",(rr=_t.exerciseBanks)===null||rr===void 0||((fr=rr.exercise_types)===null||fr===void 0)?void 0:fr.q_nulls_scores,"\u5206"),!!((st=_t.exerciseBanks)!==null&&st!==void 0&&(hr=st.exercise_types)!==null&&hr!==void 0&&hr.q_mains)&&o.a.createElement("span",{className:"ml20"},"\u7B80\u7B54\u9898",(Bt=_t.exerciseBanks)===null||Bt===void 0||((Tt=Bt.exercise_types)===null||Tt===void 0)?void 0:Tt.q_mains,"\u9898\uFF0C\u5171",(Kt=_t.exerciseBanks)===null||Kt===void 0||((jt=Kt.exercise_types)===null||jt===void 0)?void 0:jt.q_mains_scores,"\u5206"),!!((Ot=_t.exerciseBanks)!==null&&Ot!==void 0&&(pt=Ot.exercise_types)!==null&&pt!==void 0&&pt.q_shixuns)&&o.a.createElement("span",{className:"ml20"},"\u5B9E\u8BAD\u9898",(mr=_t.exerciseBanks)===null||mr===void 0||((mt=mr.exercise_types)===null||mt===void 0)?void 0:mt.q_shixuns,"\u9898\uFF0C\u5171",(xt=_t.exerciseBanks)===null||xt===void 0||((He=xt.exercise_types)===null||He===void 0)?void 0:He.q_shixuns_scores,"\u5206"),!!((wt=_t.exerciseBanks)!==null&&wt!==void 0&&(ht=wt.exercise_types)!==null&&ht!==void 0&&ht.q_pros)&&o.a.createElement("span",{className:"ml20"},"\u7F16\u7A0B\u9898",(wr=_t.exerciseBanks)===null||wr===void 0||((At=wr.exercise_types)===null||At===void 0)?void 0:At.q_pros,"\u9898\uFF0C\u5171",(It=_t.exerciseBanks)===null||It===void 0||((lr=It.exercise_types)===null||lr===void 0)?void 0:lr.q_pros_scores,"\u5206")),o.a.createElement("span",{className:"fr"},!!((Rr=_t.exerciseBanks)!==null&&Rr!==void 0&&(Or=Rr.exercise_types)!==null&&Or!==void 0&&Or.q_counts)&&o.a.createElement("span",null,"\u5408\u8BA1 ",o.a.createElement("span",{className:"color-blue"},(zt=_t.exerciseBanks)===null||zt===void 0||((dt=zt.exercise_types)===null||dt===void 0)?void 0:dt.q_counts)," \u9898\uFF0C \u5171 ",o.a.createElement("span",{className:"".concat(((at=_t.exerciseBanks)===null||at===void 0||((Pt=at.exercise_types)===null||Pt===void 0)?void 0:Pt.q_scores)>100?"color-red font-bd":"color-orange")},(Wt=_t.exerciseBanks)===null||Wt===void 0||((Gt=Wt.exercise_types)===null||Gt===void 0)?void 0:Gt.q_scores)," \u5206"))),ft!=""&&o.a.createElement("section",{className:[be.a.bg,"pt30","pl20","pr20","pb20","mt20"].join(" ")},ur()),o.a.createElement("section",{style:{display:"flex"},className:[be.a.bg,"pt30","pl30","pr30","pb30","mt20"].join(" ")},o.a.createElement("div",{style:{flex:"1"}},xr.map(function(_r,Nt){return o.a.createElement(V.a,{className:"mr20",type:"primary",onClick:function(){return rn(_r.id)}},o.a.createElement(W.a,{className:"mr5"}),_r.name)}))),o.a.createElement(te,{callback:function(Nt){ft.push({shixun:Nt.challenge_names.map(function(br){return{challenge_name:br,challenge_score:5}}),shixun_name:Nt.title,shixun_id:Nt.id,question_type:5,edit:!0}),kt(Object(u.a)(ft))}}))},pr=rt.default=Object(N.a)(function(et){var De=et.polls,Ct=et.loading,vt=et.user,ir=et.globalSetting;return{polls:De,globalSetting:ir,user:vt,loading:Ct.effects}})(St)},"rAM+":function(Rt,rt,Z){"use strict";Z.d(rt,"a",function(){return V});var re=Z("Qw5x");function V(L,K){var M;if(typeof Symbol=="undefined"||L[Symbol.iterator]==null){if(Array.isArray(L)||(M=Object(re.a)(L))||K&&L&&typeof L.length=="number"){M&&(L=M);var P=0,j=function(){};return{s:j,n:function(){return P>=L.length?{done:!0}:{done:!1,value:L[P++]}},e:function(A){throw A},f:j}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var k=!0,C=!1,R;return{s:function(){M=L[Symbol.iterator]()},n:function(){var A=M.next();return k=A.done,A},e:function(A){C=!0,R=A},f:function(){try{!k&&M.return!=null&&M.return()}finally{if(C)throw R}}}}},rUJ1:function(Rt,rt){const Z=/[&<>"']/,re=/[&<>"']/g,V=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,K={"&":"&","<":"<",">":">",'"':""","'":"'"},M=y=>K[y];function P(y,p){if(p){if(Z.test(y))return y.replace(re,M)}else if(V.test(y))return y.replace(L,M);return y}const j=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function k(y){return y.replace(j,(p,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 C=/(^|[^\[])\^/g;function R(y,p){y=y.source||y,p=p||"";const c={replace:(l,a)=>(a=a.source||a,a=a.replace(C,"$1"),y=y.replace(l,a),c),getRegex:()=>new RegExp(y,p)};return c}const x=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(y,p,c){if(y){let l;try{l=decodeURIComponent(k(c)).replace(x,"").toLowerCase()}catch(a){return null}if(l.indexOf("javascript:")===0||l.indexOf("vbscript:")===0||l.indexOf("data:")===0)return null}p&&!A.test(c)&&(c=s(p,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(l){return null}return c}const S={},_=/^[^:]+:\/*[^/]*$/,b=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function s(y,p){S[" "+y]||(_.test(y)?S[" "+y]=y+"/":S[" "+y]=m(y,"/",!0)),y=S[" "+y];const c=y.indexOf(":")===-1;return p.substring(0,2)==="//"?c?p:y.replace(b,"$1")+p:p.charAt(0)==="/"?c?p:y.replace(d,"$1")+p:y+p}const u={exec:function(){}};function h(y){let p=1,c,l;for(;p<arguments.length;p++){c=arguments[p];for(l in c)Object.prototype.hasOwnProperty.call(c,l)&&(y[l]=c[l])}return y}function E(y,p){const c=y.replace(/\|/g,(f,o,v)=>{let D=!1,N=o;for(;--N>=0&&v[N]==="\\";)D=!D;return D?"|":" |"}),l=c.split(/ \|/);let a=0;if(l.length>p)l.splice(p);else for(;l.length<p;)l.push("");for(;a<l.length;a++)l[a]=l[a].trim().replace(/\\\|/g,"|");return l}function m(y,p,c){const l=y.length;if(l===0)return"";let a=0;for(;a<l;){const f=y.charAt(l-a-1);if(f===p&&!c)a++;else if(f!==p&&c)a++;else break}return y.substr(0,l-a)}function g(y,p){if(y.indexOf(p[1])===-1)return-1;const c=y.length;let l=0,a=0;for(;a<c;a++)if(y[a]==="\\")a++;else if(y[a]===p[0])l++;else if(y[a]===p[1]&&(l--,l<0))return a;return-1}function w(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")}Rt.exports={escape:P,unescape:k,edit:R,cleanUrl:O,resolveUrl:s,noopTest:u,merge:h,splitCells:E,rtrim:m,findClosingBracket:g,checkSanitizeDeprecation:w}},uLbx:function(Rt,rt,Z){Rt.exports={flex_box_center:"flex_box_center___1paSn",flex_space_between:"flex_space_between___36S3i",flex_box_vertical_center:"flex_box_vertical_center___3ccMy",flex_box_center_end:"flex_box_center_end___31AGp",flex_box_column:"flex_box_column___1cfjg",bg:"bg___1_34e",containerTitle:"containerTitle___3x8NS",containerDesc:"containerDesc___j5b4j",listItem:"listItem___3eFKb",info:"info___1lfiH",title:"title___1_ERY",titleLeft:"titleLeft___MRBRV",titleRight:"titleRight___XliYN",acitons:"acitons___3Fqbt"}},uSYw:function(Rt,rt,Z){Rt.exports={flex_box_center:"flex_box_center___1Yp6V",flex_space_between:"flex_space_between___15-lw",flex_box_vertical_center:"flex_box_vertical_center___3Z69M",flex_box_center_end:"flex_box_center_end___mA7IH",flex_box_column:"flex_box_column___3xASj",wrp:"wrp___2ltDQ",drawer:"drawer___3_MCx",menu:"menu___aAo09",actived:"actived___3DNqM",actived2:"actived2___3JLKu",listItem:"listItem___39GLP",info:"info___1GUGE",title:"title___1wRiz",titleLeft:"titleLeft___1BA1e",titleRight:"titleRight___2w3Ba",search:"search___vFEeF",description:"description___29YXF",menuCourse:"menuCourse___2vc01"}},ulZh:function(Rt,rt,Z){typeof window!="undefined"&&function(V,L){Rt.exports=L()}(this,function(){return function(re){var V={};function L(K){if(V[K])return V[K].exports;var M=V[K]={i:K,l:!1,exports:{}};return re[K].call(M.exports,M,M.exports,L),M.l=!0,M.exports}return L.m=re,L.c=V,L.d=function(K,M,P){L.o(K,M)||Object.defineProperty(K,M,{enumerable:!0,get:P})},L.r=function(K){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(K,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(K,"__esModule",{value:!0})},L.t=function(K,M){if(M&1&&(K=L(K)),M&8)return K;if(M&4&&typeof K=="object"&&K&&K.__esModule)return K;var P=Object.create(null);if(L.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:K}),M&2&&typeof K!="string")for(var j in K)L.d(P,j,function(k){return K[k]}.bind(null,j));return P},L.n=function(K){var M=K&&K.__esModule?function(){return K.default}:function(){return K};return L.d(M,"a",M),M},L.o=function(K,M){return Object.prototype.hasOwnProperty.call(K,M)},L.p="/dist/",L(L.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(re,V,L){"use strict";var K=Object.prototype.hasOwnProperty,M="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(M=!1));function j(x,A,O){this.fn=x,this.context=A,this.once=O||!1}function k(x,A,O,S,_){if(typeof O!="function")throw new TypeError("The listener must be a function");var b=new j(O,S||x,_),d=M?M+A:A;return x._events[d]?x._events[d].fn?x._events[d]=[x._events[d],b]:x._events[d].push(b):(x._events[d]=b,x._eventsCount++),x}function C(x,A){--x._eventsCount===0?x._events=new P:delete x._events[A]}function R(){this._events=new P,this._eventsCount=0}R.prototype.eventNames=function(){var A=[],O,S;if(this._eventsCount===0)return A;for(S in O=this._events)K.call(O,S)&&A.push(M?S.slice(1):S);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(O)):A},R.prototype.listeners=function(A){var O=M?M+A:A,S=this._events[O];if(!S)return[];if(S.fn)return[S.fn];for(var _=0,b=S.length,d=new Array(b);_<b;_++)d[_]=S[_].fn;return d},R.prototype.listenerCount=function(A){var O=M?M+A:A,S=this._events[O];return S?S.fn?1:S.length:0},R.prototype.emit=function(A,O,S,_,b,d){var s=M?M+A:A;if(!this._events[s])return!1;var u=this._events[s],h=arguments.length,E,m;if(u.fn){u.once&&this.removeListener(A,u.fn,void 0,!0);switch(h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,O),!0;case 3:return u.fn.call(u.context,O,S),!0;case 4:return u.fn.call(u.context,O,S,_),!0;case 5:return u.fn.call(u.context,O,S,_,b),!0;case 6:return u.fn.call(u.context,O,S,_,b,d),!0}for(m=1,E=new Array(h-1);m<h;m++)E[m-1]=arguments[m];u.fn.apply(u.context,E)}else{var g=u.length,w;for(m=0;m<g;m++){u[m].once&&this.removeListener(A,u[m].fn,void 0,!0);switch(h){case 1:u[m].fn.call(u[m].context);break;case 2:u[m].fn.call(u[m].context,O);break;case 3:u[m].fn.call(u[m].context,O,S);break;case 4:u[m].fn.call(u[m].context,O,S,_);break;default:if(!E)for(w=1,E=new Array(h-1);w<h;w++)E[w-1]=arguments[w];u[m].fn.apply(u[m].context,E)}}}return!0},R.prototype.on=function(A,O,S){return k(this,A,O,S,!1)},R.prototype.once=function(A,O,S){return k(this,A,O,S,!0)},R.prototype.removeListener=function(A,O,S,_){var b=M?M+A:A;if(!this._events[b])return this;if(!O)return C(this,b),this;var d=this._events[b];if(d.fn)d.fn===O&&(!_||d.once)&&(!S||d.context===S)&&C(this,b);else{for(var s=0,u=[],h=d.length;s<h;s++)(d[s].fn!==O||_&&!d[s].once||S&&d[s].context!==S)&&u.push(d[s]);u.length?this._events[b]=u.length===1?u[0]:u:C(this,b)}return this},R.prototype.removeAllListeners=function(A){var O;return A?(O=M?M+A:A,this._events[O]&&C(this,O)):(this._events=new P,this._eventsCount=0),this},R.prototype.off=R.prototype.removeListener,R.prototype.addListener=R.prototype.on,R.prefixed=M,R.EventEmitter=R,re.exports=R},"./node_modules/url-toolkit/src/url-toolkit.js":function(re,V,L){(function(K){var M=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,P=/^([^\/?#]*)([^]*)$/,j=/(?:\/|^)\.(?=\/)/g,k=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,C={buildAbsoluteURL:function(R,x,A){if(A=A||{},R=R.trim(),x=x.trim(),!x){if(!A.alwaysNormalize)return R;var O=C.parseURL(R);if(!O)throw new Error("Error trying to parse base URL.");return O.path=C.normalizePath(O.path),C.buildURLFromParts(O)}var S=C.parseURL(x);if(!S)throw new Error("Error trying to parse relative URL.");if(S.scheme)return A.alwaysNormalize?(S.path=C.normalizePath(S.path),C.buildURLFromParts(S)):x;var _=C.parseURL(R);if(!_)throw new Error("Error trying to parse base URL.");if(!_.netLoc&&_.path&&_.path[0]!=="/"){var b=P.exec(_.path);_.netLoc=b[1],_.path=b[2]}_.netLoc&&!_.path&&(_.path="/");var d={scheme:_.scheme,netLoc:S.netLoc,path:null,params:S.params,query:S.query,fragment:S.fragment};if(!S.netLoc&&(d.netLoc=_.netLoc,S.path[0]!=="/"))if(!S.path)d.path=_.path,S.params||(d.params=_.params,S.query||(d.query=_.query));else{var s=_.path,u=s.substring(0,s.lastIndexOf("/")+1)+S.path;d.path=C.normalizePath(u)}return d.path===null&&(d.path=A.alwaysNormalize?C.normalizePath(S.path):S.path),C.buildURLFromParts(d)},parseURL:function(R){var x=M.exec(R);return x?{scheme:x[1]||"",netLoc:x[2]||"",path:x[3]||"",params:x[4]||"",query:x[5]||"",fragment:x[6]||""}:null},normalizePath:function(R){for(R=R.split("").reverse().join("").replace(j,"");R.length!==(R=R.replace(k,"")).length;);return R.split("").reverse().join("")},buildURLFromParts:function(R){return R.scheme+R.netLoc+R.path+R.params+R.query+R.fragment}};re.exports=C})(this)},"./node_modules/webworkify-webpack/index.js":function(re,V,L){function K(A){var O={};function S(b){if(O[b])return O[b].exports;var d=O[b]={i:b,l:!1,exports:{}};return A[b].call(d.exports,d,d.exports,S),d.l=!0,d.exports}S.m=A,S.c=O,S.i=function(b){return b},S.d=function(b,d,s){S.o(b,d)||Object.defineProperty(b,d,{configurable:!1,enumerable:!0,get:s})},S.r=function(b){Object.defineProperty(b,"__esModule",{value:!0})},S.n=function(b){var d=b&&b.__esModule?function(){return b.default}:function(){return b};return S.d(d,"a",d),d},S.o=function(b,d){return Object.prototype.hasOwnProperty.call(b,d)},S.p="/",S.oe=function(b){throw console.error(b),b};var _=S(S.s=ENTRY_MODULE);return _.default||_}var M="[\\.|\\-|\\+|\\w|/|@]+",P="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+M+").*?\\)";function j(A){return(A+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function k(A){return!isNaN(1*A)}function C(A,O,S){var _={};_[S]=[];var b=O.toString(),d=b.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return _;for(var s=d[1],u=new RegExp("(\\\\n|\\W)"+j(s)+P,"g"),h;h=u.exec(b);){if(h[3]==="dll-reference")continue;_[S].push(h[3])}for(u=new RegExp("\\("+j(s)+'\\("(dll-reference\\s('+M+'))"\\)\\)'+P,"g");h=u.exec(b);)A[h[2]]||(_[S].push(h[1]),A[h[2]]=L(h[1]).m),_[h[2]]=_[h[2]]||[],_[h[2]].push(h[4]);for(var E=Object.keys(_),m=0;m<E.length;m++)for(var g=0;g<_[E[m]].length;g++)k(_[E[m]][g])&&(_[E[m]][g]=1*_[E[m]][g]);return _}function R(A){var O=Object.keys(A);return O.reduce(function(S,_){return S||A[_].length>0},!1)}function x(A,O){for(var S={main:[O]},_={main:[]},b={main:{}};R(S);)for(var d=Object.keys(S),s=0;s<d.length;s++){var u=d[s],h=S[u],E=h.pop();if(b[u]=b[u]||{},b[u][E]||!A[u][E])continue;b[u][E]=!0,_[u]=_[u]||[],_[u].push(E);for(var m=C(A,A[u][E],u),g=Object.keys(m),w=0;w<g.length;w++)S[g[w]]=S[g[w]]||[],S[g[w]]=S[g[w]].concat(m[g[w]])}return _}re.exports=function(A,O){O=O||{};var S={main:L.m},_=O.all?{main:Object.keys(S.main)}:x(S,A),b="";Object.keys(_).filter(function(E){return E!=="main"}).forEach(function(E){for(var m=0;_[E][m];)m++;_[E].push(m),S[E][m]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",b=b+"var "+E+" = ("+K.toString().replace("ENTRY_MODULE",JSON.stringify(m))+")({"+_[E].map(function(g){return""+JSON.stringify(g)+": "+S[E][g].toString()}).join(",")+`});
|
|
`}),b=b+"new (("+K.toString().replace("ENTRY_MODULE",JSON.stringify(A))+")({"+_.main.map(function(E){return""+JSON.stringify(E)+": "+S.main[E].toString()}).join(",")+"}))(self);";var d=new window.Blob([b],{type:"text/javascript"});if(O.bare)return d;var s=window.URL||window.webkitURL||window.mozURL||window.msURL,u=s.createObjectURL(d),h=new window.Worker(u);return h.objectURL=u,h}},"./src/config.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"hlsDefaultConfig",function(){return w}),L.d(V,"mergeConfig",function(){return p}),L.d(V,"enableStreamingMode",function(){return c});var K=L("./src/controller/abr-controller.ts"),M=L("./src/controller/audio-stream-controller.ts"),P=L("./src/controller/audio-track-controller.ts"),j=L("./src/controller/subtitle-stream-controller.ts"),k=L("./src/controller/subtitle-track-controller.ts"),C=L("./src/controller/buffer-controller.ts"),R=L("./src/controller/timeline-controller.ts"),x=L("./src/controller/cap-level-controller.ts"),A=L("./src/controller/fps-controller.ts"),O=L("./src/controller/eme-controller.ts"),S=L("./src/controller/cmcd-controller.ts"),_=L("./src/utils/xhr-loader.ts"),b=L("./src/utils/fetch-loader.ts"),d=L("./src/utils/cues.ts"),s=L("./src/utils/mediakeys-helper.ts"),u=L("./src/utils/logger.ts");function h(){return h=Object.assign||function(l){for(var a=1;a<arguments.length;a++){var f=arguments[a];for(var o in f)Object.prototype.hasOwnProperty.call(f,o)&&(l[o]=f[o])}return l},h.apply(this,arguments)}function E(l,a){var f=Object.keys(l);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(l);a&&(o=o.filter(function(v){return Object.getOwnPropertyDescriptor(l,v).enumerable})),f.push.apply(f,o)}return f}function m(l){for(var a=1;a<arguments.length;a++){var f=arguments[a]!=null?arguments[a]:{};a%2?E(Object(f),!0).forEach(function(o){g(l,o,f[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(f)):E(Object(f)).forEach(function(o){Object.defineProperty(l,o,Object.getOwnPropertyDescriptor(f,o))})}return l}function g(l,a,f){return a in l?Object.defineProperty(l,a,{value:f,enumerable:!0,configurable:!0,writable:!0}):l[a]=f,l}var w=m(m({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:_.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:K.default,bufferController:C.default,capLevelController:x.default,fpsController:A.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:s.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},y()),{},{subtitleStreamController:j.SubtitleStreamController,subtitleTrackController:k.default,timelineController:R.TimelineController,audioStreamController:M.default,audioTrackController:P.default,emeController:O.default,cmcdController:S.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 p(l,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return h({},l,a)}function c(l){var a=l.loader;if(a!==b.default&&a!==_.default)u.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),l.progressive=!1;else{var f=Object(b.fetchSupported)();f&&(l.loader=b.default,l.progressive=!0,l.enableSoftwareAES=!0,u.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(re,V,L){"use strict";L.r(V);var K=L("./src/polyfills/number.ts"),M=L("./src/utils/ewma-bandwidth-estimator.ts"),P=L("./src/events.ts"),j=L("./src/utils/buffer-helper.ts"),k=L("./src/errors.ts"),C=L("./src/types/loader.ts"),R=L("./src/utils/logger.ts");function x(S,_){for(var b=0;b<_.length;b++){var d=_[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(S,d.key,d)}}function A(S,_,b){return _&&x(S.prototype,_),b&&x(S,b),S}var O=function(){function S(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 M.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var _=S.prototype;return _.registerListeners=function(){var d=this.hls;d.on(P.Events.FRAG_LOADING,this.onFragLoading,this),d.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(P.Events.ERROR,this.onError,this)},_.unregisterListeners=function(){var d=this.hls;d.off(P.Events.FRAG_LOADING,this.onFragLoading,this),d.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(P.Events.ERROR,this.onError,this)},_.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},_.onFragLoading=function(d,s){var u=s.frag;if(u.type===C.PlaylistLevelType.MAIN&&!this.timer){var h;this.fragCurrent=u,this.partCurrent=(h=s.part)!=null?h:null,this.timer=self.setInterval(this.onCheck,100)}},_.onLevelLoaded=function(d,s){var u=this.hls.config;s.details.live?this.bwEstimator.update(u.abrEwmaSlowLive,u.abrEwmaFastLive):this.bwEstimator.update(u.abrEwmaSlowVoD,u.abrEwmaFastVoD)},_._abandonRulesCheck=function(){var d=this.fragCurrent,s=this.partCurrent,u=this.hls,h=u.autoLevelEnabled,E=u.config,m=u.media;if(!d||!m)return;var g=s?s.stats:d.stats,w=s?s.duration:d.duration;if(g.aborted){R.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!h||m.paused||!m.playbackRate||!m.readyState)return;var y=performance.now()-g.loading.start,p=Math.abs(m.playbackRate);if(y<=500*w/p)return;var c=u.levels,l=u.minAutoLevel,a=c[d.level],f=g.total||Math.max(g.loaded,Math.round(w*a.maxBitrate/8)),o=Math.max(1,g.bwEstimate?g.bwEstimate/8:g.loaded*1e3/y),v=(f-g.loaded)/o,D=m.currentTime,N=(j.BufferHelper.bufferInfo(m,D,E.maxBufferHole).end-D)/p;if(N>=2*w/p||v<=N)return;var W=Number.POSITIVE_INFINITY,z;for(z=d.level-1;z>l;z--){var F=c[z].maxBitrate;if(W=w*F/(8*.8*o),W<N)break}if(W>=v)return;var I=this.bwEstimator.getEstimate();R.logger.warn("Fragment "+d.sn+(s?" part "+s.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+z+`
|
|
Current BW estimate: `+(Object(K.isFiniteNumber)(I)?(I/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+v.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+W.toFixed(3)+` s
|
|
Time to underbuffer: `+N.toFixed(3)+" s"),u.nextLoadLevel=z,this.bwEstimator.sample(y,g.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),u.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:s,stats:g})},_.onFragLoaded=function(d,s){var u=s.frag,h=s.part;if(u.type===C.PlaylistLevelType.MAIN&&Object(K.isFiniteNumber)(u.sn)){var E=h?h.stats:u.stats,m=h?h.duration:u.duration;if(this.clearTimer(),this.lastLoadedFragLevel=u.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var g=this.hls.levels[u.level],w=(g.loaded?g.loaded.bytes:0)+E.loaded,y=(g.loaded?g.loaded.duration:0)+m;g.loaded={bytes:w,duration:y},g.realBitrate=Math.round(8*w/y)}if(u.bitrateTest){var p={stats:E,frag:u,part:h,id:u.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,p),u.bitrateTest=!1}}},_.onFragBuffered=function(d,s){var u=s.frag,h=s.part,E=h?h.stats:u.stats;if(E.aborted)return;if(u.type!==C.PlaylistLevelType.MAIN||u.sn==="initSegment")return;var m=E.parsing.end-E.loading.start;this.bwEstimator.sample(m,E.loaded),E.bwEstimate=this.bwEstimator.getEstimate(),u.bitrateTest?this.bitrateTestDelay=m/1e3:this.bitrateTestDelay=0},_.onError=function(d,s){switch(s.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},_.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},_.getNextABRAutoLevel=function(){var d=this.fragCurrent,s=this.partCurrent,u=this.hls,h=u.maxAutoLevel,E=u.config,m=u.minAutoLevel,g=u.media,w=s?s.duration:d?d.duration:0,y=g?g.currentTime:0,p=g&&g.playbackRate!==0?Math.abs(g.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():E.abrEwmaDefaultEstimate,l=(j.BufferHelper.bufferInfo(g,y,E.maxBufferHole).end-y)/p,a=this.findBestLevel(c,m,h,l,E.abrBandWidthFactor,E.abrBandWidthUpFactor);if(a>=0)return a;R.logger.trace((l?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var f=w?Math.min(w,E.maxStarvationDelay):E.maxStarvationDelay,o=E.abrBandWidthFactor,v=E.abrBandWidthUpFactor;if(!l){var D=this.bitrateTestDelay;if(D){var N=w?Math.min(w,E.maxLoadingDelay):E.maxLoadingDelay;f=N-D,R.logger.trace("bitrate test took "+Math.round(1e3*D)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*f)+" ms"),o=v=1}}return a=this.findBestLevel(c,m,h,l+f,o,v),Math.max(a,0)},_.findBestLevel=function(d,s,u,h,E,m){for(var g,w=this.fragCurrent,y=this.partCurrent,p=this.lastLoadedFragLevel,c=this.hls.levels,l=c[p],a=!!(l!=null&&(g=l.details)!==null&&g!==void 0&&g.live),f=l==null?void 0:l.codecSet,o=y?y.duration:w?w.duration:0,v=u;v>=s;v--){var D=c[v];if(!D||f&&D.codecSet!==f)continue;var N=D.details,W=(y?N==null?void 0:N.partTarget:N==null?void 0:N.averagetargetduration)||o,z=void 0;v<=p?z=E*d:z=m*d;var F=c[v].maxBitrate,I=F*W/z;if(R.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+v+"/"+Math.round(z)+"/"+F+"/"+W+"/"+h+"/"+I),z>F&&(!I||a&&!this.bitrateTestDelay||I<h))return v}return-1},A(S,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,s=this.bwEstimator;if(d!==-1&&(!s||!s.canEstimate()))return d;var u=this.getNextABRAutoLevel();return d!==-1&&(u=Math.min(d,u)),u},set:function(d){this._nextAutoLevel=d}}]),S}();V.default=O},"./src/controller/audio-stream-controller.ts":function(re,V,L){"use strict";L.r(V);var K=L("./src/polyfills/number.ts"),M=L("./src/controller/base-stream-controller.ts"),P=L("./src/events.ts"),j=L("./src/utils/buffer-helper.ts"),k=L("./src/controller/fragment-tracker.ts"),C=L("./src/types/level.ts"),R=L("./src/types/loader.ts"),x=L("./src/loader/fragment.ts"),A=L("./src/demux/chunk-cache.ts"),O=L("./src/demux/transmuxer-interface.ts"),S=L("./src/types/transmuxer.ts"),_=L("./src/controller/fragment-finders.ts"),b=L("./src/utils/discontinuities.ts"),d=L("./src/errors.ts"),s=L("./src/utils/logger.ts");function u(){return u=Object.assign||function(w){for(var y=1;y<arguments.length;y++){var p=arguments[y];for(var c in p)Object.prototype.hasOwnProperty.call(p,c)&&(w[c]=p[c])}return w},u.apply(this,arguments)}function h(w,y){w.prototype=Object.create(y.prototype),w.prototype.constructor=w,E(w,y)}function E(w,y){return E=Object.setPrototypeOf||function(c,l){return c.__proto__=l,c},E(w,y)}var m=100,g=function(w){h(y,w);function y(c,l){var a;return a=w.call(this,c,l,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var p=y.prototype;return p.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},p._registerListeners=function(){var l=this.hls;l.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.on(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.on(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(P.Events.ERROR,this.onError,this),l.on(P.Events.BUFFER_RESET,this.onBufferReset,this),l.on(P.Events.BUFFER_CREATED,this.onBufferCreated,this),l.on(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},p._unregisterListeners=function(){var l=this.hls;l.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.off(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.off(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(P.Events.ERROR,this.onError,this),l.off(P.Events.BUFFER_RESET,this.onBufferReset,this),l.off(P.Events.BUFFER_CREATED,this.onBufferCreated,this),l.off(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},p.onInitPtsFound=function(l,a){var f=a.frag,o=a.id,v=a.initPTS;if(o==="main"){var D=f.cc;this.initPTS[f.cc]=v,this.log("InitPTS for cc: "+D+" found from main: "+v),this.videoTrackCC=D,this.state===M.State.WAITING_INIT_PTS&&this.tick()}},p.startLoad=function(l){if(!this.levels){this.startPosition=l,this.state=M.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(m),this.fragLoadError=0,a>0&&l===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=M.State.IDLE):(this.loadedmetadata=!1,this.state=M.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=l,this.tick()},p.doTick=function(){switch(this.state){case M.State.IDLE:this.doTickIdle();break;case M.State.WAITING_TRACK:{var l,a=this.levels,f=this.trackId,o=a==null||((l=a[f])===null||l===void 0)?void 0:l.details;if(o){if(this.waitForCdnTuneIn(o))break;this.state=M.State.WAITING_INIT_PTS}break}case M.State.FRAG_LOADING_WAITING_RETRY:{var v,D=performance.now(),N=this.retryDate;(!N||D>=N||(v=this.media)!==null&&v!==void 0&&v.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=M.State.IDLE);break}case M.State.WAITING_INIT_PTS:{var W=this.waitingData;if(W){var z=W.frag,F=W.part,I=W.cache,B=W.complete;if(this.initPTS[z.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=M.State.FRAG_LOADING;var Y=I.flush(),Q={frag:z,part:F,payload:Y,networkDetails:null};this._handleFragmentLoadProgress(Q),B&&w.prototype._handleFragmentLoadComplete.call(this,Q)}else if(this.videoTrackCC!==this.waitingVideoCC)s.logger.log("Waiting fragment cc ("+z.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ee=this.getLoadPosition(),fe=j.BufferHelper.bufferInfo(this.mediaBuffer,ee,this.config.maxBufferHole),ce=Object(_.fragmentWithinToleranceTest)(fe.end,this.config.maxFragLookUpTolerance,z);ce<0&&(s.logger.log("Waiting fragment cc ("+z.cc+") @ "+z.start+" cancelled because another fragment at "+fe.end+" is needed"),this.clearWaitingFragment())}}else this.state=M.State.IDLE}}this.onTickEnd()},p.clearWaitingFragment=function(){var l=this.waitingData;l&&(this.fragmentTracker.removeFragment(l.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=M.State.IDLE)},p.onTickEnd=function(){var l=this.media;if(!l||!l.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:l,f=a.buffered;!this.loadedmetadata&&f.length&&(this.loadedmetadata=!0),this.lastCurrentTime=l.currentTime},p.doTickIdle=function(){var l,a,f=this.hls,o=this.levels,v=this.media,D=this.trackId,N=f.config;if(!o||!o[D])return;if(!v&&(this.startFragRequested||!N.startFragPrefetch))return;var W=o[D],z=W.details;if(!z||z.live&&this.levelLastLoaded!==D||this.waitForCdnTuneIn(z)){this.state=M.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,x.ElementaryStreamTypes.AUDIO,R.PlaylistLevelType.AUDIO));var F=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,R.PlaylistLevelType.AUDIO);if(F===null)return;var I=F.len,B=this.getMaxBufferLength(),Y=this.audioSwitch;if(I>=B&&!Y)return;if(!Y&&this._streamEnded(F,z)){f.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=M.State.ENDED;return}var Q=z.fragments,ee=Q[0].start,fe=F.end;if(Y){var ce=this.getLoadPosition();fe=ce,z.PTSKnown&&ce<ee&&((F.end>ee||F.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),v.currentTime=ee+.05))}var ge=this.getNextFragment(fe,z);if(!ge){this.bufferFlushed=!0;return}((l=ge.decryptdata)===null||l===void 0?void 0:l.keyFormat)==="identity"&&!((a=ge.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(ge,z):this.loadFragment(ge,z,fe)},p.getMaxBufferLength=function(){var l=w.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,R.PlaylistLevelType.MAIN);return a===null?l:Math.max(l,a.len)},p.onMediaDetaching=function(){this.videoBuffer=null,w.prototype.onMediaDetaching.call(this)},p.onAudioTracksUpdated=function(l,a){var f=a.audioTracks;this.resetTransmuxer(),this.levels=f.map(function(o){return new C.Level(o)})},p.onAudioTrackSwitching=function(l,a){var f=!!a.url;this.trackId=a.id;var o=this.fragCurrent;o!=null&&o.loader&&o.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),f?this.setInterval(m):this.resetTransmuxer(),f?(this.audioSwitch=!0,this.state=M.State.IDLE):this.state=M.State.STOPPED,this.tick()},p.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},p.onLevelLoaded=function(l,a){this.mainDetails=a.details},p.onAudioTrackLoaded=function(l,a){var f,o=this.levels,v=a.details,D=a.id;if(!o){this.warn("Audio tracks were reset while loading level "+D);return}this.log("Track "+D+" loaded ["+v.startSN+","+v.endSN+"],duration:"+v.totalduration);var N=o[D],W=0;if(v.live||(f=N.details)!==null&&f!==void 0&&f.live){var z=this.mainDetails;if(v.fragments[0]||(v.deltaUpdateFailed=!0),v.deltaUpdateFailed||!z)return;!N.details&&v.hasProgramDateTime&&z.hasProgramDateTime?(Object(b.alignMediaPlaylistByPDT)(v,z),W=v.fragments[0].start):W=this.alignPlaylists(v,N.details)}N.details=v,this.levelLastLoaded=D,!this.startFragRequested&&(this.mainDetails||!v.live)&&this.setStartPosition(N.details,W),this.state===M.State.WAITING_TRACK&&!this.waitForCdnTuneIn(v)&&(this.state=M.State.IDLE),this.tick()},p._handleFragmentLoadProgress=function(l){var a,f=l.frag,o=l.part,v=l.payload,D=this.config,N=this.trackId,W=this.levels;if(!W){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+f.sn+" of level "+f.level+" will not be buffered");return}var z=W[N];console.assert(z,"Audio track is defined on fragment load progress");var F=z.details;console.assert(F,"Audio track details are defined on fragment load progress");var I=D.defaultAudioCodec||z.audioCodec||"mp4a.40.2",B=this.transmuxer;B||(B=this.transmuxer=new O.default(this.hls,R.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Y=this.initPTS[f.cc],Q=(a=f.initSegment)===null||a===void 0?void 0:a.data;if(Y!==void 0){var ee=!1,fe=o?o.index:-1,ce=fe!==-1,ge=new S.ChunkMetadata(f.level,f.sn,f.stats.chunkCount,v.byteLength,fe,ce);B.push(v,Q,I,"",f,o,F.totalduration,ee,ge,Y)}else{s.logger.log("Unknown video PTS for cc "+f.cc+", waiting for video PTS before demuxing audio frag "+f.sn+" of ["+F.startSN+" ,"+F.endSN+"],track "+N);var pe=this.waitingData=this.waitingData||{frag:f,part:o,cache:new A.default,complete:!1},ue=pe.cache;ue.push(new Uint8Array(v)),this.waitingVideoCC=this.videoTrackCC,this.state=M.State.WAITING_INIT_PTS}},p._handleFragmentLoadComplete=function(l){if(this.waitingData){this.waitingData.complete=!0;return}w.prototype._handleFragmentLoadComplete.call(this,l)},p.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},p.onBufferCreated=function(l,a){var f=a.tracks.audio;f&&(this.mediaBuffer=f.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},p.onFragBuffered=function(l,a){var f=a.frag,o=a.part;if(f.type!==R.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(f)){this.warn("Fragment "+f.sn+(o?" p: "+o.index:"")+" of level "+f.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}f.sn!=="initSegment"&&(this.fragPrevious=f,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(f,o)},p.onError=function(l,a){switch(a.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.AUDIO,a);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==M.State.ERROR&&this.state!==M.State.STOPPED&&(this.state=a.fatal?M.State.ERROR:M.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===M.State.PARSING||this.state===M.State.PARSED)){var f=!0,o=this.getFwdBufferInfo(this.mediaBuffer,R.PlaylistLevelType.AUDIO);o&&o.len>.5&&(f=!this.reduceMaxBufferLength(o.len)),f&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,w.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},p.onBufferFlushed=function(l,a){var f=a.type;f===x.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},p._handleTransmuxComplete=function(l){var a,f="audio",o=this.hls,v=l.remuxResult,D=l.chunkMeta,N=this.getCurrentContext(D);if(!N){this.warn("The loading context changed while buffering fragment "+D.sn+" of level "+D.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(D.level);return}var W=N.frag,z=N.part,F=v.audio,I=v.text,B=v.id3,Y=v.initSegment;if(this.fragContextChanged(W))return;if(this.state=M.State.PARSING,this.audioSwitch&&F&&this.completeAudioSwitch(),Y!=null&&Y.tracks&&(this._bufferInitSegment(Y.tracks,W,D),o.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:W,id:f,tracks:Y.tracks})),F){var Q=F.startPTS,ee=F.endPTS,fe=F.startDTS,ce=F.endDTS;z&&(z.elementaryStreams[x.ElementaryStreamTypes.AUDIO]={startPTS:Q,endPTS:ee,startDTS:fe,endDTS:ce}),W.setElementaryStreamInfo(x.ElementaryStreamTypes.AUDIO,Q,ee,fe,ce),this.bufferFragmentData(F,W,z,D)}if(B!=null&&(a=B.samples)!==null&&a!==void 0&&a.length){var ge=u({frag:W,id:f},B);o.trigger(P.Events.FRAG_PARSING_METADATA,ge)}if(I){var pe=u({frag:W,id:f},I);o.trigger(P.Events.FRAG_PARSING_USERDATA,pe)}},p._bufferInitSegment=function(l,a,f){if(this.state!==M.State.PARSING)return;l.video&&delete l.video;var o=l.audio;if(!o)return;o.levelCodec=o.codec,o.id="audio",this.log("Init audio buffer, container:"+o.container+", codecs[parsed]=["+o.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,l);var v=o.initSegment;if(v!=null&&v.byteLength){var D={type:"audio",frag:a,part:null,chunkMeta:f,parent:a.type,data:v};this.hls.trigger(P.Events.BUFFER_APPENDING,D)}this.tick()},p.loadFragment=function(l,a,f){var o=this.fragmentTracker.getState(l);this.fragCurrent=l,(this.audioSwitch||o===k.FragmentState.NOT_LOADED||o===k.FragmentState.PARTIAL)&&(l.sn==="initSegment"?this._loadInitSegment(l):a.live&&!Object(K.isFiniteNumber)(this.initPTS[l.cc])?(this.log("Waiting for video PTS in continuity counter "+l.cc+" of live stream before loading audio fragment "+l.sn+" of level "+this.trackId),this.state=M.State.WAITING_INIT_PTS):(this.startFragRequested=!0,w.prototype.loadFragment.call(this,l,a,f)))},p.completeAudioSwitch=function(){var l=this.hls,a=this.media,f=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),w.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,l.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:f})},y}(M.default);V.default=g},"./src/controller/audio-track-controller.ts":function(re,V,L){"use strict";L.r(V);var K=L("./src/events.ts"),M=L("./src/errors.ts"),P=L("./src/controller/base-playlist-controller.ts"),j=L("./src/types/loader.ts");function k(O,S){for(var _=0;_<S.length;_++){var b=S[_];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(O,b.key,b)}}function C(O,S,_){return S&&k(O.prototype,S),_&&k(O,_),O}function R(O,S){O.prototype=Object.create(S.prototype),O.prototype.constructor=O,x(O,S)}function x(O,S){return x=Object.setPrototypeOf||function(b,d){return b.__proto__=d,b},x(O,S)}var A=function(O){R(S,O);function S(b){var d;return d=O.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 _=S.prototype;return _.registerListeners=function(){var d=this.hls;d.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(K.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(K.Events.ERROR,this.onError,this)},_.unregisterListeners=function(){var d=this.hls;d.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(K.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(K.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(K.Events.ERROR,this.onError,this)},_.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,O.prototype.destroy.call(this)},_.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},_.onManifestParsed=function(d,s){this.tracks=s.audioTracks||[]},_.onAudioTrackLoaded=function(d,s){var u=s.id,h=s.details,E=this.tracksInGroup[u];if(!E){this.warn("Invalid audio track id "+u);return}var m=E.details;E.details=s.details,this.log("audioTrack "+u+" loaded ["+h.startSN+"-"+h.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,s,m))},_.onLevelLoading=function(d,s){this.switchLevel(s.level)},_.onLevelSwitching=function(d,s){this.switchLevel(s.level)},_.switchLevel=function(d){var s=this.hls.levels[d];if(!(s!=null&&s.audioGroupIds))return;var u=s.audioGroupIds[s.urlId];if(this.groupId!==u){this.groupId=u;var h=this.tracks.filter(function(m){return!u||m.groupId===u});this.selectDefaultTrack&&!h.some(function(m){return m.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=h;var E={audioTracks:h};this.log("Updating audio tracks, "+h.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(K.Events.AUDIO_TRACKS_UPDATED,E),this.selectInitialTrack()}},_.onError=function(d,s){if(O.prototype.onError.call(this,d,s),s.fatal||!s.context)return;s.context.type===j.PlaylistContextType.AUDIO_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},_.setAudioTrack=function(d){var s=this.tracksInGroup;if(d<0||d>=s.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var u=s[this.trackId];this.log("Now switching to audio-track index "+d);var h=s[d],E=h.id,m=h.groupId,g=m===void 0?"":m,w=h.name,y=h.type,p=h.url;if(this.trackId=d,this.trackName=w,this.selectDefaultTrack=!1,this.hls.trigger(K.Events.AUDIO_TRACK_SWITCHING,{id:E,groupId:g,name:w,type:y,url:p}),h.details&&!h.details.live)return;var c=this.switchParams(h.url,u==null?void 0:u.details);this.loadPlaylist(c)},_.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var s=this.trackName,u=this.findTrackId(s)||this.findTrackId();u!==-1?this.setAudioTrack(u):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},_.findTrackId=function(d){for(var s=this.tracksInGroup,u=0;u<s.length;u++){var h=s[u];if((!this.selectDefaultTrack||h.default)&&(!d||d===h.name))return h.id}return-1},_.loadPlaylist=function(d){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var u=s.id,h=s.groupId,E=s.url;if(d)try{E=d.addDirectives(E)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("loading audio-track playlist for id: "+u),this.clearTimer(),this.hls.trigger(K.Events.AUDIO_TRACK_LOADING,{url:E,id:u,groupId:h,deliveryDirectives:d||null})}},C(S,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),S}(P.default);V.default=A},"./src/controller/base-playlist-controller.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return C});var K=L("./src/polyfills/number.ts"),M=L("./src/types/level.ts"),P=L("./src/controller/level-helper.ts"),j=L("./src/utils/logger.ts"),k=L("./src/errors.ts"),C=function(){function R(A,O){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=j.logger.log.bind(j.logger,O+":"),this.warn=j.logger.warn.bind(j.logger,O+":"),this.hls=A}var x=R.prototype;return x.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},x.onError=function(O,S){S.fatal&&S.type===k.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},x.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},x.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},x.stopLoad=function(){this.canLoad=!1,this.clearTimer()},x.switchParams=function(O,S){var _=S==null?void 0:S.renditionReports;if(_)for(var b=0;b<_.length;b++){var d=_[b],s=""+d.URI;if(s===O.substr(-s.length)){var u=parseInt(d["LAST-MSN"]),h=parseInt(d["LAST-PART"]);if(S&&this.hls.config.lowLatencyMode){var E=Math.min(S.age-S.partTarget,S.targetduration);h!==void 0&&E>S.partTarget&&(h+=1)}if(Object(K.isFiniteNumber)(u))return new M.HlsUrlParameters(u,Object(K.isFiniteNumber)(h)?h:void 0,M.HlsSkip.No)}}},x.loadPlaylist=function(O){},x.shouldLoadTrack=function(O){return this.canLoad&&O&&!!O.url&&(!O.details||O.details.live)},x.playlistLoaded=function(O,S,_){var b=this,d=S.details,s=S.stats,u=s.loading.end?Math.max(0,self.performance.now()-s.loading.end):0;if(d.advancedDateTime=Date.now()-u,d.live||_!=null&&_.live){if(d.reloaded(_),_&&this.log("live playlist "+O+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),_&&d.fragments.length>0&&Object(P.mergeDetails)(_,d),!this.canLoad||!d.live)return;var h,E=void 0,m=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var g=this.hls.config.lowLatencyMode,w=d.lastPartSn,y=d.endSN,p=d.lastPartIndex,c=p!==-1,l=w===y,a=g?0:p;c?(E=l?y+1:w,m=l?a:p+1):E=y+1;var f=d.age,o=f+d.ageHeader,v=Math.min(o-d.partTarget,d.targetduration*1.5);if(v>0){if(_&&v>_.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+_.tuneInGoal+" to: "+v+" with playlist age: "+d.age),v=0;else{var D=Math.floor(v/d.targetduration);if(E+=D,m!==void 0){var N=Math.round(v%d.targetduration/d.partTarget);m+=N}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+f.toFixed(2)+"s goal: "+v+" skip sn "+D+" to part "+m)}d.tuneInGoal=v}if(h=this.getDeliveryDirectives(d,S.deliveryDirectives,E,m),g||!l){this.loadPlaylist(h);return}}else h=this.getDeliveryDirectives(d,S.deliveryDirectives,E,m);var W=Object(P.computeReloadInterval)(d,s);E!==void 0&&d.canBlockReload&&(W-=d.partTarget||1),this.log("reload live playlist "+O+" in "+Math.round(W)+" ms"),this.timer=self.setTimeout(function(){return b.loadPlaylist(h)},W)}else this.clearTimer()},x.getDeliveryDirectives=function(O,S,_,b){var d=Object(M.getSkipValue)(O,_);return S!=null&&S.skip&&O.deltaUpdateFailed&&(_=S.msn,b=S.part,d=M.HlsSkip.No),new M.HlsUrlParameters(_,b,d)},x.retryLoadingOrFail=function(O){var S=this,_=this.hls.config,b=this.retryCount<_.levelLoadingMaxRetry;if(b){var d;if(this.retryCount++,O.details.indexOf("LoadTimeOut")>-1&&(d=O.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+O.details+'"'),this.loadPlaylist();else{var s=Math.min(Math.pow(2,this.retryCount)*_.levelLoadingRetryDelay,_.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return S.loadPlaylist()},s),this.warn("retry playlist loading #"+this.retryCount+" in "+s+' ms after "'+O.details+'"')}}else this.warn('cannot recover from error "'+O.details+'"'),this.clearTimer(),O.fatal=!0;return b},R}()},"./src/controller/base-stream-controller.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"State",function(){return y}),L.d(V,"default",function(){return p});var K=L("./src/polyfills/number.ts"),M=L("./src/task-loop.ts"),P=L("./src/controller/fragment-tracker.ts"),j=L("./src/utils/buffer-helper.ts"),k=L("./src/utils/logger.ts"),C=L("./src/events.ts"),R=L("./src/errors.ts"),x=L("./src/types/transmuxer.ts"),A=L("./src/utils/mp4-tools.ts"),O=L("./src/utils/discontinuities.ts"),S=L("./src/controller/fragment-finders.ts"),_=L("./src/controller/level-helper.ts"),b=L("./src/loader/fragment-loader.ts"),d=L("./src/crypt/decrypter.ts"),s=L("./src/utils/time-ranges.ts"),u=L("./src/types/loader.ts");function h(c,l){for(var a=0;a<l.length;a++){var f=l[a];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(c,f.key,f)}}function E(c,l,a){return l&&h(c.prototype,l),a&&h(c,a),c}function m(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function g(c,l){c.prototype=Object.create(l.prototype),c.prototype.constructor=c,w(c,l)}function w(c,l){return w=Object.setPrototypeOf||function(f,o){return f.__proto__=o,f},w(c,l)}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"},p=function(c){g(l,c);function l(f,o,v){var D;return D=c.call(this)||this,D.hls=void 0,D.fragPrevious=null,D.fragCurrent=null,D.fragmentTracker=void 0,D.transmuxer=null,D._state=y.STOPPED,D.media=void 0,D.mediaBuffer=void 0,D.config=void 0,D.bitrateTest=!1,D.lastCurrentTime=0,D.nextLoadPosition=0,D.startPosition=0,D.loadedmetadata=!1,D.fragLoadError=0,D.retryDate=0,D.levels=null,D.fragmentLoader=void 0,D.levelLastLoaded=null,D.startFragRequested=!1,D.decrypter=void 0,D.initPTS=[],D.onvseeking=null,D.onvended=null,D.logPrefix="",D.log=void 0,D.warn=void 0,D.logPrefix=v,D.log=k.logger.log.bind(k.logger,v+":"),D.warn=k.logger.warn.bind(k.logger,v+":"),D.hls=f,D.fragmentLoader=new b.default(f.config),D.fragmentTracker=o,D.config=f.config,D.decrypter=new d.default(f,f.config),f.on(C.Events.KEY_LOADED,D.onKeyLoaded,m(D)),D}var a=l.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(o){},a.stopLoad=function(){this.fragmentLoader.abort();var o=this.fragCurrent;o&&this.fragmentTracker.removeFragment(o),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=y.STOPPED},a._streamEnded=function(o,v){var D=this.fragCurrent,N=this.fragmentTracker;if(!v.live&&D&&D.sn===v.endSN&&!o.nextStart){var W=N.getState(D);return W===P.FragmentState.PARTIAL||W===P.FragmentState.OK}return!1},a.onMediaAttached=function(o,v){var D=this.media=this.mediaBuffer=v.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),D.addEventListener("seeking",this.onvseeking),D.addEventListener("ended",this.onvended);var N=this.config;this.levels&&N.autoStartLoad&&this.state===y.STOPPED&&this.startLoad(N.startPosition)},a.onMediaDetaching=function(){var o=this.media;o!=null&&o.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),o&&(o.removeEventListener("seeking",this.onvseeking),o.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 o=this.config,v=this.fragCurrent,D=this.media,N=this.mediaBuffer,W=this.state,z=D?D.currentTime:0,F=j.BufferHelper.bufferInfo(N||D,z,o.maxBufferHole);if(this.log("media seeking to "+(Object(K.isFiniteNumber)(z)?z.toFixed(3):z)+", state: "+W),W===y.ENDED)this.resetLoadingState();else if(v&&!F.len){var I=o.maxFragLookUpTolerance,B=v.start-I,Y=v.start+v.duration+I,Q=z>Y;(z<B||Q)&&(Q&&v.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),v.loader.abort()),this.resetLoadingState())}D&&(this.lastCurrentTime=z),!this.loadedmetadata&&!F.len&&(this.nextLoadPosition=this.startPosition=z),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(o,v){if(this.state!==y.KEY_LOADING||v.frag!==this.fragCurrent||!this.levels)return;this.state=y.IDLE;var D=this.levels[v.frag.level].details;D&&this.loadFragment(v.frag,D,v.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=y.STOPPED,this.hls.off(C.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(o,v){this.log("Loading key for "+o.sn+" of ["+v.startSN+"-"+v.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+o.level),this.state=y.KEY_LOADING,this.fragCurrent=o,this.hls.trigger(C.Events.KEY_LOADING,{frag:o})},a.loadFragment=function(o,v,D){this._loadFragForPlayback(o,v,D)},a._loadFragForPlayback=function(o,v,D){var N=this,W=function(F){if(N.fragContextChanged(o)){N.warn("Fragment "+o.sn+(F.part?" p: "+F.part.index:"")+" of level "+o.level+" was dropped during download."),N.fragmentTracker.removeFragment(o);return}o.stats.chunkCount++,N._handleFragmentLoadProgress(F)};this._doFragLoad(o,v,D,W).then(function(z){if(!z)return;N.fragLoadError=0;var F=N.state;if(N.fragContextChanged(o)){(F===y.FRAG_LOADING||F===y.BACKTRACKING||!N.fragCurrent&&F===y.PARSING)&&(N.fragmentTracker.removeFragment(o),N.state=y.IDLE);return}if("payload"in z&&(N.log("Loaded fragment "+o.sn+" of level "+o.level),N.hls.trigger(C.Events.FRAG_LOADED,z),N.state===y.BACKTRACKING)){N.fragmentTracker.backtrack(o,z),N.resetFragmentLoading(o);return}N._handleFragmentLoadComplete(z)}).catch(function(z){N.warn(z),N.resetFragmentLoading(o)})},a.flushMainBuffer=function(o,v,D){if(D===void 0&&(D=null),!(o-v))return;var N={startOffset:o,endOffset:v,type:D};this.fragLoadError=0,this.hls.trigger(C.Events.BUFFER_FLUSHING,N)},a._loadInitSegment=function(o){var v=this;this._doFragLoad(o).then(function(D){if(!D||v.fragContextChanged(o)||!v.levels)throw new Error("init load aborted");return D}).then(function(D){var N=v.hls,W=D.payload,z=o.decryptdata;if(W&&W.byteLength>0&&z&&z.key&&z.iv&&z.method==="AES-128"){var F=self.performance.now();return v.decrypter.webCryptoDecrypt(new Uint8Array(W),z.key.buffer,z.iv.buffer).then(function(I){var B=self.performance.now();return N.trigger(C.Events.FRAG_DECRYPTED,{frag:o,payload:I,stats:{tstart:F,tdecrypt:B}}),D.payload=I,D})}return D}).then(function(D){var N=v.fragCurrent,W=v.hls,z=v.levels;if(!z)throw new Error("init load aborted, missing levels");var F=z[o.level].details;console.assert(F,"Level details are defined when init segment is loaded");var I=o.stats;v.state=y.IDLE,v.fragLoadError=0,o.data=new Uint8Array(D.payload),I.parsing.start=I.buffering.start=self.performance.now(),I.parsing.end=I.buffering.end=self.performance.now(),D.frag===N&&W.trigger(C.Events.FRAG_BUFFERED,{stats:I,frag:N,part:null,id:o.type}),v.tick()}).catch(function(D){v.warn(D),v.resetFragmentLoading(o)})},a.fragContextChanged=function(o){var v=this.fragCurrent;return!o||!v||o.level!==v.level||o.sn!==v.sn||o.urlId!==v.urlId},a.fragBufferedComplete=function(o,v){var D=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+o.type+" sn: "+o.sn+(v?" part: "+v.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+o.level+" "+s.default.toString(j.BufferHelper.getBuffered(D))),this.state=y.IDLE,this.tick()},a._handleFragmentLoadComplete=function(o){var v=this.transmuxer;if(!v)return;var D=o.frag,N=o.part,W=o.partsLoaded,z=!W||W.length===0||W.some(function(I){return!I}),F=new x.ChunkMetadata(D.level,D.sn,D.stats.chunkCount+1,0,N?N.index:-1,!z);v.flush(F)},a._handleFragmentLoadProgress=function(o){},a._doFragLoad=function(o,v,D,N){var W=this;if(D===void 0&&(D=null),!this.levels)throw new Error("frag load aborted, missing levels");if(D=Math.max(o.start,D||0),this.config.lowLatencyMode&&v){var z=v.partList;if(z&&N){D>o.end&&v.fragmentHint&&(o=v.fragmentHint);var F=this.getNextPart(z,o,D);if(F>-1){var I=z[F];return this.log("Loading part sn: "+o.sn+" p: "+I.index+" cc: "+o.cc+" of playlist ["+v.startSN+"-"+v.endSN+"] parts [0-"+F+"-"+(z.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+o.level+", target: "+parseFloat(D.toFixed(3))),this.nextLoadPosition=I.start+I.duration,this.state=y.FRAG_LOADING,this.hls.trigger(C.Events.FRAG_LOADING,{frag:o,part:z[F],targetBufferTime:D}),this.doFragPartsLoad(o,z,F,N).catch(function(B){return W.handleFragLoadError(B)})}else if(!o.url||this.loadedEndOfParts(z,D))return Promise.resolve(null)}}return this.log("Loading fragment "+o.sn+" cc: "+o.cc+" "+(v?"of ["+v.startSN+"-"+v.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+o.level+", target: "+parseFloat(D.toFixed(3))),Object(K.isFiniteNumber)(o.sn)&&!this.bitrateTest&&(this.nextLoadPosition=o.start+o.duration),this.state=y.FRAG_LOADING,this.hls.trigger(C.Events.FRAG_LOADING,{frag:o,targetBufferTime:D}),this.fragmentLoader.load(o,N).catch(function(B){return W.handleFragLoadError(B)})},a.doFragPartsLoad=function(o,v,D,N){var W=this;return new Promise(function(z,F){var I=[],B=function Y(Q){var ee=v[Q];W.fragmentLoader.loadPart(o,ee,N).then(function(fe){I[ee.index]=fe;var ce=fe.part;W.hls.trigger(C.Events.FRAG_LOADED,fe);var ge=v[Q+1];if(ge&&ge.fragment===o)Y(Q+1);else return z({frag:o,part:ce,partsLoaded:I})}).catch(F)};B(D)})},a.handleFragLoadError=function(o){var v=o.data;return v&&v.details===R.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(v.frag,v.part):this.hls.trigger(C.Events.ERROR,v),null},a._handleTransmuxerFlush=function(o){var v=this.getCurrentContext(o);if(!v||this.state!==y.PARSING){this.fragCurrent||(this.state=y.IDLE);return}var D=v.frag,N=v.part,W=v.level,z=self.performance.now();D.stats.parsing.end=z,N&&(N.stats.parsing.end=z),this.updateLevelTiming(D,N,W,o.partial)},a.getCurrentContext=function(o){var v=this.levels,D=o.level,N=o.sn,W=o.part;if(!v||!v[D])return this.warn("Levels object was unset while buffering fragment "+N+" of level "+D+". The current chunk will not be buffered."),null;var z=v[D],F=W>-1?Object(_.getPartWith)(z,N,W):null,I=F?F.fragment:Object(_.getFragmentWithSN)(z,N,this.fragCurrent);return I?{frag:I,part:F,level:z}:null},a.bufferFragmentData=function(o,v,D,N){if(!o||this.state!==y.PARSING)return;var W=o.data1,z=o.data2,F=W;if(W&&z&&(F=Object(A.appendUint8Array)(W,z)),!F||!F.length)return;var I={type:o.type,frag:v,part:D,chunkMeta:N,parent:v.type,data:F};this.hls.trigger(C.Events.BUFFER_APPENDING,I),o.dropped&&o.independent&&!D&&this.flushBufferGap(v)},a.flushBufferGap=function(o){var v=this.media;if(!v)return;if(!j.BufferHelper.isBuffered(v,v.currentTime)){this.flushMainBuffer(0,o.start);return}var D=v.currentTime,N=j.BufferHelper.bufferInfo(v,D,0),W=o.duration,z=Math.min(this.config.maxFragLookUpTolerance*2,W*.25),F=Math.max(Math.min(o.start-z,N.end-z),D+z);o.start-F>z&&this.flushMainBuffer(F,o.start)},a.getFwdBufferInfo=function(o,v){var D=this.config,N=this.getLoadPosition();if(!Object(K.isFiniteNumber)(N))return null;var W=j.BufferHelper.bufferInfo(o,N,D.maxBufferHole);if(W.len===0&&W.nextStart!==void 0){var z=this.fragmentTracker.getBufferedFrag(N,v);if(z&&W.nextStart<z.end)return j.BufferHelper.bufferInfo(o,N,Math.max(W.nextStart,D.maxBufferHole))}return W},a.getMaxBufferLength=function(o){var v=this.config,D;return o?D=Math.max(8*v.maxBufferSize/o,v.maxBufferLength):D=v.maxBufferLength,Math.min(D,v.maxMaxBufferLength)},a.reduceMaxBufferLength=function(o){var v=this.config,D=o||v.maxBufferLength;return v.maxMaxBufferLength>=D?(v.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+v.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(o,v){var D,N,W=v.fragments,z=W.length;if(!z)return null;var F=this.config,I=W[0].start,B;if(v.live){var Y=F.initialLiveManifestSize;if(z<Y)return this.warn("Not enough fragments to start playback (have: "+z+", need: "+Y+")"),null;!v.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(B=this.getInitialLiveFragment(v,W),this.startPosition=B?this.hls.liveSyncPosition||B.start:o)}else o<=I&&(B=W[0]);if(!B){var Q=F.lowLatencyMode?v.partEnd:v.fragmentEnd;B=this.getFragmentAtPosition(o,Q,v)}return(D=B)!==null&&D!==void 0&&D.initSegment&&!((N=B)!==null&&N!==void 0&&N.initSegment.data)&&!this.bitrateTest&&(B=B.initSegment),B},a.getNextPart=function(o,v,D){for(var N=-1,W=!1,z=!0,F=0,I=o.length;F<I;F++){var B=o[F];if(z=z&&!B.independent,N>-1&&D<B.start)break;var Y=B.loaded;!Y&&(W||B.independent||z)&&B.fragment===v&&(N=F),W=Y}return N},a.loadedEndOfParts=function(o,v){var D=o[o.length-1];return D&&v>D.start&&D.loaded},a.getInitialLiveFragment=function(o,v){var D=this.fragPrevious,N=null;if(D){if(o.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+D.programDateTime),N=Object(S.findFragmentByPDT)(v,D.endProgramDateTime,this.config.maxFragLookUpTolerance)),!N){var W=D.sn+1;if(W>=o.startSN&&W<=o.endSN){var z=v[W-o.startSN];D.cc===z.cc&&(N=z,this.log("Live playlist, switching playlist, load frag with next SN: "+N.sn))}N||(N=Object(S.findFragWithCC)(v,D.cc),N&&this.log("Live playlist, switching playlist, load frag with same CC: "+N.sn))}}else{var F=this.hls.liveSyncPosition;F!==null&&(N=this.getFragmentAtPosition(F,this.bitrateTest?o.fragmentEnd:o.edge,o))}return N},a.getFragmentAtPosition=function(o,v,D){var N=this.config,W=this.fragPrevious,z=D.fragments,F=D.endSN,I=D.fragmentHint,B=N.maxFragLookUpTolerance,Y=!!(N.lowLatencyMode&&D.partList&&I);Y&&I&&!this.bitrateTest&&(z=z.concat(I),F=I.sn);var Q;if(o<v){var ee=o>v-B?0:B;Q=Object(S.findFragmentByPTS)(W,z,o,ee)}else Q=z[z.length-1];if(Q){var fe=Q.sn-D.startSN,ce=W&&Q.level===W.level,ge=z[fe+1],pe=this.fragmentTracker.getState(Q);if(pe===P.FragmentState.BACKTRACKED){Q=null;for(var ue=fe;z[ue]&&this.fragmentTracker.getState(z[ue])===P.FragmentState.BACKTRACKED;)W?Q=z[ue--]:Q=z[--ue];Q||(Q=ge)}else W&&Q.sn===W.sn&&!Y&&(ce&&(Q.sn<F&&this.fragmentTracker.getState(ge)!==P.FragmentState.OK?(this.log("SN "+Q.sn+" just loaded, load next one: "+ge.sn),Q=ge):Q=null))}return Q},a.synchronizeToLiveEdge=function(o){var v=this.config,D=this.media;if(!D)return;var N=this.hls.liveSyncPosition,W=D.currentTime,z=o.fragments[0].start,F=o.edge,I=W>=z-v.maxFragLookUpTolerance&&W<=F;if(N!==null&&D.duration>N&&(W<N||!I)){var B=v.liveMaxLatencyDuration!==void 0?v.liveMaxLatencyDuration:v.liveMaxLatencyDurationCount*o.targetduration;(!I&&D.readyState<4||W<F-B)&&(this.loadedmetadata||(this.nextLoadPosition=N),D.readyState&&(this.warn("Playback: "+W.toFixed(3)+" is located too far from the end of live sliding playlist: "+F+", reset currentTime to : "+N.toFixed(3)),D.currentTime=N))}},a.alignPlaylists=function(o,v){var D=this.levels,N=this.levelLastLoaded,W=this.fragPrevious,z=N!==null?D[N]:null,F=o.fragments.length;if(!F)return this.warn("No fragments in live playlist"),0;var I=o.fragments[0].start,B=!v,Y=o.alignedSliding&&Object(K.isFiniteNumber)(I);if(B||!Y&&!I){Object(O.alignStream)(W,z,o);var Q=o.fragments[0].start;return this.log("Live playlist sliding: "+Q.toFixed(2)+" start-sn: "+(v?v.startSN:"na")+"->"+o.startSN+" prev-sn: "+(W?W.sn:"na")+" fragments: "+F),Q}return I},a.waitForCdnTuneIn=function(o){var v=3;return o.live&&o.canBlockReload&&o.tuneInGoal>Math.max(o.partHoldBack,o.partTarget*v)},a.setStartPosition=function(o,v){var D=this.startPosition;if(D<v&&(D=-1),D===-1||this.lastCurrentTime===-1){var N=o.startTimeOffset;Object(K.isFiniteNumber)(N)?(D=v+N,N<0&&(D+=o.totalduration),D=Math.min(Math.max(v,D),v+o.totalduration),this.log("Start time offset "+N+" found in playlist, adjust startPosition to "+D),this.startPosition=D):o.live?D=this.hls.liveSyncPosition||v:this.startPosition=D=0,this.lastCurrentTime=D}this.nextLoadPosition=D},a.getLoadPosition=function(){var o=this.media,v=0;return this.loadedmetadata&&o?v=o.currentTime:this.nextLoadPosition&&(v=this.nextLoadPosition),v},a.handleFragLoadAborted=function(o,v){this.transmuxer&&o.sn!=="initSegment"&&o.stats.aborted&&(this.warn("Fragment "+o.sn+(v?" part"+v.index:"")+" of level "+o.level+" was aborted"),this.resetFragmentLoading(o))},a.resetFragmentLoading=function(o){(!this.fragCurrent||!this.fragContextChanged(o))&&(this.state=y.IDLE)},a.onFragmentOrKeyLoadError=function(o,v){if(v.fatal)return;var D=v.frag;if(!D||D.type!==o)return;var N=this.fragCurrent;console.assert(N&&D.sn===N.sn&&D.level===N.level&&D.urlId===N.urlId,"Frag load error must match current frag to retry");var W=this.config;if(this.fragLoadError+1<=W.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(D.level))return;var z=Math.min(Math.pow(2,this.fragLoadError)*W.fragLoadingRetryDelay,W.fragLoadingMaxRetryTimeout);this.warn("Fragment "+D.sn+" of "+o+" "+D.level+" failed to load, retrying in "+z+"ms"),this.retryDate=self.performance.now()+z,this.fragLoadError++,this.state=y.FRAG_LOADING_WAITING_RETRY}else v.levelRetry?(o===u.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=y.IDLE):(k.logger.error(v.details+" reaches max retry, redispatch as fatal ..."),v.fatal=!0,this.hls.stopLoad(),this.state=y.ERROR)},a.afterBufferFlushed=function(o,v,D){if(!o)return;var N=j.BufferHelper.getBuffered(o);this.fragmentTracker.detectEvictedFragments(v,N,D),this.state===y.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=y.IDLE},a.resetLiveStartWhenNotLoaded=function(o){if(!this.loadedmetadata){this.startFragRequested=!1;var v=this.levels?this.levels[o].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(o,v,D,N){var W=this,z=D.details;console.assert(!!z,"level.details must be defined");var F=Object.keys(o.elementaryStreams).reduce(function(I,B){var Y=o.elementaryStreams[B];if(Y){var Q=Y.endPTS-Y.startPTS;if(Q<=0)return W.warn("Could not parse fragment "+o.sn+" "+B+" duration reliably ("+Q+") resetting transmuxer to fallback to playlist timing"),W.resetTransmuxer(),I||!1;var ee=N?0:Object(_.updateFragPTSDTS)(z,o,Y.startPTS,Y.endPTS,Y.startDTS,Y.endDTS);return W.hls.trigger(C.Events.LEVEL_PTS_UPDATED,{details:z,level:D,drift:ee,type:B,frag:o,start:Y.startPTS,end:Y.endPTS}),!0}return I},!1);F?(this.state=y.PARSED,this.hls.trigger(C.Events.FRAG_PARSED,{frag:o,part:v})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},E(l,[{key:"state",get:function(){return this._state},set:function(o){var v=this._state;v!==o&&(this._state=o,this.log(v+"->"+o))}}]),l}(M.default)},"./src/controller/buffer-controller.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return S});var K=L("./src/polyfills/number.ts"),M=L("./src/events.ts"),P=L("./src/utils/logger.ts"),j=L("./src/errors.ts"),k=L("./src/utils/buffer-helper.ts"),C=L("./src/utils/mediasource-helper.ts"),R=L("./src/loader/fragment.ts"),x=L("./src/controller/buffer-operation-queue.ts"),A=Object(C.getMediaSource)(),O=/([ha]vc.)(?:\.[^.,]+)+/,S=function(){function _(d){var s=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var u=s.hls,h=s.media,E=s.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),h&&(s.updateMediaElementDuration(),u.trigger(M.Events.MEDIA_ATTACHED,{media:h})),E&&E.removeEventListener("sourceopen",s._onMediaSourceOpen),s.checkPendingTracks()},this._onMediaSourceClose=function(){P.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){P.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var b=_.prototype;return b.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},b.destroy=function(){this.unregisterListeners(),this.details=null},b.registerListeners=function(){var s=this.hls;s.on(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(M.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(M.Events.BUFFER_RESET,this.onBufferReset,this),s.on(M.Events.BUFFER_APPENDING,this.onBufferAppending,this),s.on(M.Events.BUFFER_CODECS,this.onBufferCodecs,this),s.on(M.Events.BUFFER_EOS,this.onBufferEos,this),s.on(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),s.on(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),s.on(M.Events.FRAG_PARSED,this.onFragParsed,this),s.on(M.Events.FRAG_CHANGED,this.onFragChanged,this)},b.unregisterListeners=function(){var s=this.hls;s.off(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(M.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(M.Events.BUFFER_RESET,this.onBufferReset,this),s.off(M.Events.BUFFER_APPENDING,this.onBufferAppending,this),s.off(M.Events.BUFFER_CODECS,this.onBufferCodecs,this),s.off(M.Events.BUFFER_EOS,this.onBufferEos,this),s.off(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),s.off(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),s.off(M.Events.FRAG_PARSED,this.onFragParsed,this),s.off(M.Events.FRAG_CHANGED,this.onFragChanged,this)},b._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new x.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},b.onManifestParsed=function(s,u){var h=2;(u.audio&&!u.video||!u.altAudio)&&(h=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=h,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},b.onMediaAttaching=function(s,u){var h=this.media=u.media;if(h&&A){var E=this.mediaSource=new A;E.addEventListener("sourceopen",this._onMediaSourceOpen),E.addEventListener("sourceended",this._onMediaSourceEnded),E.addEventListener("sourceclose",this._onMediaSourceClose),h.src=self.URL.createObjectURL(E),this._objectUrl=h.src}},b.onMediaDetaching=function(){var s=this.media,u=this.mediaSource,h=this._objectUrl;if(u){if(P.logger.log("[buffer-controller]: media source detaching"),u.readyState==="open")try{u.endOfStream()}catch(E){P.logger.warn("[buffer-controller]: onMediaDetaching: "+E.message+" while calling endOfStream")}this.onBufferReset(),u.removeEventListener("sourceopen",this._onMediaSourceOpen),u.removeEventListener("sourceended",this._onMediaSourceEnded),u.removeEventListener("sourceclose",this._onMediaSourceClose),s&&(h&&self.URL.revokeObjectURL(h),s.src===h?(s.removeAttribute("src"),s.load()):P.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(M.Events.MEDIA_DETACHED,void 0)},b.onBufferReset=function(){var s=this;this.getSourceBufferTypes().forEach(function(u){var h=s.sourceBuffer[u];try{h&&(s.removeBufferListeners(u),s.mediaSource&&s.mediaSource.removeSourceBuffer(h),s.sourceBuffer[u]=void 0)}catch(E){P.logger.warn("[buffer-controller]: Failed to reset the "+u+" buffer",E)}}),this._initSourceBuffer()},b.onBufferCodecs=function(s,u){var h=this,E=this.getSourceBufferTypes().length;if(Object.keys(u).forEach(function(m){if(E){var g=h.tracks[m];if(g&&typeof g.buffer.changeType=="function"){var w=u[m],y=w.codec,p=w.levelCodec,c=w.container,l=(g.levelCodec||g.codec).replace(O,"$1"),a=(p||y).replace(O,"$1");if(l!==a){var f=c+";codecs="+(p||y);h.appendChangeType(m,f)}}}else h.pendingTracks[m]=u[m]}),E)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},b.appendChangeType=function(s,u){var h=this,E=this.operationQueue,m={execute:function(){var w=h.sourceBuffer[s];w&&(P.logger.log("[buffer-controller]: changing "+s+" sourceBuffer type to "+u),w.changeType(u)),E.shiftAndExecuteNext(s)},onStart:function(){},onComplete:function(){},onError:function(w){P.logger.warn("[buffer-controller]: Failed to change "+s+" SourceBuffer type",w)}};E.append(m,s)},b.onBufferAppending=function(s,u){var h=this,E=this.hls,m=this.operationQueue,g=this.tracks,w=u.data,y=u.type,p=u.frag,c=u.part,l=u.chunkMeta,a=l.buffering[y],f=self.performance.now();a.start=f;var o=p.stats.buffering,v=c?c.stats.buffering:null;o.start===0&&(o.start=f),v&&v.start===0&&(v.start=f);var D=g.audio,N=y==="audio"&&l.id===1&&(D==null?void 0:D.container)==="audio/mpeg",W={execute:function(){if(a.executeStart=self.performance.now(),N){var F=h.sourceBuffer[y];if(F){var I=p.start-F.timestampOffset;Math.abs(I)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+p.start+" (delta: "+I+") sn: "+p.sn+")"),F.timestampOffset=p.start)}}h.appendExecutor(w,y)},onStart:function(){},onComplete:function(){var F=self.performance.now();a.executeEnd=a.end=F,o.first===0&&(o.first=F),v&&v.first===0&&(v.first=F);var I=h.sourceBuffer,B={};for(var Y in I)B[Y]=k.BufferHelper.getBuffered(I[Y]);h.appendError=0,h.hls.trigger(M.Events.BUFFER_APPENDED,{type:y,frag:p,part:c,chunkMeta:l,parent:p.type,timeRanges:B})},onError:function(F){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+y+" SourceBuffer",F);var I={type:j.ErrorTypes.MEDIA_ERROR,parent:p.type,details:j.ErrorDetails.BUFFER_APPEND_ERROR,err:F,fatal:!1};F.code===DOMException.QUOTA_EXCEEDED_ERR?I.details=j.ErrorDetails.BUFFER_FULL_ERROR:(h.appendError++,I.details=j.ErrorDetails.BUFFER_APPEND_ERROR,h.appendError>E.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+E.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),I.fatal=!0)),E.trigger(M.Events.ERROR,I)}};m.append(W,y)},b.onBufferFlushing=function(s,u){var h=this,E=this.operationQueue,m=function(w){return{execute:h.removeExecutor.bind(h,w,u.startOffset,u.endOffset),onStart:function(){},onComplete:function(){h.hls.trigger(M.Events.BUFFER_FLUSHED,{type:w})},onError:function(p){P.logger.warn("[buffer-controller]: Failed to remove from "+w+" SourceBuffer",p)}}};u.type?E.append(m(u.type),u.type):this.getSourceBufferTypes().forEach(function(g){E.append(m(g),g)})},b.onFragParsed=function(s,u){var h=this,E=u.frag,m=u.part,g=[],w=m?m.elementaryStreams:E.elementaryStreams;w[R.ElementaryStreamTypes.AUDIOVIDEO]?g.push("audiovideo"):(w[R.ElementaryStreamTypes.AUDIO]&&g.push("audio"),w[R.ElementaryStreamTypes.VIDEO]&&g.push("video"));var y=function(){var c=self.performance.now();E.stats.buffering.end=c,m&&(m.stats.buffering.end=c);var l=m?m.stats:E.stats;h.hls.trigger(M.Events.FRAG_BUFFERED,{frag:E,part:m,stats:l,id:E.type})};g.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+E.type+" level: "+E.level+" sn: "+E.sn),this.blockBuffers(y,g)},b.onFragChanged=function(s,u){this.flushBackBuffer()},b.onBufferEos=function(s,u){var h=this,E=this.getSourceBufferTypes().reduce(function(m,g){var w=h.sourceBuffer[g];return(!u.type||u.type===g)&&(w&&!w.ended&&(w.ended=!0,P.logger.log("[buffer-controller]: "+g+" sourceBuffer now EOS"))),m&&!!(!w||w.ended)},!0);E&&this.blockBuffers(function(){var m=h.mediaSource;if(!m||m.readyState!=="open")return;m.endOfStream()})},b.onLevelUpdated=function(s,u){var h=u.details;if(!h.fragments.length)return;this.details=h,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},b.flushBackBuffer=function(){var s=this.hls,u=this.details,h=this.media,E=this.sourceBuffer;if(!h||u===null)return;var m=this.getSourceBufferTypes();if(!m.length)return;var g=u.live&&s.config.liveBackBufferLength!==null?s.config.liveBackBufferLength:s.config.backBufferLength;if(!Object(K.isFiniteNumber)(g)||g<0)return;var w=h.currentTime,y=u.levelTargetDuration,p=Math.max(g,y),c=Math.floor(w/y)*y-p;m.forEach(function(l){var a=E[l];if(a){var f=k.BufferHelper.getBuffered(a);f.length>0&&c>f.start(0)&&(s.trigger(M.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),u.live&&s.trigger(M.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),s.trigger(M.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:l}))}})},b.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var s=this.details,u=this.hls,h=this.media,E=this.mediaSource,m=s.fragments[0].start+s.totalduration,g=h.duration,w=Object(K.isFiniteNumber)(E.duration)?E.duration:0;s.live&&u.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),E.duration=Infinity,this.updateSeekableRange(s)):(m>w&&m>g||!Object(K.isFiniteNumber)(g))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+m.toFixed(3)),E.duration=m)},b.updateSeekableRange=function(s){var u=this.mediaSource,h=s.fragments,E=h.length;if(E&&s.live&&u!==null&&u!==void 0&&u.setLiveSeekableRange){var m=Math.max(0,h[0].start),g=Math.max(m,m+s.totalduration);u.setLiveSeekableRange(m,g)}},b.checkPendingTracks=function(){var s=this.bufferCodecEventsExpected,u=this.operationQueue,h=this.pendingTracks,E=Object.keys(h).length;if(E&&!s||E===2){this.createSourceBuffers(h),this.pendingTracks={};var m=this.getSourceBufferTypes();if(m.length===0){this.hls.trigger(M.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}m.forEach(function(g){u.executeNext(g)})}},b.createSourceBuffers=function(s){var u=this.sourceBuffer,h=this.mediaSource;if(!h)throw Error("createSourceBuffers called when mediaSource was null");var E=0;for(var m in s)if(!u[m]){var g=s[m];if(!g)throw Error("source buffer exists for track "+m+", however track does not");var w=g.levelCodec||g.codec,y=g.container+";codecs="+w;P.logger.log("[buffer-controller]: creating sourceBuffer("+y+")");try{var p=u[m]=h.addSourceBuffer(y),c=m;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[m]={buffer:p,codec:w,container:g.container,levelCodec:g.levelCodec,id:g.id},E++}catch(l){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+l.message),this.hls.trigger(M.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:l,mimeType:y})}}E&&this.hls.trigger(M.Events.BUFFER_CREATED,{tracks:this.tracks})},b._onSBUpdateStart=function(s){var u=this.operationQueue,h=u.current(s);h.onStart()},b._onSBUpdateEnd=function(s){var u=this.operationQueue,h=u.current(s);h.onComplete(),u.shiftAndExecuteNext(s)},b._onSBUpdateError=function(s,u){P.logger.error("[buffer-controller]: "+s+" SourceBuffer error",u),this.hls.trigger(M.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var h=this.operationQueue.current(s);h&&h.onError(u)},b.removeExecutor=function(s,u,h){var E=this.media,m=this.mediaSource,g=this.operationQueue,w=this.sourceBuffer,y=w[s];if(!E||!m||!y){P.logger.warn("[buffer-controller]: Attempting to remove from the "+s+" SourceBuffer, but it does not exist"),g.shiftAndExecuteNext(s);return}var p=Object(K.isFiniteNumber)(E.duration)?E.duration:Infinity,c=Object(K.isFiniteNumber)(m.duration)?m.duration:Infinity,l=Math.max(0,u),a=Math.min(h,p,c);a>l?(P.logger.log("[buffer-controller]: Removing ["+l+","+a+"] from the "+s+" SourceBuffer"),console.assert(!y.updating,s+" sourceBuffer must not be updating"),y.remove(l,a)):g.shiftAndExecuteNext(s)},b.appendExecutor=function(s,u){var h=this.operationQueue,E=this.sourceBuffer,m=E[u];if(!m){P.logger.warn("[buffer-controller]: Attempting to append to the "+u+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(u);return}m.ended=!1,console.assert(!m.updating,u+" sourceBuffer must not be updating"),m.appendBuffer(s)},b.blockBuffers=function(s,u){var h=this;if(u===void 0&&(u=this.getSourceBufferTypes()),!u.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(s);return}var E=this.operationQueue,m=u.map(function(g){return E.appendBlocker(g)});Promise.all(m).then(function(){s(),u.forEach(function(g){var w=h.sourceBuffer[g];(!w||!w.updating)&&E.shiftAndExecuteNext(g)})})},b.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},b.addBufferListener=function(s,u,h){var E=this.sourceBuffer[s];if(!E)return;var m=h.bind(this,s);this.listeners[s].push({event:u,listener:m}),E.addEventListener(u,m)},b.removeBufferListeners=function(s){var u=this.sourceBuffer[s];if(!u)return;this.listeners[s].forEach(function(h){u.removeEventListener(h.event,h.listener)})},_}()},"./src/controller/buffer-operation-queue.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return M});var K=L("./src/utils/logger.ts"),M=function(){function P(k){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=k}var j=P.prototype;return j.append=function(C,R){var x=this.queues[R];x.push(C),x.length===1&&this.buffers[R]&&this.executeNext(R)},j.insertAbort=function(C,R){var x=this.queues[R];x.unshift(C),this.executeNext(R)},j.appendBlocker=function(C){var R,x=new Promise(function(O){R=O}),A={execute:R,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(A,C),x},j.executeNext=function(C){var R=this.buffers,x=this.queues,A=R[C],O=x[C];if(O.length){var S=O[0];try{S.execute()}catch(_){K.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),S.onError(_),(!A||!A.updating)&&(O.shift(),this.executeNext(C))}}},j.shiftAndExecuteNext=function(C){this.queues[C].shift(),this.executeNext(C)},j.current=function(C){return this.queues[C][0]},P}()},"./src/controller/cap-level-controller.ts":function(re,V,L){"use strict";L.r(V);var K=L("./src/events.ts");function M(k,C){for(var R=0;R<C.length;R++){var x=C[R];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(k,x.key,x)}}function P(k,C,R){return C&&M(k.prototype,C),R&&M(k,R),k}var j=function(){function k(R){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=R,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var C=k.prototype;return C.setStreamController=function(x){this.streamController=x},C.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},C.registerListeners=function(){var x=this.hls;x.on(K.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),x.on(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),x.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.on(K.Events.BUFFER_CODECS,this.onBufferCodecs,this),x.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},C.unregisterListener=function(){var x=this.hls;x.off(K.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),x.off(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),x.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.off(K.Events.BUFFER_CODECS,this.onBufferCodecs,this),x.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},C.onFpsDropLevelCapping=function(x,A){k.isLevelAllowed(A.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(A.droppedLevel)},C.onMediaAttaching=function(x,A){this.media=A.media instanceof HTMLVideoElement?A.media:null},C.onManifestParsed=function(x,A){var O=this.hls;this.restrictedLevels=[],this.firstLevel=A.firstLevel,O.config.capLevelToPlayerSize&&A.video&&this.startCapping()},C.onBufferCodecs=function(x,A){var O=this.hls;O.config.capLevelToPlayerSize&&A.video&&this.startCapping()},C.onMediaDetaching=function(){this.stopCapping()},C.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var x=this.hls.levels;if(x.length){var A=this.hls;A.autoLevelCapping=this.getMaxLevel(x.length-1),A.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=A.autoLevelCapping}}},C.getMaxLevel=function(x){var A=this,O=this.hls.levels;if(!O.length)return-1;var S=O.filter(function(_,b){return k.isLevelAllowed(b,A.restrictedLevels)&&b<=x});return this.clientRect=null,k.getMaxLevelByMediaSize(S,this.mediaWidth,this.mediaHeight)},C.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()},C.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},C.getDimensions=function(){if(this.clientRect)return this.clientRect;var x=this.media,A={width:0,height:0};if(x){var O=x.getBoundingClientRect();A.width=O.width,A.height=O.height,!A.width&&!A.height&&(A.width=O.right-O.left||x.width||0,A.height=O.bottom-O.top||x.height||0)}return this.clientRect=A,A},k.isLevelAllowed=function(x,A){return A===void 0&&(A=[]),A.indexOf(x)===-1},k.getMaxLevelByMediaSize=function(x,A,O){if(!x||!x.length)return-1;for(var S=function(u,h){return h?u.width!==h.width||u.height!==h.height:!0},_=x.length-1,b=0;b<x.length;b+=1){var d=x[b];if((d.width>=A||d.height>=O)&&S(d,x[b+1])){_=b;break}}return _},P(k,[{key:"mediaWidth",get:function(){return this.getDimensions().width*k.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*k.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var x=1;try{x=self.devicePixelRatio}catch(A){}return x}}]),k}();V.default=j},"./src/controller/cmcd-controller.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return S});var K=L("./src/events.ts"),M=L("./src/types/cmcd.ts"),P=L("./src/utils/buffer-helper.ts"),j=L("./src/utils/logger.ts");function k(_,b){for(var d=0;d<b.length;d++){var s=b[d];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(_,s.key,s)}}function C(_,b,d){return b&&k(_.prototype,b),d&&k(_,d),_}function R(_,b){var d=typeof Symbol!="undefined"&&_[Symbol.iterator]||_["@@iterator"];if(d)return(d=d.call(_)).next.bind(d);if(Array.isArray(_)||(d=x(_))||b&&_&&typeof _.length=="number"){d&&(_=d);var s=0;return function(){return s>=_.length?{done:!0}:{done:!1,value:_[s++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function x(_,b){if(!_)return;if(typeof _=="string")return A(_,b);var d=Object.prototype.toString.call(_).slice(8,-1);if(d==="Object"&&_.constructor&&(d=_.constructor.name),d==="Map"||d==="Set")return Array.from(_);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return A(_,b)}function A(_,b){(b==null||b>_.length)&&(b=_.length);for(var d=0,s=new Array(b);d<b;d++)s[d]=_[d];return s}function O(){return O=Object.assign||function(_){for(var b=1;b<arguments.length;b++){var d=arguments[b];for(var s in d)Object.prototype.hasOwnProperty.call(d,s)&&(_[s]=d[s])}return _},O.apply(this,arguments)}var S=function(){function _(d){var s=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){s.initialized&&(s.starved=!0),s.buffering=!0},this.onPlaying=function(){s.initialized||(s.initialized=!0),s.buffering=!1},this.applyPlaylistData=function(E){try{s.apply(E,{ot:M.CMCDObjectType.MANIFEST,su:!s.initialized})}catch(m){j.logger.warn("Could not generate manifest CMCD data.",m)}},this.applyFragmentData=function(E){try{var m=E.frag,g=s.hls.levels[m.level],w=s.getObjectType(m),y={d:m.duration*1e3,ot:w};(w===M.CMCDObjectType.VIDEO||w===M.CMCDObjectType.AUDIO||w==M.CMCDObjectType.MUXED)&&(y.br=g.bitrate/1e3,y.tb=s.getTopBandwidth(w),y.bl=s.getBufferLength(w)),s.apply(E,y)}catch(p){j.logger.warn("Could not generate segment CMCD data.",p)}},this.hls=d;var u=this.config=d.config,h=u.cmcd;h!=null&&(u.pLoader=this.createPlaylistLoader(),u.fLoader=this.createFragmentLoader(),this.sid=h.sessionId||_.uuid(),this.cid=h.contentId,this.useHeaders=h.useHeaders===!0,this.registerListeners())}var b=_.prototype;return b.registerListeners=function(){var s=this.hls;s.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),s.on(K.Events.BUFFER_CREATED,this.onBufferCreated,this)},b.unregisterListeners=function(){var s=this.hls;s.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),s.off(K.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},b.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},b.onMediaAttached=function(s,u){this.media=u.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},b.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},b.onBufferCreated=function(s,u){var h,E;this.audioBuffer=(h=u.tracks.audio)===null||h===void 0?void 0:h.buffer,this.videoBuffer=(E=u.tracks.video)===null||E===void 0?void 0:E.buffer},b.createData=function(){var s;return{v:M.CMCDVersion,sf:M.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(s=this.media)===null||s===void 0?void 0:s.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},b.apply=function(s,u){u===void 0&&(u={}),O(u,this.createData());var h=u.ot===M.CMCDObjectType.INIT||u.ot===M.CMCDObjectType.VIDEO||u.ot===M.CMCDObjectType.MUXED;if(this.starved&&h&&(u.bs=!0,u.su=!0,this.starved=!1),u.su==null&&(u.su=this.buffering),this.useHeaders){var E=_.toHeaders(u);if(!Object.keys(E).length)return;s.headers||(s.headers={}),O(s.headers,E)}else{var m=_.toQuery(u);if(!m)return;s.url=_.appendQueryToUri(s.url,m)}},b.getObjectType=function(s){var u=s.type;return u==="subtitle"?M.CMCDObjectType.TIMED_TEXT:s.sn==="initSegment"?M.CMCDObjectType.INIT:u==="audio"?M.CMCDObjectType.AUDIO:u==="main"?this.hls.audioTracks.length?M.CMCDObjectType.VIDEO:M.CMCDObjectType.MUXED:void 0},b.getTopBandwidth=function(s){for(var u=0,h=s===M.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,E=R(h),m;!(m=E()).done;){var g=m.value;g.bitrate>u&&(u=g.bitrate)}return u>0?u:NaN},b.getBufferLength=function(s){var u=this.hls.media,h=s===M.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!h||!u)return NaN;var E=P.BufferHelper.bufferInfo(h,u.currentTime,this.config.maxBufferHole);return E.len*1e3},b.createPlaylistLoader=function(){var s=this.config.pLoader,u=this.applyPlaylistData,h=s||this.config.loader;return function(){function E(g){this.loader=void 0,this.loader=new h(g)}var m=E.prototype;return m.destroy=function(){this.loader.destroy()},m.abort=function(){this.loader.abort()},m.load=function(w,y,p){u(w),this.loader.load(w,y,p)},C(E,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),E}()},b.createFragmentLoader=function(){var s=this.config.fLoader,u=this.applyFragmentData,h=s||this.config.loader;return function(){function E(g){this.loader=void 0,this.loader=new h(g)}var m=E.prototype;return m.destroy=function(){this.loader.destroy()},m.abort=function(){this.loader.abort()},m.load=function(w,y,p){u(w),this.loader.load(w,y,p)},C(E,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),E}()},_.uuid=function(){var s=URL.createObjectURL(new Blob),u=s.toString();return URL.revokeObjectURL(s),u.substr(u.lastIndexOf("/")+1)},_.serialize=function(s){for(var u=[],h=function(N){return!Number.isNaN(N)&&N!=null&&N!==""&&N!==!1},E=function(N){return Math.round(N)},m=function(N){return E(N/100)*100},g=function(N){return encodeURIComponent(N)},w={br:E,d:E,bl:m,dl:m,mtp:m,nor:g,rtp:m,tb:E},y=Object.keys(s||{}).sort(),p=R(y),c;!(c=p()).done;){var l=c.value,a=s[l];if(!h(a))continue;if(l==="v"&&a===1)continue;if(l=="pr"&&a===1)continue;var f=w[l];f&&(a=f(a));var o=typeof a,v=void 0;l==="ot"||l==="sf"||l==="st"?v=l+"="+a:o==="boolean"?v=l:o==="number"?v=l+"="+a:v=l+"="+JSON.stringify(a),u.push(v)}return u.join(",")},_.toHeaders=function(s){for(var u=Object.keys(s),h={},E=["Object","Request","Session","Status"],m=[{},{},{},{}],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},w=0,y=u;w<y.length;w++){var p=y[w],c=g[p]!=null?g[p]:1;m[c][p]=s[p]}for(var l=0;l<m.length;l++){var a=_.serialize(m[l]);a&&(h["CMCD-"+E[l]]=a)}return h},_.toQuery=function(s){return"CMCD="+encodeURIComponent(_.serialize(s))},_.appendQueryToUri=function(s,u){if(!u)return s;var h=s.includes("?")?"&":"?";return""+s+h+u},_}()},"./src/controller/eme-controller.ts":function(re,V,L){"use strict";L.r(V);var K=L("./src/events.ts"),M=L("./src/errors.ts"),P=L("./src/utils/logger.ts"),j=L("./src/utils/mediakeys-helper.ts");function k(S,_){for(var b=0;b<_.length;b++){var d=_[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(S,d.key,d)}}function C(S,_,b){return _&&k(S.prototype,_),b&&k(S,b),S}var R=3,x=function(_,b,d){var s={audioCapabilities:[],videoCapabilities:[]};return _.forEach(function(u){s.audioCapabilities.push({contentType:'audio/mp4; codecs="'+u+'"',robustness:d.audioRobustness||""})}),b.forEach(function(u){s.videoCapabilities.push({contentType:'video/mp4; codecs="'+u+'"',robustness:d.videoRobustness||""})}),[s]},A=function(_,b,d,s){switch(_){case j.KeySystems.WIDEVINE:return x(b,d,s);default:throw new Error("Unknown key-system: "+_)}},O=function(){function S(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 _=S.prototype;return _.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},_._registerListeners=function(){this.hls.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this)},_._unregisterListeners=function(){this.hls.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this)},_.getLicenseServerUrl=function(d){switch(d){case j.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},_._attemptKeySystemAccess=function(d,s,u){var h=this,E=A(d,s,u,this._drmSystemOptions);P.logger.log("Requesting encrypted media key-system access");var m=this.requestMediaKeySystemAccess(d,E);this.mediaKeysPromise=m.then(function(g){return h._onMediaKeySystemAccessObtained(d,g)}),m.catch(function(g){P.logger.error('Failed to obtain key-system "'+d+'" access:',g)})},_._onMediaKeySystemAccessObtained=function(d,s){var u=this;P.logger.log('Access for key-system "'+d+'" obtained');var h={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:s,mediaKeySystemDomain:d};this._mediaKeysList.push(h);var E=Promise.resolve().then(function(){return s.createMediaKeys()}).then(function(m){return h.mediaKeys=m,P.logger.log('Media-keys created for key-system "'+d+'"'),u._onMediaKeysCreated(),m});return E.catch(function(m){P.logger.error("Failed to create media-keys:",m)}),E},_._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(s){s.mediaKeysSession||(s.mediaKeysSession=s.mediaKeys.createSession(),d._onNewMediaKeySession(s.mediaKeysSession))})},_._onNewMediaKeySession=function(d){var s=this;P.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(u){s._onKeySessionMessage(d,u.message)},!1)},_._onKeySessionMessage=function(d,s){P.logger.log("Got EME message event, creating license request"),this._requestLicense(s,function(u){P.logger.log("Received license data (length: "+(u&&u.byteLength)+"), updating key-session"),d.update(u)})},_.onMediaEncrypted=function(d){var s=this;if(P.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var u=function(E){if(!s._media)return;s._attemptSetMediaKeys(E),s._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(u).catch(u)},_._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var s=this._mediaKeysList[0];if(!s||!s.mediaKeys){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}P.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(s.mediaKeys),this._hasSetMediaKeys=!0}},_._generateRequestWithPreferredKeySession=function(d,s){var u=this,h=this._mediaKeysList[0];if(!h){P.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(h.mediaKeysSessionInitialized){P.logger.warn("Key-Session already initialized but requested again");return}var E=h.mediaKeysSession;if(!E){P.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!s){P.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}P.logger.log('Generating key-session request for "'+d+'" init data type'),h.mediaKeysSessionInitialized=!0,E.generateRequest(d,s).then(function(){P.logger.debug("Key-session generation succeeded")}).catch(function(m){P.logger.error("Error generating key-session request:",m),u.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},_._createLicenseXhr=function(d,s,u){var h=new XMLHttpRequest;h.responseType="arraybuffer",h.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,h,d,s,u);var E=this._licenseXhrSetup;if(E)try{E.call(this.hls,h,d),E=void 0}catch(m){P.logger.error(m)}try{h.readyState||h.open("POST",d,!0),E&&E.call(this.hls,h,d)}catch(m){throw new Error("issue setting up KeySystem license XHR "+m)}return h},_._onLicenseRequestReadyStageChange=function(d,s,u,h){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,P.logger.log("License request succeeded");var E=d.response,m=this._licenseResponseCallback;if(m)try{E=m.call(this.hls,d,s)}catch(w){P.logger.error(w)}h(E)}else{if(P.logger.error("License Request XHR failed ("+s+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>R){this.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var g=R-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+g+" attempts left"),this._requestLicense(u,h)}break}},_._generateLicenseRequestChallenge=function(d,s){switch(d.mediaKeySystemDomain){case j.KeySystems.WIDEVINE:return s}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},_._requestLicense=function(d,s){P.logger.log("Requesting content license for key-system");var u=this._mediaKeysList[0];if(!u){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var h=this.getLicenseServerUrl(u.mediaKeySystemDomain),E=this._createLicenseXhr(h,d,s);P.logger.log("Sending license request to URL: "+h);var m=this._generateLicenseRequestChallenge(u,d);E.send(m)}catch(g){P.logger.error("Failure requesting DRM license: "+g),this.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},_.onMediaAttached=function(d,s){if(!this._emeEnabled)return;var u=s.media;this._media=u,u.addEventListener("encrypted",this._onMediaEncrypted)},_.onMediaDetached=function(){var d=this._media,s=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(s.map(function(u){if(u.mediaKeysSession)return u.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},_.onManifestParsed=function(d,s){if(!this._emeEnabled)return;var u=s.levels.map(function(E){return E.audioCodec}).filter(function(E){return!!E}),h=s.levels.map(function(E){return E.videoCodec}).filter(function(E){return!!E});this._attemptKeySystemAccess(j.KeySystems.WIDEVINE,u,h)},C(S,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),S}();V.default=O},"./src/controller/fps-controller.ts":function(re,V,L){"use strict";L.r(V);var K=L("./src/events.ts"),M=L("./src/utils/logger.ts"),P=function(){function j(C){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=C,this.registerListeners()}var k=j.prototype;return k.setStreamController=function(R){this.streamController=R},k.registerListeners=function(){this.hls.on(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},k.unregisterListeners=function(){this.hls.off(K.Events.MEDIA_ATTACHING,this.onMediaAttaching)},k.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},k.onMediaAttaching=function(R,x){var A=this.hls.config;if(A.capLevelOnFPSDrop){var O=x.media instanceof self.HTMLVideoElement?x.media:null;this.media=O,O&&typeof O.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),A.fpsDroppedMonitoringPeriod)}},k.checkFPS=function(R,x,A){var O=performance.now();if(x){if(this.lastTime){var S=O-this.lastTime,_=A-this.lastDroppedFrames,b=x-this.lastDecodedFrames,d=1e3*_/S,s=this.hls;if(s.trigger(K.Events.FPS_DROP,{currentDropped:_,currentDecoded:b,totalDroppedFrames:A}),d>0&&_>s.config.fpsDroppedMonitoringThreshold*b){var u=s.currentLevel;M.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(s.autoLevelCapping===-1||s.autoLevelCapping>=u)&&(u=u-1,s.trigger(K.Events.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:s.currentLevel}),s.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=O,this.lastDroppedFrames=A,this.lastDecodedFrames=x}},k.checkFPSInterval=function(){var R=this.media;if(R)if(this.isVideoPlaybackQualityAvailable){var x=R.getVideoPlaybackQuality();this.checkFPS(R,x.totalVideoFrames,x.droppedVideoFrames)}else this.checkFPS(R,R.webkitDecodedFrameCount,R.webkitDroppedFrameCount)},j}();V.default=P},"./src/controller/fragment-finders.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"findFragmentByPDT",function(){return P}),L.d(V,"findFragmentByPTS",function(){return j}),L.d(V,"fragmentWithinToleranceTest",function(){return k}),L.d(V,"pdtWithinToleranceTest",function(){return C}),L.d(V,"findFragWithCC",function(){return R});var K=L("./src/polyfills/number.ts"),M=L("./src/utils/binary-search.ts");function P(x,A,O){if(A===null||!Array.isArray(x)||!x.length||!Object(K.isFiniteNumber)(A))return null;var S=x[0].programDateTime;if(A<(S||0))return null;var _=x[x.length-1].endProgramDateTime;if(A>=(_||0))return null;O=O||0;for(var b=0;b<x.length;++b){var d=x[b];if(C(A,O,d))return d}return null}function j(x,A,O,S){O===void 0&&(O=0),S===void 0&&(S=0);var _=null;if(x?_=A[x.sn-A[0].sn+1]||null:O===0&&A[0].start===0&&(_=A[0]),_&&k(O,S,_)===0)return _;var b=M.default.search(A,k.bind(null,O,S));return b||_}function k(x,A,O){x===void 0&&(x=0),A===void 0&&(A=0);var S=Math.min(A,O.duration+(O.deltaPTS?O.deltaPTS:0));return O.start+O.duration-S<=x?1:O.start-S>x&&O.start?-1:0}function C(x,A,O){var S=Math.min(A,O.duration+(O.deltaPTS?O.deltaPTS:0))*1e3,_=O.endProgramDateTime||0;return _-S>x}function R(x,A){return M.default.search(x,function(O){return O.cc<A?1:O.cc>A?-1:0})}},"./src/controller/fragment-tracker.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"FragmentState",function(){return P}),L.d(V,"FragmentTracker",function(){return j});var K=L("./src/events.ts"),M=L("./src/types/loader.ts"),P;(function(R){R.NOT_LOADED="NOT_LOADED",R.BACKTRACKED="BACKTRACKED",R.APPENDING="APPENDING",R.PARTIAL="PARTIAL",R.OK="OK"})(P||(P={}));var j=function(){function R(A){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=A,this._registerListeners()}var x=R.prototype;return x._registerListeners=function(){var O=this.hls;O.on(K.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.on(K.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.on(K.Events.FRAG_LOADED,this.onFragLoaded,this)},x._unregisterListeners=function(){var O=this.hls;O.off(K.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.off(K.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.off(K.Events.FRAG_LOADED,this.onFragLoaded,this)},x.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},x.getAppendedFrag=function(O,S){if(S===M.PlaylistLevelType.MAIN){var _=this.activeFragment,b=this.activeParts;if(!_)return null;if(b)for(var d=b.length;d--;){var s=b[d],u=s?s.end:_.appendedPTS;if(s.start<=O&&u!==void 0&&O<=u)return d>9&&(this.activeParts=b.slice(d-9)),s}else if(_.start<=O&&_.appendedPTS!==void 0&&O<=_.appendedPTS)return _}return this.getBufferedFrag(O,S)},x.getBufferedFrag=function(O,S){for(var _=this.fragments,b=Object.keys(_),d=b.length;d--;){var s=_[b[d]];if((s==null?void 0:s.body.type)===S&&s.buffered){var u=s.body;if(u.start<=O&&O<=u.end)return u}}return null},x.detectEvictedFragments=function(O,S,_){var b=this;Object.keys(this.fragments).forEach(function(d){var s=b.fragments[d];if(!s)return;if(!s.buffered){s.body.type===_&&b.removeFragment(s.body);return}var u=s.range[O];if(!u)return;u.time.some(function(h){var E=!b.isTimeBuffered(h.startPTS,h.endPTS,S);return E&&b.removeFragment(s.body),E})})},x.detectPartialFragments=function(O){var S=this,_=this.timeRanges,b=O.frag,d=O.part;if(!_||b.sn==="initSegment")return;var s=C(b),u=this.fragments[s];if(!u)return;Object.keys(_).forEach(function(h){var E=b.elementaryStreams[h];if(!E)return;var m=_[h],g=d!==null||E.partial===!0;u.range[h]=S.getBufferedTimes(b,d,g,m)}),u.backtrack=u.loaded=null,Object.keys(u.range).length?u.buffered=!0:this.removeFragment(u.body)},x.fragBuffered=function(O){var S=C(O),_=this.fragments[S];_&&(_.backtrack=_.loaded=null,_.buffered=!0)},x.getBufferedTimes=function(O,S,_,b){for(var d={time:[],partial:_},s=S?S.start:O.start,u=S?S.end:O.end,h=O.minEndPTS||u,E=O.maxStartPTS||s,m=0;m<b.length;m++){var g=b.start(m)-this.bufferPadding,w=b.end(m)+this.bufferPadding;if(E>=g&&h<=w){d.time.push({startPTS:Math.max(s,b.start(m)),endPTS:Math.min(u,b.end(m))});break}else if(s<w&&u>g)d.partial=!0,d.time.push({startPTS:Math.max(s,b.start(m)),endPTS:Math.min(u,b.end(m))});else if(u<=g)break}return d},x.getPartialFragment=function(O){var S=null,_,b,d,s=0,u=this.bufferPadding,h=this.fragments;return Object.keys(h).forEach(function(E){var m=h[E];if(!m)return;k(m)&&(b=m.body.start-u,d=m.body.end+u,O>=b&&O<=d&&(_=Math.min(O-b,d-O),s<=_&&(S=m.body,s=_)))}),S},x.getState=function(O){var S=C(O),_=this.fragments[S];return _?_.buffered?k(_)?P.PARTIAL:P.OK:_.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},x.backtrack=function(O,S){var _=C(O),b=this.fragments[_];if(!b||b.backtrack)return null;var d=b.backtrack=S||b.loaded;return b.loaded=null,d},x.getBacktrackData=function(O){var S=C(O),_=this.fragments[S];if(_){var b,d=_.backtrack;if(d!=null&&(b=d.payload)!==null&&b!==void 0&&b.byteLength)return d;this.removeFragment(O)}return null},x.isTimeBuffered=function(O,S,_){for(var b,d,s=0;s<_.length;s++){if(b=_.start(s)-this.bufferPadding,d=_.end(s)+this.bufferPadding,O>=b&&S<=d)return!0;if(S<=b)return!1}return!1},x.onFragLoaded=function(O,S){var _=S.frag,b=S.part;if(_.sn==="initSegment"||_.bitrateTest||b)return;var d=C(_);this.fragments[d]={body:_,loaded:S,backtrack:null,buffered:!1,range:Object.create(null)}},x.onBufferAppended=function(O,S){var _=this,b=S.frag,d=S.part,s=S.timeRanges;if(b.type===M.PlaylistLevelType.MAIN)if(this.activeFragment=b,d){var u=this.activeParts;u||(this.activeParts=u=[]),u.push(d)}else this.activeParts=null;this.timeRanges=s,Object.keys(s).forEach(function(h){var E=s[h];if(_.detectEvictedFragments(h,E),!d)for(var m=0;m<E.length;m++)b.appendedPTS=Math.max(E.end(m),b.appendedPTS||0)})},x.onFragBuffered=function(O,S){this.detectPartialFragments(S)},x.hasFragment=function(O){var S=C(O);return!!this.fragments[S]},x.removeFragmentsInRange=function(O,S,_){var b=this;Object.keys(this.fragments).forEach(function(d){var s=b.fragments[d];if(!s)return;if(s.buffered){var u=s.body;u.type===_&&u.start<S&&u.end>O&&b.removeFragment(u)}})},x.removeFragment=function(O){var S=C(O);O.stats.loaded=0,O.clearElementaryStreamInfo(),delete this.fragments[S]},x.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},R}();function k(R){var x,A;return R.buffered&&(((x=R.range.video)===null||x===void 0?void 0:x.partial)||((A=R.range.audio)===null||A===void 0?void 0:A.partial))}function C(R){return R.type+"_"+R.level+"_"+R.urlId+"_"+R.sn}},"./src/controller/gap-controller.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"STALL_MINIMUM_DURATION_MS",function(){return k}),L.d(V,"MAX_START_GAP_JUMP",function(){return C}),L.d(V,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return R}),L.d(V,"SKIP_BUFFER_RANGE_START",function(){return x}),L.d(V,"default",function(){return A});var K=L("./src/utils/buffer-helper.ts"),M=L("./src/errors.ts"),P=L("./src/events.ts"),j=L("./src/utils/logger.ts"),k=250,C=2,R=.1,x=.05,A=function(){function O(_,b,d,s){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=_,this.media=b,this.fragmentTracker=d,this.hls=s}var S=O.prototype;return S.destroy=function(){this.hls=this.fragmentTracker=this.media=null},S.poll=function(b){var d=this.config,s=this.media,u=this.stalled,h=s.currentTime,E=s.seeking,m=this.seeking&&!E,g=!this.seeking&&E;if(this.seeking=E,h!==b){if(this.moved=!0,u!==null){if(this.stallReported){var w=self.performance.now()-u;j.logger.warn("playback not stuck anymore @"+h+", after "+Math.round(w)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((g||m)&&(this.stalled=null),s.paused||s.ended||s.playbackRate===0||!K.BufferHelper.getBuffered(s).length)return;var y=K.BufferHelper.bufferInfo(s,h,0),p=y.len>0,c=y.nextStart||0;if(!p&&!c)return;if(E){var l=y.len>C,a=!c||c-h>C&&!this.fragmentTracker.getPartialFragment(h);if(l||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var f,o=Math.max(c,y.start||0)-h,v=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,D=v==null||((f=v.details)===null||f===void 0)?void 0:f.live,N=D?v.details.targetduration*2:C;if(o>0&&o<=N){this._trySkipBufferHole(null);return}}var W=self.performance.now();if(u===null){this.stalled=W;return}var z=W-u;!E&&z>=k&&this._reportStall(y.len);var F=K.BufferHelper.bufferInfo(s,h,d.maxBufferHole);this._tryFixBufferStall(F,z)},S._tryFixBufferStall=function(b,d){var s=this.config,u=this.fragmentTracker,h=this.media,E=h.currentTime,m=u.getPartialFragment(E);if(m){var g=this._trySkipBufferHole(m);if(g)return}b.len>s.maxBufferHole&&d>s.highBufferWatchdogPeriod*1e3&&(j.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},S._reportStall=function(b){var d=this.hls,s=this.media,u=this.stallReported;u||(this.stallReported=!0,j.logger.warn("Playback stalling at @"+s.currentTime+" due to low buffer (buffer="+b+")"),d.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:b}))},S._trySkipBufferHole=function(b){for(var d=this.config,s=this.hls,u=this.media,h=u.currentTime,E=0,m=K.BufferHelper.getBuffered(u),g=0;g<m.length;g++){var w=m.start(g);if(h+d.maxBufferHole>=E&&h<w){var y=Math.max(w+x,u.currentTime+R);return j.logger.warn("skipping hole, adjusting currentTime from "+h+" to "+y),this.moved=!0,this.stalled=null,u.currentTime=y,b&&s.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+h+" to "+y,frag:b}),y}E=m.end(g)}return 0},S._tryNudgeBuffer=function(){var b=this.config,d=this.hls,s=this.media,u=s.currentTime,h=(this.nudgeRetry||0)+1;if(this.nudgeRetry=h,h<b.nudgeMaxRetry){var E=u+h*b.nudgeOffset;j.logger.warn("Nudging 'currentTime' from "+u+" to "+E),s.currentTime=E,d.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else j.logger.error("Playhead still not moving while enough data buffered @"+u+" after "+b.nudgeMaxRetry+" nudges"),d.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},O}()},"./src/controller/id3-track-controller.ts":function(re,V,L){"use strict";L.r(V);var K=L("./src/events.ts"),M=L("./src/utils/texttrack-utils.ts"),P=L("./src/demux/id3.ts"),j=.25,k=function(){function C(x){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=x,this._registerListeners()}var R=C.prototype;return R.destroy=function(){this._unregisterListeners()},R._registerListeners=function(){var A=this.hls;A.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(K.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.on(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R._unregisterListeners=function(){var A=this.hls;A.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(K.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.off(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R.onMediaAttached=function(A,O){this.media=O.media},R.onMediaDetaching=function(){if(!this.id3Track)return;Object(M.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},R.getID3Track=function(A){if(!this.media)return;for(var O=0;O<A.length;O++){var S=A[O];if(S.kind==="metadata"&&S.label==="id3")return Object(M.sendAddTrackEvent)(S,this.media),S}return this.media.addTextTrack("metadata","id3")},R.onFragParsingMetadata=function(A,O){if(!this.media)return;var S=O.frag,_=O.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var b=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<_.length;d++){var s=P.getID3Frames(_[d].data);if(s){var u=_[d].pts,h=d<_.length-1?_[d+1].pts:S.end,E=h-u;E<=0&&(h=u+j);for(var m=0;m<s.length;m++){var g=s[m];if(!P.isTimeStampFrame(g)){var w=new b(u,h,"");w.value=g,this.id3Track.addCue(w)}}}}},R.onBufferFlushing=function(A,O){var S=O.startOffset,_=O.endOffset,b=O.type;if(!b||b==="audio"){var d=this.id3Track;d&&Object(M.removeCuesInRange)(d,S,_)}},C}();V.default=k},"./src/controller/latency-controller.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return C});var K=L("./src/errors.ts"),M=L("./src/events.ts"),P=L("./src/utils/logger.ts");function j(R,x){for(var A=0;A<x.length;A++){var O=x[A];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(R,O.key,O)}}function k(R,x,A){return x&&j(R.prototype,x),A&&j(R,A),R}var C=function(){function R(A){var O=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return O.timeupdate()},this.hls=A,this.config=A.config,this.registerListeners()}var x=R.prototype;return x.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},x.registerListeners=function(){this.hls.on(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(M.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){this.hls.off(M.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(M.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(M.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(M.Events.ERROR,this.onError)},x.onMediaAttached=function(O,S){this.media=S.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},x.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},x.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},x.onLevelUpdated=function(O,S){var _=S.details;this.levelDetails=_,_.advanced&&this.timeupdate(),!_.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},x.onError=function(O,S){if(S.details!==K.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,P.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},x.timeupdate=function(){var O=this.media,S=this.levelDetails;if(!O||!S)return;this.currentTime=O.currentTime;var _=this.computeLatency();if(_===null)return;this._latency=_;var b=this.config,d=b.lowLatencyMode,s=b.maxLiveSyncPlaybackRate;if(!d||s===1)return;var u=this.targetLatency;if(u===null)return;var h=_-u,E=Math.min(this.maxLatency,u+S.targetduration),m=h<E;if(S.live&&m&&h>.05&&this.forwardBufferLength>1){var g=Math.min(2,Math.max(1,s)),w=Math.round(2/(1+Math.exp(-.75*h-this.edgeStalled))*20)/20;O.playbackRate=Math.min(g,Math.max(1,w))}else O.playbackRate!==1&&O.playbackRate!==0&&(O.playbackRate=1)},x.estimateLiveEdge=function(){var O=this.levelDetails;return O===null?null:O.edge+O.age},x.computeLatency=function(){var O=this.estimateLiveEdge();return O===null?null:O-this.currentTime},k(R,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var O=this.config,S=this.levelDetails;return O.liveMaxLatencyDuration!==void 0?O.liveMaxLatencyDuration:S?O.liveMaxLatencyDurationCount*S.targetduration:0}},{key:"targetLatency",get:function(){var O=this.levelDetails;if(O===null)return null;var S=O.holdBack,_=O.partHoldBack,b=O.targetduration,d=this.config,s=d.liveSyncDuration,u=d.liveSyncDurationCount,h=d.lowLatencyMode,E=this.hls.userConfig,m=h&&_||S;(E.liveSyncDuration||E.liveSyncDurationCount||m===0)&&(m=s!==void 0?s:u*b);var g=b,w=1;return m+Math.min(this.stallCount*w,g)}},{key:"liveSyncPosition",get:function(){var O=this.estimateLiveEdge(),S=this.targetLatency,_=this.levelDetails;if(O===null||S===null||_===null)return null;var b=_.edge,d=O-S-this.edgeStalled,s=b-_.totalduration,u=b-(this.config.lowLatencyMode&&_.partTarget||_.targetduration);return Math.min(Math.max(s,d),u)}},{key:"drift",get:function(){var O=this.levelDetails;return O===null?1:O.drift}},{key:"edgeStalled",get:function(){var O=this.levelDetails;if(O===null)return 0;var S=(this.config.lowLatencyMode&&O.partTarget||O.targetduration)*3;return Math.max(O.age-S,0)}},{key:"forwardBufferLength",get:function(){var O=this.media,S=this.levelDetails;if(!O||!S)return 0;var _=O.buffered.length;return _?O.buffered.end(_-1):S.edge-this.currentTime}}]),R}()},"./src/controller/level-controller.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return d});var K=L("./src/types/level.ts"),M=L("./src/events.ts"),P=L("./src/errors.ts"),j=L("./src/utils/codecs.ts"),k=L("./src/controller/level-helper.ts"),C=L("./src/controller/base-playlist-controller.ts"),R=L("./src/types/loader.ts");function x(){return x=Object.assign||function(s){for(var u=1;u<arguments.length;u++){var h=arguments[u];for(var E in h)Object.prototype.hasOwnProperty.call(h,E)&&(s[E]=h[E])}return s},x.apply(this,arguments)}function A(s,u){for(var h=0;h<u.length;h++){var E=u[h];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(s,E.key,E)}}function O(s,u,h){return u&&A(s.prototype,u),h&&A(s,h),s}function S(s,u){s.prototype=Object.create(u.prototype),s.prototype.constructor=s,_(s,u)}function _(s,u){return _=Object.setPrototypeOf||function(E,m){return E.__proto__=m,E},_(s,u)}var b=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(s){S(u,s);function u(E){var m;return m=s.call(this,E,"[level-controller]")||this,m._levels=[],m._firstLevel=-1,m._startLevel=void 0,m.currentLevelIndex=-1,m.manualLevelIndex=-1,m.onParsedComplete=void 0,m._registerListeners(),m}var h=u.prototype;return h._registerListeners=function(){var m=this.hls;m.on(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),m.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.on(M.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),m.on(M.Events.ERROR,this.onError,this)},h._unregisterListeners=function(){var m=this.hls;m.off(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),m.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.off(M.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),m.off(M.Events.ERROR,this.onError,this)},h.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,s.prototype.destroy.call(this)},h.startLoad=function(){var m=this._levels;m.forEach(function(g){g.loadError=0}),s.prototype.startLoad.call(this)},h.onManifestLoaded=function(m,g){var w=[],y=[],p=[],c,l={},a,f=!1,o=!1,v=!1;if(g.levels.forEach(function(z){var F=z.attrs;f=f||!!(z.width&&z.height),o=o||!!z.videoCodec,v=v||!!z.audioCodec,b&&z.audioCodec&&z.audioCodec.indexOf("mp4a.40.34")!==-1&&(z.audioCodec=void 0);var I=z.bitrate+"-"+z.attrs.RESOLUTION+"-"+z.attrs.CODECS;a=l[I],a?a.url.push(z.url):(a=new K.Level(z),l[I]=a,w.push(a)),F&&(F.AUDIO&&Object(k.addGroupId)(a,"audio",F.AUDIO),F.SUBTITLES&&Object(k.addGroupId)(a,"text",F.SUBTITLES))}),(f||o)&&v&&(w=w.filter(function(z){var F=z.videoCodec,I=z.width,B=z.height;return!!F||!!(I&&B)})),w=w.filter(function(z){var F=z.audioCodec,I=z.videoCodec;return(!F||Object(j.isCodecSupportedInMp4)(F,"audio"))&&(!I||Object(j.isCodecSupportedInMp4)(I,"video"))}),g.audioTracks&&(y=g.audioTracks.filter(function(z){return!z.audioCodec||Object(j.isCodecSupportedInMp4)(z.audioCodec,"audio")}),Object(k.assignTrackIdsByGroup)(y)),g.subtitles&&(p=g.subtitles,Object(k.assignTrackIdsByGroup)(p)),w.length>0){c=w[0].bitrate,w.sort(function(z,F){return z.bitrate-F.bitrate}),this._levels=w;for(var D=0;D<w.length;D++)if(w[D].bitrate===c){this._firstLevel=D,this.log("manifest loaded, "+w.length+" level(s) found, first bitrate: "+c);break}var N=v&&!o,W={levels:w,audioTracks:y,subtitleTracks:p,firstLevel:this._firstLevel,stats:g.stats,audio:v,video:o,altAudio:!N&&y.some(function(z){return!!z.url})};this.hls.trigger(M.Events.MANIFEST_PARSED,W),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(M.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:g.url,reason:"no level with compatible codecs found in manifest"})},h.onError=function(m,g){if(s.prototype.onError.call(this,m,g),g.fatal)return;var w=g.context,y=this._levels[this.currentLevelIndex];if(w&&(w.type===R.PlaylistContextType.AUDIO_TRACK&&y.audioGroupIds&&w.groupId===y.audioGroupIds[y.urlId]||w.type===R.PlaylistContextType.SUBTITLE_TRACK&&y.textGroupIds&&w.groupId===y.textGroupIds[y.urlId])){this.redundantFailover(this.currentLevelIndex);return}var p=!1,c=!0,l;switch(g.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:if(g.frag){var a=this._levels[g.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(l=g.frag.level)):l=g.frag.level}break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:w&&(w.deliveryDirectives&&(c=!1),l=w.level),p=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:l=g.level,p=!0;break}l!==void 0&&this.recoverLevel(g,l,p,c)},h.recoverLevel=function(m,g,w,y){var p=m.details,c=this._levels[g];if(c.loadError++,w){var l=this.retryLoadingOrFail(m);if(l)m.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(y){var a=c.url.length;if(a>1&&c.loadError<a)m.levelRetry=!0,this.redundantFailover(g);else if(this.manualLevelIndex===-1){var f=g===0?this._levels.length-1:g-1;this.currentLevelIndex!==f&&this._levels[f].loadError===0&&(this.warn(p+": switch to "+f),m.levelRetry=!0,this.hls.nextAutoLevel=f)}}},h.redundantFailover=function(m){var g=this._levels[m],w=g.url.length;if(w>1){var y=(g.urlId+1)%w;this.warn("Switching to redundant URL-id "+y),this._levels.forEach(function(p){p.urlId=y}),this.level=m}},h.onFragLoaded=function(m,g){var w=g.frag;if(w!==void 0&&w.type===R.PlaylistLevelType.MAIN){var y=this._levels[w.level];y!==void 0&&(y.fragmentError=0,y.loadError=0)}},h.onLevelLoaded=function(m,g){var w,y=g.level,p=g.details,c=this._levels[y];if(!c){var l;this.warn("Invalid level index "+y),(l=g.deliveryDirectives)!==null&&l!==void 0&&l.skip&&(p.deltaUpdateFailed=!0);return}y===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(y,g,c.details)):(w=g.deliveryDirectives)!==null&&w!==void 0&&w.skip&&(p.deltaUpdateFailed=!0)},h.onAudioTrackSwitched=function(m,g){var w=this.hls.levels[this.currentLevelIndex];if(!w)return;if(w.audioGroupIds){for(var y=-1,p=this.hls.audioTracks[g.id].groupId,c=0;c<w.audioGroupIds.length;c++)if(w.audioGroupIds[c]===p){y=c;break}y!==w.urlId&&(w.urlId=y,this.startLoad())}},h.loadPlaylist=function(m){var g=this.currentLevelIndex,w=this._levels[g];if(this.canLoad&&w&&w.url.length>0){var y=w.urlId,p=w.url[y];if(m)try{p=m.addDirectives(p)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+g+(m?" at sn "+m.msn+" part "+m.part:"")+" with URL-id "+y+" "+p),this.clearTimer(),this.hls.trigger(M.Events.LEVEL_LOADING,{url:p,level:g,id:y,deliveryDirectives:m||null})}},h.removeLevel=function(m,g){var w=function(c,l){return l!==g},y=this._levels.filter(function(p,c){return c!==m?!0:p.url.length>1&&g!==void 0?(p.url=p.url.filter(w),p.audioGroupIds&&(p.audioGroupIds=p.audioGroupIds.filter(w)),p.textGroupIds&&(p.textGroupIds=p.textGroupIds.filter(w)),p.urlId=0,!0):!1}).map(function(p,c){var l=p.details;return l!=null&&l.fragments&&l.fragments.forEach(function(a){a.level=c}),p});this._levels=y,this.hls.trigger(M.Events.LEVELS_UPDATED,{levels:y})},O(u,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(m){var g,w=this._levels;if(w.length===0)return;if(this.currentLevelIndex===m&&(g=w[m])!==null&&g!==void 0&&g.details)return;if(m<0||m>=w.length){var y=m<0;if(this.hls.trigger(M.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:m,fatal:y,reason:"invalid level idx"}),y)return;m=Math.min(m,w.length-1)}this.clearTimer();var p=this.currentLevelIndex,c=w[p],l=w[m];this.log("switching to level "+m+" from "+p),this.currentLevelIndex=m;var a=x({},l,{level:m,maxBitrate:l.maxBitrate,uri:l.uri,urlId:l.urlId});delete a._urlId,this.hls.trigger(M.Events.LEVEL_SWITCHING,a);var f=l.details;if(!f||f.live){var o=this.switchParams(l.uri,c==null?void 0:c.details);this.loadPlaylist(o)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(m){this.manualLevelIndex=m,this._startLevel===void 0&&(this._startLevel=m),m!==-1&&(this.level=m)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(m){this._firstLevel=m}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var m=this.hls.config.startLevel;return m!==void 0?m:this._firstLevel}else return this._startLevel},set:function(m){this._startLevel=m}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(m){this.level=m,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=m)}}]),u}(C.default)},"./src/controller/level-helper.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"addGroupId",function(){return P}),L.d(V,"assignTrackIdsByGroup",function(){return j}),L.d(V,"updatePTS",function(){return k}),L.d(V,"updateFragPTSDTS",function(){return R}),L.d(V,"mergeDetails",function(){return x}),L.d(V,"mapPartIntersection",function(){return A}),L.d(V,"mapFragmentIntersection",function(){return O}),L.d(V,"adjustSliding",function(){return S}),L.d(V,"addSliding",function(){return _}),L.d(V,"computeReloadInterval",function(){return b}),L.d(V,"getFragmentWithSN",function(){return d}),L.d(V,"getPartWith",function(){return s});var K=L("./src/polyfills/number.ts"),M=L("./src/utils/logger.ts");function P(u,h,E){switch(h){case"audio":u.audioGroupIds||(u.audioGroupIds=[]),u.audioGroupIds.push(E);break;case"text":u.textGroupIds||(u.textGroupIds=[]),u.textGroupIds.push(E);break}}function j(u){var h={};u.forEach(function(E){var m=E.groupId||"";E.id=h[m]=h[m]||0,h[m]++})}function k(u,h,E){var m=u[h],g=u[E];C(m,g)}function C(u,h){var E=h.startPTS;if(Object(K.isFiniteNumber)(E)){var m=0,g;h.sn>u.sn?(m=E-u.start,g=u):(m=u.start-E,g=h),g.duration!==m&&(g.duration=m)}else if(h.sn>u.sn){var w=u.cc===h.cc;w&&u.minEndPTS?h.start=u.start+(u.minEndPTS-u.start):h.start=u.start+u.duration}else h.start=Math.max(u.start-h.duration,0)}function R(u,h,E,m,g,w){var y=m-E;y<=0&&(M.logger.warn("Fragment should have a positive duration",h),m=E+h.duration,w=g+h.duration);var p=E,c=m,l=h.startPTS,a=h.endPTS;if(Object(K.isFiniteNumber)(l)){var f=Math.abs(l-E);Object(K.isFiniteNumber)(h.deltaPTS)?h.deltaPTS=Math.max(f,h.deltaPTS):h.deltaPTS=f,p=Math.max(E,l),E=Math.min(E,l),g=Math.min(g,h.startDTS),c=Math.min(m,a),m=Math.max(m,a),w=Math.max(w,h.endDTS)}h.duration=m-E;var o=E-h.start;h.appendedPTS=m,h.start=h.startPTS=E,h.maxStartPTS=p,h.startDTS=g,h.endPTS=m,h.minEndPTS=c,h.endDTS=w;var v=h.sn;if(!u||v<u.startSN||v>u.endSN)return 0;var D,N=v-u.startSN,W=u.fragments;for(W[N]=h,D=N;D>0;D--)C(W[D],W[D-1]);for(D=N;D<W.length-1;D++)C(W[D],W[D+1]);return u.fragmentHint&&C(W[W.length-1],u.fragmentHint),u.PTSKnown=u.alignedSliding=!0,o}function x(u,h){for(var E=null,m=u.fragments,g=m.length-1;g>=0;g--){var w=m[g].initSegment;if(w){E=w;break}}u.fragmentHint&&delete u.fragmentHint.endPTS;var y=0,p;if(O(u,h,function(D,N){D.relurl&&(y=D.cc-N.cc),Object(K.isFiniteNumber)(D.startPTS)&&Object(K.isFiniteNumber)(D.endPTS)&&(N.start=N.startPTS=D.startPTS,N.startDTS=D.startDTS,N.appendedPTS=D.appendedPTS,N.maxStartPTS=D.maxStartPTS,N.endPTS=D.endPTS,N.endDTS=D.endDTS,N.minEndPTS=D.minEndPTS,N.duration=D.endPTS-D.startPTS,N.duration&&(p=N),h.PTSKnown=h.alignedSliding=!0),N.elementaryStreams=D.elementaryStreams,N.loader=D.loader,N.stats=D.stats,N.urlId=D.urlId,D.initSegment&&(N.initSegment=D.initSegment,E=D.initSegment)}),E){var c=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments;c.forEach(function(D){var N;(!D.initSegment||D.initSegment.relurl===((N=E)===null||N===void 0?void 0:N.relurl))&&(D.initSegment=E)})}if(h.skippedSegments&&(h.deltaUpdateFailed=h.fragments.some(function(D){return!D}),h.deltaUpdateFailed)){M.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var l=h.skippedSegments;l--;)h.fragments.shift();h.startSN=h.fragments[0].sn,h.startCC=h.fragments[0].cc}var a=h.fragments;if(y){M.logger.warn("discontinuity sliding from playlist, take drift into account");for(var f=0;f<a.length;f++)a[f].cc+=y}h.skippedSegments&&(h.startCC=h.fragments[0].cc),A(u.partList,h.partList,function(D,N){N.elementaryStreams=D.elementaryStreams,N.stats=D.stats}),p?R(h,p,p.startPTS,p.endPTS,p.startDTS,p.endDTS):S(u,h),a.length&&(h.totalduration=h.edge-a[0].start),h.driftStartTime=u.driftStartTime,h.driftStart=u.driftStart;var o=h.advancedDateTime;if(h.advanced&&o){var v=h.edge;h.driftStart||(h.driftStartTime=o,h.driftStart=v),h.driftEndTime=o,h.driftEnd=v}else h.driftEndTime=u.driftEndTime,h.driftEnd=u.driftEnd,h.advancedDateTime=u.advancedDateTime}function A(u,h,E){if(u&&h)for(var m=0,g=0,w=u.length;g<=w;g++){var y=u[g],p=h[g+m];y&&p&&y.index===p.index&&y.fragment.sn===p.fragment.sn?E(y,p):m--}}function O(u,h,E){for(var m=h.skippedSegments,g=Math.max(u.startSN,h.startSN)-h.startSN,w=(u.fragmentHint?1:0)+(m?h.endSN:Math.min(u.endSN,h.endSN))-h.startSN,y=h.startSN-u.startSN,p=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments,c=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,l=g;l<=w;l++){var a=c[y+l],f=p[l];m&&!f&&l<m&&(f=h.fragments[l]=a),a&&f&&E(a,f)}}function S(u,h){var E=h.startSN+h.skippedSegments-u.startSN,m=u.fragments;if(E<0||E>=m.length)return;_(h,m[E].start)}function _(u,h){if(h){for(var E=u.fragments,m=u.skippedSegments;m<E.length;m++)E[m].start+=h;u.fragmentHint&&(u.fragmentHint.start+=h)}}function b(u,h){var E=1e3*u.levelTargetDuration,m=E/2,g=u.age,w=g>0&&g<E*3,y=h.loading.end-h.loading.start,p,c=u.availabilityDelay;if(u.updated===!1)if(w){var l=333*u.misses;p=Math.max(Math.min(m,y*2),l),u.availabilityDelay=(u.availabilityDelay||0)+p}else p=m;else w?(c=Math.min(c||E/2,g),u.availabilityDelay=c,p=c+E-g):p=E-y;return Math.round(p)}function d(u,h,E){if(!u||!u.details)return null;var m=u.details,g=m.fragments[h-m.startSN];return g||(g=m.fragmentHint,g&&g.sn===h?g:h<m.startSN&&E&&E.sn===h?E:null)}function s(u,h,E){if(!u||!u.details)return null;var m=u.details.partList;if(m)for(var g=m.length;g--;){var w=m[g];if(w.index===E&&w.fragment.sn===h)return w}return null}},"./src/controller/stream-controller.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return m});var K=L("./src/polyfills/number.ts"),M=L("./src/controller/base-stream-controller.ts"),P=L("./src/is-supported.ts"),j=L("./src/events.ts"),k=L("./src/utils/buffer-helper.ts"),C=L("./src/controller/fragment-tracker.ts"),R=L("./src/types/loader.ts"),x=L("./src/loader/fragment.ts"),A=L("./src/demux/transmuxer-interface.ts"),O=L("./src/types/transmuxer.ts"),S=L("./src/controller/gap-controller.ts"),_=L("./src/errors.ts"),b=L("./src/utils/logger.ts");function d(g,w){for(var y=0;y<w.length;y++){var p=w[y];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(g,p.key,p)}}function s(g,w,y){return w&&d(g.prototype,w),y&&d(g,y),g}function u(g,w){g.prototype=Object.create(w.prototype),g.prototype.constructor=g,h(g,w)}function h(g,w){return h=Object.setPrototypeOf||function(p,c){return p.__proto__=c,p},h(g,w)}var E=100,m=function(g){u(w,g);function w(p,c){var l;return l=g.call(this,p,c,"[stream-controller]")||this,l.audioCodecSwap=!1,l.gapController=null,l.level=-1,l._forceStartLoad=!1,l.altAudio=!1,l.audioOnly=!1,l.fragPlaying=null,l.onvplaying=null,l.onvseeked=null,l.fragLastKbps=0,l.stalled=!1,l.couldBacktrack=!1,l.audioCodecSwitch=!1,l.videoBuffer=null,l._registerListeners(),l}var y=w.prototype;return y._registerListeners=function(){var c=this.hls;c.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(j.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(j.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(j.Events.ERROR,this.onError,this),c.on(j.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(j.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(j.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(j.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(j.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(j.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y._unregisterListeners=function(){var c=this.hls;c.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(j.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(j.Events.ERROR,this.onError,this),c.off(j.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(j.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(j.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(j.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(j.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(j.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},y.startLoad=function(c){if(this.levels){var l=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(E),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var f=a.startLevel;f===-1&&(a.config.testBandwidth?(f=0,this.bitrateTest=!0):f=a.nextAutoLevel),this.level=a.nextLoadLevel=f,this.loadedmetadata=!1}l>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+l.toFixed(3)),c=l),this.state=M.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=M.State.STOPPED},y.stopLoad=function(){this._forceStartLoad=!1,g.prototype.stopLoad.call(this)},y.doTick=function(){switch(this.state){case M.State.IDLE:this.doTickIdle();break;case M.State.WAITING_LEVEL:{var c,l=this.levels,a=this.level,f=l==null||((c=l[a])===null||c===void 0)?void 0:c.details;if(f&&(!f.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(f))break;this.state=M.State.IDLE;break}break}case M.State.FRAG_LOADING_WAITING_RETRY:{var o,v=self.performance.now(),D=this.retryDate;(!D||v>=D||(o=this.media)!==null&&o!==void 0&&o.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=M.State.IDLE)}break;default:break}this.onTickEnd()},y.onTickEnd=function(){g.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},y.doTickIdle=function(){var c,l,a=this.hls,f=this.levelLastLoaded,o=this.levels,v=this.media,D=a.config,N=a.nextLoadLevel;if(f===null||!v&&(this.startFragRequested||!D.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!o||!o[N])return;var W=o[N];this.level=a.nextLoadLevel=N;var z=W.details;if(!z||this.state===M.State.WAITING_LEVEL||z.live&&this.levelLastLoaded!==N){this.state=M.State.WAITING_LEVEL;return}var F=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:v,R.PlaylistLevelType.MAIN);if(F===null)return;var I=F.len,B=this.getMaxBufferLength(W.maxBitrate);if(I>=B)return;if(this._streamEnded(F,z)){var Y={};this.altAudio&&(Y.type="video"),this.hls.trigger(j.Events.BUFFER_EOS,Y),this.state=M.State.ENDED;return}var Q=F.end,ee=this.getNextFragment(Q,z);if(this.couldBacktrack&&!this.fragPrevious&&ee&&ee.sn!=="initSegment"){var fe=ee.sn-z.startSN;fe>1&&(ee=z.fragments[fe-1],this.fragmentTracker.removeFragment(ee))}if(ee&&this.fragmentTracker.getState(ee)===C.FragmentState.OK&&this.nextLoadPosition>Q){var ce=this.audioOnly&&!this.altAudio?x.ElementaryStreamTypes.AUDIO:x.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(v,ce,R.PlaylistLevelType.MAIN),ee=this.getNextFragment(this.nextLoadPosition,z)}if(!ee)return;ee.initSegment&&!ee.initSegment.data&&!this.bitrateTest&&(ee=ee.initSegment),((c=ee.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((l=ee.decryptdata)!==null&&l!==void 0&&l.key)?this.loadKey(ee,z):this.loadFragment(ee,z,Q)},y.loadFragment=function(c,l,a){var f,o=this.fragmentTracker.getState(c);if(this.fragCurrent=c,o===C.FragmentState.BACKTRACKED){var v=this.fragmentTracker.getBacktrackData(c);if(v){this._handleFragmentLoadProgress(v),this._handleFragmentLoadComplete(v);return}else o=C.FragmentState.NOT_LOADED}o===C.FragmentState.NOT_LOADED||o===C.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,l,a)):o===C.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((f=this.media)===null||f===void 0?void 0:f.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},y.getAppendedFrag=function(c){var l=this.fragmentTracker.getAppendedFrag(c,R.PlaylistLevelType.MAIN);return l&&"fragment"in l?l.fragment:l},y.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,R.PlaylistLevelType.MAIN)},y.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},y.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},y.nextLevelSwitch=function(){var c=this.levels,l=this.media;if(l!=null&&l.readyState){var a,f=this.getAppendedFrag(l.currentTime);if(f&&f.start>1&&this.flushMainBuffer(0,f.start-1),!l.paused&&c){var o=this.hls.nextLoadLevel,v=c[o],D=this.fragLastKbps;D&&this.fragCurrent?a=this.fragCurrent.duration*v.maxBitrate/(1e3*D)+1:a=0}else a=0;var N=this.getBufferedFrag(l.currentTime+a);if(N){var W=this.followingBufferedFrag(N);if(W){this.abortCurrentFrag();var z=W.maxStartPTS?W.maxStartPTS:W.start,F=W.duration,I=Math.max(N.end,z+Math.min(Math.max(F-this.config.maxFragLookUpTolerance,F*.5),F*.75));this.flushMainBuffer(I,Number.POSITIVE_INFINITY)}}}},y.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===M.State.KEY_LOADING&&(this.state=M.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},y.flushMainBuffer=function(c,l){g.prototype.flushMainBuffer.call(this,c,l,this.altAudio?"video":null)},y.onMediaAttached=function(c,l){g.prototype.onMediaAttached.call(this,c,l);var a=l.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new S.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,l=c?c.currentTime:null;Object(K.isFiniteNumber)(l)&&this.log("Media seeked to "+l.toFixed(3)),this.tick()},y.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(j.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},y.onManifestParsed=function(c,l){var a=!1,f=!1,o;l.levels.forEach(function(v){o=v.audioCodec,o&&(o.indexOf("mp4a.40.2")!==-1&&(a=!0),o.indexOf("mp4a.40.5")!==-1&&(f=!0))}),this.audioCodecSwitch=a&&f&&!Object(P.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=l.levels,this.startFragRequested=!1},y.onLevelLoading=function(c,l){var a=this.levels;if(!a||this.state!==M.State.IDLE)return;var f=a[l.level];(!f.details||f.details.live&&this.levelLastLoaded!==l.level||this.waitForCdnTuneIn(f.details))&&(this.state=M.State.WAITING_LEVEL)},y.onLevelLoaded=function(c,l){var a,f=this.levels,o=l.level,v=l.details,D=v.totalduration;if(!f){this.warn("Levels were reset while loading level "+o);return}this.log("Level "+o+" loaded ["+v.startSN+","+v.endSN+"], cc ["+v.startCC+", "+v.endCC+"] duration:"+D);var N=this.fragCurrent;N&&(this.state===M.State.FRAG_LOADING||this.state===M.State.FRAG_LOADING_WAITING_RETRY)&&(N.level!==l.level&&N.loader&&(this.state=M.State.IDLE,N.loader.abort()));var W=f[o],z=0;if(v.live||(a=W.details)!==null&&a!==void 0&&a.live){if(v.fragments[0]||(v.deltaUpdateFailed=!0),v.deltaUpdateFailed)return;z=this.alignPlaylists(v,W.details)}if(W.details=v,this.levelLastLoaded=o,this.hls.trigger(j.Events.LEVEL_UPDATED,{details:v,level:o}),this.state===M.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(v))return;this.state=M.State.IDLE}this.startFragRequested?v.live&&this.synchronizeToLiveEdge(v):this.setStartPosition(v,z),this.tick()},y._handleFragmentLoadProgress=function(c){var l,a=c.frag,f=c.part,o=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 D=v[a.level],N=D.details;if(!N){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var W=D.videoCodec,z=N.PTSKnown||!N.live,F=(l=a.initSegment)===null||l===void 0?void 0:l.data,I=this._getAudioCodec(D),B=this.transmuxer=this.transmuxer||new A.default(this.hls,R.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Y=f?f.index:-1,Q=Y!==-1,ee=new O.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,o.byteLength,Y,Q),fe=this.initPTS[a.cc];B.push(o,F,I,W,a,f,N.totalduration,z,ee,fe)},y.onAudioTrackSwitching=function(c,l){var a=this.altAudio,f=!!l.url,o=l.id;if(!f){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 D=this.hls;a&&D.trigger(j.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),D.trigger(j.Events.AUDIO_TRACK_SWITCHED,{id:o})}},y.onAudioTrackSwitched=function(c,l){var a=l.id,f=!!this.hls.audioTracks[a].url;if(f){var o=this.videoBuffer;o&&this.mediaBuffer!==o&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=o)}this.altAudio=f,this.tick()},y.onBufferCreated=function(c,l){var a=l.tracks,f,o,v=!1;for(var D in a){var N=a[D];if(N.id==="main"){if(o=D,f=N,D==="video"){var W=a[D];W&&(this.videoBuffer=W.buffer)}}else v=!0}v&&f?(this.log("Alternate track found, use "+o+".buffered to schedule main fragment loading"),this.mediaBuffer=f.buffer):this.mediaBuffer=this.media},y.onFragBuffered=function(c,l){var a=l.frag,f=l.part;if(a&&a.type!==R.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(f?" p: "+f.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===M.State.PARSED&&(this.state=M.State.IDLE);return}var o=f?f.stats:a.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,f)},y.onError=function(c,l){switch(l.details){case _.ErrorDetails.FRAG_LOAD_ERROR:case _.ErrorDetails.FRAG_LOAD_TIMEOUT:case _.ErrorDetails.KEY_LOAD_ERROR:case _.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.MAIN,l);break;case _.ErrorDetails.LEVEL_LOAD_ERROR:case _.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==M.State.ERROR&&(l.fatal?(this.warn(""+l.details),this.state=M.State.ERROR):!l.levelRetry&&this.state===M.State.WAITING_LEVEL&&(this.state=M.State.IDLE));break;case _.ErrorDetails.BUFFER_FULL_ERROR:if(l.parent==="main"&&(this.state===M.State.PARSING||this.state===M.State.PARSED)){var a=!0,f=this.getFwdBufferInfo(this.media,R.PlaylistLevelType.MAIN);f&&f.len>.5&&(a=!this.reduceMaxBufferLength(f.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,l=this.gapController;if(!c||!l||!c.readyState)return;var a=k.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):l.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},y.onFragLoadEmergencyAborted=function(){this.state=M.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},y.onBufferFlushed=function(c,l){var a=l.type;if(a!==x.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var f=(a===x.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(f,a,R.PlaylistLevelType.MAIN)}},y.onLevelsUpdated=function(c,l){this.levels=l.levels},y.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},y.seekToStartPos=function(){var c=this.media,l=c.currentTime,a=this.startPosition;if(a>=0&&l<a){if(c.seeking){b.logger.log("could not seek to "+a+", already seeking at "+l);return}var f=k.BufferHelper.getBuffered(c),o=f.length?f.start(0):0,v=o-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 "+l),c.currentTime=a}},y._getAudioCodec=function(c){var l=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&l&&(this.log("Swapping audio codec"),l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5"),l},y._loadBitrateTestFrag=function(c){var l=this;this._doFragLoad(c).then(function(a){var f=l.hls;if(!a||f.nextLoadLevel||l.fragContextChanged(c))return;l.fragLoadError=0,l.state=M.State.IDLE,l.startFragRequested=!1,l.bitrateTest=!1;var o=c.stats;o.parsing.start=o.parsing.end=o.buffering.start=o.buffering.end=self.performance.now(),f.trigger(j.Events.FRAG_LOADED,a)})},y._handleTransmuxComplete=function(c){var l,a="main",f=this.hls,o=c.remuxResult,v=c.chunkMeta,D=this.getCurrentContext(v);if(!D){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 N=D.frag,W=D.part,z=D.level,F=o.video,I=o.text,B=o.id3,Y=o.initSegment,Q=this.altAudio?void 0:o.audio;if(this.fragContextChanged(N))return;if(this.state=M.State.PARSING,Y){Y.tracks&&(this._bufferInitSegment(z,Y.tracks,N,v),f.trigger(j.Events.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:a,tracks:Y.tracks}));var ee=Y.initPTS,fe=Y.timescale;Object(K.isFiniteNumber)(ee)&&(this.initPTS[N.cc]=ee,f.trigger(j.Events.INIT_PTS_FOUND,{frag:N,id:a,initPTS:ee,timescale:fe}))}if(F&&o.independent!==!1){if(z.details){var ce=F.startPTS,ge=F.endPTS,pe=F.startDTS,ue=F.endDTS;if(W)W.elementaryStreams[F.type]={startPTS:ce,endPTS:ge,startDTS:pe,endDTS:ue};else if(F.firstKeyFrame&&F.independent&&(this.couldBacktrack=!0),F.dropped&&F.independent){var le=this.getLoadPosition()+this.config.maxBufferHole;if(le<ce){this.backtrack(N);return}N.setElementaryStreamInfo(F.type,N.start,ge,N.start,ue,!0)}N.setElementaryStreamInfo(F.type,ce,ge,pe,ue),this.bufferFragmentData(F,N,W,v)}}else if(o.independent===!1){this.backtrack(N);return}if(Q){var de=Q.startPTS,ye=Q.endPTS,Me=Q.startDTS,Ue=Q.endDTS;W&&(W.elementaryStreams[x.ElementaryStreamTypes.AUDIO]={startPTS:de,endPTS:ye,startDTS:Me,endDTS:Ue}),N.setElementaryStreamInfo(x.ElementaryStreamTypes.AUDIO,de,ye,Me,Ue),this.bufferFragmentData(Q,N,W,v)}if(B!=null&&(l=B.samples)!==null&&l!==void 0&&l.length){var Re={frag:N,id:a,samples:B.samples};f.trigger(j.Events.FRAG_PARSING_METADATA,Re)}if(I){var Oe={frag:N,id:a,samples:I.samples};f.trigger(j.Events.FRAG_PARSING_USERDATA,Oe)}},y._bufferInitSegment=function(c,l,a,f){var o=this;if(this.state!==M.State.PARSING)return;this.audioOnly=!!l.audio&&!l.video,this.altAudio&&!this.audioOnly&&delete l.audio;var v=l.audio,D=l.video,N=l.audiovideo;if(v){var W=c.audioCodec,z=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(W&&(W.indexOf("mp4a.40.5")!==-1?W="mp4a.40.2":W="mp4a.40.5"),v.metadata.channelCount!==1&&z.indexOf("firefox")===-1&&(W="mp4a.40.5")),z.indexOf("android")!==-1&&v.container!=="audio/mpeg"&&(W="mp4a.40.2",this.log("Android: force audio codec to "+W)),c.audioCodec&&c.audioCodec!==W&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+W+'"'),v.levelCodec=W,v.id="main",this.log("Init audio buffer, container:"+v.container+", codecs[selected/level/parsed]=["+(W||"")+"/"+(c.audioCodec||"")+"/"+v.codec+"]")}D&&(D.levelCodec=c.videoCodec,D.id="main",this.log("Init video buffer, container:"+D.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+D.codec+"]")),N&&this.log("Init audiovideo buffer, container:"+N.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+N.codec+"]"),this.hls.trigger(j.Events.BUFFER_CODECS,l),Object.keys(l).forEach(function(F){var I=l[F],B=I.initSegment;B!=null&&B.byteLength&&o.hls.trigger(j.Events.BUFFER_APPENDING,{type:F,data:B,frag:a,part:null,chunkMeta:f,parent:a.type})}),this.tick()},y.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var l=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,l?this.resetFragmentLoading(c):this.state=M.State.BACKTRACKING},y.checkFragmentChanged=function(){var c=this.media,l=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(k.BufferHelper.isBuffered(c,a)?l=this.getAppendedFrag(a):k.BufferHelper.isBuffered(c,a+.1)&&(l=this.getAppendedFrag(a+.1)),l){var f=this.fragPlaying,o=l.level;(!f||l.sn!==f.sn||f.level!==o||l.urlId!==f.urlId)&&(this.hls.trigger(j.Events.FRAG_CHANGED,{frag:l}),(!f||f.level!==o)&&this.hls.trigger(j.Events.LEVEL_SWITCHED,{level:o}),this.fragPlaying=l)}}},s(w,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);if(l)return l.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(l)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),w}(M.default)},"./src/controller/subtitle-stream-controller.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"SubtitleStreamController",function(){return u});var K=L("./src/events.ts"),M=L("./src/utils/logger.ts"),P=L("./src/utils/buffer-helper.ts"),j=L("./src/controller/fragment-finders.ts"),k=L("./src/utils/discontinuities.ts"),C=L("./src/controller/level-helper.ts"),R=L("./src/controller/fragment-tracker.ts"),x=L("./src/controller/base-stream-controller.ts"),A=L("./src/types/loader.ts"),O=L("./src/types/level.ts");function S(h,E){for(var m=0;m<E.length;m++){var g=E[m];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(h,g.key,g)}}function _(h,E,m){return E&&S(h.prototype,E),m&&S(h,m),h}function b(h,E){h.prototype=Object.create(E.prototype),h.prototype.constructor=h,d(h,E)}function d(h,E){return d=Object.setPrototypeOf||function(g,w){return g.__proto__=w,g},d(h,E)}var s=500,u=function(h){b(E,h);function E(g,w){var y;return y=h.call(this,g,w,"[subtitle-stream-controller]")||this,y.levels=[],y.currentTrackId=-1,y.tracksBuffered=[],y.mainDetails=null,y._registerListeners(),y}var m=E.prototype;return m.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},m._registerListeners=function(){var w=this.hls;w.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.on(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.on(K.Events.ERROR,this.onError,this),w.on(K.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),w.on(K.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),w.on(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),w.on(K.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),w.on(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},m._unregisterListeners=function(){var w=this.hls;w.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.off(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.off(K.Events.ERROR,this.onError,this),w.off(K.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),w.off(K.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),w.off(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),w.off(K.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),w.off(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},m.startLoad=function(){this.stopLoad(),this.state=x.State.IDLE,this.setInterval(s),this.tick()},m.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},m.onLevelLoaded=function(w,y){this.mainDetails=y.details},m.onSubtitleFragProcessed=function(w,y){var p=y.frag,c=y.success;if(this.fragPrevious=p,this.state=x.State.IDLE,!c)return;var l=this.tracksBuffered[this.currentTrackId];if(!l)return;for(var a,f=p.start,o=0;o<l.length;o++)if(f>=l[o].start&&f<=l[o].end){a=l[o];break}var v=p.start+p.duration;a?a.end=v:(a={start:f,end:v},l.push(a)),this.fragmentTracker.fragBuffered(p)},m.onBufferFlushing=function(w,y){var p=y.startOffset,c=y.endOffset;if(p===0&&c!==Number.POSITIVE_INFINITY){var l=this.currentTrackId,a=this.levels;if(!a.length||!a[l]||!a[l].details)return;var f=a[l].details,o=f.targetduration,v=c-o;if(v<=0)return;y.endOffsetSubtitles=Math.max(0,v),this.tracksBuffered.forEach(function(D){for(var N=0;N<D.length;){if(D[N].end<=v){D.shift();continue}else if(D[N].start<v)D[N].start=v;else break;N++}}),this.fragmentTracker.removeFragmentsInRange(p,v,A.PlaylistLevelType.SUBTITLE)}},m.onError=function(w,y){var p,c=y.frag;if(!c||c.type!==A.PlaylistLevelType.SUBTITLE)return;(p=this.fragCurrent)!==null&&p!==void 0&&p.loader&&this.fragCurrent.loader.abort(),this.state=x.State.IDLE},m.onSubtitleTracksUpdated=function(w,y){var p=this,c=y.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(l){return new O.Level(l)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(l){p.tracksBuffered[l.id]=[]}),this.mediaBuffer=null},m.onSubtitleTrackSwitch=function(w,y){if(this.currentTrackId=y.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var p=this.levels[this.currentTrackId];p!=null&&p.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,p&&this.setInterval(s)},m.onSubtitleTrackLoaded=function(w,y){var p,c=y.details,l=y.id,a=this.currentTrackId,f=this.levels;if(!f.length)return;var o=f[a];if(l>=f.length||l!==a||!o)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(p=o.details)!==null&&p!==void 0&&p.live){var v=this.mainDetails;if(c.deltaUpdateFailed||!v)return;var D=v.fragments[0];if(!o.details)c.hasProgramDateTime&&v.hasProgramDateTime?Object(k.alignMediaPlaylistByPDT)(c,v):D&&Object(C.addSliding)(c,D.start);else{var N=this.alignPlaylists(c,o.details);N===0&&D&&Object(C.addSliding)(c,D.start)}}if(o.details=c,this.levelLastLoaded=l,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===x.State.IDLE){var W=Object(j.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);W||(this.warn("Subtitle playlist not aligned with playback"),o.details=void 0)}},m._handleFragmentLoadComplete=function(w){var y=w.frag,p=w.payload,c=y.decryptdata,l=this.hls;if(this.fragContextChanged(y))return;if(p&&p.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(p),c.key.buffer,c.iv.buffer).then(function(f){var o=performance.now();l.trigger(K.Events.FRAG_DECRYPTED,{frag:y,payload:f,stats:{tstart:a,tdecrypt:o}})})}},m.doTick=function(){if(!this.media){this.state=x.State.IDLE;return}if(this.state===x.State.IDLE){var w,y=this.currentTrackId,p=this.levels;if(!p.length||!p[y]||!p[y].details)return;var c=p[y].details,l=c.targetduration,a=this.config,f=this.media,o=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,f.currentTime-l,a.maxBufferHole),v=o.end,D=o.len,N=this.getMaxBufferLength()+l;if(D>N)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var W=c.fragments,z=W.length,F=c.edge,I,B=this.fragPrevious;if(v<F){var Y=a.maxFragLookUpTolerance;B&&c.hasProgramDateTime&&(I=Object(j.findFragmentByPDT)(W,B.endProgramDateTime,Y)),I||(I=Object(j.findFragmentByPTS)(B,W,v,Y),!I&&B&&B.start<W[0].start&&(I=W[0]))}else I=W[z-1];(w=I)!==null&&w!==void 0&&w.encrypted?(M.logger.log("Loading key for "+I.sn),this.state=x.State.KEY_LOADING,this.hls.trigger(K.Events.KEY_LOADING,{frag:I})):I&&this.fragmentTracker.getState(I)===R.FragmentState.NOT_LOADED&&this.loadFragment(I,c,v)}},m.loadFragment=function(w,y,p){this.fragCurrent=w,h.prototype.loadFragment.call(this,w,y,p)},_(E,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),E}(x.default)},"./src/controller/subtitle-track-controller.ts":function(re,V,L){"use strict";L.r(V);var K=L("./src/events.ts"),M=L("./src/utils/texttrack-utils.ts"),P=L("./src/controller/base-playlist-controller.ts"),j=L("./src/types/loader.ts");function k(S,_){for(var b=0;b<_.length;b++){var d=_[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(S,d.key,d)}}function C(S,_,b){return _&&k(S.prototype,_),b&&k(S,b),S}function R(S,_){S.prototype=Object.create(_.prototype),S.prototype.constructor=S,x(S,_)}function x(S,_){return x=Object.setPrototypeOf||function(d,s){return d.__proto__=s,d},x(S,_)}var A=function(S){R(_,S);function _(d){var s;return s=S.call(this,d,"[subtitle-track-controller]")||this,s.media=null,s.tracks=[],s.groupId=null,s.tracksInGroup=[],s.trackId=-1,s.selectDefaultTrack=!0,s.queuedDefaultTrack=-1,s.trackChangeListener=function(){return s.onTextTracksChanged()},s.asyncPollTrackChange=function(){return s.pollTrackChange(0)},s.useTextTrackPolling=!1,s.subtitlePollingInterval=-1,s.subtitleDisplay=!0,s.registerListeners(),s}var b=_.prototype;return b.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,S.prototype.destroy.call(this)},b.registerListeners=function(){var s=this.hls;s.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),s.on(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.on(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),s.on(K.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var s=this.hls;s.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(K.Events.LEVEL_LOADING,this.onLevelLoading,this),s.off(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.off(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),s.off(K.Events.ERROR,this.onError,this)},b.onMediaAttached=function(s,u){if(this.media=u.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},b.pollTrackChange=function(s){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,s)},b.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var s=O(this.media.textTracks);s.forEach(function(u){Object(M.clearCurrentCues)(u)}),this.subtitleTrack=-1,this.media=null},b.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},b.onManifestParsed=function(s,u){this.tracks=u.subtitleTracks},b.onSubtitleTrackLoaded=function(s,u){var h=u.id,E=u.details,m=this.trackId,g=this.tracksInGroup[m];if(!g){this.warn("Invalid subtitle track id "+h);return}var w=g.details;g.details=u.details,this.log("subtitle track "+h+" loaded ["+E.startSN+"-"+E.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,u,w))},b.onLevelLoading=function(s,u){this.switchLevel(u.level)},b.onLevelSwitching=function(s,u){this.switchLevel(u.level)},b.switchLevel=function(s){var u=this.hls.levels[s];if(!(u!=null&&u.textGroupIds))return;var h=u.textGroupIds[u.urlId];if(this.groupId!==h){var E=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,m=this.tracks.filter(function(y){return!h||y.groupId===h});this.tracksInGroup=m;var g=this.findTrackId(E==null?void 0:E.name)||this.findTrackId();this.groupId=h;var w={subtitleTracks:m};this.log("Updating subtitle tracks, "+m.length+' track(s) found in "'+h+'" group-id'),this.hls.trigger(K.Events.SUBTITLE_TRACKS_UPDATED,w),g!==-1&&this.setSubtitleTrack(g,E)}},b.findTrackId=function(s){for(var u=this.tracksInGroup,h=0;h<u.length;h++){var E=u[h];if((!this.selectDefaultTrack||E.default)&&(!s||s===E.name))return E.id}return-1},b.onError=function(s,u){if(S.prototype.onError.call(this,s,u),u.fatal||!u.context)return;u.context.type===j.PlaylistContextType.SUBTITLE_TRACK&&u.context.id===this.trackId&&u.context.groupId===this.groupId&&this.retryLoadingOrFail(u)},b.loadPlaylist=function(s){var u=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(u)){var h=u.id,E=u.groupId,m=u.url;if(s)try{m=s.addDirectives(m)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("Loading subtitle playlist for id "+h),this.hls.trigger(K.Events.SUBTITLE_TRACK_LOADING,{url:m,id:h,groupId:E,deliveryDirectives:s||null})}},b.toggleTrackModes=function(s){var u=this,h=this.media,E=this.subtitleDisplay,m=this.trackId;if(!h)return;var g=O(h.textTracks),w=g.filter(function(c){return c.groupId===u.groupId});if(s===-1)[].slice.call(g).forEach(function(c){c.mode="disabled"});else{var y=w[m];y&&(y.mode="disabled")}var p=w[s];p&&(p.mode=E?"showing":"hidden")},b.setSubtitleTrack=function(s,u){var h,E=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=s;return}if(this.trackId!==s&&this.toggleTrackModes(s),this.trackId===s&&(s===-1||(h=E[s])!==null&&h!==void 0&&h.details)||s<-1||s>=E.length)return;this.clearTimer();var m=E[s];if(this.log("Switching to subtitle track "+s),this.trackId=s,m){var g=m.id,w=m.groupId,y=w===void 0?"":w,p=m.name,c=m.type,l=m.url;this.hls.trigger(K.Events.SUBTITLE_TRACK_SWITCH,{id:g,groupId:y,name:p,type:c,url:l});var a=this.switchParams(m.url,u==null?void 0:u.details);this.loadPlaylist(a)}else this.hls.trigger(K.Events.SUBTITLE_TRACK_SWITCH,{id:s})},b.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var s=-1,u=O(this.media.textTracks),h=0;h<u.length;h++)if(u[h].mode==="hidden")s=h;else if(u[h].mode==="showing"){s=h;break}this.subtitleTrack!==s&&(this.subtitleTrack=s)},C(_,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(s){this.selectDefaultTrack=!1;var u=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(s,u)}}]),_}(P.default);function O(S){for(var _=[],b=0;b<S.length;b++){var d=S[b];d.kind==="subtitles"&&d.label&&_.push(S[b])}return _}V.default=A},"./src/controller/timeline-controller.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"TimelineController",function(){return O});var K=L("./src/polyfills/number.ts"),M=L("./src/events.ts"),P=L("./src/utils/cea-608-parser.ts"),j=L("./src/utils/output-filter.ts"),k=L("./src/utils/webvtt-parser.ts"),C=L("./src/utils/texttrack-utils.ts"),R=L("./src/utils/imsc1-ttml-parser.ts"),x=L("./src/types/loader.ts"),A=L("./src/utils/logger.ts"),O=function(){function d(u){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=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 h=new j.default(this,"textTrack1"),E=new j.default(this,"textTrack2"),m=new j.default(this,"textTrack3"),g=new j.default(this,"textTrack4");this.cea608Parser1=new P.default(1,h,E),this.cea608Parser2=new P.default(3,m,g)}u.on(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.on(M.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.on(M.Events.FRAG_LOADING,this.onFragLoading,this),u.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(M.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.on(M.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(M.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.on(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var s=d.prototype;return s.destroy=function(){var h=this.hls;h.off(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),h.off(M.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),h.off(M.Events.FRAG_LOADING,this.onFragLoading,this),h.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(M.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),h.off(M.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),h.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(M.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),h.off(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},s.addCues=function(h,E,m,g,w){for(var y=!1,p=w.length;p--;){var c=w[p],l=_(c[0],c[1],E,m);if(l>=0&&(c[0]=Math.min(c[0],E),c[1]=Math.max(c[1],m),y=!0,l/(m-E)>.5))return}if(y||w.push([E,m]),this.config.renderTextTracksNatively){var a=this.captionsTracks[h];this.Cues.newCue(a,E,m,g)}else{var f=this.Cues.newCue(null,E,m,g);this.hls.trigger(M.Events.CUES_PARSED,{type:"captions",cues:f,track:h})}},s.onInitPtsFound=function(h,E){var m=this,g=E.frag,w=E.id,y=E.initPTS,p=E.timescale,c=this.unparsedVttFrags;w==="main"&&(this.initPTS[g.cc]=y,this.timescale[g.cc]=p),c.length&&(this.unparsedVttFrags=[],c.forEach(function(l){m.onFragLoaded(M.Events.FRAG_LOADED,l)}))},s.getExistingTrack=function(h){var E=this.media;if(E)for(var m=0;m<E.textTracks.length;m++){var g=E.textTracks[m];if(g[h])return g}return null},s.createCaptionsTrack=function(h){this.config.renderTextTracksNatively?this.createNativeTrack(h):this.createNonNativeTrack(h)},s.createNativeTrack=function(h){if(this.captionsTracks[h])return;var E=this.captionsProperties,m=this.captionsTracks,g=this.media,w=E[h],y=w.label,p=w.languageCode,c=this.getExistingTrack(h);if(c)m[h]=c,Object(C.clearCurrentCues)(m[h]),Object(C.sendAddTrackEvent)(m[h],g);else{var l=this.createTextTrack("captions",y,p);l&&(l[h]=!0,m[h]=l)}},s.createNonNativeTrack=function(h){if(this.nonNativeCaptionsTracks[h])return;var E=this.captionsProperties[h];if(!E)return;var m=E.label,g={_id:h,label:m,kind:"captions",default:E.media?!!E.media.default:!1,closedCaptions:E.media};this.nonNativeCaptionsTracks[h]=g,this.hls.trigger(M.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[g]})},s.createTextTrack=function(h,E,m){var g=this.media;return g?g.addTextTrack(h,E,m):void 0},s.onMediaAttaching=function(h,E){this.media=E.media,this._cleanTracks()},s.onMediaDetaching=function(){var h=this.captionsTracks;Object.keys(h).forEach(function(E){Object(C.clearCurrentCues)(h[E]),delete h[E]}),this.nonNativeCaptionsTracks={}},s.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=b(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},s._cleanTracks=function(){var h=this.media;if(!h)return;var E=h.textTracks;if(E)for(var m=0;m<E.length;m++)Object(C.clearCurrentCues)(E[m])},s.onSubtitleTracksUpdated=function(h,E){var m=this;this.textTracks=[];var g=E.subtitleTracks||[],w=g.some(function(l){return l.textCodec===R.IMSC1_CODEC});if(this.config.enableWebVTT||w&&this.config.enableIMSC1){var y=this.tracks&&g&&this.tracks.length===g.length;if(this.tracks=g||[],this.config.renderTextTracksNatively){var p=this.media?this.media.textTracks:[];this.tracks.forEach(function(l,a){var f;if(a<p.length){for(var o=null,v=0;v<p.length;v++)if(S(p[v],l)){o=p[v];break}o&&(f=o)}f?Object(C.clearCurrentCues)(f):(f=m.createTextTrack("subtitles",l.name,l.lang),f&&(f.mode="disabled")),f&&(f.groupId=l.groupId,m.textTracks.push(f))})}else if(!y&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(l){return{label:l.name,kind:l.type.toLowerCase(),default:l.default,subtitleTrack:l}});this.hls.trigger(M.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},s.onManifestLoaded=function(h,E){var m=this;this.config.enableCEA708Captions&&E.captions&&E.captions.forEach(function(g){var w=/(?:CC|SERVICE)([1-4])/.exec(g.instreamId);if(!w)return;var y="textTrack"+w[1],p=m.captionsProperties[y];if(!p)return;p.label=g.name,g.lang&&(p.languageCode=g.lang),p.media=g})},s.onFragLoading=function(h,E){var m=this.cea608Parser1,g=this.cea608Parser2,w=this.lastSn,y=this.lastPartIndex;if(!this.enabled||!(m&&g))return;if(E.frag.type===x.PlaylistLevelType.MAIN){var p,c,l=E.frag.sn,a=(p=E==null||((c=E.part)===null||c===void 0)?void 0:c.index)!=null?p:-1;l===w+1||l===w&&a===y+1||(m.reset(),g.reset()),this.lastSn=l,this.lastPartIndex=a}},s.onFragLoaded=function(h,E){var m=E.frag,g=E.payload,w=this.initPTS,y=this.unparsedVttFrags;if(m.type===x.PlaylistLevelType.SUBTITLE)if(g.byteLength){if(!Object(K.isFiniteNumber)(w[m.cc])){y.push(E),w.length&&this.hls.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:m,error:new Error("Missing initial subtitle PTS")});return}var p=m.decryptdata;if(p==null||p.key==null||p.method!=="AES-128"){var c=this.tracks[m.level],l=this.vttCCs;l[m.cc]||(l[m.cc]={start:m.start,prevCC:this.prevCC,new:!0},this.prevCC=m.cc),c&&c.textCodec===R.IMSC1_CODEC?this._parseIMSC1(m,g):this._parseVTTs(m,g,l)}}else this.hls.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:m,error:new Error("Empty subtitle payload")})},s._parseIMSC1=function(h,E){var m=this,g=this.hls;Object(R.parseIMSC1)(E,this.initPTS[h.cc],this.timescale[h.cc],function(w){m._appendCues(w,h.level),g.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(w){A.logger.log("Failed to parse IMSC1: "+w),g.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:w})})},s._parseVTTs=function(h,E,m){var g=this,w=this.hls;Object(k.parseWebVTT)(E,this.initPTS[h.cc],this.timescale[h.cc],m,h.cc,h.start,function(y){g._appendCues(y,h.level),w.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(y){g._fallbackToIMSC1(h,E),A.logger.log("Failed to parse VTT cue: "+y),w.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:y})})},s._fallbackToIMSC1=function(h,E){var m=this,g=this.tracks[h.level];g.textCodec||Object(R.parseIMSC1)(E,this.initPTS[h.cc],this.timescale[h.cc],function(){g.textCodec=R.IMSC1_CODEC,m._parseIMSC1(h,E)},function(){g.textCodec="wvtt"})},s._appendCues=function(h,E){var m=this.hls;if(this.config.renderTextTracksNatively){var g=this.textTracks[E];if(g.mode==="disabled")return;h.forEach(function(p){return Object(C.addCueToTrack)(g,p)})}else{var w=this.tracks[E],y=w.default?"default":"subtitles"+E;m.trigger(M.Events.CUES_PARSED,{type:"subtitles",cues:h,track:y})}},s.onFragDecrypted=function(h,E){var m=E.frag;if(m.type===x.PlaylistLevelType.SUBTITLE){if(!Object(K.isFiniteNumber)(this.initPTS[m.cc])){this.unparsedVttFrags.push(E);return}this.onFragLoaded(M.Events.FRAG_LOADED,E)}},s.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},s.onFragParsingUserdata=function(h,E){var m=this.cea608Parser1,g=this.cea608Parser2;if(!this.enabled||!(m&&g))return;for(var w=0;w<E.samples.length;w++){var y=E.samples[w].bytes;if(y){var p=this.extractCea608Data(y);m.addData(E.samples[w].pts,p[0]),g.addData(E.samples[w].pts,p[1])}}},s.onBufferFlushing=function(h,E){var m=E.startOffset,g=E.endOffset,w=E.endOffsetSubtitles,y=E.type,p=this.media;if(!p||p.currentTime<g)return;if(!y||y==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(C.removeCuesInRange)(c[a],m,g)})}if(this.config.renderTextTracksNatively&&(m===0&&w!==void 0)){var l=this.textTracks;Object.keys(l).forEach(function(a){return Object(C.removeCuesInRange)(l[a],m,w)})}},s.extractCea608Data=function(h){for(var E=h[0]&31,m=2,g=[[],[]],w=0;w<E;w++){var y=h[m++],p=127&h[m++],c=127&h[m++],l=(4&y)!==0,a=3&y;if(p===0&&c===0)continue;l&&((a===0||a===1)&&(g[a].push(p),g[a].push(c)))}return g},d}();function S(d,s){return d&&d.label===s.name&&!(d.textTrack1||d.textTrack2)}function _(d,s,u,h){return Math.min(s,h)-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,V,L){"use strict";L.r(V),L.d(V,"default",function(){return K});var K=function(){function M(j,k){this.subtle=void 0,this.aesIV=void 0,this.subtle=j,this.aesIV=k}var P=M.prototype;return P.decrypt=function(k,C){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},C,k)},M}()},"./src/crypt/aes-decryptor.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"removePadding",function(){return M}),L.d(V,"default",function(){return P});var K=L("./src/utils/typed-array.ts");function M(j){var k=j.byteLength,C=k&&new DataView(j.buffer).getUint8(k-1);return C?Object(K.sliceUint8)(j,0,k-C):j}var P=function(){function j(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var k=j.prototype;return k.uint8ArrayToUint32Array_=function(R){for(var x=new DataView(R),A=new Uint32Array(4),O=0;O<4;O++)A[O]=x.getUint32(O*4);return A},k.initTable=function(){var R=this.sBox,x=this.invSBox,A=this.subMix,O=A[0],S=A[1],_=A[2],b=A[3],d=this.invSubMix,s=d[0],u=d[1],h=d[2],E=d[3],m=new Uint32Array(256),g=0,w=0,y=0;for(y=0;y<256;y++)y<128?m[y]=y<<1:m[y]=y<<1^283;for(y=0;y<256;y++){var p=w^w<<1^w<<2^w<<3^w<<4;p=p>>>8^p&255^99,R[g]=p,x[p]=g;var c=m[g],l=m[c],a=m[l],f=m[p]*257^p*16843008;O[g]=f<<24|f>>>8,S[g]=f<<16|f>>>16,_[g]=f<<8|f>>>24,b[g]=f,f=a*16843009^l*65537^c*257^g*16843008,s[p]=f<<24|f>>>8,u[p]=f<<16|f>>>16,h[p]=f<<8|f>>>24,E[p]=f,g?(g=c^m[m[m[a^c]]],w^=m[m[w]]):g=w=1}},k.expandKey=function(R){for(var x=this.uint8ArrayToUint32Array_(R),A=!0,O=0;O<x.length&&A;)A=x[O]===this.key[O],O++;if(A)return;this.key=x;var S=this.keySize=x.length;if(S!==4&&S!==6&&S!==8)throw new Error("Invalid aes key size="+S);var _=this.ksRows=(S+6+1)*4,b,d,s=this.keySchedule=new Uint32Array(_),u=this.invKeySchedule=new Uint32Array(_),h=this.sBox,E=this.rcon,m=this.invSubMix,g=m[0],w=m[1],y=m[2],p=m[3],c,l;for(b=0;b<_;b++){if(b<S){c=s[b]=x[b];continue}l=c,b%S===0?(l=l<<8|l>>>24,l=h[l>>>24]<<24|h[l>>>16&255]<<16|h[l>>>8&255]<<8|h[l&255],l^=E[b/S|0]<<24):S>6&&b%S===4&&(l=h[l>>>24]<<24|h[l>>>16&255]<<16|h[l>>>8&255]<<8|h[l&255]),s[b]=c=(s[b-S]^l)>>>0}for(d=0;d<_;d++)b=_-d,d&3?l=s[b]:l=s[b-4],d<4||b<=4?u[d]=l:u[d]=g[h[l>>>24]]^w[h[l>>>16&255]]^y[h[l>>>8&255]]^p[h[l&255]],u[d]=u[d]>>>0},k.networkToHostOrderSwap=function(R){return R<<24|(R&65280)<<8|(R&16711680)>>8|R>>>24},k.decrypt=function(R,x,A){for(var O=this.keySize+6,S=this.invKeySchedule,_=this.invSBox,b=this.invSubMix,d=b[0],s=b[1],u=b[2],h=b[3],E=this.uint8ArrayToUint32Array_(A),m=E[0],g=E[1],w=E[2],y=E[3],p=new Int32Array(R),c=new Int32Array(p.length),l,a,f,o,v,D,N,W,z,F,I,B,Y,Q,ee=this.networkToHostOrderSwap;x<p.length;){for(z=ee(p[x]),F=ee(p[x+1]),I=ee(p[x+2]),B=ee(p[x+3]),v=z^S[0],D=B^S[1],N=I^S[2],W=F^S[3],Y=4,Q=1;Q<O;Q++)l=d[v>>>24]^s[D>>16&255]^u[N>>8&255]^h[W&255]^S[Y],a=d[D>>>24]^s[N>>16&255]^u[W>>8&255]^h[v&255]^S[Y+1],f=d[N>>>24]^s[W>>16&255]^u[v>>8&255]^h[D&255]^S[Y+2],o=d[W>>>24]^s[v>>16&255]^u[D>>8&255]^h[N&255]^S[Y+3],v=l,D=a,N=f,W=o,Y=Y+4;l=_[v>>>24]<<24^_[D>>16&255]<<16^_[N>>8&255]<<8^_[W&255]^S[Y],a=_[D>>>24]<<24^_[N>>16&255]<<16^_[W>>8&255]<<8^_[v&255]^S[Y+1],f=_[N>>>24]<<24^_[W>>16&255]<<16^_[v>>8&255]<<8^_[D&255]^S[Y+2],o=_[W>>>24]<<24^_[v>>16&255]<<16^_[D>>8&255]<<8^_[N&255]^S[Y+3],c[x]=ee(l^m),c[x+1]=ee(o^g),c[x+2]=ee(f^w),c[x+3]=ee(a^y),m=z,g=F,w=I,y=B,x=x+4}return c.buffer},j}()},"./src/crypt/decrypter.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return x});var K=L("./src/crypt/aes-crypto.ts"),M=L("./src/crypt/fast-aes-key.ts"),P=L("./src/crypt/aes-decryptor.ts"),j=L("./src/utils/logger.ts"),k=L("./src/utils/mp4-tools.ts"),C=L("./src/utils/typed-array.ts"),R=16,x=function(){function A(S,_,b){var d=b===void 0?{}:b,s=d.removePKCS7Padding,u=s===void 0?!0:s;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=S,this.config=_,this.removePKCS7Padding=u,u)try{var h=self.crypto;h&&(this.subtle=h.subtle||h.webkitSubtle)}catch(E){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var O=A.prototype;return O.destroy=function(){this.observer=null},O.isSync=function(){return this.config.enableSoftwareAES},O.flush=function(){var _=this.currentResult;if(!_){this.reset();return}var b=new Uint8Array(_);return this.reset(),this.removePKCS7Padding?Object(P.removePadding)(b):b},O.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},O.decrypt=function(_,b,d,s){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(_),b,d);var u=this.flush();u&&s(u.buffer)}else this.webCryptoDecrypt(new Uint8Array(_),b,d).then(s)},O.softwareDecrypt=function(_,b,d){var s=this.currentIV,u=this.currentResult,h=this.remainderData;this.logOnce("JS AES decrypt"),h&&(_=Object(k.appendUint8Array)(h,_),this.remainderData=null);var E=this.getValidChunk(_);if(!E.length)return null;s&&(d=s);var m=this.softwareDecrypter;m||(m=this.softwareDecrypter=new P.default),m.expandKey(b);var g=u;return this.currentResult=m.decrypt(E.buffer,0,d),this.currentIV=Object(C.sliceUint8)(E,-16).buffer,g||null},O.webCryptoDecrypt=function(_,b,d){var s=this,u=this.subtle;return(this.key!==b||!this.fastAesKey)&&(this.key=b,this.fastAesKey=new M.default(u,b)),this.fastAesKey.expandKey().then(function(h){if(!u)return Promise.reject(new Error("web crypto not initialized"));var E=new K.default(u,d);return E.decrypt(_.buffer,h)}).catch(function(h){return s.onWebCryptoError(h,_,b,d)})},O.onWebCryptoError=function(_,b,d,s){return j.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",_),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(b,d,s)},O.getValidChunk=function(_){var b=_,d=_.length-_.length%R;return d!==_.length&&(b=Object(C.sliceUint8)(_,0,d),this.remainderData=Object(C.sliceUint8)(_,d)),b},O.logOnce=function(_){if(!this.logEnabled)return;j.logger.log("[decrypter.ts]: "+_),this.logEnabled=!1},A}()},"./src/crypt/fast-aes-key.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return K});var K=function(){function M(j,k){this.subtle=void 0,this.key=void 0,this.subtle=j,this.key=k}var P=M.prototype;return P.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},M}()},"./src/demux/aacdemuxer.ts":function(re,V,L){"use strict";L.r(V);var K=L("./src/demux/base-audio-demuxer.ts"),M=L("./src/demux/adts.ts"),P=L("./src/utils/logger.ts"),j=L("./src/demux/id3.ts");function k(x,A){x.prototype=Object.create(A.prototype),x.prototype.constructor=x,C(x,A)}function C(x,A){return C=Object.setPrototypeOf||function(S,_){return S.__proto__=_,S},C(x,A)}var R=function(x){k(A,x);function A(S,_){var b;return b=x.call(this)||this,b.observer=void 0,b.config=void 0,b.observer=S,b.config=_,b}var O=A.prototype;return O.resetInitSegment=function(_,b,d){x.prototype.resetInitSegment.call(this,_,b,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:_,duration:d,inputTimeScale:9e4,dropped:0}},A.probe=function(_){if(!_)return!1;for(var b=j.getID3Data(_,0)||[],d=b.length,s=_.length;d<s;d++)if(M.probe(_,d))return P.logger.log("ADTS sync word found !"),!0;return!1},O.canParse=function(_,b){return M.canParse(_,b)},O.appendFrame=function(_,b,d){M.initTrackConfig(_,this.observer,b,d,_.manifestCodec);var s=M.appendFrame(_,b,d,this.initPTS,this.frameIndex);if(s&&s.missing===0)return s},A}(K.default);R.minProbeByteLength=9,V.default=R},"./src/demux/adts.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"getAudioConfig",function(){return j}),L.d(V,"isHeaderPattern",function(){return k}),L.d(V,"getHeaderLength",function(){return C}),L.d(V,"getFullFrameLength",function(){return R}),L.d(V,"canGetFrameLength",function(){return x}),L.d(V,"isHeader",function(){return A}),L.d(V,"canParse",function(){return O}),L.d(V,"probe",function(){return S}),L.d(V,"initTrackConfig",function(){return _}),L.d(V,"getFrameDuration",function(){return b}),L.d(V,"parseFrameHeader",function(){return d}),L.d(V,"appendFrame",function(){return s});var K=L("./src/utils/logger.ts"),M=L("./src/errors.ts"),P=L("./src/events.ts");function j(u,h,E,m){var g,w,y,p,c=navigator.userAgent.toLowerCase(),l=m,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];g=((h[E+2]&192)>>>6)+1;var f=(h[E+2]&60)>>>2;if(f>a.length-1){u.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+f});return}return y=(h[E+2]&1)<<2,y|=(h[E+3]&192)>>>6,K.logger.log("manifest codec:"+m+", ADTS type:"+g+", samplingIndex:"+f),/firefox/i.test(c)?f>=6?(g=5,p=new Array(4),w=f-3):(g=2,p=new Array(2),w=f):c.indexOf("android")!==-1?(g=2,p=new Array(2),w=f):(g=5,p=new Array(4),m&&(m.indexOf("mp4a.40.29")!==-1||m.indexOf("mp4a.40.5")!==-1)||!m&&f>=6?w=f-3:((m&&m.indexOf("mp4a.40.2")!==-1&&(f>=6&&y===1||/vivaldi/i.test(c))||!m&&y===1)&&(g=2,p=new Array(2)),w=f)),p[0]=g<<3,p[0]|=(f&14)>>1,p[1]|=(f&1)<<7,p[1]|=y<<3,g===5&&(p[1]|=(w&14)>>1,p[2]=(w&1)<<7,p[2]|=2<<2,p[3]=0),{config:p,samplerate:a[f],channelCount:y,codec:"mp4a.40."+g,manifestCodec:l}}function k(u,h){return u[h]===255&&(u[h+1]&246)===240}function C(u,h){return u[h+1]&1?7:9}function R(u,h){return(u[h+3]&3)<<11|u[h+4]<<3|(u[h+5]&224)>>>5}function x(u,h){return h+5<u.length}function A(u,h){return h+1<u.length&&k(u,h)}function O(u,h){return x(u,h)&&k(u,h)&&R(u,h)<=u.length-h}function S(u,h){if(A(u,h)){var E=C(u,h);if(h+E>=u.length)return!1;var m=R(u,h);if(m<=E)return!1;var g=h+m;return g===u.length||A(u,g)}return!1}function _(u,h,E,m,g){if(!u.samplerate){var w=j(h,E,m,g);if(!w)return;u.config=w.config,u.samplerate=w.samplerate,u.channelCount=w.channelCount,u.codec=w.codec,u.manifestCodec=w.manifestCodec,K.logger.log("parsed codec:"+u.codec+", rate:"+w.samplerate+", channels:"+w.channelCount)}}function b(u){return 1024*9e4/u}function d(u,h,E,m,g){var w=C(u,h),y=R(u,h);if(y-=w,y>0){var p=E+m*g;return{headerLength:w,frameLength:y,stamp:p}}}function s(u,h,E,m,g){var w=b(u.samplerate),y=d(h,E,m,g,w);if(y){var p=y.frameLength,c=y.headerLength,l=y.stamp,a=c+p,f=Math.max(0,E+a-h.length),o;f?(o=new Uint8Array(a-c),o.set(h.subarray(E+c,h.length),0)):o=h.subarray(E+c,E+a);var v={unit:o,pts:l};return f||u.samples.push(v),{sample:v,length:a,missing:f}}}},"./src/demux/base-audio-demuxer.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"initPTSFn",function(){return R});var K=L("./src/polyfills/number.ts"),M=L("./src/demux/id3.ts"),P=L("./src/demux/dummy-demuxed-track.ts"),j=L("./src/utils/mp4-tools.ts"),k=L("./src/utils/typed-array.ts"),C=function(){function x(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var A=x.prototype;return A.resetInitSegment=function(S,_,b){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},A.resetTimeStamp=function(){},A.resetContiguity=function(){},A.canParse=function(S,_){return!1},A.appendFrame=function(S,_,b){},A.demux=function(S,_){this.cachedData&&(S=Object(j.appendUint8Array)(this.cachedData,S),this.cachedData=null);var b=M.getID3Data(S,0),d=b?b.length:0,s,u,h=this._audioTrack,E=this._id3Track,m=b?M.getTimeStamp(b):void 0,g=S.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=R(m,_)),b&&b.length>0&&E.samples.push({pts:this.initPTS,dts:this.initPTS,data:b}),u=this.initPTS;d<g;){if(this.canParse(S,d)){var w=this.appendFrame(h,S,d);w?(this.frameIndex++,u=w.sample.pts,d+=w.length,s=d):d=g}else M.canParse(S,d)?(b=M.getID3Data(S,d),E.samples.push({pts:u,dts:u,data:b}),d+=b.length,s=d):d++;if(d===g&&s!==g){var y=Object(k.sliceUint8)(S,s);this.cachedData?this.cachedData=Object(j.appendUint8Array)(this.cachedData,y):this.cachedData=y}}return{audioTrack:h,avcTrack:Object(P.dummyTrack)(),id3Track:E,textTrack:Object(P.dummyTrack)()}},A.demuxSampleAes=function(S,_,b){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},A.flush=function(S){var _=this.cachedData;return _&&(this.cachedData=null,this.demux(_,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(P.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(P.dummyTrack)()}},A.destroy=function(){},x}(),R=function(A,O){return Object(K.isFiniteNumber)(A)?A*90:O*9e4};V.default=C},"./src/demux/chunk-cache.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return K});var K=function(){function P(){this.chunks=[],this.dataLength=0}var j=P.prototype;return j.push=function(C){this.chunks.push(C),this.dataLength+=C.length},j.flush=function(){var C=this.chunks,R=this.dataLength,x;if(C.length)C.length===1?x=C[0]:x=M(C,R);else return new Uint8Array(0);return this.reset(),x},j.reset=function(){this.chunks.length=0,this.dataLength=0},P}();function M(P,j){for(var k=new Uint8Array(j),C=0,R=0;R<P.length;R++){var x=P[R];k.set(x,C),C+=x.length}return k}},"./src/demux/dummy-demuxed-track.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"dummyTrack",function(){return K});function K(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(re,V,L){"use strict";L.r(V);var K=L("./src/utils/logger.ts"),M=function(){function P(k){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=k,this.bytesAvailable=k.byteLength,this.word=0,this.bitsAvailable=0}var j=P.prototype;return j.loadWord=function(){var C=this.data,R=this.bytesAvailable,x=C.byteLength-R,A=new Uint8Array(4),O=Math.min(4,R);if(O===0)throw new Error("no bytes available");A.set(C.subarray(x,x+O)),this.word=new DataView(A.buffer).getUint32(0),this.bitsAvailable=O*8,this.bytesAvailable-=O},j.skipBits=function(C){var R;this.bitsAvailable>C?(this.word<<=C,this.bitsAvailable-=C):(C-=this.bitsAvailable,R=C>>3,C-=R>>3,this.bytesAvailable-=R,this.loadWord(),this.word<<=C,this.bitsAvailable-=C)},j.readBits=function(C){var R=Math.min(this.bitsAvailable,C),x=this.word>>>32-R;return C>32&&K.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=R,this.bitsAvailable>0?this.word<<=R:this.bytesAvailable>0&&this.loadWord(),R=C-R,R>0&&this.bitsAvailable?x<<R|this.readBits(R):x},j.skipLZ=function(){var C;for(C=0;C<this.bitsAvailable;++C)if((this.word&2147483648>>>C)!==0)return this.word<<=C,this.bitsAvailable-=C,C;return this.loadWord(),C+this.skipLZ()},j.skipUEG=function(){this.skipBits(1+this.skipLZ())},j.skipEG=function(){this.skipBits(1+this.skipLZ())},j.readUEG=function(){var C=this.skipLZ();return this.readBits(C+1)-1},j.readEG=function(){var C=this.readUEG();return 1&C?1+C>>>1:-1*(C>>>1)},j.readBoolean=function(){return this.readBits(1)===1},j.readUByte=function(){return this.readBits(8)},j.readUShort=function(){return this.readBits(16)},j.readUInt=function(){return this.readBits(32)},j.skipScalingList=function(C){for(var R=8,x=8,A,O=0;O<C;O++)x!==0&&(A=this.readEG(),x=(R+A+256)%256),R=x===0?R:x},j.readSPS=function(){var C=0,R=0,x=0,A=0,O,S,_,b=this.readUByte.bind(this),d=this.readBits.bind(this),s=this.readUEG.bind(this),u=this.readBoolean.bind(this),h=this.skipBits.bind(this),E=this.skipEG.bind(this),m=this.skipUEG.bind(this),g=this.skipScalingList.bind(this);b();var w=b();if(d(5),h(3),b(),m(),w===100||w===110||w===122||w===244||w===44||w===83||w===86||w===118||w===128){var y=s();if(y===3&&h(1),m(),m(),h(1),u())for(S=y!==3?8:12,_=0;_<S;_++)u()&&(_<6?g(16):g(64))}m();var p=s();if(p===0)s();else if(p===1)for(h(1),E(),E(),O=s(),_=0;_<O;_++)E();m(),h(1);var c=s(),l=s(),a=d(1);a===0&&h(1),h(1),u()&&(C=s(),R=s(),x=s(),A=s());var f=[1,1];if(u()&&u()){var o=b();switch(o){case 1:f=[1,1];break;case 2:f=[12,11];break;case 3:f=[10,11];break;case 4:f=[16,11];break;case 5:f=[40,33];break;case 6:f=[24,11];break;case 7:f=[20,11];break;case 8:f=[32,11];break;case 9:f=[80,33];break;case 10:f=[18,11];break;case 11:f=[15,11];break;case 12:f=[64,33];break;case 13:f=[160,99];break;case 14:f=[4,3];break;case 15:f=[3,2];break;case 16:f=[2,1];break;case 255:{f=[b()<<8|b(),b()<<8|b()];break}}}return{width:Math.ceil((c+1)*16-C*2-R*2),height:(2-a)*(l+1)*16-(a?2:4)*(x+A),pixelRatio:f}},j.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},P}();V.default=M},"./src/demux/id3.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"isHeader",function(){return K}),L.d(V,"isFooter",function(){return M}),L.d(V,"getID3Data",function(){return P}),L.d(V,"canParse",function(){return k}),L.d(V,"getTimeStamp",function(){return C}),L.d(V,"isTimeStampFrame",function(){return R}),L.d(V,"getID3Frames",function(){return A}),L.d(V,"decodeFrame",function(){return O}),L.d(V,"utf8ArrayToStr",function(){return s}),L.d(V,"testables",function(){return u});var K=function(g,w){return w+10<=g.length&&(g[w]===73&&g[w+1]===68&&g[w+2]===51&&(g[w+3]<255&&g[w+4]<255&&(g[w+6]<128&&g[w+7]<128&&g[w+8]<128&&g[w+9]<128)))},M=function(g,w){return w+10<=g.length&&(g[w]===51&&g[w+1]===68&&g[w+2]===73&&(g[w+3]<255&&g[w+4]<255&&(g[w+6]<128&&g[w+7]<128&&g[w+8]<128&&g[w+9]<128)))},P=function(g,w){for(var y=w,p=0;K(g,w);){p+=10;var c=j(g,w+6);p+=c,M(g,w+10)&&(p+=10),w+=p}return p>0?g.subarray(y,y+p):void 0},j=function(g,w){var y=0;return y=(g[w]&127)<<21,y|=(g[w+1]&127)<<14,y|=(g[w+2]&127)<<7,y|=g[w+3]&127,y},k=function(g,w){return K(g,w)&&j(g,w+6)+10<=g.length-w},C=function(g){for(var w=A(g),y=0;y<w.length;y++){var p=w[y];if(R(p))return d(p)}return},R=function(g){return g&&g.key==="PRIV"&&g.info==="com.apple.streaming.transportStreamTimestamp"},x=function(g){var w=String.fromCharCode(g[0],g[1],g[2],g[3]),y=j(g,4),p=10;return{type:w,size:y,data:g.subarray(p,p+y)}},A=function(g){for(var w=0,y=[];K(g,w);){var p=j(g,w+6);w+=10;for(var c=w+p;w+8<c;){var l=x(g.subarray(w)),a=O(l);a&&y.push(a),w+=l.size+10}M(g,w)&&(w+=10)}return y},O=function(g){return g.type==="PRIV"?S(g):g.type[0]==="W"?b(g):_(g)},S=function(g){if(g.size<2)return;var w=s(g.data,!0),y=new Uint8Array(g.data.subarray(w.length+1));return{key:g.type,info:w,data:y.buffer}},_=function(g){if(g.size<2)return;if(g.type==="TXXX"){var w=1,y=s(g.data.subarray(w),!0);w+=y.length+1;var p=s(g.data.subarray(w));return{key:g.type,info:y,data:p}}var c=s(g.data.subarray(1));return{key:g.type,data:c}},b=function(g){if(g.type==="WXXX"){if(g.size<2)return;var w=1,y=s(g.data.subarray(w),!0);w+=y.length+1;var p=s(g.data.subarray(w));return{key:g.type,info:y,data:p}}var c=s(g.data);return{key:g.type,data:c}},d=function(g){if(g.data.byteLength===8){var w=new Uint8Array(g.data),y=w[3]&1,p=(w[4]<<23)+(w[5]<<15)+(w[6]<<7)+w[7];return p/=45,y&&(p+=4772185884e-2),Math.round(p)}return},s=function(g,w){w===void 0&&(w=!1);var y=E();if(y){var p=y.decode(g);if(w){var c=p.indexOf("\0");return c!==-1?p.substring(0,c):p}return p.replace(/\0/g,"")}for(var l=g.length,a,f,o,v="",D=0;D<l;){if(a=g[D++],a===0&&w)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:f=g[D++],v+=String.fromCharCode((a&31)<<6|f&63);break;case 14:f=g[D++],o=g[D++],v+=String.fromCharCode((a&15)<<12|(f&63)<<6|(o&63)<<0);break;default:}}return v},u={decodeTextFrame:_},h;function E(){return!h&&typeof self.TextDecoder!="undefined"&&(h=new self.TextDecoder("utf-8")),h}},"./src/demux/mp3demuxer.ts":function(re,V,L){"use strict";L.r(V);var K=L("./src/demux/base-audio-demuxer.ts"),M=L("./src/demux/id3.ts"),P=L("./src/utils/logger.ts"),j=L("./src/demux/mpegaudio.ts");function k(x,A){x.prototype=Object.create(A.prototype),x.prototype.constructor=x,C(x,A)}function C(x,A){return C=Object.setPrototypeOf||function(S,_){return S.__proto__=_,S},C(x,A)}var R=function(x){k(A,x);function A(){return x.apply(this,arguments)||this}var O=A.prototype;return O.resetInitSegment=function(_,b,d){x.prototype.resetInitSegment.call(this,_,b,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:_,duration:d,inputTimeScale:9e4,dropped:0}},A.probe=function(_){if(!_)return!1;for(var b=M.getID3Data(_,0)||[],d=b.length,s=_.length;d<s;d++)if(j.probe(_,d))return P.logger.log("MPEG Audio sync word found !"),!0;return!1},O.canParse=function(_,b){return j.canParse(_,b)},O.appendFrame=function(_,b,d){return this.initPTS===null?void 0:j.appendFrame(_,b,d,this.initPTS,this.frameIndex)},A}(K.default);R.minProbeByteLength=4,V.default=R},"./src/demux/mp4demuxer.ts":function(re,V,L){"use strict";L.r(V);var K=L("./src/utils/mp4-tools.ts"),M=L("./src/demux/dummy-demuxed-track.ts"),P=function(){function j(C,R){this.remainderData=null,this.config=void 0,this.config=R}var k=j.prototype;return k.resetTimeStamp=function(){},k.resetInitSegment=function(){},k.resetContiguity=function(){},j.probe=function(R){return Object(K.findBox)({data:R,start:0,end:Math.min(R.length,16384)},["moof"]).length>0},k.demux=function(R){var x=R,A=Object(M.dummyTrack)();if(this.config.progressive){this.remainderData&&(x=Object(K.appendUint8Array)(this.remainderData,R));var O=Object(K.segmentValidRange)(x);this.remainderData=O.remainder,A.samples=O.valid||new Uint8Array}else A.samples=x;return{audioTrack:Object(M.dummyTrack)(),avcTrack:A,id3Track:Object(M.dummyTrack)(),textTrack:Object(M.dummyTrack)()}},k.flush=function(){var R=Object(M.dummyTrack)();return R.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(M.dummyTrack)(),avcTrack:R,id3Track:Object(M.dummyTrack)(),textTrack:Object(M.dummyTrack)()}},k.demuxSampleAes=function(R,x,A){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},k.destroy=function(){},j}();P.minProbeByteLength=1024,V.default=P},"./src/demux/mpegaudio.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"appendFrame",function(){return C}),L.d(V,"parseHeader",function(){return R}),L.d(V,"isHeaderPattern",function(){return x}),L.d(V,"isHeader",function(){return A}),L.d(V,"canParse",function(){return O}),L.d(V,"probe",function(){return S});var K=null,M=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],P=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],j=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],k=[0,1,1,4];function C(_,b,d,s,u){if(d+24>b.length)return;var h=R(b,d);if(h&&d+h.frameLength<=b.length){var E=h.samplesPerFrame*9e4/h.sampleRate,m=s+u*E,g={unit:b.subarray(d,d+h.frameLength),pts:m,dts:m};return _.config=[],_.channelCount=h.channelCount,_.samplerate=h.sampleRate,_.samples.push(g),{sample:g,length:h.frameLength,missing:0}}}function R(_,b){var d=_[b+1]>>3&3,s=_[b+1]>>1&3,u=_[b+2]>>4&15,h=_[b+2]>>2&3;if(d!==1&&u!==0&&u!==15&&h!==3){var E=_[b+2]>>1&1,m=_[b+3]>>6,g=d===3?3-s:s===3?3:4,w=M[g*14+u-1]*1e3,y=d===3?0:d===2?1:2,p=P[y*3+h],c=m===3?1:2,l=j[d][s],a=k[s],f=l*8*a,o=Math.floor(l*w/p+E)*a;if(K===null){var v=navigator.userAgent||"",D=v.match(/Chrome\/(\d+)/i);K=D?parseInt(D[1]):0}var N=!!K&&K<=87;return N&&s===2&&w>=224e3&&m===0&&(_[b+3]=_[b+3]|128),{sampleRate:p,channelCount:c,frameLength:o,samplesPerFrame:f}}}function x(_,b){return _[b]===255&&(_[b+1]&224)===224&&(_[b+1]&6)!==0}function A(_,b){return b+1<_.length&&x(_,b)}function O(_,b){var d=4;return x(_,b)&&d<=_.length-b}function S(_,b){if(b+1<_.length&&x(_,b)){var d=4,s=R(_,b),u=d;s!=null&&s.frameLength&&(u=s.frameLength);var h=b+u;return h===_.length||A(_,h)}return!1}},"./src/demux/sample-aes.ts":function(re,V,L){"use strict";L.r(V);var K=L("./src/crypt/decrypter.ts"),M=L("./src/demux/tsdemuxer.ts"),P=function(){function j(C,R,x){this.keyData=void 0,this.decrypter=void 0,this.keyData=x,this.decrypter=new K.default(C,R,{removePKCS7Padding:!1})}var k=j.prototype;return k.decryptBuffer=function(R,x){this.decrypter.decrypt(R,this.keyData.key.buffer,this.keyData.iv.buffer,x)},k.decryptAacSample=function(R,x,A,O){var S=R[x].unit,_=S.subarray(16,S.length-S.length%16),b=_.buffer.slice(_.byteOffset,_.byteOffset+_.length),d=this;this.decryptBuffer(b,function(s){var u=new Uint8Array(s);S.set(u,16),O||d.decryptAacSamples(R,x+1,A)})},k.decryptAacSamples=function(R,x,A){for(;;x++){if(x>=R.length){A();return}if(R[x].unit.length<32)continue;var O=this.decrypter.isSync();if(this.decryptAacSample(R,x,A,O),!O)return}},k.getAvcEncryptedData=function(R){for(var x=Math.floor((R.length-48)/160)*16+16,A=new Int8Array(x),O=0,S=32;S<=R.length-16;S+=160,O+=16)A.set(R.subarray(S,S+16),O);return A},k.getAvcDecryptedUnit=function(R,x){for(var A=new Uint8Array(x),O=0,S=32;S<=R.length-16;S+=160,O+=16)R.set(A.subarray(O,O+16),S);return R},k.decryptAvcSample=function(R,x,A,O,S,_){var b=Object(M.discardEPB)(S.data),d=this.getAvcEncryptedData(b),s=this;this.decryptBuffer(d.buffer,function(u){S.data=s.getAvcDecryptedUnit(b,u),_||s.decryptAvcSamples(R,x,A+1,O)})},k.decryptAvcSamples=function(R,x,A,O){if(R instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;x++,A=0){if(x>=R.length){O();return}for(var S=R[x].units;!(A>=S.length);A++){var _=S[A];if(_.data.length<=48||_.type!==1&&_.type!==5)continue;var b=this.decrypter.isSync();if(this.decryptAvcSample(R,x,A,O,_,b),!b)return}}},j}();V.default=P},"./src/demux/transmuxer-interface.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return S});var K=L("./node_modules/webworkify-webpack/index.js"),M=L.n(K),P=L("./src/events.ts"),j=L("./src/demux/transmuxer.ts"),k=L("./src/utils/logger.ts"),C=L("./src/errors.ts"),R=L("./src/utils/mediasource-helper.ts"),x=L("./node_modules/eventemitter3/index.js"),A=L.n(x),O=Object(R.getMediaSource)()||{isTypeSupported:function(){return!1}},S=function(){function _(d,s,u,h){var E=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=d,this.id=s,this.onTransmuxComplete=u,this.onFlush=h;var m=d.config,g=function(l,a){a=a||{},a.frag=E.frag,a.id=E.id,d.trigger(l,a)};this.observer=new x.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,g),this.observer.on(P.Events.ERROR,g);var w={mp4:O.isTypeSupported("video/mp4"),mpeg:O.isTypeSupported("audio/mpeg"),mp3:O.isTypeSupported('audio/mp4; codecs="mp3"')},y=navigator.vendor;if(m.enableWorker&&typeof Worker!="undefined"){k.logger.log("demuxing in webworker");var p;try{p=this.worker=K("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),p.addEventListener("message",this.onwmsg),p.onerror=function(c){d.trigger(P.Events.ERROR,{type:C.ErrorTypes.OTHER_ERROR,details:C.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},p.postMessage({cmd:"init",typeSupported:w,vendor:y,id:s,config:JSON.stringify(m)})}catch(c){k.logger.warn("Error in worker:",c),k.logger.error("Error while initializing DemuxerWorker, fallback to inline"),p&&self.URL.revokeObjectURL(p.objectURL),this.transmuxer=new j.default(this.observer,w,m,y,s),this.worker=null}}else this.transmuxer=new j.default(this.observer,w,m,y,s)}var b=_.prototype;return b.destroy=function(){var s=this.worker;if(s)s.removeEventListener("message",this.onwmsg),s.terminate(),this.worker=null;else{var u=this.transmuxer;u&&(u.destroy(),this.transmuxer=null)}var h=this.observer;h&&h.removeAllListeners(),this.observer=null},b.push=function(s,u,h,E,m,g,w,y,p,c){var l=this;p.transmuxing.start=self.performance.now();var a=this.transmuxer,f=this.worker,o=g?g.start:m.start,v=m.decryptdata,D=this.frag,N=!(D&&m.cc===D.cc),W=!(D&&p.level===D.level),z=D?p.sn-D.sn:-1,F=this.part?p.part-this.part.index:1,I=!W&&(z===1||z===0&&F===1),B=self.performance.now();(W||z||m.stats.parsing.start===0)&&(m.stats.parsing.start=B),g&&(F||!I)&&(g.stats.parsing.start=B);var Y=new j.TransmuxState(N,I,y,W,o);if(!I||N){k.logger.log("[transmuxer-interface, "+m.type+"]: Starting new transmux session for sn: "+p.sn+" p: "+p.part+" level: "+p.level+" id: "+p.id+`
|
|
discontinuity: `+N+`
|
|
trackSwitch: `+W+`
|
|
contiguous: `+I+`
|
|
accurateTimeOffset: `+y+`
|
|
timeOffset: `+o);var Q=new j.TransmuxConfig(h,E,u,w,c);this.configureTransmuxer(Q)}if(this.frag=m,this.part=g,f)f.postMessage({cmd:"demux",data:s,decryptdata:v,chunkMeta:p,state:Y},s instanceof ArrayBuffer?[s]:[]);else if(a){var ee=a.push(s,v,p,Y);Object(j.isPromise)(ee)?ee.then(function(fe){l.handleTransmuxComplete(fe)}):this.handleTransmuxComplete(ee)}},b.flush=function(s){var u=this;s.transmuxing.start=self.performance.now();var h=this.transmuxer,E=this.worker;if(E)E.postMessage({cmd:"flush",chunkMeta:s});else if(h){var m=h.flush(s);Object(j.isPromise)(m)?m.then(function(g){u.handleFlushResult(g,s)}):this.handleFlushResult(m,s)}},b.handleFlushResult=function(s,u){var h=this;s.forEach(function(E){h.handleTransmuxComplete(E)}),this.onFlush(u)},b.onWorkerMessage=function(s){var u=s.data,h=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,h.trigger(u.event,u.data);break}}},b.configureTransmuxer=function(s){var u=this.worker,h=this.transmuxer;u?u.postMessage({cmd:"configure",config:s}):h&&h.configure(s)},b.handleTransmuxComplete=function(s){s.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(s)},_}()},"./src/demux/transmuxer-worker.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return C});var K=L("./src/demux/transmuxer.ts"),M=L("./src/events.ts"),P=L("./src/utils/logger.ts"),j=L("./node_modules/eventemitter3/index.js"),k=L.n(j);function C(S){var _=new j.EventEmitter,b=function(s,u){S.postMessage({event:s,data:u})};_.on(M.Events.FRAG_DECRYPTED,b),_.on(M.Events.ERROR,b),S.addEventListener("message",function(d){var s=d.data;switch(s.cmd){case"init":{var u=JSON.parse(s.config);S.transmuxer=new K.default(_,s.typeSupported,u,s.vendor,s.id),Object(P.enableLogs)(u.debug),b("init",null);break}case"configure":{S.transmuxer.configure(s.config);break}case"demux":{var h=S.transmuxer.push(s.data,s.decryptdata,s.chunkMeta,s.state);Object(K.isPromise)(h)?h.then(function(g){R(S,g)}):R(S,h);break}case"flush":{var E=s.chunkMeta,m=S.transmuxer.flush(E);Object(K.isPromise)(m)?m.then(function(g){A(S,g,E)}):A(S,m,E);break}default:break}})}function R(S,_){if(O(_.remuxResult))return;var b=[],d=_.remuxResult,s=d.audio,u=d.video;s&&x(b,s),u&&x(b,u),S.postMessage({event:"transmuxComplete",data:_},b)}function x(S,_){_.data1&&S.push(_.data1.buffer),_.data2&&S.push(_.data2.buffer)}function A(S,_,b){_.forEach(function(d){R(S,d)}),S.postMessage({event:"flush",data:b})}function O(S){return!S.audio&&!S.video&&!S.text&&!S.id3&&!S.initSegment}},"./src/demux/transmuxer.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return u}),L.d(V,"isPromise",function(){return m}),L.d(V,"TransmuxConfig",function(){return g}),L.d(V,"TransmuxState",function(){return w});var K=L("./src/events.ts"),M=L("./src/errors.ts"),P=L("./src/crypt/decrypter.ts"),j=L("./src/demux/aacdemuxer.ts"),k=L("./src/demux/mp4demuxer.ts"),C=L("./src/demux/tsdemuxer.ts"),R=L("./src/demux/mp3demuxer.ts"),x=L("./src/remux/mp4-remuxer.ts"),A=L("./src/remux/passthrough-remuxer.ts"),O=L("./src/demux/chunk-cache.ts"),S=L("./src/utils/mp4-tools.ts"),_=L("./src/utils/logger.ts"),b;try{b=self.performance.now.bind(self.performance)}catch(y){_.logger.debug("Unable to use Performance API on this environment"),b=self.Date.now}var d=[{demux:C.default,remux:x.default},{demux:k.default,remux:A.default},{demux:j.default,remux:x.default},{demux:R.default,remux:x.default}],s=1024;d.forEach(function(y){var p=y.demux;s=Math.max(s,p.minProbeByteLength)});var u=function(){function y(c,l,a,f,o){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new O.default,this.observer=c,this.typeSupported=l,this.config=a,this.vendor=f,this.id=o}var p=y.prototype;return p.configure=function(l){this.transmuxConfig=l,this.decrypter&&this.decrypter.reset()},p.push=function(l,a,f,o){var v=this,D=f.transmuxing;D.executeStart=b();var N=new Uint8Array(l),W=this.cache,z=this.config,F=this.currentTransmuxState,I=this.transmuxConfig;o&&(this.currentTransmuxState=o);var B=h(N,a);if(B&&B.method==="AES-128"){var Y=this.getDecrypter();if(z.enableSoftwareAES){var Q=Y.softwareDecrypt(N,B.key.buffer,B.iv.buffer);if(!Q)return D.executeEnd=b(),E(f);N=new Uint8Array(Q)}else return this.decryptionPromise=Y.webCryptoDecrypt(N,B.key.buffer,B.iv.buffer).then(function(Le){var Fe=v.push(Le,null,f);return v.decryptionPromise=null,Fe}),this.decryptionPromise}var ee=o||F,fe=ee.contiguous,ce=ee.discontinuity,ge=ee.trackSwitch,pe=ee.accurateTimeOffset,ue=ee.timeOffset,le=I.audioCodec,de=I.videoCodec,ye=I.defaultInitPts,Me=I.duration,Ue=I.initSegmentData;if((ce||ge)&&this.resetInitSegment(Ue,le,de,Me),ce&&this.resetInitialTimestamp(ye),fe||this.resetContiguity(),this.needsProbing(N,ce,ge)){if(W.dataLength){var Re=W.flush();N=Object(S.appendUint8Array)(Re,N)}this.configureTransmuxer(N,I)}var Oe=this.transmux(N,B,ue,pe,f),Ce=this.currentTransmuxState;return Ce.contiguous=!0,Ce.discontinuity=!1,Ce.trackSwitch=!1,D.executeEnd=b(),Oe},p.flush=function(l){var a=this,f=l.transmuxing;f.executeStart=b();var o=this.decrypter,v=this.cache,D=this.currentTransmuxState,N=this.decryptionPromise;if(N)return N.then(function(){return a.flush(l)});var W=[],z=D.timeOffset;if(o){var F=o.flush();F&&W.push(this.push(F,null,l))}var I=v.dataLength;v.reset();var B=this.demuxer,Y=this.remuxer;if(!B||!Y)return I>=s&&this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),f.executeEnd=b(),[E(l)];var Q=B.flush(z);return m(Q)?Q.then(function(ee){return a.flushRemux(W,ee,l),W}):(this.flushRemux(W,Q,l),W)},p.flushRemux=function(l,a,f){var o=a.audioTrack,v=a.avcTrack,D=a.id3Track,N=a.textTrack,W=this.currentTransmuxState,z=W.accurateTimeOffset,F=W.timeOffset;_.logger.log("[transmuxer.ts]: Flushed fragment "+f.sn+(f.part>-1?" p: "+f.part:"")+" of level "+f.level);var I=this.remuxer.remux(o,v,D,N,F,z,!0,this.id);l.push({remuxResult:I,chunkMeta:f}),f.transmuxing.executeEnd=b()},p.resetInitialTimestamp=function(l){var a=this.demuxer,f=this.remuxer;if(!a||!f)return;a.resetTimeStamp(l),f.resetTimeStamp(l)},p.resetContiguity=function(){var l=this.demuxer,a=this.remuxer;if(!l||!a)return;l.resetContiguity(),a.resetNextTimestamp()},p.resetInitSegment=function(l,a,f,o){var v=this.demuxer,D=this.remuxer;if(!v||!D)return;v.resetInitSegment(a,f,o),D.resetInitSegment(l,a,f)},p.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},p.transmux=function(l,a,f,o,v){var D;return a&&a.method==="SAMPLE-AES"?D=this.transmuxSampleAes(l,a,f,o,v):D=this.transmuxUnencrypted(l,f,o,v),D},p.transmuxUnencrypted=function(l,a,f,o){var v=this.demuxer.demux(l,a,!1,!this.config.progressive),D=v.audioTrack,N=v.avcTrack,W=v.id3Track,z=v.textTrack,F=this.remuxer.remux(D,N,W,z,a,f,!1,this.id);return{remuxResult:F,chunkMeta:o}},p.transmuxSampleAes=function(l,a,f,o,v){var D=this;return this.demuxer.demuxSampleAes(l,a,f).then(function(N){var W=D.remuxer.remux(N.audioTrack,N.avcTrack,N.id3Track,N.textTrack,f,o,!1,D.id);return{remuxResult:W,chunkMeta:v}})},p.configureTransmuxer=function(l,a){for(var f=this.config,o=this.observer,v=this.typeSupported,D=this.vendor,N=a.audioCodec,W=a.defaultInitPts,z=a.duration,F=a.initSegmentData,I=a.videoCodec,B,Y=0,Q=d.length;Y<Q;Y++)if(d[Y].demux.probe(l)){B=d[Y];break}B||(_.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),B={demux:k.default,remux:A.default});var ee=this.demuxer,fe=this.remuxer,ce=B.remux,ge=B.demux;(!fe||!(fe instanceof ce))&&(this.remuxer=new ce(o,f,v,D)),(!ee||!(ee instanceof ge))&&(this.demuxer=new ge(o,f,v),this.probe=ge.probe),this.resetInitSegment(F,N,I,z),this.resetInitialTimestamp(W)},p.needsProbing=function(l,a,f){return!this.demuxer||!this.remuxer||a||f},p.getDecrypter=function(){var l=this.decrypter;return l||(l=this.decrypter=new P.default(this.observer,this.config)),l},y}();function h(y,p){var c=null;return y.byteLength>0&&p!=null&&p.key!=null&&p.iv!==null&&p.method!=null&&(c=p),c}var E=function(p){return{remuxResult:{},chunkMeta:p}};function m(y){return"then"in y&&y.then instanceof Function}var g=function(p,c,l,a,f){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=p,this.videoCodec=c,this.initSegmentData=l,this.duration=a,this.defaultInitPts=f},w=function(p,c,l,a,f){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=p,this.contiguous=c,this.accurateTimeOffset=l,this.trackSwitch=a,this.timeOffset=f}},"./src/demux/tsdemuxer.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"discardEPB",function(){return E});var K=L("./src/demux/adts.ts"),M=L("./src/demux/mpegaudio.ts"),P=L("./src/demux/exp-golomb.ts"),j=L("./src/demux/id3.ts"),k=L("./src/demux/sample-aes.ts"),C=L("./src/events.ts"),R=L("./src/utils/mp4-tools.ts"),x=L("./src/utils/logger.ts"),A=L("./src/errors.ts"),O={video:1,audio:2,id3:3,text:4},S=function(){function m(w,y,p){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=w,this.config=y,this.typeSupported=p}m.probe=function(y){var p=m.syncOffset(y);return p<0?!1:(p&&x.logger.warn("MPEG2-TS detected but first sync word found @ offset "+p+", junk ahead ?"),!0)},m.syncOffset=function(y){for(var p=Math.min(1e3,y.length-3*188),c=0;c<p;){if(y[c]===71&&y[c+188]===71&&y[c+2*188]===71)return c;c++}return-1},m.createTrack=function(y,p){return{container:y==="video"||y==="audio"?"video/mp2t":void 0,type:y,id:O[y],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:y==="audio"?p:void 0}};var g=m.prototype;return g.resetInitSegment=function(y,p,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=m.createTrack("video",c),this._audioTrack=m.createTrack("audio",c),this._id3Track=m.createTrack("id3",c),this._txtTrack=m.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=y,this.videoCodec=p,this._duration=c},g.resetTimeStamp=function(){},g.resetContiguity=function(){var y=this._audioTrack,p=this._avcTrack,c=this._id3Track;y&&(y.pesData=null),p&&(p.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},g.demux=function(y,p,c,l){c===void 0&&(c=!1),l===void 0&&(l=!1),c||(this.sampleAes=null);var a,f=this._avcTrack,o=this._audioTrack,v=this._id3Track,D=f.pid,N=f.pesData,W=o.pid,z=v.pid,F=o.pesData,I=v.pesData,B=!1,Y=this.pmtParsed,Q=this._pmtId,ee=y.length;if(this.remainderData&&(y=Object(R.appendUint8Array)(this.remainderData,y),ee=y.length,this.remainderData=null),ee<188&&!l)return this.remainderData=y,{audioTrack:o,avcTrack:f,id3Track:v,textTrack:this._txtTrack};var fe=Math.max(0,m.syncOffset(y));ee-=(ee+fe)%188,ee<y.byteLength&&!l&&(this.remainderData=new Uint8Array(y.buffer,ee,y.buffer.byteLength-ee));for(var ce=fe;ce<ee;ce+=188)if(y[ce]===71){var ge=!!(y[ce+1]&64),pe=((y[ce+1]&31)<<8)+y[ce+2],ue=(y[ce+3]&48)>>4,le=void 0;if(ue>1){if(le=ce+5+y[ce+4],le===ce+188)continue}else le=ce+4;switch(pe){case D:ge&&(N&&(a=s(N))&&this.parseAVCPES(a,!1),N={data:[],size:0}),N&&(N.data.push(y.subarray(le,ce+188)),N.size+=ce+188-le);break;case W:ge&&(F&&(a=s(F))&&(o.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),F={data:[],size:0}),F&&(F.data.push(y.subarray(le,ce+188)),F.size+=ce+188-le);break;case z:ge&&(I&&(a=s(I))&&this.parseID3PES(a),I={data:[],size:0}),I&&(I.data.push(y.subarray(le,ce+188)),I.size+=ce+188-le);break;case 0:ge&&(le+=y[le]+1),Q=this._pmtId=b(y,le);break;case Q:{ge&&(le+=y[le]+1);var de=d(y,le,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);D=de.avc,D>0&&(f.pid=D),W=de.audio,W>0&&(o.pid=W,o.isAAC=de.isAAC),z=de.id3,z>0&&(v.pid=z),B&&!Y&&(x.logger.log("reparse from beginning"),B=!1,ce=fe-188),Y=this.pmtParsed=!0;break}case 17:case 8191:break;default:B=!0;break}}else this.observer.emit(C.Events.ERROR,C.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});f.pesData=N,o.pesData=F,v.pesData=I;var ye={audioTrack:o,avcTrack:f,id3Track:v,textTrack:this._txtTrack};return l&&this.extractRemainingSamples(ye),ye},g.flush=function(){var y=this.remainderData;this.remainderData=null;var p;return y?p=this.demux(y,-1,!1,!0):p={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(p),this.sampleAes?this.decrypt(p,this.sampleAes):p},g.extractRemainingSamples=function(y){var p=y.audioTrack,c=y.avcTrack,l=y.id3Track,a=c.pesData,f=p.pesData,o=l.pesData,v;a&&(v=s(a))?(this.parseAVCPES(v,!0),c.pesData=null):c.pesData=a,f&&(v=s(f))?(p.isAAC?this.parseAACPES(v):this.parseMPEGPES(v),p.pesData=null):(f!=null&&f.size&&x.logger.log("last AAC PES packet truncated,might overlap between fragments"),p.pesData=f),o&&(v=s(o))?(this.parseID3PES(v),l.pesData=null):l.pesData=o},g.demuxSampleAes=function(y,p,c){var l=this.demux(y,c,!0,!this.config.progressive),a=this.sampleAes=new k.default(this.observer,this.config,p);return this.decrypt(l,a)},g.decrypt=function(y,p){return new Promise(function(c){var l=y.audioTrack,a=y.avcTrack;l.samples&&l.isAAC?p.decryptAacSamples(l.samples,0,function(){a.samples?p.decryptAvcSamples(a.samples,0,0,function(){c(y)}):c(y)}):a.samples&&p.decryptAvcSamples(a.samples,0,0,function(){c(y)})})},g.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},g.parseAVCPES=function(y,p){var c=this,l=this._avcTrack,a=this.parseAVCNALu(y.data),f=!1,o=this.avcSample,v,D=!1;y.data=null,o&&a.length&&!l.audFound&&(u(o,l),o=this.avcSample=_(!1,y.pts,y.dts,"")),a.forEach(function(N){switch(N.type){case 1:{v=!0,o||(o=c.avcSample=_(!0,y.pts,y.dts,"")),f&&(o.debug+="NDR "),o.frame=!0;var W=N.data;if(D&&W.length>4){var z=new P.default(W).readSliceType();(z===2||z===4||z===7||z===9)&&(o.key=!0)}break}case 5:v=!0,o||(o=c.avcSample=_(!0,y.pts,y.dts,"")),f&&(o.debug+="IDR "),o.key=!0,o.frame=!0;break;case 6:{v=!0,f&&o&&(o.debug+="SEI ");var F=new P.default(E(N.data));F.readUByte();for(var I=0,B=0,Y=!1,Q=0;!Y&&F.bytesAvailable>1;){I=0;do Q=F.readUByte(),I+=Q;while(Q===255);B=0;do Q=F.readUByte(),B+=Q;while(Q===255);if(I===4&&F.bytesAvailable!==0){Y=!0;var ee=F.readUByte();if(ee===181){var fe=F.readUShort();if(fe===49){var ce=F.readUInt();if(ce===1195456820){var ge=F.readUByte();if(ge===3){for(var pe=F.readUByte(),ue=F.readUByte(),le=31&pe,de=[pe,ue],ye=0;ye<le;ye++)de.push(F.readUByte()),de.push(F.readUByte()),de.push(F.readUByte());h(c._txtTrack.samples,{type:3,pts:y.pts,bytes:de})}}}}}else if(I===5&&F.bytesAvailable!==0){if(Y=!0,B>16){for(var Me=[],Ue=0;Ue<16;Ue++)Me.push(F.readUByte().toString(16)),(Ue===3||Ue===5||Ue===7||Ue===9)&&Me.push("-");for(var Re=B-16,Oe=new Uint8Array(Re),Ce=0;Ce<Re;Ce++)Oe[Ce]=F.readUByte();h(c._txtTrack.samples,{pts:y.pts,payloadType:I,uuid:Me.join(""),userData:Object(j.utf8ArrayToStr)(Oe),userDataBytes:Oe})}}else if(B<F.bytesAvailable)for(var Le=0;Le<B;Le++)F.readUByte()}break}case 7:if(v=!0,D=!0,f&&o&&(o.debug+="SPS "),!l.sps){var Fe=new P.default(N.data),We=Fe.readSPS();l.width=We.width,l.height=We.height,l.pixelRatio=We.pixelRatio,l.sps=[N.data],l.duration=c._duration;for(var Be=N.data.subarray(1,4),Ae="avc1.",Se=0;Se<3;Se++){var $e=Be[Se].toString(16);$e.length<2&&($e="0"+$e),Ae+=$e}l.codec=Ae}break;case 8:v=!0,f&&o&&(o.debug+="PPS "),l.pps||(l.pps=[N.data]);break;case 9:v=!1,l.audFound=!0,o&&u(o,l),o=c.avcSample=_(!1,y.pts,y.dts,f?"AUD ":"");break;case 12:v=!1;break;default:v=!1,o&&(o.debug+="unknown NAL "+N.type+" ");break}if(o&&v){var qe=o.units;qe.push(N)}}),p&&o&&(u(o,l),this.avcSample=null)},g.getLastNalUnit=function(){var y,p=this.avcSample,c;if(!p||p.units.length===0){var l=this._avcTrack.samples;p=l[l.length-1]}if((y=p)!==null&&y!==void 0&&y.units){var a=p.units;c=a[a.length-1]}return c},g.parseAVCNALu=function(y){var p=y.byteLength,c=this._avcTrack,l=c.naluState||0,a=l,f=[],o=0,v,D,N,W=-1,z=0;for(l===-1&&(W=0,z=y[0]&31,l=0,o=1);o<p;){if(v=y[o++],!l){l=v?0:1;continue}if(l===1){l=v?0:2;continue}if(!v)l=3;else if(v===1){if(W>=0){var F={data:y.subarray(W,o-l-1),type:z};f.push(F)}else{var I=this.getLastNalUnit();if(I&&(a&&o<=4-a&&(I.state&&(I.data=I.data.subarray(0,I.data.byteLength-a))),D=o-l-1,D>0)){var B=new Uint8Array(I.data.byteLength+D);B.set(I.data,0),B.set(y.subarray(0,D),I.data.byteLength),I.data=B,I.state=0}}o<p?(N=y[o]&31,W=o,z=N,l=0):l=-1}else l=0}if(W>=0&&l>=0){var Y={data:y.subarray(W,p),type:z,state:l};f.push(Y)}if(f.length===0){var Q=this.getLastNalUnit();if(Q){var ee=new Uint8Array(Q.data.byteLength+y.byteLength);ee.set(Q.data,0),ee.set(y,Q.data.byteLength),Q.data=ee}}return c.naluState=l,f},g.parseAACPES=function(y){var p=0,c=this._audioTrack,l=this.aacOverFlow,a=y.data;if(l){this.aacOverFlow=null;var f=l.sample.unit.byteLength,o=Math.min(l.missing,f),v=f-o;l.sample.unit.set(a.subarray(0,o),v),c.samples.push(l.sample),p=l.missing}var D,N;for(D=p,N=a.length;D<N-1&&!K.isHeader(a,D);D++);if(D!==p){var W,z;if(D<N-1?(W="AAC PES did not start with ADTS header,offset:"+D,z=!1):(W="no ADTS header found in AAC PES",z=!0),x.logger.warn("parsing error:"+W),this.observer.emit(C.Events.ERROR,C.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:z,reason:W}),z)return}K.initTrackConfig(c,this.observer,a,D,this.audioCodec);var F;if(y.pts!==void 0)F=y.pts;else if(l){var I=K.getFrameDuration(c.samplerate);F=l.sample.pts+I}else{x.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var B=0;D<N;)if(K.isHeader(a,D)){if(D+5<N){var Y=K.appendFrame(c,a,D,F,B);if(Y)if(Y.missing)this.aacOverFlow=Y;else{D+=Y.length,B++;continue}}break}else D++},g.parseMPEGPES=function(y){var p=y.data,c=p.length,l=0,a=0,f=y.pts;if(f===void 0){x.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(M.isHeader(p,a)){var o=M.appendFrame(this._audioTrack,p,a,f,l);if(o)a+=o.length,l++;else break}else a++},g.parseID3PES=function(y){if(y.pts===void 0){x.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(y)},m}();S.minProbeByteLength=188;function _(m,g,w,y){return{key:m,frame:!1,pts:g,dts:w,units:[],debug:y,length:0}}function b(m,g){return(m[g+10]&31)<<8|m[g+11]}function d(m,g,w,y){var p={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(m[g+1]&15)<<8|m[g+2],l=g+3+c-4,a=(m[g+10]&15)<<8|m[g+11];for(g+=12+a;g<l;){var f=(m[g+1]&31)<<8|m[g+2];switch(m[g]){case 207:if(!y){x.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:p.audio===-1&&(p.audio=f);break;case 21:p.id3===-1&&(p.id3=f);break;case 219:if(!y){x.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:p.avc===-1&&(p.avc=f);break;case 3:case 4:w?p.audio===-1&&(p.audio=f,p.isAAC=!1):x.logger.log("MPEG audio found, not supported in this browser");break;case 36:x.logger.warn("Unsupported HEVC stream type found");break;default:break}g+=((m[g+3]&15)<<8|m[g+4])+5}return p}function s(m){var g=0,w,y,p,c,l,a=m.data;if(!m||m.size===0)return null;for(;a[0].length<19&&a.length>1;){var f=new Uint8Array(a[0].length+a[1].length);f.set(a[0]),f.set(a[1],a[0].length),a[0]=f,a.splice(1,1)}w=a[0];var o=(w[0]<<16)+(w[1]<<8)+w[2];if(o===1){if(y=(w[4]<<8)+w[5],y&&y>m.size-6)return null;var v=w[7];v&192&&(c=(w[9]&14)*536870912+(w[10]&255)*4194304+(w[11]&254)*16384+(w[12]&255)*128+(w[13]&254)/2,v&64?(l=(w[14]&14)*536870912+(w[15]&255)*4194304+(w[16]&254)*16384+(w[17]&255)*128+(w[18]&254)/2,c-l>60*9e4&&(x.logger.warn(Math.round((c-l)/9e4)+"s delta between PTS and DTS, align them"),c=l)):l=c),p=w[8];var D=p+9;if(m.size<=D)return null;m.size-=D;for(var N=new Uint8Array(m.size),W=0,z=a.length;W<z;W++){w=a[W];var F=w.byteLength;if(D)if(D>F){D-=F;continue}else w=w.subarray(D),F-=D,D=0;N.set(w,g),g+=F}return y&&(y-=p+3),{data:N,pts:c,dts:l,len:y}}return null}function u(m,g){if(m.units.length&&m.frame){if(m.pts===void 0){var w=g.samples,y=w.length;if(y){var p=w[y-1];m.pts=p.pts,m.dts=p.dts}else{g.dropped++;return}}g.samples.push(m)}m.debug.length&&x.logger.log(m.pts+"/"+m.dts+":"+m.debug)}function h(m,g){var w=m.length;if(w>0){if(g.pts>=m[w-1].pts)m.push(g);else for(var y=w-1;y>=0;y--)if(g.pts<m[y].pts){m.splice(y,0,g);break}}else m.push(g)}function E(m){for(var g=m.byteLength,w=[],y=1;y<g-2;)m[y]===0&&m[y+1]===0&&m[y+2]===3?(w.push(y+2),y+=2):y++;if(w.length===0)return m;var p=g-w.length,c=new Uint8Array(p),l=0;for(y=0;y<p;l++,y++)l===w[0]&&(l++,w.shift()),c[y]=m[l];return c}V.default=S},"./src/errors.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"ErrorTypes",function(){return K}),L.d(V,"ErrorDetails",function(){return M});var K;(function(P){P.NETWORK_ERROR="networkError",P.MEDIA_ERROR="mediaError",P.KEY_SYSTEM_ERROR="keySystemError",P.MUX_ERROR="muxError",P.OTHER_ERROR="otherError"})(K||(K={}));var M;(function(P){P.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",P.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",P.KEY_SYSTEM_NO_SESSION="keySystemNoSession",P.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",P.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",P.MANIFEST_LOAD_ERROR="manifestLoadError",P.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",P.MANIFEST_PARSING_ERROR="manifestParsingError",P.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",P.LEVEL_EMPTY_ERROR="levelEmptyError",P.LEVEL_LOAD_ERROR="levelLoadError",P.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",P.LEVEL_SWITCH_ERROR="levelSwitchError",P.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",P.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",P.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",P.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",P.FRAG_LOAD_ERROR="fragLoadError",P.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",P.FRAG_DECRYPT_ERROR="fragDecryptError",P.FRAG_PARSING_ERROR="fragParsingError",P.REMUX_ALLOC_ERROR="remuxAllocError",P.KEY_LOAD_ERROR="keyLoadError",P.KEY_LOAD_TIMEOUT="keyLoadTimeOut",P.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",P.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",P.BUFFER_APPEND_ERROR="bufferAppendError",P.BUFFER_APPENDING_ERROR="bufferAppendingError",P.BUFFER_STALLED_ERROR="bufferStalledError",P.BUFFER_FULL_ERROR="bufferFullError",P.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",P.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",P.INTERNAL_EXCEPTION="internalException",P.INTERNAL_ABORTED="aborted",P.UNKNOWN="unknown"})(M||(M={}))},"./src/events.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"Events",function(){return K});var K;(function(M){M.MEDIA_ATTACHING="hlsMediaAttaching",M.MEDIA_ATTACHED="hlsMediaAttached",M.MEDIA_DETACHING="hlsMediaDetaching",M.MEDIA_DETACHED="hlsMediaDetached",M.BUFFER_RESET="hlsBufferReset",M.BUFFER_CODECS="hlsBufferCodecs",M.BUFFER_CREATED="hlsBufferCreated",M.BUFFER_APPENDING="hlsBufferAppending",M.BUFFER_APPENDED="hlsBufferAppended",M.BUFFER_EOS="hlsBufferEos",M.BUFFER_FLUSHING="hlsBufferFlushing",M.BUFFER_FLUSHED="hlsBufferFlushed",M.MANIFEST_LOADING="hlsManifestLoading",M.MANIFEST_LOADED="hlsManifestLoaded",M.MANIFEST_PARSED="hlsManifestParsed",M.LEVEL_SWITCHING="hlsLevelSwitching",M.LEVEL_SWITCHED="hlsLevelSwitched",M.LEVEL_LOADING="hlsLevelLoading",M.LEVEL_LOADED="hlsLevelLoaded",M.LEVEL_UPDATED="hlsLevelUpdated",M.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",M.LEVELS_UPDATED="hlsLevelsUpdated",M.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",M.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",M.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",M.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",M.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",M.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",M.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",M.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",M.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",M.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",M.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",M.CUES_PARSED="hlsCuesParsed",M.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",M.INIT_PTS_FOUND="hlsInitPtsFound",M.FRAG_LOADING="hlsFragLoading",M.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",M.FRAG_LOADED="hlsFragLoaded",M.FRAG_DECRYPTED="hlsFragDecrypted",M.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",M.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",M.FRAG_PARSING_METADATA="hlsFragParsingMetadata",M.FRAG_PARSED="hlsFragParsed",M.FRAG_BUFFERED="hlsFragBuffered",M.FRAG_CHANGED="hlsFragChanged",M.FPS_DROP="hlsFpsDrop",M.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",M.ERROR="hlsError",M.DESTROYING="hlsDestroying",M.KEY_LOADING="hlsKeyLoading",M.KEY_LOADED="hlsKeyLoaded",M.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",M.BACK_BUFFER_REACHED="hlsBackBufferReached"})(K||(K={}))},"./src/hls.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return m});var K=L("./node_modules/url-toolkit/src/url-toolkit.js"),M=L.n(K),P=L("./src/loader/playlist-loader.ts"),j=L("./src/loader/key-loader.ts"),k=L("./src/controller/id3-track-controller.ts"),C=L("./src/controller/latency-controller.ts"),R=L("./src/controller/level-controller.ts"),x=L("./src/controller/fragment-tracker.ts"),A=L("./src/controller/stream-controller.ts"),O=L("./src/is-supported.ts"),S=L("./src/utils/logger.ts"),_=L("./src/config.ts"),b=L("./node_modules/eventemitter3/index.js"),d=L.n(b),s=L("./src/events.ts"),u=L("./src/errors.ts");function h(g,w){for(var y=0;y<w.length;y++){var p=w[y];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(g,p.key,p)}}function E(g,w,y){return w&&h(g.prototype,w),y&&h(g,y),g}var m=function(){g.isSupported=function(){return Object(O.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 p=this.config=Object(_.mergeConfig)(g.DefaultConfig,y);this.userConfig=y,Object(S.enableLogs)(p.debug),this._autoLevelCapping=-1,p.progressive&&Object(_.enableStreamingMode)(p);var c=p.abrController,l=p.bufferController,a=p.capLevelController,f=p.fpsController,o=this.abrController=new c(this),v=this.bufferController=new l(this),D=this.capLevelController=new a(this),N=new f(this),W=new P.default(this),z=new j.default(this),F=new k.default(this),I=this.levelController=new R.default(this),B=new x.FragmentTracker(this),Y=this.streamController=new A.default(this,B);D.setStreamController(Y),N.setStreamController(Y);var Q=[I,Y];this.networkControllers=Q;var ee=[W,z,o,v,D,N,F,B];this.audioTrackController=this.createController(p.audioTrackController,null,Q),this.createController(p.audioStreamController,B,Q),this.subtitleTrackController=this.createController(p.subtitleTrackController,null,Q),this.createController(p.subtitleStreamController,B,Q),this.createController(p.timelineController,null,ee),this.emeController=this.createController(p.emeController,null,ee),this.cmcdController=this.createController(p.cmcdController,null,ee),this.latencyController=this.createController(C.default,null,ee),this.coreComponents=ee}var w=g.prototype;return w.createController=function(p,c,l){if(p){var a=c?new p(this,c):new p(this);return l&&l.push(a),a}return null},w.on=function(p,c,l){l===void 0&&(l=this),this._emitter.on(p,c,l)},w.once=function(p,c,l){l===void 0&&(l=this),this._emitter.once(p,c,l)},w.removeAllListeners=function(p){this._emitter.removeAllListeners(p)},w.off=function(p,c,l,a){l===void 0&&(l=this),this._emitter.off(p,c,l,a)},w.listeners=function(p){return this._emitter.listeners(p)},w.emit=function(p,c,l){return this._emitter.emit(p,c,l)},w.trigger=function(p,c){if(this.config.debug)return this.emit(p,p,c);try{return this.emit(p,p,c)}catch(l){S.logger.error("An internal error happened while handling event "+p+'. Error message: "'+l.message+'". Here is a stacktrace:',l),this.trigger(s.Events.ERROR,{type:u.ErrorTypes.OTHER_ERROR,details:u.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:p,error:l})}return!1},w.listenerCount=function(p){return this._emitter.listenerCount(p)},w.destroy=function(){S.logger.log("destroy"),this.trigger(s.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(p){return p.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(p){return p.destroy()}),this.coreComponents.length=0},w.attachMedia=function(p){S.logger.log("attachMedia"),this._media=p,this.trigger(s.Events.MEDIA_ATTACHING,{media:p})},w.detachMedia=function(){S.logger.log("detachMedia"),this.trigger(s.Events.MEDIA_DETACHING,void 0),this._media=null},w.loadSource=function(p){this.stopLoad();var c=this.media,l=this.url,a=this.url=K.buildAbsoluteURL(self.location.href,p,{alwaysNormalize:!0});S.logger.log("loadSource:"+a),c&&l&&l!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(s.Events.MANIFEST_LOADING,{url:p})},w.startLoad=function(p){p===void 0&&(p=-1),S.logger.log("startLoad("+p+")"),this.networkControllers.forEach(function(c){c.startLoad(p)})},w.stopLoad=function(){S.logger.log("stopLoad"),this.networkControllers.forEach(function(p){p.stopLoad()})},w.swapAudioCodec=function(){S.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},w.recoverMediaError=function(){S.logger.log("recoverMediaError");var p=this._media;this.detachMedia(),p&&this.attachMedia(p)},w.removeLevel=function(p,c){c===void 0&&(c=0),this.levelController.removeLevel(p,c)},E(g,[{key:"levels",get:function(){var p=this.levelController.levels;return p||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(p){S.logger.log("set currentLevel:"+p),this.loadLevel=p,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(p){S.logger.log("set nextLevel:"+p),this.levelController.manualLevel=p,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(p){S.logger.log("set loadLevel:"+p),this.levelController.manualLevel=p}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(p){this.levelController.nextLoadLevel=p}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(p){S.logger.log("set firstLevel:"+p),this.levelController.firstLevel=p}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(p){S.logger.log("set startLevel:"+p),p!==-1&&(p=Math.max(p,this.minAutoLevel)),this.levelController.startLevel=p}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(p){var c=!!p;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(p){this._autoLevelCapping!==p&&(S.logger.log("set autoLevelCapping:"+p),this._autoLevelCapping=p)}},{key:"bandwidthEstimate",get:function(){var p=this.abrController.bwEstimator;return p?p.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var p=this.levels,c=this.config.minAutoBitrate;if(!p)return 0;for(var l=p.length,a=0;a<l;a++)if(p[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var p=this.levels,c=this.autoLevelCapping,l;return c===-1&&p&&p.length?l=p.length-1:l=c,l}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(p){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,p)}},{key:"audioTracks",get:function(){var p=this.audioTrackController;return p?p.audioTracks:[]}},{key:"audioTrack",get:function(){var p=this.audioTrackController;return p?p.audioTrack:-1},set:function(p){var c=this.audioTrackController;c&&(c.audioTrack=p)}},{key:"subtitleTracks",get:function(){var p=this.subtitleTrackController;return p?p.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var p=this.subtitleTrackController;return p?p.subtitleTrack:-1},set:function(p){var c=this.subtitleTrackController;c&&(c.subtitleTrack=p)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var p=this.subtitleTrackController;return p?p.subtitleDisplay:!1},set:function(p){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=p)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(p){this.config.lowLatencyMode=p}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return s.Events}},{key:"ErrorTypes",get:function(){return u.ErrorTypes}},{key:"ErrorDetails",get:function(){return u.ErrorDetails}},{key:"DefaultConfig",get:function(){return g.defaultConfig?g.defaultConfig:_.hlsDefaultConfig},set:function(p){g.defaultConfig=p}}]),g}();m.defaultConfig=void 0},"./src/is-supported.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"isSupported",function(){return P}),L.d(V,"changeTypeSupported",function(){return j});var K=L("./src/utils/mediasource-helper.ts");function M(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var k=Object(K.getMediaSource)();if(!k)return!1;var C=M(),R=k&&typeof k.isTypeSupported=="function"&&k.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),x=!C||C.prototype&&typeof C.prototype.appendBuffer=="function"&&typeof C.prototype.remove=="function";return!!R&&!!x}function j(){var k,C=M();return typeof(C==null||((k=C.prototype)===null||k===void 0)?void 0:k.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return S}),L.d(V,"LoadError",function(){return b});var K=L("./src/polyfills/number.ts"),M=L("./src/errors.ts");function P(d,s){d.prototype=Object.create(s.prototype),d.prototype.constructor=d,x(d,s)}function j(d){var s=typeof Map=="function"?new Map:void 0;return j=function(h){if(h===null||!R(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof s!="undefined"){if(s.has(h))return s.get(h);s.set(h,E)}function E(){return k(h,arguments,A(this).constructor)}return E.prototype=Object.create(h.prototype,{constructor:{value:E,enumerable:!1,writable:!0,configurable:!0}}),x(E,h)},j(d)}function k(d,s,u){return C()?k=Reflect.construct:k=function(E,m,g){var w=[null];w.push.apply(w,m);var y=Function.bind.apply(E,w),p=new y;return g&&x(p,g.prototype),p},k.apply(null,arguments)}function C(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function R(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function x(d,s){return x=Object.setPrototypeOf||function(h,E){return h.__proto__=E,h},x(d,s)}function A(d){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(u){return u.__proto__||Object.getPrototypeOf(u)},A(d)}var O=Math.pow(2,17),S=function(){function d(u){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=u}var s=d.prototype;return s.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},s.abort=function(){this.loader&&this.loader.abort()},s.load=function(h,E){var m=this,g=h.url;if(!g)return Promise.reject(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,networkDetails:null},"Fragment does not have a "+(g?"part list":"url")));this.abort();var w=this.config,y=w.fLoader,p=w.loader;return new Promise(function(c,l){m.loader&&m.loader.destroy();var a=m.loader=h.loader=y?new y(w):new p(w),f=_(h),o={timeout:w.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:w.fragLoadingMaxRetryTimeout,highWaterMark:O};h.stats=a.stats,a.load(f,o,{onSuccess:function(D,N,W,z){m.resetLoader(h,a),c({frag:h,part:null,payload:D.data,networkDetails:z})},onError:function(D,N,W){m.resetLoader(h,a),l(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,response:D,networkDetails:W}))},onAbort:function(D,N,W){m.resetLoader(h,a),l(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,networkDetails:W}))},onTimeout:function(D,N,W){m.resetLoader(h,a),l(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,networkDetails:W}))},onProgress:function(D,N,W,z){E&&E({frag:h,part:null,payload:W,networkDetails:z})}})})},s.loadPart=function(h,E,m){var g=this;this.abort();var w=this.config,y=w.fLoader,p=w.loader;return new Promise(function(c,l){g.loader&&g.loader.destroy();var a=g.loader=h.loader=y?new y(w):new p(w),f=_(h,E),o={timeout:w.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:w.fragLoadingMaxRetryTimeout,highWaterMark:O};E.stats=a.stats,a.load(f,o,{onSuccess:function(D,N,W,z){g.resetLoader(h,a),g.updateStatsFromPart(h,E);var F={frag:h,part:E,payload:D.data,networkDetails:z};m(F),c(F)},onError:function(D,N,W){g.resetLoader(h,a),l(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,part:E,response:D,networkDetails:W}))},onAbort:function(D,N,W){h.stats.aborted=E.stats.aborted,g.resetLoader(h,a),l(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,part:E,networkDetails:W}))},onTimeout:function(D,N,W){g.resetLoader(h,a),l(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,part:E,networkDetails:W}))}})})},s.updateStatsFromPart=function(h,E){var m=h.stats,g=E.stats,w=g.total;if(m.loaded+=g.loaded,w){var y=Math.round(h.duration/E.duration),p=Math.min(Math.round(m.loaded/w),y),c=y-p,l=c*Math.round(m.loaded/p);m.total=m.loaded+l}else m.total=Math.max(m.loaded,m.total);var a=m.loading,f=g.loading;a.start?a.first+=f.first-f.start:(a.start=f.start,a.first=f.first),a.end=f.end},s.resetLoader=function(h,E){h.loader=null,this.loader===E&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),E.destroy()},d}();function _(d,s){s===void 0&&(s=null);var u=s||d,h={frag:d,part:s,responseType:"arraybuffer",url:u.url,headers:{},rangeStart:0,rangeEnd:0},E=u.byteRangeStartOffset,m=u.byteRangeEndOffset;return Object(K.isFiniteNumber)(E)&&Object(K.isFiniteNumber)(m)&&(h.rangeStart=E,h.rangeEnd=m),h}var b=function(d){P(s,d);function s(u){for(var h,E=arguments.length,m=new Array(E>1?E-1:0),g=1;g<E;g++)m[g-1]=arguments[g];return h=d.call.apply(d,[this].concat(m))||this,h.data=void 0,h.data=u,h}return s}(j(Error))},"./src/loader/fragment.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"ElementaryStreamTypes",function(){return S}),L.d(V,"BaseSegment",function(){return _}),L.d(V,"Fragment",function(){return b}),L.d(V,"Part",function(){return d});var K=L("./src/polyfills/number.ts"),M=L("./node_modules/url-toolkit/src/url-toolkit.js"),P=L.n(M),j=L("./src/utils/logger.ts"),k=L("./src/loader/level-key.ts"),C=L("./src/loader/load-stats.ts");function R(s,u){s.prototype=Object.create(u.prototype),s.prototype.constructor=s,x(s,u)}function x(s,u){return x=Object.setPrototypeOf||function(E,m){return E.__proto__=m,E},x(s,u)}function A(s,u){for(var h=0;h<u.length;h++){var E=u[h];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(s,E.key,E)}}function O(s,u,h){return u&&A(s.prototype,u),h&&A(s,h),s}var S;(function(s){s.AUDIO="audio",s.VIDEO="video",s.AUDIOVIDEO="audiovideo"})(S||(S={}));var _=function(){function s(h){var E;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(E={},E[S.AUDIO]=null,E[S.VIDEO]=null,E[S.AUDIOVIDEO]=null,E),this.baseurl=h}var u=s.prototype;return u.setByteRange=function(E,m){var g=E.split("@",2),w=[];g.length===1?w[0]=m?m.byteRangeEndOffset:0:w[0]=parseInt(g[1]),w[1]=parseInt(g[0])+w[0],this._byteRange=w},O(s,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(M.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(E){this._url=E}}]),s}(),b=function(s){R(u,s);function u(E,m){var g;return g=s.call(this,m)||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 C.LoadStats,g.urlId=0,g.data=void 0,g.bitrateTest=!1,g.title=null,g.initSegment=null,g.type=E,g}var h=u.prototype;return h.createInitializationVector=function(m){for(var g=new Uint8Array(16),w=12;w<16;w++)g[w]=m>>8*(15-w)&255;return g},h.setDecryptDataFromLevelKey=function(m,g){var w=m;return(m==null?void 0:m.method)==="AES-128"&&m.uri&&!m.iv&&(w=k.LevelKey.fromURI(m.uri),w.method=m.method,w.iv=this.createInitializationVector(g),w.keyFormat="identity"),w},h.setElementaryStreamInfo=function(m,g,w,y,p,c){c===void 0&&(c=!1);var l=this.elementaryStreams,a=l[m];if(!a){l[m]={startPTS:g,endPTS:w,startDTS:y,endDTS:p,partial:c};return}a.startPTS=Math.min(a.startPTS,g),a.endPTS=Math.max(a.endPTS,w),a.startDTS=Math.min(a.startDTS,y),a.endDTS=Math.max(a.endDTS,p)},h.clearElementaryStreamInfo=function(){var m=this.elementaryStreams;m[S.AUDIO]=null,m[S.VIDEO]=null,m[S.AUDIOVIDEO]=null},O(u,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var m=this.sn;typeof m!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&j.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),m=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,m)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(K.isFiniteNumber)(this.programDateTime))return null;var m=Object(K.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+m*1e3}},{key:"encrypted",get:function(){var m;return!!((m=this.decryptdata)!==null&&m!==void 0&&m.keyFormat&&this.decryptdata.uri)}}]),u}(_),d=function(s){R(u,s);function u(h,E,m,g,w){var y;y=s.call(this,m)||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 C.LoadStats,y.duration=h.decimalFloatingPoint("DURATION"),y.gap=h.bool("GAP"),y.independent=h.bool("INDEPENDENT"),y.relurl=h.enumeratedString("URI"),y.fragment=E,y.index=g;var p=h.enumeratedString("BYTERANGE");return p&&y.setByteRange(p,w),w&&(y.fragOffset=w.fragOffset+w.duration),y}return O(u,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var E=this.elementaryStreams;return!!(E.audio||E.video||E.audiovideo)}}]),u}(_)},"./src/loader/key-loader.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return j});var K=L("./src/events.ts"),M=L("./src/errors.ts"),P=L("./src/utils/logger.ts"),j=function(){function k(R){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=R,this._registerListeners()}var C=k.prototype;return C._registerListeners=function(){this.hls.on(K.Events.KEY_LOADING,this.onKeyLoading,this)},C._unregisterListeners=function(){this.hls.off(K.Events.KEY_LOADING,this.onKeyLoading)},C.destroy=function(){this._unregisterListeners();for(var x in this.loaders){var A=this.loaders[x];A&&A.destroy()}this.loaders={}},C.onKeyLoading=function(x,A){var O=A.frag,S=O.type,_=this.loaders[S];if(!O.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var b=O.decryptdata.uri;if(b!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(_&&(P.logger.warn("abort previous key loader for type:"+S),_.abort()),!b){P.logger.warn("key uri is falsy");return}var s=d.loader,u=O.loader=this.loaders[S]=new s(d);this.decrypturl=b,this.decryptkey=null;var h={url:b,frag:O,responseType:"arraybuffer"},E={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(h,E,m)}else this.decryptkey&&(O.decryptdata.key=this.decryptkey,this.hls.trigger(K.Events.KEY_LOADED,{frag:O}))},C.loadsuccess=function(x,A,O){var S=O.frag;if(!S.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=S.decryptdata.key=new Uint8Array(x.data),S.loader=null,delete this.loaders[S.type],this.hls.trigger(K.Events.KEY_LOADED,{frag:S})},C.loaderror=function(x,A){var O=A.frag,S=O.loader;S&&S.abort(),delete this.loaders[O.type],this.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:O,response:x})},C.loadtimeout=function(x,A){var O=A.frag,S=O.loader;S&&S.abort(),delete this.loaders[O.type],this.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:O})},k}()},"./src/loader/level-details.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"LevelDetails",function(){return k});var K=L("./src/polyfills/number.ts");function M(C,R){for(var x=0;x<R.length;x++){var A=R[x];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(C,A.key,A)}}function P(C,R,x){return R&&M(C.prototype,R),x&&M(C,x),C}var j=10,k=function(){function C(x){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=x}var R=C.prototype;return R.reloaded=function(A){if(!A){this.advanced=!0,this.updated=!0;return}var O=this.lastPartSn-A.lastPartSn,S=this.lastPartIndex-A.lastPartIndex;this.updated=this.endSN!==A.endSN||!!S||!!O,this.advanced=this.endSN>A.endSN||O>0||O===0&&S>0,this.updated||this.advanced?this.misses=Math.floor(A.misses*.6):this.misses=A.misses+1,this.availabilityDelay=A.availabilityDelay},P(C,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(K.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||j}},{key:"drift",get:function(){var A=this.driftEndTime-this.driftStartTime;if(A>0){var O=this.driftEnd-this.driftStart;return O*1e3/A}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var A;return(A=this.fragments)!==null&&A!==void 0&&A.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 A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),C}()},"./src/loader/level-key.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"LevelKey",function(){return k});var K=L("./node_modules/url-toolkit/src/url-toolkit.js"),M=L.n(K);function P(C,R){for(var x=0;x<R.length;x++){var A=R[x];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(C,A.key,A)}}function j(C,R,x){return R&&P(C.prototype,R),x&&P(C,x),C}var k=function(){C.fromURL=function(x,A){return new C(x,A)},C.fromURI=function(x){return new C(x)};function C(R,x){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,x?this._uri=Object(K.buildAbsoluteURL)(R,x,{alwaysNormalize:!0}):this._uri=R}return j(C,[{key:"uri",get:function(){return this._uri}}]),C}()},"./src/loader/load-stats.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"LoadStats",function(){return K});var K=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return u});var K=L("./src/polyfills/number.ts"),M=L("./node_modules/url-toolkit/src/url-toolkit.js"),P=L.n(M),j=L("./src/loader/fragment.ts"),k=L("./src/loader/level-details.ts"),C=L("./src/loader/level-key.ts"),R=L("./src/utils/attr-list.ts"),x=L("./src/utils/logger.ts"),A=L("./src/utils/codecs.ts"),O=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,S=/#EXT-X-MEDIA:(.*)/g,_=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),b=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),d=/\.(mp4|m4s|m4v|m4a)$/i;function s(w){var y,p;return d.test((y=(p=M.parseURL(w))===null||p===void 0?void 0:p.path)!=null?y:"")}var u=function(){function w(){}return w.findGroup=function(p,c){for(var l=0;l<p.length;l++){var a=p[l];if(a.id===c)return a}},w.convertAVC1ToAVCOTI=function(p){var c=p.split(".");if(c.length>2){var l=c.shift()+".";return l+=parseInt(c.shift()).toString(16),l+=("000"+parseInt(c.shift()).toString(16)).substr(-4),l}return p},w.resolve=function(p,c){return M.buildAbsoluteURL(c,p,{alwaysNormalize:!0})},w.parseMasterPlaylist=function(p,c){var l=[],a={},f=!1;O.lastIndex=0;for(var o;(o=O.exec(p))!=null;)if(o[1]){var v=new R.AttrList(o[1]),D={attrs:v,bitrate:v.decimalInteger("AVERAGE-BANDWIDTH")||v.decimalInteger("BANDWIDTH"),name:v.NAME,url:w.resolve(o[2],c)},N=v.decimalResolution("RESOLUTION");N&&(D.width=N.width,D.height=N.height),h((v.CODECS||"").split(/[ ,]+/).filter(function(z){return z}),D),D.videoCodec&&D.videoCodec.indexOf("avc1")!==-1&&(D.videoCodec=w.convertAVC1ToAVCOTI(D.videoCodec)),l.push(D)}else if(o[3]){var W=new R.AttrList(o[3]);W["DATA-ID"]&&(f=!0,a[W["DATA-ID"]]=W)}return{levels:l,sessionData:f?a:null}},w.parseMasterPlaylistMedia=function(p,c,l,a){a===void 0&&(a=[]);var f,o=[],v=0;for(S.lastIndex=0;(f=S.exec(p))!==null;){var D=new R.AttrList(f[1]);if(D.TYPE===l){var N={attrs:D,bitrate:0,id:v++,groupId:D["GROUP-ID"],instreamId:D["INSTREAM-ID"],name:D.NAME||D.LANGUAGE||"",type:l,default:D.bool("DEFAULT"),autoselect:D.bool("AUTOSELECT"),forced:D.bool("FORCED"),lang:D.LANGUAGE,url:D.URI?w.resolve(D.URI,c):""};if(a.length){var W=w.findGroup(a,N.groupId)||a[0];E(N,W,"audioCodec"),E(N,W,"textCodec")}o.push(N)}}return o},w.parseLevelPlaylist=function(p,c,l,a,f){var o=new k.LevelDetails(c),v=o.fragments,D=null,N=0,W=0,z=0,F=0,I=null,B=new j.Fragment(a,c),Y,Q,ee,fe=-1,ce=!1;for(_.lastIndex=0,o.m3u8=p;(Y=_.exec(p))!==null;){ce&&(ce=!1,B=new j.Fragment(a,c),B.start=z,B.sn=N,B.cc=F,B.level=l,D&&(B.initSegment=D,B.rawProgramDateTime=D.rawProgramDateTime));var ge=Y[1];if(ge){B.duration=parseFloat(ge);var pe=(" "+Y[2]).slice(1);B.title=pe||null,B.tagList.push(pe?["INF",ge,pe]:["INF",ge])}else if(Y[3])Object(K.isFiniteNumber)(B.duration)&&(B.start=z,ee&&(B.levelkey=ee),B.sn=N,B.level=l,B.cc=F,B.urlId=f,v.push(B),B.relurl=(" "+Y[3]).slice(1),g(B,I),I=B,z+=B.duration,N++,W=0,ce=!0);else if(Y[4]){var ue=(" "+Y[4]).slice(1);I?B.setByteRange(ue,I):B.setByteRange(ue)}else if(Y[5])B.rawProgramDateTime=(" "+Y[5]).slice(1),B.tagList.push(["PROGRAM-DATE-TIME",B.rawProgramDateTime]),fe===-1&&(fe=v.length);else{if(Y=Y[0].match(b),!Y){x.logger.warn("No matches on slow regex match for level playlist!");continue}for(Q=1;Q<Y.length&&!(typeof Y[Q]!="undefined");Q++);var le=(" "+Y[Q]).slice(1),de=(" "+Y[Q+1]).slice(1),ye=Y[Q+2]?(" "+Y[Q+2]).slice(1):"";switch(le){case"PLAYLIST-TYPE":o.type=de.toUpperCase();break;case"MEDIA-SEQUENCE":N=o.startSN=parseInt(de);break;case"SKIP":{var Me=new R.AttrList(de),Ue=Me.decimalInteger("SKIPPED-SEGMENTS");if(Object(K.isFiniteNumber)(Ue)){o.skippedSegments=Ue;for(var Re=Ue;Re--;)v.unshift(null);N+=Ue}var Oe=Me.enumeratedString("RECENTLY-REMOVED-DATERANGES");Oe&&(o.recentlyRemovedDateranges=Oe.split(" "));break}case"TARGETDURATION":o.targetduration=parseFloat(de);break;case"VERSION":o.version=parseInt(de);break;case"EXTM3U":break;case"ENDLIST":o.live=!1;break;case"#":(de||ye)&&B.tagList.push(ye?[de,ye]:[de]);break;case"DIS":F++;case"GAP":B.tagList.push([le]);break;case"BITRATE":B.tagList.push([le,de]);break;case"DISCONTINUITY-SEQ":F=parseInt(de);break;case"KEY":{var Ce,Le=new R.AttrList(de),Fe=Le.enumeratedString("METHOD"),We=Le.URI,Be=Le.hexadecimalInteger("IV"),Ae=Le.enumeratedString("KEYFORMATVERSIONS"),Se=Le.enumeratedString("KEYID"),$e=(Ce=Le.enumeratedString("KEYFORMAT"))!=null?Ce:"identity",qe=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(qe.indexOf($e)>-1){x.logger.warn("Keyformat "+$e+" is not supported from the manifest");continue}else if($e!=="identity")continue;Fe&&(ee=C.LevelKey.fromURL(c,We),We&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Fe)>=0&&(ee.method=Fe,ee.keyFormat=$e,Se&&(ee.keyID=Se),Ae&&(ee.keyFormatVersions=Ae),ee.iv=Be));break}case"START":{var Je=new R.AttrList(de),Xe=Je.decimalFloatingPoint("TIME-OFFSET");Object(K.isFiniteNumber)(Xe)&&(o.startTimeOffset=Xe);break}case"MAP":{var ot=new R.AttrList(de);B.relurl=ot.URI,ot.BYTERANGE&&B.setByteRange(ot.BYTERANGE),B.level=l,B.sn="initSegment",ee&&(B.levelkey=ee),B.initSegment=null,D=B,ce=!0;break}case"SERVER-CONTROL":{var Qe=new R.AttrList(de);o.canBlockReload=Qe.bool("CAN-BLOCK-RELOAD"),o.canSkipUntil=Qe.optionalFloat("CAN-SKIP-UNTIL",0),o.canSkipDateRanges=o.canSkipUntil>0&&Qe.bool("CAN-SKIP-DATERANGES"),o.partHoldBack=Qe.optionalFloat("PART-HOLD-BACK",0),o.holdBack=Qe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ye=new R.AttrList(de);o.partTarget=Ye.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ee=o.partList;Ee||(Ee=o.partList=[]);var nt=W>0?Ee[Ee.length-1]:void 0,Ze=W++,xe=new j.Part(new R.AttrList(de),B,c,Ze,nt);Ee.push(xe),B.duration+=xe.duration;break}case"PRELOAD-HINT":{var Ne=new R.AttrList(de);o.preloadHint=Ne;break}case"RENDITION-REPORT":{var ne=new R.AttrList(de);o.renditionReports=o.renditionReports||[],o.renditionReports.push(ne);break}default:x.logger.warn("line parsed but not handled: "+Y);break}}}I&&!I.relurl?(v.pop(),z-=I.duration,o.partList&&(o.fragmentHint=I)):o.partList&&(g(B,I),B.cc=F,o.fragmentHint=B);var oe=v.length,ae=v[0],$=v[oe-1];if(z+=o.skippedSegments*o.targetduration,z>0&&oe&&$){o.averagetargetduration=z/oe;var J=$.sn;o.endSN=J!=="initSegment"?J:0,ae&&(o.startCC=ae.cc,ae.initSegment||o.fragments.every(function(q){return q.relurl&&s(q.relurl)})&&(x.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),B=new j.Fragment(a,c),B.relurl=$.relurl,B.level=l,B.sn="initSegment",ae.initSegment=B,o.needSidxRanges=!0))}else o.endSN=0,o.startCC=0;return o.fragmentHint&&(z+=o.fragmentHint.duration),o.totalduration=z,o.endCC=F,fe>0&&m(v,fe),o},w}();function h(w,y){["video","audio","text"].forEach(function(p){var c=w.filter(function(a){return Object(A.isCodecType)(a,p)});if(c.length){var l=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});y[p+"Codec"]=l.length>0?l[0]:c[0],w=w.filter(function(a){return c.indexOf(a)===-1})}}),y.unknownCodecs=w}function E(w,y,p){var c=y[p];c&&(w[p]=c)}function m(w,y){for(var p=w[y],c=y;c--;){var l=w[c];if(!l)return;l.programDateTime=p.programDateTime-l.duration*1e3,p=l}}function g(w,y){w.rawProgramDateTime?w.programDateTime=Date.parse(w.rawProgramDateTime):y!=null&&y.programDateTime&&(w.programDateTime=y.endProgramDateTime),Object(K.isFiniteNumber)(w.programDateTime)||(w.programDateTime=null,w.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(re,V,L){"use strict";L.r(V);var K=L("./src/polyfills/number.ts"),M=L("./src/events.ts"),P=L("./src/errors.ts"),j=L("./src/utils/logger.ts"),k=L("./src/utils/mp4-tools.ts"),C=L("./src/loader/m3u8-parser.ts"),R=L("./src/types/loader.ts"),x=L("./src/utils/attr-list.ts");function A(_){var b=_.type;switch(b){case R.PlaylistContextType.AUDIO_TRACK:return R.PlaylistLevelType.AUDIO;case R.PlaylistContextType.SUBTITLE_TRACK:return R.PlaylistLevelType.SUBTITLE;default:return R.PlaylistLevelType.MAIN}}function O(_,b){var d=_.url;return(d===void 0||d.indexOf("data:")===0)&&(d=b.url),d}var S=function(){function _(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var b=_.prototype;return b.registerListeners=function(){var s=this.hls;s.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(M.Events.LEVEL_LOADING,this.onLevelLoading,this),s.on(M.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),s.on(M.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.unregisterListeners=function(){var s=this.hls;s.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(M.Events.LEVEL_LOADING,this.onLevelLoading,this),s.off(M.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),s.off(M.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.createInternalLoader=function(s){var u=this.hls.config,h=u.pLoader,E=u.loader,m=h||E,g=new m(u);return s.loader=g,this.loaders[s.type]=g,g},b.getInternalLoader=function(s){return this.loaders[s.type]},b.resetInternalLoader=function(s){this.loaders[s]&&delete this.loaders[s]},b.destroyInternalLoaders=function(){for(var s in this.loaders){var u=this.loaders[s];u&&u.destroy(),this.resetInternalLoader(s)}},b.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},b.onManifestLoading=function(s,u){var h=u.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:R.PlaylistContextType.MANIFEST,url:h,deliveryDirectives:null})},b.onLevelLoading=function(s,u){var h=u.id,E=u.level,m=u.url,g=u.deliveryDirectives;this.load({id:h,groupId:null,level:E,responseType:"text",type:R.PlaylistContextType.LEVEL,url:m,deliveryDirectives:g})},b.onAudioTrackLoading=function(s,u){var h=u.id,E=u.groupId,m=u.url,g=u.deliveryDirectives;this.load({id:h,groupId:E,level:null,responseType:"text",type:R.PlaylistContextType.AUDIO_TRACK,url:m,deliveryDirectives:g})},b.onSubtitleTrackLoading=function(s,u){var h=u.id,E=u.groupId,m=u.url,g=u.deliveryDirectives;this.load({id:h,groupId:E,level:null,responseType:"text",type:R.PlaylistContextType.SUBTITLE_TRACK,url:m,deliveryDirectives:g})},b.load=function(s){var u,h=this.hls.config,E=this.getInternalLoader(s);if(E){var m=E.context;if(m&&m.url===s.url){j.logger.trace("[playlist-loader]: playlist request ongoing");return}j.logger.log("[playlist-loader]: aborting previous loader for type: "+s.type),E.abort()}var g,w,y,p;switch(s.type){case R.PlaylistContextType.MANIFEST:g=h.manifestLoadingMaxRetry,w=h.manifestLoadingTimeOut,y=h.manifestLoadingRetryDelay,p=h.manifestLoadingMaxRetryTimeout;break;case R.PlaylistContextType.LEVEL:case R.PlaylistContextType.AUDIO_TRACK:case R.PlaylistContextType.SUBTITLE_TRACK:g=0,w=h.levelLoadingTimeOut;break;default:g=h.levelLoadingMaxRetry,w=h.levelLoadingTimeOut,y=h.levelLoadingRetryDelay,p=h.levelLoadingMaxRetryTimeout;break}if(E=this.createInternalLoader(s),(u=s.deliveryDirectives)!==null&&u!==void 0&&u.part){var c;if(s.type===R.PlaylistContextType.LEVEL&&s.level!==null?c=this.hls.levels[s.level].details:s.type===R.PlaylistContextType.AUDIO_TRACK&&s.id!==null?c=this.hls.audioTracks[s.id].details:s.type===R.PlaylistContextType.SUBTITLE_TRACK&&s.id!==null&&(c=this.hls.subtitleTracks[s.id].details),c){var l=c.partTarget,a=c.targetduration;l&&a&&(w=Math.min(Math.max(l*3,a*.8)*1e3,w))}}var f={timeout:w,maxRetry:g,retryDelay:y,maxRetryDelay:p,highWaterMark:0},o={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};E.load(s,f,o)},b.loadsuccess=function(s,u,h,E){if(E===void 0&&(E=null),h.isSidxRequest){this.handleSidxRequest(s,h),this.handlePlaylistLoaded(s,u,h,E);return}this.resetInternalLoader(h.type);var m=s.data;if(m.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(s,h,"no EXTM3U delimiter",E);return}u.parsing.start=performance.now(),m.indexOf("#EXTINF:")>0||m.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(s,u,h,E):this.handleMasterPlaylist(s,u,h,E)},b.loaderror=function(s,u,h){h===void 0&&(h=null),this.handleNetworkError(u,h,!1,s)},b.loadtimeout=function(s,u,h){h===void 0&&(h=null),this.handleNetworkError(u,h,!0)},b.handleMasterPlaylist=function(s,u,h,E){var m=this.hls,g=s.data,w=O(s,h),y=C.default.parseMasterPlaylist(g,w),p=y.levels,c=y.sessionData;if(!p.length){this.handleManifestParsingError(s,h,"no level found in manifest",E);return}var l=p.map(function(N){return{id:N.attrs.AUDIO,audioCodec:N.audioCodec}}),a=p.map(function(N){return{id:N.attrs.SUBTITLES,textCodec:N.textCodec}}),f=C.default.parseMasterPlaylistMedia(g,w,"AUDIO",l),o=C.default.parseMasterPlaylistMedia(g,w,"SUBTITLES",a),v=C.default.parseMasterPlaylistMedia(g,w,"CLOSED-CAPTIONS");if(f.length){var D=f.some(function(N){return!N.url});!D&&p[0].audioCodec&&!p[0].attrs.AUDIO&&(j.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),f.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new x.AttrList({}),bitrate:0,url:""}))}m.trigger(M.Events.MANIFEST_LOADED,{levels:p,audioTracks:f,subtitles:o,captions:v,url:w,stats:u,networkDetails:E,sessionData:c})},b.handleTrackOrLevelPlaylist=function(s,u,h,E){var m=this.hls,g=h.id,w=h.level,y=h.type,p=O(s,h),c=Object(K.isFiniteNumber)(g)?g:0,l=Object(K.isFiniteNumber)(w)?w:c,a=A(h),f=C.default.parseLevelPlaylist(s.data,p,l,a,c);if(!f.fragments.length){m.trigger(M.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:p,reason:"no fragments found in level",level:typeof h.level=="number"?h.level:void 0});return}if(y===R.PlaylistContextType.MANIFEST){var o={attrs:new x.AttrList({}),bitrate:0,details:f,name:"",url:p};m.trigger(M.Events.MANIFEST_LOADED,{levels:[o],audioTracks:[],url:p,stats:u,networkDetails:E,sessionData:null})}if(u.parsing.end=performance.now(),f.needSidxRanges){var v,D=(v=f.fragments[0].initSegment)===null||v===void 0?void 0:v.url;this.load({url:D,isSidxRequest:!0,type:y,level:w,levelDetails:f,id:g,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}h.levelDetails=f,this.handlePlaylistLoaded(s,u,h,E)},b.handleSidxRequest=function(s,u){var h=Object(k.parseSegmentIndex)(new Uint8Array(s.data));if(!h)return;var E=h.references,m=u.levelDetails;E.forEach(function(g,w){var y=g.info,p=m.fragments[w];p.byteRange.length===0&&p.setByteRange(String(1+y.end-y.start)+"@"+String(y.start)),p.initSegment&&p.initSegment.setByteRange(String(h.moovEndOffset)+"@0")})},b.handleManifestParsingError=function(s,u,h,E){this.hls.trigger(M.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:u.type===R.PlaylistContextType.MANIFEST,url:s.url,reason:h,response:s,context:u,networkDetails:E})},b.handleNetworkError=function(s,u,h,E){h===void 0&&(h=!1),j.logger.warn("[playlist-loader]: A network "+(h?"timeout":"error")+" occurred while loading "+s.type+" level: "+s.level+" id: "+s.id+' group-id: "'+s.groupId+'"');var m=P.ErrorDetails.UNKNOWN,g=!1,w=this.getInternalLoader(s);switch(s.type){case R.PlaylistContextType.MANIFEST:m=h?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,g=!0;break;case R.PlaylistContextType.LEVEL:m=h?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,g=!1;break;case R.PlaylistContextType.AUDIO_TRACK:m=h?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,g=!1;break;case R.PlaylistContextType.SUBTITLE_TRACK:m=h?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,g=!1;break}w&&this.resetInternalLoader(s.type);var y={type:P.ErrorTypes.NETWORK_ERROR,details:m,fatal:g,url:s.url,loader:w,context:s,networkDetails:u};E&&(y.response=E),this.hls.trigger(M.Events.ERROR,y)},b.handlePlaylistLoaded=function(s,u,h,E){var m=h.type,g=h.level,w=h.id,y=h.groupId,p=h.loader,c=h.levelDetails,l=h.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(s,h,"invalid target duration",E);return}if(!p)return;c.live&&(p.getCacheAge&&(c.ageHeader=p.getCacheAge()||0),(!p.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(m){case R.PlaylistContextType.MANIFEST:case R.PlaylistContextType.LEVEL:this.hls.trigger(M.Events.LEVEL_LOADED,{details:c,level:g||0,id:w||0,stats:u,networkDetails:E,deliveryDirectives:l});break;case R.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(M.Events.AUDIO_TRACK_LOADED,{details:c,id:w||0,groupId:y||"",stats:u,networkDetails:E,deliveryDirectives:l});break;case R.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(M.Events.SUBTITLE_TRACK_LOADED,{details:c,id:w||0,groupId:y||"",stats:u,networkDetails:E,deliveryDirectives:l});break}},_}();V.default=S},"./src/polyfills/number.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"isFiniteNumber",function(){return K}),L.d(V,"MAX_SAFE_INTEGER",function(){return M});var K=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},M=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(re,V,L){"use strict";L.r(V);var K=function(){function M(){}return M.getSilentFrame=function(j,k){switch(j){case"mp4a.40.2":if(k===1)return new Uint8Array([0,200,0,128,35,128]);if(k===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(k===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(k===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(k===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(k===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(k===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(k===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(k===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},M}();V.default=K},"./src/remux/mp4-generator.ts":function(re,V,L){"use strict";L.r(V);var K=Math.pow(2,32)-1,M=function(){function P(){}return P.init=function(){P.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var k;for(k in P.types)P.types.hasOwnProperty(k)&&(P.types[k]=[k.charCodeAt(0),k.charCodeAt(1),k.charCodeAt(2),k.charCodeAt(3)]);var C=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),R=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);P.HDLR_TYPES={video:C,audio:R};var x=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),A=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=A,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var O=new Uint8Array([105,115,111,109]),S=new Uint8Array([97,118,99,49]),_=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,O,_,O,S),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,x))},P.box=function(k){for(var C=8,R=arguments.length,x=new Array(R>1?R-1:0),A=1;A<R;A++)x[A-1]=arguments[A];for(var O=x.length,S=O;O--;)C+=x[O].byteLength;var _=new Uint8Array(C);for(_[0]=C>>24&255,_[1]=C>>16&255,_[2]=C>>8&255,_[3]=C&255,_.set(k,4),O=0,C=8;O<S;O++)_.set(x[O],C),C+=x[O].byteLength;return _},P.hdlr=function(k){return P.box(P.types.hdlr,P.HDLR_TYPES[k])},P.mdat=function(k){return P.box(P.types.mdat,k)},P.mdhd=function(k,C){C*=k;var R=Math.floor(C/(K+1)),x=Math.floor(C%(K+1));return P.box(P.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,R>>24,R>>16&255,R>>8&255,R&255,x>>24,x>>16&255,x>>8&255,x&255,85,196,0,0]))},P.mdia=function(k){return P.box(P.types.mdia,P.mdhd(k.timescale,k.duration),P.hdlr(k.type),P.minf(k))},P.mfhd=function(k){return P.box(P.types.mfhd,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255]))},P.minf=function(k){return k.type==="audio"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(k)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(k))},P.moof=function(k,C,R){return P.box(P.types.moof,P.mfhd(k),P.traf(R,C))},P.moov=function(k){for(var C=k.length,R=[];C--;)R[C]=P.trak(k[C]);return P.box.apply(null,[P.types.moov,P.mvhd(k[0].timescale,k[0].duration)].concat(R).concat(P.mvex(k)))},P.mvex=function(k){for(var C=k.length,R=[];C--;)R[C]=P.trex(k[C]);return P.box.apply(null,[P.types.mvex].concat(R))},P.mvhd=function(k,C){C*=k;var R=Math.floor(C/(K+1)),x=Math.floor(C%(K+1)),A=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,R>>24,R>>16&255,R>>8&255,R&255,x>>24,x>>16&255,x>>8&255,x&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return P.box(P.types.mvhd,A)},P.sdtp=function(k){var C=k.samples||[],R=new Uint8Array(4+C.length),x,A;for(x=0;x<C.length;x++)A=C[x].flags,R[x+4]=A.dependsOn<<4|A.isDependedOn<<2|A.hasRedundancy;return P.box(P.types.sdtp,R)},P.stbl=function(k){return P.box(P.types.stbl,P.stsd(k),P.box(P.types.stts,P.STTS),P.box(P.types.stsc,P.STSC),P.box(P.types.stsz,P.STSZ),P.box(P.types.stco,P.STCO))},P.avc1=function(k){var C=[],R=[],x,A,O;for(x=0;x<k.sps.length;x++)A=k.sps[x],O=A.byteLength,C.push(O>>>8&255),C.push(O&255),C=C.concat(Array.prototype.slice.call(A));for(x=0;x<k.pps.length;x++)A=k.pps[x],O=A.byteLength,R.push(O>>>8&255),R.push(O&255),R=R.concat(Array.prototype.slice.call(A));var S=P.box(P.types.avcC,new Uint8Array([1,C[3],C[4],C[5],252|3,224|k.sps.length].concat(C).concat([k.pps.length]).concat(R))),_=k.width,b=k.height,d=k.pixelRatio[0],s=k.pixelRatio[1];return P.box(P.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,_>>8&255,_&255,b>>8&255,b&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),S,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,s>>24,s>>16&255,s>>8&255,s&255])))},P.esds=function(k){var C=k.config.length;return new Uint8Array([0,0,0,0,3,23+C,0,1,0,4,15+C,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([C]).concat(k.config).concat([6,1,2]))},P.mp4a=function(k){var C=k.samplerate;return P.box(P.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,k.channelCount,0,16,0,0,0,0,C>>8&255,C&255,0,0]),P.box(P.types.esds,P.esds(k)))},P.mp3=function(k){var C=k.samplerate;return P.box(P.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,k.channelCount,0,16,0,0,0,0,C>>8&255,C&255,0,0]))},P.stsd=function(k){return k.type==="audio"?!k.isAAC&&k.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(k)):P.box(P.types.stsd,P.STSD,P.mp4a(k)):P.box(P.types.stsd,P.STSD,P.avc1(k))},P.tkhd=function(k){var C=k.id,R=k.duration*k.timescale,x=k.width,A=k.height,O=Math.floor(R/(K+1)),S=Math.floor(R%(K+1));return P.box(P.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,C>>24&255,C>>16&255,C>>8&255,C&255,0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,S>>24,S>>16&255,S>>8&255,S&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,x>>8&255,x&255,0,0,A>>8&255,A&255,0,0]))},P.traf=function(k,C){var R=P.sdtp(k),x=k.id,A=Math.floor(C/(K+1)),O=Math.floor(C%(K+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,x>>24,x>>16&255,x>>8&255,x&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,O>>24,O>>16&255,O>>8&255,O&255])),P.trun(k,R.length+16+20+8+16+8+8),R)},P.trak=function(k){return k.duration=k.duration||4294967295,P.box(P.types.trak,P.tkhd(k),P.mdia(k))},P.trex=function(k){var C=k.id;return P.box(P.types.trex,new Uint8Array([0,0,0,0,C>>24,C>>16&255,C>>8&255,C&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},P.trun=function(k,C){var R=k.samples||[],x=R.length,A=12+16*x,O=new Uint8Array(A),S,_,b,d,s,u;for(C+=8+A,O.set([0,0,15,1,x>>>24&255,x>>>16&255,x>>>8&255,x&255,C>>>24&255,C>>>16&255,C>>>8&255,C&255],0),S=0;S<x;S++)_=R[S],b=_.duration,d=_.size,s=_.flags,u=_.cts,O.set([b>>>24&255,b>>>16&255,b>>>8&255,b&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,s.degradPrio&240<<8,s.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*S);return P.box(P.types.trun,O)},P.initSegment=function(k){P.types||P.init();var C=P.moov(k),R=new Uint8Array(P.FTYP.byteLength+C.byteLength);return R.set(P.FTYP),R.set(C,P.FTYP.byteLength),R},P}();M.types=void 0,M.HDLR_TYPES=void 0,M.STTS=void 0,M.STSC=void 0,M.STCO=void 0,M.STSZ=void 0,M.VMHD=void 0,M.SMHD=void 0,M.STSD=void 0,M.FTYP=void 0,M.DINF=void 0,V.default=M},"./src/remux/mp4-remuxer.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return u}),L.d(V,"normalizePts",function(){return h});var K=L("./src/polyfills/number.ts"),M=L("./src/remux/aac-helper.ts"),P=L("./src/remux/mp4-generator.ts"),j=L("./src/events.ts"),k=L("./src/errors.ts"),C=L("./src/utils/logger.ts"),R=L("./src/types/loader.ts"),x=L("./src/utils/timescale-conversion.ts");function A(){return A=Object.assign||function(w){for(var y=1;y<arguments.length;y++){var p=arguments[y];for(var c in p)Object.prototype.hasOwnProperty.call(p,c)&&(w[c]=p[c])}return w},A.apply(this,arguments)}var O=10*1e3,S=1024,_=1152,b=null,d=null,s=!1,u=function(){function w(p,c,l,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=p,this.config=c,this.typeSupported=l,this.ISGenerated=!1,b===null){var f=navigator.userAgent||"",o=f.match(/Chrome\/(\d+)/i);b=o?parseInt(o[1]):0}if(d===null){var v=navigator.userAgent.match(/Safari\/(\d+)/i);d=v?parseInt(v[1]):0}s=!!b&&b<75||!!d&&d<600}var y=w.prototype;return y.destroy=function(){},y.resetTimeStamp=function(c){C.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},y.resetNextTimestamp=function(){C.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},y.resetInitSegment=function(){C.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},y.getVideoStartPts=function(c){var l=!1,a=c.reduce(function(f,o){var v=o.pts-f;return v<-4294967296?(l=!0,h(f,o.pts)):v>0?f:o.pts},c[0].pts);return l&&C.logger.debug("PTS rollover detected"),a},y.remux=function(c,l,a,f,o,v,D,N){var W,z,F,I,B,Y,Q=o,ee=o,fe=c.pid>-1,ce=l.pid>-1,ge=l.samples.length,pe=c.samples.length>0,ue=ge>1,le=(!fe||pe)&&(!ce||ue)||this.ISGenerated||D;if(le){this.ISGenerated||(F=this.generateIS(c,l,o));var de=this.isVideoContiguous,ye=-1;if(ue&&(ye=E(l.samples),!de&&this.config.forceKeyFrameOnDiscontinuity))if(Y=!0,ye>0){C.logger.warn("[mp4-remuxer]: Dropped "+ye+" out of "+ge+" video samples due to a missing keyframe");var Me=this.getVideoStartPts(l.samples);l.samples=l.samples.slice(ye),l.dropped+=ye,ee+=(l.samples[0].pts-Me)/(l.timescale||9e4)}else ye===-1&&(C.logger.warn("[mp4-remuxer]: No keyframe found out of "+ge+" video samples"),Y=!1);if(this.ISGenerated){if(pe&&ue){var Ue=this.getVideoStartPts(l.samples),Re=h(c.samples[0].pts,Ue)-Ue,Oe=Re/l.inputTimeScale;Q+=Math.max(0,Oe),ee+=Math.max(0,-Oe)}if(pe){if(c.samplerate||(C.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),F=this.generateIS(c,l,o)),z=this.remuxAudio(c,Q,this.isAudioContiguous,v,ce||ue||N===R.PlaylistLevelType.AUDIO?ee:void 0),ue){var Ce=z?z.endPTS-z.startPTS:0;l.inputTimeScale||(C.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),F=this.generateIS(c,l,o)),W=this.remuxVideo(l,ee,de,Ce)}}else ue&&(W=this.remuxVideo(l,ee,de,0));W&&(W.firstKeyFrame=ye,W.independent=ye!==-1)}}return this.ISGenerated&&(a.samples.length&&(B=this.remuxID3(a,o)),f.samples.length&&(I=this.remuxText(f,o))),{audio:z,video:W,initSegment:F,independent:Y,text:I,id3:B}},y.generateIS=function(c,l,a){var f=c.samples,o=l.samples,v=this.typeSupported,D={},N=!Object(K.isFiniteNumber)(this._initPTS),W="audio/mp4",z,F,I;if(N&&(z=F=Infinity),c.config&&f.length&&(c.timescale=c.samplerate,c.isAAC||(v.mpeg?(W="audio/mpeg",c.codec=""):v.mp3&&(c.codec="mp3")),D.audio={id:"audio",container:W,codec:c.codec,initSegment:!c.isAAC&&v.mpeg?new Uint8Array(0):P.default.initSegment([c]),metadata:{channelCount:c.channelCount}},N&&(I=c.inputTimeScale,z=F=f[0].pts-Math.round(I*a))),l.sps&&l.pps&&o.length&&(l.timescale=l.inputTimeScale,D.video={id:"main",container:"video/mp4",codec:l.codec,initSegment:P.default.initSegment([l]),metadata:{width:l.width,height:l.height}},N)){I=l.inputTimeScale;var B=this.getVideoStartPts(o),Y=Math.round(I*a);F=Math.min(F,h(o[0].dts,B)-Y),z=Math.min(z,B-Y)}if(Object.keys(D).length)return this.ISGenerated=!0,N&&(this._initPTS=z,this._initDTS=F),{tracks:D,initPTS:z,timescale:I}},y.remuxVideo=function(c,l,a,f){var o=c.inputTimeScale,v=c.samples,D=[],N=v.length,W=this._initPTS,z=this.nextAvcDts,F=8,I,B,Y,Q=Number.POSITIVE_INFINITY,ee=Number.NEGATIVE_INFINITY,fe=0,ce=!1;if(!a||z===null){var ge=l*o,pe=v[0].pts-h(v[0].dts,v[0].pts);z=ge-pe}for(var ue=0;ue<N;ue++){var le=v[ue];if(le.pts=h(le.pts-W,z),le.dts=h(le.dts-W,z),le.dts>le.pts){var de=9e4*.2;fe=Math.max(Math.min(fe,le.pts-le.dts),-1*de)}le.dts<v[ue>0?ue-1:ue].dts&&(ce=!0)}ce&&v.sort(function(pr,et){var De=pr.dts-et.dts,Ct=pr.pts-et.pts;return De||Ct}),B=v[0].dts,Y=v[v.length-1].dts;var ye=Math.round((Y-B)/(N-1));if(fe<0){if(fe<ye*-2){C.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(x.toMsFromMpegTsClock)(-ye,!0)+" ms");for(var Me=fe,Ue=0;Ue<N;Ue++)v[Ue].dts=Me=Math.max(Me,v[Ue].pts-ye),v[Ue].pts=Math.max(Me,v[Ue].pts)}else{C.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(x.toMsFromMpegTsClock)(fe,!0)+" ms to overcome this issue");for(var Re=0;Re<N;Re++)v[Re].dts=v[Re].dts+fe}B=v[0].dts}if(a){var Oe=B-z,Ce=Oe>ye,Le=Oe<-1;if(Ce||Le){Ce?C.logger.warn("AVC: "+Object(x.toMsFromMpegTsClock)(Oe,!0)+" ms ("+Oe+"dts) hole between fragments detected, filling it"):C.logger.warn("AVC: "+Object(x.toMsFromMpegTsClock)(-Oe,!0)+" ms ("+Oe+"dts) overlapping between fragments detected"),B=z;var Fe=v[0].pts-Oe;v[0].dts=B,v[0].pts=Fe,C.logger.log("Video: First PTS/DTS adjusted: "+Object(x.toMsFromMpegTsClock)(Fe,!0)+"/"+Object(x.toMsFromMpegTsClock)(B,!0)+", delta: "+Object(x.toMsFromMpegTsClock)(Oe,!0)+" ms")}}s&&(B=Math.max(0,B));for(var We=0,Be=0,Ae=0;Ae<N;Ae++){for(var Se=v[Ae],$e=Se.units,qe=$e.length,Je=0,Xe=0;Xe<qe;Xe++)Je+=$e[Xe].data.length;Be+=Je,We+=qe,Se.length=Je,Se.dts=Math.max(Se.dts,B),Se.pts=Math.max(Se.pts,Se.dts,0),Q=Math.min(Se.pts,Q),ee=Math.max(Se.pts,ee)}Y=v[N-1].dts;var ot=Be+4*We+8,Qe;try{Qe=new Uint8Array(ot)}catch(pr){this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ot,reason:"fail allocating video mdat "+ot});return}var Ye=new DataView(Qe.buffer);Ye.setUint32(0,ot),Qe.set(P.default.types.mdat,4);for(var Ee=0;Ee<N;Ee++){for(var nt=v[Ee],Ze=nt.units,xe=0,Ne=0,ne=Ze.length;Ne<ne;Ne++){var oe=Ze[Ne],ae=oe.data,$=oe.data.byteLength;Ye.setUint32(F,$),F+=4,Qe.set(ae,F),F+=$,xe+=4+$}if(Ee<N-1)I=v[Ee+1].dts-nt.dts;else{var J=this.config,q=nt.dts-v[Ee>0?Ee-1:Ee].dts;if(J.stretchShortVideoTrack&&this.nextAudioPts!==null){var te=Math.floor(J.maxBufferHole*o),me=(f?Q+f*o:this.nextAudioPts)-nt.pts;me>te?(I=me-q,I<0&&(I=q),C.logger.log("[mp4-remuxer]: It is approximately "+me/90+" ms to the next segment; using duration "+I/90+" ms for the last video frame.")):I=q}else I=q}var be=Math.round(nt.pts-nt.dts);D.push(new m(nt.key,I,xe,be))}if(D.length&&b&&b<70){var Pe=D[0].flags;Pe.dependsOn=2,Pe.isNonSync=0}console.assert(I!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=z=Y+I,this.isVideoContiguous=!0;var gt=P.default.moof(c.sequenceNumber++,B,A({},c,{samples:D})),Ft="video",St={data1:gt,data2:Qe,startPTS:Q/o,endPTS:(ee+I)/o,startDTS:B/o,endDTS:z/o,type:Ft,hasAudio:!1,hasVideo:!0,nb:D.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Qe.length,"MDAT length must not be zero"),St},y.remuxAudio=function(c,l,a,f,o){var v=c.inputTimeScale,D=c.samplerate?c.samplerate:v,N=v/D,W=c.isAAC?S:_,z=W*N,F=this._initPTS,I=!c.isAAC&&this.typeSupported.mpeg,B=[],Y=c.samples,Q=I?0:8,ee=this.nextAudioPts||-1,fe=l*v;if(this.isAudioContiguous=a=a||Y.length&&ee>0&&(f&&Math.abs(fe-ee)<9e3||Math.abs(h(Y[0].pts-F,fe)-ee)<20*z),Y.forEach(function(ae){ae.pts=h(ae.pts-F,fe)}),!a||ee<0){if(Y=Y.filter(function(ae){return ae.pts>=0}),!Y.length)return;o===0?ee=0:f?ee=Math.max(0,fe):ee=Y[0].pts}if(c.isAAC)for(var ce=o!==void 0,ge=this.config.maxAudioFramesDrift,pe=0,ue=ee;pe<Y.length;pe++){var le=Y[pe],de=le.pts,ye=de-ue,Me=Math.abs(1e3*ye/v);if(ye<=-ge*z&&ce)pe===0&&(C.logger.warn("Audio frame @ "+(de/v).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*ye/v)+" ms."),this.nextAudioPts=ee=ue=de);else if(ye>=ge*z&&Me<O&&ce){var Ue=Math.round(ye/z);ue=de-Ue*z,ue<0&&(Ue--,ue+=z),pe===0&&(this.nextAudioPts=ee=ue),C.logger.warn("[mp4-remuxer]: Injecting "+Ue+" audio frame @ "+(ue/v).toFixed(3)+"s due to "+Math.round(1e3*ye/v)+" ms gap.");for(var Re=0;Re<Ue;Re++){var Oe=Math.max(ue,0),Ce=M.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);Ce||(C.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ce=le.unit.subarray()),Y.splice(pe,0,{unit:Ce,pts:Oe}),ue+=z,pe++}}le.pts=ue,ue+=z}for(var Le=null,Fe=null,We,Be=0,Ae=Y.length;Ae--;)Be+=Y[Ae].unit.byteLength;for(var Se=0,$e=Y.length;Se<$e;Se++){var qe=Y[Se],Je=qe.unit,Xe=qe.pts;if(Fe!==null){var ot=B[Se-1];ot.duration=Math.round((Xe-Fe)/N)}else if(a&&c.isAAC&&(Xe=ee),Le=Xe,Be>0){Be+=Q;try{We=new Uint8Array(Be)}catch(ae){this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Be,reason:"fail allocating audio mdat "+Be});return}if(!I){var Qe=new DataView(We.buffer);Qe.setUint32(0,Be),We.set(P.default.types.mdat,4)}}else return;We.set(Je,Q);var Ye=Je.byteLength;Q+=Ye,B.push(new m(!0,W,Ye,0)),Fe=Xe}var Ee=B.length;if(!Ee)return;var nt=B[B.length-1];this.nextAudioPts=ee=Fe+N*nt.duration;var Ze=I?new Uint8Array(0):P.default.moof(c.sequenceNumber++,Le/N,A({},c,{samples:B}));c.samples=[];var xe=Le/v,Ne=ee/v,ne="audio",oe={data1:Ze,data2:We,startPTS:xe,endPTS:Ne,startDTS:xe,endDTS:Ne,type:ne,hasAudio:!0,hasVideo:!1,nb:Ee};return this.isAudioContiguous=!0,console.assert(We.length,"MDAT length must not be zero"),oe},y.remuxEmptyAudio=function(c,l,a,f){var o=c.inputTimeScale,v=c.samplerate?c.samplerate:o,D=o/v,N=this.nextAudioPts,W=(N!==null?N:f.startDTS*o)+this._initDTS,z=f.endDTS*o+this._initDTS,F=D*S,I=Math.ceil((z-W)/F),B=M.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(C.logger.warn("[mp4-remuxer]: remux empty Audio"),!B){C.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Y=[],Q=0;Q<I;Q++){var ee=W+Q*F;Y.push({unit:B,pts:ee,dts:ee})}return c.samples=Y,this.remuxAudio(c,l,a,!1)},y.remuxID3=function(c,l){var a=c.samples.length;if(!a)return;for(var f=c.inputTimeScale,o=this._initPTS,v=this._initDTS,D=0;D<a;D++){var N=c.samples[D];N.pts=h(N.pts-o,l*f)/f,N.dts=h(N.dts-v,l*f)/f}var W=c.samples;return c.samples=[],{samples:W}},y.remuxText=function(c,l){var a=c.samples.length;if(!a)return;for(var f=c.inputTimeScale,o=this._initPTS,v=0;v<a;v++){var D=c.samples[v];D.pts=h(D.pts-o,l*f)/f}c.samples.sort(function(W,z){return W.pts-z.pts});var N=c.samples;return c.samples=[],{samples:N}},w}();function h(w,y){var p;if(y===null)return w;for(y<w?p=-8589934592:p=8589934592;Math.abs(w-y)>4294967296;)w+=p;return w}function E(w){for(var y=0;y<w.length;y++)if(w[y].key)return y;return-1}var m=function(y,p,c,l){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=p,this.size=c,this.cts=l,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,V,L){"use strict";L.r(V);var K=L("./src/polyfills/number.ts"),M=L("./src/utils/mp4-tools.ts"),P=L("./src/loader/fragment.ts"),j=L("./src/utils/logger.ts"),k=function(){function x(){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 A=x.prototype;return A.destroy=function(){},A.resetTimeStamp=function(S){this.initPTS=S,this.lastEndDTS=null},A.resetNextTimestamp=function(){this.lastEndDTS=null},A.resetInitSegment=function(S,_,b){this.audioCodec=_,this.videoCodec=b,this.generateInitSegment(S),this.emitInitSegment=!0},A.generateInitSegment=function(S){var _=this.audioCodec,b=this.videoCodec;if(!S||!S.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(M.parseInitSegment)(S);_||(_=R(d.audio,P.ElementaryStreamTypes.AUDIO)),b||(b=R(d.video,P.ElementaryStreamTypes.VIDEO));var s={};d.audio&&d.video?s.audiovideo={container:"video/mp4",codec:_+","+b,initSegment:S,id:"main"}:d.audio?s.audio={container:"audio/mp4",codec:_,initSegment:S,id:"audio"}:d.video?s.video={container:"video/mp4",codec:b,initSegment:S,id:"main"}:j.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=s},A.remux=function(S,_,b,d,s){var u=this.initPTS,h=this.lastEndDTS,E={audio:void 0,video:void 0,text:d,id3:b,initSegment:void 0};Object(K.isFiniteNumber)(h)||(h=this.lastEndDTS=s||0);var m=_.samples;if(!m||!m.length)return E;var g={initPTS:void 0,timescale:1},w=this.initData;if((!w||!w.length)&&(this.generateInitSegment(m),w=this.initData),!w||!w.length)return j.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),E;this.emitInitSegment&&(g.tracks=this.initTracks,this.emitInitSegment=!1),Object(K.isFiniteNumber)(u)||(this.initPTS=g.initPTS=u=C(w,m,h));var y=Object(M.getDuration)(m,w),p=h,c=y+p;Object(M.offsetStartDTS)(w,m,u),y>0?this.lastEndDTS=c:(j.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var l=!!w.audio,a=!!w.video,f="";l&&(f+="audio"),a&&(f+="video");var o={data1:m,startPTS:p,startDTS:p,endPTS:c,endDTS:c,type:f,hasAudio:l,hasVideo:a,nb:1,dropped:0};return E.audio=o.type==="audio"?o:void 0,E.video=o.type!=="audio"?o:void 0,E.text=d,E.id3=b,E.initSegment=g,E},x}(),C=function(A,O,S){return Object(M.getStartDTS)(A,O)-S};function R(x,A){var O=x==null?void 0:x.codec;return O&&O.length>4?O:O==="hvc1"?"hvc1.1.c.L120.90":O==="av01"?"av01.0.04M.08":O==="avc1"||A===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}V.default=k},"./src/task-loop.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return K});var K=function(){function M(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var P=M.prototype;return P.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},P.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},P.onHandlerDestroyed=function(){},P.hasInterval=function(){return!!this._tickInterval},P.hasNextTick=function(){return!!this._tickTimer},P.setInterval=function(k){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,k),!0)},P.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},P.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},P.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},P.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},P.doTick=function(){},M}()},"./src/types/cmcd.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"CMCDVersion",function(){return K}),L.d(V,"CMCDObjectType",function(){return M}),L.d(V,"CMCDStreamingFormat",function(){return P}),L.d(V,"CMCDStreamType",function(){return j});var K=1,M;(function(k){k.MANIFEST="m",k.AUDIO="a",k.VIDEO="v",k.MUXED="av",k.INIT="i",k.CAPTION="c",k.TIMED_TEXT="tt",k.KEY="k",k.OTHER="o"})(M||(M={}));var P;(function(k){k.DASH="d",k.HLS="h",k.SMOOTH="s",k.OTHER="o"})(P||(P={}));var j;(function(k){k.VOD="v",k.LIVE="l"})(j||(j={}))},"./src/types/level.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"HlsSkip",function(){return P}),L.d(V,"getSkipValue",function(){return j}),L.d(V,"HlsUrlParameters",function(){return k}),L.d(V,"Level",function(){return C});function K(R,x){for(var A=0;A<x.length;A++){var O=x[A];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(R,O.key,O)}}function M(R,x,A){return x&&K(R.prototype,x),A&&K(R,A),R}var P;(function(R){R.No="",R.Yes="YES",R.v2="v2"})(P||(P={}));function j(R,x){var A=R.canSkipUntil,O=R.canSkipDateRanges,S=R.endSN,_=x!==void 0?x-S:0;return A&&_<A?O?P.v2:P.Yes:P.No}var k=function(){function R(A,O,S){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=A,this.part=O,this.skip=S}var x=R.prototype;return x.addDirectives=function(O){var S=new self.URL(O);return this.msn!==void 0&&S.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&S.searchParams.set("_HLS_part",this.part.toString()),this.skip&&S.searchParams.set("_HLS_skip",this.skip),S.toString()},R}(),C=function(){function R(x){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=[x.url],this.attrs=x.attrs,this.bitrate=x.bitrate,x.details&&(this.details=x.details),this.id=x.id||0,this.name=x.name,this.width=x.width||0,this.height=x.height||0,this.audioCodec=x.audioCodec,this.videoCodec=x.videoCodec,this.unknownCodecs=x.unknownCodecs,this.codecSet=[x.videoCodec,x.audioCodec].filter(function(A){return A}).join(",").replace(/\.[^.,]+/g,"")}return M(R,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(A){var O=A%this.url.length;this._urlId!==O&&(this.details=void 0,this._urlId=O)}}]),R}()},"./src/types/loader.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"PlaylistContextType",function(){return K}),L.d(V,"PlaylistLevelType",function(){return M});var K;(function(P){P.MANIFEST="manifest",P.LEVEL="level",P.AUDIO_TRACK="audioTrack",P.SUBTITLE_TRACK="subtitleTrack"})(K||(K={}));var M;(function(P){P.MAIN="main",P.AUDIO="audio",P.SUBTITLE="subtitle"})(M||(M={}))},"./src/types/transmuxer.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"ChunkMetadata",function(){return K});var K=function(j,k,C,R,x,A){R===void 0&&(R=0),x===void 0&&(x=-1),A===void 0&&(A=!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=M(),this.buffering={audio:M(),video:M(),audiovideo:M()},this.level=j,this.sn=k,this.id=C,this.size=R,this.part=x,this.partial=A};function M(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"AttrList",function(){return P});var K=/^(\d+)x(\d+)$/,M=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,P=function(){function j(C){typeof C=="string"&&(C=j.parseAttrList(C));for(var R in C)C.hasOwnProperty(R)&&(this[R]=C[R])}var k=j.prototype;return k.decimalInteger=function(R){var x=parseInt(this[R],10);return x>Number.MAX_SAFE_INTEGER?Infinity:x},k.hexadecimalInteger=function(R){if(this[R]){var x=(this[R]||"0x").slice(2);x=(x.length&1?"0":"")+x;for(var A=new Uint8Array(x.length/2),O=0;O<x.length/2;O++)A[O]=parseInt(x.slice(O*2,O*2+2),16);return A}else return null},k.hexadecimalIntegerAsNumber=function(R){var x=parseInt(this[R],16);return x>Number.MAX_SAFE_INTEGER?Infinity:x},k.decimalFloatingPoint=function(R){return parseFloat(this[R])},k.optionalFloat=function(R,x){var A=this[R];return A?parseFloat(A):x},k.enumeratedString=function(R){return this[R]},k.bool=function(R){return this[R]==="YES"},k.decimalResolution=function(R){var x=K.exec(this[R]);return x===null?void 0:{width:parseInt(x[1],10),height:parseInt(x[2],10)}},j.parseAttrList=function(R){var x,A={},O='"';for(M.lastIndex=0;(x=M.exec(R))!==null;){var S=x[2];S.indexOf(O)===0&&S.lastIndexOf(O)===S.length-1&&(S=S.slice(1,-1)),A[x[1]]=S}return A},j}()},"./src/utils/binary-search.ts":function(re,V,L){"use strict";L.r(V);var K={search:function(P,j){for(var k=0,C=P.length-1,R=null,x=null;k<=C;){R=(k+C)/2|0,x=P[R];var A=j(x);if(A>0)k=R+1;else if(A<0)C=R-1;else return x}return null}};V.default=K},"./src/utils/buffer-helper.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"BufferHelper",function(){return P});var K=L("./src/utils/logger.ts"),M={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function j(){}return j.isBuffered=function(C,R){try{if(C){for(var x=j.getBuffered(C),A=0;A<x.length;A++)if(R>=x.start(A)&&R<=x.end(A))return!0}}catch(O){}return!1},j.bufferInfo=function(C,R,x){try{if(C){var A=j.getBuffered(C),O=[],S;for(S=0;S<A.length;S++)O.push({start:A.start(S),end:A.end(S)});return this.bufferedInfo(O,R,x)}}catch(_){}return{len:0,start:R,end:R,nextStart:void 0}},j.bufferedInfo=function(C,R,x){R=Math.max(0,R),C.sort(function(g,w){var y=g.start-w.start;return y||w.end-g.end});var A=[];if(x)for(var O=0;O<C.length;O++){var S=A.length;if(S){var _=A[S-1].end;C[O].start-_<x?C[O].end>_&&(A[S-1].end=C[O].end):A.push(C[O])}else A.push(C[O])}else A=C;for(var b=0,d,s=R,u=R,h=0;h<A.length;h++){var E=A[h].start,m=A[h].end;if(R+x>=E&&R<m)s=E,u=m,b=u-R;else if(R+x<E){d=E;break}}return{len:b,start:s||0,end:u||0,nextStart:d}},j.getBuffered=function(C){try{return C.buffered}catch(R){return K.logger.log("failed to get media.buffered",R),M}},j}()},"./src/utils/cea-608-parser.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"Row",function(){return u}),L.d(V,"CaptionScreen",function(){return h});var K=L("./src/utils/logger.ts"),M={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},P=function(c){var l=c;return M.hasOwnProperty(c)&&(l=M[c]),String.fromCharCode(l)},j=15,k=100,C={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},R={17:2,18:4,21:6,22:8,23:10,19:13,20:15},x={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},A={25:2,26:4,29:6,30:8,31:10,27:13,28:15},O=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],S;(function(p){p[p.ERROR=0]="ERROR",p[p.TEXT=1]="TEXT",p[p.WARNING=2]="WARNING",p[p.INFO=2]="INFO",p[p.DEBUG=3]="DEBUG",p[p.DATA=3]="DATA"})(S||(S={}));var _=function(){function p(){this.time=null,this.verboseLevel=S.ERROR}var c=p.prototype;return c.log=function(a,f){this.verboseLevel>=a&&K.logger.log(this.time+" ["+a+"] "+f)},p}(),b=function(c){for(var l=[],a=0;a<c.length;a++)l.push(c[a].toString(16));return l},d=function(){function p(l,a,f,o,v){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=l||"white",this.underline=a||!1,this.italics=f||!1,this.background=o||"black",this.flash=v||!1}var c=p.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 f=["foreground","underline","italics","background","flash"],o=0;o<f.length;o++){var v=f[o];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},p}(),s=function(){function p(l,a,f,o,v,D){this.uchar=void 0,this.penState=void 0,this.uchar=l||" ",this.penState=new d(a,f,o,v,D)}var c=p.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,f){this.uchar=a,this.penState.copy(f)},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()},p}(),u=function(){function p(l){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<k;a++)this.chars.push(new s);this.logger=l,this.pos=0,this.currPenState=new d}var c=p.prototype;return c.equals=function(a){for(var f=!0,o=0;o<k;o++)if(!this.chars[o].equals(a.chars[o])){f=!1;break}return f},c.copy=function(a){for(var f=0;f<k;f++)this.chars[f].copy(a.chars[f])},c.isEmpty=function(){for(var a=!0,f=0;f<k;f++)if(!this.chars[f].isEmpty()){a=!1;break}return a},c.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(S.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>k&&(this.logger.log(S.DEBUG,"Too large cursor position "+this.pos),this.pos=k)},c.moveCursor=function(a){var f=this.pos+a;if(a>1)for(var o=this.pos+1;o<f+1;o++)this.chars[o].setPenState(this.currPenState);this.setCursor(f)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var f=P(a);if(this.pos>=k){this.logger.log(S.ERROR,"Cannot insert "+a.toString(16)+" ("+f+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(f,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var f;for(f=a;f<k;f++)this.chars[f].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=[],f=!0,o=0;o<k;o++){var v=this.chars[o].uchar;v!==" "&&(f=!1),a.push(v)}return f?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var f=this.chars[this.pos];f.setPenState(this.currPenState)},p}(),h=function(){function p(l){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<j;a++)this.rows.push(new u(l));this.logger=l,this.currRow=j-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=p.prototype;return c.reset=function(){for(var a=0;a<j;a++)this.rows[a].clear();this.currRow=j-1},c.equals=function(a){for(var f=!0,o=0;o<j;o++)if(!this.rows[o].equals(a.rows[o])){f=!1;break}return f},c.copy=function(a){for(var f=0;f<j;f++)this.rows[f].copy(a.rows[f])},c.isEmpty=function(){for(var a=!0,f=0;f<j;f++)if(!this.rows[f].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 f=this.rows[this.currRow];f.insertChar(a)},c.setPen=function(a){var f=this.rows[this.currRow];f.setPenStyles(a)},c.moveCursor=function(a){var f=this.rows[this.currRow];f.moveCursor(a)},c.setCursor=function(a){this.logger.log(S.INFO,"setCursor: "+a);var f=this.rows[this.currRow];f.setCursor(a)},c.setPAC=function(a){this.logger.log(S.INFO,"pacData = "+JSON.stringify(a));var f=a.row-1;if(this.nrRollUpRows&&f<this.nrRollUpRows-1&&(f=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==f){for(var o=0;o<j;o++)this.rows[o].clear();var v=this.currRow+1-this.nrRollUpRows,D=this.lastOutputScreen;if(D){var N=D.rows[v].cueStartTime,W=this.logger.time;if(N&&W!==null&&N<W)for(var z=0;z<this.nrRollUpRows;z++)this.rows[f-this.nrRollUpRows+z+1].copy(D.rows[v+z])}}this.currRow=f;var F=this.rows[this.currRow];if(a.indent!==null){var I=a.indent,B=Math.max(I-1,0);F.setCursor(a.indent),a.color=F.chars[B].penState.foreground}var Y={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(Y)},c.setBkgData=function(a){this.logger.log(S.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(S.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(S.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,f=this.rows.splice(a,1)[0];f.clear(),this.rows.splice(this.currRow,0,f),this.logger.log(S.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var f=[],o="",v=-1,D=0;D<j;D++){var N=this.rows[D].getTextString();N&&(v=D+1,a?f.push("Row "+v+": '"+N+"'"):f.push(N.trim()))}return f.length>0&&(a?o="["+f.join(" | ")+"]":o=f.join(`
|
|
`)),o},c.getTextAndFormat=function(){return this.rows},p}(),E=function(){function p(l,a,f){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=l,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new h(f),this.nonDisplayedMemory=new h(f),this.lastOutputScreen=new h(f),this.currRollUpRow=this.displayedMemory.rows[j-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=f}var c=p.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[j-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(S.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 f=0;f<a.length;f++)this.writeScreen.insertChar(a[f]);var o=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(S.INFO,o+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(S.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(S.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(S.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(S.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(S.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(S.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(S.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(S.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(S.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(S.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(S.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(S.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(S.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(S.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(S.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var f={flash:!1};if(f.underline=a%2===1,f.italics=a>=46,f.italics)f.foreground="white";else{var o=Math.floor(a/2)-16,v=["white","green","blue","cyan","red","yellow","magenta"];f.foreground=v[o]}this.logger.log(S.INFO,"MIDROW: "+JSON.stringify(f)),this.writeScreen.setPen(f)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var f=this.logger.time;if(f===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=f:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,f,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:f),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))},p}(),m=function(){function p(l,a,f){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var o=new _;this.channels=[null,new E(l,a,o),new E(l+1,f,o)],this.cmdHistory=y(),this.logger=o}var c=p.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,f){this.channels[a].setHandler(f)},c.addData=function(a,f){var o,v,D,N=!1;this.logger.time=a;for(var W=0;W<f.length;W+=2){if(v=f[W]&127,D=f[W+1]&127,v===0&&D===0)continue;if(this.logger.log(S.DATA,"["+b([f[W],f[W+1]])+"] -> ("+b([v,D])+")"),o=this.parseCmd(v,D),o||(o=this.parseMidrow(v,D)),o||(o=this.parsePAC(v,D)),o||(o=this.parseBackgroundAttributes(v,D)),!o&&(N=this.parseChars(v,D),N)){var z=this.currentChannel;if(z&&z>0){var F=this.channels[z];F.insertChars(N)}else this.logger.log(S.WARNING,"No channel found yet. TEXT-MODE?")}!o&&!N&&this.logger.log(S.WARNING,"Couldn't parse cleaned data "+b([v,D])+" orig: "+b([f[W],f[W+1]]))}},c.parseCmd=function(a,f){var o=this.cmdHistory,v=(a===20||a===28||a===21||a===29)&&f>=32&&f<=47,D=(a===23||a===31)&&f>=33&&f<=35;if(!(v||D))return!1;if(w(a,f,o))return g(null,null,o),this.logger.log(S.DEBUG,"Repeated command ("+b([a,f])+") is dropped"),!0;var N=a===20||a===21||a===23?1:2,W=this.channels[N];return a===20||a===21||a===28||a===29?f===32?W.ccRCL():f===33?W.ccBS():f===34?W.ccAOF():f===35?W.ccAON():f===36?W.ccDER():f===37?W.ccRU(2):f===38?W.ccRU(3):f===39?W.ccRU(4):f===40?W.ccFON():f===41?W.ccRDC():f===42?W.ccTR():f===43?W.ccRTD():f===44?W.ccEDM():f===45?W.ccCR():f===46?W.ccENM():f===47&&W.ccEOC():W.ccTO(f-32),g(a,f,o),this.currentChannel=N,!0},c.parseMidrow=function(a,f){var o=0;if((a===17||a===25)&&f>=32&&f<=47){if(a===17?o=1:o=2,o!==this.currentChannel)return this.logger.log(S.ERROR,"Mismatch channel in midrow parsing"),!1;var v=this.channels[o];return v?(v.ccMIDROW(f),this.logger.log(S.DEBUG,"MIDROW ("+b([a,f])+")"),!0):!1}return!1},c.parsePAC=function(a,f){var o,v=this.cmdHistory,D=(a>=17&&a<=23||a>=25&&a<=31)&&f>=64&&f<=127,N=(a===16||a===24)&&f>=64&&f<=95;if(!(D||N))return!1;if(w(a,f,v))return g(null,null,v),!0;var W=a<=23?1:2;f>=64&&f<=95?o=W===1?C[a]:x[a]:o=W===1?R[a]:A[a];var z=this.channels[W];return z?(z.setPAC(this.interpretPAC(o,f)),g(a,f,v),this.currentChannel=W,!0):!1},c.interpretPAC=function(a,f){var o,v={color:null,italics:!1,indent:null,underline:!1,row:a};return f>95?o=f-96:o=f-64,v.underline=(o&1)===1,o<=13?v.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(o/2)]:o<=15?(v.italics=!0,v.color="white"):v.indent=Math.floor((o-16)/2)*4,v},c.parseChars=function(a,f){var o,v=null,D=null;if(a>=25?(o=2,D=a-8):(o=1,D=a),D>=17&&D<=19){var N;D===17?N=f+80:D===18?N=f+112:N=f+144,this.logger.log(S.INFO,"Special char '"+P(N)+"' in channel "+o),v=[N]}else a>=32&&a<=127&&(v=f===0?[a]:[a,f]);if(v){var W=b(v);this.logger.log(S.DEBUG,"Char codes = "+W.join(",")),g(a,f,this.cmdHistory)}return v},c.parseBackgroundAttributes=function(a,f){var o=(a===16||a===24)&&f>=32&&f<=47,v=(a===23||a===31)&&f>=45&&f<=47;if(!(o||v))return!1;var D,N={};a===16||a===24?(D=Math.floor((f-32)/2),N.background=O[D],f%2===1&&(N.background=N.background+"_semi")):f===45?N.background="transparent":(N.foreground="black",f===47&&(N.underline=!0));var W=a<=23?1:2,z=this.channels[W];return z.setBkgData(N),g(a,f,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var f=this.channels[a];f&&f.reset()}this.cmdHistory=y()},c.cueSplitAtTime=function(a){for(var f=0;f<this.channels.length;f++){var o=this.channels[f];o&&o.cueSplitAtTime(a)}},p}();function g(p,c,l){l.a=p,l.b=c}function w(p,c,l){return l.a===p&&l.b===c}function y(){return{a:null,b:null}}V.default=m},"./src/utils/codecs.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"isCodecType",function(){return M}),L.d(V,"isCodecSupportedInMp4",function(){return P});var K={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 M(j,k){var C=K[k];return!!C&&C[j.slice(0,4)]===!0}function P(j,k){return MediaSource.isTypeSupported((k||"video")+'/mp4;codecs="'+j+'"')}},"./src/utils/cues.ts":function(re,V,L){"use strict";L.r(V);var K=L("./src/utils/vttparser.ts"),M=L("./src/utils/webvtt-parser.ts"),P=L("./src/utils/texttrack-utils.ts"),j=/\s/,k={newCue:function(R,x,A,O){for(var S=[],_,b,d,s,u,h=self.VTTCue||self.TextTrackCue,E=0;E<O.rows.length;E++)if(_=O.rows[E],d=!0,s=0,u="",!_.isEmpty()){for(var m=0;m<_.chars.length;m++)j.test(_.chars[m].uchar)&&d?s++:(u+=_.chars[m].uchar,d=!1);_.cueStartTime=x,x===A&&(A+=1e-4),s>=16?s--:s++;var g=Object(K.fixLineBreaks)(u.trim()),w=Object(M.generateCueId)(x,A,g);(!R||!R.cues||!R.cues.getCueById(w))&&(b=new h(x,A,g),b.id=w,b.line=E+1,b.align="left",b.position=10+Math.min(80,Math.floor(s*8/32)*10),S.push(b))}return R&&S.length&&(S.sort(function(y,p){return y.line==="auto"||p.line==="auto"?0:y.line>8&&p.line>8?p.line-y.line:y.line-p.line}),S.forEach(function(y){return Object(P.addCueToTrack)(R,y)})),S}};V.default=k},"./src/utils/discontinuities.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"findFirstFragWithCC",function(){return j}),L.d(V,"shouldAlignOnDiscontinuities",function(){return k}),L.d(V,"findDiscontinuousReferenceFrag",function(){return C}),L.d(V,"adjustSlidingStart",function(){return x}),L.d(V,"alignStream",function(){return A}),L.d(V,"alignPDT",function(){return S}),L.d(V,"alignFragmentByPDTDelta",function(){return _}),L.d(V,"alignMediaPlaylistByPDT",function(){return b});var K=L("./src/polyfills/number.ts"),M=L("./src/utils/logger.ts"),P=L("./src/controller/level-helper.ts");function j(d,s){for(var u=null,h=0,E=d.length;h<E;h++){var m=d[h];if(m&&m.cc===s){u=m;break}}return u}function k(d,s,u){return!!(s.details&&(u.endCC>u.startCC||d&&d.cc<u.startCC))}function C(d,s){var u=d.fragments,h=s.fragments;if(!h.length||!u.length){M.logger.log("No fragments to align");return}var E=j(u,h[0].cc);if(!E||E&&!E.startPTS){M.logger.log("No frag in previous level to align on");return}return E}function R(d,s){if(d){var u=d.start+s;d.start=d.startPTS=u,d.endPTS=u+d.duration}}function x(d,s){for(var u=s.fragments,h=0,E=u.length;h<E;h++)R(u[h],d);s.fragmentHint&&R(s.fragmentHint,d),s.alignedSliding=!0}function A(d,s,u){if(!s)return;O(d,u,s),!u.alignedSliding&&s.details&&S(u,s.details),!u.alignedSliding&&s.details&&!u.skippedSegments&&Object(P.adjustSliding)(s.details,u)}function O(d,s,u){if(k(d,u,s)){var h=C(u.details,s);h&&Object(K.isFiniteNumber)(h.start)&&(M.logger.log("Adjusting PTS using last level due to CC increase within current level "+s.url),x(h.start,s))}}function S(d,s){if(!s.fragments.length||!d.hasProgramDateTime||!s.hasProgramDateTime)return;var u=s.fragments[0].programDateTime,h=d.fragments[0].programDateTime,E=(h-u)/1e3+s.fragments[0].start;E&&Object(K.isFiniteNumber)(E)&&(M.logger.log("Adjusting PTS using programDateTime delta "+(h-u)+"ms, sliding:"+E.toFixed(3)+" "+d.url+" "),x(E,d))}function _(d,s){var u=d.programDateTime;if(!u)return;var h=(u-s)/1e3;d.start=d.startPTS=h,d.endPTS=h+d.duration}function b(d,s){if(!s.fragments.length||!d.hasProgramDateTime||!s.hasProgramDateTime)return;var u=s.fragments[0].programDateTime,h=s.fragments[0].start,E=u-h*1e3;d.fragments.forEach(function(m){_(m,E)}),d.fragmentHint&&_(d.fragmentHint,E),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(re,V,L){"use strict";L.r(V);var K=L("./src/utils/ewma.ts"),M=function(){function P(k,C,R){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=R,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new K.default(k),this.fast_=new K.default(C)}var j=P.prototype;return j.update=function(C,R){var x=this.slow_,A=this.fast_;this.slow_.halfLife!==C&&(this.slow_=new K.default(C,x.getEstimate(),x.getTotalWeight())),this.fast_.halfLife!==R&&(this.fast_=new K.default(R,A.getEstimate(),A.getTotalWeight()))},j.sample=function(C,R){C=Math.max(C,this.minDelayMs_);var x=8*R,A=C/1e3,O=x/A;this.fast_.sample(A,O),this.slow_.sample(A,O)},j.canEstimate=function(){var C=this.fast_;return C&&C.getTotalWeight()>=this.minWeight_},j.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},j.destroy=function(){},P}();V.default=M},"./src/utils/ewma.ts":function(re,V,L){"use strict";L.r(V);var K=function(){function M(j,k,C){k===void 0&&(k=0),C===void 0&&(C=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=j,this.alpha_=j?Math.exp(Math.log(.5)/j):0,this.estimate_=k,this.totalWeight_=C}var P=M.prototype;return P.sample=function(k,C){var R=Math.pow(this.alpha_,k);this.estimate_=C*(1-R)+R*this.estimate_,this.totalWeight_+=k},P.getTotalWeight=function(){return this.totalWeight_},P.getEstimate=function(){if(this.alpha_){var k=1-Math.pow(this.alpha_,this.totalWeight_);if(k)return this.estimate_/k}return this.estimate_},M}();V.default=K},"./src/utils/fetch-loader.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"fetchSupported",function(){return _});var K=L("./src/polyfills/number.ts"),M=L("./src/loader/load-stats.ts"),P=L("./src/demux/chunk-cache.ts");function j(h,E){h.prototype=Object.create(E.prototype),h.prototype.constructor=h,A(h,E)}function k(h){var E=typeof Map=="function"?new Map:void 0;return k=function(g){if(g===null||!x(g))return g;if(typeof g!="function")throw new TypeError("Super expression must either be null or a function");if(typeof E!="undefined"){if(E.has(g))return E.get(g);E.set(g,w)}function w(){return C(g,arguments,O(this).constructor)}return w.prototype=Object.create(g.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),A(w,g)},k(h)}function C(h,E,m){return R()?C=Reflect.construct:C=function(w,y,p){var c=[null];c.push.apply(c,y);var l=Function.bind.apply(w,c),a=new l;return p&&A(a,p.prototype),a},C.apply(null,arguments)}function R(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(h){return!1}}function x(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function A(h,E){return A=Object.setPrototypeOf||function(g,w){return g.__proto__=w,g},A(h,E)}function O(h){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(m){return m.__proto__||Object.getPrototypeOf(m)},O(h)}function S(){return S=Object.assign||function(h){for(var E=1;E<arguments.length;E++){var m=arguments[E];for(var g in m)Object.prototype.hasOwnProperty.call(m,g)&&(h[g]=m[g])}return h},S.apply(this,arguments)}function _(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(h){}return!1}var b=function(){function h(m){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=m.fetchSetup||s,this.controller=new self.AbortController,this.stats=new M.LoadStats}var E=h.prototype;return E.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},E.abortInternal=function(){var g=this.response;(!g||!g.ok)&&(this.stats.aborted=!0,this.controller.abort())},E.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},E.load=function(g,w,y){var p=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var l=d(g,this.controller.signal),a=y.onProgress,f=g.responseType==="arraybuffer",o=f?"byteLength":"length";this.context=g,this.config=w,this.callbacks=y,this.request=this.fetchSetup(g,l),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){p.abortInternal(),y.onTimeout(c,g,p.response)},w.timeout),self.fetch(this.request).then(function(v){if(p.response=p.loader=v,!v.ok){var D=v.status,N=v.statusText;throw new u(N||"fetch, bad network response",D,v)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(v.headers.get("Content-Length")||"0"),a&&Object(K.isFiniteNumber)(w.highWaterMark)?p.loadProgressively(v,c,g,w.highWaterMark,a):f?v.arrayBuffer():v.text()}).then(function(v){var D=p.response;self.clearTimeout(p.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=v[o];var N={url:D.url,data:v};a&&!Object(K.isFiniteNumber)(w.highWaterMark)&&a(c,g,v,D),y.onSuccess(N,c,g,D)}).catch(function(v){if(self.clearTimeout(p.requestTimeout),c.aborted)return;var D=v.code||0;y.onError({code:D,text:v.message},g,v.details)})},E.getCacheAge=function(){var g=null;if(this.response){var w=this.response.headers.get("age");g=w?parseFloat(w):null}return g},E.loadProgressively=function(g,w,y,p,c){p===void 0&&(p=0);var l=new P.default,a=g.body.getReader(),f=function o(){return a.read().then(function(v){if(v.done)return l.dataLength&&c(w,y,l.flush(),g),Promise.resolve(new ArrayBuffer(0));var D=v.value,N=D.length;return w.loaded+=N,N<p||l.dataLength?(l.push(D),l.dataLength>=p&&c(w,y,l.flush(),g)):c(w,y,D,g),o()}).catch(function(){return Promise.reject()})};return f()},h}();function d(h,E){var m={method:"GET",mode:"cors",credentials:"same-origin",signal:E,headers:new self.Headers(S({},h.headers))};return h.rangeEnd&&m.headers.set("Range","bytes="+h.rangeStart+"-"+String(h.rangeEnd-1)),m}function s(h,E){return new self.Request(h.url,E)}var u=function(h){j(E,h);function E(m,g,w){var y;return y=h.call(this,m)||this,y.code=void 0,y.details=void 0,y.code=g,y.details=w,y}return E}(k(Error));V.default=b},"./src/utils/imsc1-ttml-parser.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"IMSC1_CODEC",function(){return x}),L.d(V,"parseIMSC1",function(){return _});var K=L("./src/utils/mp4-tools.ts"),M=L("./src/utils/vttparser.ts"),P=L("./src/utils/vttcue.ts"),j=L("./src/demux/id3.ts"),k=L("./src/utils/timescale-conversion.ts"),C=L("./src/utils/webvtt-parser.ts");function R(){return R=Object.assign||function(p){for(var c=1;c<arguments.length;c++){var l=arguments[c];for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&(p[a]=l[a])}return p},R.apply(this,arguments)}var x="stpp.ttml.im1t",A=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,O=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,S={left:"start",center:"center",right:"end",start:"start",end:"end"};function _(p,c,l,a,f){var o=Object(K.findBox)(new Uint8Array(p),["mdat"]);if(o.length===0){f(new Error("Could not parse IMSC1 mdat"));return}var v=o[0],D=Object(j.utf8ArrayToStr)(new Uint8Array(p,v.start,v.end-v.start)),N=Object(k.toTimescaleFromScale)(c,1,l);try{a(b(D,N))}catch(W){f(W)}}function b(p,c){var l=new DOMParser,a=l.parseFromString(p,"text/xml"),f=a.getElementsByTagName("tt")[0];if(!f)throw new Error("Invalid ttml");var o={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},v=Object.keys(o).reduce(function(F,I){return F[I]=f.getAttribute("ttp:"+I)||o[I],F},{}),D=f.getAttribute("xml:space")!=="preserve",N=s(d(f,"styling","style")),W=s(d(f,"layout","region")),z=d(f,"body","[begin]");return[].map.call(z,function(F){var I=u(F,D);if(!I||!F.hasAttribute("begin"))return null;var B=g(F.getAttribute("begin"),v),Y=g(F.getAttribute("dur"),v),Q=g(F.getAttribute("end"),v);if(B===null)throw m(F);if(Q===null){if(Y===null)throw m(F);Q=B+Y}var ee=new P.default(B-c,Q-c,I);ee.id=Object(C.generateCueId)(ee.startTime,ee.endTime,ee.text);var fe=W[F.getAttribute("region")],ce=N[F.getAttribute("style")];ee.position=10,ee.size=80;var ge=h(fe,ce),pe=ge.textAlign;if(pe){var ue=S[pe];ue&&(ee.lineAlign=ue),ee.align=pe}return R(ee,ge),ee}).filter(function(F){return F!==null})}function d(p,c,l){var a=p.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(l)):[]}function s(p){return p.reduce(function(c,l){var a=l.getAttribute("xml:id");return a&&(c[a]=l),c},{})}function u(p,c){return[].slice.call(p.childNodes).reduce(function(l,a,f){var o;return a.nodeName==="br"&&f?l+`
|
|
`:(o=a.childNodes)!==null&&o!==void 0&&o.length?u(a,c):c?l+a.textContent.trim().replace(/\s+/g," "):l+a.textContent},"")}function h(p,c){var l="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(f,o){var v=E(c,l,o)||E(p,l,o);return v&&(f[o]=v),f},{})}function E(p,c,l){return p.hasAttributeNS(c,l)?p.getAttributeNS(c,l):null}function m(p){return new Error("Could not parse ttml timestamp "+p)}function g(p,c){if(!p)return null;var l=Object(M.parseTimeStamp)(p);return l===null&&(A.test(p)?l=w(p,c):O.test(p)&&(l=y(p,c))),l}function w(p,c){var l=A.exec(p),a=(l[4]|0)+(l[5]|0)/c.subFrameRate;return(l[1]|0)*3600+(l[2]|0)*60+(l[3]|0)+a/c.frameRate}function y(p,c){var l=O.exec(p),a=Number(l[1]),f=l[2];switch(f){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/c.frameRate;case"t":return a/c.tickRate}return a}},"./src/utils/logger.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"enableLogs",function(){return C}),L.d(V,"logger",function(){return R});var K=function(){},M={trace:K,debug:K,log:K,warn:K,info:K,error:K},P=M;function j(x){var A=self.console[x];return A?A.bind(self.console,"["+x+"] >"):K}function k(x){for(var A=arguments.length,O=new Array(A>1?A-1:0),S=1;S<A;S++)O[S-1]=arguments[S];O.forEach(function(_){P[_]=x[_]?x[_].bind(x):j(_)})}function C(x){if(self.console&&x===!0||typeof x=="object"){k(x,"debug","log","info","warn","error");try{P.log()}catch(A){P=M}}else P=M}var R=P},"./src/utils/mediakeys-helper.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"KeySystems",function(){return K}),L.d(V,"requestMediaKeySystemAccess",function(){return M});var K;(function(P){P.WIDEVINE="com.widevine.alpha",P.PLAYREADY="com.microsoft.playready"})(K||(K={}));var M=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"getMediaSource",function(){return K});function K(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"bin2str",function(){return k}),L.d(V,"readUint16",function(){return C}),L.d(V,"readUint32",function(){return R}),L.d(V,"writeUint32",function(){return x}),L.d(V,"findBox",function(){return A}),L.d(V,"parseSegmentIndex",function(){return O}),L.d(V,"parseInitSegment",function(){return S}),L.d(V,"getStartDTS",function(){return _}),L.d(V,"getDuration",function(){return b}),L.d(V,"computeRawDurationFromSamples",function(){return d}),L.d(V,"offsetStartDTS",function(){return s}),L.d(V,"segmentValidRange",function(){return u}),L.d(V,"appendUint8Array",function(){return h});var K=L("./src/utils/typed-array.ts"),M=L("./src/loader/fragment.ts"),P=Math.pow(2,32)-1,j=[].push;function k(E){return String.fromCharCode.apply(null,E)}function C(E,m){"data"in E&&(m+=E.start,E=E.data);var g=E[m]<<8|E[m+1];return g<0?65536+g:g}function R(E,m){"data"in E&&(m+=E.start,E=E.data);var g=E[m]<<24|E[m+1]<<16|E[m+2]<<8|E[m+3];return g<0?4294967296+g:g}function x(E,m,g){"data"in E&&(m+=E.start,E=E.data),E[m]=g>>24,E[m+1]=g>>16&255,E[m+2]=g>>8&255,E[m+3]=g&255}function A(E,m){var g=[];if(!m.length)return g;var w,y,p;"data"in E?(w=E.data,y=E.start,p=E.end):(w=E,y=0,p=w.byteLength);for(var c=y;c<p;){var l=R(w,c),a=k(w.subarray(c+4,c+8)),f=l>1?c+l:p;if(a===m[0])if(m.length===1)g.push({data:w,start:c+8,end:f});else{var o=A({data:w,start:c+8,end:f},m.slice(1));o.length&&j.apply(g,o)}c=f}return g}function O(E){var m=A(E,["moov"]),g=m[0],w=g?g.end:null,y=A(E,["sidx"]);if(!y||!y[0])return null;var p=[],c=y[0],l=c.data[0],a=l===0?8:16,f=R(c,a);a+=4;var o=0,v=0;l===0?a+=8:a+=16,a+=2;var D=c.end+v,N=C(c,a);a+=2;for(var W=0;W<N;W++){var z=a,F=R(c,z);z+=4;var I=F&2147483647,B=(F&2147483648)>>>31;if(B===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Y=R(c,z);z+=4,p.push({referenceSize:I,subsegmentDuration:Y,info:{duration:Y/f,start:D,end:D+I-1}}),D+=I,z+=4,a=z}return{earliestPresentationTime:o,timescale:f,version:l,referencesCount:N,references:p,moovEndOffset:w}}function S(E){for(var m=[],g=A(E,["moov","trak"]),w=0;w<g.length;w++){var y=g[w],p=A(y,["tkhd"])[0];if(p){var c=p.data[p.start],l=c===0?12:20,a=R(p,l),f=A(y,["mdia","mdhd"])[0];if(f){c=f.data[f.start],l=c===0?12:20;var o=R(f,l),v=A(y,["mdia","hdlr"])[0];if(v){var D=k(v.data.subarray(v.start+8,v.start+12)),N={soun:M.ElementaryStreamTypes.AUDIO,vide:M.ElementaryStreamTypes.VIDEO}[D];if(N){var W=A(y,["mdia","minf","stbl","stsd"])[0],z=void 0;W&&(z=k(W.data.subarray(W.start+12,W.start+16))),m[a]={timescale:o,type:N},m[N]={timescale:o,id:a,codec:z}}}}}}var F=A(E,["moov","mvex","trex"]);return F.forEach(function(I){var B=R(I,4),Y=m[B];Y&&(Y.default={duration:R(I,12),flags:R(I,20)})}),m}function _(E,m){return A(m,["moof","traf"]).reduce(function(g,w){var y=A(w,["tfdt"])[0],p=y.data[y.start],c=A(w,["tfhd"]).reduce(function(l,a){var f=R(a,4),o=E[f];if(o){var v=R(y,4);p===1&&(v*=Math.pow(2,32),v+=R(y,8));var D=o.timescale||9e4,N=v/D;if(isFinite(N)&&(l===null||N<l))return N}return l},null);return c!==null&&isFinite(c)&&(g===null||c<g)?c:g},null)||0}function b(E,m){for(var g=0,w=0,y=0,p=A(E,["moof","traf"]),c=0;c<p.length;c++){var l=p[c],a=A(l,["tfhd"])[0],f=R(a,4),o=m[f];if(!o)continue;var v=o.default,D=R(a,0)|(v==null?void 0:v.flags),N=v==null?void 0:v.duration;D&8&&(D&2?N=R(a,12):N=R(a,8));for(var W=o.timescale||9e4,z=A(l,["trun"]),F=0;F<z.length;F++){if(N){var I=R(z[F],4);g=N*I}else g=d(z[F]);o.type===M.ElementaryStreamTypes.VIDEO?w+=g/W:o.type===M.ElementaryStreamTypes.AUDIO&&(y+=g/W)}}if(w===0&&y===0){var B=O(E);if(B!=null&&B.references)return B.references.reduce(function(Y,Q){return Y+Q.info.duration||0},0)}return w||y}function d(E){var m=R(E,0),g=8;m&1&&(g+=4),m&4&&(g+=4);for(var w=0,y=R(E,4),p=0;p<y;p++){if(m&256){var c=R(E,g);w+=c,g+=4}m&512&&(g+=4),m&1024&&(g+=4),m&2048&&(g+=4)}return w}function s(E,m,g){A(m,["moof","traf"]).forEach(function(w){A(w,["tfhd"]).forEach(function(y){var p=R(y,4),c=E[p];if(!c)return;var l=c.timescale||9e4;A(w,["tfdt"]).forEach(function(a){var f=a.data[a.start],o=R(a,4);if(f===0)x(a,4,o-g*l);else{o*=Math.pow(2,32),o+=R(a,8),o-=g*l,o=Math.max(o,0);var v=Math.floor(o/(P+1)),D=Math.floor(o%(P+1));x(a,4,v),x(a,8,D)}})})})}function u(E){var m={valid:null,remainder:null},g=A(E,["moof"]);if(g){if(g.length<2)return m.remainder=E,m}else return m;var w=g[g.length-1];return m.valid=Object(K.sliceUint8)(E,0,w.start-8),m.remainder=Object(K.sliceUint8)(E,w.start-8),m}function h(E,m){var g=new Uint8Array(E.length+m.length);return g.set(E),g.set(m,E.length),g}},"./src/utils/output-filter.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return K});var K=function(){function M(j,k){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=j,this.trackName=k}var P=M.prototype;return P.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},P.newCue=function(k,C,R){(this.startTime===null||this.startTime>k)&&(this.startTime=k),this.endTime=C,this.screen=R,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},M}()},"./src/utils/texttrack-utils.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"sendAddTrackEvent",function(){return M}),L.d(V,"addCueToTrack",function(){return P}),L.d(V,"clearCurrentCues",function(){return j}),L.d(V,"removeCuesInRange",function(){return k}),L.d(V,"getCuesInRange",function(){return R});var K=L("./src/utils/logger.ts");function M(x,A){var O;try{O=new Event("addtrack")}catch(S){O=document.createEvent("Event"),O.initEvent("addtrack",!1,!1)}O.track=x,A.dispatchEvent(O)}function P(x,A){var O=x.mode;if(O==="disabled"&&(x.mode="hidden"),x.cues&&!x.cues.getCueById(A.id))try{if(x.addCue(A),!x.cues.getCueById(A.id))throw new Error("addCue is failed for: "+A)}catch(_){K.logger.debug("[texttrack-utils]: "+_);var S=new self.TextTrackCue(A.startTime,A.endTime,A.text);S.id=A.id,x.addCue(S)}O==="disabled"&&(x.mode=O)}function j(x){var A=x.mode;if(A==="disabled"&&(x.mode="hidden"),x.cues)for(var O=x.cues.length;O--;)x.removeCue(x.cues[O]);A==="disabled"&&(x.mode=A)}function k(x,A,O){var S=x.mode;if(S==="disabled"&&(x.mode="hidden"),x.cues&&x.cues.length>0)for(var _=R(x.cues,A,O),b=0;b<_.length;b++)x.removeCue(_[b]);S==="disabled"&&(x.mode=S)}function C(x,A){if(A<x[0].startTime)return 0;var O=x.length-1;if(A>x[O].endTime)return-1;for(var S=0,_=O;S<=_;){var b=Math.floor((_+S)/2);if(A<x[b].startTime)_=b-1;else if(A>x[b].startTime&&S<O)S=b+1;else return b}return x[S].startTime-A<A-x[_].startTime?S:_}function R(x,A,O){var S=[],_=C(x,A);if(_>-1)for(var b=_,d=x.length;b<d;b++){var s=x[b];if(s.startTime>=A&&s.endTime<=O)S.push(s);else if(s.startTime>O)return S}return S}},"./src/utils/time-ranges.ts":function(re,V,L){"use strict";L.r(V);var K={toString:function(P){for(var j="",k=P.length,C=0;C<k;C++)j+="["+P.start(C).toFixed(3)+","+P.end(C).toFixed(3)+"]";return j}};V.default=K},"./src/utils/timescale-conversion.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"toTimescaleFromBase",function(){return M}),L.d(V,"toTimescaleFromScale",function(){return P}),L.d(V,"toMsFromMpegTsClock",function(){return j}),L.d(V,"toMpegTsClockFromTimescale",function(){return k});var K=9e4;function M(C,R,x,A){x===void 0&&(x=1),A===void 0&&(A=!1);var O=C*R*x;return A?Math.round(O):O}function P(C,R,x,A){return x===void 0&&(x=1),A===void 0&&(A=!1),M(C,R,1/x,A)}function j(C,R){return R===void 0&&(R=!1),M(C,1e3,1/K,R)}function k(C,R){return R===void 0&&(R=1),M(C,K,1/R)}},"./src/utils/typed-array.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"sliceUint8",function(){return K});function K(M,P,j){return Uint8Array.prototype.slice?M.slice(P,j):new Uint8Array(Array.prototype.slice.call(M,P,j))}},"./src/utils/vttcue.ts":function(re,V,L){"use strict";L.r(V),V.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var K=["","lr","rl"],M=["start","middle","end","left","right"];function P(x,A){if(typeof A!="string")return!1;if(!Array.isArray(x))return!1;var O=A.toLowerCase();return~x.indexOf(O)?O:!1}function j(x){return P(K,x)}function k(x){return P(M,x)}function C(x){for(var A=arguments.length,O=new Array(A>1?A-1:0),S=1;S<A;S++)O[S-1]=arguments[S];for(var _=1;_<arguments.length;_++){var b=arguments[_];for(var d in b)x[d]=b[d]}return x}function R(x,A,O){var S=this,_={enumerable:!0};S.hasBeenReset=!1;var b="",d=!1,s=x,u=A,h=O,E=null,m="",g=!0,w="auto",y="start",p=50,c="middle",l=50,a="middle";Object.defineProperty(S,"id",C({},_,{get:function(){return b},set:function(o){b=""+o}})),Object.defineProperty(S,"pauseOnExit",C({},_,{get:function(){return d},set:function(o){d=!!o}})),Object.defineProperty(S,"startTime",C({},_,{get:function(){return s},set:function(o){if(typeof o!="number")throw new TypeError("Start time must be set to a number.");s=o,this.hasBeenReset=!0}})),Object.defineProperty(S,"endTime",C({},_,{get:function(){return u},set:function(o){if(typeof o!="number")throw new TypeError("End time must be set to a number.");u=o,this.hasBeenReset=!0}})),Object.defineProperty(S,"text",C({},_,{get:function(){return h},set:function(o){h=""+o,this.hasBeenReset=!0}})),Object.defineProperty(S,"region",C({},_,{get:function(){return E},set:function(o){E=o,this.hasBeenReset=!0}})),Object.defineProperty(S,"vertical",C({},_,{get:function(){return m},set:function(o){var v=j(o);if(v===!1)throw new SyntaxError("An invalid or illegal string was specified.");m=v,this.hasBeenReset=!0}})),Object.defineProperty(S,"snapToLines",C({},_,{get:function(){return g},set:function(o){g=!!o,this.hasBeenReset=!0}})),Object.defineProperty(S,"line",C({},_,{get:function(){return w},set:function(o){if(typeof o!="number"&&o!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");w=o,this.hasBeenReset=!0}})),Object.defineProperty(S,"lineAlign",C({},_,{get:function(){return y},set:function(o){var v=k(o);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");y=v,this.hasBeenReset=!0}})),Object.defineProperty(S,"position",C({},_,{get:function(){return p},set:function(o){if(o<0||o>100)throw new Error("Position must be between 0 and 100.");p=o,this.hasBeenReset=!0}})),Object.defineProperty(S,"positionAlign",C({},_,{get:function(){return c},set:function(o){var v=k(o);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");c=v,this.hasBeenReset=!0}})),Object.defineProperty(S,"size",C({},_,{get:function(){return l},set:function(o){if(o<0||o>100)throw new Error("Size must be between 0 and 100.");l=o,this.hasBeenReset=!0}})),Object.defineProperty(S,"align",C({},_,{get:function(){return a},set:function(o){var v=k(o);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");a=v,this.hasBeenReset=!0}})),S.displayState=void 0}return R.prototype.getCueAsHTML=function(){var x=self.WebVTT;return x.convertCueToDOMTree(self,this.text)},R}()},"./src/utils/vttparser.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"parseTimeStamp",function(){return P}),L.d(V,"fixLineBreaks",function(){return A}),L.d(V,"VTTParser",function(){return O});var K=L("./src/utils/vttcue.ts"),M=function(){function S(){}var _=S.prototype;return _.decode=function(d,s){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},S}();function P(S){function _(d,s,u,h){return(d|0)*3600+(s|0)*60+(u|0)+parseFloat(h||0)}var b=S.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return b?parseFloat(b[2])>59?_(b[2],b[3],0,b[4]):_(b[1],b[2],b[3],b[4]):null}var j=function(){function S(){this.values=Object.create(null)}var _=S.prototype;return _.set=function(d,s){!this.get(d)&&s!==""&&(this.values[d]=s)},_.get=function(d,s,u){return u?this.has(d)?this.values[d]:s[u]:this.has(d)?this.values[d]:s},_.has=function(d){return d in this.values},_.alt=function(d,s,u){for(var h=0;h<u.length;++h)if(s===u[h]){this.set(d,s);break}},_.integer=function(d,s){/^-?\d+$/.test(s)&&this.set(d,parseInt(s,10))},_.percent=function(d,s){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(s)){var u=parseFloat(s);if(u>=0&&u<=100)return this.set(d,u),!0}return!1},S}();function k(S,_,b,d){var s=d?S.split(d):[S];for(var u in s){if(typeof s[u]!="string")continue;var h=s[u].split(b);if(h.length!==2)continue;var E=h[0],m=h[1];_(E,m)}}var C=new K.default(0,0,""),R=C.align==="middle"?"middle":"center";function x(S,_,b){var d=S;function s(){var E=P(S);if(E===null)throw new Error("Malformed timestamp: "+d);return S=S.replace(/^[^\sa-zA-Z-]+/,""),E}function u(E,m){var g=new j;k(E,function(p,c){var l;switch(p){case"region":for(var a=b.length-1;a>=0;a--)if(b[a].id===c){g.set(p,b[a].region);break}break;case"vertical":g.alt(p,c,["rl","lr"]);break;case"line":l=c.split(","),g.integer(p,l[0]),g.percent(p,l[0])&&g.set("snapToLines",!1),g.alt(p,l[0],["auto"]),l.length===2&&g.alt("lineAlign",l[1],["start",R,"end"]);break;case"position":l=c.split(","),g.percent(p,l[0]),l.length===2&&g.alt("positionAlign",l[1],["start",R,"end","line-left","line-right","auto"]);break;case"size":g.percent(p,c);break;case"align":g.alt(p,c,["start",R,"end","left","right"]);break}},/:/,/\s/),m.region=g.get("region",null),m.vertical=g.get("vertical","");var w=g.get("line","auto");w==="auto"&&C.line===-1&&(w=-1),m.line=w,m.lineAlign=g.get("lineAlign","start"),m.snapToLines=g.get("snapToLines",!0),m.size=g.get("size",100),m.align=g.get("align",R);var y=g.get("position","auto");y==="auto"&&C.position===50&&(y=m.align==="start"||m.align==="left"?0:m.align==="end"||m.align==="right"?100:50),m.position=y}function h(){S=S.replace(/^\s+/,"")}if(h(),_.startTime=s(),h(),S.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);S=S.substr(3),h(),_.endTime=s(),h(),u(S,_)}function A(S){return S.replace(/<br(?: \/)?>/gi,`
|
|
`)}var O=function(){function S(){this.state="INITIAL",this.buffer="",this.decoder=new M,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var _=S.prototype;return _.parse=function(d){var s=this;d&&(s.buffer+=s.decoder.decode(d,{stream:!0}));function u(){var y=s.buffer,p=0;for(y=A(y);p<y.length&&y[p]!=="\r"&&y[p]!==`
|
|
`;)++p;var c=y.substr(0,p);return y[p]==="\r"&&++p,y[p]===`
|
|
`&&++p,s.buffer=y.substr(p),c}function h(y){k(y,function(p,c){},/:/)}try{var E="";if(s.state==="INITIAL"){if(!/\r\n|\n/.test(s.buffer))return this;E=u();var m=E.match(/^()?WEBVTT([ \t].*)?$/);if(!m||!m[0])throw new Error("Malformed WebVTT signature.");s.state="HEADER"}for(var g=!1;s.buffer;){if(!/\r\n|\n/.test(s.buffer))return this;g?g=!1:E=u();switch(s.state){case"HEADER":/:/.test(E)?h(E):E||(s.state="ID");continue;case"NOTE":E||(s.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(E)){s.state="NOTE";break}if(!E)continue;if(s.cue=new K.default(0,0,""),s.state="CUE",E.indexOf("-->")===-1){s.cue.id=E;continue}case"CUE":if(!s.cue){s.state="BADCUE";continue}try{x(E,s.cue,s.regionList)}catch(y){s.cue=null,s.state="BADCUE";continue}s.state="CUETEXT";continue;case"CUETEXT":{var w=E.indexOf("-->")!==-1;if(!E||w&&(g=!0)){s.oncue&&s.cue&&s.oncue(s.cue),s.cue=null,s.state="ID";continue}if(s.cue===null)continue;s.cue.text&&(s.cue.text+=`
|
|
`),s.cue.text+=E}continue;case"BADCUE":E||(s.state="ID")}}}catch(y){s.state==="CUETEXT"&&s.cue&&s.oncue&&s.oncue(s.cue),s.cue=null,s.state=s.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},_.flush=function(){var d=this;try{if((d.cue||d.state==="HEADER")&&(d.buffer+=`
|
|
|
|
`,d.parse()),d.state==="INITIAL"||d.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(s){d.onparsingerror&&d.onparsingerror(s)}return d.onflush&&d.onflush(),this},S}()},"./src/utils/webvtt-parser.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"generateCueId",function(){return O}),L.d(V,"parseWebVTT",function(){return _});var K=L("./src/polyfills/number.ts"),M=L("./src/utils/vttparser.ts"),P=L("./src/demux/id3.ts"),j=L("./src/utils/timescale-conversion.ts"),k=L("./src/remux/mp4-remuxer.ts"),C=/\r\n|\n\r|\n|\r/g,R=function(d,s,u){return u===void 0&&(u=0),d.substr(u,s.length)===s},x=function(d){var s=parseInt(d.substr(-3)),u=parseInt(d.substr(-6,2)),h=parseInt(d.substr(-9,2)),E=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(K.isFiniteNumber)(s)||!Object(K.isFiniteNumber)(u)||!Object(K.isFiniteNumber)(h)||!Object(K.isFiniteNumber)(E))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return s+=1e3*u,s+=60*1e3*h,s+=60*60*1e3*E,s},A=function(d){for(var s=5381,u=d.length;u;)s=s*33^d.charCodeAt(--u);return(s>>>0).toString()};function O(b,d,s){return A(b.toString())+A(d.toString())+A(s)}var S=function(d,s,u){var h=d[s],E=d[h.prevCC];if(!E||!E.new&&h.new){d.ccOffset=d.presentationOffset=h.start,h.new=!1;return}for(;(m=E)!==null&&m!==void 0&&m.new;){var m;d.ccOffset+=h.start-E.start,h.new=!1,h=E,E=d[h.prevCC]}d.presentationOffset=u};function _(b,d,s,u,h,E,m,g){var w=new M.VTTParser,y=Object(P.utf8ArrayToStr)(new Uint8Array(b)).trim().replace(C,`
|
|
`).split(`
|
|
`),p=[],c=Object(j.toMpegTsClockFromTimescale)(d,s),l="00:00.000",a=0,f=0,o,v=!0,D=!1;w.oncue=function(N){var W=u[h],z=u.ccOffset,F=(a-c)/9e4;if(W!=null&&W.new&&(f!==void 0?z=u.ccOffset=W.start:S(u,h,F)),F&&(z=F-u.presentationOffset),D){var I=N.endTime-N.startTime,B=Object(k.normalizePts)((N.startTime+z-f)*9e4,E*9e4)/9e4;N.startTime=B,N.endTime=B+I}var Y=N.text.trim();N.text=decodeURIComponent(encodeURIComponent(Y)),N.id||(N.id=O(N.startTime,N.endTime,Y)),N.endTime>0&&p.push(N)},w.onparsingerror=function(N){o=N},w.onflush=function(){if(o){g(o);return}m(p)},y.forEach(function(N){if(v)if(R(N,"X-TIMESTAMP-MAP=")){v=!1,D=!0,N.substr(16).split(",").forEach(function(W){R(W,"LOCAL:")?l=W.substr(6):R(W,"MPEGTS:")&&(a=parseInt(W.substr(7)))});try{f=x(l)/1e3}catch(W){D=!1,o=W}return}else N===""&&(v=!1);w.parse(N+`
|
|
`)}),w.flush()}},"./src/utils/xhr-loader.ts":function(re,V,L){"use strict";L.r(V);var K=L("./src/utils/logger.ts"),M=L("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,j=function(){function k(R){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=R?R.xhrSetup:null,this.stats=new M.LoadStats,this.retryDelay=0}var C=k.prototype;return C.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},C.abortInternal=function(){var x=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),x&&(x.onreadystatechange=null,x.onprogress=null,x.readyState!==4&&(this.stats.aborted=!0,x.abort()))},C.abort=function(){var x;this.abortInternal(),(x=this.callbacks)!==null&&x!==void 0&&x.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},C.load=function(x,A,O){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=x,this.config=A,this.callbacks=O,this.retryDelay=A.retryDelay,this.loadInternal()},C.loadInternal=function(){var x=this.config,A=this.context;if(!x)return;var O=this.loader=new self.XMLHttpRequest,S=this.stats;S.loading.first=0,S.loaded=0;var _=this.xhrSetup;try{if(_)try{_(O,A.url)}catch(s){O.open("GET",A.url,!0),_(O,A.url)}O.readyState||O.open("GET",A.url,!0);var b=this.context.headers;if(b)for(var d in b)O.setRequestHeader(d,b[d])}catch(s){this.callbacks.onError({code:O.status,text:s.message},A,O);return}A.rangeEnd&&O.setRequestHeader("Range","bytes="+A.rangeStart+"-"+(A.rangeEnd-1)),O.onreadystatechange=this.readystatechange.bind(this),O.onprogress=this.loadprogress.bind(this),O.responseType=A.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),x.timeout),O.send()},C.readystatechange=function(){var x=this.context,A=this.loader,O=this.stats;if(!x||!A)return;var S=A.readyState,_=this.config;if(O.aborted)return;if(S>=2)if(self.clearTimeout(this.requestTimeout),O.loading.first===0&&(O.loading.first=Math.max(self.performance.now(),O.loading.start)),S===4){A.onreadystatechange=null,A.onprogress=null;var b=A.status;if(b>=200&&b<300){O.loading.end=Math.max(self.performance.now(),O.loading.first);var d,s;if(x.responseType==="arraybuffer"?(d=A.response,s=d.byteLength):(d=A.responseText,s=d.length),O.loaded=O.total=s,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(O,x,d,A),!this.callbacks)return;var h={url:A.responseURL,data:d};this.callbacks.onSuccess(h,O,x,A)}else O.retry>=_.maxRetry||b>=400&&b<499?(K.logger.error(b+" while loading "+x.url),this.callbacks.onError({code:b,text:A.statusText},x,A)):(K.logger.warn(b+" while loading "+x.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,_.maxRetryDelay),O.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),_.timeout)},C.loadtimeout=function(){K.logger.warn("timeout while loading "+this.context.url);var x=this.callbacks;x&&(this.abortInternal(),x.onTimeout(this.stats,this.context,this.loader))},C.loadprogress=function(x){var A=this.stats;A.loaded=x.loaded,x.lengthComputable&&(A.total=x.total)},C.getCacheAge=function(){var x=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var A=this.loader.getResponseHeader("age");x=A?parseFloat(A):null}return x},k}();V.default=j}}).default})},vHTk:function(Rt,rt,Z){Rt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|